cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

libtool (348001B)


      1#! /bin/sh
      2# Generated automatically by config.status (guacamole-server) 1.5.4
      3# Libtool was configured on host snx-desktop:
      4# NOTE: Changes made to this file will be lost: look at ltmain.sh.
      5
      6# Provide generalized library-building support services.
      7# Written by Gordon Matzigkeit, 1996
      8
      9# Copyright (C) 2014 Free Software Foundation, Inc.
     10# This is free software; see the source for copying conditions.  There is NO
     11# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     12
     13# GNU Libtool is free software; you can redistribute it and/or modify
     14# it under the terms of the GNU General Public License as published by
     15# the Free Software Foundation; either version 2 of of the License, or
     16# (at your option) any later version.
     17#
     18# As a special exception to the GNU General Public License, if you
     19# distribute this file as part of a program or library that is built
     20# using GNU Libtool, you may include this file under the  same
     21# distribution terms that you use for the rest of that program.
     22#
     23# GNU Libtool is distributed in the hope that it will be useful, but
     24# WITHOUT ANY WARRANTY; without even the implied warranty of
     25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     26# GNU General Public License for more details.
     27#
     28# You should have received a copy of the GNU General Public License
     29# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     30
     31
     32# The names of the tagged configurations supported by this script.
     33available_tags=''
     34
     35# Configured defaults for sys_lib_dlsearch_path munging.
     36: ${LT_SYS_LIBRARY_PATH=""}
     37
     38# ### BEGIN LIBTOOL CONFIG
     39
     40# Which release of libtool.m4 was used?
     41macro_version=2.4.7
     42macro_revision=2.4.7
     43
     44# Whether or not to build shared libraries.
     45build_libtool_libs=yes
     46
     47# Whether or not to build static libraries.
     48build_old_libs=yes
     49
     50# What type of objects to build.
     51pic_mode=default
     52
     53# Whether or not to optimize for fast installation.
     54fast_install=needless
     55
     56# Shared archive member basename,for filename based shared library versioning on AIX.
     57shared_archive_member_spec=
     58
     59# Shell to use when invoking shell scripts.
     60SHELL="/bin/sh"
     61
     62# An echo program that protects backslashes.
     63ECHO="printf %s\\n"
     64
     65# The PATH separator for the build system.
     66PATH_SEPARATOR=":"
     67
     68# The host system.
     69host_alias=
     70host=x86_64-pc-linux-gnu
     71host_os=linux-gnu
     72
     73# The build system.
     74build_alias=
     75build=x86_64-pc-linux-gnu
     76build_os=linux-gnu
     77
     78# A sed program that does not truncate output.
     79SED="/usr/bin/sed"
     80
     81# Sed that helps us avoid accidentally triggering echo(1) options like -n.
     82Xsed="$SED -e 1s/^X//"
     83
     84# A grep program that handles long lines.
     85GREP="/usr/bin/grep"
     86
     87# An ERE matcher.
     88EGREP="/usr/bin/grep -E"
     89
     90# A literal string matcher.
     91FGREP="/usr/bin/grep -F"
     92
     93# A BSD- or MS-compatible name lister.
     94NM="/usr/bin/nm -B"
     95
     96# Whether we need soft or hard links.
     97LN_S="ln -s"
     98
     99# What is the maximum length of a command?
    100max_cmd_len=1572864
    101
    102# Object file suffix (normally "o").
    103objext=o
    104
    105# Executable file suffix (normally "").
    106exeext=
    107
    108# whether the shell understands "unset".
    109lt_unset=unset
    110
    111# turn spaces into newlines.
    112SP2NL="tr \\040 \\012"
    113
    114# turn newlines into spaces.
    115NL2SP="tr \\015\\012 \\040\\040"
    116
    117# convert $build file names to $host format.
    118to_host_file_cmd=func_convert_file_noop
    119
    120# convert $build files to toolchain format.
    121to_tool_file_cmd=func_convert_file_noop
    122
    123# A file(cmd) program that detects file types.
    124FILECMD="file"
    125
    126# An object symbol dumper.
    127OBJDUMP="objdump"
    128
    129# Method to check whether dependent libraries are shared objects.
    130deplibs_check_method="pass_all"
    131
    132# Command to use when deplibs_check_method = "file_magic".
    133file_magic_cmd="\$MAGIC_CMD"
    134
    135# How to find potential files when deplibs_check_method = "file_magic".
    136file_magic_glob=""
    137
    138# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
    139want_nocaseglob="no"
    140
    141# DLL creation program.
    142DLLTOOL="false"
    143
    144# Command to associate shared and link libraries.
    145sharedlib_from_linklib_cmd="printf %s\\n"
    146
    147# The archiver.
    148AR="ar"
    149
    150# Flags to create an archive (by configure).
    151lt_ar_flags=cr
    152
    153# Flags to create an archive.
    154AR_FLAGS=${ARFLAGS-"$lt_ar_flags"}
    155
    156# How to feed a file listing to the archiver.
    157archiver_list_spec="@"
    158
    159# A symbol stripping program.
    160STRIP="strip"
    161
    162# Commands used to install an old-style archive.
    163RANLIB="ranlib"
    164old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
    165old_postuninstall_cmds=""
    166
    167# Whether to use a lock for old archive extraction.
    168lock_old_archive_extraction=no
    169
    170# A C compiler.
    171LTCC="gcc"
    172
    173# LTCC compiler flags.
    174LTCFLAGS="-g -O2"
    175
    176# Take the output of nm and produce a listing of raw symbols and C names.
    177global_symbol_pipe="/usr/bin/sed -n -e 's/^.*[	 ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[	 ][	 ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | /usr/bin/sed '/ __gnu_lto/d'"
    178
    179# Transform the output of nm in a proper C declaration.
    180global_symbol_to_cdecl="/usr/bin/sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
    181
    182# Transform the output of nm into a list of symbols to manually relocate.
    183global_symbol_to_import=""
    184
    185# Transform the output of nm in a C name address pair.
    186global_symbol_to_c_name_address="/usr/bin/sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p'"
    187
    188# Transform the output of nm in a C name address pair when lib prefix is needed.
    189global_symbol_to_c_name_address_lib_prefix="/usr/bin/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'"
    190
    191# The name lister interface.
    192nm_interface="BSD nm"
    193
    194# Specify filename containing input files for $NM.
    195nm_file_list_spec="@"
    196
    197# The root where to search for dependent libraries,and where our libraries should be installed.
    198lt_sysroot=
    199
    200# Command to truncate a binary pipe.
    201lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
    202
    203# The name of the directory that contains temporary libtool files.
    204objdir=.libs
    205
    206# Used to examine libraries when file_magic_cmd begins with "file".
    207MAGIC_CMD=file
    208
    209# Must we lock files when doing compilation?
    210need_locks="no"
    211
    212# Manifest tool.
    213MANIFEST_TOOL=":"
    214
    215# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
    216DSYMUTIL=""
    217
    218# Tool to change global to local symbols on Mac OS X.
    219NMEDIT=""
    220
    221# Tool to manipulate fat objects and archives on Mac OS X.
    222LIPO=""
    223
    224# ldd/readelf like tool for Mach-O binaries on Mac OS X.
    225OTOOL=""
    226
    227# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
    228OTOOL64=""
    229
    230# Old archive suffix (normally "a").
    231libext=a
    232
    233# Shared library suffix (normally ".so").
    234shrext_cmds=".so"
    235
    236# The commands to extract the exported symbol list from a shared archive.
    237extract_expsyms_cmds=""
    238
    239# Variables whose values should be saved in libtool wrapper scripts and
    240# restored at link time.
    241variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
    242
    243# Do we need the "lib" prefix for modules?
    244need_lib_prefix=no
    245
    246# Do we need a version for libraries?
    247need_version=no
    248
    249# Library versioning type.
    250version_type=linux
    251
    252# Shared library runtime path variable.
    253runpath_var=LD_RUN_PATH
    254
    255# Shared library path variable.
    256shlibpath_var=LD_LIBRARY_PATH
    257
    258# Is shlibpath searched before the hard-coded library search path?
    259shlibpath_overrides_runpath=yes
    260
    261# Format of library name prefix.
    262libname_spec="lib\$name"
    263
    264# List of archive names.  First name is the real one, the rest are links.
    265# The last name is the one that the linker finds with -lNAME
    266library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
    267
    268# The coded name of the library, if different from the real name.
    269soname_spec="\$libname\$release\$shared_ext\$major"
    270
    271# Permission mode override for installation of shared libraries.
    272install_override_mode=""
    273
    274# Command to use after installation of a shared archive.
    275postinstall_cmds=""
    276
    277# Command to use after uninstallation of a shared archive.
    278postuninstall_cmds=""
    279
    280# Commands used to finish a libtool library installation in a directory.
    281finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
    282
    283# As "finish_cmds", except a single script fragment to be evaled but
    284# not shown.
    285finish_eval=""
    286
    287# Whether we should hardcode library paths into libraries.
    288hardcode_into_libs=yes
    289
    290# Compile-time system search path for libraries.
    291sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1 /usr/lib /lib "
    292
    293# Detected run-time system search path for libraries.
    294sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib/R/lib /usr/lib/libfakeroot/fakechroot/ /usr/lib32 /usr/lib/libfakeroot "
    295
    296# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
    297configure_time_lt_sys_library_path=""
    298
    299# Whether dlopen is supported.
    300dlopen_support=yes
    301
    302# Whether dlopen of programs is supported.
    303dlopen_self=yes
    304
    305# Whether dlopen of statically linked programs is supported.
    306dlopen_self_static=no
    307
    308# Commands to strip libraries.
    309old_striplib="strip --strip-debug"
    310striplib="strip --strip-unneeded"
    311
    312
    313# The linker used to build libraries.
    314LD="/usr/bin/ld -m elf_x86_64"
    315
    316# How to create reloadable object files.
    317reload_flag=" -r"
    318reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
    319
    320# Commands used to build an old-style archive.
    321old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
    322
    323# A language specific compiler.
    324CC="gcc"
    325
    326# Is the compiler the GNU compiler?
    327with_gcc=yes
    328
    329# Compiler flag to turn off builtin functions.
    330no_builtin_flag=" -fno-builtin"
    331
    332# Additional compiler flags for building library objects.
    333pic_flag=" -fPIC -DPIC"
    334
    335# How to pass a linker flag through the compiler.
    336wl="-Wl,"
    337
    338# Compiler flag to prevent dynamic linking.
    339link_static_flag="-static"
    340
    341# Does compiler simultaneously support -c and -o options?
    342compiler_c_o="yes"
    343
    344# Whether or not to add -lc for building shared libraries.
    345build_libtool_need_lc=no
    346
    347# Whether or not to disallow shared libs when runtime libs are static.
    348allow_libtool_libs_with_static_runtimes=no
    349
    350# Compiler flag to allow reflexive dlopens.
    351export_dynamic_flag_spec="\$wl--export-dynamic"
    352
    353# Compiler flag to generate shared objects directly from archives.
    354whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
    355
    356# Whether the compiler copes with passing no objects directly.
    357compiler_needs_object="no"
    358
    359# Create an old-style archive from a shared archive.
    360old_archive_from_new_cmds=""
    361
    362# Create a temporary old-style archive to link instead of a shared archive.
    363old_archive_from_expsyms_cmds=""
    364
    365# Commands used to build a shared archive.
    366archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
    367archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
    368            cat \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
    369            echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
    370            \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
    371
    372# Commands used to build a loadable module if different from building
    373# a shared archive.
    374module_cmds=""
    375module_expsym_cmds=""
    376
    377# Whether we are building with GNU ld or not.
    378with_gnu_ld="yes"
    379
    380# Flag that allows shared libraries with undefined symbols to be built.
    381allow_undefined_flag=""
    382
    383# Flag that enforces no undefined symbols.
    384no_undefined_flag=""
    385
    386# Flag to hardcode $libdir into a binary during linking.
    387# This must work even if $libdir does not exist
    388hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
    389
    390# Whether we need a single "-rpath" flag with a separated argument.
    391hardcode_libdir_separator=""
    392
    393# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
    394# DIR into the resulting binary.
    395hardcode_direct=no
    396
    397# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
    398# DIR into the resulting binary and the resulting library dependency is
    399# "absolute",i.e impossible to change by setting $shlibpath_var if the
    400# library is relocated.
    401hardcode_direct_absolute=no
    402
    403# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
    404# into the resulting binary.
    405hardcode_minus_L=no
    406
    407# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
    408# into the resulting binary.
    409hardcode_shlibpath_var=unsupported
    410
    411# Set to "yes" if building a shared library automatically hardcodes DIR
    412# into the library and all subsequent libraries and executables linked
    413# against it.
    414hardcode_automatic=no
    415
    416# Set to yes if linker adds runtime paths of dependent libraries
    417# to runtime path list.
    418inherit_rpath=no
    419
    420# Whether libtool must link a program against all its dependency libraries.
    421link_all_deplibs=unknown
    422
    423# Set to "yes" if exported symbols are required.
    424always_export_symbols=no
    425
    426# The commands to list exported symbols.
    427export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
    428
    429# Symbols that should not be listed in the preloaded symbols.
    430exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
    431
    432# Symbols that must always be exported.
    433include_expsyms=""
    434
    435# Commands necessary for linking programs (against libraries) with templates.
    436prelink_cmds=""
    437
    438# Commands necessary for finishing linking programs.
    439postlink_cmds=""
    440
    441# Specify filename containing input files.
    442file_list_spec=""
    443
    444# How to hardcode a shared library path into an executable.
    445hardcode_action=immediate
    446
    447# ### END LIBTOOL CONFIG
    448
    449
    450# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
    451
    452# func_munge_path_list VARIABLE PATH
    453# -----------------------------------
    454# VARIABLE is name of variable containing _space_ separated list of
    455# directories to be munged by the contents of PATH, which is string
    456# having a format:
    457# "DIR[:DIR]:"
    458#       string "DIR[ DIR]" will be prepended to VARIABLE
    459# ":DIR[:DIR]"
    460#       string "DIR[ DIR]" will be appended to VARIABLE
    461# "DIRP[:DIRP]::[DIRA:]DIRA"
    462#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
    463#       "DIRA[ DIRA]" will be appended to VARIABLE
    464# "DIR[:DIR]"
    465#       VARIABLE will be replaced by "DIR[ DIR]"
    466func_munge_path_list ()
    467{
    468    case x$2 in
    469    x)
    470        ;;
    471    *:)
    472        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
    473        ;;
    474    x:*)
    475        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
    476        ;;
    477    *::*)
    478        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
    479        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
    480        ;;
    481    *)
    482        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
    483        ;;
    484    esac
    485}
    486
    487
    488# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
    489func_cc_basename ()
    490{
    491    for cc_temp in $*""; do
    492      case $cc_temp in
    493        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
    494        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
    495        \-*) ;;
    496        *) break;;
    497      esac
    498    done
    499    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
    500}
    501
    502
    503# ### END FUNCTIONS SHARED WITH CONFIGURE
    504
    505#! /usr/bin/env sh
    506## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
    507##               by inline-source v2019-02-19.15
    508
    509# libtool (GNU libtool) 2.4.7
    510# Provide generalized library-building support services.
    511# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    512
    513# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc.
    514# This is free software; see the source for copying conditions.  There is NO
    515# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    516
    517# GNU Libtool is free software; you can redistribute it and/or modify
    518# it under the terms of the GNU General Public License as published by
    519# the Free Software Foundation; either version 2 of the License, or
    520# (at your option) any later version.
    521#
    522# As a special exception to the GNU General Public License,
    523# if you distribute this file as part of a program or library that
    524# is built using GNU Libtool, you may include this file under the
    525# same distribution terms that you use for the rest of that program.
    526#
    527# GNU Libtool is distributed in the hope that it will be useful, but
    528# WITHOUT ANY WARRANTY; without even the implied warranty of
    529# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    530# General Public License for more details.
    531#
    532# You should have received a copy of the GNU General Public License
    533# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    534
    535
    536PROGRAM=libtool
    537PACKAGE=libtool
    538VERSION=2.4.7
    539package_revision=2.4.7
    540
    541
    542## ------ ##
    543## Usage. ##
    544## ------ ##
    545
    546# Run './libtool --help' for help with using this script from the
    547# command line.
    548
    549
    550## ------------------------------- ##
    551## User overridable command paths. ##
    552## ------------------------------- ##
    553
    554# After configure completes, it has a better idea of some of the
    555# shell tools we need than the defaults used by the functions shared
    556# with bootstrap, so set those here where they can still be over-
    557# ridden by the user, but otherwise take precedence.
    558
    559: ${AUTOCONF="autoconf"}
    560: ${AUTOMAKE="automake"}
    561
    562
    563## -------------------------- ##
    564## Source external libraries. ##
    565## -------------------------- ##
    566
    567# Much of our low-level functionality needs to be sourced from external
    568# libraries, which are installed to $pkgauxdir.
    569
    570# Set a version string for this script.
    571scriptversion=2019-02-19.15; # UTC
    572
    573# General shell script boiler plate, and helper functions.
    574# Written by Gary V. Vaughan, 2004
    575
    576# This is free software.  There is NO warranty; not even for
    577# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    578#
    579# Copyright (C) 2004-2019, 2021 Bootstrap Authors
    580#
    581# This file is dual licensed under the terms of the MIT license
    582# <https://opensource.org/license/MIT>, and GPL version 2 or later
    583# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
    584# these licenses when using or redistributing this software or any of
    585# the files within it.  See the URLs above, or the file `LICENSE`
    586# included in the Bootstrap distribution for the full license texts.
    587
    588# Please report bugs or propose patches to:
    589# <https://github.com/gnulib-modules/bootstrap/issues>
    590
    591
    592## ------ ##
    593## Usage. ##
    594## ------ ##
    595
    596# Evaluate this file near the top of your script to gain access to
    597# the functions and variables defined here:
    598#
    599#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
    600#
    601# If you need to override any of the default environment variable
    602# settings, do that before evaluating this file.
    603
    604
    605## -------------------- ##
    606## Shell normalisation. ##
    607## -------------------- ##
    608
    609# Some shells need a little help to be as Bourne compatible as possible.
    610# Before doing anything else, make sure all that help has been provided!
    611
    612DUALCASE=1; export DUALCASE # for MKS sh
    613if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
    614  emulate sh
    615  NULLCMD=:
    616  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
    617  # is contrary to our usage.  Disable this feature.
    618  alias -g '${1+"$@"}'='"$@"'
    619  setopt NO_GLOB_SUBST
    620else
    621  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
    622fi
    623
    624# NLS nuisances: We save the old values in case they are required later.
    625_G_user_locale=
    626_G_safe_locale=
    627for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
    628do
    629  eval "if test set = \"\${$_G_var+set}\"; then
    630          save_$_G_var=\$$_G_var
    631          $_G_var=C
    632	  export $_G_var
    633	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
    634	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
    635	fi"
    636done
    637# These NLS vars are set unconditionally (bootstrap issue #24).  Unset those
    638# in case the environment reset is needed later and the $save_* variant is not
    639# defined (see the code above).
    640LC_ALL=C
    641LANGUAGE=C
    642export LANGUAGE LC_ALL
    643
    644# Make sure IFS has a sensible default
    645sp=' '
    646nl='
    647'
    648IFS="$sp	$nl"
    649
    650# There are apparently some retarded systems that use ';' as a PATH separator!
    651if test "${PATH_SEPARATOR+set}" != set; then
    652  PATH_SEPARATOR=:
    653  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    654    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
    655      PATH_SEPARATOR=';'
    656  }
    657fi
    658
    659
    660# func_unset VAR
    661# --------------
    662# Portably unset VAR.
    663# In some shells, an 'unset VAR' statement leaves a non-zero return
    664# status if VAR is already unset, which might be problematic if the
    665# statement is used at the end of a function (thus poisoning its return
    666# value) or when 'set -e' is active (causing even a spurious abort of
    667# the script in this case).
    668func_unset ()
    669{
    670    { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
    671}
    672
    673
    674# Make sure CDPATH doesn't cause `cd` commands to output the target dir.
    675func_unset CDPATH
    676
    677# Make sure ${,E,F}GREP behave sanely.
    678func_unset GREP_OPTIONS
    679
    680
    681## ------------------------- ##
    682## Locate command utilities. ##
    683## ------------------------- ##
    684
    685
    686# func_executable_p FILE
    687# ----------------------
    688# Check that FILE is an executable regular file.
    689func_executable_p ()
    690{
    691    test -f "$1" && test -x "$1"
    692}
    693
    694
    695# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
    696# --------------------------------------------
    697# Search for either a program that responds to --version with output
    698# containing "GNU", or else returned by CHECK_FUNC otherwise, by
    699# trying all the directories in PATH with each of the elements of
    700# PROGS_LIST.
    701#
    702# CHECK_FUNC should accept the path to a candidate program, and
    703# set $func_check_prog_result if it truncates its output less than
    704# $_G_path_prog_max characters.
    705func_path_progs ()
    706{
    707    _G_progs_list=$1
    708    _G_check_func=$2
    709    _G_PATH=${3-"$PATH"}
    710
    711    _G_path_prog_max=0
    712    _G_path_prog_found=false
    713    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
    714    for _G_dir in $_G_PATH; do
    715      IFS=$_G_save_IFS
    716      test -z "$_G_dir" && _G_dir=.
    717      for _G_prog_name in $_G_progs_list; do
    718        for _exeext in '' .EXE; do
    719          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
    720          func_executable_p "$_G_path_prog" || continue
    721          case `"$_G_path_prog" --version 2>&1` in
    722            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
    723            *)     $_G_check_func $_G_path_prog
    724		   func_path_progs_result=$func_check_prog_result
    725		   ;;
    726          esac
    727          $_G_path_prog_found && break 3
    728        done
    729      done
    730    done
    731    IFS=$_G_save_IFS
    732    test -z "$func_path_progs_result" && {
    733      echo "no acceptable sed could be found in \$PATH" >&2
    734      exit 1
    735    }
    736}
    737
    738
    739# We want to be able to use the functions in this file before configure
    740# has figured out where the best binaries are kept, which means we have
    741# to search for them ourselves - except when the results are already set
    742# where we skip the searches.
    743
    744# Unless the user overrides by setting SED, search the path for either GNU
    745# sed, or the sed that truncates its output the least.
    746test -z "$SED" && {
    747  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
    748  for _G_i in 1 2 3 4 5 6 7; do
    749    _G_sed_script=$_G_sed_script$nl$_G_sed_script
    750  done
    751  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
    752  _G_sed_script=
    753
    754  func_check_prog_sed ()
    755  {
    756    _G_path_prog=$1
    757
    758    _G_count=0
    759    printf 0123456789 >conftest.in
    760    while :
    761    do
    762      cat conftest.in conftest.in >conftest.tmp
    763      mv conftest.tmp conftest.in
    764      cp conftest.in conftest.nl
    765      echo '' >> conftest.nl
    766      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
    767      diff conftest.out conftest.nl >/dev/null 2>&1 || break
    768      _G_count=`expr $_G_count + 1`
    769      if test "$_G_count" -gt "$_G_path_prog_max"; then
    770        # Best one so far, save it but keep looking for a better one
    771        func_check_prog_result=$_G_path_prog
    772        _G_path_prog_max=$_G_count
    773      fi
    774      # 10*(2^10) chars as input seems more than enough
    775      test 10 -lt "$_G_count" && break
    776    done
    777    rm -f conftest.in conftest.tmp conftest.nl conftest.out
    778  }
    779
    780  func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
    781  rm -f conftest.sed
    782  SED=$func_path_progs_result
    783}
    784
    785
    786# Unless the user overrides by setting GREP, search the path for either GNU
    787# grep, or the grep that truncates its output the least.
    788test -z "$GREP" && {
    789  func_check_prog_grep ()
    790  {
    791    _G_path_prog=$1
    792
    793    _G_count=0
    794    _G_path_prog_max=0
    795    printf 0123456789 >conftest.in
    796    while :
    797    do
    798      cat conftest.in conftest.in >conftest.tmp
    799      mv conftest.tmp conftest.in
    800      cp conftest.in conftest.nl
    801      echo 'GREP' >> conftest.nl
    802      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
    803      diff conftest.out conftest.nl >/dev/null 2>&1 || break
    804      _G_count=`expr $_G_count + 1`
    805      if test "$_G_count" -gt "$_G_path_prog_max"; then
    806        # Best one so far, save it but keep looking for a better one
    807        func_check_prog_result=$_G_path_prog
    808        _G_path_prog_max=$_G_count
    809      fi
    810      # 10*(2^10) chars as input seems more than enough
    811      test 10 -lt "$_G_count" && break
    812    done
    813    rm -f conftest.in conftest.tmp conftest.nl conftest.out
    814  }
    815
    816  func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
    817  GREP=$func_path_progs_result
    818}
    819
    820
    821## ------------------------------- ##
    822## User overridable command paths. ##
    823## ------------------------------- ##
    824
    825# All uppercase variable names are used for environment variables.  These
    826# variables can be overridden by the user before calling a script that
    827# uses them if a suitable command of that name is not already available
    828# in the command search PATH.
    829
    830: ${CP="cp -f"}
    831: ${ECHO="printf %s\n"}
    832: ${EGREP="$GREP -E"}
    833: ${FGREP="$GREP -F"}
    834: ${LN_S="ln -s"}
    835: ${MAKE="make"}
    836: ${MKDIR="mkdir"}
    837: ${MV="mv -f"}
    838: ${RM="rm -f"}
    839: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
    840
    841
    842## -------------------- ##
    843## Useful sed snippets. ##
    844## -------------------- ##
    845
    846sed_dirname='s|/[^/]*$||'
    847sed_basename='s|^.*/||'
    848
    849# Sed substitution that helps us do robust quoting.  It backslashifies
    850# metacharacters that are still active within double-quoted strings.
    851sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
    852
    853# Same as above, but do not quote variable references.
    854sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
    855
    856# Sed substitution that turns a string into a regex matching for the
    857# string literally.
    858sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
    859
    860# Sed substitution that converts a w32 file name or path
    861# that contains forward slashes, into one that contains
    862# (escaped) backslashes.  A very naive implementation.
    863sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
    864
    865# Re-'\' parameter expansions in output of sed_double_quote_subst that
    866# were '\'-ed in input to the same.  If an odd number of '\' preceded a
    867# '$' in input to sed_double_quote_subst, that '$' was protected from
    868# expansion.  Since each input '\' is now two '\'s, look for any number
    869# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
    870_G_bs='\\'
    871_G_bs2='\\\\'
    872_G_bs4='\\\\\\\\'
    873_G_dollar='\$'
    874sed_double_backslash="\
    875  s/$_G_bs4/&\\
    876/g
    877  s/^$_G_bs2$_G_dollar/$_G_bs&/
    878  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
    879  s/\n//g"
    880
    881# require_check_ifs_backslash
    882# ---------------------------
    883# Check if we can use backslash as IFS='\' separator, and set
    884# $check_ifs_backshlash_broken to ':' or 'false'.
    885require_check_ifs_backslash=func_require_check_ifs_backslash
    886func_require_check_ifs_backslash ()
    887{
    888  _G_save_IFS=$IFS
    889  IFS='\'
    890  _G_check_ifs_backshlash='a\\b'
    891  for _G_i in $_G_check_ifs_backshlash
    892  do
    893  case $_G_i in
    894  a)
    895    check_ifs_backshlash_broken=false
    896    ;;
    897  '')
    898    break
    899    ;;
    900  *)
    901    check_ifs_backshlash_broken=:
    902    break
    903    ;;
    904  esac
    905  done
    906  IFS=$_G_save_IFS
    907  require_check_ifs_backslash=:
    908}
    909
    910
    911## ----------------- ##
    912## Global variables. ##
    913## ----------------- ##
    914
    915# Except for the global variables explicitly listed below, the following
    916# functions in the '^func_' namespace, and the '^require_' namespace
    917# variables initialised in the 'Resource management' section, sourcing
    918# this file will not pollute your global namespace with anything
    919# else. There's no portable way to scope variables in Bourne shell
    920# though, so actually running these functions will sometimes place
    921# results into a variable named after the function, and often use
    922# temporary variables in the '^_G_' namespace. If you are careful to
    923# avoid using those namespaces casually in your sourcing script, things
    924# should continue to work as you expect. And, of course, you can freely
    925# overwrite any of the functions or variables defined here before
    926# calling anything to customize them.
    927
    928EXIT_SUCCESS=0
    929EXIT_FAILURE=1
    930EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
    931EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
    932
    933# Allow overriding, eg assuming that you follow the convention of
    934# putting '$debug_cmd' at the start of all your functions, you can get
    935# bash to show function call trace with:
    936#
    937#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
    938debug_cmd=${debug_cmd-":"}
    939exit_cmd=:
    940
    941# By convention, finish your script with:
    942#
    943#    exit $exit_status
    944#
    945# so that you can set exit_status to non-zero if you want to indicate
    946# something went wrong during execution without actually bailing out at
    947# the point of failure.
    948exit_status=$EXIT_SUCCESS
    949
    950# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
    951# is ksh but when the shell is invoked as "sh" and the current value of
    952# the _XPG environment variable is not equal to 1 (one), the special
    953# positional parameter $0, within a function call, is the name of the
    954# function.
    955progpath=$0
    956
    957# The name of this program.
    958progname=`$ECHO "$progpath" |$SED "$sed_basename"`
    959
    960# Make sure we have an absolute progpath for reexecution:
    961case $progpath in
    962  [\\/]*|[A-Za-z]:\\*) ;;
    963  *[\\/]*)
    964     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
    965     progdir=`cd "$progdir" && pwd`
    966     progpath=$progdir/$progname
    967     ;;
    968  *)
    969     _G_IFS=$IFS
    970     IFS=${PATH_SEPARATOR-:}
    971     for progdir in $PATH; do
    972       IFS=$_G_IFS
    973       test -x "$progdir/$progname" && break
    974     done
    975     IFS=$_G_IFS
    976     test -n "$progdir" || progdir=`pwd`
    977     progpath=$progdir/$progname
    978     ;;
    979esac
    980
    981
    982## ----------------- ##
    983## Standard options. ##
    984## ----------------- ##
    985
    986# The following options affect the operation of the functions defined
    987# below, and should be set appropriately depending on run-time para-
    988# meters passed on the command line.
    989
    990opt_dry_run=false
    991opt_quiet=false
    992opt_verbose=false
    993
    994# Categories 'all' and 'none' are always available.  Append any others
    995# you will pass as the first argument to func_warning from your own
    996# code.
    997warning_categories=
    998
    999# By default, display warnings according to 'opt_warning_types'.  Set
   1000# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
   1001# treat the next displayed warning as a fatal error.
   1002warning_func=func_warn_and_continue
   1003
   1004# Set to 'all' to display all warnings, 'none' to suppress all
   1005# warnings, or a space delimited list of some subset of
   1006# 'warning_categories' to display only the listed warnings.
   1007opt_warning_types=all
   1008
   1009
   1010## -------------------- ##
   1011## Resource management. ##
   1012## -------------------- ##
   1013
   1014# This section contains definitions for functions that each ensure a
   1015# particular resource (a file, or a non-empty configuration variable for
   1016# example) is available, and if appropriate to extract default values
   1017# from pertinent package files. Call them using their associated
   1018# 'require_*' variable to ensure that they are executed, at most, once.
   1019#
   1020# It's entirely deliberate that calling these functions can set
   1021# variables that don't obey the namespace limitations obeyed by the rest
   1022# of this file, in order that that they be as useful as possible to
   1023# callers.
   1024
   1025
   1026# require_term_colors
   1027# -------------------
   1028# Allow display of bold text on terminals that support it.
   1029require_term_colors=func_require_term_colors
   1030func_require_term_colors ()
   1031{
   1032    $debug_cmd
   1033
   1034    test -t 1 && {
   1035      # COLORTERM and USE_ANSI_COLORS environment variables take
   1036      # precedence, because most terminfo databases neglect to describe
   1037      # whether color sequences are supported.
   1038      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
   1039
   1040      if test 1 = "$USE_ANSI_COLORS"; then
   1041        # Standard ANSI escape sequences
   1042        tc_reset=''
   1043        tc_bold='';   tc_standout=''
   1044        tc_red='';   tc_green=''
   1045        tc_blue='';  tc_cyan=''
   1046      else
   1047        # Otherwise trust the terminfo database after all.
   1048        test -n "`tput sgr0 2>/dev/null`" && {
   1049          tc_reset=`tput sgr0`
   1050          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
   1051          tc_standout=$tc_bold
   1052          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
   1053          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
   1054          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
   1055          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
   1056          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
   1057        }
   1058      fi
   1059    }
   1060
   1061    require_term_colors=:
   1062}
   1063
   1064
   1065## ----------------- ##
   1066## Function library. ##
   1067## ----------------- ##
   1068
   1069# This section contains a variety of useful functions to call in your
   1070# scripts. Take note of the portable wrappers for features provided by
   1071# some modern shells, which will fall back to slower equivalents on
   1072# less featureful shells.
   1073
   1074
   1075# func_append VAR VALUE
   1076# ---------------------
   1077# Append VALUE onto the existing contents of VAR.
   1078
   1079  # We should try to minimise forks, especially on Windows where they are
   1080  # unreasonably slow, so skip the feature probes when bash or zsh are
   1081  # being used:
   1082  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
   1083    : ${_G_HAVE_ARITH_OP="yes"}
   1084    : ${_G_HAVE_XSI_OPS="yes"}
   1085    # The += operator was introduced in bash 3.1
   1086    case $BASH_VERSION in
   1087      [12].* | 3.0 | 3.0*) ;;
   1088      *)
   1089        : ${_G_HAVE_PLUSEQ_OP="yes"}
   1090        ;;
   1091    esac
   1092  fi
   1093
   1094  # _G_HAVE_PLUSEQ_OP
   1095  # Can be empty, in which case the shell is probed, "yes" if += is
   1096  # useable or anything else if it does not work.
   1097  test -z "$_G_HAVE_PLUSEQ_OP" \
   1098    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
   1099    && _G_HAVE_PLUSEQ_OP=yes
   1100
   1101if test yes = "$_G_HAVE_PLUSEQ_OP"
   1102then
   1103  # This is an XSI compatible shell, allowing a faster implementation...
   1104  eval 'func_append ()
   1105  {
   1106    $debug_cmd
   1107
   1108    eval "$1+=\$2"
   1109  }'
   1110else
   1111  # ...otherwise fall back to using expr, which is often a shell builtin.
   1112  func_append ()
   1113  {
   1114    $debug_cmd
   1115
   1116    eval "$1=\$$1\$2"
   1117  }
   1118fi
   1119
   1120
   1121# func_append_quoted VAR VALUE
   1122# ----------------------------
   1123# Quote VALUE and append to the end of shell variable VAR, separated
   1124# by a space.
   1125if test yes = "$_G_HAVE_PLUSEQ_OP"; then
   1126  eval 'func_append_quoted ()
   1127  {
   1128    $debug_cmd
   1129
   1130    func_quote_arg pretty "$2"
   1131    eval "$1+=\\ \$func_quote_arg_result"
   1132  }'
   1133else
   1134  func_append_quoted ()
   1135  {
   1136    $debug_cmd
   1137
   1138    func_quote_arg pretty "$2"
   1139    eval "$1=\$$1\\ \$func_quote_arg_result"
   1140  }
   1141fi
   1142
   1143
   1144# func_append_uniq VAR VALUE
   1145# --------------------------
   1146# Append unique VALUE onto the existing contents of VAR, assuming
   1147# entries are delimited by the first character of VALUE.  For example:
   1148#
   1149#   func_append_uniq options " --another-option option-argument"
   1150#
   1151# will only append to $options if " --another-option option-argument "
   1152# is not already present somewhere in $options already (note spaces at
   1153# each end implied by leading space in second argument).
   1154func_append_uniq ()
   1155{
   1156    $debug_cmd
   1157
   1158    eval _G_current_value='`$ECHO $'$1'`'
   1159    _G_delim=`expr "$2" : '\(.\)'`
   1160
   1161    case $_G_delim$_G_current_value$_G_delim in
   1162      *"$2$_G_delim"*) ;;
   1163      *) func_append "$@" ;;
   1164    esac
   1165}
   1166
   1167
   1168# func_arith TERM...
   1169# ------------------
   1170# Set func_arith_result to the result of evaluating TERMs.
   1171  test -z "$_G_HAVE_ARITH_OP" \
   1172    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
   1173    && _G_HAVE_ARITH_OP=yes
   1174
   1175if test yes = "$_G_HAVE_ARITH_OP"; then
   1176  eval 'func_arith ()
   1177  {
   1178    $debug_cmd
   1179
   1180    func_arith_result=$(( $* ))
   1181  }'
   1182else
   1183  func_arith ()
   1184  {
   1185    $debug_cmd
   1186
   1187    func_arith_result=`expr "$@"`
   1188  }
   1189fi
   1190
   1191
   1192# func_basename FILE
   1193# ------------------
   1194# Set func_basename_result to FILE with everything up to and including
   1195# the last / stripped.
   1196if test yes = "$_G_HAVE_XSI_OPS"; then
   1197  # If this shell supports suffix pattern removal, then use it to avoid
   1198  # forking. Hide the definitions single quotes in case the shell chokes
   1199  # on unsupported syntax...
   1200  _b='func_basename_result=${1##*/}'
   1201  _d='case $1 in
   1202        */*) func_dirname_result=${1%/*}$2 ;;
   1203        *  ) func_dirname_result=$3        ;;
   1204      esac'
   1205
   1206else
   1207  # ...otherwise fall back to using sed.
   1208  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
   1209  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
   1210      if test "X$func_dirname_result" = "X$1"; then
   1211        func_dirname_result=$3
   1212      else
   1213        func_append func_dirname_result "$2"
   1214      fi'
   1215fi
   1216
   1217eval 'func_basename ()
   1218{
   1219    $debug_cmd
   1220
   1221    '"$_b"'
   1222}'
   1223
   1224
   1225# func_dirname FILE APPEND NONDIR_REPLACEMENT
   1226# -------------------------------------------
   1227# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
   1228# otherwise set result to NONDIR_REPLACEMENT.
   1229eval 'func_dirname ()
   1230{
   1231    $debug_cmd
   1232
   1233    '"$_d"'
   1234}'
   1235
   1236
   1237# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
   1238# --------------------------------------------------------
   1239# Perform func_basename and func_dirname in a single function
   1240# call:
   1241#   dirname:  Compute the dirname of FILE.  If nonempty,
   1242#             add APPEND to the result, otherwise set result
   1243#             to NONDIR_REPLACEMENT.
   1244#             value returned in "$func_dirname_result"
   1245#   basename: Compute filename of FILE.
   1246#             value retuned in "$func_basename_result"
   1247# For efficiency, we do not delegate to the functions above but instead
   1248# duplicate the functionality here.
   1249eval 'func_dirname_and_basename ()
   1250{
   1251    $debug_cmd
   1252
   1253    '"$_b"'
   1254    '"$_d"'
   1255}'
   1256
   1257
   1258# func_echo ARG...
   1259# ----------------
   1260# Echo program name prefixed message.
   1261func_echo ()
   1262{
   1263    $debug_cmd
   1264
   1265    _G_message=$*
   1266
   1267    func_echo_IFS=$IFS
   1268    IFS=$nl
   1269    for _G_line in $_G_message; do
   1270      IFS=$func_echo_IFS
   1271      $ECHO "$progname: $_G_line"
   1272    done
   1273    IFS=$func_echo_IFS
   1274}
   1275
   1276
   1277# func_echo_all ARG...
   1278# --------------------
   1279# Invoke $ECHO with all args, space-separated.
   1280func_echo_all ()
   1281{
   1282    $ECHO "$*"
   1283}
   1284
   1285
   1286# func_echo_infix_1 INFIX ARG...
   1287# ------------------------------
   1288# Echo program name, followed by INFIX on the first line, with any
   1289# additional lines not showing INFIX.
   1290func_echo_infix_1 ()
   1291{
   1292    $debug_cmd
   1293
   1294    $require_term_colors
   1295
   1296    _G_infix=$1; shift
   1297    _G_indent=$_G_infix
   1298    _G_prefix="$progname: $_G_infix: "
   1299    _G_message=$*
   1300
   1301    # Strip color escape sequences before counting printable length
   1302    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
   1303    do
   1304      test -n "$_G_tc" && {
   1305        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
   1306        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
   1307      }
   1308    done
   1309    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
   1310
   1311    func_echo_infix_1_IFS=$IFS
   1312    IFS=$nl
   1313    for _G_line in $_G_message; do
   1314      IFS=$func_echo_infix_1_IFS
   1315      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
   1316      _G_prefix=$_G_indent
   1317    done
   1318    IFS=$func_echo_infix_1_IFS
   1319}
   1320
   1321
   1322# func_error ARG...
   1323# -----------------
   1324# Echo program name prefixed message to standard error.
   1325func_error ()
   1326{
   1327    $debug_cmd
   1328
   1329    $require_term_colors
   1330
   1331    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
   1332}
   1333
   1334
   1335# func_fatal_error ARG...
   1336# -----------------------
   1337# Echo program name prefixed message to standard error, and exit.
   1338func_fatal_error ()
   1339{
   1340    $debug_cmd
   1341
   1342    func_error "$*"
   1343    exit $EXIT_FAILURE
   1344}
   1345
   1346
   1347# func_grep EXPRESSION FILENAME
   1348# -----------------------------
   1349# Check whether EXPRESSION matches any line of FILENAME, without output.
   1350func_grep ()
   1351{
   1352    $debug_cmd
   1353
   1354    $GREP "$1" "$2" >/dev/null 2>&1
   1355}
   1356
   1357
   1358# func_len STRING
   1359# ---------------
   1360# Set func_len_result to the length of STRING. STRING may not
   1361# start with a hyphen.
   1362  test -z "$_G_HAVE_XSI_OPS" \
   1363    && (eval 'x=a/b/c;
   1364      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
   1365    && _G_HAVE_XSI_OPS=yes
   1366
   1367if test yes = "$_G_HAVE_XSI_OPS"; then
   1368  eval 'func_len ()
   1369  {
   1370    $debug_cmd
   1371
   1372    func_len_result=${#1}
   1373  }'
   1374else
   1375  func_len ()
   1376  {
   1377    $debug_cmd
   1378
   1379    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
   1380  }
   1381fi
   1382
   1383
   1384# func_mkdir_p DIRECTORY-PATH
   1385# ---------------------------
   1386# Make sure the entire path to DIRECTORY-PATH is available.
   1387func_mkdir_p ()
   1388{
   1389    $debug_cmd
   1390
   1391    _G_directory_path=$1
   1392    _G_dir_list=
   1393
   1394    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
   1395
   1396      # Protect directory names starting with '-'
   1397      case $_G_directory_path in
   1398        -*) _G_directory_path=./$_G_directory_path ;;
   1399      esac
   1400
   1401      # While some portion of DIR does not yet exist...
   1402      while test ! -d "$_G_directory_path"; do
   1403        # ...make a list in topmost first order.  Use a colon delimited
   1404	# list incase some portion of path contains whitespace.
   1405        _G_dir_list=$_G_directory_path:$_G_dir_list
   1406
   1407        # If the last portion added has no slash in it, the list is done
   1408        case $_G_directory_path in */*) ;; *) break ;; esac
   1409
   1410        # ...otherwise throw away the child directory and loop
   1411        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
   1412      done
   1413      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
   1414
   1415      func_mkdir_p_IFS=$IFS; IFS=:
   1416      for _G_dir in $_G_dir_list; do
   1417	IFS=$func_mkdir_p_IFS
   1418        # mkdir can fail with a 'File exist' error if two processes
   1419        # try to create one of the directories concurrently.  Don't
   1420        # stop in that case!
   1421        $MKDIR "$_G_dir" 2>/dev/null || :
   1422      done
   1423      IFS=$func_mkdir_p_IFS
   1424
   1425      # Bail out if we (or some other process) failed to create a directory.
   1426      test -d "$_G_directory_path" || \
   1427        func_fatal_error "Failed to create '$1'"
   1428    fi
   1429}
   1430
   1431
   1432# func_mktempdir [BASENAME]
   1433# -------------------------
   1434# Make a temporary directory that won't clash with other running
   1435# libtool processes, and avoids race conditions if possible.  If
   1436# given, BASENAME is the basename for that directory.
   1437func_mktempdir ()
   1438{
   1439    $debug_cmd
   1440
   1441    _G_template=${TMPDIR-/tmp}/${1-$progname}
   1442
   1443    if test : = "$opt_dry_run"; then
   1444      # Return a directory name, but don't create it in dry-run mode
   1445      _G_tmpdir=$_G_template-$$
   1446    else
   1447
   1448      # If mktemp works, use that first and foremost
   1449      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
   1450
   1451      if test ! -d "$_G_tmpdir"; then
   1452        # Failing that, at least try and use $RANDOM to avoid a race
   1453        _G_tmpdir=$_G_template-${RANDOM-0}$$
   1454
   1455        func_mktempdir_umask=`umask`
   1456        umask 0077
   1457        $MKDIR "$_G_tmpdir"
   1458        umask $func_mktempdir_umask
   1459      fi
   1460
   1461      # If we're not in dry-run mode, bomb out on failure
   1462      test -d "$_G_tmpdir" || \
   1463        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
   1464    fi
   1465
   1466    $ECHO "$_G_tmpdir"
   1467}
   1468
   1469
   1470# func_normal_abspath PATH
   1471# ------------------------
   1472# Remove doubled-up and trailing slashes, "." path components,
   1473# and cancel out any ".." path components in PATH after making
   1474# it an absolute path.
   1475func_normal_abspath ()
   1476{
   1477    $debug_cmd
   1478
   1479    # These SED scripts presuppose an absolute path with a trailing slash.
   1480    _G_pathcar='s|^/\([^/]*\).*$|\1|'
   1481    _G_pathcdr='s|^/[^/]*||'
   1482    _G_removedotparts=':dotsl
   1483		s|/\./|/|g
   1484		t dotsl
   1485		s|/\.$|/|'
   1486    _G_collapseslashes='s|/\{1,\}|/|g'
   1487    _G_finalslash='s|/*$|/|'
   1488
   1489    # Start from root dir and reassemble the path.
   1490    func_normal_abspath_result=
   1491    func_normal_abspath_tpath=$1
   1492    func_normal_abspath_altnamespace=
   1493    case $func_normal_abspath_tpath in
   1494      "")
   1495        # Empty path, that just means $cwd.
   1496        func_stripname '' '/' "`pwd`"
   1497        func_normal_abspath_result=$func_stripname_result
   1498        return
   1499        ;;
   1500      # The next three entries are used to spot a run of precisely
   1501      # two leading slashes without using negated character classes;
   1502      # we take advantage of case's first-match behaviour.
   1503      ///*)
   1504        # Unusual form of absolute path, do nothing.
   1505        ;;
   1506      //*)
   1507        # Not necessarily an ordinary path; POSIX reserves leading '//'
   1508        # and for example Cygwin uses it to access remote file shares
   1509        # over CIFS/SMB, so we conserve a leading double slash if found.
   1510        func_normal_abspath_altnamespace=/
   1511        ;;
   1512      /*)
   1513        # Absolute path, do nothing.
   1514        ;;
   1515      *)
   1516        # Relative path, prepend $cwd.
   1517        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
   1518        ;;
   1519    esac
   1520
   1521    # Cancel out all the simple stuff to save iterations.  We also want
   1522    # the path to end with a slash for ease of parsing, so make sure
   1523    # there is one (and only one) here.
   1524    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
   1525          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
   1526    while :; do
   1527      # Processed it all yet?
   1528      if test / = "$func_normal_abspath_tpath"; then
   1529        # If we ascended to the root using ".." the result may be empty now.
   1530        if test -z "$func_normal_abspath_result"; then
   1531          func_normal_abspath_result=/
   1532        fi
   1533        break
   1534      fi
   1535      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
   1536          -e "$_G_pathcar"`
   1537      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
   1538          -e "$_G_pathcdr"`
   1539      # Figure out what to do with it
   1540      case $func_normal_abspath_tcomponent in
   1541        "")
   1542          # Trailing empty path component, ignore it.
   1543          ;;
   1544        ..)
   1545          # Parent dir; strip last assembled component from result.
   1546          func_dirname "$func_normal_abspath_result"
   1547          func_normal_abspath_result=$func_dirname_result
   1548          ;;
   1549        *)
   1550          # Actual path component, append it.
   1551          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
   1552          ;;
   1553      esac
   1554    done
   1555    # Restore leading double-slash if one was found on entry.
   1556    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
   1557}
   1558
   1559
   1560# func_notquiet ARG...
   1561# --------------------
   1562# Echo program name prefixed message only when not in quiet mode.
   1563func_notquiet ()
   1564{
   1565    $debug_cmd
   1566
   1567    $opt_quiet || func_echo ${1+"$@"}
   1568
   1569    # A bug in bash halts the script if the last line of a function
   1570    # fails when set -e is in force, so we need another command to
   1571    # work around that:
   1572    :
   1573}
   1574
   1575
   1576# func_relative_path SRCDIR DSTDIR
   1577# --------------------------------
   1578# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
   1579func_relative_path ()
   1580{
   1581    $debug_cmd
   1582
   1583    func_relative_path_result=
   1584    func_normal_abspath "$1"
   1585    func_relative_path_tlibdir=$func_normal_abspath_result
   1586    func_normal_abspath "$2"
   1587    func_relative_path_tbindir=$func_normal_abspath_result
   1588
   1589    # Ascend the tree starting from libdir
   1590    while :; do
   1591      # check if we have found a prefix of bindir
   1592      case $func_relative_path_tbindir in
   1593        $func_relative_path_tlibdir)
   1594          # found an exact match
   1595          func_relative_path_tcancelled=
   1596          break
   1597          ;;
   1598        $func_relative_path_tlibdir*)
   1599          # found a matching prefix
   1600          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
   1601          func_relative_path_tcancelled=$func_stripname_result
   1602          if test -z "$func_relative_path_result"; then
   1603            func_relative_path_result=.
   1604          fi
   1605          break
   1606          ;;
   1607        *)
   1608          func_dirname $func_relative_path_tlibdir
   1609          func_relative_path_tlibdir=$func_dirname_result
   1610          if test -z "$func_relative_path_tlibdir"; then
   1611            # Have to descend all the way to the root!
   1612            func_relative_path_result=../$func_relative_path_result
   1613            func_relative_path_tcancelled=$func_relative_path_tbindir
   1614            break
   1615          fi
   1616          func_relative_path_result=../$func_relative_path_result
   1617          ;;
   1618      esac
   1619    done
   1620
   1621    # Now calculate path; take care to avoid doubling-up slashes.
   1622    func_stripname '' '/' "$func_relative_path_result"
   1623    func_relative_path_result=$func_stripname_result
   1624    func_stripname '/' '/' "$func_relative_path_tcancelled"
   1625    if test -n "$func_stripname_result"; then
   1626      func_append func_relative_path_result "/$func_stripname_result"
   1627    fi
   1628
   1629    # Normalisation. If bindir is libdir, return '.' else relative path.
   1630    if test -n "$func_relative_path_result"; then
   1631      func_stripname './' '' "$func_relative_path_result"
   1632      func_relative_path_result=$func_stripname_result
   1633    fi
   1634
   1635    test -n "$func_relative_path_result" || func_relative_path_result=.
   1636
   1637    :
   1638}
   1639
   1640
   1641# func_quote_portable EVAL ARG
   1642# ----------------------------
   1643# Internal function to portably implement func_quote_arg.  Note that we still
   1644# keep attention to performance here so we as much as possible try to avoid
   1645# calling sed binary (so far O(N) complexity as long as func_append is O(1)).
   1646func_quote_portable ()
   1647{
   1648    $debug_cmd
   1649
   1650    $require_check_ifs_backslash
   1651
   1652    func_quote_portable_result=$2
   1653
   1654    # one-time-loop (easy break)
   1655    while true
   1656    do
   1657      if $1; then
   1658        func_quote_portable_result=`$ECHO "$2" | $SED \
   1659          -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
   1660        break
   1661      fi
   1662
   1663      # Quote for eval.
   1664      case $func_quote_portable_result in
   1665        *[\\\`\"\$]*)
   1666          # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string
   1667          # contains the shell wildcard characters.
   1668          case $check_ifs_backshlash_broken$func_quote_portable_result in
   1669            :*|*[\[\*\?]*)
   1670              func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
   1671                  | $SED "$sed_quote_subst"`
   1672              break
   1673              ;;
   1674          esac
   1675
   1676          func_quote_portable_old_IFS=$IFS
   1677          for _G_char in '\' '`' '"' '$'
   1678          do
   1679            # STATE($1) PREV($2) SEPARATOR($3)
   1680            set start "" ""
   1681            func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
   1682            IFS=$_G_char
   1683            for _G_part in $func_quote_portable_result
   1684            do
   1685              case $1 in
   1686              quote)
   1687                func_append func_quote_portable_result "$3$2"
   1688                set quote "$_G_part" "\\$_G_char"
   1689                ;;
   1690              start)
   1691                set first "" ""
   1692                func_quote_portable_result=
   1693                ;;
   1694              first)
   1695                set quote "$_G_part" ""
   1696                ;;
   1697              esac
   1698            done
   1699          done
   1700          IFS=$func_quote_portable_old_IFS
   1701          ;;
   1702        *) ;;
   1703      esac
   1704      break
   1705    done
   1706
   1707    func_quote_portable_unquoted_result=$func_quote_portable_result
   1708    case $func_quote_portable_result in
   1709      # double-quote args containing shell metacharacters to delay
   1710      # word splitting, command substitution and variable expansion
   1711      # for a subsequent eval.
   1712      # many bourne shells cannot handle close brackets correctly
   1713      # in scan sets, so we specify it separately.
   1714      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1715        func_quote_portable_result=\"$func_quote_portable_result\"
   1716        ;;
   1717    esac
   1718}
   1719
   1720
   1721# func_quotefast_eval ARG
   1722# -----------------------
   1723# Quote one ARG (internal).  This is equivalent to 'func_quote_arg eval ARG',
   1724# but optimized for speed.  Result is stored in $func_quotefast_eval.
   1725if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
   1726  printf -v _GL_test_printf_tilde %q '~'
   1727  if test '\~' = "$_GL_test_printf_tilde"; then
   1728    func_quotefast_eval ()
   1729    {
   1730      printf -v func_quotefast_eval_result %q "$1"
   1731    }
   1732  else
   1733    # Broken older Bash implementations.  Make those faster too if possible.
   1734    func_quotefast_eval ()
   1735    {
   1736      case $1 in
   1737        '~'*)
   1738          func_quote_portable false "$1"
   1739          func_quotefast_eval_result=$func_quote_portable_result
   1740          ;;
   1741        *)
   1742          printf -v func_quotefast_eval_result %q "$1"
   1743          ;;
   1744      esac
   1745    }
   1746  fi
   1747else
   1748  func_quotefast_eval ()
   1749  {
   1750    func_quote_portable false "$1"
   1751    func_quotefast_eval_result=$func_quote_portable_result
   1752  }
   1753fi
   1754
   1755
   1756# func_quote_arg MODEs ARG
   1757# ------------------------
   1758# Quote one ARG to be evaled later.  MODEs argument may contain zero or more
   1759# specifiers listed below separated by ',' character.  This function returns two
   1760# values:
   1761#   i) func_quote_arg_result
   1762#      double-quoted (when needed), suitable for a subsequent eval
   1763#  ii) func_quote_arg_unquoted_result
   1764#      has all characters that are still active within double
   1765#      quotes backslashified.  Available only if 'unquoted' is specified.
   1766#
   1767# Available modes:
   1768# ----------------
   1769# 'eval' (default)
   1770#       - escape shell special characters
   1771# 'expand'
   1772#       - the same as 'eval';  but do not quote variable references
   1773# 'pretty'
   1774#       - request aesthetic output, i.e. '"a b"' instead of 'a\ b'.  This might
   1775#         be used later in func_quote to get output like: 'echo "a b"' instead
   1776#         of 'echo a\ b'.  This is slower than default on some shells.
   1777# 'unquoted'
   1778#       - produce also $func_quote_arg_unquoted_result which does not contain
   1779#         wrapping double-quotes.
   1780#
   1781# Examples for 'func_quote_arg pretty,unquoted string':
   1782#
   1783#   string      | *_result              | *_unquoted_result
   1784#   ------------+-----------------------+-------------------
   1785#   "           | \"                    | \"
   1786#   a b         | "a b"                 | a b
   1787#   "a b"       | "\"a b\""             | \"a b\"
   1788#   *           | "*"                   | *
   1789#   z="${x-$y}" | "z=\"\${x-\$y}\""     | z=\"\${x-\$y}\"
   1790#
   1791# Examples for 'func_quote_arg pretty,unquoted,expand string':
   1792#
   1793#   string        |   *_result          |  *_unquoted_result
   1794#   --------------+---------------------+--------------------
   1795#   z="${x-$y}"   | "z=\"${x-$y}\""     | z=\"${x-$y}\"
   1796func_quote_arg ()
   1797{
   1798    _G_quote_expand=false
   1799    case ,$1, in
   1800      *,expand,*)
   1801        _G_quote_expand=:
   1802        ;;
   1803    esac
   1804
   1805    case ,$1, in
   1806      *,pretty,*|*,expand,*|*,unquoted,*)
   1807        func_quote_portable $_G_quote_expand "$2"
   1808        func_quote_arg_result=$func_quote_portable_result
   1809        func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
   1810        ;;
   1811      *)
   1812        # Faster quote-for-eval for some shells.
   1813        func_quotefast_eval "$2"
   1814        func_quote_arg_result=$func_quotefast_eval_result
   1815        ;;
   1816    esac
   1817}
   1818
   1819
   1820# func_quote MODEs ARGs...
   1821# ------------------------
   1822# Quote all ARGs to be evaled later and join them into single command.  See
   1823# func_quote_arg's description for more info.
   1824func_quote ()
   1825{
   1826    $debug_cmd
   1827    _G_func_quote_mode=$1 ; shift
   1828    func_quote_result=
   1829    while test 0 -lt $#; do
   1830      func_quote_arg "$_G_func_quote_mode" "$1"
   1831      if test -n "$func_quote_result"; then
   1832        func_append func_quote_result " $func_quote_arg_result"
   1833      else
   1834        func_append func_quote_result "$func_quote_arg_result"
   1835      fi
   1836      shift
   1837    done
   1838}
   1839
   1840
   1841# func_stripname PREFIX SUFFIX NAME
   1842# ---------------------------------
   1843# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
   1844# PREFIX and SUFFIX must not contain globbing or regex special
   1845# characters, hashes, percent signs, but SUFFIX may contain a leading
   1846# dot (in which case that matches only a dot).
   1847if test yes = "$_G_HAVE_XSI_OPS"; then
   1848  eval 'func_stripname ()
   1849  {
   1850    $debug_cmd
   1851
   1852    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
   1853    # positional parameters, so assign one to ordinary variable first.
   1854    func_stripname_result=$3
   1855    func_stripname_result=${func_stripname_result#"$1"}
   1856    func_stripname_result=${func_stripname_result%"$2"}
   1857  }'
   1858else
   1859  func_stripname ()
   1860  {
   1861    $debug_cmd
   1862
   1863    case $2 in
   1864      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
   1865      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
   1866    esac
   1867  }
   1868fi
   1869
   1870
   1871# func_show_eval CMD [FAIL_EXP]
   1872# -----------------------------
   1873# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
   1874# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
   1875# is given, then evaluate it.
   1876func_show_eval ()
   1877{
   1878    $debug_cmd
   1879
   1880    _G_cmd=$1
   1881    _G_fail_exp=${2-':'}
   1882
   1883    func_quote_arg pretty,expand "$_G_cmd"
   1884    eval "func_notquiet $func_quote_arg_result"
   1885
   1886    $opt_dry_run || {
   1887      eval "$_G_cmd"
   1888      _G_status=$?
   1889      if test 0 -ne "$_G_status"; then
   1890	eval "(exit $_G_status); $_G_fail_exp"
   1891      fi
   1892    }
   1893}
   1894
   1895
   1896# func_show_eval_locale CMD [FAIL_EXP]
   1897# ------------------------------------
   1898# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
   1899# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
   1900# is given, then evaluate it.  Use the saved locale for evaluation.
   1901func_show_eval_locale ()
   1902{
   1903    $debug_cmd
   1904
   1905    _G_cmd=$1
   1906    _G_fail_exp=${2-':'}
   1907
   1908    $opt_quiet || {
   1909      func_quote_arg expand,pretty "$_G_cmd"
   1910      eval "func_echo $func_quote_arg_result"
   1911    }
   1912
   1913    $opt_dry_run || {
   1914      eval "$_G_user_locale
   1915	    $_G_cmd"
   1916      _G_status=$?
   1917      eval "$_G_safe_locale"
   1918      if test 0 -ne "$_G_status"; then
   1919	eval "(exit $_G_status); $_G_fail_exp"
   1920      fi
   1921    }
   1922}
   1923
   1924
   1925# func_tr_sh
   1926# ----------
   1927# Turn $1 into a string suitable for a shell variable name.
   1928# Result is stored in $func_tr_sh_result.  All characters
   1929# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
   1930# if $1 begins with a digit, a '_' is prepended as well.
   1931func_tr_sh ()
   1932{
   1933    $debug_cmd
   1934
   1935    case $1 in
   1936    [0-9]* | *[!a-zA-Z0-9_]*)
   1937      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
   1938      ;;
   1939    * )
   1940      func_tr_sh_result=$1
   1941      ;;
   1942    esac
   1943}
   1944
   1945
   1946# func_verbose ARG...
   1947# -------------------
   1948# Echo program name prefixed message in verbose mode only.
   1949func_verbose ()
   1950{
   1951    $debug_cmd
   1952
   1953    $opt_verbose && func_echo "$*"
   1954
   1955    :
   1956}
   1957
   1958
   1959# func_warn_and_continue ARG...
   1960# -----------------------------
   1961# Echo program name prefixed warning message to standard error.
   1962func_warn_and_continue ()
   1963{
   1964    $debug_cmd
   1965
   1966    $require_term_colors
   1967
   1968    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
   1969}
   1970
   1971
   1972# func_warning CATEGORY ARG...
   1973# ----------------------------
   1974# Echo program name prefixed warning message to standard error. Warning
   1975# messages can be filtered according to CATEGORY, where this function
   1976# elides messages where CATEGORY is not listed in the global variable
   1977# 'opt_warning_types'.
   1978func_warning ()
   1979{
   1980    $debug_cmd
   1981
   1982    # CATEGORY must be in the warning_categories list!
   1983    case " $warning_categories " in
   1984      *" $1 "*) ;;
   1985      *) func_internal_error "invalid warning category '$1'" ;;
   1986    esac
   1987
   1988    _G_category=$1
   1989    shift
   1990
   1991    case " $opt_warning_types " in
   1992      *" $_G_category "*) $warning_func ${1+"$@"} ;;
   1993    esac
   1994}
   1995
   1996
   1997# func_sort_ver VER1 VER2
   1998# -----------------------
   1999# 'sort -V' is not generally available.
   2000# Note this deviates from the version comparison in automake
   2001# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
   2002# but this should suffice as we won't be specifying old
   2003# version formats or redundant trailing .0 in bootstrap.conf.
   2004# If we did want full compatibility then we should probably
   2005# use m4_version_compare from autoconf.
   2006func_sort_ver ()
   2007{
   2008    $debug_cmd
   2009
   2010    printf '%s\n%s\n' "$1" "$2" \
   2011      | 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
   2012}
   2013
   2014# func_lt_ver PREV CURR
   2015# ---------------------
   2016# Return true if PREV and CURR are in the correct order according to
   2017# func_sort_ver, otherwise false.  Use it like this:
   2018#
   2019#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
   2020func_lt_ver ()
   2021{
   2022    $debug_cmd
   2023
   2024    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
   2025}
   2026
   2027
   2028# Local variables:
   2029# mode: shell-script
   2030# sh-indentation: 2
   2031# eval: (add-hook 'before-save-hook 'time-stamp)
   2032# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
   2033# time-stamp-time-zone: "UTC"
   2034# End:
   2035#! /bin/sh
   2036
   2037# A portable, pluggable option parser for Bourne shell.
   2038# Written by Gary V. Vaughan, 2010
   2039
   2040# This is free software.  There is NO warranty; not even for
   2041# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   2042#
   2043# Copyright (C) 2010-2019, 2021 Bootstrap Authors
   2044#
   2045# This file is dual licensed under the terms of the MIT license
   2046# <https://opensource.org/license/MIT>, and GPL version 2 or later
   2047# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
   2048# these licenses when using or redistributing this software or any of
   2049# the files within it.  See the URLs above, or the file `LICENSE`
   2050# included in the Bootstrap distribution for the full license texts.
   2051
   2052# Please report bugs or propose patches to:
   2053# <https://github.com/gnulib-modules/bootstrap/issues>
   2054
   2055# Set a version string for this script.
   2056scriptversion=2019-02-19.15; # UTC
   2057
   2058
   2059## ------ ##
   2060## Usage. ##
   2061## ------ ##
   2062
   2063# This file is a library for parsing options in your shell scripts along
   2064# with assorted other useful supporting features that you can make use
   2065# of too.
   2066#
   2067# For the simplest scripts you might need only:
   2068#
   2069#   #!/bin/sh
   2070#   . relative/path/to/funclib.sh
   2071#   . relative/path/to/options-parser
   2072#   scriptversion=1.0
   2073#   func_options ${1+"$@"}
   2074#   eval set dummy "$func_options_result"; shift
   2075#   ...rest of your script...
   2076#
   2077# In order for the '--version' option to work, you will need to have a
   2078# suitably formatted comment like the one at the top of this file
   2079# starting with '# Written by ' and ending with '# Copyright'.
   2080#
   2081# For '-h' and '--help' to work, you will also need a one line
   2082# description of your script's purpose in a comment directly above the
   2083# '# Written by ' line, like the one at the top of this file.
   2084#
   2085# The default options also support '--debug', which will turn on shell
   2086# execution tracing (see the comment above debug_cmd below for another
   2087# use), and '--verbose' and the func_verbose function to allow your script
   2088# to display verbose messages only when your user has specified
   2089# '--verbose'.
   2090#
   2091# After sourcing this file, you can plug in processing for additional
   2092# options by amending the variables from the 'Configuration' section
   2093# below, and following the instructions in the 'Option parsing'
   2094# section further down.
   2095
   2096## -------------- ##
   2097## Configuration. ##
   2098## -------------- ##
   2099
   2100# You should override these variables in your script after sourcing this
   2101# file so that they reflect the customisations you have added to the
   2102# option parser.
   2103
   2104# The usage line for option parsing errors and the start of '-h' and
   2105# '--help' output messages. You can embed shell variables for delayed
   2106# expansion at the time the message is displayed, but you will need to
   2107# quote other shell meta-characters carefully to prevent them being
   2108# expanded when the contents are evaled.
   2109usage='$progpath [OPTION]...'
   2110
   2111# Short help message in response to '-h' and '--help'.  Add to this or
   2112# override it after sourcing this library to reflect the full set of
   2113# options your script accepts.
   2114usage_message="\
   2115       --debug        enable verbose shell tracing
   2116   -W, --warnings=CATEGORY
   2117                      report the warnings falling in CATEGORY [all]
   2118   -v, --verbose      verbosely report processing
   2119       --version      print version information and exit
   2120   -h, --help         print short or long help message and exit
   2121"
   2122
   2123# Additional text appended to 'usage_message' in response to '--help'.
   2124long_help_message="
   2125Warning categories include:
   2126       'all'          show all warnings
   2127       'none'         turn off all the warnings
   2128       'error'        warnings are treated as fatal errors"
   2129
   2130# Help message printed before fatal option parsing errors.
   2131fatal_help="Try '\$progname --help' for more information."
   2132
   2133
   2134
   2135## ------------------------- ##
   2136## Hook function management. ##
   2137## ------------------------- ##
   2138
   2139# This section contains functions for adding, removing, and running hooks
   2140# in the main code.  A hook is just a list of function names that can be
   2141# run in order later on.
   2142
   2143# func_hookable FUNC_NAME
   2144# -----------------------
   2145# Declare that FUNC_NAME will run hooks added with
   2146# 'func_add_hook FUNC_NAME ...'.
   2147func_hookable ()
   2148{
   2149    $debug_cmd
   2150
   2151    func_append hookable_fns " $1"
   2152}
   2153
   2154
   2155# func_add_hook FUNC_NAME HOOK_FUNC
   2156# ---------------------------------
   2157# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
   2158# first have been declared "hookable" by a call to 'func_hookable'.
   2159func_add_hook ()
   2160{
   2161    $debug_cmd
   2162
   2163    case " $hookable_fns " in
   2164      *" $1 "*) ;;
   2165      *) func_fatal_error "'$1' does not accept hook functions." ;;
   2166    esac
   2167
   2168    eval func_append ${1}_hooks '" $2"'
   2169}
   2170
   2171
   2172# func_remove_hook FUNC_NAME HOOK_FUNC
   2173# ------------------------------------
   2174# Remove HOOK_FUNC from the list of hook functions to be called by
   2175# FUNC_NAME.
   2176func_remove_hook ()
   2177{
   2178    $debug_cmd
   2179
   2180    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
   2181}
   2182
   2183
   2184# func_propagate_result FUNC_NAME_A FUNC_NAME_B
   2185# ---------------------------------------------
   2186# If the *_result variable of FUNC_NAME_A _is set_, assign its value to
   2187# *_result variable of FUNC_NAME_B.
   2188func_propagate_result ()
   2189{
   2190    $debug_cmd
   2191
   2192    func_propagate_result_result=:
   2193    if eval "test \"\${${1}_result+set}\" = set"
   2194    then
   2195      eval "${2}_result=\$${1}_result"
   2196    else
   2197      func_propagate_result_result=false
   2198    fi
   2199}
   2200
   2201
   2202# func_run_hooks FUNC_NAME [ARG]...
   2203# ---------------------------------
   2204# Run all hook functions registered to FUNC_NAME.
   2205# It's assumed that the list of hook functions contains nothing more
   2206# than a whitespace-delimited list of legal shell function names, and
   2207# no effort is wasted trying to catch shell meta-characters or preserve
   2208# whitespace.
   2209func_run_hooks ()
   2210{
   2211    $debug_cmd
   2212
   2213    case " $hookable_fns " in
   2214      *" $1 "*) ;;
   2215      *) func_fatal_error "'$1' does not support hook functions." ;;
   2216    esac
   2217
   2218    eval _G_hook_fns=\$$1_hooks; shift
   2219
   2220    for _G_hook in $_G_hook_fns; do
   2221      func_unset "${_G_hook}_result"
   2222      eval $_G_hook '${1+"$@"}'
   2223      func_propagate_result $_G_hook func_run_hooks
   2224      if $func_propagate_result_result; then
   2225        eval set dummy "$func_run_hooks_result"; shift
   2226      fi
   2227    done
   2228}
   2229
   2230
   2231
   2232## --------------- ##
   2233## Option parsing. ##
   2234## --------------- ##
   2235
   2236# In order to add your own option parsing hooks, you must accept the
   2237# full positional parameter list from your hook function.  You may remove
   2238# or edit any options that you action, and then pass back the remaining
   2239# unprocessed options in '<hooked_function_name>_result', escaped
   2240# suitably for 'eval'.
   2241#
   2242# The '<hooked_function_name>_result' variable is automatically unset
   2243# before your hook gets called; for best performance, only set the
   2244# *_result variable when necessary (i.e. don't call the 'func_quote'
   2245# function unnecessarily because it can be an expensive operation on some
   2246# machines).
   2247#
   2248# Like this:
   2249#
   2250#    my_options_prep ()
   2251#    {
   2252#        $debug_cmd
   2253#
   2254#        # Extend the existing usage message.
   2255#        usage_message=$usage_message'
   2256#      -s, --silent       don'\''t print informational messages
   2257#    '
   2258#        # No change in '$@' (ignored completely by this hook).  Leave
   2259#        # my_options_prep_result variable intact.
   2260#    }
   2261#    func_add_hook func_options_prep my_options_prep
   2262#
   2263#
   2264#    my_silent_option ()
   2265#    {
   2266#        $debug_cmd
   2267#
   2268#        args_changed=false
   2269#
   2270#        # Note that, for efficiency, we parse as many options as we can
   2271#        # recognise in a loop before passing the remainder back to the
   2272#        # caller on the first unrecognised argument we encounter.
   2273#        while test $# -gt 0; do
   2274#          opt=$1; shift
   2275#          case $opt in
   2276#            --silent|-s) opt_silent=:
   2277#                         args_changed=:
   2278#                         ;;
   2279#            # Separate non-argument short options:
   2280#            -s*)         func_split_short_opt "$_G_opt"
   2281#                         set dummy "$func_split_short_opt_name" \
   2282#                             "-$func_split_short_opt_arg" ${1+"$@"}
   2283#                         shift
   2284#                         args_changed=:
   2285#                         ;;
   2286#            *)           # Make sure the first unrecognised option "$_G_opt"
   2287#                         # is added back to "$@" in case we need it later,
   2288#                         # if $args_changed was set to 'true'.
   2289#                         set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
   2290#          esac
   2291#        done
   2292#
   2293#        # Only call 'func_quote' here if we processed at least one argument.
   2294#        if $args_changed; then
   2295#          func_quote eval ${1+"$@"}
   2296#          my_silent_option_result=$func_quote_result
   2297#        fi
   2298#    }
   2299#    func_add_hook func_parse_options my_silent_option
   2300#
   2301#
   2302#    my_option_validation ()
   2303#    {
   2304#        $debug_cmd
   2305#
   2306#        $opt_silent && $opt_verbose && func_fatal_help "\
   2307#    '--silent' and '--verbose' options are mutually exclusive."
   2308#    }
   2309#    func_add_hook func_validate_options my_option_validation
   2310#
   2311# You'll also need to manually amend $usage_message to reflect the extra
   2312# options you parse.  It's preferable to append if you can, so that
   2313# multiple option parsing hooks can be added safely.
   2314
   2315
   2316# func_options_finish [ARG]...
   2317# ----------------------------
   2318# Finishing the option parse loop (call 'func_options' hooks ATM).
   2319func_options_finish ()
   2320{
   2321    $debug_cmd
   2322
   2323    func_run_hooks func_options ${1+"$@"}
   2324    func_propagate_result func_run_hooks func_options_finish
   2325}
   2326
   2327
   2328# func_options [ARG]...
   2329# ---------------------
   2330# All the functions called inside func_options are hookable. See the
   2331# individual implementations for details.
   2332func_hookable func_options
   2333func_options ()
   2334{
   2335    $debug_cmd
   2336
   2337    _G_options_quoted=false
   2338
   2339    for my_func in options_prep parse_options validate_options options_finish
   2340    do
   2341      func_unset func_${my_func}_result
   2342      func_unset func_run_hooks_result
   2343      eval func_$my_func '${1+"$@"}'
   2344      func_propagate_result func_$my_func func_options
   2345      if $func_propagate_result_result; then
   2346        eval set dummy "$func_options_result"; shift
   2347        _G_options_quoted=:
   2348      fi
   2349    done
   2350
   2351    $_G_options_quoted || {
   2352      # As we (func_options) are top-level options-parser function and
   2353      # nobody quoted "$@" for us yet, we need to do it explicitly for
   2354      # caller.
   2355      func_quote eval ${1+"$@"}
   2356      func_options_result=$func_quote_result
   2357    }
   2358}
   2359
   2360
   2361# func_options_prep [ARG]...
   2362# --------------------------
   2363# All initialisations required before starting the option parse loop.
   2364# Note that when calling hook functions, we pass through the list of
   2365# positional parameters.  If a hook function modifies that list, and
   2366# needs to propagate that back to rest of this script, then the complete
   2367# modified list must be put in 'func_run_hooks_result' before returning.
   2368func_hookable func_options_prep
   2369func_options_prep ()
   2370{
   2371    $debug_cmd
   2372
   2373    # Option defaults:
   2374    opt_verbose=false
   2375    opt_warning_types=
   2376
   2377    func_run_hooks func_options_prep ${1+"$@"}
   2378    func_propagate_result func_run_hooks func_options_prep
   2379}
   2380
   2381
   2382# func_parse_options [ARG]...
   2383# ---------------------------
   2384# The main option parsing loop.
   2385func_hookable func_parse_options
   2386func_parse_options ()
   2387{
   2388    $debug_cmd
   2389
   2390    _G_parse_options_requote=false
   2391    # this just eases exit handling
   2392    while test $# -gt 0; do
   2393      # Defer to hook functions for initial option parsing, so they
   2394      # get priority in the event of reusing an option name.
   2395      func_run_hooks func_parse_options ${1+"$@"}
   2396      func_propagate_result func_run_hooks func_parse_options
   2397      if $func_propagate_result_result; then
   2398        eval set dummy "$func_parse_options_result"; shift
   2399        # Even though we may have changed "$@", we passed the "$@" array
   2400        # down into the hook and it quoted it for us (because we are in
   2401        # this if-branch).  No need to quote it again.
   2402        _G_parse_options_requote=false
   2403      fi
   2404
   2405      # Break out of the loop if we already parsed every option.
   2406      test $# -gt 0 || break
   2407
   2408      # We expect that one of the options parsed in this function matches
   2409      # and thus we remove _G_opt from "$@" and need to re-quote.
   2410      _G_match_parse_options=:
   2411      _G_opt=$1
   2412      shift
   2413      case $_G_opt in
   2414        --debug|-x)   debug_cmd='set -x'
   2415                      func_echo "enabling shell trace mode" >&2
   2416                      $debug_cmd
   2417                      ;;
   2418
   2419        --no-warnings|--no-warning|--no-warn)
   2420                      set dummy --warnings none ${1+"$@"}
   2421                      shift
   2422		      ;;
   2423
   2424        --warnings|--warning|-W)
   2425                      if test $# = 0 && func_missing_arg $_G_opt; then
   2426                        _G_parse_options_requote=:
   2427                        break
   2428                      fi
   2429                      case " $warning_categories $1" in
   2430                        *" $1 "*)
   2431                          # trailing space prevents matching last $1 above
   2432                          func_append_uniq opt_warning_types " $1"
   2433                          ;;
   2434                        *all)
   2435                          opt_warning_types=$warning_categories
   2436                          ;;
   2437                        *none)
   2438                          opt_warning_types=none
   2439                          warning_func=:
   2440                          ;;
   2441                        *error)
   2442                          opt_warning_types=$warning_categories
   2443                          warning_func=func_fatal_error
   2444                          ;;
   2445                        *)
   2446                          func_fatal_error \
   2447                             "unsupported warning category: '$1'"
   2448                          ;;
   2449                      esac
   2450                      shift
   2451                      ;;
   2452
   2453        --verbose|-v) opt_verbose=: ;;
   2454        --version)    func_version ;;
   2455        -\?|-h)       func_usage ;;
   2456        --help)       func_help ;;
   2457
   2458	# Separate optargs to long options (plugins may need this):
   2459	--*=*)        func_split_equals "$_G_opt"
   2460	              set dummy "$func_split_equals_lhs" \
   2461                          "$func_split_equals_rhs" ${1+"$@"}
   2462                      shift
   2463                      ;;
   2464
   2465       # Separate optargs to short options:
   2466        -W*)
   2467                      func_split_short_opt "$_G_opt"
   2468                      set dummy "$func_split_short_opt_name" \
   2469                          "$func_split_short_opt_arg" ${1+"$@"}
   2470                      shift
   2471                      ;;
   2472
   2473        # Separate non-argument short options:
   2474        -\?*|-h*|-v*|-x*)
   2475                      func_split_short_opt "$_G_opt"
   2476                      set dummy "$func_split_short_opt_name" \
   2477                          "-$func_split_short_opt_arg" ${1+"$@"}
   2478                      shift
   2479                      ;;
   2480
   2481        --)           _G_parse_options_requote=: ; break ;;
   2482        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
   2483        *)            set dummy "$_G_opt" ${1+"$@"}; shift
   2484                      _G_match_parse_options=false
   2485                      break
   2486                      ;;
   2487      esac
   2488
   2489      if $_G_match_parse_options; then
   2490        _G_parse_options_requote=:
   2491      fi
   2492    done
   2493
   2494    if $_G_parse_options_requote; then
   2495      # save modified positional parameters for caller
   2496      func_quote eval ${1+"$@"}
   2497      func_parse_options_result=$func_quote_result
   2498    fi
   2499}
   2500
   2501
   2502# func_validate_options [ARG]...
   2503# ------------------------------
   2504# Perform any sanity checks on option settings and/or unconsumed
   2505# arguments.
   2506func_hookable func_validate_options
   2507func_validate_options ()
   2508{
   2509    $debug_cmd
   2510
   2511    # Display all warnings if -W was not given.
   2512    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
   2513
   2514    func_run_hooks func_validate_options ${1+"$@"}
   2515    func_propagate_result func_run_hooks func_validate_options
   2516
   2517    # Bail if the options were screwed!
   2518    $exit_cmd $EXIT_FAILURE
   2519}
   2520
   2521
   2522
   2523## ----------------- ##
   2524## Helper functions. ##
   2525## ----------------- ##
   2526
   2527# This section contains the helper functions used by the rest of the
   2528# hookable option parser framework in ascii-betical order.
   2529
   2530
   2531# func_fatal_help ARG...
   2532# ----------------------
   2533# Echo program name prefixed message to standard error, followed by
   2534# a help hint, and exit.
   2535func_fatal_help ()
   2536{
   2537    $debug_cmd
   2538
   2539    eval \$ECHO \""Usage: $usage"\"
   2540    eval \$ECHO \""$fatal_help"\"
   2541    func_error ${1+"$@"}
   2542    exit $EXIT_FAILURE
   2543}
   2544
   2545
   2546# func_help
   2547# ---------
   2548# Echo long help message to standard output and exit.
   2549func_help ()
   2550{
   2551    $debug_cmd
   2552
   2553    func_usage_message
   2554    $ECHO "$long_help_message"
   2555    exit 0
   2556}
   2557
   2558
   2559# func_missing_arg ARGNAME
   2560# ------------------------
   2561# Echo program name prefixed message to standard error and set global
   2562# exit_cmd.
   2563func_missing_arg ()
   2564{
   2565    $debug_cmd
   2566
   2567    func_error "Missing argument for '$1'."
   2568    exit_cmd=exit
   2569}
   2570
   2571
   2572# func_split_equals STRING
   2573# ------------------------
   2574# Set func_split_equals_lhs and func_split_equals_rhs shell variables
   2575# after splitting STRING at the '=' sign.
   2576test -z "$_G_HAVE_XSI_OPS" \
   2577    && (eval 'x=a/b/c;
   2578      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
   2579    && _G_HAVE_XSI_OPS=yes
   2580
   2581if test yes = "$_G_HAVE_XSI_OPS"
   2582then
   2583  # This is an XSI compatible shell, allowing a faster implementation...
   2584  eval 'func_split_equals ()
   2585  {
   2586      $debug_cmd
   2587
   2588      func_split_equals_lhs=${1%%=*}
   2589      func_split_equals_rhs=${1#*=}
   2590      if test "x$func_split_equals_lhs" = "x$1"; then
   2591        func_split_equals_rhs=
   2592      fi
   2593  }'
   2594else
   2595  # ...otherwise fall back to using expr, which is often a shell builtin.
   2596  func_split_equals ()
   2597  {
   2598      $debug_cmd
   2599
   2600      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
   2601      func_split_equals_rhs=
   2602      test "x$func_split_equals_lhs=" = "x$1" \
   2603        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
   2604  }
   2605fi #func_split_equals
   2606
   2607
   2608# func_split_short_opt SHORTOPT
   2609# -----------------------------
   2610# Set func_split_short_opt_name and func_split_short_opt_arg shell
   2611# variables after splitting SHORTOPT after the 2nd character.
   2612if test yes = "$_G_HAVE_XSI_OPS"
   2613then
   2614  # This is an XSI compatible shell, allowing a faster implementation...
   2615  eval 'func_split_short_opt ()
   2616  {
   2617      $debug_cmd
   2618
   2619      func_split_short_opt_arg=${1#??}
   2620      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
   2621  }'
   2622else
   2623  # ...otherwise fall back to using expr, which is often a shell builtin.
   2624  func_split_short_opt ()
   2625  {
   2626      $debug_cmd
   2627
   2628      func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'`
   2629      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
   2630  }
   2631fi #func_split_short_opt
   2632
   2633
   2634# func_usage
   2635# ----------
   2636# Echo short help message to standard output and exit.
   2637func_usage ()
   2638{
   2639    $debug_cmd
   2640
   2641    func_usage_message
   2642    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
   2643    exit 0
   2644}
   2645
   2646
   2647# func_usage_message
   2648# ------------------
   2649# Echo short help message to standard output.
   2650func_usage_message ()
   2651{
   2652    $debug_cmd
   2653
   2654    eval \$ECHO \""Usage: $usage"\"
   2655    echo
   2656    $SED -n 's|^# ||
   2657        /^Written by/{
   2658          x;p;x
   2659        }
   2660	h
   2661	/^Written by/q' < "$progpath"
   2662    echo
   2663    eval \$ECHO \""$usage_message"\"
   2664}
   2665
   2666
   2667# func_version
   2668# ------------
   2669# Echo version message to standard output and exit.
   2670# The version message is extracted from the calling file's header
   2671# comments, with leading '# ' stripped:
   2672#   1. First display the progname and version
   2673#   2. Followed by the header comment line matching  /^# Written by /
   2674#   3. Then a blank line followed by the first following line matching
   2675#      /^# Copyright /
   2676#   4. Immediately followed by any lines between the previous matches,
   2677#      except lines preceding the intervening completely blank line.
   2678# For example, see the header comments of this file.
   2679func_version ()
   2680{
   2681    $debug_cmd
   2682
   2683    printf '%s\n' "$progname $scriptversion"
   2684    $SED -n '
   2685        /^# Written by /!b
   2686        s|^# ||; p; n
   2687
   2688        :fwd2blnk
   2689        /./ {
   2690          n
   2691          b fwd2blnk
   2692        }
   2693        p; n
   2694
   2695        :holdwrnt
   2696        s|^# ||
   2697        s|^# *$||
   2698        /^Copyright /!{
   2699          /./H
   2700          n
   2701          b holdwrnt
   2702        }
   2703
   2704        s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
   2705        G
   2706        s|\(\n\)\n*|\1|g
   2707        p; q' < "$progpath"
   2708
   2709    exit $?
   2710}
   2711
   2712
   2713# Local variables:
   2714# mode: shell-script
   2715# sh-indentation: 2
   2716# eval: (add-hook 'before-save-hook 'time-stamp)
   2717# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
   2718# time-stamp-time-zone: "UTC"
   2719# End:
   2720
   2721# Set a version string.
   2722scriptversion='(GNU libtool) 2.4.7'
   2723
   2724
   2725# func_echo ARG...
   2726# ----------------
   2727# Libtool also displays the current mode in messages, so override
   2728# funclib.sh func_echo with this custom definition.
   2729func_echo ()
   2730{
   2731    $debug_cmd
   2732
   2733    _G_message=$*
   2734
   2735    func_echo_IFS=$IFS
   2736    IFS=$nl
   2737    for _G_line in $_G_message; do
   2738      IFS=$func_echo_IFS
   2739      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
   2740    done
   2741    IFS=$func_echo_IFS
   2742}
   2743
   2744
   2745# func_warning ARG...
   2746# -------------------
   2747# Libtool warnings are not categorized, so override funclib.sh
   2748# func_warning with this simpler definition.
   2749func_warning ()
   2750{
   2751    $debug_cmd
   2752
   2753    $warning_func ${1+"$@"}
   2754}
   2755
   2756
   2757## ---------------- ##
   2758## Options parsing. ##
   2759## ---------------- ##
   2760
   2761# Hook in the functions to make sure our own options are parsed during
   2762# the option parsing loop.
   2763
   2764usage='$progpath [OPTION]... [MODE-ARG]...'
   2765
   2766# Short help message in response to '-h'.
   2767usage_message="Options:
   2768       --config             show all configuration variables
   2769       --debug              enable verbose shell tracing
   2770   -n, --dry-run            display commands without modifying any files
   2771       --features           display basic configuration information and exit
   2772       --mode=MODE          use operation mode MODE
   2773       --no-warnings        equivalent to '-Wnone'
   2774       --preserve-dup-deps  don't remove duplicate dependency libraries
   2775       --quiet, --silent    don't print informational messages
   2776       --tag=TAG            use configuration variables from tag TAG
   2777   -v, --verbose            print more informational messages than default
   2778       --version            print version information
   2779   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
   2780   -h, --help, --help-all   print short, long, or detailed help message
   2781"
   2782
   2783# Additional text appended to 'usage_message' in response to '--help'.
   2784func_help ()
   2785{
   2786    $debug_cmd
   2787
   2788    func_usage_message
   2789    $ECHO "$long_help_message
   2790
   2791MODE must be one of the following:
   2792
   2793       clean           remove files from the build directory
   2794       compile         compile a source file into a libtool object
   2795       execute         automatically set library path, then run a program
   2796       finish          complete the installation of libtool libraries
   2797       install         install libraries or executables
   2798       link            create a library or an executable
   2799       uninstall       remove libraries from an installed directory
   2800
   2801MODE-ARGS vary depending on the MODE.  When passed as first option,
   2802'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
   2803Try '$progname --help --mode=MODE' for a more detailed description of MODE.
   2804
   2805When reporting a bug, please describe a test case to reproduce it and
   2806include the following information:
   2807
   2808       host-triplet:   $host
   2809       shell:          $SHELL
   2810       compiler:       $LTCC
   2811       compiler flags: $LTCFLAGS
   2812       linker:         $LD (gnu? $with_gnu_ld)
   2813       version:        $progname (GNU libtool) 2.4.7
   2814       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
   2815       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
   2816
   2817Report bugs to <bug-libtool@gnu.org>.
   2818GNU libtool home page: <http://www.gnu.org/software/libtool/>.
   2819General help using GNU software: <http://www.gnu.org/gethelp/>."
   2820    exit 0
   2821}
   2822
   2823
   2824# func_lo2o OBJECT-NAME
   2825# ---------------------
   2826# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
   2827# object suffix.
   2828
   2829lo2o=s/\\.lo\$/.$objext/
   2830o2lo=s/\\.$objext\$/.lo/
   2831
   2832if test yes = "$_G_HAVE_XSI_OPS"; then
   2833  eval 'func_lo2o ()
   2834  {
   2835    case $1 in
   2836      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
   2837      *   ) func_lo2o_result=$1               ;;
   2838    esac
   2839  }'
   2840
   2841  # func_xform LIBOBJ-OR-SOURCE
   2842  # ---------------------------
   2843  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
   2844  # suffix to a '.lo' libtool-object suffix.
   2845  eval 'func_xform ()
   2846  {
   2847    func_xform_result=${1%.*}.lo
   2848  }'
   2849else
   2850  # ...otherwise fall back to using sed.
   2851  func_lo2o ()
   2852  {
   2853    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
   2854  }
   2855
   2856  func_xform ()
   2857  {
   2858    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
   2859  }
   2860fi
   2861
   2862
   2863# func_fatal_configuration ARG...
   2864# -------------------------------
   2865# Echo program name prefixed message to standard error, followed by
   2866# a configuration failure hint, and exit.
   2867func_fatal_configuration ()
   2868{
   2869    func_fatal_error ${1+"$@"} \
   2870      "See the $PACKAGE documentation for more information." \
   2871      "Fatal configuration error."
   2872}
   2873
   2874
   2875# func_config
   2876# -----------
   2877# Display the configuration for all the tags in this script.
   2878func_config ()
   2879{
   2880    re_begincf='^# ### BEGIN LIBTOOL'
   2881    re_endcf='^# ### END LIBTOOL'
   2882
   2883    # Default configuration.
   2884    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
   2885
   2886    # Now print the configurations for the tags.
   2887    for tagname in $taglist; do
   2888      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
   2889    done
   2890
   2891    exit $?
   2892}
   2893
   2894
   2895# func_features
   2896# -------------
   2897# Display the features supported by this script.
   2898func_features ()
   2899{
   2900    echo "host: $host"
   2901    if test yes = "$build_libtool_libs"; then
   2902      echo "enable shared libraries"
   2903    else
   2904      echo "disable shared libraries"
   2905    fi
   2906    if test yes = "$build_old_libs"; then
   2907      echo "enable static libraries"
   2908    else
   2909      echo "disable static libraries"
   2910    fi
   2911
   2912    exit $?
   2913}
   2914
   2915
   2916# func_enable_tag TAGNAME
   2917# -----------------------
   2918# Verify that TAGNAME is valid, and either flag an error and exit, or
   2919# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
   2920# variable here.
   2921func_enable_tag ()
   2922{
   2923    # Global variable:
   2924    tagname=$1
   2925
   2926    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
   2927    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
   2928    sed_extractcf=/$re_begincf/,/$re_endcf/p
   2929
   2930    # Validate tagname.
   2931    case $tagname in
   2932      *[!-_A-Za-z0-9,/]*)
   2933        func_fatal_error "invalid tag name: $tagname"
   2934        ;;
   2935    esac
   2936
   2937    # Don't test for the "default" C tag, as we know it's
   2938    # there but not specially marked.
   2939    case $tagname in
   2940        CC) ;;
   2941    *)
   2942        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
   2943	  taglist="$taglist $tagname"
   2944
   2945	  # Evaluate the configuration.  Be careful to quote the path
   2946	  # and the sed script, to avoid splitting on whitespace, but
   2947	  # also don't use non-portable quotes within backquotes within
   2948	  # quotes we have to do it in 2 steps:
   2949	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
   2950	  eval "$extractedcf"
   2951        else
   2952	  func_error "ignoring unknown tag $tagname"
   2953        fi
   2954        ;;
   2955    esac
   2956}
   2957
   2958
   2959# func_check_version_match
   2960# ------------------------
   2961# Ensure that we are using m4 macros, and libtool script from the same
   2962# release of libtool.
   2963func_check_version_match ()
   2964{
   2965    if test "$package_revision" != "$macro_revision"; then
   2966      if test "$VERSION" != "$macro_version"; then
   2967        if test -z "$macro_version"; then
   2968          cat >&2 <<_LT_EOF
   2969$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
   2970$progname: definition of this LT_INIT comes from an older release.
   2971$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
   2972$progname: and run autoconf again.
   2973_LT_EOF
   2974        else
   2975          cat >&2 <<_LT_EOF
   2976$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
   2977$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
   2978$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
   2979$progname: and run autoconf again.
   2980_LT_EOF
   2981        fi
   2982      else
   2983        cat >&2 <<_LT_EOF
   2984$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
   2985$progname: but the definition of this LT_INIT comes from revision $macro_revision.
   2986$progname: You should recreate aclocal.m4 with macros from revision $package_revision
   2987$progname: of $PACKAGE $VERSION and run autoconf again.
   2988_LT_EOF
   2989      fi
   2990
   2991      exit $EXIT_MISMATCH
   2992    fi
   2993}
   2994
   2995
   2996# libtool_options_prep [ARG]...
   2997# -----------------------------
   2998# Preparation for options parsed by libtool.
   2999libtool_options_prep ()
   3000{
   3001    $debug_mode
   3002
   3003    # Option defaults:
   3004    opt_config=false
   3005    opt_dlopen=
   3006    opt_dry_run=false
   3007    opt_help=false
   3008    opt_mode=
   3009    opt_preserve_dup_deps=false
   3010    opt_quiet=false
   3011
   3012    nonopt=
   3013    preserve_args=
   3014
   3015    _G_rc_lt_options_prep=:
   3016
   3017    # Shorthand for --mode=foo, only valid as the first argument
   3018    case $1 in
   3019    clean|clea|cle|cl)
   3020      shift; set dummy --mode clean ${1+"$@"}; shift
   3021      ;;
   3022    compile|compil|compi|comp|com|co|c)
   3023      shift; set dummy --mode compile ${1+"$@"}; shift
   3024      ;;
   3025    execute|execut|execu|exec|exe|ex|e)
   3026      shift; set dummy --mode execute ${1+"$@"}; shift
   3027      ;;
   3028    finish|finis|fini|fin|fi|f)
   3029      shift; set dummy --mode finish ${1+"$@"}; shift
   3030      ;;
   3031    install|instal|insta|inst|ins|in|i)
   3032      shift; set dummy --mode install ${1+"$@"}; shift
   3033      ;;
   3034    link|lin|li|l)
   3035      shift; set dummy --mode link ${1+"$@"}; shift
   3036      ;;
   3037    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
   3038      shift; set dummy --mode uninstall ${1+"$@"}; shift
   3039      ;;
   3040    *)
   3041      _G_rc_lt_options_prep=false
   3042      ;;
   3043    esac
   3044
   3045    if $_G_rc_lt_options_prep; then
   3046      # Pass back the list of options.
   3047      func_quote eval ${1+"$@"}
   3048      libtool_options_prep_result=$func_quote_result
   3049    fi
   3050}
   3051func_add_hook func_options_prep libtool_options_prep
   3052
   3053
   3054# libtool_parse_options [ARG]...
   3055# ---------------------------------
   3056# Provide handling for libtool specific options.
   3057libtool_parse_options ()
   3058{
   3059    $debug_cmd
   3060
   3061    _G_rc_lt_parse_options=false
   3062
   3063    # Perform our own loop to consume as many options as possible in
   3064    # each iteration.
   3065    while test $# -gt 0; do
   3066      _G_match_lt_parse_options=:
   3067      _G_opt=$1
   3068      shift
   3069      case $_G_opt in
   3070        --dry-run|--dryrun|-n)
   3071                        opt_dry_run=:
   3072                        ;;
   3073
   3074        --config)       func_config ;;
   3075
   3076        --dlopen|-dlopen)
   3077                        opt_dlopen="${opt_dlopen+$opt_dlopen
   3078}$1"
   3079                        shift
   3080                        ;;
   3081
   3082        --preserve-dup-deps)
   3083                        opt_preserve_dup_deps=: ;;
   3084
   3085        --features)     func_features ;;
   3086
   3087        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
   3088
   3089        --help)         opt_help=: ;;
   3090
   3091        --help-all)     opt_help=': help-all' ;;
   3092
   3093        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
   3094                        opt_mode=$1
   3095                        case $1 in
   3096                          # Valid mode arguments:
   3097                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
   3098
   3099                          # Catch anything else as an error
   3100                          *) func_error "invalid argument for $_G_opt"
   3101                             exit_cmd=exit
   3102                             break
   3103                             ;;
   3104                        esac
   3105                        shift
   3106                        ;;
   3107
   3108        --no-silent|--no-quiet)
   3109                        opt_quiet=false
   3110                        func_append preserve_args " $_G_opt"
   3111                        ;;
   3112
   3113        --no-warnings|--no-warning|--no-warn)
   3114                        opt_warning=false
   3115                        func_append preserve_args " $_G_opt"
   3116                        ;;
   3117
   3118        --no-verbose)
   3119                        opt_verbose=false
   3120                        func_append preserve_args " $_G_opt"
   3121                        ;;
   3122
   3123        --silent|--quiet)
   3124                        opt_quiet=:
   3125                        opt_verbose=false
   3126                        func_append preserve_args " $_G_opt"
   3127                        ;;
   3128
   3129        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
   3130                        opt_tag=$1
   3131                        func_append preserve_args " $_G_opt $1"
   3132                        func_enable_tag "$1"
   3133                        shift
   3134                        ;;
   3135
   3136        --verbose|-v)   opt_quiet=false
   3137                        opt_verbose=:
   3138                        func_append preserve_args " $_G_opt"
   3139                        ;;
   3140
   3141        # An option not handled by this hook function:
   3142        *)              set dummy "$_G_opt" ${1+"$@"} ; shift
   3143                        _G_match_lt_parse_options=false
   3144                        break
   3145                        ;;
   3146      esac
   3147      $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
   3148    done
   3149
   3150    if $_G_rc_lt_parse_options; then
   3151      # save modified positional parameters for caller
   3152      func_quote eval ${1+"$@"}
   3153      libtool_parse_options_result=$func_quote_result
   3154    fi
   3155}
   3156func_add_hook func_parse_options libtool_parse_options
   3157
   3158
   3159
   3160# libtool_validate_options [ARG]...
   3161# ---------------------------------
   3162# Perform any sanity checks on option settings and/or unconsumed
   3163# arguments.
   3164libtool_validate_options ()
   3165{
   3166    # save first non-option argument
   3167    if test 0 -lt $#; then
   3168      nonopt=$1
   3169      shift
   3170    fi
   3171
   3172    # preserve --debug
   3173    test : = "$debug_cmd" || func_append preserve_args " --debug"
   3174
   3175    # Keeping compiler generated duplicates in $postdeps and $predeps is not
   3176    # harmful, and is necessary in a majority of systems that use it to satisfy
   3177    # symbol dependencies.
   3178    opt_duplicate_compiler_generated_deps=:
   3179
   3180    $opt_help || {
   3181      # Sanity checks first:
   3182      func_check_version_match
   3183
   3184      test yes != "$build_libtool_libs" \
   3185        && test yes != "$build_old_libs" \
   3186        && func_fatal_configuration "not configured to build any kind of library"
   3187
   3188      # Darwin sucks
   3189      eval std_shrext=\"$shrext_cmds\"
   3190
   3191      # Only execute mode is allowed to have -dlopen flags.
   3192      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
   3193        func_error "unrecognized option '-dlopen'"
   3194        $ECHO "$help" 1>&2
   3195        exit $EXIT_FAILURE
   3196      fi
   3197
   3198      # Change the help message to a mode-specific one.
   3199      generic_help=$help
   3200      help="Try '$progname --help --mode=$opt_mode' for more information."
   3201    }
   3202
   3203    # Pass back the unparsed argument list
   3204    func_quote eval ${1+"$@"}
   3205    libtool_validate_options_result=$func_quote_result
   3206}
   3207func_add_hook func_validate_options libtool_validate_options
   3208
   3209
   3210# Process options as early as possible so that --help and --version
   3211# can return quickly.
   3212func_options ${1+"$@"}
   3213eval set dummy "$func_options_result"; shift
   3214
   3215
   3216
   3217## ----------- ##
   3218##    Main.    ##
   3219## ----------- ##
   3220
   3221magic='%%%MAGIC variable%%%'
   3222magic_exe='%%%MAGIC EXE variable%%%'
   3223
   3224# Global variables.
   3225extracted_archives=
   3226extracted_serial=0
   3227
   3228# If this variable is set in any of the actions, the command in it
   3229# will be execed at the end.  This prevents here-documents from being
   3230# left over by shells.
   3231exec_cmd=
   3232
   3233
   3234# A function that is used when there is no print builtin or printf.
   3235func_fallback_echo ()
   3236{
   3237  eval 'cat <<_LTECHO_EOF
   3238$1
   3239_LTECHO_EOF'
   3240}
   3241
   3242# func_generated_by_libtool
   3243# True iff stdin has been generated by Libtool. This function is only
   3244# a basic sanity check; it will hardly flush out determined imposters.
   3245func_generated_by_libtool_p ()
   3246{
   3247  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
   3248}
   3249
   3250# func_lalib_p file
   3251# True iff FILE is a libtool '.la' library or '.lo' object file.
   3252# This function is only a basic sanity check; it will hardly flush out
   3253# determined imposters.
   3254func_lalib_p ()
   3255{
   3256    test -f "$1" &&
   3257      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
   3258}
   3259
   3260# func_lalib_unsafe_p file
   3261# True iff FILE is a libtool '.la' library or '.lo' object file.
   3262# This function implements the same check as func_lalib_p without
   3263# resorting to external programs.  To this end, it redirects stdin and
   3264# closes it afterwards, without saving the original file descriptor.
   3265# As a safety measure, use it only where a negative result would be
   3266# fatal anyway.  Works if 'file' does not exist.
   3267func_lalib_unsafe_p ()
   3268{
   3269    lalib_p=no
   3270    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
   3271	for lalib_p_l in 1 2 3 4
   3272	do
   3273	    read lalib_p_line
   3274	    case $lalib_p_line in
   3275		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
   3276	    esac
   3277	done
   3278	exec 0<&5 5<&-
   3279    fi
   3280    test yes = "$lalib_p"
   3281}
   3282
   3283# func_ltwrapper_script_p file
   3284# True iff FILE is a libtool wrapper script
   3285# This function is only a basic sanity check; it will hardly flush out
   3286# determined imposters.
   3287func_ltwrapper_script_p ()
   3288{
   3289    test -f "$1" &&
   3290      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
   3291}
   3292
   3293# func_ltwrapper_executable_p file
   3294# True iff FILE is a libtool wrapper executable
   3295# This function is only a basic sanity check; it will hardly flush out
   3296# determined imposters.
   3297func_ltwrapper_executable_p ()
   3298{
   3299    func_ltwrapper_exec_suffix=
   3300    case $1 in
   3301    *.exe) ;;
   3302    *) func_ltwrapper_exec_suffix=.exe ;;
   3303    esac
   3304    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
   3305}
   3306
   3307# func_ltwrapper_scriptname file
   3308# Assumes file is an ltwrapper_executable
   3309# uses $file to determine the appropriate filename for a
   3310# temporary ltwrapper_script.
   3311func_ltwrapper_scriptname ()
   3312{
   3313    func_dirname_and_basename "$1" "" "."
   3314    func_stripname '' '.exe' "$func_basename_result"
   3315    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
   3316}
   3317
   3318# func_ltwrapper_p file
   3319# True iff FILE is a libtool wrapper script or wrapper executable
   3320# This function is only a basic sanity check; it will hardly flush out
   3321# determined imposters.
   3322func_ltwrapper_p ()
   3323{
   3324    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
   3325}
   3326
   3327
   3328# func_execute_cmds commands fail_cmd
   3329# Execute tilde-delimited COMMANDS.
   3330# If FAIL_CMD is given, eval that upon failure.
   3331# FAIL_CMD may read-access the current command in variable CMD!
   3332func_execute_cmds ()
   3333{
   3334    $debug_cmd
   3335
   3336    save_ifs=$IFS; IFS='~'
   3337    for cmd in $1; do
   3338      IFS=$sp$nl
   3339      eval cmd=\"$cmd\"
   3340      IFS=$save_ifs
   3341      func_show_eval "$cmd" "${2-:}"
   3342    done
   3343    IFS=$save_ifs
   3344}
   3345
   3346
   3347# func_source file
   3348# Source FILE, adding directory component if necessary.
   3349# Note that it is not necessary on cygwin/mingw to append a dot to
   3350# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
   3351# behavior happens only for exec(3), not for open(2)!  Also, sourcing
   3352# 'FILE.' does not work on cygwin managed mounts.
   3353func_source ()
   3354{
   3355    $debug_cmd
   3356
   3357    case $1 in
   3358    */* | *\\*)	. "$1" ;;
   3359    *)		. "./$1" ;;
   3360    esac
   3361}
   3362
   3363
   3364# func_resolve_sysroot PATH
   3365# Replace a leading = in PATH with a sysroot.  Store the result into
   3366# func_resolve_sysroot_result
   3367func_resolve_sysroot ()
   3368{
   3369  func_resolve_sysroot_result=$1
   3370  case $func_resolve_sysroot_result in
   3371  =*)
   3372    func_stripname '=' '' "$func_resolve_sysroot_result"
   3373    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
   3374    ;;
   3375  esac
   3376}
   3377
   3378# func_replace_sysroot PATH
   3379# If PATH begins with the sysroot, replace it with = and
   3380# store the result into func_replace_sysroot_result.
   3381func_replace_sysroot ()
   3382{
   3383  case $lt_sysroot:$1 in
   3384  ?*:"$lt_sysroot"*)
   3385    func_stripname "$lt_sysroot" '' "$1"
   3386    func_replace_sysroot_result='='$func_stripname_result
   3387    ;;
   3388  *)
   3389    # Including no sysroot.
   3390    func_replace_sysroot_result=$1
   3391    ;;
   3392  esac
   3393}
   3394
   3395# func_infer_tag arg
   3396# Infer tagged configuration to use if any are available and
   3397# if one wasn't chosen via the "--tag" command line option.
   3398# Only attempt this if the compiler in the base compile
   3399# command doesn't match the default compiler.
   3400# arg is usually of the form 'gcc ...'
   3401func_infer_tag ()
   3402{
   3403    $debug_cmd
   3404
   3405    if test -n "$available_tags" && test -z "$tagname"; then
   3406      CC_quoted=
   3407      for arg in $CC; do
   3408	func_append_quoted CC_quoted "$arg"
   3409      done
   3410      CC_expanded=`func_echo_all $CC`
   3411      CC_quoted_expanded=`func_echo_all $CC_quoted`
   3412      case $@ in
   3413      # Blanks in the command may have been stripped by the calling shell,
   3414      # but not from the CC environment variable when configure was run.
   3415      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
   3416      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
   3417      # Blanks at the start of $base_compile will cause this to fail
   3418      # if we don't check for them as well.
   3419      *)
   3420	for z in $available_tags; do
   3421	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
   3422	    # Evaluate the configuration.
   3423	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
   3424	    CC_quoted=
   3425	    for arg in $CC; do
   3426	      # Double-quote args containing other shell metacharacters.
   3427	      func_append_quoted CC_quoted "$arg"
   3428	    done
   3429	    CC_expanded=`func_echo_all $CC`
   3430	    CC_quoted_expanded=`func_echo_all $CC_quoted`
   3431	    case "$@ " in
   3432	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
   3433	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
   3434	      # The compiler in the base compile command matches
   3435	      # the one in the tagged configuration.
   3436	      # Assume this is the tagged configuration we want.
   3437	      tagname=$z
   3438	      break
   3439	      ;;
   3440	    esac
   3441	  fi
   3442	done
   3443	# If $tagname still isn't set, then no tagged configuration
   3444	# was found and let the user know that the "--tag" command
   3445	# line option must be used.
   3446	if test -z "$tagname"; then
   3447	  func_echo "unable to infer tagged configuration"
   3448	  func_fatal_error "specify a tag with '--tag'"
   3449#	else
   3450#	  func_verbose "using $tagname tagged configuration"
   3451	fi
   3452	;;
   3453      esac
   3454    fi
   3455}
   3456
   3457
   3458
   3459# func_write_libtool_object output_name pic_name nonpic_name
   3460# Create a libtool object file (analogous to a ".la" file),
   3461# but don't create it if we're doing a dry run.
   3462func_write_libtool_object ()
   3463{
   3464    write_libobj=$1
   3465    if test yes = "$build_libtool_libs"; then
   3466      write_lobj=\'$2\'
   3467    else
   3468      write_lobj=none
   3469    fi
   3470
   3471    if test yes = "$build_old_libs"; then
   3472      write_oldobj=\'$3\'
   3473    else
   3474      write_oldobj=none
   3475    fi
   3476
   3477    $opt_dry_run || {
   3478      cat >${write_libobj}T <<EOF
   3479# $write_libobj - a libtool object file
   3480# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
   3481#
   3482# Please DO NOT delete this file!
   3483# It is necessary for linking the library.
   3484
   3485# Name of the PIC object.
   3486pic_object=$write_lobj
   3487
   3488# Name of the non-PIC object
   3489non_pic_object=$write_oldobj
   3490
   3491EOF
   3492      $MV "${write_libobj}T" "$write_libobj"
   3493    }
   3494}
   3495
   3496
   3497##################################################
   3498# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
   3499##################################################
   3500
   3501# func_convert_core_file_wine_to_w32 ARG
   3502# Helper function used by file name conversion functions when $build is *nix,
   3503# and $host is mingw, cygwin, or some other w32 environment. Relies on a
   3504# correctly configured wine environment available, with the winepath program
   3505# in $build's $PATH.
   3506#
   3507# ARG is the $build file name to be converted to w32 format.
   3508# Result is available in $func_convert_core_file_wine_to_w32_result, and will
   3509# be empty on error (or when ARG is empty)
   3510func_convert_core_file_wine_to_w32 ()
   3511{
   3512  $debug_cmd
   3513
   3514  func_convert_core_file_wine_to_w32_result=$1
   3515  if test -n "$1"; then
   3516    # Unfortunately, winepath does not exit with a non-zero error code, so we
   3517    # are forced to check the contents of stdout. On the other hand, if the
   3518    # command is not found, the shell will set an exit code of 127 and print
   3519    # *an error message* to stdout. So we must check for both error code of
   3520    # zero AND non-empty stdout, which explains the odd construction:
   3521    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
   3522    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
   3523      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
   3524        $SED -e "$sed_naive_backslashify"`
   3525    else
   3526      func_convert_core_file_wine_to_w32_result=
   3527    fi
   3528  fi
   3529}
   3530# end: func_convert_core_file_wine_to_w32
   3531
   3532
   3533# func_convert_core_path_wine_to_w32 ARG
   3534# Helper function used by path conversion functions when $build is *nix, and
   3535# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
   3536# configured wine environment available, with the winepath program in $build's
   3537# $PATH. Assumes ARG has no leading or trailing path separator characters.
   3538#
   3539# ARG is path to be converted from $build format to win32.
   3540# Result is available in $func_convert_core_path_wine_to_w32_result.
   3541# Unconvertible file (directory) names in ARG are skipped; if no directory names
   3542# are convertible, then the result may be empty.
   3543func_convert_core_path_wine_to_w32 ()
   3544{
   3545  $debug_cmd
   3546
   3547  # unfortunately, winepath doesn't convert paths, only file names
   3548  func_convert_core_path_wine_to_w32_result=
   3549  if test -n "$1"; then
   3550    oldIFS=$IFS
   3551    IFS=:
   3552    for func_convert_core_path_wine_to_w32_f in $1; do
   3553      IFS=$oldIFS
   3554      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
   3555      if test -n "$func_convert_core_file_wine_to_w32_result"; then
   3556        if test -z "$func_convert_core_path_wine_to_w32_result"; then
   3557          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
   3558        else
   3559          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
   3560        fi
   3561      fi
   3562    done
   3563    IFS=$oldIFS
   3564  fi
   3565}
   3566# end: func_convert_core_path_wine_to_w32
   3567
   3568
   3569# func_cygpath ARGS...
   3570# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
   3571# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
   3572# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
   3573# (2), returns the Cygwin file name or path in func_cygpath_result (input
   3574# file name or path is assumed to be in w32 format, as previously converted
   3575# from $build's *nix or MSYS format). In case (3), returns the w32 file name
   3576# or path in func_cygpath_result (input file name or path is assumed to be in
   3577# Cygwin format). Returns an empty string on error.
   3578#
   3579# ARGS are passed to cygpath, with the last one being the file name or path to
   3580# be converted.
   3581#
   3582# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
   3583# environment variable; do not put it in $PATH.
   3584func_cygpath ()
   3585{
   3586  $debug_cmd
   3587
   3588  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
   3589    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
   3590    if test "$?" -ne 0; then
   3591      # on failure, ensure result is empty
   3592      func_cygpath_result=
   3593    fi
   3594  else
   3595    func_cygpath_result=
   3596    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
   3597  fi
   3598}
   3599#end: func_cygpath
   3600
   3601
   3602# func_convert_core_msys_to_w32 ARG
   3603# Convert file name or path ARG from MSYS format to w32 format.  Return
   3604# result in func_convert_core_msys_to_w32_result.
   3605func_convert_core_msys_to_w32 ()
   3606{
   3607  $debug_cmd
   3608
   3609  # awkward: cmd appends spaces to result
   3610  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
   3611    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
   3612}
   3613#end: func_convert_core_msys_to_w32
   3614
   3615
   3616# func_convert_file_check ARG1 ARG2
   3617# Verify that ARG1 (a file name in $build format) was converted to $host
   3618# format in ARG2. Otherwise, emit an error message, but continue (resetting
   3619# func_to_host_file_result to ARG1).
   3620func_convert_file_check ()
   3621{
   3622  $debug_cmd
   3623
   3624  if test -z "$2" && test -n "$1"; then
   3625    func_error "Could not determine host file name corresponding to"
   3626    func_error "  '$1'"
   3627    func_error "Continuing, but uninstalled executables may not work."
   3628    # Fallback:
   3629    func_to_host_file_result=$1
   3630  fi
   3631}
   3632# end func_convert_file_check
   3633
   3634
   3635# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
   3636# Verify that FROM_PATH (a path in $build format) was converted to $host
   3637# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
   3638# func_to_host_file_result to a simplistic fallback value (see below).
   3639func_convert_path_check ()
   3640{
   3641  $debug_cmd
   3642
   3643  if test -z "$4" && test -n "$3"; then
   3644    func_error "Could not determine the host path corresponding to"
   3645    func_error "  '$3'"
   3646    func_error "Continuing, but uninstalled executables may not work."
   3647    # Fallback.  This is a deliberately simplistic "conversion" and
   3648    # should not be "improved".  See libtool.info.
   3649    if test "x$1" != "x$2"; then
   3650      lt_replace_pathsep_chars="s|$1|$2|g"
   3651      func_to_host_path_result=`echo "$3" |
   3652        $SED -e "$lt_replace_pathsep_chars"`
   3653    else
   3654      func_to_host_path_result=$3
   3655    fi
   3656  fi
   3657}
   3658# end func_convert_path_check
   3659
   3660
   3661# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
   3662# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
   3663# and appending REPL if ORIG matches BACKPAT.
   3664func_convert_path_front_back_pathsep ()
   3665{
   3666  $debug_cmd
   3667
   3668  case $4 in
   3669  $1 ) func_to_host_path_result=$3$func_to_host_path_result
   3670    ;;
   3671  esac
   3672  case $4 in
   3673  $2 ) func_append func_to_host_path_result "$3"
   3674    ;;
   3675  esac
   3676}
   3677# end func_convert_path_front_back_pathsep
   3678
   3679
   3680##################################################
   3681# $build to $host FILE NAME CONVERSION FUNCTIONS #
   3682##################################################
   3683# invoked via '$to_host_file_cmd ARG'
   3684#
   3685# In each case, ARG is the path to be converted from $build to $host format.
   3686# Result will be available in $func_to_host_file_result.
   3687
   3688
   3689# func_to_host_file ARG
   3690# Converts the file name ARG from $build format to $host format. Return result
   3691# in func_to_host_file_result.
   3692func_to_host_file ()
   3693{
   3694  $debug_cmd
   3695
   3696  $to_host_file_cmd "$1"
   3697}
   3698# end func_to_host_file
   3699
   3700
   3701# func_to_tool_file ARG LAZY
   3702# converts the file name ARG from $build format to toolchain format. Return
   3703# result in func_to_tool_file_result.  If the conversion in use is listed
   3704# in (the comma separated) LAZY, no conversion takes place.
   3705func_to_tool_file ()
   3706{
   3707  $debug_cmd
   3708
   3709  case ,$2, in
   3710    *,"$to_tool_file_cmd",*)
   3711      func_to_tool_file_result=$1
   3712      ;;
   3713    *)
   3714      $to_tool_file_cmd "$1"
   3715      func_to_tool_file_result=$func_to_host_file_result
   3716      ;;
   3717  esac
   3718}
   3719# end func_to_tool_file
   3720
   3721
   3722# func_convert_file_noop ARG
   3723# Copy ARG to func_to_host_file_result.
   3724func_convert_file_noop ()
   3725{
   3726  func_to_host_file_result=$1
   3727}
   3728# end func_convert_file_noop
   3729
   3730
   3731# func_convert_file_msys_to_w32 ARG
   3732# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
   3733# conversion to w32 is not available inside the cwrapper.  Returns result in
   3734# func_to_host_file_result.
   3735func_convert_file_msys_to_w32 ()
   3736{
   3737  $debug_cmd
   3738
   3739  func_to_host_file_result=$1
   3740  if test -n "$1"; then
   3741    func_convert_core_msys_to_w32 "$1"
   3742    func_to_host_file_result=$func_convert_core_msys_to_w32_result
   3743  fi
   3744  func_convert_file_check "$1" "$func_to_host_file_result"
   3745}
   3746# end func_convert_file_msys_to_w32
   3747
   3748
   3749# func_convert_file_cygwin_to_w32 ARG
   3750# Convert file name ARG from Cygwin to w32 format.  Returns result in
   3751# func_to_host_file_result.
   3752func_convert_file_cygwin_to_w32 ()
   3753{
   3754  $debug_cmd
   3755
   3756  func_to_host_file_result=$1
   3757  if test -n "$1"; then
   3758    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
   3759    # LT_CYGPATH in this case.
   3760    func_to_host_file_result=`cygpath -m "$1"`
   3761  fi
   3762  func_convert_file_check "$1" "$func_to_host_file_result"
   3763}
   3764# end func_convert_file_cygwin_to_w32
   3765
   3766
   3767# func_convert_file_nix_to_w32 ARG
   3768# Convert file name ARG from *nix to w32 format.  Requires a wine environment
   3769# and a working winepath. Returns result in func_to_host_file_result.
   3770func_convert_file_nix_to_w32 ()
   3771{
   3772  $debug_cmd
   3773
   3774  func_to_host_file_result=$1
   3775  if test -n "$1"; then
   3776    func_convert_core_file_wine_to_w32 "$1"
   3777    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
   3778  fi
   3779  func_convert_file_check "$1" "$func_to_host_file_result"
   3780}
   3781# end func_convert_file_nix_to_w32
   3782
   3783
   3784# func_convert_file_msys_to_cygwin ARG
   3785# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
   3786# Returns result in func_to_host_file_result.
   3787func_convert_file_msys_to_cygwin ()
   3788{
   3789  $debug_cmd
   3790
   3791  func_to_host_file_result=$1
   3792  if test -n "$1"; then
   3793    func_convert_core_msys_to_w32 "$1"
   3794    func_cygpath -u "$func_convert_core_msys_to_w32_result"
   3795    func_to_host_file_result=$func_cygpath_result
   3796  fi
   3797  func_convert_file_check "$1" "$func_to_host_file_result"
   3798}
   3799# end func_convert_file_msys_to_cygwin
   3800
   3801
   3802# func_convert_file_nix_to_cygwin ARG
   3803# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
   3804# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
   3805# in func_to_host_file_result.
   3806func_convert_file_nix_to_cygwin ()
   3807{
   3808  $debug_cmd
   3809
   3810  func_to_host_file_result=$1
   3811  if test -n "$1"; then
   3812    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
   3813    func_convert_core_file_wine_to_w32 "$1"
   3814    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
   3815    func_to_host_file_result=$func_cygpath_result
   3816  fi
   3817  func_convert_file_check "$1" "$func_to_host_file_result"
   3818}
   3819# end func_convert_file_nix_to_cygwin
   3820
   3821
   3822#############################################
   3823# $build to $host PATH CONVERSION FUNCTIONS #
   3824#############################################
   3825# invoked via '$to_host_path_cmd ARG'
   3826#
   3827# In each case, ARG is the path to be converted from $build to $host format.
   3828# The result will be available in $func_to_host_path_result.
   3829#
   3830# Path separators are also converted from $build format to $host format.  If
   3831# ARG begins or ends with a path separator character, it is preserved (but
   3832# converted to $host format) on output.
   3833#
   3834# All path conversion functions are named using the following convention:
   3835#   file name conversion function    : func_convert_file_X_to_Y ()
   3836#   path conversion function         : func_convert_path_X_to_Y ()
   3837# where, for any given $build/$host combination the 'X_to_Y' value is the
   3838# same.  If conversion functions are added for new $build/$host combinations,
   3839# the two new functions must follow this pattern, or func_init_to_host_path_cmd
   3840# will break.
   3841
   3842
   3843# func_init_to_host_path_cmd
   3844# Ensures that function "pointer" variable $to_host_path_cmd is set to the
   3845# appropriate value, based on the value of $to_host_file_cmd.
   3846to_host_path_cmd=
   3847func_init_to_host_path_cmd ()
   3848{
   3849  $debug_cmd
   3850
   3851  if test -z "$to_host_path_cmd"; then
   3852    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
   3853    to_host_path_cmd=func_convert_path_$func_stripname_result
   3854  fi
   3855}
   3856
   3857
   3858# func_to_host_path ARG
   3859# Converts the path ARG from $build format to $host format. Return result
   3860# in func_to_host_path_result.
   3861func_to_host_path ()
   3862{
   3863  $debug_cmd
   3864
   3865  func_init_to_host_path_cmd
   3866  $to_host_path_cmd "$1"
   3867}
   3868# end func_to_host_path
   3869
   3870
   3871# func_convert_path_noop ARG
   3872# Copy ARG to func_to_host_path_result.
   3873func_convert_path_noop ()
   3874{
   3875  func_to_host_path_result=$1
   3876}
   3877# end func_convert_path_noop
   3878
   3879
   3880# func_convert_path_msys_to_w32 ARG
   3881# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
   3882# conversion to w32 is not available inside the cwrapper.  Returns result in
   3883# func_to_host_path_result.
   3884func_convert_path_msys_to_w32 ()
   3885{
   3886  $debug_cmd
   3887
   3888  func_to_host_path_result=$1
   3889  if test -n "$1"; then
   3890    # Remove leading and trailing path separator characters from ARG.  MSYS
   3891    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
   3892    # and winepath ignores them completely.
   3893    func_stripname : : "$1"
   3894    func_to_host_path_tmp1=$func_stripname_result
   3895    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
   3896    func_to_host_path_result=$func_convert_core_msys_to_w32_result
   3897    func_convert_path_check : ";" \
   3898      "$func_to_host_path_tmp1" "$func_to_host_path_result"
   3899    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
   3900  fi
   3901}
   3902# end func_convert_path_msys_to_w32
   3903
   3904
   3905# func_convert_path_cygwin_to_w32 ARG
   3906# Convert path ARG from Cygwin to w32 format.  Returns result in
   3907# func_to_host_file_result.
   3908func_convert_path_cygwin_to_w32 ()
   3909{
   3910  $debug_cmd
   3911
   3912  func_to_host_path_result=$1
   3913  if test -n "$1"; then
   3914    # See func_convert_path_msys_to_w32:
   3915    func_stripname : : "$1"
   3916    func_to_host_path_tmp1=$func_stripname_result
   3917    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
   3918    func_convert_path_check : ";" \
   3919      "$func_to_host_path_tmp1" "$func_to_host_path_result"
   3920    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
   3921  fi
   3922}
   3923# end func_convert_path_cygwin_to_w32
   3924
   3925
   3926# func_convert_path_nix_to_w32 ARG
   3927# Convert path ARG from *nix to w32 format.  Requires a wine environment and
   3928# a working winepath.  Returns result in func_to_host_file_result.
   3929func_convert_path_nix_to_w32 ()
   3930{
   3931  $debug_cmd
   3932
   3933  func_to_host_path_result=$1
   3934  if test -n "$1"; then
   3935    # See func_convert_path_msys_to_w32:
   3936    func_stripname : : "$1"
   3937    func_to_host_path_tmp1=$func_stripname_result
   3938    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
   3939    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
   3940    func_convert_path_check : ";" \
   3941      "$func_to_host_path_tmp1" "$func_to_host_path_result"
   3942    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
   3943  fi
   3944}
   3945# end func_convert_path_nix_to_w32
   3946
   3947
   3948# func_convert_path_msys_to_cygwin ARG
   3949# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
   3950# Returns result in func_to_host_file_result.
   3951func_convert_path_msys_to_cygwin ()
   3952{
   3953  $debug_cmd
   3954
   3955  func_to_host_path_result=$1
   3956  if test -n "$1"; then
   3957    # See func_convert_path_msys_to_w32:
   3958    func_stripname : : "$1"
   3959    func_to_host_path_tmp1=$func_stripname_result
   3960    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
   3961    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
   3962    func_to_host_path_result=$func_cygpath_result
   3963    func_convert_path_check : : \
   3964      "$func_to_host_path_tmp1" "$func_to_host_path_result"
   3965    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
   3966  fi
   3967}
   3968# end func_convert_path_msys_to_cygwin
   3969
   3970
   3971# func_convert_path_nix_to_cygwin ARG
   3972# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
   3973# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
   3974# func_to_host_file_result.
   3975func_convert_path_nix_to_cygwin ()
   3976{
   3977  $debug_cmd
   3978
   3979  func_to_host_path_result=$1
   3980  if test -n "$1"; then
   3981    # Remove leading and trailing path separator characters from
   3982    # ARG. msys behavior is inconsistent here, cygpath turns them
   3983    # into '.;' and ';.', and winepath ignores them completely.
   3984    func_stripname : : "$1"
   3985    func_to_host_path_tmp1=$func_stripname_result
   3986    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
   3987    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
   3988    func_to_host_path_result=$func_cygpath_result
   3989    func_convert_path_check : : \
   3990      "$func_to_host_path_tmp1" "$func_to_host_path_result"
   3991    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
   3992  fi
   3993}
   3994# end func_convert_path_nix_to_cygwin
   3995
   3996
   3997# func_dll_def_p FILE
   3998# True iff FILE is a Windows DLL '.def' file.
   3999# Keep in sync with _LT_DLL_DEF_P in libtool.m4
   4000func_dll_def_p ()
   4001{
   4002  $debug_cmd
   4003
   4004  func_dll_def_p_tmp=`$SED -n \
   4005    -e 's/^[	 ]*//' \
   4006    -e '/^\(;.*\)*$/d' \
   4007    -e 's/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p' \
   4008    -e q \
   4009    "$1"`
   4010  test DEF = "$func_dll_def_p_tmp"
   4011}
   4012
   4013
   4014# func_mode_compile arg...
   4015func_mode_compile ()
   4016{
   4017    $debug_cmd
   4018
   4019    # Get the compilation command and the source file.
   4020    base_compile=
   4021    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
   4022    suppress_opt=yes
   4023    suppress_output=
   4024    arg_mode=normal
   4025    libobj=
   4026    later=
   4027    pie_flag=
   4028
   4029    for arg
   4030    do
   4031      case $arg_mode in
   4032      arg  )
   4033	# do not "continue".  Instead, add this to base_compile
   4034	lastarg=$arg
   4035	arg_mode=normal
   4036	;;
   4037
   4038      target )
   4039	libobj=$arg
   4040	arg_mode=normal
   4041	continue
   4042	;;
   4043
   4044      normal )
   4045	# Accept any command-line options.
   4046	case $arg in
   4047	-o)
   4048	  test -n "$libobj" && \
   4049	    func_fatal_error "you cannot specify '-o' more than once"
   4050	  arg_mode=target
   4051	  continue
   4052	  ;;
   4053
   4054	-pie | -fpie | -fPIE)
   4055          func_append pie_flag " $arg"
   4056	  continue
   4057	  ;;
   4058
   4059	-shared | -static | -prefer-pic | -prefer-non-pic)
   4060	  func_append later " $arg"
   4061	  continue
   4062	  ;;
   4063
   4064	-no-suppress)
   4065	  suppress_opt=no
   4066	  continue
   4067	  ;;
   4068
   4069	-Xcompiler)
   4070	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
   4071	  continue      #  The current "srcfile" will either be retained or
   4072	  ;;            #  replaced later.  I would guess that would be a bug.
   4073
   4074	-Wc,*)
   4075	  func_stripname '-Wc,' '' "$arg"
   4076	  args=$func_stripname_result
   4077	  lastarg=
   4078	  save_ifs=$IFS; IFS=,
   4079	  for arg in $args; do
   4080	    IFS=$save_ifs
   4081	    func_append_quoted lastarg "$arg"
   4082	  done
   4083	  IFS=$save_ifs
   4084	  func_stripname ' ' '' "$lastarg"
   4085	  lastarg=$func_stripname_result
   4086
   4087	  # Add the arguments to base_compile.
   4088	  func_append base_compile " $lastarg"
   4089	  continue
   4090	  ;;
   4091
   4092	*)
   4093	  # Accept the current argument as the source file.
   4094	  # The previous "srcfile" becomes the current argument.
   4095	  #
   4096	  lastarg=$srcfile
   4097	  srcfile=$arg
   4098	  ;;
   4099	esac  #  case $arg
   4100	;;
   4101      esac    #  case $arg_mode
   4102
   4103      # Aesthetically quote the previous argument.
   4104      func_append_quoted base_compile "$lastarg"
   4105    done # for arg
   4106
   4107    case $arg_mode in
   4108    arg)
   4109      func_fatal_error "you must specify an argument for -Xcompile"
   4110      ;;
   4111    target)
   4112      func_fatal_error "you must specify a target with '-o'"
   4113      ;;
   4114    *)
   4115      # Get the name of the library object.
   4116      test -z "$libobj" && {
   4117	func_basename "$srcfile"
   4118	libobj=$func_basename_result
   4119      }
   4120      ;;
   4121    esac
   4122
   4123    # Recognize several different file suffixes.
   4124    # If the user specifies -o file.o, it is replaced with file.lo
   4125    case $libobj in
   4126    *.[cCFSifmso] | \
   4127    *.ada | *.adb | *.ads | *.asm | \
   4128    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
   4129    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
   4130      func_xform "$libobj"
   4131      libobj=$func_xform_result
   4132      ;;
   4133    esac
   4134
   4135    case $libobj in
   4136    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
   4137    *)
   4138      func_fatal_error "cannot determine name of library object from '$libobj'"
   4139      ;;
   4140    esac
   4141
   4142    func_infer_tag $base_compile
   4143
   4144    for arg in $later; do
   4145      case $arg in
   4146      -shared)
   4147	test yes = "$build_libtool_libs" \
   4148	  || func_fatal_configuration "cannot build a shared library"
   4149	build_old_libs=no
   4150	continue
   4151	;;
   4152
   4153      -static)
   4154	build_libtool_libs=no
   4155	build_old_libs=yes
   4156	continue
   4157	;;
   4158
   4159      -prefer-pic)
   4160	pic_mode=yes
   4161	continue
   4162	;;
   4163
   4164      -prefer-non-pic)
   4165	pic_mode=no
   4166	continue
   4167	;;
   4168      esac
   4169    done
   4170
   4171    func_quote_arg pretty "$libobj"
   4172    test "X$libobj" != "X$func_quote_arg_result" \
   4173      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
   4174      && func_warning "libobj name '$libobj' may not contain shell special characters."
   4175    func_dirname_and_basename "$obj" "/" ""
   4176    objname=$func_basename_result
   4177    xdir=$func_dirname_result
   4178    lobj=$xdir$objdir/$objname
   4179
   4180    test -z "$base_compile" && \
   4181      func_fatal_help "you must specify a compilation command"
   4182
   4183    # Delete any leftover library objects.
   4184    if test yes = "$build_old_libs"; then
   4185      removelist="$obj $lobj $libobj ${libobj}T"
   4186    else
   4187      removelist="$lobj $libobj ${libobj}T"
   4188    fi
   4189
   4190    # On Cygwin there's no "real" PIC flag so we must build both object types
   4191    case $host_os in
   4192    cygwin* | mingw* | pw32* | os2* | cegcc*)
   4193      pic_mode=default
   4194      ;;
   4195    esac
   4196    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
   4197      # non-PIC code in shared libraries is not supported
   4198      pic_mode=default
   4199    fi
   4200
   4201    # Calculate the filename of the output object if compiler does
   4202    # not support -o with -c
   4203    if test no = "$compiler_c_o"; then
   4204      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
   4205      lockfile=$output_obj.lock
   4206    else
   4207      output_obj=
   4208      need_locks=no
   4209      lockfile=
   4210    fi
   4211
   4212    # Lock this critical section if it is needed
   4213    # We use this script file to make the link, it avoids creating a new file
   4214    if test yes = "$need_locks"; then
   4215      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
   4216	func_echo "Waiting for $lockfile to be removed"
   4217	sleep 2
   4218      done
   4219    elif test warn = "$need_locks"; then
   4220      if test -f "$lockfile"; then
   4221	$ECHO "\
   4222*** ERROR, $lockfile exists and contains:
   4223`cat $lockfile 2>/dev/null`
   4224
   4225This indicates that another process is trying to use the same
   4226temporary object file, and libtool could not work around it because
   4227your compiler does not support '-c' and '-o' together.  If you
   4228repeat this compilation, it may succeed, by chance, but you had better
   4229avoid parallel builds (make -j) in this platform, or get a better
   4230compiler."
   4231
   4232	$opt_dry_run || $RM $removelist
   4233	exit $EXIT_FAILURE
   4234      fi
   4235      func_append removelist " $output_obj"
   4236      $ECHO "$srcfile" > "$lockfile"
   4237    fi
   4238
   4239    $opt_dry_run || $RM $removelist
   4240    func_append removelist " $lockfile"
   4241    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
   4242
   4243    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
   4244    srcfile=$func_to_tool_file_result
   4245    func_quote_arg pretty "$srcfile"
   4246    qsrcfile=$func_quote_arg_result
   4247
   4248    # Only build a PIC object if we are building libtool libraries.
   4249    if test yes = "$build_libtool_libs"; then
   4250      # Without this assignment, base_compile gets emptied.
   4251      fbsd_hideous_sh_bug=$base_compile
   4252
   4253      if test no != "$pic_mode"; then
   4254	command="$base_compile $qsrcfile $pic_flag"
   4255      else
   4256	# Don't build PIC code
   4257	command="$base_compile $qsrcfile"
   4258      fi
   4259
   4260      func_mkdir_p "$xdir$objdir"
   4261
   4262      if test -z "$output_obj"; then
   4263	# Place PIC objects in $objdir
   4264	func_append command " -o $lobj"
   4265      fi
   4266
   4267      func_show_eval_locale "$command"	\
   4268          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
   4269
   4270      if test warn = "$need_locks" &&
   4271	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   4272	$ECHO "\
   4273*** ERROR, $lockfile contains:
   4274`cat $lockfile 2>/dev/null`
   4275
   4276but it should contain:
   4277$srcfile
   4278
   4279This indicates that another process is trying to use the same
   4280temporary object file, and libtool could not work around it because
   4281your compiler does not support '-c' and '-o' together.  If you
   4282repeat this compilation, it may succeed, by chance, but you had better
   4283avoid parallel builds (make -j) in this platform, or get a better
   4284compiler."
   4285
   4286	$opt_dry_run || $RM $removelist
   4287	exit $EXIT_FAILURE
   4288      fi
   4289
   4290      # Just move the object if needed, then go on to compile the next one
   4291      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
   4292	func_show_eval '$MV "$output_obj" "$lobj"' \
   4293	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
   4294      fi
   4295
   4296      # Allow error messages only from the first compilation.
   4297      if test yes = "$suppress_opt"; then
   4298	suppress_output=' >/dev/null 2>&1'
   4299      fi
   4300    fi
   4301
   4302    # Only build a position-dependent object if we build old libraries.
   4303    if test yes = "$build_old_libs"; then
   4304      if test yes != "$pic_mode"; then
   4305	# Don't build PIC code
   4306	command="$base_compile $qsrcfile$pie_flag"
   4307      else
   4308	command="$base_compile $qsrcfile $pic_flag"
   4309      fi
   4310      if test yes = "$compiler_c_o"; then
   4311	func_append command " -o $obj"
   4312      fi
   4313
   4314      # Suppress compiler output if we already did a PIC compilation.
   4315      func_append command "$suppress_output"
   4316      func_show_eval_locale "$command" \
   4317        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
   4318
   4319      if test warn = "$need_locks" &&
   4320	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   4321	$ECHO "\
   4322*** ERROR, $lockfile contains:
   4323`cat $lockfile 2>/dev/null`
   4324
   4325but it should contain:
   4326$srcfile
   4327
   4328This indicates that another process is trying to use the same
   4329temporary object file, and libtool could not work around it because
   4330your compiler does not support '-c' and '-o' together.  If you
   4331repeat this compilation, it may succeed, by chance, but you had better
   4332avoid parallel builds (make -j) in this platform, or get a better
   4333compiler."
   4334
   4335	$opt_dry_run || $RM $removelist
   4336	exit $EXIT_FAILURE
   4337      fi
   4338
   4339      # Just move the object if needed
   4340      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
   4341	func_show_eval '$MV "$output_obj" "$obj"' \
   4342	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
   4343      fi
   4344    fi
   4345
   4346    $opt_dry_run || {
   4347      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
   4348
   4349      # Unlock the critical section if it was locked
   4350      if test no != "$need_locks"; then
   4351	removelist=$lockfile
   4352        $RM "$lockfile"
   4353      fi
   4354    }
   4355
   4356    exit $EXIT_SUCCESS
   4357}
   4358
   4359$opt_help || {
   4360  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
   4361}
   4362
   4363func_mode_help ()
   4364{
   4365    # We need to display help for each of the modes.
   4366    case $opt_mode in
   4367      "")
   4368        # Generic help is extracted from the usage comments
   4369        # at the start of this file.
   4370        func_help
   4371        ;;
   4372
   4373      clean)
   4374        $ECHO \
   4375"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
   4376
   4377Remove files from the build directory.
   4378
   4379RM is the name of the program to use to delete files associated with each FILE
   4380(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
   4381to RM.
   4382
   4383If FILE is a libtool library, object or program, all the files associated
   4384with it are deleted. Otherwise, only FILE itself is deleted using RM."
   4385        ;;
   4386
   4387      compile)
   4388      $ECHO \
   4389"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
   4390
   4391Compile a source file into a libtool library object.
   4392
   4393This mode accepts the following additional options:
   4394
   4395  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   4396  -no-suppress      do not suppress compiler output for multiple passes
   4397  -prefer-pic       try to build PIC objects only
   4398  -prefer-non-pic   try to build non-PIC objects only
   4399  -shared           do not build a '.o' file suitable for static linking
   4400  -static           only build a '.o' file suitable for static linking
   4401  -Wc,FLAG
   4402  -Xcompiler FLAG   pass FLAG directly to the compiler
   4403
   4404COMPILE-COMMAND is a command to be used in creating a 'standard' object file
   4405from the given SOURCEFILE.
   4406
   4407The output file name is determined by removing the directory component from
   4408SOURCEFILE, then substituting the C source code suffix '.c' with the
   4409library object suffix, '.lo'."
   4410        ;;
   4411
   4412      execute)
   4413        $ECHO \
   4414"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
   4415
   4416Automatically set library path, then run a program.
   4417
   4418This mode accepts the following additional options:
   4419
   4420  -dlopen FILE      add the directory containing FILE to the library path
   4421
   4422This mode sets the library path environment variable according to '-dlopen'
   4423flags.
   4424
   4425If any of the ARGS are libtool executable wrappers, then they are translated
   4426into their corresponding uninstalled binary, and any of their required library
   4427directories are added to the library path.
   4428
   4429Then, COMMAND is executed, with ARGS as arguments."
   4430        ;;
   4431
   4432      finish)
   4433        $ECHO \
   4434"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
   4435
   4436Complete the installation of libtool libraries.
   4437
   4438Each LIBDIR is a directory that contains libtool libraries.
   4439
   4440The commands that this mode executes may require superuser privileges.  Use
   4441the '--dry-run' option if you just want to see what would be executed."
   4442        ;;
   4443
   4444      install)
   4445        $ECHO \
   4446"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
   4447
   4448Install executables or libraries.
   4449
   4450INSTALL-COMMAND is the installation command.  The first component should be
   4451either the 'install' or 'cp' program.
   4452
   4453The following components of INSTALL-COMMAND are treated specially:
   4454
   4455  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
   4456
   4457The rest of the components are interpreted as arguments to that command (only
   4458BSD-compatible install options are recognized)."
   4459        ;;
   4460
   4461      link)
   4462        $ECHO \
   4463"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
   4464
   4465Link object files or libraries together to form another library, or to
   4466create an executable program.
   4467
   4468LINK-COMMAND is a command using the C compiler that you would use to create
   4469a program from several object files.
   4470
   4471The following components of LINK-COMMAND are treated specially:
   4472
   4473  -all-static       do not do any dynamic linking at all
   4474  -avoid-version    do not add a version suffix if possible
   4475  -bindir BINDIR    specify path to binaries directory (for systems where
   4476                    libraries must be found in the PATH setting at runtime)
   4477  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
   4478  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   4479  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   4480  -export-symbols SYMFILE
   4481                    try to export only the symbols listed in SYMFILE
   4482  -export-symbols-regex REGEX
   4483                    try to export only the symbols matching REGEX
   4484  -LLIBDIR          search LIBDIR for required installed libraries
   4485  -lNAME            OUTPUT-FILE requires the installed library libNAME
   4486  -module           build a library that can dlopened
   4487  -no-fast-install  disable the fast-install mode
   4488  -no-install       link a not-installable executable
   4489  -no-undefined     declare that a library does not refer to external symbols
   4490  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
   4491  -objectlist FILE  use a list of object files found in FILE to specify objects
   4492  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
   4493  -precious-files-regex REGEX
   4494                    don't remove output files matching REGEX
   4495  -release RELEASE  specify package release information
   4496  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   4497  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
   4498  -shared           only do dynamic linking of libtool libraries
   4499  -shrext SUFFIX    override the standard shared library file extension
   4500  -static           do not do any dynamic linking of uninstalled libtool libraries
   4501  -static-libtool-libs
   4502                    do not do any dynamic linking of libtool libraries
   4503  -version-info CURRENT[:REVISION[:AGE]]
   4504                    specify library version info [each variable defaults to 0]
   4505  -weak LIBNAME     declare that the target provides the LIBNAME interface
   4506  -Wc,FLAG
   4507  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
   4508  -Wa,FLAG
   4509  -Xassembler FLAG  pass linker-specific FLAG directly to the assembler
   4510  -Wl,FLAG
   4511  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
   4512  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
   4513
   4514All other options (arguments beginning with '-') are ignored.
   4515
   4516Every other argument is treated as a filename.  Files ending in '.la' are
   4517treated as uninstalled libtool libraries, other files are standard or library
   4518object files.
   4519
   4520If the OUTPUT-FILE ends in '.la', then a libtool library is created,
   4521only library objects ('.lo' files) may be specified, and '-rpath' is
   4522required, except when creating a convenience library.
   4523
   4524If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
   4525using 'ar' and 'ranlib', or on Windows using 'lib'.
   4526
   4527If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
   4528is created, otherwise an executable program is created."
   4529        ;;
   4530
   4531      uninstall)
   4532        $ECHO \
   4533"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
   4534
   4535Remove libraries from an installation directory.
   4536
   4537RM is the name of the program to use to delete files associated with each FILE
   4538(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
   4539to RM.
   4540
   4541If FILE is a libtool library, all the files associated with it are deleted.
   4542Otherwise, only FILE itself is deleted using RM."
   4543        ;;
   4544
   4545      *)
   4546        func_fatal_help "invalid operation mode '$opt_mode'"
   4547        ;;
   4548    esac
   4549
   4550    echo
   4551    $ECHO "Try '$progname --help' for more information about other modes."
   4552}
   4553
   4554# Now that we've collected a possible --mode arg, show help if necessary
   4555if $opt_help; then
   4556  if test : = "$opt_help"; then
   4557    func_mode_help
   4558  else
   4559    {
   4560      func_help noexit
   4561      for opt_mode in compile link execute install finish uninstall clean; do
   4562	func_mode_help
   4563      done
   4564    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
   4565    {
   4566      func_help noexit
   4567      for opt_mode in compile link execute install finish uninstall clean; do
   4568	echo
   4569	func_mode_help
   4570      done
   4571    } |
   4572    $SED '1d
   4573      /^When reporting/,/^Report/{
   4574	H
   4575	d
   4576      }
   4577      $x
   4578      /information about other modes/d
   4579      /more detailed .*MODE/d
   4580      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
   4581  fi
   4582  exit $?
   4583fi
   4584
   4585
   4586# func_mode_execute arg...
   4587func_mode_execute ()
   4588{
   4589    $debug_cmd
   4590
   4591    # The first argument is the command name.
   4592    cmd=$nonopt
   4593    test -z "$cmd" && \
   4594      func_fatal_help "you must specify a COMMAND"
   4595
   4596    # Handle -dlopen flags immediately.
   4597    for file in $opt_dlopen; do
   4598      test -f "$file" \
   4599	|| func_fatal_help "'$file' is not a file"
   4600
   4601      dir=
   4602      case $file in
   4603      *.la)
   4604	func_resolve_sysroot "$file"
   4605	file=$func_resolve_sysroot_result
   4606
   4607	# Check to see that this really is a libtool archive.
   4608	func_lalib_unsafe_p "$file" \
   4609	  || func_fatal_help "'$lib' is not a valid libtool archive"
   4610
   4611	# Read the libtool library.
   4612	dlname=
   4613	library_names=
   4614	func_source "$file"
   4615
   4616	# Skip this library if it cannot be dlopened.
   4617	if test -z "$dlname"; then
   4618	  # Warn if it was a shared library.
   4619	  test -n "$library_names" && \
   4620	    func_warning "'$file' was not linked with '-export-dynamic'"
   4621	  continue
   4622	fi
   4623
   4624	func_dirname "$file" "" "."
   4625	dir=$func_dirname_result
   4626
   4627	if test -f "$dir/$objdir/$dlname"; then
   4628	  func_append dir "/$objdir"
   4629	else
   4630	  if test ! -f "$dir/$dlname"; then
   4631	    func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
   4632	  fi
   4633	fi
   4634	;;
   4635
   4636      *.lo)
   4637	# Just add the directory containing the .lo file.
   4638	func_dirname "$file" "" "."
   4639	dir=$func_dirname_result
   4640	;;
   4641
   4642      *)
   4643	func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
   4644	continue
   4645	;;
   4646      esac
   4647
   4648      # Get the absolute pathname.
   4649      absdir=`cd "$dir" && pwd`
   4650      test -n "$absdir" && dir=$absdir
   4651
   4652      # Now add the directory to shlibpath_var.
   4653      if eval "test -z \"\$$shlibpath_var\""; then
   4654	eval "$shlibpath_var=\"\$dir\""
   4655      else
   4656	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
   4657      fi
   4658    done
   4659
   4660    # This variable tells wrapper scripts just to set shlibpath_var
   4661    # rather than running their programs.
   4662    libtool_execute_magic=$magic
   4663
   4664    # Check if any of the arguments is a wrapper script.
   4665    args=
   4666    for file
   4667    do
   4668      case $file in
   4669      -* | *.la | *.lo ) ;;
   4670      *)
   4671	# Do a test to see if this is really a libtool program.
   4672	if func_ltwrapper_script_p "$file"; then
   4673	  func_source "$file"
   4674	  # Transform arg to wrapped name.
   4675	  file=$progdir/$program
   4676	elif func_ltwrapper_executable_p "$file"; then
   4677	  func_ltwrapper_scriptname "$file"
   4678	  func_source "$func_ltwrapper_scriptname_result"
   4679	  # Transform arg to wrapped name.
   4680	  file=$progdir/$program
   4681	fi
   4682	;;
   4683      esac
   4684      # Quote arguments (to preserve shell metacharacters).
   4685      func_append_quoted args "$file"
   4686    done
   4687
   4688    if $opt_dry_run; then
   4689      # Display what would be done.
   4690      if test -n "$shlibpath_var"; then
   4691	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
   4692	echo "export $shlibpath_var"
   4693      fi
   4694      $ECHO "$cmd$args"
   4695      exit $EXIT_SUCCESS
   4696    else
   4697      if test -n "$shlibpath_var"; then
   4698	# Export the shlibpath_var.
   4699	eval "export $shlibpath_var"
   4700      fi
   4701
   4702      # Restore saved environment variables
   4703      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
   4704      do
   4705	eval "if test \"\${save_$lt_var+set}\" = set; then
   4706                $lt_var=\$save_$lt_var; export $lt_var
   4707	      else
   4708		$lt_unset $lt_var
   4709	      fi"
   4710      done
   4711
   4712      # Now prepare to actually exec the command.
   4713      exec_cmd=\$cmd$args
   4714    fi
   4715}
   4716
   4717test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
   4718
   4719
   4720# func_mode_finish arg...
   4721func_mode_finish ()
   4722{
   4723    $debug_cmd
   4724
   4725    libs=
   4726    libdirs=
   4727    admincmds=
   4728
   4729    for opt in "$nonopt" ${1+"$@"}
   4730    do
   4731      if test -d "$opt"; then
   4732	func_append libdirs " $opt"
   4733
   4734      elif test -f "$opt"; then
   4735	if func_lalib_unsafe_p "$opt"; then
   4736	  func_append libs " $opt"
   4737	else
   4738	  func_warning "'$opt' is not a valid libtool archive"
   4739	fi
   4740
   4741      else
   4742	func_fatal_error "invalid argument '$opt'"
   4743      fi
   4744    done
   4745
   4746    if test -n "$libs"; then
   4747      if test -n "$lt_sysroot"; then
   4748        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
   4749        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
   4750      else
   4751        sysroot_cmd=
   4752      fi
   4753
   4754      # Remove sysroot references
   4755      if $opt_dry_run; then
   4756        for lib in $libs; do
   4757          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
   4758        done
   4759      else
   4760        tmpdir=`func_mktempdir`
   4761        for lib in $libs; do
   4762	  $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
   4763	    > $tmpdir/tmp-la
   4764	  mv -f $tmpdir/tmp-la $lib
   4765	done
   4766        ${RM}r "$tmpdir"
   4767      fi
   4768    fi
   4769
   4770    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
   4771      for libdir in $libdirs; do
   4772	if test -n "$finish_cmds"; then
   4773	  # Do each command in the finish commands.
   4774	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
   4775'"$cmd"'"'
   4776	fi
   4777	if test -n "$finish_eval"; then
   4778	  # Do the single finish_eval.
   4779	  eval cmds=\"$finish_eval\"
   4780	  $opt_dry_run || eval "$cmds" || func_append admincmds "
   4781       $cmds"
   4782	fi
   4783      done
   4784    fi
   4785
   4786    # Exit here if they wanted silent mode.
   4787    $opt_quiet && exit $EXIT_SUCCESS
   4788
   4789    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
   4790      echo "----------------------------------------------------------------------"
   4791      echo "Libraries have been installed in:"
   4792      for libdir in $libdirs; do
   4793	$ECHO "   $libdir"
   4794      done
   4795      echo
   4796      echo "If you ever happen to want to link against installed libraries"
   4797      echo "in a given directory, LIBDIR, you must either use libtool, and"
   4798      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
   4799      echo "flag during linking and do at least one of the following:"
   4800      if test -n "$shlibpath_var"; then
   4801	echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
   4802	echo "     during execution"
   4803      fi
   4804      if test -n "$runpath_var"; then
   4805	echo "   - add LIBDIR to the '$runpath_var' environment variable"
   4806	echo "     during linking"
   4807      fi
   4808      if test -n "$hardcode_libdir_flag_spec"; then
   4809	libdir=LIBDIR
   4810	eval flag=\"$hardcode_libdir_flag_spec\"
   4811
   4812	$ECHO "   - use the '$flag' linker flag"
   4813      fi
   4814      if test -n "$admincmds"; then
   4815	$ECHO "   - have your system administrator run these commands:$admincmds"
   4816      fi
   4817      if test -f /etc/ld.so.conf; then
   4818	echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
   4819      fi
   4820      echo
   4821
   4822      echo "See any operating system documentation about shared libraries for"
   4823      case $host in
   4824	solaris2.[6789]|solaris2.1[0-9])
   4825	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
   4826	  echo "pages."
   4827	  ;;
   4828	*)
   4829	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
   4830	  ;;
   4831      esac
   4832      echo "----------------------------------------------------------------------"
   4833    fi
   4834    exit $EXIT_SUCCESS
   4835}
   4836
   4837test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
   4838
   4839
   4840# func_mode_install arg...
   4841func_mode_install ()
   4842{
   4843    $debug_cmd
   4844
   4845    # There may be an optional sh(1) argument at the beginning of
   4846    # install_prog (especially on Windows NT).
   4847    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
   4848       # Allow the use of GNU shtool's install command.
   4849       case $nonopt in *shtool*) :;; *) false;; esac
   4850    then
   4851      # Aesthetically quote it.
   4852      func_quote_arg pretty "$nonopt"
   4853      install_prog="$func_quote_arg_result "
   4854      arg=$1
   4855      shift
   4856    else
   4857      install_prog=
   4858      arg=$nonopt
   4859    fi
   4860
   4861    # The real first argument should be the name of the installation program.
   4862    # Aesthetically quote it.
   4863    func_quote_arg pretty "$arg"
   4864    func_append install_prog "$func_quote_arg_result"
   4865    install_shared_prog=$install_prog
   4866    case " $install_prog " in
   4867      *[\\\ /]cp\ *) install_cp=: ;;
   4868      *) install_cp=false ;;
   4869    esac
   4870
   4871    # We need to accept at least all the BSD install flags.
   4872    dest=
   4873    files=
   4874    opts=
   4875    prev=
   4876    install_type=
   4877    isdir=false
   4878    stripme=
   4879    no_mode=:
   4880    for arg
   4881    do
   4882      arg2=
   4883      if test -n "$dest"; then
   4884	func_append files " $dest"
   4885	dest=$arg
   4886	continue
   4887      fi
   4888
   4889      case $arg in
   4890      -d) isdir=: ;;
   4891      -f)
   4892	if $install_cp; then :; else
   4893	  prev=$arg
   4894	fi
   4895	;;
   4896      -g | -m | -o)
   4897	prev=$arg
   4898	;;
   4899      -s)
   4900	stripme=" -s"
   4901	continue
   4902	;;
   4903      -*)
   4904	;;
   4905      *)
   4906	# If the previous option needed an argument, then skip it.
   4907	if test -n "$prev"; then
   4908	  if test X-m = "X$prev" && test -n "$install_override_mode"; then
   4909	    arg2=$install_override_mode
   4910	    no_mode=false
   4911	  fi
   4912	  prev=
   4913	else
   4914	  dest=$arg
   4915	  continue
   4916	fi
   4917	;;
   4918      esac
   4919
   4920      # Aesthetically quote the argument.
   4921      func_quote_arg pretty "$arg"
   4922      func_append install_prog " $func_quote_arg_result"
   4923      if test -n "$arg2"; then
   4924	func_quote_arg pretty "$arg2"
   4925      fi
   4926      func_append install_shared_prog " $func_quote_arg_result"
   4927    done
   4928
   4929    test -z "$install_prog" && \
   4930      func_fatal_help "you must specify an install program"
   4931
   4932    test -n "$prev" && \
   4933      func_fatal_help "the '$prev' option requires an argument"
   4934
   4935    if test -n "$install_override_mode" && $no_mode; then
   4936      if $install_cp; then :; else
   4937	func_quote_arg pretty "$install_override_mode"
   4938	func_append install_shared_prog " -m $func_quote_arg_result"
   4939      fi
   4940    fi
   4941
   4942    if test -z "$files"; then
   4943      if test -z "$dest"; then
   4944	func_fatal_help "no file or destination specified"
   4945      else
   4946	func_fatal_help "you must specify a destination"
   4947      fi
   4948    fi
   4949
   4950    # Strip any trailing slash from the destination.
   4951    func_stripname '' '/' "$dest"
   4952    dest=$func_stripname_result
   4953
   4954    # Check to see that the destination is a directory.
   4955    test -d "$dest" && isdir=:
   4956    if $isdir; then
   4957      destdir=$dest
   4958      destname=
   4959    else
   4960      func_dirname_and_basename "$dest" "" "."
   4961      destdir=$func_dirname_result
   4962      destname=$func_basename_result
   4963
   4964      # Not a directory, so check to see that there is only one file specified.
   4965      set dummy $files; shift
   4966      test "$#" -gt 1 && \
   4967	func_fatal_help "'$dest' is not a directory"
   4968    fi
   4969    case $destdir in
   4970    [\\/]* | [A-Za-z]:[\\/]*) ;;
   4971    *)
   4972      for file in $files; do
   4973	case $file in
   4974	*.lo) ;;
   4975	*)
   4976	  func_fatal_help "'$destdir' must be an absolute directory name"
   4977	  ;;
   4978	esac
   4979      done
   4980      ;;
   4981    esac
   4982
   4983    # This variable tells wrapper scripts just to set variables rather
   4984    # than running their programs.
   4985    libtool_install_magic=$magic
   4986
   4987    staticlibs=
   4988    future_libdirs=
   4989    current_libdirs=
   4990    for file in $files; do
   4991
   4992      # Do each installation.
   4993      case $file in
   4994      *.$libext)
   4995	# Do the static libraries later.
   4996	func_append staticlibs " $file"
   4997	;;
   4998
   4999      *.la)
   5000	func_resolve_sysroot "$file"
   5001	file=$func_resolve_sysroot_result
   5002
   5003	# Check to see that this really is a libtool archive.
   5004	func_lalib_unsafe_p "$file" \
   5005	  || func_fatal_help "'$file' is not a valid libtool archive"
   5006
   5007	library_names=
   5008	old_library=
   5009	relink_command=
   5010	func_source "$file"
   5011
   5012	# Add the libdir to current_libdirs if it is the destination.
   5013	if test "X$destdir" = "X$libdir"; then
   5014	  case "$current_libdirs " in
   5015	  *" $libdir "*) ;;
   5016	  *) func_append current_libdirs " $libdir" ;;
   5017	  esac
   5018	else
   5019	  # Note the libdir as a future libdir.
   5020	  case "$future_libdirs " in
   5021	  *" $libdir "*) ;;
   5022	  *) func_append future_libdirs " $libdir" ;;
   5023	  esac
   5024	fi
   5025
   5026	func_dirname "$file" "/" ""
   5027	dir=$func_dirname_result
   5028	func_append dir "$objdir"
   5029
   5030	if test -n "$relink_command"; then
   5031	  # Determine the prefix the user has applied to our future dir.
   5032	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
   5033
   5034	  # Don't allow the user to place us outside of our expected
   5035	  # location b/c this prevents finding dependent libraries that
   5036	  # are installed to the same prefix.
   5037	  # At present, this check doesn't affect windows .dll's that
   5038	  # are installed into $libdir/../bin (currently, that works fine)
   5039	  # but it's something to keep an eye on.
   5040	  test "$inst_prefix_dir" = "$destdir" && \
   5041	    func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
   5042
   5043	  if test -n "$inst_prefix_dir"; then
   5044	    # Stick the inst_prefix_dir data into the link command.
   5045	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
   5046	  else
   5047	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
   5048	  fi
   5049
   5050	  func_warning "relinking '$file'"
   5051	  func_show_eval "$relink_command" \
   5052	    'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
   5053	fi
   5054
   5055	# See the names of the shared library.
   5056	set dummy $library_names; shift
   5057	if test -n "$1"; then
   5058	  realname=$1
   5059	  shift
   5060
   5061	  srcname=$realname
   5062	  test -n "$relink_command" && srcname=${realname}T
   5063
   5064	  # Install the shared library and build the symlinks.
   5065	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
   5066	      'exit $?'
   5067	  tstripme=$stripme
   5068	  case $host_os in
   5069	  cygwin* | mingw* | pw32* | cegcc*)
   5070	    case $realname in
   5071	    *.dll.a)
   5072	      tstripme=
   5073	      ;;
   5074	    esac
   5075	    ;;
   5076	  os2*)
   5077	    case $realname in
   5078	    *_dll.a)
   5079	      tstripme=
   5080	      ;;
   5081	    esac
   5082	    ;;
   5083	  esac
   5084	  if test -n "$tstripme" && test -n "$striplib"; then
   5085	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
   5086	  fi
   5087
   5088	  if test "$#" -gt 0; then
   5089	    # Delete the old symlinks, and create new ones.
   5090	    # Try 'ln -sf' first, because the 'ln' binary might depend on
   5091	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
   5092	    # so we also need to try rm && ln -s.
   5093	    for linkname
   5094	    do
   5095	      test "$linkname" != "$realname" \
   5096		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
   5097	    done
   5098	  fi
   5099
   5100	  # Do each command in the postinstall commands.
   5101	  lib=$destdir/$realname
   5102	  func_execute_cmds "$postinstall_cmds" 'exit $?'
   5103	fi
   5104
   5105	# Install the pseudo-library for information purposes.
   5106	func_basename "$file"
   5107	name=$func_basename_result
   5108	instname=$dir/${name}i
   5109	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
   5110
   5111	# Maybe install the static library, too.
   5112	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
   5113	;;
   5114
   5115      *.lo)
   5116	# Install (i.e. copy) a libtool object.
   5117
   5118	# Figure out destination file name, if it wasn't already specified.
   5119	if test -n "$destname"; then
   5120	  destfile=$destdir/$destname
   5121	else
   5122	  func_basename "$file"
   5123	  destfile=$func_basename_result
   5124	  destfile=$destdir/$destfile
   5125	fi
   5126
   5127	# Deduce the name of the destination old-style object file.
   5128	case $destfile in
   5129	*.lo)
   5130	  func_lo2o "$destfile"
   5131	  staticdest=$func_lo2o_result
   5132	  ;;
   5133	*.$objext)
   5134	  staticdest=$destfile
   5135	  destfile=
   5136	  ;;
   5137	*)
   5138	  func_fatal_help "cannot copy a libtool object to '$destfile'"
   5139	  ;;
   5140	esac
   5141
   5142	# Install the libtool object if requested.
   5143	test -n "$destfile" && \
   5144	  func_show_eval "$install_prog $file $destfile" 'exit $?'
   5145
   5146	# Install the old object if enabled.
   5147	if test yes = "$build_old_libs"; then
   5148	  # Deduce the name of the old-style object file.
   5149	  func_lo2o "$file"
   5150	  staticobj=$func_lo2o_result
   5151	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
   5152	fi
   5153	exit $EXIT_SUCCESS
   5154	;;
   5155
   5156      *)
   5157	# Figure out destination file name, if it wasn't already specified.
   5158	if test -n "$destname"; then
   5159	  destfile=$destdir/$destname
   5160	else
   5161	  func_basename "$file"
   5162	  destfile=$func_basename_result
   5163	  destfile=$destdir/$destfile
   5164	fi
   5165
   5166	# If the file is missing, and there is a .exe on the end, strip it
   5167	# because it is most likely a libtool script we actually want to
   5168	# install
   5169	stripped_ext=
   5170	case $file in
   5171	  *.exe)
   5172	    if test ! -f "$file"; then
   5173	      func_stripname '' '.exe' "$file"
   5174	      file=$func_stripname_result
   5175	      stripped_ext=.exe
   5176	    fi
   5177	    ;;
   5178	esac
   5179
   5180	# Do a test to see if this is really a libtool program.
   5181	case $host in
   5182	*cygwin* | *mingw*)
   5183	    if func_ltwrapper_executable_p "$file"; then
   5184	      func_ltwrapper_scriptname "$file"
   5185	      wrapper=$func_ltwrapper_scriptname_result
   5186	    else
   5187	      func_stripname '' '.exe' "$file"
   5188	      wrapper=$func_stripname_result
   5189	    fi
   5190	    ;;
   5191	*)
   5192	    wrapper=$file
   5193	    ;;
   5194	esac
   5195	if func_ltwrapper_script_p "$wrapper"; then
   5196	  notinst_deplibs=
   5197	  relink_command=
   5198
   5199	  func_source "$wrapper"
   5200
   5201	  # Check the variables that should have been set.
   5202	  test -z "$generated_by_libtool_version" && \
   5203	    func_fatal_error "invalid libtool wrapper script '$wrapper'"
   5204
   5205	  finalize=:
   5206	  for lib in $notinst_deplibs; do
   5207	    # Check to see that each library is installed.
   5208	    libdir=
   5209	    if test -f "$lib"; then
   5210	      func_source "$lib"
   5211	    fi
   5212	    libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
   5213	    if test -n "$libdir" && test ! -f "$libfile"; then
   5214	      func_warning "'$lib' has not been installed in '$libdir'"
   5215	      finalize=false
   5216	    fi
   5217	  done
   5218
   5219	  relink_command=
   5220	  func_source "$wrapper"
   5221
   5222	  outputname=
   5223	  if test no = "$fast_install" && test -n "$relink_command"; then
   5224	    $opt_dry_run || {
   5225	      if $finalize; then
   5226	        tmpdir=`func_mktempdir`
   5227		func_basename "$file$stripped_ext"
   5228		file=$func_basename_result
   5229	        outputname=$tmpdir/$file
   5230	        # Replace the output file specification.
   5231	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
   5232
   5233	        $opt_quiet || {
   5234	          func_quote_arg expand,pretty "$relink_command"
   5235		  eval "func_echo $func_quote_arg_result"
   5236	        }
   5237	        if eval "$relink_command"; then :
   5238	          else
   5239		  func_error "error: relink '$file' with the above command before installing it"
   5240		  $opt_dry_run || ${RM}r "$tmpdir"
   5241		  continue
   5242	        fi
   5243	        file=$outputname
   5244	      else
   5245	        func_warning "cannot relink '$file'"
   5246	      fi
   5247	    }
   5248	  else
   5249	    # Install the binary that we compiled earlier.
   5250	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
   5251	  fi
   5252	fi
   5253
   5254	# remove .exe since cygwin /usr/bin/install will append another
   5255	# one anyway
   5256	case $install_prog,$host in
   5257	*/usr/bin/install*,*cygwin*)
   5258	  case $file:$destfile in
   5259	  *.exe:*.exe)
   5260	    # this is ok
   5261	    ;;
   5262	  *.exe:*)
   5263	    destfile=$destfile.exe
   5264	    ;;
   5265	  *:*.exe)
   5266	    func_stripname '' '.exe' "$destfile"
   5267	    destfile=$func_stripname_result
   5268	    ;;
   5269	  esac
   5270	  ;;
   5271	esac
   5272	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
   5273	$opt_dry_run || if test -n "$outputname"; then
   5274	  ${RM}r "$tmpdir"
   5275	fi
   5276	;;
   5277      esac
   5278    done
   5279
   5280    for file in $staticlibs; do
   5281      func_basename "$file"
   5282      name=$func_basename_result
   5283
   5284      # Set up the ranlib parameters.
   5285      oldlib=$destdir/$name
   5286      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
   5287      tool_oldlib=$func_to_tool_file_result
   5288
   5289      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
   5290
   5291      if test -n "$stripme" && test -n "$old_striplib"; then
   5292	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
   5293      fi
   5294
   5295      # Do each command in the postinstall commands.
   5296      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
   5297    done
   5298
   5299    test -n "$future_libdirs" && \
   5300      func_warning "remember to run '$progname --finish$future_libdirs'"
   5301
   5302    if test -n "$current_libdirs"; then
   5303      # Maybe just do a dry run.
   5304      $opt_dry_run && current_libdirs=" -n$current_libdirs"
   5305      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
   5306    else
   5307      exit $EXIT_SUCCESS
   5308    fi
   5309}
   5310
   5311test install = "$opt_mode" && func_mode_install ${1+"$@"}
   5312
   5313
   5314# func_generate_dlsyms outputname originator pic_p
   5315# Extract symbols from dlprefiles and create ${outputname}S.o with
   5316# a dlpreopen symbol table.
   5317func_generate_dlsyms ()
   5318{
   5319    $debug_cmd
   5320
   5321    my_outputname=$1
   5322    my_originator=$2
   5323    my_pic_p=${3-false}
   5324    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
   5325    my_dlsyms=
   5326
   5327    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
   5328      if test -n "$NM" && test -n "$global_symbol_pipe"; then
   5329	my_dlsyms=${my_outputname}S.c
   5330      else
   5331	func_error "not configured to extract global symbols from dlpreopened files"
   5332      fi
   5333    fi
   5334
   5335    if test -n "$my_dlsyms"; then
   5336      case $my_dlsyms in
   5337      "") ;;
   5338      *.c)
   5339	# Discover the nlist of each of the dlfiles.
   5340	nlist=$output_objdir/$my_outputname.nm
   5341
   5342	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
   5343
   5344	# Parse the name list into a source file.
   5345	func_verbose "creating $output_objdir/$my_dlsyms"
   5346
   5347	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
   5348/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
   5349/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
   5350
   5351#ifdef __cplusplus
   5352extern \"C\" {
   5353#endif
   5354
   5355#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
   5356#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
   5357#endif
   5358
   5359/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
   5360#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
   5361/* DATA imports from DLLs on WIN32 can't be const, because runtime
   5362   relocations are performed -- see ld's documentation on pseudo-relocs.  */
   5363# define LT_DLSYM_CONST
   5364#elif defined __osf__
   5365/* This system does not cope well with relocations in const data.  */
   5366# define LT_DLSYM_CONST
   5367#else
   5368# define LT_DLSYM_CONST const
   5369#endif
   5370
   5371#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
   5372
   5373/* External symbol declarations for the compiler. */\
   5374"
   5375
   5376	if test yes = "$dlself"; then
   5377	  func_verbose "generating symbol list for '$output'"
   5378
   5379	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
   5380
   5381	  # Add our own program objects to the symbol list.
   5382	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
   5383	  for progfile in $progfiles; do
   5384	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
   5385	    func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
   5386	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
   5387	  done
   5388
   5389	  if test -n "$exclude_expsyms"; then
   5390	    $opt_dry_run || {
   5391	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
   5392	      eval '$MV "$nlist"T "$nlist"'
   5393	    }
   5394	  fi
   5395
   5396	  if test -n "$export_symbols_regex"; then
   5397	    $opt_dry_run || {
   5398	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
   5399	      eval '$MV "$nlist"T "$nlist"'
   5400	    }
   5401	  fi
   5402
   5403	  # Prepare the list of exported symbols
   5404	  if test -z "$export_symbols"; then
   5405	    export_symbols=$output_objdir/$outputname.exp
   5406	    $opt_dry_run || {
   5407	      $RM $export_symbols
   5408	      eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
   5409	      case $host in
   5410	      *cygwin* | *mingw* | *cegcc* )
   5411                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
   5412                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
   5413	        ;;
   5414	      esac
   5415	    }
   5416	  else
   5417	    $opt_dry_run || {
   5418	      eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
   5419	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
   5420	      eval '$MV "$nlist"T "$nlist"'
   5421	      case $host in
   5422	        *cygwin* | *mingw* | *cegcc* )
   5423	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
   5424	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
   5425	          ;;
   5426	      esac
   5427	    }
   5428	  fi
   5429	fi
   5430
   5431	for dlprefile in $dlprefiles; do
   5432	  func_verbose "extracting global C symbols from '$dlprefile'"
   5433	  func_basename "$dlprefile"
   5434	  name=$func_basename_result
   5435          case $host in
   5436	    *cygwin* | *mingw* | *cegcc* )
   5437	      # if an import library, we need to obtain dlname
   5438	      if func_win32_import_lib_p "$dlprefile"; then
   5439	        func_tr_sh "$dlprefile"
   5440	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
   5441	        dlprefile_dlbasename=
   5442	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
   5443	          # Use subshell, to avoid clobbering current variable values
   5444	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
   5445	          if test -n "$dlprefile_dlname"; then
   5446	            func_basename "$dlprefile_dlname"
   5447	            dlprefile_dlbasename=$func_basename_result
   5448	          else
   5449	            # no lafile. user explicitly requested -dlpreopen <import library>.
   5450	            $sharedlib_from_linklib_cmd "$dlprefile"
   5451	            dlprefile_dlbasename=$sharedlib_from_linklib_result
   5452	          fi
   5453	        fi
   5454	        $opt_dry_run || {
   5455	          if test -n "$dlprefile_dlbasename"; then
   5456	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
   5457	          else
   5458	            func_warning "Could not compute DLL name from $name"
   5459	            eval '$ECHO ": $name " >> "$nlist"'
   5460	          fi
   5461	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
   5462	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
   5463	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
   5464	        }
   5465	      else # not an import lib
   5466	        $opt_dry_run || {
   5467	          eval '$ECHO ": $name " >> "$nlist"'
   5468	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
   5469	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
   5470	        }
   5471	      fi
   5472	    ;;
   5473	    *)
   5474	      $opt_dry_run || {
   5475	        eval '$ECHO ": $name " >> "$nlist"'
   5476	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
   5477	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
   5478	      }
   5479	    ;;
   5480          esac
   5481	done
   5482
   5483	$opt_dry_run || {
   5484	  # Make sure we have at least an empty file.
   5485	  test -f "$nlist" || : > "$nlist"
   5486
   5487	  if test -n "$exclude_expsyms"; then
   5488	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
   5489	    $MV "$nlist"T "$nlist"
   5490	  fi
   5491
   5492	  # Try sorting and uniquifying the output.
   5493	  if $GREP -v "^: " < "$nlist" |
   5494	      if sort -k 3 </dev/null >/dev/null 2>&1; then
   5495		sort -k 3
   5496	      else
   5497		sort +2
   5498	      fi |
   5499	      uniq > "$nlist"S; then
   5500	    :
   5501	  else
   5502	    $GREP -v "^: " < "$nlist" > "$nlist"S
   5503	  fi
   5504
   5505	  if test -f "$nlist"S; then
   5506	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
   5507	  else
   5508	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
   5509	  fi
   5510
   5511	  func_show_eval '$RM "${nlist}I"'
   5512	  if test -n "$global_symbol_to_import"; then
   5513	    eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
   5514	  fi
   5515
   5516	  echo >> "$output_objdir/$my_dlsyms" "\
   5517
   5518/* The mapping between symbol names and symbols.  */
   5519typedef struct {
   5520  const char *name;
   5521  void *address;
   5522} lt_dlsymlist;
   5523extern LT_DLSYM_CONST lt_dlsymlist
   5524lt_${my_prefix}_LTX_preloaded_symbols[];\
   5525"
   5526
   5527	  if test -s "$nlist"I; then
   5528	    echo >> "$output_objdir/$my_dlsyms" "\
   5529static void lt_syminit(void)
   5530{
   5531  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
   5532  for (; symbol->name; ++symbol)
   5533    {"
   5534	    $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
   5535	    echo >> "$output_objdir/$my_dlsyms" "\
   5536    }
   5537}"
   5538	  fi
   5539	  echo >> "$output_objdir/$my_dlsyms" "\
   5540LT_DLSYM_CONST lt_dlsymlist
   5541lt_${my_prefix}_LTX_preloaded_symbols[] =
   5542{ {\"$my_originator\", (void *) 0},"
   5543
   5544	  if test -s "$nlist"I; then
   5545	    echo >> "$output_objdir/$my_dlsyms" "\
   5546  {\"@INIT@\", (void *) &lt_syminit},"
   5547	  fi
   5548
   5549	  case $need_lib_prefix in
   5550	  no)
   5551	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
   5552	    ;;
   5553	  *)
   5554	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
   5555	    ;;
   5556	  esac
   5557	  echo >> "$output_objdir/$my_dlsyms" "\
   5558  {0, (void *) 0}
   5559};
   5560
   5561/* This works around a problem in FreeBSD linker */
   5562#ifdef FREEBSD_WORKAROUND
   5563static const void *lt_preloaded_setup() {
   5564  return lt_${my_prefix}_LTX_preloaded_symbols;
   5565}
   5566#endif
   5567
   5568#ifdef __cplusplus
   5569}
   5570#endif\
   5571"
   5572	} # !$opt_dry_run
   5573
   5574	pic_flag_for_symtable=
   5575	case "$compile_command " in
   5576	*" -static "*) ;;
   5577	*)
   5578	  case $host in
   5579	  # compiling the symbol table file with pic_flag works around
   5580	  # a FreeBSD bug that causes programs to crash when -lm is
   5581	  # linked before any other PIC object.  But we must not use
   5582	  # pic_flag when linking with -static.  The problem exists in
   5583	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
   5584	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
   5585	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
   5586	  *-*-hpux*)
   5587	    pic_flag_for_symtable=" $pic_flag"  ;;
   5588	  *)
   5589	    $my_pic_p && pic_flag_for_symtable=" $pic_flag"
   5590	    ;;
   5591	  esac
   5592	  ;;
   5593	esac
   5594	symtab_cflags=
   5595	for arg in $LTCFLAGS; do
   5596	  case $arg in
   5597	  -pie | -fpie | -fPIE) ;;
   5598	  *) func_append symtab_cflags " $arg" ;;
   5599	  esac
   5600	done
   5601
   5602	# Now compile the dynamic symbol file.
   5603	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
   5604
   5605	# Clean up the generated files.
   5606	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
   5607
   5608	# Transform the symbol file into the correct name.
   5609	symfileobj=$output_objdir/${my_outputname}S.$objext
   5610	case $host in
   5611	*cygwin* | *mingw* | *cegcc* )
   5612	  if test -f "$output_objdir/$my_outputname.def"; then
   5613	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
   5614	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
   5615	  else
   5616	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
   5617	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
   5618	  fi
   5619	  ;;
   5620	*)
   5621	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
   5622	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
   5623	  ;;
   5624	esac
   5625	;;
   5626      *)
   5627	func_fatal_error "unknown suffix for '$my_dlsyms'"
   5628	;;
   5629      esac
   5630    else
   5631      # We keep going just in case the user didn't refer to
   5632      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
   5633      # really was required.
   5634
   5635      # Nullify the symbol file.
   5636      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
   5637      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
   5638    fi
   5639}
   5640
   5641# func_cygming_gnu_implib_p ARG
   5642# This predicate returns with zero status (TRUE) if
   5643# ARG is a GNU/binutils-style import library. Returns
   5644# with nonzero status (FALSE) otherwise.
   5645func_cygming_gnu_implib_p ()
   5646{
   5647  $debug_cmd
   5648
   5649  func_to_tool_file "$1" func_convert_file_msys_to_w32
   5650  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
   5651  test -n "$func_cygming_gnu_implib_tmp"
   5652}
   5653
   5654# func_cygming_ms_implib_p ARG
   5655# This predicate returns with zero status (TRUE) if
   5656# ARG is an MS-style import library. Returns
   5657# with nonzero status (FALSE) otherwise.
   5658func_cygming_ms_implib_p ()
   5659{
   5660  $debug_cmd
   5661
   5662  func_to_tool_file "$1" func_convert_file_msys_to_w32
   5663  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
   5664  test -n "$func_cygming_ms_implib_tmp"
   5665}
   5666
   5667# func_win32_libid arg
   5668# return the library type of file 'arg'
   5669#
   5670# Need a lot of goo to handle *both* DLLs and import libs
   5671# Has to be a shell function in order to 'eat' the argument
   5672# that is supplied when $file_magic_command is called.
   5673# Despite the name, also deal with 64 bit binaries.
   5674func_win32_libid ()
   5675{
   5676  $debug_cmd
   5677
   5678  win32_libid_type=unknown
   5679  win32_fileres=`file -L $1 2>/dev/null`
   5680  case $win32_fileres in
   5681  *ar\ archive\ import\ library*) # definitely import
   5682    win32_libid_type="x86 archive import"
   5683    ;;
   5684  *ar\ archive*) # could be an import, or static
   5685    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
   5686    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
   5687       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
   5688      case $nm_interface in
   5689      "MS dumpbin")
   5690	if func_cygming_ms_implib_p "$1" ||
   5691	   func_cygming_gnu_implib_p "$1"
   5692	then
   5693	  win32_nmres=import
   5694	else
   5695	  win32_nmres=
   5696	fi
   5697	;;
   5698      *)
   5699	func_to_tool_file "$1" func_convert_file_msys_to_w32
   5700	win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
   5701	  $SED -n -e '
   5702	    1,100{
   5703		/ I /{
   5704		    s|.*|import|
   5705		    p
   5706		    q
   5707		}
   5708	    }'`
   5709	;;
   5710      esac
   5711      case $win32_nmres in
   5712      import*)  win32_libid_type="x86 archive import";;
   5713      *)        win32_libid_type="x86 archive static";;
   5714      esac
   5715    fi
   5716    ;;
   5717  *DLL*)
   5718    win32_libid_type="x86 DLL"
   5719    ;;
   5720  *executable*) # but shell scripts are "executable" too...
   5721    case $win32_fileres in
   5722    *MS\ Windows\ PE\ Intel*)
   5723      win32_libid_type="x86 DLL"
   5724      ;;
   5725    esac
   5726    ;;
   5727  esac
   5728  $ECHO "$win32_libid_type"
   5729}
   5730
   5731# func_cygming_dll_for_implib ARG
   5732#
   5733# Platform-specific function to extract the
   5734# name of the DLL associated with the specified
   5735# import library ARG.
   5736# Invoked by eval'ing the libtool variable
   5737#    $sharedlib_from_linklib_cmd
   5738# Result is available in the variable
   5739#    $sharedlib_from_linklib_result
   5740func_cygming_dll_for_implib ()
   5741{
   5742  $debug_cmd
   5743
   5744  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
   5745}
   5746
   5747# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
   5748#
   5749# The is the core of a fallback implementation of a
   5750# platform-specific function to extract the name of the
   5751# DLL associated with the specified import library LIBNAME.
   5752#
   5753# SECTION_NAME is either .idata$6 or .idata$7, depending
   5754# on the platform and compiler that created the implib.
   5755#
   5756# Echos the name of the DLL associated with the
   5757# specified import library.
   5758func_cygming_dll_for_implib_fallback_core ()
   5759{
   5760  $debug_cmd
   5761
   5762  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
   5763  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
   5764    $SED '/^Contents of section '"$match_literal"':/{
   5765      # Place marker at beginning of archive member dllname section
   5766      s/.*/====MARK====/
   5767      p
   5768      d
   5769    }
   5770    # These lines can sometimes be longer than 43 characters, but
   5771    # are always uninteresting
   5772    /:[	 ]*file format pe[i]\{,1\}-/d
   5773    /^In archive [^:]*:/d
   5774    # Ensure marker is printed
   5775    /^====MARK====/p
   5776    # Remove all lines with less than 43 characters
   5777    /^.\{43\}/!d
   5778    # From remaining lines, remove first 43 characters
   5779    s/^.\{43\}//' |
   5780    $SED -n '
   5781      # Join marker and all lines until next marker into a single line
   5782      /^====MARK====/ b para
   5783      H
   5784      $ b para
   5785      b
   5786      :para
   5787      x
   5788      s/\n//g
   5789      # Remove the marker
   5790      s/^====MARK====//
   5791      # Remove trailing dots and whitespace
   5792      s/[\. \t]*$//
   5793      # Print
   5794      /./p' |
   5795    # we now have a list, one entry per line, of the stringified
   5796    # contents of the appropriate section of all members of the
   5797    # archive that possess that section. Heuristic: eliminate
   5798    # all those that have a first or second character that is
   5799    # a '.' (that is, objdump's representation of an unprintable
   5800    # character.) This should work for all archives with less than
   5801    # 0x302f exports -- but will fail for DLLs whose name actually
   5802    # begins with a literal '.' or a single character followed by
   5803    # a '.'.
   5804    #
   5805    # Of those that remain, print the first one.
   5806    $SED -e '/^\./d;/^.\./d;q'
   5807}
   5808
   5809# func_cygming_dll_for_implib_fallback ARG
   5810# Platform-specific function to extract the
   5811# name of the DLL associated with the specified
   5812# import library ARG.
   5813#
   5814# This fallback implementation is for use when $DLLTOOL
   5815# does not support the --identify-strict option.
   5816# Invoked by eval'ing the libtool variable
   5817#    $sharedlib_from_linklib_cmd
   5818# Result is available in the variable
   5819#    $sharedlib_from_linklib_result
   5820func_cygming_dll_for_implib_fallback ()
   5821{
   5822  $debug_cmd
   5823
   5824  if func_cygming_gnu_implib_p "$1"; then
   5825    # binutils import library
   5826    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
   5827  elif func_cygming_ms_implib_p "$1"; then
   5828    # ms-generated import library
   5829    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
   5830  else
   5831    # unknown
   5832    sharedlib_from_linklib_result=
   5833  fi
   5834}
   5835
   5836
   5837# func_extract_an_archive dir oldlib
   5838func_extract_an_archive ()
   5839{
   5840    $debug_cmd
   5841
   5842    f_ex_an_ar_dir=$1; shift
   5843    f_ex_an_ar_oldlib=$1
   5844    if test yes = "$lock_old_archive_extraction"; then
   5845      lockfile=$f_ex_an_ar_oldlib.lock
   5846      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
   5847	func_echo "Waiting for $lockfile to be removed"
   5848	sleep 2
   5849      done
   5850    fi
   5851    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
   5852		   'stat=$?; rm -f "$lockfile"; exit $stat'
   5853    if test yes = "$lock_old_archive_extraction"; then
   5854      $opt_dry_run || rm -f "$lockfile"
   5855    fi
   5856    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
   5857     :
   5858    else
   5859      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
   5860    fi
   5861}
   5862
   5863
   5864# func_extract_archives gentop oldlib ...
   5865func_extract_archives ()
   5866{
   5867    $debug_cmd
   5868
   5869    my_gentop=$1; shift
   5870    my_oldlibs=${1+"$@"}
   5871    my_oldobjs=
   5872    my_xlib=
   5873    my_xabs=
   5874    my_xdir=
   5875
   5876    for my_xlib in $my_oldlibs; do
   5877      # Extract the objects.
   5878      case $my_xlib in
   5879	[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
   5880	*) my_xabs=`pwd`"/$my_xlib" ;;
   5881      esac
   5882      func_basename "$my_xlib"
   5883      my_xlib=$func_basename_result
   5884      my_xlib_u=$my_xlib
   5885      while :; do
   5886        case " $extracted_archives " in
   5887	*" $my_xlib_u "*)
   5888	  func_arith $extracted_serial + 1
   5889	  extracted_serial=$func_arith_result
   5890	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
   5891	*) break ;;
   5892	esac
   5893      done
   5894      extracted_archives="$extracted_archives $my_xlib_u"
   5895      my_xdir=$my_gentop/$my_xlib_u
   5896
   5897      func_mkdir_p "$my_xdir"
   5898
   5899      case $host in
   5900      *-darwin*)
   5901	func_verbose "Extracting $my_xabs"
   5902	# Do not bother doing anything if just a dry run
   5903	$opt_dry_run || {
   5904	  darwin_orig_dir=`pwd`
   5905	  cd $my_xdir || exit $?
   5906	  darwin_archive=$my_xabs
   5907	  darwin_curdir=`pwd`
   5908	  func_basename "$darwin_archive"
   5909	  darwin_base_archive=$func_basename_result
   5910	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
   5911	  if test -n "$darwin_arches"; then
   5912	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
   5913	    darwin_arch=
   5914	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
   5915	    for darwin_arch in  $darwin_arches; do
   5916	      func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
   5917	      $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
   5918	      cd "unfat-$$/$darwin_base_archive-$darwin_arch"
   5919	      func_extract_an_archive "`pwd`" "$darwin_base_archive"
   5920	      cd "$darwin_curdir"
   5921	      $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
   5922	    done # $darwin_arches
   5923            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
   5924	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
   5925	    darwin_file=
   5926	    darwin_files=
   5927	    for darwin_file in $darwin_filelist; do
   5928	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
   5929	      $LIPO -create -output "$darwin_file" $darwin_files
   5930	    done # $darwin_filelist
   5931	    $RM -rf unfat-$$
   5932	    cd "$darwin_orig_dir"
   5933	  else
   5934	    cd $darwin_orig_dir
   5935	    func_extract_an_archive "$my_xdir" "$my_xabs"
   5936	  fi # $darwin_arches
   5937	} # !$opt_dry_run
   5938	;;
   5939      *)
   5940        func_extract_an_archive "$my_xdir" "$my_xabs"
   5941	;;
   5942      esac
   5943      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
   5944    done
   5945
   5946    func_extract_archives_result=$my_oldobjs
   5947}
   5948
   5949
   5950# func_emit_wrapper [arg=no]
   5951#
   5952# Emit a libtool wrapper script on stdout.
   5953# Don't directly open a file because we may want to
   5954# incorporate the script contents within a cygwin/mingw
   5955# wrapper executable.  Must ONLY be called from within
   5956# func_mode_link because it depends on a number of variables
   5957# set therein.
   5958#
   5959# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
   5960# variable will take.  If 'yes', then the emitted script
   5961# will assume that the directory where it is stored is
   5962# the $objdir directory.  This is a cygwin/mingw-specific
   5963# behavior.
   5964func_emit_wrapper ()
   5965{
   5966	func_emit_wrapper_arg1=${1-no}
   5967
   5968	$ECHO "\
   5969#! $SHELL
   5970
   5971# $output - temporary wrapper script for $objdir/$outputname
   5972# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
   5973#
   5974# The $output program cannot be directly executed until all the libtool
   5975# libraries that it depends on are installed.
   5976#
   5977# This wrapper script should never be moved out of the build directory.
   5978# If it is, it will not operate correctly.
   5979
   5980# Sed substitution that helps us do robust quoting.  It backslashifies
   5981# metacharacters that are still active within double-quoted strings.
   5982sed_quote_subst='$sed_quote_subst'
   5983
   5984# Be Bourne compatible
   5985if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
   5986  emulate sh
   5987  NULLCMD=:
   5988  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
   5989  # is contrary to our usage.  Disable this feature.
   5990  alias -g '\${1+\"\$@\"}'='\"\$@\"'
   5991  setopt NO_GLOB_SUBST
   5992else
   5993  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
   5994fi
   5995BIN_SH=xpg4; export BIN_SH # for Tru64
   5996DUALCASE=1; export DUALCASE # for MKS sh
   5997
   5998# The HP-UX ksh and POSIX shell print the target directory to stdout
   5999# if CDPATH is set.
   6000(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
   6001
   6002relink_command=\"$relink_command\"
   6003
   6004# This environment variable determines our operation mode.
   6005if test \"\$libtool_install_magic\" = \"$magic\"; then
   6006  # install mode needs the following variables:
   6007  generated_by_libtool_version='$macro_version'
   6008  notinst_deplibs='$notinst_deplibs'
   6009else
   6010  # When we are sourced in execute mode, \$file and \$ECHO are already set.
   6011  if test \"\$libtool_execute_magic\" != \"$magic\"; then
   6012    file=\"\$0\""
   6013
   6014    func_quote_arg pretty "$ECHO"
   6015    qECHO=$func_quote_arg_result
   6016    $ECHO "\
   6017
   6018# A function that is used when there is no print builtin or printf.
   6019func_fallback_echo ()
   6020{
   6021  eval 'cat <<_LTECHO_EOF
   6022\$1
   6023_LTECHO_EOF'
   6024}
   6025    ECHO=$qECHO
   6026  fi
   6027
   6028# Very basic option parsing. These options are (a) specific to
   6029# the libtool wrapper, (b) are identical between the wrapper
   6030# /script/ and the wrapper /executable/ that is used only on
   6031# windows platforms, and (c) all begin with the string "--lt-"
   6032# (application programs are unlikely to have options that match
   6033# this pattern).
   6034#
   6035# There are only two supported options: --lt-debug and
   6036# --lt-dump-script. There is, deliberately, no --lt-help.
   6037#
   6038# The first argument to this parsing function should be the
   6039# script's $0 value, followed by "$@".
   6040lt_option_debug=
   6041func_parse_lt_options ()
   6042{
   6043  lt_script_arg0=\$0
   6044  shift
   6045  for lt_opt
   6046  do
   6047    case \"\$lt_opt\" in
   6048    --lt-debug) lt_option_debug=1 ;;
   6049    --lt-dump-script)
   6050        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
   6051        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
   6052        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
   6053        cat \"\$lt_dump_D/\$lt_dump_F\"
   6054        exit 0
   6055      ;;
   6056    --lt-*)
   6057        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
   6058        exit 1
   6059      ;;
   6060    esac
   6061  done
   6062
   6063  # Print the debug banner immediately:
   6064  if test -n \"\$lt_option_debug\"; then
   6065    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
   6066  fi
   6067}
   6068
   6069# Used when --lt-debug. Prints its arguments to stdout
   6070# (redirection is the responsibility of the caller)
   6071func_lt_dump_args ()
   6072{
   6073  lt_dump_args_N=1;
   6074  for lt_arg
   6075  do
   6076    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
   6077    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
   6078  done
   6079}
   6080
   6081# Core function for launching the target application
   6082func_exec_program_core ()
   6083{
   6084"
   6085  case $host in
   6086  # Backslashes separate directories on plain windows
   6087  *-*-mingw | *-*-os2* | *-cegcc*)
   6088    $ECHO "\
   6089      if test -n \"\$lt_option_debug\"; then
   6090        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
   6091        func_lt_dump_args \${1+\"\$@\"} 1>&2
   6092      fi
   6093      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
   6094"
   6095    ;;
   6096
   6097  *)
   6098    $ECHO "\
   6099      if test -n \"\$lt_option_debug\"; then
   6100        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
   6101        func_lt_dump_args \${1+\"\$@\"} 1>&2
   6102      fi
   6103      exec \"\$progdir/\$program\" \${1+\"\$@\"}
   6104"
   6105    ;;
   6106  esac
   6107  $ECHO "\
   6108      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
   6109      exit 1
   6110}
   6111
   6112# A function to encapsulate launching the target application
   6113# Strips options in the --lt-* namespace from \$@ and
   6114# launches target application with the remaining arguments.
   6115func_exec_program ()
   6116{
   6117  case \" \$* \" in
   6118  *\\ --lt-*)
   6119    for lt_wr_arg
   6120    do
   6121      case \$lt_wr_arg in
   6122      --lt-*) ;;
   6123      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
   6124      esac
   6125      shift
   6126    done ;;
   6127  esac
   6128  func_exec_program_core \${1+\"\$@\"}
   6129}
   6130
   6131  # Parse options
   6132  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
   6133
   6134  # Find the directory that this script lives in.
   6135  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
   6136  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
   6137
   6138  # Follow symbolic links until we get to the real thisdir.
   6139  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
   6140  while test -n \"\$file\"; do
   6141    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
   6142
   6143    # If there was a directory component, then change thisdir.
   6144    if test \"x\$destdir\" != \"x\$file\"; then
   6145      case \"\$destdir\" in
   6146      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
   6147      *) thisdir=\"\$thisdir/\$destdir\" ;;
   6148      esac
   6149    fi
   6150
   6151    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
   6152    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
   6153  done
   6154
   6155  # Usually 'no', except on cygwin/mingw when embedded into
   6156  # the cwrapper.
   6157  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
   6158  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
   6159    # special case for '.'
   6160    if test \"\$thisdir\" = \".\"; then
   6161      thisdir=\`pwd\`
   6162    fi
   6163    # remove .libs from thisdir
   6164    case \"\$thisdir\" in
   6165    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
   6166    $objdir )   thisdir=. ;;
   6167    esac
   6168  fi
   6169
   6170  # Try to get the absolute directory name.
   6171  absdir=\`cd \"\$thisdir\" && pwd\`
   6172  test -n \"\$absdir\" && thisdir=\"\$absdir\"
   6173"
   6174
   6175	if test yes = "$fast_install"; then
   6176	  $ECHO "\
   6177  program=lt-'$outputname'$exeext
   6178  progdir=\"\$thisdir/$objdir\"
   6179
   6180  if test ! -f \"\$progdir/\$program\" ||
   6181     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
   6182       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
   6183
   6184    file=\"\$\$-\$program\"
   6185
   6186    if test ! -d \"\$progdir\"; then
   6187      $MKDIR \"\$progdir\"
   6188    else
   6189      $RM \"\$progdir/\$file\"
   6190    fi"
   6191
   6192	  $ECHO "\
   6193
   6194    # relink executable if necessary
   6195    if test -n \"\$relink_command\"; then
   6196      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
   6197      else
   6198	\$ECHO \"\$relink_command_output\" >&2
   6199	$RM \"\$progdir/\$file\"
   6200	exit 1
   6201      fi
   6202    fi
   6203
   6204    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
   6205    { $RM \"\$progdir/\$program\";
   6206      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
   6207    $RM \"\$progdir/\$file\"
   6208  fi"
   6209	else
   6210	  $ECHO "\
   6211  program='$outputname'
   6212  progdir=\"\$thisdir/$objdir\"
   6213"
   6214	fi
   6215
   6216	$ECHO "\
   6217
   6218  if test -f \"\$progdir/\$program\"; then"
   6219
   6220	# fixup the dll searchpath if we need to.
   6221	#
   6222	# Fix the DLL searchpath if we need to.  Do this before prepending
   6223	# to shlibpath, because on Windows, both are PATH and uninstalled
   6224	# libraries must come first.
   6225	if test -n "$dllsearchpath"; then
   6226	  $ECHO "\
   6227    # Add the dll search path components to the executable PATH
   6228    PATH=$dllsearchpath:\$PATH
   6229"
   6230	fi
   6231
   6232	# Export our shlibpath_var if we have one.
   6233	if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
   6234	  $ECHO "\
   6235    # Add our own library path to $shlibpath_var
   6236    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
   6237
   6238    # Some systems cannot cope with colon-terminated $shlibpath_var
   6239    # The second colon is a workaround for a bug in BeOS R4 sed
   6240    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
   6241
   6242    export $shlibpath_var
   6243"
   6244	fi
   6245
   6246	$ECHO "\
   6247    if test \"\$libtool_execute_magic\" != \"$magic\"; then
   6248      # Run the actual program with our arguments.
   6249      func_exec_program \${1+\"\$@\"}
   6250    fi
   6251  else
   6252    # The program doesn't exist.
   6253    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
   6254    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
   6255    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
   6256    exit 1
   6257  fi
   6258fi\
   6259"
   6260}
   6261
   6262
   6263# func_emit_cwrapperexe_src
   6264# emit the source code for a wrapper executable on stdout
   6265# Must ONLY be called from within func_mode_link because
   6266# it depends on a number of variable set therein.
   6267func_emit_cwrapperexe_src ()
   6268{
   6269	cat <<EOF
   6270
   6271/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
   6272   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
   6273
   6274   The $output program cannot be directly executed until all the libtool
   6275   libraries that it depends on are installed.
   6276
   6277   This wrapper executable should never be moved out of the build directory.
   6278   If it is, it will not operate correctly.
   6279*/
   6280EOF
   6281	    cat <<"EOF"
   6282#ifdef _MSC_VER
   6283# define _CRT_SECURE_NO_DEPRECATE 1
   6284#endif
   6285#include <stdio.h>
   6286#include <stdlib.h>
   6287#ifdef _MSC_VER
   6288# include <direct.h>
   6289# include <process.h>
   6290# include <io.h>
   6291#else
   6292# include <unistd.h>
   6293# include <stdint.h>
   6294# ifdef __CYGWIN__
   6295#  include <io.h>
   6296# endif
   6297#endif
   6298#include <malloc.h>
   6299#include <stdarg.h>
   6300#include <assert.h>
   6301#include <string.h>
   6302#include <ctype.h>
   6303#include <errno.h>
   6304#include <fcntl.h>
   6305#include <sys/stat.h>
   6306
   6307#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
   6308
   6309/* declarations of non-ANSI functions */
   6310#if defined __MINGW32__
   6311# ifdef __STRICT_ANSI__
   6312int _putenv (const char *);
   6313# endif
   6314#elif defined __CYGWIN__
   6315# ifdef __STRICT_ANSI__
   6316char *realpath (const char *, char *);
   6317int putenv (char *);
   6318int setenv (const char *, const char *, int);
   6319# endif
   6320/* #elif defined other_platform || defined ... */
   6321#endif
   6322
   6323/* portability defines, excluding path handling macros */
   6324#if defined _MSC_VER
   6325# define setmode _setmode
   6326# define stat    _stat
   6327# define chmod   _chmod
   6328# define getcwd  _getcwd
   6329# define putenv  _putenv
   6330# define S_IXUSR _S_IEXEC
   6331#elif defined __MINGW32__
   6332# define setmode _setmode
   6333# define stat    _stat
   6334# define chmod   _chmod
   6335# define getcwd  _getcwd
   6336# define putenv  _putenv
   6337#elif defined __CYGWIN__
   6338# define HAVE_SETENV
   6339# define FOPEN_WB "wb"
   6340/* #elif defined other platforms ... */
   6341#endif
   6342
   6343#if defined PATH_MAX
   6344# define LT_PATHMAX PATH_MAX
   6345#elif defined MAXPATHLEN
   6346# define LT_PATHMAX MAXPATHLEN
   6347#else
   6348# define LT_PATHMAX 1024
   6349#endif
   6350
   6351#ifndef S_IXOTH
   6352# define S_IXOTH 0
   6353#endif
   6354#ifndef S_IXGRP
   6355# define S_IXGRP 0
   6356#endif
   6357
   6358/* path handling portability macros */
   6359#ifndef DIR_SEPARATOR
   6360# define DIR_SEPARATOR '/'
   6361# define PATH_SEPARATOR ':'
   6362#endif
   6363
   6364#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
   6365  defined __OS2__
   6366# define HAVE_DOS_BASED_FILE_SYSTEM
   6367# define FOPEN_WB "wb"
   6368# ifndef DIR_SEPARATOR_2
   6369#  define DIR_SEPARATOR_2 '\\'
   6370# endif
   6371# ifndef PATH_SEPARATOR_2
   6372#  define PATH_SEPARATOR_2 ';'
   6373# endif
   6374#endif
   6375
   6376#ifndef DIR_SEPARATOR_2
   6377# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
   6378#else /* DIR_SEPARATOR_2 */
   6379# define IS_DIR_SEPARATOR(ch) \
   6380	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
   6381#endif /* DIR_SEPARATOR_2 */
   6382
   6383#ifndef PATH_SEPARATOR_2
   6384# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
   6385#else /* PATH_SEPARATOR_2 */
   6386# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
   6387#endif /* PATH_SEPARATOR_2 */
   6388
   6389#ifndef FOPEN_WB
   6390# define FOPEN_WB "w"
   6391#endif
   6392#ifndef _O_BINARY
   6393# define _O_BINARY 0
   6394#endif
   6395
   6396#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
   6397#define XFREE(stale) do { \
   6398  if (stale) { free (stale); stale = 0; } \
   6399} while (0)
   6400
   6401#if defined LT_DEBUGWRAPPER
   6402static int lt_debug = 1;
   6403#else
   6404static int lt_debug = 0;
   6405#endif
   6406
   6407const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
   6408
   6409void *xmalloc (size_t num);
   6410char *xstrdup (const char *string);
   6411const char *base_name (const char *name);
   6412char *find_executable (const char *wrapper);
   6413char *chase_symlinks (const char *pathspec);
   6414int make_executable (const char *path);
   6415int check_executable (const char *path);
   6416char *strendzap (char *str, const char *pat);
   6417void lt_debugprintf (const char *file, int line, const char *fmt, ...);
   6418void lt_fatal (const char *file, int line, const char *message, ...);
   6419static const char *nonnull (const char *s);
   6420static const char *nonempty (const char *s);
   6421void lt_setenv (const char *name, const char *value);
   6422char *lt_extend_str (const char *orig_value, const char *add, int to_end);
   6423void lt_update_exe_path (const char *name, const char *value);
   6424void lt_update_lib_path (const char *name, const char *value);
   6425char **prepare_spawn (char **argv);
   6426void lt_dump_script (FILE *f);
   6427EOF
   6428
   6429	    cat <<EOF
   6430#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
   6431# define externally_visible volatile
   6432#else
   6433# define externally_visible __attribute__((externally_visible)) volatile
   6434#endif
   6435externally_visible const char * MAGIC_EXE = "$magic_exe";
   6436const char * LIB_PATH_VARNAME = "$shlibpath_var";
   6437EOF
   6438
   6439	    if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
   6440              func_to_host_path "$temp_rpath"
   6441	      cat <<EOF
   6442const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
   6443EOF
   6444	    else
   6445	      cat <<"EOF"
   6446const char * LIB_PATH_VALUE   = "";
   6447EOF
   6448	    fi
   6449
   6450	    if test -n "$dllsearchpath"; then
   6451              func_to_host_path "$dllsearchpath:"
   6452	      cat <<EOF
   6453const char * EXE_PATH_VARNAME = "PATH";
   6454const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
   6455EOF
   6456	    else
   6457	      cat <<"EOF"
   6458const char * EXE_PATH_VARNAME = "";
   6459const char * EXE_PATH_VALUE   = "";
   6460EOF
   6461	    fi
   6462
   6463	    if test yes = "$fast_install"; then
   6464	      cat <<EOF
   6465const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
   6466EOF
   6467	    else
   6468	      cat <<EOF
   6469const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
   6470EOF
   6471	    fi
   6472
   6473
   6474	    cat <<"EOF"
   6475
   6476#define LTWRAPPER_OPTION_PREFIX         "--lt-"
   6477
   6478static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
   6479static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
   6480static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
   6481
   6482int
   6483main (int argc, char *argv[])
   6484{
   6485  char **newargz;
   6486  int  newargc;
   6487  char *tmp_pathspec;
   6488  char *actual_cwrapper_path;
   6489  char *actual_cwrapper_name;
   6490  char *target_name;
   6491  char *lt_argv_zero;
   6492  int rval = 127;
   6493
   6494  int i;
   6495
   6496  program_name = (char *) xstrdup (base_name (argv[0]));
   6497  newargz = XMALLOC (char *, (size_t) argc + 1);
   6498
   6499  /* very simple arg parsing; don't want to rely on getopt
   6500   * also, copy all non cwrapper options to newargz, except
   6501   * argz[0], which is handled differently
   6502   */
   6503  newargc=0;
   6504  for (i = 1; i < argc; i++)
   6505    {
   6506      if (STREQ (argv[i], dumpscript_opt))
   6507	{
   6508EOF
   6509	    case $host in
   6510	      *mingw* | *cygwin* )
   6511		# make stdout use "unix" line endings
   6512		echo "          setmode(1,_O_BINARY);"
   6513		;;
   6514	      esac
   6515
   6516	    cat <<"EOF"
   6517	  lt_dump_script (stdout);
   6518	  return 0;
   6519	}
   6520      if (STREQ (argv[i], debug_opt))
   6521	{
   6522          lt_debug = 1;
   6523          continue;
   6524	}
   6525      if (STREQ (argv[i], ltwrapper_option_prefix))
   6526        {
   6527          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
   6528             namespace, but it is not one of the ones we know about and
   6529             have already dealt with, above (inluding dump-script), then
   6530             report an error. Otherwise, targets might begin to believe
   6531             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
   6532             namespace. The first time any user complains about this, we'll
   6533             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
   6534             or a configure.ac-settable value.
   6535           */
   6536          lt_fatal (__FILE__, __LINE__,
   6537		    "unrecognized %s option: '%s'",
   6538                    ltwrapper_option_prefix, argv[i]);
   6539        }
   6540      /* otherwise ... */
   6541      newargz[++newargc] = xstrdup (argv[i]);
   6542    }
   6543  newargz[++newargc] = NULL;
   6544
   6545EOF
   6546	    cat <<EOF
   6547  /* The GNU banner must be the first non-error debug message */
   6548  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
   6549EOF
   6550	    cat <<"EOF"
   6551  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
   6552  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
   6553
   6554  tmp_pathspec = find_executable (argv[0]);
   6555  if (tmp_pathspec == NULL)
   6556    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
   6557  lt_debugprintf (__FILE__, __LINE__,
   6558                  "(main) found exe (before symlink chase) at: %s\n",
   6559		  tmp_pathspec);
   6560
   6561  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
   6562  lt_debugprintf (__FILE__, __LINE__,
   6563                  "(main) found exe (after symlink chase) at: %s\n",
   6564		  actual_cwrapper_path);
   6565  XFREE (tmp_pathspec);
   6566
   6567  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
   6568  strendzap (actual_cwrapper_path, actual_cwrapper_name);
   6569
   6570  /* wrapper name transforms */
   6571  strendzap (actual_cwrapper_name, ".exe");
   6572  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
   6573  XFREE (actual_cwrapper_name);
   6574  actual_cwrapper_name = tmp_pathspec;
   6575  tmp_pathspec = 0;
   6576
   6577  /* target_name transforms -- use actual target program name; might have lt- prefix */
   6578  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
   6579  strendzap (target_name, ".exe");
   6580  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
   6581  XFREE (target_name);
   6582  target_name = tmp_pathspec;
   6583  tmp_pathspec = 0;
   6584
   6585  lt_debugprintf (__FILE__, __LINE__,
   6586		  "(main) libtool target name: %s\n",
   6587		  target_name);
   6588EOF
   6589
   6590	    cat <<EOF
   6591  newargz[0] =
   6592    XMALLOC (char, (strlen (actual_cwrapper_path) +
   6593		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
   6594  strcpy (newargz[0], actual_cwrapper_path);
   6595  strcat (newargz[0], "$objdir");
   6596  strcat (newargz[0], "/");
   6597EOF
   6598
   6599	    cat <<"EOF"
   6600  /* stop here, and copy so we don't have to do this twice */
   6601  tmp_pathspec = xstrdup (newargz[0]);
   6602
   6603  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
   6604  strcat (newargz[0], actual_cwrapper_name);
   6605
   6606  /* DO want the lt- prefix here if it exists, so use target_name */
   6607  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
   6608  XFREE (tmp_pathspec);
   6609  tmp_pathspec = NULL;
   6610EOF
   6611
   6612	    case $host_os in
   6613	      mingw*)
   6614	    cat <<"EOF"
   6615  {
   6616    char* p;
   6617    while ((p = strchr (newargz[0], '\\')) != NULL)
   6618      {
   6619	*p = '/';
   6620      }
   6621    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
   6622      {
   6623	*p = '/';
   6624      }
   6625  }
   6626EOF
   6627	    ;;
   6628	    esac
   6629
   6630	    cat <<"EOF"
   6631  XFREE (target_name);
   6632  XFREE (actual_cwrapper_path);
   6633  XFREE (actual_cwrapper_name);
   6634
   6635  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
   6636  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
   6637  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
   6638     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
   6639     because on Windows, both *_VARNAMEs are PATH but uninstalled
   6640     libraries must come first. */
   6641  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
   6642  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
   6643
   6644  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
   6645		  nonnull (lt_argv_zero));
   6646  for (i = 0; i < newargc; i++)
   6647    {
   6648      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
   6649		      i, nonnull (newargz[i]));
   6650    }
   6651
   6652EOF
   6653
   6654	    case $host_os in
   6655	      mingw*)
   6656		cat <<"EOF"
   6657  /* execv doesn't actually work on mingw as expected on unix */
   6658  newargz = prepare_spawn (newargz);
   6659  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   6660  if (rval == -1)
   6661    {
   6662      /* failed to start process */
   6663      lt_debugprintf (__FILE__, __LINE__,
   6664		      "(main) failed to launch target \"%s\": %s\n",
   6665		      lt_argv_zero, nonnull (strerror (errno)));
   6666      return 127;
   6667    }
   6668  return rval;
   6669EOF
   6670		;;
   6671	      *)
   6672		cat <<"EOF"
   6673  execv (lt_argv_zero, newargz);
   6674  return rval; /* =127, but avoids unused variable warning */
   6675EOF
   6676		;;
   6677	    esac
   6678
   6679	    cat <<"EOF"
   6680}
   6681
   6682void *
   6683xmalloc (size_t num)
   6684{
   6685  void *p = (void *) malloc (num);
   6686  if (!p)
   6687    lt_fatal (__FILE__, __LINE__, "memory exhausted");
   6688
   6689  return p;
   6690}
   6691
   6692char *
   6693xstrdup (const char *string)
   6694{
   6695  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
   6696			  string) : NULL;
   6697}
   6698
   6699const char *
   6700base_name (const char *name)
   6701{
   6702  const char *base;
   6703
   6704#if defined HAVE_DOS_BASED_FILE_SYSTEM
   6705  /* Skip over the disk name in MSDOS pathnames. */
   6706  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
   6707    name += 2;
   6708#endif
   6709
   6710  for (base = name; *name; name++)
   6711    if (IS_DIR_SEPARATOR (*name))
   6712      base = name + 1;
   6713  return base;
   6714}
   6715
   6716int
   6717check_executable (const char *path)
   6718{
   6719  struct stat st;
   6720
   6721  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
   6722                  nonempty (path));
   6723  if ((!path) || (!*path))
   6724    return 0;
   6725
   6726  if ((stat (path, &st) >= 0)
   6727      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
   6728    return 1;
   6729  else
   6730    return 0;
   6731}
   6732
   6733int
   6734make_executable (const char *path)
   6735{
   6736  int rval = 0;
   6737  struct stat st;
   6738
   6739  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
   6740                  nonempty (path));
   6741  if ((!path) || (!*path))
   6742    return 0;
   6743
   6744  if (stat (path, &st) >= 0)
   6745    {
   6746      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
   6747    }
   6748  return rval;
   6749}
   6750
   6751/* Searches for the full path of the wrapper.  Returns
   6752   newly allocated full path name if found, NULL otherwise
   6753   Does not chase symlinks, even on platforms that support them.
   6754*/
   6755char *
   6756find_executable (const char *wrapper)
   6757{
   6758  int has_slash = 0;
   6759  const char *p;
   6760  const char *p_next;
   6761  /* static buffer for getcwd */
   6762  char tmp[LT_PATHMAX + 1];
   6763  size_t tmp_len;
   6764  char *concat_name;
   6765
   6766  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
   6767                  nonempty (wrapper));
   6768
   6769  if ((wrapper == NULL) || (*wrapper == '\0'))
   6770    return NULL;
   6771
   6772  /* Absolute path? */
   6773#if defined HAVE_DOS_BASED_FILE_SYSTEM
   6774  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
   6775    {
   6776      concat_name = xstrdup (wrapper);
   6777      if (check_executable (concat_name))
   6778	return concat_name;
   6779      XFREE (concat_name);
   6780    }
   6781  else
   6782    {
   6783#endif
   6784      if (IS_DIR_SEPARATOR (wrapper[0]))
   6785	{
   6786	  concat_name = xstrdup (wrapper);
   6787	  if (check_executable (concat_name))
   6788	    return concat_name;
   6789	  XFREE (concat_name);
   6790	}
   6791#if defined HAVE_DOS_BASED_FILE_SYSTEM
   6792    }
   6793#endif
   6794
   6795  for (p = wrapper; *p; p++)
   6796    if (*p == '/')
   6797      {
   6798	has_slash = 1;
   6799	break;
   6800      }
   6801  if (!has_slash)
   6802    {
   6803      /* no slashes; search PATH */
   6804      const char *path = getenv ("PATH");
   6805      if (path != NULL)
   6806	{
   6807	  for (p = path; *p; p = p_next)
   6808	    {
   6809	      const char *q;
   6810	      size_t p_len;
   6811	      for (q = p; *q; q++)
   6812		if (IS_PATH_SEPARATOR (*q))
   6813		  break;
   6814	      p_len = (size_t) (q - p);
   6815	      p_next = (*q == '\0' ? q : q + 1);
   6816	      if (p_len == 0)
   6817		{
   6818		  /* empty path: current directory */
   6819		  if (getcwd (tmp, LT_PATHMAX) == NULL)
   6820		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
   6821                              nonnull (strerror (errno)));
   6822		  tmp_len = strlen (tmp);
   6823		  concat_name =
   6824		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   6825		  memcpy (concat_name, tmp, tmp_len);
   6826		  concat_name[tmp_len] = '/';
   6827		  strcpy (concat_name + tmp_len + 1, wrapper);
   6828		}
   6829	      else
   6830		{
   6831		  concat_name =
   6832		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
   6833		  memcpy (concat_name, p, p_len);
   6834		  concat_name[p_len] = '/';
   6835		  strcpy (concat_name + p_len + 1, wrapper);
   6836		}
   6837	      if (check_executable (concat_name))
   6838		return concat_name;
   6839	      XFREE (concat_name);
   6840	    }
   6841	}
   6842      /* not found in PATH; assume curdir */
   6843    }
   6844  /* Relative path | not found in path: prepend cwd */
   6845  if (getcwd (tmp, LT_PATHMAX) == NULL)
   6846    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
   6847              nonnull (strerror (errno)));
   6848  tmp_len = strlen (tmp);
   6849  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   6850  memcpy (concat_name, tmp, tmp_len);
   6851  concat_name[tmp_len] = '/';
   6852  strcpy (concat_name + tmp_len + 1, wrapper);
   6853
   6854  if (check_executable (concat_name))
   6855    return concat_name;
   6856  XFREE (concat_name);
   6857  return NULL;
   6858}
   6859
   6860char *
   6861chase_symlinks (const char *pathspec)
   6862{
   6863#ifndef S_ISLNK
   6864  return xstrdup (pathspec);
   6865#else
   6866  char buf[LT_PATHMAX];
   6867  struct stat s;
   6868  char *tmp_pathspec = xstrdup (pathspec);
   6869  char *p;
   6870  int has_symlinks = 0;
   6871  while (strlen (tmp_pathspec) && !has_symlinks)
   6872    {
   6873      lt_debugprintf (__FILE__, __LINE__,
   6874		      "checking path component for symlinks: %s\n",
   6875		      tmp_pathspec);
   6876      if (lstat (tmp_pathspec, &s) == 0)
   6877	{
   6878	  if (S_ISLNK (s.st_mode) != 0)
   6879	    {
   6880	      has_symlinks = 1;
   6881	      break;
   6882	    }
   6883
   6884	  /* search backwards for last DIR_SEPARATOR */
   6885	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
   6886	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
   6887	    p--;
   6888	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
   6889	    {
   6890	      /* no more DIR_SEPARATORS left */
   6891	      break;
   6892	    }
   6893	  *p = '\0';
   6894	}
   6895      else
   6896	{
   6897	  lt_fatal (__FILE__, __LINE__,
   6898		    "error accessing file \"%s\": %s",
   6899		    tmp_pathspec, nonnull (strerror (errno)));
   6900	}
   6901    }
   6902  XFREE (tmp_pathspec);
   6903
   6904  if (!has_symlinks)
   6905    {
   6906      return xstrdup (pathspec);
   6907    }
   6908
   6909  tmp_pathspec = realpath (pathspec, buf);
   6910  if (tmp_pathspec == 0)
   6911    {
   6912      lt_fatal (__FILE__, __LINE__,
   6913		"could not follow symlinks for %s", pathspec);
   6914    }
   6915  return xstrdup (tmp_pathspec);
   6916#endif
   6917}
   6918
   6919char *
   6920strendzap (char *str, const char *pat)
   6921{
   6922  size_t len, patlen;
   6923
   6924  assert (str != NULL);
   6925  assert (pat != NULL);
   6926
   6927  len = strlen (str);
   6928  patlen = strlen (pat);
   6929
   6930  if (patlen <= len)
   6931    {
   6932      str += len - patlen;
   6933      if (STREQ (str, pat))
   6934	*str = '\0';
   6935    }
   6936  return str;
   6937}
   6938
   6939void
   6940lt_debugprintf (const char *file, int line, const char *fmt, ...)
   6941{
   6942  va_list args;
   6943  if (lt_debug)
   6944    {
   6945      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
   6946      va_start (args, fmt);
   6947      (void) vfprintf (stderr, fmt, args);
   6948      va_end (args);
   6949    }
   6950}
   6951
   6952static void
   6953lt_error_core (int exit_status, const char *file,
   6954	       int line, const char *mode,
   6955	       const char *message, va_list ap)
   6956{
   6957  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
   6958  vfprintf (stderr, message, ap);
   6959  fprintf (stderr, ".\n");
   6960
   6961  if (exit_status >= 0)
   6962    exit (exit_status);
   6963}
   6964
   6965void
   6966lt_fatal (const char *file, int line, const char *message, ...)
   6967{
   6968  va_list ap;
   6969  va_start (ap, message);
   6970  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
   6971  va_end (ap);
   6972}
   6973
   6974static const char *
   6975nonnull (const char *s)
   6976{
   6977  return s ? s : "(null)";
   6978}
   6979
   6980static const char *
   6981nonempty (const char *s)
   6982{
   6983  return (s && !*s) ? "(empty)" : nonnull (s);
   6984}
   6985
   6986void
   6987lt_setenv (const char *name, const char *value)
   6988{
   6989  lt_debugprintf (__FILE__, __LINE__,
   6990		  "(lt_setenv) setting '%s' to '%s'\n",
   6991                  nonnull (name), nonnull (value));
   6992  {
   6993#ifdef HAVE_SETENV
   6994    /* always make a copy, for consistency with !HAVE_SETENV */
   6995    char *str = xstrdup (value);
   6996    setenv (name, str, 1);
   6997#else
   6998    size_t len = strlen (name) + 1 + strlen (value) + 1;
   6999    char *str = XMALLOC (char, len);
   7000    sprintf (str, "%s=%s", name, value);
   7001    if (putenv (str) != EXIT_SUCCESS)
   7002      {
   7003        XFREE (str);
   7004      }
   7005#endif
   7006  }
   7007}
   7008
   7009char *
   7010lt_extend_str (const char *orig_value, const char *add, int to_end)
   7011{
   7012  char *new_value;
   7013  if (orig_value && *orig_value)
   7014    {
   7015      size_t orig_value_len = strlen (orig_value);
   7016      size_t add_len = strlen (add);
   7017      new_value = XMALLOC (char, add_len + orig_value_len + 1);
   7018      if (to_end)
   7019        {
   7020          strcpy (new_value, orig_value);
   7021          strcpy (new_value + orig_value_len, add);
   7022        }
   7023      else
   7024        {
   7025          strcpy (new_value, add);
   7026          strcpy (new_value + add_len, orig_value);
   7027        }
   7028    }
   7029  else
   7030    {
   7031      new_value = xstrdup (add);
   7032    }
   7033  return new_value;
   7034}
   7035
   7036void
   7037lt_update_exe_path (const char *name, const char *value)
   7038{
   7039  lt_debugprintf (__FILE__, __LINE__,
   7040		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
   7041                  nonnull (name), nonnull (value));
   7042
   7043  if (name && *name && value && *value)
   7044    {
   7045      char *new_value = lt_extend_str (getenv (name), value, 0);
   7046      /* some systems can't cope with a ':'-terminated path #' */
   7047      size_t len = strlen (new_value);
   7048      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
   7049        {
   7050          new_value[--len] = '\0';
   7051        }
   7052      lt_setenv (name, new_value);
   7053      XFREE (new_value);
   7054    }
   7055}
   7056
   7057void
   7058lt_update_lib_path (const char *name, const char *value)
   7059{
   7060  lt_debugprintf (__FILE__, __LINE__,
   7061		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
   7062                  nonnull (name), nonnull (value));
   7063
   7064  if (name && *name && value && *value)
   7065    {
   7066      char *new_value = lt_extend_str (getenv (name), value, 0);
   7067      lt_setenv (name, new_value);
   7068      XFREE (new_value);
   7069    }
   7070}
   7071
   7072EOF
   7073	    case $host_os in
   7074	      mingw*)
   7075		cat <<"EOF"
   7076
   7077/* Prepares an argument vector before calling spawn().
   7078   Note that spawn() does not by itself call the command interpreter
   7079     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
   7080      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   7081         GetVersionEx(&v);
   7082         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
   7083      }) ? "cmd.exe" : "command.com").
   7084   Instead it simply concatenates the arguments, separated by ' ', and calls
   7085   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
   7086   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
   7087   special way:
   7088   - Space and tab are interpreted as delimiters. They are not treated as
   7089     delimiters if they are surrounded by double quotes: "...".
   7090   - Unescaped double quotes are removed from the input. Their only effect is
   7091     that within double quotes, space and tab are treated like normal
   7092     characters.
   7093   - Backslashes not followed by double quotes are not special.
   7094   - But 2*n+1 backslashes followed by a double quote become
   7095     n backslashes followed by a double quote (n >= 0):
   7096       \" -> "
   7097       \\\" -> \"
   7098       \\\\\" -> \\"
   7099 */
   7100#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
   7101#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
   7102char **
   7103prepare_spawn (char **argv)
   7104{
   7105  size_t argc;
   7106  char **new_argv;
   7107  size_t i;
   7108
   7109  /* Count number of arguments.  */
   7110  for (argc = 0; argv[argc] != NULL; argc++)
   7111    ;
   7112
   7113  /* Allocate new argument vector.  */
   7114  new_argv = XMALLOC (char *, argc + 1);
   7115
   7116  /* Put quoted arguments into the new argument vector.  */
   7117  for (i = 0; i < argc; i++)
   7118    {
   7119      const char *string = argv[i];
   7120
   7121      if (string[0] == '\0')
   7122	new_argv[i] = xstrdup ("\"\"");
   7123      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
   7124	{
   7125	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
   7126	  size_t length;
   7127	  unsigned int backslashes;
   7128	  const char *s;
   7129	  char *quoted_string;
   7130	  char *p;
   7131
   7132	  length = 0;
   7133	  backslashes = 0;
   7134	  if (quote_around)
   7135	    length++;
   7136	  for (s = string; *s != '\0'; s++)
   7137	    {
   7138	      char c = *s;
   7139	      if (c == '"')
   7140		length += backslashes + 1;
   7141	      length++;
   7142	      if (c == '\\')
   7143		backslashes++;
   7144	      else
   7145		backslashes = 0;
   7146	    }
   7147	  if (quote_around)
   7148	    length += backslashes + 1;
   7149
   7150	  quoted_string = XMALLOC (char, length + 1);
   7151
   7152	  p = quoted_string;
   7153	  backslashes = 0;
   7154	  if (quote_around)
   7155	    *p++ = '"';
   7156	  for (s = string; *s != '\0'; s++)
   7157	    {
   7158	      char c = *s;
   7159	      if (c == '"')
   7160		{
   7161		  unsigned int j;
   7162		  for (j = backslashes + 1; j > 0; j--)
   7163		    *p++ = '\\';
   7164		}
   7165	      *p++ = c;
   7166	      if (c == '\\')
   7167		backslashes++;
   7168	      else
   7169		backslashes = 0;
   7170	    }
   7171	  if (quote_around)
   7172	    {
   7173	      unsigned int j;
   7174	      for (j = backslashes; j > 0; j--)
   7175		*p++ = '\\';
   7176	      *p++ = '"';
   7177	    }
   7178	  *p = '\0';
   7179
   7180	  new_argv[i] = quoted_string;
   7181	}
   7182      else
   7183	new_argv[i] = (char *) string;
   7184    }
   7185  new_argv[argc] = NULL;
   7186
   7187  return new_argv;
   7188}
   7189EOF
   7190		;;
   7191	    esac
   7192
   7193            cat <<"EOF"
   7194void lt_dump_script (FILE* f)
   7195{
   7196EOF
   7197	    func_emit_wrapper yes |
   7198	      $SED -n -e '
   7199s/^\(.\{79\}\)\(..*\)/\1\
   7200\2/
   7201h
   7202s/\([\\"]\)/\\\1/g
   7203s/$/\\n/
   7204s/\([^\n]*\).*/  fputs ("\1", f);/p
   7205g
   7206D'
   7207            cat <<"EOF"
   7208}
   7209EOF
   7210}
   7211# end: func_emit_cwrapperexe_src
   7212
   7213# func_win32_import_lib_p ARG
   7214# True if ARG is an import lib, as indicated by $file_magic_cmd
   7215func_win32_import_lib_p ()
   7216{
   7217    $debug_cmd
   7218
   7219    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
   7220    *import*) : ;;
   7221    *) false ;;
   7222    esac
   7223}
   7224
   7225# func_suncc_cstd_abi
   7226# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
   7227# Several compiler flags select an ABI that is incompatible with the
   7228# Cstd library. Avoid specifying it if any are in CXXFLAGS.
   7229func_suncc_cstd_abi ()
   7230{
   7231    $debug_cmd
   7232
   7233    case " $compile_command " in
   7234    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
   7235      suncc_use_cstd_abi=no
   7236      ;;
   7237    *)
   7238      suncc_use_cstd_abi=yes
   7239      ;;
   7240    esac
   7241}
   7242
   7243# func_mode_link arg...
   7244func_mode_link ()
   7245{
   7246    $debug_cmd
   7247
   7248    case $host in
   7249    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
   7250      # It is impossible to link a dll without this setting, and
   7251      # we shouldn't force the makefile maintainer to figure out
   7252      # what system we are compiling for in order to pass an extra
   7253      # flag for every libtool invocation.
   7254      # allow_undefined=no
   7255
   7256      # FIXME: Unfortunately, there are problems with the above when trying
   7257      # to make a dll that has undefined symbols, in which case not
   7258      # even a static library is built.  For now, we need to specify
   7259      # -no-undefined on the libtool link line when we can be certain
   7260      # that all symbols are satisfied, otherwise we get a static library.
   7261      allow_undefined=yes
   7262      ;;
   7263    *)
   7264      allow_undefined=yes
   7265      ;;
   7266    esac
   7267    libtool_args=$nonopt
   7268    base_compile="$nonopt $@"
   7269    compile_command=$nonopt
   7270    finalize_command=$nonopt
   7271
   7272    compile_rpath=
   7273    finalize_rpath=
   7274    compile_shlibpath=
   7275    finalize_shlibpath=
   7276    convenience=
   7277    old_convenience=
   7278    deplibs=
   7279    old_deplibs=
   7280    compiler_flags=
   7281    linker_flags=
   7282    dllsearchpath=
   7283    lib_search_path=`pwd`
   7284    inst_prefix_dir=
   7285    new_inherited_linker_flags=
   7286
   7287    avoid_version=no
   7288    bindir=
   7289    dlfiles=
   7290    dlprefiles=
   7291    dlself=no
   7292    export_dynamic=no
   7293    export_symbols=
   7294    export_symbols_regex=
   7295    generated=
   7296    libobjs=
   7297    ltlibs=
   7298    module=no
   7299    no_install=no
   7300    objs=
   7301    os2dllname=
   7302    non_pic_objects=
   7303    precious_files_regex=
   7304    prefer_static_libs=no
   7305    preload=false
   7306    prev=
   7307    prevarg=
   7308    release=
   7309    rpath=
   7310    xrpath=
   7311    perm_rpath=
   7312    temp_rpath=
   7313    thread_safe=no
   7314    vinfo=
   7315    vinfo_number=no
   7316    weak_libs=
   7317    single_module=$wl-single_module
   7318    func_infer_tag $base_compile
   7319
   7320    # We need to know -static, to get the right output filenames.
   7321    for arg
   7322    do
   7323      case $arg in
   7324      -shared)
   7325	test yes != "$build_libtool_libs" \
   7326	  && func_fatal_configuration "cannot build a shared library"
   7327	build_old_libs=no
   7328	break
   7329	;;
   7330      -all-static | -static | -static-libtool-libs)
   7331	case $arg in
   7332	-all-static)
   7333	  if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
   7334	    func_warning "complete static linking is impossible in this configuration"
   7335	  fi
   7336	  if test -n "$link_static_flag"; then
   7337	    dlopen_self=$dlopen_self_static
   7338	  fi
   7339	  prefer_static_libs=yes
   7340	  ;;
   7341	-static)
   7342	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
   7343	    dlopen_self=$dlopen_self_static
   7344	  fi
   7345	  prefer_static_libs=built
   7346	  ;;
   7347	-static-libtool-libs)
   7348	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
   7349	    dlopen_self=$dlopen_self_static
   7350	  fi
   7351	  prefer_static_libs=yes
   7352	  ;;
   7353	esac
   7354	build_libtool_libs=no
   7355	build_old_libs=yes
   7356	break
   7357	;;
   7358      esac
   7359    done
   7360
   7361    # See if our shared archives depend on static archives.
   7362    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
   7363
   7364    # Go through the arguments, transforming them on the way.
   7365    while test "$#" -gt 0; do
   7366      arg=$1
   7367      shift
   7368      func_quote_arg pretty,unquoted "$arg"
   7369      qarg=$func_quote_arg_unquoted_result
   7370      func_append libtool_args " $func_quote_arg_result"
   7371
   7372      # If the previous option needs an argument, assign it.
   7373      if test -n "$prev"; then
   7374	case $prev in
   7375	output)
   7376	  func_append compile_command " @OUTPUT@"
   7377	  func_append finalize_command " @OUTPUT@"
   7378	  ;;
   7379	esac
   7380
   7381	case $prev in
   7382	bindir)
   7383	  bindir=$arg
   7384	  prev=
   7385	  continue
   7386	  ;;
   7387	dlfiles|dlprefiles)
   7388	  $preload || {
   7389	    # Add the symbol object into the linking commands.
   7390	    func_append compile_command " @SYMFILE@"
   7391	    func_append finalize_command " @SYMFILE@"
   7392	    preload=:
   7393	  }
   7394	  case $arg in
   7395	  *.la | *.lo) ;;  # We handle these cases below.
   7396	  force)
   7397	    if test no = "$dlself"; then
   7398	      dlself=needless
   7399	      export_dynamic=yes
   7400	    fi
   7401	    prev=
   7402	    continue
   7403	    ;;
   7404	  self)
   7405	    if test dlprefiles = "$prev"; then
   7406	      dlself=yes
   7407	    elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
   7408	      dlself=yes
   7409	    else
   7410	      dlself=needless
   7411	      export_dynamic=yes
   7412	    fi
   7413	    prev=
   7414	    continue
   7415	    ;;
   7416	  *)
   7417	    if test dlfiles = "$prev"; then
   7418	      func_append dlfiles " $arg"
   7419	    else
   7420	      func_append dlprefiles " $arg"
   7421	    fi
   7422	    prev=
   7423	    continue
   7424	    ;;
   7425	  esac
   7426	  ;;
   7427	expsyms)
   7428	  export_symbols=$arg
   7429	  test -f "$arg" \
   7430	    || func_fatal_error "symbol file '$arg' does not exist"
   7431	  prev=
   7432	  continue
   7433	  ;;
   7434	expsyms_regex)
   7435	  export_symbols_regex=$arg
   7436	  prev=
   7437	  continue
   7438	  ;;
   7439	framework)
   7440	  case $host in
   7441	    *-*-darwin*)
   7442	      case "$deplibs " in
   7443		*" $qarg.ltframework "*) ;;
   7444		*) func_append deplibs " $qarg.ltframework" # this is fixed later
   7445		   ;;
   7446	      esac
   7447	      ;;
   7448	  esac
   7449	  prev=
   7450	  continue
   7451	  ;;
   7452	inst_prefix)
   7453	  inst_prefix_dir=$arg
   7454	  prev=
   7455	  continue
   7456	  ;;
   7457	mllvm)
   7458	  # Clang does not use LLVM to link, so we can simply discard any
   7459	  # '-mllvm $arg' options when doing the link step.
   7460	  prev=
   7461	  continue
   7462	  ;;
   7463	objectlist)
   7464	  if test -f "$arg"; then
   7465	    save_arg=$arg
   7466	    moreargs=
   7467	    for fil in `cat "$save_arg"`
   7468	    do
   7469#	      func_append moreargs " $fil"
   7470	      arg=$fil
   7471	      # A libtool-controlled object.
   7472
   7473	      # Check to see that this really is a libtool object.
   7474	      if func_lalib_unsafe_p "$arg"; then
   7475		pic_object=
   7476		non_pic_object=
   7477
   7478		# Read the .lo file
   7479		func_source "$arg"
   7480
   7481		if test -z "$pic_object" ||
   7482		   test -z "$non_pic_object" ||
   7483		   test none = "$pic_object" &&
   7484		   test none = "$non_pic_object"; then
   7485		  func_fatal_error "cannot find name of object for '$arg'"
   7486		fi
   7487
   7488		# Extract subdirectory from the argument.
   7489		func_dirname "$arg" "/" ""
   7490		xdir=$func_dirname_result
   7491
   7492		if test none != "$pic_object"; then
   7493		  # Prepend the subdirectory the object is found in.
   7494		  pic_object=$xdir$pic_object
   7495
   7496		  if test dlfiles = "$prev"; then
   7497		    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
   7498		      func_append dlfiles " $pic_object"
   7499		      prev=
   7500		      continue
   7501		    else
   7502		      # If libtool objects are unsupported, then we need to preload.
   7503		      prev=dlprefiles
   7504		    fi
   7505		  fi
   7506
   7507		  # CHECK ME:  I think I busted this.  -Ossama
   7508		  if test dlprefiles = "$prev"; then
   7509		    # Preload the old-style object.
   7510		    func_append dlprefiles " $pic_object"
   7511		    prev=
   7512		  fi
   7513
   7514		  # A PIC object.
   7515		  func_append libobjs " $pic_object"
   7516		  arg=$pic_object
   7517		fi
   7518
   7519		# Non-PIC object.
   7520		if test none != "$non_pic_object"; then
   7521		  # Prepend the subdirectory the object is found in.
   7522		  non_pic_object=$xdir$non_pic_object
   7523
   7524		  # A standard non-PIC object
   7525		  func_append non_pic_objects " $non_pic_object"
   7526		  if test -z "$pic_object" || test none = "$pic_object"; then
   7527		    arg=$non_pic_object
   7528		  fi
   7529		else
   7530		  # If the PIC object exists, use it instead.
   7531		  # $xdir was prepended to $pic_object above.
   7532		  non_pic_object=$pic_object
   7533		  func_append non_pic_objects " $non_pic_object"
   7534		fi
   7535	      else
   7536		# Only an error if not doing a dry-run.
   7537		if $opt_dry_run; then
   7538		  # Extract subdirectory from the argument.
   7539		  func_dirname "$arg" "/" ""
   7540		  xdir=$func_dirname_result
   7541
   7542		  func_lo2o "$arg"
   7543		  pic_object=$xdir$objdir/$func_lo2o_result
   7544		  non_pic_object=$xdir$func_lo2o_result
   7545		  func_append libobjs " $pic_object"
   7546		  func_append non_pic_objects " $non_pic_object"
   7547	        else
   7548		  func_fatal_error "'$arg' is not a valid libtool object"
   7549		fi
   7550	      fi
   7551	    done
   7552	  else
   7553	    func_fatal_error "link input file '$arg' does not exist"
   7554	  fi
   7555	  arg=$save_arg
   7556	  prev=
   7557	  continue
   7558	  ;;
   7559	os2dllname)
   7560	  os2dllname=$arg
   7561	  prev=
   7562	  continue
   7563	  ;;
   7564	precious_regex)
   7565	  precious_files_regex=$arg
   7566	  prev=
   7567	  continue
   7568	  ;;
   7569	release)
   7570	  release=-$arg
   7571	  prev=
   7572	  continue
   7573	  ;;
   7574	rpath | xrpath)
   7575	  # We need an absolute path.
   7576	  case $arg in
   7577	  [\\/]* | [A-Za-z]:[\\/]*) ;;
   7578	  *)
   7579	    func_fatal_error "only absolute run-paths are allowed"
   7580	    ;;
   7581	  esac
   7582	  if test rpath = "$prev"; then
   7583	    case "$rpath " in
   7584	    *" $arg "*) ;;
   7585	    *) func_append rpath " $arg" ;;
   7586	    esac
   7587	  else
   7588	    case "$xrpath " in
   7589	    *" $arg "*) ;;
   7590	    *) func_append xrpath " $arg" ;;
   7591	    esac
   7592	  fi
   7593	  prev=
   7594	  continue
   7595	  ;;
   7596	shrext)
   7597	  shrext_cmds=$arg
   7598	  prev=
   7599	  continue
   7600	  ;;
   7601	weak)
   7602	  func_append weak_libs " $arg"
   7603	  prev=
   7604	  continue
   7605	  ;;
   7606	xassembler)
   7607	  func_append compiler_flags " -Xassembler $qarg"
   7608	  prev=
   7609	  func_append compile_command " -Xassembler $qarg"
   7610	  func_append finalize_command " -Xassembler $qarg"
   7611	  continue
   7612	  ;;
   7613	xcclinker)
   7614	  func_append linker_flags " $qarg"
   7615	  func_append compiler_flags " $qarg"
   7616	  prev=
   7617	  func_append compile_command " $qarg"
   7618	  func_append finalize_command " $qarg"
   7619	  continue
   7620	  ;;
   7621	xcompiler)
   7622	  func_append compiler_flags " $qarg"
   7623	  prev=
   7624	  func_append compile_command " $qarg"
   7625	  func_append finalize_command " $qarg"
   7626	  continue
   7627	  ;;
   7628	xlinker)
   7629	  func_append linker_flags " $qarg"
   7630	  func_append compiler_flags " $wl$qarg"
   7631	  prev=
   7632	  func_append compile_command " $wl$qarg"
   7633	  func_append finalize_command " $wl$qarg"
   7634	  continue
   7635	  ;;
   7636	*)
   7637	  eval "$prev=\"\$arg\""
   7638	  prev=
   7639	  continue
   7640	  ;;
   7641	esac
   7642      fi # test -n "$prev"
   7643
   7644      prevarg=$arg
   7645
   7646      case $arg in
   7647      -all-static)
   7648	if test -n "$link_static_flag"; then
   7649	  # See comment for -static flag below, for more details.
   7650	  func_append compile_command " $link_static_flag"
   7651	  func_append finalize_command " $link_static_flag"
   7652	fi
   7653	continue
   7654	;;
   7655
   7656      -allow-undefined)
   7657	# FIXME: remove this flag sometime in the future.
   7658	func_fatal_error "'-allow-undefined' must not be used because it is the default"
   7659	;;
   7660
   7661      -avoid-version)
   7662	avoid_version=yes
   7663	continue
   7664	;;
   7665
   7666      -bindir)
   7667	prev=bindir
   7668	continue
   7669	;;
   7670
   7671      -dlopen)
   7672	prev=dlfiles
   7673	continue
   7674	;;
   7675
   7676      -dlpreopen)
   7677	prev=dlprefiles
   7678	continue
   7679	;;
   7680
   7681      -export-dynamic)
   7682	export_dynamic=yes
   7683	continue
   7684	;;
   7685
   7686      -export-symbols | -export-symbols-regex)
   7687	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
   7688	  func_fatal_error "more than one -exported-symbols argument is not allowed"
   7689	fi
   7690	if test X-export-symbols = "X$arg"; then
   7691	  prev=expsyms
   7692	else
   7693	  prev=expsyms_regex
   7694	fi
   7695	continue
   7696	;;
   7697
   7698      -framework)
   7699	prev=framework
   7700	continue
   7701	;;
   7702
   7703      -inst-prefix-dir)
   7704	prev=inst_prefix
   7705	continue
   7706	;;
   7707
   7708      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
   7709      # so, if we see these flags be careful not to treat them like -L
   7710      -L[A-Z][A-Z]*:*)
   7711	case $with_gcc/$host in
   7712	no/*-*-irix* | /*-*-irix*)
   7713	  func_append compile_command " $arg"
   7714	  func_append finalize_command " $arg"
   7715	  ;;
   7716	esac
   7717	continue
   7718	;;
   7719
   7720      -L*)
   7721	func_stripname "-L" '' "$arg"
   7722	if test -z "$func_stripname_result"; then
   7723	  if test "$#" -gt 0; then
   7724	    func_fatal_error "require no space between '-L' and '$1'"
   7725	  else
   7726	    func_fatal_error "need path for '-L' option"
   7727	  fi
   7728	fi
   7729	func_resolve_sysroot "$func_stripname_result"
   7730	dir=$func_resolve_sysroot_result
   7731	# We need an absolute path.
   7732	case $dir in
   7733	[\\/]* | [A-Za-z]:[\\/]*) ;;
   7734	*)
   7735	  absdir=`cd "$dir" && pwd`
   7736	  test -z "$absdir" && \
   7737	    func_fatal_error "cannot determine absolute directory name of '$dir'"
   7738	  dir=$absdir
   7739	  ;;
   7740	esac
   7741	case "$deplibs " in
   7742	*" -L$dir "* | *" $arg "*)
   7743	  # Will only happen for absolute or sysroot arguments
   7744	  ;;
   7745	*)
   7746	  # Preserve sysroot, but never include relative directories
   7747	  case $dir in
   7748	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
   7749	    *) func_append deplibs " -L$dir" ;;
   7750	  esac
   7751	  func_append lib_search_path " $dir"
   7752	  ;;
   7753	esac
   7754	case $host in
   7755	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
   7756	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
   7757	  case :$dllsearchpath: in
   7758	  *":$dir:"*) ;;
   7759	  ::) dllsearchpath=$dir;;
   7760	  *) func_append dllsearchpath ":$dir";;
   7761	  esac
   7762	  case :$dllsearchpath: in
   7763	  *":$testbindir:"*) ;;
   7764	  ::) dllsearchpath=$testbindir;;
   7765	  *) func_append dllsearchpath ":$testbindir";;
   7766	  esac
   7767	  ;;
   7768	esac
   7769	continue
   7770	;;
   7771
   7772      -l*)
   7773	if test X-lc = "X$arg" || test X-lm = "X$arg"; then
   7774	  case $host in
   7775	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
   7776	    # These systems don't actually have a C or math library (as such)
   7777	    continue
   7778	    ;;
   7779	  *-*-os2*)
   7780	    # These systems don't actually have a C library (as such)
   7781	    test X-lc = "X$arg" && continue
   7782	    ;;
   7783	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
   7784	    # Do not include libc due to us having libc/libc_r.
   7785	    test X-lc = "X$arg" && continue
   7786	    ;;
   7787	  *-*-rhapsody* | *-*-darwin1.[012])
   7788	    # Rhapsody C and math libraries are in the System framework
   7789	    func_append deplibs " System.ltframework"
   7790	    continue
   7791	    ;;
   7792	  *-*-sco3.2v5* | *-*-sco5v6*)
   7793	    # Causes problems with __ctype
   7794	    test X-lc = "X$arg" && continue
   7795	    ;;
   7796	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   7797	    # Compiler inserts libc in the correct place for threads to work
   7798	    test X-lc = "X$arg" && continue
   7799	    ;;
   7800	  esac
   7801	elif test X-lc_r = "X$arg"; then
   7802	 case $host in
   7803	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
   7804	   # Do not include libc_r directly, use -pthread flag.
   7805	   continue
   7806	   ;;
   7807	 esac
   7808	fi
   7809	func_append deplibs " $arg"
   7810	continue
   7811	;;
   7812
   7813      -mllvm)
   7814	prev=mllvm
   7815	continue
   7816	;;
   7817
   7818      -module)
   7819	module=yes
   7820	continue
   7821	;;
   7822
   7823      # Tru64 UNIX uses -model [arg] to determine the layout of C++
   7824      # classes, name mangling, and exception handling.
   7825      # Darwin uses the -arch flag to determine output architecture.
   7826      -model|-arch|-isysroot|--sysroot)
   7827	func_append compiler_flags " $arg"
   7828	func_append compile_command " $arg"
   7829	func_append finalize_command " $arg"
   7830	prev=xcompiler
   7831	continue
   7832	;;
   7833     # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199.
   7834     -pthread)
   7835	case $host in
   7836	  *solaris2*) ;;
   7837	  *)
   7838	    case "$new_inherited_linker_flags " in
   7839	        *" $arg "*) ;;
   7840	        * ) func_append new_inherited_linker_flags " $arg" ;;
   7841	    esac
   7842	  ;;
   7843	esac
   7844	continue
   7845	;;
   7846      -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
   7847      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
   7848	func_append compiler_flags " $arg"
   7849	func_append compile_command " $arg"
   7850	func_append finalize_command " $arg"
   7851	case "$new_inherited_linker_flags " in
   7852	    *" $arg "*) ;;
   7853	    * ) func_append new_inherited_linker_flags " $arg" ;;
   7854	esac
   7855	continue
   7856	;;
   7857
   7858      -multi_module)
   7859	single_module=$wl-multi_module
   7860	continue
   7861	;;
   7862
   7863      -no-fast-install)
   7864	fast_install=no
   7865	continue
   7866	;;
   7867
   7868      -no-install)
   7869	case $host in
   7870	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
   7871	  # The PATH hackery in wrapper scripts is required on Windows
   7872	  # and Darwin in order for the loader to find any dlls it needs.
   7873	  func_warning "'-no-install' is ignored for $host"
   7874	  func_warning "assuming '-no-fast-install' instead"
   7875	  fast_install=no
   7876	  ;;
   7877	*) no_install=yes ;;
   7878	esac
   7879	continue
   7880	;;
   7881
   7882      -no-undefined)
   7883	allow_undefined=no
   7884	continue
   7885	;;
   7886
   7887      -objectlist)
   7888	prev=objectlist
   7889	continue
   7890	;;
   7891
   7892      -os2dllname)
   7893	prev=os2dllname
   7894	continue
   7895	;;
   7896
   7897      -o) prev=output ;;
   7898
   7899      -precious-files-regex)
   7900	prev=precious_regex
   7901	continue
   7902	;;
   7903
   7904      -release)
   7905	prev=release
   7906	continue
   7907	;;
   7908
   7909      -rpath)
   7910	prev=rpath
   7911	continue
   7912	;;
   7913
   7914      -R)
   7915	prev=xrpath
   7916	continue
   7917	;;
   7918
   7919      -R*)
   7920	func_stripname '-R' '' "$arg"
   7921	dir=$func_stripname_result
   7922	# We need an absolute path.
   7923	case $dir in
   7924	[\\/]* | [A-Za-z]:[\\/]*) ;;
   7925	=*)
   7926	  func_stripname '=' '' "$dir"
   7927	  dir=$lt_sysroot$func_stripname_result
   7928	  ;;
   7929	*)
   7930	  func_fatal_error "only absolute run-paths are allowed"
   7931	  ;;
   7932	esac
   7933	case "$xrpath " in
   7934	*" $dir "*) ;;
   7935	*) func_append xrpath " $dir" ;;
   7936	esac
   7937	continue
   7938	;;
   7939
   7940      -shared)
   7941	# The effects of -shared are defined in a previous loop.
   7942	continue
   7943	;;
   7944
   7945      -shrext)
   7946	prev=shrext
   7947	continue
   7948	;;
   7949
   7950      -static | -static-libtool-libs)
   7951	# The effects of -static are defined in a previous loop.
   7952	# We used to do the same as -all-static on platforms that
   7953	# didn't have a PIC flag, but the assumption that the effects
   7954	# would be equivalent was wrong.  It would break on at least
   7955	# Digital Unix and AIX.
   7956	continue
   7957	;;
   7958
   7959      -thread-safe)
   7960	thread_safe=yes
   7961	continue
   7962	;;
   7963
   7964      -version-info)
   7965	prev=vinfo
   7966	continue
   7967	;;
   7968
   7969      -version-number)
   7970	prev=vinfo
   7971	vinfo_number=yes
   7972	continue
   7973	;;
   7974
   7975      -weak)
   7976        prev=weak
   7977	continue
   7978	;;
   7979
   7980      -Wc,*)
   7981	func_stripname '-Wc,' '' "$arg"
   7982	args=$func_stripname_result
   7983	arg=
   7984	save_ifs=$IFS; IFS=,
   7985	for flag in $args; do
   7986	  IFS=$save_ifs
   7987          func_quote_arg pretty "$flag"
   7988	  func_append arg " $func_quote_arg_result"
   7989	  func_append compiler_flags " $func_quote_arg_result"
   7990	done
   7991	IFS=$save_ifs
   7992	func_stripname ' ' '' "$arg"
   7993	arg=$func_stripname_result
   7994	;;
   7995
   7996      -Wl,*)
   7997	func_stripname '-Wl,' '' "$arg"
   7998	args=$func_stripname_result
   7999	arg=
   8000	save_ifs=$IFS; IFS=,
   8001	for flag in $args; do
   8002	  IFS=$save_ifs
   8003          func_quote_arg pretty "$flag"
   8004	  func_append arg " $wl$func_quote_arg_result"
   8005	  func_append compiler_flags " $wl$func_quote_arg_result"
   8006	  func_append linker_flags " $func_quote_arg_result"
   8007	done
   8008	IFS=$save_ifs
   8009	func_stripname ' ' '' "$arg"
   8010	arg=$func_stripname_result
   8011	;;
   8012
   8013      -Xassembler)
   8014        prev=xassembler
   8015        continue
   8016        ;;
   8017
   8018      -Xcompiler)
   8019	prev=xcompiler
   8020	continue
   8021	;;
   8022
   8023      -Xlinker)
   8024	prev=xlinker
   8025	continue
   8026	;;
   8027
   8028      -XCClinker)
   8029	prev=xcclinker
   8030	continue
   8031	;;
   8032
   8033      # -msg_* for osf cc
   8034      -msg_*)
   8035	func_quote_arg pretty "$arg"
   8036	arg=$func_quote_arg_result
   8037	;;
   8038
   8039      # Flags to be passed through unchanged, with rationale:
   8040      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
   8041      # -r[0-9][0-9]*        specify processor for the SGI compiler
   8042      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
   8043      # +DA*, +DD*           enable 64-bit mode for the HP compiler
   8044      # -q*                  compiler args for the IBM compiler
   8045      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
   8046      # -F/path              path to uninstalled frameworks, gcc on darwin
   8047      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
   8048      # -fstack-protector*   stack protector flags for GCC
   8049      # @file                GCC response files
   8050      # -tp=*                Portland pgcc target processor selection
   8051      # --sysroot=*          for sysroot support
   8052      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
   8053      # -specs=*             GCC specs files
   8054      # -stdlib=*            select c++ std lib with clang
   8055      # -fsanitize=*         Clang/GCC memory and address sanitizer
   8056      # -fuse-ld=*           Linker select flags for GCC
   8057      # -Wa,*                Pass flags directly to the assembler
   8058      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
   8059      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
   8060      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
   8061      -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*)
   8062        func_quote_arg pretty "$arg"
   8063	arg=$func_quote_arg_result
   8064        func_append compile_command " $arg"
   8065        func_append finalize_command " $arg"
   8066        func_append compiler_flags " $arg"
   8067        continue
   8068        ;;
   8069
   8070      -Z*)
   8071        if test os2 = "`expr $host : '.*\(os2\)'`"; then
   8072          # OS/2 uses -Zxxx to specify OS/2-specific options
   8073	  compiler_flags="$compiler_flags $arg"
   8074	  func_append compile_command " $arg"
   8075	  func_append finalize_command " $arg"
   8076	  case $arg in
   8077	  -Zlinker | -Zstack)
   8078	    prev=xcompiler
   8079	    ;;
   8080	  esac
   8081	  continue
   8082        else
   8083	  # Otherwise treat like 'Some other compiler flag' below
   8084	  func_quote_arg pretty "$arg"
   8085	  arg=$func_quote_arg_result
   8086        fi
   8087	;;
   8088
   8089      # Some other compiler flag.
   8090      -* | +*)
   8091        func_quote_arg pretty "$arg"
   8092	arg=$func_quote_arg_result
   8093	;;
   8094
   8095      *.$objext)
   8096	# A standard object.
   8097	func_append objs " $arg"
   8098	;;
   8099
   8100      *.lo)
   8101	# A libtool-controlled object.
   8102
   8103	# Check to see that this really is a libtool object.
   8104	if func_lalib_unsafe_p "$arg"; then
   8105	  pic_object=
   8106	  non_pic_object=
   8107
   8108	  # Read the .lo file
   8109	  func_source "$arg"
   8110
   8111	  if test -z "$pic_object" ||
   8112	     test -z "$non_pic_object" ||
   8113	     test none = "$pic_object" &&
   8114	     test none = "$non_pic_object"; then
   8115	    func_fatal_error "cannot find name of object for '$arg'"
   8116	  fi
   8117
   8118	  # Extract subdirectory from the argument.
   8119	  func_dirname "$arg" "/" ""
   8120	  xdir=$func_dirname_result
   8121
   8122	  test none = "$pic_object" || {
   8123	    # Prepend the subdirectory the object is found in.
   8124	    pic_object=$xdir$pic_object
   8125
   8126	    if test dlfiles = "$prev"; then
   8127	      if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
   8128		func_append dlfiles " $pic_object"
   8129		prev=
   8130		continue
   8131	      else
   8132		# If libtool objects are unsupported, then we need to preload.
   8133		prev=dlprefiles
   8134	      fi
   8135	    fi
   8136
   8137	    # CHECK ME:  I think I busted this.  -Ossama
   8138	    if test dlprefiles = "$prev"; then
   8139	      # Preload the old-style object.
   8140	      func_append dlprefiles " $pic_object"
   8141	      prev=
   8142	    fi
   8143
   8144	    # A PIC object.
   8145	    func_append libobjs " $pic_object"
   8146	    arg=$pic_object
   8147	  }
   8148
   8149	  # Non-PIC object.
   8150	  if test none != "$non_pic_object"; then
   8151	    # Prepend the subdirectory the object is found in.
   8152	    non_pic_object=$xdir$non_pic_object
   8153
   8154	    # A standard non-PIC object
   8155	    func_append non_pic_objects " $non_pic_object"
   8156	    if test -z "$pic_object" || test none = "$pic_object"; then
   8157	      arg=$non_pic_object
   8158	    fi
   8159	  else
   8160	    # If the PIC object exists, use it instead.
   8161	    # $xdir was prepended to $pic_object above.
   8162	    non_pic_object=$pic_object
   8163	    func_append non_pic_objects " $non_pic_object"
   8164	  fi
   8165	else
   8166	  # Only an error if not doing a dry-run.
   8167	  if $opt_dry_run; then
   8168	    # Extract subdirectory from the argument.
   8169	    func_dirname "$arg" "/" ""
   8170	    xdir=$func_dirname_result
   8171
   8172	    func_lo2o "$arg"
   8173	    pic_object=$xdir$objdir/$func_lo2o_result
   8174	    non_pic_object=$xdir$func_lo2o_result
   8175	    func_append libobjs " $pic_object"
   8176	    func_append non_pic_objects " $non_pic_object"
   8177	  else
   8178	    func_fatal_error "'$arg' is not a valid libtool object"
   8179	  fi
   8180	fi
   8181	;;
   8182
   8183      *.$libext)
   8184	# An archive.
   8185	func_append deplibs " $arg"
   8186	func_append old_deplibs " $arg"
   8187	continue
   8188	;;
   8189
   8190      *.la)
   8191	# A libtool-controlled library.
   8192
   8193	func_resolve_sysroot "$arg"
   8194	if test dlfiles = "$prev"; then
   8195	  # This library was specified with -dlopen.
   8196	  func_append dlfiles " $func_resolve_sysroot_result"
   8197	  prev=
   8198	elif test dlprefiles = "$prev"; then
   8199	  # The library was specified with -dlpreopen.
   8200	  func_append dlprefiles " $func_resolve_sysroot_result"
   8201	  prev=
   8202	else
   8203	  func_append deplibs " $func_resolve_sysroot_result"
   8204	fi
   8205	continue
   8206	;;
   8207
   8208      # Some other compiler argument.
   8209      *)
   8210	# Unknown arguments in both finalize_command and compile_command need
   8211	# to be aesthetically quoted because they are evaled later.
   8212	func_quote_arg pretty "$arg"
   8213	arg=$func_quote_arg_result
   8214	;;
   8215      esac # arg
   8216
   8217      # Now actually substitute the argument into the commands.
   8218      if test -n "$arg"; then
   8219	func_append compile_command " $arg"
   8220	func_append finalize_command " $arg"
   8221      fi
   8222    done # argument parsing loop
   8223
   8224    test -n "$prev" && \
   8225      func_fatal_help "the '$prevarg' option requires an argument"
   8226
   8227    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
   8228      eval arg=\"$export_dynamic_flag_spec\"
   8229      func_append compile_command " $arg"
   8230      func_append finalize_command " $arg"
   8231    fi
   8232
   8233    oldlibs=
   8234    # calculate the name of the file, without its directory
   8235    func_basename "$output"
   8236    outputname=$func_basename_result
   8237    libobjs_save=$libobjs
   8238
   8239    if test -n "$shlibpath_var"; then
   8240      # get the directories listed in $shlibpath_var
   8241      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
   8242    else
   8243      shlib_search_path=
   8244    fi
   8245    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
   8246    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
   8247
   8248    # Definition is injected by LT_CONFIG during libtool generation.
   8249    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
   8250
   8251    func_dirname "$output" "/" ""
   8252    output_objdir=$func_dirname_result$objdir
   8253    func_to_tool_file "$output_objdir/"
   8254    tool_output_objdir=$func_to_tool_file_result
   8255    # Create the object directory.
   8256    func_mkdir_p "$output_objdir"
   8257
   8258    # Determine the type of output
   8259    case $output in
   8260    "")
   8261      func_fatal_help "you must specify an output file"
   8262      ;;
   8263    *.$libext) linkmode=oldlib ;;
   8264    *.lo | *.$objext) linkmode=obj ;;
   8265    *.la) linkmode=lib ;;
   8266    *) linkmode=prog ;; # Anything else should be a program.
   8267    esac
   8268
   8269    specialdeplibs=
   8270
   8271    libs=
   8272    # Find all interdependent deplibs by searching for libraries
   8273    # that are linked more than once (e.g. -la -lb -la)
   8274    for deplib in $deplibs; do
   8275      if $opt_preserve_dup_deps; then
   8276	case "$libs " in
   8277	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
   8278	esac
   8279      fi
   8280      func_append libs " $deplib"
   8281    done
   8282
   8283    if test lib = "$linkmode"; then
   8284      libs="$predeps $libs $compiler_lib_search_path $postdeps"
   8285
   8286      # Compute libraries that are listed more than once in $predeps
   8287      # $postdeps and mark them as special (i.e., whose duplicates are
   8288      # not to be eliminated).
   8289      pre_post_deps=
   8290      if $opt_duplicate_compiler_generated_deps; then
   8291	for pre_post_dep in $predeps $postdeps; do
   8292	  case "$pre_post_deps " in
   8293	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
   8294	  esac
   8295	  func_append pre_post_deps " $pre_post_dep"
   8296	done
   8297      fi
   8298      pre_post_deps=
   8299    fi
   8300
   8301    deplibs=
   8302    newdependency_libs=
   8303    newlib_search_path=
   8304    need_relink=no # whether we're linking any uninstalled libtool libraries
   8305    notinst_deplibs= # not-installed libtool libraries
   8306    notinst_path= # paths that contain not-installed libtool libraries
   8307
   8308    case $linkmode in
   8309    lib)
   8310	passes="conv dlpreopen link"
   8311	for file in $dlfiles $dlprefiles; do
   8312	  case $file in
   8313	  *.la) ;;
   8314	  *)
   8315	    func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
   8316	    ;;
   8317	  esac
   8318	done
   8319	;;
   8320    prog)
   8321	compile_deplibs=
   8322	finalize_deplibs=
   8323	alldeplibs=false
   8324	newdlfiles=
   8325	newdlprefiles=
   8326	passes="conv scan dlopen dlpreopen link"
   8327	;;
   8328    *)  passes="conv"
   8329	;;
   8330    esac
   8331
   8332    for pass in $passes; do
   8333      # The preopen pass in lib mode reverses $deplibs; put it back here
   8334      # so that -L comes before libs that need it for instance...
   8335      if test lib,link = "$linkmode,$pass"; then
   8336	## FIXME: Find the place where the list is rebuilt in the wrong
   8337	##        order, and fix it there properly
   8338        tmp_deplibs=
   8339	for deplib in $deplibs; do
   8340	  tmp_deplibs="$deplib $tmp_deplibs"
   8341	done
   8342	deplibs=$tmp_deplibs
   8343      fi
   8344
   8345      if test lib,link = "$linkmode,$pass" ||
   8346	 test prog,scan = "$linkmode,$pass"; then
   8347	libs=$deplibs
   8348	deplibs=
   8349      fi
   8350      if test prog = "$linkmode"; then
   8351	case $pass in
   8352	dlopen) libs=$dlfiles ;;
   8353	dlpreopen) libs=$dlprefiles ;;
   8354	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
   8355	esac
   8356      fi
   8357      if test lib,dlpreopen = "$linkmode,$pass"; then
   8358	# Collect and forward deplibs of preopened libtool libs
   8359	for lib in $dlprefiles; do
   8360	  # Ignore non-libtool-libs
   8361	  dependency_libs=
   8362	  func_resolve_sysroot "$lib"
   8363	  case $lib in
   8364	  *.la)	func_source "$func_resolve_sysroot_result" ;;
   8365	  esac
   8366
   8367	  # Collect preopened libtool deplibs, except any this library
   8368	  # has declared as weak libs
   8369	  for deplib in $dependency_libs; do
   8370	    func_basename "$deplib"
   8371            deplib_base=$func_basename_result
   8372	    case " $weak_libs " in
   8373	    *" $deplib_base "*) ;;
   8374	    *) func_append deplibs " $deplib" ;;
   8375	    esac
   8376	  done
   8377	done
   8378	libs=$dlprefiles
   8379      fi
   8380      if test dlopen = "$pass"; then
   8381	# Collect dlpreopened libraries
   8382	save_deplibs=$deplibs
   8383	deplibs=
   8384      fi
   8385
   8386      for deplib in $libs; do
   8387	lib=
   8388	found=false
   8389	case $deplib in
   8390	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
   8391        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
   8392	  if test prog,link = "$linkmode,$pass"; then
   8393	    compile_deplibs="$deplib $compile_deplibs"
   8394	    finalize_deplibs="$deplib $finalize_deplibs"
   8395	  else
   8396	    func_append compiler_flags " $deplib"
   8397	    if test lib = "$linkmode"; then
   8398		case "$new_inherited_linker_flags " in
   8399		    *" $deplib "*) ;;
   8400		    * ) func_append new_inherited_linker_flags " $deplib" ;;
   8401		esac
   8402	    fi
   8403	  fi
   8404	  continue
   8405	  ;;
   8406	-l*)
   8407	  if test lib != "$linkmode" && test prog != "$linkmode"; then
   8408	    func_warning "'-l' is ignored for archives/objects"
   8409	    continue
   8410	  fi
   8411	  func_stripname '-l' '' "$deplib"
   8412	  name=$func_stripname_result
   8413	  if test lib = "$linkmode"; then
   8414	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
   8415	  else
   8416	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
   8417	  fi
   8418	  for searchdir in $searchdirs; do
   8419	    for search_ext in .la $std_shrext .so .a; do
   8420	      # Search the libtool library
   8421	      lib=$searchdir/lib$name$search_ext
   8422	      if test -f "$lib"; then
   8423		if test .la = "$search_ext"; then
   8424		  found=:
   8425		else
   8426		  found=false
   8427		fi
   8428		break 2
   8429	      fi
   8430	    done
   8431	  done
   8432	  if $found; then
   8433	    # deplib is a libtool library
   8434	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
   8435	    # We need to do some special things here, and not later.
   8436	    if test yes = "$allow_libtool_libs_with_static_runtimes"; then
   8437	      case " $predeps $postdeps " in
   8438	      *" $deplib "*)
   8439		if func_lalib_p "$lib"; then
   8440		  library_names=
   8441		  old_library=
   8442		  func_source "$lib"
   8443		  for l in $old_library $library_names; do
   8444		    ll=$l
   8445		  done
   8446		  if test "X$ll" = "X$old_library"; then # only static version available
   8447		    found=false
   8448		    func_dirname "$lib" "" "."
   8449		    ladir=$func_dirname_result
   8450		    lib=$ladir/$old_library
   8451		    if test prog,link = "$linkmode,$pass"; then
   8452		      compile_deplibs="$deplib $compile_deplibs"
   8453		      finalize_deplibs="$deplib $finalize_deplibs"
   8454		    else
   8455		      deplibs="$deplib $deplibs"
   8456		      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
   8457		    fi
   8458		    continue
   8459		  fi
   8460		fi
   8461		;;
   8462	      *) ;;
   8463	      esac
   8464	    fi
   8465	  else
   8466	    # deplib doesn't seem to be a libtool library
   8467	    if test prog,link = "$linkmode,$pass"; then
   8468	      compile_deplibs="$deplib $compile_deplibs"
   8469	      finalize_deplibs="$deplib $finalize_deplibs"
   8470	    else
   8471	      deplibs="$deplib $deplibs"
   8472	      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
   8473	    fi
   8474	    continue
   8475	  fi
   8476	  ;; # -l
   8477	*.ltframework)
   8478	  if test prog,link = "$linkmode,$pass"; then
   8479	    compile_deplibs="$deplib $compile_deplibs"
   8480	    finalize_deplibs="$deplib $finalize_deplibs"
   8481	  else
   8482	    deplibs="$deplib $deplibs"
   8483	    if test lib = "$linkmode"; then
   8484		case "$new_inherited_linker_flags " in
   8485		    *" $deplib "*) ;;
   8486		    * ) func_append new_inherited_linker_flags " $deplib" ;;
   8487		esac
   8488	    fi
   8489	  fi
   8490	  continue
   8491	  ;;
   8492	-L*)
   8493	  case $linkmode in
   8494	  lib)
   8495	    deplibs="$deplib $deplibs"
   8496	    test conv = "$pass" && continue
   8497	    newdependency_libs="$deplib $newdependency_libs"
   8498	    func_stripname '-L' '' "$deplib"
   8499	    func_resolve_sysroot "$func_stripname_result"
   8500	    func_append newlib_search_path " $func_resolve_sysroot_result"
   8501	    ;;
   8502	  prog)
   8503	    if test conv = "$pass"; then
   8504	      deplibs="$deplib $deplibs"
   8505	      continue
   8506	    fi
   8507	    if test scan = "$pass"; then
   8508	      deplibs="$deplib $deplibs"
   8509	    else
   8510	      compile_deplibs="$deplib $compile_deplibs"
   8511	      finalize_deplibs="$deplib $finalize_deplibs"
   8512	    fi
   8513	    func_stripname '-L' '' "$deplib"
   8514	    func_resolve_sysroot "$func_stripname_result"
   8515	    func_append newlib_search_path " $func_resolve_sysroot_result"
   8516	    ;;
   8517	  *)
   8518	    func_warning "'-L' is ignored for archives/objects"
   8519	    ;;
   8520	  esac # linkmode
   8521	  continue
   8522	  ;; # -L
   8523	-R*)
   8524	  if test link = "$pass"; then
   8525	    func_stripname '-R' '' "$deplib"
   8526	    func_resolve_sysroot "$func_stripname_result"
   8527	    dir=$func_resolve_sysroot_result
   8528	    # Make sure the xrpath contains only unique directories.
   8529	    case "$xrpath " in
   8530	    *" $dir "*) ;;
   8531	    *) func_append xrpath " $dir" ;;
   8532	    esac
   8533	  fi
   8534	  deplibs="$deplib $deplibs"
   8535	  continue
   8536	  ;;
   8537	*.la)
   8538	  func_resolve_sysroot "$deplib"
   8539	  lib=$func_resolve_sysroot_result
   8540	  ;;
   8541	*.$libext)
   8542	  if test conv = "$pass"; then
   8543	    deplibs="$deplib $deplibs"
   8544	    continue
   8545	  fi
   8546	  case $linkmode in
   8547	  lib)
   8548	    # Linking convenience modules into shared libraries is allowed,
   8549	    # but linking other static libraries is non-portable.
   8550	    case " $dlpreconveniencelibs " in
   8551	    *" $deplib "*) ;;
   8552	    *)
   8553	      valid_a_lib=false
   8554	      case $deplibs_check_method in
   8555		match_pattern*)
   8556		  set dummy $deplibs_check_method; shift
   8557		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
   8558		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
   8559		    | $EGREP "$match_pattern_regex" > /dev/null; then
   8560		    valid_a_lib=:
   8561		  fi
   8562		;;
   8563		pass_all)
   8564		  valid_a_lib=:
   8565		;;
   8566	      esac
   8567	      if $valid_a_lib; then
   8568		echo
   8569		$ECHO "*** Warning: Linking the shared library $output against the"
   8570		$ECHO "*** static library $deplib is not portable!"
   8571		deplibs="$deplib $deplibs"
   8572	      else
   8573		echo
   8574		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
   8575		echo "*** I have the capability to make that library automatically link in when"
   8576		echo "*** you link to this library.  But I can only do this if you have a"
   8577		echo "*** shared version of the library, which you do not appear to have"
   8578		echo "*** because the file extensions .$libext of this argument makes me believe"
   8579		echo "*** that it is just a static archive that I should not use here."
   8580	      fi
   8581	      ;;
   8582	    esac
   8583	    continue
   8584	    ;;
   8585	  prog)
   8586	    if test link != "$pass"; then
   8587	      deplibs="$deplib $deplibs"
   8588	    else
   8589	      compile_deplibs="$deplib $compile_deplibs"
   8590	      finalize_deplibs="$deplib $finalize_deplibs"
   8591	    fi
   8592	    continue
   8593	    ;;
   8594	  esac # linkmode
   8595	  ;; # *.$libext
   8596	*.lo | *.$objext)
   8597	  if test conv = "$pass"; then
   8598	    deplibs="$deplib $deplibs"
   8599	  elif test prog = "$linkmode"; then
   8600	    if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
   8601	      # If there is no dlopen support or we're linking statically,
   8602	      # we need to preload.
   8603	      func_append newdlprefiles " $deplib"
   8604	      compile_deplibs="$deplib $compile_deplibs"
   8605	      finalize_deplibs="$deplib $finalize_deplibs"
   8606	    else
   8607	      func_append newdlfiles " $deplib"
   8608	    fi
   8609	  fi
   8610	  continue
   8611	  ;;
   8612	%DEPLIBS%)
   8613	  alldeplibs=:
   8614	  continue
   8615	  ;;
   8616	esac # case $deplib
   8617
   8618	$found || test -f "$lib" \
   8619	  || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
   8620
   8621	# Check to see that this really is a libtool archive.
   8622	func_lalib_unsafe_p "$lib" \
   8623	  || func_fatal_error "'$lib' is not a valid libtool archive"
   8624
   8625	func_dirname "$lib" "" "."
   8626	ladir=$func_dirname_result
   8627
   8628	dlname=
   8629	dlopen=
   8630	dlpreopen=
   8631	libdir=
   8632	library_names=
   8633	old_library=
   8634	inherited_linker_flags=
   8635	# If the library was installed with an old release of libtool,
   8636	# it will not redefine variables installed, or shouldnotlink
   8637	installed=yes
   8638	shouldnotlink=no
   8639	avoidtemprpath=
   8640
   8641
   8642	# Read the .la file
   8643	func_source "$lib"
   8644
   8645	# Convert "-framework foo" to "foo.ltframework"
   8646	if test -n "$inherited_linker_flags"; then
   8647	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
   8648	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
   8649	    case " $new_inherited_linker_flags " in
   8650	      *" $tmp_inherited_linker_flag "*) ;;
   8651	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
   8652	    esac
   8653	  done
   8654	fi
   8655	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
   8656	if test lib,link = "$linkmode,$pass" ||
   8657	   test prog,scan = "$linkmode,$pass" ||
   8658	   { test prog != "$linkmode" && test lib != "$linkmode"; }; then
   8659	  test -n "$dlopen" && func_append dlfiles " $dlopen"
   8660	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
   8661	fi
   8662
   8663	if test conv = "$pass"; then
   8664	  # Only check for convenience libraries
   8665	  deplibs="$lib $deplibs"
   8666	  if test -z "$libdir"; then
   8667	    if test -z "$old_library"; then
   8668	      func_fatal_error "cannot find name of link library for '$lib'"
   8669	    fi
   8670	    # It is a libtool convenience library, so add in its objects.
   8671	    func_append convenience " $ladir/$objdir/$old_library"
   8672	    func_append old_convenience " $ladir/$objdir/$old_library"
   8673	  elif test prog != "$linkmode" && test lib != "$linkmode"; then
   8674	    func_fatal_error "'$lib' is not a convenience library"
   8675	  fi
   8676	  tmp_libs=
   8677	  for deplib in $dependency_libs; do
   8678	    deplibs="$deplib $deplibs"
   8679	    if $opt_preserve_dup_deps; then
   8680	      case "$tmp_libs " in
   8681	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
   8682	      esac
   8683	    fi
   8684	    func_append tmp_libs " $deplib"
   8685	  done
   8686	  continue
   8687	fi # $pass = conv
   8688
   8689
   8690	# Get the name of the library we link against.
   8691	linklib=
   8692	if test -n "$old_library" &&
   8693	   { test yes = "$prefer_static_libs" ||
   8694	     test built,no = "$prefer_static_libs,$installed"; }; then
   8695	  linklib=$old_library
   8696	else
   8697	  for l in $old_library $library_names; do
   8698	    linklib=$l
   8699	  done
   8700	fi
   8701	if test -z "$linklib"; then
   8702	  func_fatal_error "cannot find name of link library for '$lib'"
   8703	fi
   8704
   8705	# This library was specified with -dlopen.
   8706	if test dlopen = "$pass"; then
   8707	  test -z "$libdir" \
   8708	    && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
   8709	  if test -z "$dlname" ||
   8710	     test yes != "$dlopen_support" ||
   8711	     test no = "$build_libtool_libs"
   8712	  then
   8713	    # If there is no dlname, no dlopen support or we're linking
   8714	    # statically, we need to preload.  We also need to preload any
   8715	    # dependent libraries so libltdl's deplib preloader doesn't
   8716	    # bomb out in the load deplibs phase.
   8717	    func_append dlprefiles " $lib $dependency_libs"
   8718	  else
   8719	    func_append newdlfiles " $lib"
   8720	  fi
   8721	  continue
   8722	fi # $pass = dlopen
   8723
   8724	# We need an absolute path.
   8725	case $ladir in
   8726	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
   8727	*)
   8728	  abs_ladir=`cd "$ladir" && pwd`
   8729	  if test -z "$abs_ladir"; then
   8730	    func_warning "cannot determine absolute directory name of '$ladir'"
   8731	    func_warning "passing it literally to the linker, although it might fail"
   8732	    abs_ladir=$ladir
   8733	  fi
   8734	  ;;
   8735	esac
   8736	func_basename "$lib"
   8737	laname=$func_basename_result
   8738
   8739	# Find the relevant object directory and library name.
   8740	if test yes = "$installed"; then
   8741	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
   8742	    func_warning "library '$lib' was moved."
   8743	    dir=$ladir
   8744	    absdir=$abs_ladir
   8745	    libdir=$abs_ladir
   8746	  else
   8747	    dir=$lt_sysroot$libdir
   8748	    absdir=$lt_sysroot$libdir
   8749	  fi
   8750	  test yes = "$hardcode_automatic" && avoidtemprpath=yes
   8751	else
   8752	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
   8753	    dir=$ladir
   8754	    absdir=$abs_ladir
   8755	    # Remove this search path later
   8756	    func_append notinst_path " $abs_ladir"
   8757	  else
   8758	    dir=$ladir/$objdir
   8759	    absdir=$abs_ladir/$objdir
   8760	    # Remove this search path later
   8761	    func_append notinst_path " $abs_ladir"
   8762	  fi
   8763	fi # $installed = yes
   8764	func_stripname 'lib' '.la' "$laname"
   8765	name=$func_stripname_result
   8766
   8767	# This library was specified with -dlpreopen.
   8768	if test dlpreopen = "$pass"; then
   8769	  if test -z "$libdir" && test prog = "$linkmode"; then
   8770	    func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
   8771	  fi
   8772	  case $host in
   8773	    # special handling for platforms with PE-DLLs.
   8774	    *cygwin* | *mingw* | *cegcc* )
   8775	      # Linker will automatically link against shared library if both
   8776	      # static and shared are present.  Therefore, ensure we extract
   8777	      # symbols from the import library if a shared library is present
   8778	      # (otherwise, the dlopen module name will be incorrect).  We do
   8779	      # this by putting the import library name into $newdlprefiles.
   8780	      # We recover the dlopen module name by 'saving' the la file
   8781	      # name in a special purpose variable, and (later) extracting the
   8782	      # dlname from the la file.
   8783	      if test -n "$dlname"; then
   8784	        func_tr_sh "$dir/$linklib"
   8785	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
   8786	        func_append newdlprefiles " $dir/$linklib"
   8787	      else
   8788	        func_append newdlprefiles " $dir/$old_library"
   8789	        # Keep a list of preopened convenience libraries to check
   8790	        # that they are being used correctly in the link pass.
   8791	        test -z "$libdir" && \
   8792	          func_append dlpreconveniencelibs " $dir/$old_library"
   8793	      fi
   8794	    ;;
   8795	    * )
   8796	      # Prefer using a static library (so that no silly _DYNAMIC symbols
   8797	      # are required to link).
   8798	      if test -n "$old_library"; then
   8799	        func_append newdlprefiles " $dir/$old_library"
   8800	        # Keep a list of preopened convenience libraries to check
   8801	        # that they are being used correctly in the link pass.
   8802	        test -z "$libdir" && \
   8803	          func_append dlpreconveniencelibs " $dir/$old_library"
   8804	      # Otherwise, use the dlname, so that lt_dlopen finds it.
   8805	      elif test -n "$dlname"; then
   8806	        func_append newdlprefiles " $dir/$dlname"
   8807	      else
   8808	        func_append newdlprefiles " $dir/$linklib"
   8809	      fi
   8810	    ;;
   8811	  esac
   8812	fi # $pass = dlpreopen
   8813
   8814	if test -z "$libdir"; then
   8815	  # Link the convenience library
   8816	  if test lib = "$linkmode"; then
   8817	    deplibs="$dir/$old_library $deplibs"
   8818	  elif test prog,link = "$linkmode,$pass"; then
   8819	    compile_deplibs="$dir/$old_library $compile_deplibs"
   8820	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
   8821	  else
   8822	    deplibs="$lib $deplibs" # used for prog,scan pass
   8823	  fi
   8824	  continue
   8825	fi
   8826
   8827
   8828	if test prog = "$linkmode" && test link != "$pass"; then
   8829	  func_append newlib_search_path " $ladir"
   8830	  deplibs="$lib $deplibs"
   8831
   8832	  linkalldeplibs=false
   8833	  if test no != "$link_all_deplibs" || test -z "$library_names" ||
   8834	     test no = "$build_libtool_libs"; then
   8835	    linkalldeplibs=:
   8836	  fi
   8837
   8838	  tmp_libs=
   8839	  for deplib in $dependency_libs; do
   8840	    case $deplib in
   8841	    -L*) func_stripname '-L' '' "$deplib"
   8842	         func_resolve_sysroot "$func_stripname_result"
   8843	         func_append newlib_search_path " $func_resolve_sysroot_result"
   8844		 ;;
   8845	    esac
   8846	    # Need to link against all dependency_libs?
   8847	    if $linkalldeplibs; then
   8848	      deplibs="$deplib $deplibs"
   8849	    else
   8850	      # Need to hardcode shared library paths
   8851	      # or/and link against static libraries
   8852	      newdependency_libs="$deplib $newdependency_libs"
   8853	    fi
   8854	    if $opt_preserve_dup_deps; then
   8855	      case "$tmp_libs " in
   8856	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
   8857	      esac
   8858	    fi
   8859	    func_append tmp_libs " $deplib"
   8860	  done # for deplib
   8861	  continue
   8862	fi # $linkmode = prog...
   8863
   8864	if test prog,link = "$linkmode,$pass"; then
   8865	  if test -n "$library_names" &&
   8866	     { { test no = "$prefer_static_libs" ||
   8867	         test built,yes = "$prefer_static_libs,$installed"; } ||
   8868	       test -z "$old_library"; }; then
   8869	    # We need to hardcode the library path
   8870	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
   8871	      # Make sure the rpath contains only unique directories.
   8872	      case $temp_rpath: in
   8873	      *"$absdir:"*) ;;
   8874	      *) func_append temp_rpath "$absdir:" ;;
   8875	      esac
   8876	    fi
   8877
   8878	    # Hardcode the library path.
   8879	    # Skip directories that are in the system default run-time
   8880	    # search path.
   8881	    case " $sys_lib_dlsearch_path " in
   8882	    *" $absdir "*) ;;
   8883	    *)
   8884	      case "$compile_rpath " in
   8885	      *" $absdir "*) ;;
   8886	      *) func_append compile_rpath " $absdir" ;;
   8887	      esac
   8888	      ;;
   8889	    esac
   8890	    case " $sys_lib_dlsearch_path " in
   8891	    *" $libdir "*) ;;
   8892	    *)
   8893	      case "$finalize_rpath " in
   8894	      *" $libdir "*) ;;
   8895	      *) func_append finalize_rpath " $libdir" ;;
   8896	      esac
   8897	      ;;
   8898	    esac
   8899	  fi # $linkmode,$pass = prog,link...
   8900
   8901	  if $alldeplibs &&
   8902	     { test pass_all = "$deplibs_check_method" ||
   8903	       { test yes = "$build_libtool_libs" &&
   8904		 test -n "$library_names"; }; }; then
   8905	    # We only need to search for static libraries
   8906	    continue
   8907	  fi
   8908	fi
   8909
   8910	link_static=no # Whether the deplib will be linked statically
   8911	use_static_libs=$prefer_static_libs
   8912	if test built = "$use_static_libs" && test yes = "$installed"; then
   8913	  use_static_libs=no
   8914	fi
   8915	if test -n "$library_names" &&
   8916	   { test no = "$use_static_libs" || test -z "$old_library"; }; then
   8917	  case $host in
   8918	  *cygwin* | *mingw* | *cegcc* | *os2*)
   8919	      # No point in relinking DLLs because paths are not encoded
   8920	      func_append notinst_deplibs " $lib"
   8921	      need_relink=no
   8922	    ;;
   8923	  *)
   8924	    if test no = "$installed"; then
   8925	      func_append notinst_deplibs " $lib"
   8926	      need_relink=yes
   8927	    fi
   8928	    ;;
   8929	  esac
   8930	  # This is a shared library
   8931
   8932	  # Warn about portability, can't link against -module's on some
   8933	  # systems (darwin).  Don't bleat about dlopened modules though!
   8934	  dlopenmodule=
   8935	  for dlpremoduletest in $dlprefiles; do
   8936	    if test "X$dlpremoduletest" = "X$lib"; then
   8937	      dlopenmodule=$dlpremoduletest
   8938	      break
   8939	    fi
   8940	  done
   8941	  if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
   8942	    echo
   8943	    if test prog = "$linkmode"; then
   8944	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
   8945	    else
   8946	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
   8947	    fi
   8948	    $ECHO "*** $linklib is not portable!"
   8949	  fi
   8950	  if test lib = "$linkmode" &&
   8951	     test yes = "$hardcode_into_libs"; then
   8952	    # Hardcode the library path.
   8953	    # Skip directories that are in the system default run-time
   8954	    # search path.
   8955	    case " $sys_lib_dlsearch_path " in
   8956	    *" $absdir "*) ;;
   8957	    *)
   8958	      case "$compile_rpath " in
   8959	      *" $absdir "*) ;;
   8960	      *) func_append compile_rpath " $absdir" ;;
   8961	      esac
   8962	      ;;
   8963	    esac
   8964	    case " $sys_lib_dlsearch_path " in
   8965	    *" $libdir "*) ;;
   8966	    *)
   8967	      case "$finalize_rpath " in
   8968	      *" $libdir "*) ;;
   8969	      *) func_append finalize_rpath " $libdir" ;;
   8970	      esac
   8971	      ;;
   8972	    esac
   8973	  fi
   8974
   8975	  if test -n "$old_archive_from_expsyms_cmds"; then
   8976	    # figure out the soname
   8977	    set dummy $library_names
   8978	    shift
   8979	    realname=$1
   8980	    shift
   8981	    libname=`eval "\\$ECHO \"$libname_spec\""`
   8982	    # use dlname if we got it. it's perfectly good, no?
   8983	    if test -n "$dlname"; then
   8984	      soname=$dlname
   8985	    elif test -n "$soname_spec"; then
   8986	      # bleh windows
   8987	      case $host in
   8988	      *cygwin* | mingw* | *cegcc* | *os2*)
   8989	        func_arith $current - $age
   8990		major=$func_arith_result
   8991		versuffix=-$major
   8992		;;
   8993	      esac
   8994	      eval soname=\"$soname_spec\"
   8995	    else
   8996	      soname=$realname
   8997	    fi
   8998
   8999	    # Make a new name for the extract_expsyms_cmds to use
   9000	    soroot=$soname
   9001	    func_basename "$soroot"
   9002	    soname=$func_basename_result
   9003	    func_stripname 'lib' '.dll' "$soname"
   9004	    newlib=libimp-$func_stripname_result.a
   9005
   9006	    # If the library has no export list, then create one now
   9007	    if test -f "$output_objdir/$soname-def"; then :
   9008	    else
   9009	      func_verbose "extracting exported symbol list from '$soname'"
   9010	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
   9011	    fi
   9012
   9013	    # Create $newlib
   9014	    if test -f "$output_objdir/$newlib"; then :; else
   9015	      func_verbose "generating import library for '$soname'"
   9016	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
   9017	    fi
   9018	    # make sure the library variables are pointing to the new library
   9019	    dir=$output_objdir
   9020	    linklib=$newlib
   9021	  fi # test -n "$old_archive_from_expsyms_cmds"
   9022
   9023	  if test prog = "$linkmode" || test relink != "$opt_mode"; then
   9024	    add_shlibpath=
   9025	    add_dir=
   9026	    add=
   9027	    lib_linked=yes
   9028	    case $hardcode_action in
   9029	    immediate | unsupported)
   9030	      if test no = "$hardcode_direct"; then
   9031		add=$dir/$linklib
   9032		case $host in
   9033		  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
   9034		  *-*-sysv4*uw2*) add_dir=-L$dir ;;
   9035		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
   9036		    *-*-unixware7*) add_dir=-L$dir ;;
   9037		  *-*-darwin* )
   9038		    # if the lib is a (non-dlopened) module then we cannot
   9039		    # link against it, someone is ignoring the earlier warnings
   9040		    if /usr/bin/file -L $add 2> /dev/null |
   9041			 $GREP ": [^:]* bundle" >/dev/null; then
   9042		      if test "X$dlopenmodule" != "X$lib"; then
   9043			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
   9044			if test -z "$old_library"; then
   9045			  echo
   9046			  echo "*** And there doesn't seem to be a static archive available"
   9047			  echo "*** The link will probably fail, sorry"
   9048			else
   9049			  add=$dir/$old_library
   9050			fi
   9051		      elif test -n "$old_library"; then
   9052			add=$dir/$old_library
   9053		      fi
   9054		    fi
   9055		esac
   9056	      elif test no = "$hardcode_minus_L"; then
   9057		case $host in
   9058		*-*-sunos*) add_shlibpath=$dir ;;
   9059		esac
   9060		add_dir=-L$dir
   9061		add=-l$name
   9062	      elif test no = "$hardcode_shlibpath_var"; then
   9063		add_shlibpath=$dir
   9064		add=-l$name
   9065	      else
   9066		lib_linked=no
   9067	      fi
   9068	      ;;
   9069	    relink)
   9070	      if test yes = "$hardcode_direct" &&
   9071	         test no = "$hardcode_direct_absolute"; then
   9072		add=$dir/$linklib
   9073	      elif test yes = "$hardcode_minus_L"; then
   9074		add_dir=-L$absdir
   9075		# Try looking first in the location we're being installed to.
   9076		if test -n "$inst_prefix_dir"; then
   9077		  case $libdir in
   9078		    [\\/]*)
   9079		      func_append add_dir " -L$inst_prefix_dir$libdir"
   9080		      ;;
   9081		  esac
   9082		fi
   9083		add=-l$name
   9084	      elif test yes = "$hardcode_shlibpath_var"; then
   9085		add_shlibpath=$dir
   9086		add=-l$name
   9087	      else
   9088		lib_linked=no
   9089	      fi
   9090	      ;;
   9091	    *) lib_linked=no ;;
   9092	    esac
   9093
   9094	    if test yes != "$lib_linked"; then
   9095	      func_fatal_configuration "unsupported hardcode properties"
   9096	    fi
   9097
   9098	    if test -n "$add_shlibpath"; then
   9099	      case :$compile_shlibpath: in
   9100	      *":$add_shlibpath:"*) ;;
   9101	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
   9102	      esac
   9103	    fi
   9104	    if test prog = "$linkmode"; then
   9105	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
   9106	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
   9107	    else
   9108	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
   9109	      test -n "$add" && deplibs="$add $deplibs"
   9110	      if test yes != "$hardcode_direct" &&
   9111		 test yes != "$hardcode_minus_L" &&
   9112		 test yes = "$hardcode_shlibpath_var"; then
   9113		case :$finalize_shlibpath: in
   9114		*":$libdir:"*) ;;
   9115		*) func_append finalize_shlibpath "$libdir:" ;;
   9116		esac
   9117	      fi
   9118	    fi
   9119	  fi
   9120
   9121	  if test prog = "$linkmode" || test relink = "$opt_mode"; then
   9122	    add_shlibpath=
   9123	    add_dir=
   9124	    add=
   9125	    # Finalize command for both is simple: just hardcode it.
   9126	    if test yes = "$hardcode_direct" &&
   9127	       test no = "$hardcode_direct_absolute"; then
   9128	      add=$libdir/$linklib
   9129	    elif test yes = "$hardcode_minus_L"; then
   9130	      add_dir=-L$libdir
   9131	      add=-l$name
   9132	    elif test yes = "$hardcode_shlibpath_var"; then
   9133	      case :$finalize_shlibpath: in
   9134	      *":$libdir:"*) ;;
   9135	      *) func_append finalize_shlibpath "$libdir:" ;;
   9136	      esac
   9137	      add=-l$name
   9138	    elif test yes = "$hardcode_automatic"; then
   9139	      if test -n "$inst_prefix_dir" &&
   9140		 test -f "$inst_prefix_dir$libdir/$linklib"; then
   9141		add=$inst_prefix_dir$libdir/$linklib
   9142	      else
   9143		add=$libdir/$linklib
   9144	      fi
   9145	    else
   9146	      # We cannot seem to hardcode it, guess we'll fake it.
   9147	      add_dir=-L$libdir
   9148	      # Try looking first in the location we're being installed to.
   9149	      if test -n "$inst_prefix_dir"; then
   9150		case $libdir in
   9151		  [\\/]*)
   9152		    func_append add_dir " -L$inst_prefix_dir$libdir"
   9153		    ;;
   9154		esac
   9155	      fi
   9156	      add=-l$name
   9157	    fi
   9158
   9159	    if test prog = "$linkmode"; then
   9160	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
   9161	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
   9162	    else
   9163	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
   9164	      test -n "$add" && deplibs="$add $deplibs"
   9165	    fi
   9166	  fi
   9167	elif test prog = "$linkmode"; then
   9168	  # Here we assume that one of hardcode_direct or hardcode_minus_L
   9169	  # is not unsupported.  This is valid on all known static and
   9170	  # shared platforms.
   9171	  if test unsupported != "$hardcode_direct"; then
   9172	    test -n "$old_library" && linklib=$old_library
   9173	    compile_deplibs="$dir/$linklib $compile_deplibs"
   9174	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
   9175	  else
   9176	    compile_deplibs="-l$name -L$dir $compile_deplibs"
   9177	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
   9178	  fi
   9179	elif test yes = "$build_libtool_libs"; then
   9180	  # Not a shared library
   9181	  if test pass_all != "$deplibs_check_method"; then
   9182	    # We're trying link a shared library against a static one
   9183	    # but the system doesn't support it.
   9184
   9185	    # Just print a warning and add the library to dependency_libs so
   9186	    # that the program can be linked against the static library.
   9187	    echo
   9188	    $ECHO "*** Warning: This system cannot link to static lib archive $lib."
   9189	    echo "*** I have the capability to make that library automatically link in when"
   9190	    echo "*** you link to this library.  But I can only do this if you have a"
   9191	    echo "*** shared version of the library, which you do not appear to have."
   9192	    if test yes = "$module"; then
   9193	      echo "*** But as you try to build a module library, libtool will still create "
   9194	      echo "*** a static module, that should work as long as the dlopening application"
   9195	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
   9196	      if test -z "$global_symbol_pipe"; then
   9197		echo
   9198		echo "*** However, this would only work if libtool was able to extract symbol"
   9199		echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
   9200		echo "*** not find such a program.  So, this module is probably useless."
   9201		echo "*** 'nm' from GNU binutils and a full rebuild may help."
   9202	      fi
   9203	      if test no = "$build_old_libs"; then
   9204		build_libtool_libs=module
   9205		build_old_libs=yes
   9206	      else
   9207		build_libtool_libs=no
   9208	      fi
   9209	    fi
   9210	  else
   9211	    deplibs="$dir/$old_library $deplibs"
   9212	    link_static=yes
   9213	  fi
   9214	fi # link shared/static library?
   9215
   9216	if test lib = "$linkmode"; then
   9217	  if test -n "$dependency_libs" &&
   9218	     { test yes != "$hardcode_into_libs" ||
   9219	       test yes = "$build_old_libs" ||
   9220	       test yes = "$link_static"; }; then
   9221	    # Extract -R from dependency_libs
   9222	    temp_deplibs=
   9223	    for libdir in $dependency_libs; do
   9224	      case $libdir in
   9225	      -R*) func_stripname '-R' '' "$libdir"
   9226	           temp_xrpath=$func_stripname_result
   9227		   case " $xrpath " in
   9228		   *" $temp_xrpath "*) ;;
   9229		   *) func_append xrpath " $temp_xrpath";;
   9230		   esac;;
   9231	      *) func_append temp_deplibs " $libdir";;
   9232	      esac
   9233	    done
   9234	    dependency_libs=$temp_deplibs
   9235	  fi
   9236
   9237	  func_append newlib_search_path " $absdir"
   9238	  # Link against this library
   9239	  test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
   9240	  # ... and its dependency_libs
   9241	  tmp_libs=
   9242	  for deplib in $dependency_libs; do
   9243	    newdependency_libs="$deplib $newdependency_libs"
   9244	    case $deplib in
   9245              -L*) func_stripname '-L' '' "$deplib"
   9246                   func_resolve_sysroot "$func_stripname_result";;
   9247              *) func_resolve_sysroot "$deplib" ;;
   9248            esac
   9249	    if $opt_preserve_dup_deps; then
   9250	      case "$tmp_libs " in
   9251	      *" $func_resolve_sysroot_result "*)
   9252                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
   9253	      esac
   9254	    fi
   9255	    func_append tmp_libs " $func_resolve_sysroot_result"
   9256	  done
   9257
   9258	  if test no != "$link_all_deplibs"; then
   9259	    # Add the search paths of all dependency libraries
   9260	    for deplib in $dependency_libs; do
   9261	      path=
   9262	      case $deplib in
   9263	      -L*) path=$deplib ;;
   9264	      *.la)
   9265	        func_resolve_sysroot "$deplib"
   9266	        deplib=$func_resolve_sysroot_result
   9267	        func_dirname "$deplib" "" "."
   9268		dir=$func_dirname_result
   9269		# We need an absolute path.
   9270		case $dir in
   9271		[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
   9272		*)
   9273		  absdir=`cd "$dir" && pwd`
   9274		  if test -z "$absdir"; then
   9275		    func_warning "cannot determine absolute directory name of '$dir'"
   9276		    absdir=$dir
   9277		  fi
   9278		  ;;
   9279		esac
   9280		if $GREP "^installed=no" $deplib > /dev/null; then
   9281		case $host in
   9282		*-*-darwin*)
   9283		  depdepl=
   9284		  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
   9285		  if test -n "$deplibrary_names"; then
   9286		    for tmp in $deplibrary_names; do
   9287		      depdepl=$tmp
   9288		    done
   9289		    if test -f "$absdir/$objdir/$depdepl"; then
   9290		      depdepl=$absdir/$objdir/$depdepl
   9291		      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
   9292                      if test -z "$darwin_install_name"; then
   9293                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
   9294                      fi
   9295		      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
   9296		      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
   9297		      path=
   9298		    fi
   9299		  fi
   9300		  ;;
   9301		*)
   9302		  path=-L$absdir/$objdir
   9303		  ;;
   9304		esac
   9305		else
   9306		  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
   9307		  test -z "$libdir" && \
   9308		    func_fatal_error "'$deplib' is not a valid libtool archive"
   9309		  test "$absdir" != "$libdir" && \
   9310		    func_warning "'$deplib' seems to be moved"
   9311
   9312		  path=-L$absdir
   9313		fi
   9314		;;
   9315	      esac
   9316	      case " $deplibs " in
   9317	      *" $path "*) ;;
   9318	      *) deplibs="$path $deplibs" ;;
   9319	      esac
   9320	    done
   9321	  fi # link_all_deplibs != no
   9322	fi # linkmode = lib
   9323      done # for deplib in $libs
   9324      if test link = "$pass"; then
   9325	if test prog = "$linkmode"; then
   9326	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
   9327	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
   9328	else
   9329	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
   9330	fi
   9331      fi
   9332      dependency_libs=$newdependency_libs
   9333      if test dlpreopen = "$pass"; then
   9334	# Link the dlpreopened libraries before other libraries
   9335	for deplib in $save_deplibs; do
   9336	  deplibs="$deplib $deplibs"
   9337	done
   9338      fi
   9339      if test dlopen != "$pass"; then
   9340	test conv = "$pass" || {
   9341	  # Make sure lib_search_path contains only unique directories.
   9342	  lib_search_path=
   9343	  for dir in $newlib_search_path; do
   9344	    case "$lib_search_path " in
   9345	    *" $dir "*) ;;
   9346	    *) func_append lib_search_path " $dir" ;;
   9347	    esac
   9348	  done
   9349	  newlib_search_path=
   9350	}
   9351
   9352	if test prog,link = "$linkmode,$pass"; then
   9353	  vars="compile_deplibs finalize_deplibs"
   9354	else
   9355	  vars=deplibs
   9356	fi
   9357	for var in $vars dependency_libs; do
   9358	  # Add libraries to $var in reverse order
   9359	  eval tmp_libs=\"\$$var\"
   9360	  new_libs=
   9361	  for deplib in $tmp_libs; do
   9362	    # FIXME: Pedantically, this is the right thing to do, so
   9363	    #        that some nasty dependency loop isn't accidentally
   9364	    #        broken:
   9365	    #new_libs="$deplib $new_libs"
   9366	    # Pragmatically, this seems to cause very few problems in
   9367	    # practice:
   9368	    case $deplib in
   9369	    -L*) new_libs="$deplib $new_libs" ;;
   9370	    -R*) ;;
   9371	    *)
   9372	      # And here is the reason: when a library appears more
   9373	      # than once as an explicit dependence of a library, or
   9374	      # is implicitly linked in more than once by the
   9375	      # compiler, it is considered special, and multiple
   9376	      # occurrences thereof are not removed.  Compare this
   9377	      # with having the same library being listed as a
   9378	      # dependency of multiple other libraries: in this case,
   9379	      # we know (pedantically, we assume) the library does not
   9380	      # need to be listed more than once, so we keep only the
   9381	      # last copy.  This is not always right, but it is rare
   9382	      # enough that we require users that really mean to play
   9383	      # such unportable linking tricks to link the library
   9384	      # using -Wl,-lname, so that libtool does not consider it
   9385	      # for duplicate removal.
   9386	      case " $specialdeplibs " in
   9387	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
   9388	      *)
   9389		case " $new_libs " in
   9390		*" $deplib "*) ;;
   9391		*) new_libs="$deplib $new_libs" ;;
   9392		esac
   9393		;;
   9394	      esac
   9395	      ;;
   9396	    esac
   9397	  done
   9398	  tmp_libs=
   9399	  for deplib in $new_libs; do
   9400	    case $deplib in
   9401	    -L*)
   9402	      case " $tmp_libs " in
   9403	      *" $deplib "*) ;;
   9404	      *) func_append tmp_libs " $deplib" ;;
   9405	      esac
   9406	      ;;
   9407	    *) func_append tmp_libs " $deplib" ;;
   9408	    esac
   9409	  done
   9410	  eval $var=\"$tmp_libs\"
   9411	done # for var
   9412      fi
   9413
   9414      # Add Sun CC postdeps if required:
   9415      test CXX = "$tagname" && {
   9416        case $host_os in
   9417        linux*)
   9418          case `$CC -V 2>&1 | $SED 5q` in
   9419          *Sun\ C*) # Sun C++ 5.9
   9420            func_suncc_cstd_abi
   9421
   9422            if test no != "$suncc_use_cstd_abi"; then
   9423              func_append postdeps ' -library=Cstd -library=Crun'
   9424            fi
   9425            ;;
   9426          esac
   9427          ;;
   9428
   9429        solaris*)
   9430          func_cc_basename "$CC"
   9431          case $func_cc_basename_result in
   9432          CC* | sunCC*)
   9433            func_suncc_cstd_abi
   9434
   9435            if test no != "$suncc_use_cstd_abi"; then
   9436              func_append postdeps ' -library=Cstd -library=Crun'
   9437            fi
   9438            ;;
   9439          esac
   9440          ;;
   9441        esac
   9442      }
   9443
   9444      # Last step: remove runtime libs from dependency_libs
   9445      # (they stay in deplibs)
   9446      tmp_libs=
   9447      for i in $dependency_libs; do
   9448	case " $predeps $postdeps $compiler_lib_search_path " in
   9449	*" $i "*)
   9450	  i=
   9451	  ;;
   9452	esac
   9453	if test -n "$i"; then
   9454	  func_append tmp_libs " $i"
   9455	fi
   9456      done
   9457      dependency_libs=$tmp_libs
   9458    done # for pass
   9459    if test prog = "$linkmode"; then
   9460      dlfiles=$newdlfiles
   9461    fi
   9462    if test prog = "$linkmode" || test lib = "$linkmode"; then
   9463      dlprefiles=$newdlprefiles
   9464    fi
   9465
   9466    case $linkmode in
   9467    oldlib)
   9468      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
   9469	func_warning "'-dlopen' is ignored for archives"
   9470      fi
   9471
   9472      case " $deplibs" in
   9473      *\ -l* | *\ -L*)
   9474	func_warning "'-l' and '-L' are ignored for archives" ;;
   9475      esac
   9476
   9477      test -n "$rpath" && \
   9478	func_warning "'-rpath' is ignored for archives"
   9479
   9480      test -n "$xrpath" && \
   9481	func_warning "'-R' is ignored for archives"
   9482
   9483      test -n "$vinfo" && \
   9484	func_warning "'-version-info/-version-number' is ignored for archives"
   9485
   9486      test -n "$release" && \
   9487	func_warning "'-release' is ignored for archives"
   9488
   9489      test -n "$export_symbols$export_symbols_regex" && \
   9490	func_warning "'-export-symbols' is ignored for archives"
   9491
   9492      # Now set the variables for building old libraries.
   9493      build_libtool_libs=no
   9494      oldlibs=$output
   9495      func_append objs "$old_deplibs"
   9496      ;;
   9497
   9498    lib)
   9499      # Make sure we only generate libraries of the form 'libNAME.la'.
   9500      case $outputname in
   9501      lib*)
   9502	func_stripname 'lib' '.la' "$outputname"
   9503	name=$func_stripname_result
   9504	eval shared_ext=\"$shrext_cmds\"
   9505	eval libname=\"$libname_spec\"
   9506	;;
   9507      *)
   9508	test no = "$module" \
   9509	  && func_fatal_help "libtool library '$output' must begin with 'lib'"
   9510
   9511	if test no != "$need_lib_prefix"; then
   9512	  # Add the "lib" prefix for modules if required
   9513	  func_stripname '' '.la' "$outputname"
   9514	  name=$func_stripname_result
   9515	  eval shared_ext=\"$shrext_cmds\"
   9516	  eval libname=\"$libname_spec\"
   9517	else
   9518	  func_stripname '' '.la' "$outputname"
   9519	  libname=$func_stripname_result
   9520	fi
   9521	;;
   9522      esac
   9523
   9524      if test -n "$objs"; then
   9525	if test pass_all != "$deplibs_check_method"; then
   9526	  func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
   9527	else
   9528	  echo
   9529	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
   9530	  $ECHO "*** objects $objs is not portable!"
   9531	  func_append libobjs " $objs"
   9532	fi
   9533      fi
   9534
   9535      test no = "$dlself" \
   9536	|| func_warning "'-dlopen self' is ignored for libtool libraries"
   9537
   9538      set dummy $rpath
   9539      shift
   9540      test 1 -lt "$#" \
   9541	&& func_warning "ignoring multiple '-rpath's for a libtool library"
   9542
   9543      install_libdir=$1
   9544
   9545      oldlibs=
   9546      if test -z "$rpath"; then
   9547	if test yes = "$build_libtool_libs"; then
   9548	  # Building a libtool convenience library.
   9549	  # Some compilers have problems with a '.al' extension so
   9550	  # convenience libraries should have the same extension an
   9551	  # archive normally would.
   9552	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
   9553	  build_libtool_libs=convenience
   9554	  build_old_libs=yes
   9555	fi
   9556
   9557	test -n "$vinfo" && \
   9558	  func_warning "'-version-info/-version-number' is ignored for convenience libraries"
   9559
   9560	test -n "$release" && \
   9561	  func_warning "'-release' is ignored for convenience libraries"
   9562      else
   9563
   9564	# Parse the version information argument.
   9565	save_ifs=$IFS; IFS=:
   9566	set dummy $vinfo 0 0 0
   9567	shift
   9568	IFS=$save_ifs
   9569
   9570	test -n "$7" && \
   9571	  func_fatal_help "too many parameters to '-version-info'"
   9572
   9573	# convert absolute version numbers to libtool ages
   9574	# this retains compatibility with .la files and attempts
   9575	# to make the code below a bit more comprehensible
   9576
   9577	case $vinfo_number in
   9578	yes)
   9579	  number_major=$1
   9580	  number_minor=$2
   9581	  number_revision=$3
   9582	  #
   9583	  # There are really only two kinds -- those that
   9584	  # use the current revision as the major version
   9585	  # and those that subtract age and use age as
   9586	  # a minor version.  But, then there is irix
   9587	  # that has an extra 1 added just for fun
   9588	  #
   9589	  case $version_type in
   9590	  # correct linux to gnu/linux during the next big refactor
   9591	  darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none)
   9592	    func_arith $number_major + $number_minor
   9593	    current=$func_arith_result
   9594	    age=$number_minor
   9595	    revision=$number_revision
   9596	    ;;
   9597	  freebsd-aout|qnx|sunos)
   9598	    current=$number_major
   9599	    revision=$number_minor
   9600	    age=0
   9601	    ;;
   9602	  irix|nonstopux)
   9603	    func_arith $number_major + $number_minor
   9604	    current=$func_arith_result
   9605	    age=$number_minor
   9606	    revision=$number_minor
   9607	    lt_irix_increment=no
   9608	    ;;
   9609	  esac
   9610	  ;;
   9611	no)
   9612	  current=$1
   9613	  revision=$2
   9614	  age=$3
   9615	  ;;
   9616	esac
   9617
   9618	# Check that each of the things are valid numbers.
   9619	case $current in
   9620	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   9621	*)
   9622	  func_error "CURRENT '$current' must be a nonnegative integer"
   9623	  func_fatal_error "'$vinfo' is not valid version information"
   9624	  ;;
   9625	esac
   9626
   9627	case $revision in
   9628	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   9629	*)
   9630	  func_error "REVISION '$revision' must be a nonnegative integer"
   9631	  func_fatal_error "'$vinfo' is not valid version information"
   9632	  ;;
   9633	esac
   9634
   9635	case $age in
   9636	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   9637	*)
   9638	  func_error "AGE '$age' must be a nonnegative integer"
   9639	  func_fatal_error "'$vinfo' is not valid version information"
   9640	  ;;
   9641	esac
   9642
   9643	if test "$age" -gt "$current"; then
   9644	  func_error "AGE '$age' is greater than the current interface number '$current'"
   9645	  func_fatal_error "'$vinfo' is not valid version information"
   9646	fi
   9647
   9648	# Calculate the version variables.
   9649	major=
   9650	versuffix=
   9651	verstring=
   9652	case $version_type in
   9653	none) ;;
   9654
   9655	darwin)
   9656	  # Like Linux, but with the current version available in
   9657	  # verstring for coding it into the library header
   9658	  func_arith $current - $age
   9659	  major=.$func_arith_result
   9660	  versuffix=$major.$age.$revision
   9661	  # Darwin ld doesn't like 0 for these options...
   9662	  func_arith $current + 1
   9663	  minor_current=$func_arith_result
   9664	  xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
   9665	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
   9666          # On Darwin other compilers
   9667          case $CC in
   9668              nagfor*)
   9669                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
   9670                  ;;
   9671              *)
   9672                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
   9673                  ;;
   9674          esac
   9675	  ;;
   9676
   9677	freebsd-aout)
   9678	  major=.$current
   9679	  versuffix=.$current.$revision
   9680	  ;;
   9681
   9682	freebsd-elf | midnightbsd-elf)
   9683	  func_arith $current - $age
   9684	  major=.$func_arith_result
   9685	  versuffix=$major.$age.$revision
   9686	  ;;
   9687
   9688	irix | nonstopux)
   9689	  if test no = "$lt_irix_increment"; then
   9690	    func_arith $current - $age
   9691	  else
   9692	    func_arith $current - $age + 1
   9693	  fi
   9694	  major=$func_arith_result
   9695
   9696	  case $version_type in
   9697	    nonstopux) verstring_prefix=nonstopux ;;
   9698	    *)         verstring_prefix=sgi ;;
   9699	  esac
   9700	  verstring=$verstring_prefix$major.$revision
   9701
   9702	  # Add in all the interfaces that we are compatible with.
   9703	  loop=$revision
   9704	  while test 0 -ne "$loop"; do
   9705	    func_arith $revision - $loop
   9706	    iface=$func_arith_result
   9707	    func_arith $loop - 1
   9708	    loop=$func_arith_result
   9709	    verstring=$verstring_prefix$major.$iface:$verstring
   9710	  done
   9711
   9712	  # Before this point, $major must not contain '.'.
   9713	  major=.$major
   9714	  versuffix=$major.$revision
   9715	  ;;
   9716
   9717	linux) # correct to gnu/linux during the next big refactor
   9718	  func_arith $current - $age
   9719	  major=.$func_arith_result
   9720	  versuffix=$major.$age.$revision
   9721	  ;;
   9722
   9723	osf)
   9724	  func_arith $current - $age
   9725	  major=.$func_arith_result
   9726	  versuffix=.$current.$age.$revision
   9727	  verstring=$current.$age.$revision
   9728
   9729	  # Add in all the interfaces that we are compatible with.
   9730	  loop=$age
   9731	  while test 0 -ne "$loop"; do
   9732	    func_arith $current - $loop
   9733	    iface=$func_arith_result
   9734	    func_arith $loop - 1
   9735	    loop=$func_arith_result
   9736	    verstring=$verstring:$iface.0
   9737	  done
   9738
   9739	  # Make executables depend on our current version.
   9740	  func_append verstring ":$current.0"
   9741	  ;;
   9742
   9743	qnx)
   9744	  major=.$current
   9745	  versuffix=.$current
   9746	  ;;
   9747
   9748	sco)
   9749	  major=.$current
   9750	  versuffix=.$current
   9751	  ;;
   9752
   9753	sunos)
   9754	  major=.$current
   9755	  versuffix=.$current.$revision
   9756	  ;;
   9757
   9758	windows)
   9759	  # Use '-' rather than '.', since we only want one
   9760	  # extension on DOS 8.3 file systems.
   9761	  func_arith $current - $age
   9762	  major=$func_arith_result
   9763	  versuffix=-$major
   9764	  ;;
   9765
   9766	*)
   9767	  func_fatal_configuration "unknown library version type '$version_type'"
   9768	  ;;
   9769	esac
   9770
   9771	# Clear the version info if we defaulted, and they specified a release.
   9772	if test -z "$vinfo" && test -n "$release"; then
   9773	  major=
   9774	  case $version_type in
   9775	  darwin)
   9776	    # we can't check for "0.0" in archive_cmds due to quoting
   9777	    # problems, so we reset it completely
   9778	    verstring=
   9779	    ;;
   9780	  *)
   9781	    verstring=0.0
   9782	    ;;
   9783	  esac
   9784	  if test no = "$need_version"; then
   9785	    versuffix=
   9786	  else
   9787	    versuffix=.0.0
   9788	  fi
   9789	fi
   9790
   9791	# Remove version info from name if versioning should be avoided
   9792	if test yes,no = "$avoid_version,$need_version"; then
   9793	  major=
   9794	  versuffix=
   9795	  verstring=
   9796	fi
   9797
   9798	# Check to see if the archive will have undefined symbols.
   9799	if test yes = "$allow_undefined"; then
   9800	  if test unsupported = "$allow_undefined_flag"; then
   9801	    if test yes = "$build_old_libs"; then
   9802	      func_warning "undefined symbols not allowed in $host shared libraries; building static only"
   9803	      build_libtool_libs=no
   9804	    else
   9805	      func_fatal_error "can't build $host shared library unless -no-undefined is specified"
   9806	    fi
   9807	  fi
   9808	else
   9809	  # Don't allow undefined symbols.
   9810	  allow_undefined_flag=$no_undefined_flag
   9811	fi
   9812
   9813      fi
   9814
   9815      func_generate_dlsyms "$libname" "$libname" :
   9816      func_append libobjs " $symfileobj"
   9817      test " " = "$libobjs" && libobjs=
   9818
   9819      if test relink != "$opt_mode"; then
   9820	# Remove our outputs, but don't remove object files since they
   9821	# may have been created when compiling PIC objects.
   9822	removelist=
   9823	tempremovelist=`$ECHO "$output_objdir/*"`
   9824	for p in $tempremovelist; do
   9825	  case $p in
   9826	    *.$objext | *.gcno)
   9827	       ;;
   9828	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
   9829	       if test -n "$precious_files_regex"; then
   9830		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
   9831		 then
   9832		   continue
   9833		 fi
   9834	       fi
   9835	       func_append removelist " $p"
   9836	       ;;
   9837	    *) ;;
   9838	  esac
   9839	done
   9840	test -n "$removelist" && \
   9841	  func_show_eval "${RM}r \$removelist"
   9842      fi
   9843
   9844      # Now set the variables for building old libraries.
   9845      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
   9846	func_append oldlibs " $output_objdir/$libname.$libext"
   9847
   9848	# Transform .lo files to .o files.
   9849	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
   9850      fi
   9851
   9852      # Eliminate all temporary directories.
   9853      #for path in $notinst_path; do
   9854      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
   9855      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
   9856      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
   9857      #done
   9858
   9859      if test -n "$xrpath"; then
   9860	# If the user specified any rpath flags, then add them.
   9861	temp_xrpath=
   9862	for libdir in $xrpath; do
   9863	  func_replace_sysroot "$libdir"
   9864	  func_append temp_xrpath " -R$func_replace_sysroot_result"
   9865	  case "$finalize_rpath " in
   9866	  *" $libdir "*) ;;
   9867	  *) func_append finalize_rpath " $libdir" ;;
   9868	  esac
   9869	done
   9870	if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
   9871	  dependency_libs="$temp_xrpath $dependency_libs"
   9872	fi
   9873      fi
   9874
   9875      # Make sure dlfiles contains only unique files that won't be dlpreopened
   9876      old_dlfiles=$dlfiles
   9877      dlfiles=
   9878      for lib in $old_dlfiles; do
   9879	case " $dlprefiles $dlfiles " in
   9880	*" $lib "*) ;;
   9881	*) func_append dlfiles " $lib" ;;
   9882	esac
   9883      done
   9884
   9885      # Make sure dlprefiles contains only unique files
   9886      old_dlprefiles=$dlprefiles
   9887      dlprefiles=
   9888      for lib in $old_dlprefiles; do
   9889	case "$dlprefiles " in
   9890	*" $lib "*) ;;
   9891	*) func_append dlprefiles " $lib" ;;
   9892	esac
   9893      done
   9894
   9895      if test yes = "$build_libtool_libs"; then
   9896	if test -n "$rpath"; then
   9897	  case $host in
   9898	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
   9899	    # these systems don't actually have a c library (as such)!
   9900	    ;;
   9901	  *-*-rhapsody* | *-*-darwin1.[012])
   9902	    # Rhapsody C library is in the System framework
   9903	    func_append deplibs " System.ltframework"
   9904	    ;;
   9905	  *-*-netbsd*)
   9906	    # Don't link with libc until the a.out ld.so is fixed.
   9907	    ;;
   9908	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
   9909	    # Do not include libc due to us having libc/libc_r.
   9910	    ;;
   9911	  *-*-sco3.2v5* | *-*-sco5v6*)
   9912	    # Causes problems with __ctype
   9913	    ;;
   9914	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   9915	    # Compiler inserts libc in the correct place for threads to work
   9916	    ;;
   9917	  *)
   9918	    # Add libc to deplibs on all other systems if necessary.
   9919	    if test yes = "$build_libtool_need_lc"; then
   9920	      func_append deplibs " -lc"
   9921	    fi
   9922	    ;;
   9923	  esac
   9924	fi
   9925
   9926	# Transform deplibs into only deplibs that can be linked in shared.
   9927	name_save=$name
   9928	libname_save=$libname
   9929	release_save=$release
   9930	versuffix_save=$versuffix
   9931	major_save=$major
   9932	# I'm not sure if I'm treating the release correctly.  I think
   9933	# release should show up in the -l (ie -lgmp5) so we don't want to
   9934	# add it in twice.  Is that correct?
   9935	release=
   9936	versuffix=
   9937	major=
   9938	newdeplibs=
   9939	droppeddeps=no
   9940	case $deplibs_check_method in
   9941	pass_all)
   9942	  # Don't check for shared/static.  Everything works.
   9943	  # This might be a little naive.  We might want to check
   9944	  # whether the library exists or not.  But this is on
   9945	  # osf3 & osf4 and I'm not really sure... Just
   9946	  # implementing what was already the behavior.
   9947	  newdeplibs=$deplibs
   9948	  ;;
   9949	test_compile)
   9950	  # This code stresses the "libraries are programs" paradigm to its
   9951	  # limits. Maybe even breaks it.  We compile a program, linking it
   9952	  # against the deplibs as a proxy for the library.  Then we can check
   9953	  # whether they linked in statically or dynamically with ldd.
   9954	  $opt_dry_run || $RM conftest.c
   9955	  cat > conftest.c <<EOF
   9956	  int main() { return 0; }
   9957EOF
   9958	  $opt_dry_run || $RM conftest
   9959	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
   9960	    ldd_output=`ldd conftest`
   9961	    for i in $deplibs; do
   9962	      case $i in
   9963	      -l*)
   9964		func_stripname -l '' "$i"
   9965		name=$func_stripname_result
   9966		if test yes = "$allow_libtool_libs_with_static_runtimes"; then
   9967		  case " $predeps $postdeps " in
   9968		  *" $i "*)
   9969		    func_append newdeplibs " $i"
   9970		    i=
   9971		    ;;
   9972		  esac
   9973		fi
   9974		if test -n "$i"; then
   9975		  libname=`eval "\\$ECHO \"$libname_spec\""`
   9976		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
   9977		  set dummy $deplib_matches; shift
   9978		  deplib_match=$1
   9979		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
   9980		    func_append newdeplibs " $i"
   9981		  else
   9982		    droppeddeps=yes
   9983		    echo
   9984		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
   9985		    echo "*** I have the capability to make that library automatically link in when"
   9986		    echo "*** you link to this library.  But I can only do this if you have a"
   9987		    echo "*** shared version of the library, which I believe you do not have"
   9988		    echo "*** because a test_compile did reveal that the linker did not use it for"
   9989		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
   9990		  fi
   9991		fi
   9992		;;
   9993	      *)
   9994		func_append newdeplibs " $i"
   9995		;;
   9996	      esac
   9997	    done
   9998	  else
   9999	    # Error occurred in the first compile.  Let's try to salvage
  10000	    # the situation: Compile a separate program for each library.
  10001	    for i in $deplibs; do
  10002	      case $i in
  10003	      -l*)
  10004		func_stripname -l '' "$i"
  10005		name=$func_stripname_result
  10006		$opt_dry_run || $RM conftest
  10007		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  10008		  ldd_output=`ldd conftest`
  10009		  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  10010		    case " $predeps $postdeps " in
  10011		    *" $i "*)
  10012		      func_append newdeplibs " $i"
  10013		      i=
  10014		      ;;
  10015		    esac
  10016		  fi
  10017		  if test -n "$i"; then
  10018		    libname=`eval "\\$ECHO \"$libname_spec\""`
  10019		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  10020		    set dummy $deplib_matches; shift
  10021		    deplib_match=$1
  10022		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  10023		      func_append newdeplibs " $i"
  10024		    else
  10025		      droppeddeps=yes
  10026		      echo
  10027		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  10028		      echo "*** I have the capability to make that library automatically link in when"
  10029		      echo "*** you link to this library.  But I can only do this if you have a"
  10030		      echo "*** shared version of the library, which you do not appear to have"
  10031		      echo "*** because a test_compile did reveal that the linker did not use this one"
  10032		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  10033		    fi
  10034		  fi
  10035		else
  10036		  droppeddeps=yes
  10037		  echo
  10038		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
  10039		  echo "*** make it link in!  You will probably need to install it or some"
  10040		  echo "*** library that it depends on before this library will be fully"
  10041		  echo "*** functional.  Installing it before continuing would be even better."
  10042		fi
  10043		;;
  10044	      *)
  10045		func_append newdeplibs " $i"
  10046		;;
  10047	      esac
  10048	    done
  10049	  fi
  10050	  ;;
  10051	file_magic*)
  10052	  set dummy $deplibs_check_method; shift
  10053	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  10054	  for a_deplib in $deplibs; do
  10055	    case $a_deplib in
  10056	    -l*)
  10057	      func_stripname -l '' "$a_deplib"
  10058	      name=$func_stripname_result
  10059	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  10060		case " $predeps $postdeps " in
  10061		*" $a_deplib "*)
  10062		  func_append newdeplibs " $a_deplib"
  10063		  a_deplib=
  10064		  ;;
  10065		esac
  10066	      fi
  10067	      if test -n "$a_deplib"; then
  10068		libname=`eval "\\$ECHO \"$libname_spec\""`
  10069		if test -n "$file_magic_glob"; then
  10070		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  10071		else
  10072		  libnameglob=$libname
  10073		fi
  10074		test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  10075		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  10076		  if test yes = "$want_nocaseglob"; then
  10077		    shopt -s nocaseglob
  10078		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  10079		    $nocaseglob
  10080		  else
  10081		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  10082		  fi
  10083		  for potent_lib in $potential_libs; do
  10084		      # Follow soft links.
  10085		      if ls -lLd "$potent_lib" 2>/dev/null |
  10086			 $GREP " -> " >/dev/null; then
  10087			continue
  10088		      fi
  10089		      # The statement above tries to avoid entering an
  10090		      # endless loop below, in case of cyclic links.
  10091		      # We might still enter an endless loop, since a link
  10092		      # loop can be closed while we follow links,
  10093		      # but so what?
  10094		      potlib=$potent_lib
  10095		      while test -h "$potlib" 2>/dev/null; do
  10096			potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  10097			case $potliblink in
  10098			[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  10099			*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  10100			esac
  10101		      done
  10102		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  10103			 $SED -e 10q |
  10104			 $EGREP "$file_magic_regex" > /dev/null; then
  10105			func_append newdeplibs " $a_deplib"
  10106			a_deplib=
  10107			break 2
  10108		      fi
  10109		  done
  10110		done
  10111	      fi
  10112	      if test -n "$a_deplib"; then
  10113		droppeddeps=yes
  10114		echo
  10115		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  10116		echo "*** I have the capability to make that library automatically link in when"
  10117		echo "*** you link to this library.  But I can only do this if you have a"
  10118		echo "*** shared version of the library, which you do not appear to have"
  10119		echo "*** because I did check the linker path looking for a file starting"
  10120		if test -z "$potlib"; then
  10121		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  10122		else
  10123		  $ECHO "*** with $libname and none of the candidates passed a file format test"
  10124		  $ECHO "*** using a file magic. Last file checked: $potlib"
  10125		fi
  10126	      fi
  10127	      ;;
  10128	    *)
  10129	      # Add a -L argument.
  10130	      func_append newdeplibs " $a_deplib"
  10131	      ;;
  10132	    esac
  10133	  done # Gone through all deplibs.
  10134	  ;;
  10135	match_pattern*)
  10136	  set dummy $deplibs_check_method; shift
  10137	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  10138	  for a_deplib in $deplibs; do
  10139	    case $a_deplib in
  10140	    -l*)
  10141	      func_stripname -l '' "$a_deplib"
  10142	      name=$func_stripname_result
  10143	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  10144		case " $predeps $postdeps " in
  10145		*" $a_deplib "*)
  10146		  func_append newdeplibs " $a_deplib"
  10147		  a_deplib=
  10148		  ;;
  10149		esac
  10150	      fi
  10151	      if test -n "$a_deplib"; then
  10152		libname=`eval "\\$ECHO \"$libname_spec\""`
  10153		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  10154		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  10155		  for potent_lib in $potential_libs; do
  10156		    potlib=$potent_lib # see symlink-check above in file_magic test
  10157		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  10158		       $EGREP "$match_pattern_regex" > /dev/null; then
  10159		      func_append newdeplibs " $a_deplib"
  10160		      a_deplib=
  10161		      break 2
  10162		    fi
  10163		  done
  10164		done
  10165	      fi
  10166	      if test -n "$a_deplib"; then
  10167		droppeddeps=yes
  10168		echo
  10169		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  10170		echo "*** I have the capability to make that library automatically link in when"
  10171		echo "*** you link to this library.  But I can only do this if you have a"
  10172		echo "*** shared version of the library, which you do not appear to have"
  10173		echo "*** because I did check the linker path looking for a file starting"
  10174		if test -z "$potlib"; then
  10175		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  10176		else
  10177		  $ECHO "*** with $libname and none of the candidates passed a file format test"
  10178		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
  10179		fi
  10180	      fi
  10181	      ;;
  10182	    *)
  10183	      # Add a -L argument.
  10184	      func_append newdeplibs " $a_deplib"
  10185	      ;;
  10186	    esac
  10187	  done # Gone through all deplibs.
  10188	  ;;
  10189	none | unknown | *)
  10190	  newdeplibs=
  10191	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  10192	  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  10193	    for i in $predeps $postdeps; do
  10194	      # can't use Xsed below, because $i might contain '/'
  10195	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  10196	    done
  10197	  fi
  10198	  case $tmp_deplibs in
  10199	  *[!\	\ ]*)
  10200	    echo
  10201	    if test none = "$deplibs_check_method"; then
  10202	      echo "*** Warning: inter-library dependencies are not supported in this platform."
  10203	    else
  10204	      echo "*** Warning: inter-library dependencies are not known to be supported."
  10205	    fi
  10206	    echo "*** All declared inter-library dependencies are being dropped."
  10207	    droppeddeps=yes
  10208	    ;;
  10209	  esac
  10210	  ;;
  10211	esac
  10212	versuffix=$versuffix_save
  10213	major=$major_save
  10214	release=$release_save
  10215	libname=$libname_save
  10216	name=$name_save
  10217
  10218	case $host in
  10219	*-*-rhapsody* | *-*-darwin1.[012])
  10220	  # On Rhapsody replace the C library with the System framework
  10221	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  10222	  ;;
  10223	esac
  10224
  10225	if test yes = "$droppeddeps"; then
  10226	  if test yes = "$module"; then
  10227	    echo
  10228	    echo "*** Warning: libtool could not satisfy all declared inter-library"
  10229	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
  10230	    echo "*** a static module, that should work as long as the dlopening"
  10231	    echo "*** application is linked with the -dlopen flag."
  10232	    if test -z "$global_symbol_pipe"; then
  10233	      echo
  10234	      echo "*** However, this would only work if libtool was able to extract symbol"
  10235	      echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  10236	      echo "*** not find such a program.  So, this module is probably useless."
  10237	      echo "*** 'nm' from GNU binutils and a full rebuild may help."
  10238	    fi
  10239	    if test no = "$build_old_libs"; then
  10240	      oldlibs=$output_objdir/$libname.$libext
  10241	      build_libtool_libs=module
  10242	      build_old_libs=yes
  10243	    else
  10244	      build_libtool_libs=no
  10245	    fi
  10246	  else
  10247	    echo "*** The inter-library dependencies that have been dropped here will be"
  10248	    echo "*** automatically added whenever a program is linked with this library"
  10249	    echo "*** or is declared to -dlopen it."
  10250
  10251	    if test no = "$allow_undefined"; then
  10252	      echo
  10253	      echo "*** Since this library must not contain undefined symbols,"
  10254	      echo "*** because either the platform does not support them or"
  10255	      echo "*** it was explicitly requested with -no-undefined,"
  10256	      echo "*** libtool will only create a static version of it."
  10257	      if test no = "$build_old_libs"; then
  10258		oldlibs=$output_objdir/$libname.$libext
  10259		build_libtool_libs=module
  10260		build_old_libs=yes
  10261	      else
  10262		build_libtool_libs=no
  10263	      fi
  10264	    fi
  10265	  fi
  10266	fi
  10267	# Done checking deplibs!
  10268	deplibs=$newdeplibs
  10269      fi
  10270      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  10271      case $host in
  10272	*-*-darwin*)
  10273	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  10274	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  10275	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  10276	  ;;
  10277      esac
  10278
  10279      # move library search paths that coincide with paths to not yet
  10280      # installed libraries to the beginning of the library search list
  10281      new_libs=
  10282      for path in $notinst_path; do
  10283	case " $new_libs " in
  10284	*" -L$path/$objdir "*) ;;
  10285	*)
  10286	  case " $deplibs " in
  10287	  *" -L$path/$objdir "*)
  10288	    func_append new_libs " -L$path/$objdir" ;;
  10289	  esac
  10290	  ;;
  10291	esac
  10292      done
  10293      for deplib in $deplibs; do
  10294	case $deplib in
  10295	-L*)
  10296	  case " $new_libs " in
  10297	  *" $deplib "*) ;;
  10298	  *) func_append new_libs " $deplib" ;;
  10299	  esac
  10300	  ;;
  10301	*) func_append new_libs " $deplib" ;;
  10302	esac
  10303      done
  10304      deplibs=$new_libs
  10305
  10306      # All the library-specific variables (install_libdir is set above).
  10307      library_names=
  10308      old_library=
  10309      dlname=
  10310
  10311      # Test again, we may have decided not to build it any more
  10312      if test yes = "$build_libtool_libs"; then
  10313	# Remove $wl instances when linking with ld.
  10314	# FIXME: should test the right _cmds variable.
  10315	case $archive_cmds in
  10316	  *\$LD\ *) wl= ;;
  10317        esac
  10318	if test yes = "$hardcode_into_libs"; then
  10319	  # Hardcode the library paths
  10320	  hardcode_libdirs=
  10321	  dep_rpath=
  10322	  rpath=$finalize_rpath
  10323	  test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  10324	  for libdir in $rpath; do
  10325	    if test -n "$hardcode_libdir_flag_spec"; then
  10326	      if test -n "$hardcode_libdir_separator"; then
  10327		func_replace_sysroot "$libdir"
  10328		libdir=$func_replace_sysroot_result
  10329		if test -z "$hardcode_libdirs"; then
  10330		  hardcode_libdirs=$libdir
  10331		else
  10332		  # Just accumulate the unique libdirs.
  10333		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  10334		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  10335		    ;;
  10336		  *)
  10337		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  10338		    ;;
  10339		  esac
  10340		fi
  10341	      else
  10342		eval flag=\"$hardcode_libdir_flag_spec\"
  10343		func_append dep_rpath " $flag"
  10344	      fi
  10345	    elif test -n "$runpath_var"; then
  10346	      case "$perm_rpath " in
  10347	      *" $libdir "*) ;;
  10348	      *) func_append perm_rpath " $libdir" ;;
  10349	      esac
  10350	    fi
  10351	  done
  10352	  # Substitute the hardcoded libdirs into the rpath.
  10353	  if test -n "$hardcode_libdir_separator" &&
  10354	     test -n "$hardcode_libdirs"; then
  10355	    libdir=$hardcode_libdirs
  10356	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  10357	  fi
  10358	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  10359	    # We should set the runpath_var.
  10360	    rpath=
  10361	    for dir in $perm_rpath; do
  10362	      func_append rpath "$dir:"
  10363	    done
  10364	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  10365	  fi
  10366	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  10367	fi
  10368
  10369	shlibpath=$finalize_shlibpath
  10370	test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  10371	if test -n "$shlibpath"; then
  10372	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  10373	fi
  10374
  10375	# Get the real and link names of the library.
  10376	eval shared_ext=\"$shrext_cmds\"
  10377	eval library_names=\"$library_names_spec\"
  10378	set dummy $library_names
  10379	shift
  10380	realname=$1
  10381	shift
  10382
  10383	if test -n "$soname_spec"; then
  10384	  eval soname=\"$soname_spec\"
  10385	else
  10386	  soname=$realname
  10387	fi
  10388	if test -z "$dlname"; then
  10389	  dlname=$soname
  10390	fi
  10391
  10392	lib=$output_objdir/$realname
  10393	linknames=
  10394	for link
  10395	do
  10396	  func_append linknames " $link"
  10397	done
  10398
  10399	# Use standard objects if they are pic
  10400	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  10401	test "X$libobjs" = "X " && libobjs=
  10402
  10403	delfiles=
  10404	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  10405	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  10406	  export_symbols=$output_objdir/$libname.uexp
  10407	  func_append delfiles " $export_symbols"
  10408	fi
  10409
  10410	orig_export_symbols=
  10411	case $host_os in
  10412	cygwin* | mingw* | cegcc*)
  10413	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  10414	    # exporting using user supplied symfile
  10415	    func_dll_def_p "$export_symbols" || {
  10416	      # and it's NOT already a .def file. Must figure out
  10417	      # which of the given symbols are data symbols and tag
  10418	      # them as such. So, trigger use of export_symbols_cmds.
  10419	      # export_symbols gets reassigned inside the "prepare
  10420	      # the list of exported symbols" if statement, so the
  10421	      # include_expsyms logic still works.
  10422	      orig_export_symbols=$export_symbols
  10423	      export_symbols=
  10424	      always_export_symbols=yes
  10425	    }
  10426	  fi
  10427	  ;;
  10428	esac
  10429
  10430	# Prepare the list of exported symbols
  10431	if test -z "$export_symbols"; then
  10432	  if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  10433	    func_verbose "generating symbol list for '$libname.la'"
  10434	    export_symbols=$output_objdir/$libname.exp
  10435	    $opt_dry_run || $RM $export_symbols
  10436	    cmds=$export_symbols_cmds
  10437	    save_ifs=$IFS; IFS='~'
  10438	    for cmd1 in $cmds; do
  10439	      IFS=$save_ifs
  10440	      # Take the normal branch if the nm_file_list_spec branch
  10441	      # doesn't work or if tool conversion is not needed.
  10442	      case $nm_file_list_spec~$to_tool_file_cmd in
  10443		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  10444		  try_normal_branch=yes
  10445		  eval cmd=\"$cmd1\"
  10446		  func_len " $cmd"
  10447		  len=$func_len_result
  10448		  ;;
  10449		*)
  10450		  try_normal_branch=no
  10451		  ;;
  10452	      esac
  10453	      if test yes = "$try_normal_branch" \
  10454		 && { test "$len" -lt "$max_cmd_len" \
  10455		      || test "$max_cmd_len" -le -1; }
  10456	      then
  10457		func_show_eval "$cmd" 'exit $?'
  10458		skipped_export=false
  10459	      elif test -n "$nm_file_list_spec"; then
  10460		func_basename "$output"
  10461		output_la=$func_basename_result
  10462		save_libobjs=$libobjs
  10463		save_output=$output
  10464		output=$output_objdir/$output_la.nm
  10465		func_to_tool_file "$output"
  10466		libobjs=$nm_file_list_spec$func_to_tool_file_result
  10467		func_append delfiles " $output"
  10468		func_verbose "creating $NM input file list: $output"
  10469		for obj in $save_libobjs; do
  10470		  func_to_tool_file "$obj"
  10471		  $ECHO "$func_to_tool_file_result"
  10472		done > "$output"
  10473		eval cmd=\"$cmd1\"
  10474		func_show_eval "$cmd" 'exit $?'
  10475		output=$save_output
  10476		libobjs=$save_libobjs
  10477		skipped_export=false
  10478	      else
  10479		# The command line is too long to execute in one step.
  10480		func_verbose "using reloadable object file for export list..."
  10481		skipped_export=:
  10482		# Break out early, otherwise skipped_export may be
  10483		# set to false by a later but shorter cmd.
  10484		break
  10485	      fi
  10486	    done
  10487	    IFS=$save_ifs
  10488	    if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  10489	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  10490	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  10491	    fi
  10492	  fi
  10493	fi
  10494
  10495	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  10496	  tmp_export_symbols=$export_symbols
  10497	  test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  10498	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  10499	fi
  10500
  10501	if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  10502	  # The given exports_symbols file has to be filtered, so filter it.
  10503	  func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  10504	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
  10505	  # 's' commands, which not all seds can handle. GNU sed should be fine
  10506	  # though. Also, the filter scales superlinearly with the number of
  10507	  # global variables. join(1) would be nice here, but unfortunately
  10508	  # isn't a blessed tool.
  10509	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  10510	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  10511	  export_symbols=$output_objdir/$libname.def
  10512	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  10513	fi
  10514
  10515	tmp_deplibs=
  10516	for test_deplib in $deplibs; do
  10517	  case " $convenience " in
  10518	  *" $test_deplib "*) ;;
  10519	  *)
  10520	    func_append tmp_deplibs " $test_deplib"
  10521	    ;;
  10522	  esac
  10523	done
  10524	deplibs=$tmp_deplibs
  10525
  10526	if test -n "$convenience"; then
  10527	  if test -n "$whole_archive_flag_spec" &&
  10528	    test yes = "$compiler_needs_object" &&
  10529	    test -z "$libobjs"; then
  10530	    # extract the archives, so we have objects to list.
  10531	    # TODO: could optimize this to just extract one archive.
  10532	    whole_archive_flag_spec=
  10533	  fi
  10534	  if test -n "$whole_archive_flag_spec"; then
  10535	    save_libobjs=$libobjs
  10536	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  10537	    test "X$libobjs" = "X " && libobjs=
  10538	  else
  10539	    gentop=$output_objdir/${outputname}x
  10540	    func_append generated " $gentop"
  10541
  10542	    func_extract_archives $gentop $convenience
  10543	    func_append libobjs " $func_extract_archives_result"
  10544	    test "X$libobjs" = "X " && libobjs=
  10545	  fi
  10546	fi
  10547
  10548	if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  10549	  eval flag=\"$thread_safe_flag_spec\"
  10550	  func_append linker_flags " $flag"
  10551	fi
  10552
  10553	# Make a backup of the uninstalled library when relinking
  10554	if test relink = "$opt_mode"; then
  10555	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  10556	fi
  10557
  10558	# Do each of the archive commands.
  10559	if test yes = "$module" && test -n "$module_cmds"; then
  10560	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  10561	    eval test_cmds=\"$module_expsym_cmds\"
  10562	    cmds=$module_expsym_cmds
  10563	  else
  10564	    eval test_cmds=\"$module_cmds\"
  10565	    cmds=$module_cmds
  10566	  fi
  10567	else
  10568	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  10569	    eval test_cmds=\"$archive_expsym_cmds\"
  10570	    cmds=$archive_expsym_cmds
  10571	  else
  10572	    eval test_cmds=\"$archive_cmds\"
  10573	    cmds=$archive_cmds
  10574	  fi
  10575	fi
  10576
  10577	if test : != "$skipped_export" &&
  10578	   func_len " $test_cmds" &&
  10579	   len=$func_len_result &&
  10580	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  10581	  :
  10582	else
  10583	  # The command line is too long to link in one step, link piecewise
  10584	  # or, if using GNU ld and skipped_export is not :, use a linker
  10585	  # script.
  10586
  10587	  # Save the value of $output and $libobjs because we want to
  10588	  # use them later.  If we have whole_archive_flag_spec, we
  10589	  # want to use save_libobjs as it was before
  10590	  # whole_archive_flag_spec was expanded, because we can't
  10591	  # assume the linker understands whole_archive_flag_spec.
  10592	  # This may have to be revisited, in case too many
  10593	  # convenience libraries get linked in and end up exceeding
  10594	  # the spec.
  10595	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  10596	    save_libobjs=$libobjs
  10597	  fi
  10598	  save_output=$output
  10599	  func_basename "$output"
  10600	  output_la=$func_basename_result
  10601
  10602	  # Clear the reloadable object creation command queue and
  10603	  # initialize k to one.
  10604	  test_cmds=
  10605	  concat_cmds=
  10606	  objlist=
  10607	  last_robj=
  10608	  k=1
  10609
  10610	  if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  10611	    output=$output_objdir/$output_la.lnkscript
  10612	    func_verbose "creating GNU ld script: $output"
  10613	    echo 'INPUT (' > $output
  10614	    for obj in $save_libobjs
  10615	    do
  10616	      func_to_tool_file "$obj"
  10617	      $ECHO "$func_to_tool_file_result" >> $output
  10618	    done
  10619	    echo ')' >> $output
  10620	    func_append delfiles " $output"
  10621	    func_to_tool_file "$output"
  10622	    output=$func_to_tool_file_result
  10623	  elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  10624	    output=$output_objdir/$output_la.lnk
  10625	    func_verbose "creating linker input file list: $output"
  10626	    : > $output
  10627	    set x $save_libobjs
  10628	    shift
  10629	    firstobj=
  10630	    if test yes = "$compiler_needs_object"; then
  10631	      firstobj="$1 "
  10632	      shift
  10633	    fi
  10634	    for obj
  10635	    do
  10636	      func_to_tool_file "$obj"
  10637	      $ECHO "$func_to_tool_file_result" >> $output
  10638	    done
  10639	    func_append delfiles " $output"
  10640	    func_to_tool_file "$output"
  10641	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  10642	  else
  10643	    if test -n "$save_libobjs"; then
  10644	      func_verbose "creating reloadable object files..."
  10645	      output=$output_objdir/$output_la-$k.$objext
  10646	      eval test_cmds=\"$reload_cmds\"
  10647	      func_len " $test_cmds"
  10648	      len0=$func_len_result
  10649	      len=$len0
  10650
  10651	      # Loop over the list of objects to be linked.
  10652	      for obj in $save_libobjs
  10653	      do
  10654		func_len " $obj"
  10655		func_arith $len + $func_len_result
  10656		len=$func_arith_result
  10657		if test -z "$objlist" ||
  10658		   test "$len" -lt "$max_cmd_len"; then
  10659		  func_append objlist " $obj"
  10660		else
  10661		  # The command $test_cmds is almost too long, add a
  10662		  # command to the queue.
  10663		  if test 1 -eq "$k"; then
  10664		    # The first file doesn't have a previous command to add.
  10665		    reload_objs=$objlist
  10666		    eval concat_cmds=\"$reload_cmds\"
  10667		  else
  10668		    # All subsequent reloadable object files will link in
  10669		    # the last one created.
  10670		    reload_objs="$objlist $last_robj"
  10671		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  10672		  fi
  10673		  last_robj=$output_objdir/$output_la-$k.$objext
  10674		  func_arith $k + 1
  10675		  k=$func_arith_result
  10676		  output=$output_objdir/$output_la-$k.$objext
  10677		  objlist=" $obj"
  10678		  func_len " $last_robj"
  10679		  func_arith $len0 + $func_len_result
  10680		  len=$func_arith_result
  10681		fi
  10682	      done
  10683	      # Handle the remaining objects by creating one last
  10684	      # reloadable object file.  All subsequent reloadable object
  10685	      # files will link in the last one created.
  10686	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  10687	      reload_objs="$objlist $last_robj"
  10688	      eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  10689	      if test -n "$last_robj"; then
  10690	        eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  10691	      fi
  10692	      func_append delfiles " $output"
  10693
  10694	    else
  10695	      output=
  10696	    fi
  10697
  10698	    ${skipped_export-false} && {
  10699	      func_verbose "generating symbol list for '$libname.la'"
  10700	      export_symbols=$output_objdir/$libname.exp
  10701	      $opt_dry_run || $RM $export_symbols
  10702	      libobjs=$output
  10703	      # Append the command to create the export file.
  10704	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  10705	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  10706	      if test -n "$last_robj"; then
  10707		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  10708	      fi
  10709	    }
  10710
  10711	    test -n "$save_libobjs" &&
  10712	      func_verbose "creating a temporary reloadable object file: $output"
  10713
  10714	    # Loop through the commands generated above and execute them.
  10715	    save_ifs=$IFS; IFS='~'
  10716	    for cmd in $concat_cmds; do
  10717	      IFS=$save_ifs
  10718	      $opt_quiet || {
  10719		  func_quote_arg expand,pretty "$cmd"
  10720		  eval "func_echo $func_quote_arg_result"
  10721	      }
  10722	      $opt_dry_run || eval "$cmd" || {
  10723		lt_exit=$?
  10724
  10725		# Restore the uninstalled library and exit
  10726		if test relink = "$opt_mode"; then
  10727		  ( cd "$output_objdir" && \
  10728		    $RM "${realname}T" && \
  10729		    $MV "${realname}U" "$realname" )
  10730		fi
  10731
  10732		exit $lt_exit
  10733	      }
  10734	    done
  10735	    IFS=$save_ifs
  10736
  10737	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  10738	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  10739	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  10740	    fi
  10741	  fi
  10742
  10743          ${skipped_export-false} && {
  10744	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
  10745	      tmp_export_symbols=$export_symbols
  10746	      test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  10747	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  10748	    fi
  10749
  10750	    if test -n "$orig_export_symbols"; then
  10751	      # The given exports_symbols file has to be filtered, so filter it.
  10752	      func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  10753	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
  10754	      # 's' commands, which not all seds can handle. GNU sed should be fine
  10755	      # though. Also, the filter scales superlinearly with the number of
  10756	      # global variables. join(1) would be nice here, but unfortunately
  10757	      # isn't a blessed tool.
  10758	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  10759	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  10760	      export_symbols=$output_objdir/$libname.def
  10761	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  10762	    fi
  10763	  }
  10764
  10765	  libobjs=$output
  10766	  # Restore the value of output.
  10767	  output=$save_output
  10768
  10769	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  10770	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  10771	    test "X$libobjs" = "X " && libobjs=
  10772	  fi
  10773	  # Expand the library linking commands again to reset the
  10774	  # value of $libobjs for piecewise linking.
  10775
  10776	  # Do each of the archive commands.
  10777	  if test yes = "$module" && test -n "$module_cmds"; then
  10778	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  10779	      cmds=$module_expsym_cmds
  10780	    else
  10781	      cmds=$module_cmds
  10782	    fi
  10783	  else
  10784	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  10785	      cmds=$archive_expsym_cmds
  10786	    else
  10787	      cmds=$archive_cmds
  10788	    fi
  10789	  fi
  10790	fi
  10791
  10792	if test -n "$delfiles"; then
  10793	  # Append the command to remove temporary files to $cmds.
  10794	  eval cmds=\"\$cmds~\$RM $delfiles\"
  10795	fi
  10796
  10797	# Add any objects from preloaded convenience libraries
  10798	if test -n "$dlprefiles"; then
  10799	  gentop=$output_objdir/${outputname}x
  10800	  func_append generated " $gentop"
  10801
  10802	  func_extract_archives $gentop $dlprefiles
  10803	  func_append libobjs " $func_extract_archives_result"
  10804	  test "X$libobjs" = "X " && libobjs=
  10805	fi
  10806
  10807	save_ifs=$IFS; IFS='~'
  10808	for cmd in $cmds; do
  10809	  IFS=$sp$nl
  10810	  eval cmd=\"$cmd\"
  10811	  IFS=$save_ifs
  10812	  $opt_quiet || {
  10813	    func_quote_arg expand,pretty "$cmd"
  10814	    eval "func_echo $func_quote_arg_result"
  10815	  }
  10816	  $opt_dry_run || eval "$cmd" || {
  10817	    lt_exit=$?
  10818
  10819	    # Restore the uninstalled library and exit
  10820	    if test relink = "$opt_mode"; then
  10821	      ( cd "$output_objdir" && \
  10822	        $RM "${realname}T" && \
  10823		$MV "${realname}U" "$realname" )
  10824	    fi
  10825
  10826	    exit $lt_exit
  10827	  }
  10828	done
  10829	IFS=$save_ifs
  10830
  10831	# Restore the uninstalled library and exit
  10832	if test relink = "$opt_mode"; then
  10833	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  10834
  10835	  if test -n "$convenience"; then
  10836	    if test -z "$whole_archive_flag_spec"; then
  10837	      func_show_eval '${RM}r "$gentop"'
  10838	    fi
  10839	  fi
  10840
  10841	  exit $EXIT_SUCCESS
  10842	fi
  10843
  10844	# Create links to the real library.
  10845	for linkname in $linknames; do
  10846	  if test "$realname" != "$linkname"; then
  10847	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  10848	  fi
  10849	done
  10850
  10851	# If -module or -export-dynamic was specified, set the dlname.
  10852	if test yes = "$module" || test yes = "$export_dynamic"; then
  10853	  # On all known operating systems, these are identical.
  10854	  dlname=$soname
  10855	fi
  10856      fi
  10857      ;;
  10858
  10859    obj)
  10860      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  10861	func_warning "'-dlopen' is ignored for objects"
  10862      fi
  10863
  10864      case " $deplibs" in
  10865      *\ -l* | *\ -L*)
  10866	func_warning "'-l' and '-L' are ignored for objects" ;;
  10867      esac
  10868
  10869      test -n "$rpath" && \
  10870	func_warning "'-rpath' is ignored for objects"
  10871
  10872      test -n "$xrpath" && \
  10873	func_warning "'-R' is ignored for objects"
  10874
  10875      test -n "$vinfo" && \
  10876	func_warning "'-version-info' is ignored for objects"
  10877
  10878      test -n "$release" && \
  10879	func_warning "'-release' is ignored for objects"
  10880
  10881      case $output in
  10882      *.lo)
  10883	test -n "$objs$old_deplibs" && \
  10884	  func_fatal_error "cannot build library object '$output' from non-libtool objects"
  10885
  10886	libobj=$output
  10887	func_lo2o "$libobj"
  10888	obj=$func_lo2o_result
  10889	;;
  10890      *)
  10891	libobj=
  10892	obj=$output
  10893	;;
  10894      esac
  10895
  10896      # Delete the old objects.
  10897      $opt_dry_run || $RM $obj $libobj
  10898
  10899      # Objects from convenience libraries.  This assumes
  10900      # single-version convenience libraries.  Whenever we create
  10901      # different ones for PIC/non-PIC, this we'll have to duplicate
  10902      # the extraction.
  10903      reload_conv_objs=
  10904      gentop=
  10905      # if reload_cmds runs $LD directly, get rid of -Wl from
  10906      # whole_archive_flag_spec and hope we can get by with turning comma
  10907      # into space.
  10908      case $reload_cmds in
  10909        *\$LD[\ \$]*) wl= ;;
  10910      esac
  10911      if test -n "$convenience"; then
  10912	if test -n "$whole_archive_flag_spec"; then
  10913	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  10914	  test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  10915	  reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  10916	else
  10917	  gentop=$output_objdir/${obj}x
  10918	  func_append generated " $gentop"
  10919
  10920	  func_extract_archives $gentop $convenience
  10921	  reload_conv_objs="$reload_objs $func_extract_archives_result"
  10922	fi
  10923      fi
  10924
  10925      # If we're not building shared, we need to use non_pic_objs
  10926      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  10927
  10928      # Create the old-style object.
  10929      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  10930
  10931      output=$obj
  10932      func_execute_cmds "$reload_cmds" 'exit $?'
  10933
  10934      # Exit if we aren't doing a library object file.
  10935      if test -z "$libobj"; then
  10936	if test -n "$gentop"; then
  10937	  func_show_eval '${RM}r "$gentop"'
  10938	fi
  10939
  10940	exit $EXIT_SUCCESS
  10941      fi
  10942
  10943      test yes = "$build_libtool_libs" || {
  10944	if test -n "$gentop"; then
  10945	  func_show_eval '${RM}r "$gentop"'
  10946	fi
  10947
  10948	# Create an invalid libtool object if no PIC, so that we don't
  10949	# accidentally link it into a program.
  10950	# $show "echo timestamp > $libobj"
  10951	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  10952	exit $EXIT_SUCCESS
  10953      }
  10954
  10955      if test -n "$pic_flag" || test default != "$pic_mode"; then
  10956	# Only do commands if we really have different PIC objects.
  10957	reload_objs="$libobjs $reload_conv_objs"
  10958	output=$libobj
  10959	func_execute_cmds "$reload_cmds" 'exit $?'
  10960      fi
  10961
  10962      if test -n "$gentop"; then
  10963	func_show_eval '${RM}r "$gentop"'
  10964      fi
  10965
  10966      exit $EXIT_SUCCESS
  10967      ;;
  10968
  10969    prog)
  10970      case $host in
  10971	*cygwin*) func_stripname '' '.exe' "$output"
  10972	          output=$func_stripname_result.exe;;
  10973      esac
  10974      test -n "$vinfo" && \
  10975	func_warning "'-version-info' is ignored for programs"
  10976
  10977      test -n "$release" && \
  10978	func_warning "'-release' is ignored for programs"
  10979
  10980      $preload \
  10981	&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  10982	&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  10983
  10984      case $host in
  10985      *-*-rhapsody* | *-*-darwin1.[012])
  10986	# On Rhapsody replace the C library is the System framework
  10987	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  10988	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  10989	;;
  10990      esac
  10991
  10992      case $host in
  10993      *-*-darwin*)
  10994	# Don't allow lazy linking, it breaks C++ global constructors
  10995	# But is supposedly fixed on 10.4 or later (yay!).
  10996	if test CXX = "$tagname"; then
  10997	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  10998	    10.[0123])
  10999	      func_append compile_command " $wl-bind_at_load"
  11000	      func_append finalize_command " $wl-bind_at_load"
  11001	    ;;
  11002	  esac
  11003	fi
  11004	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
  11005	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  11006	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  11007	;;
  11008      esac
  11009
  11010
  11011      # move library search paths that coincide with paths to not yet
  11012      # installed libraries to the beginning of the library search list
  11013      new_libs=
  11014      for path in $notinst_path; do
  11015	case " $new_libs " in
  11016	*" -L$path/$objdir "*) ;;
  11017	*)
  11018	  case " $compile_deplibs " in
  11019	  *" -L$path/$objdir "*)
  11020	    func_append new_libs " -L$path/$objdir" ;;
  11021	  esac
  11022	  ;;
  11023	esac
  11024      done
  11025      for deplib in $compile_deplibs; do
  11026	case $deplib in
  11027	-L*)
  11028	  case " $new_libs " in
  11029	  *" $deplib "*) ;;
  11030	  *) func_append new_libs " $deplib" ;;
  11031	  esac
  11032	  ;;
  11033	*) func_append new_libs " $deplib" ;;
  11034	esac
  11035      done
  11036      compile_deplibs=$new_libs
  11037
  11038
  11039      func_append compile_command " $compile_deplibs"
  11040      func_append finalize_command " $finalize_deplibs"
  11041
  11042      if test -n "$rpath$xrpath"; then
  11043	# If the user specified any rpath flags, then add them.
  11044	for libdir in $rpath $xrpath; do
  11045	  # This is the magic to use -rpath.
  11046	  case "$finalize_rpath " in
  11047	  *" $libdir "*) ;;
  11048	  *) func_append finalize_rpath " $libdir" ;;
  11049	  esac
  11050	done
  11051      fi
  11052
  11053      # Now hardcode the library paths
  11054      rpath=
  11055      hardcode_libdirs=
  11056      for libdir in $compile_rpath $finalize_rpath; do
  11057	if test -n "$hardcode_libdir_flag_spec"; then
  11058	  if test -n "$hardcode_libdir_separator"; then
  11059	    if test -z "$hardcode_libdirs"; then
  11060	      hardcode_libdirs=$libdir
  11061	    else
  11062	      # Just accumulate the unique libdirs.
  11063	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  11064	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  11065		;;
  11066	      *)
  11067		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  11068		;;
  11069	      esac
  11070	    fi
  11071	  else
  11072	    eval flag=\"$hardcode_libdir_flag_spec\"
  11073	    func_append rpath " $flag"
  11074	  fi
  11075	elif test -n "$runpath_var"; then
  11076	  case "$perm_rpath " in
  11077	  *" $libdir "*) ;;
  11078	  *) func_append perm_rpath " $libdir" ;;
  11079	  esac
  11080	fi
  11081	case $host in
  11082	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  11083	  testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  11084	  case :$dllsearchpath: in
  11085	  *":$libdir:"*) ;;
  11086	  ::) dllsearchpath=$libdir;;
  11087	  *) func_append dllsearchpath ":$libdir";;
  11088	  esac
  11089	  case :$dllsearchpath: in
  11090	  *":$testbindir:"*) ;;
  11091	  ::) dllsearchpath=$testbindir;;
  11092	  *) func_append dllsearchpath ":$testbindir";;
  11093	  esac
  11094	  ;;
  11095	esac
  11096      done
  11097      # Substitute the hardcoded libdirs into the rpath.
  11098      if test -n "$hardcode_libdir_separator" &&
  11099	 test -n "$hardcode_libdirs"; then
  11100	libdir=$hardcode_libdirs
  11101	eval rpath=\" $hardcode_libdir_flag_spec\"
  11102      fi
  11103      compile_rpath=$rpath
  11104
  11105      rpath=
  11106      hardcode_libdirs=
  11107      for libdir in $finalize_rpath; do
  11108	if test -n "$hardcode_libdir_flag_spec"; then
  11109	  if test -n "$hardcode_libdir_separator"; then
  11110	    if test -z "$hardcode_libdirs"; then
  11111	      hardcode_libdirs=$libdir
  11112	    else
  11113	      # Just accumulate the unique libdirs.
  11114	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  11115	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  11116		;;
  11117	      *)
  11118		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  11119		;;
  11120	      esac
  11121	    fi
  11122	  else
  11123	    eval flag=\"$hardcode_libdir_flag_spec\"
  11124	    func_append rpath " $flag"
  11125	  fi
  11126	elif test -n "$runpath_var"; then
  11127	  case "$finalize_perm_rpath " in
  11128	  *" $libdir "*) ;;
  11129	  *) func_append finalize_perm_rpath " $libdir" ;;
  11130	  esac
  11131	fi
  11132      done
  11133      # Substitute the hardcoded libdirs into the rpath.
  11134      if test -n "$hardcode_libdir_separator" &&
  11135	 test -n "$hardcode_libdirs"; then
  11136	libdir=$hardcode_libdirs
  11137	eval rpath=\" $hardcode_libdir_flag_spec\"
  11138      fi
  11139      finalize_rpath=$rpath
  11140
  11141      if test -n "$libobjs" && test yes = "$build_old_libs"; then
  11142	# Transform all the library objects into standard objects.
  11143	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  11144	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  11145      fi
  11146
  11147      func_generate_dlsyms "$outputname" "@PROGRAM@" false
  11148
  11149      # template prelinking step
  11150      if test -n "$prelink_cmds"; then
  11151	func_execute_cmds "$prelink_cmds" 'exit $?'
  11152      fi
  11153
  11154      wrappers_required=:
  11155      case $host in
  11156      *cegcc* | *mingw32ce*)
  11157        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  11158        wrappers_required=false
  11159        ;;
  11160      *cygwin* | *mingw* )
  11161        test yes = "$build_libtool_libs" || wrappers_required=false
  11162        ;;
  11163      *)
  11164        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  11165          wrappers_required=false
  11166        fi
  11167        ;;
  11168      esac
  11169      $wrappers_required || {
  11170	# Replace the output file specification.
  11171	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  11172	link_command=$compile_command$compile_rpath
  11173
  11174	# We have no uninstalled library dependencies, so finalize right now.
  11175	exit_status=0
  11176	func_show_eval "$link_command" 'exit_status=$?'
  11177
  11178	if test -n "$postlink_cmds"; then
  11179	  func_to_tool_file "$output"
  11180	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  11181	  func_execute_cmds "$postlink_cmds" 'exit $?'
  11182	fi
  11183
  11184	# Delete the generated files.
  11185	if test -f "$output_objdir/${outputname}S.$objext"; then
  11186	  func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  11187	fi
  11188
  11189	exit $exit_status
  11190      }
  11191
  11192      if test -n "$compile_shlibpath$finalize_shlibpath"; then
  11193	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  11194      fi
  11195      if test -n "$finalize_shlibpath"; then
  11196	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  11197      fi
  11198
  11199      compile_var=
  11200      finalize_var=
  11201      if test -n "$runpath_var"; then
  11202	if test -n "$perm_rpath"; then
  11203	  # We should set the runpath_var.
  11204	  rpath=
  11205	  for dir in $perm_rpath; do
  11206	    func_append rpath "$dir:"
  11207	  done
  11208	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  11209	fi
  11210	if test -n "$finalize_perm_rpath"; then
  11211	  # We should set the runpath_var.
  11212	  rpath=
  11213	  for dir in $finalize_perm_rpath; do
  11214	    func_append rpath "$dir:"
  11215	  done
  11216	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  11217	fi
  11218      fi
  11219
  11220      if test yes = "$no_install"; then
  11221	# We don't need to create a wrapper script.
  11222	link_command=$compile_var$compile_command$compile_rpath
  11223	# Replace the output file specification.
  11224	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  11225	# Delete the old output file.
  11226	$opt_dry_run || $RM $output
  11227	# Link the executable and exit
  11228	func_show_eval "$link_command" 'exit $?'
  11229
  11230	if test -n "$postlink_cmds"; then
  11231	  func_to_tool_file "$output"
  11232	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  11233	  func_execute_cmds "$postlink_cmds" 'exit $?'
  11234	fi
  11235
  11236	exit $EXIT_SUCCESS
  11237      fi
  11238
  11239      case $hardcode_action,$fast_install in
  11240        relink,*)
  11241	  # Fast installation is not supported
  11242	  link_command=$compile_var$compile_command$compile_rpath
  11243	  relink_command=$finalize_var$finalize_command$finalize_rpath
  11244
  11245	  func_warning "this platform does not like uninstalled shared libraries"
  11246	  func_warning "'$output' will be relinked during installation"
  11247	  ;;
  11248        *,yes)
  11249	  link_command=$finalize_var$compile_command$finalize_rpath
  11250	  relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  11251          ;;
  11252	*,no)
  11253	  link_command=$compile_var$compile_command$compile_rpath
  11254	  relink_command=$finalize_var$finalize_command$finalize_rpath
  11255          ;;
  11256	*,needless)
  11257	  link_command=$finalize_var$compile_command$finalize_rpath
  11258	  relink_command=
  11259          ;;
  11260      esac
  11261
  11262      # Replace the output file specification.
  11263      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  11264
  11265      # Delete the old output files.
  11266      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  11267
  11268      func_show_eval "$link_command" 'exit $?'
  11269
  11270      if test -n "$postlink_cmds"; then
  11271	func_to_tool_file "$output_objdir/$outputname"
  11272	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  11273	func_execute_cmds "$postlink_cmds" 'exit $?'
  11274      fi
  11275
  11276      # Now create the wrapper script.
  11277      func_verbose "creating $output"
  11278
  11279      # Quote the relink command for shipping.
  11280      if test -n "$relink_command"; then
  11281	# Preserve any variables that may affect compiler behavior
  11282	for var in $variables_saved_for_relink; do
  11283	  if eval test -z \"\${$var+set}\"; then
  11284	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  11285	  elif eval var_value=\$$var; test -z "$var_value"; then
  11286	    relink_command="$var=; export $var; $relink_command"
  11287	  else
  11288	    func_quote_arg pretty "$var_value"
  11289	    relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
  11290	  fi
  11291	done
  11292	func_quote eval cd "`pwd`"
  11293	func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
  11294	relink_command=$func_quote_arg_unquoted_result
  11295      fi
  11296
  11297      # Only actually do things if not in dry run mode.
  11298      $opt_dry_run || {
  11299	# win32 will think the script is a binary if it has
  11300	# a .exe suffix, so we strip it off here.
  11301	case $output in
  11302	  *.exe) func_stripname '' '.exe' "$output"
  11303	         output=$func_stripname_result ;;
  11304	esac
  11305	# test for cygwin because mv fails w/o .exe extensions
  11306	case $host in
  11307	  *cygwin*)
  11308	    exeext=.exe
  11309	    func_stripname '' '.exe' "$outputname"
  11310	    outputname=$func_stripname_result ;;
  11311	  *) exeext= ;;
  11312	esac
  11313	case $host in
  11314	  *cygwin* | *mingw* )
  11315	    func_dirname_and_basename "$output" "" "."
  11316	    output_name=$func_basename_result
  11317	    output_path=$func_dirname_result
  11318	    cwrappersource=$output_path/$objdir/lt-$output_name.c
  11319	    cwrapper=$output_path/$output_name.exe
  11320	    $RM $cwrappersource $cwrapper
  11321	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  11322
  11323	    func_emit_cwrapperexe_src > $cwrappersource
  11324
  11325	    # The wrapper executable is built using the $host compiler,
  11326	    # because it contains $host paths and files. If cross-
  11327	    # compiling, it, like the target executable, must be
  11328	    # executed on the $host or under an emulation environment.
  11329	    $opt_dry_run || {
  11330	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  11331	      $STRIP $cwrapper
  11332	    }
  11333
  11334	    # Now, create the wrapper script for func_source use:
  11335	    func_ltwrapper_scriptname $cwrapper
  11336	    $RM $func_ltwrapper_scriptname_result
  11337	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  11338	    $opt_dry_run || {
  11339	      # note: this script will not be executed, so do not chmod.
  11340	      if test "x$build" = "x$host"; then
  11341		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  11342	      else
  11343		func_emit_wrapper no > $func_ltwrapper_scriptname_result
  11344	      fi
  11345	    }
  11346	  ;;
  11347	  * )
  11348	    $RM $output
  11349	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  11350
  11351	    func_emit_wrapper no > $output
  11352	    chmod +x $output
  11353	  ;;
  11354	esac
  11355      }
  11356      exit $EXIT_SUCCESS
  11357      ;;
  11358    esac
  11359
  11360    # See if we need to build an old-fashioned archive.
  11361    for oldlib in $oldlibs; do
  11362
  11363      case $build_libtool_libs in
  11364        convenience)
  11365	  oldobjs="$libobjs_save $symfileobj"
  11366	  addlibs=$convenience
  11367	  build_libtool_libs=no
  11368	  ;;
  11369	module)
  11370	  oldobjs=$libobjs_save
  11371	  addlibs=$old_convenience
  11372	  build_libtool_libs=no
  11373          ;;
  11374	*)
  11375	  oldobjs="$old_deplibs $non_pic_objects"
  11376	  $preload && test -f "$symfileobj" \
  11377	    && func_append oldobjs " $symfileobj"
  11378	  addlibs=$old_convenience
  11379	  ;;
  11380      esac
  11381
  11382      if test -n "$addlibs"; then
  11383	gentop=$output_objdir/${outputname}x
  11384	func_append generated " $gentop"
  11385
  11386	func_extract_archives $gentop $addlibs
  11387	func_append oldobjs " $func_extract_archives_result"
  11388      fi
  11389
  11390      # Do each command in the archive commands.
  11391      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  11392	cmds=$old_archive_from_new_cmds
  11393      else
  11394
  11395	# Add any objects from preloaded convenience libraries
  11396	if test -n "$dlprefiles"; then
  11397	  gentop=$output_objdir/${outputname}x
  11398	  func_append generated " $gentop"
  11399
  11400	  func_extract_archives $gentop $dlprefiles
  11401	  func_append oldobjs " $func_extract_archives_result"
  11402	fi
  11403
  11404	# POSIX demands no paths to be encoded in archives.  We have
  11405	# to avoid creating archives with duplicate basenames if we
  11406	# might have to extract them afterwards, e.g., when creating a
  11407	# static archive out of a convenience library, or when linking
  11408	# the entirety of a libtool archive into another (currently
  11409	# not supported by libtool).
  11410	if (for obj in $oldobjs
  11411	    do
  11412	      func_basename "$obj"
  11413	      $ECHO "$func_basename_result"
  11414	    done | sort | sort -uc >/dev/null 2>&1); then
  11415	  :
  11416	else
  11417	  echo "copying selected object files to avoid basename conflicts..."
  11418	  gentop=$output_objdir/${outputname}x
  11419	  func_append generated " $gentop"
  11420	  func_mkdir_p "$gentop"
  11421	  save_oldobjs=$oldobjs
  11422	  oldobjs=
  11423	  counter=1
  11424	  for obj in $save_oldobjs
  11425	  do
  11426	    func_basename "$obj"
  11427	    objbase=$func_basename_result
  11428	    case " $oldobjs " in
  11429	    " ") oldobjs=$obj ;;
  11430	    *[\ /]"$objbase "*)
  11431	      while :; do
  11432		# Make sure we don't pick an alternate name that also
  11433		# overlaps.
  11434		newobj=lt$counter-$objbase
  11435		func_arith $counter + 1
  11436		counter=$func_arith_result
  11437		case " $oldobjs " in
  11438		*[\ /]"$newobj "*) ;;
  11439		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
  11440		esac
  11441	      done
  11442	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  11443	      func_append oldobjs " $gentop/$newobj"
  11444	      ;;
  11445	    *) func_append oldobjs " $obj" ;;
  11446	    esac
  11447	  done
  11448	fi
  11449	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  11450	tool_oldlib=$func_to_tool_file_result
  11451	eval cmds=\"$old_archive_cmds\"
  11452
  11453	func_len " $cmds"
  11454	len=$func_len_result
  11455	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  11456	  cmds=$old_archive_cmds
  11457	elif test -n "$archiver_list_spec"; then
  11458	  func_verbose "using command file archive linking..."
  11459	  for obj in $oldobjs
  11460	  do
  11461	    func_to_tool_file "$obj"
  11462	    $ECHO "$func_to_tool_file_result"
  11463	  done > $output_objdir/$libname.libcmd
  11464	  func_to_tool_file "$output_objdir/$libname.libcmd"
  11465	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  11466	  cmds=$old_archive_cmds
  11467	else
  11468	  # the command line is too long to link in one step, link in parts
  11469	  func_verbose "using piecewise archive linking..."
  11470	  save_RANLIB=$RANLIB
  11471	  RANLIB=:
  11472	  objlist=
  11473	  concat_cmds=
  11474	  save_oldobjs=$oldobjs
  11475	  oldobjs=
  11476	  # Is there a better way of finding the last object in the list?
  11477	  for obj in $save_oldobjs
  11478	  do
  11479	    last_oldobj=$obj
  11480	  done
  11481	  eval test_cmds=\"$old_archive_cmds\"
  11482	  func_len " $test_cmds"
  11483	  len0=$func_len_result
  11484	  len=$len0
  11485	  for obj in $save_oldobjs
  11486	  do
  11487	    func_len " $obj"
  11488	    func_arith $len + $func_len_result
  11489	    len=$func_arith_result
  11490	    func_append objlist " $obj"
  11491	    if test "$len" -lt "$max_cmd_len"; then
  11492	      :
  11493	    else
  11494	      # the above command should be used before it gets too long
  11495	      oldobjs=$objlist
  11496	      if test "$obj" = "$last_oldobj"; then
  11497		RANLIB=$save_RANLIB
  11498	      fi
  11499	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  11500	      eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  11501	      objlist=
  11502	      len=$len0
  11503	    fi
  11504	  done
  11505	  RANLIB=$save_RANLIB
  11506	  oldobjs=$objlist
  11507	  if test -z "$oldobjs"; then
  11508	    eval cmds=\"\$concat_cmds\"
  11509	  else
  11510	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  11511	  fi
  11512	fi
  11513      fi
  11514      func_execute_cmds "$cmds" 'exit $?'
  11515    done
  11516
  11517    test -n "$generated" && \
  11518      func_show_eval "${RM}r$generated"
  11519
  11520    # Now create the libtool archive.
  11521    case $output in
  11522    *.la)
  11523      old_library=
  11524      test yes = "$build_old_libs" && old_library=$libname.$libext
  11525      func_verbose "creating $output"
  11526
  11527      # Preserve any variables that may affect compiler behavior
  11528      for var in $variables_saved_for_relink; do
  11529	if eval test -z \"\${$var+set}\"; then
  11530	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  11531	elif eval var_value=\$$var; test -z "$var_value"; then
  11532	  relink_command="$var=; export $var; $relink_command"
  11533	else
  11534	  func_quote_arg pretty,unquoted "$var_value"
  11535	  relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
  11536	fi
  11537      done
  11538      # Quote the link command for shipping.
  11539      func_quote eval cd "`pwd`"
  11540      relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  11541      func_quote_arg pretty,unquoted "$relink_command"
  11542      relink_command=$func_quote_arg_unquoted_result
  11543      if test yes = "$hardcode_automatic"; then
  11544	relink_command=
  11545      fi
  11546
  11547      # Only create the output if not a dry run.
  11548      $opt_dry_run || {
  11549	for installed in no yes; do
  11550	  if test yes = "$installed"; then
  11551	    if test -z "$install_libdir"; then
  11552	      break
  11553	    fi
  11554	    output=$output_objdir/${outputname}i
  11555	    # Replace all uninstalled libtool libraries with the installed ones
  11556	    newdependency_libs=
  11557	    for deplib in $dependency_libs; do
  11558	      case $deplib in
  11559	      *.la)
  11560		func_basename "$deplib"
  11561		name=$func_basename_result
  11562		func_resolve_sysroot "$deplib"
  11563		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  11564		test -z "$libdir" && \
  11565		  func_fatal_error "'$deplib' is not a valid libtool archive"
  11566		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  11567		;;
  11568	      -L*)
  11569		func_stripname -L '' "$deplib"
  11570		func_replace_sysroot "$func_stripname_result"
  11571		func_append newdependency_libs " -L$func_replace_sysroot_result"
  11572		;;
  11573	      -R*)
  11574		func_stripname -R '' "$deplib"
  11575		func_replace_sysroot "$func_stripname_result"
  11576		func_append newdependency_libs " -R$func_replace_sysroot_result"
  11577		;;
  11578	      *) func_append newdependency_libs " $deplib" ;;
  11579	      esac
  11580	    done
  11581	    dependency_libs=$newdependency_libs
  11582	    newdlfiles=
  11583
  11584	    for lib in $dlfiles; do
  11585	      case $lib in
  11586	      *.la)
  11587	        func_basename "$lib"
  11588		name=$func_basename_result
  11589		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  11590		test -z "$libdir" && \
  11591		  func_fatal_error "'$lib' is not a valid libtool archive"
  11592		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  11593		;;
  11594	      *) func_append newdlfiles " $lib" ;;
  11595	      esac
  11596	    done
  11597	    dlfiles=$newdlfiles
  11598	    newdlprefiles=
  11599	    for lib in $dlprefiles; do
  11600	      case $lib in
  11601	      *.la)
  11602		# Only pass preopened files to the pseudo-archive (for
  11603		# eventual linking with the app. that links it) if we
  11604		# didn't already link the preopened objects directly into
  11605		# the library:
  11606		func_basename "$lib"
  11607		name=$func_basename_result
  11608		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  11609		test -z "$libdir" && \
  11610		  func_fatal_error "'$lib' is not a valid libtool archive"
  11611		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  11612		;;
  11613	      esac
  11614	    done
  11615	    dlprefiles=$newdlprefiles
  11616	  else
  11617	    newdlfiles=
  11618	    for lib in $dlfiles; do
  11619	      case $lib in
  11620		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  11621		*) abs=`pwd`"/$lib" ;;
  11622	      esac
  11623	      func_append newdlfiles " $abs"
  11624	    done
  11625	    dlfiles=$newdlfiles
  11626	    newdlprefiles=
  11627	    for lib in $dlprefiles; do
  11628	      case $lib in
  11629		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  11630		*) abs=`pwd`"/$lib" ;;
  11631	      esac
  11632	      func_append newdlprefiles " $abs"
  11633	    done
  11634	    dlprefiles=$newdlprefiles
  11635	  fi
  11636	  $RM $output
  11637	  # place dlname in correct position for cygwin
  11638	  # In fact, it would be nice if we could use this code for all target
  11639	  # systems that can't hard-code library paths into their executables
  11640	  # and that have no shared library path variable independent of PATH,
  11641	  # but it turns out we can't easily determine that from inspecting
  11642	  # libtool variables, so we have to hard-code the OSs to which it
  11643	  # applies here; at the moment, that means platforms that use the PE
  11644	  # object format with DLL files.  See the long comment at the top of
  11645	  # tests/bindir.at for full details.
  11646	  tdlname=$dlname
  11647	  case $host,$output,$installed,$module,$dlname in
  11648	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  11649	      # If a -bindir argument was supplied, place the dll there.
  11650	      if test -n "$bindir"; then
  11651		func_relative_path "$install_libdir" "$bindir"
  11652		tdlname=$func_relative_path_result/$dlname
  11653	      else
  11654		# Otherwise fall back on heuristic.
  11655		tdlname=../bin/$dlname
  11656	      fi
  11657	      ;;
  11658	  esac
  11659	  $ECHO > $output "\
  11660# $outputname - a libtool library file
  11661# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  11662#
  11663# Please DO NOT delete this file!
  11664# It is necessary for linking the library.
  11665
  11666# The name that we can dlopen(3).
  11667dlname='$tdlname'
  11668
  11669# Names of this library.
  11670library_names='$library_names'
  11671
  11672# The name of the static archive.
  11673old_library='$old_library'
  11674
  11675# Linker flags that cannot go in dependency_libs.
  11676inherited_linker_flags='$new_inherited_linker_flags'
  11677
  11678# Libraries that this one depends upon.
  11679dependency_libs='$dependency_libs'
  11680
  11681# Names of additional weak libraries provided by this library
  11682weak_library_names='$weak_libs'
  11683
  11684# Version information for $libname.
  11685current=$current
  11686age=$age
  11687revision=$revision
  11688
  11689# Is this an already installed library?
  11690installed=$installed
  11691
  11692# Should we warn about portability when linking against -modules?
  11693shouldnotlink=$module
  11694
  11695# Files to dlopen/dlpreopen
  11696dlopen='$dlfiles'
  11697dlpreopen='$dlprefiles'
  11698
  11699# Directory that this library needs to be installed in:
  11700libdir='$install_libdir'"
  11701	  if test no,yes = "$installed,$need_relink"; then
  11702	    $ECHO >> $output "\
  11703relink_command=\"$relink_command\""
  11704	  fi
  11705	done
  11706      }
  11707
  11708      # Do a symbolic link so that the libtool archive can be found in
  11709      # LD_LIBRARY_PATH before the program is installed.
  11710      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  11711      ;;
  11712    esac
  11713    exit $EXIT_SUCCESS
  11714}
  11715
  11716if test link = "$opt_mode" || test relink = "$opt_mode"; then
  11717  func_mode_link ${1+"$@"}
  11718fi
  11719
  11720
  11721# func_mode_uninstall arg...
  11722func_mode_uninstall ()
  11723{
  11724    $debug_cmd
  11725
  11726    RM=$nonopt
  11727    files=
  11728    rmforce=false
  11729    exit_status=0
  11730
  11731    # This variable tells wrapper scripts just to set variables rather
  11732    # than running their programs.
  11733    libtool_install_magic=$magic
  11734
  11735    for arg
  11736    do
  11737      case $arg in
  11738      -f) func_append RM " $arg"; rmforce=: ;;
  11739      -*) func_append RM " $arg" ;;
  11740      *) func_append files " $arg" ;;
  11741      esac
  11742    done
  11743
  11744    test -z "$RM" && \
  11745      func_fatal_help "you must specify an RM program"
  11746
  11747    rmdirs=
  11748
  11749    for file in $files; do
  11750      func_dirname "$file" "" "."
  11751      dir=$func_dirname_result
  11752      if test . = "$dir"; then
  11753	odir=$objdir
  11754      else
  11755	odir=$dir/$objdir
  11756      fi
  11757      func_basename "$file"
  11758      name=$func_basename_result
  11759      test uninstall = "$opt_mode" && odir=$dir
  11760
  11761      # Remember odir for removal later, being careful to avoid duplicates
  11762      if test clean = "$opt_mode"; then
  11763	case " $rmdirs " in
  11764	  *" $odir "*) ;;
  11765	  *) func_append rmdirs " $odir" ;;
  11766	esac
  11767      fi
  11768
  11769      # Don't error if the file doesn't exist and rm -f was used.
  11770      if { test -L "$file"; } >/dev/null 2>&1 ||
  11771	 { test -h "$file"; } >/dev/null 2>&1 ||
  11772	 test -f "$file"; then
  11773	:
  11774      elif test -d "$file"; then
  11775	exit_status=1
  11776	continue
  11777      elif $rmforce; then
  11778	continue
  11779      fi
  11780
  11781      rmfiles=$file
  11782
  11783      case $name in
  11784      *.la)
  11785	# Possibly a libtool archive, so verify it.
  11786	if func_lalib_p "$file"; then
  11787	  func_source $dir/$name
  11788
  11789	  # Delete the libtool libraries and symlinks.
  11790	  for n in $library_names; do
  11791	    func_append rmfiles " $odir/$n"
  11792	  done
  11793	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  11794
  11795	  case $opt_mode in
  11796	  clean)
  11797	    case " $library_names " in
  11798	    *" $dlname "*) ;;
  11799	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  11800	    esac
  11801	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  11802	    ;;
  11803	  uninstall)
  11804	    if test -n "$library_names"; then
  11805	      # Do each command in the postuninstall commands.
  11806	      func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  11807	    fi
  11808
  11809	    if test -n "$old_library"; then
  11810	      # Do each command in the old_postuninstall commands.
  11811	      func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  11812	    fi
  11813	    # FIXME: should reinstall the best remaining shared library.
  11814	    ;;
  11815	  esac
  11816	fi
  11817	;;
  11818
  11819      *.lo)
  11820	# Possibly a libtool object, so verify it.
  11821	if func_lalib_p "$file"; then
  11822
  11823	  # Read the .lo file
  11824	  func_source $dir/$name
  11825
  11826	  # Add PIC object to the list of files to remove.
  11827	  if test -n "$pic_object" && test none != "$pic_object"; then
  11828	    func_append rmfiles " $dir/$pic_object"
  11829	  fi
  11830
  11831	  # Add non-PIC object to the list of files to remove.
  11832	  if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  11833	    func_append rmfiles " $dir/$non_pic_object"
  11834	  fi
  11835	fi
  11836	;;
  11837
  11838      *)
  11839	if test clean = "$opt_mode"; then
  11840	  noexename=$name
  11841	  case $file in
  11842	  *.exe)
  11843	    func_stripname '' '.exe' "$file"
  11844	    file=$func_stripname_result
  11845	    func_stripname '' '.exe' "$name"
  11846	    noexename=$func_stripname_result
  11847	    # $file with .exe has already been added to rmfiles,
  11848	    # add $file without .exe
  11849	    func_append rmfiles " $file"
  11850	    ;;
  11851	  esac
  11852	  # Do a test to see if this is a libtool program.
  11853	  if func_ltwrapper_p "$file"; then
  11854	    if func_ltwrapper_executable_p "$file"; then
  11855	      func_ltwrapper_scriptname "$file"
  11856	      relink_command=
  11857	      func_source $func_ltwrapper_scriptname_result
  11858	      func_append rmfiles " $func_ltwrapper_scriptname_result"
  11859	    else
  11860	      relink_command=
  11861	      func_source $dir/$noexename
  11862	    fi
  11863
  11864	    # note $name still contains .exe if it was in $file originally
  11865	    # as does the version of $file that was added into $rmfiles
  11866	    func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  11867	    if test yes = "$fast_install" && test -n "$relink_command"; then
  11868	      func_append rmfiles " $odir/lt-$name"
  11869	    fi
  11870	    if test "X$noexename" != "X$name"; then
  11871	      func_append rmfiles " $odir/lt-$noexename.c"
  11872	    fi
  11873	  fi
  11874	fi
  11875	;;
  11876      esac
  11877      func_show_eval "$RM $rmfiles" 'exit_status=1'
  11878    done
  11879
  11880    # Try to remove the $objdir's in the directories where we deleted files
  11881    for dir in $rmdirs; do
  11882      if test -d "$dir"; then
  11883	func_show_eval "rmdir $dir >/dev/null 2>&1"
  11884      fi
  11885    done
  11886
  11887    exit $exit_status
  11888}
  11889
  11890if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  11891  func_mode_uninstall ${1+"$@"}
  11892fi
  11893
  11894test -z "$opt_mode" && {
  11895  help=$generic_help
  11896  func_fatal_help "you must specify a MODE"
  11897}
  11898
  11899test -z "$exec_cmd" && \
  11900  func_fatal_help "invalid operation mode '$opt_mode'"
  11901
  11902if test -n "$exec_cmd"; then
  11903  eval exec "$exec_cmd"
  11904  exit $EXIT_FAILURE
  11905fi
  11906
  11907exit $exit_status
  11908
  11909
  11910# The TAGs below are defined such that we never get into a situation
  11911# where we disable both kinds of libraries.  Given conflicting
  11912# choices, we go for a static library, that is the most portable,
  11913# since we can't tell whether shared libraries were disabled because
  11914# the user asked for that or because the platform doesn't support
  11915# them.  This is particularly important on AIX, because we don't
  11916# support having both static and shared libraries enabled at the same
  11917# time on that platform, so we default to a shared-only configuration.
  11918# If a disable-shared tag is given, we'll fallback to a static-only
  11919# configuration.  But we'll never go from static-only to shared-only.
  11920
  11921# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  11922build_libtool_libs=no
  11923build_old_libs=yes
  11924# ### END LIBTOOL TAG CONFIG: disable-shared
  11925
  11926# ### BEGIN LIBTOOL TAG CONFIG: disable-static
  11927build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  11928# ### END LIBTOOL TAG CONFIG: disable-static
  11929
  11930# Local Variables:
  11931# mode:shell-script
  11932# sh-indentation:2
  11933# End: