recipes

packages recipes for the <noname> package manager
Log | Files | Refs

ltmain.sh (324289B)


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