"Fossies" - the Fresh Open Source Software Archive

Member "libdbh2-5.0.22/libtool" (22 Sep 2016, 339308 Bytes) of package /linux/misc/libdbh2-5.0.22.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "libtool": 5.0.21_vs_5.0.22.

    1 #! /bin/sh
    2 # Generated automatically by config.status (libdbh2) 5.0.22
    3 # Libtool was configured on host Gentoo:
    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.
   33 available_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?
   41 macro_version=2.4.6
   42 macro_revision=2.4.6
   43 
   44 # Assembler program.
   45 AS="as"
   46 
   47 # DLL creation program.
   48 DLLTOOL="false"
   49 
   50 # Object dumper program.
   51 OBJDUMP="objdump"
   52 
   53 # Whether or not to build shared libraries.
   54 build_libtool_libs=yes
   55 
   56 # Whether or not to build static libraries.
   57 build_old_libs=yes
   58 
   59 # What type of objects to build.
   60 pic_mode=default
   61 
   62 # Whether or not to optimize for fast installation.
   63 fast_install=needless
   64 
   65 # Shared archive member basename,for filename based shared libdbh versioning on AIX.
   66 shared_archive_member_spec=
   67 
   68 # Shell to use when invoking shell scripts.
   69 SHELL="/bin/sh"
   70 
   71 # An echo program that protects backslashes.
   72 ECHO="printf %s\\n"
   73 
   74 # The PATH separator for the build system.
   75 PATH_SEPARATOR=":"
   76 
   77 # The host system.
   78 host_alias=
   79 host=x86_64-unknown-linux-gnu
   80 host_os=linux-gnu
   81 
   82 # The build system.
   83 build_alias=
   84 build=x86_64-unknown-linux-gnu
   85 build_os=linux-gnu
   86 
   87 # A sed program that does not truncate output.
   88 SED="/bin/sed"
   89 
   90 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
   91 Xsed="$SED -e 1s/^X//"
   92 
   93 # A grep program that handles long lines.
   94 GREP="/bin/grep"
   95 
   96 # An ERE matcher.
   97 EGREP="/bin/grep -E"
   98 
   99 # A literal string matcher.
  100 FGREP="/bin/grep -F"
  101 
  102 # A BSD- or MS-compatible name lister.
  103 NM="/usr/bin/nm -B"
  104 
  105 # Whether we need soft or hard links.
  106 LN_S="ln -s"
  107 
  108 # What is the maximum length of a command?
  109 max_cmd_len=1572864
  110 
  111 # Object file suffix (normally "o").
  112 objext=o
  113 
  114 # Executable file suffix (normally "").
  115 exeext=
  116 
  117 # whether the shell understands "unset".
  118 lt_unset=unset
  119 
  120 # turn spaces into newlines.
  121 SP2NL="tr \\040 \\012"
  122 
  123 # turn newlines into spaces.
  124 NL2SP="tr \\015\\012 \\040\\040"
  125 
  126 # convert $build file names to $host format.
  127 to_host_file_cmd=func_convert_file_noop
  128 
  129 # convert $build files to toolchain format.
  130 to_tool_file_cmd=func_convert_file_noop
  131 
  132 # Method to check whether dependent libraries are shared objects.
  133 deplibs_check_method="pass_all"
  134 
  135 # Command to use when deplibs_check_method = "file_magic".
  136 file_magic_cmd="\$MAGIC_CMD"
  137 
  138 # How to find potential files when deplibs_check_method = "file_magic".
  139 file_magic_glob=""
  140 
  141 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  142 want_nocaseglob="no"
  143 
  144 # Command to associate shared and link libraries.
  145 sharedlib_from_linklib_cmd="printf %s\\n"
  146 
  147 # The archiver.
  148 AR="ar"
  149 
  150 # Flags to create an archive.
  151 AR_FLAGS="cru"
  152 
  153 # How to feed a file listing to the archiver.
  154 archiver_list_spec="@"
  155 
  156 # A symbol stripping program.
  157 STRIP="strip"
  158 
  159 # Commands used to install an old-style archive.
  160 RANLIB="ranlib"
  161 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  162 old_postuninstall_cmds=""
  163 
  164 # Whether to use a lock for old archive extraction.
  165 lock_old_archive_extraction=no
  166 
  167 # A C compiler.
  168 LTCC="gcc"
  169 
  170 # LTCC compiler flags.
  171 LTCFLAGS="-O2 -pthread"
  172 
  173 # Take the output of nm and produce a listing of raw symbols and C names.
  174 global_symbol_pipe="sed -n -e 's/^.*[    ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[   ][  ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
  175 
  176 # Transform the output of nm in a proper C declaration.
  177 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  178 
  179 # Transform the output of nm into a list of symbols to manually relocate.
  180 global_symbol_to_import=""
  181 
  182 # Transform the output of nm in a C name address pair.
  183 global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p'"
  184 
  185 # Transform the output of nm in a C name address pair when lib prefix is needed.
  186 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"lib\\1\", (void *) \\&\\1},/p'"
  187 
  188 # The name lister interface.
  189 nm_interface="BSD nm"
  190 
  191 # Specify filename containing input files for $NM.
  192 nm_file_list_spec="@"
  193 
  194 # The root where to search for dependent libraries,and where our libraries should be installed.
  195 lt_sysroot=
  196 
  197 # Command to truncate a binary pipe.
  198 lt_truncate_bin="/bin/dd bs=4096 count=1"
  199 
  200 # The name of the directory that contains temporary libtool files.
  201 objdir=.libs
  202 
  203 # Used to examine libraries when file_magic_cmd begins with "file".
  204 MAGIC_CMD=file
  205 
  206 # Must we lock files when doing compilation?
  207 need_locks="no"
  208 
  209 # Manifest tool.
  210 MANIFEST_TOOL=":"
  211 
  212 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  213 DSYMUTIL=""
  214 
  215 # Tool to change global to local symbols on Mac OS X.
  216 NMEDIT=""
  217 
  218 # Tool to manipulate fat objects and archives on Mac OS X.
  219 LIPO=""
  220 
  221 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  222 OTOOL=""
  223 
  224 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  225 OTOOL64=""
  226 
  227 # Old archive suffix (normally "a").
  228 libext=a
  229 
  230 # Shared libdbh suffix (normally ".so").
  231 shrext_cmds=".so"
  232 
  233 # The commands to extract the exported symbol list from a shared archive.
  234 extract_expsyms_cmds=""
  235 
  236 # Variables whose values should be saved in libtool wrapper scripts and
  237 # restored at link time.
  238 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  239 
  240 # Do we need the "lib" prefix for modules?
  241 need_lib_prefix=no
  242 
  243 # Do we need a version for libraries?
  244 need_version=no
  245 
  246 # Library versioning type.
  247 version_type=linux
  248 
  249 # Shared libdbh runtime path variable.
  250 runpath_var=LD_RUN_PATH
  251 
  252 # Shared libdbh path variable.
  253 shlibpath_var=LD_LIBRARY_PATH
  254 
  255 # Is shlibpath searched before the hard-coded libdbh search path?
  256 shlibpath_overrides_runpath=yes
  257 
  258 # Format of libdbh name prefix.
  259 libname_spec="lib\$name"
  260 
  261 # List of archive names.  First name is the real one, the rest are links.
  262 # The last name is the one that the linker finds with -lNAME
  263 library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
  264 
  265 # The coded name of the library, if different from the real name.
  266 soname_spec="\$libname\$release\$shared_ext\$major"
  267 
  268 # Permission mode override for installation of shared libraries.
  269 install_override_mode=""
  270 
  271 # Command to use after installation of a shared archive.
  272 postinstall_cmds=""
  273 
  274 # Command to use after uninstallation of a shared archive.
  275 postuninstall_cmds=""
  276 
  277 # Commands used to finish a libtool libdbh installation in a directory.
  278 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
  279 
  280 # As "finish_cmds", except a single script fragment to be evaled but
  281 # not shown.
  282 finish_eval=""
  283 
  284 # Whether we should hardcode libdbh paths into libraries.
  285 hardcode_into_libs=yes
  286 
  287 # Compile-time system search path for libraries.
  288 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib /usr/lib /lib "
  289 
  290 # Detected run-time system search path for libraries.
  291 sys_lib_dlsearch_path_spec="/lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /lib /usr/lib /usr/local/lib /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32 /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3 /usr/local/lib /usr/lib64/qt4 "
  292 
  293 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
  294 configure_time_lt_sys_library_path=""
  295 
  296 # Whether dlopen is supported.
  297 dlopen_support=unknown
  298 
  299 # Whether dlopen of programs is supported.
  300 dlopen_self=unknown
  301 
  302 # Whether dlopen of statically linked programs is supported.
  303 dlopen_self_static=unknown
  304 
  305 # Commands to strip libraries.
  306 old_striplib="strip --strip-debug"
  307 striplib="strip --strip-unneeded"
  308 
  309 
  310 # The linker used to build libraries.
  311 LD="/usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64"
  312 
  313 # How to create reloadable object files.
  314 reload_flag=" -r"
  315 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  316 
  317 # Commands used to build an old-style archive.
  318 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  319 
  320 # A language specific compiler.
  321 CC="gcc"
  322 
  323 # Is the compiler the GNU compiler?
  324 with_gcc=yes
  325 
  326 # Compiler flag to turn off builtin functions.
  327 no_builtin_flag=" -fno-builtin"
  328 
  329 # Additional compiler flags for building libdbh objects.
  330 pic_flag=" -fPIC -DPIC"
  331 
  332 # How to pass a linker flag through the compiler.
  333 wl="-Wl,"
  334 
  335 # Compiler flag to prevent dynamic linking.
  336 link_static_flag="-static"
  337 
  338 # Does compiler simultaneously support -c and -o options?
  339 compiler_c_o="yes"
  340 
  341 # Whether or not to add -lc for building shared libraries.
  342 build_libtool_need_lc=no
  343 
  344 # Whether or not to disallow shared libs when runtime libs are static.
  345 allow_libtool_libs_with_static_runtimes=no
  346 
  347 # Compiler flag to allow reflexive dlopens.
  348 export_dynamic_flag_spec="\$wl--export-dynamic"
  349 
  350 # Compiler flag to generate shared objects directly from archives.
  351 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  352 
  353 # Whether the compiler copes with passing no objects directly.
  354 compiler_needs_object="no"
  355 
  356 # Create an old-style archive from a shared archive.
  357 old_archive_from_new_cmds=""
  358 
  359 # Create a temporary old-style archive to link instead of a shared archive.
  360 old_archive_from_expsyms_cmds=""
  361 
  362 # Commands used to build a shared archive.
  363 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
  364 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
  365             cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
  366             echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
  367             \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
  368 
  369 # Commands used to build a loadable module if different from building
  370 # a shared archive.
  371 module_cmds=""
  372 module_expsym_cmds=""
  373 
  374 # Whether we are building with GNU ld or not.
  375 with_gnu_ld="yes"
  376 
  377 # Flag that allows shared libraries with undefined symbols to be built.
  378 allow_undefined_flag=""
  379 
  380 # Flag that enforces no undefined symbols.
  381 no_undefined_flag=""
  382 
  383 # Flag to hardcode $libdir into a binary during linking.
  384 # This must work even if $libdir does not exist
  385 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
  386 
  387 # Whether we need a single "-rpath" flag with a separated argument.
  388 hardcode_libdir_separator=""
  389 
  390 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  391 # DIR into the resulting binary.
  392 hardcode_direct=no
  393 
  394 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  395 # DIR into the resulting binary and the resulting libdbh dependency is
  396 # "absolute",i.e impossible to change by setting $shlibpath_var if the
  397 # libdbh is relocated.
  398 hardcode_direct_absolute=no
  399 
  400 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  401 # into the resulting binary.
  402 hardcode_minus_L=no
  403 
  404 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  405 # into the resulting binary.
  406 hardcode_shlibpath_var=unsupported
  407 
  408 # Set to "yes" if building a shared libdbh automatically hardcodes DIR
  409 # into the libdbh and all subsequent libraries and executables linked
  410 # against it.
  411 hardcode_automatic=no
  412 
  413 # Set to yes if linker adds runtime paths of dependent libraries
  414 # to runtime path list.
  415 inherit_rpath=no
  416 
  417 # Whether libtool must link a program against all its dependency libraries.
  418 link_all_deplibs=unknown
  419 
  420 # Set to "yes" if exported symbols are required.
  421 always_export_symbols=no
  422 
  423 # The commands to list exported symbols.
  424 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  425 
  426 # Symbols that should not be listed in the preloaded symbols.
  427 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  428 
  429 # Symbols that must always be exported.
  430 include_expsyms=""
  431 
  432 # Commands necessary for linking programs (against libraries) with templates.
  433 prelink_cmds=""
  434 
  435 # Commands necessary for finishing linking programs.
  436 postlink_cmds=""
  437 
  438 # Specify filename containing input files.
  439 file_list_spec=""
  440 
  441 # How to hardcode a shared libdbh path into an executable.
  442 hardcode_action=immediate
  443 
  444 # ### END LIBTOOL CONFIG
  445 
  446 
  447 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
  448 
  449 # func_munge_path_list VARIABLE PATH
  450 # -----------------------------------
  451 # VARIABLE is name of variable containing _space_ separated list of
  452 # directories to be munged by the contents of PATH, which is string
  453 # having a format:
  454 # "DIR[:DIR]:"
  455 #       string "DIR[ DIR]" will be prepended to VARIABLE
  456 # ":DIR[:DIR]"
  457 #       string "DIR[ DIR]" will be appended to VARIABLE
  458 # "DIRP[:DIRP]::[DIRA:]DIRA"
  459 #       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  460 #       "DIRA[ DIRA]" will be appended to VARIABLE
  461 # "DIR[:DIR]"
  462 #       VARIABLE will be replaced by "DIR[ DIR]"
  463 func_munge_path_list ()
  464 {
  465     case x$2 in
  466     x)
  467         ;;
  468     *:)
  469         eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
  470         ;;
  471     x:*)
  472         eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  473         ;;
  474     *::*)
  475         eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  476         eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  477         ;;
  478     *)
  479         eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  480         ;;
  481     esac
  482 }
  483 
  484 
  485 # Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
  486 func_cc_basename ()
  487 {
  488     for cc_temp in $*""; do
  489       case $cc_temp in
  490         compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  491         distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  492         \-*) ;;
  493         *) break;;
  494       esac
  495     done
  496     func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  497 }
  498 
  499 
  500 # ### END FUNCTIONS SHARED WITH CONFIGURE
  501 
  502 #! /bin/sh
  503 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  504 ##               by inline-source v2014-01-03.01
  505 
  506 # libtool (GNU libtool) 2.4.6
  507 # Provide generalized library-building support services.
  508 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  509 
  510 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  511 # This is free software; see the source for copying conditions.  There is NO
  512 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  513 
  514 # GNU Libtool is free software; you can redistribute it and/or modify
  515 # it under the terms of the GNU General Public License as published by
  516 # the Free Software Foundation; either version 2 of the License, or
  517 # (at your option) any later version.
  518 #
  519 # As a special exception to the GNU General Public License,
  520 # if you distribute this file as part of a program or library that
  521 # is built using GNU Libtool, you may include this file under the
  522 # same distribution terms that you use for the rest of that program.
  523 #
  524 # GNU Libtool is distributed in the hope that it will be useful, but
  525 # WITHOUT ANY WARRANTY; without even the implied warranty of
  526 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  527 # General Public License for more details.
  528 #
  529 # You should have received a copy of the GNU General Public License
  530 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  531 
  532 
  533 PROGRAM=libtool
  534 PACKAGE=libtool
  535 VERSION=2.4.6
  536 package_revision=2.4.6
  537 
  538 
  539 ## ------ ##
  540 ## Usage. ##
  541 ## ------ ##
  542 
  543 # Run './libtool --help' for help with using this script from the
  544 # command line.
  545 
  546 
  547 ## ------------------------------- ##
  548 ## User overridable command paths. ##
  549 ## ------------------------------- ##
  550 
  551 # After configure completes, it has a better idea of some of the
  552 # shell tools we need than the defaults used by the functions shared
  553 # with bootstrap, so set those here where they can still be over-
  554 # ridden by the user, but otherwise take precedence.
  555 
  556 : ${AUTOCONF="autoconf"}
  557 : ${AUTOMAKE="automake"}
  558 
  559 
  560 ## -------------------------- ##
  561 ## Source external libraries. ##
  562 ## -------------------------- ##
  563 
  564 # Much of our low-level functionality needs to be sourced from external
  565 # libraries, which are installed to $pkgauxdir.
  566 
  567 # Set a version string for this script.
  568 scriptversion=2015-01-20.17; # UTC
  569 
  570 # General shell script boiler plate, and helper functions.
  571 # Written by Gary V. Vaughan, 2004
  572 
  573 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  574 # This is free software; see the source for copying conditions.  There is NO
  575 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  576 
  577 # This program is free software; you can redistribute it and/or modify
  578 # it under the terms of the GNU General Public License as published by
  579 # the Free Software Foundation; either version 3 of the License, or
  580 # (at your option) any later version.
  581 
  582 # As a special exception to the GNU General Public License, if you distribute
  583 # this file as part of a program or library that is built using GNU Libtool,
  584 # you may include this file under the same distribution terms that you use
  585 # for the rest of that program.
  586 
  587 # This program is distributed in the hope that it will be useful,
  588 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  589 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  590 # General Public License for more details.
  591 
  592 # You should have received a copy of the GNU General Public License
  593 # along with this program. If not, see <http://www.gnu.org/licenses/>.
  594 
  595 # Please report bugs or propose patches to gary@gnu.org.
  596 
  597 
  598 ## ------ ##
  599 ## Usage. ##
  600 ## ------ ##
  601 
  602 # Evaluate this file near the top of your script to gain access to
  603 # the functions and variables defined here:
  604 #
  605 #   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  606 #
  607 # If you need to override any of the default environment variable
  608 # settings, do that before evaluating this file.
  609 
  610 
  611 ## -------------------- ##
  612 ## Shell normalisation. ##
  613 ## -------------------- ##
  614 
  615 # Some shells need a little help to be as Bourne compatible as possible.
  616 # Before doing anything else, make sure all that help has been provided!
  617 
  618 DUALCASE=1; export DUALCASE # for MKS sh
  619 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  620   emulate sh
  621   NULLCMD=:
  622   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  623   # is contrary to our usage.  Disable this feature.
  624   alias -g '${1+"$@"}'='"$@"'
  625   setopt NO_GLOB_SUBST
  626 else
  627   case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  628 fi
  629 
  630 # NLS nuisances: We save the old values in case they are required later.
  631 _G_user_locale=
  632 _G_safe_locale=
  633 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  634 do
  635   eval "if test set = \"\${$_G_var+set}\"; then
  636           save_$_G_var=\$$_G_var
  637           $_G_var=C
  638       export $_G_var
  639       _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  640       _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  641     fi"
  642 done
  643 
  644 # CDPATH.
  645 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  646 
  647 # Make sure IFS has a sensible default
  648 sp=' '
  649 nl='
  650 '
  651 IFS="$sp    $nl"
  652 
  653 # There are apparently some retarded systems that use ';' as a PATH separator!
  654 if test "${PATH_SEPARATOR+set}" != set; then
  655   PATH_SEPARATOR=:
  656   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  657     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  658       PATH_SEPARATOR=';'
  659   }
  660 fi
  661 
  662 
  663 
  664 ## ------------------------- ##
  665 ## Locate command utilities. ##
  666 ## ------------------------- ##
  667 
  668 
  669 # func_executable_p FILE
  670 # ----------------------
  671 # Check that FILE is an executable regular file.
  672 func_executable_p ()
  673 {
  674     test -f "$1" && test -x "$1"
  675 }
  676 
  677 
  678 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  679 # --------------------------------------------
  680 # Search for either a program that responds to --version with output
  681 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  682 # trying all the directories in PATH with each of the elements of
  683 # PROGS_LIST.
  684 #
  685 # CHECK_FUNC should accept the path to a candidate program, and
  686 # set $func_check_prog_result if it truncates its output less than
  687 # $_G_path_prog_max characters.
  688 func_path_progs ()
  689 {
  690     _G_progs_list=$1
  691     _G_check_func=$2
  692     _G_PATH=${3-"$PATH"}
  693 
  694     _G_path_prog_max=0
  695     _G_path_prog_found=false
  696     _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  697     for _G_dir in $_G_PATH; do
  698       IFS=$_G_save_IFS
  699       test -z "$_G_dir" && _G_dir=.
  700       for _G_prog_name in $_G_progs_list; do
  701         for _exeext in '' .EXE; do
  702           _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  703           func_executable_p "$_G_path_prog" || continue
  704           case `"$_G_path_prog" --version 2>&1` in
  705             *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  706             *)     $_G_check_func $_G_path_prog
  707            func_path_progs_result=$func_check_prog_result
  708            ;;
  709           esac
  710           $_G_path_prog_found && break 3
  711         done
  712       done
  713     done
  714     IFS=$_G_save_IFS
  715     test -z "$func_path_progs_result" && {
  716       echo "no acceptable sed could be found in \$PATH" >&2
  717       exit 1
  718     }
  719 }
  720 
  721 
  722 # We want to be able to use the functions in this file before configure
  723 # has figured out where the best binaries are kept, which means we have
  724 # to search for them ourselves - except when the results are already set
  725 # where we skip the searches.
  726 
  727 # Unless the user overrides by setting SED, search the path for either GNU
  728 # sed, or the sed that truncates its output the least.
  729 test -z "$SED" && {
  730   _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  731   for _G_i in 1 2 3 4 5 6 7; do
  732     _G_sed_script=$_G_sed_script$nl$_G_sed_script
  733   done
  734   echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  735   _G_sed_script=
  736 
  737   func_check_prog_sed ()
  738   {
  739     _G_path_prog=$1
  740 
  741     _G_count=0
  742     printf 0123456789 >conftest.in
  743     while :
  744     do
  745       cat conftest.in conftest.in >conftest.tmp
  746       mv conftest.tmp conftest.in
  747       cp conftest.in conftest.nl
  748       echo '' >> conftest.nl
  749       "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  750       diff conftest.out conftest.nl >/dev/null 2>&1 || break
  751       _G_count=`expr $_G_count + 1`
  752       if test "$_G_count" -gt "$_G_path_prog_max"; then
  753         # Best one so far, save it but keep looking for a better one
  754         func_check_prog_result=$_G_path_prog
  755         _G_path_prog_max=$_G_count
  756       fi
  757       # 10*(2^10) chars as input seems more than enough
  758       test 10 -lt "$_G_count" && break
  759     done
  760     rm -f conftest.in conftest.tmp conftest.nl conftest.out
  761   }
  762 
  763   func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  764   rm -f conftest.sed
  765   SED=$func_path_progs_result
  766 }
  767 
  768 
  769 # Unless the user overrides by setting GREP, search the path for either GNU
  770 # grep, or the grep that truncates its output the least.
  771 test -z "$GREP" && {
  772   func_check_prog_grep ()
  773   {
  774     _G_path_prog=$1
  775 
  776     _G_count=0
  777     _G_path_prog_max=0
  778     printf 0123456789 >conftest.in
  779     while :
  780     do
  781       cat conftest.in conftest.in >conftest.tmp
  782       mv conftest.tmp conftest.in
  783       cp conftest.in conftest.nl
  784       echo 'GREP' >> conftest.nl
  785       "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  786       diff conftest.out conftest.nl >/dev/null 2>&1 || break
  787       _G_count=`expr $_G_count + 1`
  788       if test "$_G_count" -gt "$_G_path_prog_max"; then
  789         # Best one so far, save it but keep looking for a better one
  790         func_check_prog_result=$_G_path_prog
  791         _G_path_prog_max=$_G_count
  792       fi
  793       # 10*(2^10) chars as input seems more than enough
  794       test 10 -lt "$_G_count" && break
  795     done
  796     rm -f conftest.in conftest.tmp conftest.nl conftest.out
  797   }
  798 
  799   func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  800   GREP=$func_path_progs_result
  801 }
  802 
  803 
  804 ## ------------------------------- ##
  805 ## User overridable command paths. ##
  806 ## ------------------------------- ##
  807 
  808 # All uppercase variable names are used for environment variables.  These
  809 # variables can be overridden by the user before calling a script that
  810 # uses them if a suitable command of that name is not already available
  811 # in the command search PATH.
  812 
  813 : ${CP="cp -f"}
  814 : ${ECHO="printf %s\n"}
  815 : ${EGREP="$GREP -E"}
  816 : ${FGREP="$GREP -F"}
  817 : ${LN_S="ln -s"}
  818 : ${MAKE="make"}
  819 : ${MKDIR="mkdir"}
  820 : ${MV="mv -f"}
  821 : ${RM="rm -f"}
  822 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  823 
  824 
  825 ## -------------------- ##
  826 ## Useful sed snippets. ##
  827 ## -------------------- ##
  828 
  829 sed_dirname='s|/[^/]*$||'
  830 sed_basename='s|^.*/||'
  831 
  832 # Sed substitution that helps us do robust quoting.  It backslashifies
  833 # metacharacters that are still active within double-quoted strings.
  834 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  835 
  836 # Same as above, but do not quote variable references.
  837 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  838 
  839 # Sed substitution that turns a string into a regex matching for the
  840 # string literally.
  841 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  842 
  843 # Sed substitution that converts a w32 file name or path
  844 # that contains forward slashes, into one that contains
  845 # (escaped) backslashes.  A very naive implementation.
  846 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  847 
  848 # Re-'\' parameter expansions in output of sed_double_quote_subst that
  849 # were '\'-ed in input to the same.  If an odd number of '\' preceded a
  850 # '$' in input to sed_double_quote_subst, that '$' was protected from
  851 # expansion.  Since each input '\' is now two '\'s, look for any number
  852 # of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
  853 _G_bs='\\'
  854 _G_bs2='\\\\'
  855 _G_bs4='\\\\\\\\'
  856 _G_dollar='\$'
  857 sed_double_backslash="\
  858   s/$_G_bs4/&\\
  859 /g
  860   s/^$_G_bs2$_G_dollar/$_G_bs&/
  861   s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  862   s/\n//g"
  863 
  864 
  865 ## ----------------- ##
  866 ## Global variables. ##
  867 ## ----------------- ##
  868 
  869 # Except for the global variables explicitly listed below, the following
  870 # functions in the '^func_' namespace, and the '^require_' namespace
  871 # variables initialised in the 'Resource management' section, sourcing
  872 # this file will not pollute your global namespace with anything
  873 # else. There's no portable way to scope variables in Bourne shell
  874 # though, so actually running these functions will sometimes place
  875 # results into a variable named after the function, and often use
  876 # temporary variables in the '^_G_' namespace. If you are careful to
  877 # avoid using those namespaces casually in your sourcing script, things
  878 # should continue to work as you expect. And, of course, you can freely
  879 # overwrite any of the functions or variables defined here before
  880 # calling anything to customize them.
  881 
  882 EXIT_SUCCESS=0
  883 EXIT_FAILURE=1
  884 EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
  885 EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
  886 
  887 # Allow overriding, eg assuming that you follow the convention of
  888 # putting '$debug_cmd' at the start of all your functions, you can get
  889 # bash to show function call trace with:
  890 #
  891 #    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  892 debug_cmd=${debug_cmd-":"}
  893 exit_cmd=:
  894 
  895 # By convention, finish your script with:
  896 #
  897 #    exit $exit_status
  898 #
  899 # so that you can set exit_status to non-zero if you want to indicate
  900 # something went wrong during execution without actually bailing out at
  901 # the point of failure.
  902 exit_status=$EXIT_SUCCESS
  903 
  904 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  905 # is ksh but when the shell is invoked as "sh" and the current value of
  906 # the _XPG environment variable is not equal to 1 (one), the special
  907 # positional parameter $0, within a function call, is the name of the
  908 # function.
  909 progpath=$0
  910 
  911 # The name of this program.
  912 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  913 
  914 # Make sure we have an absolute progpath for reexecution:
  915 case $progpath in
  916   [\\/]*|[A-Za-z]:\\*) ;;
  917   *[\\/]*)
  918      progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  919      progdir=`cd "$progdir" && pwd`
  920      progpath=$progdir/$progname
  921      ;;
  922   *)
  923      _G_IFS=$IFS
  924      IFS=${PATH_SEPARATOR-:}
  925      for progdir in $PATH; do
  926        IFS=$_G_IFS
  927        test -x "$progdir/$progname" && break
  928      done
  929      IFS=$_G_IFS
  930      test -n "$progdir" || progdir=`pwd`
  931      progpath=$progdir/$progname
  932      ;;
  933 esac
  934 
  935 
  936 ## ----------------- ##
  937 ## Standard options. ##
  938 ## ----------------- ##
  939 
  940 # The following options affect the operation of the functions defined
  941 # below, and should be set appropriately depending on run-time para-
  942 # meters passed on the command line.
  943 
  944 opt_dry_run=false
  945 opt_quiet=false
  946 opt_verbose=false
  947 
  948 # Categories 'all' and 'none' are always available.  Append any others
  949 # you will pass as the first argument to func_warning from your own
  950 # code.
  951 warning_categories=
  952 
  953 # By default, display warnings according to 'opt_warning_types'.  Set
  954 # 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
  955 # treat the next displayed warning as a fatal error.
  956 warning_func=func_warn_and_continue
  957 
  958 # Set to 'all' to display all warnings, 'none' to suppress all
  959 # warnings, or a space delimited list of some subset of
  960 # 'warning_categories' to display only the listed warnings.
  961 opt_warning_types=all
  962 
  963 
  964 ## -------------------- ##
  965 ## Resource management. ##
  966 ## -------------------- ##
  967 
  968 # This section contains definitions for functions that each ensure a
  969 # particular resource (a file, or a non-empty configuration variable for
  970 # example) is available, and if appropriate to extract default values
  971 # from pertinent package files. Call them using their associated
  972 # 'require_*' variable to ensure that they are executed, at most, once.
  973 #
  974 # It's entirely deliberate that calling these functions can set
  975 # variables that don't obey the namespace limitations obeyed by the rest
  976 # of this file, in order that that they be as useful as possible to
  977 # callers.
  978 
  979 
  980 # require_term_colors
  981 # -------------------
  982 # Allow display of bold text on terminals that support it.
  983 require_term_colors=func_require_term_colors
  984 func_require_term_colors ()
  985 {
  986     $debug_cmd
  987 
  988     test -t 1 && {
  989       # COLORTERM and USE_ANSI_COLORS environment variables take
  990       # precedence, because most terminfo databases neglect to describe
  991       # whether color sequences are supported.
  992       test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  993 
  994       if test 1 = "$USE_ANSI_COLORS"; then
  995         # Standard ANSI escape sequences
  996         tc_reset=''
  997         tc_bold='';   tc_standout=''
  998         tc_red='';   tc_green=''
  999         tc_blue='';  tc_cyan=''
 1000       else
 1001         # Otherwise trust the terminfo database after all.
 1002         test -n "`tput sgr0 2>/dev/null`" && {
 1003           tc_reset=`tput sgr0`
 1004           test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
 1005           tc_standout=$tc_bold
 1006           test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
 1007           test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
 1008           test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
 1009           test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
 1010           test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
 1011         }
 1012       fi
 1013     }
 1014 
 1015     require_term_colors=:
 1016 }
 1017 
 1018 
 1019 ## ----------------- ##
 1020 ## Function library. ##
 1021 ## ----------------- ##
 1022 
 1023 # This section contains a variety of useful functions to call in your
 1024 # scripts. Take note of the portable wrappers for features provided by
 1025 # some modern shells, which will fall back to slower equivalents on
 1026 # less featureful shells.
 1027 
 1028 
 1029 # func_append VAR VALUE
 1030 # ---------------------
 1031 # Append VALUE onto the existing contents of VAR.
 1032 
 1033   # We should try to minimise forks, especially on Windows where they are
 1034   # unreasonably slow, so skip the feature probes when bash or zsh are
 1035   # being used:
 1036   if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
 1037     : ${_G_HAVE_ARITH_OP="yes"}
 1038     : ${_G_HAVE_XSI_OPS="yes"}
 1039     # The += operator was introduced in bash 3.1
 1040     case $BASH_VERSION in
 1041       [12].* | 3.0 | 3.0*) ;;
 1042       *)
 1043         : ${_G_HAVE_PLUSEQ_OP="yes"}
 1044         ;;
 1045     esac
 1046   fi
 1047 
 1048   # _G_HAVE_PLUSEQ_OP
 1049   # Can be empty, in which case the shell is probed, "yes" if += is
 1050   # useable or anything else if it does not work.
 1051   test -z "$_G_HAVE_PLUSEQ_OP" \
 1052     && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
 1053     && _G_HAVE_PLUSEQ_OP=yes
 1054 
 1055 if test yes = "$_G_HAVE_PLUSEQ_OP"
 1056 then
 1057   # This is an XSI compatible shell, allowing a faster implementation...
 1058   eval 'func_append ()
 1059   {
 1060     $debug_cmd
 1061 
 1062     eval "$1+=\$2"
 1063   }'
 1064 else
 1065   # ...otherwise fall back to using expr, which is often a shell builtin.
 1066   func_append ()
 1067   {
 1068     $debug_cmd
 1069 
 1070     eval "$1=\$$1\$2"
 1071   }
 1072 fi
 1073 
 1074 
 1075 # func_append_quoted VAR VALUE
 1076 # ----------------------------
 1077 # Quote VALUE and append to the end of shell variable VAR, separated
 1078 # by a space.
 1079 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
 1080   eval 'func_append_quoted ()
 1081   {
 1082     $debug_cmd
 1083 
 1084     func_quote_for_eval "$2"
 1085     eval "$1+=\\ \$func_quote_for_eval_result"
 1086   }'
 1087 else
 1088   func_append_quoted ()
 1089   {
 1090     $debug_cmd
 1091 
 1092     func_quote_for_eval "$2"
 1093     eval "$1=\$$1\\ \$func_quote_for_eval_result"
 1094   }
 1095 fi
 1096 
 1097 
 1098 # func_append_uniq VAR VALUE
 1099 # --------------------------
 1100 # Append unique VALUE onto the existing contents of VAR, assuming
 1101 # entries are delimited by the first character of VALUE.  For example:
 1102 #
 1103 #   func_append_uniq options " --another-option option-argument"
 1104 #
 1105 # will only append to $options if " --another-option option-argument "
 1106 # is not already present somewhere in $options already (note spaces at
 1107 # each end implied by leading space in second argument).
 1108 func_append_uniq ()
 1109 {
 1110     $debug_cmd
 1111 
 1112     eval _G_current_value='`$ECHO $'$1'`'
 1113     _G_delim=`expr "$2" : '\(.\)'`
 1114 
 1115     case $_G_delim$_G_current_value$_G_delim in
 1116       *"$2$_G_delim"*) ;;
 1117       *) func_append "$@" ;;
 1118     esac
 1119 }
 1120 
 1121 
 1122 # func_arith TERM...
 1123 # ------------------
 1124 # Set func_arith_result to the result of evaluating TERMs.
 1125   test -z "$_G_HAVE_ARITH_OP" \
 1126     && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
 1127     && _G_HAVE_ARITH_OP=yes
 1128 
 1129 if test yes = "$_G_HAVE_ARITH_OP"; then
 1130   eval 'func_arith ()
 1131   {
 1132     $debug_cmd
 1133 
 1134     func_arith_result=$(( $* ))
 1135   }'
 1136 else
 1137   func_arith ()
 1138   {
 1139     $debug_cmd
 1140 
 1141     func_arith_result=`expr "$@"`
 1142   }
 1143 fi
 1144 
 1145 
 1146 # func_basename FILE
 1147 # ------------------
 1148 # Set func_basename_result to FILE with everything up to and including
 1149 # the last / stripped.
 1150 if test yes = "$_G_HAVE_XSI_OPS"; then
 1151   # If this shell supports suffix pattern removal, then use it to avoid
 1152   # forking. Hide the definitions single quotes in case the shell chokes
 1153   # on unsupported syntax...
 1154   _b='func_basename_result=${1##*/}'
 1155   _d='case $1 in
 1156         */*) func_dirname_result=${1%/*}$2 ;;
 1157         *  ) func_dirname_result=$3        ;;
 1158       esac'
 1159 
 1160 else
 1161   # ...otherwise fall back to using sed.
 1162   _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
 1163   _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
 1164       if test "X$func_dirname_result" = "X$1"; then
 1165         func_dirname_result=$3
 1166       else
 1167         func_append func_dirname_result "$2"
 1168       fi'
 1169 fi
 1170 
 1171 eval 'func_basename ()
 1172 {
 1173     $debug_cmd
 1174 
 1175     '"$_b"'
 1176 }'
 1177 
 1178 
 1179 # func_dirname FILE APPEND NONDIR_REPLACEMENT
 1180 # -------------------------------------------
 1181 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
 1182 # otherwise set result to NONDIR_REPLACEMENT.
 1183 eval 'func_dirname ()
 1184 {
 1185     $debug_cmd
 1186 
 1187     '"$_d"'
 1188 }'
 1189 
 1190 
 1191 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
 1192 # --------------------------------------------------------
 1193 # Perform func_basename and func_dirname in a single function
 1194 # call:
 1195 #   dirname:  Compute the dirname of FILE.  If nonempty,
 1196 #             add APPEND to the result, otherwise set result
 1197 #             to NONDIR_REPLACEMENT.
 1198 #             value returned in "$func_dirname_result"
 1199 #   basename: Compute filename of FILE.
 1200 #             value retuned in "$func_basename_result"
 1201 # For efficiency, we do not delegate to the functions above but instead
 1202 # duplicate the functionality here.
 1203 eval 'func_dirname_and_basename ()
 1204 {
 1205     $debug_cmd
 1206 
 1207     '"$_b"'
 1208     '"$_d"'
 1209 }'
 1210 
 1211 
 1212 # func_echo ARG...
 1213 # ----------------
 1214 # Echo program name prefixed message.
 1215 func_echo ()
 1216 {
 1217     $debug_cmd
 1218 
 1219     _G_message=$*
 1220 
 1221     func_echo_IFS=$IFS
 1222     IFS=$nl
 1223     for _G_line in $_G_message; do
 1224       IFS=$func_echo_IFS
 1225       $ECHO "$progname: $_G_line"
 1226     done
 1227     IFS=$func_echo_IFS
 1228 }
 1229 
 1230 
 1231 # func_echo_all ARG...
 1232 # --------------------
 1233 # Invoke $ECHO with all args, space-separated.
 1234 func_echo_all ()
 1235 {
 1236     $ECHO "$*"
 1237 }
 1238 
 1239 
 1240 # func_echo_infix_1 INFIX ARG...
 1241 # ------------------------------
 1242 # Echo program name, followed by INFIX on the first line, with any
 1243 # additional lines not showing INFIX.
 1244 func_echo_infix_1 ()
 1245 {
 1246     $debug_cmd
 1247 
 1248     $require_term_colors
 1249 
 1250     _G_infix=$1; shift
 1251     _G_indent=$_G_infix
 1252     _G_prefix="$progname: $_G_infix: "
 1253     _G_message=$*
 1254 
 1255     # Strip color escape sequences before counting printable length
 1256     for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
 1257     do
 1258       test -n "$_G_tc" && {
 1259         _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
 1260         _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
 1261       }
 1262     done
 1263     _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 1264 
 1265     func_echo_infix_1_IFS=$IFS
 1266     IFS=$nl
 1267     for _G_line in $_G_message; do
 1268       IFS=$func_echo_infix_1_IFS
 1269       $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
 1270       _G_prefix=$_G_indent
 1271     done
 1272     IFS=$func_echo_infix_1_IFS
 1273 }
 1274 
 1275 
 1276 # func_error ARG...
 1277 # -----------------
 1278 # Echo program name prefixed message to standard error.
 1279 func_error ()
 1280 {
 1281     $debug_cmd
 1282 
 1283     $require_term_colors
 1284 
 1285     func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
 1286 }
 1287 
 1288 
 1289 # func_fatal_error ARG...
 1290 # -----------------------
 1291 # Echo program name prefixed message to standard error, and exit.
 1292 func_fatal_error ()
 1293 {
 1294     $debug_cmd
 1295 
 1296     func_error "$*"
 1297     exit $EXIT_FAILURE
 1298 }
 1299 
 1300 
 1301 # func_grep EXPRESSION FILENAME
 1302 # -----------------------------
 1303 # Check whether EXPRESSION matches any line of FILENAME, without output.
 1304 func_grep ()
 1305 {
 1306     $debug_cmd
 1307 
 1308     $GREP "$1" "$2" >/dev/null 2>&1
 1309 }
 1310 
 1311 
 1312 # func_len STRING
 1313 # ---------------
 1314 # Set func_len_result to the length of STRING. STRING may not
 1315 # start with a hyphen.
 1316   test -z "$_G_HAVE_XSI_OPS" \
 1317     && (eval 'x=a/b/c;
 1318       test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 1319     && _G_HAVE_XSI_OPS=yes
 1320 
 1321 if test yes = "$_G_HAVE_XSI_OPS"; then
 1322   eval 'func_len ()
 1323   {
 1324     $debug_cmd
 1325 
 1326     func_len_result=${#1}
 1327   }'
 1328 else
 1329   func_len ()
 1330   {
 1331     $debug_cmd
 1332 
 1333     func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
 1334   }
 1335 fi
 1336 
 1337 
 1338 # func_mkdir_p DIRECTORY-PATH
 1339 # ---------------------------
 1340 # Make sure the entire path to DIRECTORY-PATH is available.
 1341 func_mkdir_p ()
 1342 {
 1343     $debug_cmd
 1344 
 1345     _G_directory_path=$1
 1346     _G_dir_list=
 1347 
 1348     if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
 1349 
 1350       # Protect directory names starting with '-'
 1351       case $_G_directory_path in
 1352         -*) _G_directory_path=./$_G_directory_path ;;
 1353       esac
 1354 
 1355       # While some portion of DIR does not yet exist...
 1356       while test ! -d "$_G_directory_path"; do
 1357         # ...make a list in topmost first order.  Use a colon delimited
 1358     # list incase some portion of path contains whitespace.
 1359         _G_dir_list=$_G_directory_path:$_G_dir_list
 1360 
 1361         # If the last portion added has no slash in it, the list is done
 1362         case $_G_directory_path in */*) ;; *) break ;; esac
 1363 
 1364         # ...otherwise throw away the child directory and loop
 1365         _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
 1366       done
 1367       _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
 1368 
 1369       func_mkdir_p_IFS=$IFS; IFS=:
 1370       for _G_dir in $_G_dir_list; do
 1371     IFS=$func_mkdir_p_IFS
 1372         # mkdir can fail with a 'File exist' error if two processes
 1373         # try to create one of the directories concurrently.  Don't
 1374         # stop in that case!
 1375         $MKDIR "$_G_dir" 2>/dev/null || :
 1376       done
 1377       IFS=$func_mkdir_p_IFS
 1378 
 1379       # Bail out if we (or some other process) failed to create a directory.
 1380       test -d "$_G_directory_path" || \
 1381         func_fatal_error "Failed to create '$1'"
 1382     fi
 1383 }
 1384 
 1385 
 1386 # func_mktempdir [BASENAME]
 1387 # -------------------------
 1388 # Make a temporary directory that won't clash with other running
 1389 # libtool processes, and avoids race conditions if possible.  If
 1390 # given, BASENAME is the basename for that directory.
 1391 func_mktempdir ()
 1392 {
 1393     $debug_cmd
 1394 
 1395     _G_template=${TMPDIR-/tmp}/${1-$progname}
 1396 
 1397     if test : = "$opt_dry_run"; then
 1398       # Return a directory name, but don't create it in dry-run mode
 1399       _G_tmpdir=$_G_template-$$
 1400     else
 1401 
 1402       # If mktemp works, use that first and foremost
 1403       _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
 1404 
 1405       if test ! -d "$_G_tmpdir"; then
 1406         # Failing that, at least try and use $RANDOM to avoid a race
 1407         _G_tmpdir=$_G_template-${RANDOM-0}$$
 1408 
 1409         func_mktempdir_umask=`umask`
 1410         umask 0077
 1411         $MKDIR "$_G_tmpdir"
 1412         umask $func_mktempdir_umask
 1413       fi
 1414 
 1415       # If we're not in dry-run mode, bomb out on failure
 1416       test -d "$_G_tmpdir" || \
 1417         func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
 1418     fi
 1419 
 1420     $ECHO "$_G_tmpdir"
 1421 }
 1422 
 1423 
 1424 # func_normal_abspath PATH
 1425 # ------------------------
 1426 # Remove doubled-up and trailing slashes, "." path components,
 1427 # and cancel out any ".." path components in PATH after making
 1428 # it an absolute path.
 1429 func_normal_abspath ()
 1430 {
 1431     $debug_cmd
 1432 
 1433     # These SED scripts presuppose an absolute path with a trailing slash.
 1434     _G_pathcar='s|^/\([^/]*\).*$|\1|'
 1435     _G_pathcdr='s|^/[^/]*||'
 1436     _G_removedotparts=':dotsl
 1437         s|/\./|/|g
 1438         t dotsl
 1439         s|/\.$|/|'
 1440     _G_collapseslashes='s|/\{1,\}|/|g'
 1441     _G_finalslash='s|/*$|/|'
 1442 
 1443     # Start from root dir and reassemble the path.
 1444     func_normal_abspath_result=
 1445     func_normal_abspath_tpath=$1
 1446     func_normal_abspath_altnamespace=
 1447     case $func_normal_abspath_tpath in
 1448       "")
 1449         # Empty path, that just means $cwd.
 1450         func_stripname '' '/' "`pwd`"
 1451         func_normal_abspath_result=$func_stripname_result
 1452         return
 1453         ;;
 1454       # The next three entries are used to spot a run of precisely
 1455       # two leading slashes without using negated character classes;
 1456       # we take advantage of case's first-match behaviour.
 1457       ///*)
 1458         # Unusual form of absolute path, do nothing.
 1459         ;;
 1460       //*)
 1461         # Not necessarily an ordinary path; POSIX reserves leading '//'
 1462         # and for example Cygwin uses it to access remote file shares
 1463         # over CIFS/SMB, so we conserve a leading double slash if found.
 1464         func_normal_abspath_altnamespace=/
 1465         ;;
 1466       /*)
 1467         # Absolute path, do nothing.
 1468         ;;
 1469       *)
 1470         # Relative path, prepend $cwd.
 1471         func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
 1472         ;;
 1473     esac
 1474 
 1475     # Cancel out all the simple stuff to save iterations.  We also want
 1476     # the path to end with a slash for ease of parsing, so make sure
 1477     # there is one (and only one) here.
 1478     func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 1479           -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
 1480     while :; do
 1481       # Processed it all yet?
 1482       if test / = "$func_normal_abspath_tpath"; then
 1483         # If we ascended to the root using ".." the result may be empty now.
 1484         if test -z "$func_normal_abspath_result"; then
 1485           func_normal_abspath_result=/
 1486         fi
 1487         break
 1488       fi
 1489       func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
 1490           -e "$_G_pathcar"`
 1491       func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 1492           -e "$_G_pathcdr"`
 1493       # Figure out what to do with it
 1494       case $func_normal_abspath_tcomponent in
 1495         "")
 1496           # Trailing empty path component, ignore it.
 1497           ;;
 1498         ..)
 1499           # Parent dir; strip last assembled component from result.
 1500           func_dirname "$func_normal_abspath_result"
 1501           func_normal_abspath_result=$func_dirname_result
 1502           ;;
 1503         *)
 1504           # Actual path component, append it.
 1505           func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
 1506           ;;
 1507       esac
 1508     done
 1509     # Restore leading double-slash if one was found on entry.
 1510     func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 1511 }
 1512 
 1513 
 1514 # func_notquiet ARG...
 1515 # --------------------
 1516 # Echo program name prefixed message only when not in quiet mode.
 1517 func_notquiet ()
 1518 {
 1519     $debug_cmd
 1520 
 1521     $opt_quiet || func_echo ${1+"$@"}
 1522 
 1523     # A bug in bash halts the script if the last line of a function
 1524     # fails when set -e is in force, so we need another command to
 1525     # work around that:
 1526     :
 1527 }
 1528 
 1529 
 1530 # func_relative_path SRCDIR DSTDIR
 1531 # --------------------------------
 1532 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
 1533 func_relative_path ()
 1534 {
 1535     $debug_cmd
 1536 
 1537     func_relative_path_result=
 1538     func_normal_abspath "$1"
 1539     func_relative_path_tlibdir=$func_normal_abspath_result
 1540     func_normal_abspath "$2"
 1541     func_relative_path_tbindir=$func_normal_abspath_result
 1542 
 1543     # Ascend the tree starting from libdir
 1544     while :; do
 1545       # check if we have found a prefix of bindir
 1546       case $func_relative_path_tbindir in
 1547         $func_relative_path_tlibdir)
 1548           # found an exact match
 1549           func_relative_path_tcancelled=
 1550           break
 1551           ;;
 1552         $func_relative_path_tlibdir*)
 1553           # found a matching prefix
 1554           func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
 1555           func_relative_path_tcancelled=$func_stripname_result
 1556           if test -z "$func_relative_path_result"; then
 1557             func_relative_path_result=.
 1558           fi
 1559           break
 1560           ;;
 1561         *)
 1562           func_dirname $func_relative_path_tlibdir
 1563           func_relative_path_tlibdir=$func_dirname_result
 1564           if test -z "$func_relative_path_tlibdir"; then
 1565             # Have to descend all the way to the root!
 1566             func_relative_path_result=../$func_relative_path_result
 1567             func_relative_path_tcancelled=$func_relative_path_tbindir
 1568             break
 1569           fi
 1570           func_relative_path_result=../$func_relative_path_result
 1571           ;;
 1572       esac
 1573     done
 1574 
 1575     # Now calculate path; take care to avoid doubling-up slashes.
 1576     func_stripname '' '/' "$func_relative_path_result"
 1577     func_relative_path_result=$func_stripname_result
 1578     func_stripname '/' '/' "$func_relative_path_tcancelled"
 1579     if test -n "$func_stripname_result"; then
 1580       func_append func_relative_path_result "/$func_stripname_result"
 1581     fi
 1582 
 1583     # Normalisation. If bindir is libdir, return '.' else relative path.
 1584     if test -n "$func_relative_path_result"; then
 1585       func_stripname './' '' "$func_relative_path_result"
 1586       func_relative_path_result=$func_stripname_result
 1587     fi
 1588 
 1589     test -n "$func_relative_path_result" || func_relative_path_result=.
 1590 
 1591     :
 1592 }
 1593 
 1594 
 1595 # func_quote_for_eval ARG...
 1596 # --------------------------
 1597 # Aesthetically quote ARGs to be evaled later.
 1598 # This function returns two values:
 1599 #   i) func_quote_for_eval_result
 1600 #      double-quoted, suitable for a subsequent eval
 1601 #  ii) func_quote_for_eval_unquoted_result
 1602 #      has all characters that are still active within double
 1603 #      quotes backslashified.
 1604 func_quote_for_eval ()
 1605 {
 1606     $debug_cmd
 1607 
 1608     func_quote_for_eval_unquoted_result=
 1609     func_quote_for_eval_result=
 1610     while test 0 -lt $#; do
 1611       case $1 in
 1612         *[\\\`\"\$]*)
 1613       _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
 1614         *)
 1615           _G_unquoted_arg=$1 ;;
 1616       esac
 1617       if test -n "$func_quote_for_eval_unquoted_result"; then
 1618     func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
 1619       else
 1620         func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
 1621       fi
 1622 
 1623       case $_G_unquoted_arg in
 1624         # Double-quote args containing shell metacharacters to delay
 1625         # word splitting, command substitution and variable expansion
 1626         # for a subsequent eval.
 1627         # Many Bourne shells cannot handle close brackets correctly
 1628         # in scan sets, so we specify it separately.
 1629         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 1630           _G_quoted_arg=\"$_G_unquoted_arg\"
 1631           ;;
 1632         *)
 1633           _G_quoted_arg=$_G_unquoted_arg
 1634       ;;
 1635       esac
 1636 
 1637       if test -n "$func_quote_for_eval_result"; then
 1638     func_append func_quote_for_eval_result " $_G_quoted_arg"
 1639       else
 1640         func_append func_quote_for_eval_result "$_G_quoted_arg"
 1641       fi
 1642       shift
 1643     done
 1644 }
 1645 
 1646 
 1647 # func_quote_for_expand ARG
 1648 # -------------------------
 1649 # Aesthetically quote ARG to be evaled later; same as above,
 1650 # but do not quote variable references.
 1651 func_quote_for_expand ()
 1652 {
 1653     $debug_cmd
 1654 
 1655     case $1 in
 1656       *[\\\`\"]*)
 1657     _G_arg=`$ECHO "$1" | $SED \
 1658         -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
 1659       *)
 1660         _G_arg=$1 ;;
 1661     esac
 1662 
 1663     case $_G_arg in
 1664       # Double-quote args containing shell metacharacters to delay
 1665       # word splitting and command substitution for a subsequent eval.
 1666       # Many Bourne shells cannot handle close brackets correctly
 1667       # in scan sets, so we specify it separately.
 1668       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 1669         _G_arg=\"$_G_arg\"
 1670         ;;
 1671     esac
 1672 
 1673     func_quote_for_expand_result=$_G_arg
 1674 }
 1675 
 1676 
 1677 # func_stripname PREFIX SUFFIX NAME
 1678 # ---------------------------------
 1679 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
 1680 # PREFIX and SUFFIX must not contain globbing or regex special
 1681 # characters, hashes, percent signs, but SUFFIX may contain a leading
 1682 # dot (in which case that matches only a dot).
 1683 if test yes = "$_G_HAVE_XSI_OPS"; then
 1684   eval 'func_stripname ()
 1685   {
 1686     $debug_cmd
 1687 
 1688     # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
 1689     # positional parameters, so assign one to ordinary variable first.
 1690     func_stripname_result=$3
 1691     func_stripname_result=${func_stripname_result#"$1"}
 1692     func_stripname_result=${func_stripname_result%"$2"}
 1693   }'
 1694 else
 1695   func_stripname ()
 1696   {
 1697     $debug_cmd
 1698 
 1699     case $2 in
 1700       .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
 1701       *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
 1702     esac
 1703   }
 1704 fi
 1705 
 1706 
 1707 # func_show_eval CMD [FAIL_EXP]
 1708 # -----------------------------
 1709 # Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
 1710 # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 1711 # is given, then evaluate it.
 1712 func_show_eval ()
 1713 {
 1714     $debug_cmd
 1715 
 1716     _G_cmd=$1
 1717     _G_fail_exp=${2-':'}
 1718 
 1719     func_quote_for_expand "$_G_cmd"
 1720     eval "func_notquiet $func_quote_for_expand_result"
 1721 
 1722     $opt_dry_run || {
 1723       eval "$_G_cmd"
 1724       _G_status=$?
 1725       if test 0 -ne "$_G_status"; then
 1726     eval "(exit $_G_status); $_G_fail_exp"
 1727       fi
 1728     }
 1729 }
 1730 
 1731 
 1732 # func_show_eval_locale CMD [FAIL_EXP]
 1733 # ------------------------------------
 1734 # Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
 1735 # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 1736 # is given, then evaluate it.  Use the saved locale for evaluation.
 1737 func_show_eval_locale ()
 1738 {
 1739     $debug_cmd
 1740 
 1741     _G_cmd=$1
 1742     _G_fail_exp=${2-':'}
 1743 
 1744     $opt_quiet || {
 1745       func_quote_for_expand "$_G_cmd"
 1746       eval "func_echo $func_quote_for_expand_result"
 1747     }
 1748 
 1749     $opt_dry_run || {
 1750       eval "$_G_user_locale
 1751         $_G_cmd"
 1752       _G_status=$?
 1753       eval "$_G_safe_locale"
 1754       if test 0 -ne "$_G_status"; then
 1755     eval "(exit $_G_status); $_G_fail_exp"
 1756       fi
 1757     }
 1758 }
 1759 
 1760 
 1761 # func_tr_sh
 1762 # ----------
 1763 # Turn $1 into a string suitable for a shell variable name.
 1764 # Result is stored in $func_tr_sh_result.  All characters
 1765 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
 1766 # if $1 begins with a digit, a '_' is prepended as well.
 1767 func_tr_sh ()
 1768 {
 1769     $debug_cmd
 1770 
 1771     case $1 in
 1772     [0-9]* | *[!a-zA-Z0-9_]*)
 1773       func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
 1774       ;;
 1775     * )
 1776       func_tr_sh_result=$1
 1777       ;;
 1778     esac
 1779 }
 1780 
 1781 
 1782 # func_verbose ARG...
 1783 # -------------------
 1784 # Echo program name prefixed message in verbose mode only.
 1785 func_verbose ()
 1786 {
 1787     $debug_cmd
 1788 
 1789     $opt_verbose && func_echo "$*"
 1790 
 1791     :
 1792 }
 1793 
 1794 
 1795 # func_warn_and_continue ARG...
 1796 # -----------------------------
 1797 # Echo program name prefixed warning message to standard error.
 1798 func_warn_and_continue ()
 1799 {
 1800     $debug_cmd
 1801 
 1802     $require_term_colors
 1803 
 1804     func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
 1805 }
 1806 
 1807 
 1808 # func_warning CATEGORY ARG...
 1809 # ----------------------------
 1810 # Echo program name prefixed warning message to standard error. Warning
 1811 # messages can be filtered according to CATEGORY, where this function
 1812 # elides messages where CATEGORY is not listed in the global variable
 1813 # 'opt_warning_types'.
 1814 func_warning ()
 1815 {
 1816     $debug_cmd
 1817 
 1818     # CATEGORY must be in the warning_categories list!
 1819     case " $warning_categories " in
 1820       *" $1 "*) ;;
 1821       *) func_internal_error "invalid warning category '$1'" ;;
 1822     esac
 1823 
 1824     _G_category=$1
 1825     shift
 1826 
 1827     case " $opt_warning_types " in
 1828       *" $_G_category "*) $warning_func ${1+"$@"} ;;
 1829     esac
 1830 }
 1831 
 1832 
 1833 # func_sort_ver VER1 VER2
 1834 # -----------------------
 1835 # 'sort -V' is not generally available.
 1836 # Note this deviates from the version comparison in automake
 1837 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
 1838 # but this should suffice as we won't be specifying old
 1839 # version formats or redundant trailing .0 in bootstrap.conf.
 1840 # If we did want full compatibility then we should probably
 1841 # use m4_version_compare from autoconf.
 1842 func_sort_ver ()
 1843 {
 1844     $debug_cmd
 1845 
 1846     printf '%s\n%s\n' "$1" "$2" \
 1847       | 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
 1848 }
 1849 
 1850 # func_lt_ver PREV CURR
 1851 # ---------------------
 1852 # Return true if PREV and CURR are in the correct order according to
 1853 # func_sort_ver, otherwise false.  Use it like this:
 1854 #
 1855 #  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
 1856 func_lt_ver ()
 1857 {
 1858     $debug_cmd
 1859 
 1860     test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
 1861 }
 1862 
 1863 
 1864 # Local variables:
 1865 # mode: shell-script
 1866 # sh-indentation: 2
 1867 # eval: (add-hook 'before-save-hook 'time-stamp)
 1868 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 1869 # time-stamp-time-zone: "UTC"
 1870 # End:
 1871 #! /bin/sh
 1872 
 1873 # Set a version string for this script.
 1874 scriptversion=2014-01-07.03; # UTC
 1875 
 1876 # A portable, pluggable option parser for Bourne shell.
 1877 # Written by Gary V. Vaughan, 2010
 1878 
 1879 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
 1880 # This is free software; see the source for copying conditions.  There is NO
 1881 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 1882 
 1883 # This program is free software: you can redistribute it and/or modify
 1884 # it under the terms of the GNU General Public License as published by
 1885 # the Free Software Foundation, either version 3 of the License, or
 1886 # (at your option) any later version.
 1887 
 1888 # This program is distributed in the hope that it will be useful,
 1889 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 1890 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 1891 # GNU General Public License for more details.
 1892 
 1893 # You should have received a copy of the GNU General Public License
 1894 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 1895 
 1896 # Please report bugs or propose patches to gary@gnu.org.
 1897 
 1898 
 1899 ## ------ ##
 1900 ## Usage. ##
 1901 ## ------ ##
 1902 
 1903 # This file is a library for parsing options in your shell scripts along
 1904 # with assorted other useful supporting features that you can make use
 1905 # of too.
 1906 #
 1907 # For the simplest scripts you might need only:
 1908 #
 1909 #   #!/bin/sh
 1910 #   . relative/path/to/funclib.sh
 1911 #   . relative/path/to/options-parser
 1912 #   scriptversion=1.0
 1913 #   func_options ${1+"$@"}
 1914 #   eval set dummy "$func_options_result"; shift
 1915 #   ...rest of your script...
 1916 #
 1917 # In order for the '--version' option to work, you will need to have a
 1918 # suitably formatted comment like the one at the top of this file
 1919 # starting with '# Written by ' and ending with '# warranty; '.
 1920 #
 1921 # For '-h' and '--help' to work, you will also need a one line
 1922 # description of your script's purpose in a comment directly above the
 1923 # '# Written by ' line, like the one at the top of this file.
 1924 #
 1925 # The default options also support '--debug', which will turn on shell
 1926 # execution tracing (see the comment above debug_cmd below for another
 1927 # use), and '--verbose' and the func_verbose function to allow your script
 1928 # to display verbose messages only when your user has specified
 1929 # '--verbose'.
 1930 #
 1931 # After sourcing this file, you can plug processing for additional
 1932 # options by amending the variables from the 'Configuration' section
 1933 # below, and following the instructions in the 'Option parsing'
 1934 # section further down.
 1935 
 1936 ## -------------- ##
 1937 ## Configuration. ##
 1938 ## -------------- ##
 1939 
 1940 # You should override these variables in your script after sourcing this
 1941 # file so that they reflect the customisations you have added to the
 1942 # option parser.
 1943 
 1944 # The usage line for option parsing errors and the start of '-h' and
 1945 # '--help' output messages. You can embed shell variables for delayed
 1946 # expansion at the time the message is displayed, but you will need to
 1947 # quote other shell meta-characters carefully to prevent them being
 1948 # expanded when the contents are evaled.
 1949 usage='$progpath [OPTION]...'
 1950 
 1951 # Short help message in response to '-h' and '--help'.  Add to this or
 1952 # override it after sourcing this library to reflect the full set of
 1953 # options your script accepts.
 1954 usage_message="\
 1955        --debug        enable verbose shell tracing
 1956    -W, --warnings=CATEGORY
 1957                       report the warnings falling in CATEGORY [all]
 1958    -v, --verbose      verbosely report processing
 1959        --version      print version information and exit
 1960    -h, --help         print short or long help message and exit
 1961 "
 1962 
 1963 # Additional text appended to 'usage_message' in response to '--help'.
 1964 long_help_message="
 1965 Warning categories include:
 1966        'all'          show all warnings
 1967        'none'         turn off all the warnings
 1968        'error'        warnings are treated as fatal errors"
 1969 
 1970 # Help message printed before fatal option parsing errors.
 1971 fatal_help="Try '\$progname --help' for more information."
 1972 
 1973 
 1974 
 1975 ## ------------------------- ##
 1976 ## Hook function management. ##
 1977 ## ------------------------- ##
 1978 
 1979 # This section contains functions for adding, removing, and running hooks
 1980 # to the main code.  A hook is just a named list of of function, that can
 1981 # be run in order later on.
 1982 
 1983 # func_hookable FUNC_NAME
 1984 # -----------------------
 1985 # Declare that FUNC_NAME will run hooks added with
 1986 # 'func_add_hook FUNC_NAME ...'.
 1987 func_hookable ()
 1988 {
 1989     $debug_cmd
 1990 
 1991     func_append hookable_fns " $1"
 1992 }
 1993 
 1994 
 1995 # func_add_hook FUNC_NAME HOOK_FUNC
 1996 # ---------------------------------
 1997 # Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
 1998 # first have been declared "hookable" by a call to 'func_hookable'.
 1999 func_add_hook ()
 2000 {
 2001     $debug_cmd
 2002 
 2003     case " $hookable_fns " in
 2004       *" $1 "*) ;;
 2005       *) func_fatal_error "'$1' does not accept hook functions." ;;
 2006     esac
 2007 
 2008     eval func_append ${1}_hooks '" $2"'
 2009 }
 2010 
 2011 
 2012 # func_remove_hook FUNC_NAME HOOK_FUNC
 2013 # ------------------------------------
 2014 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
 2015 func_remove_hook ()
 2016 {
 2017     $debug_cmd
 2018 
 2019     eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
 2020 }
 2021 
 2022 
 2023 # func_run_hooks FUNC_NAME [ARG]...
 2024 # ---------------------------------
 2025 # Run all hook functions registered to FUNC_NAME.
 2026 # It is assumed that the list of hook functions contains nothing more
 2027 # than a whitespace-delimited list of legal shell function names, and
 2028 # no effort is wasted trying to catch shell meta-characters or preserve
 2029 # whitespace.
 2030 func_run_hooks ()
 2031 {
 2032     $debug_cmd
 2033 
 2034     case " $hookable_fns " in
 2035       *" $1 "*) ;;
 2036       *) func_fatal_error "'$1' does not support hook funcions.n" ;;
 2037     esac
 2038 
 2039     eval _G_hook_fns=\$$1_hooks; shift
 2040 
 2041     for _G_hook in $_G_hook_fns; do
 2042       eval $_G_hook '"$@"'
 2043 
 2044       # store returned options list back into positional
 2045       # parameters for next 'cmd' execution.
 2046       eval _G_hook_result=\$${_G_hook}_result
 2047       eval set dummy "$_G_hook_result"; shift
 2048     done
 2049 
 2050     func_quote_for_eval ${1+"$@"}
 2051     func_run_hooks_result=$func_quote_for_eval_result
 2052 }
 2053 
 2054 
 2055 
 2056 ## --------------- ##
 2057 ## Option parsing. ##
 2058 ## --------------- ##
 2059 
 2060 # In order to add your own option parsing hooks, you must accept the
 2061 # full positional parameter list in your hook function, remove any
 2062 # options that you action, and then pass back the remaining unprocessed
 2063 # options in '<hooked_function_name>_result', escaped suitably for
 2064 # 'eval'.  Like this:
 2065 #
 2066 #    my_options_prep ()
 2067 #    {
 2068 #        $debug_cmd
 2069 #
 2070 #        # Extend the existing usage message.
 2071 #        usage_message=$usage_message'
 2072 #      -s, --silent       don'\''t print informational messages
 2073 #    '
 2074 #
 2075 #        func_quote_for_eval ${1+"$@"}
 2076 #        my_options_prep_result=$func_quote_for_eval_result
 2077 #    }
 2078 #    func_add_hook func_options_prep my_options_prep
 2079 #
 2080 #
 2081 #    my_silent_option ()
 2082 #    {
 2083 #        $debug_cmd
 2084 #
 2085 #        # Note that for efficiency, we parse as many options as we can
 2086 #        # recognise in a loop before passing the remainder back to the
 2087 #        # caller on the first unrecognised argument we encounter.
 2088 #        while test $# -gt 0; do
 2089 #          opt=$1; shift
 2090 #          case $opt in
 2091 #            --silent|-s) opt_silent=: ;;
 2092 #            # Separate non-argument short options:
 2093 #            -s*)         func_split_short_opt "$_G_opt"
 2094 #                         set dummy "$func_split_short_opt_name" \
 2095 #                             "-$func_split_short_opt_arg" ${1+"$@"}
 2096 #                         shift
 2097 #                         ;;
 2098 #            *)            set dummy "$_G_opt" "$*"; shift; break ;;
 2099 #          esac
 2100 #        done
 2101 #
 2102 #        func_quote_for_eval ${1+"$@"}
 2103 #        my_silent_option_result=$func_quote_for_eval_result
 2104 #    }
 2105 #    func_add_hook func_parse_options my_silent_option
 2106 #
 2107 #
 2108 #    my_option_validation ()
 2109 #    {
 2110 #        $debug_cmd
 2111 #
 2112 #        $opt_silent && $opt_verbose && func_fatal_help "\
 2113 #    '--silent' and '--verbose' options are mutually exclusive."
 2114 #
 2115 #        func_quote_for_eval ${1+"$@"}
 2116 #        my_option_validation_result=$func_quote_for_eval_result
 2117 #    }
 2118 #    func_add_hook func_validate_options my_option_validation
 2119 #
 2120 # You'll alse need to manually amend $usage_message to reflect the extra
 2121 # options you parse.  It's preferable to append if you can, so that
 2122 # multiple option parsing hooks can be added safely.
 2123 
 2124 
 2125 # func_options [ARG]...
 2126 # ---------------------
 2127 # All the functions called inside func_options are hookable. See the
 2128 # individual implementations for details.
 2129 func_hookable func_options
 2130 func_options ()
 2131 {
 2132     $debug_cmd
 2133 
 2134     func_options_prep ${1+"$@"}
 2135     eval func_parse_options \
 2136         ${func_options_prep_result+"$func_options_prep_result"}
 2137     eval func_validate_options \
 2138         ${func_parse_options_result+"$func_parse_options_result"}
 2139 
 2140     eval func_run_hooks func_options \
 2141         ${func_validate_options_result+"$func_validate_options_result"}
 2142 
 2143     # save modified positional parameters for caller
 2144     func_options_result=$func_run_hooks_result
 2145 }
 2146 
 2147 
 2148 # func_options_prep [ARG]...
 2149 # --------------------------
 2150 # All initialisations required before starting the option parse loop.
 2151 # Note that when calling hook functions, we pass through the list of
 2152 # positional parameters.  If a hook function modifies that list, and
 2153 # needs to propogate that back to rest of this script, then the complete
 2154 # modified list must be put in 'func_run_hooks_result' before
 2155 # returning.
 2156 func_hookable func_options_prep
 2157 func_options_prep ()
 2158 {
 2159     $debug_cmd
 2160 
 2161     # Option defaults:
 2162     opt_verbose=false
 2163     opt_warning_types=
 2164 
 2165     func_run_hooks func_options_prep ${1+"$@"}
 2166 
 2167     # save modified positional parameters for caller
 2168     func_options_prep_result=$func_run_hooks_result
 2169 }
 2170 
 2171 
 2172 # func_parse_options [ARG]...
 2173 # ---------------------------
 2174 # The main option parsing loop.
 2175 func_hookable func_parse_options
 2176 func_parse_options ()
 2177 {
 2178     $debug_cmd
 2179 
 2180     func_parse_options_result=
 2181 
 2182     # this just eases exit handling
 2183     while test $# -gt 0; do
 2184       # Defer to hook functions for initial option parsing, so they
 2185       # get priority in the event of reusing an option name.
 2186       func_run_hooks func_parse_options ${1+"$@"}
 2187 
 2188       # Adjust func_parse_options positional parameters to match
 2189       eval set dummy "$func_run_hooks_result"; shift
 2190 
 2191       # Break out of the loop if we already parsed every option.
 2192       test $# -gt 0 || break
 2193 
 2194       _G_opt=$1
 2195       shift
 2196       case $_G_opt in
 2197         --debug|-x)   debug_cmd='set -x'
 2198                       func_echo "enabling shell trace mode"
 2199                       $debug_cmd
 2200                       ;;
 2201 
 2202         --no-warnings|--no-warning|--no-warn)
 2203                       set dummy --warnings none ${1+"$@"}
 2204                       shift
 2205               ;;
 2206 
 2207         --warnings|--warning|-W)
 2208                       test $# = 0 && func_missing_arg $_G_opt && break
 2209                       case " $warning_categories $1" in
 2210                         *" $1 "*)
 2211                           # trailing space prevents matching last $1 above
 2212                           func_append_uniq opt_warning_types " $1"
 2213                           ;;
 2214                         *all)
 2215                           opt_warning_types=$warning_categories
 2216                           ;;
 2217                         *none)
 2218                           opt_warning_types=none
 2219                           warning_func=:
 2220                           ;;
 2221                         *error)
 2222                           opt_warning_types=$warning_categories
 2223                           warning_func=func_fatal_error
 2224                           ;;
 2225                         *)
 2226                           func_fatal_error \
 2227                              "unsupported warning category: '$1'"
 2228                           ;;
 2229                       esac
 2230                       shift
 2231                       ;;
 2232 
 2233         --verbose|-v) opt_verbose=: ;;
 2234         --version)    func_version ;;
 2235         -\?|-h)       func_usage ;;
 2236         --help)       func_help ;;
 2237 
 2238     # Separate optargs to long options (plugins may need this):
 2239     --*=*)        func_split_equals "$_G_opt"
 2240                   set dummy "$func_split_equals_lhs" \
 2241                           "$func_split_equals_rhs" ${1+"$@"}
 2242                       shift
 2243                       ;;
 2244 
 2245        # Separate optargs to short options:
 2246         -W*)
 2247                       func_split_short_opt "$_G_opt"
 2248                       set dummy "$func_split_short_opt_name" \
 2249                           "$func_split_short_opt_arg" ${1+"$@"}
 2250                       shift
 2251                       ;;
 2252 
 2253         # Separate non-argument short options:
 2254         -\?*|-h*|-v*|-x*)
 2255                       func_split_short_opt "$_G_opt"
 2256                       set dummy "$func_split_short_opt_name" \
 2257                           "-$func_split_short_opt_arg" ${1+"$@"}
 2258                       shift
 2259                       ;;
 2260 
 2261         --)           break ;;
 2262         -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
 2263         *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
 2264       esac
 2265     done
 2266 
 2267     # save modified positional parameters for caller
 2268     func_quote_for_eval ${1+"$@"}
 2269     func_parse_options_result=$func_quote_for_eval_result
 2270 }
 2271 
 2272 
 2273 # func_validate_options [ARG]...
 2274 # ------------------------------
 2275 # Perform any sanity checks on option settings and/or unconsumed
 2276 # arguments.
 2277 func_hookable func_validate_options
 2278 func_validate_options ()
 2279 {
 2280     $debug_cmd
 2281 
 2282     # Display all warnings if -W was not given.
 2283     test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
 2284 
 2285     func_run_hooks func_validate_options ${1+"$@"}
 2286 
 2287     # Bail if the options were screwed!
 2288     $exit_cmd $EXIT_FAILURE
 2289 
 2290     # save modified positional parameters for caller
 2291     func_validate_options_result=$func_run_hooks_result
 2292 }
 2293 
 2294 
 2295 
 2296 ## ----------------- ##
 2297 ## Helper functions. ##
 2298 ## ----------------- ##
 2299 
 2300 # This section contains the helper functions used by the rest of the
 2301 # hookable option parser framework in ascii-betical order.
 2302 
 2303 
 2304 # func_fatal_help ARG...
 2305 # ----------------------
 2306 # Echo program name prefixed message to standard error, followed by
 2307 # a help hint, and exit.
 2308 func_fatal_help ()
 2309 {
 2310     $debug_cmd
 2311 
 2312     eval \$ECHO \""Usage: $usage"\"
 2313     eval \$ECHO \""$fatal_help"\"
 2314     func_error ${1+"$@"}
 2315     exit $EXIT_FAILURE
 2316 }
 2317 
 2318 
 2319 # func_help
 2320 # ---------
 2321 # Echo long help message to standard output and exit.
 2322 func_help ()
 2323 {
 2324     $debug_cmd
 2325 
 2326     func_usage_message
 2327     $ECHO "$long_help_message"
 2328     exit 0
 2329 }
 2330 
 2331 
 2332 # func_missing_arg ARGNAME
 2333 # ------------------------
 2334 # Echo program name prefixed message to standard error and set global
 2335 # exit_cmd.
 2336 func_missing_arg ()
 2337 {
 2338     $debug_cmd
 2339 
 2340     func_error "Missing argument for '$1'."
 2341     exit_cmd=exit
 2342 }
 2343 
 2344 
 2345 # func_split_equals STRING
 2346 # ------------------------
 2347 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
 2348 # splitting STRING at the '=' sign.
 2349 test -z "$_G_HAVE_XSI_OPS" \
 2350     && (eval 'x=a/b/c;
 2351       test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 2352     && _G_HAVE_XSI_OPS=yes
 2353 
 2354 if test yes = "$_G_HAVE_XSI_OPS"
 2355 then
 2356   # This is an XSI compatible shell, allowing a faster implementation...
 2357   eval 'func_split_equals ()
 2358   {
 2359       $debug_cmd
 2360 
 2361       func_split_equals_lhs=${1%%=*}
 2362       func_split_equals_rhs=${1#*=}
 2363       test "x$func_split_equals_lhs" = "x$1" \
 2364         && func_split_equals_rhs=
 2365   }'
 2366 else
 2367   # ...otherwise fall back to using expr, which is often a shell builtin.
 2368   func_split_equals ()
 2369   {
 2370       $debug_cmd
 2371 
 2372       func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
 2373       func_split_equals_rhs=
 2374       test "x$func_split_equals_lhs" = "x$1" \
 2375         || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
 2376   }
 2377 fi #func_split_equals
 2378 
 2379 
 2380 # func_split_short_opt SHORTOPT
 2381 # -----------------------------
 2382 # Set func_split_short_opt_name and func_split_short_opt_arg shell
 2383 # variables after splitting SHORTOPT after the 2nd character.
 2384 if test yes = "$_G_HAVE_XSI_OPS"
 2385 then
 2386   # This is an XSI compatible shell, allowing a faster implementation...
 2387   eval 'func_split_short_opt ()
 2388   {
 2389       $debug_cmd
 2390 
 2391       func_split_short_opt_arg=${1#??}
 2392       func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
 2393   }'
 2394 else
 2395   # ...otherwise fall back to using expr, which is often a shell builtin.
 2396   func_split_short_opt ()
 2397   {
 2398       $debug_cmd
 2399 
 2400       func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
 2401       func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
 2402   }
 2403 fi #func_split_short_opt
 2404 
 2405 
 2406 # func_usage
 2407 # ----------
 2408 # Echo short help message to standard output and exit.
 2409 func_usage ()
 2410 {
 2411     $debug_cmd
 2412 
 2413     func_usage_message
 2414     $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
 2415     exit 0
 2416 }
 2417 
 2418 
 2419 # func_usage_message
 2420 # ------------------
 2421 # Echo short help message to standard output.
 2422 func_usage_message ()
 2423 {
 2424     $debug_cmd
 2425 
 2426     eval \$ECHO \""Usage: $usage"\"
 2427     echo
 2428     $SED -n 's|^# ||
 2429         /^Written by/{
 2430           x;p;x
 2431         }
 2432     h
 2433     /^Written by/q' < "$progpath"
 2434     echo
 2435     eval \$ECHO \""$usage_message"\"
 2436 }
 2437 
 2438 
 2439 # func_version
 2440 # ------------
 2441 # Echo version message to standard output and exit.
 2442 func_version ()
 2443 {
 2444     $debug_cmd
 2445 
 2446     printf '%s\n' "$progname $scriptversion"
 2447     $SED -n '
 2448         /(C)/!b go
 2449         :more
 2450         /\./!{
 2451           N
 2452           s|\n# | |
 2453           b more
 2454         }
 2455         :go
 2456         /^# Written by /,/# warranty; / {
 2457           s|^# ||
 2458           s|^# *$||
 2459           s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
 2460           p
 2461         }
 2462         /^# Written by / {
 2463           s|^# ||
 2464           p
 2465         }
 2466         /^warranty; /q' < "$progpath"
 2467 
 2468     exit $?
 2469 }
 2470 
 2471 
 2472 # Local variables:
 2473 # mode: shell-script
 2474 # sh-indentation: 2
 2475 # eval: (add-hook 'before-save-hook 'time-stamp)
 2476 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 2477 # time-stamp-time-zone: "UTC"
 2478 # End:
 2479 
 2480 # Set a version string.
 2481 scriptversion='(GNU libtool) 2.4.6'
 2482 
 2483 
 2484 # func_echo ARG...
 2485 # ----------------
 2486 # Libtool also displays the current mode in messages, so override
 2487 # funclib.sh func_echo with this custom definition.
 2488 func_echo ()
 2489 {
 2490     $debug_cmd
 2491 
 2492     _G_message=$*
 2493 
 2494     func_echo_IFS=$IFS
 2495     IFS=$nl
 2496     for _G_line in $_G_message; do
 2497       IFS=$func_echo_IFS
 2498       $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
 2499     done
 2500     IFS=$func_echo_IFS
 2501 }
 2502 
 2503 
 2504 # func_warning ARG...
 2505 # -------------------
 2506 # Libtool warnings are not categorized, so override funclib.sh
 2507 # func_warning with this simpler definition.
 2508 func_warning ()
 2509 {
 2510     $debug_cmd
 2511 
 2512     $warning_func ${1+"$@"}
 2513 }
 2514 
 2515 
 2516 ## ---------------- ##
 2517 ## Options parsing. ##
 2518 ## ---------------- ##
 2519 
 2520 # Hook in the functions to make sure our own options are parsed during
 2521 # the option parsing loop.
 2522 
 2523 usage='$progpath [OPTION]... [MODE-ARG]...'
 2524 
 2525 # Short help message in response to '-h'.
 2526 usage_message="Options:
 2527        --config             show all configuration variables
 2528        --debug              enable verbose shell tracing
 2529    -n, --dry-run            display commands without modifying any files
 2530        --features           display basic configuration information and exit
 2531        --mode=MODE          use operation mode MODE
 2532        --no-warnings        equivalent to '-Wnone'
 2533        --preserve-dup-deps  don't remove duplicate dependency libraries
 2534        --quiet, --silent    don't print informational messages
 2535        --tag=TAG            use configuration variables from tag TAG
 2536    -v, --verbose            print more informational messages than default
 2537        --version            print version information
 2538    -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
 2539    -h, --help, --help-all   print short, long, or detailed help message
 2540 "
 2541 
 2542 # Additional text appended to 'usage_message' in response to '--help'.
 2543 func_help ()
 2544 {
 2545     $debug_cmd
 2546 
 2547     func_usage_message
 2548     $ECHO "$long_help_message
 2549 
 2550 MODE must be one of the following:
 2551 
 2552        clean           remove files from the build directory
 2553        compile         compile a source file into a libtool object
 2554        execute         automatically set library path, then run a program
 2555        finish          complete the installation of libtool libraries
 2556        install         install libraries or executables
 2557        link            create a library or an executable
 2558        uninstall       remove libraries from an installed directory
 2559 
 2560 MODE-ARGS vary depending on the MODE.  When passed as first option,
 2561 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
 2562 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
 2563 
 2564 When reporting a bug, please describe a test case to reproduce it and
 2565 include the following information:
 2566 
 2567        host-triplet:   $host
 2568        shell:          $SHELL
 2569        compiler:       $LTCC
 2570        compiler flags: $LTCFLAGS
 2571        linker:         $LD (gnu? $with_gnu_ld)
 2572        version:        $progname (GNU libtool) 2.4.6
 2573        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
 2574        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 2575 
 2576 Report bugs to <bug-libtool@gnu.org>.
 2577 GNU libtool home page: <http://www.gnu.org/software/libtool/>.
 2578 General help using GNU software: <http://www.gnu.org/gethelp/>."
 2579     exit 0
 2580 }
 2581 
 2582 
 2583 # func_lo2o OBJECT-NAME
 2584 # ---------------------
 2585 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
 2586 # object suffix.
 2587 
 2588 lo2o=s/\\.lo\$/.$objext/
 2589 o2lo=s/\\.$objext\$/.lo/
 2590 
 2591 if test yes = "$_G_HAVE_XSI_OPS"; then
 2592   eval 'func_lo2o ()
 2593   {
 2594     case $1 in
 2595       *.lo) func_lo2o_result=${1%.lo}.$objext ;;
 2596       *   ) func_lo2o_result=$1               ;;
 2597     esac
 2598   }'
 2599 
 2600   # func_xform LIBOBJ-OR-SOURCE
 2601   # ---------------------------
 2602   # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
 2603   # suffix to a '.lo' libtool-object suffix.
 2604   eval 'func_xform ()
 2605   {
 2606     func_xform_result=${1%.*}.lo
 2607   }'
 2608 else
 2609   # ...otherwise fall back to using sed.
 2610   func_lo2o ()
 2611   {
 2612     func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
 2613   }
 2614 
 2615   func_xform ()
 2616   {
 2617     func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
 2618   }
 2619 fi
 2620 
 2621 
 2622 # func_fatal_configuration ARG...
 2623 # -------------------------------
 2624 # Echo program name prefixed message to standard error, followed by
 2625 # a configuration failure hint, and exit.
 2626 func_fatal_configuration ()
 2627 {
 2628     func__fatal_error ${1+"$@"} \
 2629       "See the $PACKAGE documentation for more information." \
 2630       "Fatal configuration error."
 2631 }
 2632 
 2633 
 2634 # func_config
 2635 # -----------
 2636 # Display the configuration for all the tags in this script.
 2637 func_config ()
 2638 {
 2639     re_begincf='^# ### BEGIN LIBTOOL'
 2640     re_endcf='^# ### END LIBTOOL'
 2641 
 2642     # Default configuration.
 2643     $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
 2644 
 2645     # Now print the configurations for the tags.
 2646     for tagname in $taglist; do
 2647       $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
 2648     done
 2649 
 2650     exit $?
 2651 }
 2652 
 2653 
 2654 # func_features
 2655 # -------------
 2656 # Display the features supported by this script.
 2657 func_features ()
 2658 {
 2659     echo "host: $host"
 2660     if test yes = "$build_libtool_libs"; then
 2661       echo "enable shared libraries"
 2662     else
 2663       echo "disable shared libraries"
 2664     fi
 2665     if test yes = "$build_old_libs"; then
 2666       echo "enable static libraries"
 2667     else
 2668       echo "disable static libraries"
 2669     fi
 2670 
 2671     exit $?
 2672 }
 2673 
 2674 
 2675 # func_enable_tag TAGNAME
 2676 # -----------------------
 2677 # Verify that TAGNAME is valid, and either flag an error and exit, or
 2678 # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 2679 # variable here.
 2680 func_enable_tag ()
 2681 {
 2682     # Global variable:
 2683     tagname=$1
 2684 
 2685     re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
 2686     re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
 2687     sed_extractcf=/$re_begincf/,/$re_endcf/p
 2688 
 2689     # Validate tagname.
 2690     case $tagname in
 2691       *[!-_A-Za-z0-9,/]*)
 2692         func_fatal_error "invalid tag name: $tagname"
 2693         ;;
 2694     esac
 2695 
 2696     # Don't test for the "default" C tag, as we know it's
 2697     # there but not specially marked.
 2698     case $tagname in
 2699         CC) ;;
 2700     *)
 2701         if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
 2702       taglist="$taglist $tagname"
 2703 
 2704       # Evaluate the configuration.  Be careful to quote the path
 2705       # and the sed script, to avoid splitting on whitespace, but
 2706       # also don't use non-portable quotes within backquotes within
 2707       # quotes we have to do it in 2 steps:
 2708       extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
 2709       eval "$extractedcf"
 2710         else
 2711       func_error "ignoring unknown tag $tagname"
 2712         fi
 2713         ;;
 2714     esac
 2715 }
 2716 
 2717 
 2718 # func_check_version_match
 2719 # ------------------------
 2720 # Ensure that we are using m4 macros, and libtool script from the same
 2721 # release of libtool.
 2722 func_check_version_match ()
 2723 {
 2724     if test "$package_revision" != "$macro_revision"; then
 2725       if test "$VERSION" != "$macro_version"; then
 2726         if test -z "$macro_version"; then
 2727           cat >&2 <<_LT_EOF
 2728 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 2729 $progname: definition of this LT_INIT comes from an older release.
 2730 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 2731 $progname: and run autoconf again.
 2732 _LT_EOF
 2733         else
 2734           cat >&2 <<_LT_EOF
 2735 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 2736 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 2737 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 2738 $progname: and run autoconf again.
 2739 _LT_EOF
 2740         fi
 2741       else
 2742         cat >&2 <<_LT_EOF
 2743 $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 2744 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
 2745 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
 2746 $progname: of $PACKAGE $VERSION and run autoconf again.
 2747 _LT_EOF
 2748       fi
 2749 
 2750       exit $EXIT_MISMATCH
 2751     fi
 2752 }
 2753 
 2754 
 2755 # libtool_options_prep [ARG]...
 2756 # -----------------------------
 2757 # Preparation for options parsed by libtool.
 2758 libtool_options_prep ()
 2759 {
 2760     $debug_mode
 2761 
 2762     # Option defaults:
 2763     opt_config=false
 2764     opt_dlopen=
 2765     opt_dry_run=false
 2766     opt_help=false
 2767     opt_mode=
 2768     opt_preserve_dup_deps=false
 2769     opt_quiet=false
 2770 
 2771     nonopt=
 2772     preserve_args=
 2773 
 2774     # Shorthand for --mode=foo, only valid as the first argument
 2775     case $1 in
 2776     clean|clea|cle|cl)
 2777       shift; set dummy --mode clean ${1+"$@"}; shift
 2778       ;;
 2779     compile|compil|compi|comp|com|co|c)
 2780       shift; set dummy --mode compile ${1+"$@"}; shift
 2781       ;;
 2782     execute|execut|execu|exec|exe|ex|e)
 2783       shift; set dummy --mode execute ${1+"$@"}; shift
 2784       ;;
 2785     finish|finis|fini|fin|fi|f)
 2786       shift; set dummy --mode finish ${1+"$@"}; shift
 2787       ;;
 2788     install|instal|insta|inst|ins|in|i)
 2789       shift; set dummy --mode install ${1+"$@"}; shift
 2790       ;;
 2791     link|lin|li|l)
 2792       shift; set dummy --mode link ${1+"$@"}; shift
 2793       ;;
 2794     uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
 2795       shift; set dummy --mode uninstall ${1+"$@"}; shift
 2796       ;;
 2797     esac
 2798 
 2799     # Pass back the list of options.
 2800     func_quote_for_eval ${1+"$@"}
 2801     libtool_options_prep_result=$func_quote_for_eval_result
 2802 }
 2803 func_add_hook func_options_prep libtool_options_prep
 2804 
 2805 
 2806 # libtool_parse_options [ARG]...
 2807 # ---------------------------------
 2808 # Provide handling for libtool specific options.
 2809 libtool_parse_options ()
 2810 {
 2811     $debug_cmd
 2812 
 2813     # Perform our own loop to consume as many options as possible in
 2814     # each iteration.
 2815     while test $# -gt 0; do
 2816       _G_opt=$1
 2817       shift
 2818       case $_G_opt in
 2819         --dry-run|--dryrun|-n)
 2820                         opt_dry_run=:
 2821                         ;;
 2822 
 2823         --config)       func_config ;;
 2824 
 2825         --dlopen|-dlopen)
 2826                         opt_dlopen="${opt_dlopen+$opt_dlopen
 2827 }$1"
 2828                         shift
 2829                         ;;
 2830 
 2831         --preserve-dup-deps)
 2832                         opt_preserve_dup_deps=: ;;
 2833 
 2834         --features)     func_features ;;
 2835 
 2836         --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
 2837 
 2838         --help)         opt_help=: ;;
 2839 
 2840         --help-all)     opt_help=': help-all' ;;
 2841 
 2842         --mode)         test $# = 0 && func_missing_arg $_G_opt && break
 2843                         opt_mode=$1
 2844                         case $1 in
 2845                           # Valid mode arguments:
 2846                           clean|compile|execute|finish|install|link|relink|uninstall) ;;
 2847 
 2848                           # Catch anything else as an error
 2849                           *) func_error "invalid argument for $_G_opt"
 2850                              exit_cmd=exit
 2851                              break
 2852                              ;;
 2853                         esac
 2854                         shift
 2855                         ;;
 2856 
 2857         --no-silent|--no-quiet)
 2858                         opt_quiet=false
 2859                         func_append preserve_args " $_G_opt"
 2860                         ;;
 2861 
 2862         --no-warnings|--no-warning|--no-warn)
 2863                         opt_warning=false
 2864                         func_append preserve_args " $_G_opt"
 2865                         ;;
 2866 
 2867         --no-verbose)
 2868                         opt_verbose=false
 2869                         func_append preserve_args " $_G_opt"
 2870                         ;;
 2871 
 2872         --silent|--quiet)
 2873                         opt_quiet=:
 2874                         opt_verbose=false
 2875                         func_append preserve_args " $_G_opt"
 2876                         ;;
 2877 
 2878         --tag)          test $# = 0 && func_missing_arg $_G_opt && break
 2879                         opt_tag=$1
 2880                         func_append preserve_args " $_G_opt $1"
 2881                         func_enable_tag "$1"
 2882                         shift
 2883                         ;;
 2884 
 2885         --verbose|-v)   opt_quiet=false
 2886                         opt_verbose=:
 2887                         func_append preserve_args " $_G_opt"
 2888                         ;;
 2889 
 2890     # An option not handled by this hook function:
 2891         *)      set dummy "$_G_opt" ${1+"$@"};  shift; break  ;;
 2892       esac
 2893     done
 2894 
 2895 
 2896     # save modified positional parameters for caller
 2897     func_quote_for_eval ${1+"$@"}
 2898     libtool_parse_options_result=$func_quote_for_eval_result
 2899 }
 2900 func_add_hook func_parse_options libtool_parse_options
 2901 
 2902 
 2903 
 2904 # libtool_validate_options [ARG]...
 2905 # ---------------------------------
 2906 # Perform any sanity checks on option settings and/or unconsumed
 2907 # arguments.
 2908 libtool_validate_options ()
 2909 {
 2910     # save first non-option argument
 2911     if test 0 -lt $#; then
 2912       nonopt=$1
 2913       shift
 2914     fi
 2915 
 2916     # preserve --debug
 2917     test : = "$debug_cmd" || func_append preserve_args " --debug"
 2918 
 2919     case $host in
 2920       # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
 2921       # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
 2922       *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
 2923         # don't eliminate duplications in $postdeps and $predeps
 2924         opt_duplicate_compiler_generated_deps=:
 2925         ;;
 2926       *)
 2927         opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
 2928         ;;
 2929     esac
 2930 
 2931     $opt_help || {
 2932       # Sanity checks first:
 2933       func_check_version_match
 2934 
 2935       test yes != "$build_libtool_libs" \
 2936         && test yes != "$build_old_libs" \
 2937         && func_fatal_configuration "not configured to build any kind of library"
 2938 
 2939       # Darwin sucks
 2940       eval std_shrext=\"$shrext_cmds\"
 2941 
 2942       # Only execute mode is allowed to have -dlopen flags.
 2943       if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
 2944         func_error "unrecognized option '-dlopen'"
 2945         $ECHO "$help" 1>&2
 2946         exit $EXIT_FAILURE
 2947       fi
 2948 
 2949       # Change the help message to a mode-specific one.
 2950       generic_help=$help
 2951       help="Try '$progname --help --mode=$opt_mode' for more information."
 2952     }
 2953 
 2954     # Pass back the unparsed argument list
 2955     func_quote_for_eval ${1+"$@"}
 2956     libtool_validate_options_result=$func_quote_for_eval_result
 2957 }
 2958 func_add_hook func_validate_options libtool_validate_options
 2959 
 2960 
 2961 # Process options as early as possible so that --help and --version
 2962 # can return quickly.
 2963 func_options ${1+"$@"}
 2964 eval set dummy "$func_options_result"; shift
 2965 
 2966 
 2967 
 2968 ## ----------- ##
 2969 ##    Main.    ##
 2970 ## ----------- ##
 2971 
 2972 magic='%%%MAGIC variable%%%'
 2973 magic_exe='%%%MAGIC EXE variable%%%'
 2974 
 2975 # Global variables.
 2976 extracted_archives=
 2977 extracted_serial=0
 2978 
 2979 # If this variable is set in any of the actions, the command in it
 2980 # will be execed at the end.  This prevents here-documents from being
 2981 # left over by shells.
 2982 exec_cmd=
 2983 
 2984 
 2985 # A function that is used when there is no print builtin or printf.
 2986 func_fallback_echo ()
 2987 {
 2988   eval 'cat <<_LTECHO_EOF
 2989 $1
 2990 _LTECHO_EOF'
 2991 }
 2992 
 2993 # func_generated_by_libtool
 2994 # True iff stdin has been generated by Libtool. This function is only
 2995 # a basic sanity check; it will hardly flush out determined imposters.
 2996 func_generated_by_libtool_p ()
 2997 {
 2998   $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 2999 }
 3000 
 3001 # func_lalib_p file
 3002 # True iff FILE is a libtool '.la' library or '.lo' object file.
 3003 # This function is only a basic sanity check; it will hardly flush out
 3004 # determined imposters.
 3005 func_lalib_p ()
 3006 {
 3007     test -f "$1" &&
 3008       $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
 3009 }
 3010 
 3011 # func_lalib_unsafe_p file
 3012 # True iff FILE is a libtool '.la' library or '.lo' object file.
 3013 # This function implements the same check as func_lalib_p without
 3014 # resorting to external programs.  To this end, it redirects stdin and
 3015 # closes it afterwards, without saving the original file descriptor.
 3016 # As a safety measure, use it only where a negative result would be
 3017 # fatal anyway.  Works if 'file' does not exist.
 3018 func_lalib_unsafe_p ()
 3019 {
 3020     lalib_p=no
 3021     if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
 3022     for lalib_p_l in 1 2 3 4
 3023     do
 3024         read lalib_p_line
 3025         case $lalib_p_line in
 3026         \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
 3027         esac
 3028     done
 3029     exec 0<&5 5<&-
 3030     fi
 3031     test yes = "$lalib_p"
 3032 }
 3033 
 3034 # func_ltwrapper_script_p file
 3035 # True iff FILE is a libtool wrapper script
 3036 # This function is only a basic sanity check; it will hardly flush out
 3037 # determined imposters.
 3038 func_ltwrapper_script_p ()
 3039 {
 3040     test -f "$1" &&
 3041       $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
 3042 }
 3043 
 3044 # func_ltwrapper_executable_p file
 3045 # True iff FILE is a libtool wrapper executable
 3046 # This function is only a basic sanity check; it will hardly flush out
 3047 # determined imposters.
 3048 func_ltwrapper_executable_p ()
 3049 {
 3050     func_ltwrapper_exec_suffix=
 3051     case $1 in
 3052     *.exe) ;;
 3053     *) func_ltwrapper_exec_suffix=.exe ;;
 3054     esac
 3055     $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
 3056 }
 3057 
 3058 # func_ltwrapper_scriptname file
 3059 # Assumes file is an ltwrapper_executable
 3060 # uses $file to determine the appropriate filename for a
 3061 # temporary ltwrapper_script.
 3062 func_ltwrapper_scriptname ()
 3063 {
 3064     func_dirname_and_basename "$1" "" "."
 3065     func_stripname '' '.exe' "$func_basename_result"
 3066     func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
 3067 }
 3068 
 3069 # func_ltwrapper_p file
 3070 # True iff FILE is a libtool wrapper script or wrapper executable
 3071 # This function is only a basic sanity check; it will hardly flush out
 3072 # determined imposters.
 3073 func_ltwrapper_p ()
 3074 {
 3075     func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
 3076 }
 3077 
 3078 
 3079 # func_execute_cmds commands fail_cmd
 3080 # Execute tilde-delimited COMMANDS.
 3081 # If FAIL_CMD is given, eval that upon failure.
 3082 # FAIL_CMD may read-access the current command in variable CMD!
 3083 func_execute_cmds ()
 3084 {
 3085     $debug_cmd
 3086 
 3087     save_ifs=$IFS; IFS='~'
 3088     for cmd in $1; do
 3089       IFS=$sp$nl
 3090       eval cmd=\"$cmd\"
 3091       IFS=$save_ifs
 3092       func_show_eval "$cmd" "${2-:}"
 3093     done
 3094     IFS=$save_ifs
 3095 }
 3096 
 3097 
 3098 # func_source file
 3099 # Source FILE, adding directory component if necessary.
 3100 # Note that it is not necessary on cygwin/mingw to append a dot to
 3101 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 3102 # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 3103 # 'FILE.' does not work on cygwin managed mounts.
 3104 func_source ()
 3105 {
 3106     $debug_cmd
 3107 
 3108     case $1 in
 3109     */* | *\\*) . "$1" ;;
 3110     *)      . "./$1" ;;
 3111     esac
 3112 }
 3113 
 3114 
 3115 # func_resolve_sysroot PATH
 3116 # Replace a leading = in PATH with a sysroot.  Store the result into
 3117 # func_resolve_sysroot_result
 3118 func_resolve_sysroot ()
 3119 {
 3120   func_resolve_sysroot_result=$1
 3121   case $func_resolve_sysroot_result in
 3122   =*)
 3123     func_stripname '=' '' "$func_resolve_sysroot_result"
 3124     func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
 3125     ;;
 3126   esac
 3127 }
 3128 
 3129 # func_replace_sysroot PATH
 3130 # If PATH begins with the sysroot, replace it with = and
 3131 # store the result into func_replace_sysroot_result.
 3132 func_replace_sysroot ()
 3133 {
 3134   case $lt_sysroot:$1 in
 3135   ?*:"$lt_sysroot"*)
 3136     func_stripname "$lt_sysroot" '' "$1"
 3137     func_replace_sysroot_result='='$func_stripname_result
 3138     ;;
 3139   *)
 3140     # Including no sysroot.
 3141     func_replace_sysroot_result=$1
 3142     ;;
 3143   esac
 3144 }
 3145 
 3146 # func_infer_tag arg
 3147 # Infer tagged configuration to use if any are available and
 3148 # if one wasn't chosen via the "--tag" command line option.
 3149 # Only attempt this if the compiler in the base compile
 3150 # command doesn't match the default compiler.
 3151 # arg is usually of the form 'gcc ...'
 3152 func_infer_tag ()
 3153 {
 3154     $debug_cmd
 3155 
 3156     if test -n "$available_tags" && test -z "$tagname"; then
 3157       CC_quoted=
 3158       for arg in $CC; do
 3159     func_append_quoted CC_quoted "$arg"
 3160       done
 3161       CC_expanded=`func_echo_all $CC`
 3162       CC_quoted_expanded=`func_echo_all $CC_quoted`
 3163       case $@ in
 3164       # Blanks in the command may have been stripped by the calling shell,
 3165       # but not from the CC environment variable when configure was run.
 3166       " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 3167       " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
 3168       # Blanks at the start of $base_compile will cause this to fail
 3169       # if we don't check for them as well.
 3170       *)
 3171     for z in $available_tags; do
 3172       if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 3173         # Evaluate the configuration.
 3174         eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 3175         CC_quoted=
 3176         for arg in $CC; do
 3177           # Double-quote args containing other shell metacharacters.
 3178           func_append_quoted CC_quoted "$arg"
 3179         done
 3180         CC_expanded=`func_echo_all $CC`
 3181         CC_quoted_expanded=`func_echo_all $CC_quoted`
 3182         case "$@ " in
 3183         " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 3184         " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 3185           # The compiler in the base compile command matches
 3186           # the one in the tagged configuration.
 3187           # Assume this is the tagged configuration we want.
 3188           tagname=$z
 3189           break
 3190           ;;
 3191         esac
 3192       fi
 3193     done
 3194     # If $tagname still isn't set, then no tagged configuration
 3195     # was found and let the user know that the "--tag" command
 3196     # line option must be used.
 3197     if test -z "$tagname"; then
 3198       func_echo "unable to infer tagged configuration"
 3199       func_fatal_error "specify a tag with '--tag'"
 3200 #   else
 3201 #     func_verbose "using $tagname tagged configuration"
 3202     fi
 3203     ;;
 3204       esac
 3205     fi
 3206 }
 3207 
 3208 
 3209 
 3210 # func_write_libtool_object output_name pic_name nonpic_name
 3211 # Create a libtool object file (analogous to a ".la" file),
 3212 # but don't create it if we're doing a dry run.
 3213 func_write_libtool_object ()
 3214 {
 3215     write_libobj=$1
 3216     if test yes = "$build_libtool_libs"; then
 3217       write_lobj=\'$2\'
 3218     else
 3219       write_lobj=none
 3220     fi
 3221 
 3222     if test yes = "$build_old_libs"; then
 3223       write_oldobj=\'$3\'
 3224     else
 3225       write_oldobj=none
 3226     fi
 3227 
 3228     $opt_dry_run || {
 3229       cat >${write_libobj}T <<EOF
 3230 # $write_libobj - a libtool object file
 3231 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 3232 #
 3233 # Please DO NOT delete this file!
 3234 # It is necessary for linking the library.
 3235 
 3236 # Name of the PIC object.
 3237 pic_object=$write_lobj
 3238 
 3239 # Name of the non-PIC object
 3240 non_pic_object=$write_oldobj
 3241 
 3242 EOF
 3243       $MV "${write_libobj}T" "$write_libobj"
 3244     }
 3245 }
 3246 
 3247 
 3248 ##################################################
 3249 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
 3250 ##################################################
 3251 
 3252 # func_convert_core_file_wine_to_w32 ARG
 3253 # Helper function used by file name conversion functions when $build is *nix,
 3254 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
 3255 # correctly configured wine environment available, with the winepath program
 3256 # in $build's $PATH.
 3257 #
 3258 # ARG is the $build file name to be converted to w32 format.
 3259 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
 3260 # be empty on error (or when ARG is empty)
 3261 func_convert_core_file_wine_to_w32 ()
 3262 {
 3263   $debug_cmd
 3264 
 3265   func_convert_core_file_wine_to_w32_result=$1
 3266   if test -n "$1"; then
 3267     # Unfortunately, winepath does not exit with a non-zero error code, so we
 3268     # are forced to check the contents of stdout. On the other hand, if the
 3269     # command is not found, the shell will set an exit code of 127 and print
 3270     # *an error message* to stdout. So we must check for both error code of
 3271     # zero AND non-empty stdout, which explains the odd construction:
 3272     func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
 3273     if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
 3274       func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
 3275         $SED -e "$sed_naive_backslashify"`
 3276     else
 3277       func_convert_core_file_wine_to_w32_result=
 3278     fi
 3279   fi
 3280 }
 3281 # end: func_convert_core_file_wine_to_w32
 3282 
 3283 
 3284 # func_convert_core_path_wine_to_w32 ARG
 3285 # Helper function used by path conversion functions when $build is *nix, and
 3286 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
 3287 # configured wine environment available, with the winepath program in $build's
 3288 # $PATH. Assumes ARG has no leading or trailing path separator characters.
 3289 #
 3290 # ARG is path to be converted from $build format to win32.
 3291 # Result is available in $func_convert_core_path_wine_to_w32_result.
 3292 # Unconvertible file (directory) names in ARG are skipped; if no directory names
 3293 # are convertible, then the result may be empty.
 3294 func_convert_core_path_wine_to_w32 ()
 3295 {
 3296   $debug_cmd
 3297 
 3298   # unfortunately, winepath doesn't convert paths, only file names
 3299   func_convert_core_path_wine_to_w32_result=
 3300   if test -n "$1"; then
 3301     oldIFS=$IFS
 3302     IFS=:
 3303     for func_convert_core_path_wine_to_w32_f in $1; do
 3304       IFS=$oldIFS
 3305       func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
 3306       if test -n "$func_convert_core_file_wine_to_w32_result"; then
 3307         if test -z "$func_convert_core_path_wine_to_w32_result"; then
 3308           func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
 3309         else
 3310           func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
 3311         fi
 3312       fi
 3313     done
 3314     IFS=$oldIFS
 3315   fi
 3316 }
 3317 # end: func_convert_core_path_wine_to_w32
 3318 
 3319 
 3320 # func_cygpath ARGS...
 3321 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
 3322 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
 3323 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
 3324 # (2), returns the Cygwin file name or path in func_cygpath_result (input
 3325 # file name or path is assumed to be in w32 format, as previously converted
 3326 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
 3327 # or path in func_cygpath_result (input file name or path is assumed to be in
 3328 # Cygwin format). Returns an empty string on error.
 3329 #
 3330 # ARGS are passed to cygpath, with the last one being the file name or path to
 3331 # be converted.
 3332 #
 3333 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
 3334 # environment variable; do not put it in $PATH.
 3335 func_cygpath ()
 3336 {
 3337   $debug_cmd
 3338 
 3339   if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
 3340     func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
 3341     if test "$?" -ne 0; then
 3342       # on failure, ensure result is empty
 3343       func_cygpath_result=
 3344     fi
 3345   else
 3346     func_cygpath_result=
 3347     func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
 3348   fi
 3349 }
 3350 #end: func_cygpath
 3351 
 3352 
 3353 # func_convert_core_msys_to_w32 ARG
 3354 # Convert file name or path ARG from MSYS format to w32 format.  Return
 3355 # result in func_convert_core_msys_to_w32_result.
 3356 func_convert_core_msys_to_w32 ()
 3357 {
 3358   $debug_cmd
 3359 
 3360   # awkward: cmd appends spaces to result
 3361   func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
 3362     $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
 3363 }
 3364 #end: func_convert_core_msys_to_w32
 3365 
 3366 
 3367 # func_convert_file_check ARG1 ARG2
 3368 # Verify that ARG1 (a file name in $build format) was converted to $host
 3369 # format in ARG2. Otherwise, emit an error message, but continue (resetting
 3370 # func_to_host_file_result to ARG1).
 3371 func_convert_file_check ()
 3372 {
 3373   $debug_cmd
 3374 
 3375   if test -z "$2" && test -n "$1"; then
 3376     func_error "Could not determine host file name corresponding to"
 3377     func_error "  '$1'"
 3378     func_error "Continuing, but uninstalled executables may not work."
 3379     # Fallback:
 3380     func_to_host_file_result=$1
 3381   fi
 3382 }
 3383 # end func_convert_file_check
 3384 
 3385 
 3386 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
 3387 # Verify that FROM_PATH (a path in $build format) was converted to $host
 3388 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
 3389 # func_to_host_file_result to a simplistic fallback value (see below).
 3390 func_convert_path_check ()
 3391 {
 3392   $debug_cmd
 3393 
 3394   if test -z "$4" && test -n "$3"; then
 3395     func_error "Could not determine the host path corresponding to"
 3396     func_error "  '$3'"
 3397     func_error "Continuing, but uninstalled executables may not work."
 3398     # Fallback.  This is a deliberately simplistic "conversion" and
 3399     # should not be "improved".  See libtool.info.
 3400     if test "x$1" != "x$2"; then
 3401       lt_replace_pathsep_chars="s|$1|$2|g"
 3402       func_to_host_path_result=`echo "$3" |
 3403         $SED -e "$lt_replace_pathsep_chars"`
 3404     else
 3405       func_to_host_path_result=$3
 3406     fi
 3407   fi
 3408 }
 3409 # end func_convert_path_check
 3410 
 3411 
 3412 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
 3413 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
 3414 # and appending REPL if ORIG matches BACKPAT.
 3415 func_convert_path_front_back_pathsep ()
 3416 {
 3417   $debug_cmd
 3418 
 3419   case $4 in
 3420   $1 ) func_to_host_path_result=$3$func_to_host_path_result
 3421     ;;
 3422   esac
 3423   case $4 in
 3424   $2 ) func_append func_to_host_path_result "$3"
 3425     ;;
 3426   esac
 3427 }
 3428 # end func_convert_path_front_back_pathsep
 3429 
 3430 
 3431 ##################################################
 3432 # $build to $host FILE NAME CONVERSION FUNCTIONS #
 3433 ##################################################
 3434 # invoked via '$to_host_file_cmd ARG'
 3435 #
 3436 # In each case, ARG is the path to be converted from $build to $host format.
 3437 # Result will be available in $func_to_host_file_result.
 3438 
 3439 
 3440 # func_to_host_file ARG
 3441 # Converts the file name ARG from $build format to $host format. Return result
 3442 # in func_to_host_file_result.
 3443 func_to_host_file ()
 3444 {
 3445   $debug_cmd
 3446 
 3447   $to_host_file_cmd "$1"
 3448 }
 3449 # end func_to_host_file
 3450 
 3451 
 3452 # func_to_tool_file ARG LAZY
 3453 # converts the file name ARG from $build format to toolchain format. Return
 3454 # result in func_to_tool_file_result.  If the conversion in use is listed
 3455 # in (the comma separated) LAZY, no conversion takes place.
 3456 func_to_tool_file ()
 3457 {
 3458   $debug_cmd
 3459 
 3460   case ,$2, in
 3461     *,"$to_tool_file_cmd",*)
 3462       func_to_tool_file_result=$1
 3463       ;;
 3464     *)
 3465       $to_tool_file_cmd "$1"
 3466       func_to_tool_file_result=$func_to_host_file_result
 3467       ;;
 3468   esac
 3469 }
 3470 # end func_to_tool_file
 3471 
 3472 
 3473 # func_convert_file_noop ARG
 3474 # Copy ARG to func_to_host_file_result.
 3475 func_convert_file_noop ()
 3476 {
 3477   func_to_host_file_result=$1
 3478 }
 3479 # end func_convert_file_noop
 3480 
 3481 
 3482 # func_convert_file_msys_to_w32 ARG
 3483 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
 3484 # conversion to w32 is not available inside the cwrapper.  Returns result in
 3485 # func_to_host_file_result.
 3486 func_convert_file_msys_to_w32 ()
 3487 {
 3488   $debug_cmd
 3489 
 3490   func_to_host_file_result=$1
 3491   if test -n "$1"; then
 3492     func_convert_core_msys_to_w32 "$1"
 3493     func_to_host_file_result=$func_convert_core_msys_to_w32_result
 3494   fi
 3495   func_convert_file_check "$1" "$func_to_host_file_result"
 3496 }
 3497 # end func_convert_file_msys_to_w32
 3498 
 3499 
 3500 # func_convert_file_cygwin_to_w32 ARG
 3501 # Convert file name ARG from Cygwin to w32 format.  Returns result in
 3502 # func_to_host_file_result.
 3503 func_convert_file_cygwin_to_w32 ()
 3504 {
 3505   $debug_cmd
 3506 
 3507   func_to_host_file_result=$1
 3508   if test -n "$1"; then
 3509     # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
 3510     # LT_CYGPATH in this case.
 3511     func_to_host_file_result=`cygpath -m "$1"`
 3512   fi
 3513   func_convert_file_check "$1" "$func_to_host_file_result"
 3514 }
 3515 # end func_convert_file_cygwin_to_w32
 3516 
 3517 
 3518 # func_convert_file_nix_to_w32 ARG
 3519 # Convert file name ARG from *nix to w32 format.  Requires a wine environment
 3520 # and a working winepath. Returns result in func_to_host_file_result.
 3521 func_convert_file_nix_to_w32 ()
 3522 {
 3523   $debug_cmd
 3524 
 3525   func_to_host_file_result=$1
 3526   if test -n "$1"; then
 3527     func_convert_core_file_wine_to_w32 "$1"
 3528     func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
 3529   fi
 3530   func_convert_file_check "$1" "$func_to_host_file_result"
 3531 }
 3532 # end func_convert_file_nix_to_w32
 3533 
 3534 
 3535 # func_convert_file_msys_to_cygwin ARG
 3536 # Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 3537 # Returns result in func_to_host_file_result.
 3538 func_convert_file_msys_to_cygwin ()
 3539 {
 3540   $debug_cmd
 3541 
 3542   func_to_host_file_result=$1
 3543   if test -n "$1"; then
 3544     func_convert_core_msys_to_w32 "$1"
 3545     func_cygpath -u "$func_convert_core_msys_to_w32_result"
 3546     func_to_host_file_result=$func_cygpath_result
 3547   fi
 3548   func_convert_file_check "$1" "$func_to_host_file_result"
 3549 }
 3550 # end func_convert_file_msys_to_cygwin
 3551 
 3552 
 3553 # func_convert_file_nix_to_cygwin ARG
 3554 # Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
 3555 # in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
 3556 # in func_to_host_file_result.
 3557 func_convert_file_nix_to_cygwin ()
 3558 {
 3559   $debug_cmd
 3560 
 3561   func_to_host_file_result=$1
 3562   if test -n "$1"; then
 3563     # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
 3564     func_convert_core_file_wine_to_w32 "$1"
 3565     func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
 3566     func_to_host_file_result=$func_cygpath_result
 3567   fi
 3568   func_convert_file_check "$1" "$func_to_host_file_result"
 3569 }
 3570 # end func_convert_file_nix_to_cygwin
 3571 
 3572 
 3573 #############################################
 3574 # $build to $host PATH CONVERSION FUNCTIONS #
 3575 #############################################
 3576 # invoked via '$to_host_path_cmd ARG'
 3577 #
 3578 # In each case, ARG is the path to be converted from $build to $host format.
 3579 # The result will be available in $func_to_host_path_result.
 3580 #
 3581 # Path separators are also converted from $build format to $host format.  If
 3582 # ARG begins or ends with a path separator character, it is preserved (but
 3583 # converted to $host format) on output.
 3584 #
 3585 # All path conversion functions are named using the following convention:
 3586 #   file name conversion function    : func_convert_file_X_to_Y ()
 3587 #   path conversion function         : func_convert_path_X_to_Y ()
 3588 # where, for any given $build/$host combination the 'X_to_Y' value is the
 3589 # same.  If conversion functions are added for new $build/$host combinations,
 3590 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
 3591 # will break.
 3592 
 3593 
 3594 # func_init_to_host_path_cmd
 3595 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
 3596 # appropriate value, based on the value of $to_host_file_cmd.
 3597 to_host_path_cmd=
 3598 func_init_to_host_path_cmd ()
 3599 {
 3600   $debug_cmd
 3601 
 3602   if test -z "$to_host_path_cmd"; then
 3603     func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
 3604     to_host_path_cmd=func_convert_path_$func_stripname_result
 3605   fi
 3606 }
 3607 
 3608 
 3609 # func_to_host_path ARG
 3610 # Converts the path ARG from $build format to $host format. Return result
 3611 # in func_to_host_path_result.
 3612 func_to_host_path ()
 3613 {
 3614   $debug_cmd
 3615 
 3616   func_init_to_host_path_cmd
 3617   $to_host_path_cmd "$1"
 3618 }
 3619 # end func_to_host_path
 3620 
 3621 
 3622 # func_convert_path_noop ARG
 3623 # Copy ARG to func_to_host_path_result.
 3624 func_convert_path_noop ()
 3625 {
 3626   func_to_host_path_result=$1
 3627 }
 3628 # end func_convert_path_noop
 3629 
 3630 
 3631 # func_convert_path_msys_to_w32 ARG
 3632 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
 3633 # conversion to w32 is not available inside the cwrapper.  Returns result in
 3634 # func_to_host_path_result.
 3635 func_convert_path_msys_to_w32 ()
 3636 {
 3637   $debug_cmd
 3638 
 3639   func_to_host_path_result=$1
 3640   if test -n "$1"; then
 3641     # Remove leading and trailing path separator characters from ARG.  MSYS
 3642     # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
 3643     # and winepath ignores them completely.
 3644     func_stripname : : "$1"
 3645     func_to_host_path_tmp1=$func_stripname_result
 3646     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 3647     func_to_host_path_result=$func_convert_core_msys_to_w32_result
 3648     func_convert_path_check : ";" \
 3649       "$func_to_host_path_tmp1" "$func_to_host_path_result"
 3650     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 3651   fi
 3652 }
 3653 # end func_convert_path_msys_to_w32
 3654 
 3655 
 3656 # func_convert_path_cygwin_to_w32 ARG
 3657 # Convert path ARG from Cygwin to w32 format.  Returns result in
 3658 # func_to_host_file_result.
 3659 func_convert_path_cygwin_to_w32 ()
 3660 {
 3661   $debug_cmd
 3662 
 3663   func_to_host_path_result=$1
 3664   if test -n "$1"; then
 3665     # See func_convert_path_msys_to_w32:
 3666     func_stripname : : "$1"
 3667     func_to_host_path_tmp1=$func_stripname_result
 3668     func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
 3669     func_convert_path_check : ";" \
 3670       "$func_to_host_path_tmp1" "$func_to_host_path_result"
 3671     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 3672   fi
 3673 }
 3674 # end func_convert_path_cygwin_to_w32
 3675 
 3676 
 3677 # func_convert_path_nix_to_w32 ARG
 3678 # Convert path ARG from *nix to w32 format.  Requires a wine environment and
 3679 # a working winepath.  Returns result in func_to_host_file_result.
 3680 func_convert_path_nix_to_w32 ()
 3681 {
 3682   $debug_cmd
 3683 
 3684   func_to_host_path_result=$1
 3685   if test -n "$1"; then
 3686     # See func_convert_path_msys_to_w32:
 3687     func_stripname : : "$1"
 3688     func_to_host_path_tmp1=$func_stripname_result
 3689     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 3690     func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
 3691     func_convert_path_check : ";" \
 3692       "$func_to_host_path_tmp1" "$func_to_host_path_result"
 3693     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 3694   fi
 3695 }
 3696 # end func_convert_path_nix_to_w32
 3697 
 3698 
 3699 # func_convert_path_msys_to_cygwin ARG
 3700 # Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 3701 # Returns result in func_to_host_file_result.
 3702 func_convert_path_msys_to_cygwin ()
 3703 {
 3704   $debug_cmd
 3705 
 3706   func_to_host_path_result=$1
 3707   if test -n "$1"; then
 3708     # See func_convert_path_msys_to_w32:
 3709     func_stripname : : "$1"
 3710     func_to_host_path_tmp1=$func_stripname_result
 3711     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 3712     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
 3713     func_to_host_path_result=$func_cygpath_result
 3714     func_convert_path_check : : \
 3715       "$func_to_host_path_tmp1" "$func_to_host_path_result"
 3716     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 3717   fi
 3718 }
 3719 # end func_convert_path_msys_to_cygwin
 3720 
 3721 
 3722 # func_convert_path_nix_to_cygwin ARG
 3723 # Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
 3724 # a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
 3725 # func_to_host_file_result.
 3726 func_convert_path_nix_to_cygwin ()
 3727 {
 3728   $debug_cmd
 3729 
 3730   func_to_host_path_result=$1
 3731   if test -n "$1"; then
 3732     # Remove leading and trailing path separator characters from
 3733     # ARG. msys behavior is inconsistent here, cygpath turns them
 3734     # into '.;' and ';.', and winepath ignores them completely.
 3735     func_stripname : : "$1"
 3736     func_to_host_path_tmp1=$func_stripname_result
 3737     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 3738     func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
 3739     func_to_host_path_result=$func_cygpath_result
 3740     func_convert_path_check : : \
 3741       "$func_to_host_path_tmp1" "$func_to_host_path_result"
 3742     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 3743   fi
 3744 }
 3745 # end func_convert_path_nix_to_cygwin
 3746 
 3747 
 3748 # func_dll_def_p FILE
 3749 # True iff FILE is a Windows DLL '.def' file.
 3750 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
 3751 func_dll_def_p ()
 3752 {
 3753   $debug_cmd
 3754 
 3755   func_dll_def_p_tmp=`$SED -n \
 3756     -e 's/^[     ]*//' \
 3757     -e '/^\(;.*\)*$/d' \
 3758     -e 's/^\(EXPORTS\|LIBRARY\)\([   ].*\)*$/DEF/p' \
 3759     -e q \
 3760     "$1"`
 3761   test DEF = "$func_dll_def_p_tmp"
 3762 }
 3763 
 3764 
 3765 # func_mode_compile arg...
 3766 func_mode_compile ()
 3767 {
 3768     $debug_cmd
 3769 
 3770     # Get the compilation command and the source file.
 3771     base_compile=
 3772     srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
 3773     suppress_opt=yes
 3774     suppress_output=
 3775     arg_mode=normal
 3776     libobj=
 3777     later=
 3778     pie_flag=
 3779 
 3780     for arg
 3781     do
 3782       case $arg_mode in
 3783       arg  )
 3784     # do not "continue".  Instead, add this to base_compile
 3785     lastarg=$arg
 3786     arg_mode=normal
 3787     ;;
 3788 
 3789       target )
 3790     libobj=$arg
 3791     arg_mode=normal
 3792     continue
 3793     ;;
 3794 
 3795       normal )
 3796     # Accept any command-line options.
 3797     case $arg in
 3798     -o)
 3799       test -n "$libobj" && \
 3800         func_fatal_error "you cannot specify '-o' more than once"
 3801       arg_mode=target
 3802       continue
 3803       ;;
 3804 
 3805     -pie | -fpie | -fPIE)
 3806           func_append pie_flag " $arg"
 3807       continue
 3808       ;;
 3809 
 3810     -shared | -static | -prefer-pic | -prefer-non-pic)
 3811       func_append later " $arg"
 3812       continue
 3813       ;;
 3814 
 3815     -no-suppress)
 3816       suppress_opt=no
 3817       continue
 3818       ;;
 3819 
 3820     -Xcompiler)
 3821       arg_mode=arg  #  the next one goes into the "base_compile" arg list
 3822       continue      #  The current "srcfile" will either be retained or
 3823       ;;            #  replaced later.  I would guess that would be a bug.
 3824 
 3825     -Wc,*)
 3826       func_stripname '-Wc,' '' "$arg"
 3827       args=$func_stripname_result
 3828       lastarg=
 3829       save_ifs=$IFS; IFS=,
 3830       for arg in $args; do
 3831         IFS=$save_ifs
 3832         func_append_quoted lastarg "$arg"
 3833       done
 3834       IFS=$save_ifs
 3835       func_stripname ' ' '' "$lastarg"
 3836       lastarg=$func_stripname_result
 3837 
 3838       # Add the arguments to base_compile.
 3839       func_append base_compile " $lastarg"
 3840       continue
 3841       ;;
 3842 
 3843     *)
 3844       # Accept the current argument as the source file.
 3845       # The previous "srcfile" becomes the current argument.
 3846       #
 3847       lastarg=$srcfile
 3848       srcfile=$arg
 3849       ;;
 3850     esac  #  case $arg
 3851     ;;
 3852       esac    #  case $arg_mode
 3853 
 3854       # Aesthetically quote the previous argument.
 3855       func_append_quoted base_compile "$lastarg"
 3856     done # for arg
 3857 
 3858     case $arg_mode in
 3859     arg)
 3860       func_fatal_error "you must specify an argument for -Xcompile"
 3861       ;;
 3862     target)
 3863       func_fatal_error "you must specify a target with '-o'"
 3864       ;;
 3865     *)
 3866       # Get the name of the library object.
 3867       test -z "$libobj" && {
 3868     func_basename "$srcfile"
 3869     libobj=$func_basename_result
 3870       }
 3871       ;;
 3872     esac
 3873 
 3874     # Recognize several different file suffixes.
 3875     # If the user specifies -o file.o, it is replaced with file.lo
 3876     case $libobj in
 3877     *.[cCFSifmso] | \
 3878     *.ada | *.adb | *.ads | *.asm | \
 3879     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
 3880     *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
 3881       func_xform "$libobj"
 3882       libobj=$func_xform_result
 3883       ;;
 3884     esac
 3885 
 3886     case $libobj in
 3887     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
 3888     *)
 3889       func_fatal_error "cannot determine name of library object from '$libobj'"
 3890       ;;
 3891     esac
 3892 
 3893     func_infer_tag $base_compile
 3894 
 3895     for arg in $later; do
 3896       case $arg in
 3897       -shared)
 3898     test yes = "$build_libtool_libs" \
 3899       || func_fatal_configuration "cannot build a shared library"
 3900     build_old_libs=no
 3901     continue
 3902     ;;
 3903 
 3904       -static)
 3905     build_libtool_libs=no
 3906     build_old_libs=yes
 3907     continue
 3908     ;;
 3909 
 3910       -prefer-pic)
 3911     pic_mode=yes
 3912     continue
 3913     ;;
 3914 
 3915       -prefer-non-pic)
 3916     pic_mode=no
 3917     continue
 3918     ;;
 3919       esac
 3920     done
 3921 
 3922     func_quote_for_eval "$libobj"
 3923     test "X$libobj" != "X$func_quote_for_eval_result" \
 3924       && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
 3925       && func_warning "libobj name '$libobj' may not contain shell special characters."
 3926     func_dirname_and_basename "$obj" "/" ""
 3927     objname=$func_basename_result
 3928     xdir=$func_dirname_result
 3929     lobj=$xdir$objdir/$objname
 3930 
 3931     test -z "$base_compile" && \
 3932       func_fatal_help "you must specify a compilation command"
 3933 
 3934     # Delete any leftover library objects.
 3935     if test yes = "$build_old_libs"; then
 3936       removelist="$obj $lobj $libobj ${libobj}T"
 3937     else
 3938       removelist="$lobj $libobj ${libobj}T"
 3939     fi
 3940 
 3941     # On Cygwin there's no "real" PIC flag so we must build both object types
 3942     case $host_os in
 3943     cygwin* | mingw* | pw32* | os2* | cegcc*)
 3944       pic_mode=default
 3945       ;;
 3946     esac
 3947     if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
 3948       # non-PIC code in shared libraries is not supported
 3949       pic_mode=default
 3950     fi
 3951 
 3952     # Calculate the filename of the output object if compiler does
 3953     # not support -o with -c
 3954     if test no = "$compiler_c_o"; then
 3955       output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
 3956       lockfile=$output_obj.lock
 3957     else
 3958       output_obj=
 3959       need_locks=no
 3960       lockfile=
 3961     fi
 3962 
 3963     # Lock this critical section if it is needed
 3964     # We use this script file to make the link, it avoids creating a new file
 3965     if test yes = "$need_locks"; then
 3966       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 3967     func_echo "Waiting for $lockfile to be removed"
 3968     sleep 2
 3969       done
 3970     elif test warn = "$need_locks"; then
 3971       if test -f "$lockfile"; then
 3972     $ECHO "\
 3973 *** ERROR, $lockfile exists and contains:
 3974 `cat $lockfile 2>/dev/null`
 3975 
 3976 This indicates that another process is trying to use the same
 3977 temporary object file, and libtool could not work around it because
 3978 your compiler does not support '-c' and '-o' together.  If you
 3979 repeat this compilation, it may succeed, by chance, but you had better
 3980 avoid parallel builds (make -j) in this platform, or get a better
 3981 compiler."
 3982 
 3983     $opt_dry_run || $RM $removelist
 3984     exit $EXIT_FAILURE
 3985       fi
 3986       func_append removelist " $output_obj"
 3987       $ECHO "$srcfile" > "$lockfile"
 3988     fi
 3989 
 3990     $opt_dry_run || $RM $removelist
 3991     func_append removelist " $lockfile"
 3992     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 3993 
 3994     func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
 3995     srcfile=$func_to_tool_file_result
 3996     func_quote_for_eval "$srcfile"
 3997     qsrcfile=$func_quote_for_eval_result
 3998 
 3999     # Only build a PIC object if we are building libtool libraries.
 4000     if test yes = "$build_libtool_libs"; then
 4001       # Without this assignment, base_compile gets emptied.
 4002       fbsd_hideous_sh_bug=$base_compile
 4003 
 4004       if test no != "$pic_mode"; then
 4005     command="$base_compile $qsrcfile $pic_flag"
 4006       else
 4007     # Don't build PIC code
 4008     command="$base_compile $qsrcfile"
 4009       fi
 4010 
 4011       func_mkdir_p "$xdir$objdir"
 4012 
 4013       if test -z "$output_obj"; then
 4014     # Place PIC objects in $objdir
 4015     func_append command " -o $lobj"
 4016       fi
 4017 
 4018       func_show_eval_locale "$command"  \
 4019           'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
 4020 
 4021       if test warn = "$need_locks" &&
 4022      test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 4023     $ECHO "\
 4024 *** ERROR, $lockfile contains:
 4025 `cat $lockfile 2>/dev/null`
 4026 
 4027 but it should contain:
 4028 $srcfile
 4029 
 4030 This indicates that another process is trying to use the same
 4031 temporary object file, and libtool could not work around it because
 4032 your compiler does not support '-c' and '-o' together.  If you
 4033 repeat this compilation, it may succeed, by chance, but you had better
 4034 avoid parallel builds (make -j) in this platform, or get a better
 4035 compiler."
 4036 
 4037     $opt_dry_run || $RM $removelist
 4038     exit $EXIT_FAILURE
 4039       fi
 4040 
 4041       # Just move the object if needed, then go on to compile the next one
 4042       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 4043     func_show_eval '$MV "$output_obj" "$lobj"' \
 4044       'error=$?; $opt_dry_run || $RM $removelist; exit $error'
 4045       fi
 4046 
 4047       # Allow error messages only from the first compilation.
 4048       if test yes = "$suppress_opt"; then
 4049     suppress_output=' >/dev/null 2>&1'
 4050       fi
 4051     fi
 4052 
 4053     # Only build a position-dependent object if we build old libraries.
 4054     if test yes = "$build_old_libs"; then
 4055       if test yes != "$pic_mode"; then
 4056     # Don't build PIC code
 4057     command="$base_compile $qsrcfile$pie_flag"
 4058       else
 4059     command="$base_compile $qsrcfile $pic_flag"
 4060       fi
 4061       if test yes = "$compiler_c_o"; then
 4062     func_append command " -o $obj"
 4063       fi
 4064 
 4065       # Suppress compiler output if we already did a PIC compilation.
 4066       func_append command "$suppress_output"
 4067       func_show_eval_locale "$command" \
 4068         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 4069 
 4070       if test warn = "$need_locks" &&
 4071      test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 4072     $ECHO "\
 4073 *** ERROR, $lockfile contains:
 4074 `cat $lockfile 2>/dev/null`
 4075 
 4076 but it should contain:
 4077 $srcfile
 4078 
 4079 This indicates that another process is trying to use the same
 4080 temporary object file, and libtool could not work around it because
 4081 your compiler does not support '-c' and '-o' together.  If you
 4082 repeat this compilation, it may succeed, by chance, but you had better
 4083 avoid parallel builds (make -j) in this platform, or get a better
 4084 compiler."
 4085 
 4086     $opt_dry_run || $RM $removelist
 4087     exit $EXIT_FAILURE
 4088       fi
 4089 
 4090       # Just move the object if needed
 4091       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
 4092     func_show_eval '$MV "$output_obj" "$obj"' \
 4093       'error=$?; $opt_dry_run || $RM $removelist; exit $error'
 4094       fi
 4095     fi
 4096 
 4097     $opt_dry_run || {
 4098       func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 4099 
 4100       # Unlock the critical section if it was locked
 4101       if test no != "$need_locks"; then
 4102     removelist=$lockfile
 4103         $RM "$lockfile"
 4104       fi
 4105     }
 4106 
 4107     exit $EXIT_SUCCESS
 4108 }
 4109 
 4110 $opt_help || {
 4111   test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
 4112 }
 4113 
 4114 func_mode_help ()
 4115 {
 4116     # We need to display help for each of the modes.
 4117     case $opt_mode in
 4118       "")
 4119         # Generic help is extracted from the usage comments
 4120         # at the start of this file.
 4121         func_help
 4122         ;;
 4123 
 4124       clean)
 4125         $ECHO \
 4126 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 4127 
 4128 Remove files from the build directory.
 4129 
 4130 RM is the name of the program to use to delete files associated with each FILE
 4131 (typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 4132 to RM.
 4133 
 4134 If FILE is a libtool library, object or program, all the files associated
 4135 with it are deleted. Otherwise, only FILE itself is deleted using RM."
 4136         ;;
 4137 
 4138       compile)
 4139       $ECHO \
 4140 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
 4141 
 4142 Compile a source file into a libtool library object.
 4143 
 4144 This mode accepts the following additional options:
 4145 
 4146   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 4147   -no-suppress      do not suppress compiler output for multiple passes
 4148   -prefer-pic       try to build PIC objects only
 4149   -prefer-non-pic   try to build non-PIC objects only
 4150   -shared           do not build a '.o' file suitable for static linking
 4151   -static           only build a '.o' file suitable for static linking
 4152   -Wc,FLAG          pass FLAG directly to the compiler
 4153 
 4154 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
 4155 from the given SOURCEFILE.
 4156 
 4157 The output file name is determined by removing the directory component from
 4158 SOURCEFILE, then substituting the C source code suffix '.c' with the
 4159 library object suffix, '.lo'."
 4160         ;;
 4161 
 4162       execute)
 4163         $ECHO \
 4164 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
 4165 
 4166 Automatically set library path, then run a program.
 4167 
 4168 This mode accepts the following additional options:
 4169 
 4170   -dlopen FILE      add the directory containing FILE to the library path
 4171 
 4172 This mode sets the library path environment variable according to '-dlopen'
 4173 flags.
 4174 
 4175 If any of the ARGS are libtool executable wrappers, then they are translated
 4176 into their corresponding uninstalled binary, and any of their required library
 4177 directories are added to the library path.
 4178 
 4179 Then, COMMAND is executed, with ARGS as arguments."
 4180         ;;
 4181 
 4182       finish)
 4183         $ECHO \
 4184 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
 4185 
 4186 Complete the installation of libtool libraries.
 4187 
 4188 Each LIBDIR is a directory that contains libtool libraries.
 4189 
 4190 The commands that this mode executes may require superuser privileges.  Use
 4191 the '--dry-run' option if you just want to see what would be executed."
 4192         ;;
 4193 
 4194       install)
 4195         $ECHO \
 4196 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
 4197 
 4198 Install executables or libraries.
 4199 
 4200 INSTALL-COMMAND is the installation command.  The first component should be
 4201 either the 'install' or 'cp' program.
 4202 
 4203 The following components of INSTALL-COMMAND are treated specially:
 4204 
 4205   -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 4206 
 4207 The rest of the components are interpreted as arguments to that command (only
 4208 BSD-compatible install options are recognized)."
 4209         ;;
 4210 
 4211       link)
 4212         $ECHO \
 4213 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
 4214 
 4215 Link object files or libraries together to form another library, or to
 4216 create an executable program.
 4217 
 4218 LINK-COMMAND is a command using the C compiler that you would use to create
 4219 a program from several object files.
 4220 
 4221 The following components of LINK-COMMAND are treated specially:
 4222 
 4223   -all-static       do not do any dynamic linking at all
 4224   -avoid-version    do not add a version suffix if possible
 4225   -bindir BINDIR    specify path to binaries directory (for systems where
 4226                     libraries must be found in the PATH setting at runtime)
 4227   -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
 4228   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
 4229   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
 4230   -export-symbols SYMFILE
 4231                     try to export only the symbols listed in SYMFILE
 4232   -export-symbols-regex REGEX
 4233                     try to export only the symbols matching REGEX
 4234   -LLIBDIR          search LIBDIR for required installed libraries
 4235   -lNAME            OUTPUT-FILE requires the installed library libNAME
 4236   -module           build a library that can dlopened
 4237   -no-fast-install  disable the fast-install mode
 4238   -no-install       link a not-installable executable
 4239   -no-undefined     declare that a library does not refer to external symbols
 4240   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 4241   -objectlist FILE  use a list of object files found in FILE to specify objects
 4242   -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
 4243   -precious-files-regex REGEX
 4244                     don't remove output files matching REGEX
 4245   -release RELEASE  specify package release information
 4246   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
 4247   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
 4248   -shared           only do dynamic linking of libtool libraries
 4249   -shrext SUFFIX    override the standard shared library file extension
 4250   -static           do not do any dynamic linking of uninstalled libtool libraries
 4251   -static-libtool-libs
 4252                     do not do any dynamic linking of libtool libraries
 4253   -version-info CURRENT[:REVISION[:AGE]]
 4254                     specify library version info [each variable defaults to 0]
 4255   -weak LIBNAME     declare that the target provides the LIBNAME interface
 4256   -Wc,FLAG
 4257   -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
 4258   -Wl,FLAG
 4259   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
 4260   -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 4261 
 4262 All other options (arguments beginning with '-') are ignored.
 4263 
 4264 Every other argument is treated as a filename.  Files ending in '.la' are
 4265 treated as uninstalled libtool libraries, other files are standard or library
 4266 object files.
 4267 
 4268 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
 4269 only library objects ('.lo' files) may be specified, and '-rpath' is
 4270 required, except when creating a convenience library.
 4271 
 4272 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
 4273 using 'ar' and 'ranlib', or on Windows using 'lib'.
 4274 
 4275 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
 4276 is created, otherwise an executable program is created."
 4277         ;;
 4278 
 4279       uninstall)
 4280         $ECHO \
 4281 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
 4282 
 4283 Remove libraries from an installation directory.
 4284 
 4285 RM is the name of the program to use to delete files associated with each FILE
 4286 (typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 4287 to RM.
 4288 
 4289 If FILE is a libtool library, all the files associated with it are deleted.
 4290 Otherwise, only FILE itself is deleted using RM."
 4291         ;;
 4292 
 4293       *)
 4294         func_fatal_help "invalid operation mode '$opt_mode'"
 4295         ;;
 4296     esac
 4297 
 4298     echo
 4299     $ECHO "Try '$progname --help' for more information about other modes."
 4300 }
 4301 
 4302 # Now that we've collected a possible --mode arg, show help if necessary
 4303 if $opt_help; then
 4304   if test : = "$opt_help"; then
 4305     func_mode_help
 4306   else
 4307     {
 4308       func_help noexit
 4309       for opt_mode in compile link execute install finish uninstall clean; do
 4310     func_mode_help
 4311       done
 4312     } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
 4313     {
 4314       func_help noexit
 4315       for opt_mode in compile link execute install finish uninstall clean; do
 4316     echo
 4317     func_mode_help
 4318       done
 4319     } |
 4320     $SED '1d
 4321       /^When reporting/,/^Report/{
 4322     H
 4323     d
 4324       }
 4325       $x
 4326       /information about other modes/d
 4327       /more detailed .*MODE/d
 4328       s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
 4329   fi
 4330   exit $?
 4331 fi
 4332 
 4333 
 4334 # func_mode_execute arg...
 4335 func_mode_execute ()
 4336 {
 4337     $debug_cmd
 4338 
 4339     # The first argument is the command name.
 4340     cmd=$nonopt
 4341     test -z "$cmd" && \
 4342       func_fatal_help "you must specify a COMMAND"
 4343 
 4344     # Handle -dlopen flags immediately.
 4345     for file in $opt_dlopen; do
 4346       test -f "$file" \
 4347     || func_fatal_help "'$file' is not a file"
 4348 
 4349       dir=
 4350       case $file in
 4351       *.la)
 4352     func_resolve_sysroot "$file"
 4353     file=$func_resolve_sysroot_result
 4354 
 4355     # Check to see that this really is a libtool archive.
 4356     func_lalib_unsafe_p "$file" \
 4357       || func_fatal_help "'$lib' is not a valid libtool archive"
 4358 
 4359     # Read the libtool library.
 4360     dlname=
 4361     library_names=
 4362     func_source "$file"
 4363 
 4364     # Skip this library if it cannot be dlopened.
 4365     if test -z "$dlname"; then
 4366       # Warn if it was a shared library.
 4367       test -n "$library_names" && \
 4368         func_warning "'$file' was not linked with '-export-dynamic'"
 4369       continue
 4370     fi
 4371 
 4372     func_dirname "$file" "" "."
 4373     dir=$func_dirname_result
 4374 
 4375     if test -f "$dir/$objdir/$dlname"; then
 4376       func_append dir "/$objdir"
 4377     else
 4378       if test ! -f "$dir/$dlname"; then
 4379         func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
 4380       fi
 4381     fi
 4382     ;;
 4383 
 4384       *.lo)
 4385     # Just add the directory containing the .lo file.
 4386     func_dirname "$file" "" "."
 4387     dir=$func_dirname_result
 4388     ;;
 4389 
 4390       *)
 4391     func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
 4392     continue
 4393     ;;
 4394       esac
 4395 
 4396       # Get the absolute pathname.
 4397       absdir=`cd "$dir" && pwd`
 4398       test -n "$absdir" && dir=$absdir
 4399 
 4400       # Now add the directory to shlibpath_var.
 4401       if eval "test -z \"\$$shlibpath_var\""; then
 4402     eval "$shlibpath_var=\"\$dir\""
 4403       else
 4404     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
 4405       fi
 4406     done
 4407 
 4408     # This variable tells wrapper scripts just to set shlibpath_var
 4409     # rather than running their programs.
 4410     libtool_execute_magic=$magic
 4411 
 4412     # Check if any of the arguments is a wrapper script.
 4413     args=
 4414     for file
 4415     do
 4416       case $file in
 4417       -* | *.la | *.lo ) ;;
 4418       *)
 4419     # Do a test to see if this is really a libtool program.
 4420     if func_ltwrapper_script_p "$file"; then
 4421       func_source "$file"
 4422       # Transform arg to wrapped name.
 4423       file=$progdir/$program
 4424     elif func_ltwrapper_executable_p "$file"; then
 4425       func_ltwrapper_scriptname "$file"
 4426       func_source "$func_ltwrapper_scriptname_result"
 4427       # Transform arg to wrapped name.
 4428       file=$progdir/$program
 4429     fi
 4430     ;;
 4431       esac
 4432       # Quote arguments (to preserve shell metacharacters).
 4433       func_append_quoted args "$file"
 4434     done
 4435 
 4436     if $opt_dry_run; then
 4437       # Display what would be done.
 4438       if test -n "$shlibpath_var"; then
 4439     eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
 4440     echo "export $shlibpath_var"
 4441       fi
 4442       $ECHO "$cmd$args"
 4443       exit $EXIT_SUCCESS
 4444     else
 4445       if test -n "$shlibpath_var"; then
 4446     # Export the shlibpath_var.
 4447     eval "export $shlibpath_var"
 4448       fi
 4449 
 4450       # Restore saved environment variables
 4451       for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 4452       do
 4453     eval "if test \"\${save_$lt_var+set}\" = set; then
 4454                 $lt_var=\$save_$lt_var; export $lt_var
 4455           else
 4456         $lt_unset $lt_var
 4457           fi"
 4458       done
 4459 
 4460       # Now prepare to actually exec the command.
 4461       exec_cmd=\$cmd$args
 4462     fi
 4463 }
 4464 
 4465 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
 4466 
 4467 
 4468 # func_mode_finish arg...
 4469 func_mode_finish ()
 4470 {
 4471     $debug_cmd
 4472 
 4473     libs=
 4474     libdirs=
 4475     admincmds=
 4476 
 4477     for opt in "$nonopt" ${1+"$@"}
 4478     do
 4479       if test -d "$opt"; then
 4480     func_append libdirs " $opt"
 4481 
 4482       elif test -f "$opt"; then
 4483     if func_lalib_unsafe_p "$opt"; then
 4484       func_append libs " $opt"
 4485     else
 4486       func_warning "'$opt' is not a valid libtool archive"
 4487     fi
 4488 
 4489       else
 4490     func_fatal_error "invalid argument '$opt'"
 4491       fi
 4492     done
 4493 
 4494     if test -n "$libs"; then
 4495       if test -n "$lt_sysroot"; then
 4496         sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
 4497         sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
 4498       else
 4499         sysroot_cmd=
 4500       fi
 4501 
 4502       # Remove sysroot references
 4503       if $opt_dry_run; then
 4504         for lib in $libs; do
 4505           echo "removing references to $lt_sysroot and '=' prefixes from $lib"
 4506         done
 4507       else
 4508         tmpdir=`func_mktempdir`
 4509         for lib in $libs; do
 4510       $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
 4511         > $tmpdir/tmp-la
 4512       mv -f $tmpdir/tmp-la $lib
 4513     done
 4514         ${RM}r "$tmpdir"
 4515       fi
 4516     fi
 4517 
 4518     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 4519       for libdir in $libdirs; do
 4520     if test -n "$finish_cmds"; then
 4521       # Do each command in the finish commands.
 4522       func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
 4523 '"$cmd"'"'
 4524     fi
 4525     if test -n "$finish_eval"; then
 4526       # Do the single finish_eval.
 4527       eval cmds=\"$finish_eval\"
 4528       $opt_dry_run || eval "$cmds" || func_append admincmds "
 4529        $cmds"
 4530     fi
 4531       done
 4532     fi
 4533 
 4534     # Exit here if they wanted silent mode.
 4535     $opt_quiet && exit $EXIT_SUCCESS
 4536 
 4537     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 4538       echo "----------------------------------------------------------------------"
 4539       echo "Libraries have been installed in:"
 4540       for libdir in $libdirs; do
 4541     $ECHO "   $libdir"
 4542       done
 4543       echo
 4544       echo "If you ever happen to want to link against installed libraries"
 4545       echo "in a given directory, LIBDIR, you must either use libtool, and"
 4546       echo "specify the full pathname of the library, or use the '-LLIBDIR'"
 4547       echo "flag during linking and do at least one of the following:"
 4548       if test -n "$shlibpath_var"; then
 4549     echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
 4550     echo "     during execution"
 4551       fi
 4552       if test -n "$runpath_var"; then
 4553     echo "   - add LIBDIR to the '$runpath_var' environment variable"
 4554     echo "     during linking"
 4555       fi
 4556       if test -n "$hardcode_libdir_flag_spec"; then
 4557     libdir=LIBDIR
 4558     eval flag=\"$hardcode_libdir_flag_spec\"
 4559 
 4560     $ECHO "   - use the '$flag' linker flag"
 4561       fi
 4562       if test -n "$admincmds"; then
 4563     $ECHO "   - have your system administrator run these commands:$admincmds"
 4564       fi
 4565       if test -f /etc/ld.so.conf; then
 4566     echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
 4567       fi
 4568       echo
 4569 
 4570       echo "See any operating system documentation about shared libraries for"
 4571       case $host in
 4572     solaris2.[6789]|solaris2.1[0-9])
 4573       echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
 4574       echo "pages."
 4575       ;;
 4576     *)
 4577       echo "more information, such as the ld(1) and ld.so(8) manual pages."
 4578       ;;
 4579       esac
 4580       echo "----------------------------------------------------------------------"
 4581     fi
 4582     exit $EXIT_SUCCESS
 4583 }
 4584 
 4585 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
 4586 
 4587 
 4588 # func_mode_install arg...
 4589 func_mode_install ()
 4590 {
 4591     $debug_cmd
 4592 
 4593     # There may be an optional sh(1) argument at the beginning of
 4594     # install_prog (especially on Windows NT).
 4595     if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
 4596        # Allow the use of GNU shtool's install command.
 4597        case $nonopt in *shtool*) :;; *) false;; esac
 4598     then
 4599       # Aesthetically quote it.
 4600       func_quote_for_eval "$nonopt"
 4601       install_prog="$func_quote_for_eval_result "
 4602       arg=$1
 4603       shift
 4604     else
 4605       install_prog=
 4606       arg=$nonopt
 4607     fi
 4608 
 4609     # The real first argument should be the name of the installation program.
 4610     # Aesthetically quote it.
 4611     func_quote_for_eval "$arg"
 4612     func_append install_prog "$func_quote_for_eval_result"
 4613     install_shared_prog=$install_prog
 4614     case " $install_prog " in
 4615       *[\\\ /]cp\ *) install_cp=: ;;
 4616       *) install_cp=false ;;
 4617     esac
 4618 
 4619     # We need to accept at least all the BSD install flags.
 4620     dest=
 4621     files=
 4622     opts=
 4623     prev=
 4624     install_type=
 4625     isdir=false
 4626     stripme=
 4627     no_mode=:
 4628     for arg
 4629     do
 4630       arg2=
 4631       if test -n "$dest"; then
 4632     func_append files " $dest"
 4633     dest=$arg
 4634     continue
 4635       fi
 4636 
 4637       case $arg in
 4638       -d) isdir=: ;;
 4639       -f)
 4640     if $install_cp; then :; else
 4641       prev=$arg
 4642     fi
 4643     ;;
 4644       -g | -m | -o)
 4645     prev=$arg
 4646     ;;
 4647       -s)
 4648     stripme=" -s"
 4649     continue
 4650     ;;
 4651       -*)
 4652     ;;
 4653       *)
 4654     # If the previous option needed an argument, then skip it.
 4655     if test -n "$prev"; then
 4656       if test X-m = "X$prev" && test -n "$install_override_mode"; then
 4657         arg2=$install_override_mode
 4658         no_mode=false
 4659       fi
 4660       prev=
 4661     else
 4662       dest=$arg
 4663       continue
 4664     fi
 4665     ;;
 4666       esac
 4667 
 4668       # Aesthetically quote the argument.
 4669       func_quote_for_eval "$arg"
 4670       func_append install_prog " $func_quote_for_eval_result"
 4671       if test -n "$arg2"; then
 4672     func_quote_for_eval "$arg2"
 4673       fi
 4674       func_append install_shared_prog " $func_quote_for_eval_result"
 4675     done
 4676 
 4677     test -z "$install_prog" && \
 4678       func_fatal_help "you must specify an install program"
 4679 
 4680     test -n "$prev" && \
 4681       func_fatal_help "the '$prev' option requires an argument"
 4682 
 4683     if test -n "$install_override_mode" && $no_mode; then
 4684       if $install_cp; then :; else
 4685     func_quote_for_eval "$install_override_mode"
 4686     func_append install_shared_prog " -m $func_quote_for_eval_result"
 4687       fi
 4688     fi
 4689 
 4690     if test -z "$files"; then
 4691       if test -z "$dest"; then
 4692     func_fatal_help "no file or destination specified"
 4693       else
 4694     func_fatal_help "you must specify a destination"
 4695       fi
 4696     fi
 4697 
 4698     # Strip any trailing slash from the destination.
 4699     func_stripname '' '/' "$dest"
 4700     dest=$func_stripname_result
 4701 
 4702     # Check to see that the destination is a directory.
 4703     test -d "$dest" && isdir=:
 4704     if $isdir; then
 4705       destdir=$dest
 4706       destname=
 4707     else
 4708       func_dirname_and_basename "$dest" "" "."
 4709       destdir=$func_dirname_result
 4710       destname=$func_basename_result
 4711 
 4712       # Not a directory, so check to see that there is only one file specified.
 4713       set dummy $files; shift
 4714       test "$#" -gt 1 && \
 4715     func_fatal_help "'$dest' is not a directory"
 4716     fi
 4717     case $destdir in
 4718     [\\/]* | [A-Za-z]:[\\/]*) ;;
 4719     *)
 4720       for file in $files; do
 4721     case $file in
 4722     *.lo) ;;
 4723     *)
 4724       func_fatal_help "'$destdir' must be an absolute directory name"
 4725       ;;
 4726     esac
 4727       done
 4728       ;;
 4729     esac
 4730 
 4731     # This variable tells wrapper scripts just to set variables rather
 4732     # than running their programs.
 4733     libtool_install_magic=$magic
 4734 
 4735     staticlibs=
 4736     future_libdirs=
 4737     current_libdirs=
 4738     for file in $files; do
 4739 
 4740       # Do each installation.
 4741       case $file in
 4742       *.$libext)
 4743     # Do the static libraries later.
 4744     func_append staticlibs " $file"
 4745     ;;
 4746 
 4747       *.la)
 4748     func_resolve_sysroot "$file"
 4749     file=$func_resolve_sysroot_result
 4750 
 4751     # Check to see that this really is a libtool archive.
 4752     func_lalib_unsafe_p "$file" \
 4753       || func_fatal_help "'$file' is not a valid libtool archive"
 4754 
 4755     library_names=
 4756     old_library=
 4757     relink_command=
 4758     func_source "$file"
 4759 
 4760     # Add the libdir to current_libdirs if it is the destination.
 4761     if test "X$destdir" = "X$libdir"; then
 4762       case "$current_libdirs " in
 4763       *" $libdir "*) ;;
 4764       *) func_append current_libdirs " $libdir" ;;
 4765       esac
 4766     else
 4767       # Note the libdir as a future libdir.
 4768       case "$future_libdirs " in
 4769       *" $libdir "*) ;;
 4770       *) func_append future_libdirs " $libdir" ;;
 4771       esac
 4772     fi
 4773 
 4774     func_dirname "$file" "/" ""
 4775     dir=$func_dirname_result
 4776     func_append dir "$objdir"
 4777 
 4778     if test -n "$relink_command"; then
 4779       # Determine the prefix the user has applied to our future dir.
 4780       inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 4781 
 4782       # Don't allow the user to place us outside of our expected
 4783       # location b/c this prevents finding dependent libraries that
 4784       # are installed to the same prefix.
 4785       # At present, this check doesn't affect windows .dll's that
 4786       # are installed into $libdir/../bin (currently, that works fine)
 4787       # but it's something to keep an eye on.
 4788       test "$inst_prefix_dir" = "$destdir" && \
 4789         func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
 4790 
 4791       if test -n "$inst_prefix_dir"; then
 4792         # Stick the inst_prefix_dir data into the link command.
 4793         relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 4794       else
 4795         relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 4796       fi
 4797 
 4798       func_warning "relinking '$file'"
 4799       func_show_eval "$relink_command" \
 4800         'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
 4801     fi
 4802 
 4803     # See the names of the shared library.
 4804     set dummy $library_names; shift
 4805     if test -n "$1"; then
 4806       realname=$1
 4807       shift
 4808 
 4809       srcname=$realname
 4810       test -n "$relink_command" && srcname=${realname}T
 4811 
 4812       # Install the shared library and build the symlinks.
 4813       func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 4814           'exit $?'
 4815       tstripme=$stripme
 4816       case $host_os in
 4817       cygwin* | mingw* | pw32* | cegcc*)
 4818         case $realname in
 4819         *.dll.a)
 4820           tstripme=
 4821           ;;
 4822         esac
 4823         ;;
 4824       os2*)
 4825         case $realname in
 4826         *_dll.a)
 4827           tstripme=
 4828           ;;
 4829         esac
 4830         ;;
 4831       esac
 4832       if test -n "$tstripme" && test -n "$striplib"; then
 4833         func_show_eval "$striplib $destdir/$realname" 'exit $?'
 4834       fi
 4835 
 4836       if test "$#" -gt 0; then
 4837         # Delete the old symlinks, and create new ones.
 4838         # Try 'ln -sf' first, because the 'ln' binary might depend on
 4839         # the symlink we replace!  Solaris /bin/ln does not understand -f,
 4840         # so we also need to try rm && ln -s.
 4841         for linkname
 4842         do
 4843           test "$linkname" != "$realname" \
 4844         && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
 4845         done
 4846       fi
 4847 
 4848       # Do each command in the postinstall commands.
 4849       lib=$destdir/$realname
 4850       func_execute_cmds "$postinstall_cmds" 'exit $?'
 4851     fi
 4852 
 4853     # Install the pseudo-library for information purposes.
 4854     func_basename "$file"
 4855     name=$func_basename_result
 4856     instname=$dir/${name}i
 4857     func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 4858 
 4859     # Maybe install the static library, too.
 4860     test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 4861     ;;
 4862 
 4863       *.lo)
 4864     # Install (i.e. copy) a libtool object.
 4865 
 4866     # Figure out destination file name, if it wasn't already specified.
 4867     if test -n "$destname"; then
 4868       destfile=$destdir/$destname
 4869     else
 4870       func_basename "$file"
 4871       destfile=$func_basename_result
 4872       destfile=$destdir/$destfile
 4873     fi
 4874 
 4875     # Deduce the name of the destination old-style object file.
 4876     case $destfile in
 4877     *.lo)
 4878       func_lo2o "$destfile"
 4879       staticdest=$func_lo2o_result
 4880       ;;
 4881     *.$objext)
 4882       staticdest=$destfile
 4883       destfile=
 4884       ;;
 4885     *)
 4886       func_fatal_help "cannot copy a libtool object to '$destfile'"
 4887       ;;
 4888     esac
 4889 
 4890     # Install the libtool object if requested.
 4891     test -n "$destfile" && \
 4892       func_show_eval "$install_prog $file $destfile" 'exit $?'
 4893 
 4894     # Install the old object if enabled.
 4895     if test yes = "$build_old_libs"; then
 4896       # Deduce the name of the old-style object file.
 4897       func_lo2o "$file"
 4898       staticobj=$func_lo2o_result
 4899       func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
 4900     fi
 4901     exit $EXIT_SUCCESS
 4902     ;;
 4903 
 4904       *)
 4905     # Figure out destination file name, if it wasn't already specified.
 4906     if test -n "$destname"; then
 4907       destfile=$destdir/$destname
 4908     else
 4909       func_basename "$file"
 4910       destfile=$func_basename_result
 4911       destfile=$destdir/$destfile
 4912     fi
 4913 
 4914     # If the file is missing, and there is a .exe on the end, strip it
 4915     # because it is most likely a libtool script we actually want to
 4916     # install
 4917     stripped_ext=
 4918     case $file in
 4919       *.exe)
 4920         if test ! -f "$file"; then
 4921           func_stripname '' '.exe' "$file"
 4922           file=$func_stripname_result
 4923           stripped_ext=.exe
 4924         fi
 4925         ;;
 4926     esac
 4927 
 4928     # Do a test to see if this is really a libtool program.
 4929     case $host in
 4930     *cygwin* | *mingw*)
 4931         if func_ltwrapper_executable_p "$file"; then
 4932           func_ltwrapper_scriptname "$file"
 4933           wrapper=$func_ltwrapper_scriptname_result
 4934         else
 4935           func_stripname '' '.exe' "$file"
 4936           wrapper=$func_stripname_result
 4937         fi
 4938         ;;
 4939     *)
 4940         wrapper=$file
 4941         ;;
 4942     esac
 4943     if func_ltwrapper_script_p "$wrapper"; then
 4944       notinst_deplibs=
 4945       relink_command=
 4946 
 4947       func_source "$wrapper"
 4948 
 4949       # Check the variables that should have been set.
 4950       test -z "$generated_by_libtool_version" && \
 4951         func_fatal_error "invalid libtool wrapper script '$wrapper'"
 4952 
 4953       finalize=:
 4954       for lib in $notinst_deplibs; do
 4955         # Check to see that each library is installed.
 4956         libdir=
 4957         if test -f "$lib"; then
 4958           func_source "$lib"
 4959         fi
 4960         libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
 4961         if test -n "$libdir" && test ! -f "$libfile"; then
 4962           func_warning "'$lib' has not been installed in '$libdir'"
 4963           finalize=false
 4964         fi
 4965       done
 4966 
 4967       relink_command=
 4968       func_source "$wrapper"
 4969 
 4970       outputname=
 4971       if test no = "$fast_install" && test -n "$relink_command"; then
 4972         $opt_dry_run || {
 4973           if $finalize; then
 4974             tmpdir=`func_mktempdir`
 4975         func_basename "$file$stripped_ext"
 4976         file=$func_basename_result
 4977             outputname=$tmpdir/$file
 4978             # Replace the output file specification.
 4979             relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 4980 
 4981             $opt_quiet || {
 4982               func_quote_for_expand "$relink_command"
 4983           eval "func_echo $func_quote_for_expand_result"
 4984             }
 4985             if eval "$relink_command"; then :
 4986               else
 4987           func_error "error: relink '$file' with the above command before installing it"
 4988           $opt_dry_run || ${RM}r "$tmpdir"
 4989           continue
 4990             fi
 4991             file=$outputname
 4992           else
 4993             func_warning "cannot relink '$file'"
 4994           fi
 4995         }
 4996       else
 4997         # Install the binary that we compiled earlier.
 4998         file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 4999       fi
 5000     fi
 5001 
 5002     # remove .exe since cygwin /usr/bin/install will append another
 5003     # one anyway
 5004     case $install_prog,$host in
 5005     */usr/bin/install*,*cygwin*)
 5006       case $file:$destfile in
 5007       *.exe:*.exe)
 5008         # this is ok
 5009         ;;
 5010       *.exe:*)
 5011         destfile=$destfile.exe
 5012         ;;
 5013       *:*.exe)
 5014         func_stripname '' '.exe' "$destfile"
 5015         destfile=$func_stripname_result
 5016         ;;
 5017       esac
 5018       ;;
 5019     esac
 5020     func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
 5021     $opt_dry_run || if test -n "$outputname"; then
 5022       ${RM}r "$tmpdir"
 5023     fi
 5024     ;;
 5025       esac
 5026     done
 5027 
 5028     for file in $staticlibs; do
 5029       func_basename "$file"
 5030       name=$func_basename_result
 5031 
 5032       # Set up the ranlib parameters.
 5033       oldlib=$destdir/$name
 5034       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
 5035       tool_oldlib=$func_to_tool_file_result
 5036 
 5037       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 5038 
 5039       if test -n "$stripme" && test -n "$old_striplib"; then
 5040     func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
 5041       fi
 5042 
 5043       # Do each command in the postinstall commands.
 5044       func_execute_cmds "$old_postinstall_cmds" 'exit $?'
 5045     done
 5046 
 5047     test -n "$future_libdirs" && \
 5048       func_warning "remember to run '$progname --finish$future_libdirs'"
 5049 
 5050     if test -n "$current_libdirs"; then
 5051       # Maybe just do a dry run.
 5052       $opt_dry_run && current_libdirs=" -n$current_libdirs"
 5053       exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
 5054     else
 5055       exit $EXIT_SUCCESS
 5056     fi
 5057 }
 5058 
 5059 test install = "$opt_mode" && func_mode_install ${1+"$@"}
 5060 
 5061 
 5062 # func_generate_dlsyms outputname originator pic_p
 5063 # Extract symbols from dlprefiles and create ${outputname}S.o with
 5064 # a dlpreopen symbol table.
 5065 func_generate_dlsyms ()
 5066 {
 5067     $debug_cmd
 5068 
 5069     my_outputname=$1
 5070     my_originator=$2
 5071     my_pic_p=${3-false}
 5072     my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
 5073     my_dlsyms=
 5074 
 5075     if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
 5076       if test -n "$NM" && test -n "$global_symbol_pipe"; then
 5077     my_dlsyms=${my_outputname}S.c
 5078       else
 5079     func_error "not configured to extract global symbols from dlpreopened files"
 5080       fi
 5081     fi
 5082 
 5083     if test -n "$my_dlsyms"; then
 5084       case $my_dlsyms in
 5085       "") ;;
 5086       *.c)
 5087     # Discover the nlist of each of the dlfiles.
 5088     nlist=$output_objdir/$my_outputname.nm
 5089 
 5090     func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 5091 
 5092     # Parse the name list into a source file.
 5093     func_verbose "creating $output_objdir/$my_dlsyms"
 5094 
 5095     $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
 5096 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
 5097 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
 5098 
 5099 #ifdef __cplusplus
 5100 extern \"C\" {
 5101 #endif
 5102 
 5103 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 5104 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 5105 #endif
 5106 
 5107 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 5108 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
 5109 /* DATA imports from DLLs on WIN32 can't be const, because runtime
 5110    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 5111 # define LT_DLSYM_CONST
 5112 #elif defined __osf__
 5113 /* This system does not cope well with relocations in const data.  */
 5114 # define LT_DLSYM_CONST
 5115 #else
 5116 # define LT_DLSYM_CONST const
 5117 #endif
 5118 
 5119 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 5120 
 5121 /* External symbol declarations for the compiler. */\
 5122 "
 5123 
 5124     if test yes = "$dlself"; then
 5125       func_verbose "generating symbol list for '$output'"
 5126 
 5127       $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 5128 
 5129       # Add our own program objects to the symbol list.
 5130       progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 5131       for progfile in $progfiles; do
 5132         func_to_tool_file "$progfile" func_convert_file_msys_to_w32
 5133         func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
 5134         $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 5135       done
 5136 
 5137       if test -n "$exclude_expsyms"; then
 5138         $opt_dry_run || {
 5139           eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 5140           eval '$MV "$nlist"T "$nlist"'
 5141         }
 5142       fi
 5143 
 5144       if test -n "$export_symbols_regex"; then
 5145         $opt_dry_run || {
 5146           eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 5147           eval '$MV "$nlist"T "$nlist"'
 5148         }
 5149       fi
 5150 
 5151       # Prepare the list of exported symbols
 5152       if test -z "$export_symbols"; then
 5153         export_symbols=$output_objdir/$outputname.exp
 5154         $opt_dry_run || {
 5155           $RM $export_symbols
 5156           eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 5157           case $host in
 5158           *cygwin* | *mingw* | *cegcc* )
 5159                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 5160                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 5161             ;;
 5162           esac
 5163         }
 5164       else
 5165         $opt_dry_run || {
 5166           eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 5167           eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 5168           eval '$MV "$nlist"T "$nlist"'
 5169           case $host in
 5170             *cygwin* | *mingw* | *cegcc* )
 5171               eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 5172               eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 5173               ;;
 5174           esac
 5175         }
 5176       fi
 5177     fi
 5178 
 5179     for dlprefile in $dlprefiles; do
 5180       func_verbose "extracting global C symbols from '$dlprefile'"
 5181       func_basename "$dlprefile"
 5182       name=$func_basename_result
 5183           case $host in
 5184         *cygwin* | *mingw* | *cegcc* )
 5185           # if an import library, we need to obtain dlname
 5186           if func_win32_import_lib_p "$dlprefile"; then
 5187             func_tr_sh "$dlprefile"
 5188             eval "curr_lafile=\$libfile_$func_tr_sh_result"
 5189             dlprefile_dlbasename=
 5190             if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
 5191               # Use subshell, to avoid clobbering current variable values
 5192               dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
 5193               if test -n "$dlprefile_dlname"; then
 5194                 func_basename "$dlprefile_dlname"
 5195                 dlprefile_dlbasename=$func_basename_result
 5196               else
 5197                 # no lafile. user explicitly requested -dlpreopen <import library>.
 5198                 $sharedlib_from_linklib_cmd "$dlprefile"
 5199                 dlprefile_dlbasename=$sharedlib_from_linklib_result
 5200               fi
 5201             fi
 5202             $opt_dry_run || {
 5203               if test -n "$dlprefile_dlbasename"; then
 5204                 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
 5205               else
 5206                 func_warning "Could not compute DLL name from $name"
 5207                 eval '$ECHO ": $name " >> "$nlist"'
 5208               fi
 5209               func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 5210               eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
 5211                 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
 5212             }
 5213           else # not an import lib
 5214             $opt_dry_run || {
 5215               eval '$ECHO ": $name " >> "$nlist"'
 5216               func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 5217               eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 5218             }
 5219           fi
 5220         ;;
 5221         *)
 5222           $opt_dry_run || {
 5223             eval '$ECHO ": $name " >> "$nlist"'
 5224             func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 5225             eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 5226           }
 5227         ;;
 5228           esac
 5229     done
 5230 
 5231     $opt_dry_run || {
 5232       # Make sure we have at least an empty file.
 5233       test -f "$nlist" || : > "$nlist"
 5234 
 5235       if test -n "$exclude_expsyms"; then
 5236         $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 5237         $MV "$nlist"T "$nlist"
 5238       fi
 5239 
 5240       # Try sorting and uniquifying the output.
 5241       if $GREP -v "^: " < "$nlist" |
 5242           if sort -k 3 </dev/null >/dev/null 2>&1; then
 5243         sort -k 3
 5244           else
 5245         sort +2
 5246           fi |
 5247           uniq > "$nlist"S; then
 5248         :
 5249       else
 5250         $GREP -v "^: " < "$nlist" > "$nlist"S
 5251       fi
 5252 
 5253       if test -f "$nlist"S; then
 5254         eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 5255       else
 5256         echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 5257       fi
 5258 
 5259       func_show_eval '$RM "${nlist}I"'
 5260       if test -n "$global_symbol_to_import"; then
 5261         eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
 5262       fi
 5263 
 5264       echo >> "$output_objdir/$my_dlsyms" "\
 5265 
 5266 /* The mapping between symbol names and symbols.  */
 5267 typedef struct {
 5268   const char *name;
 5269   void *address;
 5270 } lt_dlsymlist;
 5271 extern LT_DLSYM_CONST lt_dlsymlist
 5272 lt_${my_prefix}_LTX_preloaded_symbols[];\
 5273 "
 5274 
 5275       if test -s "$nlist"I; then
 5276         echo >> "$output_objdir/$my_dlsyms" "\
 5277 static void lt_syminit(void)
 5278 {
 5279   LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
 5280   for (; symbol->name; ++symbol)
 5281     {"
 5282         $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
 5283         echo >> "$output_objdir/$my_dlsyms" "\
 5284     }
 5285 }"
 5286       fi
 5287       echo >> "$output_objdir/$my_dlsyms" "\
 5288 LT_DLSYM_CONST lt_dlsymlist
 5289 lt_${my_prefix}_LTX_preloaded_symbols[] =
 5290 { {\"$my_originator\", (void *) 0},"
 5291 
 5292       if test -s "$nlist"I; then
 5293         echo >> "$output_objdir/$my_dlsyms" "\
 5294   {\"@INIT@\", (void *) &lt_syminit},"
 5295       fi
 5296 
 5297       case $need_lib_prefix in
 5298       no)
 5299         eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
 5300         ;;
 5301       *)
 5302         eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 5303         ;;
 5304       esac
 5305       echo >> "$output_objdir/$my_dlsyms" "\
 5306   {0, (void *) 0}
 5307 };
 5308 
 5309 /* This works around a problem in FreeBSD linker */
 5310 #ifdef FREEBSD_WORKAROUND
 5311 static const void *lt_preloaded_setup() {
 5312   return lt_${my_prefix}_LTX_preloaded_symbols;
 5313 }
 5314 #endif
 5315 
 5316 #ifdef __cplusplus
 5317 }
 5318 #endif\
 5319 "
 5320     } # !$opt_dry_run
 5321 
 5322     pic_flag_for_symtable=
 5323     case "$compile_command " in
 5324     *" -static "*) ;;
 5325     *)
 5326       case $host in
 5327       # compiling the symbol table file with pic_flag works around
 5328       # a FreeBSD bug that causes programs to crash when -lm is
 5329       # linked before any other PIC object.  But we must not use
 5330       # pic_flag when linking with -static.  The problem exists in
 5331       # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
 5332       *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 5333         pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 5334       *-*-hpux*)
 5335         pic_flag_for_symtable=" $pic_flag"  ;;
 5336       *)
 5337         $my_pic_p && pic_flag_for_symtable=" $pic_flag"
 5338         ;;
 5339       esac
 5340       ;;
 5341     esac
 5342     symtab_cflags=
 5343     for arg in $LTCFLAGS; do
 5344       case $arg in
 5345       -pie | -fpie | -fPIE) ;;
 5346       *) func_append symtab_cflags " $arg" ;;
 5347       esac
 5348     done
 5349 
 5350     # Now compile the dynamic symbol file.
 5351     func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 5352 
 5353     # Clean up the generated files.
 5354     func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
 5355 
 5356     # Transform the symbol file into the correct name.
 5357     symfileobj=$output_objdir/${my_outputname}S.$objext
 5358     case $host in
 5359     *cygwin* | *mingw* | *cegcc* )
 5360       if test -f "$output_objdir/$my_outputname.def"; then
 5361         compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 5362         finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 5363       else
 5364         compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 5365         finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 5366       fi
 5367       ;;
 5368     *)
 5369       compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 5370       finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 5371       ;;
 5372     esac
 5373     ;;
 5374       *)
 5375     func_fatal_error "unknown suffix for '$my_dlsyms'"
 5376     ;;
 5377       esac
 5378     else
 5379       # We keep going just in case the user didn't refer to
 5380       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
 5381       # really was required.
 5382 
 5383       # Nullify the symbol file.
 5384       compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
 5385       finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
 5386     fi
 5387 }
 5388 
 5389 # func_cygming_gnu_implib_p ARG
 5390 # This predicate returns with zero status (TRUE) if
 5391 # ARG is a GNU/binutils-style import library. Returns
 5392 # with nonzero status (FALSE) otherwise.
 5393 func_cygming_gnu_implib_p ()
 5394 {
 5395   $debug_cmd
 5396 
 5397   func_to_tool_file "$1" func_convert_file_msys_to_w32
 5398   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)$'`
 5399   test -n "$func_cygming_gnu_implib_tmp"
 5400 }
 5401 
 5402 # func_cygming_ms_implib_p ARG
 5403 # This predicate returns with zero status (TRUE) if
 5404 # ARG is an MS-style import library. Returns
 5405 # with nonzero status (FALSE) otherwise.
 5406 func_cygming_ms_implib_p ()
 5407 {
 5408   $debug_cmd
 5409 
 5410   func_to_tool_file "$1" func_convert_file_msys_to_w32
 5411   func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
 5412   test -n "$func_cygming_ms_implib_tmp"
 5413 }
 5414 
 5415 # func_win32_libid arg
 5416 # return the library type of file 'arg'
 5417 #
 5418 # Need a lot of goo to handle *both* DLLs and import libs
 5419 # Has to be a shell function in order to 'eat' the argument
 5420 # that is supplied when $file_magic_command is called.
 5421 # Despite the name, also deal with 64 bit binaries.
 5422 func_win32_libid ()
 5423 {
 5424   $debug_cmd
 5425 
 5426   win32_libid_type=unknown
 5427   win32_fileres=`file -L $1 2>/dev/null`
 5428   case $win32_fileres in
 5429   *ar\ archive\ import\ library*) # definitely import
 5430     win32_libid_type="x86 archive import"
 5431     ;;
 5432   *ar\ archive*) # could be an import, or static
 5433     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
 5434     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
 5435        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
 5436       case $nm_interface in
 5437       "MS dumpbin")
 5438     if func_cygming_ms_implib_p "$1" ||
 5439        func_cygming_gnu_implib_p "$1"
 5440     then
 5441       win32_nmres=import
 5442     else
 5443       win32_nmres=
 5444     fi
 5445     ;;
 5446       *)
 5447     func_to_tool_file "$1" func_convert_file_msys_to_w32
 5448     win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 5449       $SED -n -e '
 5450         1,100{
 5451         / I /{
 5452             s|.*|import|
 5453             p
 5454             q
 5455         }
 5456         }'`
 5457     ;;
 5458       esac
 5459       case $win32_nmres in
 5460       import*)  win32_libid_type="x86 archive import";;
 5461       *)        win32_libid_type="x86 archive static";;
 5462       esac
 5463     fi
 5464     ;;
 5465   *DLL*)
 5466     win32_libid_type="x86 DLL"
 5467     ;;
 5468   *executable*) # but shell scripts are "executable" too...
 5469     case $win32_fileres in
 5470     *MS\ Windows\ PE\ Intel*)
 5471       win32_libid_type="x86 DLL"
 5472       ;;
 5473     esac
 5474     ;;
 5475   esac
 5476   $ECHO "$win32_libid_type"
 5477 }
 5478 
 5479 # func_cygming_dll_for_implib ARG
 5480 #
 5481 # Platform-specific function to extract the
 5482 # name of the DLL associated with the specified
 5483 # import library ARG.
 5484 # Invoked by eval'ing the libtool variable
 5485 #    $sharedlib_from_linklib_cmd
 5486 # Result is available in the variable
 5487 #    $sharedlib_from_linklib_result
 5488 func_cygming_dll_for_implib ()
 5489 {
 5490   $debug_cmd
 5491 
 5492   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
 5493 }
 5494 
 5495 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
 5496 #
 5497 # The is the core of a fallback implementation of a
 5498 # platform-specific function to extract the name of the
 5499 # DLL associated with the specified import library LIBNAME.
 5500 #
 5501 # SECTION_NAME is either .idata$6 or .idata$7, depending
 5502 # on the platform and compiler that created the implib.
 5503 #
 5504 # Echos the name of the DLL associated with the
 5505 # specified import library.
 5506 func_cygming_dll_for_implib_fallback_core ()
 5507 {
 5508   $debug_cmd
 5509 
 5510   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
 5511   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
 5512     $SED '/^Contents of section '"$match_literal"':/{
 5513       # Place marker at beginning of archive member dllname section
 5514       s/.*/====MARK====/
 5515       p
 5516       d
 5517     }
 5518     # These lines can sometimes be longer than 43 characters, but
 5519     # are always uninteresting
 5520     /:[  ]*file format pe[i]\{,1\}-/d
 5521     /^In archive [^:]*:/d
 5522     # Ensure marker is printed
 5523     /^====MARK====/p
 5524     # Remove all lines with less than 43 characters
 5525     /^.\{43\}/!d
 5526     # From remaining lines, remove first 43 characters
 5527     s/^.\{43\}//' |
 5528     $SED -n '
 5529       # Join marker and all lines until next marker into a single line
 5530       /^====MARK====/ b para
 5531       H
 5532       $ b para
 5533       b
 5534       :para
 5535       x
 5536       s/\n//g
 5537       # Remove the marker
 5538       s/^====MARK====//
 5539       # Remove trailing dots and whitespace
 5540       s/[\. \t]*$//
 5541       # Print
 5542       /./p' |
 5543     # we now have a list, one entry per line, of the stringified
 5544     # contents of the appropriate section of all members of the
 5545     # archive that possess that section. Heuristic: eliminate
 5546     # all those that have a first or second character that is
 5547     # a '.' (that is, objdump's representation of an unprintable
 5548     # character.) This should work for all archives with less than
 5549     # 0x302f exports -- but will fail for DLLs whose name actually
 5550     # begins with a literal '.' or a single character followed by
 5551     # a '.'.
 5552     #
 5553     # Of those that remain, print the first one.
 5554     $SED -e '/^\./d;/^.\./d;q'
 5555 }
 5556 
 5557 # func_cygming_dll_for_implib_fallback ARG
 5558 # Platform-specific function to extract the
 5559 # name of the DLL associated with the specified
 5560 # import library ARG.
 5561 #
 5562 # This fallback implementation is for use when $DLLTOOL
 5563 # does not support the --identify-strict option.
 5564 # Invoked by eval'ing the libtool variable
 5565 #    $sharedlib_from_linklib_cmd
 5566 # Result is available in the variable
 5567 #    $sharedlib_from_linklib_result
 5568 func_cygming_dll_for_implib_fallback ()
 5569 {
 5570   $debug_cmd
 5571 
 5572   if func_cygming_gnu_implib_p "$1"; then
 5573     # binutils import library
 5574     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
 5575   elif func_cygming_ms_implib_p "$1"; then
 5576     # ms-generated import library
 5577     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
 5578   else
 5579     # unknown
 5580     sharedlib_from_linklib_result=
 5581   fi
 5582 }
 5583 
 5584 
 5585 # func_extract_an_archive dir oldlib
 5586 func_extract_an_archive ()
 5587 {
 5588     $debug_cmd
 5589 
 5590     f_ex_an_ar_dir=$1; shift
 5591     f_ex_an_ar_oldlib=$1
 5592     if test yes = "$lock_old_archive_extraction"; then
 5593       lockfile=$f_ex_an_ar_oldlib.lock
 5594       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 5595     func_echo "Waiting for $lockfile to be removed"
 5596     sleep 2
 5597       done
 5598     fi
 5599     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
 5600            'stat=$?; rm -f "$lockfile"; exit $stat'
 5601     if test yes = "$lock_old_archive_extraction"; then
 5602       $opt_dry_run || rm -f "$lockfile"
 5603     fi
 5604     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 5605      :
 5606     else
 5607       func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
 5608     fi
 5609 }
 5610 
 5611 
 5612 # func_extract_archives gentop oldlib ...
 5613 func_extract_archives ()
 5614 {
 5615     $debug_cmd
 5616 
 5617     my_gentop=$1; shift
 5618     my_oldlibs=${1+"$@"}
 5619     my_oldobjs=
 5620     my_xlib=
 5621     my_xabs=
 5622     my_xdir=
 5623 
 5624     for my_xlib in $my_oldlibs; do
 5625       # Extract the objects.
 5626       case $my_xlib in
 5627     [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
 5628     *) my_xabs=`pwd`"/$my_xlib" ;;
 5629       esac
 5630       func_basename "$my_xlib"
 5631       my_xlib=$func_basename_result
 5632       my_xlib_u=$my_xlib
 5633       while :; do
 5634         case " $extracted_archives " in
 5635     *" $my_xlib_u "*)
 5636       func_arith $extracted_serial + 1
 5637       extracted_serial=$func_arith_result
 5638       my_xlib_u=lt$extracted_serial-$my_xlib ;;
 5639     *) break ;;
 5640     esac
 5641       done
 5642       extracted_archives="$extracted_archives $my_xlib_u"
 5643       my_xdir=$my_gentop/$my_xlib_u
 5644 
 5645       func_mkdir_p "$my_xdir"
 5646 
 5647       case $host in
 5648       *-darwin*)
 5649     func_verbose "Extracting $my_xabs"
 5650     # Do not bother doing anything if just a dry run
 5651     $opt_dry_run || {
 5652       darwin_orig_dir=`pwd`
 5653       cd $my_xdir || exit $?
 5654       darwin_archive=$my_xabs
 5655       darwin_curdir=`pwd`
 5656       func_basename "$darwin_archive"
 5657       darwin_base_archive=$func_basename_result
 5658       darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
 5659       if test -n "$darwin_arches"; then
 5660         darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
 5661         darwin_arch=
 5662         func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
 5663         for darwin_arch in  $darwin_arches; do
 5664           func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
 5665           $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
 5666           cd "unfat-$$/$darwin_base_archive-$darwin_arch"
 5667           func_extract_an_archive "`pwd`" "$darwin_base_archive"
 5668           cd "$darwin_curdir"
 5669           $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
 5670         done # $darwin_arches
 5671             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
 5672         darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
 5673         darwin_file=
 5674         darwin_files=
 5675         for darwin_file in $darwin_filelist; do
 5676           darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 5677           $LIPO -create -output "$darwin_file" $darwin_files
 5678         done # $darwin_filelist
 5679         $RM -rf unfat-$$
 5680         cd "$darwin_orig_dir"
 5681       else
 5682         cd $darwin_orig_dir
 5683         func_extract_an_archive "$my_xdir" "$my_xabs"
 5684       fi # $darwin_arches
 5685     } # !$opt_dry_run
 5686     ;;
 5687       *)
 5688         func_extract_an_archive "$my_xdir" "$my_xabs"
 5689     ;;
 5690       esac
 5691       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
 5692     done
 5693 
 5694     func_extract_archives_result=$my_oldobjs
 5695 }
 5696 
 5697 
 5698 # func_emit_wrapper [arg=no]
 5699 #
 5700 # Emit a libtool wrapper script on stdout.
 5701 # Don't directly open a file because we may want to
 5702 # incorporate the script contents within a cygwin/mingw
 5703 # wrapper executable.  Must ONLY be called from within
 5704 # func_mode_link because it depends on a number of variables
 5705 # set therein.
 5706 #
 5707 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 5708 # variable will take.  If 'yes', then the emitted script
 5709 # will assume that the directory where it is stored is
 5710 # the $objdir directory.  This is a cygwin/mingw-specific
 5711 # behavior.
 5712 func_emit_wrapper ()
 5713 {
 5714     func_emit_wrapper_arg1=${1-no}
 5715 
 5716     $ECHO "\
 5717 #! $SHELL
 5718 
 5719 # $output - temporary wrapper script for $objdir/$outputname
 5720 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 5721 #
 5722 # The $output program cannot be directly executed until all the libtool
 5723 # libraries that it depends on are installed.
 5724 #
 5725 # This wrapper script should never be moved out of the build directory.
 5726 # If it is, it will not operate correctly.
 5727 
 5728 # Sed substitution that helps us do robust quoting.  It backslashifies
 5729 # metacharacters that are still active within double-quoted strings.
 5730 sed_quote_subst='$sed_quote_subst'
 5731 
 5732 # Be Bourne compatible
 5733 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 5734   emulate sh
 5735   NULLCMD=:
 5736   # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 5737   # is contrary to our usage.  Disable this feature.
 5738   alias -g '\${1+\"\$@\"}'='\"\$@\"'
 5739   setopt NO_GLOB_SUBST
 5740 else
 5741   case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 5742 fi
 5743 BIN_SH=xpg4; export BIN_SH # for Tru64
 5744 DUALCASE=1; export DUALCASE # for MKS sh
 5745 
 5746 # The HP-UX ksh and POSIX shell print the target directory to stdout
 5747 # if CDPATH is set.
 5748 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 5749 
 5750 relink_command=\"$relink_command\"
 5751 
 5752 # This environment variable determines our operation mode.
 5753 if test \"\$libtool_install_magic\" = \"$magic\"; then
 5754   # install mode needs the following variables:
 5755   generated_by_libtool_version='$macro_version'
 5756   notinst_deplibs='$notinst_deplibs'
 5757 else
 5758   # When we are sourced in execute mode, \$file and \$ECHO are already set.
 5759   if test \"\$libtool_execute_magic\" != \"$magic\"; then
 5760     file=\"\$0\""
 5761 
 5762     qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
 5763     $ECHO "\
 5764 
 5765 # A function that is used when there is no print builtin or printf.
 5766 func_fallback_echo ()
 5767 {
 5768   eval 'cat <<_LTECHO_EOF
 5769 \$1
 5770 _LTECHO_EOF'
 5771 }
 5772     ECHO=\"$qECHO\"
 5773   fi
 5774 
 5775 # Very basic option parsing. These options are (a) specific to
 5776 # the libtool wrapper, (b) are identical between the wrapper
 5777 # /script/ and the wrapper /executable/ that is used only on
 5778 # windows platforms, and (c) all begin with the string "--lt-"
 5779 # (application programs are unlikely to have options that match
 5780 # this pattern).
 5781 #
 5782 # There are only two supported options: --lt-debug and
 5783 # --lt-dump-script. There is, deliberately, no --lt-help.
 5784 #
 5785 # The first argument to this parsing function should be the
 5786 # script's $0 value, followed by "$@".
 5787 lt_option_debug=
 5788 func_parse_lt_options ()
 5789 {
 5790   lt_script_arg0=\$0
 5791   shift
 5792   for lt_opt
 5793   do
 5794     case \"\$lt_opt\" in
 5795     --lt-debug) lt_option_debug=1 ;;
 5796     --lt-dump-script)
 5797         lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
 5798         test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
 5799         lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
 5800         cat \"\$lt_dump_D/\$lt_dump_F\"
 5801         exit 0
 5802       ;;
 5803     --lt-*)
 5804         \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
 5805         exit 1
 5806       ;;
 5807     esac
 5808   done
 5809 
 5810   # Print the debug banner immediately:
 5811   if test -n \"\$lt_option_debug\"; then
 5812     echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
 5813   fi
 5814 }
 5815 
 5816 # Used when --lt-debug. Prints its arguments to stdout
 5817 # (redirection is the responsibility of the caller)
 5818 func_lt_dump_args ()
 5819 {
 5820   lt_dump_args_N=1;
 5821   for lt_arg
 5822   do
 5823     \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
 5824     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
 5825   done
 5826 }
 5827 
 5828 # Core function for launching the target application
 5829 func_exec_program_core ()
 5830 {
 5831 "
 5832   case $host in
 5833   # Backslashes separate directories on plain windows
 5834   *-*-mingw | *-*-os2* | *-cegcc*)
 5835     $ECHO "\
 5836       if test -n \"\$lt_option_debug\"; then
 5837         \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
 5838         func_lt_dump_args \${1+\"\$@\"} 1>&2
 5839       fi
 5840       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
 5841 "
 5842     ;;
 5843 
 5844   *)
 5845     $ECHO "\
 5846       if test -n \"\$lt_option_debug\"; then
 5847         \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
 5848         func_lt_dump_args \${1+\"\$@\"} 1>&2
 5849       fi
 5850       exec \"\$progdir/\$program\" \${1+\"\$@\"}
 5851 "
 5852     ;;
 5853   esac
 5854   $ECHO "\
 5855       \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
 5856       exit 1
 5857 }
 5858 
 5859 # A function to encapsulate launching the target application
 5860 # Strips options in the --lt-* namespace from \$@ and
 5861 # launches target application with the remaining arguments.
 5862 func_exec_program ()
 5863 {
 5864   case \" \$* \" in
 5865   *\\ --lt-*)
 5866     for lt_wr_arg
 5867     do
 5868       case \$lt_wr_arg in
 5869       --lt-*) ;;
 5870       *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
 5871       esac
 5872       shift
 5873     done ;;
 5874   esac
 5875   func_exec_program_core \${1+\"\$@\"}
 5876 }
 5877 
 5878   # Parse options
 5879   func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 5880 
 5881   # Find the directory that this script lives in.
 5882   thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
 5883   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 5884 
 5885   # Follow symbolic links until we get to the real thisdir.
 5886   file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
 5887   while test -n \"\$file\"; do
 5888     destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 5889 
 5890     # If there was a directory component, then change thisdir.
 5891     if test \"x\$destdir\" != \"x\$file\"; then
 5892       case \"\$destdir\" in
 5893       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
 5894       *) thisdir=\"\$thisdir/\$destdir\" ;;
 5895       esac
 5896     fi
 5897 
 5898     file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
 5899     file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
 5900   done
 5901 
 5902   # Usually 'no', except on cygwin/mingw when embedded into
 5903   # the cwrapper.
 5904   WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
 5905   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
 5906     # special case for '.'
 5907     if test \"\$thisdir\" = \".\"; then
 5908       thisdir=\`pwd\`
 5909     fi
 5910     # remove .libs from thisdir
 5911     case \"\$thisdir\" in
 5912     *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
 5913     $objdir )   thisdir=. ;;
 5914     esac
 5915   fi
 5916 
 5917   # Try to get the absolute directory name.
 5918   absdir=\`cd \"\$thisdir\" && pwd\`
 5919   test -n \"\$absdir\" && thisdir=\"\$absdir\"
 5920 "
 5921 
 5922     if test yes = "$fast_install"; then
 5923       $ECHO "\
 5924   program=lt-'$outputname'$exeext
 5925   progdir=\"\$thisdir/$objdir\"
 5926 
 5927   if test ! -f \"\$progdir/\$program\" ||
 5928      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
 5929        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 5930 
 5931     file=\"\$\$-\$program\"
 5932 
 5933     if test ! -d \"\$progdir\"; then
 5934       $MKDIR \"\$progdir\"
 5935     else
 5936       $RM \"\$progdir/\$file\"
 5937     fi"
 5938 
 5939       $ECHO "\
 5940 
 5941     # relink executable if necessary
 5942     if test -n \"\$relink_command\"; then
 5943       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
 5944       else
 5945     \$ECHO \"\$relink_command_output\" >&2
 5946     $RM \"\$progdir/\$file\"
 5947     exit 1
 5948       fi
 5949     fi
 5950 
 5951     $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
 5952     { $RM \"\$progdir/\$program\";
 5953       $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
 5954     $RM \"\$progdir/\$file\"
 5955   fi"
 5956     else
 5957       $ECHO "\
 5958   program='$outputname'
 5959   progdir=\"\$thisdir/$objdir\"
 5960 "
 5961     fi
 5962 
 5963     $ECHO "\
 5964 
 5965   if test -f \"\$progdir/\$program\"; then"
 5966 
 5967     # fixup the dll searchpath if we need to.
 5968     #
 5969     # Fix the DLL searchpath if we need to.  Do this before prepending
 5970     # to shlibpath, because on Windows, both are PATH and uninstalled
 5971     # libraries must come first.
 5972     if test -n "$dllsearchpath"; then
 5973       $ECHO "\
 5974     # Add the dll search path components to the executable PATH
 5975     PATH=$dllsearchpath:\$PATH
 5976 "
 5977     fi
 5978 
 5979     # Export our shlibpath_var if we have one.
 5980     if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 5981       $ECHO "\
 5982     # Add our own library path to $shlibpath_var
 5983     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
 5984 
 5985     # Some systems cannot cope with colon-terminated $shlibpath_var
 5986     # The second colon is a workaround for a bug in BeOS R4 sed
 5987     $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 5988 
 5989     export $shlibpath_var
 5990 "
 5991     fi
 5992 
 5993     $ECHO "\
 5994     if test \"\$libtool_execute_magic\" != \"$magic\"; then
 5995       # Run the actual program with our arguments.
 5996       func_exec_program \${1+\"\$@\"}
 5997     fi
 5998   else
 5999     # The program doesn't exist.
 6000     \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
 6001     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
 6002     \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
 6003     exit 1
 6004   fi
 6005 fi\
 6006 "
 6007 }
 6008 
 6009 
 6010 # func_emit_cwrapperexe_src
 6011 # emit the source code for a wrapper executable on stdout
 6012 # Must ONLY be called from within func_mode_link because
 6013 # it depends on a number of variable set therein.
 6014 func_emit_cwrapperexe_src ()
 6015 {
 6016     cat <<EOF
 6017 
 6018 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 6019    Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 6020 
 6021    The $output program cannot be directly executed until all the libtool
 6022    libraries that it depends on are installed.
 6023 
 6024    This wrapper executable should never be moved out of the build directory.
 6025    If it is, it will not operate correctly.
 6026 */
 6027 EOF
 6028         cat <<"EOF"
 6029 #ifdef _MSC_VER
 6030 # define _CRT_SECURE_NO_DEPRECATE 1
 6031 #endif
 6032 #include <stdio.h>
 6033 #include <stdlib.h>
 6034 #ifdef _MSC_VER
 6035 # include <direct.h>
 6036 # include <process.h>
 6037 # include <io.h>
 6038 #else
 6039 # include <unistd.h>
 6040 # include <stdint.h>
 6041 # ifdef __CYGWIN__
 6042 #  include <io.h>
 6043 # endif
 6044 #endif
 6045 #include <malloc.h>
 6046 #include <stdarg.h>
 6047 #include <assert.h>
 6048 #include <string.h>
 6049 #include <ctype.h>
 6050 #include <errno.h>
 6051 #include <fcntl.h>
 6052 #include <sys/stat.h>
 6053 
 6054 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 6055 
 6056 /* declarations of non-ANSI functions */
 6057 #if defined __MINGW32__
 6058 # ifdef __STRICT_ANSI__
 6059 int _putenv (const char *);
 6060 # endif
 6061 #elif defined __CYGWIN__
 6062 # ifdef __STRICT_ANSI__
 6063 char *realpath (const char *, char *);
 6064 int putenv (char *);
 6065 int setenv (const char *, const char *, int);
 6066 # endif
 6067 /* #elif defined other_platform || defined ... */
 6068 #endif
 6069 
 6070 /* portability defines, excluding path handling macros */
 6071 #if defined _MSC_VER
 6072 # define setmode _setmode
 6073 # define stat    _stat
 6074 # define chmod   _chmod
 6075 # define getcwd  _getcwd
 6076 # define putenv  _putenv
 6077 # define S_IXUSR _S_IEXEC
 6078 #elif defined __MINGW32__
 6079 # define setmode _setmode
 6080 # define stat    _stat
 6081 # define chmod   _chmod
 6082 # define getcwd  _getcwd
 6083 # define putenv  _putenv
 6084 #elif defined __CYGWIN__
 6085 # define HAVE_SETENV
 6086 # define FOPEN_WB "wb"
 6087 /* #elif defined other platforms ... */
 6088 #endif
 6089 
 6090 #if defined PATH_MAX
 6091 # define LT_PATHMAX PATH_MAX
 6092 #elif defined MAXPATHLEN
 6093 # define LT_PATHMAX MAXPATHLEN
 6094 #else
 6095 # define LT_PATHMAX 1024
 6096 #endif
 6097 
 6098 #ifndef S_IXOTH
 6099 # define S_IXOTH 0
 6100 #endif
 6101 #ifndef S_IXGRP
 6102 # define S_IXGRP 0
 6103 #endif
 6104 
 6105 /* path handling portability macros */
 6106 #ifndef DIR_SEPARATOR
 6107 # define DIR_SEPARATOR '/'
 6108 # define PATH_SEPARATOR ':'
 6109 #endif
 6110 
 6111 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
 6112   defined __OS2__
 6113 # define HAVE_DOS_BASED_FILE_SYSTEM
 6114 # define FOPEN_WB "wb"
 6115 # ifndef DIR_SEPARATOR_2
 6116 #  define DIR_SEPARATOR_2 '\\'
 6117 # endif
 6118 # ifndef PATH_SEPARATOR_2
 6119 #  define PATH_SEPARATOR_2 ';'
 6120 # endif
 6121 #endif
 6122 
 6123 #ifndef DIR_SEPARATOR_2
 6124 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 6125 #else /* DIR_SEPARATOR_2 */
 6126 # define IS_DIR_SEPARATOR(ch) \
 6127     (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 6128 #endif /* DIR_SEPARATOR_2 */
 6129 
 6130 #ifndef PATH_SEPARATOR_2
 6131 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 6132 #else /* PATH_SEPARATOR_2 */
 6133 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 6134 #endif /* PATH_SEPARATOR_2 */
 6135 
 6136 #ifndef FOPEN_WB
 6137 # define FOPEN_WB "w"
 6138 #endif
 6139 #ifndef _O_BINARY
 6140 # define _O_BINARY 0
 6141 #endif
 6142 
 6143 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 6144 #define XFREE(stale) do { \
 6145   if (stale) { free (stale); stale = 0; } \
 6146 } while (0)
 6147 
 6148 #if defined LT_DEBUGWRAPPER
 6149 static int lt_debug = 1;
 6150 #else
 6151 static int lt_debug = 0;
 6152 #endif
 6153 
 6154 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 6155 
 6156 void *xmalloc (size_t num);
 6157 char *xstrdup (const char *string);
 6158 const char *base_name (const char *name);
 6159 char *find_executable (const char *wrapper);
 6160 char *chase_symlinks (const char *pathspec);
 6161 int make_executable (const char *path);
 6162 int check_executable (const char *path);
 6163 char *strendzap (char *str, const char *pat);
 6164 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
 6165 void lt_fatal (const char *file, int line, const char *message, ...);
 6166 static const char *nonnull (const char *s);
 6167 static const char *nonempty (const char *s);
 6168 void lt_setenv (const char *name, const char *value);
 6169 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
 6170 void lt_update_exe_path (const char *name, const char *value);
 6171 void lt_update_lib_path (const char *name, const char *value);
 6172 char **prepare_spawn (char **argv);
 6173 void lt_dump_script (FILE *f);
 6174 EOF
 6175 
 6176         cat <<EOF
 6177 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
 6178 # define externally_visible volatile
 6179 #else
 6180 # define externally_visible __attribute__((externally_visible)) volatile
 6181 #endif
 6182 externally_visible const char * MAGIC_EXE = "$magic_exe";
 6183 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 6184 EOF
 6185 
 6186         if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 6187               func_to_host_path "$temp_rpath"
 6188           cat <<EOF
 6189 const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
 6190 EOF
 6191         else
 6192           cat <<"EOF"
 6193 const char * LIB_PATH_VALUE   = "";
 6194 EOF
 6195         fi
 6196 
 6197         if test -n "$dllsearchpath"; then
 6198               func_to_host_path "$dllsearchpath:"
 6199           cat <<EOF
 6200 const char * EXE_PATH_VARNAME = "PATH";
 6201 const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
 6202 EOF
 6203         else
 6204           cat <<"EOF"
 6205 const char * EXE_PATH_VARNAME = "";
 6206 const char * EXE_PATH_VALUE   = "";
 6207 EOF
 6208         fi
 6209 
 6210         if test yes = "$fast_install"; then
 6211           cat <<EOF
 6212 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
 6213 EOF
 6214         else
 6215           cat <<EOF
 6216 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
 6217 EOF
 6218         fi
 6219 
 6220 
 6221         cat <<"EOF"
 6222 
 6223 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
 6224 
 6225 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
 6226 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
 6227 static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 6228 
 6229 int
 6230 main (int argc, char *argv[])
 6231 {
 6232   char **newargz;
 6233   int  newargc;
 6234   char *tmp_pathspec;
 6235   char *actual_cwrapper_path;
 6236   char *actual_cwrapper_name;
 6237   char *target_name;
 6238   char *lt_argv_zero;
 6239   int rval = 127;
 6240 
 6241   int i;
 6242 
 6243   program_name = (char *) xstrdup (base_name (argv[0]));
 6244   newargz = XMALLOC (char *, (size_t) argc + 1);
 6245 
 6246   /* very simple arg parsing; don't want to rely on getopt
 6247    * also, copy all non cwrapper options to newargz, except
 6248    * argz[0], which is handled differently
 6249    */
 6250   newargc=0;
 6251   for (i = 1; i < argc; i++)
 6252     {
 6253       if (STREQ (argv[i], dumpscript_opt))
 6254     {
 6255 EOF
 6256         case $host in
 6257           *mingw* | *cygwin* )
 6258         # make stdout use "unix" line endings
 6259         echo "          setmode(1,_O_BINARY);"
 6260         ;;
 6261           esac
 6262 
 6263         cat <<"EOF"
 6264       lt_dump_script (stdout);
 6265       return 0;
 6266     }
 6267       if (STREQ (argv[i], debug_opt))
 6268     {
 6269           lt_debug = 1;
 6270           continue;
 6271     }
 6272       if (STREQ (argv[i], ltwrapper_option_prefix))
 6273         {
 6274           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
 6275              namespace, but it is not one of the ones we know about and
 6276              have already dealt with, above (inluding dump-script), then
 6277              report an error. Otherwise, targets might begin to believe
 6278              they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
 6279              namespace. The first time any user complains about this, we'll
 6280              need to make LTWRAPPER_OPTION_PREFIX a configure-time option
 6281              or a configure.ac-settable value.
 6282            */
 6283           lt_fatal (__FILE__, __LINE__,
 6284             "unrecognized %s option: '%s'",
 6285                     ltwrapper_option_prefix, argv[i]);
 6286         }
 6287       /* otherwise ... */
 6288       newargz[++newargc] = xstrdup (argv[i]);
 6289     }
 6290   newargz[++newargc] = NULL;
 6291 
 6292 EOF
 6293         cat <<EOF
 6294   /* The GNU banner must be the first non-error debug message */
 6295   lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
 6296 EOF
 6297         cat <<"EOF"
 6298   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
 6299   lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 6300 
 6301   tmp_pathspec = find_executable (argv[0]);
 6302   if (tmp_pathspec == NULL)
 6303     lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
 6304   lt_debugprintf (__FILE__, __LINE__,
 6305                   "(main) found exe (before symlink chase) at: %s\n",
 6306           tmp_pathspec);
 6307 
 6308   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
 6309   lt_debugprintf (__FILE__, __LINE__,
 6310                   "(main) found exe (after symlink chase) at: %s\n",
 6311           actual_cwrapper_path);
 6312   XFREE (tmp_pathspec);
 6313 
 6314   actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
 6315   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 6316 
 6317   /* wrapper name transforms */
 6318   strendzap (actual_cwrapper_name, ".exe");
 6319   tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
 6320   XFREE (actual_cwrapper_name);
 6321   actual_cwrapper_name = tmp_pathspec;
 6322   tmp_pathspec = 0;
 6323 
 6324   /* target_name transforms -- use actual target program name; might have lt- prefix */
 6325   target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
 6326   strendzap (target_name, ".exe");
 6327   tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
 6328   XFREE (target_name);
 6329   target_name = tmp_pathspec;
 6330   tmp_pathspec = 0;
 6331 
 6332   lt_debugprintf (__FILE__, __LINE__,
 6333           "(main) libtool target name: %s\n",
 6334           target_name);
 6335 EOF
 6336 
 6337         cat <<EOF
 6338   newargz[0] =
 6339     XMALLOC (char, (strlen (actual_cwrapper_path) +
 6340             strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
 6341   strcpy (newargz[0], actual_cwrapper_path);
 6342   strcat (newargz[0], "$objdir");
 6343   strcat (newargz[0], "/");
 6344 EOF
 6345 
 6346         cat <<"EOF"
 6347   /* stop here, and copy so we don't have to do this twice */
 6348   tmp_pathspec = xstrdup (newargz[0]);
 6349 
 6350   /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
 6351   strcat (newargz[0], actual_cwrapper_name);
 6352 
 6353   /* DO want the lt- prefix here if it exists, so use target_name */
 6354   lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
 6355   XFREE (tmp_pathspec);
 6356   tmp_pathspec = NULL;
 6357 EOF
 6358 
 6359         case $host_os in
 6360           mingw*)
 6361         cat <<"EOF"
 6362   {
 6363     char* p;
 6364     while ((p = strchr (newargz[0], '\\')) != NULL)
 6365       {
 6366     *p = '/';
 6367       }
 6368     while ((p = strchr (lt_argv_zero, '\\')) != NULL)
 6369       {
 6370     *p = '/';
 6371       }
 6372   }
 6373 EOF
 6374         ;;
 6375         esac
 6376 
 6377         cat <<"EOF"
 6378   XFREE (target_name);
 6379   XFREE (actual_cwrapper_path);
 6380   XFREE (actual_cwrapper_name);
 6381 
 6382   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
 6383   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
 6384   /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
 6385      be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
 6386      because on Windows, both *_VARNAMEs are PATH but uninstalled
 6387      libraries must come first. */
 6388   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
 6389   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
 6390 
 6391   lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
 6392           nonnull (lt_argv_zero));
 6393   for (i = 0; i < newargc; i++)
 6394     {
 6395       lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
 6396               i, nonnull (newargz[i]));
 6397     }
 6398