Annotation of embedaddon/sudo/ltmain.sh, revision 1.1.1.3

1.1.1.3 ! misho       1: #! /bin/sh
1.1       misho       2: 
1.1.1.3 ! misho       3: # libtool (GNU libtool) 2.4.2.418
        !             4: # Provide generalized library-building support services.
1.1       misho       5: # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
                      6: 
1.1.1.3 ! misho       7: # Copyright (C) 1996-2013 Free Software Foundation, Inc.
1.1       misho       8: # This is free software; see the source for copying conditions.  There is NO
                      9: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                     10: 
                     11: # GNU Libtool is free software; you can redistribute it and/or modify
                     12: # it under the terms of the GNU General Public License as published by
                     13: # the Free Software Foundation; either version 2 of the License, or
                     14: # (at your option) any later version.
                     15: #
                     16: # As a special exception to the GNU General Public License,
                     17: # if you distribute this file as part of a program or library that
                     18: # is built using GNU Libtool, you may include this file under the
                     19: # same distribution terms that you use for the rest of that program.
                     20: #
                     21: # GNU Libtool is distributed in the hope that it will be useful, but
                     22: # WITHOUT ANY WARRANTY; without even the implied warranty of
                     23: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     24: # General Public License for more details.
                     25: #
                     26: # You should have received a copy of the GNU General Public License
1.1.1.3 ! misho      27: # along with this program.  If not, see <http://www.gnu.org/licenses/>.
1.1       misho      28: 
                     29: 
                     30: PROGRAM=libtool
                     31: PACKAGE=libtool
1.1.1.3 ! misho      32: VERSION=2.4.2.418
        !            33: package_revision=2.4.2.418
1.1       misho      34: 
1.1.1.3 ! misho      35: 
        !            36: ## ------ ##
        !            37: ## Usage. ##
        !            38: ## ------ ##
        !            39: 
        !            40: # Run './libtool --help' for help with using this script from the
        !            41: # command line.
        !            42: 
        !            43: 
        !            44: ## ------------------------------- ##
        !            45: ## User overridable command paths. ##
        !            46: ## ------------------------------- ##
        !            47: 
        !            48: # After configure completes, it has a better idea of some of the
        !            49: # shell tools we need than the defaults used by the functions shared
        !            50: # with bootstrap, so set those here where they can still be over-
        !            51: # ridden by the user, but otherwise take precedence.
        !            52: 
        !            53: : ${AUTOCONF="autoconf"}
        !            54: : ${AUTOMAKE="automake"}
        !            55: 
        !            56: 
        !            57: ## -------------------------- ##
        !            58: ## Source external libraries. ##
        !            59: ## -------------------------- ##
        !            60: 
        !            61: # Much of our low-level functionality needs to be sourced from external
        !            62: # libraries, which are installed to $pkgauxdir.
        !            63: 
        !            64: # Set a version string for this script.
        !            65: scriptversion=2013-08-23.20; # UTC
        !            66: 
        !            67: # General shell script boiler plate, and helper functions.
        !            68: # Written by Gary V. Vaughan, 2004
        !            69: 
        !            70: # Copyright (C) 2004-2013 Free Software Foundation, Inc.
        !            71: # This is free software; see the source for copying conditions.  There is NO
        !            72: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
        !            73: 
        !            74: # This program is free software; you can redistribute it and/or modify
        !            75: # it under the terms of the GNU General Public License as published by
        !            76: # the Free Software Foundation; either version 3 of the License, or
        !            77: # (at your option) any later version.
        !            78: 
        !            79: # As a special exception to the GNU General Public License, if you distribute
        !            80: # this file as part of a program or library that is built using GNU Libtool,
        !            81: # you may include this file under the same distribution terms that you use
        !            82: # for the rest of that program.
        !            83: 
        !            84: # This program is distributed in the hope that it will be useful,
        !            85: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            86: # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
        !            87: # General Public License for more details.
        !            88: 
        !            89: # You should have received a copy of the GNU General Public License
        !            90: # along with this program. If not, see <http://www.gnu.org/licenses/>.
        !            91: 
        !            92: # Please report bugs or propose patches to gary@gnu.org.
        !            93: 
        !            94: 
        !            95: ## ------ ##
        !            96: ## Usage. ##
        !            97: ## ------ ##
        !            98: 
        !            99: # Evaluate this file near the top of your script to gain access to
        !           100: # the functions and variables defined here:
        !           101: #
        !           102: #   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
        !           103: #
        !           104: # If you need to override any of the default environment variable
        !           105: # settings, do that before evaluating this file.
        !           106: 
        !           107: 
        !           108: ## -------------------- ##
        !           109: ## Shell normalisation. ##
        !           110: ## -------------------- ##
        !           111: 
        !           112: # Some shells need a little help to be as Bourne compatible as possible.
        !           113: # Before doing anything else, make sure all that help has been provided!
        !           114: 
        !           115: DUALCASE=1; export DUALCASE # for MKS sh
        !           116: if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
1.1       misho     117:   emulate sh
                    118:   NULLCMD=:
1.1.1.3 ! misho     119:   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
1.1       misho     120:   # is contrary to our usage.  Disable this feature.
                    121:   alias -g '${1+"$@"}'='"$@"'
                    122:   setopt NO_GLOB_SUBST
                    123: else
1.1.1.3 ! misho     124:   case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
1.1       misho     125: fi
                    126: 
1.1.1.3 ! misho     127: # NLS nuisances: We save the old values in case they are required later.
        !           128: _G_user_locale=
        !           129: _G_safe_locale=
        !           130: for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1.1       misho     131: do
1.1.1.3 ! misho     132:   eval "if test set = \"\${$_G_var+set}\"; then
        !           133:           save_$_G_var=\$$_G_var
        !           134:           $_G_var=C
        !           135:          export $_G_var
        !           136:          _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
        !           137:          _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
1.1       misho     138:        fi"
                    139: done
                    140: 
1.1.1.3 ! misho     141: # CDPATH.
        !           142: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
1.1       misho     143: 
1.1.1.3 ! misho     144: # Make sure IFS has a sensible default
        !           145: sp=' '
        !           146: nl='
        !           147: '
        !           148: IFS="$sp       $nl"
1.1       misho     149: 
1.1.1.3 ! misho     150: # There are still modern systems that have problems with 'echo' mis-
        !           151: # handling backslashes, among others, so make sure $bs_echo is set to a
        !           152: # command that correctly interprets backslashes.
        !           153: # (this code from Autoconf 2.68)
        !           154: 
        !           155: # Printing a long string crashes Solaris 7 /usr/bin/printf.
        !           156: bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
        !           157: bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
        !           158: bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
        !           159: # Prefer a ksh shell builtin over an external printf program on Solaris,
        !           160: # but without wasting forks for bash or zsh.
        !           161: if test -z "$BASH_VERSION$ZSH_VERSION" \
        !           162:     && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then
        !           163:   bs_echo='print -r --'
        !           164:   bs_echo_n='print -rn --'
        !           165: elif (test "X`printf %s $bs_echo`" = "X$bs_echo") 2>/dev/null; then
        !           166:   bs_echo='printf %s\n'
        !           167:   bs_echo_n='printf %s'
        !           168: else
        !           169:   if test "X`(/usr/ucb/echo -n -n $bs_echo) 2>/dev/null`" = "X-n $bs_echo"; then
        !           170:     bs_echo_body='eval /usr/ucb/echo -n "$1$nl"'
        !           171:     bs_echo_n='/usr/ucb/echo -n'
        !           172:   else
        !           173:     bs_echo_body='eval expr "X$1" : "X\\(.*\\)"'
        !           174:     bs_echo_n_body='eval
        !           175:       arg=$1;
        !           176:       case $arg in #(
        !           177:       *"$nl"*)
        !           178:        expr "X$arg" : "X\\(.*\\)$nl";
        !           179:        arg=`expr "X$arg" : ".*$nl\\(.*\\)"`;;
        !           180:       esac;
        !           181:       expr "X$arg" : "X\\(.*\\)" | tr -d "$nl"
        !           182:     '
        !           183:     export bs_echo_n_body
        !           184:     bs_echo_n='sh -c $bs_echo_n_body bs_echo'
        !           185:   fi
        !           186:   export bs_echo_body
        !           187:   bs_echo='sh -c $bs_echo_body bs_echo'
        !           188: fi
1.1       misho     189: 
                    190: 
1.1.1.3 ! misho     191: ## ------------------------------- ##
        !           192: ## User overridable command paths. ##
        !           193: ## ------------------------------- ##
        !           194: 
        !           195: # All uppercase variable names are used for environment variables.  These
        !           196: # variables can be overridden by the user before calling a script that
        !           197: # uses them if a suitable command of that name is not already available
        !           198: # in the command search PATH.
1.1       misho     199: 
                    200: : ${CP="cp -f"}
1.1.1.3 ! misho     201: : ${ECHO="$bs_echo"}
        !           202: : ${EGREP="grep -E"}
        !           203: : ${FGREP="grep -F"}
        !           204: : ${GREP="grep"}
        !           205: : ${LN_S="ln -s"}
1.1       misho     206: : ${MAKE="make"}
                    207: : ${MKDIR="mkdir"}
                    208: : ${MV="mv -f"}
                    209: : ${RM="rm -f"}
1.1.1.3 ! misho     210: : ${SED="sed"}
1.1       misho     211: : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
                    212: 
                    213: 
1.1.1.3 ! misho     214: ## -------------------- ##
        !           215: ## Useful sed snippets. ##
        !           216: ## -------------------- ##
1.1       misho     217: 
1.1.1.3 ! misho     218: sed_dirname='s|/[^/]*$||'
        !           219: sed_basename='s|^.*/||'
1.1       misho     220: 
1.1.1.3 ! misho     221: # Sed substitution that helps us do robust quoting.  It backslashifies
        !           222: # metacharacters that are still active within double-quoted strings.
        !           223: sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
1.1       misho     224: 
1.1.1.3 ! misho     225: # Same as above, but do not quote variable references.
        !           226: sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
1.1       misho     227: 
1.1.1.3 ! misho     228: # Sed substitution that turns a string into a regex matching for the
        !           229: # string literally.
        !           230: sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
1.1       misho     231: 
1.1.1.3 ! misho     232: # Sed substitution that converts a w32 file name or path
        !           233: # that contains forward slashes, into one that contains
        !           234: # (escaped) backslashes.  A very naive implementation.
        !           235: sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
1.1       misho     236: 
1.1.1.3 ! misho     237: # Re-'\' parameter expansions in output of sed_double_quote_subst that
        !           238: # were '\'-ed in input to the same.  If an odd number of '\' preceded a
        !           239: # '$' in input to sed_double_quote_subst, that '$' was protected from
        !           240: # expansion.  Since each input '\' is now two '\'s, look for any number
        !           241: # of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
        !           242: _G_bs='\\'
        !           243: _G_bs2='\\\\'
        !           244: _G_bs4='\\\\\\\\'
        !           245: _G_dollar='\$'
        !           246: sed_double_backslash="\
        !           247:   s/$_G_bs4/&\\
        !           248: /g
        !           249:   s/^$_G_bs2$_G_dollar/$_G_bs&/
        !           250:   s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
        !           251:   s/\n//g"
1.1       misho     252: 
                    253: 
1.1.1.3 ! misho     254: ## ----------------- ##
        !           255: ## Global variables. ##
        !           256: ## ----------------- ##
        !           257: 
        !           258: # Except for the global variables explicitly listed below, the following
        !           259: # functions in the '^func_' namespace, and the '^require_' namespace
        !           260: # variables initialised in the 'Resource management' section, sourcing
        !           261: # this file will not pollute your global namespace with anything
        !           262: # else. There's no portable way to scope variables in Bourne shell
        !           263: # though, so actually running these functions will sometimes place
        !           264: # results into a variable named after the function, and often use
        !           265: # temporary variables in the '^_G_' namespace. If you are careful to
        !           266: # avoid using those namespaces casually in your sourcing script, things
        !           267: # should continue to work as you expect. And, of course, you can freely
        !           268: # overwrite any of the functions or variables defined here before
        !           269: # calling anything to customize them.
1.1       misho     270: 
1.1.1.3 ! misho     271: EXIT_SUCCESS=0
        !           272: EXIT_FAILURE=1
        !           273: EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
        !           274: EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
1.1       misho     275: 
1.1.1.3 ! misho     276: # Allow overriding, eg assuming that you follow the convention of
        !           277: # putting '$debug_cmd' at the start of all your functions, you can get
        !           278: # bash to show function call trace with:
        !           279: #
        !           280: #    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
        !           281: debug_cmd=${debug_cmd-":"}
        !           282: exit_cmd=:
1.1       misho     283: 
1.1.1.3 ! misho     284: # By convention, finish your script with:
        !           285: #
        !           286: #    exit $exit_status
        !           287: #
        !           288: # so that you can set exit_status to non-zero if you want to indicate
        !           289: # something went wrong during execution without actually bailing out at
        !           290: # the point of failure.
        !           291: exit_status=$EXIT_SUCCESS
1.1       misho     292: 
1.1.1.3 ! misho     293: # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
        !           294: # is ksh but when the shell is invoked as "sh" and the current value of
        !           295: # the _XPG environment variable is not equal to 1 (one), the special
        !           296: # positional parameter $0, within a function call, is the name of the
        !           297: # function.
        !           298: progpath=$0
1.1       misho     299: 
1.1.1.3 ! misho     300: # The name of this program.
        !           301: progname=`$bs_echo "$progpath" |$SED "$sed_basename"`
1.1       misho     302: 
1.1.1.3 ! misho     303: # Make sure we have an absolute progpath for reexecution:
1.1       misho     304: case $progpath in
                    305:   [\\/]*|[A-Za-z]:\\*) ;;
                    306:   *[\\/]*)
1.1.1.3 ! misho     307:      progdir=`$bs_echo "$progpath" |$SED "$sed_dirname"`
1.1       misho     308:      progdir=`cd "$progdir" && pwd`
1.1.1.3 ! misho     309:      progpath=$progdir/$progname
1.1       misho     310:      ;;
                    311:   *)
1.1.1.3 ! misho     312:      _G_IFS=$IFS
1.1.1.2   misho     313:      IFS=${PATH_SEPARATOR-:}
1.1       misho     314:      for progdir in $PATH; do
1.1.1.3 ! misho     315:        IFS=$_G_IFS
1.1       misho     316:        test -x "$progdir/$progname" && break
                    317:      done
1.1.1.3 ! misho     318:      IFS=$_G_IFS
1.1       misho     319:      test -n "$progdir" || progdir=`pwd`
1.1.1.3 ! misho     320:      progpath=$progdir/$progname
1.1       misho     321:      ;;
                    322: esac
                    323: 
                    324: 
1.1.1.3 ! misho     325: ## ----------------- ##
        !           326: ## Standard options. ##
        !           327: ## ----------------- ##
        !           328: 
        !           329: # The following options affect the operation of the functions defined
        !           330: # below, and should be set appropriately depending on run-time para-
        !           331: # meters passed on the command line.
1.1       misho     332: 
                    333: opt_dry_run=false
                    334: opt_quiet=false
                    335: opt_verbose=false
                    336: 
1.1.1.3 ! misho     337: # Categories 'all' and 'none' are always available.  Append any others
        !           338: # you will pass as the first argument to func_warning from your own
        !           339: # code.
        !           340: warning_categories=
        !           341: 
        !           342: # By default, display warnings according to 'opt_warning_types'.  Set
        !           343: # 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
        !           344: # treat the next displayed warning as a fatal error.
        !           345: warning_func=func_warn_and_continue
        !           346: 
        !           347: # Set to 'all' to display all warnings, 'none' to suppress all
        !           348: # warnings, or a space delimited list of some subset of
        !           349: # 'warning_categories' to display only the listed warnings.
        !           350: opt_warning_types=all
        !           351: 
        !           352: 
        !           353: ## -------------------- ##
        !           354: ## Resource management. ##
        !           355: ## -------------------- ##
        !           356: 
        !           357: # This section contains definitions for functions that each ensure a
        !           358: # particular resource (a file, or a non-empty configuration variable for
        !           359: # example) is available, and if appropriate to extract default values
        !           360: # from pertinent package files. Call them using their associated
        !           361: # 'require_*' variable to ensure that they are executed, at most, once.
        !           362: #
        !           363: # It's entirely deliberate that calling these functions can set
        !           364: # variables that don't obey the namespace limitations obeyed by the rest
        !           365: # of this file, in order that that they be as useful as possible to
        !           366: # callers.
        !           367: 
        !           368: 
        !           369: # require_term_colors
        !           370: # -------------------
        !           371: # Allow display of bold text on terminals that support it.
        !           372: require_term_colors=func_require_term_colors
        !           373: func_require_term_colors ()
        !           374: {
        !           375:     $debug_cmd
        !           376: 
        !           377:     test -t 1 && {
        !           378:       # COLORTERM and USE_ANSI_COLORS environment variables take
        !           379:       # precedence, because most terminfo databases neglect to describe
        !           380:       # whether color sequences are supported.
        !           381:       test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
        !           382: 
        !           383:       if test 1 = "$USE_ANSI_COLORS"; then
        !           384:         # Standard ANSI escape sequences
        !           385:         tc_reset=''
        !           386:         tc_bold='';   tc_standout=''
        !           387:         tc_red='';   tc_green=''
        !           388:         tc_blue='';  tc_cyan=''
        !           389:       else
        !           390:         # Otherwise trust the terminfo database after all.
        !           391:         test -n "`tput sgr0 2>/dev/null`" && {
        !           392:           tc_reset=`tput sgr0`
        !           393:           test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
        !           394:           tc_standout=$tc_bold
        !           395:           test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
        !           396:           test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
        !           397:           test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
        !           398:           test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
        !           399:           test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
        !           400:         }
        !           401:       fi
        !           402:     }
        !           403: 
        !           404:     require_term_colors=:
1.1       misho     405: }
                    406: 
                    407: 
1.1.1.3 ! misho     408: ## ----------------- ##
        !           409: ## Function library. ##
        !           410: ## ----------------- ##
1.1       misho     411: 
1.1.1.3 ! misho     412: # This section contains a variety of useful functions to call in your
        !           413: # scripts. Take note of the portable wrappers for features provided by
        !           414: # some modern shells, which will fall back to slower equivalents on
        !           415: # less featureful shells.
1.1       misho     416: 
1.1.1.3 ! misho     417: 
        !           418: # func_append VAR VALUE
        !           419: # ---------------------
        !           420: # Append VALUE onto the existing contents of VAR.
        !           421: 
        !           422:   # We should try to minimise forks, especially on Windows where they are
        !           423:   # unreasonably slow, so skip the feature probes when bash or zsh are
        !           424:   # being used:
        !           425:   if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
        !           426:     : ${_G_HAVE_ARITH_OP="yes"}
        !           427:     : ${_G_HAVE_XSI_OPS="yes"}
        !           428:     # The += operator was introduced in bash 3.1
        !           429:     case $BASH_VERSION in
        !           430:       [12].* | 3.0 | 3.0*) ;;
        !           431:       *)
        !           432:         : ${_G_HAVE_PLUSEQ_OP="yes"}
        !           433:         ;;
        !           434:     esac
        !           435:   fi
        !           436: 
        !           437:   # _G_HAVE_PLUSEQ_OP
        !           438:   # Can be empty, in which case the shell is probed, "yes" if += is
        !           439:   # useable or anything else if it does not work.
        !           440:   test -z "$_G_HAVE_PLUSEQ_OP" \
        !           441:     && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
        !           442:     && _G_HAVE_PLUSEQ_OP=yes
        !           443: 
        !           444: if test yes = "$_G_HAVE_PLUSEQ_OP"
        !           445: then
        !           446:   # This is an XSI compatible shell, allowing a faster implementation...
        !           447:   eval 'func_append ()
        !           448:   {
        !           449:     $debug_cmd
        !           450: 
        !           451:     eval "$1+=\$2"
        !           452:   }'
        !           453: else
        !           454:   # ...otherwise fall back to using expr, which is often a shell builtin.
        !           455:   func_append ()
        !           456:   {
        !           457:     $debug_cmd
        !           458: 
        !           459:     eval "$1=\$$1\$2"
        !           460:   }
        !           461: fi
        !           462: 
        !           463: 
        !           464: # func_append_quoted VAR VALUE
        !           465: # ----------------------------
        !           466: # Quote VALUE and append to the end of shell variable VAR, separated
        !           467: # by a space.
        !           468: if test yes = "$_G_HAVE_PLUSEQ_OP"; then
        !           469:   eval 'func_append_quoted ()
        !           470:   {
        !           471:     $debug_cmd
        !           472: 
        !           473:     func_quote_for_eval "$2"
        !           474:     eval "$1+=\\ \$func_quote_for_eval_result"
        !           475:   }'
        !           476: else
        !           477:   func_append_quoted ()
        !           478:   {
        !           479:     $debug_cmd
        !           480: 
        !           481:     func_quote_for_eval "$2"
        !           482:     eval "$1=\$$1\\ \$func_quote_for_eval_result"
        !           483:   }
        !           484: fi
        !           485: 
        !           486: 
        !           487: # func_append_uniq VAR VALUE
        !           488: # --------------------------
        !           489: # Append unique VALUE onto the existing contents of VAR, assuming
        !           490: # entries are delimited by the first character of VALUE.  For example:
        !           491: #
        !           492: #   func_append_uniq options " --another-option option-argument"
        !           493: #
        !           494: # will only append to $options if " --another-option option-argument "
        !           495: # is not already present somewhere in $options already (note spaces at
        !           496: # each end implied by leading space in second argument).
        !           497: func_append_uniq ()
        !           498: {
        !           499:     $debug_cmd
        !           500: 
        !           501:     eval _G_current_value='`$bs_echo $'$1'`'
        !           502:     _G_delim=`expr "$2" : '\(.\)'`
        !           503: 
        !           504:     case $_G_delim$_G_current_value$_G_delim in
        !           505:       *"$2$_G_delim"*) ;;
        !           506:       *) func_append "$@" ;;
        !           507:     esac
1.1       misho     508: }
                    509: 
1.1.1.3 ! misho     510: 
        !           511: # func_arith TERM...
        !           512: # ------------------
        !           513: # Set func_arith_result to the result of evaluating TERMs.
        !           514:   test -z "$_G_HAVE_ARITH_OP" \
        !           515:     && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
        !           516:     && _G_HAVE_ARITH_OP=yes
        !           517: 
        !           518: if test yes = "$_G_HAVE_ARITH_OP"; then
        !           519:   eval 'func_arith ()
        !           520:   {
        !           521:     $debug_cmd
        !           522: 
        !           523:     func_arith_result=$(( $* ))
        !           524:   }'
        !           525: else
        !           526:   func_arith ()
        !           527:   {
        !           528:     $debug_cmd
        !           529: 
        !           530:     func_arith_result=`expr "$@"`
        !           531:   }
        !           532: fi
        !           533: 
        !           534: 
        !           535: # func_basename FILE
        !           536: # ------------------
        !           537: # Set func_basename_result to FILE with everything up to and including
        !           538: # the last / stripped.
        !           539: if test yes = "$_G_HAVE_XSI_OPS"; then
        !           540:   # If this shell supports suffix pattern removal, then use it to avoid
        !           541:   # forking. Hide the definitions single quotes in case the shell chokes
        !           542:   # on unsupported syntax...
        !           543:   _b='func_basename_result=${1##*/}'
        !           544:   _d='case $1 in
        !           545:         */*) func_dirname_result=${1%/*}$2 ;;
        !           546:         *  ) func_dirname_result=$3        ;;
        !           547:       esac'
        !           548: 
        !           549: else
        !           550:   # ...otherwise fall back to using sed.
        !           551:   _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
        !           552:   _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
        !           553:       if test "X$func_dirname_result" = "X$1"; then
        !           554:         func_dirname_result=$3
        !           555:       else
        !           556:         func_append func_dirname_result "$2"
        !           557:       fi'
        !           558: fi
        !           559: 
        !           560: eval 'func_basename ()
1.1       misho     561: {
1.1.1.3 ! misho     562:     $debug_cmd
1.1       misho     563: 
1.1.1.3 ! misho     564:     '"$_b"'
        !           565: }'
1.1       misho     566: 
1.1.1.3 ! misho     567: 
        !           568: # func_dirname FILE APPEND NONDIR_REPLACEMENT
        !           569: # -------------------------------------------
        !           570: # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
        !           571: # otherwise set result to NONDIR_REPLACEMENT.
        !           572: eval 'func_dirname ()
1.1       misho     573: {
1.1.1.3 ! misho     574:     $debug_cmd
        !           575: 
        !           576:     '"$_d"'
        !           577: }'
        !           578: 
        !           579: 
        !           580: # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
        !           581: # --------------------------------------------------------
        !           582: # Perform func_basename and func_dirname in a single function
        !           583: # call:
        !           584: #   dirname:  Compute the dirname of FILE.  If nonempty,
        !           585: #             add APPEND to the result, otherwise set result
        !           586: #             to NONDIR_REPLACEMENT.
        !           587: #             value returned in "$func_dirname_result"
        !           588: #   basename: Compute filename of FILE.
        !           589: #             value retuned in "$func_basename_result"
        !           590: # For efficiency, we do not delegate to the functions above but instead
        !           591: # duplicate the functionality here.
        !           592: eval 'func_dirname_and_basename ()
        !           593: {
        !           594:     $debug_cmd
        !           595: 
        !           596:     '"$_b"'
        !           597:     '"$_d"'
        !           598: }'
        !           599: 
        !           600: 
        !           601: # func_echo ARG...
        !           602: # ----------------
        !           603: # Echo program name prefixed message.
        !           604: func_echo ()
        !           605: {
        !           606:     $debug_cmd
        !           607: 
        !           608:     _G_message=$*
        !           609: 
        !           610:     func_echo_IFS=$IFS
        !           611:     IFS=$nl
        !           612:     for _G_line in $_G_message; do
        !           613:       IFS=$func_echo_IFS
        !           614:       $bs_echo "$progname: $_G_line"
        !           615:     done
        !           616:     IFS=$func_echo_IFS
        !           617: }
        !           618: 
        !           619: 
        !           620: # func_echo_all ARG...
        !           621: # --------------------
        !           622: # Invoke $ECHO with all args, space-separated.
        !           623: func_echo_all ()
        !           624: {
        !           625:     $ECHO "$*"
        !           626: }
        !           627: 
        !           628: 
        !           629: # func_echo_infix_1 INFIX ARG...
        !           630: # ------------------------------
        !           631: # Echo program name, followed by INFIX on the first line, with any
        !           632: # additional lines not showing INFIX.
        !           633: func_echo_infix_1 ()
        !           634: {
        !           635:     $debug_cmd
        !           636: 
        !           637:     $require_term_colors
        !           638: 
        !           639:     _G_infix=$1; shift
        !           640:     _G_indent=$_G_infix
        !           641:     _G_prefix="$progname: $_G_infix: "
        !           642:     _G_message=$*
        !           643: 
        !           644:     # Strip color escape sequences before counting printable length
        !           645:     for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
        !           646:     do
        !           647:       test -n "$_G_tc" && {
        !           648:         _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"`
        !           649:         _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"`
        !           650:       }
        !           651:     done
        !           652:     _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
        !           653: 
        !           654:     func_echo_infix_1_IFS=$IFS
        !           655:     IFS=$nl
        !           656:     for _G_line in $_G_message; do
        !           657:       IFS=$func_echo_infix_1_IFS
        !           658:       $bs_echo "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
        !           659:       _G_prefix=$_G_indent
        !           660:     done
        !           661:     IFS=$func_echo_infix_1_IFS
        !           662: }
        !           663: 
        !           664: 
        !           665: # func_error ARG...
        !           666: # -----------------
        !           667: # Echo program name prefixed message to standard error.
        !           668: func_error ()
        !           669: {
        !           670:     $debug_cmd
        !           671: 
        !           672:     $require_term_colors
        !           673: 
        !           674:     func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
        !           675: }
        !           676: 
        !           677: 
        !           678: # func_fatal_error ARG...
        !           679: # -----------------------
        !           680: # Echo program name prefixed message to standard error, and exit.
        !           681: func_fatal_error ()
        !           682: {
        !           683:     $debug_cmd
        !           684: 
        !           685:     func_error "$*"
        !           686:     exit $EXIT_FAILURE
        !           687: }
        !           688: 
        !           689: 
        !           690: # func_grep EXPRESSION FILENAME
        !           691: # -----------------------------
        !           692: # Check whether EXPRESSION matches any line of FILENAME, without output.
        !           693: func_grep ()
        !           694: {
        !           695:     $debug_cmd
        !           696: 
        !           697:     $GREP "$1" "$2" >/dev/null 2>&1
        !           698: }
        !           699: 
        !           700: 
        !           701: # func_len STRING
        !           702: # ---------------
        !           703: # Set func_len_result to the length of STRING. STRING may not
        !           704: # start with a hyphen.
        !           705:   test -z "$_G_HAVE_XSI_OPS" \
        !           706:     && (eval 'x=a/b/c;
        !           707:       test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
        !           708:     && _G_HAVE_XSI_OPS=yes
        !           709: 
        !           710: if test yes = "$_G_HAVE_XSI_OPS"; then
        !           711:   eval 'func_len ()
        !           712:   {
        !           713:     $debug_cmd
        !           714: 
        !           715:     func_len_result=${#1}
        !           716:   }'
        !           717: else
        !           718:   func_len ()
        !           719:   {
        !           720:     $debug_cmd
        !           721: 
        !           722:     func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
        !           723:   }
        !           724: fi
        !           725: 
        !           726: 
        !           727: # func_mkdir_p DIRECTORY-PATH
        !           728: # ---------------------------
        !           729: # Make sure the entire path to DIRECTORY-PATH is available.
        !           730: func_mkdir_p ()
        !           731: {
        !           732:     $debug_cmd
        !           733: 
        !           734:     _G_directory_path=$1
        !           735:     _G_dir_list=
        !           736: 
        !           737:     if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
        !           738: 
        !           739:       # Protect directory names starting with '-'
        !           740:       case $_G_directory_path in
        !           741:         -*) _G_directory_path=./$_G_directory_path ;;
        !           742:       esac
        !           743: 
        !           744:       # While some portion of DIR does not yet exist...
        !           745:       while test ! -d "$_G_directory_path"; do
        !           746:         # ...make a list in topmost first order.  Use a colon delimited
        !           747:        # list incase some portion of path contains whitespace.
        !           748:         _G_dir_list=$_G_directory_path:$_G_dir_list
        !           749: 
        !           750:         # If the last portion added has no slash in it, the list is done
        !           751:         case $_G_directory_path in */*) ;; *) break ;; esac
        !           752: 
        !           753:         # ...otherwise throw away the child directory and loop
        !           754:         _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
        !           755:       done
        !           756:       _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
        !           757: 
        !           758:       func_mkdir_p_IFS=$IFS; IFS=:
        !           759:       for _G_dir in $_G_dir_list; do
        !           760:        IFS=$func_mkdir_p_IFS
        !           761:         # mkdir can fail with a 'File exist' error if two processes
        !           762:         # try to create one of the directories concurrently.  Don't
        !           763:         # stop in that case!
        !           764:         $MKDIR "$_G_dir" 2>/dev/null || :
        !           765:       done
        !           766:       IFS=$func_mkdir_p_IFS
        !           767: 
        !           768:       # Bail out if we (or some other process) failed to create a directory.
        !           769:       test -d "$_G_directory_path" || \
        !           770:         func_fatal_error "Failed to create '$1'"
        !           771:     fi
        !           772: }
        !           773: 
        !           774: 
        !           775: # func_mktempdir [BASENAME]
        !           776: # -------------------------
        !           777: # Make a temporary directory that won't clash with other running
        !           778: # libtool processes, and avoids race conditions if possible.  If
        !           779: # given, BASENAME is the basename for that directory.
        !           780: func_mktempdir ()
        !           781: {
        !           782:     $debug_cmd
        !           783: 
        !           784:     _G_template=${TMPDIR-/tmp}/${1-$progname}
        !           785: 
        !           786:     if test : = "$opt_dry_run"; then
        !           787:       # Return a directory name, but don't create it in dry-run mode
        !           788:       _G_tmpdir=$_G_template-$$
        !           789:     else
        !           790: 
        !           791:       # If mktemp works, use that first and foremost
        !           792:       _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
        !           793: 
        !           794:       if test ! -d "$_G_tmpdir"; then
        !           795:         # Failing that, at least try and use $RANDOM to avoid a race
        !           796:         _G_tmpdir=$_G_template-${RANDOM-0}$$
        !           797: 
        !           798:         func_mktempdir_umask=`umask`
        !           799:         umask 0077
        !           800:         $MKDIR "$_G_tmpdir"
        !           801:         umask $func_mktempdir_umask
        !           802:       fi
        !           803: 
        !           804:       # If we're not in dry-run mode, bomb out on failure
        !           805:       test -d "$_G_tmpdir" || \
        !           806:         func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
        !           807:     fi
        !           808: 
        !           809:     $ECHO "$_G_tmpdir"
        !           810: }
        !           811: 
        !           812: 
        !           813: # func_normal_abspath PATH
        !           814: # ------------------------
        !           815: # Remove doubled-up and trailing slashes, "." path components,
        !           816: # and cancel out any ".." path components in PATH after making
        !           817: # it an absolute path.
        !           818: func_normal_abspath ()
        !           819: {
        !           820:     $debug_cmd
        !           821: 
        !           822:     # These SED scripts presuppose an absolute path with a trailing slash.
        !           823:     _G_pathcar='s|^/\([^/]*\).*$|\1|'
        !           824:     _G_pathcdr='s|^/[^/]*||'
        !           825:     _G_removedotparts=':dotsl
        !           826:                s|/\./|/|g
        !           827:                t dotsl
        !           828:                s|/\.$|/|'
        !           829:     _G_collapseslashes='s|/\{1,\}|/|g'
        !           830:     _G_finalslash='s|/*$|/|'
        !           831: 
        !           832:     # Start from root dir and reassemble the path.
        !           833:     func_normal_abspath_result=
        !           834:     func_normal_abspath_tpath=$1
        !           835:     func_normal_abspath_altnamespace=
        !           836:     case $func_normal_abspath_tpath in
        !           837:       "")
        !           838:         # Empty path, that just means $cwd.
        !           839:         func_stripname '' '/' "`pwd`"
        !           840:         func_normal_abspath_result=$func_stripname_result
        !           841:         return
        !           842:         ;;
        !           843:       # The next three entries are used to spot a run of precisely
        !           844:       # two leading slashes without using negated character classes;
        !           845:       # we take advantage of case's first-match behaviour.
        !           846:       ///*)
        !           847:         # Unusual form of absolute path, do nothing.
        !           848:         ;;
        !           849:       //*)
        !           850:         # Not necessarily an ordinary path; POSIX reserves leading '//'
        !           851:         # and for example Cygwin uses it to access remote file shares
        !           852:         # over CIFS/SMB, so we conserve a leading double slash if found.
        !           853:         func_normal_abspath_altnamespace=/
        !           854:         ;;
        !           855:       /*)
        !           856:         # Absolute path, do nothing.
        !           857:         ;;
        !           858:       *)
        !           859:         # Relative path, prepend $cwd.
        !           860:         func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
        !           861:         ;;
        !           862:     esac
        !           863: 
        !           864:     # Cancel out all the simple stuff to save iterations.  We also want
        !           865:     # the path to end with a slash for ease of parsing, so make sure
        !           866:     # there is one (and only one) here.
        !           867:     func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
        !           868:           -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
        !           869:     while :; do
        !           870:       # Processed it all yet?
        !           871:       if test / = "$func_normal_abspath_tpath"; then
        !           872:         # If we ascended to the root using ".." the result may be empty now.
        !           873:         if test -z "$func_normal_abspath_result"; then
        !           874:           func_normal_abspath_result=/
        !           875:         fi
        !           876:         break
        !           877:       fi
        !           878:       func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
        !           879:           -e "$_G_pathcar"`
        !           880:       func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
        !           881:           -e "$_G_pathcdr"`
        !           882:       # Figure out what to do with it
        !           883:       case $func_normal_abspath_tcomponent in
        !           884:         "")
        !           885:           # Trailing empty path component, ignore it.
        !           886:           ;;
        !           887:         ..)
        !           888:           # Parent dir; strip last assembled component from result.
        !           889:           func_dirname "$func_normal_abspath_result"
        !           890:           func_normal_abspath_result=$func_dirname_result
        !           891:           ;;
        !           892:         *)
        !           893:           # Actual path component, append it.
        !           894:           func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
        !           895:           ;;
        !           896:       esac
        !           897:     done
        !           898:     # Restore leading double-slash if one was found on entry.
        !           899:     func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
        !           900: }
        !           901: 
        !           902: 
        !           903: # func_notquiet ARG...
        !           904: # --------------------
        !           905: # Echo program name prefixed message only when not in quiet mode.
        !           906: func_notquiet ()
        !           907: {
        !           908:     $debug_cmd
        !           909: 
        !           910:     $opt_quiet || func_echo ${1+"$@"}
        !           911: 
        !           912:     # A bug in bash halts the script if the last line of a function
        !           913:     # fails when set -e is in force, so we need another command to
        !           914:     # work around that:
        !           915:     :
        !           916: }
        !           917: 
        !           918: 
        !           919: # func_relative_path SRCDIR DSTDIR
        !           920: # --------------------------------
        !           921: # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
        !           922: func_relative_path ()
        !           923: {
        !           924:     $debug_cmd
        !           925: 
        !           926:     func_relative_path_result=
        !           927:     func_normal_abspath "$1"
        !           928:     func_relative_path_tlibdir=$func_normal_abspath_result
        !           929:     func_normal_abspath "$2"
        !           930:     func_relative_path_tbindir=$func_normal_abspath_result
        !           931: 
        !           932:     # Ascend the tree starting from libdir
        !           933:     while :; do
        !           934:       # check if we have found a prefix of bindir
        !           935:       case $func_relative_path_tbindir in
        !           936:         $func_relative_path_tlibdir)
        !           937:           # found an exact match
        !           938:           func_relative_path_tcancelled=
        !           939:           break
        !           940:           ;;
        !           941:         $func_relative_path_tlibdir*)
        !           942:           # found a matching prefix
        !           943:           func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
        !           944:           func_relative_path_tcancelled=$func_stripname_result
        !           945:           if test -z "$func_relative_path_result"; then
        !           946:             func_relative_path_result=.
        !           947:           fi
        !           948:           break
        !           949:           ;;
        !           950:         *)
        !           951:           func_dirname $func_relative_path_tlibdir
        !           952:           func_relative_path_tlibdir=$func_dirname_result
        !           953:           if test -z "$func_relative_path_tlibdir"; then
        !           954:             # Have to descend all the way to the root!
        !           955:             func_relative_path_result=../$func_relative_path_result
        !           956:             func_relative_path_tcancelled=$func_relative_path_tbindir
        !           957:             break
        !           958:           fi
        !           959:           func_relative_path_result=../$func_relative_path_result
        !           960:           ;;
        !           961:       esac
        !           962:     done
        !           963: 
        !           964:     # Now calculate path; take care to avoid doubling-up slashes.
        !           965:     func_stripname '' '/' "$func_relative_path_result"
        !           966:     func_relative_path_result=$func_stripname_result
        !           967:     func_stripname '/' '/' "$func_relative_path_tcancelled"
        !           968:     if test -n "$func_stripname_result"; then
        !           969:       func_append func_relative_path_result "/$func_stripname_result"
        !           970:     fi
        !           971: 
        !           972:     # Normalisation. If bindir is libdir, return '.' else relative path.
        !           973:     if test -n "$func_relative_path_result"; then
        !           974:       func_stripname './' '' "$func_relative_path_result"
        !           975:       func_relative_path_result=$func_stripname_result
        !           976:     fi
        !           977: 
        !           978:     test -n "$func_relative_path_result" || func_relative_path_result=.
        !           979: 
        !           980:     :
        !           981: }
        !           982: 
        !           983: 
        !           984: # func_quote_for_eval ARG...
        !           985: # --------------------------
        !           986: # Aesthetically quote ARGs to be evaled later.
        !           987: # This function returns two values:
        !           988: #   i) func_quote_for_eval_result
        !           989: #      double-quoted, suitable for a subsequent eval
        !           990: #  ii) func_quote_for_eval_unquoted_result
        !           991: #      has all characters that are still active within double
        !           992: #      quotes backslashified.
        !           993: func_quote_for_eval ()
        !           994: {
        !           995:     $debug_cmd
        !           996: 
        !           997:     func_quote_for_eval_unquoted_result=
        !           998:     func_quote_for_eval_result=
        !           999:     while test 0 -lt $#; do
        !          1000:       case $1 in
        !          1001:         *[\\\`\"\$]*)
        !          1002:          _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
        !          1003:         *)
        !          1004:           _G_unquoted_arg=$1 ;;
        !          1005:       esac
        !          1006:       if test -n "$func_quote_for_eval_unquoted_result"; then
        !          1007:        func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
        !          1008:       else
        !          1009:         func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
        !          1010:       fi
        !          1011: 
        !          1012:       case $_G_unquoted_arg in
        !          1013:         # Double-quote args containing shell metacharacters to delay
        !          1014:         # word splitting, command substitution and variable expansion
        !          1015:         # for a subsequent eval.
        !          1016:         # Many Bourne shells cannot handle close brackets correctly
        !          1017:         # in scan sets, so we specify it separately.
        !          1018:         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \  ]*|*]*|"")
        !          1019:           _G_quoted_arg=\"$_G_unquoted_arg\"
        !          1020:           ;;
        !          1021:         *)
        !          1022:           _G_quoted_arg=$_G_unquoted_arg
        !          1023:          ;;
        !          1024:       esac
        !          1025: 
        !          1026:       if test -n "$func_quote_for_eval_result"; then
        !          1027:        func_append func_quote_for_eval_result " $_G_quoted_arg"
        !          1028:       else
        !          1029:         func_append func_quote_for_eval_result "$_G_quoted_arg"
        !          1030:       fi
        !          1031:       shift
        !          1032:     done
        !          1033: }
        !          1034: 
        !          1035: 
        !          1036: # func_quote_for_expand ARG
        !          1037: # -------------------------
        !          1038: # Aesthetically quote ARG to be evaled later; same as above,
        !          1039: # but do not quote variable references.
        !          1040: func_quote_for_expand ()
        !          1041: {
        !          1042:     $debug_cmd
        !          1043: 
        !          1044:     case $1 in
        !          1045:       *[\\\`\"]*)
        !          1046:        _G_arg=`$ECHO "$1" | $SED \
        !          1047:            -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
        !          1048:       *)
        !          1049:         _G_arg=$1 ;;
        !          1050:     esac
        !          1051: 
        !          1052:     case $_G_arg in
        !          1053:       # Double-quote args containing shell metacharacters to delay
        !          1054:       # word splitting and command substitution for a subsequent eval.
        !          1055:       # Many Bourne shells cannot handle close brackets correctly
        !          1056:       # in scan sets, so we specify it separately.
        !          1057:       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
        !          1058:         _G_arg=\"$_G_arg\"
        !          1059:         ;;
        !          1060:     esac
        !          1061: 
        !          1062:     func_quote_for_expand_result=$_G_arg
        !          1063: }
        !          1064: 
        !          1065: 
        !          1066: # func_stripname PREFIX SUFFIX NAME
        !          1067: # ---------------------------------
        !          1068: # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
        !          1069: # PREFIX and SUFFIX must not contain globbing or regex special
        !          1070: # characters, hashes, percent signs, but SUFFIX may contain a leading
        !          1071: # dot (in which case that matches only a dot).
        !          1072: if test yes = "$_G_HAVE_XSI_OPS"; then
        !          1073:   eval 'func_stripname ()
        !          1074:   {
        !          1075:     $debug_cmd
        !          1076: 
        !          1077:     # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
        !          1078:     # positional parameters, so assign one to ordinary variable first.
        !          1079:     func_stripname_result=$3
        !          1080:     func_stripname_result=${func_stripname_result#"$1"}
        !          1081:     func_stripname_result=${func_stripname_result%"$2"}
        !          1082:   }'
        !          1083: else
        !          1084:   func_stripname ()
        !          1085:   {
        !          1086:     $debug_cmd
        !          1087: 
        !          1088:     case $2 in
        !          1089:       .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
        !          1090:       *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
        !          1091:     esac
        !          1092:   }
        !          1093: fi
        !          1094: 
        !          1095: 
        !          1096: # func_show_eval CMD [FAIL_EXP]
        !          1097: # -----------------------------
        !          1098: # Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
        !          1099: # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
        !          1100: # is given, then evaluate it.
        !          1101: func_show_eval ()
        !          1102: {
        !          1103:     $debug_cmd
        !          1104: 
        !          1105:     _G_cmd=$1
        !          1106:     _G_fail_exp=${2-':'}
        !          1107: 
        !          1108:     func_quote_for_expand "$_G_cmd"
        !          1109:     eval "func_notquiet $func_quote_for_expand_result"
        !          1110: 
        !          1111:     $opt_dry_run || {
        !          1112:       eval "$_G_cmd"
        !          1113:       _G_status=$?
        !          1114:       if test 0 -ne "$_G_status"; then
        !          1115:        eval "(exit $_G_status); $_G_fail_exp"
        !          1116:       fi
        !          1117:     }
        !          1118: }
        !          1119: 
        !          1120: 
        !          1121: # func_show_eval_locale CMD [FAIL_EXP]
        !          1122: # ------------------------------------
        !          1123: # Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
        !          1124: # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
        !          1125: # is given, then evaluate it.  Use the saved locale for evaluation.
        !          1126: func_show_eval_locale ()
        !          1127: {
        !          1128:     $debug_cmd
        !          1129: 
        !          1130:     _G_cmd=$1
        !          1131:     _G_fail_exp=${2-':'}
        !          1132: 
        !          1133:     $opt_quiet || {
        !          1134:       func_quote_for_expand "$_G_cmd"
        !          1135:       eval "func_echo $func_quote_for_expand_result"
        !          1136:     }
        !          1137: 
        !          1138:     $opt_dry_run || {
        !          1139:       eval "$_G_user_locale
        !          1140:            $_G_cmd"
        !          1141:       _G_status=$?
        !          1142:       eval "$_G_safe_locale"
        !          1143:       if test 0 -ne "$_G_status"; then
        !          1144:        eval "(exit $_G_status); $_G_fail_exp"
        !          1145:       fi
        !          1146:     }
        !          1147: }
        !          1148: 
        !          1149: 
        !          1150: # func_tr_sh
        !          1151: # ----------
        !          1152: # Turn $1 into a string suitable for a shell variable name.
        !          1153: # Result is stored in $func_tr_sh_result.  All characters
        !          1154: # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
        !          1155: # if $1 begins with a digit, a '_' is prepended as well.
        !          1156: func_tr_sh ()
        !          1157: {
        !          1158:     $debug_cmd
        !          1159: 
        !          1160:     case $1 in
        !          1161:     [0-9]* | *[!a-zA-Z0-9_]*)
        !          1162:       func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
        !          1163:       ;;
        !          1164:     * )
        !          1165:       func_tr_sh_result=$1
        !          1166:       ;;
        !          1167:     esac
        !          1168: }
        !          1169: 
        !          1170: 
        !          1171: # func_verbose ARG...
        !          1172: # -------------------
        !          1173: # Echo program name prefixed message in verbose mode only.
        !          1174: func_verbose ()
        !          1175: {
        !          1176:     $debug_cmd
        !          1177: 
        !          1178:     $opt_verbose && func_echo "$*"
        !          1179: 
        !          1180:     :
        !          1181: }
        !          1182: 
        !          1183: 
        !          1184: # func_warn_and_continue ARG...
        !          1185: # -----------------------------
        !          1186: # Echo program name prefixed warning message to standard error.
        !          1187: func_warn_and_continue ()
        !          1188: {
        !          1189:     $debug_cmd
        !          1190: 
        !          1191:     $require_term_colors
        !          1192: 
        !          1193:     func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
        !          1194: }
        !          1195: 
        !          1196: 
        !          1197: # func_warning CATEGORY ARG...
        !          1198: # ----------------------------
        !          1199: # Echo program name prefixed warning message to standard error. Warning
        !          1200: # messages can be filtered according to CATEGORY, where this function
        !          1201: # elides messages where CATEGORY is not listed in the global variable
        !          1202: # 'opt_warning_types'.
        !          1203: func_warning ()
        !          1204: {
        !          1205:     $debug_cmd
        !          1206: 
        !          1207:     # CATEGORY must be in the warning_categories list!
        !          1208:     case " $warning_categories " in
        !          1209:       *" $1 "*) ;;
        !          1210:       *) func_internal_error "invalid warning category '$1'" ;;
        !          1211:     esac
        !          1212: 
        !          1213:     _G_category=$1
        !          1214:     shift
        !          1215: 
        !          1216:     case " $opt_warning_types " in
        !          1217:       *" $_G_category "*) $warning_func ${1+"$@"} ;;
        !          1218:     esac
        !          1219: }
        !          1220: 
        !          1221: 
        !          1222: # func_sort_ver VER1 VER2
        !          1223: # -----------------------
        !          1224: # 'sort -V' is not generally available.
        !          1225: # Note this deviates from the version comparison in automake
        !          1226: # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
        !          1227: # but this should suffice as we won't be specifying old
        !          1228: # version formats or redundant trailing .0 in bootstrap.conf.
        !          1229: # If we did want full compatibility then we should probably
        !          1230: # use m4_version_compare from autoconf.
        !          1231: func_sort_ver ()
        !          1232: {
        !          1233:     $debug_cmd
        !          1234: 
        !          1235:     ver1=$1
        !          1236:     ver2=$2
        !          1237: 
        !          1238:     # Split on '.' and compare each component.
        !          1239:     i=1
        !          1240:     while :; do
        !          1241:       p1=`echo "$ver1" |cut -d. -f$i`
        !          1242:       p2=`echo "$ver2" |cut -d. -f$i`
        !          1243:       if test ! "$p1"; then
        !          1244:         echo "$1 $2"
        !          1245:         break
        !          1246:       elif test ! "$p2"; then
        !          1247:         echo "$2 $1"
        !          1248:         break
        !          1249:       elif test ! "$p1" = "$p2"; then
        !          1250:         if test "$p1" -gt "$p2" 2>/dev/null; then # numeric comparison
        !          1251:           echo "$2 $1"
        !          1252:         elif test "$p2" -gt "$p1" 2>/dev/null; then # numeric comparison
        !          1253:           echo "$1 $2"
        !          1254:         else # numeric, then lexicographic comparison
        !          1255:           lp=`printf "$p1\n$p2\n" |sort -n |tail -n1`
        !          1256:           if test "$lp" = "$p2"; then
        !          1257:             echo "$1 $2"
        !          1258:           else
        !          1259:             echo "$2 $1"
        !          1260:           fi
        !          1261:         fi
        !          1262:         break
        !          1263:       fi
        !          1264:       i=`expr $i + 1`
        !          1265:     done
        !          1266: }
        !          1267: 
        !          1268: 
        !          1269: # Local variables:
        !          1270: # mode: shell-script
        !          1271: # sh-indentation: 2
        !          1272: # eval: (add-hook 'write-file-hooks 'time-stamp)
        !          1273: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
        !          1274: # time-stamp-time-zone: "UTC"
        !          1275: # End:
        !          1276: #! /bin/sh
        !          1277: 
        !          1278: # Set a version string for this script.
        !          1279: scriptversion=2012-10-21.11; # UTC
        !          1280: 
        !          1281: # A portable, pluggable option parser for Bourne shell.
        !          1282: # Written by Gary V. Vaughan, 2010
        !          1283: 
        !          1284: # Copyright (C) 2010-2013 Free Software Foundation, Inc.
        !          1285: # This is free software; see the source for copying conditions.  There is NO
        !          1286: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
        !          1287: 
        !          1288: # This program is free software: you can redistribute it and/or modify
        !          1289: # it under the terms of the GNU General Public License as published by
        !          1290: # the Free Software Foundation, either version 3 of the License, or
        !          1291: # (at your option) any later version.
        !          1292: 
        !          1293: # This program is distributed in the hope that it will be useful,
        !          1294: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !          1295: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !          1296: # GNU General Public License for more details.
        !          1297: 
        !          1298: # You should have received a copy of the GNU General Public License
        !          1299: # along with this program.  If not, see <http://www.gnu.org/licenses/>.
        !          1300: 
        !          1301: # Please report bugs or propose patches to gary@gnu.org.
        !          1302: 
        !          1303: 
        !          1304: ## ------ ##
        !          1305: ## Usage. ##
        !          1306: ## ------ ##
        !          1307: 
        !          1308: # This file is a library for parsing options in your shell scripts along
        !          1309: # with assorted other useful supporting features that you can make use
        !          1310: # of too.
        !          1311: #
        !          1312: # For the simplest scripts you might need only:
        !          1313: #
        !          1314: #   #!/bin/sh
        !          1315: #   . relative/path/to/funclib.sh
        !          1316: #   . relative/path/to/options-parser
        !          1317: #   scriptversion=1.0
        !          1318: #   func_options ${1+"$@"}
        !          1319: #   eval set dummy "$func_options_result"; shift
        !          1320: #   ...rest of your script...
        !          1321: #
        !          1322: # In order for the '--version' option to work, you will need to have a
        !          1323: # suitably formatted comment like the one at the top of this file
        !          1324: # starting with '# Written by ' and ending with '# warranty; '.
        !          1325: #
        !          1326: # For '-h' and '--help' to work, you will also need a one line
        !          1327: # description of your script's purpose in a comment directly above the
        !          1328: # '# Written by ' line, like the one at the top of this file.
        !          1329: #
        !          1330: # The default options also support '--debug', which will turn on shell
        !          1331: # execution tracing (see the comment above debug_cmd below for another
        !          1332: # use), and '--verbose' and the func_verbose function to allow your script
        !          1333: # to display verbose messages only when your user has specified
        !          1334: # '--verbose'.
        !          1335: #
        !          1336: # After sourcing this file, you can plug processing for additional
        !          1337: # options by amending the variables from the 'Configuration' section
        !          1338: # below, and following the instructions in the 'Option parsing'
        !          1339: # section further down.
        !          1340: 
        !          1341: ## -------------- ##
        !          1342: ## Configuration. ##
        !          1343: ## -------------- ##
        !          1344: 
        !          1345: # You should override these variables in your script after sourcing this
        !          1346: # file so that they reflect the customisations you have added to the
        !          1347: # option parser.
        !          1348: 
        !          1349: # The usage line for option parsing errors and the start of '-h' and
        !          1350: # '--help' output messages. You can embed shell variables for delayed
        !          1351: # expansion at the time the message is displayed, but you will need to
        !          1352: # quote other shell meta-characters carefully to prevent them being
        !          1353: # expanded when the contents are evaled.
        !          1354: usage='$progpath [OPTION]...'
        !          1355: 
        !          1356: # Short help message in response to '-h' and '--help'.  Add to this or
        !          1357: # override it after sourcing this library to reflect the full set of
        !          1358: # options your script accepts.
        !          1359: usage_message="\
        !          1360:        --debug        enable verbose shell tracing
        !          1361:    -W, --warnings=CATEGORY
        !          1362:                       report the warnings falling in CATEGORY [all]
        !          1363:    -v, --verbose      verbosely report processing
        !          1364:        --version      print version information and exit
        !          1365:    -h, --help         print short or long help message and exit
        !          1366: "
        !          1367: 
        !          1368: # Additional text appended to 'usage_message' in response to '--help'.
        !          1369: long_help_message="
        !          1370: Warning categories include:
        !          1371:        'all'          show all warnings
        !          1372:        'none'         turn off all the warnings
        !          1373:        'error'        warnings are treated as fatal errors"
        !          1374: 
        !          1375: # Help message printed before fatal option parsing errors.
        !          1376: fatal_help="Try '\$progname --help' for more information."
        !          1377: 
        !          1378: 
        !          1379: 
        !          1380: ## ------------------------- ##
        !          1381: ## Hook function management. ##
        !          1382: ## ------------------------- ##
        !          1383: 
        !          1384: # This section contains functions for adding, removing, and running hooks
        !          1385: # to the main code.  A hook is just a named list of of function, that can
        !          1386: # be run in order later on.
1.1       misho    1387: 
1.1.1.3 ! misho    1388: # func_hookable FUNC_NAME
        !          1389: # -----------------------
        !          1390: # Declare that FUNC_NAME will run hooks added with
        !          1391: # 'func_add_hook FUNC_NAME ...'.
        !          1392: func_hookable ()
1.1       misho    1393: {
1.1.1.3 ! misho    1394:     $debug_cmd
        !          1395: 
        !          1396:     func_append hookable_fns " $1"
1.1       misho    1397: }
                   1398: 
                   1399: 
1.1.1.3 ! misho    1400: # func_add_hook FUNC_NAME HOOK_FUNC
        !          1401: # ---------------------------------
        !          1402: # Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
        !          1403: # first have been declared "hookable" by a call to 'func_hookable'.
        !          1404: func_add_hook ()
1.1       misho    1405: {
1.1.1.3 ! misho    1406:     $debug_cmd
        !          1407: 
        !          1408:     case " $hookable_fns " in
        !          1409:       *" $1 "*) ;;
        !          1410:       *) func_fatal_error "'$1' does not accept hook functions." ;;
        !          1411:     esac
        !          1412: 
        !          1413:     eval func_append ${1}_hooks '" $2"'
1.1       misho    1414: }
                   1415: 
                   1416: 
1.1.1.3 ! misho    1417: # func_remove_hook FUNC_NAME HOOK_FUNC
        !          1418: # ------------------------------------
        !          1419: # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
        !          1420: func_remove_hook ()
1.1       misho    1421: {
1.1.1.3 ! misho    1422:     $debug_cmd
1.1       misho    1423: 
1.1.1.3 ! misho    1424:     eval ${1}_hooks='`$bs_echo "\$'$1'_hooks" |$SED "s| '$2'||"`'
        !          1425: }
1.1       misho    1426: 
                   1427: 
1.1.1.3 ! misho    1428: # func_run_hooks FUNC_NAME [ARG]...
        !          1429: # ---------------------------------
        !          1430: # Run all hook functions registered to FUNC_NAME.
        !          1431: # It is assumed that the list of hook functions contains nothing more
        !          1432: # than a whitespace-delimited list of legal shell function names, and
        !          1433: # no effort is wasted trying to catch shell meta-characters or preserve
        !          1434: # whitespace.
        !          1435: func_run_hooks ()
        !          1436: {
        !          1437:     $debug_cmd
1.1       misho    1438: 
1.1.1.3 ! misho    1439:     case " $hookable_fns " in
        !          1440:       *" $1 "*) ;;
        !          1441:       *) func_fatal_error "'$1' does not support hook funcions.n" ;;
        !          1442:     esac
1.1       misho    1443: 
1.1.1.3 ! misho    1444:     eval _G_hook_fns=\$$1_hooks; shift
1.1       misho    1445: 
1.1.1.3 ! misho    1446:     for _G_hook in $_G_hook_fns; do
        !          1447:       eval $_G_hook '"$@"'
1.1       misho    1448: 
1.1.1.3 ! misho    1449:       # store returned options list back into positional
        !          1450:       # parameters for next 'cmd' execution.
        !          1451:       eval _G_hook_result=\$${_G_hook}_result
        !          1452:       eval set dummy "$_G_hook_result"; shift
        !          1453:     done
        !          1454: 
        !          1455:     func_quote_for_eval ${1+"$@"}
        !          1456:     func_run_hooks_result=$func_quote_for_eval_result
1.1       misho    1457: }
                   1458: 
                   1459: 
                   1460: 
1.1.1.3 ! misho    1461: ## --------------- ##
        !          1462: ## Option parsing. ##
        !          1463: ## --------------- ##
1.1       misho    1464: 
1.1.1.3 ! misho    1465: # In order to add your own option parsing hooks, you must accept the
        !          1466: # full positional parameter list in your hook function, remove any
        !          1467: # options that you action, and then pass back the remaining unprocessed
        !          1468: # options in '<hooked_function_name>_result', escaped suitably for
        !          1469: # 'eval'.  Like this:
        !          1470: #
        !          1471: #    my_options_prep ()
        !          1472: #    {
        !          1473: #        $debug_cmd
        !          1474: #
        !          1475: #        # Extend the existing usage message.
        !          1476: #        usage_message=$usage_message'
        !          1477: #      -s, --silent       don'\''t print informational messages
        !          1478: #    '
        !          1479: #
        !          1480: #        func_quote_for_eval ${1+"$@"}
        !          1481: #        my_options_prep_result=$func_quote_for_eval_result
        !          1482: #    }
        !          1483: #    func_add_hook func_options_prep my_options_prep
        !          1484: #
        !          1485: #
        !          1486: #    my_silent_option ()
        !          1487: #    {
        !          1488: #        $debug_cmd
        !          1489: #
        !          1490: #        # Note that for efficiency, we parse as many options as we can
        !          1491: #        # recognise in a loop before passing the remainder back to the
        !          1492: #        # caller on the first unrecognised argument we encounter.
        !          1493: #        while test $# -gt 0; do
        !          1494: #          opt=$1; shift
        !          1495: #          case $opt in
        !          1496: #            --silent|-s) opt_silent=: ;;
        !          1497: #            # Separate non-argument short options:
        !          1498: #            -s*)         func_split_short_opt "$_G_opt"
        !          1499: #                         set dummy "$func_split_short_opt_name" \
        !          1500: #                             "-$func_split_short_opt_arg" ${1+"$@"}
        !          1501: #                         shift
        !          1502: #                         ;;
        !          1503: #            *)            set dummy "$_G_opt" "$*"; shift; break ;;
        !          1504: #          esac
        !          1505: #        done
        !          1506: #
        !          1507: #        func_quote_for_eval ${1+"$@"}
        !          1508: #        my_silent_option_result=$func_quote_for_eval_result
        !          1509: #    }
        !          1510: #    func_add_hook func_parse_options my_silent_option
        !          1511: #
        !          1512: #
        !          1513: #    my_option_validation ()
        !          1514: #    {
        !          1515: #        $debug_cmd
        !          1516: #
        !          1517: #        $opt_silent && $opt_verbose && func_fatal_help "\
        !          1518: #    '--silent' and '--verbose' options are mutually exclusive."
        !          1519: #
        !          1520: #        func_quote_for_eval ${1+"$@"}
        !          1521: #        my_option_validation_result=$func_quote_for_eval_result
        !          1522: #    }
        !          1523: #    func_add_hook func_validate_options my_option_validation
        !          1524: #
        !          1525: # You'll alse need to manually amend $usage_message to reflect the extra
        !          1526: # options you parse.  It's preferable to append if you can, so that
        !          1527: # multiple option parsing hooks can be added safely.
1.1       misho    1528: 
                   1529: 
1.1.1.3 ! misho    1530: # func_options [ARG]...
        !          1531: # ---------------------
        !          1532: # All the functions called inside func_options are hookable. See the
        !          1533: # individual implementations for details.
        !          1534: func_hookable func_options
        !          1535: func_options ()
        !          1536: {
        !          1537:     $debug_cmd
1.1       misho    1538: 
1.1.1.3 ! misho    1539:     func_options_prep ${1+"$@"}
        !          1540:     eval func_parse_options \
        !          1541:         ${func_options_prep_result+"$func_options_prep_result"}
        !          1542:     eval func_validate_options \
        !          1543:         ${func_parse_options_result+"$func_parse_options_result"}
        !          1544: 
        !          1545:     eval func_run_hooks func_options \
        !          1546:         ${func_validate_options_result+"$func_validate_options_result"}
1.1       misho    1547: 
1.1.1.3 ! misho    1548:     # save modified positional parameters for caller
        !          1549:     func_options_result=$func_run_hooks_result
1.1       misho    1550: }
                   1551: 
                   1552: 
1.1.1.3 ! misho    1553: # func_options_prep [ARG]...
        !          1554: # --------------------------
        !          1555: # All initialisations required before starting the option parse loop.
        !          1556: # Note that when calling hook functions, we pass through the list of
        !          1557: # positional parameters.  If a hook function modifies that list, and
        !          1558: # needs to propogate that back to rest of this script, then the complete
        !          1559: # modified list must be put in 'func_run_hooks_result' before
        !          1560: # returning.
        !          1561: func_hookable func_options_prep
        !          1562: func_options_prep ()
1.1       misho    1563: {
1.1.1.3 ! misho    1564:     $debug_cmd
1.1       misho    1565: 
1.1.1.3 ! misho    1566:     # Option defaults:
        !          1567:     opt_verbose=false
        !          1568:     opt_warning_types=
        !          1569: 
        !          1570:     func_run_hooks func_options_prep ${1+"$@"}
        !          1571: 
        !          1572:     # save modified positional parameters for caller
        !          1573:     func_options_prep_result=$func_run_hooks_result
1.1       misho    1574: }
                   1575: 
                   1576: 
1.1.1.3 ! misho    1577: # func_parse_options [ARG]...
        !          1578: # ---------------------------
        !          1579: # The main option parsing loop.
        !          1580: func_hookable func_parse_options
        !          1581: func_parse_options ()
1.1       misho    1582: {
1.1.1.3 ! misho    1583:     $debug_cmd
1.1       misho    1584: 
1.1.1.3 ! misho    1585:     func_parse_options_result=
1.1       misho    1586: 
1.1.1.3 ! misho    1587:     # this just eases exit handling
        !          1588:     while test $# -gt 0; do
        !          1589:       # Defer to hook functions for initial option parsing, so they
        !          1590:       # get priority in the event of reusing an option name.
        !          1591:       func_run_hooks func_parse_options ${1+"$@"}
1.1       misho    1592: 
1.1.1.3 ! misho    1593:       # Adjust func_parse_options positional parameters to match
        !          1594:       eval set dummy "$func_run_hooks_result"; shift
1.1       misho    1595: 
1.1.1.3 ! misho    1596:       # Break out of the loop if we already parsed every option.
        !          1597:       test $# -gt 0 || break
1.1       misho    1598: 
1.1.1.3 ! misho    1599:       _G_opt=$1
        !          1600:       shift
        !          1601:       case $_G_opt in
        !          1602:         --debug|-x)   debug_cmd='set -x'
        !          1603:                       func_echo "enabling shell trace mode"
        !          1604:                       $debug_cmd
        !          1605:                       ;;
        !          1606: 
        !          1607:         --no-warnings|--no-warning|--no-warn)
        !          1608:                       set dummy --warnings none ${1+"$@"}
        !          1609:                       shift
        !          1610:                      ;;
1.1       misho    1611: 
1.1.1.3 ! misho    1612:         --warnings|--warning|-W)
        !          1613:                       test $# = 0 && func_missing_arg $_G_opt && break
        !          1614:                       case " $warning_categories $1" in
        !          1615:                         *" $1 "*)
        !          1616:                           # trailing space prevents matching last $1 above
        !          1617:                           func_append_uniq opt_warning_types " $1"
        !          1618:                           ;;
        !          1619:                         *all)
        !          1620:                           opt_warning_types=$warning_categories
        !          1621:                           ;;
        !          1622:                         *none)
        !          1623:                           opt_warning_types=none
        !          1624:                           warning_func=:
        !          1625:                           ;;
        !          1626:                         *error)
        !          1627:                           opt_warning_types=$warning_categories
        !          1628:                           warning_func=func_fatal_error
        !          1629:                           ;;
        !          1630:                         *)
        !          1631:                           func_fatal_error \
        !          1632:                              "unsupported warning category: '$1'"
        !          1633:                           ;;
        !          1634:                       esac
        !          1635:                       shift
        !          1636:                       ;;
        !          1637: 
        !          1638:         --verbose|-v) opt_verbose=: ;;
        !          1639:         --version)    func_version ;;
        !          1640:         -\?|-h)       func_usage ;;
        !          1641:         --help)       func_help ;;
        !          1642: 
        !          1643:        # Separate optargs to long options (plugins may need this):
        !          1644:        --*=*)        func_split_equals "$_G_opt"
        !          1645:                      set dummy "$func_split_equals_lhs" \
        !          1646:                           "$func_split_equals_rhs" ${1+"$@"}
        !          1647:                       shift
        !          1648:                       ;;
        !          1649: 
        !          1650:        # Separate optargs to short options:
        !          1651:         -W*)
        !          1652:                       func_split_short_opt "$_G_opt"
        !          1653:                       set dummy "$func_split_short_opt_name" \
        !          1654:                           "$func_split_short_opt_arg" ${1+"$@"}
        !          1655:                       shift
        !          1656:                       ;;
        !          1657: 
        !          1658:         # Separate non-argument short options:
        !          1659:         -\?*|-h*|-v*|-x*)
        !          1660:                       func_split_short_opt "$_G_opt"
        !          1661:                       set dummy "$func_split_short_opt_name" \
        !          1662:                           "-$func_split_short_opt_arg" ${1+"$@"}
        !          1663:                       shift
        !          1664:                       ;;
        !          1665: 
        !          1666:         --)           break ;;
        !          1667:         -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
        !          1668:         *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
        !          1669:       esac
        !          1670:     done
        !          1671: 
        !          1672:     # save modified positional parameters for caller
        !          1673:     func_quote_for_eval ${1+"$@"}
        !          1674:     func_parse_options_result=$func_quote_for_eval_result
1.1       misho    1675: }
                   1676: 
                   1677: 
1.1.1.3 ! misho    1678: # func_validate_options [ARG]...
        !          1679: # ------------------------------
        !          1680: # Perform any sanity checks on option settings and/or unconsumed
        !          1681: # arguments.
        !          1682: func_hookable func_validate_options
        !          1683: func_validate_options ()
1.1       misho    1684: {
1.1.1.3 ! misho    1685:     $debug_cmd
1.1       misho    1686: 
1.1.1.3 ! misho    1687:     # Display all warnings if -W was not given.
        !          1688:     test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1.1       misho    1689: 
1.1.1.3 ! misho    1690:     func_run_hooks func_validate_options ${1+"$@"}
1.1       misho    1691: 
1.1.1.3 ! misho    1692:     # Bail if the options were screwed!
        !          1693:     $exit_cmd $EXIT_FAILURE
        !          1694: 
        !          1695:     # save modified positional parameters for caller
        !          1696:     func_validate_options_result=$func_run_hooks_result
1.1       misho    1697: }
                   1698: 
                   1699: 
                   1700: 
1.1.1.3 ! misho    1701: ## ------------------##
        !          1702: ## Helper functions. ##
        !          1703: ## ------------------##
1.1       misho    1704: 
1.1.1.3 ! misho    1705: # This section contains the helper functions used by the rest of the
        !          1706: # hookable option parser framework in ascii-betical order.
        !          1707: 
        !          1708: 
        !          1709: # func_fatal_help ARG...
        !          1710: # ----------------------
        !          1711: # Echo program name prefixed message to standard error, followed by
        !          1712: # a help hint, and exit.
        !          1713: func_fatal_help ()
1.1       misho    1714: {
1.1.1.3 ! misho    1715:     $debug_cmd
1.1       misho    1716: 
1.1.1.3 ! misho    1717:     eval \$bs_echo \""Usage: $usage"\"
        !          1718:     eval \$bs_echo \""$fatal_help"\"
        !          1719:     func_error ${1+"$@"}
        !          1720:     exit $EXIT_FAILURE
1.1       misho    1721: }
                   1722: 
1.1.1.3 ! misho    1723: 
        !          1724: # func_help
        !          1725: # ---------
        !          1726: # Echo long help message to standard output and exit.
1.1       misho    1727: func_help ()
                   1728: {
1.1.1.3 ! misho    1729:     $debug_cmd
1.1       misho    1730: 
1.1.1.3 ! misho    1731:     func_usage_message
        !          1732:     $bs_echo "$long_help_message"
        !          1733:     exit 0
1.1       misho    1734: }
                   1735: 
1.1.1.3 ! misho    1736: 
        !          1737: # func_missing_arg ARGNAME
        !          1738: # ------------------------
1.1       misho    1739: # Echo program name prefixed message to standard error and set global
                   1740: # exit_cmd.
                   1741: func_missing_arg ()
                   1742: {
1.1.1.3 ! misho    1743:     $debug_cmd
1.1       misho    1744: 
1.1.1.3 ! misho    1745:     func_error "Missing argument for '$1'."
1.1       misho    1746:     exit_cmd=exit
                   1747: }
                   1748: 
                   1749: 
1.1.1.3 ! misho    1750: # func_split_equals STRING
        !          1751: # ------------------------
        !          1752: # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
        !          1753: # splitting STRING at the '=' sign.
        !          1754: test -z "$_G_HAVE_XSI_OPS" \
        !          1755:     && (eval 'x=a/b/c;
        !          1756:       test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
        !          1757:     && _G_HAVE_XSI_OPS=yes
        !          1758: 
        !          1759: if test yes = "$_G_HAVE_XSI_OPS"
        !          1760: then
        !          1761:   # This is an XSI compatible shell, allowing a faster implementation...
        !          1762:   eval 'func_split_equals ()
        !          1763:   {
        !          1764:       $debug_cmd
        !          1765: 
        !          1766:       func_split_equals_lhs=${1%%=*}
        !          1767:       func_split_equals_rhs=${1#*=}
        !          1768:       test "x$func_split_equals_lhs" = "x$1" \
        !          1769:         && func_split_equals_rhs=
        !          1770:   }'
        !          1771: else
        !          1772:   # ...otherwise fall back to using expr, which is often a shell builtin.
        !          1773:   func_split_equals ()
        !          1774:   {
        !          1775:       $debug_cmd
        !          1776: 
        !          1777:       func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
        !          1778:       func_split_equals_rhs=
        !          1779:       test "x$func_split_equals_lhs" = "x$1" \
        !          1780:         || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
        !          1781:   }
        !          1782: fi #func_split_equals
        !          1783: 
        !          1784: 
        !          1785: # func_split_short_opt SHORTOPT
        !          1786: # -----------------------------
1.1       misho    1787: # Set func_split_short_opt_name and func_split_short_opt_arg shell
                   1788: # variables after splitting SHORTOPT after the 2nd character.
1.1.1.3 ! misho    1789: if test yes = "$_G_HAVE_XSI_OPS"
        !          1790: then
        !          1791:   # This is an XSI compatible shell, allowing a faster implementation...
        !          1792:   eval 'func_split_short_opt ()
        !          1793:   {
        !          1794:       $debug_cmd
        !          1795: 
        !          1796:       func_split_short_opt_arg=${1#??}
        !          1797:       func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
        !          1798:   }'
        !          1799: else
        !          1800:   # ...otherwise fall back to using expr, which is often a shell builtin.
        !          1801:   func_split_short_opt ()
        !          1802:   {
        !          1803:       $debug_cmd
        !          1804: 
        !          1805:       func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
        !          1806:       func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
        !          1807:   }
        !          1808: fi #func_split_short_opt
        !          1809: 
        !          1810: 
        !          1811: # func_usage
        !          1812: # ----------
        !          1813: # Echo short help message to standard output and exit.
        !          1814: func_usage ()
1.1       misho    1815: {
1.1.1.3 ! misho    1816:     $debug_cmd
1.1       misho    1817: 
1.1.1.3 ! misho    1818:     func_usage_message
        !          1819:     $bs_echo "Run '$progname --help |${PAGER-more}' for full usage"
        !          1820:     exit 0
        !          1821: }
1.1       misho    1822: 
                   1823: 
1.1.1.3 ! misho    1824: # func_usage_message
        !          1825: # ------------------
        !          1826: # Echo short help message to standard output.
        !          1827: func_usage_message ()
1.1       misho    1828: {
1.1.1.3 ! misho    1829:     $debug_cmd
1.1       misho    1830: 
1.1.1.3 ! misho    1831:     eval \$bs_echo \""Usage: $usage"\"
        !          1832:     echo
        !          1833:     $SED -n 's|^# ||
        !          1834:         /^Written by/{
        !          1835:           x;p;x
        !          1836:         }
        !          1837:        h
        !          1838:        /^Written by/q' < "$progpath"
        !          1839:     echo
        !          1840:     eval \$bs_echo \""$usage_message"\"
        !          1841: }
1.1       misho    1842: 
                   1843: 
1.1.1.3 ! misho    1844: # func_version
        !          1845: # ------------
        !          1846: # Echo version message to standard output and exit.
        !          1847: func_version ()
        !          1848: {
        !          1849:     $debug_cmd
1.1       misho    1850: 
1.1.1.3 ! misho    1851:     printf '%s\n' "$progname $scriptversion"
        !          1852:     $SED -n '/^##/q
        !          1853:         /(C)/!b go
        !          1854:         :more
        !          1855:         /\./!{
        !          1856:           N
        !          1857:           s|\n# | |
        !          1858:           b more
        !          1859:         }
        !          1860:         :go
        !          1861:         /^# Written by /,/# warranty; / {
        !          1862:           s|^# ||
        !          1863:           s|^# *$||
        !          1864:           s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
        !          1865:           p
        !          1866:         }
        !          1867:         /^# Written by / {
        !          1868:           s|^# ||
        !          1869:           p
        !          1870:         }
        !          1871:         /^warranty; /q' < "$progpath"
1.1       misho    1872: 
1.1.1.3 ! misho    1873:     exit $?
        !          1874: }
1.1       misho    1875: 
                   1876: 
1.1.1.3 ! misho    1877: # Local variables:
        !          1878: # mode: shell-script
        !          1879: # sh-indentation: 2
        !          1880: # eval: (add-hook 'write-file-hooks 'time-stamp)
        !          1881: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
        !          1882: # time-stamp-time-zone: "UTC"
        !          1883: # End:
1.1       misho    1884: 
1.1.1.3 ! misho    1885: # Set a version string.
        !          1886: scriptversion='(GNU libtool) 2.4.2.418'
1.1       misho    1887: 
                   1888: 
1.1.1.3 ! misho    1889: # func_echo ARG...
        !          1890: # ----------------
        !          1891: # Libtool also displays the current mode in messages, so override
        !          1892: # funclib.sh func_echo with this custom definition.
        !          1893: func_echo ()
1.1       misho    1894: {
1.1.1.3 ! misho    1895:     $debug_cmd
1.1       misho    1896: 
1.1.1.3 ! misho    1897:     _G_message=$*
1.1       misho    1898: 
1.1.1.3 ! misho    1899:     func_echo_IFS=$IFS
        !          1900:     IFS=$nl
        !          1901:     for _G_line in $_G_message; do
        !          1902:       IFS=$func_echo_IFS
        !          1903:       $bs_echo "$progname${opt_mode+: $opt_mode}: $_G_line"
        !          1904:     done
        !          1905:     IFS=$func_echo_IFS
        !          1906: }
1.1       misho    1907: 
1.1.1.3 ! misho    1908: 
        !          1909: # func_warning ARG...
        !          1910: # -------------------
        !          1911: # Libtool warnings are not categorized, so override funclib.sh
        !          1912: # func_warning with this simpler definition.
        !          1913: func_warning ()
1.1       misho    1914: {
1.1.1.3 ! misho    1915:     $debug_cmd
1.1       misho    1916: 
1.1.1.3 ! misho    1917:     $warning_func ${1+"$@"}
        !          1918: }
1.1       misho    1919: 
                   1920: 
1.1.1.3 ! misho    1921: ## ---------------- ##
        !          1922: ## Options parsing. ##
        !          1923: ## ---------------- ##
        !          1924: 
        !          1925: # Hook in the functions to make sure our own options are parsed during
        !          1926: # the option parsing loop.
        !          1927: 
        !          1928: usage='$progpath [OPTION]... [MODE-ARG]...'
        !          1929: 
        !          1930: # Short help message in response to '-h'.
        !          1931: usage_message="Options:
        !          1932:        --config             show all configuration variables
        !          1933:        --debug              enable verbose shell tracing
        !          1934:    -n, --dry-run            display commands without modifying any files
        !          1935:        --features           display basic configuration information and exit
        !          1936:        --mode=MODE          use operation mode MODE
        !          1937:        --no-warnings        equivalent to '-Wnone'
        !          1938:        --preserve-dup-deps  don't remove duplicate dependency libraries
        !          1939:        --quiet, --silent    don't print informational messages
        !          1940:        --tag=TAG            use configuration variables from tag TAG
        !          1941:    -v, --verbose            print more informational messages than default
        !          1942:        --version            print version information
        !          1943:    -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
        !          1944:    -h, --help, --help-all   print short, long, or detailed help message
        !          1945: "
1.1       misho    1946: 
1.1.1.3 ! misho    1947: # Additional text appended to 'usage_message' in response to '--help'.
        !          1948: long_help_message=$long_help_message"
1.1       misho    1949: 
1.1.1.3 ! misho    1950: MODE must be one of the following:
1.1       misho    1951: 
1.1.1.3 ! misho    1952:        clean           remove files from the build directory
        !          1953:        compile         compile a source file into a libtool object
        !          1954:        execute         automatically set library path, then run a program
        !          1955:        finish          complete the installation of libtool libraries
        !          1956:        install         install libraries or executables
        !          1957:        link            create a library or an executable
        !          1958:        uninstall       remove libraries from an installed directory
        !          1959: 
        !          1960: MODE-ARGS vary depending on the MODE.  When passed as first option,
        !          1961: '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
        !          1962: Try '$progname --help --mode=MODE' for a more detailed description of MODE.
        !          1963: 
        !          1964: When reporting a bug, please describe a test case to reproduce it and
        !          1965: include the following information:
        !          1966: 
        !          1967:        host-triplet:   $host
        !          1968:        shell:          $SHELL
        !          1969:        compiler:       $LTCC
        !          1970:        compiler flags: $LTCFLAGS
        !          1971:        linker:         $LD (gnu? $with_gnu_ld)
        !          1972:        version:        $progname (GNU libtool) 2.4.2.418
        !          1973:        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
        !          1974:        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
        !          1975: 
        !          1976: Report bugs to <bug-libtool@gnu.org>.
        !          1977: GNU libtool home page: <http://www.gnu.org/software/libtool/>.
        !          1978: General help using GNU software: <http://www.gnu.org/gethelp/>."
        !          1979: 
        !          1980: 
        !          1981: # func_lo2o OBJECT-NAME
        !          1982: # ---------------------
        !          1983: # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
        !          1984: # object suffix.
        !          1985: 
        !          1986: lo2o=s/\\.lo\$/.$objext/
        !          1987: o2lo=s/\\.$objext\$/.lo/
        !          1988: 
        !          1989: if test yes = "$_G_HAVE_XSI_OPS"; then
        !          1990:   eval 'func_lo2o ()
        !          1991:   {
        !          1992:     case $1 in
        !          1993:       *.lo) func_lo2o_result=${1%.lo}.$objext ;;
        !          1994:       *   ) func_lo2o_result=$1               ;;
        !          1995:     esac
        !          1996:   }'
        !          1997: 
        !          1998:   # func_xform LIBOBJ-OR-SOURCE
        !          1999:   # ---------------------------
        !          2000:   # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
        !          2001:   # suffix to a '.lo' libtool-object suffix.
        !          2002:   eval 'func_xform ()
        !          2003:   {
        !          2004:     func_xform_result=${1%.*}.lo
        !          2005:   }'
        !          2006: else
        !          2007:   # ...otherwise fall back to using sed.
        !          2008:   func_lo2o ()
        !          2009:   {
        !          2010:     func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
        !          2011:   }
        !          2012: 
        !          2013:   func_xform ()
        !          2014:   {
        !          2015:     func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
        !          2016:   }
        !          2017: fi
1.1       misho    2018: 
                   2019: 
1.1.1.3 ! misho    2020: # func_fatal_configuration ARG...
        !          2021: # -------------------------------
1.1       misho    2022: # Echo program name prefixed message to standard error, followed by
                   2023: # a configuration failure hint, and exit.
                   2024: func_fatal_configuration ()
                   2025: {
1.1.1.3 ! misho    2026:     func__fatal_error ${1+"$@"} \
        !          2027:       "See the $PACKAGE documentation for more information." \
        !          2028:       "Fatal configuration error."
1.1       misho    2029: }
                   2030: 
                   2031: 
                   2032: # func_config
1.1.1.3 ! misho    2033: # -----------
1.1       misho    2034: # Display the configuration for all the tags in this script.
                   2035: func_config ()
                   2036: {
                   2037:     re_begincf='^# ### BEGIN LIBTOOL'
                   2038:     re_endcf='^# ### END LIBTOOL'
                   2039: 
                   2040:     # Default configuration.
                   2041:     $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
                   2042: 
                   2043:     # Now print the configurations for the tags.
                   2044:     for tagname in $taglist; do
                   2045:       $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
                   2046:     done
                   2047: 
                   2048:     exit $?
                   2049: }
                   2050: 
1.1.1.3 ! misho    2051: 
1.1       misho    2052: # func_features
1.1.1.3 ! misho    2053: # -------------
1.1       misho    2054: # Display the features supported by this script.
                   2055: func_features ()
                   2056: {
                   2057:     echo "host: $host"
1.1.1.3 ! misho    2058:     if test yes = "$build_libtool_libs"; then
1.1       misho    2059:       echo "enable shared libraries"
                   2060:     else
                   2061:       echo "disable shared libraries"
                   2062:     fi
1.1.1.3 ! misho    2063:     if test yes = "$build_old_libs"; then
1.1       misho    2064:       echo "enable static libraries"
                   2065:     else
                   2066:       echo "disable static libraries"
                   2067:     fi
                   2068: 
                   2069:     exit $?
                   2070: }
                   2071: 
1.1.1.3 ! misho    2072: 
        !          2073: # func_enable_tag TAGNAME
        !          2074: # -----------------------
1.1       misho    2075: # Verify that TAGNAME is valid, and either flag an error and exit, or
                   2076: # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
                   2077: # variable here.
                   2078: func_enable_tag ()
                   2079: {
1.1.1.3 ! misho    2080:     # Global variable:
        !          2081:     tagname=$1
1.1       misho    2082: 
1.1.1.3 ! misho    2083:     re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
        !          2084:     re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
        !          2085:     sed_extractcf=/$re_begincf/,/$re_endcf/p
        !          2086: 
        !          2087:     # Validate tagname.
        !          2088:     case $tagname in
        !          2089:       *[!-_A-Za-z0-9,/]*)
        !          2090:         func_fatal_error "invalid tag name: $tagname"
        !          2091:         ;;
        !          2092:     esac
1.1       misho    2093: 
1.1.1.3 ! misho    2094:     # Don't test for the "default" C tag, as we know it's
        !          2095:     # there but not specially marked.
        !          2096:     case $tagname in
        !          2097:         CC) ;;
1.1       misho    2098:     *)
1.1.1.3 ! misho    2099:         if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
        !          2100:          taglist="$taglist $tagname"
1.1       misho    2101: 
1.1.1.3 ! misho    2102:          # Evaluate the configuration.  Be careful to quote the path
        !          2103:          # and the sed script, to avoid splitting on whitespace, but
        !          2104:          # also don't use non-portable quotes within backquotes within
        !          2105:          # quotes we have to do it in 2 steps:
        !          2106:          extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
        !          2107:          eval "$extractedcf"
        !          2108:         else
        !          2109:          func_error "ignoring unknown tag $tagname"
        !          2110:         fi
        !          2111:         ;;
        !          2112:     esac
1.1       misho    2113: }
                   2114: 
1.1.1.3 ! misho    2115: 
1.1       misho    2116: # func_check_version_match
1.1.1.3 ! misho    2117: # ------------------------
1.1       misho    2118: # Ensure that we are using m4 macros, and libtool script from the same
                   2119: # release of libtool.
                   2120: func_check_version_match ()
                   2121: {
1.1.1.3 ! misho    2122:     if test "$package_revision" != "$macro_revision"; then
        !          2123:       if test "$VERSION" != "$macro_version"; then
        !          2124:         if test -z "$macro_version"; then
        !          2125:           cat >&2 <<_LT_EOF
1.1       misho    2126: $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
                   2127: $progname: definition of this LT_INIT comes from an older release.
                   2128: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
                   2129: $progname: and run autoconf again.
                   2130: _LT_EOF
1.1.1.3 ! misho    2131:         else
        !          2132:           cat >&2 <<_LT_EOF
1.1       misho    2133: $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
                   2134: $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
                   2135: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
                   2136: $progname: and run autoconf again.
                   2137: _LT_EOF
1.1.1.3 ! misho    2138:         fi
        !          2139:       else
        !          2140:         cat >&2 <<_LT_EOF
1.1       misho    2141: $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
                   2142: $progname: but the definition of this LT_INIT comes from revision $macro_revision.
                   2143: $progname: You should recreate aclocal.m4 with macros from revision $package_revision
                   2144: $progname: of $PACKAGE $VERSION and run autoconf again.
                   2145: _LT_EOF
1.1.1.3 ! misho    2146:       fi
1.1       misho    2147: 
1.1.1.3 ! misho    2148:       exit $EXIT_MISMATCH
        !          2149:     fi
1.1       misho    2150: }
                   2151: 
                   2152: 
1.1.1.3 ! misho    2153: # libtool_options_prep [ARG]...
        !          2154: # -----------------------------
        !          2155: # Preparation for options parsed by libtool.
        !          2156: libtool_options_prep ()
        !          2157: {
        !          2158:     $debug_mode
1.1       misho    2159: 
1.1.1.3 ! misho    2160:     # Option defaults:
        !          2161:     opt_config=false
        !          2162:     opt_dlopen=
        !          2163:     opt_dry_run=false
        !          2164:     opt_help=false
        !          2165:     opt_mode=
        !          2166:     opt_preserve_dup_deps=false
        !          2167:     opt_quiet=false
1.1       misho    2168: 
1.1.1.3 ! misho    2169:     nonopt=
        !          2170:     preserve_args=
1.1       misho    2171: 
1.1.1.3 ! misho    2172:     # Shorthand for --mode=foo, only valid as the first argument
        !          2173:     case $1 in
        !          2174:     clean|clea|cle|cl)
        !          2175:       shift; set dummy --mode clean ${1+"$@"}; shift
        !          2176:       ;;
        !          2177:     compile|compil|compi|comp|com|co|c)
        !          2178:       shift; set dummy --mode compile ${1+"$@"}; shift
        !          2179:       ;;
        !          2180:     execute|execut|execu|exec|exe|ex|e)
        !          2181:       shift; set dummy --mode execute ${1+"$@"}; shift
        !          2182:       ;;
        !          2183:     finish|finis|fini|fin|fi|f)
        !          2184:       shift; set dummy --mode finish ${1+"$@"}; shift
        !          2185:       ;;
        !          2186:     install|instal|insta|inst|ins|in|i)
        !          2187:       shift; set dummy --mode install ${1+"$@"}; shift
        !          2188:       ;;
        !          2189:     link|lin|li|l)
        !          2190:       shift; set dummy --mode link ${1+"$@"}; shift
        !          2191:       ;;
        !          2192:     uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
        !          2193:       shift; set dummy --mode uninstall ${1+"$@"}; shift
        !          2194:       ;;
        !          2195:     esac
1.1       misho    2196: 
1.1.1.3 ! misho    2197:     # Pass back the list of options.
        !          2198:     func_quote_for_eval ${1+"$@"}
        !          2199:     libtool_options_prep_result=$func_quote_for_eval_result
        !          2200: }
        !          2201: func_add_hook func_options_prep libtool_options_prep
1.1       misho    2202: 
                   2203: 
1.1.1.3 ! misho    2204: # libtool_parse_options [ARG]...
        !          2205: # ---------------------------------
        !          2206: # Provide handling for libtool specific options.
        !          2207: libtool_parse_options ()
        !          2208: {
        !          2209:     $debug_cmd
1.1       misho    2210: 
1.1.1.3 ! misho    2211:     # Perform our own loop to consume as many options as possible in
        !          2212:     # each iteration.
        !          2213:     while test $# -gt 0; do
        !          2214:       _G_opt=$1
        !          2215:       shift
        !          2216:       case $_G_opt in
        !          2217:         --dry-run|--dryrun|-n)
        !          2218:                         opt_dry_run=:
        !          2219:                         ;;
        !          2220: 
        !          2221:         --config)       func_config ;;
        !          2222: 
        !          2223:         --dlopen|-dlopen)
        !          2224:                         opt_dlopen="${opt_dlopen+$opt_dlopen
        !          2225: }$1"
        !          2226:                         shift
        !          2227:                         ;;
        !          2228: 
        !          2229:         --preserve-dup-deps)
        !          2230:                         opt_preserve_dup_deps=: ;;
        !          2231: 
        !          2232:         --features)     func_features ;;
        !          2233: 
        !          2234:         --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
        !          2235: 
        !          2236:         --help)         opt_help=: ;;
        !          2237: 
        !          2238:         --help-all)     opt_help=': help-all' ;;
        !          2239: 
        !          2240:         --mode)         test $# = 0 && func_missing_arg $_G_opt && break
        !          2241:                         opt_mode=$1
        !          2242:                         case $1 in
        !          2243:                           # Valid mode arguments:
        !          2244:                           clean|compile|execute|finish|install|link|relink|uninstall) ;;
        !          2245: 
        !          2246:                           # Catch anything else as an error
        !          2247:                           *) func_error "invalid argument for $_G_opt"
        !          2248:                              exit_cmd=exit
        !          2249:                              break
        !          2250:                              ;;
        !          2251:                         esac
        !          2252:                         shift
        !          2253:                         ;;
        !          2254: 
        !          2255:         --no-silent|--no-quiet)
        !          2256:                         opt_quiet=false
        !          2257:                         func_append preserve_args " $_G_opt"
        !          2258:                         ;;
        !          2259: 
        !          2260:         --no-warnings|--no-warning|--no-warn)
        !          2261:                         opt_warning=false
        !          2262:                         func_append preserve_args " $_G_opt"
        !          2263:                         ;;
        !          2264: 
        !          2265:         --no-verbose)
        !          2266:                         opt_verbose=false
        !          2267:                         func_append preserve_args " $_G_opt"
        !          2268:                         ;;
        !          2269: 
        !          2270:         --silent|--quiet)
        !          2271:                         opt_quiet=:
        !          2272:                         opt_verbose=false
        !          2273:                         func_append preserve_args " $_G_opt"
        !          2274:                         ;;
        !          2275: 
        !          2276:         --tag)          test $# = 0 && func_missing_arg $_G_opt && break
        !          2277:                         opt_tag=$1
        !          2278:                         func_append preserve_args " $_G_opt $1"
        !          2279:                         func_enable_tag "$1"
        !          2280:                         shift
        !          2281:                         ;;
        !          2282: 
        !          2283:         --verbose|-v)   opt_quiet=false
        !          2284:                         opt_verbose=:
        !          2285:                         func_append preserve_args " $_G_opt"
        !          2286:                         ;;
1.1       misho    2287: 
1.1.1.3 ! misho    2288:        # An option not handled by this hook function:
        !          2289:         *)             set dummy "$_G_opt" ${1+"$@"};  shift; break  ;;
        !          2290:       esac
        !          2291:     done
1.1       misho    2292: 
                   2293: 
1.1.1.3 ! misho    2294:     # save modified positional parameters for caller
        !          2295:     func_quote_for_eval ${1+"$@"}
        !          2296:     libtool_parse_options_result=$func_quote_for_eval_result
        !          2297: }
        !          2298: func_add_hook func_parse_options libtool_parse_options
1.1       misho    2299: 
                   2300: 
                   2301: 
1.1.1.3 ! misho    2302: # libtool_validate_options [ARG]...
        !          2303: # ---------------------------------
        !          2304: # Perform any sanity checks on option settings and/or unconsumed
        !          2305: # arguments.
        !          2306: libtool_validate_options ()
        !          2307: {
        !          2308:     # save first non-option argument
        !          2309:     if test 0 -lt $#; then
        !          2310:       nonopt=$1
        !          2311:       shift
1.1       misho    2312:     fi
                   2313: 
1.1.1.3 ! misho    2314:     # preserve --debug
        !          2315:     test : = "$debug_cmd" || func_append preserve_args " --debug"
1.1       misho    2316: 
1.1.1.3 ! misho    2317:     case $host in
        !          2318:       *cygwin* | *mingw* | *pw32* | *cegcc*)
        !          2319:         # don't eliminate duplications in $postdeps and $predeps
        !          2320:         opt_duplicate_compiler_generated_deps=:
        !          2321:         ;;
        !          2322:       *)
        !          2323:         opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
        !          2324:         ;;
        !          2325:     esac
        !          2326: 
        !          2327:     $opt_help || {
        !          2328:       # Sanity checks first:
        !          2329:       func_check_version_match
        !          2330: 
        !          2331:       test yes != "$build_libtool_libs" \
        !          2332:         && test yes != "$build_old_libs" \
        !          2333:         && func_fatal_configuration "not configured to build any kind of library"
        !          2334: 
        !          2335:       # Darwin sucks
        !          2336:       eval std_shrext=\"$shrext_cmds\"
        !          2337: 
        !          2338:       # Only execute mode is allowed to have -dlopen flags.
        !          2339:       if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
        !          2340:         func_error "unrecognized option '-dlopen'"
        !          2341:         $ECHO "$help" 1>&2
        !          2342:         exit $EXIT_FAILURE
        !          2343:       fi
        !          2344: 
        !          2345:       # Change the help message to a mode-specific one.
        !          2346:       generic_help=$help
        !          2347:       help="Try '$progname --help --mode=$opt_mode' for more information."
        !          2348:     }
1.1       misho    2349: 
1.1.1.3 ! misho    2350:     # Pass back the unparsed argument list
        !          2351:     func_quote_for_eval ${1+"$@"}
        !          2352:     libtool_validate_options_result=$func_quote_for_eval_result
1.1       misho    2353: }
1.1.1.3 ! misho    2354: func_add_hook func_validate_options libtool_validate_options
        !          2355: 
1.1       misho    2356: 
1.1.1.3 ! misho    2357: # Process options as early as possible so that --help and --version
        !          2358: # can return quickly.
        !          2359: func_options ${1+"$@"}
        !          2360: eval set dummy "$func_options_result"; shift
1.1       misho    2361: 
                   2362: 
                   2363: 
                   2364: ## ----------- ##
                   2365: ##    Main.    ##
                   2366: ## ----------- ##
                   2367: 
1.1.1.3 ! misho    2368: magic='%%%MAGIC variable%%%'
        !          2369: magic_exe='%%%MAGIC EXE variable%%%'
        !          2370: 
        !          2371: # Global variables.
        !          2372: extracted_archives=
        !          2373: extracted_serial=0
        !          2374: 
        !          2375: # If this variable is set in any of the actions, the command in it
        !          2376: # will be execed at the end.  This prevents here-documents from being
        !          2377: # left over by shells.
        !          2378: exec_cmd=
        !          2379: 
        !          2380: 
        !          2381: # A function that is used when there is no print builtin or printf.
        !          2382: func_fallback_echo ()
        !          2383: {
        !          2384:   eval 'cat <<_LTECHO_EOF
        !          2385: $1
        !          2386: _LTECHO_EOF'
        !          2387: }
        !          2388: 
1.1       misho    2389: # func_lalib_p file
1.1.1.3 ! misho    2390: # True iff FILE is a libtool '.la' library or '.lo' object file.
1.1       misho    2391: # This function is only a basic sanity check; it will hardly flush out
                   2392: # determined imposters.
                   2393: func_lalib_p ()
                   2394: {
                   2395:     test -f "$1" &&
                   2396:       $SED -e 4q "$1" 2>/dev/null \
                   2397:         | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
                   2398: }
                   2399: 
                   2400: # func_lalib_unsafe_p file
1.1.1.3 ! misho    2401: # True iff FILE is a libtool '.la' library or '.lo' object file.
1.1       misho    2402: # This function implements the same check as func_lalib_p without
                   2403: # resorting to external programs.  To this end, it redirects stdin and
                   2404: # closes it afterwards, without saving the original file descriptor.
                   2405: # As a safety measure, use it only where a negative result would be
1.1.1.3 ! misho    2406: # fatal anyway.  Works if 'file' does not exist.
1.1       misho    2407: func_lalib_unsafe_p ()
                   2408: {
                   2409:     lalib_p=no
                   2410:     if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
                   2411:        for lalib_p_l in 1 2 3 4
                   2412:        do
                   2413:            read lalib_p_line
1.1.1.3 ! misho    2414:            case $lalib_p_line in
1.1       misho    2415:                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
                   2416:            esac
                   2417:        done
                   2418:        exec 0<&5 5<&-
                   2419:     fi
1.1.1.3 ! misho    2420:     test yes = "$lalib_p"
1.1       misho    2421: }
                   2422: 
                   2423: # func_ltwrapper_script_p file
                   2424: # True iff FILE is a libtool wrapper script
                   2425: # This function is only a basic sanity check; it will hardly flush out
                   2426: # determined imposters.
                   2427: func_ltwrapper_script_p ()
                   2428: {
                   2429:     func_lalib_p "$1"
                   2430: }
                   2431: 
                   2432: # func_ltwrapper_executable_p file
                   2433: # True iff FILE is a libtool wrapper executable
                   2434: # This function is only a basic sanity check; it will hardly flush out
                   2435: # determined imposters.
                   2436: func_ltwrapper_executable_p ()
                   2437: {
                   2438:     func_ltwrapper_exec_suffix=
                   2439:     case $1 in
                   2440:     *.exe) ;;
                   2441:     *) func_ltwrapper_exec_suffix=.exe ;;
                   2442:     esac
                   2443:     $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
                   2444: }
                   2445: 
                   2446: # func_ltwrapper_scriptname file
                   2447: # Assumes file is an ltwrapper_executable
                   2448: # uses $file to determine the appropriate filename for a
                   2449: # temporary ltwrapper_script.
                   2450: func_ltwrapper_scriptname ()
                   2451: {
                   2452:     func_dirname_and_basename "$1" "" "."
                   2453:     func_stripname '' '.exe' "$func_basename_result"
1.1.1.3 ! misho    2454:     func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
1.1       misho    2455: }
                   2456: 
                   2457: # func_ltwrapper_p file
                   2458: # True iff FILE is a libtool wrapper script or wrapper executable
                   2459: # This function is only a basic sanity check; it will hardly flush out
                   2460: # determined imposters.
                   2461: func_ltwrapper_p ()
                   2462: {
                   2463:     func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
                   2464: }
                   2465: 
                   2466: 
                   2467: # func_execute_cmds commands fail_cmd
                   2468: # Execute tilde-delimited COMMANDS.
                   2469: # If FAIL_CMD is given, eval that upon failure.
                   2470: # FAIL_CMD may read-access the current command in variable CMD!
                   2471: func_execute_cmds ()
                   2472: {
1.1.1.3 ! misho    2473:     $debug_cmd
        !          2474: 
1.1       misho    2475:     save_ifs=$IFS; IFS='~'
                   2476:     for cmd in $1; do
1.1.1.3 ! misho    2477:       IFS=$sp$nl
1.1       misho    2478:       eval cmd=\"$cmd\"
1.1.1.3 ! misho    2479:       IFS=$save_ifs
1.1       misho    2480:       func_show_eval "$cmd" "${2-:}"
                   2481:     done
                   2482:     IFS=$save_ifs
                   2483: }
                   2484: 
                   2485: 
                   2486: # func_source file
                   2487: # Source FILE, adding directory component if necessary.
                   2488: # Note that it is not necessary on cygwin/mingw to append a dot to
                   2489: # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
                   2490: # behavior happens only for exec(3), not for open(2)!  Also, sourcing
1.1.1.3 ! misho    2491: # 'FILE.' does not work on cygwin managed mounts.
1.1       misho    2492: func_source ()
                   2493: {
1.1.1.3 ! misho    2494:     $debug_cmd
        !          2495: 
1.1       misho    2496:     case $1 in
                   2497:     */* | *\\*)        . "$1" ;;
                   2498:     *)         . "./$1" ;;
                   2499:     esac
                   2500: }
                   2501: 
                   2502: 
                   2503: # func_resolve_sysroot PATH
                   2504: # Replace a leading = in PATH with a sysroot.  Store the result into
                   2505: # func_resolve_sysroot_result
                   2506: func_resolve_sysroot ()
                   2507: {
                   2508:   func_resolve_sysroot_result=$1
                   2509:   case $func_resolve_sysroot_result in
                   2510:   =*)
                   2511:     func_stripname '=' '' "$func_resolve_sysroot_result"
                   2512:     func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
                   2513:     ;;
                   2514:   esac
                   2515: }
                   2516: 
                   2517: # func_replace_sysroot PATH
                   2518: # If PATH begins with the sysroot, replace it with = and
                   2519: # store the result into func_replace_sysroot_result.
                   2520: func_replace_sysroot ()
                   2521: {
1.1.1.3 ! misho    2522:   case $lt_sysroot:$1 in
1.1       misho    2523:   ?*:"$lt_sysroot"*)
                   2524:     func_stripname "$lt_sysroot" '' "$1"
1.1.1.3 ! misho    2525:     func_replace_sysroot_result='='$func_stripname_result
1.1       misho    2526:     ;;
                   2527:   *)
                   2528:     # Including no sysroot.
                   2529:     func_replace_sysroot_result=$1
                   2530:     ;;
                   2531:   esac
                   2532: }
                   2533: 
                   2534: # func_infer_tag arg
                   2535: # Infer tagged configuration to use if any are available and
                   2536: # if one wasn't chosen via the "--tag" command line option.
                   2537: # Only attempt this if the compiler in the base compile
                   2538: # command doesn't match the default compiler.
                   2539: # arg is usually of the form 'gcc ...'
                   2540: func_infer_tag ()
                   2541: {
1.1.1.3 ! misho    2542:     $debug_cmd
        !          2543: 
1.1       misho    2544:     if test -n "$available_tags" && test -z "$tagname"; then
                   2545:       CC_quoted=
                   2546:       for arg in $CC; do
                   2547:        func_append_quoted CC_quoted "$arg"
                   2548:       done
                   2549:       CC_expanded=`func_echo_all $CC`
                   2550:       CC_quoted_expanded=`func_echo_all $CC_quoted`
                   2551:       case $@ in
                   2552:       # Blanks in the command may have been stripped by the calling shell,
                   2553:       # but not from the CC environment variable when configure was run.
                   2554:       " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
                   2555:       " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
                   2556:       # Blanks at the start of $base_compile will cause this to fail
                   2557:       # if we don't check for them as well.
                   2558:       *)
                   2559:        for z in $available_tags; do
                   2560:          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
                   2561:            # Evaluate the configuration.
1.1.1.3 ! misho    2562:            eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1.1       misho    2563:            CC_quoted=
                   2564:            for arg in $CC; do
                   2565:              # Double-quote args containing other shell metacharacters.
                   2566:              func_append_quoted CC_quoted "$arg"
                   2567:            done
                   2568:            CC_expanded=`func_echo_all $CC`
                   2569:            CC_quoted_expanded=`func_echo_all $CC_quoted`
                   2570:            case "$@ " in
                   2571:            " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
                   2572:            " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
                   2573:              # The compiler in the base compile command matches
                   2574:              # the one in the tagged configuration.
                   2575:              # Assume this is the tagged configuration we want.
                   2576:              tagname=$z
                   2577:              break
                   2578:              ;;
                   2579:            esac
                   2580:          fi
                   2581:        done
                   2582:        # If $tagname still isn't set, then no tagged configuration
                   2583:        # was found and let the user know that the "--tag" command
                   2584:        # line option must be used.
                   2585:        if test -z "$tagname"; then
                   2586:          func_echo "unable to infer tagged configuration"
1.1.1.3 ! misho    2587:          func_fatal_error "specify a tag with '--tag'"
1.1       misho    2588: #      else
                   2589: #        func_verbose "using $tagname tagged configuration"
                   2590:        fi
                   2591:        ;;
                   2592:       esac
                   2593:     fi
                   2594: }
                   2595: 
                   2596: 
                   2597: 
                   2598: # func_write_libtool_object output_name pic_name nonpic_name
                   2599: # Create a libtool object file (analogous to a ".la" file),
                   2600: # but don't create it if we're doing a dry run.
                   2601: func_write_libtool_object ()
                   2602: {
1.1.1.3 ! misho    2603:     write_libobj=$1
        !          2604:     if test yes = "$build_libtool_libs"; then
        !          2605:       write_lobj=\'$2\'
1.1       misho    2606:     else
                   2607:       write_lobj=none
                   2608:     fi
                   2609: 
1.1.1.3 ! misho    2610:     if test yes = "$build_old_libs"; then
        !          2611:       write_oldobj=\'$3\'
1.1       misho    2612:     else
                   2613:       write_oldobj=none
                   2614:     fi
                   2615: 
                   2616:     $opt_dry_run || {
                   2617:       cat >${write_libobj}T <<EOF
                   2618: # $write_libobj - a libtool object file
1.1.1.3 ! misho    2619: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1.1       misho    2620: #
                   2621: # Please DO NOT delete this file!
                   2622: # It is necessary for linking the library.
                   2623: 
                   2624: # Name of the PIC object.
                   2625: pic_object=$write_lobj
                   2626: 
                   2627: # Name of the non-PIC object
                   2628: non_pic_object=$write_oldobj
                   2629: 
                   2630: EOF
1.1.1.3 ! misho    2631:       $MV "${write_libobj}T" "$write_libobj"
1.1       misho    2632:     }
                   2633: }
                   2634: 
                   2635: 
                   2636: ##################################################
                   2637: # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
                   2638: ##################################################
                   2639: 
                   2640: # func_convert_core_file_wine_to_w32 ARG
                   2641: # Helper function used by file name conversion functions when $build is *nix,
                   2642: # and $host is mingw, cygwin, or some other w32 environment. Relies on a
                   2643: # correctly configured wine environment available, with the winepath program
                   2644: # in $build's $PATH.
                   2645: #
                   2646: # ARG is the $build file name to be converted to w32 format.
                   2647: # Result is available in $func_convert_core_file_wine_to_w32_result, and will
                   2648: # be empty on error (or when ARG is empty)
                   2649: func_convert_core_file_wine_to_w32 ()
                   2650: {
1.1.1.3 ! misho    2651:   $debug_cmd
        !          2652: 
        !          2653:   func_convert_core_file_wine_to_w32_result=$1
1.1       misho    2654:   if test -n "$1"; then
                   2655:     # Unfortunately, winepath does not exit with a non-zero error code, so we
                   2656:     # are forced to check the contents of stdout. On the other hand, if the
                   2657:     # command is not found, the shell will set an exit code of 127 and print
                   2658:     # *an error message* to stdout. So we must check for both error code of
                   2659:     # zero AND non-empty stdout, which explains the odd construction:
                   2660:     func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1.1.1.3 ! misho    2661:     if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
1.1       misho    2662:       func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1.1.1.3 ! misho    2663:         $SED -e "$sed_naive_backslashify"`
1.1       misho    2664:     else
                   2665:       func_convert_core_file_wine_to_w32_result=
                   2666:     fi
                   2667:   fi
                   2668: }
                   2669: # end: func_convert_core_file_wine_to_w32
                   2670: 
                   2671: 
                   2672: # func_convert_core_path_wine_to_w32 ARG
                   2673: # Helper function used by path conversion functions when $build is *nix, and
                   2674: # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
                   2675: # configured wine environment available, with the winepath program in $build's
                   2676: # $PATH. Assumes ARG has no leading or trailing path separator characters.
                   2677: #
                   2678: # ARG is path to be converted from $build format to win32.
                   2679: # Result is available in $func_convert_core_path_wine_to_w32_result.
                   2680: # Unconvertible file (directory) names in ARG are skipped; if no directory names
                   2681: # are convertible, then the result may be empty.
                   2682: func_convert_core_path_wine_to_w32 ()
                   2683: {
1.1.1.3 ! misho    2684:   $debug_cmd
        !          2685: 
1.1       misho    2686:   # unfortunately, winepath doesn't convert paths, only file names
1.1.1.3 ! misho    2687:   func_convert_core_path_wine_to_w32_result=
1.1       misho    2688:   if test -n "$1"; then
                   2689:     oldIFS=$IFS
                   2690:     IFS=:
                   2691:     for func_convert_core_path_wine_to_w32_f in $1; do
                   2692:       IFS=$oldIFS
                   2693:       func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1.1.1.3 ! misho    2694:       if test -n "$func_convert_core_file_wine_to_w32_result"; then
1.1       misho    2695:         if test -z "$func_convert_core_path_wine_to_w32_result"; then
1.1.1.3 ! misho    2696:           func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
1.1       misho    2697:         else
                   2698:           func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
                   2699:         fi
                   2700:       fi
                   2701:     done
                   2702:     IFS=$oldIFS
                   2703:   fi
                   2704: }
                   2705: # end: func_convert_core_path_wine_to_w32
                   2706: 
                   2707: 
                   2708: # func_cygpath ARGS...
                   2709: # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
                   2710: # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
                   2711: # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
                   2712: # (2), returns the Cygwin file name or path in func_cygpath_result (input
                   2713: # file name or path is assumed to be in w32 format, as previously converted
                   2714: # from $build's *nix or MSYS format). In case (3), returns the w32 file name
                   2715: # or path in func_cygpath_result (input file name or path is assumed to be in
                   2716: # Cygwin format). Returns an empty string on error.
                   2717: #
                   2718: # ARGS are passed to cygpath, with the last one being the file name or path to
                   2719: # be converted.
                   2720: #
                   2721: # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
                   2722: # environment variable; do not put it in $PATH.
                   2723: func_cygpath ()
                   2724: {
1.1.1.3 ! misho    2725:   $debug_cmd
        !          2726: 
1.1       misho    2727:   if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
                   2728:     func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
                   2729:     if test "$?" -ne 0; then
                   2730:       # on failure, ensure result is empty
                   2731:       func_cygpath_result=
                   2732:     fi
                   2733:   else
                   2734:     func_cygpath_result=
1.1.1.3 ! misho    2735:     func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
1.1       misho    2736:   fi
                   2737: }
                   2738: #end: func_cygpath
                   2739: 
                   2740: 
                   2741: # func_convert_core_msys_to_w32 ARG
                   2742: # Convert file name or path ARG from MSYS format to w32 format.  Return
                   2743: # result in func_convert_core_msys_to_w32_result.
                   2744: func_convert_core_msys_to_w32 ()
                   2745: {
1.1.1.3 ! misho    2746:   $debug_cmd
        !          2747: 
1.1       misho    2748:   # awkward: cmd appends spaces to result
                   2749:   func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1.1.1.3 ! misho    2750:     $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
1.1       misho    2751: }
                   2752: #end: func_convert_core_msys_to_w32
                   2753: 
                   2754: 
                   2755: # func_convert_file_check ARG1 ARG2
                   2756: # Verify that ARG1 (a file name in $build format) was converted to $host
                   2757: # format in ARG2. Otherwise, emit an error message, but continue (resetting
                   2758: # func_to_host_file_result to ARG1).
                   2759: func_convert_file_check ()
                   2760: {
1.1.1.3 ! misho    2761:   $debug_cmd
        !          2762: 
        !          2763:   if test -z "$2" && test -n "$1"; then
1.1       misho    2764:     func_error "Could not determine host file name corresponding to"
1.1.1.3 ! misho    2765:     func_error "  '$1'"
1.1       misho    2766:     func_error "Continuing, but uninstalled executables may not work."
                   2767:     # Fallback:
1.1.1.3 ! misho    2768:     func_to_host_file_result=$1
1.1       misho    2769:   fi
                   2770: }
                   2771: # end func_convert_file_check
                   2772: 
                   2773: 
                   2774: # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
                   2775: # Verify that FROM_PATH (a path in $build format) was converted to $host
                   2776: # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
                   2777: # func_to_host_file_result to a simplistic fallback value (see below).
                   2778: func_convert_path_check ()
                   2779: {
1.1.1.3 ! misho    2780:   $debug_cmd
        !          2781: 
1.1       misho    2782:   if test -z "$4" && test -n "$3"; then
                   2783:     func_error "Could not determine the host path corresponding to"
1.1.1.3 ! misho    2784:     func_error "  '$3'"
1.1       misho    2785:     func_error "Continuing, but uninstalled executables may not work."
                   2786:     # Fallback.  This is a deliberately simplistic "conversion" and
                   2787:     # should not be "improved".  See libtool.info.
                   2788:     if test "x$1" != "x$2"; then
                   2789:       lt_replace_pathsep_chars="s|$1|$2|g"
                   2790:       func_to_host_path_result=`echo "$3" |
                   2791:         $SED -e "$lt_replace_pathsep_chars"`
                   2792:     else
1.1.1.3 ! misho    2793:       func_to_host_path_result=$3
1.1       misho    2794:     fi
                   2795:   fi
                   2796: }
                   2797: # end func_convert_path_check
                   2798: 
                   2799: 
                   2800: # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
                   2801: # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
                   2802: # and appending REPL if ORIG matches BACKPAT.
                   2803: func_convert_path_front_back_pathsep ()
                   2804: {
1.1.1.3 ! misho    2805:   $debug_cmd
        !          2806: 
1.1       misho    2807:   case $4 in
1.1.1.3 ! misho    2808:   $1 ) func_to_host_path_result=$3$func_to_host_path_result
1.1       misho    2809:     ;;
                   2810:   esac
                   2811:   case $4 in
                   2812:   $2 ) func_append func_to_host_path_result "$3"
                   2813:     ;;
                   2814:   esac
                   2815: }
                   2816: # end func_convert_path_front_back_pathsep
                   2817: 
                   2818: 
                   2819: ##################################################
                   2820: # $build to $host FILE NAME CONVERSION FUNCTIONS #
                   2821: ##################################################
1.1.1.3 ! misho    2822: # invoked via '$to_host_file_cmd ARG'
1.1       misho    2823: #
                   2824: # In each case, ARG is the path to be converted from $build to $host format.
                   2825: # Result will be available in $func_to_host_file_result.
                   2826: 
                   2827: 
                   2828: # func_to_host_file ARG
                   2829: # Converts the file name ARG from $build format to $host format. Return result
                   2830: # in func_to_host_file_result.
                   2831: func_to_host_file ()
                   2832: {
1.1.1.3 ! misho    2833:   $debug_cmd
        !          2834: 
1.1       misho    2835:   $to_host_file_cmd "$1"
                   2836: }
                   2837: # end func_to_host_file
                   2838: 
                   2839: 
                   2840: # func_to_tool_file ARG LAZY
                   2841: # converts the file name ARG from $build format to toolchain format. Return
                   2842: # result in func_to_tool_file_result.  If the conversion in use is listed
                   2843: # in (the comma separated) LAZY, no conversion takes place.
                   2844: func_to_tool_file ()
                   2845: {
1.1.1.3 ! misho    2846:   $debug_cmd
        !          2847: 
1.1       misho    2848:   case ,$2, in
                   2849:     *,"$to_tool_file_cmd",*)
                   2850:       func_to_tool_file_result=$1
                   2851:       ;;
                   2852:     *)
                   2853:       $to_tool_file_cmd "$1"
                   2854:       func_to_tool_file_result=$func_to_host_file_result
                   2855:       ;;
                   2856:   esac
                   2857: }
                   2858: # end func_to_tool_file
                   2859: 
                   2860: 
                   2861: # func_convert_file_noop ARG
                   2862: # Copy ARG to func_to_host_file_result.
                   2863: func_convert_file_noop ()
                   2864: {
1.1.1.3 ! misho    2865:   func_to_host_file_result=$1
1.1       misho    2866: }
                   2867: # end func_convert_file_noop
                   2868: 
                   2869: 
                   2870: # func_convert_file_msys_to_w32 ARG
                   2871: # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
                   2872: # conversion to w32 is not available inside the cwrapper.  Returns result in
                   2873: # func_to_host_file_result.
                   2874: func_convert_file_msys_to_w32 ()
                   2875: {
1.1.1.3 ! misho    2876:   $debug_cmd
        !          2877: 
        !          2878:   func_to_host_file_result=$1
1.1       misho    2879:   if test -n "$1"; then
                   2880:     func_convert_core_msys_to_w32 "$1"
1.1.1.3 ! misho    2881:     func_to_host_file_result=$func_convert_core_msys_to_w32_result
1.1       misho    2882:   fi
                   2883:   func_convert_file_check "$1" "$func_to_host_file_result"
                   2884: }
                   2885: # end func_convert_file_msys_to_w32
                   2886: 
                   2887: 
                   2888: # func_convert_file_cygwin_to_w32 ARG
                   2889: # Convert file name ARG from Cygwin to w32 format.  Returns result in
                   2890: # func_to_host_file_result.
                   2891: func_convert_file_cygwin_to_w32 ()
                   2892: {
1.1.1.3 ! misho    2893:   $debug_cmd
        !          2894: 
        !          2895:   func_to_host_file_result=$1
1.1       misho    2896:   if test -n "$1"; then
                   2897:     # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
                   2898:     # LT_CYGPATH in this case.
                   2899:     func_to_host_file_result=`cygpath -m "$1"`
                   2900:   fi
                   2901:   func_convert_file_check "$1" "$func_to_host_file_result"
                   2902: }
                   2903: # end func_convert_file_cygwin_to_w32
                   2904: 
                   2905: 
                   2906: # func_convert_file_nix_to_w32 ARG
                   2907: # Convert file name ARG from *nix to w32 format.  Requires a wine environment
                   2908: # and a working winepath. Returns result in func_to_host_file_result.
                   2909: func_convert_file_nix_to_w32 ()
                   2910: {
1.1.1.3 ! misho    2911:   $debug_cmd
        !          2912: 
        !          2913:   func_to_host_file_result=$1
1.1       misho    2914:   if test -n "$1"; then
                   2915:     func_convert_core_file_wine_to_w32 "$1"
1.1.1.3 ! misho    2916:     func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
1.1       misho    2917:   fi
                   2918:   func_convert_file_check "$1" "$func_to_host_file_result"
                   2919: }
                   2920: # end func_convert_file_nix_to_w32
                   2921: 
                   2922: 
                   2923: # func_convert_file_msys_to_cygwin ARG
                   2924: # Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
                   2925: # Returns result in func_to_host_file_result.
                   2926: func_convert_file_msys_to_cygwin ()
                   2927: {
1.1.1.3 ! misho    2928:   $debug_cmd
        !          2929: 
        !          2930:   func_to_host_file_result=$1
1.1       misho    2931:   if test -n "$1"; then
                   2932:     func_convert_core_msys_to_w32 "$1"
                   2933:     func_cygpath -u "$func_convert_core_msys_to_w32_result"
1.1.1.3 ! misho    2934:     func_to_host_file_result=$func_cygpath_result
1.1       misho    2935:   fi
                   2936:   func_convert_file_check "$1" "$func_to_host_file_result"
                   2937: }
                   2938: # end func_convert_file_msys_to_cygwin
                   2939: 
                   2940: 
                   2941: # func_convert_file_nix_to_cygwin ARG
                   2942: # Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
                   2943: # in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
                   2944: # in func_to_host_file_result.
                   2945: func_convert_file_nix_to_cygwin ()
                   2946: {
1.1.1.3 ! misho    2947:   $debug_cmd
        !          2948: 
        !          2949:   func_to_host_file_result=$1
1.1       misho    2950:   if test -n "$1"; then
                   2951:     # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
                   2952:     func_convert_core_file_wine_to_w32 "$1"
                   2953:     func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1.1.1.3 ! misho    2954:     func_to_host_file_result=$func_cygpath_result
1.1       misho    2955:   fi
                   2956:   func_convert_file_check "$1" "$func_to_host_file_result"
                   2957: }
                   2958: # end func_convert_file_nix_to_cygwin
                   2959: 
                   2960: 
                   2961: #############################################
                   2962: # $build to $host PATH CONVERSION FUNCTIONS #
                   2963: #############################################
1.1.1.3 ! misho    2964: # invoked via '$to_host_path_cmd ARG'
1.1       misho    2965: #
                   2966: # In each case, ARG is the path to be converted from $build to $host format.
                   2967: # The result will be available in $func_to_host_path_result.
                   2968: #
                   2969: # Path separators are also converted from $build format to $host format.  If
                   2970: # ARG begins or ends with a path separator character, it is preserved (but
                   2971: # converted to $host format) on output.
                   2972: #
                   2973: # All path conversion functions are named using the following convention:
                   2974: #   file name conversion function    : func_convert_file_X_to_Y ()
                   2975: #   path conversion function         : func_convert_path_X_to_Y ()
                   2976: # where, for any given $build/$host combination the 'X_to_Y' value is the
                   2977: # same.  If conversion functions are added for new $build/$host combinations,
                   2978: # the two new functions must follow this pattern, or func_init_to_host_path_cmd
                   2979: # will break.
                   2980: 
                   2981: 
                   2982: # func_init_to_host_path_cmd
                   2983: # Ensures that function "pointer" variable $to_host_path_cmd is set to the
                   2984: # appropriate value, based on the value of $to_host_file_cmd.
                   2985: to_host_path_cmd=
                   2986: func_init_to_host_path_cmd ()
                   2987: {
1.1.1.3 ! misho    2988:   $debug_cmd
        !          2989: 
1.1       misho    2990:   if test -z "$to_host_path_cmd"; then
                   2991:     func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1.1.1.3 ! misho    2992:     to_host_path_cmd=func_convert_path_$func_stripname_result
1.1       misho    2993:   fi
                   2994: }
                   2995: 
                   2996: 
                   2997: # func_to_host_path ARG
                   2998: # Converts the path ARG from $build format to $host format. Return result
                   2999: # in func_to_host_path_result.
                   3000: func_to_host_path ()
                   3001: {
1.1.1.3 ! misho    3002:   $debug_cmd
        !          3003: 
1.1       misho    3004:   func_init_to_host_path_cmd
                   3005:   $to_host_path_cmd "$1"
                   3006: }
                   3007: # end func_to_host_path
                   3008: 
                   3009: 
                   3010: # func_convert_path_noop ARG
                   3011: # Copy ARG to func_to_host_path_result.
                   3012: func_convert_path_noop ()
                   3013: {
1.1.1.3 ! misho    3014:   func_to_host_path_result=$1
1.1       misho    3015: }
                   3016: # end func_convert_path_noop
                   3017: 
                   3018: 
                   3019: # func_convert_path_msys_to_w32 ARG
                   3020: # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
                   3021: # conversion to w32 is not available inside the cwrapper.  Returns result in
                   3022: # func_to_host_path_result.
                   3023: func_convert_path_msys_to_w32 ()
                   3024: {
1.1.1.3 ! misho    3025:   $debug_cmd
        !          3026: 
        !          3027:   func_to_host_path_result=$1
1.1       misho    3028:   if test -n "$1"; then
                   3029:     # Remove leading and trailing path separator characters from ARG.  MSYS
                   3030:     # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
                   3031:     # and winepath ignores them completely.
                   3032:     func_stripname : : "$1"
                   3033:     func_to_host_path_tmp1=$func_stripname_result
                   3034:     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1.1.1.3 ! misho    3035:     func_to_host_path_result=$func_convert_core_msys_to_w32_result
1.1       misho    3036:     func_convert_path_check : ";" \
                   3037:       "$func_to_host_path_tmp1" "$func_to_host_path_result"
                   3038:     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
                   3039:   fi
                   3040: }
                   3041: # end func_convert_path_msys_to_w32
                   3042: 
                   3043: 
                   3044: # func_convert_path_cygwin_to_w32 ARG
                   3045: # Convert path ARG from Cygwin to w32 format.  Returns result in
                   3046: # func_to_host_file_result.
                   3047: func_convert_path_cygwin_to_w32 ()
                   3048: {
1.1.1.3 ! misho    3049:   $debug_cmd
        !          3050: 
        !          3051:   func_to_host_path_result=$1
1.1       misho    3052:   if test -n "$1"; then
                   3053:     # See func_convert_path_msys_to_w32:
                   3054:     func_stripname : : "$1"
                   3055:     func_to_host_path_tmp1=$func_stripname_result
                   3056:     func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
                   3057:     func_convert_path_check : ";" \
                   3058:       "$func_to_host_path_tmp1" "$func_to_host_path_result"
                   3059:     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
                   3060:   fi
                   3061: }
                   3062: # end func_convert_path_cygwin_to_w32
                   3063: 
                   3064: 
                   3065: # func_convert_path_nix_to_w32 ARG
                   3066: # Convert path ARG from *nix to w32 format.  Requires a wine environment and
                   3067: # a working winepath.  Returns result in func_to_host_file_result.
                   3068: func_convert_path_nix_to_w32 ()
                   3069: {
1.1.1.3 ! misho    3070:   $debug_cmd
        !          3071: 
        !          3072:   func_to_host_path_result=$1
1.1       misho    3073:   if test -n "$1"; then
                   3074:     # See func_convert_path_msys_to_w32:
                   3075:     func_stripname : : "$1"
                   3076:     func_to_host_path_tmp1=$func_stripname_result
                   3077:     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1.1.1.3 ! misho    3078:     func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
1.1       misho    3079:     func_convert_path_check : ";" \
                   3080:       "$func_to_host_path_tmp1" "$func_to_host_path_result"
                   3081:     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
                   3082:   fi
                   3083: }
                   3084: # end func_convert_path_nix_to_w32
                   3085: 
                   3086: 
                   3087: # func_convert_path_msys_to_cygwin ARG
                   3088: # Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
                   3089: # Returns result in func_to_host_file_result.
                   3090: func_convert_path_msys_to_cygwin ()
                   3091: {
1.1.1.3 ! misho    3092:   $debug_cmd
        !          3093: 
        !          3094:   func_to_host_path_result=$1
1.1       misho    3095:   if test -n "$1"; then
                   3096:     # See func_convert_path_msys_to_w32:
                   3097:     func_stripname : : "$1"
                   3098:     func_to_host_path_tmp1=$func_stripname_result
                   3099:     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
                   3100:     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1.1.1.3 ! misho    3101:     func_to_host_path_result=$func_cygpath_result
1.1       misho    3102:     func_convert_path_check : : \
                   3103:       "$func_to_host_path_tmp1" "$func_to_host_path_result"
                   3104:     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
                   3105:   fi
                   3106: }
                   3107: # end func_convert_path_msys_to_cygwin
                   3108: 
                   3109: 
                   3110: # func_convert_path_nix_to_cygwin ARG
                   3111: # Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
                   3112: # a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
                   3113: # func_to_host_file_result.
                   3114: func_convert_path_nix_to_cygwin ()
                   3115: {
1.1.1.3 ! misho    3116:   $debug_cmd
        !          3117: 
        !          3118:   func_to_host_path_result=$1
1.1       misho    3119:   if test -n "$1"; then
                   3120:     # Remove leading and trailing path separator characters from
                   3121:     # ARG. msys behavior is inconsistent here, cygpath turns them
                   3122:     # into '.;' and ';.', and winepath ignores them completely.
                   3123:     func_stripname : : "$1"
                   3124:     func_to_host_path_tmp1=$func_stripname_result
                   3125:     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
                   3126:     func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1.1.1.3 ! misho    3127:     func_to_host_path_result=$func_cygpath_result
1.1       misho    3128:     func_convert_path_check : : \
                   3129:       "$func_to_host_path_tmp1" "$func_to_host_path_result"
                   3130:     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
                   3131:   fi
                   3132: }
                   3133: # end func_convert_path_nix_to_cygwin
                   3134: 
                   3135: 
1.1.1.3 ! misho    3136: # func_dll_def_p FILE
        !          3137: # True iff FILE is a Windows DLL '.def' file.
        !          3138: # Keep in sync with _LT_DLL_DEF_P in libtool.m4
        !          3139: func_dll_def_p ()
        !          3140: {
        !          3141:   $debug_cmd
        !          3142: 
        !          3143:   func_dll_def_p_tmp=`$SED -n \
        !          3144:     -e 's/^[    ]*//' \
        !          3145:     -e '/^\(;.*\)*$/d' \
        !          3146:     -e 's/^\(EXPORTS\|LIBRARY\)\([      ].*\)*$/DEF/p' \
        !          3147:     -e q \
        !          3148:     "$1"`
        !          3149:   test DEF = "$func_dll_def_p_tmp"
        !          3150: }
        !          3151: 
        !          3152: 
1.1       misho    3153: # func_mode_compile arg...
                   3154: func_mode_compile ()
                   3155: {
1.1.1.3 ! misho    3156:     $debug_cmd
        !          3157: 
1.1       misho    3158:     # Get the compilation command and the source file.
                   3159:     base_compile=
1.1.1.3 ! misho    3160:     srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
1.1       misho    3161:     suppress_opt=yes
                   3162:     suppress_output=
                   3163:     arg_mode=normal
                   3164:     libobj=
                   3165:     later=
                   3166:     pie_flag=
                   3167: 
                   3168:     for arg
                   3169:     do
                   3170:       case $arg_mode in
                   3171:       arg  )
                   3172:        # do not "continue".  Instead, add this to base_compile
1.1.1.3 ! misho    3173:        lastarg=$arg
1.1       misho    3174:        arg_mode=normal
                   3175:        ;;
                   3176: 
                   3177:       target )
1.1.1.3 ! misho    3178:        libobj=$arg
1.1       misho    3179:        arg_mode=normal
                   3180:        continue
                   3181:        ;;
                   3182: 
                   3183:       normal )
                   3184:        # Accept any command-line options.
                   3185:        case $arg in
                   3186:        -o)
                   3187:          test -n "$libobj" && \
1.1.1.3 ! misho    3188:            func_fatal_error "you cannot specify '-o' more than once"
1.1       misho    3189:          arg_mode=target
                   3190:          continue
                   3191:          ;;
                   3192: 
                   3193:        -pie | -fpie | -fPIE)
                   3194:           func_append pie_flag " $arg"
                   3195:          continue
                   3196:          ;;
                   3197: 
                   3198:        -shared | -static | -prefer-pic | -prefer-non-pic)
                   3199:          func_append later " $arg"
                   3200:          continue
                   3201:          ;;
                   3202: 
                   3203:        -no-suppress)
                   3204:          suppress_opt=no
                   3205:          continue
                   3206:          ;;
                   3207: 
                   3208:        -Xcompiler)
                   3209:          arg_mode=arg  #  the next one goes into the "base_compile" arg list
                   3210:          continue      #  The current "srcfile" will either be retained or
                   3211:          ;;            #  replaced later.  I would guess that would be a bug.
                   3212: 
                   3213:        -Wc,*)
                   3214:          func_stripname '-Wc,' '' "$arg"
                   3215:          args=$func_stripname_result
                   3216:          lastarg=
1.1.1.3 ! misho    3217:          save_ifs=$IFS; IFS=,
1.1       misho    3218:          for arg in $args; do
1.1.1.3 ! misho    3219:            IFS=$save_ifs
1.1       misho    3220:            func_append_quoted lastarg "$arg"
                   3221:          done
1.1.1.3 ! misho    3222:          IFS=$save_ifs
1.1       misho    3223:          func_stripname ' ' '' "$lastarg"
                   3224:          lastarg=$func_stripname_result
                   3225: 
                   3226:          # Add the arguments to base_compile.
                   3227:          func_append base_compile " $lastarg"
                   3228:          continue
                   3229:          ;;
                   3230: 
                   3231:        *)
                   3232:          # Accept the current argument as the source file.
                   3233:          # The previous "srcfile" becomes the current argument.
                   3234:          #
1.1.1.3 ! misho    3235:          lastarg=$srcfile
        !          3236:          srcfile=$arg
1.1       misho    3237:          ;;
                   3238:        esac  #  case $arg
                   3239:        ;;
                   3240:       esac    #  case $arg_mode
                   3241: 
                   3242:       # Aesthetically quote the previous argument.
                   3243:       func_append_quoted base_compile "$lastarg"
                   3244:     done # for arg
                   3245: 
                   3246:     case $arg_mode in
                   3247:     arg)
                   3248:       func_fatal_error "you must specify an argument for -Xcompile"
                   3249:       ;;
                   3250:     target)
1.1.1.3 ! misho    3251:       func_fatal_error "you must specify a target with '-o'"
1.1       misho    3252:       ;;
                   3253:     *)
                   3254:       # Get the name of the library object.
                   3255:       test -z "$libobj" && {
                   3256:        func_basename "$srcfile"
1.1.1.3 ! misho    3257:        libobj=$func_basename_result
1.1       misho    3258:       }
                   3259:       ;;
                   3260:     esac
                   3261: 
                   3262:     # Recognize several different file suffixes.
                   3263:     # If the user specifies -o file.o, it is replaced with file.lo
                   3264:     case $libobj in
                   3265:     *.[cCFSifmso] | \
                   3266:     *.ada | *.adb | *.ads | *.asm | \
                   3267:     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1.1.1.2   misho    3268:     *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
1.1       misho    3269:       func_xform "$libobj"
                   3270:       libobj=$func_xform_result
                   3271:       ;;
                   3272:     esac
                   3273: 
                   3274:     case $libobj in
                   3275:     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
                   3276:     *)
1.1.1.3 ! misho    3277:       func_fatal_error "cannot determine name of library object from '$libobj'"
1.1       misho    3278:       ;;
                   3279:     esac
                   3280: 
                   3281:     func_infer_tag $base_compile
                   3282: 
                   3283:     for arg in $later; do
                   3284:       case $arg in
                   3285:       -shared)
1.1.1.3 ! misho    3286:        test yes = "$build_libtool_libs" \
        !          3287:          || func_fatal_configuration "cannot build a shared library"
1.1       misho    3288:        build_old_libs=no
                   3289:        continue
                   3290:        ;;
                   3291: 
                   3292:       -static)
                   3293:        build_libtool_libs=no
                   3294:        build_old_libs=yes
                   3295:        continue
                   3296:        ;;
                   3297: 
                   3298:       -prefer-pic)
                   3299:        pic_mode=yes
                   3300:        continue
                   3301:        ;;
                   3302: 
                   3303:       -prefer-non-pic)
                   3304:        pic_mode=no
                   3305:        continue
                   3306:        ;;
                   3307:       esac
                   3308:     done
                   3309: 
                   3310:     func_quote_for_eval "$libobj"
                   3311:     test "X$libobj" != "X$func_quote_for_eval_result" \
                   3312:       && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
1.1.1.3 ! misho    3313:       && func_warning "libobj name '$libobj' may not contain shell special characters."
1.1       misho    3314:     func_dirname_and_basename "$obj" "/" ""
1.1.1.3 ! misho    3315:     objname=$func_basename_result
        !          3316:     xdir=$func_dirname_result
        !          3317:     lobj=$xdir$objdir/$objname
1.1       misho    3318: 
                   3319:     test -z "$base_compile" && \
                   3320:       func_fatal_help "you must specify a compilation command"
                   3321: 
                   3322:     # Delete any leftover library objects.
1.1.1.3 ! misho    3323:     if test yes = "$build_old_libs"; then
1.1       misho    3324:       removelist="$obj $lobj $libobj ${libobj}T"
                   3325:     else
                   3326:       removelist="$lobj $libobj ${libobj}T"
                   3327:     fi
                   3328: 
                   3329:     # On Cygwin there's no "real" PIC flag so we must build both object types
                   3330:     case $host_os in
                   3331:     cygwin* | mingw* | pw32* | os2* | cegcc*)
                   3332:       pic_mode=default
                   3333:       ;;
                   3334:     esac
1.1.1.3 ! misho    3335:     if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
1.1       misho    3336:       # non-PIC code in shared libraries is not supported
                   3337:       pic_mode=default
                   3338:     fi
                   3339: 
                   3340:     # Calculate the filename of the output object if compiler does
                   3341:     # not support -o with -c
1.1.1.3 ! misho    3342:     if test no = "$compiler_c_o"; then
        !          3343:       output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
        !          3344:       lockfile=$output_obj.lock
1.1       misho    3345:     else
                   3346:       output_obj=
                   3347:       need_locks=no
                   3348:       lockfile=
                   3349:     fi
                   3350: 
                   3351:     # Lock this critical section if it is needed
                   3352:     # We use this script file to make the link, it avoids creating a new file
1.1.1.3 ! misho    3353:     if test yes = "$need_locks"; then
1.1       misho    3354:       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
                   3355:        func_echo "Waiting for $lockfile to be removed"
                   3356:        sleep 2
                   3357:       done
1.1.1.3 ! misho    3358:     elif test warn = "$need_locks"; then
1.1       misho    3359:       if test -f "$lockfile"; then
                   3360:        $ECHO "\
                   3361: *** ERROR, $lockfile exists and contains:
                   3362: `cat $lockfile 2>/dev/null`
                   3363: 
                   3364: This indicates that another process is trying to use the same
                   3365: temporary object file, and libtool could not work around it because
1.1.1.3 ! misho    3366: your compiler does not support '-c' and '-o' together.  If you
1.1       misho    3367: repeat this compilation, it may succeed, by chance, but you had better
                   3368: avoid parallel builds (make -j) in this platform, or get a better
                   3369: compiler."
                   3370: 
                   3371:        $opt_dry_run || $RM $removelist
                   3372:        exit $EXIT_FAILURE
                   3373:       fi
                   3374:       func_append removelist " $output_obj"
                   3375:       $ECHO "$srcfile" > "$lockfile"
                   3376:     fi
                   3377: 
                   3378:     $opt_dry_run || $RM $removelist
                   3379:     func_append removelist " $lockfile"
                   3380:     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
                   3381: 
                   3382:     func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
                   3383:     srcfile=$func_to_tool_file_result
                   3384:     func_quote_for_eval "$srcfile"
                   3385:     qsrcfile=$func_quote_for_eval_result
                   3386: 
                   3387:     # Only build a PIC object if we are building libtool libraries.
1.1.1.3 ! misho    3388:     if test yes = "$build_libtool_libs"; then
1.1       misho    3389:       # Without this assignment, base_compile gets emptied.
                   3390:       fbsd_hideous_sh_bug=$base_compile
                   3391: 
1.1.1.3 ! misho    3392:       if test no != "$pic_mode"; then
1.1       misho    3393:        command="$base_compile $qsrcfile $pic_flag"
                   3394:       else
                   3395:        # Don't build PIC code
                   3396:        command="$base_compile $qsrcfile"
                   3397:       fi
                   3398: 
                   3399:       func_mkdir_p "$xdir$objdir"
                   3400: 
                   3401:       if test -z "$output_obj"; then
                   3402:        # Place PIC objects in $objdir
                   3403:        func_append command " -o $lobj"
                   3404:       fi
                   3405: 
                   3406:       func_show_eval_locale "$command" \
                   3407:           'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
                   3408: 
1.1.1.3 ! misho    3409:       if test warn = "$need_locks" &&
1.1       misho    3410:         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
                   3411:        $ECHO "\
                   3412: *** ERROR, $lockfile contains:
                   3413: `cat $lockfile 2>/dev/null`
                   3414: 
                   3415: but it should contain:
                   3416: $srcfile
                   3417: 
                   3418: This indicates that another process is trying to use the same
                   3419: temporary object file, and libtool could not work around it because
1.1.1.3 ! misho    3420: your compiler does not support '-c' and '-o' together.  If you
1.1       misho    3421: repeat this compilation, it may succeed, by chance, but you had better
                   3422: avoid parallel builds (make -j) in this platform, or get a better
                   3423: compiler."
                   3424: 
                   3425:        $opt_dry_run || $RM $removelist
                   3426:        exit $EXIT_FAILURE
                   3427:       fi
                   3428: 
                   3429:       # Just move the object if needed, then go on to compile the next one
                   3430:       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
                   3431:        func_show_eval '$MV "$output_obj" "$lobj"' \
                   3432:          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
                   3433:       fi
                   3434: 
                   3435:       # Allow error messages only from the first compilation.
1.1.1.3 ! misho    3436:       if test yes = "$suppress_opt"; then
1.1       misho    3437:        suppress_output=' >/dev/null 2>&1'
                   3438:       fi
                   3439:     fi
                   3440: 
                   3441:     # Only build a position-dependent object if we build old libraries.
1.1.1.3 ! misho    3442:     if test yes = "$build_old_libs"; then
        !          3443:       if test yes != "$pic_mode"; then
1.1       misho    3444:        # Don't build PIC code
                   3445:        command="$base_compile $qsrcfile$pie_flag"
                   3446:       else
                   3447:        command="$base_compile $qsrcfile $pic_flag"
                   3448:       fi
1.1.1.3 ! misho    3449:       if test yes = "$compiler_c_o"; then
1.1       misho    3450:        func_append command " -o $obj"
                   3451:       fi
                   3452: 
                   3453:       # Suppress compiler output if we already did a PIC compilation.
                   3454:       func_append command "$suppress_output"
                   3455:       func_show_eval_locale "$command" \
                   3456:         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
                   3457: 
1.1.1.3 ! misho    3458:       if test warn = "$need_locks" &&
1.1       misho    3459:         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
                   3460:        $ECHO "\
                   3461: *** ERROR, $lockfile contains:
                   3462: `cat $lockfile 2>/dev/null`
                   3463: 
                   3464: but it should contain:
                   3465: $srcfile
                   3466: 
                   3467: This indicates that another process is trying to use the same
                   3468: temporary object file, and libtool could not work around it because
1.1.1.3 ! misho    3469: your compiler does not support '-c' and '-o' together.  If you
1.1       misho    3470: repeat this compilation, it may succeed, by chance, but you had better
                   3471: avoid parallel builds (make -j) in this platform, or get a better
                   3472: compiler."
                   3473: 
                   3474:        $opt_dry_run || $RM $removelist
                   3475:        exit $EXIT_FAILURE
                   3476:       fi
                   3477: 
                   3478:       # Just move the object if needed
                   3479:       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
                   3480:        func_show_eval '$MV "$output_obj" "$obj"' \
                   3481:          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
                   3482:       fi
                   3483:     fi
                   3484: 
                   3485:     $opt_dry_run || {
                   3486:       func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
                   3487: 
                   3488:       # Unlock the critical section if it was locked
1.1.1.3 ! misho    3489:       if test no != "$need_locks"; then
1.1       misho    3490:        removelist=$lockfile
                   3491:         $RM "$lockfile"
                   3492:       fi
                   3493:     }
                   3494: 
                   3495:     exit $EXIT_SUCCESS
                   3496: }
                   3497: 
                   3498: $opt_help || {
1.1.1.3 ! misho    3499:   test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
1.1       misho    3500: }
                   3501: 
                   3502: func_mode_help ()
                   3503: {
                   3504:     # We need to display help for each of the modes.
                   3505:     case $opt_mode in
                   3506:       "")
                   3507:         # Generic help is extracted from the usage comments
                   3508:         # at the start of this file.
                   3509:         func_help
                   3510:         ;;
                   3511: 
                   3512:       clean)
                   3513:         $ECHO \
                   3514: "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
                   3515: 
                   3516: Remove files from the build directory.
                   3517: 
                   3518: RM is the name of the program to use to delete files associated with each FILE
1.1.1.3 ! misho    3519: (typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
1.1       misho    3520: to RM.
                   3521: 
                   3522: If FILE is a libtool library, object or program, all the files associated
                   3523: with it are deleted. Otherwise, only FILE itself is deleted using RM."
                   3524:         ;;
                   3525: 
                   3526:       compile)
                   3527:       $ECHO \
                   3528: "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
                   3529: 
                   3530: Compile a source file into a libtool library object.
                   3531: 
                   3532: This mode accepts the following additional options:
                   3533: 
                   3534:   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
                   3535:   -no-suppress      do not suppress compiler output for multiple passes
                   3536:   -prefer-pic       try to build PIC objects only
                   3537:   -prefer-non-pic   try to build non-PIC objects only
1.1.1.3 ! misho    3538:   -shared           do not build a '.o' file suitable for static linking
        !          3539:   -static           only build a '.o' file suitable for static linking
1.1       misho    3540:   -Wc,FLAG          pass FLAG directly to the compiler
                   3541: 
1.1.1.3 ! misho    3542: COMPILE-COMMAND is a command to be used in creating a 'standard' object file
1.1       misho    3543: from the given SOURCEFILE.
                   3544: 
                   3545: The output file name is determined by removing the directory component from
1.1.1.3 ! misho    3546: SOURCEFILE, then substituting the C source code suffix '.c' with the
        !          3547: library object suffix, '.lo'."
1.1       misho    3548:         ;;
                   3549: 
                   3550:       execute)
                   3551:         $ECHO \
                   3552: "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
                   3553: 
                   3554: Automatically set library path, then run a program.
                   3555: 
                   3556: This mode accepts the following additional options:
                   3557: 
                   3558:   -dlopen FILE      add the directory containing FILE to the library path
                   3559: 
1.1.1.3 ! misho    3560: This mode sets the library path environment variable according to '-dlopen'
1.1       misho    3561: flags.
                   3562: 
                   3563: If any of the ARGS are libtool executable wrappers, then they are translated
                   3564: into their corresponding uninstalled binary, and any of their required library
                   3565: directories are added to the library path.
                   3566: 
                   3567: Then, COMMAND is executed, with ARGS as arguments."
                   3568:         ;;
                   3569: 
                   3570:       finish)
                   3571:         $ECHO \
                   3572: "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
                   3573: 
                   3574: Complete the installation of libtool libraries.
                   3575: 
                   3576: Each LIBDIR is a directory that contains libtool libraries.
                   3577: 
                   3578: The commands that this mode executes may require superuser privileges.  Use
1.1.1.3 ! misho    3579: the '--dry-run' option if you just want to see what would be executed."
1.1       misho    3580:         ;;
                   3581: 
                   3582:       install)
                   3583:         $ECHO \
                   3584: "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
                   3585: 
                   3586: Install executables or libraries.
                   3587: 
                   3588: INSTALL-COMMAND is the installation command.  The first component should be
1.1.1.3 ! misho    3589: either the 'install' or 'cp' program.
1.1       misho    3590: 
                   3591: The following components of INSTALL-COMMAND are treated specially:
                   3592: 
                   3593:   -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
                   3594: 
                   3595: The rest of the components are interpreted as arguments to that command (only
                   3596: BSD-compatible install options are recognized)."
                   3597:         ;;
                   3598: 
                   3599:       link)
                   3600:         $ECHO \
                   3601: "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
                   3602: 
                   3603: Link object files or libraries together to form another library, or to
                   3604: create an executable program.
                   3605: 
                   3606: LINK-COMMAND is a command using the C compiler that you would use to create
                   3607: a program from several object files.
                   3608: 
                   3609: The following components of LINK-COMMAND are treated specially:
                   3610: 
                   3611:   -all-static       do not do any dynamic linking at all
                   3612:   -avoid-version    do not add a version suffix if possible
                   3613:   -bindir BINDIR    specify path to binaries directory (for systems where
                   3614:                     libraries must be found in the PATH setting at runtime)
1.1.1.3 ! misho    3615:   -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
1.1       misho    3616:   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
                   3617:   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
                   3618:   -export-symbols SYMFILE
                   3619:                     try to export only the symbols listed in SYMFILE
                   3620:   -export-symbols-regex REGEX
                   3621:                     try to export only the symbols matching REGEX
                   3622:   -LLIBDIR          search LIBDIR for required installed libraries
                   3623:   -lNAME            OUTPUT-FILE requires the installed library libNAME
                   3624:   -module           build a library that can dlopened
                   3625:   -no-fast-install  disable the fast-install mode
                   3626:   -no-install       link a not-installable executable
                   3627:   -no-undefined     declare that a library does not refer to external symbols
                   3628:   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
                   3629:   -objectlist FILE  Use a list of object files found in FILE to specify objects
                   3630:   -precious-files-regex REGEX
                   3631:                     don't remove output files matching REGEX
                   3632:   -release RELEASE  specify package release information
                   3633:   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
                   3634:   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
                   3635:   -shared           only do dynamic linking of libtool libraries
                   3636:   -shrext SUFFIX    override the standard shared library file extension
                   3637:   -static           do not do any dynamic linking of uninstalled libtool libraries
                   3638:   -static-libtool-libs
                   3639:                     do not do any dynamic linking of libtool libraries
                   3640:   -version-info CURRENT[:REVISION[:AGE]]
                   3641:                     specify library version info [each variable defaults to 0]
                   3642:   -weak LIBNAME     declare that the target provides the LIBNAME interface
                   3643:   -Wc,FLAG
                   3644:   -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
                   3645:   -Wl,FLAG
                   3646:   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
                   3647:   -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
                   3648: 
1.1.1.3 ! misho    3649: All other options (arguments beginning with '-') are ignored.
1.1       misho    3650: 
1.1.1.3 ! misho    3651: Every other argument is treated as a filename.  Files ending in '.la' are
1.1       misho    3652: treated as uninstalled libtool libraries, other files are standard or library
                   3653: object files.
                   3654: 
1.1.1.3 ! misho    3655: If the OUTPUT-FILE ends in '.la', then a libtool library is created,
        !          3656: only library objects ('.lo' files) may be specified, and '-rpath' is
1.1       misho    3657: required, except when creating a convenience library.
                   3658: 
1.1.1.3 ! misho    3659: If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
        !          3660: using 'ar' and 'ranlib', or on Windows using 'lib'.
1.1       misho    3661: 
1.1.1.3 ! misho    3662: If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
1.1       misho    3663: is created, otherwise an executable program is created."
                   3664:         ;;
                   3665: 
                   3666:       uninstall)
                   3667:         $ECHO \
                   3668: "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
                   3669: 
                   3670: Remove libraries from an installation directory.
                   3671: 
                   3672: RM is the name of the program to use to delete files associated with each FILE
1.1.1.3 ! misho    3673: (typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
1.1       misho    3674: to RM.
                   3675: 
                   3676: If FILE is a libtool library, all the files associated with it are deleted.
                   3677: Otherwise, only FILE itself is deleted using RM."
                   3678:         ;;
                   3679: 
                   3680:       *)
1.1.1.3 ! misho    3681:         func_fatal_help "invalid operation mode '$opt_mode'"
1.1       misho    3682:         ;;
                   3683:     esac
                   3684: 
                   3685:     echo
1.1.1.3 ! misho    3686:     $ECHO "Try '$progname --help' for more information about other modes."
1.1       misho    3687: }
                   3688: 
                   3689: # Now that we've collected a possible --mode arg, show help if necessary
                   3690: if $opt_help; then
1.1.1.3 ! misho    3691:   if test : = "$opt_help"; then
1.1       misho    3692:     func_mode_help
                   3693:   else
                   3694:     {
                   3695:       func_help noexit
                   3696:       for opt_mode in compile link execute install finish uninstall clean; do
                   3697:        func_mode_help
                   3698:       done
                   3699:     } | sed -n '1p; 2,$s/^Usage:/  or: /p'
                   3700:     {
                   3701:       func_help noexit
                   3702:       for opt_mode in compile link execute install finish uninstall clean; do
                   3703:        echo
                   3704:        func_mode_help
                   3705:       done
                   3706:     } |
                   3707:     sed '1d
                   3708:       /^When reporting/,/^Report/{
                   3709:        H
                   3710:        d
                   3711:       }
                   3712:       $x
                   3713:       /information about other modes/d
                   3714:       /more detailed .*MODE/d
                   3715:       s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
                   3716:   fi
                   3717:   exit $?
                   3718: fi
                   3719: 
                   3720: 
                   3721: # func_mode_execute arg...
                   3722: func_mode_execute ()
                   3723: {
1.1.1.3 ! misho    3724:     $debug_cmd
        !          3725: 
1.1       misho    3726:     # The first argument is the command name.
1.1.1.3 ! misho    3727:     cmd=$nonopt
1.1       misho    3728:     test -z "$cmd" && \
                   3729:       func_fatal_help "you must specify a COMMAND"
                   3730: 
                   3731:     # Handle -dlopen flags immediately.
                   3732:     for file in $opt_dlopen; do
                   3733:       test -f "$file" \
1.1.1.3 ! misho    3734:        || func_fatal_help "'$file' is not a file"
1.1       misho    3735: 
                   3736:       dir=
                   3737:       case $file in
                   3738:       *.la)
                   3739:        func_resolve_sysroot "$file"
                   3740:        file=$func_resolve_sysroot_result
                   3741: 
                   3742:        # Check to see that this really is a libtool archive.
                   3743:        func_lalib_unsafe_p "$file" \
1.1.1.3 ! misho    3744:          || func_fatal_help "'$lib' is not a valid libtool archive"
1.1       misho    3745: 
                   3746:        # Read the libtool library.
                   3747:        dlname=
                   3748:        library_names=
                   3749:        func_source "$file"
                   3750: 
                   3751:        # Skip this library if it cannot be dlopened.
                   3752:        if test -z "$dlname"; then
                   3753:          # Warn if it was a shared library.
                   3754:          test -n "$library_names" && \
1.1.1.3 ! misho    3755:            func_warning "'$file' was not linked with '-export-dynamic'"
1.1       misho    3756:          continue
                   3757:        fi
                   3758: 
                   3759:        func_dirname "$file" "" "."
1.1.1.3 ! misho    3760:        dir=$func_dirname_result
1.1       misho    3761: 
                   3762:        if test -f "$dir/$objdir/$dlname"; then
                   3763:          func_append dir "/$objdir"
                   3764:        else
                   3765:          if test ! -f "$dir/$dlname"; then
1.1.1.3 ! misho    3766:            func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
1.1       misho    3767:          fi
                   3768:        fi
                   3769:        ;;
                   3770: 
                   3771:       *.lo)
                   3772:        # Just add the directory containing the .lo file.
                   3773:        func_dirname "$file" "" "."
1.1.1.3 ! misho    3774:        dir=$func_dirname_result
1.1       misho    3775:        ;;
                   3776: 
                   3777:       *)
1.1.1.3 ! misho    3778:        func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
1.1       misho    3779:        continue
                   3780:        ;;
                   3781:       esac
                   3782: 
                   3783:       # Get the absolute pathname.
                   3784:       absdir=`cd "$dir" && pwd`
1.1.1.3 ! misho    3785:       test -n "$absdir" && dir=$absdir
1.1       misho    3786: 
                   3787:       # Now add the directory to shlibpath_var.
                   3788:       if eval "test -z \"\$$shlibpath_var\""; then
                   3789:        eval "$shlibpath_var=\"\$dir\""
                   3790:       else
                   3791:        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
                   3792:       fi
                   3793:     done
                   3794: 
                   3795:     # This variable tells wrapper scripts just to set shlibpath_var
                   3796:     # rather than running their programs.
1.1.1.3 ! misho    3797:     libtool_execute_magic=$magic
1.1       misho    3798: 
                   3799:     # Check if any of the arguments is a wrapper script.
                   3800:     args=
                   3801:     for file
                   3802:     do
                   3803:       case $file in
                   3804:       -* | *.la | *.lo ) ;;
                   3805:       *)
                   3806:        # Do a test to see if this is really a libtool program.
                   3807:        if func_ltwrapper_script_p "$file"; then
                   3808:          func_source "$file"
                   3809:          # Transform arg to wrapped name.
1.1.1.3 ! misho    3810:          file=$progdir/$program
1.1       misho    3811:        elif func_ltwrapper_executable_p "$file"; then
                   3812:          func_ltwrapper_scriptname "$file"
                   3813:          func_source "$func_ltwrapper_scriptname_result"
                   3814:          # Transform arg to wrapped name.
1.1.1.3 ! misho    3815:          file=$progdir/$program
1.1       misho    3816:        fi
                   3817:        ;;
                   3818:       esac
                   3819:       # Quote arguments (to preserve shell metacharacters).
                   3820:       func_append_quoted args "$file"
                   3821:     done
                   3822: 
1.1.1.3 ! misho    3823:     if $opt_dry_run; then
        !          3824:       # Display what would be done.
        !          3825:       if test -n "$shlibpath_var"; then
        !          3826:        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
        !          3827:        echo "export $shlibpath_var"
        !          3828:       fi
        !          3829:       $ECHO "$cmd$args"
        !          3830:       exit $EXIT_SUCCESS
        !          3831:     else
1.1       misho    3832:       if test -n "$shlibpath_var"; then
                   3833:        # Export the shlibpath_var.
                   3834:        eval "export $shlibpath_var"
                   3835:       fi
                   3836: 
                   3837:       # Restore saved environment variables
                   3838:       for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
                   3839:       do
                   3840:        eval "if test \"\${save_$lt_var+set}\" = set; then
                   3841:                 $lt_var=\$save_$lt_var; export $lt_var
                   3842:              else
                   3843:                $lt_unset $lt_var
                   3844:              fi"
                   3845:       done
                   3846: 
                   3847:       # Now prepare to actually exec the command.
1.1.1.3 ! misho    3848:       exec_cmd=\$cmd$args
1.1       misho    3849:     fi
                   3850: }
                   3851: 
1.1.1.3 ! misho    3852: test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
1.1       misho    3853: 
                   3854: 
                   3855: # func_mode_finish arg...
                   3856: func_mode_finish ()
                   3857: {
1.1.1.3 ! misho    3858:     $debug_cmd
        !          3859: 
1.1       misho    3860:     libs=
                   3861:     libdirs=
                   3862:     admincmds=
                   3863: 
                   3864:     for opt in "$nonopt" ${1+"$@"}
                   3865:     do
                   3866:       if test -d "$opt"; then
                   3867:        func_append libdirs " $opt"
                   3868: 
                   3869:       elif test -f "$opt"; then
                   3870:        if func_lalib_unsafe_p "$opt"; then
                   3871:          func_append libs " $opt"
                   3872:        else
1.1.1.3 ! misho    3873:          func_warning "'$opt' is not a valid libtool archive"
1.1       misho    3874:        fi
                   3875: 
                   3876:       else
1.1.1.3 ! misho    3877:        func_fatal_error "invalid argument '$opt'"
1.1       misho    3878:       fi
                   3879:     done
                   3880: 
                   3881:     if test -n "$libs"; then
                   3882:       if test -n "$lt_sysroot"; then
                   3883:         sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
                   3884:         sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
                   3885:       else
                   3886:         sysroot_cmd=
                   3887:       fi
                   3888: 
                   3889:       # Remove sysroot references
                   3890:       if $opt_dry_run; then
                   3891:         for lib in $libs; do
1.1.1.3 ! misho    3892:           echo "removing references to $lt_sysroot and '=' prefixes from $lib"
1.1       misho    3893:         done
                   3894:       else
                   3895:         tmpdir=`func_mktempdir`
                   3896:         for lib in $libs; do
1.1.1.3 ! misho    3897:          sed -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
1.1       misho    3898:            > $tmpdir/tmp-la
                   3899:          mv -f $tmpdir/tmp-la $lib
                   3900:        done
                   3901:         ${RM}r "$tmpdir"
                   3902:       fi
                   3903:     fi
                   3904: 
                   3905:     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
                   3906:       for libdir in $libdirs; do
                   3907:        if test -n "$finish_cmds"; then
                   3908:          # Do each command in the finish commands.
                   3909:          func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
                   3910: '"$cmd"'"'
                   3911:        fi
                   3912:        if test -n "$finish_eval"; then
                   3913:          # Do the single finish_eval.
                   3914:          eval cmds=\"$finish_eval\"
                   3915:          $opt_dry_run || eval "$cmds" || func_append admincmds "
                   3916:        $cmds"
                   3917:        fi
                   3918:       done
                   3919:     fi
                   3920: 
                   3921:     # Exit here if they wanted silent mode.
1.1.1.3 ! misho    3922:     $opt_quiet && exit $EXIT_SUCCESS
1.1       misho    3923: 
                   3924:     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
                   3925:       echo "----------------------------------------------------------------------"
                   3926:       echo "Libraries have been installed in:"
                   3927:       for libdir in $libdirs; do
                   3928:        $ECHO "   $libdir"
                   3929:       done
                   3930:       echo
                   3931:       echo "If you ever happen to want to link against installed libraries"
                   3932:       echo "in a given directory, LIBDIR, you must either use libtool, and"
1.1.1.3 ! misho    3933:       echo "specify the full pathname of the library, or use the '-LLIBDIR'"
1.1       misho    3934:       echo "flag during linking and do at least one of the following:"
                   3935:       if test -n "$shlibpath_var"; then
1.1.1.3 ! misho    3936:        echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
1.1       misho    3937:        echo "     during execution"
                   3938:       fi
                   3939:       if test -n "$runpath_var"; then
1.1.1.3 ! misho    3940:        echo "   - add LIBDIR to the '$runpath_var' environment variable"
1.1       misho    3941:        echo "     during linking"
                   3942:       fi
                   3943:       if test -n "$hardcode_libdir_flag_spec"; then
                   3944:        libdir=LIBDIR
                   3945:        eval flag=\"$hardcode_libdir_flag_spec\"
                   3946: 
1.1.1.3 ! misho    3947:        $ECHO "   - use the '$flag' linker flag"
1.1       misho    3948:       fi
                   3949:       if test -n "$admincmds"; then
                   3950:        $ECHO "   - have your system administrator run these commands:$admincmds"
                   3951:       fi
                   3952:       if test -f /etc/ld.so.conf; then
1.1.1.3 ! misho    3953:        echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
1.1       misho    3954:       fi
                   3955:       echo
                   3956: 
                   3957:       echo "See any operating system documentation about shared libraries for"
                   3958:       case $host in
                   3959:        solaris2.[6789]|solaris2.1[0-9])
                   3960:          echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
                   3961:          echo "pages."
                   3962:          ;;
                   3963:        *)
                   3964:          echo "more information, such as the ld(1) and ld.so(8) manual pages."
                   3965:          ;;
                   3966:       esac
                   3967:       echo "----------------------------------------------------------------------"
                   3968:     fi
                   3969:     exit $EXIT_SUCCESS
                   3970: }
                   3971: 
1.1.1.3 ! misho    3972: test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
1.1       misho    3973: 
                   3974: 
                   3975: # func_mode_install arg...
                   3976: func_mode_install ()
                   3977: {
1.1.1.3 ! misho    3978:     $debug_cmd
        !          3979: 
1.1       misho    3980:     # There may be an optional sh(1) argument at the beginning of
                   3981:     # install_prog (especially on Windows NT).
1.1.1.3 ! misho    3982:     if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
1.1       misho    3983:        # Allow the use of GNU shtool's install command.
1.1.1.3 ! misho    3984:        case $nonopt in *shtool*) :;; *) false;; esac
        !          3985:     then
1.1       misho    3986:       # Aesthetically quote it.
                   3987:       func_quote_for_eval "$nonopt"
                   3988:       install_prog="$func_quote_for_eval_result "
                   3989:       arg=$1
                   3990:       shift
                   3991:     else
                   3992:       install_prog=
                   3993:       arg=$nonopt
                   3994:     fi
                   3995: 
                   3996:     # The real first argument should be the name of the installation program.
                   3997:     # Aesthetically quote it.
                   3998:     func_quote_for_eval "$arg"
                   3999:     func_append install_prog "$func_quote_for_eval_result"
                   4000:     install_shared_prog=$install_prog
                   4001:     case " $install_prog " in
                   4002:       *[\\\ /]cp\ *) install_cp=: ;;
                   4003:       *) install_cp=false ;;
                   4004:     esac
                   4005: 
                   4006:     # We need to accept at least all the BSD install flags.
                   4007:     dest=
                   4008:     files=
                   4009:     opts=
                   4010:     prev=
                   4011:     install_type=
1.1.1.3 ! misho    4012:     isdir=false
1.1       misho    4013:     stripme=
                   4014:     no_mode=:
                   4015:     for arg
                   4016:     do
                   4017:       arg2=
                   4018:       if test -n "$dest"; then
                   4019:        func_append files " $dest"
                   4020:        dest=$arg
                   4021:        continue
                   4022:       fi
                   4023: 
                   4024:       case $arg in
1.1.1.3 ! misho    4025:       -d) isdir=: ;;
1.1       misho    4026:       -f)
                   4027:        if $install_cp; then :; else
                   4028:          prev=$arg
                   4029:        fi
                   4030:        ;;
                   4031:       -g | -m | -o)
                   4032:        prev=$arg
                   4033:        ;;
                   4034:       -s)
                   4035:        stripme=" -s"
                   4036:        continue
                   4037:        ;;
                   4038:       -*)
                   4039:        ;;
                   4040:       *)
                   4041:        # If the previous option needed an argument, then skip it.
                   4042:        if test -n "$prev"; then
1.1.1.3 ! misho    4043:          if test X-m = "X$prev" && test -n "$install_override_mode"; then
1.1       misho    4044:            arg2=$install_override_mode
                   4045:            no_mode=false
                   4046:          fi
                   4047:          prev=
                   4048:        else
                   4049:          dest=$arg
                   4050:          continue
                   4051:        fi
                   4052:        ;;
                   4053:       esac
                   4054: 
                   4055:       # Aesthetically quote the argument.
                   4056:       func_quote_for_eval "$arg"
                   4057:       func_append install_prog " $func_quote_for_eval_result"
                   4058:       if test -n "$arg2"; then
                   4059:        func_quote_for_eval "$arg2"
                   4060:       fi
                   4061:       func_append install_shared_prog " $func_quote_for_eval_result"
                   4062:     done
                   4063: 
                   4064:     test -z "$install_prog" && \
                   4065:       func_fatal_help "you must specify an install program"
                   4066: 
                   4067:     test -n "$prev" && \
1.1.1.3 ! misho    4068:       func_fatal_help "the '$prev' option requires an argument"
1.1       misho    4069: 
                   4070:     if test -n "$install_override_mode" && $no_mode; then
                   4071:       if $install_cp; then :; else
                   4072:        func_quote_for_eval "$install_override_mode"
                   4073:        func_append install_shared_prog " -m $func_quote_for_eval_result"
                   4074:       fi
                   4075:     fi
                   4076: 
                   4077:     if test -z "$files"; then
                   4078:       if test -z "$dest"; then
                   4079:        func_fatal_help "no file or destination specified"
                   4080:       else
                   4081:        func_fatal_help "you must specify a destination"
                   4082:       fi
                   4083:     fi
                   4084: 
                   4085:     # Strip any trailing slash from the destination.
                   4086:     func_stripname '' '/' "$dest"
                   4087:     dest=$func_stripname_result
                   4088: 
                   4089:     # Check to see that the destination is a directory.
1.1.1.3 ! misho    4090:     test -d "$dest" && isdir=:
        !          4091:     if $isdir; then
        !          4092:       destdir=$dest
1.1       misho    4093:       destname=
                   4094:     else
                   4095:       func_dirname_and_basename "$dest" "" "."
1.1.1.3 ! misho    4096:       destdir=$func_dirname_result
        !          4097:       destname=$func_basename_result
1.1       misho    4098: 
                   4099:       # Not a directory, so check to see that there is only one file specified.
                   4100:       set dummy $files; shift
                   4101:       test "$#" -gt 1 && \
1.1.1.3 ! misho    4102:        func_fatal_help "'$dest' is not a directory"
1.1       misho    4103:     fi
                   4104:     case $destdir in
                   4105:     [\\/]* | [A-Za-z]:[\\/]*) ;;
                   4106:     *)
                   4107:       for file in $files; do
                   4108:        case $file in
                   4109:        *.lo) ;;
                   4110:        *)
1.1.1.3 ! misho    4111:          func_fatal_help "'$destdir' must be an absolute directory name"
1.1       misho    4112:          ;;
                   4113:        esac
                   4114:       done
                   4115:       ;;
                   4116:     esac
                   4117: 
                   4118:     # This variable tells wrapper scripts just to set variables rather
                   4119:     # than running their programs.
1.1.1.3 ! misho    4120:     libtool_install_magic=$magic
1.1       misho    4121: 
                   4122:     staticlibs=
                   4123:     future_libdirs=
                   4124:     current_libdirs=
                   4125:     for file in $files; do
                   4126: 
                   4127:       # Do each installation.
                   4128:       case $file in
                   4129:       *.$libext)
                   4130:        # Do the static libraries later.
                   4131:        func_append staticlibs " $file"
                   4132:        ;;
                   4133: 
                   4134:       *.la)
                   4135:        func_resolve_sysroot "$file"
                   4136:        file=$func_resolve_sysroot_result
                   4137: 
                   4138:        # Check to see that this really is a libtool archive.
                   4139:        func_lalib_unsafe_p "$file" \
1.1.1.3 ! misho    4140:          || func_fatal_help "'$file' is not a valid libtool archive"
1.1       misho    4141: 
                   4142:        library_names=
                   4143:        old_library=
                   4144:        relink_command=
                   4145:        func_source "$file"
                   4146: 
                   4147:        # Add the libdir to current_libdirs if it is the destination.
                   4148:        if test "X$destdir" = "X$libdir"; then
                   4149:          case "$current_libdirs " in
                   4150:          *" $libdir "*) ;;
                   4151:          *) func_append current_libdirs " $libdir" ;;
                   4152:          esac
                   4153:        else
                   4154:          # Note the libdir as a future libdir.
                   4155:          case "$future_libdirs " in
                   4156:          *" $libdir "*) ;;
                   4157:          *) func_append future_libdirs " $libdir" ;;
                   4158:          esac
                   4159:        fi
                   4160: 
                   4161:        func_dirname "$file" "/" ""
1.1.1.3 ! misho    4162:        dir=$func_dirname_result
1.1       misho    4163:        func_append dir "$objdir"
                   4164: 
                   4165:        if test -n "$relink_command"; then
                   4166:          # Determine the prefix the user has applied to our future dir.
                   4167:          inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
                   4168: 
                   4169:          # Don't allow the user to place us outside of our expected
                   4170:          # location b/c this prevents finding dependent libraries that
                   4171:          # are installed to the same prefix.
                   4172:          # At present, this check doesn't affect windows .dll's that
                   4173:          # are installed into $libdir/../bin (currently, that works fine)
                   4174:          # but it's something to keep an eye on.
                   4175:          test "$inst_prefix_dir" = "$destdir" && \
1.1.1.3 ! misho    4176:            func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
1.1       misho    4177: 
                   4178:          if test -n "$inst_prefix_dir"; then
                   4179:            # Stick the inst_prefix_dir data into the link command.
                   4180:            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
                   4181:          else
                   4182:            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
                   4183:          fi
                   4184: 
1.1.1.3 ! misho    4185:          func_warning "relinking '$file'"
1.1       misho    4186:          func_show_eval "$relink_command" \
1.1.1.3 ! misho    4187:            'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
1.1       misho    4188:        fi
                   4189: 
                   4190:        # See the names of the shared library.
                   4191:        set dummy $library_names; shift
                   4192:        if test -n "$1"; then
1.1.1.3 ! misho    4193:          realname=$1
1.1       misho    4194:          shift
                   4195: 
1.1.1.3 ! misho    4196:          srcname=$realname
        !          4197:          test -n "$relink_command" && srcname=${realname}T
1.1       misho    4198: 
                   4199:          # Install the shared library and build the symlinks.
                   4200:          func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
                   4201:              'exit $?'
1.1.1.3 ! misho    4202:          tstripme=$stripme
1.1       misho    4203:          case $host_os in
                   4204:          cygwin* | mingw* | pw32* | cegcc*)
                   4205:            case $realname in
                   4206:            *.dll.a)
1.1.1.3 ! misho    4207:              tstripme=
1.1       misho    4208:              ;;
                   4209:            esac
                   4210:            ;;
                   4211:          esac
                   4212:          if test -n "$tstripme" && test -n "$striplib"; then
                   4213:            func_show_eval "$striplib $destdir/$realname" 'exit $?'
                   4214:          fi
                   4215: 
                   4216:          if test "$#" -gt 0; then
                   4217:            # Delete the old symlinks, and create new ones.
1.1.1.3 ! misho    4218:            # Try 'ln -sf' first, because the 'ln' binary might depend on
1.1       misho    4219:            # the symlink we replace!  Solaris /bin/ln does not understand -f,
                   4220:            # so we also need to try rm && ln -s.
                   4221:            for linkname
                   4222:            do
                   4223:              test "$linkname" != "$realname" \
                   4224:                && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
                   4225:            done
                   4226:          fi
                   4227: 
                   4228:          # Do each command in the postinstall commands.
1.1.1.3 ! misho    4229:          lib=$destdir/$realname
1.1       misho    4230:          func_execute_cmds "$postinstall_cmds" 'exit $?'
                   4231:        fi
                   4232: 
                   4233:        # Install the pseudo-library for information purposes.
                   4234:        func_basename "$file"
1.1.1.3 ! misho    4235:        name=$func_basename_result
        !          4236:        instname=$dir/${name}i
1.1       misho    4237:        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
                   4238: 
                   4239:        # Maybe install the static library, too.
                   4240:        test -n "$old_library" && func_append staticlibs " $dir/$old_library"
                   4241:        ;;
                   4242: 
                   4243:       *.lo)
                   4244:        # Install (i.e. copy) a libtool object.
                   4245: 
                   4246:        # Figure out destination file name, if it wasn't already specified.
                   4247:        if test -n "$destname"; then
1.1.1.3 ! misho    4248:          destfile=$destdir/$destname
1.1       misho    4249:        else
                   4250:          func_basename "$file"
1.1.1.3 ! misho    4251:          destfile=$func_basename_result
        !          4252:          destfile=$destdir/$destfile
1.1       misho    4253:        fi
                   4254: 
                   4255:        # Deduce the name of the destination old-style object file.
                   4256:        case $destfile in
                   4257:        *.lo)
                   4258:          func_lo2o "$destfile"
                   4259:          staticdest=$func_lo2o_result
                   4260:          ;;
                   4261:        *.$objext)
1.1.1.3 ! misho    4262:          staticdest=$destfile
1.1       misho    4263:          destfile=
                   4264:          ;;
                   4265:        *)
1.1.1.3 ! misho    4266:          func_fatal_help "cannot copy a libtool object to '$destfile'"
1.1       misho    4267:          ;;
                   4268:        esac
                   4269: 
                   4270:        # Install the libtool object if requested.
                   4271:        test -n "$destfile" && \
                   4272:          func_show_eval "$install_prog $file $destfile" 'exit $?'
                   4273: 
                   4274:        # Install the old object if enabled.
1.1.1.3 ! misho    4275:        if test yes = "$build_old_libs"; then
1.1       misho    4276:          # Deduce the name of the old-style object file.
                   4277:          func_lo2o "$file"
                   4278:          staticobj=$func_lo2o_result
                   4279:          func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
                   4280:        fi
                   4281:        exit $EXIT_SUCCESS
                   4282:        ;;
                   4283: 
                   4284:       *)
                   4285:        # Figure out destination file name, if it wasn't already specified.
                   4286:        if test -n "$destname"; then
1.1.1.3 ! misho    4287:          destfile=$destdir/$destname
1.1       misho    4288:        else
                   4289:          func_basename "$file"
1.1.1.3 ! misho    4290:          destfile=$func_basename_result
        !          4291:          destfile=$destdir/$destfile
1.1       misho    4292:        fi
                   4293: 
                   4294:        # If the file is missing, and there is a .exe on the end, strip it
                   4295:        # because it is most likely a libtool script we actually want to
                   4296:        # install
1.1.1.3 ! misho    4297:        stripped_ext=
1.1       misho    4298:        case $file in
                   4299:          *.exe)
                   4300:            if test ! -f "$file"; then
                   4301:              func_stripname '' '.exe' "$file"
                   4302:              file=$func_stripname_result
1.1.1.3 ! misho    4303:              stripped_ext=.exe
1.1       misho    4304:            fi
                   4305:            ;;
                   4306:        esac
                   4307: 
                   4308:        # Do a test to see if this is really a libtool program.
                   4309:        case $host in
                   4310:        *cygwin* | *mingw*)
                   4311:            if func_ltwrapper_executable_p "$file"; then
                   4312:              func_ltwrapper_scriptname "$file"
                   4313:              wrapper=$func_ltwrapper_scriptname_result
                   4314:            else
                   4315:              func_stripname '' '.exe' "$file"
                   4316:              wrapper=$func_stripname_result
                   4317:            fi
                   4318:            ;;
                   4319:        *)
                   4320:            wrapper=$file
                   4321:            ;;
                   4322:        esac
                   4323:        if func_ltwrapper_script_p "$wrapper"; then
                   4324:          notinst_deplibs=
                   4325:          relink_command=
                   4326: 
                   4327:          func_source "$wrapper"
                   4328: 
                   4329:          # Check the variables that should have been set.
                   4330:          test -z "$generated_by_libtool_version" && \
1.1.1.3 ! misho    4331:            func_fatal_error "invalid libtool wrapper script '$wrapper'"
1.1       misho    4332: 
1.1.1.3 ! misho    4333:          finalize=:
1.1       misho    4334:          for lib in $notinst_deplibs; do
                   4335:            # Check to see that each library is installed.
                   4336:            libdir=
                   4337:            if test -f "$lib"; then
                   4338:              func_source "$lib"
                   4339:            fi
1.1.1.3 ! misho    4340:            libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
1.1       misho    4341:            if test -n "$libdir" && test ! -f "$libfile"; then
1.1.1.3 ! misho    4342:              func_warning "'$lib' has not been installed in '$libdir'"
        !          4343:              finalize=false
1.1       misho    4344:            fi
                   4345:          done
                   4346: 
                   4347:          relink_command=
                   4348:          func_source "$wrapper"
                   4349: 
                   4350:          outputname=
1.1.1.3 ! misho    4351:          if test no = "$fast_install" && test -n "$relink_command"; then
1.1       misho    4352:            $opt_dry_run || {
1.1.1.3 ! misho    4353:              if $finalize; then
1.1       misho    4354:                tmpdir=`func_mktempdir`
                   4355:                func_basename "$file$stripped_ext"
1.1.1.3 ! misho    4356:                file=$func_basename_result
        !          4357:                outputname=$tmpdir/$file
1.1       misho    4358:                # Replace the output file specification.
                   4359:                relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
                   4360: 
1.1.1.3 ! misho    4361:                $opt_quiet || {
1.1       misho    4362:                  func_quote_for_expand "$relink_command"
                   4363:                  eval "func_echo $func_quote_for_expand_result"
                   4364:                }
                   4365:                if eval "$relink_command"; then :
                   4366:                  else
1.1.1.3 ! misho    4367:                  func_error "error: relink '$file' with the above command before installing it"
1.1       misho    4368:                  $opt_dry_run || ${RM}r "$tmpdir"
                   4369:                  continue
                   4370:                fi
1.1.1.3 ! misho    4371:                file=$outputname
1.1       misho    4372:              else
1.1.1.3 ! misho    4373:                func_warning "cannot relink '$file'"
1.1       misho    4374:              fi
                   4375:            }
                   4376:          else
                   4377:            # Install the binary that we compiled earlier.
                   4378:            file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
                   4379:          fi
                   4380:        fi
                   4381: 
                   4382:        # remove .exe since cygwin /usr/bin/install will append another
                   4383:        # one anyway
                   4384:        case $install_prog,$host in
                   4385:        */usr/bin/install*,*cygwin*)
                   4386:          case $file:$destfile in
                   4387:          *.exe:*.exe)
                   4388:            # this is ok
                   4389:            ;;
                   4390:          *.exe:*)
                   4391:            destfile=$destfile.exe
                   4392:            ;;
                   4393:          *:*.exe)
                   4394:            func_stripname '' '.exe' "$destfile"
                   4395:            destfile=$func_stripname_result
                   4396:            ;;
                   4397:          esac
                   4398:          ;;
                   4399:        esac
                   4400:        func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
                   4401:        $opt_dry_run || if test -n "$outputname"; then
                   4402:          ${RM}r "$tmpdir"
                   4403:        fi
                   4404:        ;;
                   4405:       esac
                   4406:     done
                   4407: 
                   4408:     for file in $staticlibs; do
                   4409:       func_basename "$file"
1.1.1.3 ! misho    4410:       name=$func_basename_result
1.1       misho    4411: 
                   4412:       # Set up the ranlib parameters.
1.1.1.3 ! misho    4413:       oldlib=$destdir/$name
1.1.1.2   misho    4414:       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
                   4415:       tool_oldlib=$func_to_tool_file_result
1.1       misho    4416: 
                   4417:       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
                   4418: 
                   4419:       if test -n "$stripme" && test -n "$old_striplib"; then
1.1.1.2   misho    4420:        func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
1.1       misho    4421:       fi
                   4422: 
                   4423:       # Do each command in the postinstall commands.
                   4424:       func_execute_cmds "$old_postinstall_cmds" 'exit $?'
                   4425:     done
                   4426: 
                   4427:     test -n "$future_libdirs" && \
1.1.1.3 ! misho    4428:       func_warning "remember to run '$progname --finish$future_libdirs'"
1.1       misho    4429: 
                   4430:     if test -n "$current_libdirs"; then
                   4431:       # Maybe just do a dry run.
                   4432:       $opt_dry_run && current_libdirs=" -n$current_libdirs"
1.1.1.3 ! misho    4433:       exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
1.1       misho    4434:     else
                   4435:       exit $EXIT_SUCCESS
                   4436:     fi
                   4437: }
                   4438: 
1.1.1.3 ! misho    4439: test install = "$opt_mode" && func_mode_install ${1+"$@"}
1.1       misho    4440: 
                   4441: 
                   4442: # func_generate_dlsyms outputname originator pic_p
                   4443: # Extract symbols from dlprefiles and create ${outputname}S.o with
                   4444: # a dlpreopen symbol table.
                   4445: func_generate_dlsyms ()
                   4446: {
1.1.1.3 ! misho    4447:     $debug_cmd
        !          4448: 
        !          4449:     my_outputname=$1
        !          4450:     my_originator=$2
        !          4451:     my_pic_p=${3-false}
1.1       misho    4452:     my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
                   4453:     my_dlsyms=
                   4454: 
1.1.1.3 ! misho    4455:     if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
1.1       misho    4456:       if test -n "$NM" && test -n "$global_symbol_pipe"; then
1.1.1.3 ! misho    4457:        my_dlsyms=${my_outputname}S.c
1.1       misho    4458:       else
                   4459:        func_error "not configured to extract global symbols from dlpreopened files"
                   4460:       fi
                   4461:     fi
                   4462: 
                   4463:     if test -n "$my_dlsyms"; then
                   4464:       case $my_dlsyms in
                   4465:       "") ;;
                   4466:       *.c)
                   4467:        # Discover the nlist of each of the dlfiles.
1.1.1.3 ! misho    4468:        nlist=$output_objdir/$my_outputname.nm
1.1       misho    4469: 
                   4470:        func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
                   4471: 
                   4472:        # Parse the name list into a source file.
                   4473:        func_verbose "creating $output_objdir/$my_dlsyms"
                   4474: 
                   4475:        $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1.1.1.3 ! misho    4476: /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
        !          4477: /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
1.1       misho    4478: 
                   4479: #ifdef __cplusplus
                   4480: extern \"C\" {
                   4481: #endif
                   4482: 
1.1.1.3 ! misho    4483: #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
1.1       misho    4484: #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
                   4485: #endif
                   4486: 
                   4487: /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
1.1.1.3 ! misho    4488: #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
        !          4489: /* DATA imports from DLLs on WIN32 can't be const, because runtime
1.1       misho    4490:    relocations are performed -- see ld's documentation on pseudo-relocs.  */
                   4491: # define LT_DLSYM_CONST
1.1.1.3 ! misho    4492: #elif defined __osf__
1.1       misho    4493: /* This system does not cope well with relocations in const data.  */
                   4494: # define LT_DLSYM_CONST
                   4495: #else
                   4496: # define LT_DLSYM_CONST const
                   4497: #endif
                   4498: 
1.1.1.3 ! misho    4499: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
        !          4500: 
1.1       misho    4501: /* External symbol declarations for the compiler. */\
                   4502: "
                   4503: 
1.1.1.3 ! misho    4504:        if test yes = "$dlself"; then
        !          4505:          func_verbose "generating symbol list for '$output'"
1.1       misho    4506: 
                   4507:          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
                   4508: 
                   4509:          # Add our own program objects to the symbol list.
                   4510:          progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
                   4511:          for progfile in $progfiles; do
                   4512:            func_to_tool_file "$progfile" func_convert_file_msys_to_w32
1.1.1.3 ! misho    4513:            func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
1.1       misho    4514:            $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
                   4515:          done
                   4516: 
                   4517:          if test -n "$exclude_expsyms"; then
                   4518:            $opt_dry_run || {
                   4519:              eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
                   4520:              eval '$MV "$nlist"T "$nlist"'
                   4521:            }
                   4522:          fi
                   4523: 
                   4524:          if test -n "$export_symbols_regex"; then
                   4525:            $opt_dry_run || {
                   4526:              eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
                   4527:              eval '$MV "$nlist"T "$nlist"'
                   4528:            }
                   4529:          fi
                   4530: 
                   4531:          # Prepare the list of exported symbols
                   4532:          if test -z "$export_symbols"; then
1.1.1.3 ! misho    4533:            export_symbols=$output_objdir/$outputname.exp
1.1       misho    4534:            $opt_dry_run || {
                   4535:              $RM $export_symbols
1.1.1.3 ! misho    4536:              eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1.1       misho    4537:              case $host in
                   4538:              *cygwin* | *mingw* | *cegcc* )
                   4539:                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                   4540:                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
                   4541:                ;;
                   4542:              esac
                   4543:            }
                   4544:          else
                   4545:            $opt_dry_run || {
1.1.1.3 ! misho    4546:              eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1.1       misho    4547:              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
                   4548:              eval '$MV "$nlist"T "$nlist"'
                   4549:              case $host in
                   4550:                *cygwin* | *mingw* | *cegcc* )
                   4551:                  eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                   4552:                  eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
                   4553:                  ;;
                   4554:              esac
                   4555:            }
                   4556:          fi
                   4557:        fi
                   4558: 
                   4559:        for dlprefile in $dlprefiles; do
1.1.1.3 ! misho    4560:          func_verbose "extracting global C symbols from '$dlprefile'"
1.1       misho    4561:          func_basename "$dlprefile"
1.1.1.3 ! misho    4562:          name=$func_basename_result
1.1       misho    4563:           case $host in
                   4564:            *cygwin* | *mingw* | *cegcc* )
                   4565:              # if an import library, we need to obtain dlname
                   4566:              if func_win32_import_lib_p "$dlprefile"; then
                   4567:                func_tr_sh "$dlprefile"
                   4568:                eval "curr_lafile=\$libfile_$func_tr_sh_result"
1.1.1.3 ! misho    4569:                dlprefile_dlbasename=
1.1       misho    4570:                if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
                   4571:                  # Use subshell, to avoid clobbering current variable values
                   4572:                  dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
1.1.1.3 ! misho    4573:                  if test -n "$dlprefile_dlname"; then
1.1       misho    4574:                    func_basename "$dlprefile_dlname"
1.1.1.3 ! misho    4575:                    dlprefile_dlbasename=$func_basename_result
1.1       misho    4576:                  else
                   4577:                    # no lafile. user explicitly requested -dlpreopen <import library>.
                   4578:                    $sharedlib_from_linklib_cmd "$dlprefile"
                   4579:                    dlprefile_dlbasename=$sharedlib_from_linklib_result
                   4580:                  fi
                   4581:                fi
                   4582:                $opt_dry_run || {
1.1.1.3 ! misho    4583:                  if test -n "$dlprefile_dlbasename"; then
1.1       misho    4584:                    eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
                   4585:                  else
                   4586:                    func_warning "Could not compute DLL name from $name"
                   4587:                    eval '$ECHO ": $name " >> "$nlist"'
                   4588:                  fi
                   4589:                  func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
                   4590:                  eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
                   4591:                    $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
                   4592:                }
                   4593:              else # not an import lib
                   4594:                $opt_dry_run || {
                   4595:                  eval '$ECHO ": $name " >> "$nlist"'
                   4596:                  func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
                   4597:                  eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
                   4598:                }
                   4599:              fi
                   4600:            ;;
                   4601:            *)
                   4602:              $opt_dry_run || {
                   4603:                eval '$ECHO ": $name " >> "$nlist"'
                   4604:                func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
                   4605:                eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
                   4606:              }
                   4607:            ;;
                   4608:           esac
                   4609:        done
                   4610: 
                   4611:        $opt_dry_run || {
                   4612:          # Make sure we have at least an empty file.
                   4613:          test -f "$nlist" || : > "$nlist"
                   4614: 
                   4615:          if test -n "$exclude_expsyms"; then
                   4616:            $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
                   4617:            $MV "$nlist"T "$nlist"
                   4618:          fi
                   4619: 
                   4620:          # Try sorting and uniquifying the output.
                   4621:          if $GREP -v "^: " < "$nlist" |
                   4622:              if sort -k 3 </dev/null >/dev/null 2>&1; then
                   4623:                sort -k 3
                   4624:              else
                   4625:                sort +2
                   4626:              fi |
                   4627:              uniq > "$nlist"S; then
                   4628:            :
                   4629:          else
                   4630:            $GREP -v "^: " < "$nlist" > "$nlist"S
                   4631:          fi
                   4632: 
                   4633:          if test -f "$nlist"S; then
                   4634:            eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
                   4635:          else
                   4636:            echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
                   4637:          fi
                   4638: 
1.1.1.3 ! misho    4639:          func_show_eval '$RM "${nlist}I"'
        !          4640:          if test -n "$global_symbol_to_import"; then
        !          4641:            eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
        !          4642:          fi
        !          4643: 
1.1       misho    4644:          echo >> "$output_objdir/$my_dlsyms" "\
                   4645: 
                   4646: /* The mapping between symbol names and symbols.  */
                   4647: typedef struct {
                   4648:   const char *name;
                   4649:   void *address;
                   4650: } lt_dlsymlist;
                   4651: extern LT_DLSYM_CONST lt_dlsymlist
1.1.1.3 ! misho    4652: lt_${my_prefix}_LTX_preloaded_symbols[];\
        !          4653: "
        !          4654: 
        !          4655:          if test -s "$nlist"I; then
        !          4656:            echo >> "$output_objdir/$my_dlsyms" "\
        !          4657: static void lt_syminit(void)
        !          4658: {
        !          4659:   LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
        !          4660:   for (; symbol->name; ++symbol)
        !          4661:     {"
        !          4662:            $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
        !          4663:            echo >> "$output_objdir/$my_dlsyms" "\
        !          4664:     }
        !          4665: }"
        !          4666:          fi
        !          4667:          echo >> "$output_objdir/$my_dlsyms" "\
1.1       misho    4668: LT_DLSYM_CONST lt_dlsymlist
                   4669: lt_${my_prefix}_LTX_preloaded_symbols[] =
1.1.1.3 ! misho    4670: { {\"$my_originator\", (void *) 0},"
        !          4671: 
        !          4672:          if test -s "$nlist"I; then
        !          4673:            echo >> "$output_objdir/$my_dlsyms" "\
        !          4674:   {\"@INIT@\", (void *) &lt_syminit},"
        !          4675:          fi
1.1       misho    4676: 
                   4677:          case $need_lib_prefix in
                   4678:          no)
                   4679:            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
                   4680:            ;;
                   4681:          *)
                   4682:            eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
                   4683:            ;;
                   4684:          esac
                   4685:          echo >> "$output_objdir/$my_dlsyms" "\
                   4686:   {0, (void *) 0}
                   4687: };
                   4688: 
                   4689: /* This works around a problem in FreeBSD linker */
                   4690: #ifdef FREEBSD_WORKAROUND
                   4691: static const void *lt_preloaded_setup() {
                   4692:   return lt_${my_prefix}_LTX_preloaded_symbols;
                   4693: }
                   4694: #endif
                   4695: 
                   4696: #ifdef __cplusplus
                   4697: }
                   4698: #endif\
                   4699: "
                   4700:        } # !$opt_dry_run
                   4701: 
                   4702:        pic_flag_for_symtable=
                   4703:        case "$compile_command " in
                   4704:        *" -static "*) ;;
                   4705:        *)
                   4706:          case $host in
                   4707:          # compiling the symbol table file with pic_flag works around
                   4708:          # a FreeBSD bug that causes programs to crash when -lm is
                   4709:          # linked before any other PIC object.  But we must not use
                   4710:          # pic_flag when linking with -static.  The problem exists in
                   4711:          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1.1.1.2   misho    4712:          *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1.1       misho    4713:            pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
                   4714:          *-*-hpux*)
                   4715:            pic_flag_for_symtable=" $pic_flag"  ;;
                   4716:          *)
1.1.1.3 ! misho    4717:            $my_pic_p && pic_flag_for_symtable=" $pic_flag"
1.1       misho    4718:            ;;
                   4719:          esac
                   4720:          ;;
                   4721:        esac
                   4722:        symtab_cflags=
                   4723:        for arg in $LTCFLAGS; do
                   4724:          case $arg in
                   4725:          -pie | -fpie | -fPIE) ;;
                   4726:          *) func_append symtab_cflags " $arg" ;;
                   4727:          esac
                   4728:        done
                   4729: 
                   4730:        # Now compile the dynamic symbol file.
                   4731:        func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
                   4732: 
                   4733:        # Clean up the generated files.
1.1.1.3 ! misho    4734:        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
1.1       misho    4735: 
                   4736:        # Transform the symbol file into the correct name.
1.1.1.3 ! misho    4737:        symfileobj=$output_objdir/${my_outputname}S.$objext
1.1       misho    4738:        case $host in
                   4739:        *cygwin* | *mingw* | *cegcc* )
                   4740:          if test -f "$output_objdir/$my_outputname.def"; then
                   4741:            compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
                   4742:            finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
                   4743:          else
                   4744:            compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
                   4745:            finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
                   4746:          fi
                   4747:          ;;
                   4748:        *)
                   4749:          compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
                   4750:          finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
                   4751:          ;;
                   4752:        esac
                   4753:        ;;
                   4754:       *)
1.1.1.3 ! misho    4755:        func_fatal_error "unknown suffix for '$my_dlsyms'"
1.1       misho    4756:        ;;
                   4757:       esac
                   4758:     else
                   4759:       # We keep going just in case the user didn't refer to
                   4760:       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
                   4761:       # really was required.
                   4762: 
                   4763:       # Nullify the symbol file.
                   4764:       compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
                   4765:       finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
                   4766:     fi
                   4767: }
                   4768: 
1.1.1.3 ! misho    4769: # func_cygming_gnu_implib_p ARG
        !          4770: # This predicate returns with zero status (TRUE) if
        !          4771: # ARG is a GNU/binutils-style import library. Returns
        !          4772: # with nonzero status (FALSE) otherwise.
        !          4773: func_cygming_gnu_implib_p ()
        !          4774: {
        !          4775:   $debug_cmd
        !          4776: 
        !          4777:   func_to_tool_file "$1" func_convert_file_msys_to_w32
        !          4778:   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)$'`
        !          4779:   test -n "$func_cygming_gnu_implib_tmp"
        !          4780: }
        !          4781: 
        !          4782: # func_cygming_ms_implib_p ARG
        !          4783: # This predicate returns with zero status (TRUE) if
        !          4784: # ARG is an MS-style import library. Returns
        !          4785: # with nonzero status (FALSE) otherwise.
        !          4786: func_cygming_ms_implib_p ()
        !          4787: {
        !          4788:   $debug_cmd
        !          4789: 
        !          4790:   func_to_tool_file "$1" func_convert_file_msys_to_w32
        !          4791:   func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
        !          4792:   test -n "$func_cygming_ms_implib_tmp"
        !          4793: }
        !          4794: 
1.1       misho    4795: # func_win32_libid arg
                   4796: # return the library type of file 'arg'
                   4797: #
                   4798: # Need a lot of goo to handle *both* DLLs and import libs
                   4799: # Has to be a shell function in order to 'eat' the argument
                   4800: # that is supplied when $file_magic_command is called.
                   4801: # Despite the name, also deal with 64 bit binaries.
                   4802: func_win32_libid ()
                   4803: {
1.1.1.3 ! misho    4804:   $debug_cmd
        !          4805: 
        !          4806:   win32_libid_type=unknown
1.1       misho    4807:   win32_fileres=`file -L $1 2>/dev/null`
                   4808:   case $win32_fileres in
                   4809:   *ar\ archive\ import\ library*) # definitely import
                   4810:     win32_libid_type="x86 archive import"
                   4811:     ;;
                   4812:   *ar\ archive*) # could be an import, or static
                   4813:     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
                   4814:     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
                   4815:        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
1.1.1.3 ! misho    4816:       case $nm_interface in
        !          4817:       "MS dumpbin")
        !          4818:        if func_cygming_ms_implib_p "$1" ||
        !          4819:           func_cygming_gnu_implib_p "$1"
        !          4820:        then
        !          4821:          win32_nmres=import
        !          4822:        else
        !          4823:          win32_nmres=
        !          4824:        fi
        !          4825:        ;;
        !          4826:       *)
        !          4827:        func_to_tool_file "$1" func_convert_file_msys_to_w32
        !          4828:        win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
        !          4829:          $SED -n -e '
1.1       misho    4830:            1,100{
                   4831:                / I /{
1.1.1.3 ! misho    4832:                    s|.*|import|
1.1       misho    4833:                    p
                   4834:                    q
                   4835:                }
                   4836:            }'`
1.1.1.3 ! misho    4837:        ;;
        !          4838:       esac
1.1       misho    4839:       case $win32_nmres in
                   4840:       import*)  win32_libid_type="x86 archive import";;
                   4841:       *)        win32_libid_type="x86 archive static";;
                   4842:       esac
                   4843:     fi
                   4844:     ;;
                   4845:   *DLL*)
                   4846:     win32_libid_type="x86 DLL"
                   4847:     ;;
                   4848:   *executable*) # but shell scripts are "executable" too...
                   4849:     case $win32_fileres in
                   4850:     *MS\ Windows\ PE\ Intel*)
                   4851:       win32_libid_type="x86 DLL"
                   4852:       ;;
                   4853:     esac
                   4854:     ;;
                   4855:   esac
                   4856:   $ECHO "$win32_libid_type"
                   4857: }
                   4858: 
                   4859: # func_cygming_dll_for_implib ARG
                   4860: #
                   4861: # Platform-specific function to extract the
                   4862: # name of the DLL associated with the specified
                   4863: # import library ARG.
                   4864: # Invoked by eval'ing the libtool variable
                   4865: #    $sharedlib_from_linklib_cmd
                   4866: # Result is available in the variable
                   4867: #    $sharedlib_from_linklib_result
                   4868: func_cygming_dll_for_implib ()
                   4869: {
1.1.1.3 ! misho    4870:   $debug_cmd
        !          4871: 
1.1       misho    4872:   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
                   4873: }
                   4874: 
                   4875: # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
                   4876: #
                   4877: # The is the core of a fallback implementation of a
                   4878: # platform-specific function to extract the name of the
                   4879: # DLL associated with the specified import library LIBNAME.
                   4880: #
                   4881: # SECTION_NAME is either .idata$6 or .idata$7, depending
                   4882: # on the platform and compiler that created the implib.
                   4883: #
                   4884: # Echos the name of the DLL associated with the
                   4885: # specified import library.
                   4886: func_cygming_dll_for_implib_fallback_core ()
                   4887: {
1.1.1.3 ! misho    4888:   $debug_cmd
        !          4889: 
1.1       misho    4890:   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
                   4891:   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
                   4892:     $SED '/^Contents of section '"$match_literal"':/{
                   4893:       # Place marker at beginning of archive member dllname section
                   4894:       s/.*/====MARK====/
                   4895:       p
                   4896:       d
                   4897:     }
                   4898:     # These lines can sometimes be longer than 43 characters, but
                   4899:     # are always uninteresting
                   4900:     /:[         ]*file format pe[i]\{,1\}-/d
                   4901:     /^In archive [^:]*:/d
                   4902:     # Ensure marker is printed
                   4903:     /^====MARK====/p
                   4904:     # Remove all lines with less than 43 characters
                   4905:     /^.\{43\}/!d
                   4906:     # From remaining lines, remove first 43 characters
                   4907:     s/^.\{43\}//' |
                   4908:     $SED -n '
                   4909:       # Join marker and all lines until next marker into a single line
                   4910:       /^====MARK====/ b para
                   4911:       H
                   4912:       $ b para
                   4913:       b
                   4914:       :para
                   4915:       x
                   4916:       s/\n//g
                   4917:       # Remove the marker
                   4918:       s/^====MARK====//
                   4919:       # Remove trailing dots and whitespace
                   4920:       s/[\. \t]*$//
                   4921:       # Print
                   4922:       /./p' |
                   4923:     # we now have a list, one entry per line, of the stringified
                   4924:     # contents of the appropriate section of all members of the
1.1.1.3 ! misho    4925:     # archive that possess that section. Heuristic: eliminate
        !          4926:     # all those that have a first or second character that is
1.1       misho    4927:     # a '.' (that is, objdump's representation of an unprintable
                   4928:     # character.) This should work for all archives with less than
                   4929:     # 0x302f exports -- but will fail for DLLs whose name actually
                   4930:     # begins with a literal '.' or a single character followed by
                   4931:     # a '.'.
                   4932:     #
                   4933:     # Of those that remain, print the first one.
                   4934:     $SED -e '/^\./d;/^.\./d;q'
                   4935: }
                   4936: 
                   4937: # func_cygming_dll_for_implib_fallback ARG
                   4938: # Platform-specific function to extract the
                   4939: # name of the DLL associated with the specified
                   4940: # import library ARG.
                   4941: #
                   4942: # This fallback implementation is for use when $DLLTOOL
                   4943: # does not support the --identify-strict option.
                   4944: # Invoked by eval'ing the libtool variable
                   4945: #    $sharedlib_from_linklib_cmd
                   4946: # Result is available in the variable
                   4947: #    $sharedlib_from_linklib_result
                   4948: func_cygming_dll_for_implib_fallback ()
                   4949: {
1.1.1.3 ! misho    4950:   $debug_cmd
        !          4951: 
        !          4952:   if func_cygming_gnu_implib_p "$1"; then
1.1       misho    4953:     # binutils import library
                   4954:     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
1.1.1.3 ! misho    4955:   elif func_cygming_ms_implib_p "$1"; then
1.1       misho    4956:     # ms-generated import library
                   4957:     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
                   4958:   else
                   4959:     # unknown
1.1.1.3 ! misho    4960:     sharedlib_from_linklib_result=
1.1       misho    4961:   fi
                   4962: }
                   4963: 
                   4964: 
                   4965: # func_extract_an_archive dir oldlib
                   4966: func_extract_an_archive ()
                   4967: {
1.1.1.3 ! misho    4968:     $debug_cmd
        !          4969: 
        !          4970:     f_ex_an_ar_dir=$1; shift
        !          4971:     f_ex_an_ar_oldlib=$1
        !          4972:     if test yes = "$lock_old_archive_extraction"; then
1.1       misho    4973:       lockfile=$f_ex_an_ar_oldlib.lock
                   4974:       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
                   4975:        func_echo "Waiting for $lockfile to be removed"
                   4976:        sleep 2
                   4977:       done
                   4978:     fi
                   4979:     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
                   4980:                   'stat=$?; rm -f "$lockfile"; exit $stat'
1.1.1.3 ! misho    4981:     if test yes = "$lock_old_archive_extraction"; then
1.1       misho    4982:       $opt_dry_run || rm -f "$lockfile"
                   4983:     fi
                   4984:     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
                   4985:      :
                   4986:     else
                   4987:       func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
                   4988:     fi
                   4989: }
                   4990: 
                   4991: 
                   4992: # func_extract_archives gentop oldlib ...
                   4993: func_extract_archives ()
                   4994: {
1.1.1.3 ! misho    4995:     $debug_cmd
        !          4996: 
        !          4997:     my_gentop=$1; shift
1.1       misho    4998:     my_oldlibs=${1+"$@"}
1.1.1.3 ! misho    4999:     my_oldobjs=
        !          5000:     my_xlib=
        !          5001:     my_xabs=
        !          5002:     my_xdir=
1.1       misho    5003: 
                   5004:     for my_xlib in $my_oldlibs; do
                   5005:       # Extract the objects.
                   5006:       case $my_xlib in
1.1.1.3 ! misho    5007:        [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
1.1       misho    5008:        *) my_xabs=`pwd`"/$my_xlib" ;;
                   5009:       esac
                   5010:       func_basename "$my_xlib"
1.1.1.3 ! misho    5011:       my_xlib=$func_basename_result
1.1       misho    5012:       my_xlib_u=$my_xlib
                   5013:       while :; do
                   5014:         case " $extracted_archives " in
                   5015:        *" $my_xlib_u "*)
                   5016:          func_arith $extracted_serial + 1
                   5017:          extracted_serial=$func_arith_result
                   5018:          my_xlib_u=lt$extracted_serial-$my_xlib ;;
                   5019:        *) break ;;
                   5020:        esac
                   5021:       done
                   5022:       extracted_archives="$extracted_archives $my_xlib_u"
1.1.1.3 ! misho    5023:       my_xdir=$my_gentop/$my_xlib_u
1.1       misho    5024: 
                   5025:       func_mkdir_p "$my_xdir"
                   5026: 
                   5027:       case $host in
                   5028:       *-darwin*)
                   5029:        func_verbose "Extracting $my_xabs"
                   5030:        # Do not bother doing anything if just a dry run
                   5031:        $opt_dry_run || {
                   5032:          darwin_orig_dir=`pwd`
                   5033:          cd $my_xdir || exit $?
                   5034:          darwin_archive=$my_xabs
                   5035:          darwin_curdir=`pwd`
1.1.1.3 ! misho    5036:          func_basename "$darwin_archive"
        !          5037:          darwin_base_archive=$func_basename_result
1.1       misho    5038:          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
                   5039:          if test -n "$darwin_arches"; then
                   5040:            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
                   5041:            darwin_arch=
                   5042:            func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
1.1.1.3 ! misho    5043:            for darwin_arch in  $darwin_arches; do
        !          5044:              func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
        !          5045:              $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
        !          5046:              cd "unfat-$$/$darwin_base_archive-$darwin_arch"
        !          5047:              func_extract_an_archive "`pwd`" "$darwin_base_archive"
1.1       misho    5048:              cd "$darwin_curdir"
1.1.1.3 ! misho    5049:              $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
1.1       misho    5050:            done # $darwin_arches
                   5051:             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
                   5052:            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
                   5053:            darwin_file=
                   5054:            darwin_files=
                   5055:            for darwin_file in $darwin_filelist; do
                   5056:              darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
                   5057:              $LIPO -create -output "$darwin_file" $darwin_files
                   5058:            done # $darwin_filelist
                   5059:            $RM -rf unfat-$$
                   5060:            cd "$darwin_orig_dir"
                   5061:          else
                   5062:            cd $darwin_orig_dir
                   5063:            func_extract_an_archive "$my_xdir" "$my_xabs"
                   5064:          fi # $darwin_arches
                   5065:        } # !$opt_dry_run
                   5066:        ;;
                   5067:       *)
                   5068:         func_extract_an_archive "$my_xdir" "$my_xabs"
                   5069:        ;;
                   5070:       esac
                   5071:       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
                   5072:     done
                   5073: 
1.1.1.3 ! misho    5074:     func_extract_archives_result=$my_oldobjs
1.1       misho    5075: }
                   5076: 
                   5077: 
                   5078: # func_emit_wrapper [arg=no]
                   5079: #
                   5080: # Emit a libtool wrapper script on stdout.
                   5081: # Don't directly open a file because we may want to
                   5082: # incorporate the script contents within a cygwin/mingw
                   5083: # wrapper executable.  Must ONLY be called from within
                   5084: # func_mode_link because it depends on a number of variables
                   5085: # set therein.
                   5086: #
                   5087: # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
                   5088: # variable will take.  If 'yes', then the emitted script
1.1.1.3 ! misho    5089: # will assume that the directory where it is stored is
1.1       misho    5090: # the $objdir directory.  This is a cygwin/mingw-specific
                   5091: # behavior.
                   5092: func_emit_wrapper ()
                   5093: {
                   5094:        func_emit_wrapper_arg1=${1-no}
                   5095: 
                   5096:        $ECHO "\
                   5097: #! $SHELL
                   5098: 
                   5099: # $output - temporary wrapper script for $objdir/$outputname
1.1.1.3 ! misho    5100: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1.1       misho    5101: #
                   5102: # The $output program cannot be directly executed until all the libtool
                   5103: # libraries that it depends on are installed.
                   5104: #
                   5105: # This wrapper script should never be moved out of the build directory.
                   5106: # If it is, it will not operate correctly.
                   5107: 
                   5108: # Sed substitution that helps us do robust quoting.  It backslashifies
                   5109: # metacharacters that are still active within double-quoted strings.
                   5110: sed_quote_subst='$sed_quote_subst'
                   5111: 
                   5112: # Be Bourne compatible
                   5113: if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
                   5114:   emulate sh
                   5115:   NULLCMD=:
                   5116:   # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
                   5117:   # is contrary to our usage.  Disable this feature.
                   5118:   alias -g '\${1+\"\$@\"}'='\"\$@\"'
                   5119:   setopt NO_GLOB_SUBST
                   5120: else
                   5121:   case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
                   5122: fi
                   5123: BIN_SH=xpg4; export BIN_SH # for Tru64
                   5124: DUALCASE=1; export DUALCASE # for MKS sh
                   5125: 
                   5126: # The HP-UX ksh and POSIX shell print the target directory to stdout
                   5127: # if CDPATH is set.
                   5128: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
                   5129: 
                   5130: relink_command=\"$relink_command\"
                   5131: 
                   5132: # This environment variable determines our operation mode.
                   5133: if test \"\$libtool_install_magic\" = \"$magic\"; then
                   5134:   # install mode needs the following variables:
                   5135:   generated_by_libtool_version='$macro_version'
                   5136:   notinst_deplibs='$notinst_deplibs'
                   5137: else
                   5138:   # When we are sourced in execute mode, \$file and \$ECHO are already set.
                   5139:   if test \"\$libtool_execute_magic\" != \"$magic\"; then
                   5140:     file=\"\$0\""
                   5141: 
                   5142:     qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
                   5143:     $ECHO "\
                   5144: 
                   5145: # A function that is used when there is no print builtin or printf.
                   5146: func_fallback_echo ()
                   5147: {
                   5148:   eval 'cat <<_LTECHO_EOF
                   5149: \$1
                   5150: _LTECHO_EOF'
                   5151: }
                   5152:     ECHO=\"$qECHO\"
                   5153:   fi
                   5154: 
                   5155: # Very basic option parsing. These options are (a) specific to
                   5156: # the libtool wrapper, (b) are identical between the wrapper
1.1.1.3 ! misho    5157: # /script/ and the wrapper /executable/ that is used only on
1.1       misho    5158: # windows platforms, and (c) all begin with the string "--lt-"
1.1.1.3 ! misho    5159: # (application programs are unlikely to have options that match
1.1       misho    5160: # this pattern).
                   5161: #
                   5162: # There are only two supported options: --lt-debug and
                   5163: # --lt-dump-script. There is, deliberately, no --lt-help.
                   5164: #
                   5165: # The first argument to this parsing function should be the
                   5166: # script's $0 value, followed by "$@".
                   5167: lt_option_debug=
                   5168: func_parse_lt_options ()
                   5169: {
                   5170:   lt_script_arg0=\$0
                   5171:   shift
                   5172:   for lt_opt
                   5173:   do
                   5174:     case \"\$lt_opt\" in
                   5175:     --lt-debug) lt_option_debug=1 ;;
                   5176:     --lt-dump-script)
                   5177:         lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
                   5178:         test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
                   5179:         lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
                   5180:         cat \"\$lt_dump_D/\$lt_dump_F\"
                   5181:         exit 0
                   5182:       ;;
                   5183:     --lt-*)
                   5184:         \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
                   5185:         exit 1
                   5186:       ;;
                   5187:     esac
                   5188:   done
                   5189: 
                   5190:   # Print the debug banner immediately:
                   5191:   if test -n \"\$lt_option_debug\"; then
1.1.1.3 ! misho    5192:     echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
1.1       misho    5193:   fi
                   5194: }
                   5195: 
                   5196: # Used when --lt-debug. Prints its arguments to stdout
                   5197: # (redirection is the responsibility of the caller)
                   5198: func_lt_dump_args ()
                   5199: {
                   5200:   lt_dump_args_N=1;
                   5201:   for lt_arg
                   5202:   do
1.1.1.3 ! misho    5203:     \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
1.1       misho    5204:     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
                   5205:   done
                   5206: }
                   5207: 
                   5208: # Core function for launching the target application
                   5209: func_exec_program_core ()
                   5210: {
                   5211: "
                   5212:   case $host in
                   5213:   # Backslashes separate directories on plain windows
                   5214:   *-*-mingw | *-*-os2* | *-cegcc*)
                   5215:     $ECHO "\
                   5216:       if test -n \"\$lt_option_debug\"; then
1.1.1.3 ! misho    5217:         \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
1.1       misho    5218:         func_lt_dump_args \${1+\"\$@\"} 1>&2
                   5219:       fi
                   5220:       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
                   5221: "
                   5222:     ;;
                   5223: 
                   5224:   *)
                   5225:     $ECHO "\
                   5226:       if test -n \"\$lt_option_debug\"; then
1.1.1.3 ! misho    5227:         \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
1.1       misho    5228:         func_lt_dump_args \${1+\"\$@\"} 1>&2
                   5229:       fi
                   5230:       exec \"\$progdir/\$program\" \${1+\"\$@\"}
                   5231: "
                   5232:     ;;
                   5233:   esac
                   5234:   $ECHO "\
                   5235:       \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
                   5236:       exit 1
                   5237: }
                   5238: 
                   5239: # A function to encapsulate launching the target application
                   5240: # Strips options in the --lt-* namespace from \$@ and
                   5241: # launches target application with the remaining arguments.
                   5242: func_exec_program ()
                   5243: {
1.1.1.2   misho    5244:   case \" \$* \" in
                   5245:   *\\ --lt-*)
                   5246:     for lt_wr_arg
                   5247:     do
                   5248:       case \$lt_wr_arg in
                   5249:       --lt-*) ;;
                   5250:       *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
                   5251:       esac
                   5252:       shift
                   5253:     done ;;
                   5254:   esac
1.1       misho    5255:   func_exec_program_core \${1+\"\$@\"}
                   5256: }
                   5257: 
                   5258:   # Parse options
                   5259:   func_parse_lt_options \"\$0\" \${1+\"\$@\"}
                   5260: 
                   5261:   # Find the directory that this script lives in.
                   5262:   thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
                   5263:   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
                   5264: 
                   5265:   # Follow symbolic links until we get to the real thisdir.
                   5266:   file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
                   5267:   while test -n \"\$file\"; do
                   5268:     destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
                   5269: 
                   5270:     # If there was a directory component, then change thisdir.
                   5271:     if test \"x\$destdir\" != \"x\$file\"; then
                   5272:       case \"\$destdir\" in
                   5273:       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
                   5274:       *) thisdir=\"\$thisdir/\$destdir\" ;;
                   5275:       esac
                   5276:     fi
                   5277: 
                   5278:     file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
                   5279:     file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
                   5280:   done
                   5281: 
                   5282:   # Usually 'no', except on cygwin/mingw when embedded into
                   5283:   # the cwrapper.
                   5284:   WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
                   5285:   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
                   5286:     # special case for '.'
                   5287:     if test \"\$thisdir\" = \".\"; then
                   5288:       thisdir=\`pwd\`
                   5289:     fi
                   5290:     # remove .libs from thisdir
                   5291:     case \"\$thisdir\" in
                   5292:     *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
                   5293:     $objdir )   thisdir=. ;;
                   5294:     esac
                   5295:   fi
                   5296: 
                   5297:   # Try to get the absolute directory name.
                   5298:   absdir=\`cd \"\$thisdir\" && pwd\`
                   5299:   test -n \"\$absdir\" && thisdir=\"\$absdir\"
                   5300: "
                   5301: 
1.1.1.3 ! misho    5302:        if test yes = "$fast_install"; then
1.1       misho    5303:          $ECHO "\
                   5304:   program=lt-'$outputname'$exeext
                   5305:   progdir=\"\$thisdir/$objdir\"
                   5306: 
                   5307:   if test ! -f \"\$progdir/\$program\" ||
1.1.1.3 ! misho    5308:      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
1.1       misho    5309:        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
                   5310: 
                   5311:     file=\"\$\$-\$program\"
                   5312: 
                   5313:     if test ! -d \"\$progdir\"; then
                   5314:       $MKDIR \"\$progdir\"
                   5315:     else
                   5316:       $RM \"\$progdir/\$file\"
                   5317:     fi"
                   5318: 
                   5319:          $ECHO "\
                   5320: 
                   5321:     # relink executable if necessary
                   5322:     if test -n \"\$relink_command\"; then
                   5323:       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
                   5324:       else
                   5325:        $ECHO \"\$relink_command_output\" >&2
                   5326:        $RM \"\$progdir/\$file\"
                   5327:        exit 1
                   5328:       fi
                   5329:     fi
                   5330: 
                   5331:     $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
                   5332:     { $RM \"\$progdir/\$program\";
                   5333:       $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
                   5334:     $RM \"\$progdir/\$file\"
                   5335:   fi"
                   5336:        else
                   5337:          $ECHO "\
                   5338:   program='$outputname'
                   5339:   progdir=\"\$thisdir/$objdir\"
                   5340: "
                   5341:        fi
                   5342: 
                   5343:        $ECHO "\
                   5344: 
                   5345:   if test -f \"\$progdir/\$program\"; then"
                   5346: 
                   5347:        # fixup the dll searchpath if we need to.
                   5348:        #
                   5349:        # Fix the DLL searchpath if we need to.  Do this before prepending
                   5350:        # to shlibpath, because on Windows, both are PATH and uninstalled
                   5351:        # libraries must come first.
                   5352:        if test -n "$dllsearchpath"; then
                   5353:          $ECHO "\
                   5354:     # Add the dll search path components to the executable PATH
                   5355:     PATH=$dllsearchpath:\$PATH
                   5356: "
                   5357:        fi
                   5358: 
                   5359:        # Export our shlibpath_var if we have one.
1.1.1.3 ! misho    5360:        if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1.1       misho    5361:          $ECHO "\
                   5362:     # Add our own library path to $shlibpath_var
                   5363:     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
                   5364: 
                   5365:     # Some systems cannot cope with colon-terminated $shlibpath_var
                   5366:     # The second colon is a workaround for a bug in BeOS R4 sed
                   5367:     $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
                   5368: 
                   5369:     export $shlibpath_var
                   5370: "
                   5371:        fi
                   5372: 
                   5373:        $ECHO "\
                   5374:     if test \"\$libtool_execute_magic\" != \"$magic\"; then
                   5375:       # Run the actual program with our arguments.
                   5376:       func_exec_program \${1+\"\$@\"}
                   5377:     fi
                   5378:   else
                   5379:     # The program doesn't exist.
1.1.1.3 ! misho    5380:     \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
1.1       misho    5381:     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
                   5382:     \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
                   5383:     exit 1
                   5384:   fi
                   5385: fi\
                   5386: "
                   5387: }
                   5388: 
                   5389: 
                   5390: # func_emit_cwrapperexe_src
                   5391: # emit the source code for a wrapper executable on stdout
                   5392: # Must ONLY be called from within func_mode_link because
                   5393: # it depends on a number of variable set therein.
                   5394: func_emit_cwrapperexe_src ()
                   5395: {
                   5396:        cat <<EOF
                   5397: 
                   5398: /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
1.1.1.3 ! misho    5399:    Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1.1       misho    5400: 
                   5401:    The $output program cannot be directly executed until all the libtool
                   5402:    libraries that it depends on are installed.
                   5403: 
                   5404:    This wrapper executable should never be moved out of the build directory.
                   5405:    If it is, it will not operate correctly.
                   5406: */
                   5407: EOF
                   5408:            cat <<"EOF"
                   5409: #ifdef _MSC_VER
                   5410: # define _CRT_SECURE_NO_DEPRECATE 1
                   5411: #endif
                   5412: #include <stdio.h>
                   5413: #include <stdlib.h>
                   5414: #ifdef _MSC_VER
                   5415: # include <direct.h>
                   5416: # include <process.h>
                   5417: # include <io.h>
                   5418: #else
                   5419: # include <unistd.h>
                   5420: # include <stdint.h>
                   5421: # ifdef __CYGWIN__
                   5422: #  include <io.h>
                   5423: # endif
                   5424: #endif
                   5425: #include <malloc.h>
                   5426: #include <stdarg.h>
                   5427: #include <assert.h>
                   5428: #include <string.h>
                   5429: #include <ctype.h>
                   5430: #include <errno.h>
                   5431: #include <fcntl.h>
                   5432: #include <sys/stat.h>
                   5433: 
1.1.1.3 ! misho    5434: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
        !          5435: 
1.1       misho    5436: /* declarations of non-ANSI functions */
1.1.1.3 ! misho    5437: #if defined __MINGW32__
1.1       misho    5438: # ifdef __STRICT_ANSI__
                   5439: int _putenv (const char *);
                   5440: # endif
1.1.1.3 ! misho    5441: #elif defined __CYGWIN__
1.1       misho    5442: # ifdef __STRICT_ANSI__
                   5443: char *realpath (const char *, char *);
                   5444: int putenv (char *);
                   5445: int setenv (const char *, const char *, int);
                   5446: # endif
1.1.1.3 ! misho    5447: /* #elif defined other_platform || defined ... */
1.1       misho    5448: #endif
                   5449: 
                   5450: /* portability defines, excluding path handling macros */
1.1.1.3 ! misho    5451: #if defined _MSC_VER
1.1       misho    5452: # define setmode _setmode
                   5453: # define stat    _stat
                   5454: # define chmod   _chmod
                   5455: # define getcwd  _getcwd
                   5456: # define putenv  _putenv
                   5457: # define S_IXUSR _S_IEXEC
1.1.1.3 ! misho    5458: #elif defined __MINGW32__
1.1       misho    5459: # define setmode _setmode
                   5460: # define stat    _stat
                   5461: # define chmod   _chmod
                   5462: # define getcwd  _getcwd
                   5463: # define putenv  _putenv
1.1.1.3 ! misho    5464: #elif defined __CYGWIN__
1.1       misho    5465: # define HAVE_SETENV
                   5466: # define FOPEN_WB "wb"
1.1.1.3 ! misho    5467: /* #elif defined other platforms ... */
1.1       misho    5468: #endif
                   5469: 
1.1.1.3 ! misho    5470: #if defined PATH_MAX
1.1       misho    5471: # define LT_PATHMAX PATH_MAX
1.1.1.3 ! misho    5472: #elif defined MAXPATHLEN
1.1       misho    5473: # define LT_PATHMAX MAXPATHLEN
                   5474: #else
                   5475: # define LT_PATHMAX 1024
                   5476: #endif
                   5477: 
                   5478: #ifndef S_IXOTH
                   5479: # define S_IXOTH 0
                   5480: #endif
                   5481: #ifndef S_IXGRP
                   5482: # define S_IXGRP 0
                   5483: #endif
                   5484: 
                   5485: /* path handling portability macros */
                   5486: #ifndef DIR_SEPARATOR
                   5487: # define DIR_SEPARATOR '/'
                   5488: # define PATH_SEPARATOR ':'
                   5489: #endif
                   5490: 
1.1.1.3 ! misho    5491: #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
        !          5492:   defined __OS2__
1.1       misho    5493: # define HAVE_DOS_BASED_FILE_SYSTEM
                   5494: # define FOPEN_WB "wb"
                   5495: # ifndef DIR_SEPARATOR_2
                   5496: #  define DIR_SEPARATOR_2 '\\'
                   5497: # endif
                   5498: # ifndef PATH_SEPARATOR_2
                   5499: #  define PATH_SEPARATOR_2 ';'
                   5500: # endif
                   5501: #endif
                   5502: 
                   5503: #ifndef DIR_SEPARATOR_2
                   5504: # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
                   5505: #else /* DIR_SEPARATOR_2 */
                   5506: # define IS_DIR_SEPARATOR(ch) \
                   5507:        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
                   5508: #endif /* DIR_SEPARATOR_2 */
                   5509: 
                   5510: #ifndef PATH_SEPARATOR_2
                   5511: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
                   5512: #else /* PATH_SEPARATOR_2 */
                   5513: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
                   5514: #endif /* PATH_SEPARATOR_2 */
                   5515: 
                   5516: #ifndef FOPEN_WB
                   5517: # define FOPEN_WB "w"
                   5518: #endif
                   5519: #ifndef _O_BINARY
                   5520: # define _O_BINARY 0
                   5521: #endif
                   5522: 
                   5523: #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
                   5524: #define XFREE(stale) do { \
1.1.1.3 ! misho    5525:   if (stale) { free (stale); stale = 0; } \
1.1       misho    5526: } while (0)
                   5527: 
1.1.1.3 ! misho    5528: #if defined LT_DEBUGWRAPPER
1.1       misho    5529: static int lt_debug = 1;
                   5530: #else
                   5531: static int lt_debug = 0;
                   5532: #endif
                   5533: 
                   5534: const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
                   5535: 
                   5536: void *xmalloc (size_t num);
                   5537: char *xstrdup (const char *string);
                   5538: const char *base_name (const char *name);
                   5539: char *find_executable (const char *wrapper);
                   5540: char *chase_symlinks (const char *pathspec);
                   5541: int make_executable (const char *path);
                   5542: int check_executable (const char *path);
                   5543: char *strendzap (char *str, const char *pat);
                   5544: void lt_debugprintf (const char *file, int line, const char *fmt, ...);
                   5545: void lt_fatal (const char *file, int line, const char *message, ...);
                   5546: static const char *nonnull (const char *s);
                   5547: static const char *nonempty (const char *s);
                   5548: void lt_setenv (const char *name, const char *value);
                   5549: char *lt_extend_str (const char *orig_value, const char *add, int to_end);
                   5550: void lt_update_exe_path (const char *name, const char *value);
                   5551: void lt_update_lib_path (const char *name, const char *value);
                   5552: char **prepare_spawn (char **argv);
                   5553: void lt_dump_script (FILE *f);
                   5554: EOF
                   5555: 
                   5556:            cat <<EOF
                   5557: volatile const char * MAGIC_EXE = "$magic_exe";
                   5558: const char * LIB_PATH_VARNAME = "$shlibpath_var";
                   5559: EOF
                   5560: 
1.1.1.3 ! misho    5561:            if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1.1       misho    5562:               func_to_host_path "$temp_rpath"
                   5563:              cat <<EOF
                   5564: const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
                   5565: EOF
                   5566:            else
                   5567:              cat <<"EOF"
                   5568: const char * LIB_PATH_VALUE   = "";
                   5569: EOF
                   5570:            fi
                   5571: 
                   5572:            if test -n "$dllsearchpath"; then
                   5573:               func_to_host_path "$dllsearchpath:"
                   5574:              cat <<EOF
                   5575: const char * EXE_PATH_VARNAME = "PATH";
                   5576: const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
                   5577: EOF
                   5578:            else
                   5579:              cat <<"EOF"
                   5580: const char * EXE_PATH_VARNAME = "";
                   5581: const char * EXE_PATH_VALUE   = "";
                   5582: EOF
                   5583:            fi
                   5584: 
1.1.1.3 ! misho    5585:            if test yes = "$fast_install"; then
1.1       misho    5586:              cat <<EOF
                   5587: const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
                   5588: EOF
                   5589:            else
                   5590:              cat <<EOF
                   5591: const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
                   5592: EOF
                   5593:            fi
                   5594: 
                   5595: 
                   5596:            cat <<"EOF"
                   5597: 
                   5598: #define LTWRAPPER_OPTION_PREFIX         "--lt-"
                   5599: 
                   5600: static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
                   5601: static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
                   5602: static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
                   5603: 
                   5604: int
                   5605: main (int argc, char *argv[])
                   5606: {
                   5607:   char **newargz;
                   5608:   int  newargc;
                   5609:   char *tmp_pathspec;
                   5610:   char *actual_cwrapper_path;
                   5611:   char *actual_cwrapper_name;
                   5612:   char *target_name;
                   5613:   char *lt_argv_zero;
1.1.1.3 ! misho    5614:   int rval = 127;
1.1       misho    5615: 
                   5616:   int i;
                   5617: 
                   5618:   program_name = (char *) xstrdup (base_name (argv[0]));
1.1.1.3 ! misho    5619:   newargz = XMALLOC (char *, (size_t) argc + 1);
1.1       misho    5620: 
                   5621:   /* very simple arg parsing; don't want to rely on getopt
                   5622:    * also, copy all non cwrapper options to newargz, except
                   5623:    * argz[0], which is handled differently
                   5624:    */
                   5625:   newargc=0;
                   5626:   for (i = 1; i < argc; i++)
                   5627:     {
1.1.1.3 ! misho    5628:       if (STREQ (argv[i], dumpscript_opt))
1.1       misho    5629:        {
                   5630: EOF
1.1.1.3 ! misho    5631:            case $host in
1.1       misho    5632:              *mingw* | *cygwin* )
                   5633:                # make stdout use "unix" line endings
                   5634:                echo "          setmode(1,_O_BINARY);"
                   5635:                ;;
                   5636:              esac
                   5637: 
                   5638:            cat <<"EOF"
                   5639:          lt_dump_script (stdout);
                   5640:          return 0;
                   5641:        }
1.1.1.3 ! misho    5642:       if (STREQ (argv[i], debug_opt))
1.1       misho    5643:        {
                   5644:           lt_debug = 1;
                   5645:           continue;
                   5646:        }
1.1.1.3 ! misho    5647:       if (STREQ (argv[i], ltwrapper_option_prefix))
1.1       misho    5648:         {
                   5649:           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
                   5650:              namespace, but it is not one of the ones we know about and
                   5651:              have already dealt with, above (inluding dump-script), then
                   5652:              report an error. Otherwise, targets might begin to believe
                   5653:              they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
                   5654:              namespace. The first time any user complains about this, we'll
                   5655:              need to make LTWRAPPER_OPTION_PREFIX a configure-time option
                   5656:              or a configure.ac-settable value.
                   5657:            */
                   5658:           lt_fatal (__FILE__, __LINE__,
                   5659:                    "unrecognized %s option: '%s'",
                   5660:                     ltwrapper_option_prefix, argv[i]);
                   5661:         }
                   5662:       /* otherwise ... */
                   5663:       newargz[++newargc] = xstrdup (argv[i]);
                   5664:     }
                   5665:   newargz[++newargc] = NULL;
                   5666: 
                   5667: EOF
                   5668:            cat <<EOF
                   5669:   /* The GNU banner must be the first non-error debug message */
1.1.1.3 ! misho    5670:   lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
1.1       misho    5671: EOF
                   5672:            cat <<"EOF"
                   5673:   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
                   5674:   lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
                   5675: 
                   5676:   tmp_pathspec = find_executable (argv[0]);
                   5677:   if (tmp_pathspec == NULL)
                   5678:     lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
                   5679:   lt_debugprintf (__FILE__, __LINE__,
                   5680:                   "(main) found exe (before symlink chase) at: %s\n",
                   5681:                  tmp_pathspec);
                   5682: 
                   5683:   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
                   5684:   lt_debugprintf (__FILE__, __LINE__,
                   5685:                   "(main) found exe (after symlink chase) at: %s\n",
                   5686:                  actual_cwrapper_path);
                   5687:   XFREE (tmp_pathspec);
                   5688: 
                   5689:   actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
                   5690:   strendzap (actual_cwrapper_path, actual_cwrapper_name);
                   5691: 
                   5692:   /* wrapper name transforms */
                   5693:   strendzap (actual_cwrapper_name, ".exe");
                   5694:   tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
                   5695:   XFREE (actual_cwrapper_name);
                   5696:   actual_cwrapper_name = tmp_pathspec;
                   5697:   tmp_pathspec = 0;
                   5698: 
                   5699:   /* target_name transforms -- use actual target program name; might have lt- prefix */
                   5700:   target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
                   5701:   strendzap (target_name, ".exe");
                   5702:   tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
                   5703:   XFREE (target_name);
                   5704:   target_name = tmp_pathspec;
                   5705:   tmp_pathspec = 0;
                   5706: 
                   5707:   lt_debugprintf (__FILE__, __LINE__,
                   5708:                  "(main) libtool target name: %s\n",
                   5709:                  target_name);
                   5710: EOF
                   5711: 
                   5712:            cat <<EOF
                   5713:   newargz[0] =
                   5714:     XMALLOC (char, (strlen (actual_cwrapper_path) +
                   5715:                    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
                   5716:   strcpy (newargz[0], actual_cwrapper_path);
                   5717:   strcat (newargz[0], "$objdir");
                   5718:   strcat (newargz[0], "/");
                   5719: EOF
                   5720: 
                   5721:            cat <<"EOF"
                   5722:   /* stop here, and copy so we don't have to do this twice */
                   5723:   tmp_pathspec = xstrdup (newargz[0]);
                   5724: 
                   5725:   /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
                   5726:   strcat (newargz[0], actual_cwrapper_name);
                   5727: 
                   5728:   /* DO want the lt- prefix here if it exists, so use target_name */
                   5729:   lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
                   5730:   XFREE (tmp_pathspec);
                   5731:   tmp_pathspec = NULL;
                   5732: EOF
                   5733: 
                   5734:            case $host_os in
                   5735:              mingw*)
                   5736:            cat <<"EOF"
                   5737:   {
                   5738:     char* p;
                   5739:     while ((p = strchr (newargz[0], '\\')) != NULL)
                   5740:       {
                   5741:        *p = '/';
                   5742:       }
                   5743:     while ((p = strchr (lt_argv_zero, '\\')) != NULL)
                   5744:       {
                   5745:        *p = '/';
                   5746:       }
                   5747:   }
                   5748: EOF
                   5749:            ;;
                   5750:            esac
                   5751: 
                   5752:            cat <<"EOF"
                   5753:   XFREE (target_name);
                   5754:   XFREE (actual_cwrapper_path);
                   5755:   XFREE (actual_cwrapper_name);
                   5756: 
                   5757:   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
                   5758:   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
                   5759:   /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
                   5760:      be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
                   5761:      because on Windows, both *_VARNAMEs are PATH but uninstalled
                   5762:      libraries must come first. */
                   5763:   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
                   5764:   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
                   5765: 
                   5766:   lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
                   5767:                  nonnull (lt_argv_zero));
                   5768:   for (i = 0; i < newargc; i++)
                   5769:     {
                   5770:       lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
                   5771:                      i, nonnull (newargz[i]));
                   5772:     }
                   5773: 
                   5774: EOF
                   5775: 
                   5776:            case $host_os in
                   5777:              mingw*)
                   5778:                cat <<"EOF"
                   5779:   /* execv doesn't actually work on mingw as expected on unix */
                   5780:   newargz = prepare_spawn (newargz);
1.1.1.3 ! misho    5781:   rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
1.1       misho    5782:   if (rval == -1)
                   5783:     {
                   5784:       /* failed to start process */
                   5785:       lt_debugprintf (__FILE__, __LINE__,
                   5786:                      "(main) failed to launch target \"%s\": %s\n",
                   5787:                      lt_argv_zero, nonnull (strerror (errno)));
                   5788:       return 127;
                   5789:     }
                   5790:   return rval;
                   5791: EOF
                   5792:                ;;
                   5793:              *)
                   5794:                cat <<"EOF"
                   5795:   execv (lt_argv_zero, newargz);
                   5796:   return rval; /* =127, but avoids unused variable warning */
                   5797: EOF
                   5798:                ;;
                   5799:            esac
                   5800: 
                   5801:            cat <<"EOF"
                   5802: }
                   5803: 
                   5804: void *
                   5805: xmalloc (size_t num)
                   5806: {
                   5807:   void *p = (void *) malloc (num);
                   5808:   if (!p)
                   5809:     lt_fatal (__FILE__, __LINE__, "memory exhausted");
                   5810: 
                   5811:   return p;
                   5812: }
                   5813: 
                   5814: char *
                   5815: xstrdup (const char *string)
                   5816: {
                   5817:   return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
                   5818:                          string) : NULL;
                   5819: }
                   5820: 
                   5821: const char *
                   5822: base_name (const char *name)
                   5823: {
                   5824:   const char *base;
                   5825: 
1.1.1.3 ! misho    5826: #if defined HAVE_DOS_BASED_FILE_SYSTEM
1.1       misho    5827:   /* Skip over the disk name in MSDOS pathnames. */
                   5828:   if (isalpha ((unsigned char) name[0]) && name[1] == ':')
                   5829:     name += 2;
                   5830: #endif
                   5831: 
                   5832:   for (base = name; *name; name++)
                   5833:     if (IS_DIR_SEPARATOR (*name))
                   5834:       base = name + 1;
                   5835:   return base;
                   5836: }
                   5837: 
                   5838: int
                   5839: check_executable (const char *path)
                   5840: {
                   5841:   struct stat st;
                   5842: 
                   5843:   lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
                   5844:                   nonempty (path));
                   5845:   if ((!path) || (!*path))
                   5846:     return 0;
                   5847: 
                   5848:   if ((stat (path, &st) >= 0)
                   5849:       && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
                   5850:     return 1;
                   5851:   else
                   5852:     return 0;
                   5853: }
                   5854: 
                   5855: int
                   5856: make_executable (const char *path)
                   5857: {
                   5858:   int rval = 0;
                   5859:   struct stat st;
                   5860: 
                   5861:   lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
                   5862:                   nonempty (path));
                   5863:   if ((!path) || (!*path))
                   5864:     return 0;
                   5865: 
                   5866:   if (stat (path, &st) >= 0)
                   5867:     {
                   5868:       rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
                   5869:     }
                   5870:   return rval;
                   5871: }
                   5872: 
                   5873: /* Searches for the full path of the wrapper.  Returns
                   5874:    newly allocated full path name if found, NULL otherwise
                   5875:    Does not chase symlinks, even on platforms that support them.
                   5876: */
                   5877: char *
                   5878: find_executable (const char *wrapper)
                   5879: {
                   5880:   int has_slash = 0;
                   5881:   const char *p;
                   5882:   const char *p_next;
                   5883:   /* static buffer for getcwd */
                   5884:   char tmp[LT_PATHMAX + 1];
1.1.1.3 ! misho    5885:   size_t tmp_len;
1.1       misho    5886:   char *concat_name;
                   5887: 
                   5888:   lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
                   5889:                   nonempty (wrapper));
                   5890: 
                   5891:   if ((wrapper == NULL) || (*wrapper == '\0'))
                   5892:     return NULL;
                   5893: 
                   5894:   /* Absolute path? */
1.1.1.3 ! misho    5895: #if defined HAVE_DOS_BASED_FILE_SYSTEM
1.1       misho    5896:   if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
                   5897:     {
                   5898:       concat_name = xstrdup (wrapper);
                   5899:       if (check_executable (concat_name))
                   5900:        return concat_name;
                   5901:       XFREE (concat_name);
                   5902:     }
                   5903:   else
                   5904:     {
                   5905: #endif
                   5906:       if (IS_DIR_SEPARATOR (wrapper[0]))
                   5907:        {
                   5908:          concat_name = xstrdup (wrapper);
                   5909:          if (check_executable (concat_name))
                   5910:            return concat_name;
                   5911:          XFREE (concat_name);
                   5912:        }
1.1.1.3 ! misho    5913: #if defined HAVE_DOS_BASED_FILE_SYSTEM
1.1       misho    5914:     }
                   5915: #endif
                   5916: 
                   5917:   for (p = wrapper; *p; p++)
                   5918:     if (*p == '/')
                   5919:       {
                   5920:        has_slash = 1;
                   5921:        break;
                   5922:       }
                   5923:   if (!has_slash)
                   5924:     {
                   5925:       /* no slashes; search PATH */
                   5926:       const char *path = getenv ("PATH");
                   5927:       if (path != NULL)
                   5928:        {
                   5929:          for (p = path; *p; p = p_next)
                   5930:            {
                   5931:              const char *q;
                   5932:              size_t p_len;
                   5933:              for (q = p; *q; q++)
                   5934:                if (IS_PATH_SEPARATOR (*q))
                   5935:                  break;
1.1.1.3 ! misho    5936:              p_len = (size_t) (q - p);
1.1       misho    5937:              p_next = (*q == '\0' ? q : q + 1);
                   5938:              if (p_len == 0)
                   5939:                {
                   5940:                  /* empty path: current directory */
                   5941:                  if (getcwd (tmp, LT_PATHMAX) == NULL)
                   5942:                    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
                   5943:                               nonnull (strerror (errno)));
                   5944:                  tmp_len = strlen (tmp);
                   5945:                  concat_name =
                   5946:                    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
                   5947:                  memcpy (concat_name, tmp, tmp_len);
                   5948:                  concat_name[tmp_len] = '/';
                   5949:                  strcpy (concat_name + tmp_len + 1, wrapper);
                   5950:                }
                   5951:              else
                   5952:                {
                   5953:                  concat_name =
                   5954:                    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
                   5955:                  memcpy (concat_name, p, p_len);
                   5956:                  concat_name[p_len] = '/';
                   5957:                  strcpy (concat_name + p_len + 1, wrapper);
                   5958:                }
                   5959:              if (check_executable (concat_name))
                   5960:                return concat_name;
                   5961:              XFREE (concat_name);
                   5962:            }
                   5963:        }
                   5964:       /* not found in PATH; assume curdir */
                   5965:     }
                   5966:   /* Relative path | not found in path: prepend cwd */
                   5967:   if (getcwd (tmp, LT_PATHMAX) == NULL)
                   5968:     lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
                   5969:               nonnull (strerror (errno)));
                   5970:   tmp_len = strlen (tmp);
                   5971:   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
                   5972:   memcpy (concat_name, tmp, tmp_len);
                   5973:   concat_name[tmp_len] = '/';
                   5974:   strcpy (concat_name + tmp_len + 1, wrapper);
                   5975: 
                   5976:   if (check_executable (concat_name))
                   5977:     return concat_name;
                   5978:   XFREE (concat_name);
                   5979:   return NULL;
                   5980: }
                   5981: 
                   5982: char *
                   5983: chase_symlinks (const char *pathspec)
                   5984: {
                   5985: #ifndef S_ISLNK
                   5986:   return xstrdup (pathspec);
                   5987: #else
                   5988:   char buf[LT_PATHMAX];
                   5989:   struct stat s;
                   5990:   char *tmp_pathspec = xstrdup (pathspec);
                   5991:   char *p;
                   5992:   int has_symlinks = 0;
                   5993:   while (strlen (tmp_pathspec) && !has_symlinks)
                   5994:     {
                   5995:       lt_debugprintf (__FILE__, __LINE__,
                   5996:                      "checking path component for symlinks: %s\n",
                   5997:                      tmp_pathspec);
                   5998:       if (lstat (tmp_pathspec, &s) == 0)
                   5999:        {
                   6000:          if (S_ISLNK (s.st_mode) != 0)
                   6001:            {
                   6002:              has_symlinks = 1;
                   6003:              break;
                   6004:            }
                   6005: 
                   6006:          /* search backwards for last DIR_SEPARATOR */
                   6007:          p = tmp_pathspec + strlen (tmp_pathspec) - 1;
                   6008:          while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
                   6009:            p--;
                   6010:          if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
                   6011:            {
                   6012:              /* no more DIR_SEPARATORS left */
                   6013:              break;
                   6014:            }
                   6015:          *p = '\0';
                   6016:        }
                   6017:       else
                   6018:        {
                   6019:          lt_fatal (__FILE__, __LINE__,
                   6020:                    "error accessing file \"%s\": %s",
                   6021:                    tmp_pathspec, nonnull (strerror (errno)));
                   6022:        }
                   6023:     }
                   6024:   XFREE (tmp_pathspec);
                   6025: 
                   6026:   if (!has_symlinks)
                   6027:     {
                   6028:       return xstrdup (pathspec);
                   6029:     }
                   6030: 
                   6031:   tmp_pathspec = realpath (pathspec, buf);
                   6032:   if (tmp_pathspec == 0)
                   6033:     {
                   6034:       lt_fatal (__FILE__, __LINE__,
                   6035:                "could not follow symlinks for %s", pathspec);
                   6036:     }
                   6037:   return xstrdup (tmp_pathspec);
                   6038: #endif
                   6039: }
                   6040: 
                   6041: char *
                   6042: strendzap (char *str, const char *pat)
                   6043: {
                   6044:   size_t len, patlen;
                   6045: 
                   6046:   assert (str != NULL);
                   6047:   assert (pat != NULL);
                   6048: 
                   6049:   len = strlen (str);
                   6050:   patlen = strlen (pat);
                   6051: 
                   6052:   if (patlen <= len)
                   6053:     {
                   6054:       str += len - patlen;
1.1.1.3 ! misho    6055:       if (STREQ (str, pat))
1.1       misho    6056:        *str = '\0';
                   6057:     }
                   6058:   return str;
                   6059: }
                   6060: 
                   6061: void
                   6062: lt_debugprintf (const char *file, int line, const char *fmt, ...)
                   6063: {
                   6064:   va_list args;
                   6065:   if (lt_debug)
                   6066:     {
                   6067:       (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
                   6068:       va_start (args, fmt);
                   6069:       (void) vfprintf (stderr, fmt, args);
                   6070:       va_end (args);
                   6071:     }
                   6072: }
                   6073: 
                   6074: static void
                   6075: lt_error_core (int exit_status, const char *file,
                   6076:               int line, const char *mode,
                   6077:               const char *message, va_list ap)
                   6078: {
                   6079:   fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
                   6080:   vfprintf (stderr, message, ap);
                   6081:   fprintf (stderr, ".\n");
                   6082: 
                   6083:   if (exit_status >= 0)
                   6084:     exit (exit_status);
                   6085: }
                   6086: 
                   6087: void
                   6088: lt_fatal (const char *file, int line, const char *message, ...)
                   6089: {
                   6090:   va_list ap;
                   6091:   va_start (ap, message);
                   6092:   lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
                   6093:   va_end (ap);
                   6094: }
                   6095: 
                   6096: static const char *
                   6097: nonnull (const char *s)
                   6098: {
                   6099:   return s ? s : "(null)";
                   6100: }
                   6101: 
                   6102: static const char *
                   6103: nonempty (const char *s)
                   6104: {
                   6105:   return (s && !*s) ? "(empty)" : nonnull (s);
                   6106: }
                   6107: 
                   6108: void
                   6109: lt_setenv (const char *name, const char *value)
                   6110: {
                   6111:   lt_debugprintf (__FILE__, __LINE__,
                   6112:                  "(lt_setenv) setting '%s' to '%s'\n",
                   6113:                   nonnull (name), nonnull (value));
                   6114:   {
                   6115: #ifdef HAVE_SETENV
                   6116:     /* always make a copy, for consistency with !HAVE_SETENV */
                   6117:     char *str = xstrdup (value);
                   6118:     setenv (name, str, 1);
                   6119: #else
1.1.1.3 ! misho    6120:     size_t len = strlen (name) + 1 + strlen (value) + 1;
1.1       misho    6121:     char *str = XMALLOC (char, len);
                   6122:     sprintf (str, "%s=%s", name, value);
                   6123:     if (putenv (str) != EXIT_SUCCESS)
                   6124:       {
                   6125:         XFREE (str);
                   6126:       }
                   6127: #endif
                   6128:   }
                   6129: }
                   6130: 
                   6131: char *
                   6132: lt_extend_str (const char *orig_value, const char *add, int to_end)
                   6133: {
                   6134:   char *new_value;
                   6135:   if (orig_value && *orig_value)
                   6136:     {
1.1.1.3 ! misho    6137:       size_t orig_value_len = strlen (orig_value);
        !          6138:       size_t add_len = strlen (add);
1.1       misho    6139:       new_value = XMALLOC (char, add_len + orig_value_len + 1);
                   6140:       if (to_end)
                   6141:         {
                   6142:           strcpy (new_value, orig_value);
                   6143:           strcpy (new_value + orig_value_len, add);
                   6144:         }
                   6145:       else
                   6146:         {
                   6147:           strcpy (new_value, add);
                   6148:           strcpy (new_value + add_len, orig_value);
                   6149:         }
                   6150:     }
                   6151:   else
                   6152:     {
                   6153:       new_value = xstrdup (add);
                   6154:     }
                   6155:   return new_value;
                   6156: }
                   6157: 
                   6158: void
                   6159: lt_update_exe_path (const char *name, const char *value)
                   6160: {
                   6161:   lt_debugprintf (__FILE__, __LINE__,
                   6162:                  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
                   6163:                   nonnull (name), nonnull (value));
                   6164: 
                   6165:   if (name && *name && value && *value)
                   6166:     {
                   6167:       char *new_value = lt_extend_str (getenv (name), value, 0);
                   6168:       /* some systems can't cope with a ':'-terminated path #' */
1.1.1.3 ! misho    6169:       size_t len = strlen (new_value);
        !          6170:       while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
1.1       misho    6171:         {
1.1.1.3 ! misho    6172:           new_value[--len] = '\0';
1.1       misho    6173:         }
                   6174:       lt_setenv (name, new_value);
                   6175:       XFREE (new_value);
                   6176:     }
                   6177: }
                   6178: 
                   6179: void
                   6180: lt_update_lib_path (const char *name, const char *value)
                   6181: {
                   6182:   lt_debugprintf (__FILE__, __LINE__,
                   6183:                  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
                   6184:                   nonnull (name), nonnull (value));
                   6185: 
                   6186:   if (name && *name && value && *value)
                   6187:     {
                   6188:       char *new_value = lt_extend_str (getenv (name), value, 0);
                   6189:       lt_setenv (name, new_value);
                   6190:       XFREE (new_value);
                   6191:     }
                   6192: }
                   6193: 
                   6194: EOF
                   6195:            case $host_os in
                   6196:              mingw*)
                   6197:                cat <<"EOF"
                   6198: 
                   6199: /* Prepares an argument vector before calling spawn().
                   6200:    Note that spawn() does not by itself call the command interpreter
                   6201:      (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
                   6202:       ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
                   6203:          GetVersionEx(&v);
                   6204:          v.dwPlatformId == VER_PLATFORM_WIN32_NT;
                   6205:       }) ? "cmd.exe" : "command.com").
                   6206:    Instead it simply concatenates the arguments, separated by ' ', and calls
                   6207:    CreateProcess().  We must quote the arguments since Win32 CreateProcess()
                   6208:    interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
                   6209:    special way:
                   6210:    - Space and tab are interpreted as delimiters. They are not treated as
                   6211:      delimiters if they are surrounded by double quotes: "...".
                   6212:    - Unescaped double quotes are removed from the input. Their only effect is
                   6213:      that within double quotes, space and tab are treated like normal
                   6214:      characters.
                   6215:    - Backslashes not followed by double quotes are not special.
                   6216:    - But 2*n+1 backslashes followed by a double quote become
                   6217:      n backslashes followed by a double quote (n >= 0):
                   6218:        \" -> "
                   6219:        \\\" -> \"
                   6220:        \\\\\" -> \\"
                   6221:  */
                   6222: #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"
                   6223: #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"
                   6224: char **
                   6225: prepare_spawn (char **argv)
                   6226: {
                   6227:   size_t argc;
                   6228:   char **new_argv;
                   6229:   size_t i;
                   6230: 
                   6231:   /* Count number of arguments.  */
                   6232:   for (argc = 0; argv[argc] != NULL; argc++)
                   6233:     ;
                   6234: 
                   6235:   /* Allocate new argument vector.  */
                   6236:   new_argv = XMALLOC (char *, argc + 1);
                   6237: 
                   6238:   /* Put quoted arguments into the new argument vector.  */
                   6239:   for (i = 0; i < argc; i++)
                   6240:     {
                   6241:       const char *string = argv[i];
                   6242: 
                   6243:       if (string[0] == '\0')
                   6244:        new_argv[i] = xstrdup ("\"\"");
                   6245:       else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
                   6246:        {
                   6247:          int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
                   6248:          size_t length;
                   6249:          unsigned int backslashes;
                   6250:          const char *s;
                   6251:          char *quoted_string;
                   6252:          char *p;
                   6253: 
                   6254:          length = 0;
                   6255:          backslashes = 0;
                   6256:          if (quote_around)
                   6257:            length++;
                   6258:          for (s = string; *s != '\0'; s++)
                   6259:            {
                   6260:              char c = *s;
                   6261:              if (c == '"')
                   6262:                length += backslashes + 1;
                   6263:              length++;
                   6264:              if (c == '\\')
                   6265:                backslashes++;
                   6266:              else
                   6267:                backslashes = 0;
                   6268:            }
                   6269:          if (quote_around)
                   6270:            length += backslashes + 1;
                   6271: 
                   6272:          quoted_string = XMALLOC (char, length + 1);
                   6273: 
                   6274:          p = quoted_string;
                   6275:          backslashes = 0;
                   6276:          if (quote_around)
                   6277:            *p++ = '"';
                   6278:          for (s = string; *s != '\0'; s++)
                   6279:            {
                   6280:              char c = *s;
                   6281:              if (c == '"')
                   6282:                {
                   6283:                  unsigned int j;
                   6284:                  for (j = backslashes + 1; j > 0; j--)
                   6285:                    *p++ = '\\';
                   6286:                }
                   6287:              *p++ = c;
                   6288:              if (c == '\\')
                   6289:                backslashes++;
                   6290:              else
                   6291:                backslashes = 0;
                   6292:            }
                   6293:          if (quote_around)
                   6294:            {
                   6295:              unsigned int j;
                   6296:              for (j = backslashes; j > 0; j--)
                   6297:                *p++ = '\\';
                   6298:              *p++ = '"';
                   6299:            }
                   6300:          *p = '\0';
                   6301: 
                   6302:          new_argv[i] = quoted_string;
                   6303:        }
                   6304:       else
                   6305:        new_argv[i] = (char *) string;
                   6306:     }
                   6307:   new_argv[argc] = NULL;
                   6308: 
                   6309:   return new_argv;
                   6310: }
                   6311: EOF
                   6312:                ;;
                   6313:            esac
                   6314: 
                   6315:             cat <<"EOF"
                   6316: void lt_dump_script (FILE* f)
                   6317: {
                   6318: EOF
                   6319:            func_emit_wrapper yes |
1.1.1.2   misho    6320:              $SED -n -e '
                   6321: s/^\(.\{79\}\)\(..*\)/\1\
                   6322: \2/
                   6323: h
                   6324: s/\([\\"]\)/\\\1/g
                   6325: s/$/\\n/
                   6326: s/\([^\n]*\).*/  fputs ("\1", f);/p
                   6327: g
                   6328: D'
1.1       misho    6329:             cat <<"EOF"
                   6330: }
                   6331: EOF
                   6332: }
                   6333: # end: func_emit_cwrapperexe_src
                   6334: 
                   6335: # func_win32_import_lib_p ARG
                   6336: # True if ARG is an import lib, as indicated by $file_magic_cmd
                   6337: func_win32_import_lib_p ()
                   6338: {
1.1.1.3 ! misho    6339:     $debug_cmd
        !          6340: 
1.1       misho    6341:     case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
                   6342:     *import*) : ;;
                   6343:     *) false ;;
                   6344:     esac
                   6345: }
                   6346: 
                   6347: # func_mode_link arg...
                   6348: func_mode_link ()
                   6349: {
1.1.1.3 ! misho    6350:     $debug_cmd
        !          6351: 
1.1       misho    6352:     case $host in
                   6353:     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
                   6354:       # It is impossible to link a dll without this setting, and
                   6355:       # we shouldn't force the makefile maintainer to figure out
1.1.1.3 ! misho    6356:       # what system we are compiling for in order to pass an extra
1.1       misho    6357:       # flag for every libtool invocation.
                   6358:       # allow_undefined=no
                   6359: 
                   6360:       # FIXME: Unfortunately, there are problems with the above when trying
1.1.1.3 ! misho    6361:       # to make a dll that has undefined symbols, in which case not
1.1       misho    6362:       # even a static library is built.  For now, we need to specify
                   6363:       # -no-undefined on the libtool link line when we can be certain
                   6364:       # that all symbols are satisfied, otherwise we get a static library.
                   6365:       allow_undefined=yes
                   6366:       ;;
                   6367:     *)
                   6368:       allow_undefined=yes
                   6369:       ;;
                   6370:     esac
                   6371:     libtool_args=$nonopt
                   6372:     base_compile="$nonopt $@"
                   6373:     compile_command=$nonopt
                   6374:     finalize_command=$nonopt
                   6375: 
                   6376:     compile_rpath=
                   6377:     finalize_rpath=
                   6378:     compile_shlibpath=
                   6379:     finalize_shlibpath=
                   6380:     convenience=
                   6381:     old_convenience=
                   6382:     deplibs=
                   6383:     old_deplibs=
                   6384:     compiler_flags=
                   6385:     linker_flags=
                   6386:     dllsearchpath=
                   6387:     lib_search_path=`pwd`
                   6388:     inst_prefix_dir=
                   6389:     new_inherited_linker_flags=
                   6390: 
                   6391:     avoid_version=no
                   6392:     bindir=
                   6393:     dlfiles=
                   6394:     dlprefiles=
                   6395:     dlself=no
                   6396:     export_dynamic=no
                   6397:     export_symbols=
                   6398:     export_symbols_regex=
                   6399:     generated=
                   6400:     libobjs=
                   6401:     ltlibs=
                   6402:     module=no
                   6403:     no_install=no
                   6404:     objs=
                   6405:     non_pic_objects=
                   6406:     precious_files_regex=
                   6407:     prefer_static_libs=no
1.1.1.3 ! misho    6408:     preload=false
1.1       misho    6409:     prev=
                   6410:     prevarg=
                   6411:     release=
                   6412:     rpath=
                   6413:     xrpath=
                   6414:     perm_rpath=
                   6415:     temp_rpath=
                   6416:     thread_safe=no
                   6417:     vinfo=
                   6418:     vinfo_number=no
                   6419:     weak_libs=
1.1.1.3 ! misho    6420:     single_module=$wl-single_module
1.1       misho    6421:     func_infer_tag $base_compile
                   6422: 
                   6423:     # We need to know -static, to get the right output filenames.
                   6424:     for arg
                   6425:     do
                   6426:       case $arg in
                   6427:       -shared)
1.1.1.3 ! misho    6428:        test yes != "$build_libtool_libs" \
        !          6429:          && func_fatal_configuration "cannot build a shared library"
1.1       misho    6430:        build_old_libs=no
                   6431:        break
                   6432:        ;;
                   6433:       -all-static | -static | -static-libtool-libs)
                   6434:        case $arg in
                   6435:        -all-static)
1.1.1.3 ! misho    6436:          if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
1.1       misho    6437:            func_warning "complete static linking is impossible in this configuration"
                   6438:          fi
                   6439:          if test -n "$link_static_flag"; then
                   6440:            dlopen_self=$dlopen_self_static
                   6441:          fi
                   6442:          prefer_static_libs=yes
                   6443:          ;;
                   6444:        -static)
                   6445:          if test -z "$pic_flag" && test -n "$link_static_flag"; then
                   6446:            dlopen_self=$dlopen_self_static
                   6447:          fi
                   6448:          prefer_static_libs=built
                   6449:          ;;
                   6450:        -static-libtool-libs)
                   6451:          if test -z "$pic_flag" && test -n "$link_static_flag"; then
                   6452:            dlopen_self=$dlopen_self_static
                   6453:          fi
                   6454:          prefer_static_libs=yes
                   6455:          ;;
                   6456:        esac
                   6457:        build_libtool_libs=no
                   6458:        build_old_libs=yes
                   6459:        break
                   6460:        ;;
                   6461:       esac
                   6462:     done
                   6463: 
                   6464:     # See if our shared archives depend on static archives.
                   6465:     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
                   6466: 
                   6467:     # Go through the arguments, transforming them on the way.
                   6468:     while test "$#" -gt 0; do
1.1.1.3 ! misho    6469:       arg=$1
1.1       misho    6470:       shift
                   6471:       func_quote_for_eval "$arg"
                   6472:       qarg=$func_quote_for_eval_unquoted_result
                   6473:       func_append libtool_args " $func_quote_for_eval_result"
                   6474: 
                   6475:       # If the previous option needs an argument, assign it.
                   6476:       if test -n "$prev"; then
                   6477:        case $prev in
                   6478:        output)
                   6479:          func_append compile_command " @OUTPUT@"
                   6480:          func_append finalize_command " @OUTPUT@"
                   6481:          ;;
                   6482:        esac
                   6483: 
                   6484:        case $prev in
                   6485:        bindir)
1.1.1.3 ! misho    6486:          bindir=$arg
1.1       misho    6487:          prev=
                   6488:          continue
                   6489:          ;;
                   6490:        dlfiles|dlprefiles)
1.1.1.3 ! misho    6491:          $preload || {
1.1       misho    6492:            # Add the symbol object into the linking commands.
                   6493:            func_append compile_command " @SYMFILE@"
                   6494:            func_append finalize_command " @SYMFILE@"
1.1.1.3 ! misho    6495:            preload=:
        !          6496:          }
1.1       misho    6497:          case $arg in
                   6498:          *.la | *.lo) ;;  # We handle these cases below.
                   6499:          force)
1.1.1.3 ! misho    6500:            if test no = "$dlself"; then
1.1       misho    6501:              dlself=needless
                   6502:              export_dynamic=yes
                   6503:            fi
                   6504:            prev=
                   6505:            continue
                   6506:            ;;
                   6507:          self)
1.1.1.3 ! misho    6508:            if test dlprefiles = "$prev"; then
1.1       misho    6509:              dlself=yes
1.1.1.3 ! misho    6510:            elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
1.1       misho    6511:              dlself=yes
                   6512:            else
                   6513:              dlself=needless
                   6514:              export_dynamic=yes
                   6515:            fi
                   6516:            prev=
                   6517:            continue
                   6518:            ;;
                   6519:          *)
1.1.1.3 ! misho    6520:            if test dlfiles = "$prev"; then
1.1       misho    6521:              func_append dlfiles " $arg"
                   6522:            else
                   6523:              func_append dlprefiles " $arg"
                   6524:            fi
                   6525:            prev=
                   6526:            continue
                   6527:            ;;
                   6528:          esac
                   6529:          ;;
                   6530:        expsyms)
1.1.1.3 ! misho    6531:          export_symbols=$arg
1.1       misho    6532:          test -f "$arg" \
1.1.1.3 ! misho    6533:            || func_fatal_error "symbol file '$arg' does not exist"
1.1       misho    6534:          prev=
                   6535:          continue
                   6536:          ;;
                   6537:        expsyms_regex)
1.1.1.3 ! misho    6538:          export_symbols_regex=$arg
1.1       misho    6539:          prev=
                   6540:          continue
                   6541:          ;;
                   6542:        framework)
                   6543:          case $host in
                   6544:            *-*-darwin*)
                   6545:              case "$deplibs " in
                   6546:                *" $qarg.ltframework "*) ;;
                   6547:                *) func_append deplibs " $qarg.ltframework" # this is fixed later
                   6548:                   ;;
                   6549:              esac
                   6550:              ;;
                   6551:          esac
                   6552:          prev=
                   6553:          continue
                   6554:          ;;
                   6555:        inst_prefix)
1.1.1.3 ! misho    6556:          inst_prefix_dir=$arg
        !          6557:          prev=
        !          6558:          continue
        !          6559:          ;;
        !          6560:        mllvm)
        !          6561:          # Clang does not use LLVM to link, so we can simply discard any
        !          6562:          # '-mllvm $arg' options when doing the link step.
1.1       misho    6563:          prev=
                   6564:          continue
                   6565:          ;;
                   6566:        objectlist)
                   6567:          if test -f "$arg"; then
                   6568:            save_arg=$arg
                   6569:            moreargs=
                   6570:            for fil in `cat "$save_arg"`
                   6571:            do
                   6572: #            func_append moreargs " $fil"
                   6573:              arg=$fil
                   6574:              # A libtool-controlled object.
                   6575: 
                   6576:              # Check to see that this really is a libtool object.
                   6577:              if func_lalib_unsafe_p "$arg"; then
                   6578:                pic_object=
                   6579:                non_pic_object=
                   6580: 
                   6581:                # Read the .lo file
                   6582:                func_source "$arg"
                   6583: 
                   6584:                if test -z "$pic_object" ||
                   6585:                   test -z "$non_pic_object" ||
1.1.1.3 ! misho    6586:                   test none = "$pic_object" &&
        !          6587:                   test none = "$non_pic_object"; then
        !          6588:                  func_fatal_error "cannot find name of object for '$arg'"
1.1       misho    6589:                fi
                   6590: 
                   6591:                # Extract subdirectory from the argument.
                   6592:                func_dirname "$arg" "/" ""
1.1.1.3 ! misho    6593:                xdir=$func_dirname_result
1.1       misho    6594: 
1.1.1.3 ! misho    6595:                if test none != "$pic_object"; then
1.1       misho    6596:                  # Prepend the subdirectory the object is found in.
1.1.1.3 ! misho    6597:                  pic_object=$xdir$pic_object
1.1       misho    6598: 
1.1.1.3 ! misho    6599:                  if test dlfiles = "$prev"; then
        !          6600:                    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
1.1       misho    6601:                      func_append dlfiles " $pic_object"
                   6602:                      prev=
                   6603:                      continue
                   6604:                    else
                   6605:                      # If libtool objects are unsupported, then we need to preload.
                   6606:                      prev=dlprefiles
                   6607:                    fi
                   6608:                  fi
                   6609: 
                   6610:                  # CHECK ME:  I think I busted this.  -Ossama
1.1.1.3 ! misho    6611:                  if test dlprefiles = "$prev"; then
1.1       misho    6612:                    # Preload the old-style object.
                   6613:                    func_append dlprefiles " $pic_object"
                   6614:                    prev=
                   6615:                  fi
                   6616: 
                   6617:                  # A PIC object.
                   6618:                  func_append libobjs " $pic_object"
1.1.1.3 ! misho    6619:                  arg=$pic_object
1.1       misho    6620:                fi
                   6621: 
                   6622:                # Non-PIC object.
1.1.1.3 ! misho    6623:                if test none != "$non_pic_object"; then
1.1       misho    6624:                  # Prepend the subdirectory the object is found in.
1.1.1.3 ! misho    6625:                  non_pic_object=$xdir$non_pic_object
1.1       misho    6626: 
                   6627:                  # A standard non-PIC object
                   6628:                  func_append non_pic_objects " $non_pic_object"
1.1.1.3 ! misho    6629:                  if test -z "$pic_object" || test none = "$pic_object"; then
        !          6630:                    arg=$non_pic_object
1.1       misho    6631:                  fi
                   6632:                else
                   6633:                  # If the PIC object exists, use it instead.
                   6634:                  # $xdir was prepended to $pic_object above.
1.1.1.3 ! misho    6635:                  non_pic_object=$pic_object
1.1       misho    6636:                  func_append non_pic_objects " $non_pic_object"
                   6637:                fi
                   6638:              else
                   6639:                # Only an error if not doing a dry-run.
                   6640:                if $opt_dry_run; then
                   6641:                  # Extract subdirectory from the argument.
                   6642:                  func_dirname "$arg" "/" ""
1.1.1.3 ! misho    6643:                  xdir=$func_dirname_result
1.1       misho    6644: 
                   6645:                  func_lo2o "$arg"
                   6646:                  pic_object=$xdir$objdir/$func_lo2o_result
                   6647:                  non_pic_object=$xdir$func_lo2o_result
                   6648:                  func_append libobjs " $pic_object"
                   6649:                  func_append non_pic_objects " $non_pic_object"
                   6650:                else
1.1.1.3 ! misho    6651:                  func_fatal_error "'$arg' is not a valid libtool object"
1.1       misho    6652:                fi
                   6653:              fi
                   6654:            done
                   6655:          else
1.1.1.3 ! misho    6656:            func_fatal_error "link input file '$arg' does not exist"
1.1       misho    6657:          fi
                   6658:          arg=$save_arg
                   6659:          prev=
                   6660:          continue
                   6661:          ;;
                   6662:        precious_regex)
1.1.1.3 ! misho    6663:          precious_files_regex=$arg
1.1       misho    6664:          prev=
                   6665:          continue
                   6666:          ;;
                   6667:        release)
1.1.1.3 ! misho    6668:          release=-$arg
1.1       misho    6669:          prev=
                   6670:          continue
                   6671:          ;;
                   6672:        rpath | xrpath)
                   6673:          # We need an absolute path.
                   6674:          case $arg in
                   6675:          [\\/]* | [A-Za-z]:[\\/]*) ;;
                   6676:          *)
                   6677:            func_fatal_error "only absolute run-paths are allowed"
                   6678:            ;;
                   6679:          esac
1.1.1.3 ! misho    6680:          if test rpath = "$prev"; then
1.1       misho    6681:            case "$rpath " in
                   6682:            *" $arg "*) ;;
                   6683:            *) func_append rpath " $arg" ;;
                   6684:            esac
                   6685:          else
                   6686:            case "$xrpath " in
                   6687:            *" $arg "*) ;;
                   6688:            *) func_append xrpath " $arg" ;;
                   6689:            esac
                   6690:          fi
                   6691:          prev=
                   6692:          continue
                   6693:          ;;
                   6694:        shrext)
1.1.1.3 ! misho    6695:          shrext_cmds=$arg
1.1       misho    6696:          prev=
                   6697:          continue
                   6698:          ;;
                   6699:        weak)
                   6700:          func_append weak_libs " $arg"
                   6701:          prev=
                   6702:          continue
                   6703:          ;;
                   6704:        xcclinker)
                   6705:          func_append linker_flags " $qarg"
                   6706:          func_append compiler_flags " $qarg"
                   6707:          prev=
                   6708:          func_append compile_command " $qarg"
                   6709:          func_append finalize_command " $qarg"
                   6710:          continue
                   6711:          ;;
                   6712:        xcompiler)
                   6713:          func_append compiler_flags " $qarg"
                   6714:          prev=
                   6715:          func_append compile_command " $qarg"
                   6716:          func_append finalize_command " $qarg"
                   6717:          continue
                   6718:          ;;
                   6719:        xlinker)
                   6720:          func_append linker_flags " $qarg"
                   6721:          func_append compiler_flags " $wl$qarg"
                   6722:          prev=
                   6723:          func_append compile_command " $wl$qarg"
                   6724:          func_append finalize_command " $wl$qarg"
                   6725:          continue
                   6726:          ;;
                   6727:        *)
                   6728:          eval "$prev=\"\$arg\""
                   6729:          prev=
                   6730:          continue
                   6731:          ;;
                   6732:        esac
                   6733:       fi # test -n "$prev"
                   6734: 
1.1.1.3 ! misho    6735:       prevarg=$arg
1.1       misho    6736: 
                   6737:       case $arg in
                   6738:       -all-static)
                   6739:        if test -n "$link_static_flag"; then
                   6740:          # See comment for -static flag below, for more details.
                   6741:          func_append compile_command " $link_static_flag"
                   6742:          func_append finalize_command " $link_static_flag"
                   6743:        fi
                   6744:        continue
                   6745:        ;;
                   6746: 
                   6747:       -allow-undefined)
                   6748:        # FIXME: remove this flag sometime in the future.
1.1.1.3 ! misho    6749:        func_fatal_error "'-allow-undefined' must not be used because it is the default"
1.1       misho    6750:        ;;
                   6751: 
                   6752:       -avoid-version)
                   6753:        avoid_version=yes
                   6754:        continue
                   6755:        ;;
                   6756: 
                   6757:       -bindir)
                   6758:        prev=bindir
                   6759:        continue
                   6760:        ;;
                   6761: 
                   6762:       -dlopen)
                   6763:        prev=dlfiles
                   6764:        continue
                   6765:        ;;
                   6766: 
                   6767:       -dlpreopen)
                   6768:        prev=dlprefiles
                   6769:        continue
                   6770:        ;;
                   6771: 
                   6772:       -export-dynamic)
                   6773:        export_dynamic=yes
                   6774:        continue
                   6775:        ;;
                   6776: 
                   6777:       -export-symbols | -export-symbols-regex)
                   6778:        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
                   6779:          func_fatal_error "more than one -exported-symbols argument is not allowed"
                   6780:        fi
1.1.1.3 ! misho    6781:        if test X-export-symbols = "X$arg"; then
1.1       misho    6782:          prev=expsyms
                   6783:        else
                   6784:          prev=expsyms_regex
                   6785:        fi
                   6786:        continue
                   6787:        ;;
                   6788: 
                   6789:       -framework)
                   6790:        prev=framework
                   6791:        continue
                   6792:        ;;
                   6793: 
                   6794:       -inst-prefix-dir)
                   6795:        prev=inst_prefix
                   6796:        continue
                   6797:        ;;
                   6798: 
                   6799:       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
                   6800:       # so, if we see these flags be careful not to treat them like -L
                   6801:       -L[A-Z][A-Z]*:*)
                   6802:        case $with_gcc/$host in
                   6803:        no/*-*-irix* | /*-*-irix*)
                   6804:          func_append compile_command " $arg"
                   6805:          func_append finalize_command " $arg"
                   6806:          ;;
                   6807:        esac
                   6808:        continue
                   6809:        ;;
                   6810: 
                   6811:       -L*)
                   6812:        func_stripname "-L" '' "$arg"
                   6813:        if test -z "$func_stripname_result"; then
                   6814:          if test "$#" -gt 0; then
1.1.1.3 ! misho    6815:            func_fatal_error "require no space between '-L' and '$1'"
1.1       misho    6816:          else
1.1.1.3 ! misho    6817:            func_fatal_error "need path for '-L' option"
1.1       misho    6818:          fi
                   6819:        fi
                   6820:        func_resolve_sysroot "$func_stripname_result"
                   6821:        dir=$func_resolve_sysroot_result
                   6822:        # We need an absolute path.
                   6823:        case $dir in
                   6824:        [\\/]* | [A-Za-z]:[\\/]*) ;;
                   6825:        *)
                   6826:          absdir=`cd "$dir" && pwd`
                   6827:          test -z "$absdir" && \
1.1.1.3 ! misho    6828:            func_fatal_error "cannot determine absolute directory name of '$dir'"
        !          6829:          dir=$absdir
1.1       misho    6830:          ;;
                   6831:        esac
                   6832:        case "$deplibs " in
                   6833:        *" -L$dir "* | *" $arg "*)
                   6834:          # Will only happen for absolute or sysroot arguments
                   6835:          ;;
                   6836:        *)
                   6837:          # Preserve sysroot, but never include relative directories
                   6838:          case $dir in
                   6839:            [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
                   6840:            *) func_append deplibs " -L$dir" ;;
                   6841:          esac
                   6842:          func_append lib_search_path " $dir"
                   6843:          ;;
                   6844:        esac
                   6845:        case $host in
                   6846:        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
                   6847:          testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
                   6848:          case :$dllsearchpath: in
                   6849:          *":$dir:"*) ;;
                   6850:          ::) dllsearchpath=$dir;;
                   6851:          *) func_append dllsearchpath ":$dir";;
                   6852:          esac
                   6853:          case :$dllsearchpath: in
                   6854:          *":$testbindir:"*) ;;
                   6855:          ::) dllsearchpath=$testbindir;;
                   6856:          *) func_append dllsearchpath ":$testbindir";;
                   6857:          esac
                   6858:          ;;
                   6859:        esac
                   6860:        continue
                   6861:        ;;
                   6862: 
                   6863:       -l*)
1.1.1.3 ! misho    6864:        if test X-lc = "X$arg" || test X-lm = "X$arg"; then
1.1       misho    6865:          case $host in
                   6866:          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
                   6867:            # These systems don't actually have a C or math library (as such)
                   6868:            continue
                   6869:            ;;
                   6870:          *-*-os2*)
                   6871:            # These systems don't actually have a C library (as such)
1.1.1.3 ! misho    6872:            test X-lc = "X$arg" && continue
1.1       misho    6873:            ;;
1.1.1.3 ! misho    6874:          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
1.1       misho    6875:            # Do not include libc due to us having libc/libc_r.
1.1.1.3 ! misho    6876:            test X-lc = "X$arg" && continue
1.1       misho    6877:            ;;
                   6878:          *-*-rhapsody* | *-*-darwin1.[012])
                   6879:            # Rhapsody C and math libraries are in the System framework
                   6880:            func_append deplibs " System.ltframework"
                   6881:            continue
                   6882:            ;;
                   6883:          *-*-sco3.2v5* | *-*-sco5v6*)
                   6884:            # Causes problems with __ctype
1.1.1.3 ! misho    6885:            test X-lc = "X$arg" && continue
1.1       misho    6886:            ;;
                   6887:          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
                   6888:            # Compiler inserts libc in the correct place for threads to work
1.1.1.3 ! misho    6889:            test X-lc = "X$arg" && continue
1.1       misho    6890:            ;;
                   6891:          esac
1.1.1.3 ! misho    6892:        elif test X-lc_r = "X$arg"; then
1.1       misho    6893:         case $host in
1.1.1.3 ! misho    6894:         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
1.1       misho    6895:           # Do not include libc_r directly, use -pthread flag.
                   6896:           continue
                   6897:           ;;
                   6898:         esac
                   6899:        fi
                   6900:        func_append deplibs " $arg"
                   6901:        continue
                   6902:        ;;
                   6903: 
1.1.1.3 ! misho    6904:       -mllvm)
        !          6905:        prev=mllvm
        !          6906:        continue
        !          6907:        ;;
        !          6908: 
1.1       misho    6909:       -module)
                   6910:        module=yes
                   6911:        continue
                   6912:        ;;
                   6913: 
                   6914:       # Tru64 UNIX uses -model [arg] to determine the layout of C++
                   6915:       # classes, name mangling, and exception handling.
                   6916:       # Darwin uses the -arch flag to determine output architecture.
                   6917:       -model|-arch|-isysroot|--sysroot)
                   6918:        func_append compiler_flags " $arg"
                   6919:        func_append compile_command " $arg"
                   6920:        func_append finalize_command " $arg"
                   6921:        prev=xcompiler
                   6922:        continue
                   6923:        ;;
                   6924: 
1.1.1.2   misho    6925:       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
                   6926:       |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
1.1       misho    6927:        func_append compiler_flags " $arg"
                   6928:        func_append compile_command " $arg"
                   6929:        func_append finalize_command " $arg"
                   6930:        case "$new_inherited_linker_flags " in
                   6931:            *" $arg "*) ;;
                   6932:            * ) func_append new_inherited_linker_flags " $arg" ;;
                   6933:        esac
                   6934:        continue
                   6935:        ;;
                   6936: 
                   6937:       -multi_module)
1.1.1.3 ! misho    6938:        single_module=$wl-multi_module
1.1       misho    6939:        continue
                   6940:        ;;
                   6941: 
                   6942:       -no-fast-install)
                   6943:        fast_install=no
                   6944:        continue
                   6945:        ;;
                   6946: 
                   6947:       -no-install)
                   6948:        case $host in
                   6949:        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
                   6950:          # The PATH hackery in wrapper scripts is required on Windows
                   6951:          # and Darwin in order for the loader to find any dlls it needs.
1.1.1.3 ! misho    6952:          func_warning "'-no-install' is ignored for $host"
        !          6953:          func_warning "assuming '-no-fast-install' instead"
1.1       misho    6954:          fast_install=no
                   6955:          ;;
                   6956:        *) no_install=yes ;;
                   6957:        esac
                   6958:        continue
                   6959:        ;;
                   6960: 
                   6961:       -no-undefined)
                   6962:        allow_undefined=no
                   6963:        continue
                   6964:        ;;
                   6965: 
                   6966:       -objectlist)
                   6967:        prev=objectlist
                   6968:        continue
                   6969:        ;;
                   6970: 
                   6971:       -o) prev=output ;;
                   6972: 
                   6973:       -precious-files-regex)
                   6974:        prev=precious_regex
                   6975:        continue
                   6976:        ;;
                   6977: 
                   6978:       -release)
                   6979:        prev=release
                   6980:        continue
                   6981:        ;;
                   6982: 
                   6983:       -rpath)
                   6984:        prev=rpath
                   6985:        continue
                   6986:        ;;
                   6987: 
                   6988:       -R)
                   6989:        prev=xrpath
                   6990:        continue
                   6991:        ;;
                   6992: 
                   6993:       -R*)
                   6994:        func_stripname '-R' '' "$arg"
                   6995:        dir=$func_stripname_result
                   6996:        # We need an absolute path.
                   6997:        case $dir in
                   6998:        [\\/]* | [A-Za-z]:[\\/]*) ;;
                   6999:        =*)
                   7000:          func_stripname '=' '' "$dir"
                   7001:          dir=$lt_sysroot$func_stripname_result
                   7002:          ;;
                   7003:        *)
                   7004:          func_fatal_error "only absolute run-paths are allowed"
                   7005:          ;;
                   7006:        esac
                   7007:        case "$xrpath " in
                   7008:        *" $dir "*) ;;
                   7009:        *) func_append xrpath " $dir" ;;
                   7010:        esac
                   7011:        continue
                   7012:        ;;
                   7013: 
                   7014:       -shared)
                   7015:        # The effects of -shared are defined in a previous loop.
                   7016:        continue
                   7017:        ;;
                   7018: 
                   7019:       -shrext)
                   7020:        prev=shrext
                   7021:        continue
                   7022:        ;;
                   7023: 
                   7024:       -static | -static-libtool-libs)
                   7025:        # The effects of -static are defined in a previous loop.
                   7026:        # We used to do the same as -all-static on platforms that
                   7027:        # didn't have a PIC flag, but the assumption that the effects
                   7028:        # would be equivalent was wrong.  It would break on at least
                   7029:        # Digital Unix and AIX.
                   7030:        continue
                   7031:        ;;
                   7032: 
                   7033:       -thread-safe)
                   7034:        thread_safe=yes
                   7035:        continue
                   7036:        ;;
                   7037: 
                   7038:       -version-info)
                   7039:        prev=vinfo
                   7040:        continue
                   7041:        ;;
                   7042: 
                   7043:       -version-number)
                   7044:        prev=vinfo
                   7045:        vinfo_number=yes
                   7046:        continue
                   7047:        ;;
                   7048: 
                   7049:       -weak)
                   7050:         prev=weak
                   7051:        continue
                   7052:        ;;
                   7053: 
                   7054:       -Wc,*)
                   7055:        func_stripname '-Wc,' '' "$arg"
                   7056:        args=$func_stripname_result
                   7057:        arg=
1.1.1.3 ! misho    7058:        save_ifs=$IFS; IFS=,
1.1       misho    7059:        for flag in $args; do
1.1.1.3 ! misho    7060:          IFS=$save_ifs
1.1       misho    7061:           func_quote_for_eval "$flag"
                   7062:          func_append arg " $func_quote_for_eval_result"
                   7063:          func_append compiler_flags " $func_quote_for_eval_result"
                   7064:        done
1.1.1.3 ! misho    7065:        IFS=$save_ifs
1.1       misho    7066:        func_stripname ' ' '' "$arg"
                   7067:        arg=$func_stripname_result
                   7068:        ;;
                   7069: 
                   7070:       -Wl,*)
                   7071:        func_stripname '-Wl,' '' "$arg"
                   7072:        args=$func_stripname_result
                   7073:        arg=
1.1.1.3 ! misho    7074:        save_ifs=$IFS; IFS=,
1.1       misho    7075:        for flag in $args; do
1.1.1.3 ! misho    7076:          IFS=$save_ifs
1.1       misho    7077:           func_quote_for_eval "$flag"
                   7078:          func_append arg " $wl$func_quote_for_eval_result"
                   7079:          func_append compiler_flags " $wl$func_quote_for_eval_result"
                   7080:          func_append linker_flags " $func_quote_for_eval_result"
                   7081:        done
1.1.1.3 ! misho    7082:        IFS=$save_ifs
1.1       misho    7083:        func_stripname ' ' '' "$arg"
                   7084:        arg=$func_stripname_result
                   7085:        ;;
                   7086: 
                   7087:       -Xcompiler)
                   7088:        prev=xcompiler
                   7089:        continue
                   7090:        ;;
                   7091: 
                   7092:       -Xlinker)
                   7093:        prev=xlinker
                   7094:        continue
                   7095:        ;;
                   7096: 
                   7097:       -XCClinker)
                   7098:        prev=xcclinker
                   7099:        continue
                   7100:        ;;
                   7101: 
                   7102:       # -msg_* for osf cc
                   7103:       -msg_*)
                   7104:        func_quote_for_eval "$arg"
1.1.1.3 ! misho    7105:        arg=$func_quote_for_eval_result
1.1       misho    7106:        ;;
                   7107: 
                   7108:       # Flags to be passed through unchanged, with rationale:
                   7109:       # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
                   7110:       # -r[0-9][0-9]*        specify processor for the SGI compiler
                   7111:       # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
                   7112:       # +DA*, +DD*           enable 64-bit mode for the HP compiler
                   7113:       # -q*                  compiler args for the IBM compiler
                   7114:       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
                   7115:       # -F/path              path to uninstalled frameworks, gcc on darwin
                   7116:       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
                   7117:       # @file                GCC response files
                   7118:       # -tp=*                Portland pgcc target processor selection
                   7119:       # --sysroot=*          for sysroot support
1.1.1.3 ! misho    7120:       # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
        !          7121:       # -stdlib=*            select c++ std lib with clang
1.1       misho    7122:       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
                   7123:       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
1.1.1.3 ! misho    7124:       -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-stdlib=*)
1.1       misho    7125:         func_quote_for_eval "$arg"
1.1.1.3 ! misho    7126:        arg=$func_quote_for_eval_result
1.1       misho    7127:         func_append compile_command " $arg"
                   7128:         func_append finalize_command " $arg"
                   7129:         func_append compiler_flags " $arg"
                   7130:         continue
                   7131:         ;;
                   7132: 
                   7133:       # Some other compiler flag.
                   7134:       -* | +*)
                   7135:         func_quote_for_eval "$arg"
1.1.1.3 ! misho    7136:        arg=$func_quote_for_eval_result
1.1       misho    7137:        ;;
                   7138: 
                   7139:       *.$objext)
                   7140:        # A standard object.
                   7141:        func_append objs " $arg"
                   7142:        ;;
                   7143: 
                   7144:       *.lo)
                   7145:        # A libtool-controlled object.
                   7146: 
                   7147:        # Check to see that this really is a libtool object.
                   7148:        if func_lalib_unsafe_p "$arg"; then
                   7149:          pic_object=
                   7150:          non_pic_object=
                   7151: 
                   7152:          # Read the .lo file
                   7153:          func_source "$arg"
                   7154: 
                   7155:          if test -z "$pic_object" ||
                   7156:             test -z "$non_pic_object" ||
1.1.1.3 ! misho    7157:             test none = "$pic_object" &&
        !          7158:             test none = "$non_pic_object"; then
        !          7159:            func_fatal_error "cannot find name of object for '$arg'"
1.1       misho    7160:          fi
                   7161: 
                   7162:          # Extract subdirectory from the argument.
                   7163:          func_dirname "$arg" "/" ""
1.1.1.3 ! misho    7164:          xdir=$func_dirname_result
1.1       misho    7165: 
1.1.1.3 ! misho    7166:          test none = "$pic_object" || {
1.1       misho    7167:            # Prepend the subdirectory the object is found in.
1.1.1.3 ! misho    7168:            pic_object=$xdir$pic_object
1.1       misho    7169: 
1.1.1.3 ! misho    7170:            if test dlfiles = "$prev"; then
        !          7171:              if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
1.1       misho    7172:                func_append dlfiles " $pic_object"
                   7173:                prev=
                   7174:                continue
                   7175:              else
                   7176:                # If libtool objects are unsupported, then we need to preload.
                   7177:                prev=dlprefiles
                   7178:              fi
                   7179:            fi
                   7180: 
                   7181:            # CHECK ME:  I think I busted this.  -Ossama
1.1.1.3 ! misho    7182:            if test dlprefiles = "$prev"; then
1.1       misho    7183:              # Preload the old-style object.
                   7184:              func_append dlprefiles " $pic_object"
                   7185:              prev=
                   7186:            fi
                   7187: 
                   7188:            # A PIC object.
                   7189:            func_append libobjs " $pic_object"
1.1.1.3 ! misho    7190:            arg=$pic_object
        !          7191:          }
1.1       misho    7192: 
                   7193:          # Non-PIC object.
1.1.1.3 ! misho    7194:          if test none != "$non_pic_object"; then
1.1       misho    7195:            # Prepend the subdirectory the object is found in.
1.1.1.3 ! misho    7196:            non_pic_object=$xdir$non_pic_object
1.1       misho    7197: 
                   7198:            # A standard non-PIC object
                   7199:            func_append non_pic_objects " $non_pic_object"
1.1.1.3 ! misho    7200:            if test -z "$pic_object" || test none = "$pic_object"; then
        !          7201:              arg=$non_pic_object
1.1       misho    7202:            fi
                   7203:          else
                   7204:            # If the PIC object exists, use it instead.
                   7205:            # $xdir was prepended to $pic_object above.
1.1.1.3 ! misho    7206:            non_pic_object=$pic_object
1.1       misho    7207:            func_append non_pic_objects " $non_pic_object"
                   7208:          fi
                   7209:        else
                   7210:          # Only an error if not doing a dry-run.
                   7211:          if $opt_dry_run; then
                   7212:            # Extract subdirectory from the argument.
                   7213:            func_dirname "$arg" "/" ""
1.1.1.3 ! misho    7214:            xdir=$func_dirname_result
1.1       misho    7215: 
                   7216:            func_lo2o "$arg"
                   7217:            pic_object=$xdir$objdir/$func_lo2o_result
                   7218:            non_pic_object=$xdir$func_lo2o_result
                   7219:            func_append libobjs " $pic_object"
                   7220:            func_append non_pic_objects " $non_pic_object"
                   7221:          else
1.1.1.3 ! misho    7222:            func_fatal_error "'$arg' is not a valid libtool object"
1.1       misho    7223:          fi
                   7224:        fi
                   7225:        ;;
                   7226: 
                   7227:       *.$libext)
                   7228:        # An archive.
                   7229:        func_append deplibs " $arg"
                   7230:        func_append old_deplibs " $arg"
                   7231:        continue
                   7232:        ;;
                   7233: 
                   7234:       *.la)
                   7235:        # A libtool-controlled library.
                   7236: 
                   7237:        func_resolve_sysroot "$arg"
1.1.1.3 ! misho    7238:        if test dlfiles = "$prev"; then
1.1       misho    7239:          # This library was specified with -dlopen.
                   7240:          func_append dlfiles " $func_resolve_sysroot_result"
                   7241:          prev=
1.1.1.3 ! misho    7242:        elif test dlprefiles = "$prev"; then
1.1       misho    7243:          # The library was specified with -dlpreopen.
                   7244:          func_append dlprefiles " $func_resolve_sysroot_result"
                   7245:          prev=
                   7246:        else
                   7247:          func_append deplibs " $func_resolve_sysroot_result"
                   7248:        fi
                   7249:        continue
                   7250:        ;;
                   7251: 
                   7252:       # Some other compiler argument.
                   7253:       *)
                   7254:        # Unknown arguments in both finalize_command and compile_command need
                   7255:        # to be aesthetically quoted because they are evaled later.
                   7256:        func_quote_for_eval "$arg"
1.1.1.3 ! misho    7257:        arg=$func_quote_for_eval_result
1.1       misho    7258:        ;;
                   7259:       esac # arg
                   7260: 
                   7261:       # Now actually substitute the argument into the commands.
                   7262:       if test -n "$arg"; then
                   7263:        func_append compile_command " $arg"
                   7264:        func_append finalize_command " $arg"
                   7265:       fi
                   7266:     done # argument parsing loop
                   7267: 
                   7268:     test -n "$prev" && \
1.1.1.3 ! misho    7269:       func_fatal_help "the '$prevarg' option requires an argument"
1.1       misho    7270: 
1.1.1.3 ! misho    7271:     if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
1.1       misho    7272:       eval arg=\"$export_dynamic_flag_spec\"
                   7273:       func_append compile_command " $arg"
                   7274:       func_append finalize_command " $arg"
                   7275:     fi
                   7276: 
                   7277:     oldlibs=
                   7278:     # calculate the name of the file, without its directory
                   7279:     func_basename "$output"
1.1.1.3 ! misho    7280:     outputname=$func_basename_result
        !          7281:     libobjs_save=$libobjs
1.1       misho    7282: 
                   7283:     if test -n "$shlibpath_var"; then
                   7284:       # get the directories listed in $shlibpath_var
1.1.1.3 ! misho    7285:       eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
1.1       misho    7286:     else
                   7287:       shlib_search_path=
                   7288:     fi
                   7289:     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
                   7290:     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
                   7291: 
                   7292:     func_dirname "$output" "/" ""
1.1.1.3 ! misho    7293:     output_objdir=$func_dirname_result$objdir
1.1       misho    7294:     func_to_tool_file "$output_objdir/"
                   7295:     tool_output_objdir=$func_to_tool_file_result
                   7296:     # Create the object directory.
                   7297:     func_mkdir_p "$output_objdir"
                   7298: 
                   7299:     # Determine the type of output
                   7300:     case $output in
                   7301:     "")
                   7302:       func_fatal_help "you must specify an output file"
                   7303:       ;;
                   7304:     *.$libext) linkmode=oldlib ;;
                   7305:     *.lo | *.$objext) linkmode=obj ;;
                   7306:     *.la) linkmode=lib ;;
                   7307:     *) linkmode=prog ;; # Anything else should be a program.
                   7308:     esac
                   7309: 
                   7310:     specialdeplibs=
                   7311: 
                   7312:     libs=
                   7313:     # Find all interdependent deplibs by searching for libraries
                   7314:     # that are linked more than once (e.g. -la -lb -la)
                   7315:     for deplib in $deplibs; do
1.1.1.3 ! misho    7316:       if $opt_preserve_dup_deps; then
1.1       misho    7317:        case "$libs " in
                   7318:        *" $deplib "*) func_append specialdeplibs " $deplib" ;;
                   7319:        esac
                   7320:       fi
                   7321:       func_append libs " $deplib"
                   7322:     done
                   7323: 
1.1.1.3 ! misho    7324:     if test lib = "$linkmode"; then
1.1       misho    7325:       libs="$predeps $libs $compiler_lib_search_path $postdeps"
                   7326: 
                   7327:       # Compute libraries that are listed more than once in $predeps
                   7328:       # $postdeps and mark them as special (i.e., whose duplicates are
                   7329:       # not to be eliminated).
                   7330:       pre_post_deps=
                   7331:       if $opt_duplicate_compiler_generated_deps; then
                   7332:        for pre_post_dep in $predeps $postdeps; do
                   7333:          case "$pre_post_deps " in
                   7334:          *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
                   7335:          esac
                   7336:          func_append pre_post_deps " $pre_post_dep"
                   7337:        done
                   7338:       fi
                   7339:       pre_post_deps=
                   7340:     fi
                   7341: 
                   7342:     deplibs=
                   7343:     newdependency_libs=
                   7344:     newlib_search_path=
                   7345:     need_relink=no # whether we're linking any uninstalled libtool libraries
                   7346:     notinst_deplibs= # not-installed libtool libraries
                   7347:     notinst_path= # paths that contain not-installed libtool libraries
                   7348: 
                   7349:     case $linkmode in
                   7350:     lib)
                   7351:        passes="conv dlpreopen link"
                   7352:        for file in $dlfiles $dlprefiles; do
                   7353:          case $file in
                   7354:          *.la) ;;
                   7355:          *)
1.1.1.3 ! misho    7356:            func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
1.1       misho    7357:            ;;
                   7358:          esac
                   7359:        done
                   7360:        ;;
                   7361:     prog)
                   7362:        compile_deplibs=
                   7363:        finalize_deplibs=
1.1.1.3 ! misho    7364:        alldeplibs=false
1.1       misho    7365:        newdlfiles=
                   7366:        newdlprefiles=
                   7367:        passes="conv scan dlopen dlpreopen link"
                   7368:        ;;
                   7369:     *)  passes="conv"
                   7370:        ;;
                   7371:     esac
                   7372: 
                   7373:     for pass in $passes; do
                   7374:       # The preopen pass in lib mode reverses $deplibs; put it back here
                   7375:       # so that -L comes before libs that need it for instance...
1.1.1.3 ! misho    7376:       if test lib,link = "$linkmode,$pass"; then
1.1       misho    7377:        ## FIXME: Find the place where the list is rebuilt in the wrong
                   7378:        ##        order, and fix it there properly
                   7379:         tmp_deplibs=
                   7380:        for deplib in $deplibs; do
                   7381:          tmp_deplibs="$deplib $tmp_deplibs"
                   7382:        done
1.1.1.3 ! misho    7383:        deplibs=$tmp_deplibs
1.1       misho    7384:       fi
                   7385: 
1.1.1.3 ! misho    7386:       if test lib,link = "$linkmode,$pass" ||
        !          7387:         test prog,scan = "$linkmode,$pass"; then
        !          7388:        libs=$deplibs
1.1       misho    7389:        deplibs=
                   7390:       fi
1.1.1.3 ! misho    7391:       if test prog = "$linkmode"; then
1.1       misho    7392:        case $pass in
1.1.1.3 ! misho    7393:        dlopen) libs=$dlfiles ;;
        !          7394:        dlpreopen) libs=$dlprefiles ;;
1.1       misho    7395:        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
                   7396:        esac
                   7397:       fi
1.1.1.3 ! misho    7398:       if test lib,dlpreopen = "$linkmode,$pass"; then
1.1       misho    7399:        # Collect and forward deplibs of preopened libtool libs
                   7400:        for lib in $dlprefiles; do
                   7401:          # Ignore non-libtool-libs
                   7402:          dependency_libs=
                   7403:          func_resolve_sysroot "$lib"
                   7404:          case $lib in
                   7405:          *.la) func_source "$func_resolve_sysroot_result" ;;
                   7406:          esac
                   7407: 
                   7408:          # Collect preopened libtool deplibs, except any this library
                   7409:          # has declared as weak libs
                   7410:          for deplib in $dependency_libs; do
                   7411:            func_basename "$deplib"
                   7412:             deplib_base=$func_basename_result
                   7413:            case " $weak_libs " in
                   7414:            *" $deplib_base "*) ;;
                   7415:            *) func_append deplibs " $deplib" ;;
                   7416:            esac
                   7417:          done
                   7418:        done
1.1.1.3 ! misho    7419:        libs=$dlprefiles
1.1       misho    7420:       fi
1.1.1.3 ! misho    7421:       if test dlopen = "$pass"; then
1.1       misho    7422:        # Collect dlpreopened libraries
1.1.1.3 ! misho    7423:        save_deplibs=$deplibs
1.1       misho    7424:        deplibs=
                   7425:       fi
                   7426: 
                   7427:       for deplib in $libs; do
                   7428:        lib=
1.1.1.3 ! misho    7429:        found=false
1.1       misho    7430:        case $deplib in
1.1.1.2   misho    7431:        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
                   7432:         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
1.1.1.3 ! misho    7433:          if test prog,link = "$linkmode,$pass"; then
1.1       misho    7434:            compile_deplibs="$deplib $compile_deplibs"
                   7435:            finalize_deplibs="$deplib $finalize_deplibs"
                   7436:          else
                   7437:            func_append compiler_flags " $deplib"
1.1.1.3 ! misho    7438:            if test lib = "$linkmode"; then
1.1       misho    7439:                case "$new_inherited_linker_flags " in
                   7440:                    *" $deplib "*) ;;
                   7441:                    * ) func_append new_inherited_linker_flags " $deplib" ;;
                   7442:                esac
                   7443:            fi
                   7444:          fi
                   7445:          continue
                   7446:          ;;
                   7447:        -l*)
1.1.1.3 ! misho    7448:          if test lib != "$linkmode" && test prog != "$linkmode"; then
        !          7449:            func_warning "'-l' is ignored for archives/objects"
1.1       misho    7450:            continue
                   7451:          fi
                   7452:          func_stripname '-l' '' "$deplib"
                   7453:          name=$func_stripname_result
1.1.1.3 ! misho    7454:          if test lib = "$linkmode"; then
1.1       misho    7455:            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
                   7456:          else
                   7457:            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
                   7458:          fi
                   7459:          for searchdir in $searchdirs; do
                   7460:            for search_ext in .la $std_shrext .so .a; do
                   7461:              # Search the libtool library
1.1.1.3 ! misho    7462:              lib=$searchdir/lib$name$search_ext
1.1       misho    7463:              if test -f "$lib"; then
1.1.1.3 ! misho    7464:                if test .la = "$search_ext"; then
        !          7465:                  found=:
1.1       misho    7466:                else
1.1.1.3 ! misho    7467:                  found=false
1.1       misho    7468:                fi
                   7469:                break 2
                   7470:              fi
                   7471:            done
                   7472:          done
1.1.1.3 ! misho    7473:          if $found; then
        !          7474:            # deplib is a libtool library
1.1       misho    7475:            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
                   7476:            # We need to do some special things here, and not later.
1.1.1.3 ! misho    7477:            if test yes = "$allow_libtool_libs_with_static_runtimes"; then
1.1       misho    7478:              case " $predeps $postdeps " in
                   7479:              *" $deplib "*)
                   7480:                if func_lalib_p "$lib"; then
                   7481:                  library_names=
                   7482:                  old_library=
                   7483:                  func_source "$lib"
                   7484:                  for l in $old_library $library_names; do
1.1.1.3 ! misho    7485:                    ll=$l
1.1       misho    7486:                  done
1.1.1.3 ! misho    7487:                  if test "X$ll" = "X$old_library"; then # only static version available
        !          7488:                    found=false
1.1       misho    7489:                    func_dirname "$lib" "" "."
1.1.1.3 ! misho    7490:                    ladir=$func_dirname_result
1.1       misho    7491:                    lib=$ladir/$old_library
1.1.1.3 ! misho    7492:                    if test prog,link = "$linkmode,$pass"; then
1.1       misho    7493:                      compile_deplibs="$deplib $compile_deplibs"
                   7494:                      finalize_deplibs="$deplib $finalize_deplibs"
                   7495:                    else
                   7496:                      deplibs="$deplib $deplibs"
1.1.1.3 ! misho    7497:                      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
1.1       misho    7498:                    fi
                   7499:                    continue
                   7500:                  fi
                   7501:                fi
                   7502:                ;;
                   7503:              *) ;;
                   7504:              esac
                   7505:            fi
1.1.1.3 ! misho    7506:          else
        !          7507:            # deplib doesn't seem to be a libtool library
        !          7508:            if test prog,link = "$linkmode,$pass"; then
        !          7509:              compile_deplibs="$deplib $compile_deplibs"
        !          7510:              finalize_deplibs="$deplib $finalize_deplibs"
        !          7511:            else
        !          7512:              deplibs="$deplib $deplibs"
        !          7513:              test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
        !          7514:            fi
        !          7515:            continue
1.1       misho    7516:          fi
                   7517:          ;; # -l
                   7518:        *.ltframework)
1.1.1.3 ! misho    7519:          if test prog,link = "$linkmode,$pass"; then
1.1       misho    7520:            compile_deplibs="$deplib $compile_deplibs"
                   7521:            finalize_deplibs="$deplib $finalize_deplibs"
                   7522:          else
                   7523:            deplibs="$deplib $deplibs"
1.1.1.3 ! misho    7524:            if test lib = "$linkmode"; then
1.1       misho    7525:                case "$new_inherited_linker_flags " in
                   7526:                    *" $deplib "*) ;;
                   7527:                    * ) func_append new_inherited_linker_flags " $deplib" ;;
                   7528:                esac
                   7529:            fi
                   7530:          fi
                   7531:          continue
                   7532:          ;;
                   7533:        -L*)
                   7534:          case $linkmode in
                   7535:          lib)
                   7536:            deplibs="$deplib $deplibs"
1.1.1.3 ! misho    7537:            test conv = "$pass" && continue
1.1       misho    7538:            newdependency_libs="$deplib $newdependency_libs"
                   7539:            func_stripname '-L' '' "$deplib"
                   7540:            func_resolve_sysroot "$func_stripname_result"
                   7541:            func_append newlib_search_path " $func_resolve_sysroot_result"
                   7542:            ;;
                   7543:          prog)
1.1.1.3 ! misho    7544:            if test conv = "$pass"; then
1.1       misho    7545:              deplibs="$deplib $deplibs"
                   7546:              continue
                   7547:            fi
1.1.1.3 ! misho    7548:            if test scan = "$pass"; then
1.1       misho    7549:              deplibs="$deplib $deplibs"
                   7550:            else
                   7551:              compile_deplibs="$deplib $compile_deplibs"
                   7552:              finalize_deplibs="$deplib $finalize_deplibs"
                   7553:            fi
                   7554:            func_stripname '-L' '' "$deplib"
                   7555:            func_resolve_sysroot "$func_stripname_result"
                   7556:            func_append newlib_search_path " $func_resolve_sysroot_result"
                   7557:            ;;
                   7558:          *)
1.1.1.3 ! misho    7559:            func_warning "'-L' is ignored for archives/objects"
1.1       misho    7560:            ;;
                   7561:          esac # linkmode
                   7562:          continue
                   7563:          ;; # -L
                   7564:        -R*)
1.1.1.3 ! misho    7565:          if test link = "$pass"; then
1.1       misho    7566:            func_stripname '-R' '' "$deplib"
                   7567:            func_resolve_sysroot "$func_stripname_result"
                   7568:            dir=$func_resolve_sysroot_result
                   7569:            # Make sure the xrpath contains only unique directories.
                   7570:            case "$xrpath " in
                   7571:            *" $dir "*) ;;
                   7572:            *) func_append xrpath " $dir" ;;
                   7573:            esac
                   7574:          fi
                   7575:          deplibs="$deplib $deplibs"
                   7576:          continue
                   7577:          ;;
                   7578:        *.la)
                   7579:          func_resolve_sysroot "$deplib"
                   7580:          lib=$func_resolve_sysroot_result
                   7581:          ;;
                   7582:        *.$libext)
1.1.1.3 ! misho    7583:          if test conv = "$pass"; then
1.1       misho    7584:            deplibs="$deplib $deplibs"
                   7585:            continue
                   7586:          fi
                   7587:          case $linkmode in
                   7588:          lib)
                   7589:            # Linking convenience modules into shared libraries is allowed,
                   7590:            # but linking other static libraries is non-portable.
                   7591:            case " $dlpreconveniencelibs " in
                   7592:            *" $deplib "*) ;;
                   7593:            *)
1.1.1.3 ! misho    7594:              valid_a_lib=false
1.1       misho    7595:              case $deplibs_check_method in
                   7596:                match_pattern*)
                   7597:                  set dummy $deplibs_check_method; shift
                   7598:                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
                   7599:                  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
                   7600:                    | $EGREP "$match_pattern_regex" > /dev/null; then
1.1.1.3 ! misho    7601:                    valid_a_lib=:
1.1       misho    7602:                  fi
                   7603:                ;;
                   7604:                pass_all)
1.1.1.3 ! misho    7605:                  valid_a_lib=:
1.1       misho    7606:                ;;
                   7607:              esac
1.1.1.3 ! misho    7608:              if $valid_a_lib; then
        !          7609:                echo
        !          7610:                $ECHO "*** Warning: Linking the shared library $output against the"
        !          7611:                $ECHO "*** static library $deplib is not portable!"
        !          7612:                deplibs="$deplib $deplibs"
        !          7613:              else
1.1       misho    7614:                echo
                   7615:                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
                   7616:                echo "*** I have the capability to make that library automatically link in when"
                   7617:                echo "*** you link to this library.  But I can only do this if you have a"
                   7618:                echo "*** shared version of the library, which you do not appear to have"
                   7619:                echo "*** because the file extensions .$libext of this argument makes me believe"
                   7620:                echo "*** that it is just a static archive that I should not use here."
                   7621:              fi
                   7622:              ;;
                   7623:            esac
                   7624:            continue
                   7625:            ;;
                   7626:          prog)
1.1.1.3 ! misho    7627:            if test link != "$pass"; then
1.1       misho    7628:              deplibs="$deplib $deplibs"
                   7629:            else
                   7630:              compile_deplibs="$deplib $compile_deplibs"
                   7631:              finalize_deplibs="$deplib $finalize_deplibs"
                   7632:            fi
                   7633:            continue
                   7634:            ;;
                   7635:          esac # linkmode
                   7636:          ;; # *.$libext
                   7637:        *.lo | *.$objext)
1.1.1.3 ! misho    7638:          if test conv = "$pass"; then
1.1       misho    7639:            deplibs="$deplib $deplibs"
1.1.1.3 ! misho    7640:          elif test prog = "$linkmode"; then
        !          7641:            if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
1.1       misho    7642:              # If there is no dlopen support or we're linking statically,
                   7643:              # we need to preload.
                   7644:              func_append newdlprefiles " $deplib"
                   7645:              compile_deplibs="$deplib $compile_deplibs"
                   7646:              finalize_deplibs="$deplib $finalize_deplibs"
                   7647:            else
                   7648:              func_append newdlfiles " $deplib"
                   7649:            fi
                   7650:          fi
                   7651:          continue
                   7652:          ;;
                   7653:        %DEPLIBS%)
1.1.1.3 ! misho    7654:          alldeplibs=:
1.1       misho    7655:          continue
                   7656:          ;;
                   7657:        esac # case $deplib
                   7658: 
1.1.1.3 ! misho    7659:        $found || test -f "$lib" \
        !          7660:          || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
1.1       misho    7661: 
                   7662:        # Check to see that this really is a libtool archive.
                   7663:        func_lalib_unsafe_p "$lib" \
1.1.1.3 ! misho    7664:          || func_fatal_error "'$lib' is not a valid libtool archive"
1.1       misho    7665: 
                   7666:        func_dirname "$lib" "" "."
1.1.1.3 ! misho    7667:        ladir=$func_dirname_result
1.1       misho    7668: 
                   7669:        dlname=
                   7670:        dlopen=
                   7671:        dlpreopen=
                   7672:        libdir=
                   7673:        library_names=
                   7674:        old_library=
                   7675:        inherited_linker_flags=
                   7676:        # If the library was installed with an old release of libtool,
                   7677:        # it will not redefine variables installed, or shouldnotlink
                   7678:        installed=yes
                   7679:        shouldnotlink=no
                   7680:        avoidtemprpath=
                   7681: 
                   7682: 
                   7683:        # Read the .la file
                   7684:        func_source "$lib"
                   7685: 
                   7686:        # Convert "-framework foo" to "foo.ltframework"
                   7687:        if test -n "$inherited_linker_flags"; then
                   7688:          tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
                   7689:          for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
                   7690:            case " $new_inherited_linker_flags " in
                   7691:              *" $tmp_inherited_linker_flag "*) ;;
                   7692:              *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
                   7693:            esac
                   7694:          done
                   7695:        fi
                   7696:        dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
1.1.1.3 ! misho    7697:        if test lib,link = "$linkmode,$pass" ||
        !          7698:           test prog,scan = "$linkmode,$pass" ||
        !          7699:           { test prog != "$linkmode" && test lib != "$linkmode"; }; then
1.1       misho    7700:          test -n "$dlopen" && func_append dlfiles " $dlopen"
                   7701:          test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
                   7702:        fi
                   7703: 
1.1.1.3 ! misho    7704:        if test conv = "$pass"; then
1.1       misho    7705:          # Only check for convenience libraries
                   7706:          deplibs="$lib $deplibs"
                   7707:          if test -z "$libdir"; then
                   7708:            if test -z "$old_library"; then
1.1.1.3 ! misho    7709:              func_fatal_error "cannot find name of link library for '$lib'"
1.1       misho    7710:            fi
                   7711:            # It is a libtool convenience library, so add in its objects.
                   7712:            func_append convenience " $ladir/$objdir/$old_library"
                   7713:            func_append old_convenience " $ladir/$objdir/$old_library"
1.1.1.3 ! misho    7714:          elif test prog != "$linkmode" && test lib != "$linkmode"; then
        !          7715:            func_fatal_error "'$lib' is not a convenience library"
1.1       misho    7716:          fi
                   7717:          tmp_libs=
                   7718:          for deplib in $dependency_libs; do
                   7719:            deplibs="$deplib $deplibs"
1.1.1.3 ! misho    7720:            if $opt_preserve_dup_deps; then
1.1       misho    7721:              case "$tmp_libs " in
                   7722:              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
                   7723:              esac
                   7724:            fi
                   7725:            func_append tmp_libs " $deplib"
                   7726:          done
                   7727:          continue
                   7728:        fi # $pass = conv
                   7729: 
                   7730: 
                   7731:        # Get the name of the library we link against.
                   7732:        linklib=
                   7733:        if test -n "$old_library" &&
1.1.1.3 ! misho    7734:           { test yes = "$prefer_static_libs" ||
        !          7735:             test built,no = "$prefer_static_libs,$installed"; }; then
1.1       misho    7736:          linklib=$old_library
                   7737:        else
                   7738:          for l in $old_library $library_names; do
1.1.1.3 ! misho    7739:            linklib=$l
1.1       misho    7740:          done
                   7741:        fi
                   7742:        if test -z "$linklib"; then
1.1.1.3 ! misho    7743:          func_fatal_error "cannot find name of link library for '$lib'"
1.1       misho    7744:        fi
                   7745: 
                   7746:        # This library was specified with -dlopen.
1.1.1.3 ! misho    7747:        if test dlopen = "$pass"; then
        !          7748:          test -z "$libdir" \
        !          7749:            && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
1.1       misho    7750:          if test -z "$dlname" ||
1.1.1.3 ! misho    7751:             test yes != "$dlopen_support" ||
        !          7752:             test no = "$build_libtool_libs"
        !          7753:          then
1.1       misho    7754:            # If there is no dlname, no dlopen support or we're linking
                   7755:            # statically, we need to preload.  We also need to preload any
                   7756:            # dependent libraries so libltdl's deplib preloader doesn't
                   7757:            # bomb out in the load deplibs phase.
                   7758:            func_append dlprefiles " $lib $dependency_libs"
                   7759:          else
                   7760:            func_append newdlfiles " $lib"
                   7761:          fi
                   7762:          continue
                   7763:        fi # $pass = dlopen
                   7764: 
                   7765:        # We need an absolute path.
                   7766:        case $ladir in
1.1.1.3 ! misho    7767:        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
1.1       misho    7768:        *)
                   7769:          abs_ladir=`cd "$ladir" && pwd`
                   7770:          if test -z "$abs_ladir"; then
1.1.1.3 ! misho    7771:            func_warning "cannot determine absolute directory name of '$ladir'"
1.1       misho    7772:            func_warning "passing it literally to the linker, although it might fail"
1.1.1.3 ! misho    7773:            abs_ladir=$ladir
1.1       misho    7774:          fi
                   7775:          ;;
                   7776:        esac
                   7777:        func_basename "$lib"
1.1.1.3 ! misho    7778:        laname=$func_basename_result
1.1       misho    7779: 
                   7780:        # Find the relevant object directory and library name.
1.1.1.3 ! misho    7781:        if test yes = "$installed"; then
1.1       misho    7782:          if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1.1.1.3 ! misho    7783:            func_warning "library '$lib' was moved."
        !          7784:            dir=$ladir
        !          7785:            absdir=$abs_ladir
        !          7786:            libdir=$abs_ladir
1.1       misho    7787:          else
1.1.1.3 ! misho    7788:            dir=$lt_sysroot$libdir
        !          7789:            absdir=$lt_sysroot$libdir
1.1       misho    7790:          fi
1.1.1.3 ! misho    7791:          test yes = "$hardcode_automatic" && avoidtemprpath=yes
1.1       misho    7792:        else
                   7793:          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1.1.1.3 ! misho    7794:            dir=$ladir
        !          7795:            absdir=$abs_ladir
1.1       misho    7796:            # Remove this search path later
                   7797:            func_append notinst_path " $abs_ladir"
                   7798:          else
1.1.1.3 ! misho    7799:            dir=$ladir/$objdir
        !          7800:            absdir=$abs_ladir/$objdir
1.1       misho    7801:            # Remove this search path later
                   7802:            func_append notinst_path " $abs_ladir"
                   7803:          fi
                   7804:        fi # $installed = yes
                   7805:        func_stripname 'lib' '.la' "$laname"
                   7806:        name=$func_stripname_result
                   7807: 
                   7808:        # This library was specified with -dlpreopen.
1.1.1.3 ! misho    7809:        if test dlpreopen = "$pass"; then
        !          7810:          if test -z "$libdir" && test prog = "$linkmode"; then
        !          7811:            func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
1.1       misho    7812:          fi
1.1.1.3 ! misho    7813:          case $host in
1.1       misho    7814:            # special handling for platforms with PE-DLLs.
                   7815:            *cygwin* | *mingw* | *cegcc* )
                   7816:              # Linker will automatically link against shared library if both
                   7817:              # static and shared are present.  Therefore, ensure we extract
                   7818:              # symbols from the import library if a shared library is present
                   7819:              # (otherwise, the dlopen module name will be incorrect).  We do
                   7820:              # this by putting the import library name into $newdlprefiles.
                   7821:              # We recover the dlopen module name by 'saving' the la file
                   7822:              # name in a special purpose variable, and (later) extracting the
                   7823:              # dlname from the la file.
                   7824:              if test -n "$dlname"; then
                   7825:                func_tr_sh "$dir/$linklib"
                   7826:                eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
                   7827:                func_append newdlprefiles " $dir/$linklib"
                   7828:              else
                   7829:                func_append newdlprefiles " $dir/$old_library"
                   7830:                # Keep a list of preopened convenience libraries to check
                   7831:                # that they are being used correctly in the link pass.
                   7832:                test -z "$libdir" && \
                   7833:                  func_append dlpreconveniencelibs " $dir/$old_library"
                   7834:              fi
                   7835:            ;;
                   7836:            * )
                   7837:              # Prefer using a static library (so that no silly _DYNAMIC symbols
                   7838:              # are required to link).
                   7839:              if test -n "$old_library"; then
                   7840:                func_append newdlprefiles " $dir/$old_library"
                   7841:                # Keep a list of preopened convenience libraries to check
                   7842:                # that they are being used correctly in the link pass.
                   7843:                test -z "$libdir" && \
                   7844:                  func_append dlpreconveniencelibs " $dir/$old_library"
                   7845:              # Otherwise, use the dlname, so that lt_dlopen finds it.
                   7846:              elif test -n "$dlname"; then
                   7847:                func_append newdlprefiles " $dir/$dlname"
                   7848:              else
                   7849:                func_append newdlprefiles " $dir/$linklib"
                   7850:              fi
                   7851:            ;;
                   7852:          esac
                   7853:        fi # $pass = dlpreopen
                   7854: 
                   7855:        if test -z "$libdir"; then
                   7856:          # Link the convenience library
1.1.1.3 ! misho    7857:          if test lib = "$linkmode"; then
1.1       misho    7858:            deplibs="$dir/$old_library $deplibs"
1.1.1.3 ! misho    7859:          elif test prog,link = "$linkmode,$pass"; then
1.1       misho    7860:            compile_deplibs="$dir/$old_library $compile_deplibs"
                   7861:            finalize_deplibs="$dir/$old_library $finalize_deplibs"
                   7862:          else
                   7863:            deplibs="$lib $deplibs" # used for prog,scan pass
                   7864:          fi
                   7865:          continue
                   7866:        fi
                   7867: 
                   7868: 
1.1.1.3 ! misho    7869:        if test prog = "$linkmode" && test link != "$pass"; then
1.1       misho    7870:          func_append newlib_search_path " $ladir"
                   7871:          deplibs="$lib $deplibs"
                   7872: 
1.1.1.3 ! misho    7873:          linkalldeplibs=false
        !          7874:          if test no != "$link_all_deplibs" || test -z "$library_names" ||
        !          7875:             test no = "$build_libtool_libs"; then
        !          7876:            linkalldeplibs=:
1.1       misho    7877:          fi
                   7878: 
                   7879:          tmp_libs=
                   7880:          for deplib in $dependency_libs; do
                   7881:            case $deplib in
                   7882:            -L*) func_stripname '-L' '' "$deplib"
                   7883:                 func_resolve_sysroot "$func_stripname_result"
                   7884:                 func_append newlib_search_path " $func_resolve_sysroot_result"
                   7885:                 ;;
                   7886:            esac
                   7887:            # Need to link against all dependency_libs?
1.1.1.3 ! misho    7888:            if $linkalldeplibs; then
1.1       misho    7889:              deplibs="$deplib $deplibs"
                   7890:            else
                   7891:              # Need to hardcode shared library paths
                   7892:              # or/and link against static libraries
                   7893:              newdependency_libs="$deplib $newdependency_libs"
                   7894:            fi
1.1.1.3 ! misho    7895:            if $opt_preserve_dup_deps; then
1.1       misho    7896:              case "$tmp_libs " in
                   7897:              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
                   7898:              esac
                   7899:            fi
                   7900:            func_append tmp_libs " $deplib"
                   7901:          done # for deplib
                   7902:          continue
                   7903:        fi # $linkmode = prog...
                   7904: 
1.1.1.3 ! misho    7905:        if test prog,link = "$linkmode,$pass"; then
1.1       misho    7906:          if test -n "$library_names" &&
1.1.1.3 ! misho    7907:             { { test no = "$prefer_static_libs" ||
        !          7908:                 test built,yes = "$prefer_static_libs,$installed"; } ||
1.1       misho    7909:               test -z "$old_library"; }; then
                   7910:            # We need to hardcode the library path
1.1.1.3 ! misho    7911:            if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
1.1       misho    7912:              # Make sure the rpath contains only unique directories.
1.1.1.3 ! misho    7913:              case $temp_rpath: in
1.1       misho    7914:              *"$absdir:"*) ;;
                   7915:              *) func_append temp_rpath "$absdir:" ;;
                   7916:              esac
                   7917:            fi
                   7918: 
                   7919:            # Hardcode the library path.
                   7920:            # Skip directories that are in the system default run-time
                   7921:            # search path.
                   7922:            case " $sys_lib_dlsearch_path " in
                   7923:            *" $absdir "*) ;;
                   7924:            *)
                   7925:              case "$compile_rpath " in
                   7926:              *" $absdir "*) ;;
                   7927:              *) func_append compile_rpath " $absdir" ;;
                   7928:              esac
                   7929:              ;;
                   7930:            esac
                   7931:            case " $sys_lib_dlsearch_path " in
                   7932:            *" $libdir "*) ;;
                   7933:            *)
                   7934:              case "$finalize_rpath " in
                   7935:              *" $libdir "*) ;;
                   7936:              *) func_append finalize_rpath " $libdir" ;;
                   7937:              esac
                   7938:              ;;
                   7939:            esac
                   7940:          fi # $linkmode,$pass = prog,link...
                   7941: 
1.1.1.3 ! misho    7942:          if $alldeplibs &&
        !          7943:             { test pass_all = "$deplibs_check_method" ||
        !          7944:               { test yes = "$build_libtool_libs" &&
1.1       misho    7945:                 test -n "$library_names"; }; }; then
                   7946:            # We only need to search for static libraries
                   7947:            continue
                   7948:          fi
                   7949:        fi
                   7950: 
                   7951:        link_static=no # Whether the deplib will be linked statically
                   7952:        use_static_libs=$prefer_static_libs
1.1.1.3 ! misho    7953:        if test built = "$use_static_libs" && test yes = "$installed"; then
1.1       misho    7954:          use_static_libs=no
                   7955:        fi
                   7956:        if test -n "$library_names" &&
1.1.1.3 ! misho    7957:           { test no = "$use_static_libs" || test -z "$old_library"; }; then
1.1       misho    7958:          case $host in
                   7959:          *cygwin* | *mingw* | *cegcc*)
                   7960:              # No point in relinking DLLs because paths are not encoded
                   7961:              func_append notinst_deplibs " $lib"
                   7962:              need_relink=no
                   7963:            ;;
                   7964:          *)
1.1.1.3 ! misho    7965:            if test no = "$installed"; then
1.1       misho    7966:              func_append notinst_deplibs " $lib"
                   7967:              need_relink=yes
                   7968:            fi
                   7969:            ;;
                   7970:          esac
                   7971:          # This is a shared library
                   7972: 
                   7973:          # Warn about portability, can't link against -module's on some
                   7974:          # systems (darwin).  Don't bleat about dlopened modules though!
1.1.1.3 ! misho    7975:          dlopenmodule=
1.1       misho    7976:          for dlpremoduletest in $dlprefiles; do
                   7977:            if test "X$dlpremoduletest" = "X$lib"; then
1.1.1.3 ! misho    7978:              dlopenmodule=$dlpremoduletest
1.1       misho    7979:              break
                   7980:            fi
                   7981:          done
1.1.1.3 ! misho    7982:          if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
1.1       misho    7983:            echo
1.1.1.3 ! misho    7984:            if test prog = "$linkmode"; then
1.1       misho    7985:              $ECHO "*** Warning: Linking the executable $output against the loadable module"
                   7986:            else
                   7987:              $ECHO "*** Warning: Linking the shared library $output against the loadable module"
                   7988:            fi
                   7989:            $ECHO "*** $linklib is not portable!"
                   7990:          fi
1.1.1.3 ! misho    7991:          if test lib = "$linkmode" &&
        !          7992:             test yes = "$hardcode_into_libs"; then
1.1       misho    7993:            # Hardcode the library path.
                   7994:            # Skip directories that are in the system default run-time
                   7995:            # search path.
                   7996:            case " $sys_lib_dlsearch_path " in
                   7997:            *" $absdir "*) ;;
                   7998:            *)
                   7999:              case "$compile_rpath " in
                   8000:              *" $absdir "*) ;;
                   8001:              *) func_append compile_rpath " $absdir" ;;
                   8002:              esac
                   8003:              ;;
                   8004:            esac
                   8005:            case " $sys_lib_dlsearch_path " in
                   8006:            *" $libdir "*) ;;
                   8007:            *)
                   8008:              case "$finalize_rpath " in
                   8009:              *" $libdir "*) ;;
                   8010:              *) func_append finalize_rpath " $libdir" ;;
                   8011:              esac
                   8012:              ;;
                   8013:            esac
                   8014:          fi
                   8015: 
                   8016:          if test -n "$old_archive_from_expsyms_cmds"; then
                   8017:            # figure out the soname
                   8018:            set dummy $library_names
                   8019:            shift
1.1.1.3 ! misho    8020:            realname=$1
1.1       misho    8021:            shift
                   8022:            libname=`eval "\\$ECHO \"$libname_spec\""`
                   8023:            # use dlname if we got it. it's perfectly good, no?
                   8024:            if test -n "$dlname"; then
1.1.1.3 ! misho    8025:              soname=$dlname
1.1       misho    8026:            elif test -n "$soname_spec"; then
                   8027:              # bleh windows
                   8028:              case $host in
                   8029:              *cygwin* | mingw* | *cegcc*)
                   8030:                func_arith $current - $age
                   8031:                major=$func_arith_result
1.1.1.3 ! misho    8032:                versuffix=-$major
1.1       misho    8033:                ;;
                   8034:              esac
                   8035:              eval soname=\"$soname_spec\"
                   8036:            else
1.1.1.3 ! misho    8037:              soname=$realname
1.1       misho    8038:            fi
                   8039: 
                   8040:            # Make a new name for the extract_expsyms_cmds to use
1.1.1.3 ! misho    8041:            soroot=$soname
1.1       misho    8042:            func_basename "$soroot"
1.1.1.3 ! misho    8043:            soname=$func_basename_result
1.1       misho    8044:            func_stripname 'lib' '.dll' "$soname"
                   8045:            newlib=libimp-$func_stripname_result.a
                   8046: 
                   8047:            # If the library has no export list, then create one now
                   8048:            if test -f "$output_objdir/$soname-def"; then :
                   8049:            else
1.1.1.3 ! misho    8050:              func_verbose "extracting exported symbol list from '$soname'"
1.1       misho    8051:              func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
                   8052:            fi
                   8053: 
                   8054:            # Create $newlib
                   8055:            if test -f "$output_objdir/$newlib"; then :; else
1.1.1.3 ! misho    8056:              func_verbose "generating import library for '$soname'"
1.1       misho    8057:              func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
                   8058:            fi
                   8059:            # make sure the library variables are pointing to the new library
                   8060:            dir=$output_objdir
                   8061:            linklib=$newlib
                   8062:          fi # test -n "$old_archive_from_expsyms_cmds"
                   8063: 
1.1.1.3 ! misho    8064:          if test prog = "$linkmode" || test relink != "$opt_mode"; then
1.1       misho    8065:            add_shlibpath=
                   8066:            add_dir=
                   8067:            add=
                   8068:            lib_linked=yes
                   8069:            case $hardcode_action in
                   8070:            immediate | unsupported)
1.1.1.3 ! misho    8071:              if test no = "$hardcode_direct"; then
        !          8072:                add=$dir/$linklib
1.1       misho    8073:                case $host in
1.1.1.3 ! misho    8074:                  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
        !          8075:                  *-*-sysv4*uw2*) add_dir=-L$dir ;;
1.1       misho    8076:                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
1.1.1.3 ! misho    8077:                    *-*-unixware7*) add_dir=-L$dir ;;
1.1       misho    8078:                  *-*-darwin* )
1.1.1.3 ! misho    8079:                    # if the lib is a (non-dlopened) module then we cannot
1.1       misho    8080:                    # link against it, someone is ignoring the earlier warnings
                   8081:                    if /usr/bin/file -L $add 2> /dev/null |
1.1.1.3 ! misho    8082:                         $GREP ": [^:]* bundle" >/dev/null; then
1.1       misho    8083:                      if test "X$dlopenmodule" != "X$lib"; then
                   8084:                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
1.1.1.3 ! misho    8085:                        if test -z "$old_library"; then
1.1       misho    8086:                          echo
                   8087:                          echo "*** And there doesn't seem to be a static archive available"
                   8088:                          echo "*** The link will probably fail, sorry"
                   8089:                        else
1.1.1.3 ! misho    8090:                          add=$dir/$old_library
1.1       misho    8091:                        fi
                   8092:                      elif test -n "$old_library"; then
1.1.1.3 ! misho    8093:                        add=$dir/$old_library
1.1       misho    8094:                      fi
                   8095:                    fi
                   8096:                esac
1.1.1.3 ! misho    8097:              elif test no = "$hardcode_minus_L"; then
1.1       misho    8098:                case $host in
1.1.1.3 ! misho    8099:                *-*-sunos*) add_shlibpath=$dir ;;
1.1       misho    8100:                esac
1.1.1.3 ! misho    8101:                add_dir=-L$dir
        !          8102:                add=-l$name
        !          8103:              elif test no = "$hardcode_shlibpath_var"; then
        !          8104:                add_shlibpath=$dir
        !          8105:                add=-l$name
1.1       misho    8106:              else
                   8107:                lib_linked=no
                   8108:              fi
                   8109:              ;;
                   8110:            relink)
1.1.1.3 ! misho    8111:              if test yes = "$hardcode_direct" &&
        !          8112:                 test no = "$hardcode_direct_absolute"; then
        !          8113:                add=$dir/$linklib
        !          8114:              elif test yes = "$hardcode_minus_L"; then
        !          8115:                add_dir=-L$absdir
1.1       misho    8116:                # Try looking first in the location we're being installed to.
                   8117:                if test -n "$inst_prefix_dir"; then
                   8118:                  case $libdir in
                   8119:                    [\\/]*)
                   8120:                      func_append add_dir " -L$inst_prefix_dir$libdir"
                   8121:                      ;;
                   8122:                  esac
                   8123:                fi
1.1.1.3 ! misho    8124:                add=-l$name
        !          8125:              elif test yes = "$hardcode_shlibpath_var"; then
        !          8126:                add_shlibpath=$dir
        !          8127:                add=-l$name
1.1       misho    8128:              else
                   8129:                lib_linked=no
                   8130:              fi
                   8131:              ;;
                   8132:            *) lib_linked=no ;;
                   8133:            esac
                   8134: 
1.1.1.3 ! misho    8135:            if test yes != "$lib_linked"; then
1.1       misho    8136:              func_fatal_configuration "unsupported hardcode properties"
                   8137:            fi
                   8138: 
                   8139:            if test -n "$add_shlibpath"; then
                   8140:              case :$compile_shlibpath: in
                   8141:              *":$add_shlibpath:"*) ;;
                   8142:              *) func_append compile_shlibpath "$add_shlibpath:" ;;
                   8143:              esac
                   8144:            fi
1.1.1.3 ! misho    8145:            if test prog = "$linkmode"; then
1.1       misho    8146:              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
                   8147:              test -n "$add" && compile_deplibs="$add $compile_deplibs"
                   8148:            else
                   8149:              test -n "$add_dir" && deplibs="$add_dir $deplibs"
                   8150:              test -n "$add" && deplibs="$add $deplibs"
1.1.1.3 ! misho    8151:              if test yes != "$hardcode_direct" &&
        !          8152:                 test yes != "$hardcode_minus_L" &&
        !          8153:                 test yes = "$hardcode_shlibpath_var"; then
1.1       misho    8154:                case :$finalize_shlibpath: in
                   8155:                *":$libdir:"*) ;;
                   8156:                *) func_append finalize_shlibpath "$libdir:" ;;
                   8157:                esac
                   8158:              fi
                   8159:            fi
                   8160:          fi
                   8161: 
1.1.1.3 ! misho    8162:          if test prog = "$linkmode" || test relink = "$opt_mode"; then
1.1       misho    8163:            add_shlibpath=
                   8164:            add_dir=
                   8165:            add=
                   8166:            # Finalize command for both is simple: just hardcode it.
1.1.1.3 ! misho    8167:            if test yes = "$hardcode_direct" &&
        !          8168:               test no = "$hardcode_direct_absolute"; then
        !          8169:              add=$libdir/$linklib
        !          8170:            elif test yes = "$hardcode_minus_L"; then
        !          8171:              add_dir=-L$libdir
        !          8172:              add=-l$name
        !          8173:            elif test yes = "$hardcode_shlibpath_var"; then
1.1       misho    8174:              case :$finalize_shlibpath: in
                   8175:              *":$libdir:"*) ;;
                   8176:              *) func_append finalize_shlibpath "$libdir:" ;;
                   8177:              esac
1.1.1.3 ! misho    8178:              add=-l$name
        !          8179:            elif test yes = "$hardcode_automatic"; then
1.1       misho    8180:              if test -n "$inst_prefix_dir" &&
1.1.1.3 ! misho    8181:                 test -f "$inst_prefix_dir$libdir/$linklib"; then
        !          8182:                add=$inst_prefix_dir$libdir/$linklib
1.1       misho    8183:              else
1.1.1.3 ! misho    8184:                add=$libdir/$linklib
1.1       misho    8185:              fi
                   8186:            else
                   8187:              # We cannot seem to hardcode it, guess we'll fake it.
1.1.1.3 ! misho    8188:              add_dir=-L$libdir
1.1       misho    8189:              # Try looking first in the location we're being installed to.
                   8190:              if test -n "$inst_prefix_dir"; then
                   8191:                case $libdir in
                   8192:                  [\\/]*)
                   8193:                    func_append add_dir " -L$inst_prefix_dir$libdir"
                   8194:                    ;;
                   8195:                esac
                   8196:              fi
1.1.1.3 ! misho    8197:              add=-l$name
1.1       misho    8198:            fi
                   8199: 
1.1.1.3 ! misho    8200:            if test prog = "$linkmode"; then
1.1       misho    8201:              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
                   8202:              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
                   8203:            else
                   8204:              test -n "$add_dir" && deplibs="$add_dir $deplibs"
                   8205:              test -n "$add" && deplibs="$add $deplibs"
                   8206:            fi
                   8207:          fi
1.1.1.3 ! misho    8208:        elif test prog = "$linkmode"; then
1.1       misho    8209:          # Here we assume that one of hardcode_direct or hardcode_minus_L
                   8210:          # is not unsupported.  This is valid on all known static and
                   8211:          # shared platforms.
1.1.1.3 ! misho    8212:          if test unsupported != "$hardcode_direct"; then
        !          8213:            test -n "$old_library" && linklib=$old_library
1.1       misho    8214:            compile_deplibs="$dir/$linklib $compile_deplibs"
                   8215:            finalize_deplibs="$dir/$linklib $finalize_deplibs"
                   8216:          else
                   8217:            compile_deplibs="-l$name -L$dir $compile_deplibs"
                   8218:            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
                   8219:          fi
1.1.1.3 ! misho    8220:        elif test yes = "$build_libtool_libs"; then
1.1       misho    8221:          # Not a shared library
1.1.1.3 ! misho    8222:          if test pass_all != "$deplibs_check_method"; then
1.1       misho    8223:            # We're trying link a shared library against a static one
                   8224:            # but the system doesn't support it.
                   8225: 
                   8226:            # Just print a warning and add the library to dependency_libs so
                   8227:            # that the program can be linked against the static library.
                   8228:            echo
1.1.1.3 ! misho    8229:            $ECHO "*** Warning: This system cannot link to static lib archive $lib."
1.1       misho    8230:            echo "*** I have the capability to make that library automatically link in when"
                   8231:            echo "*** you link to this library.  But I can only do this if you have a"
                   8232:            echo "*** shared version of the library, which you do not appear to have."
1.1.1.3 ! misho    8233:            if test yes = "$module"; then
1.1       misho    8234:              echo "*** But as you try to build a module library, libtool will still create "
                   8235:              echo "*** a static module, that should work as long as the dlopening application"
                   8236:              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
                   8237:              if test -z "$global_symbol_pipe"; then
                   8238:                echo
                   8239:                echo "*** However, this would only work if libtool was able to extract symbol"
1.1.1.3 ! misho    8240:                echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
1.1       misho    8241:                echo "*** not find such a program.  So, this module is probably useless."
1.1.1.3 ! misho    8242:                echo "*** 'nm' from GNU binutils and a full rebuild may help."
1.1       misho    8243:              fi
1.1.1.3 ! misho    8244:              if test no = "$build_old_libs"; then
1.1       misho    8245:                build_libtool_libs=module
                   8246:                build_old_libs=yes
                   8247:              else
                   8248:                build_libtool_libs=no
                   8249:              fi
                   8250:            fi
                   8251:          else
                   8252:            deplibs="$dir/$old_library $deplibs"
                   8253:            link_static=yes
                   8254:          fi
                   8255:        fi # link shared/static library?
                   8256: 
1.1.1.3 ! misho    8257:        if test lib = "$linkmode"; then
1.1       misho    8258:          if test -n "$dependency_libs" &&
1.1.1.3 ! misho    8259:             { test yes != "$hardcode_into_libs" ||
        !          8260:               test yes = "$build_old_libs" ||
        !          8261:               test yes = "$link_static"; }; then
1.1       misho    8262:            # Extract -R from dependency_libs
                   8263:            temp_deplibs=
                   8264:            for libdir in $dependency_libs; do
                   8265:              case $libdir in
                   8266:              -R*) func_stripname '-R' '' "$libdir"
                   8267:                   temp_xrpath=$func_stripname_result
                   8268:                   case " $xrpath " in
                   8269:                   *" $temp_xrpath "*) ;;
                   8270:                   *) func_append xrpath " $temp_xrpath";;
                   8271:                   esac;;
                   8272:              *) func_append temp_deplibs " $libdir";;
                   8273:              esac
                   8274:            done
1.1.1.3 ! misho    8275:            dependency_libs=$temp_deplibs
1.1       misho    8276:          fi
                   8277: 
                   8278:          func_append newlib_search_path " $absdir"
                   8279:          # Link against this library
1.1.1.3 ! misho    8280:          test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1.1       misho    8281:          # ... and its dependency_libs
                   8282:          tmp_libs=
                   8283:          for deplib in $dependency_libs; do
                   8284:            newdependency_libs="$deplib $newdependency_libs"
                   8285:            case $deplib in
                   8286:               -L*) func_stripname '-L' '' "$deplib"
                   8287:                    func_resolve_sysroot "$func_stripname_result";;
                   8288:               *) func_resolve_sysroot "$deplib" ;;
                   8289:             esac
1.1.1.3 ! misho    8290:            if $opt_preserve_dup_deps; then
1.1       misho    8291:              case "$tmp_libs " in
                   8292:              *" $func_resolve_sysroot_result "*)
                   8293:                 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
                   8294:              esac
                   8295:            fi
                   8296:            func_append tmp_libs " $func_resolve_sysroot_result"
                   8297:          done
                   8298: 
1.1.1.3 ! misho    8299:          if test no != "$link_all_deplibs"; then
1.1       misho    8300:            # Add the search paths of all dependency libraries
                   8301:            for deplib in $dependency_libs; do
                   8302:              path=
                   8303:              case $deplib in
1.1.1.3 ! misho    8304:              -L*) path=$deplib ;;
1.1       misho    8305:              *.la)
                   8306:                func_resolve_sysroot "$deplib"
                   8307:                deplib=$func_resolve_sysroot_result
                   8308:                func_dirname "$deplib" "" "."
                   8309:                dir=$func_dirname_result
                   8310:                # We need an absolute path.
                   8311:                case $dir in
1.1.1.3 ! misho    8312:                [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
1.1       misho    8313:                *)
                   8314:                  absdir=`cd "$dir" && pwd`
                   8315:                  if test -z "$absdir"; then
1.1.1.3 ! misho    8316:                    func_warning "cannot determine absolute directory name of '$dir'"
        !          8317:                    absdir=$dir
1.1       misho    8318:                  fi
                   8319:                  ;;
                   8320:                esac
                   8321:                if $GREP "^installed=no" $deplib > /dev/null; then
                   8322:                case $host in
                   8323:                *-*-darwin*)
                   8324:                  depdepl=
1.1.1.3 ! misho    8325:                  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
        !          8326:                  if test -n "$deplibrary_names"; then
        !          8327:                    for tmp in $deplibrary_names; do
1.1       misho    8328:                      depdepl=$tmp
                   8329:                    done
1.1.1.3 ! misho    8330:                    if test -f "$absdir/$objdir/$depdepl"; then
        !          8331:                      depdepl=$absdir/$objdir/$depdepl
        !          8332:                      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
1.1       misho    8333:                       if test -z "$darwin_install_name"; then
1.1.1.3 ! misho    8334:                           darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
1.1       misho    8335:                       fi
1.1.1.3 ! misho    8336:                      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
        !          8337:                      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
1.1       misho    8338:                      path=
                   8339:                    fi
                   8340:                  fi
                   8341:                  ;;
                   8342:                *)
1.1.1.3 ! misho    8343:                  path=-L$absdir/$objdir
1.1       misho    8344:                  ;;
                   8345:                esac
                   8346:                else
1.1.1.3 ! misho    8347:                  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1.1       misho    8348:                  test -z "$libdir" && \
1.1.1.3 ! misho    8349:                    func_fatal_error "'$deplib' is not a valid libtool archive"
1.1       misho    8350:                  test "$absdir" != "$libdir" && \
1.1.1.3 ! misho    8351:                    func_warning "'$deplib' seems to be moved"
1.1       misho    8352: 
1.1.1.3 ! misho    8353:                  path=-L$absdir
1.1       misho    8354:                fi
                   8355:                ;;
                   8356:              esac
                   8357:              case " $deplibs " in
                   8358:              *" $path "*) ;;
                   8359:              *) deplibs="$path $deplibs" ;;
                   8360:              esac
                   8361:            done
                   8362:          fi # link_all_deplibs != no
                   8363:        fi # linkmode = lib
                   8364:       done # for deplib in $libs
1.1.1.3 ! misho    8365:       if test link = "$pass"; then
        !          8366:        if test prog = "$linkmode"; then
1.1       misho    8367:          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
                   8368:          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
                   8369:        else
                   8370:          compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   8371:        fi
                   8372:       fi
1.1.1.3 ! misho    8373:       dependency_libs=$newdependency_libs
        !          8374:       if test dlpreopen = "$pass"; then
1.1       misho    8375:        # Link the dlpreopened libraries before other libraries
                   8376:        for deplib in $save_deplibs; do
                   8377:          deplibs="$deplib $deplibs"
                   8378:        done
                   8379:       fi
1.1.1.3 ! misho    8380:       if test dlopen != "$pass"; then
        !          8381:        test conv = "$pass" || {
1.1       misho    8382:          # Make sure lib_search_path contains only unique directories.
                   8383:          lib_search_path=
                   8384:          for dir in $newlib_search_path; do
                   8385:            case "$lib_search_path " in
                   8386:            *" $dir "*) ;;
                   8387:            *) func_append lib_search_path " $dir" ;;
                   8388:            esac
                   8389:          done
                   8390:          newlib_search_path=
1.1.1.3 ! misho    8391:        }
1.1       misho    8392: 
1.1.1.3 ! misho    8393:        if test prog,link = "$linkmode,$pass"; then
1.1       misho    8394:          vars="compile_deplibs finalize_deplibs"
1.1.1.3 ! misho    8395:        else
        !          8396:          vars=deplibs
1.1       misho    8397:        fi
                   8398:        for var in $vars dependency_libs; do
                   8399:          # Add libraries to $var in reverse order
                   8400:          eval tmp_libs=\"\$$var\"
                   8401:          new_libs=
                   8402:          for deplib in $tmp_libs; do
                   8403:            # FIXME: Pedantically, this is the right thing to do, so
                   8404:            #        that some nasty dependency loop isn't accidentally
                   8405:            #        broken:
                   8406:            #new_libs="$deplib $new_libs"
                   8407:            # Pragmatically, this seems to cause very few problems in
                   8408:            # practice:
                   8409:            case $deplib in
                   8410:            -L*) new_libs="$deplib $new_libs" ;;
                   8411:            -R*) ;;
                   8412:            *)
                   8413:              # And here is the reason: when a library appears more
                   8414:              # than once as an explicit dependence of a library, or
                   8415:              # is implicitly linked in more than once by the
                   8416:              # compiler, it is considered special, and multiple
                   8417:              # occurrences thereof are not removed.  Compare this
                   8418:              # with having the same library being listed as a
                   8419:              # dependency of multiple other libraries: in this case,
                   8420:              # we know (pedantically, we assume) the library does not
                   8421:              # need to be listed more than once, so we keep only the
                   8422:              # last copy.  This is not always right, but it is rare
                   8423:              # enough that we require users that really mean to play
                   8424:              # such unportable linking tricks to link the library
                   8425:              # using -Wl,-lname, so that libtool does not consider it
                   8426:              # for duplicate removal.
                   8427:              case " $specialdeplibs " in
                   8428:              *" $deplib "*) new_libs="$deplib $new_libs" ;;
                   8429:              *)
                   8430:                case " $new_libs " in
                   8431:                *" $deplib "*) ;;
                   8432:                *) new_libs="$deplib $new_libs" ;;
                   8433:                esac
                   8434:                ;;
                   8435:              esac
                   8436:              ;;
                   8437:            esac
                   8438:          done
                   8439:          tmp_libs=
                   8440:          for deplib in $new_libs; do
                   8441:            case $deplib in
                   8442:            -L*)
                   8443:              case " $tmp_libs " in
                   8444:              *" $deplib "*) ;;
                   8445:              *) func_append tmp_libs " $deplib" ;;
                   8446:              esac
                   8447:              ;;
                   8448:            *) func_append tmp_libs " $deplib" ;;
                   8449:            esac
                   8450:          done
                   8451:          eval $var=\"$tmp_libs\"
                   8452:        done # for var
                   8453:       fi
                   8454:       # Last step: remove runtime libs from dependency_libs
                   8455:       # (they stay in deplibs)
                   8456:       tmp_libs=
1.1.1.3 ! misho    8457:       for i in $dependency_libs; do
1.1       misho    8458:        case " $predeps $postdeps $compiler_lib_search_path " in
                   8459:        *" $i "*)
1.1.1.3 ! misho    8460:          i=
1.1       misho    8461:          ;;
                   8462:        esac
1.1.1.3 ! misho    8463:        if test -n "$i"; then
1.1       misho    8464:          func_append tmp_libs " $i"
                   8465:        fi
                   8466:       done
                   8467:       dependency_libs=$tmp_libs
                   8468:     done # for pass
1.1.1.3 ! misho    8469:     if test prog = "$linkmode"; then
        !          8470:       dlfiles=$newdlfiles
1.1       misho    8471:     fi
1.1.1.3 ! misho    8472:     if test prog = "$linkmode" || test lib = "$linkmode"; then
        !          8473:       dlprefiles=$newdlprefiles
1.1       misho    8474:     fi
                   8475: 
                   8476:     case $linkmode in
                   8477:     oldlib)
1.1.1.3 ! misho    8478:       if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
        !          8479:        func_warning "'-dlopen' is ignored for archives"
1.1       misho    8480:       fi
                   8481: 
                   8482:       case " $deplibs" in
                   8483:       *\ -l* | *\ -L*)
1.1.1.3 ! misho    8484:        func_warning "'-l' and '-L' are ignored for archives" ;;
1.1       misho    8485:       esac
                   8486: 
                   8487:       test -n "$rpath" && \
1.1.1.3 ! misho    8488:        func_warning "'-rpath' is ignored for archives"
1.1       misho    8489: 
                   8490:       test -n "$xrpath" && \
1.1.1.3 ! misho    8491:        func_warning "'-R' is ignored for archives"
1.1       misho    8492: 
                   8493:       test -n "$vinfo" && \
1.1.1.3 ! misho    8494:        func_warning "'-version-info/-version-number' is ignored for archives"
1.1       misho    8495: 
                   8496:       test -n "$release" && \
1.1.1.3 ! misho    8497:        func_warning "'-release' is ignored for archives"
1.1       misho    8498: 
                   8499:       test -n "$export_symbols$export_symbols_regex" && \
1.1.1.3 ! misho    8500:        func_warning "'-export-symbols' is ignored for archives"
1.1       misho    8501: 
                   8502:       # Now set the variables for building old libraries.
                   8503:       build_libtool_libs=no
1.1.1.3 ! misho    8504:       oldlibs=$output
1.1       misho    8505:       func_append objs "$old_deplibs"
                   8506:       ;;
                   8507: 
                   8508:     lib)
1.1.1.3 ! misho    8509:       # Make sure we only generate libraries of the form 'libNAME.la'.
1.1       misho    8510:       case $outputname in
                   8511:       lib*)
                   8512:        func_stripname 'lib' '.la' "$outputname"
                   8513:        name=$func_stripname_result
                   8514:        eval shared_ext=\"$shrext_cmds\"
                   8515:        eval libname=\"$libname_spec\"
                   8516:        ;;
                   8517:       *)
1.1.1.3 ! misho    8518:        test no = "$module" \
        !          8519:          && func_fatal_help "libtool library '$output' must begin with 'lib'"
1.1       misho    8520: 
1.1.1.3 ! misho    8521:        if test no != "$need_lib_prefix"; then
1.1       misho    8522:          # Add the "lib" prefix for modules if required
                   8523:          func_stripname '' '.la' "$outputname"
                   8524:          name=$func_stripname_result
                   8525:          eval shared_ext=\"$shrext_cmds\"
                   8526:          eval libname=\"$libname_spec\"
                   8527:        else
                   8528:          func_stripname '' '.la' "$outputname"
                   8529:          libname=$func_stripname_result
                   8530:        fi
                   8531:        ;;
                   8532:       esac
                   8533: 
                   8534:       if test -n "$objs"; then
1.1.1.3 ! misho    8535:        if test pass_all != "$deplibs_check_method"; then
        !          8536:          func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
1.1       misho    8537:        else
                   8538:          echo
                   8539:          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
                   8540:          $ECHO "*** objects $objs is not portable!"
                   8541:          func_append libobjs " $objs"
                   8542:        fi
                   8543:       fi
                   8544: 
1.1.1.3 ! misho    8545:       test no = "$dlself" \
        !          8546:        || func_warning "'-dlopen self' is ignored for libtool libraries"
1.1       misho    8547: 
                   8548:       set dummy $rpath
                   8549:       shift
1.1.1.3 ! misho    8550:       test 1 -lt "$#" \
        !          8551:        && func_warning "ignoring multiple '-rpath's for a libtool library"
1.1       misho    8552: 
1.1.1.3 ! misho    8553:       install_libdir=$1
1.1       misho    8554: 
                   8555:       oldlibs=
                   8556:       if test -z "$rpath"; then
1.1.1.3 ! misho    8557:        if test yes = "$build_libtool_libs"; then
1.1       misho    8558:          # Building a libtool convenience library.
1.1.1.3 ! misho    8559:          # Some compilers have problems with a '.al' extension so
1.1       misho    8560:          # convenience libraries should have the same extension an
                   8561:          # archive normally would.
                   8562:          oldlibs="$output_objdir/$libname.$libext $oldlibs"
                   8563:          build_libtool_libs=convenience
                   8564:          build_old_libs=yes
                   8565:        fi
                   8566: 
                   8567:        test -n "$vinfo" && \
1.1.1.3 ! misho    8568:          func_warning "'-version-info/-version-number' is ignored for convenience libraries"
1.1       misho    8569: 
                   8570:        test -n "$release" && \
1.1.1.3 ! misho    8571:          func_warning "'-release' is ignored for convenience libraries"
1.1       misho    8572:       else
                   8573: 
                   8574:        # Parse the version information argument.
1.1.1.3 ! misho    8575:        save_ifs=$IFS; IFS=:
1.1       misho    8576:        set dummy $vinfo 0 0 0
                   8577:        shift
1.1.1.3 ! misho    8578:        IFS=$save_ifs
1.1       misho    8579: 
                   8580:        test -n "$7" && \
1.1.1.3 ! misho    8581:          func_fatal_help "too many parameters to '-version-info'"
1.1       misho    8582: 
                   8583:        # convert absolute version numbers to libtool ages
                   8584:        # this retains compatibility with .la files and attempts
                   8585:        # to make the code below a bit more comprehensible
                   8586: 
                   8587:        case $vinfo_number in
                   8588:        yes)
1.1.1.3 ! misho    8589:          number_major=$1
        !          8590:          number_minor=$2
        !          8591:          number_revision=$3
1.1       misho    8592:          #
                   8593:          # There are really only two kinds -- those that
                   8594:          # use the current revision as the major version
                   8595:          # and those that subtract age and use age as
                   8596:          # a minor version.  But, then there is irix
1.1.1.3 ! misho    8597:          # that has an extra 1 added just for fun
1.1       misho    8598:          #
                   8599:          case $version_type in
1.1.1.2   misho    8600:          # correct linux to gnu/linux during the next big refactor
1.1       misho    8601:          darwin|linux|osf|windows|none)
                   8602:            func_arith $number_major + $number_minor
                   8603:            current=$func_arith_result
1.1.1.3 ! misho    8604:            age=$number_minor
        !          8605:            revision=$number_revision
1.1       misho    8606:            ;;
                   8607:          freebsd-aout|freebsd-elf|qnx|sunos)
1.1.1.3 ! misho    8608:            current=$number_major
        !          8609:            revision=$number_minor
        !          8610:            age=0
1.1       misho    8611:            ;;
                   8612:          irix|nonstopux)
                   8613:            func_arith $number_major + $number_minor
                   8614:            current=$func_arith_result
1.1.1.3 ! misho    8615:            age=$number_minor
        !          8616:            revision=$number_minor
1.1       misho    8617:            lt_irix_increment=no
                   8618:            ;;
                   8619:          esac
                   8620:          ;;
                   8621:        no)
1.1.1.3 ! misho    8622:          current=$1
        !          8623:          revision=$2
        !          8624:          age=$3
1.1       misho    8625:          ;;
                   8626:        esac
                   8627: 
                   8628:        # Check that each of the things are valid numbers.
                   8629:        case $current in
                   8630:        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]) ;;
                   8631:        *)
1.1.1.3 ! misho    8632:          func_error "CURRENT '$current' must be a nonnegative integer"
        !          8633:          func_fatal_error "'$vinfo' is not valid version information"
1.1       misho    8634:          ;;
                   8635:        esac
                   8636: 
                   8637:        case $revision in
                   8638:        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]) ;;
                   8639:        *)
1.1.1.3 ! misho    8640:          func_error "REVISION '$revision' must be a nonnegative integer"
        !          8641:          func_fatal_error "'$vinfo' is not valid version information"
1.1       misho    8642:          ;;
                   8643:        esac
                   8644: 
                   8645:        case $age in
                   8646:        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]) ;;
                   8647:        *)
1.1.1.3 ! misho    8648:          func_error "AGE '$age' must be a nonnegative integer"
        !          8649:          func_fatal_error "'$vinfo' is not valid version information"
1.1       misho    8650:          ;;
                   8651:        esac
                   8652: 
                   8653:        if test "$age" -gt "$current"; then
1.1.1.3 ! misho    8654:          func_error "AGE '$age' is greater than the current interface number '$current'"
        !          8655:          func_fatal_error "'$vinfo' is not valid version information"
1.1       misho    8656:        fi
                   8657: 
                   8658:        # Calculate the version variables.
                   8659:        major=
                   8660:        versuffix=
                   8661:        verstring=
                   8662:        case $version_type in
                   8663:        none) ;;
                   8664: 
                   8665:        darwin)
                   8666:          # Like Linux, but with the current version available in
                   8667:          # verstring for coding it into the library header
                   8668:          func_arith $current - $age
                   8669:          major=.$func_arith_result
1.1.1.3 ! misho    8670:          versuffix=$major.$age.$revision
1.1       misho    8671:          # Darwin ld doesn't like 0 for these options...
                   8672:          func_arith $current + 1
                   8673:          minor_current=$func_arith_result
1.1.1.3 ! misho    8674:          xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
1.1       misho    8675:          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
1.1.1.3 ! misho    8676:           # On Darwin other compilers
        !          8677:           case $CC in
        !          8678:               nagfor*)
        !          8679:                   verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
        !          8680:                   ;;
        !          8681:               *)
        !          8682:                   verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
        !          8683:                   ;;
        !          8684:           esac
1.1       misho    8685:          ;;
                   8686: 
                   8687:        freebsd-aout)
1.1.1.3 ! misho    8688:          major=.$current
        !          8689:          versuffix=.$current.$revision
1.1       misho    8690:          ;;
                   8691: 
                   8692:        freebsd-elf)
1.1.1.3 ! misho    8693:          major=.$current
        !          8694:          versuffix=.$current
1.1       misho    8695:          ;;
                   8696: 
                   8697:        irix | nonstopux)
1.1.1.3 ! misho    8698:          if test no = "$lt_irix_increment"; then
1.1       misho    8699:            func_arith $current - $age
                   8700:          else
                   8701:            func_arith $current - $age + 1
                   8702:          fi
                   8703:          major=$func_arith_result
                   8704: 
                   8705:          case $version_type in
                   8706:            nonstopux) verstring_prefix=nonstopux ;;
                   8707:            *)         verstring_prefix=sgi ;;
                   8708:          esac
1.1.1.3 ! misho    8709:          verstring=$verstring_prefix$major.$revision
1.1       misho    8710: 
                   8711:          # Add in all the interfaces that we are compatible with.
                   8712:          loop=$revision
1.1.1.3 ! misho    8713:          while test 0 -ne "$loop"; do
1.1       misho    8714:            func_arith $revision - $loop
                   8715:            iface=$func_arith_result
                   8716:            func_arith $loop - 1
                   8717:            loop=$func_arith_result
1.1.1.3 ! misho    8718:            verstring=$verstring_prefix$major.$iface:$verstring
1.1       misho    8719:          done
                   8720: 
1.1.1.3 ! misho    8721:          # Before this point, $major must not contain '.'.
1.1       misho    8722:          major=.$major
1.1.1.3 ! misho    8723:          versuffix=$major.$revision
1.1       misho    8724:          ;;
                   8725: 
1.1.1.2   misho    8726:        linux) # correct to gnu/linux during the next big refactor
1.1       misho    8727:          func_arith $current - $age
                   8728:          major=.$func_arith_result
1.1.1.3 ! misho    8729:          versuffix=$major.$age.$revision
1.1       misho    8730:          ;;
                   8731: 
                   8732:        osf)
                   8733:          func_arith $current - $age
                   8734:          major=.$func_arith_result
1.1.1.3 ! misho    8735:          versuffix=.$current.$age.$revision
        !          8736:          verstring=$current.$age.$revision
1.1       misho    8737: 
                   8738:          # Add in all the interfaces that we are compatible with.
                   8739:          loop=$age
1.1.1.3 ! misho    8740:          while test 0 -ne "$loop"; do
1.1       misho    8741:            func_arith $current - $loop
                   8742:            iface=$func_arith_result
                   8743:            func_arith $loop - 1
                   8744:            loop=$func_arith_result
1.1.1.3 ! misho    8745:            verstring=$verstring:$iface.0
1.1       misho    8746:          done
                   8747: 
                   8748:          # Make executables depend on our current version.
1.1.1.3 ! misho    8749:          func_append verstring ":$current.0"
1.1       misho    8750:          ;;
                   8751: 
                   8752:        qnx)
1.1.1.3 ! misho    8753:          major=.$current
        !          8754:          versuffix=.$current
1.1       misho    8755:          ;;
                   8756: 
                   8757:        sunos)
1.1.1.3 ! misho    8758:          major=.$current
        !          8759:          versuffix=.$current.$revision
1.1       misho    8760:          ;;
                   8761: 
                   8762:        windows)
                   8763:          # Use '-' rather than '.', since we only want one
1.1.1.3 ! misho    8764:          # extension on DOS 8.3 file systems.
1.1       misho    8765:          func_arith $current - $age
                   8766:          major=$func_arith_result
1.1.1.3 ! misho    8767:          versuffix=-$major
1.1       misho    8768:          ;;
                   8769: 
                   8770:        *)
1.1.1.3 ! misho    8771:          func_fatal_configuration "unknown library version type '$version_type'"
1.1       misho    8772:          ;;
                   8773:        esac
                   8774: 
                   8775:        # Clear the version info if we defaulted, and they specified a release.
                   8776:        if test -z "$vinfo" && test -n "$release"; then
                   8777:          major=
                   8778:          case $version_type in
                   8779:          darwin)
                   8780:            # we can't check for "0.0" in archive_cmds due to quoting
                   8781:            # problems, so we reset it completely
                   8782:            verstring=
                   8783:            ;;
                   8784:          *)
1.1.1.3 ! misho    8785:            verstring=0.0
1.1       misho    8786:            ;;
                   8787:          esac
1.1.1.3 ! misho    8788:          if test no = "$need_version"; then
1.1       misho    8789:            versuffix=
                   8790:          else
1.1.1.3 ! misho    8791:            versuffix=.0.0
1.1       misho    8792:          fi
                   8793:        fi
                   8794: 
                   8795:        # Remove version info from name if versioning should be avoided
1.1.1.3 ! misho    8796:        if test yes,no = "$avoid_version,$need_version"; then
1.1       misho    8797:          major=
                   8798:          versuffix=
1.1.1.3 ! misho    8799:          verstring=
1.1       misho    8800:        fi
                   8801: 
                   8802:        # Check to see if the archive will have undefined symbols.
1.1.1.3 ! misho    8803:        if test yes = "$allow_undefined"; then
        !          8804:          if test unsupported = "$allow_undefined_flag"; then
        !          8805:            if test yes = "$build_old_libs"; then
        !          8806:              func_warning "undefined symbols not allowed in $host shared libraries; building static only"
        !          8807:              build_libtool_libs=no
        !          8808:            else
        !          8809:              func_fatal_error "can't build $host shared library unless -no-undefined is specified"
        !          8810:            fi
1.1       misho    8811:          fi
                   8812:        else
                   8813:          # Don't allow undefined symbols.
1.1.1.3 ! misho    8814:          allow_undefined_flag=$no_undefined_flag
1.1       misho    8815:        fi
                   8816: 
                   8817:       fi
                   8818: 
1.1.1.3 ! misho    8819:       func_generate_dlsyms "$libname" "$libname" :
1.1       misho    8820:       func_append libobjs " $symfileobj"
1.1.1.3 ! misho    8821:       test " " = "$libobjs" && libobjs=
1.1       misho    8822: 
1.1.1.3 ! misho    8823:       if test relink != "$opt_mode"; then
1.1       misho    8824:        # Remove our outputs, but don't remove object files since they
                   8825:        # may have been created when compiling PIC objects.
                   8826:        removelist=
                   8827:        tempremovelist=`$ECHO "$output_objdir/*"`
                   8828:        for p in $tempremovelist; do
                   8829:          case $p in
                   8830:            *.$objext | *.gcno)
                   8831:               ;;
1.1.1.3 ! misho    8832:            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
        !          8833:               if test -n "$precious_files_regex"; then
1.1       misho    8834:                 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
                   8835:                 then
                   8836:                   continue
                   8837:                 fi
                   8838:               fi
                   8839:               func_append removelist " $p"
                   8840:               ;;
                   8841:            *) ;;
                   8842:          esac
                   8843:        done
                   8844:        test -n "$removelist" && \
                   8845:          func_show_eval "${RM}r \$removelist"
                   8846:       fi
                   8847: 
                   8848:       # Now set the variables for building old libraries.
1.1.1.3 ! misho    8849:       if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
1.1       misho    8850:        func_append oldlibs " $output_objdir/$libname.$libext"
                   8851: 
                   8852:        # Transform .lo files to .o files.
1.1.1.3 ! misho    8853:        oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
1.1       misho    8854:       fi
                   8855: 
                   8856:       # Eliminate all temporary directories.
                   8857:       #for path in $notinst_path; do
                   8858:       #        lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
                   8859:       #        deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
                   8860:       #        dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
                   8861:       #done
                   8862: 
                   8863:       if test -n "$xrpath"; then
                   8864:        # If the user specified any rpath flags, then add them.
                   8865:        temp_xrpath=
                   8866:        for libdir in $xrpath; do
                   8867:          func_replace_sysroot "$libdir"
                   8868:          func_append temp_xrpath " -R$func_replace_sysroot_result"
                   8869:          case "$finalize_rpath " in
                   8870:          *" $libdir "*) ;;
                   8871:          *) func_append finalize_rpath " $libdir" ;;
                   8872:          esac
                   8873:        done
1.1.1.3 ! misho    8874:        if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
1.1       misho    8875:          dependency_libs="$temp_xrpath $dependency_libs"
                   8876:        fi
                   8877:       fi
                   8878: 
                   8879:       # Make sure dlfiles contains only unique files that won't be dlpreopened
1.1.1.3 ! misho    8880:       old_dlfiles=$dlfiles
1.1       misho    8881:       dlfiles=
                   8882:       for lib in $old_dlfiles; do
                   8883:        case " $dlprefiles $dlfiles " in
                   8884:        *" $lib "*) ;;
                   8885:        *) func_append dlfiles " $lib" ;;
                   8886:        esac
                   8887:       done
                   8888: 
                   8889:       # Make sure dlprefiles contains only unique files
1.1.1.3 ! misho    8890:       old_dlprefiles=$dlprefiles
1.1       misho    8891:       dlprefiles=
                   8892:       for lib in $old_dlprefiles; do
                   8893:        case "$dlprefiles " in
                   8894:        *" $lib "*) ;;
                   8895:        *) func_append dlprefiles " $lib" ;;
                   8896:        esac
                   8897:       done
                   8898: 
1.1.1.3 ! misho    8899:       if test yes = "$build_libtool_libs"; then
1.1       misho    8900:        if test -n "$rpath"; then
                   8901:          case $host in
                   8902:          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
                   8903:            # these systems don't actually have a c library (as such)!
                   8904:            ;;
                   8905:          *-*-rhapsody* | *-*-darwin1.[012])
                   8906:            # Rhapsody C library is in the System framework
                   8907:            func_append deplibs " System.ltframework"
                   8908:            ;;
                   8909:          *-*-netbsd*)
                   8910:            # Don't link with libc until the a.out ld.so is fixed.
                   8911:            ;;
                   8912:          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
                   8913:            # Do not include libc due to us having libc/libc_r.
                   8914:            ;;
                   8915:          *-*-sco3.2v5* | *-*-sco5v6*)
                   8916:            # Causes problems with __ctype
                   8917:            ;;
                   8918:          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
                   8919:            # Compiler inserts libc in the correct place for threads to work
                   8920:            ;;
                   8921:          *)
                   8922:            # Add libc to deplibs on all other systems if necessary.
1.1.1.3 ! misho    8923:            if test yes = "$build_libtool_need_lc"; then
1.1       misho    8924:              func_append deplibs " -lc"
                   8925:            fi
                   8926:            ;;
                   8927:          esac
                   8928:        fi
                   8929: 
                   8930:        # Transform deplibs into only deplibs that can be linked in shared.
                   8931:        name_save=$name
                   8932:        libname_save=$libname
                   8933:        release_save=$release
                   8934:        versuffix_save=$versuffix
                   8935:        major_save=$major
                   8936:        # I'm not sure if I'm treating the release correctly.  I think
                   8937:        # release should show up in the -l (ie -lgmp5) so we don't want to
                   8938:        # add it in twice.  Is that correct?
1.1.1.3 ! misho    8939:        release=
        !          8940:        versuffix=
        !          8941:        major=
1.1       misho    8942:        newdeplibs=
                   8943:        droppeddeps=no
                   8944:        case $deplibs_check_method in
                   8945:        pass_all)
                   8946:          # Don't check for shared/static.  Everything works.
                   8947:          # This might be a little naive.  We might want to check
                   8948:          # whether the library exists or not.  But this is on
                   8949:          # osf3 & osf4 and I'm not really sure... Just
                   8950:          # implementing what was already the behavior.
                   8951:          newdeplibs=$deplibs
                   8952:          ;;
                   8953:        test_compile)
                   8954:          # This code stresses the "libraries are programs" paradigm to its
                   8955:          # limits. Maybe even breaks it.  We compile a program, linking it
                   8956:          # against the deplibs as a proxy for the library.  Then we can check
                   8957:          # whether they linked in statically or dynamically with ldd.
                   8958:          $opt_dry_run || $RM conftest.c
                   8959:          cat > conftest.c <<EOF
                   8960:          int main() { return 0; }
                   8961: EOF
                   8962:          $opt_dry_run || $RM conftest
                   8963:          if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
                   8964:            ldd_output=`ldd conftest`
                   8965:            for i in $deplibs; do
                   8966:              case $i in
                   8967:              -l*)
                   8968:                func_stripname -l '' "$i"
                   8969:                name=$func_stripname_result
1.1.1.3 ! misho    8970:                if test yes = "$allow_libtool_libs_with_static_runtimes"; then
1.1       misho    8971:                  case " $predeps $postdeps " in
                   8972:                  *" $i "*)
                   8973:                    func_append newdeplibs " $i"
1.1.1.3 ! misho    8974:                    i=
1.1       misho    8975:                    ;;
                   8976:                  esac
                   8977:                fi
1.1.1.3 ! misho    8978:                if test -n "$i"; then
1.1       misho    8979:                  libname=`eval "\\$ECHO \"$libname_spec\""`
                   8980:                  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
                   8981:                  set dummy $deplib_matches; shift
                   8982:                  deplib_match=$1
1.1.1.3 ! misho    8983:                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
1.1       misho    8984:                    func_append newdeplibs " $i"
                   8985:                  else
                   8986:                    droppeddeps=yes
                   8987:                    echo
                   8988:                    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
                   8989:                    echo "*** I have the capability to make that library automatically link in when"
                   8990:                    echo "*** you link to this library.  But I can only do this if you have a"
                   8991:                    echo "*** shared version of the library, which I believe you do not have"
                   8992:                    echo "*** because a test_compile did reveal that the linker did not use it for"
                   8993:                    echo "*** its dynamic dependency list that programs get resolved with at runtime."
                   8994:                  fi
                   8995:                fi
                   8996:                ;;
                   8997:              *)
                   8998:                func_append newdeplibs " $i"
                   8999:                ;;
                   9000:              esac
                   9001:            done
                   9002:          else
                   9003:            # Error occurred in the first compile.  Let's try to salvage
                   9004:            # the situation: Compile a separate program for each library.
                   9005:            for i in $deplibs; do
                   9006:              case $i in
                   9007:              -l*)
                   9008:                func_stripname -l '' "$i"
                   9009:                name=$func_stripname_result
                   9010:                $opt_dry_run || $RM conftest
                   9011:                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
                   9012:                  ldd_output=`ldd conftest`
1.1.1.3 ! misho    9013:                  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
1.1       misho    9014:                    case " $predeps $postdeps " in
                   9015:                    *" $i "*)
                   9016:                      func_append newdeplibs " $i"
1.1.1.3 ! misho    9017:                      i=
1.1       misho    9018:                      ;;
                   9019:                    esac
                   9020:                  fi
1.1.1.3 ! misho    9021:                  if test -n "$i"; then
1.1       misho    9022:                    libname=`eval "\\$ECHO \"$libname_spec\""`
                   9023:                    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
                   9024:                    set dummy $deplib_matches; shift
                   9025:                    deplib_match=$1
1.1.1.3 ! misho    9026:                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
1.1       misho    9027:                      func_append newdeplibs " $i"
                   9028:                    else
                   9029:                      droppeddeps=yes
                   9030:                      echo
                   9031:                      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
                   9032:                      echo "*** I have the capability to make that library automatically link in when"
                   9033:                      echo "*** you link to this library.  But I can only do this if you have a"
                   9034:                      echo "*** shared version of the library, which you do not appear to have"
                   9035:                      echo "*** because a test_compile did reveal that the linker did not use this one"
                   9036:                      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
                   9037:                    fi
                   9038:                  fi
                   9039:                else
                   9040:                  droppeddeps=yes
                   9041:                  echo
                   9042:                  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
                   9043:                  echo "*** make it link in!  You will probably need to install it or some"
                   9044:                  echo "*** library that it depends on before this library will be fully"
                   9045:                  echo "*** functional.  Installing it before continuing would be even better."
                   9046:                fi
                   9047:                ;;
                   9048:              *)
                   9049:                func_append newdeplibs " $i"
                   9050:                ;;
                   9051:              esac
                   9052:            done
                   9053:          fi
                   9054:          ;;
                   9055:        file_magic*)
                   9056:          set dummy $deplibs_check_method; shift
                   9057:          file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
                   9058:          for a_deplib in $deplibs; do
                   9059:            case $a_deplib in
                   9060:            -l*)
                   9061:              func_stripname -l '' "$a_deplib"
                   9062:              name=$func_stripname_result
1.1.1.3 ! misho    9063:              if test yes = "$allow_libtool_libs_with_static_runtimes"; then
1.1       misho    9064:                case " $predeps $postdeps " in
                   9065:                *" $a_deplib "*)
                   9066:                  func_append newdeplibs " $a_deplib"
1.1.1.3 ! misho    9067:                  a_deplib=
1.1       misho    9068:                  ;;
                   9069:                esac
                   9070:              fi
1.1.1.3 ! misho    9071:              if test -n "$a_deplib"; then
1.1       misho    9072:                libname=`eval "\\$ECHO \"$libname_spec\""`
                   9073:                if test -n "$file_magic_glob"; then
                   9074:                  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
                   9075:                else
                   9076:                  libnameglob=$libname
                   9077:                fi
1.1.1.3 ! misho    9078:                test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
1.1       misho    9079:                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
1.1.1.3 ! misho    9080:                  if test yes = "$want_nocaseglob"; then
1.1       misho    9081:                    shopt -s nocaseglob
                   9082:                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
                   9083:                    $nocaseglob
                   9084:                  else
                   9085:                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
                   9086:                  fi
                   9087:                  for potent_lib in $potential_libs; do
                   9088:                      # Follow soft links.
                   9089:                      if ls -lLd "$potent_lib" 2>/dev/null |
                   9090:                         $GREP " -> " >/dev/null; then
                   9091:                        continue
                   9092:                      fi
                   9093:                      # The statement above tries to avoid entering an
                   9094:                      # endless loop below, in case of cyclic links.
                   9095:                      # We might still enter an endless loop, since a link
                   9096:                      # loop can be closed while we follow links,
                   9097:                      # but so what?
1.1.1.3 ! misho    9098:                      potlib=$potent_lib
1.1       misho    9099:                      while test -h "$potlib" 2>/dev/null; do
1.1.1.3 ! misho    9100:                        potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
1.1       misho    9101:                        case $potliblink in
1.1.1.3 ! misho    9102:                        [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
        !          9103:                        *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
1.1       misho    9104:                        esac
                   9105:                      done
                   9106:                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
                   9107:                         $SED -e 10q |
                   9108:                         $EGREP "$file_magic_regex" > /dev/null; then
                   9109:                        func_append newdeplibs " $a_deplib"
1.1.1.3 ! misho    9110:                        a_deplib=
1.1       misho    9111:                        break 2
                   9112:                      fi
                   9113:                  done
                   9114:                done
                   9115:              fi
1.1.1.3 ! misho    9116:              if test -n "$a_deplib"; then
1.1       misho    9117:                droppeddeps=yes
                   9118:                echo
                   9119:                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
                   9120:                echo "*** I have the capability to make that library automatically link in when"
                   9121:                echo "*** you link to this library.  But I can only do this if you have a"
                   9122:                echo "*** shared version of the library, which you do not appear to have"
                   9123:                echo "*** because I did check the linker path looking for a file starting"
1.1.1.3 ! misho    9124:                if test -z "$potlib"; then
1.1       misho    9125:                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
                   9126:                else
                   9127:                  $ECHO "*** with $libname and none of the candidates passed a file format test"
                   9128:                  $ECHO "*** using a file magic. Last file checked: $potlib"
                   9129:                fi
                   9130:              fi
                   9131:              ;;
                   9132:            *)
                   9133:              # Add a -L argument.
                   9134:              func_append newdeplibs " $a_deplib"
                   9135:              ;;
                   9136:            esac
                   9137:          done # Gone through all deplibs.
                   9138:          ;;
                   9139:        match_pattern*)
                   9140:          set dummy $deplibs_check_method; shift
                   9141:          match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
                   9142:          for a_deplib in $deplibs; do
                   9143:            case $a_deplib in
                   9144:            -l*)
                   9145:              func_stripname -l '' "$a_deplib"
                   9146:              name=$func_stripname_result
1.1.1.3 ! misho    9147:              if test yes = "$allow_libtool_libs_with_static_runtimes"; then
1.1       misho    9148:                case " $predeps $postdeps " in
                   9149:                *" $a_deplib "*)
                   9150:                  func_append newdeplibs " $a_deplib"
1.1.1.3 ! misho    9151:                  a_deplib=
1.1       misho    9152:                  ;;
                   9153:                esac
                   9154:              fi
1.1.1.3 ! misho    9155:              if test -n "$a_deplib"; then
1.1       misho    9156:                libname=`eval "\\$ECHO \"$libname_spec\""`
                   9157:                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
                   9158:                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                   9159:                  for potent_lib in $potential_libs; do
1.1.1.3 ! misho    9160:                    potlib=$potent_lib # see symlink-check above in file_magic test
1.1       misho    9161:                    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
                   9162:                       $EGREP "$match_pattern_regex" > /dev/null; then
                   9163:                      func_append newdeplibs " $a_deplib"
1.1.1.3 ! misho    9164:                      a_deplib=
1.1       misho    9165:                      break 2
                   9166:                    fi
                   9167:                  done
                   9168:                done
                   9169:              fi
1.1.1.3 ! misho    9170:              if test -n "$a_deplib"; then
1.1       misho    9171:                droppeddeps=yes
                   9172:                echo
                   9173:                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
                   9174:                echo "*** I have the capability to make that library automatically link in when"
                   9175:                echo "*** you link to this library.  But I can only do this if you have a"
                   9176:                echo "*** shared version of the library, which you do not appear to have"
                   9177:                echo "*** because I did check the linker path looking for a file starting"
1.1.1.3 ! misho    9178:                if test -z "$potlib"; then
1.1       misho    9179:                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
                   9180:                else
                   9181:                  $ECHO "*** with $libname and none of the candidates passed a file format test"
                   9182:                  $ECHO "*** using a regex pattern. Last file checked: $potlib"
                   9183:                fi
                   9184:              fi
                   9185:              ;;
                   9186:            *)
                   9187:              # Add a -L argument.
                   9188:              func_append newdeplibs " $a_deplib"
                   9189:              ;;
                   9190:            esac
                   9191:          done # Gone through all deplibs.
                   9192:          ;;
                   9193:        none | unknown | *)
1.1.1.3 ! misho    9194:          newdeplibs=
1.1       misho    9195:          tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
1.1.1.3 ! misho    9196:          if test yes = "$allow_libtool_libs_with_static_runtimes"; then
        !          9197:            for i in $predeps $postdeps; do
1.1       misho    9198:              # can't use Xsed below, because $i might contain '/'
1.1.1.3 ! misho    9199:              tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
1.1       misho    9200:            done
                   9201:          fi
                   9202:          case $tmp_deplibs in
                   9203:          *[!\  \ ]*)
                   9204:            echo
1.1.1.3 ! misho    9205:            if test none = "$deplibs_check_method"; then
1.1       misho    9206:              echo "*** Warning: inter-library dependencies are not supported in this platform."
                   9207:            else
                   9208:              echo "*** Warning: inter-library dependencies are not known to be supported."
                   9209:            fi
                   9210:            echo "*** All declared inter-library dependencies are being dropped."
                   9211:            droppeddeps=yes
                   9212:            ;;
                   9213:          esac
                   9214:          ;;
                   9215:        esac
                   9216:        versuffix=$versuffix_save
                   9217:        major=$major_save
                   9218:        release=$release_save
                   9219:        libname=$libname_save
                   9220:        name=$name_save
                   9221: 
                   9222:        case $host in
                   9223:        *-*-rhapsody* | *-*-darwin1.[012])
                   9224:          # On Rhapsody replace the C library with the System framework
                   9225:          newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
                   9226:          ;;
                   9227:        esac
                   9228: 
1.1.1.3 ! misho    9229:        if test yes = "$droppeddeps"; then
        !          9230:          if test yes = "$module"; then
1.1       misho    9231:            echo
                   9232:            echo "*** Warning: libtool could not satisfy all declared inter-library"
                   9233:            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
                   9234:            echo "*** a static module, that should work as long as the dlopening"
                   9235:            echo "*** application is linked with the -dlopen flag."
                   9236:            if test -z "$global_symbol_pipe"; then
                   9237:              echo
                   9238:              echo "*** However, this would only work if libtool was able to extract symbol"
1.1.1.3 ! misho    9239:              echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
1.1       misho    9240:              echo "*** not find such a program.  So, this module is probably useless."
1.1.1.3 ! misho    9241:              echo "*** 'nm' from GNU binutils and a full rebuild may help."
1.1       misho    9242:            fi
1.1.1.3 ! misho    9243:            if test no = "$build_old_libs"; then
        !          9244:              oldlibs=$output_objdir/$libname.$libext
1.1       misho    9245:              build_libtool_libs=module
                   9246:              build_old_libs=yes
                   9247:            else
                   9248:              build_libtool_libs=no
                   9249:            fi
                   9250:          else
                   9251:            echo "*** The inter-library dependencies that have been dropped here will be"
                   9252:            echo "*** automatically added whenever a program is linked with this library"
                   9253:            echo "*** or is declared to -dlopen it."
                   9254: 
1.1.1.3 ! misho    9255:            if test no = "$allow_undefined"; then
1.1       misho    9256:              echo
                   9257:              echo "*** Since this library must not contain undefined symbols,"
                   9258:              echo "*** because either the platform does not support them or"
                   9259:              echo "*** it was explicitly requested with -no-undefined,"
                   9260:              echo "*** libtool will only create a static version of it."
1.1.1.3 ! misho    9261:              if test no = "$build_old_libs"; then
        !          9262:                oldlibs=$output_objdir/$libname.$libext
1.1       misho    9263:                build_libtool_libs=module
                   9264:                build_old_libs=yes
                   9265:              else
                   9266:                build_libtool_libs=no
                   9267:              fi
                   9268:            fi
                   9269:          fi
                   9270:        fi
                   9271:        # Done checking deplibs!
                   9272:        deplibs=$newdeplibs
                   9273:       fi
                   9274:       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
                   9275:       case $host in
                   9276:        *-*-darwin*)
                   9277:          newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   9278:          new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   9279:          deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   9280:          ;;
                   9281:       esac
                   9282: 
                   9283:       # move library search paths that coincide with paths to not yet
                   9284:       # installed libraries to the beginning of the library search list
                   9285:       new_libs=
                   9286:       for path in $notinst_path; do
                   9287:        case " $new_libs " in
                   9288:        *" -L$path/$objdir "*) ;;
                   9289:        *)
                   9290:          case " $deplibs " in
                   9291:          *" -L$path/$objdir "*)
                   9292:            func_append new_libs " -L$path/$objdir" ;;
                   9293:          esac
                   9294:          ;;
                   9295:        esac
                   9296:       done
                   9297:       for deplib in $deplibs; do
                   9298:        case $deplib in
                   9299:        -L*)
                   9300:          case " $new_libs " in
                   9301:          *" $deplib "*) ;;
                   9302:          *) func_append new_libs " $deplib" ;;
                   9303:          esac
                   9304:          ;;
                   9305:        *) func_append new_libs " $deplib" ;;
                   9306:        esac
                   9307:       done
1.1.1.3 ! misho    9308:       deplibs=$new_libs
1.1       misho    9309: 
                   9310:       # All the library-specific variables (install_libdir is set above).
                   9311:       library_names=
                   9312:       old_library=
                   9313:       dlname=
                   9314: 
                   9315:       # Test again, we may have decided not to build it any more
1.1.1.3 ! misho    9316:       if test yes = "$build_libtool_libs"; then
        !          9317:        # Remove $wl instances when linking with ld.
1.1.1.2   misho    9318:        # FIXME: should test the right _cmds variable.
                   9319:        case $archive_cmds in
                   9320:          *\$LD\ *) wl= ;;
                   9321:         esac
1.1.1.3 ! misho    9322:        if test yes = "$hardcode_into_libs"; then
1.1       misho    9323:          # Hardcode the library paths
                   9324:          hardcode_libdirs=
                   9325:          dep_rpath=
1.1.1.3 ! misho    9326:          rpath=$finalize_rpath
        !          9327:          test relink = "$opt_mode" || rpath=$compile_rpath$rpath
1.1       misho    9328:          for libdir in $rpath; do
                   9329:            if test -n "$hardcode_libdir_flag_spec"; then
                   9330:              if test -n "$hardcode_libdir_separator"; then
                   9331:                func_replace_sysroot "$libdir"
                   9332:                libdir=$func_replace_sysroot_result
                   9333:                if test -z "$hardcode_libdirs"; then
1.1.1.3 ! misho    9334:                  hardcode_libdirs=$libdir
1.1       misho    9335:                else
                   9336:                  # Just accumulate the unique libdirs.
                   9337:                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
                   9338:                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
                   9339:                    ;;
                   9340:                  *)
                   9341:                    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
                   9342:                    ;;
                   9343:                  esac
                   9344:                fi
                   9345:              else
                   9346:                eval flag=\"$hardcode_libdir_flag_spec\"
                   9347:                func_append dep_rpath " $flag"
                   9348:              fi
                   9349:            elif test -n "$runpath_var"; then
                   9350:              case "$perm_rpath " in
                   9351:              *" $libdir "*) ;;
1.1.1.2   misho    9352:              *) func_append perm_rpath " $libdir" ;;
1.1       misho    9353:              esac
                   9354:            fi
                   9355:          done
                   9356:          # Substitute the hardcoded libdirs into the rpath.
                   9357:          if test -n "$hardcode_libdir_separator" &&
                   9358:             test -n "$hardcode_libdirs"; then
1.1.1.3 ! misho    9359:            libdir=$hardcode_libdirs
1.1.1.2   misho    9360:            eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
1.1       misho    9361:          fi
                   9362:          if test -n "$runpath_var" && test -n "$perm_rpath"; then
                   9363:            # We should set the runpath_var.
                   9364:            rpath=
                   9365:            for dir in $perm_rpath; do
                   9366:              func_append rpath "$dir:"
                   9367:            done
                   9368:            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
                   9369:          fi
                   9370:          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
                   9371:        fi
                   9372: 
1.1.1.3 ! misho    9373:        shlibpath=$finalize_shlibpath
        !          9374:        test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
1.1       misho    9375:        if test -n "$shlibpath"; then
                   9376:          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
                   9377:        fi
                   9378: 
                   9379:        # Get the real and link names of the library.
                   9380:        eval shared_ext=\"$shrext_cmds\"
                   9381:        eval library_names=\"$library_names_spec\"
                   9382:        set dummy $library_names
                   9383:        shift
1.1.1.3 ! misho    9384:        realname=$1
1.1       misho    9385:        shift
                   9386: 
                   9387:        if test -n "$soname_spec"; then
                   9388:          eval soname=\"$soname_spec\"
                   9389:        else
1.1.1.3 ! misho    9390:          soname=$realname
1.1       misho    9391:        fi
                   9392:        if test -z "$dlname"; then
                   9393:          dlname=$soname
                   9394:        fi
                   9395: 
1.1.1.3 ! misho    9396:        lib=$output_objdir/$realname
1.1       misho    9397:        linknames=
                   9398:        for link
                   9399:        do
                   9400:          func_append linknames " $link"
                   9401:        done
                   9402: 
                   9403:        # Use standard objects if they are pic
                   9404:        test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
                   9405:        test "X$libobjs" = "X " && libobjs=
                   9406: 
                   9407:        delfiles=
                   9408:        if test -n "$export_symbols" && test -n "$include_expsyms"; then
                   9409:          $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
1.1.1.3 ! misho    9410:          export_symbols=$output_objdir/$libname.uexp
1.1       misho    9411:          func_append delfiles " $export_symbols"
                   9412:        fi
                   9413: 
                   9414:        orig_export_symbols=
                   9415:        case $host_os in
                   9416:        cygwin* | mingw* | cegcc*)
                   9417:          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
                   9418:            # exporting using user supplied symfile
1.1.1.3 ! misho    9419:            func_dll_def_p "$export_symbols" || {
1.1       misho    9420:              # and it's NOT already a .def file. Must figure out
                   9421:              # which of the given symbols are data symbols and tag
                   9422:              # them as such. So, trigger use of export_symbols_cmds.
                   9423:              # export_symbols gets reassigned inside the "prepare
                   9424:              # the list of exported symbols" if statement, so the
                   9425:              # include_expsyms logic still works.
1.1.1.3 ! misho    9426:              orig_export_symbols=$export_symbols
1.1       misho    9427:              export_symbols=
                   9428:              always_export_symbols=yes
1.1.1.3 ! misho    9429:            }
1.1       misho    9430:          fi
                   9431:          ;;
                   9432:        esac
                   9433: 
                   9434:        # Prepare the list of exported symbols
                   9435:        if test -z "$export_symbols"; then
1.1.1.3 ! misho    9436:          if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
        !          9437:            func_verbose "generating symbol list for '$libname.la'"
        !          9438:            export_symbols=$output_objdir/$libname.exp
1.1       misho    9439:            $opt_dry_run || $RM $export_symbols
                   9440:            cmds=$export_symbols_cmds
1.1.1.3 ! misho    9441:            save_ifs=$IFS; IFS='~'
1.1       misho    9442:            for cmd1 in $cmds; do
1.1.1.3 ! misho    9443:              IFS=$save_ifs
1.1       misho    9444:              # Take the normal branch if the nm_file_list_spec branch
                   9445:              # doesn't work or if tool conversion is not needed.
                   9446:              case $nm_file_list_spec~$to_tool_file_cmd in
                   9447:                *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
                   9448:                  try_normal_branch=yes
                   9449:                  eval cmd=\"$cmd1\"
                   9450:                  func_len " $cmd"
                   9451:                  len=$func_len_result
                   9452:                  ;;
                   9453:                *)
                   9454:                  try_normal_branch=no
                   9455:                  ;;
                   9456:              esac
1.1.1.3 ! misho    9457:              if test yes = "$try_normal_branch" \
1.1       misho    9458:                 && { test "$len" -lt "$max_cmd_len" \
                   9459:                      || test "$max_cmd_len" -le -1; }
                   9460:              then
                   9461:                func_show_eval "$cmd" 'exit $?'
                   9462:                skipped_export=false
                   9463:              elif test -n "$nm_file_list_spec"; then
                   9464:                func_basename "$output"
                   9465:                output_la=$func_basename_result
                   9466:                save_libobjs=$libobjs
                   9467:                save_output=$output
1.1.1.3 ! misho    9468:                output=$output_objdir/$output_la.nm
1.1       misho    9469:                func_to_tool_file "$output"
                   9470:                libobjs=$nm_file_list_spec$func_to_tool_file_result
                   9471:                func_append delfiles " $output"
                   9472:                func_verbose "creating $NM input file list: $output"
                   9473:                for obj in $save_libobjs; do
                   9474:                  func_to_tool_file "$obj"
                   9475:                  $ECHO "$func_to_tool_file_result"
                   9476:                done > "$output"
                   9477:                eval cmd=\"$cmd1\"
                   9478:                func_show_eval "$cmd" 'exit $?'
                   9479:                output=$save_output
                   9480:                libobjs=$save_libobjs
                   9481:                skipped_export=false
                   9482:              else
                   9483:                # The command line is too long to execute in one step.
                   9484:                func_verbose "using reloadable object file for export list..."
                   9485:                skipped_export=:
                   9486:                # Break out early, otherwise skipped_export may be
                   9487:                # set to false by a later but shorter cmd.
                   9488:                break
                   9489:              fi
                   9490:            done
1.1.1.3 ! misho    9491:            IFS=$save_ifs
        !          9492:            if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
1.1       misho    9493:              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
                   9494:              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
                   9495:            fi
                   9496:          fi
                   9497:        fi
                   9498: 
                   9499:        if test -n "$export_symbols" && test -n "$include_expsyms"; then
1.1.1.3 ! misho    9500:          tmp_export_symbols=$export_symbols
        !          9501:          test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
1.1       misho    9502:          $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
                   9503:        fi
                   9504: 
1.1.1.3 ! misho    9505:        if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
1.1       misho    9506:          # The given exports_symbols file has to be filtered, so filter it.
1.1.1.3 ! misho    9507:          func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
1.1       misho    9508:          # FIXME: $output_objdir/$libname.filter potentially contains lots of
1.1.1.3 ! misho    9509:          # 's' commands, which not all seds can handle. GNU sed should be fine
1.1       misho    9510:          # though. Also, the filter scales superlinearly with the number of
                   9511:          # global variables. join(1) would be nice here, but unfortunately
                   9512:          # isn't a blessed tool.
                   9513:          $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
                   9514:          func_append delfiles " $export_symbols $output_objdir/$libname.filter"
                   9515:          export_symbols=$output_objdir/$libname.def
                   9516:          $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
                   9517:        fi
                   9518: 
                   9519:        tmp_deplibs=
                   9520:        for test_deplib in $deplibs; do
                   9521:          case " $convenience " in
                   9522:          *" $test_deplib "*) ;;
                   9523:          *)
                   9524:            func_append tmp_deplibs " $test_deplib"
                   9525:            ;;
                   9526:          esac
                   9527:        done
1.1.1.3 ! misho    9528:        deplibs=$tmp_deplibs
1.1       misho    9529: 
                   9530:        if test -n "$convenience"; then
                   9531:          if test -n "$whole_archive_flag_spec" &&
1.1.1.3 ! misho    9532:            test yes = "$compiler_needs_object" &&
1.1       misho    9533:            test -z "$libobjs"; then
                   9534:            # extract the archives, so we have objects to list.
                   9535:            # TODO: could optimize this to just extract one archive.
                   9536:            whole_archive_flag_spec=
                   9537:          fi
                   9538:          if test -n "$whole_archive_flag_spec"; then
                   9539:            save_libobjs=$libobjs
                   9540:            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
                   9541:            test "X$libobjs" = "X " && libobjs=
                   9542:          else
1.1.1.3 ! misho    9543:            gentop=$output_objdir/${outputname}x
1.1       misho    9544:            func_append generated " $gentop"
                   9545: 
                   9546:            func_extract_archives $gentop $convenience
                   9547:            func_append libobjs " $func_extract_archives_result"
                   9548:            test "X$libobjs" = "X " && libobjs=
                   9549:          fi
                   9550:        fi
                   9551: 
1.1.1.3 ! misho    9552:        if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
1.1       misho    9553:          eval flag=\"$thread_safe_flag_spec\"
                   9554:          func_append linker_flags " $flag"
                   9555:        fi
                   9556: 
                   9557:        # Make a backup of the uninstalled library when relinking
1.1.1.3 ! misho    9558:        if test relink = "$opt_mode"; then
1.1       misho    9559:          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
                   9560:        fi
                   9561: 
                   9562:        # Do each of the archive commands.
1.1.1.3 ! misho    9563:        if test yes = "$module" && test -n "$module_cmds"; then
1.1       misho    9564:          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
                   9565:            eval test_cmds=\"$module_expsym_cmds\"
                   9566:            cmds=$module_expsym_cmds
                   9567:          else
                   9568:            eval test_cmds=\"$module_cmds\"
                   9569:            cmds=$module_cmds
                   9570:          fi
                   9571:        else
                   9572:          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
                   9573:            eval test_cmds=\"$archive_expsym_cmds\"
                   9574:            cmds=$archive_expsym_cmds
                   9575:          else
                   9576:            eval test_cmds=\"$archive_cmds\"
                   9577:            cmds=$archive_cmds
                   9578:          fi
                   9579:        fi
                   9580: 
1.1.1.3 ! misho    9581:        if test : != "$skipped_export" &&
1.1       misho    9582:           func_len " $test_cmds" &&
                   9583:           len=$func_len_result &&
                   9584:           test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
                   9585:          :
                   9586:        else
                   9587:          # The command line is too long to link in one step, link piecewise
                   9588:          # or, if using GNU ld and skipped_export is not :, use a linker
                   9589:          # script.
                   9590: 
                   9591:          # Save the value of $output and $libobjs because we want to
                   9592:          # use them later.  If we have whole_archive_flag_spec, we
                   9593:          # want to use save_libobjs as it was before
                   9594:          # whole_archive_flag_spec was expanded, because we can't
                   9595:          # assume the linker understands whole_archive_flag_spec.
                   9596:          # This may have to be revisited, in case too many
                   9597:          # convenience libraries get linked in and end up exceeding
                   9598:          # the spec.
                   9599:          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
                   9600:            save_libobjs=$libobjs
                   9601:          fi
                   9602:          save_output=$output
                   9603:          func_basename "$output"
                   9604:          output_la=$func_basename_result
                   9605: 
                   9606:          # Clear the reloadable object creation command queue and
                   9607:          # initialize k to one.
                   9608:          test_cmds=
                   9609:          concat_cmds=
                   9610:          objlist=
                   9611:          last_robj=
                   9612:          k=1
                   9613: 
1.1.1.3 ! misho    9614:          if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
        !          9615:            output=$output_objdir/$output_la.lnkscript
1.1       misho    9616:            func_verbose "creating GNU ld script: $output"
                   9617:            echo 'INPUT (' > $output
                   9618:            for obj in $save_libobjs
                   9619:            do
                   9620:              func_to_tool_file "$obj"
                   9621:              $ECHO "$func_to_tool_file_result" >> $output
                   9622:            done
                   9623:            echo ')' >> $output
                   9624:            func_append delfiles " $output"
                   9625:            func_to_tool_file "$output"
                   9626:            output=$func_to_tool_file_result
1.1.1.3 ! misho    9627:          elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
        !          9628:            output=$output_objdir/$output_la.lnk
1.1       misho    9629:            func_verbose "creating linker input file list: $output"
                   9630:            : > $output
                   9631:            set x $save_libobjs
                   9632:            shift
                   9633:            firstobj=
1.1.1.3 ! misho    9634:            if test yes = "$compiler_needs_object"; then
1.1       misho    9635:              firstobj="$1 "
                   9636:              shift
                   9637:            fi
                   9638:            for obj
                   9639:            do
                   9640:              func_to_tool_file "$obj"
                   9641:              $ECHO "$func_to_tool_file_result" >> $output
                   9642:            done
                   9643:            func_append delfiles " $output"
                   9644:            func_to_tool_file "$output"
                   9645:            output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
                   9646:          else
                   9647:            if test -n "$save_libobjs"; then
                   9648:              func_verbose "creating reloadable object files..."
1.1.1.3 ! misho    9649:              output=$output_objdir/$output_la-$k.$objext
1.1       misho    9650:              eval test_cmds=\"$reload_cmds\"
                   9651:              func_len " $test_cmds"
                   9652:              len0=$func_len_result
                   9653:              len=$len0
                   9654: 
                   9655:              # Loop over the list of objects to be linked.
                   9656:              for obj in $save_libobjs
                   9657:              do
                   9658:                func_len " $obj"
                   9659:                func_arith $len + $func_len_result
                   9660:                len=$func_arith_result
1.1.1.3 ! misho    9661:                if test -z "$objlist" ||
1.1       misho    9662:                   test "$len" -lt "$max_cmd_len"; then
                   9663:                  func_append objlist " $obj"
                   9664:                else
                   9665:                  # The command $test_cmds is almost too long, add a
                   9666:                  # command to the queue.
1.1.1.3 ! misho    9667:                  if test 1 -eq "$k"; then
1.1       misho    9668:                    # The first file doesn't have a previous command to add.
                   9669:                    reload_objs=$objlist
                   9670:                    eval concat_cmds=\"$reload_cmds\"
                   9671:                  else
                   9672:                    # All subsequent reloadable object files will link in
                   9673:                    # the last one created.
                   9674:                    reload_objs="$objlist $last_robj"
                   9675:                    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
                   9676:                  fi
1.1.1.3 ! misho    9677:                  last_robj=$output_objdir/$output_la-$k.$objext
1.1       misho    9678:                  func_arith $k + 1
                   9679:                  k=$func_arith_result
1.1.1.3 ! misho    9680:                  output=$output_objdir/$output_la-$k.$objext
1.1       misho    9681:                  objlist=" $obj"
                   9682:                  func_len " $last_robj"
                   9683:                  func_arith $len0 + $func_len_result
                   9684:                  len=$func_arith_result
                   9685:                fi
                   9686:              done
                   9687:              # Handle the remaining objects by creating one last
                   9688:              # reloadable object file.  All subsequent reloadable object
                   9689:              # files will link in the last one created.
                   9690:              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
                   9691:              reload_objs="$objlist $last_robj"
1.1.1.3 ! misho    9692:              eval concat_cmds=\"\$concat_cmds$reload_cmds\"
1.1       misho    9693:              if test -n "$last_robj"; then
1.1.1.3 ! misho    9694:                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
1.1       misho    9695:              fi
                   9696:              func_append delfiles " $output"
                   9697: 
                   9698:            else
                   9699:              output=
                   9700:            fi
                   9701: 
1.1.1.3 ! misho    9702:            ${skipped_export-false} && {
        !          9703:              func_verbose "generating symbol list for '$libname.la'"
        !          9704:              export_symbols=$output_objdir/$libname.exp
1.1       misho    9705:              $opt_dry_run || $RM $export_symbols
                   9706:              libobjs=$output
                   9707:              # Append the command to create the export file.
                   9708:              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
                   9709:              eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
                   9710:              if test -n "$last_robj"; then
                   9711:                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
                   9712:              fi
1.1.1.3 ! misho    9713:            }
1.1       misho    9714: 
                   9715:            test -n "$save_libobjs" &&
                   9716:              func_verbose "creating a temporary reloadable object file: $output"
                   9717: 
                   9718:            # Loop through the commands generated above and execute them.
1.1.1.3 ! misho    9719:            save_ifs=$IFS; IFS='~'
1.1       misho    9720:            for cmd in $concat_cmds; do
1.1.1.3 ! misho    9721:              IFS=$save_ifs
        !          9722:              $opt_quiet || {
1.1       misho    9723:                  func_quote_for_expand "$cmd"
                   9724:                  eval "func_echo $func_quote_for_expand_result"
                   9725:              }
                   9726:              $opt_dry_run || eval "$cmd" || {
                   9727:                lt_exit=$?
                   9728: 
                   9729:                # Restore the uninstalled library and exit
1.1.1.3 ! misho    9730:                if test relink = "$opt_mode"; then
1.1       misho    9731:                  ( cd "$output_objdir" && \
                   9732:                    $RM "${realname}T" && \
                   9733:                    $MV "${realname}U" "$realname" )
                   9734:                fi
                   9735: 
                   9736:                exit $lt_exit
                   9737:              }
                   9738:            done
1.1.1.3 ! misho    9739:            IFS=$save_ifs
1.1       misho    9740: 
                   9741:            if test -n "$export_symbols_regex" && ${skipped_export-false}; then
                   9742:              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
                   9743:              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
                   9744:            fi
                   9745:          fi
                   9746: 
1.1.1.3 ! misho    9747:           ${skipped_export-false} && {
1.1       misho    9748:            if test -n "$export_symbols" && test -n "$include_expsyms"; then
1.1.1.3 ! misho    9749:              tmp_export_symbols=$export_symbols
        !          9750:              test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
1.1       misho    9751:              $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
                   9752:            fi
                   9753: 
                   9754:            if test -n "$orig_export_symbols"; then
                   9755:              # The given exports_symbols file has to be filtered, so filter it.
1.1.1.3 ! misho    9756:              func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
1.1       misho    9757:              # FIXME: $output_objdir/$libname.filter potentially contains lots of
1.1.1.3 ! misho    9758:              # 's' commands, which not all seds can handle. GNU sed should be fine
1.1       misho    9759:              # though. Also, the filter scales superlinearly with the number of
                   9760:              # global variables. join(1) would be nice here, but unfortunately
                   9761:              # isn't a blessed tool.
                   9762:              $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
                   9763:              func_append delfiles " $export_symbols $output_objdir/$libname.filter"
                   9764:              export_symbols=$output_objdir/$libname.def
                   9765:              $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
                   9766:            fi
1.1.1.3 ! misho    9767:          }
1.1       misho    9768: 
                   9769:          libobjs=$output
                   9770:          # Restore the value of output.
                   9771:          output=$save_output
                   9772: 
                   9773:          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
                   9774:            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
                   9775:            test "X$libobjs" = "X " && libobjs=
                   9776:          fi
                   9777:          # Expand the library linking commands again to reset the
                   9778:          # value of $libobjs for piecewise linking.
                   9779: 
                   9780:          # Do each of the archive commands.
1.1.1.3 ! misho    9781:          if test yes = "$module" && test -n "$module_cmds"; then
1.1       misho    9782:            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
                   9783:              cmds=$module_expsym_cmds
                   9784:            else
                   9785:              cmds=$module_cmds
                   9786:            fi
                   9787:          else
                   9788:            if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
                   9789:              cmds=$archive_expsym_cmds
                   9790:            else
                   9791:              cmds=$archive_cmds
                   9792:            fi
                   9793:          fi
                   9794:        fi
                   9795: 
                   9796:        if test -n "$delfiles"; then
                   9797:          # Append the command to remove temporary files to $cmds.
                   9798:          eval cmds=\"\$cmds~\$RM $delfiles\"
                   9799:        fi
                   9800: 
                   9801:        # Add any objects from preloaded convenience libraries
                   9802:        if test -n "$dlprefiles"; then
1.1.1.3 ! misho    9803:          gentop=$output_objdir/${outputname}x
1.1       misho    9804:          func_append generated " $gentop"
                   9805: 
                   9806:          func_extract_archives $gentop $dlprefiles
                   9807:          func_append libobjs " $func_extract_archives_result"
                   9808:          test "X$libobjs" = "X " && libobjs=
                   9809:        fi
                   9810: 
1.1.1.3 ! misho    9811:        save_ifs=$IFS; IFS='~'
1.1       misho    9812:        for cmd in $cmds; do
1.1.1.3 ! misho    9813:          IFS=$sp$nl
1.1       misho    9814:          eval cmd=\"$cmd\"
1.1.1.3 ! misho    9815:          IFS=$save_ifs
        !          9816:          $opt_quiet || {
1.1       misho    9817:            func_quote_for_expand "$cmd"
                   9818:            eval "func_echo $func_quote_for_expand_result"
                   9819:          }
                   9820:          $opt_dry_run || eval "$cmd" || {
                   9821:            lt_exit=$?
                   9822: 
                   9823:            # Restore the uninstalled library and exit
1.1.1.3 ! misho    9824:            if test relink = "$opt_mode"; then
1.1       misho    9825:              ( cd "$output_objdir" && \
                   9826:                $RM "${realname}T" && \
                   9827:                $MV "${realname}U" "$realname" )
                   9828:            fi
                   9829: 
                   9830:            exit $lt_exit
                   9831:          }
                   9832:        done
1.1.1.3 ! misho    9833:        IFS=$save_ifs
1.1       misho    9834: 
                   9835:        # Restore the uninstalled library and exit
1.1.1.3 ! misho    9836:        if test relink = "$opt_mode"; then
1.1       misho    9837:          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
                   9838: 
                   9839:          if test -n "$convenience"; then
                   9840:            if test -z "$whole_archive_flag_spec"; then
                   9841:              func_show_eval '${RM}r "$gentop"'
                   9842:            fi
                   9843:          fi
                   9844: 
                   9845:          exit $EXIT_SUCCESS
                   9846:        fi
                   9847: 
                   9848:        # Create links to the real library.
                   9849:        for linkname in $linknames; do
                   9850:          if test "$realname" != "$linkname"; then
                   9851:            func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
                   9852:          fi
                   9853:        done
                   9854: 
                   9855:        # If -module or -export-dynamic was specified, set the dlname.
1.1.1.3 ! misho    9856:        if test yes = "$module" || test yes = "$export_dynamic"; then
1.1       misho    9857:          # On all known operating systems, these are identical.
1.1.1.3 ! misho    9858:          dlname=$soname
1.1       misho    9859:        fi
                   9860:       fi
                   9861:       ;;
                   9862: 
                   9863:     obj)
1.1.1.3 ! misho    9864:       if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
        !          9865:        func_warning "'-dlopen' is ignored for objects"
1.1       misho    9866:       fi
                   9867: 
                   9868:       case " $deplibs" in
                   9869:       *\ -l* | *\ -L*)
1.1.1.3 ! misho    9870:        func_warning "'-l' and '-L' are ignored for objects" ;;
1.1       misho    9871:       esac
                   9872: 
                   9873:       test -n "$rpath" && \
1.1.1.3 ! misho    9874:        func_warning "'-rpath' is ignored for objects"
1.1       misho    9875: 
                   9876:       test -n "$xrpath" && \
1.1.1.3 ! misho    9877:        func_warning "'-R' is ignored for objects"
1.1       misho    9878: 
                   9879:       test -n "$vinfo" && \
1.1.1.3 ! misho    9880:        func_warning "'-version-info' is ignored for objects"
1.1       misho    9881: 
                   9882:       test -n "$release" && \
1.1.1.3 ! misho    9883:        func_warning "'-release' is ignored for objects"
1.1       misho    9884: 
                   9885:       case $output in
                   9886:       *.lo)
                   9887:        test -n "$objs$old_deplibs" && \
1.1.1.3 ! misho    9888:          func_fatal_error "cannot build library object '$output' from non-libtool objects"
1.1       misho    9889: 
                   9890:        libobj=$output
                   9891:        func_lo2o "$libobj"
                   9892:        obj=$func_lo2o_result
                   9893:        ;;
                   9894:       *)
                   9895:        libobj=
1.1.1.3 ! misho    9896:        obj=$output
1.1       misho    9897:        ;;
                   9898:       esac
                   9899: 
                   9900:       # Delete the old objects.
                   9901:       $opt_dry_run || $RM $obj $libobj
                   9902: 
                   9903:       # Objects from convenience libraries.  This assumes
                   9904:       # single-version convenience libraries.  Whenever we create
                   9905:       # different ones for PIC/non-PIC, this we'll have to duplicate
                   9906:       # the extraction.
                   9907:       reload_conv_objs=
                   9908:       gentop=
                   9909:       # reload_cmds runs $LD directly, so let us get rid of
                   9910:       # -Wl from whole_archive_flag_spec and hope we can get by with
                   9911:       # turning comma into space..
                   9912:       wl=
                   9913: 
                   9914:       if test -n "$convenience"; then
                   9915:        if test -n "$whole_archive_flag_spec"; then
                   9916:          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
                   9917:          reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
                   9918:        else
1.1.1.3 ! misho    9919:          gentop=$output_objdir/${obj}x
1.1       misho    9920:          func_append generated " $gentop"
                   9921: 
                   9922:          func_extract_archives $gentop $convenience
                   9923:          reload_conv_objs="$reload_objs $func_extract_archives_result"
                   9924:        fi
                   9925:       fi
                   9926: 
                   9927:       # If we're not building shared, we need to use non_pic_objs
1.1.1.3 ! misho    9928:       test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
1.1       misho    9929: 
                   9930:       # Create the old-style object.
1.1.1.3 ! misho    9931:       reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
1.1       misho    9932: 
1.1.1.3 ! misho    9933:       output=$obj
1.1       misho    9934:       func_execute_cmds "$reload_cmds" 'exit $?'
                   9935: 
                   9936:       # Exit if we aren't doing a library object file.
                   9937:       if test -z "$libobj"; then
                   9938:        if test -n "$gentop"; then
                   9939:          func_show_eval '${RM}r "$gentop"'
                   9940:        fi
                   9941: 
                   9942:        exit $EXIT_SUCCESS
                   9943:       fi
                   9944: 
1.1.1.3 ! misho    9945:       test yes = "$build_libtool_libs" || {
1.1       misho    9946:        if test -n "$gentop"; then
                   9947:          func_show_eval '${RM}r "$gentop"'
                   9948:        fi
                   9949: 
                   9950:        # Create an invalid libtool object if no PIC, so that we don't
                   9951:        # accidentally link it into a program.
                   9952:        # $show "echo timestamp > $libobj"
                   9953:        # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
                   9954:        exit $EXIT_SUCCESS
1.1.1.3 ! misho    9955:       }
1.1       misho    9956: 
1.1.1.3 ! misho    9957:       if test -n "$pic_flag" || test default != "$pic_mode"; then
1.1       misho    9958:        # Only do commands if we really have different PIC objects.
                   9959:        reload_objs="$libobjs $reload_conv_objs"
1.1.1.3 ! misho    9960:        output=$libobj
1.1       misho    9961:        func_execute_cmds "$reload_cmds" 'exit $?'
                   9962:       fi
                   9963: 
                   9964:       if test -n "$gentop"; then
                   9965:        func_show_eval '${RM}r "$gentop"'
                   9966:       fi
                   9967: 
                   9968:       exit $EXIT_SUCCESS
                   9969:       ;;
                   9970: 
                   9971:     prog)
                   9972:       case $host in
                   9973:        *cygwin*) func_stripname '' '.exe' "$output"
                   9974:                  output=$func_stripname_result.exe;;
                   9975:       esac
                   9976:       test -n "$vinfo" && \
1.1.1.3 ! misho    9977:        func_warning "'-version-info' is ignored for programs"
1.1       misho    9978: 
                   9979:       test -n "$release" && \
1.1.1.3 ! misho    9980:        func_warning "'-release' is ignored for programs"
1.1       misho    9981: 
1.1.1.3 ! misho    9982:       $preload \
        !          9983:        && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
        !          9984:        && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
1.1       misho    9985: 
                   9986:       case $host in
                   9987:       *-*-rhapsody* | *-*-darwin1.[012])
                   9988:        # On Rhapsody replace the C library is the System framework
                   9989:        compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
                   9990:        finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
                   9991:        ;;
                   9992:       esac
                   9993: 
                   9994:       case $host in
                   9995:       *-*-darwin*)
                   9996:        # Don't allow lazy linking, it breaks C++ global constructors
                   9997:        # But is supposedly fixed on 10.4 or later (yay!).
1.1.1.3 ! misho    9998:        if test CXX = "$tagname"; then
1.1       misho    9999:          case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
                   10000:            10.[0123])
1.1.1.3 ! misho    10001:              func_append compile_command " $wl-bind_at_load"
        !          10002:              func_append finalize_command " $wl-bind_at_load"
1.1       misho    10003:            ;;
                   10004:          esac
                   10005:        fi
                   10006:        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
                   10007:        compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   10008:        finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
                   10009:        ;;
                   10010:       esac
                   10011: 
                   10012: 
                   10013:       # move library search paths that coincide with paths to not yet
                   10014:       # installed libraries to the beginning of the library search list
                   10015:       new_libs=
                   10016:       for path in $notinst_path; do
                   10017:        case " $new_libs " in
                   10018:        *" -L$path/$objdir "*) ;;
                   10019:        *)
                   10020:          case " $compile_deplibs " in
                   10021:          *" -L$path/$objdir "*)
                   10022:            func_append new_libs " -L$path/$objdir" ;;
                   10023:          esac
                   10024:          ;;
                   10025:        esac
                   10026:       done
                   10027:       for deplib in $compile_deplibs; do
                   10028:        case $deplib in
                   10029:        -L*)
                   10030:          case " $new_libs " in
                   10031:          *" $deplib "*) ;;
                   10032:          *) func_append new_libs " $deplib" ;;
                   10033:          esac
                   10034:          ;;
                   10035:        *) func_append new_libs " $deplib" ;;
                   10036:        esac
                   10037:       done
1.1.1.3 ! misho    10038:       compile_deplibs=$new_libs
1.1       misho    10039: 
                   10040: 
                   10041:       func_append compile_command " $compile_deplibs"
                   10042:       func_append finalize_command " $finalize_deplibs"
                   10043: 
                   10044:       if test -n "$rpath$xrpath"; then
                   10045:        # If the user specified any rpath flags, then add them.
                   10046:        for libdir in $rpath $xrpath; do
                   10047:          # This is the magic to use -rpath.
                   10048:          case "$finalize_rpath " in
                   10049:          *" $libdir "*) ;;
                   10050:          *) func_append finalize_rpath " $libdir" ;;
                   10051:          esac
                   10052:        done
                   10053:       fi
                   10054: 
                   10055:       # Now hardcode the library paths
                   10056:       rpath=
                   10057:       hardcode_libdirs=
                   10058:       for libdir in $compile_rpath $finalize_rpath; do
                   10059:        if test -n "$hardcode_libdir_flag_spec"; then
                   10060:          if test -n "$hardcode_libdir_separator"; then
                   10061:            if test -z "$hardcode_libdirs"; then
1.1.1.3 ! misho    10062:              hardcode_libdirs=$libdir
1.1       misho    10063:            else
                   10064:              # Just accumulate the unique libdirs.
                   10065:              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
                   10066:              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
                   10067:                ;;
                   10068:              *)
                   10069:                func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
                   10070:                ;;
                   10071:              esac
                   10072:            fi
                   10073:          else
                   10074:            eval flag=\"$hardcode_libdir_flag_spec\"
                   10075:            func_append rpath " $flag"
                   10076:          fi
                   10077:        elif test -n "$runpath_var"; then
                   10078:          case "$perm_rpath " in
                   10079:          *" $libdir "*) ;;
                   10080:          *) func_append perm_rpath " $libdir" ;;
                   10081:          esac
                   10082:        fi
                   10083:        case $host in
                   10084:        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
1.1.1.3 ! misho    10085:          testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
1.1       misho    10086:          case :$dllsearchpath: in
                   10087:          *":$libdir:"*) ;;
                   10088:          ::) dllsearchpath=$libdir;;
                   10089:          *) func_append dllsearchpath ":$libdir";;
                   10090:          esac
                   10091:          case :$dllsearchpath: in
                   10092:          *":$testbindir:"*) ;;
                   10093:          ::) dllsearchpath=$testbindir;;
                   10094:          *) func_append dllsearchpath ":$testbindir";;
                   10095:          esac
                   10096:          ;;
                   10097:        esac
                   10098:       done
                   10099:       # Substitute the hardcoded libdirs into the rpath.
                   10100:       if test -n "$hardcode_libdir_separator" &&
                   10101:         test -n "$hardcode_libdirs"; then
1.1.1.3 ! misho    10102:        libdir=$hardcode_libdirs
1.1       misho    10103:        eval rpath=\" $hardcode_libdir_flag_spec\"
                   10104:       fi
1.1.1.3 ! misho    10105:       compile_rpath=$rpath
1.1       misho    10106: 
                   10107:       rpath=
                   10108:       hardcode_libdirs=
                   10109:       for libdir in $finalize_rpath; do
                   10110:        if test -n "$hardcode_libdir_flag_spec"; then
                   10111:          if test -n "$hardcode_libdir_separator"; then
                   10112:            if test -z "$hardcode_libdirs"; then
1.1.1.3 ! misho    10113:              hardcode_libdirs=$libdir
1.1       misho    10114:            else
                   10115:              # Just accumulate the unique libdirs.
                   10116:              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
                   10117:              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
                   10118:                ;;
                   10119:              *)
                   10120:                func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
                   10121:                ;;
                   10122:              esac
                   10123:            fi
                   10124:          else
                   10125:            eval flag=\"$hardcode_libdir_flag_spec\"
                   10126:            func_append rpath " $flag"
                   10127:          fi
                   10128:        elif test -n "$runpath_var"; then
                   10129:          case "$finalize_perm_rpath " in
                   10130:          *" $libdir "*) ;;
                   10131:          *) func_append finalize_perm_rpath " $libdir" ;;
                   10132:          esac
                   10133:        fi
                   10134:       done
                   10135:       # Substitute the hardcoded libdirs into the rpath.
                   10136:       if test -n "$hardcode_libdir_separator" &&
                   10137:         test -n "$hardcode_libdirs"; then
1.1.1.3 ! misho    10138:        libdir=$hardcode_libdirs
1.1       misho    10139:        eval rpath=\" $hardcode_libdir_flag_spec\"
                   10140:       fi
1.1.1.3 ! misho    10141:       finalize_rpath=$rpath
1.1       misho    10142: 
1.1.1.3 ! misho    10143:       if test -n "$libobjs" && test yes = "$build_old_libs"; then
1.1       misho    10144:        # Transform all the library objects into standard objects.
                   10145:        compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
                   10146:        finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
                   10147:       fi
                   10148: 
1.1.1.3 ! misho    10149:       func_generate_dlsyms "$outputname" "@PROGRAM@" false
1.1       misho    10150: 
                   10151:       # template prelinking step
                   10152:       if test -n "$prelink_cmds"; then
                   10153:        func_execute_cmds "$prelink_cmds" 'exit $?'
                   10154:       fi
                   10155: 
1.1.1.3 ! misho    10156:       wrappers_required=:
1.1       misho    10157:       case $host in
                   10158:       *cegcc* | *mingw32ce*)
                   10159:         # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
1.1.1.3 ! misho    10160:         wrappers_required=false
1.1       misho    10161:         ;;
                   10162:       *cygwin* | *mingw* )
1.1.1.3 ! misho    10163:         test yes = "$build_libtool_libs" || wrappers_required=false
1.1       misho    10164:         ;;
                   10165:       *)
1.1.1.3 ! misho    10166:         if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
        !          10167:           wrappers_required=false
1.1       misho    10168:         fi
                   10169:         ;;
                   10170:       esac
1.1.1.3 ! misho    10171:       $wrappers_required || {
1.1       misho    10172:        # Replace the output file specification.
                   10173:        compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
1.1.1.3 ! misho    10174:        link_command=$compile_command$compile_rpath
1.1       misho    10175: 
                   10176:        # We have no uninstalled library dependencies, so finalize right now.
                   10177:        exit_status=0
                   10178:        func_show_eval "$link_command" 'exit_status=$?'
                   10179: 
                   10180:        if test -n "$postlink_cmds"; then
                   10181:          func_to_tool_file "$output"
                   10182:          postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
                   10183:          func_execute_cmds "$postlink_cmds" 'exit $?'
                   10184:        fi
                   10185: 
                   10186:        # Delete the generated files.
1.1.1.3 ! misho    10187:        if test -f "$output_objdir/${outputname}S.$objext"; then
        !          10188:          func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
1.1       misho    10189:        fi
                   10190: 
                   10191:        exit $exit_status
1.1.1.3 ! misho    10192:       }
1.1       misho    10193: 
                   10194:       if test -n "$compile_shlibpath$finalize_shlibpath"; then
                   10195:        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
                   10196:       fi
                   10197:       if test -n "$finalize_shlibpath"; then
                   10198:        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
                   10199:       fi
                   10200: 
                   10201:       compile_var=
                   10202:       finalize_var=
                   10203:       if test -n "$runpath_var"; then
                   10204:        if test -n "$perm_rpath"; then
                   10205:          # We should set the runpath_var.
                   10206:          rpath=
                   10207:          for dir in $perm_rpath; do
                   10208:            func_append rpath "$dir:"
                   10209:          done
                   10210:          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
                   10211:        fi
                   10212:        if test -n "$finalize_perm_rpath"; then
                   10213:          # We should set the runpath_var.
                   10214:          rpath=
                   10215:          for dir in $finalize_perm_rpath; do
                   10216:            func_append rpath "$dir:"
                   10217:          done
                   10218:          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
                   10219:        fi
                   10220:       fi
                   10221: 
1.1.1.3 ! misho    10222:       if test yes = "$no_install"; then
1.1       misho    10223:        # We don't need to create a wrapper script.
1.1.1.3 ! misho    10224:        link_command=$compile_var$compile_command$compile_rpath
1.1       misho    10225:        # Replace the output file specification.
                   10226:        link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
                   10227:        # Delete the old output file.
                   10228:        $opt_dry_run || $RM $output
                   10229:        # Link the executable and exit
                   10230:        func_show_eval "$link_command" 'exit $?'
                   10231: 
                   10232:        if test -n "$postlink_cmds"; then
                   10233:          func_to_tool_file "$output"
                   10234:          postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
                   10235:          func_execute_cmds "$postlink_cmds" 'exit $?'
                   10236:        fi
                   10237: 
                   10238:        exit $EXIT_SUCCESS
                   10239:       fi
                   10240: 
1.1.1.3 ! misho    10241:       case $hardcode_action,$fast_install in
        !          10242:         relink,*)
        !          10243:          # Fast installation is not supported
        !          10244:          link_command=$compile_var$compile_command$compile_rpath
        !          10245:          relink_command=$finalize_var$finalize_command$finalize_rpath
        !          10246: 
        !          10247:          func_warning "this platform does not like uninstalled shared libraries"
        !          10248:          func_warning "'$output' will be relinked during installation"
        !          10249:          ;;
        !          10250:         *,yes)
        !          10251:          link_command=$finalize_var$compile_command$finalize_rpath
        !          10252:          relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
        !          10253:           ;;
        !          10254:        *,no)
        !          10255:          link_command=$compile_var$compile_command$compile_rpath
        !          10256:          relink_command=$finalize_var$finalize_command$finalize_rpath
        !          10257:           ;;
        !          10258:        *,needless)
        !          10259:          link_command=$finalize_var$compile_command$finalize_rpath
        !          10260:          relink_command=
        !          10261:           ;;
        !          10262:       esac
1.1       misho    10263: 
                   10264:       # Replace the output file specification.
                   10265:       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
                   10266: 
                   10267:       # Delete the old output files.
                   10268:       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
                   10269: 
                   10270:       func_show_eval "$link_command" 'exit $?'
                   10271: 
                   10272:       if test -n "$postlink_cmds"; then
                   10273:        func_to_tool_file "$output_objdir/$outputname"
                   10274:        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'`
                   10275:        func_execute_cmds "$postlink_cmds" 'exit $?'
                   10276:       fi
                   10277: 
                   10278:       # Now create the wrapper script.
                   10279:       func_verbose "creating $output"
                   10280: 
                   10281:       # Quote the relink command for shipping.
                   10282:       if test -n "$relink_command"; then
                   10283:        # Preserve any variables that may affect compiler behavior
                   10284:        for var in $variables_saved_for_relink; do
                   10285:          if eval test -z \"\${$var+set}\"; then
                   10286:            relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
                   10287:          elif eval var_value=\$$var; test -z "$var_value"; then
                   10288:            relink_command="$var=; export $var; $relink_command"
                   10289:          else
                   10290:            func_quote_for_eval "$var_value"
                   10291:            relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
                   10292:          fi
                   10293:        done
                   10294:        relink_command="(cd `pwd`; $relink_command)"
                   10295:        relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
                   10296:       fi
                   10297: 
                   10298:       # Only actually do things if not in dry run mode.
                   10299:       $opt_dry_run || {
                   10300:        # win32 will think the script is a binary if it has
                   10301:        # a .exe suffix, so we strip it off here.
                   10302:        case $output in
                   10303:          *.exe) func_stripname '' '.exe' "$output"
                   10304:                 output=$func_stripname_result ;;
                   10305:        esac
                   10306:        # test for cygwin because mv fails w/o .exe extensions
                   10307:        case $host in
                   10308:          *cygwin*)
                   10309:            exeext=.exe
                   10310:            func_stripname '' '.exe' "$outputname"
                   10311:            outputname=$func_stripname_result ;;
                   10312:          *) exeext= ;;
                   10313:        esac
                   10314:        case $host in
                   10315:          *cygwin* | *mingw* )
                   10316:            func_dirname_and_basename "$output" "" "."
                   10317:            output_name=$func_basename_result
                   10318:            output_path=$func_dirname_result
1.1.1.3 ! misho    10319:            cwrappersource=$output_path/$objdir/lt-$output_name.c
        !          10320:            cwrapper=$output_path/$output_name.exe
1.1       misho    10321:            $RM $cwrappersource $cwrapper
                   10322:            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
                   10323: 
                   10324:            func_emit_cwrapperexe_src > $cwrappersource
                   10325: 
                   10326:            # The wrapper executable is built using the $host compiler,
                   10327:            # because it contains $host paths and files. If cross-
                   10328:            # compiling, it, like the target executable, must be
                   10329:            # executed on the $host or under an emulation environment.
                   10330:            $opt_dry_run || {
                   10331:              $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
                   10332:              $STRIP $cwrapper
                   10333:            }
                   10334: 
                   10335:            # Now, create the wrapper script for func_source use:
                   10336:            func_ltwrapper_scriptname $cwrapper
                   10337:            $RM $func_ltwrapper_scriptname_result
                   10338:            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
                   10339:            $opt_dry_run || {
                   10340:              # note: this script will not be executed, so do not chmod.
1.1.1.3 ! misho    10341:              if test "x$build" = "x$host"; then
1.1       misho    10342:                $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
                   10343:              else
                   10344:                func_emit_wrapper no > $func_ltwrapper_scriptname_result
                   10345:              fi
                   10346:            }
                   10347:          ;;
                   10348:          * )
                   10349:            $RM $output
                   10350:            trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
                   10351: 
                   10352:            func_emit_wrapper no > $output
                   10353:            chmod +x $output
                   10354:          ;;
                   10355:        esac
                   10356:       }
                   10357:       exit $EXIT_SUCCESS
                   10358:       ;;
                   10359:     esac
                   10360: 
                   10361:     # See if we need to build an old-fashioned archive.
                   10362:     for oldlib in $oldlibs; do
                   10363: 
1.1.1.3 ! misho    10364:       case $build_libtool_libs in
        !          10365:         convenience)
        !          10366:          oldobjs="$libobjs_save $symfileobj"
        !          10367:          addlibs=$convenience
1.1       misho    10368:          build_libtool_libs=no
1.1.1.3 ! misho    10369:          ;;
        !          10370:        module)
        !          10371:          oldobjs=$libobjs_save
        !          10372:          addlibs=$old_convenience
        !          10373:          build_libtool_libs=no
        !          10374:           ;;
        !          10375:        *)
1.1       misho    10376:          oldobjs="$old_deplibs $non_pic_objects"
1.1.1.3 ! misho    10377:          $preload && test -f "$symfileobj" \
        !          10378:            && func_append oldobjs " $symfileobj"
        !          10379:          addlibs=$old_convenience
        !          10380:          ;;
        !          10381:       esac
1.1       misho    10382: 
                   10383:       if test -n "$addlibs"; then
1.1.1.3 ! misho    10384:        gentop=$output_objdir/${outputname}x
1.1       misho    10385:        func_append generated " $gentop"
                   10386: 
                   10387:        func_extract_archives $gentop $addlibs
                   10388:        func_append oldobjs " $func_extract_archives_result"
                   10389:       fi
                   10390: 
                   10391:       # Do each command in the archive commands.
1.1.1.3 ! misho    10392:       if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
1.1       misho    10393:        cmds=$old_archive_from_new_cmds
                   10394:       else
                   10395: 
                   10396:        # Add any objects from preloaded convenience libraries
                   10397:        if test -n "$dlprefiles"; then
1.1.1.3 ! misho    10398:          gentop=$output_objdir/${outputname}x
1.1       misho    10399:          func_append generated " $gentop"
                   10400: 
                   10401:          func_extract_archives $gentop $dlprefiles
                   10402:          func_append oldobjs " $func_extract_archives_result"
                   10403:        fi
                   10404: 
                   10405:        # POSIX demands no paths to be encoded in archives.  We have
                   10406:        # to avoid creating archives with duplicate basenames if we
                   10407:        # might have to extract them afterwards, e.g., when creating a
                   10408:        # static archive out of a convenience library, or when linking
                   10409:        # the entirety of a libtool archive into another (currently
                   10410:        # not supported by libtool).
                   10411:        if (for obj in $oldobjs
                   10412:            do
                   10413:              func_basename "$obj"
                   10414:              $ECHO "$func_basename_result"
                   10415:            done | sort | sort -uc >/dev/null 2>&1); then
                   10416:          :
                   10417:        else
                   10418:          echo "copying selected object files to avoid basename conflicts..."
1.1.1.3 ! misho    10419:          gentop=$output_objdir/${outputname}x
1.1       misho    10420:          func_append generated " $gentop"
                   10421:          func_mkdir_p "$gentop"
                   10422:          save_oldobjs=$oldobjs
                   10423:          oldobjs=
                   10424:          counter=1
                   10425:          for obj in $save_oldobjs
                   10426:          do
                   10427:            func_basename "$obj"
1.1.1.3 ! misho    10428:            objbase=$func_basename_result
1.1       misho    10429:            case " $oldobjs " in
                   10430:            " ") oldobjs=$obj ;;
                   10431:            *[\ /]"$objbase "*)
                   10432:              while :; do
                   10433:                # Make sure we don't pick an alternate name that also
                   10434:                # overlaps.
                   10435:                newobj=lt$counter-$objbase
                   10436:                func_arith $counter + 1
                   10437:                counter=$func_arith_result
                   10438:                case " $oldobjs " in
                   10439:                *[\ /]"$newobj "*) ;;
                   10440:                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
                   10441:                esac
                   10442:              done
                   10443:              func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
                   10444:              func_append oldobjs " $gentop/$newobj"
                   10445:              ;;
                   10446:            *) func_append oldobjs " $obj" ;;
                   10447:            esac
                   10448:          done
                   10449:        fi
1.1.1.2   misho    10450:        func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
                   10451:        tool_oldlib=$func_to_tool_file_result
1.1       misho    10452:        eval cmds=\"$old_archive_cmds\"
                   10453: 
                   10454:        func_len " $cmds"
                   10455:        len=$func_len_result
                   10456:        if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
                   10457:          cmds=$old_archive_cmds
                   10458:        elif test -n "$archiver_list_spec"; then
                   10459:          func_verbose "using command file archive linking..."
                   10460:          for obj in $oldobjs
                   10461:          do
                   10462:            func_to_tool_file "$obj"
                   10463:            $ECHO "$func_to_tool_file_result"
                   10464:          done > $output_objdir/$libname.libcmd
                   10465:          func_to_tool_file "$output_objdir/$libname.libcmd"
                   10466:          oldobjs=" $archiver_list_spec$func_to_tool_file_result"
                   10467:          cmds=$old_archive_cmds
                   10468:        else
                   10469:          # the command line is too long to link in one step, link in parts
                   10470:          func_verbose "using piecewise archive linking..."
                   10471:          save_RANLIB=$RANLIB
                   10472:          RANLIB=:
                   10473:          objlist=
                   10474:          concat_cmds=
                   10475:          save_oldobjs=$oldobjs
                   10476:          oldobjs=
                   10477:          # Is there a better way of finding the last object in the list?
                   10478:          for obj in $save_oldobjs
                   10479:          do
                   10480:            last_oldobj=$obj
                   10481:          done
                   10482:          eval test_cmds=\"$old_archive_cmds\"
                   10483:          func_len " $test_cmds"
                   10484:          len0=$func_len_result
                   10485:          len=$len0
                   10486:          for obj in $save_oldobjs
                   10487:          do
                   10488:            func_len " $obj"
                   10489:            func_arith $len + $func_len_result
                   10490:            len=$func_arith_result
                   10491:            func_append objlist " $obj"
                   10492:            if test "$len" -lt "$max_cmd_len"; then
                   10493:              :
                   10494:            else
                   10495:              # the above command should be used before it gets too long
                   10496:              oldobjs=$objlist
1.1.1.3 ! misho    10497:              if test "$obj" = "$last_oldobj"; then
1.1       misho    10498:                RANLIB=$save_RANLIB
                   10499:              fi
                   10500:              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
1.1.1.3 ! misho    10501:              eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
1.1       misho    10502:              objlist=
                   10503:              len=$len0
                   10504:            fi
                   10505:          done
                   10506:          RANLIB=$save_RANLIB
                   10507:          oldobjs=$objlist
1.1.1.3 ! misho    10508:          if test -z "$oldobjs"; then
1.1       misho    10509:            eval cmds=\"\$concat_cmds\"
                   10510:          else
                   10511:            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
                   10512:          fi
                   10513:        fi
                   10514:       fi
                   10515:       func_execute_cmds "$cmds" 'exit $?'
                   10516:     done
                   10517: 
                   10518:     test -n "$generated" && \
                   10519:       func_show_eval "${RM}r$generated"
                   10520: 
                   10521:     # Now create the libtool archive.
                   10522:     case $output in
                   10523:     *.la)
                   10524:       old_library=
1.1.1.3 ! misho    10525:       test yes = "$build_old_libs" && old_library=$libname.$libext
1.1       misho    10526:       func_verbose "creating $output"
                   10527: 
                   10528:       # Preserve any variables that may affect compiler behavior
                   10529:       for var in $variables_saved_for_relink; do
                   10530:        if eval test -z \"\${$var+set}\"; then
                   10531:          relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
                   10532:        elif eval var_value=\$$var; test -z "$var_value"; then
                   10533:          relink_command="$var=; export $var; $relink_command"
                   10534:        else
                   10535:          func_quote_for_eval "$var_value"
                   10536:          relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
                   10537:        fi
                   10538:       done
                   10539:       # Quote the link command for shipping.
1.1.1.3 ! misho    10540:       relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
1.1       misho    10541:       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
1.1.1.3 ! misho    10542:       if test yes = "$hardcode_automatic"; then
1.1       misho    10543:        relink_command=
                   10544:       fi
                   10545: 
                   10546:       # Only create the output if not a dry run.
                   10547:       $opt_dry_run || {
                   10548:        for installed in no yes; do
1.1.1.3 ! misho    10549:          if test yes = "$installed"; then
1.1       misho    10550:            if test -z "$install_libdir"; then
                   10551:              break
                   10552:            fi
1.1.1.3 ! misho    10553:            output=$output_objdir/${outputname}i
1.1       misho    10554:            # Replace all uninstalled libtool libraries with the installed ones
                   10555:            newdependency_libs=
                   10556:            for deplib in $dependency_libs; do
                   10557:              case $deplib in
                   10558:              *.la)
                   10559:                func_basename "$deplib"
1.1.1.3 ! misho    10560:                name=$func_basename_result
1.1.1.2   misho    10561:                func_resolve_sysroot "$deplib"
1.1.1.3 ! misho    10562:                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
1.1       misho    10563:                test -z "$libdir" && \
1.1.1.3 ! misho    10564:                  func_fatal_error "'$deplib' is not a valid libtool archive"
1.1       misho    10565:                func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
                   10566:                ;;
                   10567:              -L*)
                   10568:                func_stripname -L '' "$deplib"
                   10569:                func_replace_sysroot "$func_stripname_result"
                   10570:                func_append newdependency_libs " -L$func_replace_sysroot_result"
                   10571:                ;;
                   10572:              -R*)
                   10573:                func_stripname -R '' "$deplib"
                   10574:                func_replace_sysroot "$func_stripname_result"
                   10575:                func_append newdependency_libs " -R$func_replace_sysroot_result"
                   10576:                ;;
                   10577:              *) func_append newdependency_libs " $deplib" ;;
                   10578:              esac
                   10579:            done
1.1.1.3 ! misho    10580:            dependency_libs=$newdependency_libs
1.1       misho    10581:            newdlfiles=
                   10582: 
                   10583:            for lib in $dlfiles; do
                   10584:              case $lib in
                   10585:              *.la)
                   10586:                func_basename "$lib"
1.1.1.3 ! misho    10587:                name=$func_basename_result
        !          10588:                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
1.1       misho    10589:                test -z "$libdir" && \
1.1.1.3 ! misho    10590:                  func_fatal_error "'$lib' is not a valid libtool archive"
1.1       misho    10591:                func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
                   10592:                ;;
                   10593:              *) func_append newdlfiles " $lib" ;;
                   10594:              esac
                   10595:            done
1.1.1.3 ! misho    10596:            dlfiles=$newdlfiles
1.1       misho    10597:            newdlprefiles=
                   10598:            for lib in $dlprefiles; do
                   10599:              case $lib in
                   10600:              *.la)
                   10601:                # Only pass preopened files to the pseudo-archive (for
                   10602:                # eventual linking with the app. that links it) if we
                   10603:                # didn't already link the preopened objects directly into
                   10604:                # the library:
                   10605:                func_basename "$lib"
1.1.1.3 ! misho    10606:                name=$func_basename_result
        !          10607:                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
1.1       misho    10608:                test -z "$libdir" && \
1.1.1.3 ! misho    10609:                  func_fatal_error "'$lib' is not a valid libtool archive"
1.1       misho    10610:                func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
                   10611:                ;;
                   10612:              esac
                   10613:            done
1.1.1.3 ! misho    10614:            dlprefiles=$newdlprefiles
1.1       misho    10615:          else
                   10616:            newdlfiles=
                   10617:            for lib in $dlfiles; do
                   10618:              case $lib in
1.1.1.3 ! misho    10619:                [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
1.1       misho    10620:                *) abs=`pwd`"/$lib" ;;
                   10621:              esac
                   10622:              func_append newdlfiles " $abs"
                   10623:            done
1.1.1.3 ! misho    10624:            dlfiles=$newdlfiles
1.1       misho    10625:            newdlprefiles=
                   10626:            for lib in $dlprefiles; do
                   10627:              case $lib in
1.1.1.3 ! misho    10628:                [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
1.1       misho    10629:                *) abs=`pwd`"/$lib" ;;
                   10630:              esac
                   10631:              func_append newdlprefiles " $abs"
                   10632:            done
1.1.1.3 ! misho    10633:            dlprefiles=$newdlprefiles
1.1       misho    10634:          fi
                   10635:          $RM $output
                   10636:          # place dlname in correct position for cygwin
                   10637:          # In fact, it would be nice if we could use this code for all target
                   10638:          # systems that can't hard-code library paths into their executables
                   10639:          # and that have no shared library path variable independent of PATH,
                   10640:          # but it turns out we can't easily determine that from inspecting
                   10641:          # libtool variables, so we have to hard-code the OSs to which it
                   10642:          # applies here; at the moment, that means platforms that use the PE
                   10643:          # object format with DLL files.  See the long comment at the top of
                   10644:          # tests/bindir.at for full details.
                   10645:          tdlname=$dlname
                   10646:          case $host,$output,$installed,$module,$dlname in
                   10647:            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
                   10648:              # If a -bindir argument was supplied, place the dll there.
1.1.1.3 ! misho    10649:              if test -n "$bindir"; then
1.1       misho    10650:                func_relative_path "$install_libdir" "$bindir"
1.1.1.3 ! misho    10651:                tdlname=$func_relative_path_result/$dlname
1.1       misho    10652:              else
                   10653:                # Otherwise fall back on heuristic.
                   10654:                tdlname=../bin/$dlname
                   10655:              fi
                   10656:              ;;
                   10657:          esac
                   10658:          $ECHO > $output "\
                   10659: # $outputname - a libtool library file
1.1.1.3 ! misho    10660: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1.1       misho    10661: #
                   10662: # Please DO NOT delete this file!
                   10663: # It is necessary for linking the library.
                   10664: 
                   10665: # The name that we can dlopen(3).
                   10666: dlname='$tdlname'
                   10667: 
                   10668: # Names of this library.
                   10669: library_names='$library_names'
                   10670: 
                   10671: # The name of the static archive.
                   10672: old_library='$old_library'
                   10673: 
1.1.1.3 ! misho    10674: # Linker flags that cannot go in dependency_libs.
1.1       misho    10675: inherited_linker_flags='$new_inherited_linker_flags'
                   10676: 
                   10677: # Libraries that this one depends upon.
                   10678: dependency_libs='$dependency_libs'
                   10679: 
                   10680: # Names of additional weak libraries provided by this library
                   10681: weak_library_names='$weak_libs'
                   10682: 
                   10683: # Version information for $libname.
                   10684: current=$current
                   10685: age=$age
                   10686: revision=$revision
                   10687: 
                   10688: # Is this an already installed library?
                   10689: installed=$installed
                   10690: 
                   10691: # Should we warn about portability when linking against -modules?
                   10692: shouldnotlink=$module
                   10693: 
                   10694: # Files to dlopen/dlpreopen
                   10695: dlopen='$dlfiles'
                   10696: dlpreopen='$dlprefiles'
                   10697: 
                   10698: # Directory that this library needs to be installed in:
                   10699: libdir='$install_libdir'"
1.1.1.3 ! misho    10700:          if test no,yes = "$installed,$need_relink"; then
1.1       misho    10701:            $ECHO >> $output "\
                   10702: relink_command=\"$relink_command\""
                   10703:          fi
                   10704:        done
                   10705:       }
                   10706: 
                   10707:       # Do a symbolic link so that the libtool archive can be found in
                   10708:       # LD_LIBRARY_PATH before the program is installed.
                   10709:       func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
                   10710:       ;;
                   10711:     esac
                   10712:     exit $EXIT_SUCCESS
                   10713: }
                   10714: 
1.1.1.3 ! misho    10715: if test link = "$opt_mode" || test relink = "$opt_mode"; then
        !          10716:   func_mode_link ${1+"$@"}
        !          10717: fi
1.1       misho    10718: 
                   10719: 
                   10720: # func_mode_uninstall arg...
                   10721: func_mode_uninstall ()
                   10722: {
1.1.1.3 ! misho    10723:     $debug_cmd
        !          10724: 
        !          10725:     RM=$nonopt
1.1       misho    10726:     files=
1.1.1.3 ! misho    10727:     rmforce=false
1.1       misho    10728:     exit_status=0
                   10729: 
                   10730:     # This variable tells wrapper scripts just to set variables rather
                   10731:     # than running their programs.
1.1.1.3 ! misho    10732:     libtool_install_magic=$magic
1.1       misho    10733: 
                   10734:     for arg
                   10735:     do
                   10736:       case $arg in
1.1.1.3 ! misho    10737:       -f) func_append RM " $arg"; rmforce=: ;;
1.1       misho    10738:       -*) func_append RM " $arg" ;;
                   10739:       *) func_append files " $arg" ;;
                   10740:       esac
                   10741:     done
                   10742: 
                   10743:     test -z "$RM" && \
                   10744:       func_fatal_help "you must specify an RM program"
                   10745: 
                   10746:     rmdirs=
                   10747: 
                   10748:     for file in $files; do
                   10749:       func_dirname "$file" "" "."
1.1.1.3 ! misho    10750:       dir=$func_dirname_result
        !          10751:       if test . = "$dir"; then
        !          10752:        odir=$objdir
1.1       misho    10753:       else
1.1.1.3 ! misho    10754:        odir=$dir/$objdir
1.1       misho    10755:       fi
                   10756:       func_basename "$file"
1.1.1.3 ! misho    10757:       name=$func_basename_result
        !          10758:       test uninstall = "$opt_mode" && odir=$dir
1.1       misho    10759: 
                   10760:       # Remember odir for removal later, being careful to avoid duplicates
1.1.1.3 ! misho    10761:       if test clean = "$opt_mode"; then
1.1       misho    10762:        case " $rmdirs " in
                   10763:          *" $odir "*) ;;
                   10764:          *) func_append rmdirs " $odir" ;;
                   10765:        esac
                   10766:       fi
                   10767: 
                   10768:       # Don't error if the file doesn't exist and rm -f was used.
                   10769:       if { test -L "$file"; } >/dev/null 2>&1 ||
                   10770:         { test -h "$file"; } >/dev/null 2>&1 ||
                   10771:         test -f "$file"; then
                   10772:        :
                   10773:       elif test -d "$file"; then
                   10774:        exit_status=1
                   10775:        continue
1.1.1.3 ! misho    10776:       elif $rmforce; then
1.1       misho    10777:        continue
                   10778:       fi
                   10779: 
1.1.1.3 ! misho    10780:       rmfiles=$file
1.1       misho    10781: 
                   10782:       case $name in
                   10783:       *.la)
                   10784:        # Possibly a libtool archive, so verify it.
                   10785:        if func_lalib_p "$file"; then
                   10786:          func_source $dir/$name
                   10787: 
                   10788:          # Delete the libtool libraries and symlinks.
                   10789:          for n in $library_names; do
                   10790:            func_append rmfiles " $odir/$n"
                   10791:          done
                   10792:          test -n "$old_library" && func_append rmfiles " $odir/$old_library"
                   10793: 
1.1.1.3 ! misho    10794:          case $opt_mode in
1.1       misho    10795:          clean)
                   10796:            case " $library_names " in
                   10797:            *" $dlname "*) ;;
                   10798:            *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
                   10799:            esac
                   10800:            test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
                   10801:            ;;
                   10802:          uninstall)
                   10803:            if test -n "$library_names"; then
                   10804:              # Do each command in the postuninstall commands.
1.1.1.3 ! misho    10805:              func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
1.1       misho    10806:            fi
                   10807: 
                   10808:            if test -n "$old_library"; then
                   10809:              # Do each command in the old_postuninstall commands.
1.1.1.3 ! misho    10810:              func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
1.1       misho    10811:            fi
                   10812:            # FIXME: should reinstall the best remaining shared library.
                   10813:            ;;
                   10814:          esac
                   10815:        fi
                   10816:        ;;
                   10817: 
                   10818:       *.lo)
                   10819:        # Possibly a libtool object, so verify it.
                   10820:        if func_lalib_p "$file"; then
                   10821: 
                   10822:          # Read the .lo file
                   10823:          func_source $dir/$name
                   10824: 
                   10825:          # Add PIC object to the list of files to remove.
1.1.1.3 ! misho    10826:          if test -n "$pic_object" && test none != "$pic_object"; then
1.1       misho    10827:            func_append rmfiles " $dir/$pic_object"
                   10828:          fi
                   10829: 
                   10830:          # Add non-PIC object to the list of files to remove.
1.1.1.3 ! misho    10831:          if test -n "$non_pic_object" && test none != "$non_pic_object"; then
1.1       misho    10832:            func_append rmfiles " $dir/$non_pic_object"
                   10833:          fi
                   10834:        fi
                   10835:        ;;
                   10836: 
                   10837:       *)
1.1.1.3 ! misho    10838:        if test clean = "$opt_mode"; then
1.1       misho    10839:          noexename=$name
                   10840:          case $file in
                   10841:          *.exe)
                   10842:            func_stripname '' '.exe' "$file"
                   10843:            file=$func_stripname_result
                   10844:            func_stripname '' '.exe' "$name"
                   10845:            noexename=$func_stripname_result
                   10846:            # $file with .exe has already been added to rmfiles,
                   10847:            # add $file without .exe
                   10848:            func_append rmfiles " $file"
                   10849:            ;;
                   10850:          esac
                   10851:          # Do a test to see if this is a libtool program.
                   10852:          if func_ltwrapper_p "$file"; then
                   10853:            if func_ltwrapper_executable_p "$file"; then
                   10854:              func_ltwrapper_scriptname "$file"
                   10855:              relink_command=
                   10856:              func_source $func_ltwrapper_scriptname_result
                   10857:              func_append rmfiles " $func_ltwrapper_scriptname_result"
                   10858:            else
                   10859:              relink_command=
                   10860:              func_source $dir/$noexename
                   10861:            fi
                   10862: 
                   10863:            # note $name still contains .exe if it was in $file originally
                   10864:            # as does the version of $file that was added into $rmfiles
1.1.1.3 ! misho    10865:            func_append rmfiles " $odir/$name $odir/${name}S.$objext"
        !          10866:            if test yes = "$fast_install" && test -n "$relink_command"; then
1.1       misho    10867:              func_append rmfiles " $odir/lt-$name"
                   10868:            fi
1.1.1.3 ! misho    10869:            if test "X$noexename" != "X$name"; then
        !          10870:              func_append rmfiles " $odir/lt-$noexename.c"
1.1       misho    10871:            fi
                   10872:          fi
                   10873:        fi
                   10874:        ;;
                   10875:       esac
                   10876:       func_show_eval "$RM $rmfiles" 'exit_status=1'
                   10877:     done
                   10878: 
1.1.1.3 ! misho    10879:     # Try to remove the $objdir's in the directories where we deleted files
1.1       misho    10880:     for dir in $rmdirs; do
                   10881:       if test -d "$dir"; then
                   10882:        func_show_eval "rmdir $dir >/dev/null 2>&1"
                   10883:       fi
                   10884:     done
                   10885: 
                   10886:     exit $exit_status
                   10887: }
                   10888: 
1.1.1.3 ! misho    10889: if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
        !          10890:   func_mode_uninstall ${1+"$@"}
        !          10891: fi
1.1       misho    10892: 
                   10893: test -z "$opt_mode" && {
1.1.1.3 ! misho    10894:   help=$generic_help
1.1       misho    10895:   func_fatal_help "you must specify a MODE"
                   10896: }
                   10897: 
                   10898: test -z "$exec_cmd" && \
1.1.1.3 ! misho    10899:   func_fatal_help "invalid operation mode '$opt_mode'"
1.1       misho    10900: 
                   10901: if test -n "$exec_cmd"; then
                   10902:   eval exec "$exec_cmd"
                   10903:   exit $EXIT_FAILURE
                   10904: fi
                   10905: 
                   10906: exit $exit_status
                   10907: 
                   10908: 
                   10909: # The TAGs below are defined such that we never get into a situation
1.1.1.3 ! misho    10910: # where we disable both kinds of libraries.  Given conflicting
1.1       misho    10911: # choices, we go for a static library, that is the most portable,
                   10912: # since we can't tell whether shared libraries were disabled because
                   10913: # the user asked for that or because the platform doesn't support
                   10914: # them.  This is particularly important on AIX, because we don't
                   10915: # support having both static and shared libraries enabled at the same
                   10916: # time on that platform, so we default to a shared-only configuration.
                   10917: # If a disable-shared tag is given, we'll fallback to a static-only
                   10918: # configuration.  But we'll never go from static-only to shared-only.
                   10919: 
                   10920: # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
                   10921: build_libtool_libs=no
                   10922: build_old_libs=yes
                   10923: # ### END LIBTOOL TAG CONFIG: disable-shared
                   10924: 
                   10925: # ### BEGIN LIBTOOL TAG CONFIG: disable-static
                   10926: build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
                   10927: # ### END LIBTOOL TAG CONFIG: disable-static
                   10928: 
                   10929: # Local Variables:
                   10930: # mode:shell-script
                   10931: # sh-indentation:2
                   10932: # End:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>