quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

ltmain.sh (337554B)


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