"Fossies" - the Fresh Open Source Software Archive

Member "mono-6.12.0.122/external/bdwgc/libtool" (22 Feb 2021, 345357 Bytes) of package /linux/misc/mono-sources/mono/mono-6.12.0.122.tar.xz:


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 and code folding option. 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": 6.12.0.107_vs_6.12.0.122.

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