"Fossies" - the Fresh Open Source Software Archive

Member "sip-0.12.1/ltmain.sh" (4 Sep 2013, 316439 Bytes) of package /linux/privat/sip-0.12.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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