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