Subversion Repositories Vertical

Rev

Blame | Last modification | View Log | RSS feed

  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. PACKAGE=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 $PACKAGE 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 $PACKAGE $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 $PACKAGE $VERSION
  2230. $progname: and run autoconf again.
  2231. _LT_EOF
  2232.         else
  2233.           cat >&2 <<_LT_EOF
  2234. $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
  2235. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2236. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $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 $PACKAGE $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 $PACKAGE $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* | *msys* | *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 .*$PACKAGE" > /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\ *$PACKAGE* ) 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 $PACKAGE) $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* | msys* | 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.           # Determine the prefix the user has applied to our future dir.
  4279.           inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  4280.  
  4281.           # Don't allow the user to place us outside of our expected
  4282.           # location b/c this prevents finding dependent libraries that
  4283.           # are installed to the same prefix.
  4284.           # At present, this check doesn't affect windows .dll's that
  4285.           # are installed into $libdir/../bin (currently, that works fine)
  4286.           # but it's something to keep an eye on.
  4287.           test "$inst_prefix_dir" = "$destdir" && \
  4288.             func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  4289.  
  4290.           if test -n "$inst_prefix_dir"; then
  4291.             # Stick the inst_prefix_dir data into the link command.
  4292.             relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4293.           else
  4294.             relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4295.           fi
  4296.  
  4297.           func_warning "relinking '$file'"
  4298.           func_show_eval "$relink_command" \
  4299.             'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  4300.         fi
  4301.  
  4302.         # See the names of the shared library.
  4303.         set dummy $library_names; shift
  4304.         if test -n "$1"; then
  4305.           realname=$1
  4306.           shift
  4307.  
  4308.           srcname=$realname
  4309.           test -n "$relink_command" && srcname=${realname}T
  4310.  
  4311.           # Install the shared library and build the symlinks.
  4312.           func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  4313.               'exit $?'
  4314.           tstripme=$stripme
  4315.           case $host_os in
  4316.           cygwin* | msys* | mingw* | pw32* | cegcc*)
  4317.             case $realname in
  4318.             *.dll.a)
  4319.               tstripme=
  4320.               ;;
  4321.             esac
  4322.             ;;
  4323.           os2*)
  4324.             case $realname in
  4325.             *_dll.a)
  4326.               tstripme=
  4327.               ;;
  4328.             esac
  4329.             ;;
  4330.           esac
  4331.           if test -n "$tstripme" && test -n "$striplib"; then
  4332.             func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4333.           fi
  4334.  
  4335.           if test "$#" -gt 0; then
  4336.             # Delete the old symlinks, and create new ones.
  4337.             # Try 'ln -sf' first, because the 'ln' binary might depend on
  4338.             # the symlink we replace!  Solaris /bin/ln does not understand -f,
  4339.             # so we also need to try rm && ln -s.
  4340.             for linkname
  4341.             do
  4342.               test "$linkname" != "$realname" \
  4343.                 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4344.             done
  4345.           fi
  4346.  
  4347.           # Do each command in the postinstall commands.
  4348.           lib=$destdir/$realname
  4349.           func_execute_cmds "$postinstall_cmds" 'exit $?'
  4350.         fi
  4351.  
  4352.         # Install the pseudo-library for information purposes.
  4353.         func_basename "$file"
  4354.         name=$func_basename_result
  4355.         instname=$dir/${name}i
  4356.         func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4357.  
  4358.         # Maybe install the static library, too.
  4359.         test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4360.         ;;
  4361.  
  4362.       *.lo)
  4363.         # Install (i.e. copy) a libtool object.
  4364.  
  4365.         # Figure out destination file name, if it wasn't already specified.
  4366.         if test -n "$destname"; then
  4367.           destfile=$destdir/$destname
  4368.         else
  4369.           func_basename "$file"
  4370.           destfile=$func_basename_result
  4371.           destfile=$destdir/$destfile
  4372.         fi
  4373.  
  4374.         # Deduce the name of the destination old-style object file.
  4375.         case $destfile in
  4376.         *.lo)
  4377.           func_lo2o "$destfile"
  4378.           staticdest=$func_lo2o_result
  4379.           ;;
  4380.         *.$objext)
  4381.           staticdest=$destfile
  4382.           destfile=
  4383.           ;;
  4384.         *)
  4385.           func_fatal_help "cannot copy a libtool object to '$destfile'"
  4386.           ;;
  4387.         esac
  4388.  
  4389.         # Install the libtool object if requested.
  4390.         test -n "$destfile" && \
  4391.           func_show_eval "$install_prog $file $destfile" 'exit $?'
  4392.  
  4393.         # Install the old object if enabled.
  4394.         if test yes = "$build_old_libs"; then
  4395.           # Deduce the name of the old-style object file.
  4396.           func_lo2o "$file"
  4397.           staticobj=$func_lo2o_result
  4398.           func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4399.         fi
  4400.         exit $EXIT_SUCCESS
  4401.         ;;
  4402.  
  4403.       *)
  4404.         # Figure out destination file name, if it wasn't already specified.
  4405.         if test -n "$destname"; then
  4406.           destfile=$destdir/$destname
  4407.         else
  4408.           func_basename "$file"
  4409.           destfile=$func_basename_result
  4410.           destfile=$destdir/$destfile
  4411.         fi
  4412.  
  4413.         # If the file is missing, and there is a .exe on the end, strip it
  4414.         # because it is most likely a libtool script we actually want to
  4415.         # install
  4416.         stripped_ext=
  4417.         case $file in
  4418.           *.exe)
  4419.             if test ! -f "$file"; then
  4420.               func_stripname '' '.exe' "$file"
  4421.               file=$func_stripname_result
  4422.               stripped_ext=.exe
  4423.             fi
  4424.             ;;
  4425.         esac
  4426.  
  4427.         # Do a test to see if this is really a libtool program.
  4428.         case $host in
  4429.         *cygwin* | *msys* | *mingw*)
  4430.             if func_ltwrapper_executable_p "$file"; then
  4431.               func_ltwrapper_scriptname "$file"
  4432.               wrapper=$func_ltwrapper_scriptname_result
  4433.             else
  4434.               func_stripname '' '.exe' "$file"
  4435.               wrapper=$func_stripname_result
  4436.             fi
  4437.             ;;
  4438.         *)
  4439.             wrapper=$file
  4440.             ;;
  4441.         esac
  4442.         if func_ltwrapper_script_p "$wrapper"; then
  4443.           notinst_deplibs=
  4444.           relink_command=
  4445.  
  4446.           func_source "$wrapper"
  4447.  
  4448.           # Check the variables that should have been set.
  4449.           test -z "$generated_by_libtool_version" && \
  4450.             func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4451.  
  4452.           finalize=:
  4453.           for lib in $notinst_deplibs; do
  4454.             # Check to see that each library is installed.
  4455.             libdir=
  4456.             if test -f "$lib"; then
  4457.               func_source "$lib"
  4458.             fi
  4459.             libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4460.             if test -n "$libdir" && test ! -f "$libfile"; then
  4461.               func_warning "'$lib' has not been installed in '$libdir'"
  4462.               finalize=false
  4463.             fi
  4464.           done
  4465.  
  4466.           relink_command=
  4467.           func_source "$wrapper"
  4468.  
  4469.           outputname=
  4470.           if test no = "$fast_install" && test -n "$relink_command"; then
  4471.             $opt_dry_run || {
  4472.               if $finalize; then
  4473.                 tmpdir=`func_mktempdir`
  4474.                 func_basename "$file$stripped_ext"
  4475.                 file=$func_basename_result
  4476.                 outputname=$tmpdir/$file
  4477.                 # Replace the output file specification.
  4478.                 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4479.  
  4480.                 $opt_quiet || {
  4481.                   func_quote_for_expand "$relink_command"
  4482.                   eval "func_echo $func_quote_for_expand_result"
  4483.                 }
  4484.                 if eval "$relink_command"; then :
  4485.                   else
  4486.                   func_error "error: relink '$file' with the above command before installing it"
  4487.                   $opt_dry_run || ${RM}r "$tmpdir"
  4488.                   continue
  4489.                 fi
  4490.                 file=$outputname
  4491.               else
  4492.                 func_warning "cannot relink '$file'"
  4493.               fi
  4494.             }
  4495.           else
  4496.             # Install the binary that we compiled earlier.
  4497.             file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4498.           fi
  4499.         fi
  4500.  
  4501.         # remove .exe since cygwin /usr/bin/install will append another
  4502.         # one anyway
  4503.         case $install_prog,$host in
  4504.         */usr/bin/install*,*cygwin*|*/usr/bin/install*,*msys*)
  4505.           case $file:$destfile in
  4506.           *.exe:*.exe)
  4507.             # this is ok
  4508.             ;;
  4509.           *.exe:*)
  4510.             destfile=$destfile.exe
  4511.             ;;
  4512.           *:*.exe)
  4513.             func_stripname '' '.exe' "$destfile"
  4514.             destfile=$func_stripname_result
  4515.             ;;
  4516.           esac
  4517.           ;;
  4518.         esac
  4519.         func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4520.         $opt_dry_run || if test -n "$outputname"; then
  4521.           ${RM}r "$tmpdir"
  4522.         fi
  4523.         ;;
  4524.       esac
  4525.     done
  4526.  
  4527.     for file in $staticlibs; do
  4528.       func_basename "$file"
  4529.       name=$func_basename_result
  4530.  
  4531.       # Set up the ranlib parameters.
  4532.       oldlib=$destdir/$name
  4533.       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4534.       tool_oldlib=$func_to_tool_file_result
  4535.  
  4536.       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4537.  
  4538.       if test -n "$stripme" && test -n "$old_striplib"; then
  4539.         func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4540.       fi
  4541.  
  4542.       # Do each command in the postinstall commands.
  4543.       func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4544.     done
  4545.  
  4546.     test -n "$future_libdirs" && \
  4547.       func_warning "remember to run '$progname --finish$future_libdirs'"
  4548.  
  4549.     if test -n "$current_libdirs"; then
  4550.       # Maybe just do a dry run.
  4551.       $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4552.       exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4553.     else
  4554.       exit $EXIT_SUCCESS
  4555.     fi
  4556. }
  4557.  
  4558. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4559.  
  4560.  
  4561. # func_generate_dlsyms outputname originator pic_p
  4562. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4563. # a dlpreopen symbol table.
  4564. func_generate_dlsyms ()
  4565. {
  4566.     $debug_cmd
  4567.  
  4568.     my_outputname=$1
  4569.     my_originator=$2
  4570.     my_pic_p=${3-false}
  4571.     my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4572.     my_dlsyms=
  4573.  
  4574.     if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4575.       if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4576.         my_dlsyms=${my_outputname}S.c
  4577.       else
  4578.         func_error "not configured to extract global symbols from dlpreopened files"
  4579.       fi
  4580.     fi
  4581.  
  4582.     if test -n "$my_dlsyms"; then
  4583.       case $my_dlsyms in
  4584.       "") ;;
  4585.       *.c)
  4586.         # Discover the nlist of each of the dlfiles.
  4587.         nlist=$output_objdir/$my_outputname.nm
  4588.  
  4589.         func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4590.  
  4591.         # Parse the name list into a source file.
  4592.         func_verbose "creating $output_objdir/$my_dlsyms"
  4593.  
  4594.         $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4595. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4596. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4597.  
  4598. #ifdef __cplusplus
  4599. extern \"C\" {
  4600. #endif
  4601.  
  4602. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4603. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4604. #endif
  4605.  
  4606. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
  4607. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4608. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4609.   relocations are performed -- see ld's documentation on pseudo-relocs.  */
  4610. # define LT_DLSYM_CONST
  4611. #elif defined __osf__
  4612. /* This system does not cope well with relocations in const data.  */
  4613. # define LT_DLSYM_CONST
  4614. #else
  4615. # define LT_DLSYM_CONST const
  4616. #endif
  4617.  
  4618. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4619.  
  4620. /* External symbol declarations for the compiler. */\
  4621. "
  4622.  
  4623.         if test yes = "$dlself"; then
  4624.           func_verbose "generating symbol list for '$output'"
  4625.  
  4626.           $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4627.  
  4628.           # Add our own program objects to the symbol list.
  4629.           progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4630.           for progfile in $progfiles; do
  4631.             func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4632.             func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4633.             $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4634.           done
  4635.  
  4636.           if test -n "$exclude_expsyms"; then
  4637.             $opt_dry_run || {
  4638.               eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4639.               eval '$MV "$nlist"T "$nlist"'
  4640.             }
  4641.           fi
  4642.  
  4643.           if test -n "$export_symbols_regex"; then
  4644.             $opt_dry_run || {
  4645.               eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4646.               eval '$MV "$nlist"T "$nlist"'
  4647.             }
  4648.           fi
  4649.  
  4650.           # Prepare the list of exported symbols
  4651.           if test -z "$export_symbols"; then
  4652.             export_symbols=$output_objdir/$outputname.exp
  4653.             $opt_dry_run || {
  4654.               $RM $export_symbols
  4655.               eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4656.               case $host in
  4657.               *cygwin* | *msys* | *mingw* | *cegcc* )
  4658.                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4659.                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4660.                 ;;
  4661.               esac
  4662.             }
  4663.           else
  4664.             $opt_dry_run || {
  4665.               eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4666.               eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4667.               eval '$MV "$nlist"T "$nlist"'
  4668.               case $host in
  4669.                 *cygwin* | *msys* | *mingw* | *cegcc* )
  4670.                   eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4671.                   eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4672.                   ;;
  4673.               esac
  4674.             }
  4675.           fi
  4676.         fi
  4677.  
  4678.         for dlprefile in $dlprefiles; do
  4679.           func_verbose "extracting global C symbols from '$dlprefile'"
  4680.           func_basename "$dlprefile"
  4681.           name=$func_basename_result
  4682.           case $host in
  4683.             *cygwin* | *msys* | *mingw* | *cegcc* )
  4684.               # if an import library, we need to obtain dlname
  4685.               if func_win32_import_lib_p "$dlprefile"; then
  4686.                 func_tr_sh "$dlprefile"
  4687.                 eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4688.                 dlprefile_dlbasename=
  4689.                 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4690.                   # Use subshell, to avoid clobbering current variable values
  4691.                   dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4692.                   if test -n "$dlprefile_dlname"; then
  4693.                     func_basename "$dlprefile_dlname"
  4694.                     dlprefile_dlbasename=$func_basename_result
  4695.                   else
  4696.                     # no lafile. user explicitly requested -dlpreopen <import library>.
  4697.                     $sharedlib_from_linklib_cmd "$dlprefile"
  4698.                     dlprefile_dlbasename=$sharedlib_from_linklib_result
  4699.                   fi
  4700.                 fi
  4701.                 $opt_dry_run || {
  4702.                   if test -n "$dlprefile_dlbasename"; then
  4703.                     eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4704.                   else
  4705.                     func_warning "Could not compute DLL name from $name"
  4706.                     eval '$ECHO ": $name " >> "$nlist"'
  4707.                   fi
  4708.                   func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4709.                   eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4710.                     $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4711.                 }
  4712.               else # not an import lib
  4713.                 $opt_dry_run || {
  4714.                   eval '$ECHO ": $name " >> "$nlist"'
  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 >> '$nlist'"
  4717.                 }
  4718.               fi
  4719.             ;;
  4720.             *)
  4721.               $opt_dry_run || {
  4722.                 eval '$ECHO ": $name " >> "$nlist"'
  4723.                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4724.                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4725.               }
  4726.             ;;
  4727.           esac
  4728.         done
  4729.  
  4730.         $opt_dry_run || {
  4731.           # Make sure we have at least an empty file.
  4732.           test -f "$nlist" || : > "$nlist"
  4733.  
  4734.           if test -n "$exclude_expsyms"; then
  4735.             $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4736.             $MV "$nlist"T "$nlist"
  4737.           fi
  4738.  
  4739.           # Try sorting and uniquifying the output.
  4740.           if $GREP -v "^: " < "$nlist" |
  4741.               if sort -k 3 </dev/null >/dev/null 2>&1; then
  4742.                 sort -k 3
  4743.               else
  4744.                 sort +2
  4745.               fi |
  4746.               uniq > "$nlist"S; then
  4747.             :
  4748.           else
  4749.             $GREP -v "^: " < "$nlist" > "$nlist"S
  4750.           fi
  4751.  
  4752.           if test -f "$nlist"S; then
  4753.             eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4754.           else
  4755.             echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4756.           fi
  4757.  
  4758.           func_show_eval '$RM "${nlist}I"'
  4759.           if test -n "$global_symbol_to_import"; then
  4760.             eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4761.           fi
  4762.  
  4763.           echo >> "$output_objdir/$my_dlsyms" "\
  4764. /* The mapping between symbol names and symbols.  */
  4765. typedef struct {
  4766.  const char *name;
  4767.  void *address;
  4768. } lt_dlsymlist;
  4769. extern LT_DLSYM_CONST lt_dlsymlist
  4770. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4771. "
  4772.  
  4773.           if test -s "$nlist"I; then
  4774.             echo >> "$output_objdir/$my_dlsyms" "\
  4775. static void lt_syminit(void)
  4776. {
  4777.  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4778.  for (; symbol->name; ++symbol)
  4779.    {"
  4780.             $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4781.             echo >> "$output_objdir/$my_dlsyms" "\
  4782.    }
  4783. }"
  4784.           fi
  4785.           echo >> "$output_objdir/$my_dlsyms" "\
  4786. LT_DLSYM_CONST lt_dlsymlist
  4787. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4788. { {\"$my_originator\", (void *) 0},"
  4789.  
  4790.           if test -s "$nlist"I; then
  4791.             echo >> "$output_objdir/$my_dlsyms" "\
  4792.  {\"@INIT@\", (void *) &lt_syminit},"
  4793.           fi
  4794.  
  4795.           case $need_lib_prefix in
  4796.           no)
  4797.             eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4798.             ;;
  4799.           *)
  4800.             eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4801.             ;;
  4802.           esac
  4803.           echo >> "$output_objdir/$my_dlsyms" "\
  4804.  {0, (void *) 0}
  4805. };
  4806.  
  4807. /* This works around a problem in FreeBSD linker */
  4808. #ifdef FREEBSD_WORKAROUND
  4809. static const void *lt_preloaded_setup() {
  4810.  return lt_${my_prefix}_LTX_preloaded_symbols;
  4811. }
  4812. #endif
  4813.  
  4814. #ifdef __cplusplus
  4815. }
  4816. #endif\
  4817. "
  4818.         } # !$opt_dry_run
  4819.  
  4820.         pic_flag_for_symtable=
  4821.         case "$compile_command " in
  4822.         *" -static "*) ;;
  4823.         *)
  4824.           case $host in
  4825.           # compiling the symbol table file with pic_flag works around
  4826.           # a FreeBSD bug that causes programs to crash when -lm is
  4827.           # linked before any other PIC object.  But we must not use
  4828.           # pic_flag when linking with -static.  The problem exists in
  4829.           # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4830.           *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4831.             pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4832.           *-*-hpux*)
  4833.             pic_flag_for_symtable=" $pic_flag"  ;;
  4834.           *)
  4835.             $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4836.             ;;
  4837.           esac
  4838.           ;;
  4839.         esac
  4840.         symtab_cflags=
  4841.         for arg in $LTCFLAGS; do
  4842.           case $arg in
  4843.           -pie | -fpie | -fPIE) ;;
  4844.           *) func_append symtab_cflags " $arg" ;;
  4845.           esac
  4846.         done
  4847.  
  4848.         # Now compile the dynamic symbol file.
  4849.         func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4850.  
  4851.         # Clean up the generated files.
  4852.         func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4853.  
  4854.         # Transform the symbol file into the correct name.
  4855.         symfileobj=$output_objdir/${my_outputname}S.$objext
  4856.         case $host in
  4857.         *cygwin* | *msys* | *mingw* | *cegcc* )
  4858.           if test -f "$output_objdir/$my_outputname.def"; then
  4859.             compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4860.             finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4861.           else
  4862.             compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4863.             finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4864.           fi
  4865.           ;;
  4866.         *)
  4867.           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4868.           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4869.           ;;
  4870.         esac
  4871.         ;;
  4872.       *)
  4873.         func_fatal_error "unknown suffix for '$my_dlsyms'"
  4874.         ;;
  4875.       esac
  4876.     else
  4877.       # We keep going just in case the user didn't refer to
  4878.       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  4879.       # really was required.
  4880.  
  4881.       # Nullify the symbol file.
  4882.       compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4883.       finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4884.     fi
  4885. }
  4886.  
  4887. # func_cygming_gnu_implib_p ARG
  4888. # This predicate returns with zero status (TRUE) if
  4889. # ARG is a GNU/binutils-style import library. Returns
  4890. # with nonzero status (FALSE) otherwise.
  4891. func_cygming_gnu_implib_p ()
  4892. {
  4893.   $debug_cmd
  4894.  
  4895.   func_to_tool_file "$1" func_convert_file_msys_to_w32
  4896.   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)$'`
  4897.   test -n "$func_cygming_gnu_implib_tmp"
  4898. }
  4899.  
  4900. # func_cygming_ms_implib_p ARG
  4901. # This predicate returns with zero status (TRUE) if
  4902. # ARG is an MS-style import library. Returns
  4903. # with nonzero status (FALSE) otherwise.
  4904. func_cygming_ms_implib_p ()
  4905. {
  4906.   $debug_cmd
  4907.  
  4908.   func_to_tool_file "$1" func_convert_file_msys_to_w32
  4909.   func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4910.   test -n "$func_cygming_ms_implib_tmp"
  4911. }
  4912.  
  4913. # func_win32_libid arg
  4914. # return the library type of file 'arg'
  4915. #
  4916. # Need a lot of goo to handle *both* DLLs and import libs
  4917. # Has to be a shell function in order to 'eat' the argument
  4918. # that is supplied when $file_magic_command is called.
  4919. # Despite the name, also deal with 64 bit binaries.
  4920. func_win32_libid ()
  4921. {
  4922.   $debug_cmd
  4923.  
  4924.   win32_libid_type=unknown
  4925.   win32_fileres=`file -L $1 2>/dev/null`
  4926.   case $win32_fileres in
  4927.   *ar\ archive\ import\ library*) # definitely import
  4928.     win32_libid_type="x86 archive import"
  4929.     ;;
  4930.   *ar\ archive*) # could be an import, or static
  4931.     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4932.     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4933.        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4934.       case $nm_interface in
  4935.       "MS dumpbin")
  4936.         if func_cygming_ms_implib_p "$1" ||
  4937.            func_cygming_gnu_implib_p "$1"
  4938.         then
  4939.           win32_nmres=import
  4940.         else
  4941.           win32_nmres=
  4942.         fi
  4943.         ;;
  4944.       *)
  4945.         func_to_tool_file "$1" func_convert_file_msys_to_w32
  4946.         win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4947.           $SED -n -e '
  4948.             1,100{
  4949.                 / I /{
  4950.                     s|.*|import|
  4951.                     p
  4952.                     q
  4953.                 }
  4954.             }'`
  4955.         ;;
  4956.       esac
  4957.       case $win32_nmres in
  4958.       import*)  win32_libid_type="x86 archive import";;
  4959.       *)        win32_libid_type="x86 archive static";;
  4960.       esac
  4961.     fi
  4962.     ;;
  4963.   *DLL*)
  4964.     win32_libid_type="x86 DLL"
  4965.     ;;
  4966.   *executable*) # but shell scripts are "executable" too...
  4967.     case $win32_fileres in
  4968.     *MS\ Windows\ PE\ Intel*)
  4969.       win32_libid_type="x86 DLL"
  4970.       ;;
  4971.     esac
  4972.     ;;
  4973.   esac
  4974.   $ECHO "$win32_libid_type"
  4975. }
  4976.  
  4977. # func_cygming_dll_for_implib ARG
  4978. #
  4979. # Platform-specific function to extract the
  4980. # name of the DLL associated with the specified
  4981. # import library ARG.
  4982. # Invoked by eval'ing the libtool variable
  4983. #    $sharedlib_from_linklib_cmd
  4984. # Result is available in the variable
  4985. #    $sharedlib_from_linklib_result
  4986. func_cygming_dll_for_implib ()
  4987. {
  4988.   $debug_cmd
  4989.  
  4990.   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4991. }
  4992.  
  4993. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4994. #
  4995. # The is the core of a fallback implementation of a
  4996. # platform-specific function to extract the name of the
  4997. # DLL associated with the specified import library LIBNAME.
  4998. #
  4999. # SECTION_NAME is either .idata$6 or .idata$7, depending
  5000. # on the platform and compiler that created the implib.
  5001. #
  5002. # Echos the name of the DLL associated with the
  5003. # specified import library.
  5004. func_cygming_dll_for_implib_fallback_core ()
  5005. {
  5006.   $debug_cmd
  5007.  
  5008.   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  5009.   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  5010.     $SED '/^Contents of section '"$match_literal"':/{
  5011.      # Place marker at beginning of archive member dllname section
  5012.      s/.*/====MARK====/
  5013.      p
  5014.      d
  5015.    }
  5016.    # These lines can sometimes be longer than 43 characters, but
  5017.    # are always uninteresting
  5018.     /:[  ]*file format pe[i]\{,1\}-/d
  5019.    /^In archive [^:]*:/d
  5020.    # Ensure marker is printed
  5021.    /^====MARK====/p
  5022.    # Remove all lines with less than 43 characters
  5023.    /^.\{43\}/!d
  5024.    # From remaining lines, remove first 43 characters
  5025.    s/^.\{43\}//' |
  5026.     $SED -n '
  5027.      # Join marker and all lines until next marker into a single line
  5028.      /^====MARK====/ b para
  5029.      H
  5030.      $ b para
  5031.      b
  5032.      :para
  5033.      x
  5034.      s/\n//g
  5035.      # Remove the marker
  5036.      s/^====MARK====//
  5037.      # Remove trailing dots and whitespace
  5038.      s/[\. \t]*$//
  5039.      # Print
  5040.      /./p' |
  5041.     # we now have a list, one entry per line, of the stringified
  5042.     # contents of the appropriate section of all members of the
  5043.     # archive that possess that section. Heuristic: eliminate
  5044.     # all those that have a first or second character that is
  5045.     # a '.' (that is, objdump's representation of an unprintable
  5046.     # character.) This should work for all archives with less than
  5047.     # 0x302f exports -- but will fail for DLLs whose name actually
  5048.     # begins with a literal '.' or a single character followed by
  5049.     # a '.'.
  5050.     #
  5051.     # Of those that remain, print the first one.
  5052.     $SED -e '/^\./d;/^.\./d;q'
  5053. }
  5054.  
  5055. # func_cygming_dll_for_implib_fallback ARG
  5056. # Platform-specific function to extract the
  5057. # name of the DLL associated with the specified
  5058. # import library ARG.
  5059. #
  5060. # This fallback implementation is for use when $DLLTOOL
  5061. # does not support the --identify-strict option.
  5062. # Invoked by eval'ing the libtool variable
  5063. #    $sharedlib_from_linklib_cmd
  5064. # Result is available in the variable
  5065. #    $sharedlib_from_linklib_result
  5066. func_cygming_dll_for_implib_fallback ()
  5067. {
  5068.   $debug_cmd
  5069.  
  5070.   if func_cygming_gnu_implib_p "$1"; then
  5071.     # binutils import library
  5072.     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  5073.   elif func_cygming_ms_implib_p "$1"; then
  5074.     # ms-generated import library
  5075.     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  5076.   else
  5077.     # unknown
  5078.     sharedlib_from_linklib_result=
  5079.   fi
  5080. }
  5081.  
  5082.  
  5083. # func_extract_an_archive dir oldlib
  5084. func_extract_an_archive ()
  5085. {
  5086.     $debug_cmd
  5087.  
  5088.     f_ex_an_ar_dir=$1; shift
  5089.     f_ex_an_ar_oldlib=$1
  5090.     if test yes = "$lock_old_archive_extraction"; then
  5091.       lockfile=$f_ex_an_ar_oldlib.lock
  5092.       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  5093.         func_echo "Waiting for $lockfile to be removed"
  5094.         sleep 2
  5095.       done
  5096.     fi
  5097.     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  5098.                    'stat=$?; rm -f "$lockfile"; exit $stat'
  5099.     if test yes = "$lock_old_archive_extraction"; then
  5100.       $opt_dry_run || rm -f "$lockfile"
  5101.     fi
  5102.     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  5103.      :
  5104.     else
  5105.       func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  5106.     fi
  5107. }
  5108.  
  5109.  
  5110. # func_extract_archives gentop oldlib ...
  5111. func_extract_archives ()
  5112. {
  5113.     $debug_cmd
  5114.  
  5115.     my_gentop=$1; shift
  5116.     my_oldlibs=${1+"$@"}
  5117.     my_oldobjs=
  5118.     my_xlib=
  5119.     my_xabs=
  5120.     my_xdir=
  5121.  
  5122.     for my_xlib in $my_oldlibs; do
  5123.       # Extract the objects.
  5124.       case $my_xlib in
  5125.         [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  5126.         *) my_xabs=`pwd`"/$my_xlib" ;;
  5127.       esac
  5128.       func_basename "$my_xlib"
  5129.       my_xlib=$func_basename_result
  5130.       my_xlib_u=$my_xlib
  5131.       while :; do
  5132.         case " $extracted_archives " in
  5133.         *" $my_xlib_u "*)
  5134.           func_arith $extracted_serial + 1
  5135.           extracted_serial=$func_arith_result
  5136.           my_xlib_u=lt$extracted_serial-$my_xlib ;;
  5137.         *) break ;;
  5138.         esac
  5139.       done
  5140.       extracted_archives="$extracted_archives $my_xlib_u"
  5141.       my_xdir=$my_gentop/$my_xlib_u
  5142.  
  5143.       func_mkdir_p "$my_xdir"
  5144.  
  5145.       case $host in
  5146.       *-darwin*)
  5147.         func_verbose "Extracting $my_xabs"
  5148.         # Do not bother doing anything if just a dry run
  5149.         $opt_dry_run || {
  5150.           darwin_orig_dir=`pwd`
  5151.           cd $my_xdir || exit $?
  5152.           darwin_archive=$my_xabs
  5153.           darwin_curdir=`pwd`
  5154.           func_basename "$darwin_archive"
  5155.           darwin_base_archive=$func_basename_result
  5156.           darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  5157.           if test -n "$darwin_arches"; then
  5158.             darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  5159.             darwin_arch=
  5160.             func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  5161.             for darwin_arch in  $darwin_arches; do
  5162.               func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  5163.               $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  5164.               cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  5165.               func_extract_an_archive "`pwd`" "$darwin_base_archive"
  5166.               cd "$darwin_curdir"
  5167.               $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  5168.             done # $darwin_arches
  5169.             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  5170.             darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  5171.             darwin_file=
  5172.             darwin_files=
  5173.             for darwin_file in $darwin_filelist; do
  5174.               darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  5175.               $LIPO -create -output "$darwin_file" $darwin_files
  5176.             done # $darwin_filelist
  5177.             $RM -rf unfat-$$
  5178.             cd "$darwin_orig_dir"
  5179.           else
  5180.             cd $darwin_orig_dir
  5181.             func_extract_an_archive "$my_xdir" "$my_xabs"
  5182.           fi # $darwin_arches
  5183.         } # !$opt_dry_run
  5184.         ;;
  5185.       *)
  5186.         func_extract_an_archive "$my_xdir" "$my_xabs"
  5187.         ;;
  5188.       esac
  5189.       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  5190.     done
  5191.  
  5192.     func_extract_archives_result=$my_oldobjs
  5193. }
  5194.  
  5195.  
  5196. # func_emit_wrapper [arg=no]
  5197. #
  5198. # Emit a libtool wrapper script on stdout.
  5199. # Don't directly open a file because we may want to
  5200. # incorporate the script contents within a cygwin/mingw
  5201. # wrapper executable.  Must ONLY be called from within
  5202. # func_mode_link because it depends on a number of variables
  5203. # set therein.
  5204. #
  5205. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  5206. # variable will take.  If 'yes', then the emitted script
  5207. # will assume that the directory where it is stored is
  5208. # the $objdir directory.  This is a cygwin/mingw-specific
  5209. # behavior.
  5210. func_emit_wrapper ()
  5211. {
  5212.         func_emit_wrapper_arg1=${1-no}
  5213.  
  5214.         $ECHO "\
  5215. #! $SHELL
  5216.  
  5217. # $output - temporary wrapper script for $objdir/$outputname
  5218. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5219. #
  5220. # The $output program cannot be directly executed until all the libtool
  5221. # libraries that it depends on are installed.
  5222. #
  5223. # This wrapper script should never be moved out of the build directory.
  5224. # If it is, it will not operate correctly.
  5225.  
  5226. # Sed substitution that helps us do robust quoting.  It backslashifies
  5227. # metacharacters that are still active within double-quoted strings.
  5228. sed_quote_subst='$sed_quote_subst'
  5229.  
  5230. # Be Bourne compatible
  5231. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  5232.  emulate sh
  5233.  NULLCMD=:
  5234.  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  5235.  # is contrary to our usage.  Disable this feature.
  5236.  alias -g '\${1+\"\$@\"}'='\"\$@\"'
  5237.  setopt NO_GLOB_SUBST
  5238. else
  5239.  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  5240. fi
  5241. BIN_SH=xpg4; export BIN_SH # for Tru64
  5242. DUALCASE=1; export DUALCASE # for MKS sh
  5243.  
  5244. # The HP-UX ksh and POSIX shell print the target directory to stdout
  5245. # if CDPATH is set.
  5246. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  5247.  
  5248. relink_command=\"$relink_command\"
  5249.  
  5250. # This environment variable determines our operation mode.
  5251. if test \"\$libtool_install_magic\" = \"$magic\"; then
  5252.  # install mode needs the following variables:
  5253.  generated_by_libtool_version='$macro_version'
  5254.  notinst_deplibs='$notinst_deplibs'
  5255. else
  5256.  # When we are sourced in execute mode, \$file and \$ECHO are already set.
  5257.  if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5258.    file=\"\$0\""
  5259.  
  5260.     qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  5261.     $ECHO "\
  5262. # A function that is used when there is no print builtin or printf.
  5263. func_fallback_echo ()
  5264. {
  5265.  eval 'cat <<_LTECHO_EOF
  5266. \$1
  5267. _LTECHO_EOF'
  5268. }
  5269.    ECHO=\"$qECHO\"
  5270.  fi
  5271.  
  5272. # Very basic option parsing. These options are (a) specific to
  5273. # the libtool wrapper, (b) are identical between the wrapper
  5274. # /script/ and the wrapper /executable/ that is used only on
  5275. # windows platforms, and (c) all begin with the string "--lt-"
  5276. # (application programs are unlikely to have options that match
  5277. # this pattern).
  5278. #
  5279. # There are only two supported options: --lt-debug and
  5280. # --lt-dump-script. There is, deliberately, no --lt-help.
  5281. #
  5282. # The first argument to this parsing function should be the
  5283. # script's $0 value, followed by "$@".
  5284. lt_option_debug=
  5285. func_parse_lt_options ()
  5286. {
  5287.  lt_script_arg0=\$0
  5288.  shift
  5289.  for lt_opt
  5290.  do
  5291.    case \"\$lt_opt\" in
  5292.    --lt-debug) lt_option_debug=1 ;;
  5293.    --lt-dump-script)
  5294.        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  5295.        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  5296.        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  5297.        cat \"\$lt_dump_D/\$lt_dump_F\"
  5298.        exit 0
  5299.      ;;
  5300.    --lt-*)
  5301.        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  5302.        exit 1
  5303.      ;;
  5304.    esac
  5305.  done
  5306.  
  5307.  # Print the debug banner immediately:
  5308.  if test -n \"\$lt_option_debug\"; then
  5309.    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  5310.  fi
  5311. }
  5312.  
  5313. # Used when --lt-debug. Prints its arguments to stdout
  5314. # (redirection is the responsibility of the caller)
  5315. func_lt_dump_args ()
  5316. {
  5317.  lt_dump_args_N=1;
  5318.  for lt_arg
  5319.  do
  5320.    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  5321.    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  5322.  done
  5323. }
  5324.  
  5325. # Core function for launching the target application
  5326. func_exec_program_core ()
  5327. {
  5328. "
  5329.   case $host in
  5330.   # Backslashes separate directories on plain windows
  5331.   *-*-mingw | *-*-os2* | *-cegcc*)
  5332.     $ECHO "\
  5333.      if test -n \"\$lt_option_debug\"; then
  5334.        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  5335.        func_lt_dump_args \${1+\"\$@\"} 1>&2
  5336.      fi
  5337.      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  5338. "
  5339.     ;;
  5340.  
  5341.   *)
  5342.     $ECHO "\
  5343.      if test -n \"\$lt_option_debug\"; then
  5344.        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  5345.        func_lt_dump_args \${1+\"\$@\"} 1>&2
  5346.      fi
  5347.      exec \"\$progdir/\$program\" \${1+\"\$@\"}
  5348. "
  5349.     ;;
  5350.   esac
  5351.   $ECHO "\
  5352.      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  5353.      exit 1
  5354. }
  5355.  
  5356. # A function to encapsulate launching the target application
  5357. # Strips options in the --lt-* namespace from \$@ and
  5358. # launches target application with the remaining arguments.
  5359. func_exec_program ()
  5360. {
  5361.  case \" \$* \" in
  5362.  *\\ --lt-*)
  5363.    for lt_wr_arg
  5364.    do
  5365.      case \$lt_wr_arg in
  5366.      --lt-*) ;;
  5367.      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  5368.      esac
  5369.      shift
  5370.    done ;;
  5371.  esac
  5372.  func_exec_program_core \${1+\"\$@\"}
  5373. }
  5374.  
  5375.  # Parse options
  5376.  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  5377.  
  5378.  # Find the directory that this script lives in.
  5379.  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  5380.  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  5381.  
  5382.  # Follow symbolic links until we get to the real thisdir.
  5383.  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  5384.  while test -n \"\$file\"; do
  5385.    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  5386.  
  5387.    # If there was a directory component, then change thisdir.
  5388.    if test \"x\$destdir\" != \"x\$file\"; then
  5389.      case \"\$destdir\" in
  5390.      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  5391.      *) thisdir=\"\$thisdir/\$destdir\" ;;
  5392.      esac
  5393.    fi
  5394.  
  5395.    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  5396.    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  5397.  done
  5398.  
  5399.  # Usually 'no', except on cygwin/mingw when embedded into
  5400.  # the cwrapper.
  5401.  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  5402.  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  5403.    # special case for '.'
  5404.    if test \"\$thisdir\" = \".\"; then
  5405.      thisdir=\`pwd\`
  5406.    fi
  5407.    # remove .libs from thisdir
  5408.    case \"\$thisdir\" in
  5409.    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  5410.    $objdir )   thisdir=. ;;
  5411.    esac
  5412.  fi
  5413.  
  5414.  # Try to get the absolute directory name.
  5415.  absdir=\`cd \"\$thisdir\" && pwd\`
  5416.  test -n \"\$absdir\" && thisdir=\"\$absdir\"
  5417. "
  5418.  
  5419.         if test yes = "$fast_install"; then
  5420.           $ECHO "\
  5421.  program=lt-'$outputname'$exeext
  5422.  progdir=\"\$thisdir/$objdir\"
  5423.  
  5424.  if test ! -f \"\$progdir/\$program\" ||
  5425.     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5426.       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5427.  
  5428.    file=\"\$\$-\$program\"
  5429.  
  5430.    if test ! -d \"\$progdir\"; then
  5431.      $MKDIR \"\$progdir\"
  5432.    else
  5433.      $RM \"\$progdir/\$file\"
  5434.    fi"
  5435.  
  5436.           $ECHO "\
  5437.    # relink executable if necessary
  5438.    if test -n \"\$relink_command\"; then
  5439.      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5440.      else
  5441.         \$ECHO \"\$relink_command_output\" >&2
  5442.         $RM \"\$progdir/\$file\"
  5443.         exit 1
  5444.      fi
  5445.    fi
  5446.  
  5447.    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5448.    { $RM \"\$progdir/\$program\";
  5449.      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5450.    $RM \"\$progdir/\$file\"
  5451.  fi"
  5452.         else
  5453.           $ECHO "\
  5454.  program='$outputname'
  5455.  progdir=\"\$thisdir/$objdir\"
  5456. "
  5457.         fi
  5458.  
  5459.         $ECHO "\
  5460.  if test -f \"\$progdir/\$program\"; then"
  5461.  
  5462.         # fixup the dll searchpath if we need to.
  5463.         #
  5464.         # Fix the DLL searchpath if we need to.  Do this before prepending
  5465.         # to shlibpath, because on Windows, both are PATH and uninstalled
  5466.         # libraries must come first.
  5467.         if test -n "$dllsearchpath"; then
  5468.           $ECHO "\
  5469.    # Add the dll search path components to the executable PATH
  5470.    PATH=$dllsearchpath:\$PATH
  5471. "
  5472.         fi
  5473.  
  5474.         # Export our shlibpath_var if we have one.
  5475.         if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5476.           $ECHO "\
  5477.    # Add our own library path to $shlibpath_var
  5478.    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5479.  
  5480.    # Some systems cannot cope with colon-terminated $shlibpath_var
  5481.    # The second colon is a workaround for a bug in BeOS R4 sed
  5482.    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5483.  
  5484.    export $shlibpath_var
  5485. "
  5486.         fi
  5487.  
  5488.         $ECHO "\
  5489.    if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5490.      # Run the actual program with our arguments.
  5491.      func_exec_program \${1+\"\$@\"}
  5492.    fi
  5493.  else
  5494.    # The program doesn't exist.
  5495.    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5496.    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5497.    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5498.    exit 1
  5499.  fi
  5500. fi\
  5501. "
  5502. }
  5503.  
  5504.  
  5505. # func_emit_cwrapperexe_src
  5506. # emit the source code for a wrapper executable on stdout
  5507. # Must ONLY be called from within func_mode_link because
  5508. # it depends on a number of variable set therein.
  5509. func_emit_cwrapperexe_src ()
  5510. {
  5511.         cat <<EOF
  5512.  
  5513. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5514.    Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5515.  
  5516.    The $output program cannot be directly executed until all the libtool
  5517.    libraries that it depends on are installed.
  5518.  
  5519.    This wrapper executable should never be moved out of the build directory.
  5520.    If it is, it will not operate correctly.
  5521. */
  5522. EOF
  5523.             cat <<"EOF"
  5524. #ifdef _MSC_VER
  5525. # define _CRT_SECURE_NO_DEPRECATE 1
  5526. #endif
  5527. #include <stdio.h>
  5528. #include <stdlib.h>
  5529. #ifdef _MSC_VER
  5530. # include <direct.h>
  5531. # include <process.h>
  5532. # include <io.h>
  5533. #else
  5534. # include <unistd.h>
  5535. # include <stdint.h>
  5536. # ifdef __CYGWIN__
  5537. #  include <process.h>
  5538. #  include <io.h>
  5539. # endif
  5540. #endif
  5541. #include <malloc.h>
  5542. #include <stdarg.h>
  5543. #include <assert.h>
  5544. #include <string.h>
  5545. #include <ctype.h>
  5546. #include <errno.h>
  5547. #include <fcntl.h>
  5548. #include <sys/stat.h>
  5549.  
  5550. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5551.  
  5552. /* declarations of non-ANSI functions */
  5553. #if defined __MINGW32__
  5554. # if defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR) || defined(_POSIX_)
  5555. int _putenv (const char *);
  5556. # endif
  5557. #elif defined __CYGWIN__
  5558. # ifdef __STRICT_ANSI__
  5559. char *realpath (const char *, char *);
  5560. int putenv (char *);
  5561. int setenv (const char *, const char *, int);
  5562. # endif
  5563. /* #elif defined other_platform || defined ... */
  5564. #endif
  5565.  
  5566. /* portability defines, excluding path handling macros */
  5567. #if defined _MSC_VER
  5568. # define setmode _setmode
  5569. # define stat    _stat
  5570. # define chmod   _chmod
  5571. # define getcwd  _getcwd
  5572. # define putenv  _putenv
  5573. # define S_IXUSR _S_IEXEC
  5574. #elif defined __MINGW32__
  5575. # define setmode _setmode
  5576. # define stat    _stat
  5577. # define chmod   _chmod
  5578. # define getcwd  _getcwd
  5579. # define putenv  _putenv
  5580. #elif defined __CYGWIN__
  5581. # define HAVE_SETENV
  5582. # define FOPEN_WB "wb"
  5583. /* #elif defined other platforms ... */
  5584. #endif
  5585.  
  5586. #if defined PATH_MAX
  5587. # define LT_PATHMAX PATH_MAX
  5588. #elif defined MAXPATHLEN
  5589. # define LT_PATHMAX MAXPATHLEN
  5590. #else
  5591. # define LT_PATHMAX 1024
  5592. #endif
  5593.  
  5594. #ifndef S_IXOTH
  5595. # define S_IXOTH 0
  5596. #endif
  5597. #ifndef S_IXGRP
  5598. # define S_IXGRP 0
  5599. #endif
  5600.  
  5601. /* path handling portability macros */
  5602. #ifndef DIR_SEPARATOR
  5603. # define DIR_SEPARATOR '/'
  5604. # define PATH_SEPARATOR ':'
  5605. #endif
  5606.  
  5607. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5608.   defined __OS2__
  5609. # define HAVE_DOS_BASED_FILE_SYSTEM
  5610. # define FOPEN_WB "wb"
  5611. # ifndef DIR_SEPARATOR_2
  5612. #  define DIR_SEPARATOR_2 '\\'
  5613. # endif
  5614. # ifndef PATH_SEPARATOR_2
  5615. #  define PATH_SEPARATOR_2 ';'
  5616. # endif
  5617. #endif
  5618.  
  5619. #ifndef DIR_SEPARATOR_2
  5620. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5621. #else /* DIR_SEPARATOR_2 */
  5622. # define IS_DIR_SEPARATOR(ch) \
  5623.         (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5624. #endif /* DIR_SEPARATOR_2 */
  5625.  
  5626. #ifndef PATH_SEPARATOR_2
  5627. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5628. #else /* PATH_SEPARATOR_2 */
  5629. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5630. #endif /* PATH_SEPARATOR_2 */
  5631.  
  5632. #ifndef FOPEN_WB
  5633. # define FOPEN_WB "w"
  5634. #endif
  5635. #ifndef _O_BINARY
  5636. # define _O_BINARY 0
  5637. #endif
  5638.  
  5639. #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  5640. #define XFREE(stale) do { \
  5641.   if (stale) { free (stale); stale = 0; } \
  5642. } while (0)
  5643.  
  5644. #if defined LT_DEBUGWRAPPER
  5645. static int lt_debug = 1;
  5646. #else
  5647. static int lt_debug = 0;
  5648. #endif
  5649.  
  5650. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5651.  
  5652. void *xmalloc (size_t num);
  5653. char *xstrdup (const char *string);
  5654. const char *base_name (const char *name);
  5655. char *find_executable (const char *wrapper);
  5656. char *chase_symlinks (const char *pathspec);
  5657. int make_executable (const char *path);
  5658. int check_executable (const char *path);
  5659. char *strendzap (char *str, const char *pat);
  5660. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5661. void lt_fatal (const char *file, int line, const char *message, ...);
  5662. static const char *nonnull (const char *s);
  5663. static const char *nonempty (const char *s);
  5664. void lt_setenv (const char *name, const char *value);
  5665. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5666. void lt_update_exe_path (const char *name, const char *value);
  5667. void lt_update_lib_path (const char *name, const char *value);
  5668. char **prepare_spawn (char **argv);
  5669. void lt_dump_script (FILE *f);
  5670. EOF
  5671.  
  5672.             cat <<EOF
  5673. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5674. # define externally_visible volatile
  5675. #else
  5676. # define externally_visible __attribute__((externally_visible)) volatile
  5677. #endif
  5678. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5679. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5680. EOF
  5681.  
  5682.             if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5683.               func_to_host_path "$temp_rpath"
  5684.               cat <<EOF
  5685. const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
  5686. EOF
  5687.             else
  5688.               cat <<"EOF"
  5689. const char * LIB_PATH_VALUE   = "";
  5690. EOF
  5691.             fi
  5692.  
  5693.             if test -n "$dllsearchpath"; then
  5694.               func_to_host_path "$dllsearchpath:"
  5695.               cat <<EOF
  5696. const char * EXE_PATH_VARNAME = "PATH";
  5697. const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
  5698. EOF
  5699.             else
  5700.               cat <<"EOF"
  5701. const char * EXE_PATH_VARNAME = "";
  5702. const char * EXE_PATH_VALUE   = "";
  5703. EOF
  5704.             fi
  5705.  
  5706.             if test yes = "$fast_install"; then
  5707.               cat <<EOF
  5708. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5709. EOF
  5710.             else
  5711.               cat <<EOF
  5712. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5713. EOF
  5714.             fi
  5715.  
  5716.  
  5717.             cat <<"EOF"
  5718.  
  5719. #define LTWRAPPER_OPTION_PREFIX         "--lt-"
  5720.  
  5721. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5722. static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
  5723. static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
  5724.  
  5725. int
  5726. main (int argc, char *argv[])
  5727. {
  5728.   char **newargz;
  5729.   int  newargc;
  5730.   char *tmp_pathspec;
  5731.   char *actual_cwrapper_path;
  5732.   char *actual_cwrapper_name;
  5733.   char *target_name;
  5734.   char *lt_argv_zero;
  5735.   int rval = 127;
  5736.  
  5737.   int i;
  5738.  
  5739.   program_name = (char *) xstrdup (base_name (argv[0]));
  5740.   newargz = XMALLOC (char *, (size_t) argc + 1);
  5741.  
  5742.   /* very simple arg parsing; don't want to rely on getopt
  5743.   * also, copy all non cwrapper options to newargz, except
  5744.   * argz[0], which is handled differently
  5745.   */
  5746.  newargc=0;
  5747.  for (i = 1; i < argc; i++)
  5748.    {
  5749.      if (STREQ (argv[i], dumpscript_opt))
  5750.         {
  5751. EOF
  5752.             case $host in
  5753.               *mingw* | *cygwin* | *msys* )
  5754.                 # make stdout use "unix" line endings
  5755.                 echo "          setmode(1,_O_BINARY);"
  5756.                 ;;
  5757.               esac
  5758.  
  5759.             cat <<"EOF"
  5760.           lt_dump_script (stdout);
  5761.           return 0;
  5762.         }
  5763.      if (STREQ (argv[i], debug_opt))
  5764.         {
  5765.          lt_debug = 1;
  5766.          continue;
  5767.         }
  5768.      if (STREQ (argv[i], ltwrapper_option_prefix))
  5769.        {
  5770.          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5771.             namespace, but it is not one of the ones we know about and
  5772.             have already dealt with, above (inluding dump-script), then
  5773.             report an error. Otherwise, targets might begin to believe
  5774.             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5775.             namespace. The first time any user complains about this, we'll
  5776.              need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5777.              or a configure.ac-settable value.
  5778.            */
  5779.           lt_fatal (__FILE__, __LINE__,
  5780.                     "unrecognized %s option: '%s'",
  5781.                     ltwrapper_option_prefix, argv[i]);
  5782.         }
  5783.       /* otherwise ... */
  5784.       newargz[++newargc] = xstrdup (argv[i]);
  5785.     }
  5786.   newargz[++newargc] = NULL;
  5787.  
  5788. EOF
  5789.             cat <<EOF
  5790.   /* The GNU banner must be the first non-error debug message */
  5791.   lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5792. EOF
  5793.             cat <<"EOF"
  5794.   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5795.   lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5796.  
  5797.   tmp_pathspec = find_executable (argv[0]);
  5798.   if (tmp_pathspec == NULL)
  5799.     lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5800.   lt_debugprintf (__FILE__, __LINE__,
  5801.                   "(main) found exe (before symlink chase) at: %s\n",
  5802.                   tmp_pathspec);
  5803.  
  5804.   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5805.   lt_debugprintf (__FILE__, __LINE__,
  5806.                   "(main) found exe (after symlink chase) at: %s\n",
  5807.                   actual_cwrapper_path);
  5808.   XFREE (tmp_pathspec);
  5809.  
  5810.   actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5811.   strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5812.  
  5813.   /* wrapper name transforms */
  5814.   strendzap (actual_cwrapper_name, ".exe");
  5815.   tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5816.   XFREE (actual_cwrapper_name);
  5817.   actual_cwrapper_name = tmp_pathspec;
  5818.   tmp_pathspec = 0;
  5819.  
  5820.   /* target_name transforms -- use actual target program name; might have lt- prefix */
  5821.   target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5822.   strendzap (target_name, ".exe");
  5823.   tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5824.   XFREE (target_name);
  5825.   target_name = tmp_pathspec;
  5826.   tmp_pathspec = 0;
  5827.  
  5828.   lt_debugprintf (__FILE__, __LINE__,
  5829.                   "(main) libtool target name: %s\n",
  5830.                   target_name);
  5831. EOF
  5832.  
  5833.             cat <<EOF
  5834.   newargz[0] =
  5835.     XMALLOC (char, (strlen (actual_cwrapper_path) +
  5836.                     strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5837.   strcpy (newargz[0], actual_cwrapper_path);
  5838.   strcat (newargz[0], "$objdir");
  5839.   strcat (newargz[0], "/");
  5840. EOF
  5841.  
  5842.             cat <<"EOF"
  5843.   /* stop here, and copy so we don't have to do this twice */
  5844.  tmp_pathspec = xstrdup (newargz[0]);
  5845.  
  5846.  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5847.  strcat (newargz[0], actual_cwrapper_name);
  5848.  
  5849.  /* DO want the lt- prefix here if it exists, so use target_name */
  5850.  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5851.  XFREE (tmp_pathspec);
  5852.  tmp_pathspec = NULL;
  5853. EOF
  5854.  
  5855.             case $host_os in
  5856.               mingw*)
  5857.             cat <<"EOF"
  5858.  {
  5859.    char* p;
  5860.    while ((p = strchr (newargz[0], '\\')) != NULL)
  5861.       {
  5862.         *p = '/';
  5863.       }
  5864.     while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5865.       {
  5866.         *p = '/';
  5867.       }
  5868.   }
  5869. EOF
  5870.             ;;
  5871.             esac
  5872.  
  5873.             cat <<"EOF"
  5874.   XFREE (target_name);
  5875.   XFREE (actual_cwrapper_path);
  5876.   XFREE (actual_cwrapper_name);
  5877.  
  5878.   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5879.   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
  5880.   /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
  5881.      be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5882.      because on Windows, both *_VARNAMEs are PATH but uninstalled
  5883.      libraries must come first. */
  5884.   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5885.   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5886.  
  5887.   lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5888.                   nonnull (lt_argv_zero));
  5889.   for (i = 0; i < newargc; i++)
  5890.     {
  5891.       lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5892.                       i, nonnull (newargz[i]));
  5893.     }
  5894.  
  5895. EOF
  5896.  
  5897.             case $host_os in
  5898.               mingw*)
  5899.                 cat <<"EOF"
  5900.   /* execv doesn't actually work on mingw as expected on unix */
  5901.  newargz = prepare_spawn (newargz);
  5902.  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5903.  if (rval == -1)
  5904.    {
  5905.      /* failed to start process */
  5906.      lt_debugprintf (__FILE__, __LINE__,
  5907.                       "(main) failed to launch target \"%s\": %s\n",
  5908.                       lt_argv_zero, nonnull (strerror (errno)));
  5909.      return 127;
  5910.    }
  5911.  return rval;
  5912. EOF
  5913.                 ;;
  5914.               *)
  5915.                 cat <<"EOF"
  5916.  execv (lt_argv_zero, newargz);
  5917.  return rval; /* =127, but avoids unused variable warning */
  5918. EOF
  5919.                 ;;
  5920.             esac
  5921.  
  5922.             cat <<"EOF"
  5923. }
  5924.  
  5925. void *
  5926. xmalloc (size_t num)
  5927. {
  5928.  void *p = (void *) malloc (num);
  5929.  if (!p)
  5930.    lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5931.  
  5932.  return p;
  5933. }
  5934.  
  5935. char *
  5936. xstrdup (const char *string)
  5937. {
  5938.  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5939.                           string) : NULL;
  5940. }
  5941.  
  5942. const char *
  5943. base_name (const char *name)
  5944. {
  5945.  const char *base;
  5946.  
  5947. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5948.  /* Skip over the disk name in MSDOS pathnames. */
  5949.  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5950.    name += 2;
  5951. #endif
  5952.  
  5953.  for (base = name; *name; name++)
  5954.    if (IS_DIR_SEPARATOR (*name))
  5955.      base = name + 1;
  5956.  return base;
  5957. }
  5958.  
  5959. int
  5960. check_executable (const char *path)
  5961. {
  5962.  struct stat st;
  5963.  
  5964.  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5965.                  nonempty (path));
  5966.  if ((!path) || (!*path))
  5967.    return 0;
  5968.  
  5969.  if ((stat (path, &st) >= 0)
  5970.      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5971.    return 1;
  5972.  else
  5973.    return 0;
  5974. }
  5975.  
  5976. int
  5977. make_executable (const char *path)
  5978. {
  5979.  int rval = 0;
  5980.  struct stat st;
  5981.  
  5982.  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5983.                  nonempty (path));
  5984.  if ((!path) || (!*path))
  5985.    return 0;
  5986.  
  5987.  if (stat (path, &st) >= 0)
  5988.    {
  5989.      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5990.    }
  5991.  return rval;
  5992. }
  5993.  
  5994. /* Searches for the full path of the wrapper.  Returns
  5995.   newly allocated full path name if found, NULL otherwise
  5996.   Does not chase symlinks, even on platforms that support them.
  5997. */
  5998. char *
  5999. find_executable (const char *wrapper)
  6000. {
  6001.  int has_slash = 0;
  6002.  const char *p;
  6003.  const char *p_next;
  6004.  /* static buffer for getcwd */
  6005.  char tmp[LT_PATHMAX + 1];
  6006.  size_t tmp_len;
  6007.  char *concat_name;
  6008.  
  6009.  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  6010.                  nonempty (wrapper));
  6011.  
  6012.  if ((wrapper == NULL) || (*wrapper == '\0'))
  6013.    return NULL;
  6014.  
  6015.  /* Absolute path? */
  6016. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  6017.  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  6018.    {
  6019.      concat_name = xstrdup (wrapper);
  6020.      if (check_executable (concat_name))
  6021.         return concat_name;
  6022.      XFREE (concat_name);
  6023.    }
  6024.  else
  6025.    {
  6026. #endif
  6027.      if (IS_DIR_SEPARATOR (wrapper[0]))
  6028.         {
  6029.           concat_name = xstrdup (wrapper);
  6030.           if (check_executable (concat_name))
  6031.             return concat_name;
  6032.           XFREE (concat_name);
  6033.         }
  6034. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  6035.    }
  6036. #endif
  6037.  
  6038.  for (p = wrapper; *p; p++)
  6039.    if (*p == '/')
  6040.      {
  6041.         has_slash = 1;
  6042.         break;
  6043.      }
  6044.  if (!has_slash)
  6045.    {
  6046.      /* no slashes; search PATH */
  6047.      const char *path = getenv ("PATH");
  6048.      if (path != NULL)
  6049.         {
  6050.           for (p = path; *p; p = p_next)
  6051.             {
  6052.               const char *q;
  6053.               size_t p_len;
  6054.               for (q = p; *q; q++)
  6055.                 if (IS_PATH_SEPARATOR (*q))
  6056.                   break;
  6057.               p_len = (size_t) (q - p);
  6058.               p_next = (*q == '\0' ? q : q + 1);
  6059.               if (p_len == 0)
  6060.                 {
  6061.                   /* empty path: current directory */
  6062.                   if (getcwd (tmp, LT_PATHMAX) == NULL)
  6063.                     lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  6064.                              nonnull (strerror (errno)));
  6065.                   tmp_len = strlen (tmp);
  6066.                   concat_name =
  6067.                     XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  6068.                   memcpy (concat_name, tmp, tmp_len);
  6069.                   concat_name[tmp_len] = '/';
  6070.                   strcpy (concat_name + tmp_len + 1, wrapper);
  6071.                 }
  6072.               else
  6073.                 {
  6074.                   concat_name =
  6075.                     XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  6076.                   memcpy (concat_name, p, p_len);
  6077.                   concat_name[p_len] = '/';
  6078.                   strcpy (concat_name + p_len + 1, wrapper);
  6079.                 }
  6080.               if (check_executable (concat_name))
  6081.                 return concat_name;
  6082.               XFREE (concat_name);
  6083.             }
  6084.         }
  6085.      /* not found in PATH; assume curdir */
  6086.    }
  6087.  /* Relative path | not found in path: prepend cwd */
  6088.  if (getcwd (tmp, LT_PATHMAX) == NULL)
  6089.    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  6090.              nonnull (strerror (errno)));
  6091.  tmp_len = strlen (tmp);
  6092.  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  6093.  memcpy (concat_name, tmp, tmp_len);
  6094.  concat_name[tmp_len] = '/';
  6095.  strcpy (concat_name + tmp_len + 1, wrapper);
  6096.  
  6097.  if (check_executable (concat_name))
  6098.    return concat_name;
  6099.  XFREE (concat_name);
  6100.  return NULL;
  6101. }
  6102.  
  6103. char *
  6104. chase_symlinks (const char *pathspec)
  6105. {
  6106. #ifndef S_ISLNK
  6107.  return xstrdup (pathspec);
  6108. #else
  6109.  char buf[LT_PATHMAX];
  6110.  struct stat s;
  6111.  char *tmp_pathspec = xstrdup (pathspec);
  6112.  char *p;
  6113.  int has_symlinks = 0;
  6114.  while (strlen (tmp_pathspec) && !has_symlinks)
  6115.    {
  6116.      lt_debugprintf (__FILE__, __LINE__,
  6117.                       "checking path component for symlinks: %s\n",
  6118.                       tmp_pathspec);
  6119.      if (lstat (tmp_pathspec, &s) == 0)
  6120.         {
  6121.           if (S_ISLNK (s.st_mode) != 0)
  6122.             {
  6123.               has_symlinks = 1;
  6124.               break;
  6125.             }
  6126.  
  6127.           /* search backwards for last DIR_SEPARATOR */
  6128.           p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  6129.           while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  6130.             p--;
  6131.           if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  6132.             {
  6133.               /* no more DIR_SEPARATORS left */
  6134.               break;
  6135.             }
  6136.           *p = '\0';
  6137.         }
  6138.      else
  6139.         {
  6140.           lt_fatal (__FILE__, __LINE__,
  6141.                     "error accessing file \"%s\": %s",
  6142.                     tmp_pathspec, nonnull (strerror (errno)));
  6143.         }
  6144.    }
  6145.  XFREE (tmp_pathspec);
  6146.  
  6147.  if (!has_symlinks)
  6148.    {
  6149.      return xstrdup (pathspec);
  6150.    }
  6151.  
  6152.  tmp_pathspec = realpath (pathspec, buf);
  6153.  if (tmp_pathspec == 0)
  6154.    {
  6155.      lt_fatal (__FILE__, __LINE__,
  6156.                 "could not follow symlinks for %s", pathspec);
  6157.    }
  6158.  return xstrdup (tmp_pathspec);
  6159. #endif
  6160. }
  6161.  
  6162. char *
  6163. strendzap (char *str, const char *pat)
  6164. {
  6165.  size_t len, patlen;
  6166.  
  6167.  assert (str != NULL);
  6168.  assert (pat != NULL);
  6169.  
  6170.  len = strlen (str);
  6171.  patlen = strlen (pat);
  6172.  
  6173.  if (patlen <= len)
  6174.    {
  6175.      str += len - patlen;
  6176.      if (STREQ (str, pat))
  6177.         *str = '\0';
  6178.    }
  6179.  return str;
  6180. }
  6181.  
  6182. void
  6183. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  6184. {
  6185.  va_list args;
  6186.  if (lt_debug)
  6187.    {
  6188.      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  6189.      va_start (args, fmt);
  6190.      (void) vfprintf (stderr, fmt, args);
  6191.      va_end (args);
  6192.    }
  6193. }
  6194.  
  6195. static void
  6196. lt_error_core (int exit_status, const char *file,
  6197.                int line, const char *mode,
  6198.                const char *message, va_list ap)
  6199. {
  6200.  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  6201.  vfprintf (stderr, message, ap);
  6202.  fprintf (stderr, ".\n");
  6203.  
  6204.  if (exit_status >= 0)
  6205.    exit (exit_status);
  6206. }
  6207.  
  6208. void
  6209. lt_fatal (const char *file, int line, const char *message, ...)
  6210. {
  6211.  va_list ap;
  6212.  va_start (ap, message);
  6213.  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  6214.  va_end (ap);
  6215. }
  6216.  
  6217. static const char *
  6218. nonnull (const char *s)
  6219. {
  6220.  return s ? s : "(null)";
  6221. }
  6222.  
  6223. static const char *
  6224. nonempty (const char *s)
  6225. {
  6226.  return (s && !*s) ? "(empty)" : nonnull (s);
  6227. }
  6228.  
  6229. void
  6230. lt_setenv (const char *name, const char *value)
  6231. {
  6232.  lt_debugprintf (__FILE__, __LINE__,
  6233.                   "(lt_setenv) setting '%s' to '%s'\n",
  6234.                  nonnull (name), nonnull (value));
  6235.  {
  6236. #ifdef HAVE_SETENV
  6237.    /* always make a copy, for consistency with !HAVE_SETENV */
  6238.    char *str = xstrdup (value);
  6239.    setenv (name, str, 1);
  6240. #else
  6241.    size_t len = strlen (name) + 1 + strlen (value) + 1;
  6242.    char *str = XMALLOC (char, len);
  6243.    sprintf (str, "%s=%s", name, value);
  6244.    if (putenv (str) != EXIT_SUCCESS)
  6245.      {
  6246.        XFREE (str);
  6247.      }
  6248. #endif
  6249.  }
  6250. }
  6251.  
  6252. char *
  6253. lt_extend_str (const char *orig_value, const char *add, int to_end)
  6254. {
  6255.  char *new_value;
  6256.  if (orig_value && *orig_value)
  6257.    {
  6258.      size_t orig_value_len = strlen (orig_value);
  6259.      size_t add_len = strlen (add);
  6260.      new_value = XMALLOC (char, add_len + orig_value_len + 1);
  6261.      if (to_end)
  6262.        {
  6263.          strcpy (new_value, orig_value);
  6264.          strcpy (new_value + orig_value_len, add);
  6265.        }
  6266.      else
  6267.        {
  6268.          strcpy (new_value, add);
  6269.          strcpy (new_value + add_len, orig_value);
  6270.        }
  6271.    }
  6272.  else
  6273.    {
  6274.      new_value = xstrdup (add);
  6275.    }
  6276.  return new_value;
  6277. }
  6278.  
  6279. void
  6280. lt_update_exe_path (const char *name, const char *value)
  6281. {
  6282.  lt_debugprintf (__FILE__, __LINE__,
  6283.                   "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  6284.                  nonnull (name), nonnull (value));
  6285.  
  6286.  if (name && *name && value && *value)
  6287.    {
  6288.      char *new_value = lt_extend_str (getenv (name), value, 0);
  6289.      /* some systems can't cope with a ':'-terminated path #' */
  6290.       size_t len = strlen (new_value);
  6291.       while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  6292.         {
  6293.           new_value[--len] = '\0';
  6294.         }
  6295.       lt_setenv (name, new_value);
  6296.       XFREE (new_value);
  6297.     }
  6298. }
  6299.  
  6300. void
  6301. lt_update_lib_path (const char *name, const char *value)
  6302. {
  6303.   lt_debugprintf (__FILE__, __LINE__,
  6304.                   "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  6305.                   nonnull (name), nonnull (value));
  6306.  
  6307.   if (name && *name && value && *value)
  6308.     {
  6309.       char *new_value = lt_extend_str (getenv (name), value, 0);
  6310.       lt_setenv (name, new_value);
  6311.       XFREE (new_value);
  6312.     }
  6313. }
  6314.  
  6315. EOF
  6316.             case $host_os in
  6317.               mingw*)
  6318.                 cat <<"EOF"
  6319.  
  6320. /* Prepares an argument vector before calling spawn().
  6321.    Note that spawn() does not by itself call the command interpreter
  6322.      (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  6323.       ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  6324.          GetVersionEx(&v);
  6325.          v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  6326.       }) ? "cmd.exe" : "command.com").
  6327.    Instead it simply concatenates the arguments, separated by ' ', and calls
  6328.    CreateProcess().  We must quote the arguments since Win32 CreateProcess()
  6329.    interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  6330.    special way:
  6331.    - Space and tab are interpreted as delimiters. They are not treated as
  6332.      delimiters if they are surrounded by double quotes: "...".
  6333.    - Unescaped double quotes are removed from the input. Their only effect is
  6334.      that within double quotes, space and tab are treated like normal
  6335.      characters.
  6336.    - Backslashes not followed by double quotes are not special.
  6337.    - But 2*n+1 backslashes followed by a double quote become
  6338.      n backslashes followed by a double quote (n >= 0):
  6339.        \" -> "
  6340.       \\\" -> \"
  6341.       \\\\\" -> \\"
  6342. */
  6343. #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"
  6344. #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"
  6345. char **
  6346. prepare_spawn (char **argv)
  6347. {
  6348.  size_t argc;
  6349.  char **new_argv;
  6350.  size_t i;
  6351.  
  6352.  /* Count number of arguments.  */
  6353.  for (argc = 0; argv[argc] != NULL; argc++)
  6354.    ;
  6355.  
  6356.  /* Allocate new argument vector.  */
  6357.  new_argv = XMALLOC (char *, argc + 1);
  6358.  
  6359.  /* Put quoted arguments into the new argument vector.  */
  6360.  for (i = 0; i < argc; i++)
  6361.    {
  6362.      const char *string = argv[i];
  6363.  
  6364.      if (string[0] == '\0')
  6365.         new_argv[i] = xstrdup ("\"\"");
  6366.      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  6367.         {
  6368.           int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  6369.           size_t length;
  6370.           unsigned int backslashes;
  6371.           const char *s;
  6372.           char *quoted_string;
  6373.           char *p;
  6374.  
  6375.           length = 0;
  6376.           backslashes = 0;
  6377.           if (quote_around)
  6378.             length++;
  6379.           for (s = string; *s != '\0'; s++)
  6380.             {
  6381.               char c = *s;
  6382.               if (c == '"')
  6383.                 length += backslashes + 1;
  6384.               length++;
  6385.               if (c == '\\')
  6386.                 backslashes++;
  6387.               else
  6388.                 backslashes = 0;
  6389.             }
  6390.           if (quote_around)
  6391.             length += backslashes + 1;
  6392.  
  6393.           quoted_string = XMALLOC (char, length + 1);
  6394.  
  6395.           p = quoted_string;
  6396.           backslashes = 0;
  6397.           if (quote_around)
  6398.             *p++ = '"';
  6399.           for (s = string; *s != '\0'; s++)
  6400.             {
  6401.               char c = *s;
  6402.               if (c == '"')
  6403.                 {
  6404.                   unsigned int j;
  6405.                   for (j = backslashes + 1; j > 0; j--)
  6406.                     *p++ = '\\';
  6407.                 }
  6408.               *p++ = c;
  6409.               if (c == '\\')
  6410.                 backslashes++;
  6411.               else
  6412.                 backslashes = 0;
  6413.             }
  6414.           if (quote_around)
  6415.             {
  6416.               unsigned int j;
  6417.               for (j = backslashes; j > 0; j--)
  6418.                 *p++ = '\\';
  6419.               *p++ = '"';
  6420.             }
  6421.           *p = '\0';
  6422.  
  6423.           new_argv[i] = quoted_string;
  6424.         }
  6425.       else
  6426.         new_argv[i] = (char *) string;
  6427.     }
  6428.   new_argv[argc] = NULL;
  6429.  
  6430.   return new_argv;
  6431. }
  6432. EOF
  6433.                 ;;
  6434.             esac
  6435.  
  6436.             cat <<"EOF"
  6437. void lt_dump_script (FILE* f)
  6438. {
  6439. EOF
  6440.             func_emit_wrapper yes |
  6441.               $SED -n -e '
  6442. s/^\(.\{79\}\)\(..*\)/\1\
  6443. \2/
  6444. h
  6445. s/\([\\"]\)/\\\1/g
  6446. s/$/\\n/
  6447. s/\([^\n]*\).*/  fputs ("\1", f);/p
  6448. g
  6449. D'
  6450.             cat <<"EOF"
  6451. }
  6452. EOF
  6453. }
  6454. # end: func_emit_cwrapperexe_src
  6455.  
  6456. # func_emit_exe_manifest
  6457. # emit a Win32 UAC manifest for executable on stdout
  6458. # Must ONLY be called from within func_mode_link because
  6459. # it depends on a number of variable set therein.
  6460. func_emit_exe_manifest ()
  6461. {
  6462.     cat <<EOF
  6463. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  6464. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  6465.   <assemblyIdentity version="1.0.0.0"
  6466. EOF
  6467.  
  6468.     case $host in
  6469.     i?86-*-* )   echo '     processorArchitecture="x86"' ;;
  6470.     ia64-*-* )   echo '     processorArchitecture="ia64"' ;;
  6471.     x86_64-*-* ) echo '     processorArchitecture="amd64"' ;;
  6472.     *)           echo '     processorArchitecture="*"' ;;
  6473.     esac
  6474.  
  6475.     cat <<EOF
  6476.      name="$host_os.$PROGRAM.$outputname"
  6477.      type="win32"/>
  6478.  
  6479.   <!-- Identify the application security requirements. -->
  6480.   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  6481.     <security>
  6482.       <requestedPrivileges>
  6483.         <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
  6484.       </requestedPrivileges>
  6485.     </security>
  6486.   </trustInfo>
  6487. </assembly>
  6488. EOF
  6489. }
  6490.  
  6491. # func_win32_import_lib_p ARG
  6492. # True if ARG is an import lib, as indicated by $file_magic_cmd
  6493. func_win32_import_lib_p ()
  6494. {
  6495.     $debug_cmd
  6496.  
  6497.     case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  6498.     *import*) : ;;
  6499.     *) false ;;
  6500.     esac
  6501. }
  6502.  
  6503. # func_suncc_cstd_abi
  6504. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  6505. # Several compiler flags select an ABI that is incompatible with the
  6506. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  6507. func_suncc_cstd_abi ()
  6508. {
  6509.     $debug_cmd
  6510.  
  6511.     case " $compile_command " in
  6512.     *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  6513.       suncc_use_cstd_abi=no
  6514.       ;;
  6515.     *)
  6516.       suncc_use_cstd_abi=yes
  6517.       ;;
  6518.     esac
  6519. }
  6520.  
  6521. # func_mode_link arg...
  6522. func_mode_link ()
  6523. {
  6524.     $debug_cmd
  6525.  
  6526.     case $host in
  6527.     *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6528.       # It is impossible to link a dll without this setting, and
  6529.       # we shouldn't force the makefile maintainer to figure out
  6530.       # what system we are compiling for in order to pass an extra
  6531.       # flag for every libtool invocation.
  6532.       # allow_undefined=no
  6533.  
  6534.       # FIXME: Unfortunately, there are problems with the above when trying
  6535.       # to make a dll that has undefined symbols, in which case not
  6536.       # even a static library is built.  For now, we need to specify
  6537.       # -no-undefined on the libtool link line when we can be certain
  6538.       # that all symbols are satisfied, otherwise we get a static library.
  6539.       allow_undefined=yes
  6540.       ;;
  6541.     *)
  6542.       allow_undefined=yes
  6543.       ;;
  6544.     esac
  6545.     libtool_args=$nonopt
  6546.     base_compile="$nonopt $@"
  6547.     compile_command=$nonopt
  6548.     finalize_command=$nonopt
  6549.  
  6550.     compile_rpath=
  6551.     finalize_rpath=
  6552.     compile_shlibpath=
  6553.     finalize_shlibpath=
  6554.     convenience=
  6555.     old_convenience=
  6556.     deplibs=
  6557.     old_deplibs=
  6558.     compiler_flags=
  6559.     linker_flags=
  6560.     dllsearchpath=
  6561.     lib_search_path=`pwd`
  6562.     inst_prefix_dir=
  6563.     new_inherited_linker_flags=
  6564.  
  6565.     avoid_version=no
  6566.     bindir=
  6567.     dlfiles=
  6568.     dlprefiles=
  6569.     dlself=no
  6570.     export_dynamic=no
  6571.     export_symbols=
  6572.     export_symbols_regex=
  6573.     generated=
  6574.     libobjs=
  6575.     ltlibs=
  6576.     module=no
  6577.     no_install=no
  6578.     objs=
  6579.     os2dllname=
  6580.     non_pic_objects=
  6581.     precious_files_regex=
  6582.     prefer_static_libs=no
  6583.     preload=false
  6584.     prev=
  6585.     prevarg=
  6586.     release=
  6587.     rpath=
  6588.     xrpath=
  6589.     perm_rpath=
  6590.     temp_rpath=
  6591.     thread_safe=no
  6592.     vinfo=
  6593.     vinfo_number=no
  6594.     weak_libs=
  6595.     single_module=$wl-single_module
  6596.     func_infer_tag $base_compile
  6597.  
  6598.     # We need to know -static, to get the right output filenames.
  6599.     for arg
  6600.     do
  6601.       case $arg in
  6602.       -shared)
  6603.         test yes != "$build_libtool_libs" \
  6604.           && func_fatal_configuration "cannot build a shared library"
  6605.         build_old_libs=no
  6606.         break
  6607.         ;;
  6608.       -all-static | -static | -static-libtool-libs)
  6609.         case $arg in
  6610.         -all-static)
  6611.           if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6612.             func_warning "complete static linking is impossible in this configuration"
  6613.           fi
  6614.           if test -n "$link_static_flag"; then
  6615.             dlopen_self=$dlopen_self_static
  6616.           fi
  6617.           prefer_static_libs=yes
  6618.           ;;
  6619.         -static)
  6620.           if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6621.             dlopen_self=$dlopen_self_static
  6622.           fi
  6623.           prefer_static_libs=built
  6624.           ;;
  6625.         -static-libtool-libs)
  6626.           if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6627.             dlopen_self=$dlopen_self_static
  6628.           fi
  6629.           prefer_static_libs=yes
  6630.           ;;
  6631.         esac
  6632.         build_libtool_libs=no
  6633.         build_old_libs=yes
  6634.         break
  6635.         ;;
  6636.       esac
  6637.     done
  6638.  
  6639.     # See if our shared archives depend on static archives.
  6640.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6641.  
  6642.     # Go through the arguments, transforming them on the way.
  6643.     while test "$#" -gt 0; do
  6644.       arg=$1
  6645.       shift
  6646.       func_quote_for_eval "$arg"
  6647.       qarg=$func_quote_for_eval_unquoted_result
  6648.       func_append libtool_args " $func_quote_for_eval_result"
  6649.  
  6650.       # If the previous option needs an argument, assign it.
  6651.       if test -n "$prev"; then
  6652.         case $prev in
  6653.         output)
  6654.           func_append compile_command " @OUTPUT@"
  6655.           func_append finalize_command " @OUTPUT@"
  6656.           ;;
  6657.         esac
  6658.  
  6659.         case $prev in
  6660.         bindir)
  6661.           bindir=$arg
  6662.           prev=
  6663.           continue
  6664.           ;;
  6665.         dlfiles|dlprefiles)
  6666.           $preload || {
  6667.             # Add the symbol object into the linking commands.
  6668.             func_append compile_command " @SYMFILE@"
  6669.             func_append finalize_command " @SYMFILE@"
  6670.             preload=:
  6671.           }
  6672.           case $arg in
  6673.           *.la | *.lo) ;;  # We handle these cases below.
  6674.           force)
  6675.             if test no = "$dlself"; then
  6676.               dlself=needless
  6677.               export_dynamic=yes
  6678.             fi
  6679.             prev=
  6680.             continue
  6681.             ;;
  6682.           self)
  6683.             if test dlprefiles = "$prev"; then
  6684.               dlself=yes
  6685.             elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6686.               dlself=yes
  6687.             else
  6688.               dlself=needless
  6689.               export_dynamic=yes
  6690.             fi
  6691.             prev=
  6692.             continue
  6693.             ;;
  6694.           *)
  6695.             if test dlfiles = "$prev"; then
  6696.               func_append dlfiles " $arg"
  6697.             else
  6698.               func_append dlprefiles " $arg"
  6699.             fi
  6700.             prev=
  6701.             continue
  6702.             ;;
  6703.           esac
  6704.           ;;
  6705.         expsyms)
  6706.           export_symbols=$arg
  6707.           test -f "$arg" \
  6708.             || func_fatal_error "symbol file '$arg' does not exist"
  6709.           prev=
  6710.           continue
  6711.           ;;
  6712.         expsyms_regex)
  6713.           export_symbols_regex=$arg
  6714.           prev=
  6715.           continue
  6716.           ;;
  6717.         framework)
  6718.           case $host in
  6719.             *-*-darwin*)
  6720.               case "$deplibs " in
  6721.                 *" $qarg.ltframework "*) ;;
  6722.                 *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6723.                    ;;
  6724.               esac
  6725.               ;;
  6726.           esac
  6727.           prev=
  6728.           continue
  6729.           ;;
  6730.         inst_prefix)
  6731.           inst_prefix_dir=$arg
  6732.           prev=
  6733.           continue
  6734.           ;;
  6735.         mllvm)
  6736.           # Clang does not use LLVM to link, so we can simply discard any
  6737.           # '-mllvm $arg' options when doing the link step.
  6738.           prev=
  6739.           continue
  6740.           ;;
  6741.         objectlist)
  6742.           if test -f "$arg"; then
  6743.             save_arg=$arg
  6744.             moreargs=
  6745.             for fil in `cat "$save_arg"`
  6746.             do
  6747. #             func_append moreargs " $fil"
  6748.               arg=$fil
  6749.               # A libtool-controlled object.
  6750.  
  6751.               # Check to see that this really is a libtool object.
  6752.               if func_lalib_unsafe_p "$arg"; then
  6753.                 pic_object=
  6754.                 non_pic_object=
  6755.  
  6756.                 # Read the .lo file
  6757.                 func_source "$arg"
  6758.  
  6759.                 if test -z "$pic_object" ||
  6760.                    test -z "$non_pic_object" ||
  6761.                    test none = "$pic_object" &&
  6762.                    test none = "$non_pic_object"; then
  6763.                   func_fatal_error "cannot find name of object for '$arg'"
  6764.                 fi
  6765.  
  6766.                 # Extract subdirectory from the argument.
  6767.                 func_dirname "$arg" "/" ""
  6768.                 xdir=$func_dirname_result
  6769.  
  6770.                 if test none != "$pic_object"; then
  6771.                   # Prepend the subdirectory the object is found in.
  6772.                   pic_object=$xdir$pic_object
  6773.  
  6774.                   if test dlfiles = "$prev"; then
  6775.                     if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6776.                       func_append dlfiles " $pic_object"
  6777.                       prev=
  6778.                       continue
  6779.                     else
  6780.                       # If libtool objects are unsupported, then we need to preload.
  6781.                       prev=dlprefiles
  6782.                     fi
  6783.                   fi
  6784.  
  6785.                   # CHECK ME:  I think I busted this.  -Ossama
  6786.                   if test dlprefiles = "$prev"; then
  6787.                     # Preload the old-style object.
  6788.                     func_append dlprefiles " $pic_object"
  6789.                     prev=
  6790.                   fi
  6791.  
  6792.                   # A PIC object.
  6793.                   func_append libobjs " $pic_object"
  6794.                   arg=$pic_object
  6795.                 fi
  6796.  
  6797.                 # Non-PIC object.
  6798.                 if test none != "$non_pic_object"; then
  6799.                   # Prepend the subdirectory the object is found in.
  6800.                   non_pic_object=$xdir$non_pic_object
  6801.  
  6802.                   # A standard non-PIC object
  6803.                   func_append non_pic_objects " $non_pic_object"
  6804.                   if test -z "$pic_object" || test none = "$pic_object"; then
  6805.                     arg=$non_pic_object
  6806.                   fi
  6807.                 else
  6808.                   # If the PIC object exists, use it instead.
  6809.                   # $xdir was prepended to $pic_object above.
  6810.                   non_pic_object=$pic_object
  6811.                   func_append non_pic_objects " $non_pic_object"
  6812.                 fi
  6813.               else
  6814.                 # Only an error if not doing a dry-run.
  6815.                 if $opt_dry_run; then
  6816.                   # Extract subdirectory from the argument.
  6817.                   func_dirname "$arg" "/" ""
  6818.                   xdir=$func_dirname_result
  6819.  
  6820.                   func_lo2o "$arg"
  6821.                   pic_object=$xdir$objdir/$func_lo2o_result
  6822.                   non_pic_object=$xdir$func_lo2o_result
  6823.                   func_append libobjs " $pic_object"
  6824.                   func_append non_pic_objects " $non_pic_object"
  6825.                 else
  6826.                   func_fatal_error "'$arg' is not a valid libtool object"
  6827.                 fi
  6828.               fi
  6829.             done
  6830.           else
  6831.             func_fatal_error "link input file '$arg' does not exist"
  6832.           fi
  6833.           arg=$save_arg
  6834.           prev=
  6835.           continue
  6836.           ;;
  6837.         os2dllname)
  6838.           os2dllname=$arg
  6839.           prev=
  6840.           continue
  6841.           ;;
  6842.         precious_regex)
  6843.           precious_files_regex=$arg
  6844.           prev=
  6845.           continue
  6846.           ;;
  6847.         release)
  6848.           release=-$arg
  6849.           prev=
  6850.           continue
  6851.           ;;
  6852.         rpath | xrpath)
  6853.           # We need an absolute path.
  6854.           case $arg in
  6855.           [\\/]* | [A-Za-z]:[\\/]*) ;;
  6856.           *)
  6857.             func_fatal_error "only absolute run-paths are allowed"
  6858.             ;;
  6859.           esac
  6860.           if test rpath = "$prev"; then
  6861.             case "$rpath " in
  6862.             *" $arg "*) ;;
  6863.             *) func_append rpath " $arg" ;;
  6864.             esac
  6865.           else
  6866.             case "$xrpath " in
  6867.             *" $arg "*) ;;
  6868.             *) func_append xrpath " $arg" ;;
  6869.             esac
  6870.           fi
  6871.           prev=
  6872.           continue
  6873.           ;;
  6874.         shrext)
  6875.           shrext_cmds=$arg
  6876.           prev=
  6877.           continue
  6878.           ;;
  6879.         weak)
  6880.           func_append weak_libs " $arg"
  6881.           prev=
  6882.           continue
  6883.           ;;
  6884.         xcclinker)
  6885.           func_append linker_flags " $qarg"
  6886.           func_append compiler_flags " $qarg"
  6887.           prev=
  6888.           func_append compile_command " $qarg"
  6889.           func_append finalize_command " $qarg"
  6890.           continue
  6891.           ;;
  6892.         xcompiler)
  6893.           func_append compiler_flags " $qarg"
  6894.           prev=
  6895.           func_append compile_command " $qarg"
  6896.           func_append finalize_command " $qarg"
  6897.           continue
  6898.           ;;
  6899.         xlinker)
  6900.           func_append linker_flags " $qarg"
  6901.           func_append compiler_flags " $wl$qarg"
  6902.           prev=
  6903.           func_append compile_command " $wl$qarg"
  6904.           func_append finalize_command " $wl$qarg"
  6905.           continue
  6906.           ;;
  6907.         *)
  6908.           eval "$prev=\"\$arg\""
  6909.           prev=
  6910.           continue
  6911.           ;;
  6912.         esac
  6913.       fi # test -n "$prev"
  6914.  
  6915.       prevarg=$arg
  6916.  
  6917.       case $arg in
  6918.       -all-static)
  6919.         if test -n "$link_static_flag"; then
  6920.           # See comment for -static flag below, for more details.
  6921.           func_append compile_command " $link_static_flag"
  6922.           func_append finalize_command " $link_static_flag"
  6923.         fi
  6924.         continue
  6925.         ;;
  6926.  
  6927.       -allow-undefined)
  6928.         # FIXME: remove this flag sometime in the future.
  6929.         func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6930.         ;;
  6931.  
  6932.       -avoid-version)
  6933.         avoid_version=yes
  6934.         continue
  6935.         ;;
  6936.  
  6937.       -bindir)
  6938.         prev=bindir
  6939.         continue
  6940.         ;;
  6941.  
  6942.       -dlopen)
  6943.         prev=dlfiles
  6944.         continue
  6945.         ;;
  6946.  
  6947.       -dlpreopen)
  6948.         prev=dlprefiles
  6949.         continue
  6950.         ;;
  6951.  
  6952.       -export-dynamic)
  6953.         export_dynamic=yes
  6954.         continue
  6955.         ;;
  6956.  
  6957.       -export-symbols | -export-symbols-regex)
  6958.         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6959.           func_fatal_error "more than one -exported-symbols argument is not allowed"
  6960.         fi
  6961.         if test X-export-symbols = "X$arg"; then
  6962.           prev=expsyms
  6963.         else
  6964.           prev=expsyms_regex
  6965.         fi
  6966.         continue
  6967.         ;;
  6968.  
  6969.       -framework)
  6970.         prev=framework
  6971.         continue
  6972.         ;;
  6973.  
  6974.       -inst-prefix-dir)
  6975.         prev=inst_prefix
  6976.         continue
  6977.         ;;
  6978.  
  6979.       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6980.       # so, if we see these flags be careful not to treat them like -L
  6981.       -L[A-Z][A-Z]*:*)
  6982.         case $with_gcc/$host in
  6983.         no/*-*-irix* | /*-*-irix*)
  6984.           func_append compile_command " $arg"
  6985.           func_append finalize_command " $arg"
  6986.           ;;
  6987.         esac
  6988.         continue
  6989.         ;;
  6990.  
  6991.       -L*)
  6992.         func_stripname "-L" '' "$arg"
  6993.         if test -z "$func_stripname_result"; then
  6994.           if test "$#" -gt 0; then
  6995.             func_fatal_error "require no space between '-L' and '$1'"
  6996.           else
  6997.             func_fatal_error "need path for '-L' option"
  6998.           fi
  6999.         fi
  7000.         func_resolve_sysroot "$func_stripname_result"
  7001.         dir=$func_resolve_sysroot_result
  7002.         # We need an absolute path.
  7003.         case $dir in
  7004.         [\\/]* | [A-Za-z]:[\\/]*) ;;
  7005.         *)
  7006.           absdir=`cd "$dir" && pwd`
  7007.           test -z "$absdir" && \
  7008.             func_fatal_error "cannot determine absolute directory name of '$dir'"
  7009.           dir=$absdir
  7010.           ;;
  7011.         esac
  7012.         case "$deplibs " in
  7013.         *" -L$dir "* | *" $arg "*)
  7014.           # Will only happen for absolute or sysroot arguments
  7015.           ;;
  7016.         *)
  7017.           # Preserve sysroot, but never include relative directories
  7018.           case $dir in
  7019.             [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  7020.             *) func_append deplibs " -L$dir" ;;
  7021.           esac
  7022.           func_append lib_search_path " $dir"
  7023.           ;;
  7024.         esac
  7025.         case $host in
  7026.         *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  7027.           testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  7028.           case :$dllsearchpath: in
  7029.           *":$dir:"*) ;;
  7030.           ::) dllsearchpath=$dir;;
  7031.           *) func_append dllsearchpath ":$dir";;
  7032.           esac
  7033.           case :$dllsearchpath: in
  7034.           *":$testbindir:"*) ;;
  7035.           ::) dllsearchpath=$testbindir;;
  7036.           *) func_append dllsearchpath ":$testbindir";;
  7037.           esac
  7038.           ;;
  7039.         esac
  7040.         continue
  7041.         ;;
  7042.  
  7043.       -l*)
  7044.         if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  7045.           case $host in
  7046.           *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  7047.             # These systems don't actually have a C or math library (as such)
  7048.             continue
  7049.             ;;
  7050.           *-*-os2*)
  7051.             # These systems don't actually have a C library (as such)
  7052.             test X-lc = "X$arg" && continue
  7053.             ;;
  7054.           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  7055.             # Do not include libc due to us having libc/libc_r.
  7056.             test X-lc = "X$arg" && continue
  7057.             ;;
  7058.           *-*-rhapsody* | *-*-darwin1.[012])
  7059.             # Rhapsody C and math libraries are in the System framework
  7060.             func_append deplibs " System.ltframework"
  7061.             continue
  7062.             ;;
  7063.           *-*-sco3.2v5* | *-*-sco5v6*)
  7064.             # Causes problems with __ctype
  7065.             test X-lc = "X$arg" && continue
  7066.             ;;
  7067.           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  7068.             # Compiler inserts libc in the correct place for threads to work
  7069.             test X-lc = "X$arg" && continue
  7070.             ;;
  7071.           esac
  7072.         elif test X-lc_r = "X$arg"; then
  7073.          case $host in
  7074.          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  7075.            # Do not include libc_r directly, use -pthread flag.
  7076.            continue
  7077.            ;;
  7078.          esac
  7079.         fi
  7080.         func_append deplibs " $arg"
  7081.         continue
  7082.         ;;
  7083.  
  7084.       -mllvm)
  7085.         prev=mllvm
  7086.         continue
  7087.         ;;
  7088.  
  7089.       -module)
  7090.         module=yes
  7091.         continue
  7092.         ;;
  7093.  
  7094.       # Tru64 UNIX uses -model [arg] to determine the layout of C++
  7095.       # classes, name mangling, and exception handling.
  7096.       # Darwin uses the -arch flag to determine output architecture.
  7097.       -model|-arch|-isysroot|--sysroot)
  7098.         func_append compiler_flags " $arg"
  7099.         func_append compile_command " $arg"
  7100.         func_append finalize_command " $arg"
  7101.         prev=xcompiler
  7102.         continue
  7103.         ;;
  7104.  
  7105.       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7106.       |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7107.         func_append compiler_flags " $arg"
  7108.         func_append compile_command " $arg"
  7109.         func_append finalize_command " $arg"
  7110.         case "$new_inherited_linker_flags " in
  7111.             *" $arg "*) ;;
  7112.             * ) func_append new_inherited_linker_flags " $arg" ;;
  7113.         esac
  7114.         continue
  7115.         ;;
  7116.  
  7117.       -multi_module)
  7118.         single_module=$wl-multi_module
  7119.         continue
  7120.         ;;
  7121.  
  7122.       -no-fast-install)
  7123.         fast_install=no
  7124.         continue
  7125.         ;;
  7126.  
  7127.       -no-install)
  7128.         case $host in
  7129.         *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  7130.           # The PATH hackery in wrapper scripts is required on Windows
  7131.           # and Darwin in order for the loader to find any dlls it needs.
  7132.           func_warning "'-no-install' is ignored for $host"
  7133.           func_warning "assuming '-no-fast-install' instead"
  7134.           fast_install=no
  7135.           ;;
  7136.         *) no_install=yes ;;
  7137.         esac
  7138.         continue
  7139.         ;;
  7140.  
  7141.       -no-undefined)
  7142.         allow_undefined=no
  7143.         continue
  7144.         ;;
  7145.  
  7146.       -objectlist)
  7147.         prev=objectlist
  7148.         continue
  7149.         ;;
  7150.  
  7151.       -os2dllname)
  7152.         prev=os2dllname
  7153.         continue
  7154.         ;;
  7155.  
  7156.       -o) prev=output ;;
  7157.  
  7158.       -precious-files-regex)
  7159.         prev=precious_regex
  7160.         continue
  7161.         ;;
  7162.  
  7163.       -release)
  7164.         prev=release
  7165.         continue
  7166.         ;;
  7167.  
  7168.       -rpath)
  7169.         prev=rpath
  7170.         continue
  7171.         ;;
  7172.  
  7173.       -R)
  7174.         prev=xrpath
  7175.         continue
  7176.         ;;
  7177.  
  7178.       -R*)
  7179.         func_stripname '-R' '' "$arg"
  7180.         dir=$func_stripname_result
  7181.         # We need an absolute path.
  7182.         case $dir in
  7183.         [\\/]* | [A-Za-z]:[\\/]*) ;;
  7184.         =*)
  7185.           func_stripname '=' '' "$dir"
  7186.           dir=$lt_sysroot$func_stripname_result
  7187.           ;;
  7188.         *)
  7189.           func_fatal_error "only absolute run-paths are allowed"
  7190.           ;;
  7191.         esac
  7192.         case "$xrpath " in
  7193.         *" $dir "*) ;;
  7194.         *) func_append xrpath " $dir" ;;
  7195.         esac
  7196.         continue
  7197.         ;;
  7198.  
  7199.       -shared)
  7200.         # The effects of -shared are defined in a previous loop.
  7201.         continue
  7202.         ;;
  7203.  
  7204.       -shrext)
  7205.         prev=shrext
  7206.         continue
  7207.         ;;
  7208.  
  7209.       -static | -static-libtool-libs)
  7210.         # The effects of -static are defined in a previous loop.
  7211.         # We used to do the same as -all-static on platforms that
  7212.         # didn't have a PIC flag, but the assumption that the effects
  7213.         # would be equivalent was wrong.  It would break on at least
  7214.         # Digital Unix and AIX.
  7215.         continue
  7216.         ;;
  7217.  
  7218.       -thread-safe)
  7219.         thread_safe=yes
  7220.         continue
  7221.         ;;
  7222.  
  7223.       -version-info)
  7224.         prev=vinfo
  7225.         continue
  7226.         ;;
  7227.  
  7228.       -version-number)
  7229.         prev=vinfo
  7230.         vinfo_number=yes
  7231.         continue
  7232.         ;;
  7233.  
  7234.       -weak)
  7235.         prev=weak
  7236.         continue
  7237.         ;;
  7238.  
  7239.       -Wc,*)
  7240.         func_stripname '-Wc,' '' "$arg"
  7241.         args=$func_stripname_result
  7242.         arg=
  7243.         save_ifs=$IFS; IFS=,
  7244.         for flag in $args; do
  7245.           IFS=$save_ifs
  7246.           func_quote_for_eval "$flag"
  7247.           func_append arg " $func_quote_for_eval_result"
  7248.           func_append compiler_flags " $func_quote_for_eval_result"
  7249.         done
  7250.         IFS=$save_ifs
  7251.         func_stripname ' ' '' "$arg"
  7252.         arg=$func_stripname_result
  7253.         ;;
  7254.  
  7255.       -Wl,*)
  7256.         func_stripname '-Wl,' '' "$arg"
  7257.         args=$func_stripname_result
  7258.         arg=
  7259.         save_ifs=$IFS; IFS=,
  7260.         for flag in $args; do
  7261.           IFS=$save_ifs
  7262.           func_quote_for_eval "$flag"
  7263.           func_append arg " $wl$func_quote_for_eval_result"
  7264.           func_append compiler_flags " $wl$func_quote_for_eval_result"
  7265.           func_append linker_flags " $func_quote_for_eval_result"
  7266.         done
  7267.         IFS=$save_ifs
  7268.         func_stripname ' ' '' "$arg"
  7269.         arg=$func_stripname_result
  7270.         ;;
  7271.  
  7272.       -Xcompiler)
  7273.         prev=xcompiler
  7274.         continue
  7275.         ;;
  7276.  
  7277.       -Xlinker)
  7278.         prev=xlinker
  7279.         continue
  7280.         ;;
  7281.  
  7282.       -XCClinker)
  7283.         prev=xcclinker
  7284.         continue
  7285.         ;;
  7286.  
  7287.       # -msg_* for osf cc
  7288.       -msg_*)
  7289.         func_quote_for_eval "$arg"
  7290.         arg=$func_quote_for_eval_result
  7291.         ;;
  7292.  
  7293.       # Flags to be passed through unchanged, with rationale:
  7294.       # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
  7295.       # -r[0-9][0-9]*        specify processor for the SGI compiler
  7296.       # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  7297.       # +DA*, +DD*           enable 64-bit mode for the HP compiler
  7298.       # -q*                  compiler args for the IBM compiler
  7299.       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  7300.       # -F/path              path to uninstalled frameworks, gcc on darwin
  7301.       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
  7302.       # -fstack-protector*   stack protector flags for GCC
  7303.       # @file                GCC response files
  7304.       # -tp=*                Portland pgcc target processor selection
  7305.       # --sysroot=*          for sysroot support
  7306.       # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  7307.       # -stdlib=*            select c++ std lib with clang
  7308.       # -{shared,static}-libgcc, -static-{libgfortran|libstdc++}
  7309.       #                      link against specified runtime library
  7310.       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  7311.       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  7312.       -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  7313.       -ftree-parallelize-loops=*|-fcilkplus|-fgnu-tm|-ffast-math| \
  7314.       -funsafe-math-optimizations|-fvtable-verify*| \
  7315.       -shared-libgcc|-static-libgcc|-static-libgfortran|-static-libstdc++)
  7316.         func_quote_for_eval "$arg"
  7317.         arg=$func_quote_for_eval_result
  7318.         func_append compile_command " $arg"
  7319.         func_append finalize_command " $arg"
  7320.         func_append compiler_flags " $arg"
  7321.         continue
  7322.         ;;
  7323.  
  7324.       -Z*)
  7325.         if test os2 = "`expr $host : '.*\(os2\)'`"; then
  7326.           # OS/2 uses -Zxxx to specify OS/2-specific options
  7327.           compiler_flags="$compiler_flags $arg"
  7328.           func_append compile_command " $arg"
  7329.           func_append finalize_command " $arg"
  7330.           case $arg in
  7331.           -Zlinker | -Zstack)
  7332.             prev=xcompiler
  7333.             ;;
  7334.           esac
  7335.           continue
  7336.         else
  7337.           # Otherwise treat like 'Some other compiler flag' below
  7338.           func_quote_for_eval "$arg"
  7339.           arg=$func_quote_for_eval_result
  7340.         fi
  7341.         ;;
  7342.  
  7343.       # Some other compiler flag.
  7344.       -* | +*)
  7345.         func_quote_for_eval "$arg"
  7346.         arg=$func_quote_for_eval_result
  7347.         ;;
  7348.  
  7349.       *.$objext)
  7350.         # A standard object.
  7351.         func_append objs " $arg"
  7352.         ;;
  7353.  
  7354.       *.lo)
  7355.         # A libtool-controlled object.
  7356.  
  7357.         # Check to see that this really is a libtool object.
  7358.         if func_lalib_unsafe_p "$arg"; then
  7359.           pic_object=
  7360.           non_pic_object=
  7361.  
  7362.           # Read the .lo file
  7363.           func_source "$arg"
  7364.  
  7365.           if test -z "$pic_object" ||
  7366.              test -z "$non_pic_object" ||
  7367.              test none = "$pic_object" &&
  7368.              test none = "$non_pic_object"; then
  7369.             func_fatal_error "cannot find name of object for '$arg'"
  7370.           fi
  7371.  
  7372.           # Extract subdirectory from the argument.
  7373.           func_dirname "$arg" "/" ""
  7374.           xdir=$func_dirname_result
  7375.  
  7376.           test none = "$pic_object" || {
  7377.             # Prepend the subdirectory the object is found in.
  7378.             pic_object=$xdir$pic_object
  7379.  
  7380.             if test dlfiles = "$prev"; then
  7381.               if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  7382.                 func_append dlfiles " $pic_object"
  7383.                 prev=
  7384.                 continue
  7385.               else
  7386.                 # If libtool objects are unsupported, then we need to preload.
  7387.                 prev=dlprefiles
  7388.               fi
  7389.             fi
  7390.  
  7391.             # CHECK ME:  I think I busted this.  -Ossama
  7392.             if test dlprefiles = "$prev"; then
  7393.               # Preload the old-style object.
  7394.               func_append dlprefiles " $pic_object"
  7395.               prev=
  7396.             fi
  7397.  
  7398.             # A PIC object.
  7399.             func_append libobjs " $pic_object"
  7400.             arg=$pic_object
  7401.           }
  7402.  
  7403.           # Non-PIC object.
  7404.           if test none != "$non_pic_object"; then
  7405.             # Prepend the subdirectory the object is found in.
  7406.             non_pic_object=$xdir$non_pic_object
  7407.  
  7408.             # A standard non-PIC object
  7409.             func_append non_pic_objects " $non_pic_object"
  7410.             if test -z "$pic_object" || test none = "$pic_object"; then
  7411.               arg=$non_pic_object
  7412.             fi
  7413.           else
  7414.             # If the PIC object exists, use it instead.
  7415.             # $xdir was prepended to $pic_object above.
  7416.             non_pic_object=$pic_object
  7417.             func_append non_pic_objects " $non_pic_object"
  7418.           fi
  7419.         else
  7420.           # Only an error if not doing a dry-run.
  7421.           if $opt_dry_run; then
  7422.             # Extract subdirectory from the argument.
  7423.             func_dirname "$arg" "/" ""
  7424.             xdir=$func_dirname_result
  7425.  
  7426.             func_lo2o "$arg"
  7427.             pic_object=$xdir$objdir/$func_lo2o_result
  7428.             non_pic_object=$xdir$func_lo2o_result
  7429.             func_append libobjs " $pic_object"
  7430.             func_append non_pic_objects " $non_pic_object"
  7431.           else
  7432.             func_fatal_error "'$arg' is not a valid libtool object"
  7433.           fi
  7434.         fi
  7435.         ;;
  7436.  
  7437.       *.$libext)
  7438.         # An archive.
  7439.         func_append deplibs " $arg"
  7440.         func_append old_deplibs " $arg"
  7441.         continue
  7442.         ;;
  7443.  
  7444.       *.la)
  7445.         # A libtool-controlled library.
  7446.  
  7447.         func_resolve_sysroot "$arg"
  7448.         if test dlfiles = "$prev"; then
  7449.           # This library was specified with -dlopen.
  7450.           func_append dlfiles " $func_resolve_sysroot_result"
  7451.           prev=
  7452.         elif test dlprefiles = "$prev"; then
  7453.           # The library was specified with -dlpreopen.
  7454.           func_append dlprefiles " $func_resolve_sysroot_result"
  7455.           prev=
  7456.         else
  7457.           func_append deplibs " $func_resolve_sysroot_result"
  7458.         fi
  7459.         continue
  7460.         ;;
  7461.  
  7462.       # Some other compiler argument.
  7463.       *)
  7464.         # Unknown arguments in both finalize_command and compile_command need
  7465.         # to be aesthetically quoted because they are evaled later.
  7466.         func_quote_for_eval "$arg"
  7467.         arg=$func_quote_for_eval_result
  7468.         ;;
  7469.       esac # arg
  7470.  
  7471.       # Now actually substitute the argument into the commands.
  7472.       if test -n "$arg"; then
  7473.         func_append compile_command " $arg"
  7474.         func_append finalize_command " $arg"
  7475.       fi
  7476.     done # argument parsing loop
  7477.  
  7478.     test -n "$prev" && \
  7479.       func_fatal_help "the '$prevarg' option requires an argument"
  7480.  
  7481.     if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  7482.       eval arg=\"$export_dynamic_flag_spec\"
  7483.       func_append compile_command " $arg"
  7484.       func_append finalize_command " $arg"
  7485.     fi
  7486.  
  7487.     oldlibs=
  7488.     # calculate the name of the file, without its directory
  7489.     func_basename "$output"
  7490.     outputname=$func_basename_result
  7491.     libobjs_save=$libobjs
  7492.  
  7493.     if test -n "$shlibpath_var"; then
  7494.       # get the directories listed in $shlibpath_var
  7495.       eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  7496.     else
  7497.       shlib_search_path=
  7498.     fi
  7499.     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  7500.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  7501.  
  7502.     # Definition is injected by LT_CONFIG during libtool generation.
  7503.     func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  7504.  
  7505.     func_dirname "$output" "/" ""
  7506.     output_objdir=$func_dirname_result$objdir
  7507.     func_to_tool_file "$output_objdir/"
  7508.     tool_output_objdir=$func_to_tool_file_result
  7509.     # Create the object directory.
  7510.     func_mkdir_p "$output_objdir"
  7511.  
  7512.     # Determine the type of output
  7513.     case $output in
  7514.     "")
  7515.       func_fatal_help "you must specify an output file"
  7516.       ;;
  7517.     *.$libext) linkmode=oldlib ;;
  7518.     *.lo | *.$objext) linkmode=obj ;;
  7519.     *.la) linkmode=lib ;;
  7520.     *) linkmode=prog ;; # Anything else should be a program.
  7521.     esac
  7522.  
  7523.     specialdeplibs=
  7524.  
  7525.     libs=
  7526.     # Find all interdependent deplibs by searching for libraries
  7527.     # that are linked more than once (e.g. -la -lb -la)
  7528.     for deplib in $deplibs; do
  7529.       if $opt_preserve_dup_deps; then
  7530.         case "$libs " in
  7531.         *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7532.         esac
  7533.       fi
  7534.       func_append libs " $deplib"
  7535.     done
  7536.  
  7537.     if test lib = "$linkmode"; then
  7538.       libs="$predeps $libs $compiler_lib_search_path $postdeps"
  7539.  
  7540.       # Compute libraries that are listed more than once in $predeps
  7541.       # $postdeps and mark them as special (i.e., whose duplicates are
  7542.       # not to be eliminated).
  7543.       pre_post_deps=
  7544.       if $opt_duplicate_compiler_generated_deps; then
  7545.         for pre_post_dep in $predeps $postdeps; do
  7546.           case "$pre_post_deps " in
  7547.           *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  7548.           esac
  7549.           func_append pre_post_deps " $pre_post_dep"
  7550.         done
  7551.       fi
  7552.       pre_post_deps=
  7553.     fi
  7554.  
  7555.     deplibs=
  7556.     newdependency_libs=
  7557.     newlib_search_path=
  7558.     need_relink=no # whether we're linking any uninstalled libtool libraries
  7559.     notinst_deplibs= # not-installed libtool libraries
  7560.     notinst_path= # paths that contain not-installed libtool libraries
  7561.  
  7562.     case $linkmode in
  7563.     lib)
  7564.         passes="conv dlpreopen link"
  7565.         for file in $dlfiles $dlprefiles; do
  7566.           case $file in
  7567.           *.la) ;;
  7568.           *)
  7569.             func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  7570.             ;;
  7571.           esac
  7572.         done
  7573.         ;;
  7574.     prog)
  7575.         compile_deplibs=
  7576.         finalize_deplibs=
  7577.         alldeplibs=false
  7578.         newdlfiles=
  7579.         newdlprefiles=
  7580.         passes="conv scan dlopen dlpreopen link"
  7581.         ;;
  7582.     *)  passes="conv"
  7583.         ;;
  7584.     esac
  7585.  
  7586.     for pass in $passes; do
  7587.       # The preopen pass in lib mode reverses $deplibs; put it back here
  7588.       # so that -L comes before libs that need it for instance...
  7589.       if test lib,link = "$linkmode,$pass"; then
  7590.         ## FIXME: Find the place where the list is rebuilt in the wrong
  7591.         ##        order, and fix it there properly
  7592.         tmp_deplibs=
  7593.         for deplib in $deplibs; do
  7594.           tmp_deplibs="$deplib $tmp_deplibs"
  7595.         done
  7596.         deplibs=$tmp_deplibs
  7597.       fi
  7598.  
  7599.       if test lib,link = "$linkmode,$pass" ||
  7600.          test prog,scan = "$linkmode,$pass"; then
  7601.         libs=$deplibs
  7602.         deplibs=
  7603.       fi
  7604.       if test prog = "$linkmode"; then
  7605.         case $pass in
  7606.         dlopen) libs=$dlfiles ;;
  7607.         dlpreopen) libs=$dlprefiles ;;
  7608.         link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  7609.         esac
  7610.       fi
  7611.       if test lib,dlpreopen = "$linkmode,$pass"; then
  7612.         # Collect and forward deplibs of preopened libtool libs
  7613.         for lib in $dlprefiles; do
  7614.           # Ignore non-libtool-libs
  7615.           dependency_libs=
  7616.           func_resolve_sysroot "$lib"
  7617.           case $lib in
  7618.           *.la) func_source "$func_resolve_sysroot_result" ;;
  7619.           esac
  7620.  
  7621.           # Collect preopened libtool deplibs, except any this library
  7622.           # has declared as weak libs
  7623.           for deplib in $dependency_libs; do
  7624.             func_basename "$deplib"
  7625.             deplib_base=$func_basename_result
  7626.             case " $weak_libs " in
  7627.             *" $deplib_base "*) ;;
  7628.             *) func_append deplibs " $deplib" ;;
  7629.             esac
  7630.           done
  7631.         done
  7632.         libs=$dlprefiles
  7633.       fi
  7634.       if test dlopen = "$pass"; then
  7635.         # Collect dlpreopened libraries
  7636.         save_deplibs=$deplibs
  7637.         deplibs=
  7638.       fi
  7639.  
  7640.       for deplib in $libs; do
  7641.         lib=
  7642.         found=false
  7643.         case $deplib in
  7644.         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7645.         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7646.           if test prog,link = "$linkmode,$pass"; then
  7647.             compile_deplibs="$deplib $compile_deplibs"
  7648.             finalize_deplibs="$deplib $finalize_deplibs"
  7649.           else
  7650.             func_append compiler_flags " $deplib"
  7651.             if test lib = "$linkmode"; then
  7652.                 case "$new_inherited_linker_flags " in
  7653.                     *" $deplib "*) ;;
  7654.                     * ) func_append new_inherited_linker_flags " $deplib" ;;
  7655.                 esac
  7656.             fi
  7657.           fi
  7658.           continue
  7659.           ;;
  7660.         -l*)
  7661.           if test lib != "$linkmode" && test prog != "$linkmode"; then
  7662.             func_warning "'-l' is ignored for archives/objects"
  7663.             continue
  7664.           fi
  7665.           func_stripname '-l' '' "$deplib"
  7666.           name=$func_stripname_result
  7667.           if test lib = "$linkmode"; then
  7668.             searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  7669.           else
  7670.             searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  7671.           fi
  7672.           for searchdir in $searchdirs; do
  7673.             for search_ext in .la $std_shrext .so .a; do
  7674.               # Search the libtool library
  7675.               lib=$searchdir/lib$name$search_ext
  7676.               if test -f "$lib"; then
  7677.                 if test .la = "$search_ext"; then
  7678.                   found=:
  7679.                 else
  7680.                   found=false
  7681.                 fi
  7682.                 break 2
  7683.               fi
  7684.             done
  7685.           done
  7686.           if $found; then
  7687.             # deplib is a libtool library
  7688.             # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7689.             # We need to do some special things here, and not later.
  7690.             if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7691.               case " $predeps $postdeps " in
  7692.               *" $deplib "*)
  7693.                 if func_lalib_p "$lib"; then
  7694.                   library_names=
  7695.                   old_library=
  7696.                   func_source "$lib"
  7697.                   for l in $old_library $library_names; do
  7698.                     ll=$l
  7699.                   done
  7700.                   if test "X$ll" = "X$old_library"; then # only static version available
  7701.                     found=false
  7702.                     func_dirname "$lib" "" "."
  7703.                     ladir=$func_dirname_result
  7704.                     lib=$ladir/$old_library
  7705.                     if test prog,link = "$linkmode,$pass"; then
  7706.                       compile_deplibs="$deplib $compile_deplibs"
  7707.                       finalize_deplibs="$deplib $finalize_deplibs"
  7708.                     else
  7709.                       deplibs="$deplib $deplibs"
  7710.                       test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7711.                     fi
  7712.                     continue
  7713.                   fi
  7714.                 fi
  7715.                 ;;
  7716.               *) ;;
  7717.               esac
  7718.             fi
  7719.           else
  7720.             # deplib doesn't seem to be a libtool library
  7721.             if test prog,link = "$linkmode,$pass"; then
  7722.               compile_deplibs="$deplib $compile_deplibs"
  7723.               finalize_deplibs="$deplib $finalize_deplibs"
  7724.             else
  7725.               deplibs="$deplib $deplibs"
  7726.               test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7727.             fi
  7728.             continue
  7729.           fi
  7730.           ;; # -l
  7731.         *.ltframework)
  7732.           if test prog,link = "$linkmode,$pass"; then
  7733.             compile_deplibs="$deplib $compile_deplibs"
  7734.             finalize_deplibs="$deplib $finalize_deplibs"
  7735.           else
  7736.             deplibs="$deplib $deplibs"
  7737.             if test lib = "$linkmode"; then
  7738.                 case "$new_inherited_linker_flags " in
  7739.                     *" $deplib "*) ;;
  7740.                     * ) func_append new_inherited_linker_flags " $deplib" ;;
  7741.                 esac
  7742.             fi
  7743.           fi
  7744.           continue
  7745.           ;;
  7746.         -L*)
  7747.           case $linkmode in
  7748.           lib)
  7749.             deplibs="$deplib $deplibs"
  7750.             test conv = "$pass" && continue
  7751.             newdependency_libs="$deplib $newdependency_libs"
  7752.             func_stripname '-L' '' "$deplib"
  7753.             func_resolve_sysroot "$func_stripname_result"
  7754.             func_append newlib_search_path " $func_resolve_sysroot_result"
  7755.             ;;
  7756.           prog)
  7757.             if test conv = "$pass"; then
  7758.               deplibs="$deplib $deplibs"
  7759.               continue
  7760.             fi
  7761.             if test scan = "$pass"; then
  7762.               deplibs="$deplib $deplibs"
  7763.             else
  7764.               compile_deplibs="$deplib $compile_deplibs"
  7765.               finalize_deplibs="$deplib $finalize_deplibs"
  7766.             fi
  7767.             func_stripname '-L' '' "$deplib"
  7768.             func_resolve_sysroot "$func_stripname_result"
  7769.             func_append newlib_search_path " $func_resolve_sysroot_result"
  7770.             ;;
  7771.           *)
  7772.             func_warning "'-L' is ignored for archives/objects"
  7773.             ;;
  7774.           esac # linkmode
  7775.           continue
  7776.           ;; # -L
  7777.         -R*)
  7778.           if test link = "$pass"; then
  7779.             func_stripname '-R' '' "$deplib"
  7780.             func_resolve_sysroot "$func_stripname_result"
  7781.             dir=$func_resolve_sysroot_result
  7782.             # Make sure the xrpath contains only unique directories.
  7783.             case "$xrpath " in
  7784.             *" $dir "*) ;;
  7785.             *) func_append xrpath " $dir" ;;
  7786.             esac
  7787.           fi
  7788.           deplibs="$deplib $deplibs"
  7789.           continue
  7790.           ;;
  7791.         *.la)
  7792.           func_resolve_sysroot "$deplib"
  7793.           lib=$func_resolve_sysroot_result
  7794.           ;;
  7795.         *.$libext)
  7796.           if test conv = "$pass"; then
  7797.             deplibs="$deplib $deplibs"
  7798.             continue
  7799.           fi
  7800.           case $linkmode in
  7801.           lib)
  7802.             # Linking convenience modules into shared libraries is allowed,
  7803.             # but linking other static libraries is non-portable.
  7804.             case " $dlpreconveniencelibs " in
  7805.             *" $deplib "*) ;;
  7806.             *)
  7807.               valid_a_lib=false
  7808.               case $deplibs_check_method in
  7809.                 match_pattern*)
  7810.                   set dummy $deplibs_check_method; shift
  7811.                   match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7812.                   if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7813.                     | $EGREP "$match_pattern_regex" > /dev/null; then
  7814.                     valid_a_lib=:
  7815.                   fi
  7816.                 ;;
  7817.                 pass_all)
  7818.                   valid_a_lib=:
  7819.                 ;;
  7820.               esac
  7821.               if $valid_a_lib; then
  7822.                 echo
  7823.                 $ECHO "*** Warning: Linking the shared library $output against the"
  7824.                 $ECHO "*** static library $deplib is not portable!"
  7825.                 deplibs="$deplib $deplibs"
  7826.               else
  7827.                 echo
  7828.                 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7829.                 echo "*** I have the capability to make that library automatically link in when"
  7830.                 echo "*** you link to this library.  But I can only do this if you have a"
  7831.                 echo "*** shared version of the library, which you do not appear to have"
  7832.                 echo "*** because the file extensions .$libext of this argument makes me believe"
  7833.                 echo "*** that it is just a static archive that I should not use here."
  7834.               fi
  7835.               ;;
  7836.             esac
  7837.             continue
  7838.             ;;
  7839.           prog)
  7840.             if test link != "$pass"; then
  7841.               deplibs="$deplib $deplibs"
  7842.             else
  7843.               compile_deplibs="$deplib $compile_deplibs"
  7844.               finalize_deplibs="$deplib $finalize_deplibs"
  7845.             fi
  7846.             continue
  7847.             ;;
  7848.           esac # linkmode
  7849.           ;; # *.$libext
  7850.         *.lo | *.$objext)
  7851.           if test conv = "$pass"; then
  7852.             deplibs="$deplib $deplibs"
  7853.           elif test prog = "$linkmode"; then
  7854.             if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7855.               # If there is no dlopen support or we're linking statically,
  7856.               # we need to preload.
  7857.               func_append newdlprefiles " $deplib"
  7858.               compile_deplibs="$deplib $compile_deplibs"
  7859.               finalize_deplibs="$deplib $finalize_deplibs"
  7860.             else
  7861.               func_append newdlfiles " $deplib"
  7862.             fi
  7863.           fi
  7864.           continue
  7865.           ;;
  7866.         %DEPLIBS%)
  7867.           alldeplibs=:
  7868.           continue
  7869.           ;;
  7870.         esac # case $deplib
  7871.  
  7872.         $found || test -f "$lib" \
  7873.           || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7874.  
  7875.         # Check to see that this really is a libtool archive.
  7876.         func_lalib_unsafe_p "$lib" \
  7877.           || func_fatal_error "'$lib' is not a valid libtool archive"
  7878.  
  7879.         func_dirname "$lib" "" "."
  7880.         ladir=$func_dirname_result
  7881.  
  7882.         dlname=
  7883.         dlopen=
  7884.         dlpreopen=
  7885.         libdir=
  7886.         library_names=
  7887.         old_library=
  7888.         inherited_linker_flags=
  7889.         # If the library was installed with an old release of libtool,
  7890.         # it will not redefine variables installed, or shouldnotlink
  7891.         installed=yes
  7892.         shouldnotlink=no
  7893.         avoidtemprpath=
  7894.  
  7895.  
  7896.         # Read the .la file
  7897.         func_source "$lib"
  7898.  
  7899.         # Convert "-framework foo" to "foo.ltframework"
  7900.         if test -n "$inherited_linker_flags"; then
  7901.           tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7902.           for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7903.             case " $new_inherited_linker_flags " in
  7904.               *" $tmp_inherited_linker_flag "*) ;;
  7905.               *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7906.             esac
  7907.           done
  7908.         fi
  7909.         dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7910.         if test lib,link = "$linkmode,$pass" ||
  7911.            test prog,scan = "$linkmode,$pass" ||
  7912.            { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7913.           test -n "$dlopen" && func_append dlfiles " $dlopen"
  7914.           test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7915.         fi
  7916.  
  7917.         if test conv = "$pass"; then
  7918.           # Only check for convenience libraries
  7919.           deplibs="$lib $deplibs"
  7920.           if test -z "$libdir"; then
  7921.             if test -z "$old_library"; then
  7922.               func_fatal_error "cannot find name of link library for '$lib'"
  7923.             fi
  7924.             # It is a libtool convenience library, so add in its objects.
  7925.             func_append convenience " $ladir/$objdir/$old_library"
  7926.             func_append old_convenience " $ladir/$objdir/$old_library"
  7927.           elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7928.             func_fatal_error "'$lib' is not a convenience library"
  7929.           fi
  7930.           tmp_libs=
  7931.           for deplib in $dependency_libs; do
  7932.             deplibs="$deplib $deplibs"
  7933.             if $opt_preserve_dup_deps; then
  7934.               case "$tmp_libs " in
  7935.               *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7936.               esac
  7937.             fi
  7938.             func_append tmp_libs " $deplib"
  7939.           done
  7940.           continue
  7941.         fi # $pass = conv
  7942.  
  7943.  
  7944.         # Get the name of the library we link against.
  7945.         linklib=
  7946.         if test -n "$old_library" &&
  7947.            { test yes = "$prefer_static_libs" ||
  7948.              test built,no = "$prefer_static_libs,$installed"; }; then
  7949.           linklib=$old_library
  7950.         else
  7951.           for l in $old_library $library_names; do
  7952.             linklib=$l
  7953.           done
  7954.         fi
  7955.         if test -z "$linklib"; then
  7956.           func_fatal_error "cannot find name of link library for '$lib'"
  7957.         fi
  7958.  
  7959.         # This library was specified with -dlopen.
  7960.         if test dlopen = "$pass"; then
  7961.           test -z "$libdir" \
  7962.             && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7963.           if test -z "$dlname" ||
  7964.              test yes != "$dlopen_support" ||
  7965.              test no = "$build_libtool_libs"
  7966.           then
  7967.             # If there is no dlname, no dlopen support or we're linking
  7968.             # statically, we need to preload.  We also need to preload any
  7969.             # dependent libraries so libltdl's deplib preloader doesn't
  7970.             # bomb out in the load deplibs phase.
  7971.             func_append dlprefiles " $lib $dependency_libs"
  7972.           else
  7973.             func_append newdlfiles " $lib"
  7974.           fi
  7975.           continue
  7976.         fi # $pass = dlopen
  7977.  
  7978.         # We need an absolute path.
  7979.         case $ladir in
  7980.         [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7981.         *)
  7982.           abs_ladir=`cd "$ladir" && pwd`
  7983.           if test -z "$abs_ladir"; then
  7984.             func_warning "cannot determine absolute directory name of '$ladir'"
  7985.             func_warning "passing it literally to the linker, although it might fail"
  7986.             abs_ladir=$ladir
  7987.           fi
  7988.           ;;
  7989.         esac
  7990.         func_basename "$lib"
  7991.         laname=$func_basename_result
  7992.  
  7993.         # Find the relevant object directory and library name.
  7994.         if test yes = "$installed"; then
  7995.           if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7996.             func_warning "library '$lib' was moved."
  7997.             dir=$ladir
  7998.             absdir=$abs_ladir
  7999.             libdir=$abs_ladir
  8000.           else
  8001.             dir=$lt_sysroot$libdir
  8002.             absdir=$lt_sysroot$libdir
  8003.           fi
  8004.           test yes = "$hardcode_automatic" && avoidtemprpath=yes
  8005.         else
  8006.           if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  8007.             dir=$ladir
  8008.             absdir=$abs_ladir
  8009.             # Remove this search path later
  8010.             func_append notinst_path " $abs_ladir"
  8011.           else
  8012.             dir=$ladir/$objdir
  8013.             absdir=$abs_ladir/$objdir
  8014.             # Remove this search path later
  8015.             func_append notinst_path " $abs_ladir"
  8016.           fi
  8017.         fi # $installed = yes
  8018.         func_stripname 'lib' '.la' "$laname"
  8019.         name=$func_stripname_result
  8020.  
  8021.         # This library was specified with -dlpreopen.
  8022.         if test dlpreopen = "$pass"; then
  8023.           if test -z "$libdir" && test prog = "$linkmode"; then
  8024.             func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  8025.           fi
  8026.           case $host in
  8027.             # special handling for platforms with PE-DLLs.
  8028.             *cygwin* | *msys* | *mingw* | *cegcc* )
  8029.               # Linker will automatically link against shared library if both
  8030.               # static and shared are present.  Therefore, ensure we extract
  8031.               # symbols from the import library if a shared library is present
  8032.               # (otherwise, the dlopen module name will be incorrect).  We do
  8033.               # this by putting the import library name into $newdlprefiles.
  8034.               # We recover the dlopen module name by 'saving' the la file
  8035.               # name in a special purpose variable, and (later) extracting the
  8036.               # dlname from the la file.
  8037.               if test -n "$dlname"; then
  8038.                 func_tr_sh "$dir/$linklib"
  8039.                 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  8040.                 func_append newdlprefiles " $dir/$linklib"
  8041.               else
  8042.                 func_append newdlprefiles " $dir/$old_library"
  8043.                 # Keep a list of preopened convenience libraries to check
  8044.                 # that they are being used correctly in the link pass.
  8045.                 test -z "$libdir" && \
  8046.                   func_append dlpreconveniencelibs " $dir/$old_library"
  8047.               fi
  8048.             ;;
  8049.             * )
  8050.               # Prefer using a static library (so that no silly _DYNAMIC symbols
  8051.               # are required to link).
  8052.               if test -n "$old_library"; then
  8053.                 func_append newdlprefiles " $dir/$old_library"
  8054.                 # Keep a list of preopened convenience libraries to check
  8055.                 # that they are being used correctly in the link pass.
  8056.                 test -z "$libdir" && \
  8057.                   func_append dlpreconveniencelibs " $dir/$old_library"
  8058.               # Otherwise, use the dlname, so that lt_dlopen finds it.
  8059.               elif test -n "$dlname"; then
  8060.                 func_append newdlprefiles " $dir/$dlname"
  8061.               else
  8062.                 func_append newdlprefiles " $dir/$linklib"
  8063.               fi
  8064.             ;;
  8065.           esac
  8066.         fi # $pass = dlpreopen
  8067.  
  8068.         if test -z "$libdir"; then
  8069.           # Link the convenience library
  8070.           if test lib = "$linkmode"; then
  8071.             deplibs="$dir/$old_library $deplibs"
  8072.           elif test prog,link = "$linkmode,$pass"; then
  8073.             compile_deplibs="$dir/$old_library $compile_deplibs"
  8074.             finalize_deplibs="$dir/$old_library $finalize_deplibs"
  8075.           else
  8076.             deplibs="$lib $deplibs" # used for prog,scan pass
  8077.           fi
  8078.           continue
  8079.         fi
  8080.  
  8081.  
  8082.         if test prog = "$linkmode" && test link != "$pass"; then
  8083.           func_append newlib_search_path " $ladir"
  8084.           deplibs="$lib $deplibs"
  8085.  
  8086.           linkalldeplibs=false
  8087.           if test no != "$link_all_deplibs" || test -z "$library_names" ||
  8088.              test no = "$build_libtool_libs"; then
  8089.             linkalldeplibs=:
  8090.           fi
  8091.  
  8092.           tmp_libs=
  8093.           for deplib in $dependency_libs; do
  8094.             case $deplib in
  8095.             -L*) func_stripname '-L' '' "$deplib"
  8096.                  func_resolve_sysroot "$func_stripname_result"
  8097.                  func_append newlib_search_path " $func_resolve_sysroot_result"
  8098.                  ;;
  8099.             esac
  8100.             # Need to link against all dependency_libs?
  8101.             if $linkalldeplibs; then
  8102.               deplibs="$deplib $deplibs"
  8103.             else
  8104.               # Need to hardcode shared library paths
  8105.               # or/and link against static libraries
  8106.               newdependency_libs="$deplib $newdependency_libs"
  8107.             fi
  8108.             if $opt_preserve_dup_deps; then
  8109.               case "$tmp_libs " in
  8110.               *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  8111.               esac
  8112.             fi
  8113.             func_append tmp_libs " $deplib"
  8114.           done # for deplib
  8115.           continue
  8116.         fi # $linkmode = prog...
  8117.  
  8118.         if test prog,link = "$linkmode,$pass"; then
  8119.           if test -n "$library_names" &&
  8120.              { { test no = "$prefer_static_libs" ||
  8121.                  test built,yes = "$prefer_static_libs,$installed"; } ||
  8122.                test -z "$old_library"; }; then
  8123.             # We need to hardcode the library path
  8124.             if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  8125.               # Make sure the rpath contains only unique directories.
  8126.               case $temp_rpath: in
  8127.               *"$absdir:"*) ;;
  8128.               *) func_append temp_rpath "$absdir:" ;;
  8129.               esac
  8130.             fi
  8131.  
  8132.             # Hardcode the library path.
  8133.             # Skip directories that are in the system default run-time
  8134.             # search path.
  8135.             case " $sys_lib_dlsearch_path " in
  8136.             *" $absdir "*) ;;
  8137.             *)
  8138.               case "$compile_rpath " in
  8139.               *" $absdir "*) ;;
  8140.               *) func_append compile_rpath " $absdir" ;;
  8141.               esac
  8142.               ;;
  8143.             esac
  8144.             case " $sys_lib_dlsearch_path " in
  8145.             *" $libdir "*) ;;
  8146.             *)
  8147.               case "$finalize_rpath " in
  8148.               *" $libdir "*) ;;
  8149.               *) func_append finalize_rpath " $libdir" ;;
  8150.               esac
  8151.               ;;
  8152.             esac
  8153.           fi # $linkmode,$pass = prog,link...
  8154.  
  8155.           if $alldeplibs &&
  8156.              { test pass_all = "$deplibs_check_method" ||
  8157.                { test yes = "$build_libtool_libs" &&
  8158.                  test -n "$library_names"; }; }; then
  8159.             # We only need to search for static libraries
  8160.             continue
  8161.           fi
  8162.         fi
  8163.  
  8164.         link_static=no # Whether the deplib will be linked statically
  8165.         use_static_libs=$prefer_static_libs
  8166.         if test built = "$use_static_libs" && test yes = "$installed"; then
  8167.           use_static_libs=no
  8168.         fi
  8169.         if test -n "$library_names" &&
  8170.            { test no = "$use_static_libs" || test -z "$old_library"; }; then
  8171.           case $host in
  8172.           *cygwin* | *msys* | *mingw* | *cegcc* | *os2*)
  8173.               # No point in relinking DLLs because paths are not encoded
  8174.               func_append notinst_deplibs " $lib"
  8175.               need_relink=no
  8176.             ;;
  8177.           *)
  8178.             if test no = "$installed"; then
  8179.               func_append notinst_deplibs " $lib"
  8180.               need_relink=yes
  8181.             fi
  8182.             ;;
  8183.           esac
  8184.           # This is a shared library
  8185.  
  8186.           # Warn about portability, can't link against -module's on some
  8187.           # systems (darwin).  Don't bleat about dlopened modules though!
  8188.           dlopenmodule=
  8189.           for dlpremoduletest in $dlprefiles; do
  8190.             if test "X$dlpremoduletest" = "X$lib"; then
  8191.               dlopenmodule=$dlpremoduletest
  8192.               break
  8193.             fi
  8194.           done
  8195.           if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  8196.             echo
  8197.             if test prog = "$linkmode"; then
  8198.               $ECHO "*** Warning: Linking the executable $output against the loadable module"
  8199.             else
  8200.               $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  8201.             fi
  8202.             $ECHO "*** $linklib is not portable!"
  8203.           fi
  8204.           if test lib = "$linkmode" &&
  8205.              test yes = "$hardcode_into_libs"; then
  8206.             # Hardcode the library path.
  8207.             # Skip directories that are in the system default run-time
  8208.             # search path.
  8209.             case " $sys_lib_dlsearch_path " in
  8210.             *" $absdir "*) ;;
  8211.             *)
  8212.               case "$compile_rpath " in
  8213.               *" $absdir "*) ;;
  8214.               *) func_append compile_rpath " $absdir" ;;
  8215.               esac
  8216.               ;;
  8217.             esac
  8218.             case " $sys_lib_dlsearch_path " in
  8219.             *" $libdir "*) ;;
  8220.             *)
  8221.               case "$finalize_rpath " in
  8222.               *" $libdir "*) ;;
  8223.               *) func_append finalize_rpath " $libdir" ;;
  8224.               esac
  8225.               ;;
  8226.             esac
  8227.           fi
  8228.  
  8229.           if test -n "$old_archive_from_expsyms_cmds"; then
  8230.             # figure out the soname
  8231.             set dummy $library_names
  8232.             shift
  8233.             realname=$1
  8234.             shift
  8235.             libname=`eval "\\$ECHO \"$libname_spec\""`
  8236.             # use dlname if we got it. it's perfectly good, no?
  8237.             if test -n "$dlname"; then
  8238.               soname=$dlname
  8239.             elif test -n "$soname_spec"; then
  8240.               # bleh windows
  8241.               case $host in
  8242.               *cygwin* | *msys* | mingw* | *cegcc* | *os2*)
  8243.                 func_arith $current - $age
  8244.                 major=$func_arith_result
  8245.                 versuffix=-$major
  8246.                 ;;
  8247.               esac
  8248.               eval soname=\"$soname_spec\"
  8249.             else
  8250.               soname=$realname
  8251.             fi
  8252.  
  8253.             # Make a new name for the extract_expsyms_cmds to use
  8254.             soroot=$soname
  8255.             func_basename "$soroot"
  8256.             soname=$func_basename_result
  8257.             func_stripname 'lib' '.dll' "$soname"
  8258.             newlib=libimp-$func_stripname_result.a
  8259.  
  8260.             # If the library has no export list, then create one now
  8261.             if test -f "$output_objdir/$soname-def"; then :
  8262.             else
  8263.               func_verbose "extracting exported symbol list from '$soname'"
  8264.               func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  8265.             fi
  8266.  
  8267.             # Create $newlib
  8268.             if test -f "$output_objdir/$newlib"; then :; else
  8269.               func_verbose "generating import library for '$soname'"
  8270.               func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  8271.             fi
  8272.             # make sure the library variables are pointing to the new library
  8273.             dir=$output_objdir
  8274.             linklib=$newlib
  8275.           fi # test -n "$old_archive_from_expsyms_cmds"
  8276.  
  8277.           if test prog = "$linkmode" || test relink != "$opt_mode"; then
  8278.             add_shlibpath=
  8279.             add_dir=
  8280.             add=
  8281.             lib_linked=yes
  8282.             case $hardcode_action in
  8283.             immediate | unsupported)
  8284.               if test no = "$hardcode_direct"; then
  8285.                 add=$dir/$linklib
  8286.                 case $host in
  8287.                   *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  8288.                   *-*-sysv4*uw2*) add_dir=-L$dir ;;
  8289.                   *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  8290.                     *-*-unixware7*) add_dir=-L$dir ;;
  8291.                   *-*-darwin* )
  8292.                     # if the lib is a (non-dlopened) module then we cannot
  8293.                     # link against it, someone is ignoring the earlier warnings
  8294.                     if /usr/bin/file -L $add 2> /dev/null |
  8295.                          $GREP ": [^:]* bundle" >/dev/null; then
  8296.                       if test "X$dlopenmodule" != "X$lib"; then
  8297.                         $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  8298.                         if test -z "$old_library"; then
  8299.                           echo
  8300.                           echo "*** And there doesn't seem to be a static archive available"
  8301.                           echo "*** The link will probably fail, sorry"
  8302.                         else
  8303.                           add=$dir/$old_library
  8304.                         fi
  8305.                       elif test -n "$old_library"; then
  8306.                         add=$dir/$old_library
  8307.                       fi
  8308.                     fi
  8309.                 esac
  8310.               elif test no = "$hardcode_minus_L"; then
  8311.                 case $host in
  8312.                 *-*-sunos*) add_shlibpath=$dir ;;
  8313.                 esac
  8314.                 add_dir=-L$dir
  8315.                 add=-l$name
  8316.               elif test no = "$hardcode_shlibpath_var"; then
  8317.                 add_shlibpath=$dir
  8318.                 add=-l$name
  8319.               else
  8320.                 lib_linked=no
  8321.               fi
  8322.               ;;
  8323.             relink)
  8324.               if test yes = "$hardcode_direct" &&
  8325.                  test no = "$hardcode_direct_absolute"; then
  8326.                 add=$dir/$linklib
  8327.               elif test yes = "$hardcode_minus_L"; then
  8328.                 add_dir=-L$absdir
  8329.                 # Try looking first in the location we're being installed to.
  8330.                 if test -n "$inst_prefix_dir"; then
  8331.                   case $libdir in
  8332.                     [\\/]*)
  8333.                       func_append add_dir " -L$inst_prefix_dir$libdir"
  8334.                       ;;
  8335.                   esac
  8336.                 fi
  8337.                 add=-l$name
  8338.               elif test yes = "$hardcode_shlibpath_var"; then
  8339.                 add_shlibpath=$dir
  8340.                 add=-l$name
  8341.               else
  8342.                 lib_linked=no
  8343.               fi
  8344.               ;;
  8345.             *) lib_linked=no ;;
  8346.             esac
  8347.  
  8348.             if test yes != "$lib_linked"; then
  8349.               func_fatal_configuration "unsupported hardcode properties"
  8350.             fi
  8351.  
  8352.             if test -n "$add_shlibpath"; then
  8353.               case :$compile_shlibpath: in
  8354.               *":$add_shlibpath:"*) ;;
  8355.               *) func_append compile_shlibpath "$add_shlibpath:" ;;
  8356.               esac
  8357.             fi
  8358.             if test prog = "$linkmode"; then
  8359.               test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  8360.               test -n "$add" && compile_deplibs="$add $compile_deplibs"
  8361.             else
  8362.               test -n "$add_dir" && deplibs="$add_dir $deplibs"
  8363.               test -n "$add" && deplibs="$add $deplibs"
  8364.               if test yes != "$hardcode_direct" &&
  8365.                  test yes != "$hardcode_minus_L" &&
  8366.                  test yes = "$hardcode_shlibpath_var"; then
  8367.                 case :$finalize_shlibpath: in
  8368.                 *":$libdir:"*) ;;
  8369.                 *) func_append finalize_shlibpath "$libdir:" ;;
  8370.                 esac
  8371.               fi
  8372.             fi
  8373.           fi
  8374.  
  8375.           if test prog = "$linkmode" || test relink = "$opt_mode"; then
  8376.             add_shlibpath=
  8377.             add_dir=
  8378.             add=
  8379.             # Finalize command for both is simple: just hardcode it.
  8380.             if test yes = "$hardcode_direct" &&
  8381.                test no = "$hardcode_direct_absolute"; then
  8382.               add=$libdir/$linklib
  8383.             elif test yes = "$hardcode_minus_L"; then
  8384.               add_dir=-L$libdir
  8385.               add=-l$name
  8386.             elif test yes = "$hardcode_shlibpath_var"; then
  8387.               case :$finalize_shlibpath: in
  8388.               *":$libdir:"*) ;;
  8389.               *) func_append finalize_shlibpath "$libdir:" ;;
  8390.               esac
  8391.               add=-l$name
  8392.             elif test yes = "$hardcode_automatic"; then
  8393.               if test -n "$inst_prefix_dir" &&
  8394.                  test -f "$inst_prefix_dir$libdir/$linklib"; then
  8395.                 add=$inst_prefix_dir$libdir/$linklib
  8396.               else
  8397.                 add=$libdir/$linklib
  8398.               fi
  8399.             else
  8400.               # We cannot seem to hardcode it, guess we'll fake it.
  8401.               add_dir=-L$libdir
  8402.               # Try looking first in the location we're being installed to.
  8403.               if test -n "$inst_prefix_dir"; then
  8404.                 case $libdir in
  8405.                   [\\/]*)
  8406.                     func_append add_dir " -L$inst_prefix_dir$libdir"
  8407.                     ;;
  8408.                 esac
  8409.               fi
  8410.               add=-l$name
  8411.             fi
  8412.  
  8413.             if test prog = "$linkmode"; then
  8414.               test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  8415.               test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  8416.             else
  8417.               test -n "$add_dir" && deplibs="$add_dir $deplibs"
  8418.               test -n "$add" && deplibs="$add $deplibs"
  8419.             fi
  8420.           fi
  8421.         elif test prog = "$linkmode"; then
  8422.           # Here we assume that one of hardcode_direct or hardcode_minus_L
  8423.           # is not unsupported.  This is valid on all known static and
  8424.           # shared platforms.
  8425.           if test unsupported != "$hardcode_direct"; then
  8426.             test -n "$old_library" && linklib=$old_library
  8427.             compile_deplibs="$dir/$linklib $compile_deplibs"
  8428.             finalize_deplibs="$dir/$linklib $finalize_deplibs"
  8429.           else
  8430.             compile_deplibs="-l$name -L$dir $compile_deplibs"
  8431.             finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  8432.           fi
  8433.         elif test yes = "$build_libtool_libs"; then
  8434.           # Not a shared library
  8435.           if test pass_all != "$deplibs_check_method"; then
  8436.             # We're trying link a shared library against a static one
  8437.             # but the system doesn't support it.
  8438.  
  8439.             # Just print a warning and add the library to dependency_libs so
  8440.             # that the program can be linked against the static library.
  8441.             echo
  8442.             $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  8443.             echo "*** I have the capability to make that library automatically link in when"
  8444.             echo "*** you link to this library.  But I can only do this if you have a"
  8445.             echo "*** shared version of the library, which you do not appear to have."
  8446.             if test yes = "$module"; then
  8447.               echo "*** But as you try to build a module library, libtool will still create "
  8448.               echo "*** a static module, that should work as long as the dlopening application"
  8449.               echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  8450.               if test -z "$global_symbol_pipe"; then
  8451.                 echo
  8452.                 echo "*** However, this would only work if libtool was able to extract symbol"
  8453.                 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8454.                 echo "*** not find such a program.  So, this module is probably useless."
  8455.                 echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8456.               fi
  8457.               if test no = "$build_old_libs"; then
  8458.                 build_libtool_libs=module
  8459.                 build_old_libs=yes
  8460.               else
  8461.                 build_libtool_libs=no
  8462.               fi
  8463.             fi
  8464.           else
  8465.             deplibs="$dir/$old_library $deplibs"
  8466.             link_static=yes
  8467.           fi
  8468.         fi # link shared/static library?
  8469.  
  8470.         if test lib = "$linkmode"; then
  8471.           if test -n "$dependency_libs" &&
  8472.              { test yes != "$hardcode_into_libs" ||
  8473.                test yes = "$build_old_libs" ||
  8474.                test yes = "$link_static"; }; then
  8475.             # Extract -R from dependency_libs
  8476.             temp_deplibs=
  8477.             for libdir in $dependency_libs; do
  8478.               case $libdir in
  8479.               -R*) func_stripname '-R' '' "$libdir"
  8480.                    temp_xrpath=$func_stripname_result
  8481.                    case " $xrpath " in
  8482.                    *" $temp_xrpath "*) ;;
  8483.                    *) func_append xrpath " $temp_xrpath";;
  8484.                    esac;;
  8485.               *) func_append temp_deplibs " $libdir";;
  8486.               esac
  8487.             done
  8488.             dependency_libs=$temp_deplibs
  8489.           fi
  8490.  
  8491.           func_append newlib_search_path " $absdir"
  8492.           # Link against this library
  8493.           test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  8494.           # ... and its dependency_libs
  8495.           tmp_libs=
  8496.           for deplib in $dependency_libs; do
  8497.             newdependency_libs="$deplib $newdependency_libs"
  8498.             case $deplib in
  8499.               -L*) func_stripname '-L' '' "$deplib"
  8500.                    func_resolve_sysroot "$func_stripname_result";;
  8501.               *) func_resolve_sysroot "$deplib" ;;
  8502.             esac
  8503.             if $opt_preserve_dup_deps; then
  8504.               case "$tmp_libs " in
  8505.               *" $func_resolve_sysroot_result "*)
  8506.                 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  8507.               esac
  8508.             fi
  8509.             func_append tmp_libs " $func_resolve_sysroot_result"
  8510.           done
  8511.  
  8512.           if test no != "$link_all_deplibs"; then
  8513.             # Add the search paths of all dependency libraries
  8514.             for deplib in $dependency_libs; do
  8515.               path=
  8516.               case $deplib in
  8517.               -L*) path=$deplib ;;
  8518.               *.la)
  8519.                 func_resolve_sysroot "$deplib"
  8520.                 deplib=$func_resolve_sysroot_result
  8521.                 func_dirname "$deplib" "" "."
  8522.                 dir=$func_dirname_result
  8523.                 # We need an absolute path.
  8524.                 case $dir in
  8525.                 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  8526.                 *)
  8527.                   absdir=`cd "$dir" && pwd`
  8528.                   if test -z "$absdir"; then
  8529.                     func_warning "cannot determine absolute directory name of '$dir'"
  8530.                     absdir=$dir
  8531.                   fi
  8532.                   ;;
  8533.                 esac
  8534.                 if $GREP "^installed=no" $deplib > /dev/null; then
  8535.                 case $host in
  8536.                 *-*-darwin*)
  8537.                   depdepl=
  8538.                   eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  8539.                   if test -n "$deplibrary_names"; then
  8540.                     for tmp in $deplibrary_names; do
  8541.                       depdepl=$tmp
  8542.                     done
  8543.                     if test -f "$absdir/$objdir/$depdepl"; then
  8544.                       depdepl=$absdir/$objdir/$depdepl
  8545.                       darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  8546.                       if test -z "$darwin_install_name"; then
  8547.                           darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
  8548.                       fi
  8549.                       func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  8550.                       func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  8551.                       path=
  8552.                     fi
  8553.                   fi
  8554.                   ;;
  8555.                 *)
  8556.                   path=-L$absdir/$objdir
  8557.                   ;;
  8558.                 esac
  8559.                 else
  8560.                   eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  8561.                   test -z "$libdir" && \
  8562.                     func_fatal_error "'$deplib' is not a valid libtool archive"
  8563.                   abs_inode=`ls -i "$deplib" | awk '{print $1}'`
  8564.                     lib_inode=`ls -i "$libdir/$(basename $deplib)" | awk '{print $1}'`
  8565.                   test "$abs_inode" != "$lib_inode" && \
  8566.                     func_warning "'$deplib' seems to be moved"
  8567.  
  8568.                   path=-L$absdir
  8569.                 fi
  8570.                 ;;
  8571.               esac
  8572.               case " $deplibs " in
  8573.               *" $path "*) ;;
  8574.               *) deplibs="$path $deplibs" ;;
  8575.               esac
  8576.             done
  8577.           fi # link_all_deplibs != no
  8578.         fi # linkmode = lib
  8579.       done # for deplib in $libs
  8580.       if test link = "$pass"; then
  8581.         if test prog = "$linkmode"; then
  8582.           compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  8583.           finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  8584.         else
  8585.           compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8586.         fi
  8587.       fi
  8588.       dependency_libs=$newdependency_libs
  8589.       if test dlpreopen = "$pass"; then
  8590.         # Link the dlpreopened libraries before other libraries
  8591.         for deplib in $save_deplibs; do
  8592.           deplibs="$deplib $deplibs"
  8593.         done
  8594.       fi
  8595.       if test dlopen != "$pass"; then
  8596.         test conv = "$pass" || {
  8597.           # Make sure lib_search_path contains only unique directories.
  8598.           lib_search_path=
  8599.           for dir in $newlib_search_path; do
  8600.             case "$lib_search_path " in
  8601.             *" $dir "*) ;;
  8602.             *) func_append lib_search_path " $dir" ;;
  8603.             esac
  8604.           done
  8605.           newlib_search_path=
  8606.         }
  8607.  
  8608.         if test prog,link = "$linkmode,$pass"; then
  8609.           vars="compile_deplibs finalize_deplibs"
  8610.         else
  8611.           vars=deplibs
  8612.         fi
  8613.         for var in $vars dependency_libs; do
  8614.           # Add libraries to $var in reverse order
  8615.           eval tmp_libs=\"\$$var\"
  8616.           new_libs=
  8617.           for deplib in $tmp_libs; do
  8618.             # FIXME: Pedantically, this is the right thing to do, so
  8619.             #        that some nasty dependency loop isn't accidentally
  8620.             #        broken:
  8621.             #new_libs="$deplib $new_libs"
  8622.             # Pragmatically, this seems to cause very few problems in
  8623.             # practice:
  8624.             case $deplib in
  8625.             -L*) new_libs="$deplib $new_libs" ;;
  8626.             -R*) ;;
  8627.             *)
  8628.               # And here is the reason: when a library appears more
  8629.               # than once as an explicit dependence of a library, or
  8630.               # is implicitly linked in more than once by the
  8631.               # compiler, it is considered special, and multiple
  8632.               # occurrences thereof are not removed.  Compare this
  8633.               # with having the same library being listed as a
  8634.               # dependency of multiple other libraries: in this case,
  8635.               # we know (pedantically, we assume) the library does not
  8636.               # need to be listed more than once, so we keep only the
  8637.               # last copy.  This is not always right, but it is rare
  8638.               # enough that we require users that really mean to play
  8639.               # such unportable linking tricks to link the library
  8640.               # using -Wl,-lname, so that libtool does not consider it
  8641.               # for duplicate removal.
  8642.               case " $specialdeplibs " in
  8643.               *" $deplib "*) new_libs="$deplib $new_libs" ;;
  8644.               *)
  8645.                 case " $new_libs " in
  8646.                 *" $deplib "*) ;;
  8647.                 *) new_libs="$deplib $new_libs" ;;
  8648.                 esac
  8649.                 ;;
  8650.               esac
  8651.               ;;
  8652.             esac
  8653.           done
  8654.           tmp_libs=
  8655.           for deplib in $new_libs; do
  8656.             case $deplib in
  8657.             -L*)
  8658.               case " $tmp_libs " in
  8659.               *" $deplib "*) ;;
  8660.               *) func_append tmp_libs " $deplib" ;;
  8661.               esac
  8662.               ;;
  8663.             *) func_append tmp_libs " $deplib" ;;
  8664.             esac
  8665.           done
  8666.           eval $var=\"$tmp_libs\"
  8667.         done # for var
  8668.       fi
  8669.  
  8670.       # Add Sun CC postdeps if required:
  8671.       test CXX = "$tagname" && {
  8672.         case $host_os in
  8673.         linux*)
  8674.           case `$CC -V 2>&1 | sed 5q` in
  8675.           *Sun\ C*) # Sun C++ 5.9
  8676.             func_suncc_cstd_abi
  8677.  
  8678.             if test no != "$suncc_use_cstd_abi"; then
  8679.               func_append postdeps ' -library=Cstd -library=Crun'
  8680.             fi
  8681.             ;;
  8682.           esac
  8683.           ;;
  8684.  
  8685.         solaris*)
  8686.           func_cc_basename "$CC"
  8687.           case $func_cc_basename_result in
  8688.           CC* | sunCC*)
  8689.             func_suncc_cstd_abi
  8690.  
  8691.             if test no != "$suncc_use_cstd_abi"; then
  8692.               func_append postdeps ' -library=Cstd -library=Crun'
  8693.             fi
  8694.             ;;
  8695.           esac
  8696.           ;;
  8697.         esac
  8698.       }
  8699.  
  8700.       # Last step: remove runtime libs from dependency_libs
  8701.       # (they stay in deplibs)
  8702.       tmp_libs=
  8703.       for i in $dependency_libs; do
  8704.         case " $predeps $postdeps $compiler_lib_search_path " in
  8705.         *" $i "*)
  8706.           i=
  8707.           ;;
  8708.         esac
  8709.         if test -n "$i"; then
  8710.           func_append tmp_libs " $i"
  8711.         fi
  8712.       done
  8713.       dependency_libs=$tmp_libs
  8714.     done # for pass
  8715.     if test prog = "$linkmode"; then
  8716.       dlfiles=$newdlfiles
  8717.     fi
  8718.     if test prog = "$linkmode" || test lib = "$linkmode"; then
  8719.       dlprefiles=$newdlprefiles
  8720.     fi
  8721.  
  8722.     case $linkmode in
  8723.     oldlib)
  8724.       if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8725.         func_warning "'-dlopen' is ignored for archives"
  8726.       fi
  8727.  
  8728.       case " $deplibs" in
  8729.       *\ -l* | *\ -L*)
  8730.         func_warning "'-l' and '-L' are ignored for archives" ;;
  8731.       esac
  8732.  
  8733.       test -n "$rpath" && \
  8734.         func_warning "'-rpath' is ignored for archives"
  8735.  
  8736.       test -n "$xrpath" && \
  8737.         func_warning "'-R' is ignored for archives"
  8738.  
  8739.       test -n "$vinfo" && \
  8740.         func_warning "'-version-info/-version-number' is ignored for archives"
  8741.  
  8742.       test -n "$release" && \
  8743.         func_warning "'-release' is ignored for archives"
  8744.  
  8745.       test -n "$export_symbols$export_symbols_regex" && \
  8746.         func_warning "'-export-symbols' is ignored for archives"
  8747.  
  8748.       # Now set the variables for building old libraries.
  8749.       build_libtool_libs=no
  8750.       oldlibs=$output
  8751.       func_append objs "$old_deplibs"
  8752.       ;;
  8753.  
  8754.     lib)
  8755.       # Make sure we only generate libraries of the form 'libNAME.la'.
  8756.       case $outputname in
  8757.       lib*)
  8758.         func_stripname 'lib' '.la' "$outputname"
  8759.         name=$func_stripname_result
  8760.         eval shared_ext=\"$shrext_cmds\"
  8761.         eval libname=\"$libname_spec\"
  8762.         ;;
  8763.       *)
  8764.         test no = "$module" \
  8765.           && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8766.  
  8767.         if test no != "$need_lib_prefix"; then
  8768.           # Add the "lib" prefix for modules if required
  8769.           func_stripname '' '.la' "$outputname"
  8770.           name=$func_stripname_result
  8771.           eval shared_ext=\"$shrext_cmds\"
  8772.           eval libname=\"$libname_spec\"
  8773.         else
  8774.           func_stripname '' '.la' "$outputname"
  8775.           libname=$func_stripname_result
  8776.         fi
  8777.         ;;
  8778.       esac
  8779.  
  8780.       if test -n "$objs"; then
  8781.         if test pass_all != "$deplibs_check_method"; then
  8782.           func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8783.         else
  8784.           echo
  8785.           $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8786.           $ECHO "*** objects $objs is not portable!"
  8787.           func_append libobjs " $objs"
  8788.         fi
  8789.       fi
  8790.  
  8791.       test no = "$dlself" \
  8792.         || func_warning "'-dlopen self' is ignored for libtool libraries"
  8793.  
  8794.       set dummy $rpath
  8795.       shift
  8796.       test 1 -lt "$#" \
  8797.         && func_warning "ignoring multiple '-rpath's for a libtool library"
  8798.  
  8799.       install_libdir=$1
  8800.  
  8801.       oldlibs=
  8802.       if test -z "$rpath"; then
  8803.         if test yes = "$build_libtool_libs"; then
  8804.           # Building a libtool convenience library.
  8805.           # Some compilers have problems with a '.al' extension so
  8806.           # convenience libraries should have the same extension an
  8807.           # archive normally would.
  8808.           oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8809.           build_libtool_libs=convenience
  8810.           build_old_libs=yes
  8811.         fi
  8812.  
  8813.         test -n "$vinfo" && \
  8814.           func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8815.  
  8816.         test -n "$release" && \
  8817.           func_warning "'-release' is ignored for convenience libraries"
  8818.       else
  8819.  
  8820.         # Parse the version information argument.
  8821.         save_ifs=$IFS; IFS=:
  8822.         set dummy $vinfo 0 0 0
  8823.         shift
  8824.         IFS=$save_ifs
  8825.  
  8826.         test -n "$7" && \
  8827.           func_fatal_help "too many parameters to '-version-info'"
  8828.  
  8829.         # convert absolute version numbers to libtool ages
  8830.         # this retains compatibility with .la files and attempts
  8831.         # to make the code below a bit more comprehensible
  8832.  
  8833.         case $vinfo_number in
  8834.         yes)
  8835.           number_major=$1
  8836.           number_minor=$2
  8837.           number_revision=$3
  8838.           #
  8839.           # There are really only two kinds -- those that
  8840.           # use the current revision as the major version
  8841.           # and those that subtract age and use age as
  8842.           # a minor version.  But, then there is irix
  8843.           # that has an extra 1 added just for fun
  8844.           #
  8845.           case $version_type in
  8846.           # correct linux to gnu/linux during the next big refactor
  8847.           darwin|freebsd-elf|linux|osf|windows|none)
  8848.             func_arith $number_major + $number_minor
  8849.             current=$func_arith_result
  8850.             age=$number_minor
  8851.             revision=$number_revision
  8852.             ;;
  8853.           freebsd-aout|qnx|sunos)
  8854.             current=$number_major
  8855.             revision=$number_minor
  8856.             age=0
  8857.             ;;
  8858.           irix|nonstopux)
  8859.             func_arith $number_major + $number_minor
  8860.             current=$func_arith_result
  8861.             age=$number_minor
  8862.             revision=$number_minor
  8863.             lt_irix_increment=no
  8864.             ;;
  8865.           esac
  8866.           ;;
  8867.         no)
  8868.           current=$1
  8869.           revision=$2
  8870.           age=$3
  8871.           ;;
  8872.         esac
  8873.  
  8874.         # Check that each of the things are valid numbers.
  8875.         case $current in
  8876.         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]) ;;
  8877.         *)
  8878.           func_error "CURRENT '$current' must be a nonnegative integer"
  8879.           func_fatal_error "'$vinfo' is not valid version information"
  8880.           ;;
  8881.         esac
  8882.  
  8883.         case $revision in
  8884.         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]) ;;
  8885.         *)
  8886.           func_error "REVISION '$revision' must be a nonnegative integer"
  8887.           func_fatal_error "'$vinfo' is not valid version information"
  8888.           ;;
  8889.         esac
  8890.  
  8891.         case $age in
  8892.         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]) ;;
  8893.         *)
  8894.           func_error "AGE '$age' must be a nonnegative integer"
  8895.           func_fatal_error "'$vinfo' is not valid version information"
  8896.           ;;
  8897.         esac
  8898.  
  8899.         if test "$age" -gt "$current"; then
  8900.           func_error "AGE '$age' is greater than the current interface number '$current'"
  8901.           func_fatal_error "'$vinfo' is not valid version information"
  8902.         fi
  8903.  
  8904.         # Calculate the version variables.
  8905.         major=
  8906.         versuffix=
  8907.         verstring=
  8908.         case $version_type in
  8909.         none) ;;
  8910.  
  8911.         darwin)
  8912.           # Like Linux, but with the current version available in
  8913.           # verstring for coding it into the library header
  8914.           func_arith $current - $age
  8915.           major=.$func_arith_result
  8916.           versuffix=$major.$age.$revision
  8917.           # Darwin ld doesn't like 0 for these options...
  8918.           func_arith $current + 1
  8919.           minor_current=$func_arith_result
  8920.           xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8921.           verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8922.           # On Darwin other compilers
  8923.           case $CC in
  8924.               nagfor*)
  8925.                   verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8926.                   ;;
  8927.               *)
  8928.                   verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8929.                   ;;
  8930.           esac
  8931.           ;;
  8932.  
  8933.         freebsd-aout)
  8934.           major=.$current
  8935.           versuffix=.$current.$revision
  8936.           ;;
  8937.  
  8938.         freebsd-elf)
  8939.           func_arith $current - $age
  8940.           major=.$func_arith_result
  8941.           versuffix=$major.$age.$revision
  8942.           ;;
  8943.  
  8944.         irix | nonstopux)
  8945.           if test no = "$lt_irix_increment"; then
  8946.             func_arith $current - $age
  8947.           else
  8948.             func_arith $current - $age + 1
  8949.           fi
  8950.           major=$func_arith_result
  8951.  
  8952.           case $version_type in
  8953.             nonstopux) verstring_prefix=nonstopux ;;
  8954.             *)         verstring_prefix=sgi ;;
  8955.           esac
  8956.           verstring=$verstring_prefix$major.$revision
  8957.  
  8958.           # Add in all the interfaces that we are compatible with.
  8959.           loop=$revision
  8960.           while test 0 -ne "$loop"; do
  8961.             func_arith $revision - $loop
  8962.             iface=$func_arith_result
  8963.             func_arith $loop - 1
  8964.             loop=$func_arith_result
  8965.             verstring=$verstring_prefix$major.$iface:$verstring
  8966.           done
  8967.  
  8968.           # Before this point, $major must not contain '.'.
  8969.           major=.$major
  8970.           versuffix=$major.$revision
  8971.           ;;
  8972.  
  8973.         linux) # correct to gnu/linux during the next big refactor
  8974.           func_arith $current - $age
  8975.           major=.$func_arith_result
  8976.           versuffix=$major.$age.$revision
  8977.           ;;
  8978.  
  8979.         osf)
  8980.           func_arith $current - $age
  8981.           major=.$func_arith_result
  8982.           versuffix=.$current.$age.$revision
  8983.           verstring=$current.$age.$revision
  8984.  
  8985.           # Add in all the interfaces that we are compatible with.
  8986.           loop=$age
  8987.           while test 0 -ne "$loop"; do
  8988.             func_arith $current - $loop
  8989.             iface=$func_arith_result
  8990.             func_arith $loop - 1
  8991.             loop=$func_arith_result
  8992.             verstring=$verstring:$iface.0
  8993.           done
  8994.  
  8995.           # Make executables depend on our current version.
  8996.           func_append verstring ":$current.0"
  8997.           ;;
  8998.  
  8999.         qnx)
  9000.           major=.$current
  9001.           versuffix=.$current
  9002.           ;;
  9003.  
  9004.         sco)
  9005.           major=.$current
  9006.           versuffix=.$current
  9007.           ;;
  9008.  
  9009.         sunos)
  9010.           major=.$current
  9011.           versuffix=.$current.$revision
  9012.           ;;
  9013.  
  9014.         windows)
  9015.           # Use '-' rather than '.', since we only want one
  9016.           # extension on DOS 8.3 file systems.
  9017.           func_arith $current - $age
  9018.           major=$func_arith_result
  9019.           versuffix=-$major
  9020.           ;;
  9021.  
  9022.         *)
  9023.           func_fatal_configuration "unknown library version type '$version_type'"
  9024.           ;;
  9025.         esac
  9026.  
  9027.         # Clear the version info if we defaulted, and they specified a release.
  9028.         if test -z "$vinfo" && test -n "$release"; then
  9029.           major=
  9030.           case $version_type in
  9031.           darwin)
  9032.             # we can't check for "0.0" in archive_cmds due to quoting
  9033.             # problems, so we reset it completely
  9034.             verstring=
  9035.             ;;
  9036.           *)
  9037.             verstring=0.0
  9038.             ;;
  9039.           esac
  9040.           if test no = "$need_version"; then
  9041.             versuffix=
  9042.           else
  9043.             versuffix=.0.0
  9044.           fi
  9045.         fi
  9046.  
  9047.         # Remove version info from name if versioning should be avoided
  9048.         if test yes,no = "$avoid_version,$need_version"; then
  9049.           major=
  9050.           versuffix=
  9051.           verstring=
  9052.         fi
  9053.  
  9054.         # Check to see if the archive will have undefined symbols.
  9055.         if test yes = "$allow_undefined"; then
  9056.           if test unsupported = "$allow_undefined_flag"; then
  9057.             if test yes = "$build_old_libs"; then
  9058.               func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  9059.               build_libtool_libs=no
  9060.             else
  9061.               func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  9062.             fi
  9063.           fi
  9064.         else
  9065.           # Don't allow undefined symbols.
  9066.           allow_undefined_flag=$no_undefined_flag
  9067.         fi
  9068.  
  9069.       fi
  9070.  
  9071.       func_generate_dlsyms "$libname" "$libname" :
  9072.       func_append libobjs " $symfileobj"
  9073.       test " " = "$libobjs" && libobjs=
  9074.  
  9075.       if test relink != "$opt_mode"; then
  9076.         # Remove our outputs, but don't remove object files since they
  9077.         # may have been created when compiling PIC objects.
  9078.         removelist=
  9079.         tempremovelist=`$ECHO "$output_objdir/*"`
  9080.         for p in $tempremovelist; do
  9081.           case $p in
  9082.             *.$objext | *.gcno)
  9083.                ;;
  9084.             $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  9085.                if test -n "$precious_files_regex"; then
  9086.                  if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  9087.                  then
  9088.                    continue
  9089.                  fi
  9090.                fi
  9091.                func_append removelist " $p"
  9092.                ;;
  9093.             *) ;;
  9094.           esac
  9095.         done
  9096.         test -n "$removelist" && \
  9097.           func_show_eval "${RM}r \$removelist"
  9098.       fi
  9099.  
  9100.       # Now set the variables for building old libraries.
  9101.       if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  9102.         func_append oldlibs " $output_objdir/$libname.$libext"
  9103.  
  9104.         # Transform .lo files to .o files.
  9105.         oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  9106.       fi
  9107.  
  9108.       # Eliminate all temporary directories.
  9109.       #for path in $notinst_path; do
  9110.       # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  9111.       # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  9112.       # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  9113.       #done
  9114.  
  9115.       if test -n "$xrpath"; then
  9116.         # If the user specified any rpath flags, then add them.
  9117.         temp_xrpath=
  9118.         for libdir in $xrpath; do
  9119.           func_replace_sysroot "$libdir"
  9120.           func_append temp_xrpath " -R$func_replace_sysroot_result"
  9121.           case "$finalize_rpath " in
  9122.           *" $libdir "*) ;;
  9123.           *) func_append finalize_rpath " $libdir" ;;
  9124.           esac
  9125.         done
  9126.         if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  9127.           dependency_libs="$temp_xrpath $dependency_libs"
  9128.         fi
  9129.       fi
  9130.  
  9131.       # Make sure dlfiles contains only unique files that won't be dlpreopened
  9132.       old_dlfiles=$dlfiles
  9133.       dlfiles=
  9134.       for lib in $old_dlfiles; do
  9135.         case " $dlprefiles $dlfiles " in
  9136.         *" $lib "*) ;;
  9137.         *) func_append dlfiles " $lib" ;;
  9138.         esac
  9139.       done
  9140.  
  9141.       # Make sure dlprefiles contains only unique files
  9142.       old_dlprefiles=$dlprefiles
  9143.       dlprefiles=
  9144.       for lib in $old_dlprefiles; do
  9145.         case "$dlprefiles " in
  9146.         *" $lib "*) ;;
  9147.         *) func_append dlprefiles " $lib" ;;
  9148.         esac
  9149.       done
  9150.  
  9151.       if test yes = "$build_libtool_libs"; then
  9152.         if test -n "$rpath"; then
  9153.           case $host in
  9154.           *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  9155.             # these systems don't actually have a c library (as such)!
  9156.             ;;
  9157.           *-*-rhapsody* | *-*-darwin1.[012])
  9158.             # Rhapsody C library is in the System framework
  9159.             func_append deplibs " System.ltframework"
  9160.             ;;
  9161.           *-*-netbsd*)
  9162.             # Don't link with libc until the a.out ld.so is fixed.
  9163.             ;;
  9164.           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  9165.             # Do not include libc due to us having libc/libc_r.
  9166.             ;;
  9167.           *-*-sco3.2v5* | *-*-sco5v6*)
  9168.             # Causes problems with __ctype
  9169.             ;;
  9170.           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  9171.             # Compiler inserts libc in the correct place for threads to work
  9172.             ;;
  9173.           *)
  9174.             # Add libc to deplibs on all other systems if necessary.
  9175.             if test yes = "$build_libtool_need_lc"; then
  9176.               func_append deplibs " -lc"
  9177.             fi
  9178.             ;;
  9179.           esac
  9180.         fi
  9181.  
  9182.         # Transform deplibs into only deplibs that can be linked in shared.
  9183.         name_save=$name
  9184.         libname_save=$libname
  9185.         release_save=$release
  9186.         versuffix_save=$versuffix
  9187.         major_save=$major
  9188.         # I'm not sure if I'm treating the release correctly.  I think
  9189.         # release should show up in the -l (ie -lgmp5) so we don't want to
  9190.         # add it in twice.  Is that correct?
  9191.         release=
  9192.         versuffix=
  9193.         major=
  9194.         newdeplibs=
  9195.         droppeddeps=no
  9196.         case $deplibs_check_method in
  9197.         pass_all)
  9198.           # Don't check for shared/static.  Everything works.
  9199.           # This might be a little naive.  We might want to check
  9200.           # whether the library exists or not.  But this is on
  9201.           # osf3 & osf4 and I'm not really sure... Just
  9202.           # implementing what was already the behavior.
  9203.           newdeplibs=$deplibs
  9204.           ;;
  9205.         test_compile)
  9206.           # This code stresses the "libraries are programs" paradigm to its
  9207.           # limits. Maybe even breaks it.  We compile a program, linking it
  9208.           # against the deplibs as a proxy for the library.  Then we can check
  9209.           # whether they linked in statically or dynamically with ldd.
  9210.           $opt_dry_run || $RM conftest.c
  9211.           cat > conftest.c <<EOF
  9212.           int main() { return 0; }
  9213. EOF
  9214.           $opt_dry_run || $RM conftest
  9215.           if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  9216.             ldd_output=`ldd conftest`
  9217.             for i in $deplibs; do
  9218.               case $i in
  9219.               -l*)
  9220.                 func_stripname -l '' "$i"
  9221.                 name=$func_stripname_result
  9222.                 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  9223.                   case " $predeps $postdeps " in
  9224.                   *" $i "*)
  9225.                     func_append newdeplibs " $i"
  9226.                     i=
  9227.                     ;;
  9228.                   esac
  9229.                 fi
  9230.                 if test -n "$i"; then
  9231.                   libname=`eval "\\$ECHO \"$libname_spec\""`
  9232.                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  9233.                   set dummy $deplib_matches; shift
  9234.                   deplib_match=$1
  9235.                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  9236.                     func_append newdeplibs " $i"
  9237.                   else
  9238.                     droppeddeps=yes
  9239.                     echo
  9240.                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  9241.                     echo "*** I have the capability to make that library automatically link in when"
  9242.                     echo "*** you link to this library.  But I can only do this if you have a"
  9243.                     echo "*** shared version of the library, which I believe you do not have"
  9244.                     echo "*** because a test_compile did reveal that the linker did not use it for"
  9245.                     echo "*** its dynamic dependency list that programs get resolved with at runtime."
  9246.                   fi
  9247.                 fi
  9248.                 ;;
  9249.               *)
  9250.                 func_append newdeplibs " $i"
  9251.                 ;;
  9252.               esac
  9253.             done
  9254.           else
  9255.             # Error occurred in the first compile.  Let's try to salvage
  9256.             # the situation: Compile a separate program for each library.
  9257.             for i in $deplibs; do
  9258.               case $i in
  9259.               -l*)
  9260.                 func_stripname -l '' "$i"
  9261.                 name=$func_stripname_result
  9262.                 $opt_dry_run || $RM conftest
  9263.                 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  9264.                   ldd_output=`ldd conftest`
  9265.                   if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  9266.                     case " $predeps $postdeps " in
  9267.                     *" $i "*)
  9268.                       func_append newdeplibs " $i"
  9269.                       i=
  9270.                       ;;
  9271.                     esac
  9272.                   fi
  9273.                   if test -n "$i"; then
  9274.                     libname=`eval "\\$ECHO \"$libname_spec\""`
  9275.                     deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  9276.                     set dummy $deplib_matches; shift
  9277.                     deplib_match=$1
  9278.                     if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  9279.                       func_append newdeplibs " $i"
  9280.                     else
  9281.                       droppeddeps=yes
  9282.                       echo
  9283.                       $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  9284.                       echo "*** I have the capability to make that library automatically link in when"
  9285.                       echo "*** you link to this library.  But I can only do this if you have a"
  9286.                       echo "*** shared version of the library, which you do not appear to have"
  9287.                       echo "*** because a test_compile did reveal that the linker did not use this one"
  9288.                       echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  9289.                     fi
  9290.                   fi
  9291.                 else
  9292.                   droppeddeps=yes
  9293.                   echo
  9294.                   $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
  9295.                   echo "*** make it link in!  You will probably need to install it or some"
  9296.                   echo "*** library that it depends on before this library will be fully"
  9297.                   echo "*** functional.  Installing it before continuing would be even better."
  9298.                 fi
  9299.                 ;;
  9300.               *)
  9301.                 func_append newdeplibs " $i"
  9302.                 ;;
  9303.               esac
  9304.             done
  9305.           fi
  9306.           ;;
  9307.         file_magic*)
  9308.           set dummy $deplibs_check_method; shift
  9309.           file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  9310.           for a_deplib in $deplibs; do
  9311.             case $a_deplib in
  9312.             -l*)
  9313.               func_stripname -l '' "$a_deplib"
  9314.               name=$func_stripname_result
  9315.               if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  9316.                 case " $predeps $postdeps " in
  9317.                 *" $a_deplib "*)
  9318.                   func_append newdeplibs " $a_deplib"
  9319.                   a_deplib=
  9320.                   ;;
  9321.                 esac
  9322.               fi
  9323.               if test -n "$a_deplib"; then
  9324.                 libname=`eval "\\$ECHO \"$libname_spec\""`
  9325.                 if test -n "$file_magic_glob"; then
  9326.                   libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  9327.                 else
  9328.                   libnameglob=$libname
  9329.                 fi
  9330.                 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  9331.                 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  9332.                   if test yes = "$want_nocaseglob"; then
  9333.                     shopt -s nocaseglob
  9334.                     potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  9335.                     $nocaseglob
  9336.                   else
  9337.                     potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  9338.                   fi
  9339.                   for potent_lib in $potential_libs; do
  9340.                       # Follow soft links.
  9341.                       if ls -lLd "$potent_lib" 2>/dev/null |
  9342.                          $GREP " -> " >/dev/null; then
  9343.                         continue
  9344.                       fi
  9345.                       # The statement above tries to avoid entering an
  9346.                       # endless loop below, in case of cyclic links.
  9347.                       # We might still enter an endless loop, since a link
  9348.                       # loop can be closed while we follow links,
  9349.                       # but so what?
  9350.                       potlib=$potent_lib
  9351.                       while test -h "$potlib" 2>/dev/null; do
  9352.                         potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  9353.                         case $potliblink in
  9354.                         [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  9355.                         *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  9356.                         esac
  9357.                       done
  9358.                       if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  9359.                          $SED -e 10q |
  9360.                          $EGREP "$file_magic_regex" > /dev/null; then
  9361.                         func_append newdeplibs " $a_deplib"
  9362.                         a_deplib=
  9363.                         break 2
  9364.                       fi
  9365.                   done
  9366.                 done
  9367.               fi
  9368.               if test -n "$a_deplib"; then
  9369.                 droppeddeps=yes
  9370.                 echo
  9371.                 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  9372.                 echo "*** I have the capability to make that library automatically link in when"
  9373.                 echo "*** you link to this library.  But I can only do this if you have a"
  9374.                 echo "*** shared version of the library, which you do not appear to have"
  9375.                 echo "*** because I did check the linker path looking for a file starting"
  9376.                 if test -z "$potlib"; then
  9377.                   $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  9378.                 else
  9379.                   $ECHO "*** with $libname and none of the candidates passed a file format test"
  9380.                   $ECHO "*** using a file magic. Last file checked: $potlib"
  9381.                 fi
  9382.               fi
  9383.               ;;
  9384.             *)
  9385.               # Add a -L argument.
  9386.               func_append newdeplibs " $a_deplib"
  9387.               ;;
  9388.             esac
  9389.           done # Gone through all deplibs.
  9390.           ;;
  9391.         match_pattern*)
  9392.           set dummy $deplibs_check_method; shift
  9393.           match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  9394.           for a_deplib in $deplibs; do
  9395.             case $a_deplib in
  9396.             -l*)
  9397.               func_stripname -l '' "$a_deplib"
  9398.               name=$func_stripname_result
  9399.               if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  9400.                 case " $predeps $postdeps " in
  9401.                 *" $a_deplib "*)
  9402.                   func_append newdeplibs " $a_deplib"
  9403.                   a_deplib=
  9404.                   ;;
  9405.                 esac
  9406.               fi
  9407.               if test -n "$a_deplib"; then
  9408.                 libname=`eval "\\$ECHO \"$libname_spec\""`
  9409.                 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  9410.                   potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  9411.                   for potent_lib in $potential_libs; do
  9412.                     potlib=$potent_lib # see symlink-check above in file_magic test
  9413.                     if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  9414.                        $EGREP "$match_pattern_regex" > /dev/null; then
  9415.                       func_append newdeplibs " $a_deplib"
  9416.                       a_deplib=
  9417.                       break 2
  9418.                     fi
  9419.                   done
  9420.                 done
  9421.               fi
  9422.               if test -n "$a_deplib"; then
  9423.                 droppeddeps=yes
  9424.                 echo
  9425.                 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  9426.                 echo "*** I have the capability to make that library automatically link in when"
  9427.                 echo "*** you link to this library.  But I can only do this if you have a"
  9428.                 echo "*** shared version of the library, which you do not appear to have"
  9429.                 echo "*** because I did check the linker path looking for a file starting"
  9430.                 if test -z "$potlib"; then
  9431.                   $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  9432.                 else
  9433.                   $ECHO "*** with $libname and none of the candidates passed a file format test"
  9434.                   $ECHO "*** using a regex pattern. Last file checked: $potlib"
  9435.                 fi
  9436.               fi
  9437.               ;;
  9438.             *)
  9439.               # Add a -L argument.
  9440.               func_append newdeplibs " $a_deplib"
  9441.               ;;
  9442.             esac
  9443.           done # Gone through all deplibs.
  9444.           ;;
  9445.         none | unknown | *)
  9446.           newdeplibs=
  9447.           tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  9448.           if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  9449.             for i in $predeps $postdeps; do
  9450.               # can't use Xsed below, because $i might contain '/'
  9451.               tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  9452.             done
  9453.           fi
  9454.           case $tmp_deplibs in
  9455.           *[!\  \ ]*)
  9456.             echo
  9457.             if test none = "$deplibs_check_method"; then
  9458.               echo "*** Warning: inter-library dependencies are not supported in this platform."
  9459.             else
  9460.               echo "*** Warning: inter-library dependencies are not known to be supported."
  9461.             fi
  9462.             echo "*** All declared inter-library dependencies are being dropped."
  9463.             droppeddeps=yes
  9464.             ;;
  9465.           esac
  9466.           ;;
  9467.         esac
  9468.         versuffix=$versuffix_save
  9469.         major=$major_save
  9470.         release=$release_save
  9471.         libname=$libname_save
  9472.         name=$name_save
  9473.  
  9474.         case $host in
  9475.         *-*-rhapsody* | *-*-darwin1.[012])
  9476.           # On Rhapsody replace the C library with the System framework
  9477.           newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  9478.           ;;
  9479.         esac
  9480.  
  9481.         if test yes = "$droppeddeps"; then
  9482.           if test yes = "$module"; then
  9483.             echo
  9484.             echo "*** Warning: libtool could not satisfy all declared inter-library"
  9485.             $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
  9486.             echo "*** a static module, that should work as long as the dlopening"
  9487.             echo "*** application is linked with the -dlopen flag."
  9488.             if test -z "$global_symbol_pipe"; then
  9489.               echo
  9490.               echo "*** However, this would only work if libtool was able to extract symbol"
  9491.               echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  9492.               echo "*** not find such a program.  So, this module is probably useless."
  9493.               echo "*** 'nm' from GNU binutils and a full rebuild may help."
  9494.             fi
  9495.             if test no = "$build_old_libs"; then
  9496.               oldlibs=$output_objdir/$libname.$libext
  9497.               build_libtool_libs=module
  9498.               build_old_libs=yes
  9499.             else
  9500.               build_libtool_libs=no
  9501.             fi
  9502.           else
  9503.             echo "*** The inter-library dependencies that have been dropped here will be"
  9504.             echo "*** automatically added whenever a program is linked with this library"
  9505.             echo "*** or is declared to -dlopen it."
  9506.  
  9507.             if test no = "$allow_undefined"; then
  9508.               echo
  9509.               echo "*** Since this library must not contain undefined symbols,"
  9510.               echo "*** because either the platform does not support them or"
  9511.               echo "*** it was explicitly requested with -no-undefined,"
  9512.               echo "*** libtool will only create a static version of it."
  9513.               if test no = "$build_old_libs"; then
  9514.                 oldlibs=$output_objdir/$libname.$libext
  9515.                 build_libtool_libs=module
  9516.                 build_old_libs=yes
  9517.               else
  9518.                 build_libtool_libs=no
  9519.               fi
  9520.             fi
  9521.           fi
  9522.         fi
  9523.         # Done checking deplibs!
  9524.         deplibs=$newdeplibs
  9525.       fi
  9526.       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9527.       case $host in
  9528.         *-*-darwin*)
  9529.           newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9530.           new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9531.           deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9532.           ;;
  9533.       esac
  9534.  
  9535.       # move library search paths that coincide with paths to not yet
  9536.       # installed libraries to the beginning of the library search list
  9537.       new_libs=
  9538.       for path in $notinst_path; do
  9539.         case " $new_libs " in
  9540.         *" -L$path/$objdir "*) ;;
  9541.         *)
  9542.           case " $deplibs " in
  9543.           *" -L$path/$objdir "*)
  9544.             func_append new_libs " -L$path/$objdir" ;;
  9545.           esac
  9546.           ;;
  9547.         esac
  9548.       done
  9549.       for deplib in $deplibs; do
  9550.         case $deplib in
  9551.         -L*)
  9552.           case " $new_libs " in
  9553.           *" $deplib "*) ;;
  9554.           *) func_append new_libs " $deplib" ;;
  9555.           esac
  9556.           ;;
  9557.         *) func_append new_libs " $deplib" ;;
  9558.         esac
  9559.       done
  9560.       deplibs=$new_libs
  9561.  
  9562.       # All the library-specific variables (install_libdir is set above).
  9563.       library_names=
  9564.       old_library=
  9565.       dlname=
  9566.  
  9567.       # Test again, we may have decided not to build it any more
  9568.       if test yes = "$build_libtool_libs"; then
  9569.         # Remove $wl instances when linking with ld.
  9570.         # FIXME: should test the right _cmds variable.
  9571.         case $archive_cmds in
  9572.           *\$LD\ *) wl= ;;
  9573.         esac
  9574.         if test yes = "$hardcode_into_libs"; then
  9575.           # Hardcode the library paths
  9576.           hardcode_libdirs=
  9577.           dep_rpath=
  9578.           rpath=$finalize_rpath
  9579.           test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  9580.           for libdir in $rpath; do
  9581.             if test -n "$hardcode_libdir_flag_spec"; then
  9582.               if test -n "$hardcode_libdir_separator"; then
  9583.                 func_replace_sysroot "$libdir"
  9584.                 libdir=$func_replace_sysroot_result
  9585.                 if test -z "$hardcode_libdirs"; then
  9586.                   hardcode_libdirs=$libdir
  9587.                 else
  9588.                   # Just accumulate the unique libdirs.
  9589.                   case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9590.                   *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9591.                     ;;
  9592.                   *)
  9593.                     func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9594.                     ;;
  9595.                   esac
  9596.                 fi
  9597.               else
  9598.                 eval flag=\"$hardcode_libdir_flag_spec\"
  9599.                 func_append dep_rpath " $flag"
  9600.               fi
  9601.             elif test -n "$runpath_var"; then
  9602.               case "$perm_rpath " in
  9603.               *" $libdir "*) ;;
  9604.               *) func_append perm_rpath " $libdir" ;;
  9605.               esac
  9606.             fi
  9607.           done
  9608.           # Substitute the hardcoded libdirs into the rpath.
  9609.           if test -n "$hardcode_libdir_separator" &&
  9610.              test -n "$hardcode_libdirs"; then
  9611.             libdir=$hardcode_libdirs
  9612.             eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  9613.           fi
  9614.           if test -n "$runpath_var" && test -n "$perm_rpath"; then
  9615.             # We should set the runpath_var.
  9616.             rpath=
  9617.             for dir in $perm_rpath; do
  9618.               func_append rpath "$dir:"
  9619.             done
  9620.             eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  9621.           fi
  9622.           test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  9623.         fi
  9624.  
  9625.         shlibpath=$finalize_shlibpath
  9626.         test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  9627.         if test -n "$shlibpath"; then
  9628.           eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  9629.         fi
  9630.  
  9631.         # Get the real and link names of the library.
  9632.         eval shared_ext=\"$shrext_cmds\"
  9633.         eval library_names=\"$library_names_spec\"
  9634.         set dummy $library_names
  9635.         shift
  9636.         realname=$1
  9637.         shift
  9638.  
  9639.         if test -n "$soname_spec"; then
  9640.           eval soname=\"$soname_spec\"
  9641.         else
  9642.           soname=$realname
  9643.         fi
  9644.         if test -z "$dlname"; then
  9645.           dlname=$soname
  9646.         fi
  9647.  
  9648.         lib=$output_objdir/$realname
  9649.         linknames=
  9650.         for link
  9651.         do
  9652.           func_append linknames " $link"
  9653.         done
  9654.  
  9655.         # Use standard objects if they are pic
  9656.         test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9657.         test "X$libobjs" = "X " && libobjs=
  9658.  
  9659.         delfiles=
  9660.         if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9661.           $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  9662.           export_symbols=$output_objdir/$libname.uexp
  9663.           func_append delfiles " $export_symbols"
  9664.         fi
  9665.  
  9666.         orig_export_symbols=
  9667.         case $host_os in
  9668.         cygwin* | msys* | mingw* | cegcc*)
  9669.           if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  9670.             # exporting using user supplied symfile
  9671.             func_dll_def_p "$export_symbols" || {
  9672.               # and it's NOT already a .def file. Must figure out
  9673.               # which of the given symbols are data symbols and tag
  9674.               # them as such. So, trigger use of export_symbols_cmds.
  9675.               # export_symbols gets reassigned inside the "prepare
  9676.               # the list of exported symbols" if statement, so the
  9677.               # include_expsyms logic still works.
  9678.               orig_export_symbols=$export_symbols
  9679.               export_symbols=
  9680.               always_export_symbols=yes
  9681.             }
  9682.           fi
  9683.           ;;
  9684.         esac
  9685.  
  9686.         # Prepare the list of exported symbols
  9687.         if test -z "$export_symbols"; then
  9688.           if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  9689.             func_verbose "generating symbol list for '$libname.la'"
  9690.             export_symbols=$output_objdir/$libname.exp
  9691.             $opt_dry_run || $RM $export_symbols
  9692.             cmds=$export_symbols_cmds
  9693.             save_ifs=$IFS; IFS='~'
  9694.             for cmd1 in $cmds; do
  9695.               IFS=$save_ifs
  9696.               # Take the normal branch if the nm_file_list_spec branch
  9697.               # doesn't work or if tool conversion is not needed.
  9698.               case $nm_file_list_spec~$to_tool_file_cmd in
  9699.                 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  9700.                   try_normal_branch=yes
  9701.                   eval cmd=\"$cmd1\"
  9702.                   func_len " $cmd"
  9703.                   len=$func_len_result
  9704.                   ;;
  9705.                 *)
  9706.                   try_normal_branch=no
  9707.                   ;;
  9708.               esac
  9709.               if test yes = "$try_normal_branch" \
  9710.                  && { test "$len" -lt "$max_cmd_len" \
  9711.                       || test "$max_cmd_len" -le -1; }
  9712.               then
  9713.                 func_show_eval "$cmd" 'exit $?'
  9714.                 skipped_export=false
  9715.               elif test -n "$nm_file_list_spec"; then
  9716.                 func_basename "$output"
  9717.                 output_la=$func_basename_result
  9718.                 save_libobjs=$libobjs
  9719.                 save_output=$output
  9720.                 output=$output_objdir/$output_la.nm
  9721.                 func_to_tool_file "$output"
  9722.                 libobjs=$nm_file_list_spec$func_to_tool_file_result
  9723.                 func_append delfiles " $output"
  9724.                 func_verbose "creating $NM input file list: $output"
  9725.                 for obj in $save_libobjs; do
  9726.                   func_to_tool_file "$obj"
  9727.                   $ECHO "$func_to_tool_file_result"
  9728.                 done > "$output"
  9729.                 eval cmd=\"$cmd1\"
  9730.                 func_show_eval "$cmd" 'exit $?'
  9731.                 output=$save_output
  9732.                 libobjs=$save_libobjs
  9733.                 skipped_export=false
  9734.               else
  9735.                 # The command line is too long to execute in one step.
  9736.                 func_verbose "using reloadable object file for export list..."
  9737.                 skipped_export=:
  9738.                 # Break out early, otherwise skipped_export may be
  9739.                 # set to false by a later but shorter cmd.
  9740.                 break
  9741.               fi
  9742.             done
  9743.             IFS=$save_ifs
  9744.             if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  9745.               func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9746.               func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9747.             fi
  9748.           fi
  9749.         fi
  9750.  
  9751.         if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9752.           tmp_export_symbols=$export_symbols
  9753.           test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9754.           $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9755.         fi
  9756.  
  9757.         if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  9758.           # The given exports_symbols file has to be filtered, so filter it.
  9759.           func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9760.           # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9761.           # 's' commands, which not all seds can handle. GNU sed should be fine
  9762.           # though. Also, the filter scales superlinearly with the number of
  9763.           # global variables. join(1) would be nice here, but unfortunately
  9764.           # isn't a blessed tool.
  9765.           $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9766.           func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9767.           export_symbols=$output_objdir/$libname.def
  9768.           $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9769.         fi
  9770.  
  9771.         tmp_deplibs=
  9772.         for test_deplib in $deplibs; do
  9773.           case " $convenience " in
  9774.           *" $test_deplib "*) ;;
  9775.           *)
  9776.             func_append tmp_deplibs " $test_deplib"
  9777.             ;;
  9778.           esac
  9779.         done
  9780.         deplibs=$tmp_deplibs
  9781.  
  9782.         if test -n "$convenience"; then
  9783.           if test -n "$whole_archive_flag_spec" &&
  9784.             test yes = "$compiler_needs_object" &&
  9785.             test -z "$libobjs"; then
  9786.             # extract the archives, so we have objects to list.
  9787.             # TODO: could optimize this to just extract one archive.
  9788.             whole_archive_flag_spec=
  9789.           fi
  9790.           if test -n "$whole_archive_flag_spec"; then
  9791.             save_libobjs=$libobjs
  9792.             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9793.             test "X$libobjs" = "X " && libobjs=
  9794.           else
  9795.             gentop=$output_objdir/${outputname}x
  9796.             func_append generated " $gentop"
  9797.  
  9798.             func_extract_archives $gentop $convenience
  9799.             func_append libobjs " $func_extract_archives_result"
  9800.             test "X$libobjs" = "X " && libobjs=
  9801.           fi
  9802.         fi
  9803.  
  9804.         if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  9805.           eval flag=\"$thread_safe_flag_spec\"
  9806.           func_append linker_flags " $flag"
  9807.         fi
  9808.  
  9809.         # Make a backup of the uninstalled library when relinking
  9810.         if test relink = "$opt_mode"; then
  9811.           $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  9812.         fi
  9813.  
  9814.         # Do each of the archive commands.
  9815.         if test yes = "$module" && test -n "$module_cmds"; then
  9816.           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9817.             eval test_cmds=\"$module_expsym_cmds\"
  9818.             cmds=$module_expsym_cmds
  9819.           else
  9820.             eval test_cmds=\"$module_cmds\"
  9821.             cmds=$module_cmds
  9822.           fi
  9823.         else
  9824.           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9825.             eval test_cmds=\"$archive_expsym_cmds\"
  9826.             cmds=$archive_expsym_cmds
  9827.           else
  9828.             eval test_cmds=\"$archive_cmds\"
  9829.             cmds=$archive_cmds
  9830.           fi
  9831.         fi
  9832.  
  9833.         if test : != "$skipped_export" &&
  9834.            func_len " $test_cmds" &&
  9835.            len=$func_len_result &&
  9836.            test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9837.           :
  9838.         else
  9839.           # The command line is too long to link in one step, link piecewise
  9840.           # or, if using GNU ld and skipped_export is not :, use a linker
  9841.           # script.
  9842.  
  9843.           # Save the value of $output and $libobjs because we want to
  9844.           # use them later.  If we have whole_archive_flag_spec, we
  9845.           # want to use save_libobjs as it was before
  9846.           # whole_archive_flag_spec was expanded, because we can't
  9847.           # assume the linker understands whole_archive_flag_spec.
  9848.           # This may have to be revisited, in case too many
  9849.           # convenience libraries get linked in and end up exceeding
  9850.           # the spec.
  9851.           if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9852.             save_libobjs=$libobjs
  9853.           fi
  9854.           save_output=$output
  9855.           func_basename "$output"
  9856.           output_la=$func_basename_result
  9857.  
  9858.           # Clear the reloadable object creation command queue and
  9859.           # initialize k to one.
  9860.           test_cmds=
  9861.           concat_cmds=
  9862.           objlist=
  9863.           last_robj=
  9864.           k=1
  9865.  
  9866.           if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9867.             output=$output_objdir/$output_la.lnk
  9868.             func_verbose "creating linker input file list: $output"
  9869.             : > $output
  9870.             set x $save_libobjs
  9871.             shift
  9872.             firstobj=
  9873.             if test yes = "$compiler_needs_object"; then
  9874.               firstobj="$1 "
  9875.               shift
  9876.             fi
  9877.             for obj
  9878.             do
  9879.               func_to_tool_file "$obj"
  9880.               $ECHO "$func_to_tool_file_result" >> $output
  9881.             done
  9882.             func_append delfiles " $output"
  9883.             func_to_tool_file "$output"
  9884.             output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9885.           elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9886.             output=$output_objdir/$output_la.lnkscript
  9887.             func_verbose "creating GNU ld script: $output"
  9888.             echo 'INPUT (' > $output
  9889.             for obj in $save_libobjs
  9890.             do
  9891.               func_to_tool_file "$obj"
  9892.               $ECHO "$func_to_tool_file_result" >> $output
  9893.             done
  9894.             echo ')' >> $output
  9895.             func_append delfiles " $output"
  9896.             func_to_tool_file "$output"
  9897.             output=$func_to_tool_file_result
  9898.           else
  9899.             if test -n "$save_libobjs"; then
  9900.               func_verbose "creating reloadable object files..."
  9901.               output=$output_objdir/$output_la-$k.$objext
  9902.               eval test_cmds=\"$reload_cmds\"
  9903.               func_len " $test_cmds"
  9904.               len0=$func_len_result
  9905.               len=$len0
  9906.  
  9907.               # Loop over the list of objects to be linked.
  9908.               for obj in $save_libobjs
  9909.               do
  9910.                 func_len " $obj"
  9911.                 func_arith $len + $func_len_result
  9912.                 len=$func_arith_result
  9913.                 if test -z "$objlist" ||
  9914.                    test "$len" -lt "$max_cmd_len"; then
  9915.                   func_append objlist " $obj"
  9916.                 else
  9917.                   # The command $test_cmds is almost too long, add a
  9918.                   # command to the queue.
  9919.                   if test 1 -eq "$k"; then
  9920.                     # The first file doesn't have a previous command to add.
  9921.                     reload_objs=$objlist
  9922.                     eval concat_cmds=\"$reload_cmds\"
  9923.                   else
  9924.                     # All subsequent reloadable object files will link in
  9925.                     # the last one created.
  9926.                     reload_objs="$objlist $last_robj"
  9927.                     eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9928.                   fi
  9929.                   last_robj=$output_objdir/$output_la-$k.$objext
  9930.                   func_arith $k + 1
  9931.                   k=$func_arith_result
  9932.                   output=$output_objdir/$output_la-$k.$objext
  9933.                   objlist=" $obj"
  9934.                   func_len " $last_robj"
  9935.                   func_arith $len0 + $func_len_result
  9936.                   len=$func_arith_result
  9937.                 fi
  9938.               done
  9939.               # Handle the remaining objects by creating one last
  9940.               # reloadable object file.  All subsequent reloadable object
  9941.               # files will link in the last one created.
  9942.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9943.               reload_objs="$objlist $last_robj"
  9944.               eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9945.               if test -n "$last_robj"; then
  9946.                 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9947.               fi
  9948.               func_append delfiles " $output"
  9949.  
  9950.             else
  9951.               output=
  9952.             fi
  9953.  
  9954.             ${skipped_export-false} && {
  9955.               func_verbose "generating symbol list for '$libname.la'"
  9956.               export_symbols=$output_objdir/$libname.exp
  9957.               $opt_dry_run || $RM $export_symbols
  9958.               libobjs=$output
  9959.               # Append the command to create the export file.
  9960.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9961.               eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9962.               if test -n "$last_robj"; then
  9963.                 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9964.               fi
  9965.             }
  9966.  
  9967.             test -n "$save_libobjs" &&
  9968.               func_verbose "creating a temporary reloadable object file: $output"
  9969.  
  9970.             # Loop through the commands generated above and execute them.
  9971.             save_ifs=$IFS; IFS='~'
  9972.             for cmd in $concat_cmds; do
  9973.               IFS=$save_ifs
  9974.               $opt_quiet || {
  9975.                   func_quote_for_expand "$cmd"
  9976.                   eval "func_echo $func_quote_for_expand_result"
  9977.               }
  9978.               $opt_dry_run || eval "$cmd" || {
  9979.                 lt_exit=$?
  9980.  
  9981.                 # Restore the uninstalled library and exit
  9982.                 if test relink = "$opt_mode"; then
  9983.                   ( cd "$output_objdir" && \
  9984.                     $RM "${realname}T" && \
  9985.                     $MV "${realname}U" "$realname" )
  9986.                 fi
  9987.  
  9988.                 exit $lt_exit
  9989.               }
  9990.             done
  9991.             IFS=$save_ifs
  9992.  
  9993.             if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9994.               func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9995.               func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9996.             fi
  9997.           fi
  9998.  
  9999.           ${skipped_export-false} && {
  10000.             if test -n "$export_symbols" && test -n "$include_expsyms"; then
  10001.               tmp_export_symbols=$export_symbols
  10002.               test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  10003.               $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  10004.             fi
  10005.  
  10006.             if test -n "$orig_export_symbols"; then
  10007.               # The given exports_symbols file has to be filtered, so filter it.
  10008.               func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  10009.               # FIXME: $output_objdir/$libname.filter potentially contains lots of
  10010.               # 's' commands, which not all seds can handle. GNU sed should be fine
  10011.               # though. Also, the filter scales superlinearly with the number of
  10012.               # global variables. join(1) would be nice here, but unfortunately
  10013.               # isn't a blessed tool.
  10014.               $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  10015.               func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  10016.               export_symbols=$output_objdir/$libname.def
  10017.               $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  10018.             fi
  10019.           }
  10020.  
  10021.           libobjs=$output
  10022.           # Restore the value of output.
  10023.           output=$save_output
  10024.  
  10025.           if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  10026.             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  10027.             test "X$libobjs" = "X " && libobjs=
  10028.           fi
  10029.           # Expand the library linking commands again to reset the
  10030.           # value of $libobjs for piecewise linking.
  10031.  
  10032.           # Do each of the archive commands.
  10033.           if test yes = "$module" && test -n "$module_cmds"; then
  10034.             if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  10035.               cmds=$module_expsym_cmds
  10036.             else
  10037.               cmds=$module_cmds
  10038.             fi
  10039.           else
  10040.             if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  10041.               cmds=$archive_expsym_cmds
  10042.             else
  10043.               cmds=$archive_cmds
  10044.             fi
  10045.           fi
  10046.         fi
  10047.  
  10048.         if test -n "$delfiles"; then
  10049.           # Append the command to remove temporary files to $cmds.
  10050.           eval cmds=\"\$cmds~\$RM $delfiles\"
  10051.         fi
  10052.  
  10053.         # Add any objects from preloaded convenience libraries
  10054.         if test -n "$dlprefiles"; then
  10055.           gentop=$output_objdir/${outputname}x
  10056.           func_append generated " $gentop"
  10057.  
  10058.           func_extract_archives $gentop $dlprefiles
  10059.           func_append libobjs " $func_extract_archives_result"
  10060.           test "X$libobjs" = "X " && libobjs=
  10061.         fi
  10062.  
  10063.         save_ifs=$IFS; IFS='~'
  10064.         for cmd in $cmds; do
  10065.           IFS=$sp$nl
  10066.           eval cmd=\"$cmd\"
  10067.           IFS=$save_ifs
  10068.           $opt_quiet || {
  10069.             func_quote_for_expand "$cmd"
  10070.             eval "func_echo $func_quote_for_expand_result"
  10071.           }
  10072.           $opt_dry_run || eval "$cmd" || {
  10073.             lt_exit=$?
  10074.  
  10075.             # Restore the uninstalled library and exit
  10076.             if test relink = "$opt_mode"; then
  10077.               ( cd "$output_objdir" && \
  10078.                 $RM "${realname}T" && \
  10079.                 $MV "${realname}U" "$realname" )
  10080.             fi
  10081.  
  10082.             exit $lt_exit
  10083.           }
  10084.         done
  10085.         IFS=$save_ifs
  10086.  
  10087.         # Restore the uninstalled library and exit
  10088.         if test relink = "$opt_mode"; then
  10089.           $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  10090.  
  10091.           if test -n "$convenience"; then
  10092.             if test -z "$whole_archive_flag_spec"; then
  10093.               func_show_eval '${RM}r "$gentop"'
  10094.             fi
  10095.           fi
  10096.  
  10097.           exit $EXIT_SUCCESS
  10098.         fi
  10099.  
  10100.         # Create links to the real library.
  10101.         for linkname in $linknames; do
  10102.           if test "$realname" != "$linkname"; then
  10103.             func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  10104.           fi
  10105.         done
  10106.  
  10107.         # If -module or -export-dynamic was specified, set the dlname.
  10108.         if test yes = "$module" || test yes = "$export_dynamic"; then
  10109.           # On all known operating systems, these are identical.
  10110.           dlname=$soname
  10111.         fi
  10112.       fi
  10113.       ;;
  10114.  
  10115.     obj)
  10116.       if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  10117.         func_warning "'-dlopen' is ignored for objects"
  10118.       fi
  10119.  
  10120.       case " $deplibs" in
  10121.       *\ -l* | *\ -L*)
  10122.         func_warning "'-l' and '-L' are ignored for objects" ;;
  10123.       esac
  10124.  
  10125.       test -n "$rpath" && \
  10126.         func_warning "'-rpath' is ignored for objects"
  10127.  
  10128.       test -n "$xrpath" && \
  10129.         func_warning "'-R' is ignored for objects"
  10130.  
  10131.       test -n "$vinfo" && \
  10132.         func_warning "'-version-info' is ignored for objects"
  10133.  
  10134.       test -n "$release" && \
  10135.         func_warning "'-release' is ignored for objects"
  10136.  
  10137.       case $output in
  10138.       *.lo)
  10139.         test -n "$objs$old_deplibs" && \
  10140.           func_fatal_error "cannot build library object '$output' from non-libtool objects"
  10141.  
  10142.         libobj=$output
  10143.         func_lo2o "$libobj"
  10144.         obj=$func_lo2o_result
  10145.         ;;
  10146.       *)
  10147.         libobj=
  10148.         obj=$output
  10149.         ;;
  10150.       esac
  10151.  
  10152.       # Delete the old objects.
  10153.       $opt_dry_run || $RM $obj $libobj
  10154.  
  10155.       # Objects from convenience libraries.  This assumes
  10156.       # single-version convenience libraries.  Whenever we create
  10157.       # different ones for PIC/non-PIC, this we'll have to duplicate
  10158.       # the extraction.
  10159.       reload_conv_objs=
  10160.       gentop=
  10161.       # if reload_cmds runs $LD directly, get rid of -Wl from
  10162.       # whole_archive_flag_spec and hope we can get by with turning comma
  10163.       # into space.
  10164.       case $reload_cmds in
  10165.         *\$LD[\ \$]*) wl= ;;
  10166.       esac
  10167.       if test -n "$convenience"; then
  10168.         if test -n "$whole_archive_flag_spec"; then
  10169.           eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  10170.           test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  10171.           reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  10172.         else
  10173.           gentop=$output_objdir/${obj}x
  10174.           func_append generated " $gentop"
  10175.  
  10176.           func_extract_archives $gentop $convenience
  10177.           reload_conv_objs="$reload_objs $func_extract_archives_result"
  10178.         fi
  10179.       fi
  10180.  
  10181.       # If we're not building shared, we need to use non_pic_objs
  10182.       test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  10183.  
  10184.       # Create the old-style object.
  10185.       reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  10186.  
  10187.       output=$obj
  10188.       func_execute_cmds "$reload_cmds" 'exit $?'
  10189.  
  10190.       # Exit if we aren't doing a library object file.
  10191.       if test -z "$libobj"; then
  10192.         if test -n "$gentop"; then
  10193.           func_show_eval '${RM}r "$gentop"'
  10194.         fi
  10195.  
  10196.         exit $EXIT_SUCCESS
  10197.       fi
  10198.  
  10199.       test yes = "$build_libtool_libs" || {
  10200.         if test -n "$gentop"; then
  10201.           func_show_eval '${RM}r "$gentop"'
  10202.         fi
  10203.  
  10204.         # Create an invalid libtool object if no PIC, so that we don't
  10205.         # accidentally link it into a program.
  10206.         # $show "echo timestamp > $libobj"
  10207.         # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  10208.         exit $EXIT_SUCCESS
  10209.       }
  10210.  
  10211.       if test -n "$pic_flag" || test default != "$pic_mode"; then
  10212.         # Only do commands if we really have different PIC objects.
  10213.         reload_objs="$libobjs $reload_conv_objs"
  10214.         output=$libobj
  10215.         func_execute_cmds "$reload_cmds" 'exit $?'
  10216.       fi
  10217.  
  10218.       if test -n "$gentop"; then
  10219.         func_show_eval '${RM}r "$gentop"'
  10220.       fi
  10221.  
  10222.       exit $EXIT_SUCCESS
  10223.       ;;
  10224.  
  10225.     prog)
  10226.       case $host in
  10227.         *cygwin* | *msys*) func_stripname '' '.exe' "$output"
  10228.                   output=$func_stripname_result.exe;;
  10229.       esac
  10230.       test -n "$vinfo" && \
  10231.         func_warning "'-version-info' is ignored for programs"
  10232.  
  10233.       test -n "$release" && \
  10234.         func_warning "'-release' is ignored for programs"
  10235.  
  10236.       $preload \
  10237.         && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  10238.         && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  10239.  
  10240.       case $host in
  10241.       *-*-rhapsody* | *-*-darwin1.[012])
  10242.         # On Rhapsody replace the C library is the System framework
  10243.         compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  10244.         finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  10245.         ;;
  10246.       esac
  10247.  
  10248.       case $host in
  10249.       *-*-darwin*)
  10250.         # Don't allow lazy linking, it breaks C++ global constructors
  10251.         # But is supposedly fixed on 10.4 or later (yay!).
  10252.         if test CXX = "$tagname"; then
  10253.           case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  10254.             10.[0123])
  10255.               func_append compile_command " $wl-bind_at_load"
  10256.               func_append finalize_command " $wl-bind_at_load"
  10257.             ;;
  10258.           esac
  10259.         fi
  10260.         # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  10261.         compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  10262.         finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  10263.         ;;
  10264.       esac
  10265.  
  10266.  
  10267.       # move library search paths that coincide with paths to not yet
  10268.       # installed libraries to the beginning of the library search list
  10269.       new_libs=
  10270.       for path in $notinst_path; do
  10271.         case " $new_libs " in
  10272.         *" -L$path/$objdir "*) ;;
  10273.         *)
  10274.           case " $compile_deplibs " in
  10275.           *" -L$path/$objdir "*)
  10276.             func_append new_libs " -L$path/$objdir" ;;
  10277.           esac
  10278.           ;;
  10279.         esac
  10280.       done
  10281.       for deplib in $compile_deplibs; do
  10282.         case $deplib in
  10283.         -L*)
  10284.           case " $new_libs " in
  10285.           *" $deplib "*) ;;
  10286.           *) func_append new_libs " $deplib" ;;
  10287.           esac
  10288.           ;;
  10289.         *) func_append new_libs " $deplib" ;;
  10290.         esac
  10291.       done
  10292.       compile_deplibs=$new_libs
  10293.  
  10294.  
  10295.       func_append compile_command " $compile_deplibs"
  10296.       func_append finalize_command " $finalize_deplibs"
  10297.  
  10298.       if test -n "$rpath$xrpath"; then
  10299.         # If the user specified any rpath flags, then add them.
  10300.         for libdir in $rpath $xrpath; do
  10301.           # This is the magic to use -rpath.
  10302.           case "$finalize_rpath " in
  10303.           *" $libdir "*) ;;
  10304.           *) func_append finalize_rpath " $libdir" ;;
  10305.           esac
  10306.         done
  10307.       fi
  10308.  
  10309.       # Now hardcode the library paths
  10310.       rpath=
  10311.       hardcode_libdirs=
  10312.       for libdir in $compile_rpath $finalize_rpath; do
  10313.         if test -n "$hardcode_libdir_flag_spec"; then
  10314.           if test -n "$hardcode_libdir_separator"; then
  10315.             if test -z "$hardcode_libdirs"; then
  10316.               hardcode_libdirs=$libdir
  10317.             else
  10318.               # Just accumulate the unique libdirs.
  10319.               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  10320.               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  10321.                 ;;
  10322.               *)
  10323.                 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  10324.                 ;;
  10325.               esac
  10326.             fi
  10327.           else
  10328.             eval flag=\"$hardcode_libdir_flag_spec\"
  10329.             func_append rpath " $flag"
  10330.           fi
  10331.         elif test -n "$runpath_var"; then
  10332.           case "$perm_rpath " in
  10333.           *" $libdir "*) ;;
  10334.           *) func_append perm_rpath " $libdir" ;;
  10335.           esac
  10336.         fi
  10337.         case $host in
  10338.         *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  10339.           testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  10340.           case :$dllsearchpath: in
  10341.           *":$libdir:"*) ;;
  10342.           ::) dllsearchpath=$libdir;;
  10343.           *) func_append dllsearchpath ":$libdir";;
  10344.           esac
  10345.           case :$dllsearchpath: in
  10346.           *":$testbindir:"*) ;;
  10347.           ::) dllsearchpath=$testbindir;;
  10348.           *) func_append dllsearchpath ":$testbindir";;
  10349.           esac
  10350.           ;;
  10351.         esac
  10352.       done
  10353.       # Substitute the hardcoded libdirs into the rpath.
  10354.       if test -n "$hardcode_libdir_separator" &&
  10355.          test -n "$hardcode_libdirs"; then
  10356.         libdir=$hardcode_libdirs
  10357.         eval rpath=\" $hardcode_libdir_flag_spec\"
  10358.       fi
  10359.       compile_rpath=$rpath
  10360.  
  10361.       rpath=
  10362.       hardcode_libdirs=
  10363.       for libdir in $finalize_rpath; do
  10364.         if test -n "$hardcode_libdir_flag_spec"; then
  10365.           if test -n "$hardcode_libdir_separator"; then
  10366.             if test -z "$hardcode_libdirs"; then
  10367.               hardcode_libdirs=$libdir
  10368.             else
  10369.               # Just accumulate the unique libdirs.
  10370.               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  10371.               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  10372.                 ;;
  10373.               *)
  10374.                 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  10375.                 ;;
  10376.               esac
  10377.             fi
  10378.           else
  10379.             eval flag=\"$hardcode_libdir_flag_spec\"
  10380.             func_append rpath " $flag"
  10381.           fi
  10382.         elif test -n "$runpath_var"; then
  10383.           case "$finalize_perm_rpath " in
  10384.           *" $libdir "*) ;;
  10385.           *) func_append finalize_perm_rpath " $libdir" ;;
  10386.           esac
  10387.         fi
  10388.       done
  10389.       # Substitute the hardcoded libdirs into the rpath.
  10390.       if test -n "$hardcode_libdir_separator" &&
  10391.          test -n "$hardcode_libdirs"; then
  10392.         libdir=$hardcode_libdirs
  10393.         eval rpath=\" $hardcode_libdir_flag_spec\"
  10394.       fi
  10395.       finalize_rpath=$rpath
  10396.  
  10397.       if test -n "$libobjs" && test yes = "$build_old_libs"; then
  10398.         # Transform all the library objects into standard objects.
  10399.         compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  10400.         finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  10401.       fi
  10402.  
  10403.       func_generate_dlsyms "$outputname" "@PROGRAM@" false
  10404.  
  10405.       # template prelinking step
  10406.       if test -n "$prelink_cmds"; then
  10407.         func_execute_cmds "$prelink_cmds" 'exit $?'
  10408.       fi
  10409.  
  10410.       wrappers_required=:
  10411.       case $host in
  10412.       *cegcc* | *mingw32ce*)
  10413.         # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  10414.         wrappers_required=false
  10415.         ;;
  10416.       *cygwin* | *msys* | *mingw* )
  10417.         test yes = "$build_libtool_libs" || wrappers_required=false
  10418.         ;;
  10419.       *)
  10420.         if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  10421.           wrappers_required=false
  10422.         fi
  10423.         ;;
  10424.       esac
  10425.       $wrappers_required || {
  10426.         # Replace the output file specification.
  10427.         compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  10428.         link_command=$compile_command$compile_rpath
  10429.  
  10430.         # We have no uninstalled library dependencies, so finalize right now.
  10431.         exit_status=0
  10432.         func_show_eval "$link_command" 'exit_status=$?'
  10433.  
  10434.         if test -n "$postlink_cmds"; then
  10435.           func_to_tool_file "$output"
  10436.           postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  10437.           func_execute_cmds "$postlink_cmds" 'exit $?'
  10438.         fi
  10439.  
  10440.         # Delete the generated files.
  10441.         if test -f "$output_objdir/${outputname}S.$objext"; then
  10442.           func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  10443.         fi
  10444.  
  10445.         exit $exit_status
  10446.       }
  10447.  
  10448.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  10449.         compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  10450.       fi
  10451.       if test -n "$finalize_shlibpath"; then
  10452.         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  10453.       fi
  10454.  
  10455.       compile_var=
  10456.       finalize_var=
  10457.       if test -n "$runpath_var"; then
  10458.         if test -n "$perm_rpath"; then
  10459.           # We should set the runpath_var.
  10460.           rpath=
  10461.           for dir in $perm_rpath; do
  10462.             func_append rpath "$dir:"
  10463.           done
  10464.           compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  10465.         fi
  10466.         if test -n "$finalize_perm_rpath"; then
  10467.           # We should set the runpath_var.
  10468.           rpath=
  10469.           for dir in $finalize_perm_rpath; do
  10470.             func_append rpath "$dir:"
  10471.           done
  10472.           finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  10473.         fi
  10474.       fi
  10475.  
  10476.       if test yes = "$no_install"; then
  10477.         # We don't need to create a wrapper script.
  10478.         link_command=$compile_var$compile_command$compile_rpath
  10479.         # Replace the output file specification.
  10480.         link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  10481.         # Delete the old output file.
  10482.         $opt_dry_run || $RM $output
  10483.         # Link the executable and exit
  10484.         func_show_eval "$link_command" 'exit $?'
  10485.  
  10486.         if test -n "$postlink_cmds"; then
  10487.           func_to_tool_file "$output"
  10488.           postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  10489.           func_execute_cmds "$postlink_cmds" 'exit $?'
  10490.         fi
  10491.  
  10492.         exit $EXIT_SUCCESS
  10493.       fi
  10494.  
  10495.       case $hardcode_action,$fast_install in
  10496.         relink,*)
  10497.           # Fast installation is not supported
  10498.           link_command=$compile_var$compile_command$compile_rpath
  10499.           relink_command=$finalize_var$finalize_command$finalize_rpath
  10500.  
  10501.           func_warning "this platform does not like uninstalled shared libraries"
  10502.           func_warning "'$output' will be relinked during installation"
  10503.           ;;
  10504.         *,yes)
  10505.           link_command=$finalize_var$compile_command$finalize_rpath
  10506.           relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  10507.           ;;
  10508.         *,no)
  10509.           link_command=$compile_var$compile_command$compile_rpath
  10510.           relink_command=$finalize_var$finalize_command$finalize_rpath
  10511.           ;;
  10512.         *,needless)
  10513.           link_command=$finalize_var$compile_command$finalize_rpath
  10514.           relink_command=
  10515.           ;;
  10516.       esac
  10517.  
  10518.       # Replace the output file specification.
  10519.       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  10520.  
  10521.       # Delete the old output files.
  10522.       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  10523.  
  10524.       func_show_eval "$link_command" 'exit $?'
  10525.  
  10526.       if test -n "$postlink_cmds"; then
  10527.         func_to_tool_file "$output_objdir/$outputname"
  10528.         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'`
  10529.         func_execute_cmds "$postlink_cmds" 'exit $?'
  10530.       fi
  10531.  
  10532.       # Now create the wrapper script.
  10533.       func_verbose "creating $output"
  10534.  
  10535.       # Quote the relink command for shipping.
  10536.       if test -n "$relink_command"; then
  10537.         # Preserve any variables that may affect compiler behavior
  10538.         for var in $variables_saved_for_relink; do
  10539.           if eval test -z \"\${$var+set}\"; then
  10540.             relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  10541.           elif eval var_value=\$$var; test -z "$var_value"; then
  10542.             relink_command="$var=; export $var; $relink_command"
  10543.           else
  10544.             func_quote_for_eval "$var_value"
  10545.             relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  10546.           fi
  10547.         done
  10548.         relink_command="(cd `pwd`; $relink_command)"
  10549.         relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  10550.       fi
  10551.  
  10552.       # Only actually do things if not in dry run mode.
  10553.       $opt_dry_run || {
  10554.         # win32 will think the script is a binary if it has
  10555.         # a .exe suffix, so we strip it off here.
  10556.         case $output in
  10557.           *.exe) func_stripname '' '.exe' "$output"
  10558.                  output=$func_stripname_result ;;
  10559.         esac
  10560.         # test for cygwin because mv fails w/o .exe extensions
  10561.         case $host in
  10562.           *cygwin* | *msys*)
  10563.             exeext=.exe
  10564.             func_stripname '' '.exe' "$outputname"
  10565.             outputname=$func_stripname_result ;;
  10566.           *) exeext= ;;
  10567.         esac
  10568.         case $host in
  10569.           *cygwin* | *msys* | *mingw* )
  10570.             func_dirname_and_basename "$output" "" "."
  10571.             output_name=$func_basename_result
  10572.             output_path=$func_dirname_result
  10573.             cwrappersource=$output_path/$objdir/lt-$output_name.c
  10574.             cwrapper=$output_path/$output_name.exe
  10575.             $RM $cwrappersource $cwrapper
  10576.             trap "$RM $cwrappersource $cwrapper $cwrapper.manifest; exit $EXIT_FAILURE" 1 2 15
  10577.  
  10578.             func_emit_cwrapperexe_src > $cwrappersource
  10579.  
  10580.             # The wrapper executable is built using the $host compiler,
  10581.             # because it contains $host paths and files. If cross-
  10582.             # compiling, it, like the target executable, must be
  10583.             # executed on the $host or under an emulation environment.
  10584.             $opt_dry_run || {
  10585.               $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  10586.               $STRIP $cwrapper
  10587.             }
  10588.  
  10589.             # Now, create the wrapper script for func_source use:
  10590.             func_ltwrapper_scriptname $cwrapper
  10591.             $RM $func_ltwrapper_scriptname_result
  10592.             trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  10593.             $opt_dry_run || {
  10594.               # note: this script will not be executed, so do not chmod.
  10595.               if test "x$build" = "x$host"; then
  10596.                 # Create the UAC manifests first if necessary (but the
  10597.                 # manifest files must have executable permission regardless).
  10598.                 case $output_name in
  10599.                   *instal*|*patch*|*setup*|*update*)
  10600.                     func_emit_exe_manifest > $cwrapper.manifest
  10601.                     func_emit_exe_manifest > $output_path/$objdir/$output_name.exe.manifest
  10602.                     chmod +x $cwrapper.manifest
  10603.                     chmod +x $output_path/$objdir/$output_name.exe.manifest
  10604.                   ;;
  10605.                 esac
  10606.                 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  10607.               else
  10608.                 func_emit_wrapper no > $func_ltwrapper_scriptname_result
  10609.               fi
  10610.             }
  10611.           ;;
  10612.           * )
  10613.             $RM $output
  10614.             trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  10615.  
  10616.             func_emit_wrapper no > $output
  10617.             chmod +x $output
  10618.           ;;
  10619.         esac
  10620.       }
  10621.       exit $EXIT_SUCCESS
  10622.       ;;
  10623.     esac
  10624.  
  10625.     # See if we need to build an old-fashioned archive.
  10626.     for oldlib in $oldlibs; do
  10627.  
  10628.       case $build_libtool_libs in
  10629.         convenience)
  10630.           oldobjs="$libobjs_save $symfileobj"
  10631.           addlibs=$convenience
  10632.           build_libtool_libs=no
  10633.           ;;
  10634.         module)
  10635.           oldobjs=$libobjs_save
  10636.           addlibs=$old_convenience
  10637.           build_libtool_libs=no
  10638.           ;;
  10639.         *)
  10640.           oldobjs="$old_deplibs $non_pic_objects"
  10641.           $preload && test -f "$symfileobj" \
  10642.             && func_append oldobjs " $symfileobj"
  10643.           addlibs=$old_convenience
  10644.           ;;
  10645.       esac
  10646.  
  10647.       if test -n "$addlibs"; then
  10648.         gentop=$output_objdir/${outputname}x
  10649.         func_append generated " $gentop"
  10650.  
  10651.         func_extract_archives $gentop $addlibs
  10652.         func_append oldobjs " $func_extract_archives_result"
  10653.       fi
  10654.  
  10655.       # Do each command in the archive commands.
  10656.       if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  10657.         cmds=$old_archive_from_new_cmds
  10658.       else
  10659.  
  10660.         # Add any objects from preloaded convenience libraries
  10661.         if test -n "$dlprefiles"; then
  10662.           gentop=$output_objdir/${outputname}x
  10663.           func_append generated " $gentop"
  10664.  
  10665.           func_extract_archives $gentop $dlprefiles
  10666.           func_append oldobjs " $func_extract_archives_result"
  10667.         fi
  10668.  
  10669.         # POSIX demands no paths to be encoded in archives.  We have
  10670.         # to avoid creating archives with duplicate basenames if we
  10671.         # might have to extract them afterwards, e.g., when creating a
  10672.         # static archive out of a convenience library, or when linking
  10673.         # the entirety of a libtool archive into another (currently
  10674.         # not supported by libtool).
  10675.         if (for obj in $oldobjs
  10676.             do
  10677.               func_basename "$obj"
  10678.               $ECHO "$func_basename_result"
  10679.             done | sort | sort -uc >/dev/null 2>&1); then
  10680.           :
  10681.         else
  10682.           echo "copying selected object files to avoid basename conflicts..."
  10683.           gentop=$output_objdir/${outputname}x
  10684.           func_append generated " $gentop"
  10685.           func_mkdir_p "$gentop"
  10686.           save_oldobjs=$oldobjs
  10687.           oldobjs=
  10688.           counter=1
  10689.           for obj in $save_oldobjs
  10690.           do
  10691.             func_basename "$obj"
  10692.             objbase=$func_basename_result
  10693.             case " $oldobjs " in
  10694.             " ") oldobjs=$obj ;;
  10695.             *[\ /]"$objbase "*)
  10696.               while :; do
  10697.                 # Make sure we don't pick an alternate name that also
  10698.                 # overlaps.
  10699.                 newobj=lt$counter-$objbase
  10700.                 func_arith $counter + 1
  10701.                 counter=$func_arith_result
  10702.                 case " $oldobjs " in
  10703.                 *[\ /]"$newobj "*) ;;
  10704.                 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  10705.                 esac
  10706.               done
  10707.               func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  10708.               func_append oldobjs " $gentop/$newobj"
  10709.               ;;
  10710.             *) func_append oldobjs " $obj" ;;
  10711.             esac
  10712.           done
  10713.         fi
  10714.         func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  10715.         tool_oldlib=$func_to_tool_file_result
  10716.         eval cmds=\"$old_archive_cmds\"
  10717.  
  10718.         func_len " $cmds"
  10719.         len=$func_len_result
  10720.         if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  10721.           cmds=$old_archive_cmds
  10722.         elif test -n "$archiver_list_spec"; then
  10723.           func_verbose "using command file archive linking..."
  10724.           for obj in $oldobjs
  10725.           do
  10726.             func_to_tool_file "$obj"
  10727.             $ECHO "$func_to_tool_file_result"
  10728.           done > $output_objdir/$libname.libcmd
  10729.           func_to_tool_file "$output_objdir/$libname.libcmd"
  10730.           oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  10731.           cmds=$old_archive_cmds
  10732.         else
  10733.           # the command line is too long to link in one step, link in parts
  10734.           func_verbose "using piecewise archive linking..."
  10735.           save_RANLIB=$RANLIB
  10736.           RANLIB=:
  10737.           objlist=
  10738.           concat_cmds=
  10739.           save_oldobjs=$oldobjs
  10740.           oldobjs=
  10741.           # Is there a better way of finding the last object in the list?
  10742.           for obj in $save_oldobjs
  10743.           do
  10744.             last_oldobj=$obj
  10745.           done
  10746.           eval test_cmds=\"$old_archive_cmds\"
  10747.           func_len " $test_cmds"
  10748.           len0=$func_len_result
  10749.           len=$len0
  10750.           for obj in $save_oldobjs
  10751.           do
  10752.             func_len " $obj"
  10753.             func_arith $len + $func_len_result
  10754.             len=$func_arith_result
  10755.             func_append objlist " $obj"
  10756.             if test "$len" -lt "$max_cmd_len"; then
  10757.               :
  10758.             else
  10759.               # the above command should be used before it gets too long
  10760.               oldobjs=$objlist
  10761.               if test "$obj" = "$last_oldobj"; then
  10762.                 RANLIB=$save_RANLIB
  10763.               fi
  10764.               test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  10765.               eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  10766.               objlist=
  10767.               len=$len0
  10768.             fi
  10769.           done
  10770.           RANLIB=$save_RANLIB
  10771.           oldobjs=$objlist
  10772.           if test -z "$oldobjs"; then
  10773.             eval cmds=\"\$concat_cmds\"
  10774.           else
  10775.             eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  10776.           fi
  10777.         fi
  10778.       fi
  10779.       func_execute_cmds "$cmds" 'exit $?'
  10780.     done
  10781.  
  10782.     test -n "$generated" && \
  10783.       func_show_eval "${RM}r$generated"
  10784.  
  10785.     # Now create the libtool archive.
  10786.     case $output in
  10787.     *.la)
  10788.       old_library=
  10789.       test yes = "$build_old_libs" && old_library=$libname.$libext
  10790.       func_verbose "creating $output"
  10791.  
  10792.       # Preserve any variables that may affect compiler behavior
  10793.       for var in $variables_saved_for_relink; do
  10794.         if eval test -z \"\${$var+set}\"; then
  10795.           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  10796.         elif eval var_value=\$$var; test -z "$var_value"; then
  10797.           relink_command="$var=; export $var; $relink_command"
  10798.         else
  10799.           func_quote_for_eval "$var_value"
  10800.           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  10801.         fi
  10802.       done
  10803.       # Quote the link command for shipping.
  10804.       relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  10805.       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  10806.       if test yes = "$hardcode_automatic"; then
  10807.         relink_command=
  10808.       fi
  10809.  
  10810.       # Only create the output if not a dry run.
  10811.       $opt_dry_run || {
  10812.         for installed in no yes; do
  10813.           if test yes = "$installed"; then
  10814.             if test -z "$install_libdir"; then
  10815.               break
  10816.             fi
  10817.             output=$output_objdir/${outputname}i
  10818.             # Replace all uninstalled libtool libraries with the installed ones
  10819.             newdependency_libs=
  10820.             for deplib in $dependency_libs; do
  10821.               case $deplib in
  10822.               *.la)
  10823.                 func_basename "$deplib"
  10824.                 name=$func_basename_result
  10825.                 func_resolve_sysroot "$deplib"
  10826.                 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  10827.                 test -z "$libdir" && \
  10828.                   func_fatal_error "'$deplib' is not a valid libtool archive"
  10829.                 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  10830.                 ;;
  10831.               -L*)
  10832.                 func_stripname -L '' "$deplib"
  10833.                 func_replace_sysroot "$func_stripname_result"
  10834.                 func_append newdependency_libs " -L$func_replace_sysroot_result"
  10835.                 ;;
  10836.               -R*)
  10837.                 func_stripname -R '' "$deplib"
  10838.                 func_replace_sysroot "$func_stripname_result"
  10839.                 func_append newdependency_libs " -R$func_replace_sysroot_result"
  10840.                 ;;
  10841.               *) func_append newdependency_libs " $deplib" ;;
  10842.               esac
  10843.             done
  10844.             dependency_libs=$newdependency_libs
  10845.             newdlfiles=
  10846.  
  10847.             for lib in $dlfiles; do
  10848.               case $lib in
  10849.               *.la)
  10850.                 func_basename "$lib"
  10851.                 name=$func_basename_result
  10852.                 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10853.                 test -z "$libdir" && \
  10854.                   func_fatal_error "'$lib' is not a valid libtool archive"
  10855.                 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  10856.                 ;;
  10857.               *) func_append newdlfiles " $lib" ;;
  10858.               esac
  10859.             done
  10860.             dlfiles=$newdlfiles
  10861.             newdlprefiles=
  10862.             for lib in $dlprefiles; do
  10863.               case $lib in
  10864.               *.la)
  10865.                 # Only pass preopened files to the pseudo-archive (for
  10866.                 # eventual linking with the app. that links it) if we
  10867.                 # didn't already link the preopened objects directly into
  10868.                 # the library:
  10869.                 func_basename "$lib"
  10870.                 name=$func_basename_result
  10871.                 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10872.                 test -z "$libdir" && \
  10873.                   func_fatal_error "'$lib' is not a valid libtool archive"
  10874.                 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  10875.                 ;;
  10876.               esac
  10877.             done
  10878.             dlprefiles=$newdlprefiles
  10879.           else
  10880.             newdlfiles=
  10881.             for lib in $dlfiles; do
  10882.               case $lib in
  10883.                 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10884.                 *) abs=`pwd`"/$lib" ;;
  10885.               esac
  10886.               func_append newdlfiles " $abs"
  10887.             done
  10888.             dlfiles=$newdlfiles
  10889.             newdlprefiles=
  10890.             for lib in $dlprefiles; do
  10891.               case $lib in
  10892.                 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10893.                 *) abs=`pwd`"/$lib" ;;
  10894.               esac
  10895.               func_append newdlprefiles " $abs"
  10896.             done
  10897.             dlprefiles=$newdlprefiles
  10898.           fi
  10899.           $RM $output
  10900.           # place dlname in correct position for cygwin
  10901.           # In fact, it would be nice if we could use this code for all target
  10902.           # systems that can't hard-code library paths into their executables
  10903.           # and that have no shared library path variable independent of PATH,
  10904.           # but it turns out we can't easily determine that from inspecting
  10905.           # libtool variables, so we have to hard-code the OSs to which it
  10906.           # applies here; at the moment, that means platforms that use the PE
  10907.           # object format with DLL files.  See the long comment at the top of
  10908.           # tests/bindir.at for full details.
  10909.           tdlname=$dlname
  10910.           case $host,$output,$installed,$module,$dlname in
  10911.             *cygwin*,*lai,yes,no,*.dll | *msys*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  10912.               # If a -bindir argument was supplied, place the dll there.
  10913.               if test -n "$bindir"; then
  10914.                 func_relative_path "$install_libdir" "$bindir"
  10915.                 tdlname=$func_relative_path_result/$dlname
  10916.               else
  10917.                 # Otherwise fall back on heuristic.
  10918.                 tdlname=../bin/$dlname
  10919.               fi
  10920.               ;;
  10921.           esac
  10922.           $ECHO > $output "\
  10923. # $outputname - a libtool library file
  10924. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  10925. #
  10926. # Please DO NOT delete this file!
  10927. # It is necessary for linking the library.
  10928.  
  10929. # The name that we can dlopen(3).
  10930. dlname='$tdlname'
  10931.  
  10932. # Names of this library.
  10933. library_names='$library_names'
  10934.  
  10935. # The name of the static archive.
  10936. old_library='$old_library'
  10937.  
  10938. # Linker flags that cannot go in dependency_libs.
  10939. inherited_linker_flags='$new_inherited_linker_flags'
  10940.  
  10941. # Libraries that this one depends upon.
  10942. dependency_libs='$dependency_libs'
  10943.  
  10944. # Names of additional weak libraries provided by this library
  10945. weak_library_names='$weak_libs'
  10946.  
  10947. # Version information for $libname.
  10948. current=$current
  10949. age=$age
  10950. revision=$revision
  10951.  
  10952. # Is this an already installed library?
  10953. installed=$installed
  10954.  
  10955. # Should we warn about portability when linking against -modules?
  10956. shouldnotlink=$module
  10957.  
  10958. # Files to dlopen/dlpreopen
  10959. dlopen='$dlfiles'
  10960. dlpreopen='$dlprefiles'
  10961.  
  10962. # Directory that this library needs to be installed in:
  10963. libdir='$install_libdir'"
  10964.           if test no,yes = "$installed,$need_relink"; then
  10965.             $ECHO >> $output "\
  10966. relink_command=\"$relink_command\""
  10967.           fi
  10968.         done
  10969.       }
  10970.  
  10971.       # Do a symbolic link so that the libtool archive can be found in
  10972.       # LD_LIBRARY_PATH before the program is installed.
  10973.       func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10974.       ;;
  10975.     esac
  10976.     exit $EXIT_SUCCESS
  10977. }
  10978.  
  10979. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10980.   func_mode_link ${1+"$@"}
  10981. fi
  10982.  
  10983.  
  10984. # func_mode_uninstall arg...
  10985. func_mode_uninstall ()
  10986. {
  10987.     $debug_cmd
  10988.  
  10989.     RM=$nonopt
  10990.     files=
  10991.     rmforce=false
  10992.     exit_status=0
  10993.  
  10994.     # This variable tells wrapper scripts just to set variables rather
  10995.     # than running their programs.
  10996.     libtool_install_magic=$magic
  10997.  
  10998.     for arg
  10999.     do
  11000.       case $arg in
  11001.       -f) func_append RM " $arg"; rmforce=: ;;
  11002.       -*) func_append RM " $arg" ;;
  11003.       *) func_append files " $arg" ;;
  11004.       esac
  11005.     done
  11006.  
  11007.     test -z "$RM" && \
  11008.       func_fatal_help "you must specify an RM program"
  11009.  
  11010.     rmdirs=
  11011.  
  11012.     for file in $files; do
  11013.       func_dirname "$file" "" "."
  11014.       dir=$func_dirname_result
  11015.       if test . = "$dir"; then
  11016.         odir=$objdir
  11017.       else
  11018.         odir=$dir/$objdir
  11019.       fi
  11020.       func_basename "$file"
  11021.       name=$func_basename_result
  11022.       test uninstall = "$opt_mode" && odir=$dir
  11023.  
  11024.       # Remember odir for removal later, being careful to avoid duplicates
  11025.       if test clean = "$opt_mode"; then
  11026.         case " $rmdirs " in
  11027.           *" $odir "*) ;;
  11028.           *) func_append rmdirs " $odir" ;;
  11029.         esac
  11030.       fi
  11031.  
  11032.       # Don't error if the file doesn't exist and rm -f was used.
  11033.       if { test -L "$file"; } >/dev/null 2>&1 ||
  11034.          { test -h "$file"; } >/dev/null 2>&1 ||
  11035.          test -f "$file"; then
  11036.         :
  11037.       elif test -d "$file"; then
  11038.         exit_status=1
  11039.         continue
  11040.       elif $rmforce; then
  11041.         continue
  11042.       fi
  11043.  
  11044.       rmfiles=$file
  11045.  
  11046.       case $name in
  11047.       *.la)
  11048.         # Possibly a libtool archive, so verify it.
  11049.         if func_lalib_p "$file"; then
  11050.           func_source $dir/$name
  11051.  
  11052.           # Delete the libtool libraries and symlinks.
  11053.           for n in $library_names; do
  11054.             func_append rmfiles " $odir/$n"
  11055.           done
  11056.           test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  11057.  
  11058.           case $opt_mode in
  11059.           clean)
  11060.             case " $library_names " in
  11061.             *" $dlname "*) ;;
  11062.             *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  11063.             esac
  11064.             test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  11065.             ;;
  11066.           uninstall)
  11067.             if test -n "$library_names"; then
  11068.               # Do each command in the postuninstall commands.
  11069.               func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  11070.             fi
  11071.  
  11072.             if test -n "$old_library"; then
  11073.               # Do each command in the old_postuninstall commands.
  11074.               func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  11075.             fi
  11076.             # FIXME: should reinstall the best remaining shared library.
  11077.             ;;
  11078.           esac
  11079.         fi
  11080.         ;;
  11081.  
  11082.       *.lo)
  11083.         # Possibly a libtool object, so verify it.
  11084.         if func_lalib_p "$file"; then
  11085.  
  11086.           # Read the .lo file
  11087.           func_source $dir/$name
  11088.  
  11089.           # Add PIC object to the list of files to remove.
  11090.           if test -n "$pic_object" && test none != "$pic_object"; then
  11091.             func_append rmfiles " $dir/$pic_object"
  11092.           fi
  11093.  
  11094.           # Add non-PIC object to the list of files to remove.
  11095.           if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  11096.             func_append rmfiles " $dir/$non_pic_object"
  11097.           fi
  11098.         fi
  11099.         ;;
  11100.  
  11101.       *)
  11102.         if test clean = "$opt_mode"; then
  11103.           noexename=$name
  11104.           case $file in
  11105.           *.exe)
  11106.             func_stripname '' '.exe' "$file"
  11107.             file=$func_stripname_result
  11108.             func_stripname '' '.exe' "$name"
  11109.             noexename=$func_stripname_result
  11110.             # $file with .exe has already been added to rmfiles,
  11111.             # add $file without .exe
  11112.             func_append rmfiles " $file"
  11113.             ;;
  11114.           esac
  11115.           # Do a test to see if this is a libtool program.
  11116.           if func_ltwrapper_p "$file"; then
  11117.             if func_ltwrapper_executable_p "$file"; then
  11118.               func_ltwrapper_scriptname "$file"
  11119.               relink_command=
  11120.               func_source $func_ltwrapper_scriptname_result
  11121.               func_append rmfiles " $func_ltwrapper_scriptname_result"
  11122.             else
  11123.               relink_command=
  11124.               func_source $dir/$noexename
  11125.             fi
  11126.  
  11127.             # note $name still contains .exe if it was in $file originally
  11128.             # as does the version of $file that was added into $rmfiles
  11129.             func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  11130.             func_append rmfiles " ${name}.manifest $objdir/${name}.manifest"
  11131.             if test yes = "$fast_install" && test -n "$relink_command"; then
  11132.               func_append rmfiles " $odir/lt-$name $objdir/lt-${name}.manifest"
  11133.             fi
  11134.             if test "X$noexename" != "X$name"; then
  11135.               func_append rmfiles " $odir/lt-$noexename.c"
  11136.             fi
  11137.           fi
  11138.         fi
  11139.         ;;
  11140.       esac
  11141.       func_show_eval "$RM $rmfiles" 'exit_status=1'
  11142.     done
  11143.  
  11144.     # Try to remove the $objdir's in the directories where we deleted files
  11145.     for dir in $rmdirs; do
  11146.       if test -d "$dir"; then
  11147.         func_show_eval "rmdir $dir >/dev/null 2>&1"
  11148.       fi
  11149.     done
  11150.  
  11151.     exit $exit_status
  11152. }
  11153.  
  11154. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  11155.   func_mode_uninstall ${1+"$@"}
  11156. fi
  11157.  
  11158. test -z "$opt_mode" && {
  11159.   help=$generic_help
  11160.   func_fatal_help "you must specify a MODE"
  11161. }
  11162.  
  11163. test -z "$exec_cmd" && \
  11164.   func_fatal_help "invalid operation mode '$opt_mode'"
  11165.  
  11166. if test -n "$exec_cmd"; then
  11167.   eval exec "$exec_cmd"
  11168.   exit $EXIT_FAILURE
  11169. fi
  11170.  
  11171. exit $exit_status
  11172.  
  11173.  
  11174. # The TAGs below are defined such that we never get into a situation
  11175. # where we disable both kinds of libraries.  Given conflicting
  11176. # choices, we go for a static library, that is the most portable,
  11177. # since we can't tell whether shared libraries were disabled because
  11178. # the user asked for that or because the platform doesn't support
  11179. # them.  This is particularly important on AIX, because we don't
  11180. # support having both static and shared libraries enabled at the same
  11181. # time on that platform, so we default to a shared-only configuration.
  11182. # If a disable-shared tag is given, we'll fallback to a static-only
  11183. # configuration.  But we'll never go from static-only to shared-only.
  11184.  
  11185. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  11186. build_libtool_libs=no
  11187. build_old_libs=yes
  11188. # ### END LIBTOOL TAG CONFIG: disable-shared
  11189.  
  11190. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  11191. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  11192. # ### END LIBTOOL TAG CONFIG: disable-static
  11193.  
  11194. # Local Variables:
  11195. # mode:shell-script
  11196. # sh-indentation:2
  11197. # End:
  11198.