Chris@41: #! /bin/sh Chris@41: ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in Chris@41: ## by inline-source v2014-01-03.01 Chris@41: Chris@41: # libtool (GNU libtool) 2.4.6 Chris@41: # Provide generalized library-building support services. Chris@41: # Written by Gordon Matzigkeit , 1996 Chris@41: Chris@41: # Copyright (C) 1996-2015 Free Software Foundation, Inc. Chris@41: # This is free software; see the source for copying conditions. There is NO Chris@41: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Chris@41: Chris@41: # GNU Libtool is free software; you can redistribute it and/or modify Chris@41: # it under the terms of the GNU General Public License as published by Chris@41: # the Free Software Foundation; either version 2 of the License, or Chris@41: # (at your option) any later version. Chris@41: # Chris@41: # As a special exception to the GNU General Public License, Chris@41: # if you distribute this file as part of a program or library that Chris@41: # is built using GNU Libtool, you may include this file under the Chris@41: # same distribution terms that you use for the rest of that program. Chris@41: # Chris@41: # GNU Libtool is distributed in the hope that it will be useful, but Chris@41: # WITHOUT ANY WARRANTY; without even the implied warranty of Chris@41: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Chris@41: # General Public License for more details. Chris@41: # Chris@41: # You should have received a copy of the GNU General Public License Chris@41: # along with this program. If not, see . Chris@41: Chris@41: Chris@41: PROGRAM=libtool Chris@41: PACKAGE=libtool Chris@41: VERSION="2.4.6 Debian-2.4.6-2" Chris@41: package_revision=2.4.6 Chris@41: Chris@41: Chris@41: ## ------ ## Chris@41: ## Usage. ## Chris@41: ## ------ ## Chris@41: Chris@41: # Run './libtool --help' for help with using this script from the Chris@41: # command line. Chris@41: Chris@41: Chris@41: ## ------------------------------- ## Chris@41: ## User overridable command paths. ## Chris@41: ## ------------------------------- ## Chris@41: Chris@41: # After configure completes, it has a better idea of some of the Chris@41: # shell tools we need than the defaults used by the functions shared Chris@41: # with bootstrap, so set those here where they can still be over- Chris@41: # ridden by the user, but otherwise take precedence. Chris@41: Chris@41: : ${AUTOCONF="autoconf"} Chris@41: : ${AUTOMAKE="automake"} Chris@41: Chris@41: Chris@41: ## -------------------------- ## Chris@41: ## Source external libraries. ## Chris@41: ## -------------------------- ## Chris@41: Chris@41: # Much of our low-level functionality needs to be sourced from external Chris@41: # libraries, which are installed to $pkgauxdir. Chris@41: Chris@41: # Set a version string for this script. Chris@41: scriptversion=2015-01-20.17; # UTC Chris@41: Chris@41: # General shell script boiler plate, and helper functions. Chris@41: # Written by Gary V. Vaughan, 2004 Chris@41: Chris@41: # Copyright (C) 2004-2015 Free Software Foundation, Inc. Chris@41: # This is free software; see the source for copying conditions. There is NO Chris@41: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Chris@41: Chris@41: # This program is free software; you can redistribute it and/or modify Chris@41: # it under the terms of the GNU General Public License as published by Chris@41: # the Free Software Foundation; either version 3 of the License, or Chris@41: # (at your option) any later version. Chris@41: Chris@41: # As a special exception to the GNU General Public License, if you distribute Chris@41: # this file as part of a program or library that is built using GNU Libtool, Chris@41: # you may include this file under the same distribution terms that you use Chris@41: # for the rest of that program. Chris@41: Chris@41: # This program is distributed in the hope that it will be useful, Chris@41: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@41: # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU Chris@41: # General Public License for more details. Chris@41: Chris@41: # You should have received a copy of the GNU General Public License Chris@41: # along with this program. If not, see . Chris@41: Chris@41: # Please report bugs or propose patches to gary@gnu.org. Chris@41: Chris@41: Chris@41: ## ------ ## Chris@41: ## Usage. ## Chris@41: ## ------ ## Chris@41: Chris@41: # Evaluate this file near the top of your script to gain access to Chris@41: # the functions and variables defined here: Chris@41: # Chris@41: # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh Chris@41: # Chris@41: # If you need to override any of the default environment variable Chris@41: # settings, do that before evaluating this file. Chris@41: Chris@41: Chris@41: ## -------------------- ## Chris@41: ## Shell normalisation. ## Chris@41: ## -------------------- ## Chris@41: Chris@41: # Some shells need a little help to be as Bourne compatible as possible. Chris@41: # Before doing anything else, make sure all that help has been provided! Chris@41: Chris@41: DUALCASE=1; export DUALCASE # for MKS sh Chris@41: if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : Chris@41: emulate sh Chris@41: NULLCMD=: Chris@41: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which Chris@41: # is contrary to our usage. Disable this feature. Chris@41: alias -g '${1+"$@"}'='"$@"' Chris@41: setopt NO_GLOB_SUBST Chris@41: else Chris@41: case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac Chris@41: fi Chris@41: Chris@41: # NLS nuisances: We save the old values in case they are required later. Chris@41: _G_user_locale= Chris@41: _G_safe_locale= Chris@41: for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES Chris@41: do Chris@41: eval "if test set = \"\${$_G_var+set}\"; then Chris@41: save_$_G_var=\$$_G_var Chris@41: $_G_var=C Chris@41: export $_G_var Chris@41: _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" Chris@41: _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" Chris@41: fi" Chris@41: done Chris@41: Chris@41: # CDPATH. Chris@41: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH Chris@41: Chris@41: # Make sure IFS has a sensible default Chris@41: sp=' ' Chris@41: nl=' Chris@41: ' Chris@41: IFS="$sp $nl" Chris@41: Chris@41: # There are apparently some retarded systems that use ';' as a PATH separator! Chris@41: if test "${PATH_SEPARATOR+set}" != set; then Chris@41: PATH_SEPARATOR=: Chris@41: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { Chris@41: (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || Chris@41: PATH_SEPARATOR=';' Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: Chris@41: ## ------------------------- ## Chris@41: ## Locate command utilities. ## Chris@41: ## ------------------------- ## Chris@41: Chris@41: Chris@41: # func_executable_p FILE Chris@41: # ---------------------- Chris@41: # Check that FILE is an executable regular file. Chris@41: func_executable_p () Chris@41: { Chris@41: test -f "$1" && test -x "$1" Chris@41: } Chris@41: Chris@41: Chris@41: # func_path_progs PROGS_LIST CHECK_FUNC [PATH] Chris@41: # -------------------------------------------- Chris@41: # Search for either a program that responds to --version with output Chris@41: # containing "GNU", or else returned by CHECK_FUNC otherwise, by Chris@41: # trying all the directories in PATH with each of the elements of Chris@41: # PROGS_LIST. Chris@41: # Chris@41: # CHECK_FUNC should accept the path to a candidate program, and Chris@41: # set $func_check_prog_result if it truncates its output less than Chris@41: # $_G_path_prog_max characters. Chris@41: func_path_progs () Chris@41: { Chris@41: _G_progs_list=$1 Chris@41: _G_check_func=$2 Chris@41: _G_PATH=${3-"$PATH"} Chris@41: Chris@41: _G_path_prog_max=0 Chris@41: _G_path_prog_found=false Chris@41: _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} Chris@41: for _G_dir in $_G_PATH; do Chris@41: IFS=$_G_save_IFS Chris@41: test -z "$_G_dir" && _G_dir=. Chris@41: for _G_prog_name in $_G_progs_list; do Chris@41: for _exeext in '' .EXE; do Chris@41: _G_path_prog=$_G_dir/$_G_prog_name$_exeext Chris@41: func_executable_p "$_G_path_prog" || continue Chris@41: case `"$_G_path_prog" --version 2>&1` in Chris@41: *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; Chris@41: *) $_G_check_func $_G_path_prog Chris@41: func_path_progs_result=$func_check_prog_result Chris@41: ;; Chris@41: esac Chris@41: $_G_path_prog_found && break 3 Chris@41: done Chris@41: done Chris@41: done Chris@41: IFS=$_G_save_IFS Chris@41: test -z "$func_path_progs_result" && { Chris@41: echo "no acceptable sed could be found in \$PATH" >&2 Chris@41: exit 1 Chris@41: } Chris@41: } Chris@41: Chris@41: Chris@41: # We want to be able to use the functions in this file before configure Chris@41: # has figured out where the best binaries are kept, which means we have Chris@41: # to search for them ourselves - except when the results are already set Chris@41: # where we skip the searches. Chris@41: Chris@41: # Unless the user overrides by setting SED, search the path for either GNU Chris@41: # sed, or the sed that truncates its output the least. Chris@41: test -z "$SED" && { Chris@41: _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ Chris@41: for _G_i in 1 2 3 4 5 6 7; do Chris@41: _G_sed_script=$_G_sed_script$nl$_G_sed_script Chris@41: done Chris@41: echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed Chris@41: _G_sed_script= Chris@41: Chris@41: func_check_prog_sed () Chris@41: { Chris@41: _G_path_prog=$1 Chris@41: Chris@41: _G_count=0 Chris@41: printf 0123456789 >conftest.in Chris@41: while : Chris@41: do Chris@41: cat conftest.in conftest.in >conftest.tmp Chris@41: mv conftest.tmp conftest.in Chris@41: cp conftest.in conftest.nl Chris@41: echo '' >> conftest.nl Chris@41: "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break Chris@41: diff conftest.out conftest.nl >/dev/null 2>&1 || break Chris@41: _G_count=`expr $_G_count + 1` Chris@41: if test "$_G_count" -gt "$_G_path_prog_max"; then Chris@41: # Best one so far, save it but keep looking for a better one Chris@41: func_check_prog_result=$_G_path_prog Chris@41: _G_path_prog_max=$_G_count Chris@41: fi Chris@41: # 10*(2^10) chars as input seems more than enough Chris@41: test 10 -lt "$_G_count" && break Chris@41: done Chris@41: rm -f conftest.in conftest.tmp conftest.nl conftest.out Chris@41: } Chris@41: Chris@41: func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin Chris@41: rm -f conftest.sed Chris@41: SED=$func_path_progs_result Chris@41: } Chris@41: Chris@41: Chris@41: # Unless the user overrides by setting GREP, search the path for either GNU Chris@41: # grep, or the grep that truncates its output the least. Chris@41: test -z "$GREP" && { Chris@41: func_check_prog_grep () Chris@41: { Chris@41: _G_path_prog=$1 Chris@41: Chris@41: _G_count=0 Chris@41: _G_path_prog_max=0 Chris@41: printf 0123456789 >conftest.in Chris@41: while : Chris@41: do Chris@41: cat conftest.in conftest.in >conftest.tmp Chris@41: mv conftest.tmp conftest.in Chris@41: cp conftest.in conftest.nl Chris@41: echo 'GREP' >> conftest.nl Chris@41: "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break Chris@41: diff conftest.out conftest.nl >/dev/null 2>&1 || break Chris@41: _G_count=`expr $_G_count + 1` Chris@41: if test "$_G_count" -gt "$_G_path_prog_max"; then Chris@41: # Best one so far, save it but keep looking for a better one Chris@41: func_check_prog_result=$_G_path_prog Chris@41: _G_path_prog_max=$_G_count Chris@41: fi Chris@41: # 10*(2^10) chars as input seems more than enough Chris@41: test 10 -lt "$_G_count" && break Chris@41: done Chris@41: rm -f conftest.in conftest.tmp conftest.nl conftest.out Chris@41: } Chris@41: Chris@41: func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin Chris@41: GREP=$func_path_progs_result Chris@41: } Chris@41: Chris@41: Chris@41: ## ------------------------------- ## Chris@41: ## User overridable command paths. ## Chris@41: ## ------------------------------- ## Chris@41: Chris@41: # All uppercase variable names are used for environment variables. These Chris@41: # variables can be overridden by the user before calling a script that Chris@41: # uses them if a suitable command of that name is not already available Chris@41: # in the command search PATH. Chris@41: Chris@41: : ${CP="cp -f"} Chris@41: : ${ECHO="printf %s\n"} Chris@41: : ${EGREP="$GREP -E"} Chris@41: : ${FGREP="$GREP -F"} Chris@41: : ${LN_S="ln -s"} Chris@41: : ${MAKE="make"} Chris@41: : ${MKDIR="mkdir"} Chris@41: : ${MV="mv -f"} Chris@41: : ${RM="rm -f"} Chris@41: : ${SHELL="${CONFIG_SHELL-/bin/sh}"} Chris@41: Chris@41: Chris@41: ## -------------------- ## Chris@41: ## Useful sed snippets. ## Chris@41: ## -------------------- ## Chris@41: Chris@41: sed_dirname='s|/[^/]*$||' Chris@41: sed_basename='s|^.*/||' Chris@41: Chris@41: # Sed substitution that helps us do robust quoting. It backslashifies Chris@41: # metacharacters that are still active within double-quoted strings. Chris@41: sed_quote_subst='s|\([`"$\\]\)|\\\1|g' Chris@41: Chris@41: # Same as above, but do not quote variable references. Chris@41: sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' Chris@41: Chris@41: # Sed substitution that turns a string into a regex matching for the Chris@41: # string literally. Chris@41: sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' Chris@41: Chris@41: # Sed substitution that converts a w32 file name or path Chris@41: # that contains forward slashes, into one that contains Chris@41: # (escaped) backslashes. A very naive implementation. Chris@41: sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' Chris@41: Chris@41: # Re-'\' parameter expansions in output of sed_double_quote_subst that Chris@41: # were '\'-ed in input to the same. If an odd number of '\' preceded a Chris@41: # '$' in input to sed_double_quote_subst, that '$' was protected from Chris@41: # expansion. Since each input '\' is now two '\'s, look for any number Chris@41: # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. Chris@41: _G_bs='\\' Chris@41: _G_bs2='\\\\' Chris@41: _G_bs4='\\\\\\\\' Chris@41: _G_dollar='\$' Chris@41: sed_double_backslash="\ Chris@41: s/$_G_bs4/&\\ Chris@41: /g Chris@41: s/^$_G_bs2$_G_dollar/$_G_bs&/ Chris@41: s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g Chris@41: s/\n//g" Chris@41: Chris@41: Chris@41: ## ----------------- ## Chris@41: ## Global variables. ## Chris@41: ## ----------------- ## Chris@41: Chris@41: # Except for the global variables explicitly listed below, the following Chris@41: # functions in the '^func_' namespace, and the '^require_' namespace Chris@41: # variables initialised in the 'Resource management' section, sourcing Chris@41: # this file will not pollute your global namespace with anything Chris@41: # else. There's no portable way to scope variables in Bourne shell Chris@41: # though, so actually running these functions will sometimes place Chris@41: # results into a variable named after the function, and often use Chris@41: # temporary variables in the '^_G_' namespace. If you are careful to Chris@41: # avoid using those namespaces casually in your sourcing script, things Chris@41: # should continue to work as you expect. And, of course, you can freely Chris@41: # overwrite any of the functions or variables defined here before Chris@41: # calling anything to customize them. Chris@41: Chris@41: EXIT_SUCCESS=0 Chris@41: EXIT_FAILURE=1 Chris@41: EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. Chris@41: EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. Chris@41: Chris@41: # Allow overriding, eg assuming that you follow the convention of Chris@41: # putting '$debug_cmd' at the start of all your functions, you can get Chris@41: # bash to show function call trace with: Chris@41: # Chris@41: # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name Chris@41: debug_cmd=${debug_cmd-":"} Chris@41: exit_cmd=: Chris@41: Chris@41: # By convention, finish your script with: Chris@41: # Chris@41: # exit $exit_status Chris@41: # Chris@41: # so that you can set exit_status to non-zero if you want to indicate Chris@41: # something went wrong during execution without actually bailing out at Chris@41: # the point of failure. Chris@41: exit_status=$EXIT_SUCCESS Chris@41: Chris@41: # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh Chris@41: # is ksh but when the shell is invoked as "sh" and the current value of Chris@41: # the _XPG environment variable is not equal to 1 (one), the special Chris@41: # positional parameter $0, within a function call, is the name of the Chris@41: # function. Chris@41: progpath=$0 Chris@41: Chris@41: # The name of this program. Chris@41: progname=`$ECHO "$progpath" |$SED "$sed_basename"` Chris@41: Chris@41: # Make sure we have an absolute progpath for reexecution: Chris@41: case $progpath in Chris@41: [\\/]*|[A-Za-z]:\\*) ;; Chris@41: *[\\/]*) Chris@41: progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` Chris@41: progdir=`cd "$progdir" && pwd` Chris@41: progpath=$progdir/$progname Chris@41: ;; Chris@41: *) Chris@41: _G_IFS=$IFS Chris@41: IFS=${PATH_SEPARATOR-:} Chris@41: for progdir in $PATH; do Chris@41: IFS=$_G_IFS Chris@41: test -x "$progdir/$progname" && break Chris@41: done Chris@41: IFS=$_G_IFS Chris@41: test -n "$progdir" || progdir=`pwd` Chris@41: progpath=$progdir/$progname Chris@41: ;; Chris@41: esac Chris@41: Chris@41: Chris@41: ## ----------------- ## Chris@41: ## Standard options. ## Chris@41: ## ----------------- ## Chris@41: Chris@41: # The following options affect the operation of the functions defined Chris@41: # below, and should be set appropriately depending on run-time para- Chris@41: # meters passed on the command line. Chris@41: Chris@41: opt_dry_run=false Chris@41: opt_quiet=false Chris@41: opt_verbose=false Chris@41: Chris@41: # Categories 'all' and 'none' are always available. Append any others Chris@41: # you will pass as the first argument to func_warning from your own Chris@41: # code. Chris@41: warning_categories= Chris@41: Chris@41: # By default, display warnings according to 'opt_warning_types'. Set Chris@41: # 'warning_func' to ':' to elide all warnings, or func_fatal_error to Chris@41: # treat the next displayed warning as a fatal error. Chris@41: warning_func=func_warn_and_continue Chris@41: Chris@41: # Set to 'all' to display all warnings, 'none' to suppress all Chris@41: # warnings, or a space delimited list of some subset of Chris@41: # 'warning_categories' to display only the listed warnings. Chris@41: opt_warning_types=all Chris@41: Chris@41: Chris@41: ## -------------------- ## Chris@41: ## Resource management. ## Chris@41: ## -------------------- ## Chris@41: Chris@41: # This section contains definitions for functions that each ensure a Chris@41: # particular resource (a file, or a non-empty configuration variable for Chris@41: # example) is available, and if appropriate to extract default values Chris@41: # from pertinent package files. Call them using their associated Chris@41: # 'require_*' variable to ensure that they are executed, at most, once. Chris@41: # Chris@41: # It's entirely deliberate that calling these functions can set Chris@41: # variables that don't obey the namespace limitations obeyed by the rest Chris@41: # of this file, in order that that they be as useful as possible to Chris@41: # callers. Chris@41: Chris@41: Chris@41: # require_term_colors Chris@41: # ------------------- Chris@41: # Allow display of bold text on terminals that support it. Chris@41: require_term_colors=func_require_term_colors Chris@41: func_require_term_colors () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: test -t 1 && { Chris@41: # COLORTERM and USE_ANSI_COLORS environment variables take Chris@41: # precedence, because most terminfo databases neglect to describe Chris@41: # whether color sequences are supported. Chris@41: test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} Chris@41: Chris@41: if test 1 = "$USE_ANSI_COLORS"; then Chris@41: # Standard ANSI escape sequences Chris@41: tc_reset='' Chris@41: tc_bold=''; tc_standout='' Chris@41: tc_red=''; tc_green='' Chris@41: tc_blue=''; tc_cyan='' Chris@41: else Chris@41: # Otherwise trust the terminfo database after all. Chris@41: test -n "`tput sgr0 2>/dev/null`" && { Chris@41: tc_reset=`tput sgr0` Chris@41: test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` Chris@41: tc_standout=$tc_bold Chris@41: test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` Chris@41: test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` Chris@41: test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` Chris@41: test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` Chris@41: test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` Chris@41: } Chris@41: fi Chris@41: } Chris@41: Chris@41: require_term_colors=: Chris@41: } Chris@41: Chris@41: Chris@41: ## ----------------- ## Chris@41: ## Function library. ## Chris@41: ## ----------------- ## Chris@41: Chris@41: # This section contains a variety of useful functions to call in your Chris@41: # scripts. Take note of the portable wrappers for features provided by Chris@41: # some modern shells, which will fall back to slower equivalents on Chris@41: # less featureful shells. Chris@41: Chris@41: Chris@41: # func_append VAR VALUE Chris@41: # --------------------- Chris@41: # Append VALUE onto the existing contents of VAR. Chris@41: Chris@41: # We should try to minimise forks, especially on Windows where they are Chris@41: # unreasonably slow, so skip the feature probes when bash or zsh are Chris@41: # being used: Chris@41: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then Chris@41: : ${_G_HAVE_ARITH_OP="yes"} Chris@41: : ${_G_HAVE_XSI_OPS="yes"} Chris@41: # The += operator was introduced in bash 3.1 Chris@41: case $BASH_VERSION in Chris@41: [12].* | 3.0 | 3.0*) ;; Chris@41: *) Chris@41: : ${_G_HAVE_PLUSEQ_OP="yes"} Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: # _G_HAVE_PLUSEQ_OP Chris@41: # Can be empty, in which case the shell is probed, "yes" if += is Chris@41: # useable or anything else if it does not work. Chris@41: test -z "$_G_HAVE_PLUSEQ_OP" \ Chris@41: && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ Chris@41: && _G_HAVE_PLUSEQ_OP=yes Chris@41: Chris@41: if test yes = "$_G_HAVE_PLUSEQ_OP" Chris@41: then Chris@41: # This is an XSI compatible shell, allowing a faster implementation... Chris@41: eval 'func_append () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval "$1+=\$2" Chris@41: }' Chris@41: else Chris@41: # ...otherwise fall back to using expr, which is often a shell builtin. Chris@41: func_append () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval "$1=\$$1\$2" Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_append_quoted VAR VALUE Chris@41: # ---------------------------- Chris@41: # Quote VALUE and append to the end of shell variable VAR, separated Chris@41: # by a space. Chris@41: if test yes = "$_G_HAVE_PLUSEQ_OP"; then Chris@41: eval 'func_append_quoted () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_quote_for_eval "$2" Chris@41: eval "$1+=\\ \$func_quote_for_eval_result" Chris@41: }' Chris@41: else Chris@41: func_append_quoted () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_quote_for_eval "$2" Chris@41: eval "$1=\$$1\\ \$func_quote_for_eval_result" Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_append_uniq VAR VALUE Chris@41: # -------------------------- Chris@41: # Append unique VALUE onto the existing contents of VAR, assuming Chris@41: # entries are delimited by the first character of VALUE. For example: Chris@41: # Chris@41: # func_append_uniq options " --another-option option-argument" Chris@41: # Chris@41: # will only append to $options if " --another-option option-argument " Chris@41: # is not already present somewhere in $options already (note spaces at Chris@41: # each end implied by leading space in second argument). Chris@41: func_append_uniq () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval _G_current_value='`$ECHO $'$1'`' Chris@41: _G_delim=`expr "$2" : '\(.\)'` Chris@41: Chris@41: case $_G_delim$_G_current_value$_G_delim in Chris@41: *"$2$_G_delim"*) ;; Chris@41: *) func_append "$@" ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: Chris@41: # func_arith TERM... Chris@41: # ------------------ Chris@41: # Set func_arith_result to the result of evaluating TERMs. Chris@41: test -z "$_G_HAVE_ARITH_OP" \ Chris@41: && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ Chris@41: && _G_HAVE_ARITH_OP=yes Chris@41: Chris@41: if test yes = "$_G_HAVE_ARITH_OP"; then Chris@41: eval 'func_arith () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_arith_result=$(( $* )) Chris@41: }' Chris@41: else Chris@41: func_arith () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_arith_result=`expr "$@"` Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_basename FILE Chris@41: # ------------------ Chris@41: # Set func_basename_result to FILE with everything up to and including Chris@41: # the last / stripped. Chris@41: if test yes = "$_G_HAVE_XSI_OPS"; then Chris@41: # If this shell supports suffix pattern removal, then use it to avoid Chris@41: # forking. Hide the definitions single quotes in case the shell chokes Chris@41: # on unsupported syntax... Chris@41: _b='func_basename_result=${1##*/}' Chris@41: _d='case $1 in Chris@41: */*) func_dirname_result=${1%/*}$2 ;; Chris@41: * ) func_dirname_result=$3 ;; Chris@41: esac' Chris@41: Chris@41: else Chris@41: # ...otherwise fall back to using sed. Chris@41: _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' Chris@41: _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` Chris@41: if test "X$func_dirname_result" = "X$1"; then Chris@41: func_dirname_result=$3 Chris@41: else Chris@41: func_append func_dirname_result "$2" Chris@41: fi' Chris@41: fi Chris@41: Chris@41: eval 'func_basename () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: '"$_b"' Chris@41: }' Chris@41: Chris@41: Chris@41: # func_dirname FILE APPEND NONDIR_REPLACEMENT Chris@41: # ------------------------------------------- Chris@41: # Compute the dirname of FILE. If nonempty, add APPEND to the result, Chris@41: # otherwise set result to NONDIR_REPLACEMENT. Chris@41: eval 'func_dirname () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: '"$_d"' Chris@41: }' Chris@41: Chris@41: Chris@41: # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT Chris@41: # -------------------------------------------------------- Chris@41: # Perform func_basename and func_dirname in a single function Chris@41: # call: Chris@41: # dirname: Compute the dirname of FILE. If nonempty, Chris@41: # add APPEND to the result, otherwise set result Chris@41: # to NONDIR_REPLACEMENT. Chris@41: # value returned in "$func_dirname_result" Chris@41: # basename: Compute filename of FILE. Chris@41: # value retuned in "$func_basename_result" Chris@41: # For efficiency, we do not delegate to the functions above but instead Chris@41: # duplicate the functionality here. Chris@41: eval 'func_dirname_and_basename () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: '"$_b"' Chris@41: '"$_d"' Chris@41: }' Chris@41: Chris@41: Chris@41: # func_echo ARG... Chris@41: # ---------------- Chris@41: # Echo program name prefixed message. Chris@41: func_echo () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_message=$* Chris@41: Chris@41: func_echo_IFS=$IFS Chris@41: IFS=$nl Chris@41: for _G_line in $_G_message; do Chris@41: IFS=$func_echo_IFS Chris@41: $ECHO "$progname: $_G_line" Chris@41: done Chris@41: IFS=$func_echo_IFS Chris@41: } Chris@41: Chris@41: Chris@41: # func_echo_all ARG... Chris@41: # -------------------- Chris@41: # Invoke $ECHO with all args, space-separated. Chris@41: func_echo_all () Chris@41: { Chris@41: $ECHO "$*" Chris@41: } Chris@41: Chris@41: Chris@41: # func_echo_infix_1 INFIX ARG... Chris@41: # ------------------------------ Chris@41: # Echo program name, followed by INFIX on the first line, with any Chris@41: # additional lines not showing INFIX. Chris@41: func_echo_infix_1 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $require_term_colors Chris@41: Chris@41: _G_infix=$1; shift Chris@41: _G_indent=$_G_infix Chris@41: _G_prefix="$progname: $_G_infix: " Chris@41: _G_message=$* Chris@41: Chris@41: # Strip color escape sequences before counting printable length Chris@41: for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" Chris@41: do Chris@41: test -n "$_G_tc" && { Chris@41: _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` Chris@41: _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` Chris@41: } Chris@41: done Chris@41: _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes Chris@41: Chris@41: func_echo_infix_1_IFS=$IFS Chris@41: IFS=$nl Chris@41: for _G_line in $_G_message; do Chris@41: IFS=$func_echo_infix_1_IFS Chris@41: $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 Chris@41: _G_prefix=$_G_indent Chris@41: done Chris@41: IFS=$func_echo_infix_1_IFS Chris@41: } Chris@41: Chris@41: Chris@41: # func_error ARG... Chris@41: # ----------------- Chris@41: # Echo program name prefixed message to standard error. Chris@41: func_error () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $require_term_colors Chris@41: Chris@41: func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 Chris@41: } Chris@41: Chris@41: Chris@41: # func_fatal_error ARG... Chris@41: # ----------------------- Chris@41: # Echo program name prefixed message to standard error, and exit. Chris@41: func_fatal_error () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_error "$*" Chris@41: exit $EXIT_FAILURE Chris@41: } Chris@41: Chris@41: Chris@41: # func_grep EXPRESSION FILENAME Chris@41: # ----------------------------- Chris@41: # Check whether EXPRESSION matches any line of FILENAME, without output. Chris@41: func_grep () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $GREP "$1" "$2" >/dev/null 2>&1 Chris@41: } Chris@41: Chris@41: Chris@41: # func_len STRING Chris@41: # --------------- Chris@41: # Set func_len_result to the length of STRING. STRING may not Chris@41: # start with a hyphen. Chris@41: test -z "$_G_HAVE_XSI_OPS" \ Chris@41: && (eval 'x=a/b/c; Chris@41: test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ Chris@41: && _G_HAVE_XSI_OPS=yes Chris@41: Chris@41: if test yes = "$_G_HAVE_XSI_OPS"; then Chris@41: eval 'func_len () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_len_result=${#1} Chris@41: }' Chris@41: else Chris@41: func_len () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_mkdir_p DIRECTORY-PATH Chris@41: # --------------------------- Chris@41: # Make sure the entire path to DIRECTORY-PATH is available. Chris@41: func_mkdir_p () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_directory_path=$1 Chris@41: _G_dir_list= Chris@41: Chris@41: if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then Chris@41: Chris@41: # Protect directory names starting with '-' Chris@41: case $_G_directory_path in Chris@41: -*) _G_directory_path=./$_G_directory_path ;; Chris@41: esac Chris@41: Chris@41: # While some portion of DIR does not yet exist... Chris@41: while test ! -d "$_G_directory_path"; do Chris@41: # ...make a list in topmost first order. Use a colon delimited Chris@41: # list incase some portion of path contains whitespace. Chris@41: _G_dir_list=$_G_directory_path:$_G_dir_list Chris@41: Chris@41: # If the last portion added has no slash in it, the list is done Chris@41: case $_G_directory_path in */*) ;; *) break ;; esac Chris@41: Chris@41: # ...otherwise throw away the child directory and loop Chris@41: _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` Chris@41: done Chris@41: _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` Chris@41: Chris@41: func_mkdir_p_IFS=$IFS; IFS=: Chris@41: for _G_dir in $_G_dir_list; do Chris@41: IFS=$func_mkdir_p_IFS Chris@41: # mkdir can fail with a 'File exist' error if two processes Chris@41: # try to create one of the directories concurrently. Don't Chris@41: # stop in that case! Chris@41: $MKDIR "$_G_dir" 2>/dev/null || : Chris@41: done Chris@41: IFS=$func_mkdir_p_IFS Chris@41: Chris@41: # Bail out if we (or some other process) failed to create a directory. Chris@41: test -d "$_G_directory_path" || \ Chris@41: func_fatal_error "Failed to create '$1'" Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: # func_mktempdir [BASENAME] Chris@41: # ------------------------- Chris@41: # Make a temporary directory that won't clash with other running Chris@41: # libtool processes, and avoids race conditions if possible. If Chris@41: # given, BASENAME is the basename for that directory. Chris@41: func_mktempdir () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_template=${TMPDIR-/tmp}/${1-$progname} Chris@41: Chris@41: if test : = "$opt_dry_run"; then Chris@41: # Return a directory name, but don't create it in dry-run mode Chris@41: _G_tmpdir=$_G_template-$$ Chris@41: else Chris@41: Chris@41: # If mktemp works, use that first and foremost Chris@41: _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` Chris@41: Chris@41: if test ! -d "$_G_tmpdir"; then Chris@41: # Failing that, at least try and use $RANDOM to avoid a race Chris@41: _G_tmpdir=$_G_template-${RANDOM-0}$$ Chris@41: Chris@41: func_mktempdir_umask=`umask` Chris@41: umask 0077 Chris@41: $MKDIR "$_G_tmpdir" Chris@41: umask $func_mktempdir_umask Chris@41: fi Chris@41: Chris@41: # If we're not in dry-run mode, bomb out on failure Chris@41: test -d "$_G_tmpdir" || \ Chris@41: func_fatal_error "cannot create temporary directory '$_G_tmpdir'" Chris@41: fi Chris@41: Chris@41: $ECHO "$_G_tmpdir" Chris@41: } Chris@41: Chris@41: Chris@41: # func_normal_abspath PATH Chris@41: # ------------------------ Chris@41: # Remove doubled-up and trailing slashes, "." path components, Chris@41: # and cancel out any ".." path components in PATH after making Chris@41: # it an absolute path. Chris@41: func_normal_abspath () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # These SED scripts presuppose an absolute path with a trailing slash. Chris@41: _G_pathcar='s|^/\([^/]*\).*$|\1|' Chris@41: _G_pathcdr='s|^/[^/]*||' Chris@41: _G_removedotparts=':dotsl Chris@41: s|/\./|/|g Chris@41: t dotsl Chris@41: s|/\.$|/|' Chris@41: _G_collapseslashes='s|/\{1,\}|/|g' Chris@41: _G_finalslash='s|/*$|/|' Chris@41: Chris@41: # Start from root dir and reassemble the path. Chris@41: func_normal_abspath_result= Chris@41: func_normal_abspath_tpath=$1 Chris@41: func_normal_abspath_altnamespace= Chris@41: case $func_normal_abspath_tpath in Chris@41: "") Chris@41: # Empty path, that just means $cwd. Chris@41: func_stripname '' '/' "`pwd`" Chris@41: func_normal_abspath_result=$func_stripname_result Chris@41: return Chris@41: ;; Chris@41: # The next three entries are used to spot a run of precisely Chris@41: # two leading slashes without using negated character classes; Chris@41: # we take advantage of case's first-match behaviour. Chris@41: ///*) Chris@41: # Unusual form of absolute path, do nothing. Chris@41: ;; Chris@41: //*) Chris@41: # Not necessarily an ordinary path; POSIX reserves leading '//' Chris@41: # and for example Cygwin uses it to access remote file shares Chris@41: # over CIFS/SMB, so we conserve a leading double slash if found. Chris@41: func_normal_abspath_altnamespace=/ Chris@41: ;; Chris@41: /*) Chris@41: # Absolute path, do nothing. Chris@41: ;; Chris@41: *) Chris@41: # Relative path, prepend $cwd. Chris@41: func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Cancel out all the simple stuff to save iterations. We also want Chris@41: # the path to end with a slash for ease of parsing, so make sure Chris@41: # there is one (and only one) here. Chris@41: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@41: -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` Chris@41: while :; do Chris@41: # Processed it all yet? Chris@41: if test / = "$func_normal_abspath_tpath"; then Chris@41: # If we ascended to the root using ".." the result may be empty now. Chris@41: if test -z "$func_normal_abspath_result"; then Chris@41: func_normal_abspath_result=/ Chris@41: fi Chris@41: break Chris@41: fi Chris@41: func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@41: -e "$_G_pathcar"` Chris@41: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@41: -e "$_G_pathcdr"` Chris@41: # Figure out what to do with it Chris@41: case $func_normal_abspath_tcomponent in Chris@41: "") Chris@41: # Trailing empty path component, ignore it. Chris@41: ;; Chris@41: ..) Chris@41: # Parent dir; strip last assembled component from result. Chris@41: func_dirname "$func_normal_abspath_result" Chris@41: func_normal_abspath_result=$func_dirname_result Chris@41: ;; Chris@41: *) Chris@41: # Actual path component, append it. Chris@41: func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: # Restore leading double-slash if one was found on entry. Chris@41: func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result Chris@41: } Chris@41: Chris@41: Chris@41: # func_notquiet ARG... Chris@41: # -------------------- Chris@41: # Echo program name prefixed message only when not in quiet mode. Chris@41: func_notquiet () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $opt_quiet || func_echo ${1+"$@"} Chris@41: Chris@41: # A bug in bash halts the script if the last line of a function Chris@41: # fails when set -e is in force, so we need another command to Chris@41: # work around that: Chris@41: : Chris@41: } Chris@41: Chris@41: Chris@41: # func_relative_path SRCDIR DSTDIR Chris@41: # -------------------------------- Chris@41: # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. Chris@41: func_relative_path () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_relative_path_result= Chris@41: func_normal_abspath "$1" Chris@41: func_relative_path_tlibdir=$func_normal_abspath_result Chris@41: func_normal_abspath "$2" Chris@41: func_relative_path_tbindir=$func_normal_abspath_result Chris@41: Chris@41: # Ascend the tree starting from libdir Chris@41: while :; do Chris@41: # check if we have found a prefix of bindir Chris@41: case $func_relative_path_tbindir in Chris@41: $func_relative_path_tlibdir) Chris@41: # found an exact match Chris@41: func_relative_path_tcancelled= Chris@41: break Chris@41: ;; Chris@41: $func_relative_path_tlibdir*) Chris@41: # found a matching prefix Chris@41: func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" Chris@41: func_relative_path_tcancelled=$func_stripname_result Chris@41: if test -z "$func_relative_path_result"; then Chris@41: func_relative_path_result=. Chris@41: fi Chris@41: break Chris@41: ;; Chris@41: *) Chris@41: func_dirname $func_relative_path_tlibdir Chris@41: func_relative_path_tlibdir=$func_dirname_result Chris@41: if test -z "$func_relative_path_tlibdir"; then Chris@41: # Have to descend all the way to the root! Chris@41: func_relative_path_result=../$func_relative_path_result Chris@41: func_relative_path_tcancelled=$func_relative_path_tbindir Chris@41: break Chris@41: fi Chris@41: func_relative_path_result=../$func_relative_path_result Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # Now calculate path; take care to avoid doubling-up slashes. Chris@41: func_stripname '' '/' "$func_relative_path_result" Chris@41: func_relative_path_result=$func_stripname_result Chris@41: func_stripname '/' '/' "$func_relative_path_tcancelled" Chris@41: if test -n "$func_stripname_result"; then Chris@41: func_append func_relative_path_result "/$func_stripname_result" Chris@41: fi Chris@41: Chris@41: # Normalisation. If bindir is libdir, return '.' else relative path. Chris@41: if test -n "$func_relative_path_result"; then Chris@41: func_stripname './' '' "$func_relative_path_result" Chris@41: func_relative_path_result=$func_stripname_result Chris@41: fi Chris@41: Chris@41: test -n "$func_relative_path_result" || func_relative_path_result=. Chris@41: Chris@41: : Chris@41: } Chris@41: Chris@41: Chris@41: # func_quote_for_eval ARG... Chris@41: # -------------------------- Chris@41: # Aesthetically quote ARGs to be evaled later. Chris@41: # This function returns two values: Chris@41: # i) func_quote_for_eval_result Chris@41: # double-quoted, suitable for a subsequent eval Chris@41: # ii) func_quote_for_eval_unquoted_result Chris@41: # has all characters that are still active within double Chris@41: # quotes backslashified. Chris@41: func_quote_for_eval () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_quote_for_eval_unquoted_result= Chris@41: func_quote_for_eval_result= Chris@41: while test 0 -lt $#; do Chris@41: case $1 in Chris@41: *[\\\`\"\$]*) Chris@41: _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; Chris@41: *) Chris@41: _G_unquoted_arg=$1 ;; Chris@41: esac Chris@41: if test -n "$func_quote_for_eval_unquoted_result"; then Chris@41: func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" Chris@41: else Chris@41: func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" Chris@41: fi Chris@41: Chris@41: case $_G_unquoted_arg in Chris@41: # Double-quote args containing shell metacharacters to delay Chris@41: # word splitting, command substitution and variable expansion Chris@41: # for a subsequent eval. Chris@41: # Many Bourne shells cannot handle close brackets correctly Chris@41: # in scan sets, so we specify it separately. Chris@41: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") Chris@41: _G_quoted_arg=\"$_G_unquoted_arg\" Chris@41: ;; Chris@41: *) Chris@41: _G_quoted_arg=$_G_unquoted_arg Chris@41: ;; Chris@41: esac Chris@41: Chris@41: if test -n "$func_quote_for_eval_result"; then Chris@41: func_append func_quote_for_eval_result " $_G_quoted_arg" Chris@41: else Chris@41: func_append func_quote_for_eval_result "$_G_quoted_arg" Chris@41: fi Chris@41: shift Chris@41: done Chris@41: } Chris@41: Chris@41: Chris@41: # func_quote_for_expand ARG Chris@41: # ------------------------- Chris@41: # Aesthetically quote ARG to be evaled later; same as above, Chris@41: # but do not quote variable references. Chris@41: func_quote_for_expand () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $1 in Chris@41: *[\\\`\"]*) Chris@41: _G_arg=`$ECHO "$1" | $SED \ Chris@41: -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; Chris@41: *) Chris@41: _G_arg=$1 ;; Chris@41: esac Chris@41: Chris@41: case $_G_arg in Chris@41: # Double-quote args containing shell metacharacters to delay Chris@41: # word splitting and command substitution for a subsequent eval. Chris@41: # Many Bourne shells cannot handle close brackets correctly Chris@41: # in scan sets, so we specify it separately. Chris@41: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") Chris@41: _G_arg=\"$_G_arg\" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: func_quote_for_expand_result=$_G_arg Chris@41: } Chris@41: Chris@41: Chris@41: # func_stripname PREFIX SUFFIX NAME Chris@41: # --------------------------------- Chris@41: # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. Chris@41: # PREFIX and SUFFIX must not contain globbing or regex special Chris@41: # characters, hashes, percent signs, but SUFFIX may contain a leading Chris@41: # dot (in which case that matches only a dot). Chris@41: if test yes = "$_G_HAVE_XSI_OPS"; then Chris@41: eval 'func_stripname () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are Chris@41: # positional parameters, so assign one to ordinary variable first. Chris@41: func_stripname_result=$3 Chris@41: func_stripname_result=${func_stripname_result#"$1"} Chris@41: func_stripname_result=${func_stripname_result%"$2"} Chris@41: }' Chris@41: else Chris@41: func_stripname () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $2 in Chris@41: .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; Chris@41: *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; Chris@41: esac Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_show_eval CMD [FAIL_EXP] Chris@41: # ----------------------------- Chris@41: # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is Chris@41: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP Chris@41: # is given, then evaluate it. Chris@41: func_show_eval () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_cmd=$1 Chris@41: _G_fail_exp=${2-':'} Chris@41: Chris@41: func_quote_for_expand "$_G_cmd" Chris@41: eval "func_notquiet $func_quote_for_expand_result" Chris@41: Chris@41: $opt_dry_run || { Chris@41: eval "$_G_cmd" Chris@41: _G_status=$? Chris@41: if test 0 -ne "$_G_status"; then Chris@41: eval "(exit $_G_status); $_G_fail_exp" Chris@41: fi Chris@41: } Chris@41: } Chris@41: Chris@41: Chris@41: # func_show_eval_locale CMD [FAIL_EXP] Chris@41: # ------------------------------------ Chris@41: # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is Chris@41: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP Chris@41: # is given, then evaluate it. Use the saved locale for evaluation. Chris@41: func_show_eval_locale () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_cmd=$1 Chris@41: _G_fail_exp=${2-':'} Chris@41: Chris@41: $opt_quiet || { Chris@41: func_quote_for_expand "$_G_cmd" Chris@41: eval "func_echo $func_quote_for_expand_result" Chris@41: } Chris@41: Chris@41: $opt_dry_run || { Chris@41: eval "$_G_user_locale Chris@41: $_G_cmd" Chris@41: _G_status=$? Chris@41: eval "$_G_safe_locale" Chris@41: if test 0 -ne "$_G_status"; then Chris@41: eval "(exit $_G_status); $_G_fail_exp" Chris@41: fi Chris@41: } Chris@41: } Chris@41: Chris@41: Chris@41: # func_tr_sh Chris@41: # ---------- Chris@41: # Turn $1 into a string suitable for a shell variable name. Chris@41: # Result is stored in $func_tr_sh_result. All characters Chris@41: # not in the set a-zA-Z0-9_ are replaced with '_'. Further, Chris@41: # if $1 begins with a digit, a '_' is prepended as well. Chris@41: func_tr_sh () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $1 in Chris@41: [0-9]* | *[!a-zA-Z0-9_]*) Chris@41: func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` Chris@41: ;; Chris@41: * ) Chris@41: func_tr_sh_result=$1 Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: Chris@41: # func_verbose ARG... Chris@41: # ------------------- Chris@41: # Echo program name prefixed message in verbose mode only. Chris@41: func_verbose () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $opt_verbose && func_echo "$*" Chris@41: Chris@41: : Chris@41: } Chris@41: Chris@41: Chris@41: # func_warn_and_continue ARG... Chris@41: # ----------------------------- Chris@41: # Echo program name prefixed warning message to standard error. Chris@41: func_warn_and_continue () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $require_term_colors Chris@41: Chris@41: func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 Chris@41: } Chris@41: Chris@41: Chris@41: # func_warning CATEGORY ARG... Chris@41: # ---------------------------- Chris@41: # Echo program name prefixed warning message to standard error. Warning Chris@41: # messages can be filtered according to CATEGORY, where this function Chris@41: # elides messages where CATEGORY is not listed in the global variable Chris@41: # 'opt_warning_types'. Chris@41: func_warning () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # CATEGORY must be in the warning_categories list! Chris@41: case " $warning_categories " in Chris@41: *" $1 "*) ;; Chris@41: *) func_internal_error "invalid warning category '$1'" ;; Chris@41: esac Chris@41: Chris@41: _G_category=$1 Chris@41: shift Chris@41: Chris@41: case " $opt_warning_types " in Chris@41: *" $_G_category "*) $warning_func ${1+"$@"} ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: Chris@41: # func_sort_ver VER1 VER2 Chris@41: # ----------------------- Chris@41: # 'sort -V' is not generally available. Chris@41: # Note this deviates from the version comparison in automake Chris@41: # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a Chris@41: # but this should suffice as we won't be specifying old Chris@41: # version formats or redundant trailing .0 in bootstrap.conf. Chris@41: # If we did want full compatibility then we should probably Chris@41: # use m4_version_compare from autoconf. Chris@41: func_sort_ver () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: printf '%s\n%s\n' "$1" "$2" \ Chris@41: | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n Chris@41: } Chris@41: Chris@41: # func_lt_ver PREV CURR Chris@41: # --------------------- Chris@41: # Return true if PREV and CURR are in the correct order according to Chris@41: # func_sort_ver, otherwise false. Use it like this: Chris@41: # Chris@41: # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." Chris@41: func_lt_ver () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` Chris@41: } Chris@41: Chris@41: Chris@41: # Local variables: Chris@41: # mode: shell-script Chris@41: # sh-indentation: 2 Chris@41: # eval: (add-hook 'before-save-hook 'time-stamp) Chris@41: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" Chris@41: # time-stamp-time-zone: "UTC" Chris@41: # End: Chris@41: #! /bin/sh Chris@41: Chris@41: # Set a version string for this script. Chris@41: scriptversion=2014-01-07.03; # UTC Chris@41: Chris@41: # A portable, pluggable option parser for Bourne shell. Chris@41: # Written by Gary V. Vaughan, 2010 Chris@41: Chris@41: # Copyright (C) 2010-2015 Free Software Foundation, Inc. Chris@41: # This is free software; see the source for copying conditions. There is NO Chris@41: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Chris@41: Chris@41: # This program is free software: you can redistribute it and/or modify Chris@41: # it under the terms of the GNU General Public License as published by Chris@41: # the Free Software Foundation, either version 3 of the License, or Chris@41: # (at your option) any later version. Chris@41: Chris@41: # This program is distributed in the hope that it will be useful, Chris@41: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@41: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@41: # GNU General Public License for more details. Chris@41: Chris@41: # You should have received a copy of the GNU General Public License Chris@41: # along with this program. If not, see . Chris@41: Chris@41: # Please report bugs or propose patches to gary@gnu.org. Chris@41: Chris@41: Chris@41: ## ------ ## Chris@41: ## Usage. ## Chris@41: ## ------ ## Chris@41: Chris@41: # This file is a library for parsing options in your shell scripts along Chris@41: # with assorted other useful supporting features that you can make use Chris@41: # of too. Chris@41: # Chris@41: # For the simplest scripts you might need only: Chris@41: # Chris@41: # #!/bin/sh Chris@41: # . relative/path/to/funclib.sh Chris@41: # . relative/path/to/options-parser Chris@41: # scriptversion=1.0 Chris@41: # func_options ${1+"$@"} Chris@41: # eval set dummy "$func_options_result"; shift Chris@41: # ...rest of your script... Chris@41: # Chris@41: # In order for the '--version' option to work, you will need to have a Chris@41: # suitably formatted comment like the one at the top of this file Chris@41: # starting with '# Written by ' and ending with '# warranty; '. Chris@41: # Chris@41: # For '-h' and '--help' to work, you will also need a one line Chris@41: # description of your script's purpose in a comment directly above the Chris@41: # '# Written by ' line, like the one at the top of this file. Chris@41: # Chris@41: # The default options also support '--debug', which will turn on shell Chris@41: # execution tracing (see the comment above debug_cmd below for another Chris@41: # use), and '--verbose' and the func_verbose function to allow your script Chris@41: # to display verbose messages only when your user has specified Chris@41: # '--verbose'. Chris@41: # Chris@41: # After sourcing this file, you can plug processing for additional Chris@41: # options by amending the variables from the 'Configuration' section Chris@41: # below, and following the instructions in the 'Option parsing' Chris@41: # section further down. Chris@41: Chris@41: ## -------------- ## Chris@41: ## Configuration. ## Chris@41: ## -------------- ## Chris@41: Chris@41: # You should override these variables in your script after sourcing this Chris@41: # file so that they reflect the customisations you have added to the Chris@41: # option parser. Chris@41: Chris@41: # The usage line for option parsing errors and the start of '-h' and Chris@41: # '--help' output messages. You can embed shell variables for delayed Chris@41: # expansion at the time the message is displayed, but you will need to Chris@41: # quote other shell meta-characters carefully to prevent them being Chris@41: # expanded when the contents are evaled. Chris@41: usage='$progpath [OPTION]...' Chris@41: Chris@41: # Short help message in response to '-h' and '--help'. Add to this or Chris@41: # override it after sourcing this library to reflect the full set of Chris@41: # options your script accepts. Chris@41: usage_message="\ Chris@41: --debug enable verbose shell tracing Chris@41: -W, --warnings=CATEGORY Chris@41: report the warnings falling in CATEGORY [all] Chris@41: -v, --verbose verbosely report processing Chris@41: --version print version information and exit Chris@41: -h, --help print short or long help message and exit Chris@41: " Chris@41: Chris@41: # Additional text appended to 'usage_message' in response to '--help'. Chris@41: long_help_message=" Chris@41: Warning categories include: Chris@41: 'all' show all warnings Chris@41: 'none' turn off all the warnings Chris@41: 'error' warnings are treated as fatal errors" Chris@41: Chris@41: # Help message printed before fatal option parsing errors. Chris@41: fatal_help="Try '\$progname --help' for more information." Chris@41: Chris@41: Chris@41: Chris@41: ## ------------------------- ## Chris@41: ## Hook function management. ## Chris@41: ## ------------------------- ## Chris@41: Chris@41: # This section contains functions for adding, removing, and running hooks Chris@41: # to the main code. A hook is just a named list of of function, that can Chris@41: # be run in order later on. Chris@41: Chris@41: # func_hookable FUNC_NAME Chris@41: # ----------------------- Chris@41: # Declare that FUNC_NAME will run hooks added with Chris@41: # 'func_add_hook FUNC_NAME ...'. Chris@41: func_hookable () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_append hookable_fns " $1" Chris@41: } Chris@41: Chris@41: Chris@41: # func_add_hook FUNC_NAME HOOK_FUNC Chris@41: # --------------------------------- Chris@41: # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must Chris@41: # first have been declared "hookable" by a call to 'func_hookable'. Chris@41: func_add_hook () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case " $hookable_fns " in Chris@41: *" $1 "*) ;; Chris@41: *) func_fatal_error "'$1' does not accept hook functions." ;; Chris@41: esac Chris@41: Chris@41: eval func_append ${1}_hooks '" $2"' Chris@41: } Chris@41: Chris@41: Chris@41: # func_remove_hook FUNC_NAME HOOK_FUNC Chris@41: # ------------------------------------ Chris@41: # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. Chris@41: func_remove_hook () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' Chris@41: } Chris@41: Chris@41: Chris@41: # func_run_hooks FUNC_NAME [ARG]... Chris@41: # --------------------------------- Chris@41: # Run all hook functions registered to FUNC_NAME. Chris@41: # It is assumed that the list of hook functions contains nothing more Chris@41: # than a whitespace-delimited list of legal shell function names, and Chris@41: # no effort is wasted trying to catch shell meta-characters or preserve Chris@41: # whitespace. Chris@41: func_run_hooks () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case " $hookable_fns " in Chris@41: *" $1 "*) ;; Chris@41: *) func_fatal_error "'$1' does not support hook funcions.n" ;; Chris@41: esac Chris@41: Chris@41: eval _G_hook_fns=\$$1_hooks; shift Chris@41: Chris@41: for _G_hook in $_G_hook_fns; do Chris@41: eval $_G_hook '"$@"' Chris@41: Chris@41: # store returned options list back into positional Chris@41: # parameters for next 'cmd' execution. Chris@41: eval _G_hook_result=\$${_G_hook}_result Chris@41: eval set dummy "$_G_hook_result"; shift Chris@41: done Chris@41: Chris@41: func_quote_for_eval ${1+"$@"} Chris@41: func_run_hooks_result=$func_quote_for_eval_result Chris@41: } Chris@41: Chris@41: Chris@41: Chris@41: ## --------------- ## Chris@41: ## Option parsing. ## Chris@41: ## --------------- ## Chris@41: Chris@41: # In order to add your own option parsing hooks, you must accept the Chris@41: # full positional parameter list in your hook function, remove any Chris@41: # options that you action, and then pass back the remaining unprocessed Chris@41: # options in '_result', escaped suitably for Chris@41: # 'eval'. Like this: Chris@41: # Chris@41: # my_options_prep () Chris@41: # { Chris@41: # $debug_cmd Chris@41: # Chris@41: # # Extend the existing usage message. Chris@41: # usage_message=$usage_message' Chris@41: # -s, --silent don'\''t print informational messages Chris@41: # ' Chris@41: # Chris@41: # func_quote_for_eval ${1+"$@"} Chris@41: # my_options_prep_result=$func_quote_for_eval_result Chris@41: # } Chris@41: # func_add_hook func_options_prep my_options_prep Chris@41: # Chris@41: # Chris@41: # my_silent_option () Chris@41: # { Chris@41: # $debug_cmd Chris@41: # Chris@41: # # Note that for efficiency, we parse as many options as we can Chris@41: # # recognise in a loop before passing the remainder back to the Chris@41: # # caller on the first unrecognised argument we encounter. Chris@41: # while test $# -gt 0; do Chris@41: # opt=$1; shift Chris@41: # case $opt in Chris@41: # --silent|-s) opt_silent=: ;; Chris@41: # # Separate non-argument short options: Chris@41: # -s*) func_split_short_opt "$_G_opt" Chris@41: # set dummy "$func_split_short_opt_name" \ Chris@41: # "-$func_split_short_opt_arg" ${1+"$@"} Chris@41: # shift Chris@41: # ;; Chris@41: # *) set dummy "$_G_opt" "$*"; shift; break ;; Chris@41: # esac Chris@41: # done Chris@41: # Chris@41: # func_quote_for_eval ${1+"$@"} Chris@41: # my_silent_option_result=$func_quote_for_eval_result Chris@41: # } Chris@41: # func_add_hook func_parse_options my_silent_option Chris@41: # Chris@41: # Chris@41: # my_option_validation () Chris@41: # { Chris@41: # $debug_cmd Chris@41: # Chris@41: # $opt_silent && $opt_verbose && func_fatal_help "\ Chris@41: # '--silent' and '--verbose' options are mutually exclusive." Chris@41: # Chris@41: # func_quote_for_eval ${1+"$@"} Chris@41: # my_option_validation_result=$func_quote_for_eval_result Chris@41: # } Chris@41: # func_add_hook func_validate_options my_option_validation Chris@41: # Chris@41: # You'll alse need to manually amend $usage_message to reflect the extra Chris@41: # options you parse. It's preferable to append if you can, so that Chris@41: # multiple option parsing hooks can be added safely. Chris@41: Chris@41: Chris@41: # func_options [ARG]... Chris@41: # --------------------- Chris@41: # All the functions called inside func_options are hookable. See the Chris@41: # individual implementations for details. Chris@41: func_hookable func_options Chris@41: func_options () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_options_prep ${1+"$@"} Chris@41: eval func_parse_options \ Chris@41: ${func_options_prep_result+"$func_options_prep_result"} Chris@41: eval func_validate_options \ Chris@41: ${func_parse_options_result+"$func_parse_options_result"} Chris@41: Chris@41: eval func_run_hooks func_options \ Chris@41: ${func_validate_options_result+"$func_validate_options_result"} Chris@41: Chris@41: # save modified positional parameters for caller Chris@41: func_options_result=$func_run_hooks_result Chris@41: } Chris@41: Chris@41: Chris@41: # func_options_prep [ARG]... Chris@41: # -------------------------- Chris@41: # All initialisations required before starting the option parse loop. Chris@41: # Note that when calling hook functions, we pass through the list of Chris@41: # positional parameters. If a hook function modifies that list, and Chris@41: # needs to propogate that back to rest of this script, then the complete Chris@41: # modified list must be put in 'func_run_hooks_result' before Chris@41: # returning. Chris@41: func_hookable func_options_prep Chris@41: func_options_prep () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # Option defaults: Chris@41: opt_verbose=false Chris@41: opt_warning_types= Chris@41: Chris@41: func_run_hooks func_options_prep ${1+"$@"} Chris@41: Chris@41: # save modified positional parameters for caller Chris@41: func_options_prep_result=$func_run_hooks_result Chris@41: } Chris@41: Chris@41: Chris@41: # func_parse_options [ARG]... Chris@41: # --------------------------- Chris@41: # The main option parsing loop. Chris@41: func_hookable func_parse_options Chris@41: func_parse_options () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_parse_options_result= Chris@41: Chris@41: # this just eases exit handling Chris@41: while test $# -gt 0; do Chris@41: # Defer to hook functions for initial option parsing, so they Chris@41: # get priority in the event of reusing an option name. Chris@41: func_run_hooks func_parse_options ${1+"$@"} Chris@41: Chris@41: # Adjust func_parse_options positional parameters to match Chris@41: eval set dummy "$func_run_hooks_result"; shift Chris@41: Chris@41: # Break out of the loop if we already parsed every option. Chris@41: test $# -gt 0 || break Chris@41: Chris@41: _G_opt=$1 Chris@41: shift Chris@41: case $_G_opt in Chris@41: --debug|-x) debug_cmd='set -x' Chris@41: func_echo "enabling shell trace mode" Chris@41: $debug_cmd Chris@41: ;; Chris@41: Chris@41: --no-warnings|--no-warning|--no-warn) Chris@41: set dummy --warnings none ${1+"$@"} Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --warnings|--warning|-W) Chris@41: test $# = 0 && func_missing_arg $_G_opt && break Chris@41: case " $warning_categories $1" in Chris@41: *" $1 "*) Chris@41: # trailing space prevents matching last $1 above Chris@41: func_append_uniq opt_warning_types " $1" Chris@41: ;; Chris@41: *all) Chris@41: opt_warning_types=$warning_categories Chris@41: ;; Chris@41: *none) Chris@41: opt_warning_types=none Chris@41: warning_func=: Chris@41: ;; Chris@41: *error) Chris@41: opt_warning_types=$warning_categories Chris@41: warning_func=func_fatal_error Chris@41: ;; Chris@41: *) Chris@41: func_fatal_error \ Chris@41: "unsupported warning category: '$1'" Chris@41: ;; Chris@41: esac Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --verbose|-v) opt_verbose=: ;; Chris@41: --version) func_version ;; Chris@41: -\?|-h) func_usage ;; Chris@41: --help) func_help ;; Chris@41: Chris@41: # Separate optargs to long options (plugins may need this): Chris@41: --*=*) func_split_equals "$_G_opt" Chris@41: set dummy "$func_split_equals_lhs" \ Chris@41: "$func_split_equals_rhs" ${1+"$@"} Chris@41: shift Chris@41: ;; Chris@41: Chris@41: # Separate optargs to short options: Chris@41: -W*) Chris@41: func_split_short_opt "$_G_opt" Chris@41: set dummy "$func_split_short_opt_name" \ Chris@41: "$func_split_short_opt_arg" ${1+"$@"} Chris@41: shift Chris@41: ;; Chris@41: Chris@41: # Separate non-argument short options: Chris@41: -\?*|-h*|-v*|-x*) Chris@41: func_split_short_opt "$_G_opt" Chris@41: set dummy "$func_split_short_opt_name" \ Chris@41: "-$func_split_short_opt_arg" ${1+"$@"} Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --) break ;; Chris@41: -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; Chris@41: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # save modified positional parameters for caller Chris@41: func_quote_for_eval ${1+"$@"} Chris@41: func_parse_options_result=$func_quote_for_eval_result Chris@41: } Chris@41: Chris@41: Chris@41: # func_validate_options [ARG]... Chris@41: # ------------------------------ Chris@41: # Perform any sanity checks on option settings and/or unconsumed Chris@41: # arguments. Chris@41: func_hookable func_validate_options Chris@41: func_validate_options () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # Display all warnings if -W was not given. Chris@41: test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" Chris@41: Chris@41: func_run_hooks func_validate_options ${1+"$@"} Chris@41: Chris@41: # Bail if the options were screwed! Chris@41: $exit_cmd $EXIT_FAILURE Chris@41: Chris@41: # save modified positional parameters for caller Chris@41: func_validate_options_result=$func_run_hooks_result Chris@41: } Chris@41: Chris@41: Chris@41: Chris@41: ## ----------------- ## Chris@41: ## Helper functions. ## Chris@41: ## ----------------- ## Chris@41: Chris@41: # This section contains the helper functions used by the rest of the Chris@41: # hookable option parser framework in ascii-betical order. Chris@41: Chris@41: Chris@41: # func_fatal_help ARG... Chris@41: # ---------------------- Chris@41: # Echo program name prefixed message to standard error, followed by Chris@41: # a help hint, and exit. Chris@41: func_fatal_help () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval \$ECHO \""Usage: $usage"\" Chris@41: eval \$ECHO \""$fatal_help"\" Chris@41: func_error ${1+"$@"} Chris@41: exit $EXIT_FAILURE Chris@41: } Chris@41: Chris@41: Chris@41: # func_help Chris@41: # --------- Chris@41: # Echo long help message to standard output and exit. Chris@41: func_help () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_usage_message Chris@41: $ECHO "$long_help_message" Chris@41: exit 0 Chris@41: } Chris@41: Chris@41: Chris@41: # func_missing_arg ARGNAME Chris@41: # ------------------------ Chris@41: # Echo program name prefixed message to standard error and set global Chris@41: # exit_cmd. Chris@41: func_missing_arg () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_error "Missing argument for '$1'." Chris@41: exit_cmd=exit Chris@41: } Chris@41: Chris@41: Chris@41: # func_split_equals STRING Chris@41: # ------------------------ Chris@41: # Set func_split_equals_lhs and func_split_equals_rhs shell variables after Chris@41: # splitting STRING at the '=' sign. Chris@41: test -z "$_G_HAVE_XSI_OPS" \ Chris@41: && (eval 'x=a/b/c; Chris@41: test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ Chris@41: && _G_HAVE_XSI_OPS=yes Chris@41: Chris@41: if test yes = "$_G_HAVE_XSI_OPS" Chris@41: then Chris@41: # This is an XSI compatible shell, allowing a faster implementation... Chris@41: eval 'func_split_equals () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_split_equals_lhs=${1%%=*} Chris@41: func_split_equals_rhs=${1#*=} Chris@41: test "x$func_split_equals_lhs" = "x$1" \ Chris@41: && func_split_equals_rhs= Chris@41: }' Chris@41: else Chris@41: # ...otherwise fall back to using expr, which is often a shell builtin. Chris@41: func_split_equals () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` Chris@41: func_split_equals_rhs= Chris@41: test "x$func_split_equals_lhs" = "x$1" \ Chris@41: || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` Chris@41: } Chris@41: fi #func_split_equals Chris@41: Chris@41: Chris@41: # func_split_short_opt SHORTOPT Chris@41: # ----------------------------- Chris@41: # Set func_split_short_opt_name and func_split_short_opt_arg shell Chris@41: # variables after splitting SHORTOPT after the 2nd character. Chris@41: if test yes = "$_G_HAVE_XSI_OPS" Chris@41: then Chris@41: # This is an XSI compatible shell, allowing a faster implementation... Chris@41: eval 'func_split_short_opt () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_split_short_opt_arg=${1#??} Chris@41: func_split_short_opt_name=${1%"$func_split_short_opt_arg"} Chris@41: }' Chris@41: else Chris@41: # ...otherwise fall back to using expr, which is often a shell builtin. Chris@41: func_split_short_opt () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` Chris@41: func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` Chris@41: } Chris@41: fi #func_split_short_opt Chris@41: Chris@41: Chris@41: # func_usage Chris@41: # ---------- Chris@41: # Echo short help message to standard output and exit. Chris@41: func_usage () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_usage_message Chris@41: $ECHO "Run '$progname --help |${PAGER-more}' for full usage" Chris@41: exit 0 Chris@41: } Chris@41: Chris@41: Chris@41: # func_usage_message Chris@41: # ------------------ Chris@41: # Echo short help message to standard output. Chris@41: func_usage_message () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: eval \$ECHO \""Usage: $usage"\" Chris@41: echo Chris@41: $SED -n 's|^# || Chris@41: /^Written by/{ Chris@41: x;p;x Chris@41: } Chris@41: h Chris@41: /^Written by/q' < "$progpath" Chris@41: echo Chris@41: eval \$ECHO \""$usage_message"\" Chris@41: } Chris@41: Chris@41: Chris@41: # func_version Chris@41: # ------------ Chris@41: # Echo version message to standard output and exit. Chris@41: func_version () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: printf '%s\n' "$progname $scriptversion" Chris@41: $SED -n ' Chris@41: /(C)/!b go Chris@41: :more Chris@41: /\./!{ Chris@41: N Chris@41: s|\n# | | Chris@41: b more Chris@41: } Chris@41: :go Chris@41: /^# Written by /,/# warranty; / { Chris@41: s|^# || Chris@41: s|^# *$|| Chris@41: s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| Chris@41: p Chris@41: } Chris@41: /^# Written by / { Chris@41: s|^# || Chris@41: p Chris@41: } Chris@41: /^warranty; /q' < "$progpath" Chris@41: Chris@41: exit $? Chris@41: } Chris@41: Chris@41: Chris@41: # Local variables: Chris@41: # mode: shell-script Chris@41: # sh-indentation: 2 Chris@41: # eval: (add-hook 'before-save-hook 'time-stamp) Chris@41: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" Chris@41: # time-stamp-time-zone: "UTC" Chris@41: # End: Chris@41: Chris@41: # Set a version string. Chris@41: scriptversion='(GNU libtool) 2.4.6' Chris@41: Chris@41: Chris@41: # func_echo ARG... Chris@41: # ---------------- Chris@41: # Libtool also displays the current mode in messages, so override Chris@41: # funclib.sh func_echo with this custom definition. Chris@41: func_echo () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: _G_message=$* Chris@41: Chris@41: func_echo_IFS=$IFS Chris@41: IFS=$nl Chris@41: for _G_line in $_G_message; do Chris@41: IFS=$func_echo_IFS Chris@41: $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" Chris@41: done Chris@41: IFS=$func_echo_IFS Chris@41: } Chris@41: Chris@41: Chris@41: # func_warning ARG... Chris@41: # ------------------- Chris@41: # Libtool warnings are not categorized, so override funclib.sh Chris@41: # func_warning with this simpler definition. Chris@41: func_warning () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $warning_func ${1+"$@"} Chris@41: } Chris@41: Chris@41: Chris@41: ## ---------------- ## Chris@41: ## Options parsing. ## Chris@41: ## ---------------- ## Chris@41: Chris@41: # Hook in the functions to make sure our own options are parsed during Chris@41: # the option parsing loop. Chris@41: Chris@41: usage='$progpath [OPTION]... [MODE-ARG]...' Chris@41: Chris@41: # Short help message in response to '-h'. Chris@41: usage_message="Options: Chris@41: --config show all configuration variables Chris@41: --debug enable verbose shell tracing Chris@41: -n, --dry-run display commands without modifying any files Chris@41: --features display basic configuration information and exit Chris@41: --mode=MODE use operation mode MODE Chris@41: --no-warnings equivalent to '-Wnone' Chris@41: --preserve-dup-deps don't remove duplicate dependency libraries Chris@41: --quiet, --silent don't print informational messages Chris@41: --tag=TAG use configuration variables from tag TAG Chris@41: -v, --verbose print more informational messages than default Chris@41: --version print version information Chris@41: -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] Chris@41: -h, --help, --help-all print short, long, or detailed help message Chris@41: " Chris@41: Chris@41: # Additional text appended to 'usage_message' in response to '--help'. Chris@41: func_help () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_usage_message Chris@41: $ECHO "$long_help_message Chris@41: Chris@41: MODE must be one of the following: Chris@41: Chris@41: clean remove files from the build directory Chris@41: compile compile a source file into a libtool object Chris@41: execute automatically set library path, then run a program Chris@41: finish complete the installation of libtool libraries Chris@41: install install libraries or executables Chris@41: link create a library or an executable Chris@41: uninstall remove libraries from an installed directory Chris@41: Chris@41: MODE-ARGS vary depending on the MODE. When passed as first option, Chris@41: '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Chris@41: Try '$progname --help --mode=MODE' for a more detailed description of MODE. Chris@41: Chris@41: When reporting a bug, please describe a test case to reproduce it and Chris@41: include the following information: Chris@41: Chris@41: host-triplet: $host Chris@41: shell: $SHELL Chris@41: compiler: $LTCC Chris@41: compiler flags: $LTCFLAGS Chris@41: linker: $LD (gnu? $with_gnu_ld) Chris@41: version: $progname $scriptversion Debian-2.4.6-2 Chris@41: automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` Chris@41: autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Chris@41: Chris@41: Report bugs to . Chris@41: GNU libtool home page: . Chris@41: General help using GNU software: ." Chris@41: exit 0 Chris@41: } Chris@41: Chris@41: Chris@41: # func_lo2o OBJECT-NAME Chris@41: # --------------------- Chris@41: # Transform OBJECT-NAME from a '.lo' suffix to the platform specific Chris@41: # object suffix. Chris@41: Chris@41: lo2o=s/\\.lo\$/.$objext/ Chris@41: o2lo=s/\\.$objext\$/.lo/ Chris@41: Chris@41: if test yes = "$_G_HAVE_XSI_OPS"; then Chris@41: eval 'func_lo2o () Chris@41: { Chris@41: case $1 in Chris@41: *.lo) func_lo2o_result=${1%.lo}.$objext ;; Chris@41: * ) func_lo2o_result=$1 ;; Chris@41: esac Chris@41: }' Chris@41: Chris@41: # func_xform LIBOBJ-OR-SOURCE Chris@41: # --------------------------- Chris@41: # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) Chris@41: # suffix to a '.lo' libtool-object suffix. Chris@41: eval 'func_xform () Chris@41: { Chris@41: func_xform_result=${1%.*}.lo Chris@41: }' Chris@41: else Chris@41: # ...otherwise fall back to using sed. Chris@41: func_lo2o () Chris@41: { Chris@41: func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` Chris@41: } Chris@41: Chris@41: func_xform () Chris@41: { Chris@41: func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` Chris@41: } Chris@41: fi Chris@41: Chris@41: Chris@41: # func_fatal_configuration ARG... Chris@41: # ------------------------------- Chris@41: # Echo program name prefixed message to standard error, followed by Chris@41: # a configuration failure hint, and exit. Chris@41: func_fatal_configuration () Chris@41: { Chris@41: func__fatal_error ${1+"$@"} \ Chris@41: "See the $PACKAGE documentation for more information." \ Chris@41: "Fatal configuration error." Chris@41: } Chris@41: Chris@41: Chris@41: # func_config Chris@41: # ----------- Chris@41: # Display the configuration for all the tags in this script. Chris@41: func_config () Chris@41: { Chris@41: re_begincf='^# ### BEGIN LIBTOOL' Chris@41: re_endcf='^# ### END LIBTOOL' Chris@41: Chris@41: # Default configuration. Chris@41: $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" Chris@41: Chris@41: # Now print the configurations for the tags. Chris@41: for tagname in $taglist; do Chris@41: $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" Chris@41: done Chris@41: Chris@41: exit $? Chris@41: } Chris@41: Chris@41: Chris@41: # func_features Chris@41: # ------------- Chris@41: # Display the features supported by this script. Chris@41: func_features () Chris@41: { Chris@41: echo "host: $host" Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: echo "enable shared libraries" Chris@41: else Chris@41: echo "disable shared libraries" Chris@41: fi Chris@41: if test yes = "$build_old_libs"; then Chris@41: echo "enable static libraries" Chris@41: else Chris@41: echo "disable static libraries" Chris@41: fi Chris@41: Chris@41: exit $? Chris@41: } Chris@41: Chris@41: Chris@41: # func_enable_tag TAGNAME Chris@41: # ----------------------- Chris@41: # Verify that TAGNAME is valid, and either flag an error and exit, or Chris@41: # enable the TAGNAME tag. We also add TAGNAME to the global $taglist Chris@41: # variable here. Chris@41: func_enable_tag () Chris@41: { Chris@41: # Global variable: Chris@41: tagname=$1 Chris@41: Chris@41: re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" Chris@41: re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" Chris@41: sed_extractcf=/$re_begincf/,/$re_endcf/p Chris@41: Chris@41: # Validate tagname. Chris@41: case $tagname in Chris@41: *[!-_A-Za-z0-9,/]*) Chris@41: func_fatal_error "invalid tag name: $tagname" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Don't test for the "default" C tag, as we know it's Chris@41: # there but not specially marked. Chris@41: case $tagname in Chris@41: CC) ;; Chris@41: *) Chris@41: if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then Chris@41: taglist="$taglist $tagname" Chris@41: Chris@41: # Evaluate the configuration. Be careful to quote the path Chris@41: # and the sed script, to avoid splitting on whitespace, but Chris@41: # also don't use non-portable quotes within backquotes within Chris@41: # quotes we have to do it in 2 steps: Chris@41: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` Chris@41: eval "$extractedcf" Chris@41: else Chris@41: func_error "ignoring unknown tag $tagname" Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: Chris@41: # func_check_version_match Chris@41: # ------------------------ Chris@41: # Ensure that we are using m4 macros, and libtool script from the same Chris@41: # release of libtool. Chris@41: func_check_version_match () Chris@41: { Chris@41: if test "$package_revision" != "$macro_revision"; then Chris@41: if test "$VERSION" != "$macro_version"; then Chris@41: if test -z "$macro_version"; then Chris@41: cat >&2 <<_LT_EOF Chris@41: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the Chris@41: $progname: definition of this LT_INIT comes from an older release. Chris@41: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION Chris@41: $progname: and run autoconf again. Chris@41: _LT_EOF Chris@41: else Chris@41: cat >&2 <<_LT_EOF Chris@41: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the Chris@41: $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. Chris@41: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION Chris@41: $progname: and run autoconf again. Chris@41: _LT_EOF Chris@41: fi Chris@41: else Chris@41: cat >&2 <<_LT_EOF Chris@41: $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, Chris@41: $progname: but the definition of this LT_INIT comes from revision $macro_revision. Chris@41: $progname: You should recreate aclocal.m4 with macros from revision $package_revision Chris@41: $progname: of $PACKAGE $VERSION and run autoconf again. Chris@41: _LT_EOF Chris@41: fi Chris@41: Chris@41: exit $EXIT_MISMATCH Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: # libtool_options_prep [ARG]... Chris@41: # ----------------------------- Chris@41: # Preparation for options parsed by libtool. Chris@41: libtool_options_prep () Chris@41: { Chris@41: $debug_mode Chris@41: Chris@41: # Option defaults: Chris@41: opt_config=false Chris@41: opt_dlopen= Chris@41: opt_dry_run=false Chris@41: opt_help=false Chris@41: opt_mode= Chris@41: opt_preserve_dup_deps=false Chris@41: opt_quiet=false Chris@41: Chris@41: nonopt= Chris@41: preserve_args= Chris@41: Chris@41: # Shorthand for --mode=foo, only valid as the first argument Chris@41: case $1 in Chris@41: clean|clea|cle|cl) Chris@41: shift; set dummy --mode clean ${1+"$@"}; shift Chris@41: ;; Chris@41: compile|compil|compi|comp|com|co|c) Chris@41: shift; set dummy --mode compile ${1+"$@"}; shift Chris@41: ;; Chris@41: execute|execut|execu|exec|exe|ex|e) Chris@41: shift; set dummy --mode execute ${1+"$@"}; shift Chris@41: ;; Chris@41: finish|finis|fini|fin|fi|f) Chris@41: shift; set dummy --mode finish ${1+"$@"}; shift Chris@41: ;; Chris@41: install|instal|insta|inst|ins|in|i) Chris@41: shift; set dummy --mode install ${1+"$@"}; shift Chris@41: ;; Chris@41: link|lin|li|l) Chris@41: shift; set dummy --mode link ${1+"$@"}; shift Chris@41: ;; Chris@41: uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) Chris@41: shift; set dummy --mode uninstall ${1+"$@"}; shift Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Pass back the list of options. Chris@41: func_quote_for_eval ${1+"$@"} Chris@41: libtool_options_prep_result=$func_quote_for_eval_result Chris@41: } Chris@41: func_add_hook func_options_prep libtool_options_prep Chris@41: Chris@41: Chris@41: # libtool_parse_options [ARG]... Chris@41: # --------------------------------- Chris@41: # Provide handling for libtool specific options. Chris@41: libtool_parse_options () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # Perform our own loop to consume as many options as possible in Chris@41: # each iteration. Chris@41: while test $# -gt 0; do Chris@41: _G_opt=$1 Chris@41: shift Chris@41: case $_G_opt in Chris@41: --dry-run|--dryrun|-n) Chris@41: opt_dry_run=: Chris@41: ;; Chris@41: Chris@41: --config) func_config ;; Chris@41: Chris@41: --dlopen|-dlopen) Chris@41: opt_dlopen="${opt_dlopen+$opt_dlopen Chris@41: }$1" Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --preserve-dup-deps) Chris@41: opt_preserve_dup_deps=: ;; Chris@41: Chris@41: --features) func_features ;; Chris@41: Chris@41: --finish) set dummy --mode finish ${1+"$@"}; shift ;; Chris@41: Chris@41: --help) opt_help=: ;; Chris@41: Chris@41: --help-all) opt_help=': help-all' ;; Chris@41: Chris@41: --mode) test $# = 0 && func_missing_arg $_G_opt && break Chris@41: opt_mode=$1 Chris@41: case $1 in Chris@41: # Valid mode arguments: Chris@41: clean|compile|execute|finish|install|link|relink|uninstall) ;; Chris@41: Chris@41: # Catch anything else as an error Chris@41: *) func_error "invalid argument for $_G_opt" Chris@41: exit_cmd=exit Chris@41: break Chris@41: ;; Chris@41: esac Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --no-silent|--no-quiet) Chris@41: opt_quiet=false Chris@41: func_append preserve_args " $_G_opt" Chris@41: ;; Chris@41: Chris@41: --no-warnings|--no-warning|--no-warn) Chris@41: opt_warning=false Chris@41: func_append preserve_args " $_G_opt" Chris@41: ;; Chris@41: Chris@41: --no-verbose) Chris@41: opt_verbose=false Chris@41: func_append preserve_args " $_G_opt" Chris@41: ;; Chris@41: Chris@41: --silent|--quiet) Chris@41: opt_quiet=: Chris@41: opt_verbose=false Chris@41: func_append preserve_args " $_G_opt" Chris@41: ;; Chris@41: Chris@41: --tag) test $# = 0 && func_missing_arg $_G_opt && break Chris@41: opt_tag=$1 Chris@41: func_append preserve_args " $_G_opt $1" Chris@41: func_enable_tag "$1" Chris@41: shift Chris@41: ;; Chris@41: Chris@41: --verbose|-v) opt_quiet=false Chris@41: opt_verbose=: Chris@41: func_append preserve_args " $_G_opt" Chris@41: ;; Chris@41: Chris@41: # An option not handled by this hook function: Chris@41: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: Chris@41: # save modified positional parameters for caller Chris@41: func_quote_for_eval ${1+"$@"} Chris@41: libtool_parse_options_result=$func_quote_for_eval_result Chris@41: } Chris@41: func_add_hook func_parse_options libtool_parse_options Chris@41: Chris@41: Chris@41: Chris@41: # libtool_validate_options [ARG]... Chris@41: # --------------------------------- Chris@41: # Perform any sanity checks on option settings and/or unconsumed Chris@41: # arguments. Chris@41: libtool_validate_options () Chris@41: { Chris@41: # save first non-option argument Chris@41: if test 0 -lt $#; then Chris@41: nonopt=$1 Chris@41: shift Chris@41: fi Chris@41: Chris@41: # preserve --debug Chris@41: test : = "$debug_cmd" || func_append preserve_args " --debug" Chris@41: Chris@41: case $host in Chris@41: # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 Chris@41: # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 Chris@41: *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) Chris@41: # don't eliminate duplications in $postdeps and $predeps Chris@41: opt_duplicate_compiler_generated_deps=: Chris@41: ;; Chris@41: *) Chris@41: opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps Chris@41: ;; Chris@41: esac Chris@41: Chris@41: $opt_help || { Chris@41: # Sanity checks first: Chris@41: func_check_version_match Chris@41: Chris@41: test yes != "$build_libtool_libs" \ Chris@41: && test yes != "$build_old_libs" \ Chris@41: && func_fatal_configuration "not configured to build any kind of library" Chris@41: Chris@41: # Darwin sucks Chris@41: eval std_shrext=\"$shrext_cmds\" Chris@41: Chris@41: # Only execute mode is allowed to have -dlopen flags. Chris@41: if test -n "$opt_dlopen" && test execute != "$opt_mode"; then Chris@41: func_error "unrecognized option '-dlopen'" Chris@41: $ECHO "$help" 1>&2 Chris@41: exit $EXIT_FAILURE Chris@41: fi Chris@41: Chris@41: # Change the help message to a mode-specific one. Chris@41: generic_help=$help Chris@41: help="Try '$progname --help --mode=$opt_mode' for more information." Chris@41: } Chris@41: Chris@41: # Pass back the unparsed argument list Chris@41: func_quote_for_eval ${1+"$@"} Chris@41: libtool_validate_options_result=$func_quote_for_eval_result Chris@41: } Chris@41: func_add_hook func_validate_options libtool_validate_options Chris@41: Chris@41: Chris@41: # Process options as early as possible so that --help and --version Chris@41: # can return quickly. Chris@41: func_options ${1+"$@"} Chris@41: eval set dummy "$func_options_result"; shift Chris@41: Chris@41: Chris@41: Chris@41: ## ----------- ## Chris@41: ## Main. ## Chris@41: ## ----------- ## Chris@41: Chris@41: magic='%%%MAGIC variable%%%' Chris@41: magic_exe='%%%MAGIC EXE variable%%%' Chris@41: Chris@41: # Global variables. Chris@41: extracted_archives= Chris@41: extracted_serial=0 Chris@41: Chris@41: # If this variable is set in any of the actions, the command in it Chris@41: # will be execed at the end. This prevents here-documents from being Chris@41: # left over by shells. Chris@41: exec_cmd= Chris@41: Chris@41: Chris@41: # A function that is used when there is no print builtin or printf. Chris@41: func_fallback_echo () Chris@41: { Chris@41: eval 'cat <<_LTECHO_EOF Chris@41: $1 Chris@41: _LTECHO_EOF' Chris@41: } Chris@41: Chris@41: # func_generated_by_libtool Chris@41: # True iff stdin has been generated by Libtool. This function is only Chris@41: # a basic sanity check; it will hardly flush out determined imposters. Chris@41: func_generated_by_libtool_p () Chris@41: { Chris@41: $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 Chris@41: } Chris@41: Chris@41: # func_lalib_p file Chris@41: # True iff FILE is a libtool '.la' library or '.lo' object file. Chris@41: # This function is only a basic sanity check; it will hardly flush out Chris@41: # determined imposters. Chris@41: func_lalib_p () Chris@41: { Chris@41: test -f "$1" && Chris@41: $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p Chris@41: } Chris@41: Chris@41: # func_lalib_unsafe_p file Chris@41: # True iff FILE is a libtool '.la' library or '.lo' object file. Chris@41: # This function implements the same check as func_lalib_p without Chris@41: # resorting to external programs. To this end, it redirects stdin and Chris@41: # closes it afterwards, without saving the original file descriptor. Chris@41: # As a safety measure, use it only where a negative result would be Chris@41: # fatal anyway. Works if 'file' does not exist. Chris@41: func_lalib_unsafe_p () Chris@41: { Chris@41: lalib_p=no Chris@41: if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then Chris@41: for lalib_p_l in 1 2 3 4 Chris@41: do Chris@41: read lalib_p_line Chris@41: case $lalib_p_line in Chris@41: \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; Chris@41: esac Chris@41: done Chris@41: exec 0<&5 5<&- Chris@41: fi Chris@41: test yes = "$lalib_p" Chris@41: } Chris@41: Chris@41: # func_ltwrapper_script_p file Chris@41: # True iff FILE is a libtool wrapper script Chris@41: # This function is only a basic sanity check; it will hardly flush out Chris@41: # determined imposters. Chris@41: func_ltwrapper_script_p () Chris@41: { Chris@41: test -f "$1" && Chris@41: $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p Chris@41: } Chris@41: Chris@41: # func_ltwrapper_executable_p file Chris@41: # True iff FILE is a libtool wrapper executable Chris@41: # This function is only a basic sanity check; it will hardly flush out Chris@41: # determined imposters. Chris@41: func_ltwrapper_executable_p () Chris@41: { Chris@41: func_ltwrapper_exec_suffix= Chris@41: case $1 in Chris@41: *.exe) ;; Chris@41: *) func_ltwrapper_exec_suffix=.exe ;; Chris@41: esac Chris@41: $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 Chris@41: } Chris@41: Chris@41: # func_ltwrapper_scriptname file Chris@41: # Assumes file is an ltwrapper_executable Chris@41: # uses $file to determine the appropriate filename for a Chris@41: # temporary ltwrapper_script. Chris@41: func_ltwrapper_scriptname () Chris@41: { Chris@41: func_dirname_and_basename "$1" "" "." Chris@41: func_stripname '' '.exe' "$func_basename_result" Chris@41: func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper Chris@41: } Chris@41: Chris@41: # func_ltwrapper_p file Chris@41: # True iff FILE is a libtool wrapper script or wrapper executable Chris@41: # This function is only a basic sanity check; it will hardly flush out Chris@41: # determined imposters. Chris@41: func_ltwrapper_p () Chris@41: { Chris@41: func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" Chris@41: } Chris@41: Chris@41: Chris@41: # func_execute_cmds commands fail_cmd Chris@41: # Execute tilde-delimited COMMANDS. Chris@41: # If FAIL_CMD is given, eval that upon failure. Chris@41: # FAIL_CMD may read-access the current command in variable CMD! Chris@41: func_execute_cmds () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: save_ifs=$IFS; IFS='~' Chris@41: for cmd in $1; do Chris@41: IFS=$sp$nl Chris@41: eval cmd=\"$cmd\" Chris@41: IFS=$save_ifs Chris@41: func_show_eval "$cmd" "${2-:}" Chris@41: done Chris@41: IFS=$save_ifs Chris@41: } Chris@41: Chris@41: Chris@41: # func_source file Chris@41: # Source FILE, adding directory component if necessary. Chris@41: # Note that it is not necessary on cygwin/mingw to append a dot to Chris@41: # FILE even if both FILE and FILE.exe exist: automatic-append-.exe Chris@41: # behavior happens only for exec(3), not for open(2)! Also, sourcing Chris@41: # 'FILE.' does not work on cygwin managed mounts. Chris@41: func_source () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $1 in Chris@41: */* | *\\*) . "$1" ;; Chris@41: *) . "./$1" ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: Chris@41: # func_resolve_sysroot PATH Chris@41: # Replace a leading = in PATH with a sysroot. Store the result into Chris@41: # func_resolve_sysroot_result Chris@41: func_resolve_sysroot () Chris@41: { Chris@41: func_resolve_sysroot_result=$1 Chris@41: case $func_resolve_sysroot_result in Chris@41: =*) Chris@41: func_stripname '=' '' "$func_resolve_sysroot_result" Chris@41: func_resolve_sysroot_result=$lt_sysroot$func_stripname_result Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: # func_replace_sysroot PATH Chris@41: # If PATH begins with the sysroot, replace it with = and Chris@41: # store the result into func_replace_sysroot_result. Chris@41: func_replace_sysroot () Chris@41: { Chris@41: case $lt_sysroot:$1 in Chris@41: ?*:"$lt_sysroot"*) Chris@41: func_stripname "$lt_sysroot" '' "$1" Chris@41: func_replace_sysroot_result='='$func_stripname_result Chris@41: ;; Chris@41: *) Chris@41: # Including no sysroot. Chris@41: func_replace_sysroot_result=$1 Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: # func_infer_tag arg Chris@41: # Infer tagged configuration to use if any are available and Chris@41: # if one wasn't chosen via the "--tag" command line option. Chris@41: # Only attempt this if the compiler in the base compile Chris@41: # command doesn't match the default compiler. Chris@41: # arg is usually of the form 'gcc ...' Chris@41: func_infer_tag () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if test -n "$available_tags" && test -z "$tagname"; then Chris@41: CC_quoted= Chris@41: for arg in $CC; do Chris@41: func_append_quoted CC_quoted "$arg" Chris@41: done Chris@41: CC_expanded=`func_echo_all $CC` Chris@41: CC_quoted_expanded=`func_echo_all $CC_quoted` Chris@41: case $@ in Chris@41: # Blanks in the command may have been stripped by the calling shell, Chris@41: # but not from the CC environment variable when configure was run. Chris@41: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ Chris@41: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; Chris@41: # Blanks at the start of $base_compile will cause this to fail Chris@41: # if we don't check for them as well. Chris@41: *) Chris@41: for z in $available_tags; do Chris@41: if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then Chris@41: # Evaluate the configuration. Chris@41: eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" Chris@41: CC_quoted= Chris@41: for arg in $CC; do Chris@41: # Double-quote args containing other shell metacharacters. Chris@41: func_append_quoted CC_quoted "$arg" Chris@41: done Chris@41: CC_expanded=`func_echo_all $CC` Chris@41: CC_quoted_expanded=`func_echo_all $CC_quoted` Chris@41: case "$@ " in Chris@41: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ Chris@41: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) Chris@41: # The compiler in the base compile command matches Chris@41: # the one in the tagged configuration. Chris@41: # Assume this is the tagged configuration we want. Chris@41: tagname=$z Chris@41: break Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: done Chris@41: # If $tagname still isn't set, then no tagged configuration Chris@41: # was found and let the user know that the "--tag" command Chris@41: # line option must be used. Chris@41: if test -z "$tagname"; then Chris@41: func_echo "unable to infer tagged configuration" Chris@41: func_fatal_error "specify a tag with '--tag'" Chris@41: # else Chris@41: # func_verbose "using $tagname tagged configuration" Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: Chris@41: # func_write_libtool_object output_name pic_name nonpic_name Chris@41: # Create a libtool object file (analogous to a ".la" file), Chris@41: # but don't create it if we're doing a dry run. Chris@41: func_write_libtool_object () Chris@41: { Chris@41: write_libobj=$1 Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: write_lobj=\'$2\' Chris@41: else Chris@41: write_lobj=none Chris@41: fi Chris@41: Chris@41: if test yes = "$build_old_libs"; then Chris@41: write_oldobj=\'$3\' Chris@41: else Chris@41: write_oldobj=none Chris@41: fi Chris@41: Chris@41: $opt_dry_run || { Chris@41: cat >${write_libobj}T </dev/null` Chris@41: if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then Chris@41: func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | Chris@41: $SED -e "$sed_naive_backslashify"` Chris@41: else Chris@41: func_convert_core_file_wine_to_w32_result= Chris@41: fi Chris@41: fi Chris@41: } Chris@41: # end: func_convert_core_file_wine_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_core_path_wine_to_w32 ARG Chris@41: # Helper function used by path conversion functions when $build is *nix, and Chris@41: # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly Chris@41: # configured wine environment available, with the winepath program in $build's Chris@41: # $PATH. Assumes ARG has no leading or trailing path separator characters. Chris@41: # Chris@41: # ARG is path to be converted from $build format to win32. Chris@41: # Result is available in $func_convert_core_path_wine_to_w32_result. Chris@41: # Unconvertible file (directory) names in ARG are skipped; if no directory names Chris@41: # are convertible, then the result may be empty. Chris@41: func_convert_core_path_wine_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # unfortunately, winepath doesn't convert paths, only file names Chris@41: func_convert_core_path_wine_to_w32_result= Chris@41: if test -n "$1"; then Chris@41: oldIFS=$IFS Chris@41: IFS=: Chris@41: for func_convert_core_path_wine_to_w32_f in $1; do Chris@41: IFS=$oldIFS Chris@41: func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" Chris@41: if test -n "$func_convert_core_file_wine_to_w32_result"; then Chris@41: if test -z "$func_convert_core_path_wine_to_w32_result"; then Chris@41: func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result Chris@41: else Chris@41: func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" Chris@41: fi Chris@41: fi Chris@41: done Chris@41: IFS=$oldIFS Chris@41: fi Chris@41: } Chris@41: # end: func_convert_core_path_wine_to_w32 Chris@41: Chris@41: Chris@41: # func_cygpath ARGS... Chris@41: # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when Chris@41: # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) Chris@41: # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or Chris@41: # (2), returns the Cygwin file name or path in func_cygpath_result (input Chris@41: # file name or path is assumed to be in w32 format, as previously converted Chris@41: # from $build's *nix or MSYS format). In case (3), returns the w32 file name Chris@41: # or path in func_cygpath_result (input file name or path is assumed to be in Chris@41: # Cygwin format). Returns an empty string on error. Chris@41: # Chris@41: # ARGS are passed to cygpath, with the last one being the file name or path to Chris@41: # be converted. Chris@41: # Chris@41: # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH Chris@41: # environment variable; do not put it in $PATH. Chris@41: func_cygpath () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then Chris@41: func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` Chris@41: if test "$?" -ne 0; then Chris@41: # on failure, ensure result is empty Chris@41: func_cygpath_result= Chris@41: fi Chris@41: else Chris@41: func_cygpath_result= Chris@41: func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" Chris@41: fi Chris@41: } Chris@41: #end: func_cygpath Chris@41: Chris@41: Chris@41: # func_convert_core_msys_to_w32 ARG Chris@41: # Convert file name or path ARG from MSYS format to w32 format. Return Chris@41: # result in func_convert_core_msys_to_w32_result. Chris@41: func_convert_core_msys_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # awkward: cmd appends spaces to result Chris@41: func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | Chris@41: $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` Chris@41: } Chris@41: #end: func_convert_core_msys_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_file_check ARG1 ARG2 Chris@41: # Verify that ARG1 (a file name in $build format) was converted to $host Chris@41: # format in ARG2. Otherwise, emit an error message, but continue (resetting Chris@41: # func_to_host_file_result to ARG1). Chris@41: func_convert_file_check () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if test -z "$2" && test -n "$1"; then Chris@41: func_error "Could not determine host file name corresponding to" Chris@41: func_error " '$1'" Chris@41: func_error "Continuing, but uninstalled executables may not work." Chris@41: # Fallback: Chris@41: func_to_host_file_result=$1 Chris@41: fi Chris@41: } Chris@41: # end func_convert_file_check Chris@41: Chris@41: Chris@41: # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH Chris@41: # Verify that FROM_PATH (a path in $build format) was converted to $host Chris@41: # format in TO_PATH. Otherwise, emit an error message, but continue, resetting Chris@41: # func_to_host_file_result to a simplistic fallback value (see below). Chris@41: func_convert_path_check () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if test -z "$4" && test -n "$3"; then Chris@41: func_error "Could not determine the host path corresponding to" Chris@41: func_error " '$3'" Chris@41: func_error "Continuing, but uninstalled executables may not work." Chris@41: # Fallback. This is a deliberately simplistic "conversion" and Chris@41: # should not be "improved". See libtool.info. Chris@41: if test "x$1" != "x$2"; then Chris@41: lt_replace_pathsep_chars="s|$1|$2|g" Chris@41: func_to_host_path_result=`echo "$3" | Chris@41: $SED -e "$lt_replace_pathsep_chars"` Chris@41: else Chris@41: func_to_host_path_result=$3 Chris@41: fi Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_check Chris@41: Chris@41: Chris@41: # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG Chris@41: # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT Chris@41: # and appending REPL if ORIG matches BACKPAT. Chris@41: func_convert_path_front_back_pathsep () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $4 in Chris@41: $1 ) func_to_host_path_result=$3$func_to_host_path_result Chris@41: ;; Chris@41: esac Chris@41: case $4 in Chris@41: $2 ) func_append func_to_host_path_result "$3" Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: # end func_convert_path_front_back_pathsep Chris@41: Chris@41: Chris@41: ################################################## Chris@41: # $build to $host FILE NAME CONVERSION FUNCTIONS # Chris@41: ################################################## Chris@41: # invoked via '$to_host_file_cmd ARG' Chris@41: # Chris@41: # In each case, ARG is the path to be converted from $build to $host format. Chris@41: # Result will be available in $func_to_host_file_result. Chris@41: Chris@41: Chris@41: # func_to_host_file ARG Chris@41: # Converts the file name ARG from $build format to $host format. Return result Chris@41: # in func_to_host_file_result. Chris@41: func_to_host_file () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: $to_host_file_cmd "$1" Chris@41: } Chris@41: # end func_to_host_file Chris@41: Chris@41: Chris@41: # func_to_tool_file ARG LAZY Chris@41: # converts the file name ARG from $build format to toolchain format. Return Chris@41: # result in func_to_tool_file_result. If the conversion in use is listed Chris@41: # in (the comma separated) LAZY, no conversion takes place. Chris@41: func_to_tool_file () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case ,$2, in Chris@41: *,"$to_tool_file_cmd",*) Chris@41: func_to_tool_file_result=$1 Chris@41: ;; Chris@41: *) Chris@41: $to_tool_file_cmd "$1" Chris@41: func_to_tool_file_result=$func_to_host_file_result Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: # end func_to_tool_file Chris@41: Chris@41: Chris@41: # func_convert_file_noop ARG Chris@41: # Copy ARG to func_to_host_file_result. Chris@41: func_convert_file_noop () Chris@41: { Chris@41: func_to_host_file_result=$1 Chris@41: } Chris@41: # end func_convert_file_noop Chris@41: Chris@41: Chris@41: # func_convert_file_msys_to_w32 ARG Chris@41: # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic Chris@41: # conversion to w32 is not available inside the cwrapper. Returns result in Chris@41: # func_to_host_file_result. Chris@41: func_convert_file_msys_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_file_result=$1 Chris@41: if test -n "$1"; then Chris@41: func_convert_core_msys_to_w32 "$1" Chris@41: func_to_host_file_result=$func_convert_core_msys_to_w32_result Chris@41: fi Chris@41: func_convert_file_check "$1" "$func_to_host_file_result" Chris@41: } Chris@41: # end func_convert_file_msys_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_file_cygwin_to_w32 ARG Chris@41: # Convert file name ARG from Cygwin to w32 format. Returns result in Chris@41: # func_to_host_file_result. Chris@41: func_convert_file_cygwin_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_file_result=$1 Chris@41: if test -n "$1"; then Chris@41: # because $build is cygwin, we call "the" cygpath in $PATH; no need to use Chris@41: # LT_CYGPATH in this case. Chris@41: func_to_host_file_result=`cygpath -m "$1"` Chris@41: fi Chris@41: func_convert_file_check "$1" "$func_to_host_file_result" Chris@41: } Chris@41: # end func_convert_file_cygwin_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_file_nix_to_w32 ARG Chris@41: # Convert file name ARG from *nix to w32 format. Requires a wine environment Chris@41: # and a working winepath. Returns result in func_to_host_file_result. Chris@41: func_convert_file_nix_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_file_result=$1 Chris@41: if test -n "$1"; then Chris@41: func_convert_core_file_wine_to_w32 "$1" Chris@41: func_to_host_file_result=$func_convert_core_file_wine_to_w32_result Chris@41: fi Chris@41: func_convert_file_check "$1" "$func_to_host_file_result" Chris@41: } Chris@41: # end func_convert_file_nix_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_file_msys_to_cygwin ARG Chris@41: # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. Chris@41: # Returns result in func_to_host_file_result. Chris@41: func_convert_file_msys_to_cygwin () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_file_result=$1 Chris@41: if test -n "$1"; then Chris@41: func_convert_core_msys_to_w32 "$1" Chris@41: func_cygpath -u "$func_convert_core_msys_to_w32_result" Chris@41: func_to_host_file_result=$func_cygpath_result Chris@41: fi Chris@41: func_convert_file_check "$1" "$func_to_host_file_result" Chris@41: } Chris@41: # end func_convert_file_msys_to_cygwin Chris@41: Chris@41: Chris@41: # func_convert_file_nix_to_cygwin ARG Chris@41: # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed Chris@41: # in a wine environment, working winepath, and LT_CYGPATH set. Returns result Chris@41: # in func_to_host_file_result. Chris@41: func_convert_file_nix_to_cygwin () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_file_result=$1 Chris@41: if test -n "$1"; then Chris@41: # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. Chris@41: func_convert_core_file_wine_to_w32 "$1" Chris@41: func_cygpath -u "$func_convert_core_file_wine_to_w32_result" Chris@41: func_to_host_file_result=$func_cygpath_result Chris@41: fi Chris@41: func_convert_file_check "$1" "$func_to_host_file_result" Chris@41: } Chris@41: # end func_convert_file_nix_to_cygwin Chris@41: Chris@41: Chris@41: ############################################# Chris@41: # $build to $host PATH CONVERSION FUNCTIONS # Chris@41: ############################################# Chris@41: # invoked via '$to_host_path_cmd ARG' Chris@41: # Chris@41: # In each case, ARG is the path to be converted from $build to $host format. Chris@41: # The result will be available in $func_to_host_path_result. Chris@41: # Chris@41: # Path separators are also converted from $build format to $host format. If Chris@41: # ARG begins or ends with a path separator character, it is preserved (but Chris@41: # converted to $host format) on output. Chris@41: # Chris@41: # All path conversion functions are named using the following convention: Chris@41: # file name conversion function : func_convert_file_X_to_Y () Chris@41: # path conversion function : func_convert_path_X_to_Y () Chris@41: # where, for any given $build/$host combination the 'X_to_Y' value is the Chris@41: # same. If conversion functions are added for new $build/$host combinations, Chris@41: # the two new functions must follow this pattern, or func_init_to_host_path_cmd Chris@41: # will break. Chris@41: Chris@41: Chris@41: # func_init_to_host_path_cmd Chris@41: # Ensures that function "pointer" variable $to_host_path_cmd is set to the Chris@41: # appropriate value, based on the value of $to_host_file_cmd. Chris@41: to_host_path_cmd= Chris@41: func_init_to_host_path_cmd () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if test -z "$to_host_path_cmd"; then Chris@41: func_stripname 'func_convert_file_' '' "$to_host_file_cmd" Chris@41: to_host_path_cmd=func_convert_path_$func_stripname_result Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: # func_to_host_path ARG Chris@41: # Converts the path ARG from $build format to $host format. Return result Chris@41: # in func_to_host_path_result. Chris@41: func_to_host_path () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_init_to_host_path_cmd Chris@41: $to_host_path_cmd "$1" Chris@41: } Chris@41: # end func_to_host_path Chris@41: Chris@41: Chris@41: # func_convert_path_noop ARG Chris@41: # Copy ARG to func_to_host_path_result. Chris@41: func_convert_path_noop () Chris@41: { Chris@41: func_to_host_path_result=$1 Chris@41: } Chris@41: # end func_convert_path_noop Chris@41: Chris@41: Chris@41: # func_convert_path_msys_to_w32 ARG Chris@41: # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic Chris@41: # conversion to w32 is not available inside the cwrapper. Returns result in Chris@41: # func_to_host_path_result. Chris@41: func_convert_path_msys_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_path_result=$1 Chris@41: if test -n "$1"; then Chris@41: # Remove leading and trailing path separator characters from ARG. MSYS Chris@41: # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; Chris@41: # and winepath ignores them completely. Chris@41: func_stripname : : "$1" Chris@41: func_to_host_path_tmp1=$func_stripname_result Chris@41: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" Chris@41: func_to_host_path_result=$func_convert_core_msys_to_w32_result Chris@41: func_convert_path_check : ";" \ Chris@41: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@41: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_msys_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_path_cygwin_to_w32 ARG Chris@41: # Convert path ARG from Cygwin to w32 format. Returns result in Chris@41: # func_to_host_file_result. Chris@41: func_convert_path_cygwin_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_path_result=$1 Chris@41: if test -n "$1"; then Chris@41: # See func_convert_path_msys_to_w32: Chris@41: func_stripname : : "$1" Chris@41: func_to_host_path_tmp1=$func_stripname_result Chris@41: func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` Chris@41: func_convert_path_check : ";" \ Chris@41: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@41: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_cygwin_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_path_nix_to_w32 ARG Chris@41: # Convert path ARG from *nix to w32 format. Requires a wine environment and Chris@41: # a working winepath. Returns result in func_to_host_file_result. Chris@41: func_convert_path_nix_to_w32 () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_path_result=$1 Chris@41: if test -n "$1"; then Chris@41: # See func_convert_path_msys_to_w32: Chris@41: func_stripname : : "$1" Chris@41: func_to_host_path_tmp1=$func_stripname_result Chris@41: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" Chris@41: func_to_host_path_result=$func_convert_core_path_wine_to_w32_result Chris@41: func_convert_path_check : ";" \ Chris@41: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@41: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_nix_to_w32 Chris@41: Chris@41: Chris@41: # func_convert_path_msys_to_cygwin ARG Chris@41: # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. Chris@41: # Returns result in func_to_host_file_result. Chris@41: func_convert_path_msys_to_cygwin () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_path_result=$1 Chris@41: if test -n "$1"; then Chris@41: # See func_convert_path_msys_to_w32: Chris@41: func_stripname : : "$1" Chris@41: func_to_host_path_tmp1=$func_stripname_result Chris@41: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" Chris@41: func_cygpath -u -p "$func_convert_core_msys_to_w32_result" Chris@41: func_to_host_path_result=$func_cygpath_result Chris@41: func_convert_path_check : : \ Chris@41: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@41: func_convert_path_front_back_pathsep ":*" "*:" : "$1" Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_msys_to_cygwin Chris@41: Chris@41: Chris@41: # func_convert_path_nix_to_cygwin ARG Chris@41: # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a Chris@41: # a wine environment, working winepath, and LT_CYGPATH set. Returns result in Chris@41: # func_to_host_file_result. Chris@41: func_convert_path_nix_to_cygwin () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_host_path_result=$1 Chris@41: if test -n "$1"; then Chris@41: # Remove leading and trailing path separator characters from Chris@41: # ARG. msys behavior is inconsistent here, cygpath turns them Chris@41: # into '.;' and ';.', and winepath ignores them completely. Chris@41: func_stripname : : "$1" Chris@41: func_to_host_path_tmp1=$func_stripname_result Chris@41: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" Chris@41: func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" Chris@41: func_to_host_path_result=$func_cygpath_result Chris@41: func_convert_path_check : : \ Chris@41: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@41: func_convert_path_front_back_pathsep ":*" "*:" : "$1" Chris@41: fi Chris@41: } Chris@41: # end func_convert_path_nix_to_cygwin Chris@41: Chris@41: Chris@41: # func_dll_def_p FILE Chris@41: # True iff FILE is a Windows DLL '.def' file. Chris@41: # Keep in sync with _LT_DLL_DEF_P in libtool.m4 Chris@41: func_dll_def_p () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_dll_def_p_tmp=`$SED -n \ Chris@41: -e 's/^[ ]*//' \ Chris@41: -e '/^\(;.*\)*$/d' \ Chris@41: -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ Chris@41: -e q \ Chris@41: "$1"` Chris@41: test DEF = "$func_dll_def_p_tmp" Chris@41: } Chris@41: Chris@41: Chris@41: # func_mode_compile arg... Chris@41: func_mode_compile () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # Get the compilation command and the source file. Chris@41: base_compile= Chris@41: srcfile=$nonopt # always keep a non-empty value in "srcfile" Chris@41: suppress_opt=yes Chris@41: suppress_output= Chris@41: arg_mode=normal Chris@41: libobj= Chris@41: later= Chris@41: pie_flag= Chris@41: Chris@41: for arg Chris@41: do Chris@41: case $arg_mode in Chris@41: arg ) Chris@41: # do not "continue". Instead, add this to base_compile Chris@41: lastarg=$arg Chris@41: arg_mode=normal Chris@41: ;; Chris@41: Chris@41: target ) Chris@41: libobj=$arg Chris@41: arg_mode=normal Chris@41: continue Chris@41: ;; Chris@41: Chris@41: normal ) Chris@41: # Accept any command-line options. Chris@41: case $arg in Chris@41: -o) Chris@41: test -n "$libobj" && \ Chris@41: func_fatal_error "you cannot specify '-o' more than once" Chris@41: arg_mode=target Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -pie | -fpie | -fPIE) Chris@41: func_append pie_flag " $arg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -shared | -static | -prefer-pic | -prefer-non-pic) Chris@41: func_append later " $arg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -no-suppress) Chris@41: suppress_opt=no Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -Xcompiler) Chris@41: arg_mode=arg # the next one goes into the "base_compile" arg list Chris@41: continue # The current "srcfile" will either be retained or Chris@41: ;; # replaced later. I would guess that would be a bug. Chris@41: Chris@41: -Wc,*) Chris@41: func_stripname '-Wc,' '' "$arg" Chris@41: args=$func_stripname_result Chris@41: lastarg= Chris@41: save_ifs=$IFS; IFS=, Chris@41: for arg in $args; do Chris@41: IFS=$save_ifs Chris@41: func_append_quoted lastarg "$arg" Chris@41: done Chris@41: IFS=$save_ifs Chris@41: func_stripname ' ' '' "$lastarg" Chris@41: lastarg=$func_stripname_result Chris@41: Chris@41: # Add the arguments to base_compile. Chris@41: func_append base_compile " $lastarg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: *) Chris@41: # Accept the current argument as the source file. Chris@41: # The previous "srcfile" becomes the current argument. Chris@41: # Chris@41: lastarg=$srcfile Chris@41: srcfile=$arg Chris@41: ;; Chris@41: esac # case $arg Chris@41: ;; Chris@41: esac # case $arg_mode Chris@41: Chris@41: # Aesthetically quote the previous argument. Chris@41: func_append_quoted base_compile "$lastarg" Chris@41: done # for arg Chris@41: Chris@41: case $arg_mode in Chris@41: arg) Chris@41: func_fatal_error "you must specify an argument for -Xcompile" Chris@41: ;; Chris@41: target) Chris@41: func_fatal_error "you must specify a target with '-o'" Chris@41: ;; Chris@41: *) Chris@41: # Get the name of the library object. Chris@41: test -z "$libobj" && { Chris@41: func_basename "$srcfile" Chris@41: libobj=$func_basename_result Chris@41: } Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Recognize several different file suffixes. Chris@41: # If the user specifies -o file.o, it is replaced with file.lo Chris@41: case $libobj in Chris@41: *.[cCFSifmso] | \ Chris@41: *.ada | *.adb | *.ads | *.asm | \ Chris@41: *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ Chris@41: *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) Chris@41: func_xform "$libobj" Chris@41: libobj=$func_xform_result Chris@41: ;; Chris@41: esac Chris@41: Chris@41: case $libobj in Chris@41: *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; Chris@41: *) Chris@41: func_fatal_error "cannot determine name of library object from '$libobj'" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: func_infer_tag $base_compile Chris@41: Chris@41: for arg in $later; do Chris@41: case $arg in Chris@41: -shared) Chris@41: test yes = "$build_libtool_libs" \ Chris@41: || func_fatal_configuration "cannot build a shared library" Chris@41: build_old_libs=no Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -static) Chris@41: build_libtool_libs=no Chris@41: build_old_libs=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -prefer-pic) Chris@41: pic_mode=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -prefer-non-pic) Chris@41: pic_mode=no Chris@41: continue Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: func_quote_for_eval "$libobj" Chris@41: test "X$libobj" != "X$func_quote_for_eval_result" \ Chris@41: && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ Chris@41: && func_warning "libobj name '$libobj' may not contain shell special characters." Chris@41: func_dirname_and_basename "$obj" "/" "" Chris@41: objname=$func_basename_result Chris@41: xdir=$func_dirname_result Chris@41: lobj=$xdir$objdir/$objname Chris@41: Chris@41: test -z "$base_compile" && \ Chris@41: func_fatal_help "you must specify a compilation command" Chris@41: Chris@41: # Delete any leftover library objects. Chris@41: if test yes = "$build_old_libs"; then Chris@41: removelist="$obj $lobj $libobj ${libobj}T" Chris@41: else Chris@41: removelist="$lobj $libobj ${libobj}T" Chris@41: fi Chris@41: Chris@41: # On Cygwin there's no "real" PIC flag so we must build both object types Chris@41: case $host_os in Chris@41: cygwin* | mingw* | pw32* | os2* | cegcc*) Chris@41: pic_mode=default Chris@41: ;; Chris@41: esac Chris@41: if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then Chris@41: # non-PIC code in shared libraries is not supported Chris@41: pic_mode=default Chris@41: fi Chris@41: Chris@41: # Calculate the filename of the output object if compiler does Chris@41: # not support -o with -c Chris@41: if test no = "$compiler_c_o"; then Chris@41: output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext Chris@41: lockfile=$output_obj.lock Chris@41: else Chris@41: output_obj= Chris@41: need_locks=no Chris@41: lockfile= Chris@41: fi Chris@41: Chris@41: # Lock this critical section if it is needed Chris@41: # We use this script file to make the link, it avoids creating a new file Chris@41: if test yes = "$need_locks"; then Chris@41: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do Chris@41: func_echo "Waiting for $lockfile to be removed" Chris@41: sleep 2 Chris@41: done Chris@41: elif test warn = "$need_locks"; then Chris@41: if test -f "$lockfile"; then Chris@41: $ECHO "\ Chris@41: *** ERROR, $lockfile exists and contains: Chris@41: `cat $lockfile 2>/dev/null` Chris@41: Chris@41: This indicates that another process is trying to use the same Chris@41: temporary object file, and libtool could not work around it because Chris@41: your compiler does not support '-c' and '-o' together. If you Chris@41: repeat this compilation, it may succeed, by chance, but you had better Chris@41: avoid parallel builds (make -j) in this platform, or get a better Chris@41: compiler." Chris@41: Chris@41: $opt_dry_run || $RM $removelist Chris@41: exit $EXIT_FAILURE Chris@41: fi Chris@41: func_append removelist " $output_obj" Chris@41: $ECHO "$srcfile" > "$lockfile" Chris@41: fi Chris@41: Chris@41: $opt_dry_run || $RM $removelist Chris@41: func_append removelist " $lockfile" Chris@41: trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 Chris@41: Chris@41: func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 Chris@41: srcfile=$func_to_tool_file_result Chris@41: func_quote_for_eval "$srcfile" Chris@41: qsrcfile=$func_quote_for_eval_result Chris@41: Chris@41: # Only build a PIC object if we are building libtool libraries. Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: # Without this assignment, base_compile gets emptied. Chris@41: fbsd_hideous_sh_bug=$base_compile Chris@41: Chris@41: if test no != "$pic_mode"; then Chris@41: command="$base_compile $qsrcfile $pic_flag" Chris@41: else Chris@41: # Don't build PIC code Chris@41: command="$base_compile $qsrcfile" Chris@41: fi Chris@41: Chris@41: func_mkdir_p "$xdir$objdir" Chris@41: Chris@41: if test -z "$output_obj"; then Chris@41: # Place PIC objects in $objdir Chris@41: func_append command " -o $lobj" Chris@41: fi Chris@41: Chris@41: func_show_eval_locale "$command" \ Chris@41: 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' Chris@41: Chris@41: if test warn = "$need_locks" && Chris@41: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then Chris@41: $ECHO "\ Chris@41: *** ERROR, $lockfile contains: Chris@41: `cat $lockfile 2>/dev/null` Chris@41: Chris@41: but it should contain: Chris@41: $srcfile Chris@41: Chris@41: This indicates that another process is trying to use the same Chris@41: temporary object file, and libtool could not work around it because Chris@41: your compiler does not support '-c' and '-o' together. If you Chris@41: repeat this compilation, it may succeed, by chance, but you had better Chris@41: avoid parallel builds (make -j) in this platform, or get a better Chris@41: compiler." Chris@41: Chris@41: $opt_dry_run || $RM $removelist Chris@41: exit $EXIT_FAILURE Chris@41: fi Chris@41: Chris@41: # Just move the object if needed, then go on to compile the next one Chris@41: if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then Chris@41: func_show_eval '$MV "$output_obj" "$lobj"' \ Chris@41: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' Chris@41: fi Chris@41: Chris@41: # Allow error messages only from the first compilation. Chris@41: if test yes = "$suppress_opt"; then Chris@41: suppress_output=' >/dev/null 2>&1' Chris@41: fi Chris@41: fi Chris@41: Chris@41: # Only build a position-dependent object if we build old libraries. Chris@41: if test yes = "$build_old_libs"; then Chris@41: if test yes != "$pic_mode"; then Chris@41: # Don't build PIC code Chris@41: command="$base_compile $qsrcfile$pie_flag" Chris@41: else Chris@41: command="$base_compile $qsrcfile $pic_flag" Chris@41: fi Chris@41: if test yes = "$compiler_c_o"; then Chris@41: func_append command " -o $obj" Chris@41: fi Chris@41: Chris@41: # Suppress compiler output if we already did a PIC compilation. Chris@41: func_append command "$suppress_output" Chris@41: func_show_eval_locale "$command" \ Chris@41: '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' Chris@41: Chris@41: if test warn = "$need_locks" && Chris@41: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then Chris@41: $ECHO "\ Chris@41: *** ERROR, $lockfile contains: Chris@41: `cat $lockfile 2>/dev/null` Chris@41: Chris@41: but it should contain: Chris@41: $srcfile Chris@41: Chris@41: This indicates that another process is trying to use the same Chris@41: temporary object file, and libtool could not work around it because Chris@41: your compiler does not support '-c' and '-o' together. If you Chris@41: repeat this compilation, it may succeed, by chance, but you had better Chris@41: avoid parallel builds (make -j) in this platform, or get a better Chris@41: compiler." Chris@41: Chris@41: $opt_dry_run || $RM $removelist Chris@41: exit $EXIT_FAILURE Chris@41: fi Chris@41: Chris@41: # Just move the object if needed Chris@41: if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then Chris@41: func_show_eval '$MV "$output_obj" "$obj"' \ Chris@41: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' Chris@41: fi Chris@41: fi Chris@41: Chris@41: $opt_dry_run || { Chris@41: func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" Chris@41: Chris@41: # Unlock the critical section if it was locked Chris@41: if test no != "$need_locks"; then Chris@41: removelist=$lockfile Chris@41: $RM "$lockfile" Chris@41: fi Chris@41: } Chris@41: Chris@41: exit $EXIT_SUCCESS Chris@41: } Chris@41: Chris@41: $opt_help || { Chris@41: test compile = "$opt_mode" && func_mode_compile ${1+"$@"} Chris@41: } Chris@41: Chris@41: func_mode_help () Chris@41: { Chris@41: # We need to display help for each of the modes. Chris@41: case $opt_mode in Chris@41: "") Chris@41: # Generic help is extracted from the usage comments Chris@41: # at the start of this file. Chris@41: func_help Chris@41: ;; Chris@41: Chris@41: clean) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Chris@41: Chris@41: Remove files from the build directory. Chris@41: Chris@41: RM is the name of the program to use to delete files associated with each FILE Chris@41: (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed Chris@41: to RM. Chris@41: Chris@41: If FILE is a libtool library, object or program, all the files associated Chris@41: with it are deleted. Otherwise, only FILE itself is deleted using RM." Chris@41: ;; Chris@41: Chris@41: compile) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Chris@41: Chris@41: Compile a source file into a libtool library object. Chris@41: Chris@41: This mode accepts the following additional options: Chris@41: Chris@41: -o OUTPUT-FILE set the output file name to OUTPUT-FILE Chris@41: -no-suppress do not suppress compiler output for multiple passes Chris@41: -prefer-pic try to build PIC objects only Chris@41: -prefer-non-pic try to build non-PIC objects only Chris@41: -shared do not build a '.o' file suitable for static linking Chris@41: -static only build a '.o' file suitable for static linking Chris@41: -Wc,FLAG pass FLAG directly to the compiler Chris@41: Chris@41: COMPILE-COMMAND is a command to be used in creating a 'standard' object file Chris@41: from the given SOURCEFILE. Chris@41: Chris@41: The output file name is determined by removing the directory component from Chris@41: SOURCEFILE, then substituting the C source code suffix '.c' with the Chris@41: library object suffix, '.lo'." Chris@41: ;; Chris@41: Chris@41: execute) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Chris@41: Chris@41: Automatically set library path, then run a program. Chris@41: Chris@41: This mode accepts the following additional options: Chris@41: Chris@41: -dlopen FILE add the directory containing FILE to the library path Chris@41: Chris@41: This mode sets the library path environment variable according to '-dlopen' Chris@41: flags. Chris@41: Chris@41: If any of the ARGS are libtool executable wrappers, then they are translated Chris@41: into their corresponding uninstalled binary, and any of their required library Chris@41: directories are added to the library path. Chris@41: Chris@41: Then, COMMAND is executed, with ARGS as arguments." Chris@41: ;; Chris@41: Chris@41: finish) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Chris@41: Chris@41: Complete the installation of libtool libraries. Chris@41: Chris@41: Each LIBDIR is a directory that contains libtool libraries. Chris@41: Chris@41: The commands that this mode executes may require superuser privileges. Use Chris@41: the '--dry-run' option if you just want to see what would be executed." Chris@41: ;; Chris@41: Chris@41: install) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Chris@41: Chris@41: Install executables or libraries. Chris@41: Chris@41: INSTALL-COMMAND is the installation command. The first component should be Chris@41: either the 'install' or 'cp' program. Chris@41: Chris@41: The following components of INSTALL-COMMAND are treated specially: Chris@41: Chris@41: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation Chris@41: Chris@41: The rest of the components are interpreted as arguments to that command (only Chris@41: BSD-compatible install options are recognized)." Chris@41: ;; Chris@41: Chris@41: link) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Chris@41: Chris@41: Link object files or libraries together to form another library, or to Chris@41: create an executable program. Chris@41: Chris@41: LINK-COMMAND is a command using the C compiler that you would use to create Chris@41: a program from several object files. Chris@41: Chris@41: The following components of LINK-COMMAND are treated specially: Chris@41: Chris@41: -all-static do not do any dynamic linking at all Chris@41: -avoid-version do not add a version suffix if possible Chris@41: -bindir BINDIR specify path to binaries directory (for systems where Chris@41: libraries must be found in the PATH setting at runtime) Chris@41: -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime Chris@41: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols Chris@41: -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) Chris@41: -export-symbols SYMFILE Chris@41: try to export only the symbols listed in SYMFILE Chris@41: -export-symbols-regex REGEX Chris@41: try to export only the symbols matching REGEX Chris@41: -LLIBDIR search LIBDIR for required installed libraries Chris@41: -lNAME OUTPUT-FILE requires the installed library libNAME Chris@41: -module build a library that can dlopened Chris@41: -no-fast-install disable the fast-install mode Chris@41: -no-install link a not-installable executable Chris@41: -no-undefined declare that a library does not refer to external symbols Chris@41: -o OUTPUT-FILE create OUTPUT-FILE from the specified objects Chris@41: -objectlist FILE use a list of object files found in FILE to specify objects Chris@41: -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) Chris@41: -precious-files-regex REGEX Chris@41: don't remove output files matching REGEX Chris@41: -release RELEASE specify package release information Chris@41: -rpath LIBDIR the created library will eventually be installed in LIBDIR Chris@41: -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries Chris@41: -shared only do dynamic linking of libtool libraries Chris@41: -shrext SUFFIX override the standard shared library file extension Chris@41: -static do not do any dynamic linking of uninstalled libtool libraries Chris@41: -static-libtool-libs Chris@41: do not do any dynamic linking of libtool libraries Chris@41: -version-info CURRENT[:REVISION[:AGE]] Chris@41: specify library version info [each variable defaults to 0] Chris@41: -weak LIBNAME declare that the target provides the LIBNAME interface Chris@41: -Wc,FLAG Chris@41: -Xcompiler FLAG pass linker-specific FLAG directly to the compiler Chris@41: -Wl,FLAG Chris@41: -Xlinker FLAG pass linker-specific FLAG directly to the linker Chris@41: -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) Chris@41: Chris@41: All other options (arguments beginning with '-') are ignored. Chris@41: Chris@41: Every other argument is treated as a filename. Files ending in '.la' are Chris@41: treated as uninstalled libtool libraries, other files are standard or library Chris@41: object files. Chris@41: Chris@41: If the OUTPUT-FILE ends in '.la', then a libtool library is created, Chris@41: only library objects ('.lo' files) may be specified, and '-rpath' is Chris@41: required, except when creating a convenience library. Chris@41: Chris@41: If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created Chris@41: using 'ar' and 'ranlib', or on Windows using 'lib'. Chris@41: Chris@41: If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file Chris@41: is created, otherwise an executable program is created." Chris@41: ;; Chris@41: Chris@41: uninstall) Chris@41: $ECHO \ Chris@41: "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Chris@41: Chris@41: Remove libraries from an installation directory. Chris@41: Chris@41: RM is the name of the program to use to delete files associated with each FILE Chris@41: (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed Chris@41: to RM. Chris@41: Chris@41: If FILE is a libtool library, all the files associated with it are deleted. Chris@41: Otherwise, only FILE itself is deleted using RM." Chris@41: ;; Chris@41: Chris@41: *) Chris@41: func_fatal_help "invalid operation mode '$opt_mode'" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: echo Chris@41: $ECHO "Try '$progname --help' for more information about other modes." Chris@41: } Chris@41: Chris@41: # Now that we've collected a possible --mode arg, show help if necessary Chris@41: if $opt_help; then Chris@41: if test : = "$opt_help"; then Chris@41: func_mode_help Chris@41: else Chris@41: { Chris@41: func_help noexit Chris@41: for opt_mode in compile link execute install finish uninstall clean; do Chris@41: func_mode_help Chris@41: done Chris@41: } | $SED -n '1p; 2,$s/^Usage:/ or: /p' Chris@41: { Chris@41: func_help noexit Chris@41: for opt_mode in compile link execute install finish uninstall clean; do Chris@41: echo Chris@41: func_mode_help Chris@41: done Chris@41: } | Chris@41: $SED '1d Chris@41: /^When reporting/,/^Report/{ Chris@41: H Chris@41: d Chris@41: } Chris@41: $x Chris@41: /information about other modes/d Chris@41: /more detailed .*MODE/d Chris@41: s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' Chris@41: fi Chris@41: exit $? Chris@41: fi Chris@41: Chris@41: Chris@41: # func_mode_execute arg... Chris@41: func_mode_execute () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # The first argument is the command name. Chris@41: cmd=$nonopt Chris@41: test -z "$cmd" && \ Chris@41: func_fatal_help "you must specify a COMMAND" Chris@41: Chris@41: # Handle -dlopen flags immediately. Chris@41: for file in $opt_dlopen; do Chris@41: test -f "$file" \ Chris@41: || func_fatal_help "'$file' is not a file" Chris@41: Chris@41: dir= Chris@41: case $file in Chris@41: *.la) Chris@41: func_resolve_sysroot "$file" Chris@41: file=$func_resolve_sysroot_result Chris@41: Chris@41: # Check to see that this really is a libtool archive. Chris@41: func_lalib_unsafe_p "$file" \ Chris@41: || func_fatal_help "'$lib' is not a valid libtool archive" Chris@41: Chris@41: # Read the libtool library. Chris@41: dlname= Chris@41: library_names= Chris@41: func_source "$file" Chris@41: Chris@41: # Skip this library if it cannot be dlopened. Chris@41: if test -z "$dlname"; then Chris@41: # Warn if it was a shared library. Chris@41: test -n "$library_names" && \ Chris@41: func_warning "'$file' was not linked with '-export-dynamic'" Chris@41: continue Chris@41: fi Chris@41: Chris@41: func_dirname "$file" "" "." Chris@41: dir=$func_dirname_result Chris@41: Chris@41: if test -f "$dir/$objdir/$dlname"; then Chris@41: func_append dir "/$objdir" Chris@41: else Chris@41: if test ! -f "$dir/$dlname"; then Chris@41: func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: Chris@41: *.lo) Chris@41: # Just add the directory containing the .lo file. Chris@41: func_dirname "$file" "" "." Chris@41: dir=$func_dirname_result Chris@41: ;; Chris@41: Chris@41: *) Chris@41: func_warning "'-dlopen' is ignored for non-libtool libraries and objects" Chris@41: continue Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Get the absolute pathname. Chris@41: absdir=`cd "$dir" && pwd` Chris@41: test -n "$absdir" && dir=$absdir Chris@41: Chris@41: # Now add the directory to shlibpath_var. Chris@41: if eval "test -z \"\$$shlibpath_var\""; then Chris@41: eval "$shlibpath_var=\"\$dir\"" Chris@41: else Chris@41: eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" Chris@41: fi Chris@41: done Chris@41: Chris@41: # This variable tells wrapper scripts just to set shlibpath_var Chris@41: # rather than running their programs. Chris@41: libtool_execute_magic=$magic Chris@41: Chris@41: # Check if any of the arguments is a wrapper script. Chris@41: args= Chris@41: for file Chris@41: do Chris@41: case $file in Chris@41: -* | *.la | *.lo ) ;; Chris@41: *) Chris@41: # Do a test to see if this is really a libtool program. Chris@41: if func_ltwrapper_script_p "$file"; then Chris@41: func_source "$file" Chris@41: # Transform arg to wrapped name. Chris@41: file=$progdir/$program Chris@41: elif func_ltwrapper_executable_p "$file"; then Chris@41: func_ltwrapper_scriptname "$file" Chris@41: func_source "$func_ltwrapper_scriptname_result" Chris@41: # Transform arg to wrapped name. Chris@41: file=$progdir/$program Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: # Quote arguments (to preserve shell metacharacters). Chris@41: func_append_quoted args "$file" Chris@41: done Chris@41: Chris@41: if $opt_dry_run; then Chris@41: # Display what would be done. Chris@41: if test -n "$shlibpath_var"; then Chris@41: eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" Chris@41: echo "export $shlibpath_var" Chris@41: fi Chris@41: $ECHO "$cmd$args" Chris@41: exit $EXIT_SUCCESS Chris@41: else Chris@41: if test -n "$shlibpath_var"; then Chris@41: # Export the shlibpath_var. Chris@41: eval "export $shlibpath_var" Chris@41: fi Chris@41: Chris@41: # Restore saved environment variables Chris@41: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES Chris@41: do Chris@41: eval "if test \"\${save_$lt_var+set}\" = set; then Chris@41: $lt_var=\$save_$lt_var; export $lt_var Chris@41: else Chris@41: $lt_unset $lt_var Chris@41: fi" Chris@41: done Chris@41: Chris@41: # Now prepare to actually exec the command. Chris@41: exec_cmd=\$cmd$args Chris@41: fi Chris@41: } Chris@41: Chris@41: test execute = "$opt_mode" && func_mode_execute ${1+"$@"} Chris@41: Chris@41: Chris@41: # func_mode_finish arg... Chris@41: func_mode_finish () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: libs= Chris@41: libdirs= Chris@41: admincmds= Chris@41: Chris@41: for opt in "$nonopt" ${1+"$@"} Chris@41: do Chris@41: if test -d "$opt"; then Chris@41: func_append libdirs " $opt" Chris@41: Chris@41: elif test -f "$opt"; then Chris@41: if func_lalib_unsafe_p "$opt"; then Chris@41: func_append libs " $opt" Chris@41: else Chris@41: func_warning "'$opt' is not a valid libtool archive" Chris@41: fi Chris@41: Chris@41: else Chris@41: func_fatal_error "invalid argument '$opt'" Chris@41: fi Chris@41: done Chris@41: Chris@41: if test -n "$libs"; then Chris@41: if test -n "$lt_sysroot"; then Chris@41: sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` Chris@41: sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" Chris@41: else Chris@41: sysroot_cmd= Chris@41: fi Chris@41: Chris@41: # Remove sysroot references Chris@41: if $opt_dry_run; then Chris@41: for lib in $libs; do Chris@41: echo "removing references to $lt_sysroot and '=' prefixes from $lib" Chris@41: done Chris@41: else Chris@41: tmpdir=`func_mktempdir` Chris@41: for lib in $libs; do Chris@41: $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ Chris@41: > $tmpdir/tmp-la Chris@41: mv -f $tmpdir/tmp-la $lib Chris@41: done Chris@41: ${RM}r "$tmpdir" Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then Chris@41: for libdir in $libdirs; do Chris@41: if test -n "$finish_cmds"; then Chris@41: # Do each command in the finish commands. Chris@41: func_execute_cmds "$finish_cmds" 'admincmds="$admincmds Chris@41: '"$cmd"'"' Chris@41: fi Chris@41: if test -n "$finish_eval"; then Chris@41: # Do the single finish_eval. Chris@41: eval cmds=\"$finish_eval\" Chris@41: $opt_dry_run || eval "$cmds" || func_append admincmds " Chris@41: $cmds" Chris@41: fi Chris@41: done Chris@41: fi Chris@41: Chris@41: # Exit here if they wanted silent mode. Chris@41: $opt_quiet && exit $EXIT_SUCCESS Chris@41: Chris@41: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then Chris@41: echo "----------------------------------------------------------------------" Chris@41: echo "Libraries have been installed in:" Chris@41: for libdir in $libdirs; do Chris@41: $ECHO " $libdir" Chris@41: done Chris@41: echo Chris@41: echo "If you ever happen to want to link against installed libraries" Chris@41: echo "in a given directory, LIBDIR, you must either use libtool, and" Chris@41: echo "specify the full pathname of the library, or use the '-LLIBDIR'" Chris@41: echo "flag during linking and do at least one of the following:" Chris@41: if test -n "$shlibpath_var"; then Chris@41: echo " - add LIBDIR to the '$shlibpath_var' environment variable" Chris@41: echo " during execution" Chris@41: fi Chris@41: if test -n "$runpath_var"; then Chris@41: echo " - add LIBDIR to the '$runpath_var' environment variable" Chris@41: echo " during linking" Chris@41: fi Chris@41: if test -n "$hardcode_libdir_flag_spec"; then Chris@41: libdir=LIBDIR Chris@41: eval flag=\"$hardcode_libdir_flag_spec\" Chris@41: Chris@41: $ECHO " - use the '$flag' linker flag" Chris@41: fi Chris@41: if test -n "$admincmds"; then Chris@41: $ECHO " - have your system administrator run these commands:$admincmds" Chris@41: fi Chris@41: if test -f /etc/ld.so.conf; then Chris@41: echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" Chris@41: fi Chris@41: echo Chris@41: Chris@41: echo "See any operating system documentation about shared libraries for" Chris@41: case $host in Chris@41: solaris2.[6789]|solaris2.1[0-9]) Chris@41: echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" Chris@41: echo "pages." Chris@41: ;; Chris@41: *) Chris@41: echo "more information, such as the ld(1) and ld.so(8) manual pages." Chris@41: ;; Chris@41: esac Chris@41: echo "----------------------------------------------------------------------" Chris@41: fi Chris@41: exit $EXIT_SUCCESS Chris@41: } Chris@41: Chris@41: test finish = "$opt_mode" && func_mode_finish ${1+"$@"} Chris@41: Chris@41: Chris@41: # func_mode_install arg... Chris@41: func_mode_install () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: # There may be an optional sh(1) argument at the beginning of Chris@41: # install_prog (especially on Windows NT). Chris@41: if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || Chris@41: # Allow the use of GNU shtool's install command. Chris@41: case $nonopt in *shtool*) :;; *) false;; esac Chris@41: then Chris@41: # Aesthetically quote it. Chris@41: func_quote_for_eval "$nonopt" Chris@41: install_prog="$func_quote_for_eval_result " Chris@41: arg=$1 Chris@41: shift Chris@41: else Chris@41: install_prog= Chris@41: arg=$nonopt Chris@41: fi Chris@41: Chris@41: # The real first argument should be the name of the installation program. Chris@41: # Aesthetically quote it. Chris@41: func_quote_for_eval "$arg" Chris@41: func_append install_prog "$func_quote_for_eval_result" Chris@41: install_shared_prog=$install_prog Chris@41: case " $install_prog " in Chris@41: *[\\\ /]cp\ *) install_cp=: ;; Chris@41: *) install_cp=false ;; Chris@41: esac Chris@41: Chris@41: # We need to accept at least all the BSD install flags. Chris@41: dest= Chris@41: files= Chris@41: opts= Chris@41: prev= Chris@41: install_type= Chris@41: isdir=false Chris@41: stripme= Chris@41: no_mode=: Chris@41: for arg Chris@41: do Chris@41: arg2= Chris@41: if test -n "$dest"; then Chris@41: func_append files " $dest" Chris@41: dest=$arg Chris@41: continue Chris@41: fi Chris@41: Chris@41: case $arg in Chris@41: -d) isdir=: ;; Chris@41: -f) Chris@41: if $install_cp; then :; else Chris@41: prev=$arg Chris@41: fi Chris@41: ;; Chris@41: -g | -m | -o) Chris@41: prev=$arg Chris@41: ;; Chris@41: -s) Chris@41: stripme=" -s" Chris@41: continue Chris@41: ;; Chris@41: -*) Chris@41: ;; Chris@41: *) Chris@41: # If the previous option needed an argument, then skip it. Chris@41: if test -n "$prev"; then Chris@41: if test X-m = "X$prev" && test -n "$install_override_mode"; then Chris@41: arg2=$install_override_mode Chris@41: no_mode=false Chris@41: fi Chris@41: prev= Chris@41: else Chris@41: dest=$arg Chris@41: continue Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Aesthetically quote the argument. Chris@41: func_quote_for_eval "$arg" Chris@41: func_append install_prog " $func_quote_for_eval_result" Chris@41: if test -n "$arg2"; then Chris@41: func_quote_for_eval "$arg2" Chris@41: fi Chris@41: func_append install_shared_prog " $func_quote_for_eval_result" Chris@41: done Chris@41: Chris@41: test -z "$install_prog" && \ Chris@41: func_fatal_help "you must specify an install program" Chris@41: Chris@41: test -n "$prev" && \ Chris@41: func_fatal_help "the '$prev' option requires an argument" Chris@41: Chris@41: if test -n "$install_override_mode" && $no_mode; then Chris@41: if $install_cp; then :; else Chris@41: func_quote_for_eval "$install_override_mode" Chris@41: func_append install_shared_prog " -m $func_quote_for_eval_result" Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test -z "$files"; then Chris@41: if test -z "$dest"; then Chris@41: func_fatal_help "no file or destination specified" Chris@41: else Chris@41: func_fatal_help "you must specify a destination" Chris@41: fi Chris@41: fi Chris@41: Chris@41: # Strip any trailing slash from the destination. Chris@41: func_stripname '' '/' "$dest" Chris@41: dest=$func_stripname_result Chris@41: Chris@41: # Check to see that the destination is a directory. Chris@41: test -d "$dest" && isdir=: Chris@41: if $isdir; then Chris@41: destdir=$dest Chris@41: destname= Chris@41: else Chris@41: func_dirname_and_basename "$dest" "" "." Chris@41: destdir=$func_dirname_result Chris@41: destname=$func_basename_result Chris@41: Chris@41: # Not a directory, so check to see that there is only one file specified. Chris@41: set dummy $files; shift Chris@41: test "$#" -gt 1 && \ Chris@41: func_fatal_help "'$dest' is not a directory" Chris@41: fi Chris@41: case $destdir in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@41: *) Chris@41: for file in $files; do Chris@41: case $file in Chris@41: *.lo) ;; Chris@41: *) Chris@41: func_fatal_help "'$destdir' must be an absolute directory name" Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # This variable tells wrapper scripts just to set variables rather Chris@41: # than running their programs. Chris@41: libtool_install_magic=$magic Chris@41: Chris@41: staticlibs= Chris@41: future_libdirs= Chris@41: current_libdirs= Chris@41: for file in $files; do Chris@41: Chris@41: # Do each installation. Chris@41: case $file in Chris@41: *.$libext) Chris@41: # Do the static libraries later. Chris@41: func_append staticlibs " $file" Chris@41: ;; Chris@41: Chris@41: *.la) Chris@41: func_resolve_sysroot "$file" Chris@41: file=$func_resolve_sysroot_result Chris@41: Chris@41: # Check to see that this really is a libtool archive. Chris@41: func_lalib_unsafe_p "$file" \ Chris@41: || func_fatal_help "'$file' is not a valid libtool archive" Chris@41: Chris@41: library_names= Chris@41: old_library= Chris@41: relink_command= Chris@41: func_source "$file" Chris@41: Chris@41: # Add the libdir to current_libdirs if it is the destination. Chris@41: if test "X$destdir" = "X$libdir"; then Chris@41: case "$current_libdirs " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append current_libdirs " $libdir" ;; Chris@41: esac Chris@41: else Chris@41: # Note the libdir as a future libdir. Chris@41: case "$future_libdirs " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append future_libdirs " $libdir" ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: func_dirname "$file" "/" "" Chris@41: dir=$func_dirname_result Chris@41: func_append dir "$objdir" Chris@41: Chris@41: if test -n "$relink_command"; then Chris@41: # Determine the prefix the user has applied to our future dir. Chris@41: inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` Chris@41: Chris@41: # Don't allow the user to place us outside of our expected Chris@41: # location b/c this prevents finding dependent libraries that Chris@41: # are installed to the same prefix. Chris@41: # At present, this check doesn't affect windows .dll's that Chris@41: # are installed into $libdir/../bin (currently, that works fine) Chris@41: # but it's something to keep an eye on. Chris@41: test "$inst_prefix_dir" = "$destdir" && \ Chris@41: func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" Chris@41: Chris@41: if test -n "$inst_prefix_dir"; then Chris@41: # Stick the inst_prefix_dir data into the link command. Chris@41: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` Chris@41: else Chris@41: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` Chris@41: fi Chris@41: Chris@41: func_warning "relinking '$file'" Chris@41: func_show_eval "$relink_command" \ Chris@41: 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' Chris@41: fi Chris@41: Chris@41: # See the names of the shared library. Chris@41: set dummy $library_names; shift Chris@41: if test -n "$1"; then Chris@41: realname=$1 Chris@41: shift Chris@41: Chris@41: srcname=$realname Chris@41: test -n "$relink_command" && srcname=${realname}T Chris@41: Chris@41: # Install the shared library and build the symlinks. Chris@41: func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ Chris@41: 'exit $?' Chris@41: tstripme=$stripme Chris@41: case $host_os in Chris@41: cygwin* | mingw* | pw32* | cegcc*) Chris@41: case $realname in Chris@41: *.dll.a) Chris@41: tstripme= Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: os2*) Chris@41: case $realname in Chris@41: *_dll.a) Chris@41: tstripme= Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: if test -n "$tstripme" && test -n "$striplib"; then Chris@41: func_show_eval "$striplib $destdir/$realname" 'exit $?' Chris@41: fi Chris@41: Chris@41: if test "$#" -gt 0; then Chris@41: # Delete the old symlinks, and create new ones. Chris@41: # Try 'ln -sf' first, because the 'ln' binary might depend on Chris@41: # the symlink we replace! Solaris /bin/ln does not understand -f, Chris@41: # so we also need to try rm && ln -s. Chris@41: for linkname Chris@41: do Chris@41: test "$linkname" != "$realname" \ Chris@41: && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" Chris@41: done Chris@41: fi Chris@41: Chris@41: # Do each command in the postinstall commands. Chris@41: lib=$destdir/$realname Chris@41: func_execute_cmds "$postinstall_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: # Install the pseudo-library for information purposes. Chris@41: func_basename "$file" Chris@41: name=$func_basename_result Chris@41: instname=$dir/${name}i Chris@41: func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' Chris@41: Chris@41: # Maybe install the static library, too. Chris@41: test -n "$old_library" && func_append staticlibs " $dir/$old_library" Chris@41: ;; Chris@41: Chris@41: *.lo) Chris@41: # Install (i.e. copy) a libtool object. Chris@41: Chris@41: # Figure out destination file name, if it wasn't already specified. Chris@41: if test -n "$destname"; then Chris@41: destfile=$destdir/$destname Chris@41: else Chris@41: func_basename "$file" Chris@41: destfile=$func_basename_result Chris@41: destfile=$destdir/$destfile Chris@41: fi Chris@41: Chris@41: # Deduce the name of the destination old-style object file. Chris@41: case $destfile in Chris@41: *.lo) Chris@41: func_lo2o "$destfile" Chris@41: staticdest=$func_lo2o_result Chris@41: ;; Chris@41: *.$objext) Chris@41: staticdest=$destfile Chris@41: destfile= Chris@41: ;; Chris@41: *) Chris@41: func_fatal_help "cannot copy a libtool object to '$destfile'" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Install the libtool object if requested. Chris@41: test -n "$destfile" && \ Chris@41: func_show_eval "$install_prog $file $destfile" 'exit $?' Chris@41: Chris@41: # Install the old object if enabled. Chris@41: if test yes = "$build_old_libs"; then Chris@41: # Deduce the name of the old-style object file. Chris@41: func_lo2o "$file" Chris@41: staticobj=$func_lo2o_result Chris@41: func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' Chris@41: fi Chris@41: exit $EXIT_SUCCESS Chris@41: ;; Chris@41: Chris@41: *) Chris@41: # Figure out destination file name, if it wasn't already specified. Chris@41: if test -n "$destname"; then Chris@41: destfile=$destdir/$destname Chris@41: else Chris@41: func_basename "$file" Chris@41: destfile=$func_basename_result Chris@41: destfile=$destdir/$destfile Chris@41: fi Chris@41: Chris@41: # If the file is missing, and there is a .exe on the end, strip it Chris@41: # because it is most likely a libtool script we actually want to Chris@41: # install Chris@41: stripped_ext= Chris@41: case $file in Chris@41: *.exe) Chris@41: if test ! -f "$file"; then Chris@41: func_stripname '' '.exe' "$file" Chris@41: file=$func_stripname_result Chris@41: stripped_ext=.exe Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Do a test to see if this is really a libtool program. Chris@41: case $host in Chris@41: *cygwin* | *mingw*) Chris@41: if func_ltwrapper_executable_p "$file"; then Chris@41: func_ltwrapper_scriptname "$file" Chris@41: wrapper=$func_ltwrapper_scriptname_result Chris@41: else Chris@41: func_stripname '' '.exe' "$file" Chris@41: wrapper=$func_stripname_result Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: wrapper=$file Chris@41: ;; Chris@41: esac Chris@41: if func_ltwrapper_script_p "$wrapper"; then Chris@41: notinst_deplibs= Chris@41: relink_command= Chris@41: Chris@41: func_source "$wrapper" Chris@41: Chris@41: # Check the variables that should have been set. Chris@41: test -z "$generated_by_libtool_version" && \ Chris@41: func_fatal_error "invalid libtool wrapper script '$wrapper'" Chris@41: Chris@41: finalize=: Chris@41: for lib in $notinst_deplibs; do Chris@41: # Check to see that each library is installed. Chris@41: libdir= Chris@41: if test -f "$lib"; then Chris@41: func_source "$lib" Chris@41: fi Chris@41: libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` Chris@41: if test -n "$libdir" && test ! -f "$libfile"; then Chris@41: func_warning "'$lib' has not been installed in '$libdir'" Chris@41: finalize=false Chris@41: fi Chris@41: done Chris@41: Chris@41: relink_command= Chris@41: func_source "$wrapper" Chris@41: Chris@41: outputname= Chris@41: if test no = "$fast_install" && test -n "$relink_command"; then Chris@41: $opt_dry_run || { Chris@41: if $finalize; then Chris@41: tmpdir=`func_mktempdir` Chris@41: func_basename "$file$stripped_ext" Chris@41: file=$func_basename_result Chris@41: outputname=$tmpdir/$file Chris@41: # Replace the output file specification. Chris@41: relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` Chris@41: Chris@41: $opt_quiet || { Chris@41: func_quote_for_expand "$relink_command" Chris@41: eval "func_echo $func_quote_for_expand_result" Chris@41: } Chris@41: if eval "$relink_command"; then : Chris@41: else Chris@41: func_error "error: relink '$file' with the above command before installing it" Chris@41: $opt_dry_run || ${RM}r "$tmpdir" Chris@41: continue Chris@41: fi Chris@41: file=$outputname Chris@41: else Chris@41: func_warning "cannot relink '$file'" Chris@41: fi Chris@41: } Chris@41: else Chris@41: # Install the binary that we compiled earlier. Chris@41: file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` Chris@41: fi Chris@41: fi Chris@41: Chris@41: # remove .exe since cygwin /usr/bin/install will append another Chris@41: # one anyway Chris@41: case $install_prog,$host in Chris@41: */usr/bin/install*,*cygwin*) Chris@41: case $file:$destfile in Chris@41: *.exe:*.exe) Chris@41: # this is ok Chris@41: ;; Chris@41: *.exe:*) Chris@41: destfile=$destfile.exe Chris@41: ;; Chris@41: *:*.exe) Chris@41: func_stripname '' '.exe' "$destfile" Chris@41: destfile=$func_stripname_result Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' Chris@41: $opt_dry_run || if test -n "$outputname"; then Chris@41: ${RM}r "$tmpdir" Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: for file in $staticlibs; do Chris@41: func_basename "$file" Chris@41: name=$func_basename_result Chris@41: Chris@41: # Set up the ranlib parameters. Chris@41: oldlib=$destdir/$name Chris@41: func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 Chris@41: tool_oldlib=$func_to_tool_file_result Chris@41: Chris@41: func_show_eval "$install_prog \$file \$oldlib" 'exit $?' Chris@41: Chris@41: if test -n "$stripme" && test -n "$old_striplib"; then Chris@41: func_show_eval "$old_striplib $tool_oldlib" 'exit $?' Chris@41: fi Chris@41: Chris@41: # Do each command in the postinstall commands. Chris@41: func_execute_cmds "$old_postinstall_cmds" 'exit $?' Chris@41: done Chris@41: Chris@41: test -n "$future_libdirs" && \ Chris@41: func_warning "remember to run '$progname --finish$future_libdirs'" Chris@41: Chris@41: if test -n "$current_libdirs"; then Chris@41: # Maybe just do a dry run. Chris@41: $opt_dry_run && current_libdirs=" -n$current_libdirs" Chris@41: exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' Chris@41: else Chris@41: exit $EXIT_SUCCESS Chris@41: fi Chris@41: } Chris@41: Chris@41: test install = "$opt_mode" && func_mode_install ${1+"$@"} Chris@41: Chris@41: Chris@41: # func_generate_dlsyms outputname originator pic_p Chris@41: # Extract symbols from dlprefiles and create ${outputname}S.o with Chris@41: # a dlpreopen symbol table. Chris@41: func_generate_dlsyms () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: my_outputname=$1 Chris@41: my_originator=$2 Chris@41: my_pic_p=${3-false} Chris@41: my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` Chris@41: my_dlsyms= Chris@41: Chris@41: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then Chris@41: if test -n "$NM" && test -n "$global_symbol_pipe"; then Chris@41: my_dlsyms=${my_outputname}S.c Chris@41: else Chris@41: func_error "not configured to extract global symbols from dlpreopened files" Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test -n "$my_dlsyms"; then Chris@41: case $my_dlsyms in Chris@41: "") ;; Chris@41: *.c) Chris@41: # Discover the nlist of each of the dlfiles. Chris@41: nlist=$output_objdir/$my_outputname.nm Chris@41: Chris@41: func_show_eval "$RM $nlist ${nlist}S ${nlist}T" Chris@41: Chris@41: # Parse the name list into a source file. Chris@41: func_verbose "creating $output_objdir/$my_dlsyms" Chris@41: Chris@41: $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ Chris@41: /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ Chris@41: /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ Chris@41: Chris@41: #ifdef __cplusplus Chris@41: extern \"C\" { Chris@41: #endif Chris@41: Chris@41: #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) Chris@41: #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" Chris@41: #endif Chris@41: Chris@41: /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ Chris@41: #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE Chris@41: /* DATA imports from DLLs on WIN32 can't be const, because runtime Chris@41: relocations are performed -- see ld's documentation on pseudo-relocs. */ Chris@41: # define LT_DLSYM_CONST Chris@41: #elif defined __osf__ Chris@41: /* This system does not cope well with relocations in const data. */ Chris@41: # define LT_DLSYM_CONST Chris@41: #else Chris@41: # define LT_DLSYM_CONST const Chris@41: #endif Chris@41: Chris@41: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) Chris@41: Chris@41: /* External symbol declarations for the compiler. */\ Chris@41: " Chris@41: Chris@41: if test yes = "$dlself"; then Chris@41: func_verbose "generating symbol list for '$output'" Chris@41: Chris@41: $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" Chris@41: Chris@41: # Add our own program objects to the symbol list. Chris@41: progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@41: for progfile in $progfiles; do Chris@41: func_to_tool_file "$progfile" func_convert_file_msys_to_w32 Chris@41: func_verbose "extracting global C symbols from '$func_to_tool_file_result'" Chris@41: $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" Chris@41: done Chris@41: Chris@41: if test -n "$exclude_expsyms"; then Chris@41: $opt_dry_run || { Chris@41: eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' Chris@41: eval '$MV "$nlist"T "$nlist"' Chris@41: } Chris@41: fi Chris@41: Chris@41: if test -n "$export_symbols_regex"; then Chris@41: $opt_dry_run || { Chris@41: eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' Chris@41: eval '$MV "$nlist"T "$nlist"' Chris@41: } Chris@41: fi Chris@41: Chris@41: # Prepare the list of exported symbols Chris@41: if test -z "$export_symbols"; then Chris@41: export_symbols=$output_objdir/$outputname.exp Chris@41: $opt_dry_run || { Chris@41: $RM $export_symbols Chris@41: eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' Chris@41: case $host in Chris@41: *cygwin* | *mingw* | *cegcc* ) Chris@41: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' Chris@41: eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: else Chris@41: $opt_dry_run || { Chris@41: eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' Chris@41: eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' Chris@41: eval '$MV "$nlist"T "$nlist"' Chris@41: case $host in Chris@41: *cygwin* | *mingw* | *cegcc* ) Chris@41: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' Chris@41: eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: fi Chris@41: fi Chris@41: Chris@41: for dlprefile in $dlprefiles; do Chris@41: func_verbose "extracting global C symbols from '$dlprefile'" Chris@41: func_basename "$dlprefile" Chris@41: name=$func_basename_result Chris@41: case $host in Chris@41: *cygwin* | *mingw* | *cegcc* ) Chris@41: # if an import library, we need to obtain dlname Chris@41: if func_win32_import_lib_p "$dlprefile"; then Chris@41: func_tr_sh "$dlprefile" Chris@41: eval "curr_lafile=\$libfile_$func_tr_sh_result" Chris@41: dlprefile_dlbasename= Chris@41: if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then Chris@41: # Use subshell, to avoid clobbering current variable values Chris@41: dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` Chris@41: if test -n "$dlprefile_dlname"; then Chris@41: func_basename "$dlprefile_dlname" Chris@41: dlprefile_dlbasename=$func_basename_result Chris@41: else Chris@41: # no lafile. user explicitly requested -dlpreopen . Chris@41: $sharedlib_from_linklib_cmd "$dlprefile" Chris@41: dlprefile_dlbasename=$sharedlib_from_linklib_result Chris@41: fi Chris@41: fi Chris@41: $opt_dry_run || { Chris@41: if test -n "$dlprefile_dlbasename"; then Chris@41: eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' Chris@41: else Chris@41: func_warning "Could not compute DLL name from $name" Chris@41: eval '$ECHO ": $name " >> "$nlist"' Chris@41: fi Chris@41: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@41: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | Chris@41: $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" Chris@41: } Chris@41: else # not an import lib Chris@41: $opt_dry_run || { Chris@41: eval '$ECHO ": $name " >> "$nlist"' Chris@41: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@41: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" Chris@41: } Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: $opt_dry_run || { Chris@41: eval '$ECHO ": $name " >> "$nlist"' Chris@41: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@41: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" Chris@41: } Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: $opt_dry_run || { Chris@41: # Make sure we have at least an empty file. Chris@41: test -f "$nlist" || : > "$nlist" Chris@41: Chris@41: if test -n "$exclude_expsyms"; then Chris@41: $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T Chris@41: $MV "$nlist"T "$nlist" Chris@41: fi Chris@41: Chris@41: # Try sorting and uniquifying the output. Chris@41: if $GREP -v "^: " < "$nlist" | Chris@41: if sort -k 3 /dev/null 2>&1; then Chris@41: sort -k 3 Chris@41: else Chris@41: sort +2 Chris@41: fi | Chris@41: uniq > "$nlist"S; then Chris@41: : Chris@41: else Chris@41: $GREP -v "^: " < "$nlist" > "$nlist"S Chris@41: fi Chris@41: Chris@41: if test -f "$nlist"S; then Chris@41: eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' Chris@41: else Chris@41: echo '/* NONE */' >> "$output_objdir/$my_dlsyms" Chris@41: fi Chris@41: Chris@41: func_show_eval '$RM "${nlist}I"' Chris@41: if test -n "$global_symbol_to_import"; then Chris@41: eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' Chris@41: fi Chris@41: Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: Chris@41: /* The mapping between symbol names and symbols. */ Chris@41: typedef struct { Chris@41: const char *name; Chris@41: void *address; Chris@41: } lt_dlsymlist; Chris@41: extern LT_DLSYM_CONST lt_dlsymlist Chris@41: lt_${my_prefix}_LTX_preloaded_symbols[];\ Chris@41: " Chris@41: Chris@41: if test -s "$nlist"I; then Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: static void lt_syminit(void) Chris@41: { Chris@41: LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; Chris@41: for (; symbol->name; ++symbol) Chris@41: {" Chris@41: $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: } Chris@41: }" Chris@41: fi Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: LT_DLSYM_CONST lt_dlsymlist Chris@41: lt_${my_prefix}_LTX_preloaded_symbols[] = Chris@41: { {\"$my_originator\", (void *) 0}," Chris@41: Chris@41: if test -s "$nlist"I; then Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: {\"@INIT@\", (void *) <_syminit}," Chris@41: fi Chris@41: Chris@41: case $need_lib_prefix in Chris@41: no) Chris@41: eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" Chris@41: ;; Chris@41: *) Chris@41: eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" Chris@41: ;; Chris@41: esac Chris@41: echo >> "$output_objdir/$my_dlsyms" "\ Chris@41: {0, (void *) 0} Chris@41: }; Chris@41: Chris@41: /* This works around a problem in FreeBSD linker */ Chris@41: #ifdef FREEBSD_WORKAROUND Chris@41: static const void *lt_preloaded_setup() { Chris@41: return lt_${my_prefix}_LTX_preloaded_symbols; Chris@41: } Chris@41: #endif Chris@41: Chris@41: #ifdef __cplusplus Chris@41: } Chris@41: #endif\ Chris@41: " Chris@41: } # !$opt_dry_run Chris@41: Chris@41: pic_flag_for_symtable= Chris@41: case "$compile_command " in Chris@41: *" -static "*) ;; Chris@41: *) Chris@41: case $host in Chris@41: # compiling the symbol table file with pic_flag works around Chris@41: # a FreeBSD bug that causes programs to crash when -lm is Chris@41: # linked before any other PIC object. But we must not use Chris@41: # pic_flag when linking with -static. The problem exists in Chris@41: # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. Chris@41: *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) Chris@41: pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; Chris@41: *-*-hpux*) Chris@41: pic_flag_for_symtable=" $pic_flag" ;; Chris@41: *) Chris@41: $my_pic_p && pic_flag_for_symtable=" $pic_flag" Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: symtab_cflags= Chris@41: for arg in $LTCFLAGS; do Chris@41: case $arg in Chris@41: -pie | -fpie | -fPIE) ;; Chris@41: *) func_append symtab_cflags " $arg" ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # Now compile the dynamic symbol file. Chris@41: func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' Chris@41: Chris@41: # Clean up the generated files. Chris@41: func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' Chris@41: Chris@41: # Transform the symbol file into the correct name. Chris@41: symfileobj=$output_objdir/${my_outputname}S.$objext Chris@41: case $host in Chris@41: *cygwin* | *mingw* | *cegcc* ) Chris@41: if test -f "$output_objdir/$my_outputname.def"; then Chris@41: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` Chris@41: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` Chris@41: else Chris@41: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@41: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@41: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: *) Chris@41: func_fatal_error "unknown suffix for '$my_dlsyms'" Chris@41: ;; Chris@41: esac Chris@41: else Chris@41: # We keep going just in case the user didn't refer to Chris@41: # lt_preloaded_symbols. The linker will fail if global_symbol_pipe Chris@41: # really was required. Chris@41: Chris@41: # Nullify the symbol file. Chris@41: compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` Chris@41: finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` Chris@41: fi Chris@41: } Chris@41: Chris@41: # func_cygming_gnu_implib_p ARG Chris@41: # This predicate returns with zero status (TRUE) if Chris@41: # ARG is a GNU/binutils-style import library. Returns Chris@41: # with nonzero status (FALSE) otherwise. Chris@41: func_cygming_gnu_implib_p () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@41: 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)$'` Chris@41: test -n "$func_cygming_gnu_implib_tmp" Chris@41: } Chris@41: Chris@41: # func_cygming_ms_implib_p ARG Chris@41: # This predicate returns with zero status (TRUE) if Chris@41: # ARG is an MS-style import library. Returns Chris@41: # with nonzero status (FALSE) otherwise. Chris@41: func_cygming_ms_implib_p () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@41: func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` Chris@41: test -n "$func_cygming_ms_implib_tmp" Chris@41: } Chris@41: Chris@41: # func_win32_libid arg Chris@41: # return the library type of file 'arg' Chris@41: # Chris@41: # Need a lot of goo to handle *both* DLLs and import libs Chris@41: # Has to be a shell function in order to 'eat' the argument Chris@41: # that is supplied when $file_magic_command is called. Chris@41: # Despite the name, also deal with 64 bit binaries. Chris@41: func_win32_libid () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: win32_libid_type=unknown Chris@41: win32_fileres=`file -L $1 2>/dev/null` Chris@41: case $win32_fileres in Chris@41: *ar\ archive\ import\ library*) # definitely import Chris@41: win32_libid_type="x86 archive import" Chris@41: ;; Chris@41: *ar\ archive*) # could be an import, or static Chris@41: # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. Chris@41: if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | Chris@41: $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then Chris@41: case $nm_interface in Chris@41: "MS dumpbin") Chris@41: if func_cygming_ms_implib_p "$1" || Chris@41: func_cygming_gnu_implib_p "$1" Chris@41: then Chris@41: win32_nmres=import Chris@41: else Chris@41: win32_nmres= Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@41: win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | Chris@41: $SED -n -e ' Chris@41: 1,100{ Chris@41: / I /{ Chris@41: s|.*|import| Chris@41: p Chris@41: q Chris@41: } Chris@41: }'` Chris@41: ;; Chris@41: esac Chris@41: case $win32_nmres in Chris@41: import*) win32_libid_type="x86 archive import";; Chris@41: *) win32_libid_type="x86 archive static";; Chris@41: esac Chris@41: fi Chris@41: ;; Chris@41: *DLL*) Chris@41: win32_libid_type="x86 DLL" Chris@41: ;; Chris@41: *executable*) # but shell scripts are "executable" too... Chris@41: case $win32_fileres in Chris@41: *MS\ Windows\ PE\ Intel*) Chris@41: win32_libid_type="x86 DLL" Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: $ECHO "$win32_libid_type" Chris@41: } Chris@41: Chris@41: # func_cygming_dll_for_implib ARG Chris@41: # Chris@41: # Platform-specific function to extract the Chris@41: # name of the DLL associated with the specified Chris@41: # import library ARG. Chris@41: # Invoked by eval'ing the libtool variable Chris@41: # $sharedlib_from_linklib_cmd Chris@41: # Result is available in the variable Chris@41: # $sharedlib_from_linklib_result Chris@41: func_cygming_dll_for_implib () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` Chris@41: } Chris@41: Chris@41: # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs Chris@41: # Chris@41: # The is the core of a fallback implementation of a Chris@41: # platform-specific function to extract the name of the Chris@41: # DLL associated with the specified import library LIBNAME. Chris@41: # Chris@41: # SECTION_NAME is either .idata$6 or .idata$7, depending Chris@41: # on the platform and compiler that created the implib. Chris@41: # Chris@41: # Echos the name of the DLL associated with the Chris@41: # specified import library. Chris@41: func_cygming_dll_for_implib_fallback_core () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` Chris@41: $OBJDUMP -s --section "$1" "$2" 2>/dev/null | Chris@41: $SED '/^Contents of section '"$match_literal"':/{ Chris@41: # Place marker at beginning of archive member dllname section Chris@41: s/.*/====MARK====/ Chris@41: p Chris@41: d Chris@41: } Chris@41: # These lines can sometimes be longer than 43 characters, but Chris@41: # are always uninteresting Chris@41: /:[ ]*file format pe[i]\{,1\}-/d Chris@41: /^In archive [^:]*:/d Chris@41: # Ensure marker is printed Chris@41: /^====MARK====/p Chris@41: # Remove all lines with less than 43 characters Chris@41: /^.\{43\}/!d Chris@41: # From remaining lines, remove first 43 characters Chris@41: s/^.\{43\}//' | Chris@41: $SED -n ' Chris@41: # Join marker and all lines until next marker into a single line Chris@41: /^====MARK====/ b para Chris@41: H Chris@41: $ b para Chris@41: b Chris@41: :para Chris@41: x Chris@41: s/\n//g Chris@41: # Remove the marker Chris@41: s/^====MARK====// Chris@41: # Remove trailing dots and whitespace Chris@41: s/[\. \t]*$// Chris@41: # Print Chris@41: /./p' | Chris@41: # we now have a list, one entry per line, of the stringified Chris@41: # contents of the appropriate section of all members of the Chris@41: # archive that possess that section. Heuristic: eliminate Chris@41: # all those that have a first or second character that is Chris@41: # a '.' (that is, objdump's representation of an unprintable Chris@41: # character.) This should work for all archives with less than Chris@41: # 0x302f exports -- but will fail for DLLs whose name actually Chris@41: # begins with a literal '.' or a single character followed by Chris@41: # a '.'. Chris@41: # Chris@41: # Of those that remain, print the first one. Chris@41: $SED -e '/^\./d;/^.\./d;q' Chris@41: } Chris@41: Chris@41: # func_cygming_dll_for_implib_fallback ARG Chris@41: # Platform-specific function to extract the Chris@41: # name of the DLL associated with the specified Chris@41: # import library ARG. Chris@41: # Chris@41: # This fallback implementation is for use when $DLLTOOL Chris@41: # does not support the --identify-strict option. Chris@41: # Invoked by eval'ing the libtool variable Chris@41: # $sharedlib_from_linklib_cmd Chris@41: # Result is available in the variable Chris@41: # $sharedlib_from_linklib_result Chris@41: func_cygming_dll_for_implib_fallback () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: if func_cygming_gnu_implib_p "$1"; then Chris@41: # binutils import library Chris@41: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` Chris@41: elif func_cygming_ms_implib_p "$1"; then Chris@41: # ms-generated import library Chris@41: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` Chris@41: else Chris@41: # unknown Chris@41: sharedlib_from_linklib_result= Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: # func_extract_an_archive dir oldlib Chris@41: func_extract_an_archive () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: f_ex_an_ar_dir=$1; shift Chris@41: f_ex_an_ar_oldlib=$1 Chris@41: if test yes = "$lock_old_archive_extraction"; then Chris@41: lockfile=$f_ex_an_ar_oldlib.lock Chris@41: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do Chris@41: func_echo "Waiting for $lockfile to be removed" Chris@41: sleep 2 Chris@41: done Chris@41: fi Chris@41: func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ Chris@41: 'stat=$?; rm -f "$lockfile"; exit $stat' Chris@41: if test yes = "$lock_old_archive_extraction"; then Chris@41: $opt_dry_run || rm -f "$lockfile" Chris@41: fi Chris@41: if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then Chris@41: : Chris@41: else Chris@41: func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" Chris@41: fi Chris@41: } Chris@41: Chris@41: Chris@41: # func_extract_archives gentop oldlib ... Chris@41: func_extract_archives () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: my_gentop=$1; shift Chris@41: my_oldlibs=${1+"$@"} Chris@41: my_oldobjs= Chris@41: my_xlib= Chris@41: my_xabs= Chris@41: my_xdir= Chris@41: Chris@41: for my_xlib in $my_oldlibs; do Chris@41: # Extract the objects. Chris@41: case $my_xlib in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; Chris@41: *) my_xabs=`pwd`"/$my_xlib" ;; Chris@41: esac Chris@41: func_basename "$my_xlib" Chris@41: my_xlib=$func_basename_result Chris@41: my_xlib_u=$my_xlib Chris@41: while :; do Chris@41: case " $extracted_archives " in Chris@41: *" $my_xlib_u "*) Chris@41: func_arith $extracted_serial + 1 Chris@41: extracted_serial=$func_arith_result Chris@41: my_xlib_u=lt$extracted_serial-$my_xlib ;; Chris@41: *) break ;; Chris@41: esac Chris@41: done Chris@41: extracted_archives="$extracted_archives $my_xlib_u" Chris@41: my_xdir=$my_gentop/$my_xlib_u Chris@41: Chris@41: func_mkdir_p "$my_xdir" Chris@41: Chris@41: case $host in Chris@41: *-darwin*) Chris@41: func_verbose "Extracting $my_xabs" Chris@41: # Do not bother doing anything if just a dry run Chris@41: $opt_dry_run || { Chris@41: darwin_orig_dir=`pwd` Chris@41: cd $my_xdir || exit $? Chris@41: darwin_archive=$my_xabs Chris@41: darwin_curdir=`pwd` Chris@41: func_basename "$darwin_archive" Chris@41: darwin_base_archive=$func_basename_result Chris@41: darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` Chris@41: if test -n "$darwin_arches"; then Chris@41: darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` Chris@41: darwin_arch= Chris@41: func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" Chris@41: for darwin_arch in $darwin_arches; do Chris@41: func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" Chris@41: $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" Chris@41: cd "unfat-$$/$darwin_base_archive-$darwin_arch" Chris@41: func_extract_an_archive "`pwd`" "$darwin_base_archive" Chris@41: cd "$darwin_curdir" Chris@41: $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" Chris@41: done # $darwin_arches Chris@41: ## Okay now we've a bunch of thin objects, gotta fatten them up :) Chris@41: darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` Chris@41: darwin_file= Chris@41: darwin_files= Chris@41: for darwin_file in $darwin_filelist; do Chris@41: darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` Chris@41: $LIPO -create -output "$darwin_file" $darwin_files Chris@41: done # $darwin_filelist Chris@41: $RM -rf unfat-$$ Chris@41: cd "$darwin_orig_dir" Chris@41: else Chris@41: cd $darwin_orig_dir Chris@41: func_extract_an_archive "$my_xdir" "$my_xabs" Chris@41: fi # $darwin_arches Chris@41: } # !$opt_dry_run Chris@41: ;; Chris@41: *) Chris@41: func_extract_an_archive "$my_xdir" "$my_xabs" Chris@41: ;; Chris@41: esac Chris@41: my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` Chris@41: done Chris@41: Chris@41: func_extract_archives_result=$my_oldobjs Chris@41: } Chris@41: Chris@41: Chris@41: # func_emit_wrapper [arg=no] Chris@41: # Chris@41: # Emit a libtool wrapper script on stdout. Chris@41: # Don't directly open a file because we may want to Chris@41: # incorporate the script contents within a cygwin/mingw Chris@41: # wrapper executable. Must ONLY be called from within Chris@41: # func_mode_link because it depends on a number of variables Chris@41: # set therein. Chris@41: # Chris@41: # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR Chris@41: # variable will take. If 'yes', then the emitted script Chris@41: # will assume that the directory where it is stored is Chris@41: # the $objdir directory. This is a cygwin/mingw-specific Chris@41: # behavior. Chris@41: func_emit_wrapper () Chris@41: { Chris@41: func_emit_wrapper_arg1=${1-no} Chris@41: Chris@41: $ECHO "\ Chris@41: #! $SHELL Chris@41: Chris@41: # $output - temporary wrapper script for $objdir/$outputname Chris@41: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION Chris@41: # Chris@41: # The $output program cannot be directly executed until all the libtool Chris@41: # libraries that it depends on are installed. Chris@41: # Chris@41: # This wrapper script should never be moved out of the build directory. Chris@41: # If it is, it will not operate correctly. Chris@41: Chris@41: # Sed substitution that helps us do robust quoting. It backslashifies Chris@41: # metacharacters that are still active within double-quoted strings. Chris@41: sed_quote_subst='$sed_quote_subst' Chris@41: Chris@41: # Be Bourne compatible Chris@41: if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then Chris@41: emulate sh Chris@41: NULLCMD=: Chris@41: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which Chris@41: # is contrary to our usage. Disable this feature. Chris@41: alias -g '\${1+\"\$@\"}'='\"\$@\"' Chris@41: setopt NO_GLOB_SUBST Chris@41: else Chris@41: case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac Chris@41: fi Chris@41: BIN_SH=xpg4; export BIN_SH # for Tru64 Chris@41: DUALCASE=1; export DUALCASE # for MKS sh Chris@41: Chris@41: # The HP-UX ksh and POSIX shell print the target directory to stdout Chris@41: # if CDPATH is set. Chris@41: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH Chris@41: Chris@41: relink_command=\"$relink_command\" Chris@41: Chris@41: # This environment variable determines our operation mode. Chris@41: if test \"\$libtool_install_magic\" = \"$magic\"; then Chris@41: # install mode needs the following variables: Chris@41: generated_by_libtool_version='$macro_version' Chris@41: notinst_deplibs='$notinst_deplibs' Chris@41: else Chris@41: # When we are sourced in execute mode, \$file and \$ECHO are already set. Chris@41: if test \"\$libtool_execute_magic\" != \"$magic\"; then Chris@41: file=\"\$0\"" Chris@41: Chris@41: qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` Chris@41: $ECHO "\ Chris@41: Chris@41: # A function that is used when there is no print builtin or printf. Chris@41: func_fallback_echo () Chris@41: { Chris@41: eval 'cat <<_LTECHO_EOF Chris@41: \$1 Chris@41: _LTECHO_EOF' Chris@41: } Chris@41: ECHO=\"$qECHO\" Chris@41: fi Chris@41: Chris@41: # Very basic option parsing. These options are (a) specific to Chris@41: # the libtool wrapper, (b) are identical between the wrapper Chris@41: # /script/ and the wrapper /executable/ that is used only on Chris@41: # windows platforms, and (c) all begin with the string "--lt-" Chris@41: # (application programs are unlikely to have options that match Chris@41: # this pattern). Chris@41: # Chris@41: # There are only two supported options: --lt-debug and Chris@41: # --lt-dump-script. There is, deliberately, no --lt-help. Chris@41: # Chris@41: # The first argument to this parsing function should be the Chris@41: # script's $0 value, followed by "$@". Chris@41: lt_option_debug= Chris@41: func_parse_lt_options () Chris@41: { Chris@41: lt_script_arg0=\$0 Chris@41: shift Chris@41: for lt_opt Chris@41: do Chris@41: case \"\$lt_opt\" in Chris@41: --lt-debug) lt_option_debug=1 ;; Chris@41: --lt-dump-script) Chris@41: lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` Chris@41: test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. Chris@41: lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` Chris@41: cat \"\$lt_dump_D/\$lt_dump_F\" Chris@41: exit 0 Chris@41: ;; Chris@41: --lt-*) Chris@41: \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 Chris@41: exit 1 Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # Print the debug banner immediately: Chris@41: if test -n \"\$lt_option_debug\"; then Chris@41: echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 Chris@41: fi Chris@41: } Chris@41: Chris@41: # Used when --lt-debug. Prints its arguments to stdout Chris@41: # (redirection is the responsibility of the caller) Chris@41: func_lt_dump_args () Chris@41: { Chris@41: lt_dump_args_N=1; Chris@41: for lt_arg Chris@41: do Chris@41: \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" Chris@41: lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` Chris@41: done Chris@41: } Chris@41: Chris@41: # Core function for launching the target application Chris@41: func_exec_program_core () Chris@41: { Chris@41: " Chris@41: case $host in Chris@41: # Backslashes separate directories on plain windows Chris@41: *-*-mingw | *-*-os2* | *-cegcc*) Chris@41: $ECHO "\ Chris@41: if test -n \"\$lt_option_debug\"; then Chris@41: \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 Chris@41: func_lt_dump_args \${1+\"\$@\"} 1>&2 Chris@41: fi Chris@41: exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} Chris@41: " Chris@41: ;; Chris@41: Chris@41: *) Chris@41: $ECHO "\ Chris@41: if test -n \"\$lt_option_debug\"; then Chris@41: \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 Chris@41: func_lt_dump_args \${1+\"\$@\"} 1>&2 Chris@41: fi Chris@41: exec \"\$progdir/\$program\" \${1+\"\$@\"} Chris@41: " Chris@41: ;; Chris@41: esac Chris@41: $ECHO "\ Chris@41: \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 Chris@41: exit 1 Chris@41: } Chris@41: Chris@41: # A function to encapsulate launching the target application Chris@41: # Strips options in the --lt-* namespace from \$@ and Chris@41: # launches target application with the remaining arguments. Chris@41: func_exec_program () Chris@41: { Chris@41: case \" \$* \" in Chris@41: *\\ --lt-*) Chris@41: for lt_wr_arg Chris@41: do Chris@41: case \$lt_wr_arg in Chris@41: --lt-*) ;; Chris@41: *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; Chris@41: esac Chris@41: shift Chris@41: done ;; Chris@41: esac Chris@41: func_exec_program_core \${1+\"\$@\"} Chris@41: } Chris@41: Chris@41: # Parse options Chris@41: func_parse_lt_options \"\$0\" \${1+\"\$@\"} Chris@41: Chris@41: # Find the directory that this script lives in. Chris@41: thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` Chris@41: test \"x\$thisdir\" = \"x\$file\" && thisdir=. Chris@41: Chris@41: # Follow symbolic links until we get to the real thisdir. Chris@41: file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` Chris@41: while test -n \"\$file\"; do Chris@41: destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` Chris@41: Chris@41: # If there was a directory component, then change thisdir. Chris@41: if test \"x\$destdir\" != \"x\$file\"; then Chris@41: case \"\$destdir\" in Chris@41: [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; Chris@41: *) thisdir=\"\$thisdir/\$destdir\" ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` Chris@41: file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` Chris@41: done Chris@41: Chris@41: # Usually 'no', except on cygwin/mingw when embedded into Chris@41: # the cwrapper. Chris@41: WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 Chris@41: if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then Chris@41: # special case for '.' Chris@41: if test \"\$thisdir\" = \".\"; then Chris@41: thisdir=\`pwd\` Chris@41: fi Chris@41: # remove .libs from thisdir Chris@41: case \"\$thisdir\" in Chris@41: *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; Chris@41: $objdir ) thisdir=. ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: # Try to get the absolute directory name. Chris@41: absdir=\`cd \"\$thisdir\" && pwd\` Chris@41: test -n \"\$absdir\" && thisdir=\"\$absdir\" Chris@41: " Chris@41: Chris@41: if test yes = "$fast_install"; then Chris@41: $ECHO "\ Chris@41: program=lt-'$outputname'$exeext Chris@41: progdir=\"\$thisdir/$objdir\" Chris@41: Chris@41: if test ! -f \"\$progdir/\$program\" || Chris@41: { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ Chris@41: test \"X\$file\" != \"X\$progdir/\$program\"; }; then Chris@41: Chris@41: file=\"\$\$-\$program\" Chris@41: Chris@41: if test ! -d \"\$progdir\"; then Chris@41: $MKDIR \"\$progdir\" Chris@41: else Chris@41: $RM \"\$progdir/\$file\" Chris@41: fi" Chris@41: Chris@41: $ECHO "\ Chris@41: Chris@41: # relink executable if necessary Chris@41: if test -n \"\$relink_command\"; then Chris@41: if relink_command_output=\`eval \$relink_command 2>&1\`; then : Chris@41: else Chris@41: \$ECHO \"\$relink_command_output\" >&2 Chris@41: $RM \"\$progdir/\$file\" Chris@41: exit 1 Chris@41: fi Chris@41: fi Chris@41: Chris@41: $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || Chris@41: { $RM \"\$progdir/\$program\"; Chris@41: $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } Chris@41: $RM \"\$progdir/\$file\" Chris@41: fi" Chris@41: else Chris@41: $ECHO "\ Chris@41: program='$outputname' Chris@41: progdir=\"\$thisdir/$objdir\" Chris@41: " Chris@41: fi Chris@41: Chris@41: $ECHO "\ Chris@41: Chris@41: if test -f \"\$progdir/\$program\"; then" Chris@41: Chris@41: # fixup the dll searchpath if we need to. Chris@41: # Chris@41: # Fix the DLL searchpath if we need to. Do this before prepending Chris@41: # to shlibpath, because on Windows, both are PATH and uninstalled Chris@41: # libraries must come first. Chris@41: if test -n "$dllsearchpath"; then Chris@41: $ECHO "\ Chris@41: # Add the dll search path components to the executable PATH Chris@41: PATH=$dllsearchpath:\$PATH Chris@41: " Chris@41: fi Chris@41: Chris@41: # Export our shlibpath_var if we have one. Chris@41: if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then Chris@41: $ECHO "\ Chris@41: # Add our own library path to $shlibpath_var Chris@41: $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" Chris@41: Chris@41: # Some systems cannot cope with colon-terminated $shlibpath_var Chris@41: # The second colon is a workaround for a bug in BeOS R4 sed Chris@41: $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` Chris@41: Chris@41: export $shlibpath_var Chris@41: " Chris@41: fi Chris@41: Chris@41: $ECHO "\ Chris@41: if test \"\$libtool_execute_magic\" != \"$magic\"; then Chris@41: # Run the actual program with our arguments. Chris@41: func_exec_program \${1+\"\$@\"} Chris@41: fi Chris@41: else Chris@41: # The program doesn't exist. Chris@41: \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 Chris@41: \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 Chris@41: \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 Chris@41: exit 1 Chris@41: fi Chris@41: fi\ Chris@41: " Chris@41: } Chris@41: Chris@41: Chris@41: # func_emit_cwrapperexe_src Chris@41: # emit the source code for a wrapper executable on stdout Chris@41: # Must ONLY be called from within func_mode_link because Chris@41: # it depends on a number of variable set therein. Chris@41: func_emit_cwrapperexe_src () Chris@41: { Chris@41: cat < Chris@41: #include Chris@41: #ifdef _MSC_VER Chris@41: # include Chris@41: # include Chris@41: # include Chris@41: #else Chris@41: # include Chris@41: # include Chris@41: # ifdef __CYGWIN__ Chris@41: # include Chris@41: # endif Chris@41: #endif Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: #include Chris@41: Chris@41: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) Chris@41: Chris@41: /* declarations of non-ANSI functions */ Chris@41: #if defined __MINGW32__ Chris@41: # ifdef __STRICT_ANSI__ Chris@41: int _putenv (const char *); Chris@41: # endif Chris@41: #elif defined __CYGWIN__ Chris@41: # ifdef __STRICT_ANSI__ Chris@41: char *realpath (const char *, char *); Chris@41: int putenv (char *); Chris@41: int setenv (const char *, const char *, int); Chris@41: # endif Chris@41: /* #elif defined other_platform || defined ... */ Chris@41: #endif Chris@41: Chris@41: /* portability defines, excluding path handling macros */ Chris@41: #if defined _MSC_VER Chris@41: # define setmode _setmode Chris@41: # define stat _stat Chris@41: # define chmod _chmod Chris@41: # define getcwd _getcwd Chris@41: # define putenv _putenv Chris@41: # define S_IXUSR _S_IEXEC Chris@41: #elif defined __MINGW32__ Chris@41: # define setmode _setmode Chris@41: # define stat _stat Chris@41: # define chmod _chmod Chris@41: # define getcwd _getcwd Chris@41: # define putenv _putenv Chris@41: #elif defined __CYGWIN__ Chris@41: # define HAVE_SETENV Chris@41: # define FOPEN_WB "wb" Chris@41: /* #elif defined other platforms ... */ Chris@41: #endif Chris@41: Chris@41: #if defined PATH_MAX Chris@41: # define LT_PATHMAX PATH_MAX Chris@41: #elif defined MAXPATHLEN Chris@41: # define LT_PATHMAX MAXPATHLEN Chris@41: #else Chris@41: # define LT_PATHMAX 1024 Chris@41: #endif Chris@41: Chris@41: #ifndef S_IXOTH Chris@41: # define S_IXOTH 0 Chris@41: #endif Chris@41: #ifndef S_IXGRP Chris@41: # define S_IXGRP 0 Chris@41: #endif Chris@41: Chris@41: /* path handling portability macros */ Chris@41: #ifndef DIR_SEPARATOR Chris@41: # define DIR_SEPARATOR '/' Chris@41: # define PATH_SEPARATOR ':' Chris@41: #endif Chris@41: Chris@41: #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ Chris@41: defined __OS2__ Chris@41: # define HAVE_DOS_BASED_FILE_SYSTEM Chris@41: # define FOPEN_WB "wb" Chris@41: # ifndef DIR_SEPARATOR_2 Chris@41: # define DIR_SEPARATOR_2 '\\' Chris@41: # endif Chris@41: # ifndef PATH_SEPARATOR_2 Chris@41: # define PATH_SEPARATOR_2 ';' Chris@41: # endif Chris@41: #endif Chris@41: Chris@41: #ifndef DIR_SEPARATOR_2 Chris@41: # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) Chris@41: #else /* DIR_SEPARATOR_2 */ Chris@41: # define IS_DIR_SEPARATOR(ch) \ Chris@41: (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) Chris@41: #endif /* DIR_SEPARATOR_2 */ Chris@41: Chris@41: #ifndef PATH_SEPARATOR_2 Chris@41: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) Chris@41: #else /* PATH_SEPARATOR_2 */ Chris@41: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) Chris@41: #endif /* PATH_SEPARATOR_2 */ Chris@41: Chris@41: #ifndef FOPEN_WB Chris@41: # define FOPEN_WB "w" Chris@41: #endif Chris@41: #ifndef _O_BINARY Chris@41: # define _O_BINARY 0 Chris@41: #endif Chris@41: Chris@41: #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) Chris@41: #define XFREE(stale) do { \ Chris@41: if (stale) { free (stale); stale = 0; } \ Chris@41: } while (0) Chris@41: Chris@41: #if defined LT_DEBUGWRAPPER Chris@41: static int lt_debug = 1; Chris@41: #else Chris@41: static int lt_debug = 0; Chris@41: #endif Chris@41: Chris@41: const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ Chris@41: Chris@41: void *xmalloc (size_t num); Chris@41: char *xstrdup (const char *string); Chris@41: const char *base_name (const char *name); Chris@41: char *find_executable (const char *wrapper); Chris@41: char *chase_symlinks (const char *pathspec); Chris@41: int make_executable (const char *path); Chris@41: int check_executable (const char *path); Chris@41: char *strendzap (char *str, const char *pat); Chris@41: void lt_debugprintf (const char *file, int line, const char *fmt, ...); Chris@41: void lt_fatal (const char *file, int line, const char *message, ...); Chris@41: static const char *nonnull (const char *s); Chris@41: static const char *nonempty (const char *s); Chris@41: void lt_setenv (const char *name, const char *value); Chris@41: char *lt_extend_str (const char *orig_value, const char *add, int to_end); Chris@41: void lt_update_exe_path (const char *name, const char *value); Chris@41: void lt_update_lib_path (const char *name, const char *value); Chris@41: char **prepare_spawn (char **argv); Chris@41: void lt_dump_script (FILE *f); Chris@41: EOF Chris@41: Chris@41: cat <= 0) Chris@41: && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) Chris@41: return 1; Chris@41: else Chris@41: return 0; Chris@41: } Chris@41: Chris@41: int Chris@41: make_executable (const char *path) Chris@41: { Chris@41: int rval = 0; Chris@41: struct stat st; Chris@41: Chris@41: lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", Chris@41: nonempty (path)); Chris@41: if ((!path) || (!*path)) Chris@41: return 0; Chris@41: Chris@41: if (stat (path, &st) >= 0) Chris@41: { Chris@41: rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); Chris@41: } Chris@41: return rval; Chris@41: } Chris@41: Chris@41: /* Searches for the full path of the wrapper. Returns Chris@41: newly allocated full path name if found, NULL otherwise Chris@41: Does not chase symlinks, even on platforms that support them. Chris@41: */ Chris@41: char * Chris@41: find_executable (const char *wrapper) Chris@41: { Chris@41: int has_slash = 0; Chris@41: const char *p; Chris@41: const char *p_next; Chris@41: /* static buffer for getcwd */ Chris@41: char tmp[LT_PATHMAX + 1]; Chris@41: size_t tmp_len; Chris@41: char *concat_name; Chris@41: Chris@41: lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", Chris@41: nonempty (wrapper)); Chris@41: Chris@41: if ((wrapper == NULL) || (*wrapper == '\0')) Chris@41: return NULL; Chris@41: Chris@41: /* Absolute path? */ Chris@41: #if defined HAVE_DOS_BASED_FILE_SYSTEM Chris@41: if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') Chris@41: { Chris@41: concat_name = xstrdup (wrapper); Chris@41: if (check_executable (concat_name)) Chris@41: return concat_name; Chris@41: XFREE (concat_name); Chris@41: } Chris@41: else Chris@41: { Chris@41: #endif Chris@41: if (IS_DIR_SEPARATOR (wrapper[0])) Chris@41: { Chris@41: concat_name = xstrdup (wrapper); Chris@41: if (check_executable (concat_name)) Chris@41: return concat_name; Chris@41: XFREE (concat_name); Chris@41: } Chris@41: #if defined HAVE_DOS_BASED_FILE_SYSTEM Chris@41: } Chris@41: #endif Chris@41: Chris@41: for (p = wrapper; *p; p++) Chris@41: if (*p == '/') Chris@41: { Chris@41: has_slash = 1; Chris@41: break; Chris@41: } Chris@41: if (!has_slash) Chris@41: { Chris@41: /* no slashes; search PATH */ Chris@41: const char *path = getenv ("PATH"); Chris@41: if (path != NULL) Chris@41: { Chris@41: for (p = path; *p; p = p_next) Chris@41: { Chris@41: const char *q; Chris@41: size_t p_len; Chris@41: for (q = p; *q; q++) Chris@41: if (IS_PATH_SEPARATOR (*q)) Chris@41: break; Chris@41: p_len = (size_t) (q - p); Chris@41: p_next = (*q == '\0' ? q : q + 1); Chris@41: if (p_len == 0) Chris@41: { Chris@41: /* empty path: current directory */ Chris@41: if (getcwd (tmp, LT_PATHMAX) == NULL) Chris@41: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", Chris@41: nonnull (strerror (errno))); Chris@41: tmp_len = strlen (tmp); Chris@41: concat_name = Chris@41: XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); Chris@41: memcpy (concat_name, tmp, tmp_len); Chris@41: concat_name[tmp_len] = '/'; Chris@41: strcpy (concat_name + tmp_len + 1, wrapper); Chris@41: } Chris@41: else Chris@41: { Chris@41: concat_name = Chris@41: XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); Chris@41: memcpy (concat_name, p, p_len); Chris@41: concat_name[p_len] = '/'; Chris@41: strcpy (concat_name + p_len + 1, wrapper); Chris@41: } Chris@41: if (check_executable (concat_name)) Chris@41: return concat_name; Chris@41: XFREE (concat_name); Chris@41: } Chris@41: } Chris@41: /* not found in PATH; assume curdir */ Chris@41: } Chris@41: /* Relative path | not found in path: prepend cwd */ Chris@41: if (getcwd (tmp, LT_PATHMAX) == NULL) Chris@41: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", Chris@41: nonnull (strerror (errno))); Chris@41: tmp_len = strlen (tmp); Chris@41: concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); Chris@41: memcpy (concat_name, tmp, tmp_len); Chris@41: concat_name[tmp_len] = '/'; Chris@41: strcpy (concat_name + tmp_len + 1, wrapper); Chris@41: Chris@41: if (check_executable (concat_name)) Chris@41: return concat_name; Chris@41: XFREE (concat_name); Chris@41: return NULL; Chris@41: } Chris@41: Chris@41: char * Chris@41: chase_symlinks (const char *pathspec) Chris@41: { Chris@41: #ifndef S_ISLNK Chris@41: return xstrdup (pathspec); Chris@41: #else Chris@41: char buf[LT_PATHMAX]; Chris@41: struct stat s; Chris@41: char *tmp_pathspec = xstrdup (pathspec); Chris@41: char *p; Chris@41: int has_symlinks = 0; Chris@41: while (strlen (tmp_pathspec) && !has_symlinks) Chris@41: { Chris@41: lt_debugprintf (__FILE__, __LINE__, Chris@41: "checking path component for symlinks: %s\n", Chris@41: tmp_pathspec); Chris@41: if (lstat (tmp_pathspec, &s) == 0) Chris@41: { Chris@41: if (S_ISLNK (s.st_mode) != 0) Chris@41: { Chris@41: has_symlinks = 1; Chris@41: break; Chris@41: } Chris@41: Chris@41: /* search backwards for last DIR_SEPARATOR */ Chris@41: p = tmp_pathspec + strlen (tmp_pathspec) - 1; Chris@41: while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) Chris@41: p--; Chris@41: if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) Chris@41: { Chris@41: /* no more DIR_SEPARATORS left */ Chris@41: break; Chris@41: } Chris@41: *p = '\0'; Chris@41: } Chris@41: else Chris@41: { Chris@41: lt_fatal (__FILE__, __LINE__, Chris@41: "error accessing file \"%s\": %s", Chris@41: tmp_pathspec, nonnull (strerror (errno))); Chris@41: } Chris@41: } Chris@41: XFREE (tmp_pathspec); Chris@41: Chris@41: if (!has_symlinks) Chris@41: { Chris@41: return xstrdup (pathspec); Chris@41: } Chris@41: Chris@41: tmp_pathspec = realpath (pathspec, buf); Chris@41: if (tmp_pathspec == 0) Chris@41: { Chris@41: lt_fatal (__FILE__, __LINE__, Chris@41: "could not follow symlinks for %s", pathspec); Chris@41: } Chris@41: return xstrdup (tmp_pathspec); Chris@41: #endif Chris@41: } Chris@41: Chris@41: char * Chris@41: strendzap (char *str, const char *pat) Chris@41: { Chris@41: size_t len, patlen; Chris@41: Chris@41: assert (str != NULL); Chris@41: assert (pat != NULL); Chris@41: Chris@41: len = strlen (str); Chris@41: patlen = strlen (pat); Chris@41: Chris@41: if (patlen <= len) Chris@41: { Chris@41: str += len - patlen; Chris@41: if (STREQ (str, pat)) Chris@41: *str = '\0'; Chris@41: } Chris@41: return str; Chris@41: } Chris@41: Chris@41: void Chris@41: lt_debugprintf (const char *file, int line, const char *fmt, ...) Chris@41: { Chris@41: va_list args; Chris@41: if (lt_debug) Chris@41: { Chris@41: (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); Chris@41: va_start (args, fmt); Chris@41: (void) vfprintf (stderr, fmt, args); Chris@41: va_end (args); Chris@41: } Chris@41: } Chris@41: Chris@41: static void Chris@41: lt_error_core (int exit_status, const char *file, Chris@41: int line, const char *mode, Chris@41: const char *message, va_list ap) Chris@41: { Chris@41: fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); Chris@41: vfprintf (stderr, message, ap); Chris@41: fprintf (stderr, ".\n"); Chris@41: Chris@41: if (exit_status >= 0) Chris@41: exit (exit_status); Chris@41: } Chris@41: Chris@41: void Chris@41: lt_fatal (const char *file, int line, const char *message, ...) Chris@41: { Chris@41: va_list ap; Chris@41: va_start (ap, message); Chris@41: lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); Chris@41: va_end (ap); Chris@41: } Chris@41: Chris@41: static const char * Chris@41: nonnull (const char *s) Chris@41: { Chris@41: return s ? s : "(null)"; Chris@41: } Chris@41: Chris@41: static const char * Chris@41: nonempty (const char *s) Chris@41: { Chris@41: return (s && !*s) ? "(empty)" : nonnull (s); Chris@41: } Chris@41: Chris@41: void Chris@41: lt_setenv (const char *name, const char *value) Chris@41: { Chris@41: lt_debugprintf (__FILE__, __LINE__, Chris@41: "(lt_setenv) setting '%s' to '%s'\n", Chris@41: nonnull (name), nonnull (value)); Chris@41: { Chris@41: #ifdef HAVE_SETENV Chris@41: /* always make a copy, for consistency with !HAVE_SETENV */ Chris@41: char *str = xstrdup (value); Chris@41: setenv (name, str, 1); Chris@41: #else Chris@41: size_t len = strlen (name) + 1 + strlen (value) + 1; Chris@41: char *str = XMALLOC (char, len); Chris@41: sprintf (str, "%s=%s", name, value); Chris@41: if (putenv (str) != EXIT_SUCCESS) Chris@41: { Chris@41: XFREE (str); Chris@41: } Chris@41: #endif Chris@41: } Chris@41: } Chris@41: Chris@41: char * Chris@41: lt_extend_str (const char *orig_value, const char *add, int to_end) Chris@41: { Chris@41: char *new_value; Chris@41: if (orig_value && *orig_value) Chris@41: { Chris@41: size_t orig_value_len = strlen (orig_value); Chris@41: size_t add_len = strlen (add); Chris@41: new_value = XMALLOC (char, add_len + orig_value_len + 1); Chris@41: if (to_end) Chris@41: { Chris@41: strcpy (new_value, orig_value); Chris@41: strcpy (new_value + orig_value_len, add); Chris@41: } Chris@41: else Chris@41: { Chris@41: strcpy (new_value, add); Chris@41: strcpy (new_value + add_len, orig_value); Chris@41: } Chris@41: } Chris@41: else Chris@41: { Chris@41: new_value = xstrdup (add); Chris@41: } Chris@41: return new_value; Chris@41: } Chris@41: Chris@41: void Chris@41: lt_update_exe_path (const char *name, const char *value) Chris@41: { Chris@41: lt_debugprintf (__FILE__, __LINE__, Chris@41: "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", Chris@41: nonnull (name), nonnull (value)); Chris@41: Chris@41: if (name && *name && value && *value) Chris@41: { Chris@41: char *new_value = lt_extend_str (getenv (name), value, 0); Chris@41: /* some systems can't cope with a ':'-terminated path #' */ Chris@41: size_t len = strlen (new_value); Chris@41: while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) Chris@41: { Chris@41: new_value[--len] = '\0'; Chris@41: } Chris@41: lt_setenv (name, new_value); Chris@41: XFREE (new_value); Chris@41: } Chris@41: } Chris@41: Chris@41: void Chris@41: lt_update_lib_path (const char *name, const char *value) Chris@41: { Chris@41: lt_debugprintf (__FILE__, __LINE__, Chris@41: "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", Chris@41: nonnull (name), nonnull (value)); Chris@41: Chris@41: if (name && *name && value && *value) Chris@41: { Chris@41: char *new_value = lt_extend_str (getenv (name), value, 0); Chris@41: lt_setenv (name, new_value); Chris@41: XFREE (new_value); Chris@41: } Chris@41: } Chris@41: Chris@41: EOF Chris@41: case $host_os in Chris@41: mingw*) Chris@41: cat <<"EOF" Chris@41: Chris@41: /* Prepares an argument vector before calling spawn(). Chris@41: Note that spawn() does not by itself call the command interpreter Chris@41: (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : Chris@41: ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); Chris@41: GetVersionEx(&v); Chris@41: v.dwPlatformId == VER_PLATFORM_WIN32_NT; Chris@41: }) ? "cmd.exe" : "command.com"). Chris@41: Instead it simply concatenates the arguments, separated by ' ', and calls Chris@41: CreateProcess(). We must quote the arguments since Win32 CreateProcess() Chris@41: interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a Chris@41: special way: Chris@41: - Space and tab are interpreted as delimiters. They are not treated as Chris@41: delimiters if they are surrounded by double quotes: "...". Chris@41: - Unescaped double quotes are removed from the input. Their only effect is Chris@41: that within double quotes, space and tab are treated like normal Chris@41: characters. Chris@41: - Backslashes not followed by double quotes are not special. Chris@41: - But 2*n+1 backslashes followed by a double quote become Chris@41: n backslashes followed by a double quote (n >= 0): Chris@41: \" -> " Chris@41: \\\" -> \" Chris@41: \\\\\" -> \\" Chris@41: */ Chris@41: #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" Chris@41: #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" Chris@41: char ** Chris@41: prepare_spawn (char **argv) Chris@41: { Chris@41: size_t argc; Chris@41: char **new_argv; Chris@41: size_t i; Chris@41: Chris@41: /* Count number of arguments. */ Chris@41: for (argc = 0; argv[argc] != NULL; argc++) Chris@41: ; Chris@41: Chris@41: /* Allocate new argument vector. */ Chris@41: new_argv = XMALLOC (char *, argc + 1); Chris@41: Chris@41: /* Put quoted arguments into the new argument vector. */ Chris@41: for (i = 0; i < argc; i++) Chris@41: { Chris@41: const char *string = argv[i]; Chris@41: Chris@41: if (string[0] == '\0') Chris@41: new_argv[i] = xstrdup ("\"\""); Chris@41: else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) Chris@41: { Chris@41: int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); Chris@41: size_t length; Chris@41: unsigned int backslashes; Chris@41: const char *s; Chris@41: char *quoted_string; Chris@41: char *p; Chris@41: Chris@41: length = 0; Chris@41: backslashes = 0; Chris@41: if (quote_around) Chris@41: length++; Chris@41: for (s = string; *s != '\0'; s++) Chris@41: { Chris@41: char c = *s; Chris@41: if (c == '"') Chris@41: length += backslashes + 1; Chris@41: length++; Chris@41: if (c == '\\') Chris@41: backslashes++; Chris@41: else Chris@41: backslashes = 0; Chris@41: } Chris@41: if (quote_around) Chris@41: length += backslashes + 1; Chris@41: Chris@41: quoted_string = XMALLOC (char, length + 1); Chris@41: Chris@41: p = quoted_string; Chris@41: backslashes = 0; Chris@41: if (quote_around) Chris@41: *p++ = '"'; Chris@41: for (s = string; *s != '\0'; s++) Chris@41: { Chris@41: char c = *s; Chris@41: if (c == '"') Chris@41: { Chris@41: unsigned int j; Chris@41: for (j = backslashes + 1; j > 0; j--) Chris@41: *p++ = '\\'; Chris@41: } Chris@41: *p++ = c; Chris@41: if (c == '\\') Chris@41: backslashes++; Chris@41: else Chris@41: backslashes = 0; Chris@41: } Chris@41: if (quote_around) Chris@41: { Chris@41: unsigned int j; Chris@41: for (j = backslashes; j > 0; j--) Chris@41: *p++ = '\\'; Chris@41: *p++ = '"'; Chris@41: } Chris@41: *p = '\0'; Chris@41: Chris@41: new_argv[i] = quoted_string; Chris@41: } Chris@41: else Chris@41: new_argv[i] = (char *) string; Chris@41: } Chris@41: new_argv[argc] = NULL; Chris@41: Chris@41: return new_argv; Chris@41: } Chris@41: EOF Chris@41: ;; Chris@41: esac Chris@41: Chris@41: cat <<"EOF" Chris@41: void lt_dump_script (FILE* f) Chris@41: { Chris@41: EOF Chris@41: func_emit_wrapper yes | Chris@41: $SED -n -e ' Chris@41: s/^\(.\{79\}\)\(..*\)/\1\ Chris@41: \2/ Chris@41: h Chris@41: s/\([\\"]\)/\\\1/g Chris@41: s/$/\\n/ Chris@41: s/\([^\n]*\).*/ fputs ("\1", f);/p Chris@41: g Chris@41: D' Chris@41: cat <<"EOF" Chris@41: } Chris@41: EOF Chris@41: } Chris@41: # end: func_emit_cwrapperexe_src Chris@41: Chris@41: # func_win32_import_lib_p ARG Chris@41: # True if ARG is an import lib, as indicated by $file_magic_cmd Chris@41: func_win32_import_lib_p () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in Chris@41: *import*) : ;; Chris@41: *) false ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: # func_suncc_cstd_abi Chris@41: # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! Chris@41: # Several compiler flags select an ABI that is incompatible with the Chris@41: # Cstd library. Avoid specifying it if any are in CXXFLAGS. Chris@41: func_suncc_cstd_abi () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case " $compile_command " in Chris@41: *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) Chris@41: suncc_use_cstd_abi=no Chris@41: ;; Chris@41: *) Chris@41: suncc_use_cstd_abi=yes Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: # func_mode_link arg... Chris@41: func_mode_link () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@41: # It is impossible to link a dll without this setting, and Chris@41: # we shouldn't force the makefile maintainer to figure out Chris@41: # what system we are compiling for in order to pass an extra Chris@41: # flag for every libtool invocation. Chris@41: # allow_undefined=no Chris@41: Chris@41: # FIXME: Unfortunately, there are problems with the above when trying Chris@41: # to make a dll that has undefined symbols, in which case not Chris@41: # even a static library is built. For now, we need to specify Chris@41: # -no-undefined on the libtool link line when we can be certain Chris@41: # that all symbols are satisfied, otherwise we get a static library. Chris@41: allow_undefined=yes Chris@41: ;; Chris@41: *) Chris@41: allow_undefined=yes Chris@41: ;; Chris@41: esac Chris@41: libtool_args=$nonopt Chris@41: base_compile="$nonopt $@" Chris@41: compile_command=$nonopt Chris@41: finalize_command=$nonopt Chris@41: Chris@41: compile_rpath= Chris@41: finalize_rpath= Chris@41: compile_shlibpath= Chris@41: finalize_shlibpath= Chris@41: convenience= Chris@41: old_convenience= Chris@41: deplibs= Chris@41: old_deplibs= Chris@41: compiler_flags= Chris@41: linker_flags= Chris@41: dllsearchpath= Chris@41: lib_search_path=`pwd` Chris@41: inst_prefix_dir= Chris@41: new_inherited_linker_flags= Chris@41: Chris@41: avoid_version=no Chris@41: bindir= Chris@41: dlfiles= Chris@41: dlprefiles= Chris@41: dlself=no Chris@41: export_dynamic=no Chris@41: export_symbols= Chris@41: export_symbols_regex= Chris@41: generated= Chris@41: libobjs= Chris@41: ltlibs= Chris@41: module=no Chris@41: no_install=no Chris@41: objs= Chris@41: os2dllname= Chris@41: non_pic_objects= Chris@41: precious_files_regex= Chris@41: prefer_static_libs=no Chris@41: preload=false Chris@41: prev= Chris@41: prevarg= Chris@41: release= Chris@41: rpath= Chris@41: xrpath= Chris@41: perm_rpath= Chris@41: temp_rpath= Chris@41: thread_safe=no Chris@41: vinfo= Chris@41: vinfo_number=no Chris@41: weak_libs= Chris@41: single_module=$wl-single_module Chris@41: func_infer_tag $base_compile Chris@41: Chris@41: # We need to know -static, to get the right output filenames. Chris@41: for arg Chris@41: do Chris@41: case $arg in Chris@41: -shared) Chris@41: test yes != "$build_libtool_libs" \ Chris@41: && func_fatal_configuration "cannot build a shared library" Chris@41: build_old_libs=no Chris@41: break Chris@41: ;; Chris@41: -all-static | -static | -static-libtool-libs) Chris@41: case $arg in Chris@41: -all-static) Chris@41: if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then Chris@41: func_warning "complete static linking is impossible in this configuration" Chris@41: fi Chris@41: if test -n "$link_static_flag"; then Chris@41: dlopen_self=$dlopen_self_static Chris@41: fi Chris@41: prefer_static_libs=yes Chris@41: ;; Chris@41: -static) Chris@41: if test -z "$pic_flag" && test -n "$link_static_flag"; then Chris@41: dlopen_self=$dlopen_self_static Chris@41: fi Chris@41: prefer_static_libs=built Chris@41: ;; Chris@41: -static-libtool-libs) Chris@41: if test -z "$pic_flag" && test -n "$link_static_flag"; then Chris@41: dlopen_self=$dlopen_self_static Chris@41: fi Chris@41: prefer_static_libs=yes Chris@41: ;; Chris@41: esac Chris@41: build_libtool_libs=no Chris@41: build_old_libs=yes Chris@41: break Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # See if our shared archives depend on static archives. Chris@41: test -n "$old_archive_from_new_cmds" && build_old_libs=yes Chris@41: Chris@41: # Go through the arguments, transforming them on the way. Chris@41: while test "$#" -gt 0; do Chris@41: arg=$1 Chris@41: shift Chris@41: func_quote_for_eval "$arg" Chris@41: qarg=$func_quote_for_eval_unquoted_result Chris@41: func_append libtool_args " $func_quote_for_eval_result" Chris@41: Chris@41: # If the previous option needs an argument, assign it. Chris@41: if test -n "$prev"; then Chris@41: case $prev in Chris@41: output) Chris@41: func_append compile_command " @OUTPUT@" Chris@41: func_append finalize_command " @OUTPUT@" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: case $prev in Chris@41: bindir) Chris@41: bindir=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: dlfiles|dlprefiles) Chris@41: $preload || { Chris@41: # Add the symbol object into the linking commands. Chris@41: func_append compile_command " @SYMFILE@" Chris@41: func_append finalize_command " @SYMFILE@" Chris@41: preload=: Chris@41: } Chris@41: case $arg in Chris@41: *.la | *.lo) ;; # We handle these cases below. Chris@41: force) Chris@41: if test no = "$dlself"; then Chris@41: dlself=needless Chris@41: export_dynamic=yes Chris@41: fi Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: self) Chris@41: if test dlprefiles = "$prev"; then Chris@41: dlself=yes Chris@41: elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then Chris@41: dlself=yes Chris@41: else Chris@41: dlself=needless Chris@41: export_dynamic=yes Chris@41: fi Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: *) Chris@41: if test dlfiles = "$prev"; then Chris@41: func_append dlfiles " $arg" Chris@41: else Chris@41: func_append dlprefiles " $arg" Chris@41: fi Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: expsyms) Chris@41: export_symbols=$arg Chris@41: test -f "$arg" \ Chris@41: || func_fatal_error "symbol file '$arg' does not exist" Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: expsyms_regex) Chris@41: export_symbols_regex=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: framework) Chris@41: case $host in Chris@41: *-*-darwin*) Chris@41: case "$deplibs " in Chris@41: *" $qarg.ltframework "*) ;; Chris@41: *) func_append deplibs " $qarg.ltframework" # this is fixed later Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: inst_prefix) Chris@41: inst_prefix_dir=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: mllvm) Chris@41: # Clang does not use LLVM to link, so we can simply discard any Chris@41: # '-mllvm $arg' options when doing the link step. Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: objectlist) Chris@41: if test -f "$arg"; then Chris@41: save_arg=$arg Chris@41: moreargs= Chris@41: for fil in `cat "$save_arg"` Chris@41: do Chris@41: # func_append moreargs " $fil" Chris@41: arg=$fil Chris@41: # A libtool-controlled object. Chris@41: Chris@41: # Check to see that this really is a libtool object. Chris@41: if func_lalib_unsafe_p "$arg"; then Chris@41: pic_object= Chris@41: non_pic_object= Chris@41: Chris@41: # Read the .lo file Chris@41: func_source "$arg" Chris@41: Chris@41: if test -z "$pic_object" || Chris@41: test -z "$non_pic_object" || Chris@41: test none = "$pic_object" && Chris@41: test none = "$non_pic_object"; then Chris@41: func_fatal_error "cannot find name of object for '$arg'" Chris@41: fi Chris@41: Chris@41: # Extract subdirectory from the argument. Chris@41: func_dirname "$arg" "/" "" Chris@41: xdir=$func_dirname_result Chris@41: Chris@41: if test none != "$pic_object"; then Chris@41: # Prepend the subdirectory the object is found in. Chris@41: pic_object=$xdir$pic_object Chris@41: Chris@41: if test dlfiles = "$prev"; then Chris@41: if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then Chris@41: func_append dlfiles " $pic_object" Chris@41: prev= Chris@41: continue Chris@41: else Chris@41: # If libtool objects are unsupported, then we need to preload. Chris@41: prev=dlprefiles Chris@41: fi Chris@41: fi Chris@41: Chris@41: # CHECK ME: I think I busted this. -Ossama Chris@41: if test dlprefiles = "$prev"; then Chris@41: # Preload the old-style object. Chris@41: func_append dlprefiles " $pic_object" Chris@41: prev= Chris@41: fi Chris@41: Chris@41: # A PIC object. Chris@41: func_append libobjs " $pic_object" Chris@41: arg=$pic_object Chris@41: fi Chris@41: Chris@41: # Non-PIC object. Chris@41: if test none != "$non_pic_object"; then Chris@41: # Prepend the subdirectory the object is found in. Chris@41: non_pic_object=$xdir$non_pic_object Chris@41: Chris@41: # A standard non-PIC object Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: if test -z "$pic_object" || test none = "$pic_object"; then Chris@41: arg=$non_pic_object Chris@41: fi Chris@41: else Chris@41: # If the PIC object exists, use it instead. Chris@41: # $xdir was prepended to $pic_object above. Chris@41: non_pic_object=$pic_object Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: fi Chris@41: else Chris@41: # Only an error if not doing a dry-run. Chris@41: if $opt_dry_run; then Chris@41: # Extract subdirectory from the argument. Chris@41: func_dirname "$arg" "/" "" Chris@41: xdir=$func_dirname_result Chris@41: Chris@41: func_lo2o "$arg" Chris@41: pic_object=$xdir$objdir/$func_lo2o_result Chris@41: non_pic_object=$xdir$func_lo2o_result Chris@41: func_append libobjs " $pic_object" Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: else Chris@41: func_fatal_error "'$arg' is not a valid libtool object" Chris@41: fi Chris@41: fi Chris@41: done Chris@41: else Chris@41: func_fatal_error "link input file '$arg' does not exist" Chris@41: fi Chris@41: arg=$save_arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: os2dllname) Chris@41: os2dllname=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: precious_regex) Chris@41: precious_files_regex=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: release) Chris@41: release=-$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: rpath | xrpath) Chris@41: # We need an absolute path. Chris@41: case $arg in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@41: *) Chris@41: func_fatal_error "only absolute run-paths are allowed" Chris@41: ;; Chris@41: esac Chris@41: if test rpath = "$prev"; then Chris@41: case "$rpath " in Chris@41: *" $arg "*) ;; Chris@41: *) func_append rpath " $arg" ;; Chris@41: esac Chris@41: else Chris@41: case "$xrpath " in Chris@41: *" $arg "*) ;; Chris@41: *) func_append xrpath " $arg" ;; Chris@41: esac Chris@41: fi Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: shrext) Chris@41: shrext_cmds=$arg Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: weak) Chris@41: func_append weak_libs " $arg" Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: xcclinker) Chris@41: func_append linker_flags " $qarg" Chris@41: func_append compiler_flags " $qarg" Chris@41: prev= Chris@41: func_append compile_command " $qarg" Chris@41: func_append finalize_command " $qarg" Chris@41: continue Chris@41: ;; Chris@41: xcompiler) Chris@41: func_append compiler_flags " $qarg" Chris@41: prev= Chris@41: func_append compile_command " $qarg" Chris@41: func_append finalize_command " $qarg" Chris@41: continue Chris@41: ;; Chris@41: xlinker) Chris@41: func_append linker_flags " $qarg" Chris@41: func_append compiler_flags " $wl$qarg" Chris@41: prev= Chris@41: func_append compile_command " $wl$qarg" Chris@41: func_append finalize_command " $wl$qarg" Chris@41: continue Chris@41: ;; Chris@41: *) Chris@41: eval "$prev=\"\$arg\"" Chris@41: prev= Chris@41: continue Chris@41: ;; Chris@41: esac Chris@41: fi # test -n "$prev" Chris@41: Chris@41: prevarg=$arg Chris@41: Chris@41: case $arg in Chris@41: -all-static) Chris@41: if test -n "$link_static_flag"; then Chris@41: # See comment for -static flag below, for more details. Chris@41: func_append compile_command " $link_static_flag" Chris@41: func_append finalize_command " $link_static_flag" Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -allow-undefined) Chris@41: # FIXME: remove this flag sometime in the future. Chris@41: func_fatal_error "'-allow-undefined' must not be used because it is the default" Chris@41: ;; Chris@41: Chris@41: -avoid-version) Chris@41: avoid_version=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -bindir) Chris@41: prev=bindir Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -dlopen) Chris@41: prev=dlfiles Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -dlpreopen) Chris@41: prev=dlprefiles Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -export-dynamic) Chris@41: export_dynamic=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -export-symbols | -export-symbols-regex) Chris@41: if test -n "$export_symbols" || test -n "$export_symbols_regex"; then Chris@41: func_fatal_error "more than one -exported-symbols argument is not allowed" Chris@41: fi Chris@41: if test X-export-symbols = "X$arg"; then Chris@41: prev=expsyms Chris@41: else Chris@41: prev=expsyms_regex Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -framework) Chris@41: prev=framework Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -inst-prefix-dir) Chris@41: prev=inst_prefix Chris@41: continue Chris@41: ;; Chris@41: Chris@41: # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* Chris@41: # so, if we see these flags be careful not to treat them like -L Chris@41: -L[A-Z][A-Z]*:*) Chris@41: case $with_gcc/$host in Chris@41: no/*-*-irix* | /*-*-irix*) Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -L*) Chris@41: func_stripname "-L" '' "$arg" Chris@41: if test -z "$func_stripname_result"; then Chris@41: if test "$#" -gt 0; then Chris@41: func_fatal_error "require no space between '-L' and '$1'" Chris@41: else Chris@41: func_fatal_error "need path for '-L' option" Chris@41: fi Chris@41: fi Chris@41: func_resolve_sysroot "$func_stripname_result" Chris@41: dir=$func_resolve_sysroot_result Chris@41: # We need an absolute path. Chris@41: case $dir in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@41: *) Chris@41: absdir=`cd "$dir" && pwd` Chris@41: test -z "$absdir" && \ Chris@41: func_fatal_error "cannot determine absolute directory name of '$dir'" Chris@41: dir=$absdir Chris@41: ;; Chris@41: esac Chris@41: case "$deplibs " in Chris@41: *" -L$dir "* | *" $arg "*) Chris@41: # Will only happen for absolute or sysroot arguments Chris@41: ;; Chris@41: *) Chris@41: # Preserve sysroot, but never include relative directories Chris@41: case $dir in Chris@41: [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; Chris@41: *) func_append deplibs " -L$dir" ;; Chris@41: esac Chris@41: func_append lib_search_path " $dir" Chris@41: ;; Chris@41: esac Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@41: testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` Chris@41: case :$dllsearchpath: in Chris@41: *":$dir:"*) ;; Chris@41: ::) dllsearchpath=$dir;; Chris@41: *) func_append dllsearchpath ":$dir";; Chris@41: esac Chris@41: case :$dllsearchpath: in Chris@41: *":$testbindir:"*) ;; Chris@41: ::) dllsearchpath=$testbindir;; Chris@41: *) func_append dllsearchpath ":$testbindir";; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -l*) Chris@41: if test X-lc = "X$arg" || test X-lm = "X$arg"; then Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) Chris@41: # These systems don't actually have a C or math library (as such) Chris@41: continue Chris@41: ;; Chris@41: *-*-os2*) Chris@41: # These systems don't actually have a C library (as such) Chris@41: test X-lc = "X$arg" && continue Chris@41: ;; Chris@41: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) Chris@41: # Do not include libc due to us having libc/libc_r. Chris@41: test X-lc = "X$arg" && continue Chris@41: ;; Chris@41: *-*-rhapsody* | *-*-darwin1.[012]) Chris@41: # Rhapsody C and math libraries are in the System framework Chris@41: func_append deplibs " System.ltframework" Chris@41: continue Chris@41: ;; Chris@41: *-*-sco3.2v5* | *-*-sco5v6*) Chris@41: # Causes problems with __ctype Chris@41: test X-lc = "X$arg" && continue Chris@41: ;; Chris@41: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) Chris@41: # Compiler inserts libc in the correct place for threads to work Chris@41: test X-lc = "X$arg" && continue Chris@41: ;; Chris@41: esac Chris@41: elif test X-lc_r = "X$arg"; then Chris@41: case $host in Chris@41: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) Chris@41: # Do not include libc_r directly, use -pthread flag. Chris@41: continue Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: func_append deplibs " $arg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -mllvm) Chris@41: prev=mllvm Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -module) Chris@41: module=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: # Tru64 UNIX uses -model [arg] to determine the layout of C++ Chris@41: # classes, name mangling, and exception handling. Chris@41: # Darwin uses the -arch flag to determine output architecture. Chris@41: -model|-arch|-isysroot|--sysroot) Chris@41: func_append compiler_flags " $arg" Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: prev=xcompiler Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ Chris@41: |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) Chris@41: func_append compiler_flags " $arg" Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: case "$new_inherited_linker_flags " in Chris@41: *" $arg "*) ;; Chris@41: * ) func_append new_inherited_linker_flags " $arg" ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -multi_module) Chris@41: single_module=$wl-multi_module Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -no-fast-install) Chris@41: fast_install=no Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -no-install) Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) Chris@41: # The PATH hackery in wrapper scripts is required on Windows Chris@41: # and Darwin in order for the loader to find any dlls it needs. Chris@41: func_warning "'-no-install' is ignored for $host" Chris@41: func_warning "assuming '-no-fast-install' instead" Chris@41: fast_install=no Chris@41: ;; Chris@41: *) no_install=yes ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -no-undefined) Chris@41: allow_undefined=no Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -objectlist) Chris@41: prev=objectlist Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -os2dllname) Chris@41: prev=os2dllname Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -o) prev=output ;; Chris@41: Chris@41: -precious-files-regex) Chris@41: prev=precious_regex Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -release) Chris@41: prev=release Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -rpath) Chris@41: prev=rpath Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -R) Chris@41: prev=xrpath Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -R*) Chris@41: func_stripname '-R' '' "$arg" Chris@41: dir=$func_stripname_result Chris@41: # We need an absolute path. Chris@41: case $dir in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@41: =*) Chris@41: func_stripname '=' '' "$dir" Chris@41: dir=$lt_sysroot$func_stripname_result Chris@41: ;; Chris@41: *) Chris@41: func_fatal_error "only absolute run-paths are allowed" Chris@41: ;; Chris@41: esac Chris@41: case "$xrpath " in Chris@41: *" $dir "*) ;; Chris@41: *) func_append xrpath " $dir" ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -shared) Chris@41: # The effects of -shared are defined in a previous loop. Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -shrext) Chris@41: prev=shrext Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -static | -static-libtool-libs) Chris@41: # The effects of -static are defined in a previous loop. Chris@41: # We used to do the same as -all-static on platforms that Chris@41: # didn't have a PIC flag, but the assumption that the effects Chris@41: # would be equivalent was wrong. It would break on at least Chris@41: # Digital Unix and AIX. Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -thread-safe) Chris@41: thread_safe=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -version-info) Chris@41: prev=vinfo Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -version-number) Chris@41: prev=vinfo Chris@41: vinfo_number=yes Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -weak) Chris@41: prev=weak Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -Wc,*) Chris@41: func_stripname '-Wc,' '' "$arg" Chris@41: args=$func_stripname_result Chris@41: arg= Chris@41: save_ifs=$IFS; IFS=, Chris@41: for flag in $args; do Chris@41: IFS=$save_ifs Chris@41: func_quote_for_eval "$flag" Chris@41: func_append arg " $func_quote_for_eval_result" Chris@41: func_append compiler_flags " $func_quote_for_eval_result" Chris@41: done Chris@41: IFS=$save_ifs Chris@41: func_stripname ' ' '' "$arg" Chris@41: arg=$func_stripname_result Chris@41: ;; Chris@41: Chris@41: -Wl,*) Chris@41: func_stripname '-Wl,' '' "$arg" Chris@41: args=$func_stripname_result Chris@41: arg= Chris@41: save_ifs=$IFS; IFS=, Chris@41: for flag in $args; do Chris@41: IFS=$save_ifs Chris@41: func_quote_for_eval "$flag" Chris@41: func_append arg " $wl$func_quote_for_eval_result" Chris@41: func_append compiler_flags " $wl$func_quote_for_eval_result" Chris@41: func_append linker_flags " $func_quote_for_eval_result" Chris@41: done Chris@41: IFS=$save_ifs Chris@41: func_stripname ' ' '' "$arg" Chris@41: arg=$func_stripname_result Chris@41: ;; Chris@41: Chris@41: -Xcompiler) Chris@41: prev=xcompiler Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -Xlinker) Chris@41: prev=xlinker Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -XCClinker) Chris@41: prev=xcclinker Chris@41: continue Chris@41: ;; Chris@41: Chris@41: # -msg_* for osf cc Chris@41: -msg_*) Chris@41: func_quote_for_eval "$arg" Chris@41: arg=$func_quote_for_eval_result Chris@41: ;; Chris@41: Chris@41: # Flags to be passed through unchanged, with rationale: Chris@41: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler Chris@41: # -r[0-9][0-9]* specify processor for the SGI compiler Chris@41: # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler Chris@41: # +DA*, +DD* enable 64-bit mode for the HP compiler Chris@41: # -q* compiler args for the IBM compiler Chris@41: # -m*, -t[45]*, -txscale* architecture-specific flags for GCC Chris@41: # -F/path path to uninstalled frameworks, gcc on darwin Chris@41: # -p, -pg, --coverage, -fprofile-* profiling flags for GCC Chris@41: # -fstack-protector* stack protector flags for GCC Chris@41: # @file GCC response files Chris@41: # -tp=* Portland pgcc target processor selection Chris@41: # --sysroot=* for sysroot support Chris@41: # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization Chris@41: # -specs=* GCC specs files Chris@41: # -stdlib=* select c++ std lib with clang Chris@41: # -fsanitize=* Clang/GCC memory and address sanitizer Chris@41: -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ Chris@41: -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ Chris@41: -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ Chris@41: -specs=*|-fsanitize=*) Chris@41: func_quote_for_eval "$arg" Chris@41: arg=$func_quote_for_eval_result Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: func_append compiler_flags " $arg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: -Z*) Chris@41: if test os2 = "`expr $host : '.*\(os2\)'`"; then Chris@41: # OS/2 uses -Zxxx to specify OS/2-specific options Chris@41: compiler_flags="$compiler_flags $arg" Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: case $arg in Chris@41: -Zlinker | -Zstack) Chris@41: prev=xcompiler Chris@41: ;; Chris@41: esac Chris@41: continue Chris@41: else Chris@41: # Otherwise treat like 'Some other compiler flag' below Chris@41: func_quote_for_eval "$arg" Chris@41: arg=$func_quote_for_eval_result Chris@41: fi Chris@41: ;; Chris@41: Chris@41: # Some other compiler flag. Chris@41: -* | +*) Chris@41: func_quote_for_eval "$arg" Chris@41: arg=$func_quote_for_eval_result Chris@41: ;; Chris@41: Chris@41: *.$objext) Chris@41: # A standard object. Chris@41: func_append objs " $arg" Chris@41: ;; Chris@41: Chris@41: *.lo) Chris@41: # A libtool-controlled object. Chris@41: Chris@41: # Check to see that this really is a libtool object. Chris@41: if func_lalib_unsafe_p "$arg"; then Chris@41: pic_object= Chris@41: non_pic_object= Chris@41: Chris@41: # Read the .lo file Chris@41: func_source "$arg" Chris@41: Chris@41: if test -z "$pic_object" || Chris@41: test -z "$non_pic_object" || Chris@41: test none = "$pic_object" && Chris@41: test none = "$non_pic_object"; then Chris@41: func_fatal_error "cannot find name of object for '$arg'" Chris@41: fi Chris@41: Chris@41: # Extract subdirectory from the argument. Chris@41: func_dirname "$arg" "/" "" Chris@41: xdir=$func_dirname_result Chris@41: Chris@41: test none = "$pic_object" || { Chris@41: # Prepend the subdirectory the object is found in. Chris@41: pic_object=$xdir$pic_object Chris@41: Chris@41: if test dlfiles = "$prev"; then Chris@41: if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then Chris@41: func_append dlfiles " $pic_object" Chris@41: prev= Chris@41: continue Chris@41: else Chris@41: # If libtool objects are unsupported, then we need to preload. Chris@41: prev=dlprefiles Chris@41: fi Chris@41: fi Chris@41: Chris@41: # CHECK ME: I think I busted this. -Ossama Chris@41: if test dlprefiles = "$prev"; then Chris@41: # Preload the old-style object. Chris@41: func_append dlprefiles " $pic_object" Chris@41: prev= Chris@41: fi Chris@41: Chris@41: # A PIC object. Chris@41: func_append libobjs " $pic_object" Chris@41: arg=$pic_object Chris@41: } Chris@41: Chris@41: # Non-PIC object. Chris@41: if test none != "$non_pic_object"; then Chris@41: # Prepend the subdirectory the object is found in. Chris@41: non_pic_object=$xdir$non_pic_object Chris@41: Chris@41: # A standard non-PIC object Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: if test -z "$pic_object" || test none = "$pic_object"; then Chris@41: arg=$non_pic_object Chris@41: fi Chris@41: else Chris@41: # If the PIC object exists, use it instead. Chris@41: # $xdir was prepended to $pic_object above. Chris@41: non_pic_object=$pic_object Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: fi Chris@41: else Chris@41: # Only an error if not doing a dry-run. Chris@41: if $opt_dry_run; then Chris@41: # Extract subdirectory from the argument. Chris@41: func_dirname "$arg" "/" "" Chris@41: xdir=$func_dirname_result Chris@41: Chris@41: func_lo2o "$arg" Chris@41: pic_object=$xdir$objdir/$func_lo2o_result Chris@41: non_pic_object=$xdir$func_lo2o_result Chris@41: func_append libobjs " $pic_object" Chris@41: func_append non_pic_objects " $non_pic_object" Chris@41: else Chris@41: func_fatal_error "'$arg' is not a valid libtool object" Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: Chris@41: *.$libext) Chris@41: # An archive. Chris@41: func_append deplibs " $arg" Chris@41: func_append old_deplibs " $arg" Chris@41: continue Chris@41: ;; Chris@41: Chris@41: *.la) Chris@41: # A libtool-controlled library. Chris@41: Chris@41: func_resolve_sysroot "$arg" Chris@41: if test dlfiles = "$prev"; then Chris@41: # This library was specified with -dlopen. Chris@41: func_append dlfiles " $func_resolve_sysroot_result" Chris@41: prev= Chris@41: elif test dlprefiles = "$prev"; then Chris@41: # The library was specified with -dlpreopen. Chris@41: func_append dlprefiles " $func_resolve_sysroot_result" Chris@41: prev= Chris@41: else Chris@41: func_append deplibs " $func_resolve_sysroot_result" Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: Chris@41: # Some other compiler argument. Chris@41: *) Chris@41: # Unknown arguments in both finalize_command and compile_command need Chris@41: # to be aesthetically quoted because they are evaled later. Chris@41: func_quote_for_eval "$arg" Chris@41: arg=$func_quote_for_eval_result Chris@41: ;; Chris@41: esac # arg Chris@41: Chris@41: # Now actually substitute the argument into the commands. Chris@41: if test -n "$arg"; then Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: fi Chris@41: done # argument parsing loop Chris@41: Chris@41: test -n "$prev" && \ Chris@41: func_fatal_help "the '$prevarg' option requires an argument" Chris@41: Chris@41: if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then Chris@41: eval arg=\"$export_dynamic_flag_spec\" Chris@41: func_append compile_command " $arg" Chris@41: func_append finalize_command " $arg" Chris@41: fi Chris@41: Chris@41: oldlibs= Chris@41: # calculate the name of the file, without its directory Chris@41: func_basename "$output" Chris@41: outputname=$func_basename_result Chris@41: libobjs_save=$libobjs Chris@41: Chris@41: if test -n "$shlibpath_var"; then Chris@41: # get the directories listed in $shlibpath_var Chris@41: eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` Chris@41: else Chris@41: shlib_search_path= Chris@41: fi Chris@41: eval sys_lib_search_path=\"$sys_lib_search_path_spec\" Chris@41: eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" Chris@41: Chris@41: # Definition is injected by LT_CONFIG during libtool generation. Chris@41: func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" Chris@41: Chris@41: func_dirname "$output" "/" "" Chris@41: output_objdir=$func_dirname_result$objdir Chris@41: func_to_tool_file "$output_objdir/" Chris@41: tool_output_objdir=$func_to_tool_file_result Chris@41: # Create the object directory. Chris@41: func_mkdir_p "$output_objdir" Chris@41: Chris@41: # Determine the type of output Chris@41: case $output in Chris@41: "") Chris@41: func_fatal_help "you must specify an output file" Chris@41: ;; Chris@41: *.$libext) linkmode=oldlib ;; Chris@41: *.lo | *.$objext) linkmode=obj ;; Chris@41: *.la) linkmode=lib ;; Chris@41: *) linkmode=prog ;; # Anything else should be a program. Chris@41: esac Chris@41: Chris@41: specialdeplibs= Chris@41: Chris@41: libs= Chris@41: # Find all interdependent deplibs by searching for libraries Chris@41: # that are linked more than once (e.g. -la -lb -la) Chris@41: for deplib in $deplibs; do Chris@41: if $opt_preserve_dup_deps; then Chris@41: case "$libs " in Chris@41: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@41: esac Chris@41: fi Chris@41: func_append libs " $deplib" Chris@41: done Chris@41: Chris@41: if test lib = "$linkmode"; then Chris@41: libs="$predeps $libs $compiler_lib_search_path $postdeps" Chris@41: Chris@41: # Compute libraries that are listed more than once in $predeps Chris@41: # $postdeps and mark them as special (i.e., whose duplicates are Chris@41: # not to be eliminated). Chris@41: pre_post_deps= Chris@41: if $opt_duplicate_compiler_generated_deps; then Chris@41: for pre_post_dep in $predeps $postdeps; do Chris@41: case "$pre_post_deps " in Chris@41: *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; Chris@41: esac Chris@41: func_append pre_post_deps " $pre_post_dep" Chris@41: done Chris@41: fi Chris@41: pre_post_deps= Chris@41: fi Chris@41: Chris@41: deplibs= Chris@41: newdependency_libs= Chris@41: newlib_search_path= Chris@41: need_relink=no # whether we're linking any uninstalled libtool libraries Chris@41: notinst_deplibs= # not-installed libtool libraries Chris@41: notinst_path= # paths that contain not-installed libtool libraries Chris@41: Chris@41: case $linkmode in Chris@41: lib) Chris@41: passes="conv dlpreopen link" Chris@41: for file in $dlfiles $dlprefiles; do Chris@41: case $file in Chris@41: *.la) ;; Chris@41: *) Chris@41: func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: ;; Chris@41: prog) Chris@41: compile_deplibs= Chris@41: finalize_deplibs= Chris@41: alldeplibs=false Chris@41: newdlfiles= Chris@41: newdlprefiles= Chris@41: passes="conv scan dlopen dlpreopen link" Chris@41: ;; Chris@41: *) passes="conv" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: for pass in $passes; do Chris@41: # The preopen pass in lib mode reverses $deplibs; put it back here Chris@41: # so that -L comes before libs that need it for instance... Chris@41: if test lib,link = "$linkmode,$pass"; then Chris@41: ## FIXME: Find the place where the list is rebuilt in the wrong Chris@41: ## order, and fix it there properly Chris@41: tmp_deplibs= Chris@41: for deplib in $deplibs; do Chris@41: tmp_deplibs="$deplib $tmp_deplibs" Chris@41: done Chris@41: deplibs=$tmp_deplibs Chris@41: fi Chris@41: Chris@41: if test lib,link = "$linkmode,$pass" || Chris@41: test prog,scan = "$linkmode,$pass"; then Chris@41: libs=$deplibs Chris@41: deplibs= Chris@41: fi Chris@41: if test prog = "$linkmode"; then Chris@41: case $pass in Chris@41: dlopen) libs=$dlfiles ;; Chris@41: dlpreopen) libs=$dlprefiles ;; Chris@41: link) Chris@41: libs="$deplibs %DEPLIBS%" Chris@41: test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: if test lib,dlpreopen = "$linkmode,$pass"; then Chris@41: # Collect and forward deplibs of preopened libtool libs Chris@41: for lib in $dlprefiles; do Chris@41: # Ignore non-libtool-libs Chris@41: dependency_libs= Chris@41: func_resolve_sysroot "$lib" Chris@41: case $lib in Chris@41: *.la) func_source "$func_resolve_sysroot_result" ;; Chris@41: esac Chris@41: Chris@41: # Collect preopened libtool deplibs, except any this library Chris@41: # has declared as weak libs Chris@41: for deplib in $dependency_libs; do Chris@41: func_basename "$deplib" Chris@41: deplib_base=$func_basename_result Chris@41: case " $weak_libs " in Chris@41: *" $deplib_base "*) ;; Chris@41: *) func_append deplibs " $deplib" ;; Chris@41: esac Chris@41: done Chris@41: done Chris@41: libs=$dlprefiles Chris@41: fi Chris@41: if test dlopen = "$pass"; then Chris@41: # Collect dlpreopened libraries Chris@41: save_deplibs=$deplibs Chris@41: deplibs= Chris@41: fi Chris@41: Chris@41: for deplib in $libs; do Chris@41: lib= Chris@41: found=false Chris@41: case $deplib in Chris@41: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ Chris@41: |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: else Chris@41: func_append compiler_flags " $deplib" Chris@41: if test lib = "$linkmode"; then Chris@41: case "$new_inherited_linker_flags " in Chris@41: *" $deplib "*) ;; Chris@41: * ) func_append new_inherited_linker_flags " $deplib" ;; Chris@41: esac Chris@41: fi Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: -l*) Chris@41: if test lib != "$linkmode" && test prog != "$linkmode"; then Chris@41: func_warning "'-l' is ignored for archives/objects" Chris@41: continue Chris@41: fi Chris@41: func_stripname '-l' '' "$deplib" Chris@41: name=$func_stripname_result Chris@41: if test lib = "$linkmode"; then Chris@41: searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" Chris@41: else Chris@41: searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" Chris@41: fi Chris@41: for searchdir in $searchdirs; do Chris@41: for search_ext in .la $std_shrext .so .a; do Chris@41: # Search the libtool library Chris@41: lib=$searchdir/lib$name$search_ext Chris@41: if test -f "$lib"; then Chris@41: if test .la = "$search_ext"; then Chris@41: found=: Chris@41: else Chris@41: found=false Chris@41: fi Chris@41: break 2 Chris@41: fi Chris@41: done Chris@41: done Chris@41: if $found; then Chris@41: # deplib is a libtool library Chris@41: # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, Chris@41: # We need to do some special things here, and not later. Chris@41: if test yes = "$allow_libtool_libs_with_static_runtimes"; then Chris@41: case " $predeps $postdeps " in Chris@41: *" $deplib "*) Chris@41: if func_lalib_p "$lib"; then Chris@41: library_names= Chris@41: old_library= Chris@41: func_source "$lib" Chris@41: for l in $old_library $library_names; do Chris@41: ll=$l Chris@41: done Chris@41: if test "X$ll" = "X$old_library"; then # only static version available Chris@41: found=false Chris@41: func_dirname "$lib" "" "." Chris@41: ladir=$func_dirname_result Chris@41: lib=$ladir/$old_library Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: else Chris@41: deplibs="$deplib $deplibs" Chris@41: test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" Chris@41: fi Chris@41: continue Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: *) ;; Chris@41: esac Chris@41: fi Chris@41: else Chris@41: # deplib doesn't seem to be a libtool library Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: else Chris@41: deplibs="$deplib $deplibs" Chris@41: test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" Chris@41: fi Chris@41: continue Chris@41: fi Chris@41: ;; # -l Chris@41: *.ltframework) Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: else Chris@41: deplibs="$deplib $deplibs" Chris@41: if test lib = "$linkmode"; then Chris@41: case "$new_inherited_linker_flags " in Chris@41: *" $deplib "*) ;; Chris@41: * ) func_append new_inherited_linker_flags " $deplib" ;; Chris@41: esac Chris@41: fi Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: -L*) Chris@41: case $linkmode in Chris@41: lib) Chris@41: deplibs="$deplib $deplibs" Chris@41: test conv = "$pass" && continue Chris@41: newdependency_libs="$deplib $newdependency_libs" Chris@41: func_stripname '-L' '' "$deplib" Chris@41: func_resolve_sysroot "$func_stripname_result" Chris@41: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@41: ;; Chris@41: prog) Chris@41: if test conv = "$pass"; then Chris@41: deplibs="$deplib $deplibs" Chris@41: continue Chris@41: fi Chris@41: if test scan = "$pass"; then Chris@41: deplibs="$deplib $deplibs" Chris@41: else Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: fi Chris@41: func_stripname '-L' '' "$deplib" Chris@41: func_resolve_sysroot "$func_stripname_result" Chris@41: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@41: ;; Chris@41: *) Chris@41: func_warning "'-L' is ignored for archives/objects" Chris@41: ;; Chris@41: esac # linkmode Chris@41: continue Chris@41: ;; # -L Chris@41: -R*) Chris@41: if test link = "$pass"; then Chris@41: func_stripname '-R' '' "$deplib" Chris@41: func_resolve_sysroot "$func_stripname_result" Chris@41: dir=$func_resolve_sysroot_result Chris@41: # Make sure the xrpath contains only unique directories. Chris@41: case "$xrpath " in Chris@41: *" $dir "*) ;; Chris@41: *) func_append xrpath " $dir" ;; Chris@41: esac Chris@41: fi Chris@41: deplibs="$deplib $deplibs" Chris@41: continue Chris@41: ;; Chris@41: *.la) Chris@41: func_resolve_sysroot "$deplib" Chris@41: lib=$func_resolve_sysroot_result Chris@41: ;; Chris@41: *.$libext) Chris@41: if test conv = "$pass"; then Chris@41: deplibs="$deplib $deplibs" Chris@41: continue Chris@41: fi Chris@41: case $linkmode in Chris@41: lib) Chris@41: # Linking convenience modules into shared libraries is allowed, Chris@41: # but linking other static libraries is non-portable. Chris@41: case " $dlpreconveniencelibs " in Chris@41: *" $deplib "*) ;; Chris@41: *) Chris@41: valid_a_lib=false Chris@41: case $deplibs_check_method in Chris@41: match_pattern*) Chris@41: set dummy $deplibs_check_method; shift Chris@41: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` Chris@41: if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ Chris@41: | $EGREP "$match_pattern_regex" > /dev/null; then Chris@41: valid_a_lib=: Chris@41: fi Chris@41: ;; Chris@41: pass_all) Chris@41: valid_a_lib=: Chris@41: ;; Chris@41: esac Chris@41: if $valid_a_lib; then Chris@41: echo Chris@41: $ECHO "*** Warning: Linking the shared library $output against the" Chris@41: $ECHO "*** static library $deplib is not portable!" Chris@41: deplibs="$deplib $deplibs" Chris@41: else Chris@41: echo Chris@41: $ECHO "*** Warning: Trying to link with static lib archive $deplib." Chris@41: echo "*** I have the capability to make that library automatically link in when" Chris@41: echo "*** you link to this library. But I can only do this if you have a" Chris@41: echo "*** shared version of the library, which you do not appear to have" Chris@41: echo "*** because the file extensions .$libext of this argument makes me believe" Chris@41: echo "*** that it is just a static archive that I should not use here." Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: continue Chris@41: ;; Chris@41: prog) Chris@41: if test link != "$pass"; then Chris@41: deplibs="$deplib $deplibs" Chris@41: else Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: esac # linkmode Chris@41: ;; # *.$libext Chris@41: *.lo | *.$objext) Chris@41: if test conv = "$pass"; then Chris@41: deplibs="$deplib $deplibs" Chris@41: elif test prog = "$linkmode"; then Chris@41: if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then Chris@41: # If there is no dlopen support or we're linking statically, Chris@41: # we need to preload. Chris@41: func_append newdlprefiles " $deplib" Chris@41: compile_deplibs="$deplib $compile_deplibs" Chris@41: finalize_deplibs="$deplib $finalize_deplibs" Chris@41: else Chris@41: func_append newdlfiles " $deplib" Chris@41: fi Chris@41: fi Chris@41: continue Chris@41: ;; Chris@41: %DEPLIBS%) Chris@41: alldeplibs=: Chris@41: continue Chris@41: ;; Chris@41: esac # case $deplib Chris@41: Chris@41: $found || test -f "$lib" \ Chris@41: || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" Chris@41: Chris@41: # Check to see that this really is a libtool archive. Chris@41: func_lalib_unsafe_p "$lib" \ Chris@41: || func_fatal_error "'$lib' is not a valid libtool archive" Chris@41: Chris@41: func_dirname "$lib" "" "." Chris@41: ladir=$func_dirname_result Chris@41: Chris@41: dlname= Chris@41: dlopen= Chris@41: dlpreopen= Chris@41: libdir= Chris@41: library_names= Chris@41: old_library= Chris@41: inherited_linker_flags= Chris@41: # If the library was installed with an old release of libtool, Chris@41: # it will not redefine variables installed, or shouldnotlink Chris@41: installed=yes Chris@41: shouldnotlink=no Chris@41: avoidtemprpath= Chris@41: Chris@41: Chris@41: # Read the .la file Chris@41: func_source "$lib" Chris@41: Chris@41: # Convert "-framework foo" to "foo.ltframework" Chris@41: if test -n "$inherited_linker_flags"; then Chris@41: tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` Chris@41: for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do Chris@41: case " $new_inherited_linker_flags " in Chris@41: *" $tmp_inherited_linker_flag "*) ;; Chris@41: *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; Chris@41: esac Chris@41: done Chris@41: fi Chris@41: dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: if test lib,link = "$linkmode,$pass" || Chris@41: test prog,scan = "$linkmode,$pass" || Chris@41: { test prog != "$linkmode" && test lib != "$linkmode"; }; then Chris@41: test -n "$dlopen" && func_append dlfiles " $dlopen" Chris@41: test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" Chris@41: fi Chris@41: Chris@41: if test conv = "$pass"; then Chris@41: # Only check for convenience libraries Chris@41: deplibs="$lib $deplibs" Chris@41: if test -z "$libdir"; then Chris@41: if test -z "$old_library"; then Chris@41: func_fatal_error "cannot find name of link library for '$lib'" Chris@41: fi Chris@41: # It is a libtool convenience library, so add in its objects. Chris@41: func_append convenience " $ladir/$objdir/$old_library" Chris@41: func_append old_convenience " $ladir/$objdir/$old_library" Chris@41: tmp_libs= Chris@41: for deplib in $dependency_libs; do Chris@41: deplibs="$deplib $deplibs" Chris@41: if $opt_preserve_dup_deps; then Chris@41: case "$tmp_libs " in Chris@41: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@41: esac Chris@41: fi Chris@41: func_append tmp_libs " $deplib" Chris@41: done Chris@41: elif test prog != "$linkmode" && test lib != "$linkmode"; then Chris@41: func_fatal_error "'$lib' is not a convenience library" Chris@41: fi Chris@41: continue Chris@41: fi # $pass = conv Chris@41: Chris@41: Chris@41: # Get the name of the library we link against. Chris@41: linklib= Chris@41: if test -n "$old_library" && Chris@41: { test yes = "$prefer_static_libs" || Chris@41: test built,no = "$prefer_static_libs,$installed"; }; then Chris@41: linklib=$old_library Chris@41: else Chris@41: for l in $old_library $library_names; do Chris@41: linklib=$l Chris@41: done Chris@41: fi Chris@41: if test -z "$linklib"; then Chris@41: func_fatal_error "cannot find name of link library for '$lib'" Chris@41: fi Chris@41: Chris@41: # This library was specified with -dlopen. Chris@41: if test dlopen = "$pass"; then Chris@41: test -z "$libdir" \ Chris@41: && func_fatal_error "cannot -dlopen a convenience library: '$lib'" Chris@41: if test -z "$dlname" || Chris@41: test yes != "$dlopen_support" || Chris@41: test no = "$build_libtool_libs" Chris@41: then Chris@41: # If there is no dlname, no dlopen support or we're linking Chris@41: # statically, we need to preload. We also need to preload any Chris@41: # dependent libraries so libltdl's deplib preloader doesn't Chris@41: # bomb out in the load deplibs phase. Chris@41: func_append dlprefiles " $lib $dependency_libs" Chris@41: else Chris@41: func_append newdlfiles " $lib" Chris@41: fi Chris@41: continue Chris@41: fi # $pass = dlopen Chris@41: Chris@41: # We need an absolute path. Chris@41: case $ladir in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; Chris@41: *) Chris@41: abs_ladir=`cd "$ladir" && pwd` Chris@41: if test -z "$abs_ladir"; then Chris@41: func_warning "cannot determine absolute directory name of '$ladir'" Chris@41: func_warning "passing it literally to the linker, although it might fail" Chris@41: abs_ladir=$ladir Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: func_basename "$lib" Chris@41: laname=$func_basename_result Chris@41: Chris@41: # Find the relevant object directory and library name. Chris@41: if test yes = "$installed"; then Chris@41: if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then Chris@41: func_warning "library '$lib' was moved." Chris@41: dir=$ladir Chris@41: absdir=$abs_ladir Chris@41: libdir=$abs_ladir Chris@41: else Chris@41: dir=$lt_sysroot$libdir Chris@41: absdir=$lt_sysroot$libdir Chris@41: fi Chris@41: test yes = "$hardcode_automatic" && avoidtemprpath=yes Chris@41: else Chris@41: if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then Chris@41: dir=$ladir Chris@41: absdir=$abs_ladir Chris@41: # Remove this search path later Chris@41: func_append notinst_path " $abs_ladir" Chris@41: else Chris@41: dir=$ladir/$objdir Chris@41: absdir=$abs_ladir/$objdir Chris@41: # Remove this search path later Chris@41: func_append notinst_path " $abs_ladir" Chris@41: fi Chris@41: fi # $installed = yes Chris@41: func_stripname 'lib' '.la' "$laname" Chris@41: name=$func_stripname_result Chris@41: Chris@41: # This library was specified with -dlpreopen. Chris@41: if test dlpreopen = "$pass"; then Chris@41: if test -z "$libdir" && test prog = "$linkmode"; then Chris@41: func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" Chris@41: fi Chris@41: case $host in Chris@41: # special handling for platforms with PE-DLLs. Chris@41: *cygwin* | *mingw* | *cegcc* ) Chris@41: # Linker will automatically link against shared library if both Chris@41: # static and shared are present. Therefore, ensure we extract Chris@41: # symbols from the import library if a shared library is present Chris@41: # (otherwise, the dlopen module name will be incorrect). We do Chris@41: # this by putting the import library name into $newdlprefiles. Chris@41: # We recover the dlopen module name by 'saving' the la file Chris@41: # name in a special purpose variable, and (later) extracting the Chris@41: # dlname from the la file. Chris@41: if test -n "$dlname"; then Chris@41: func_tr_sh "$dir/$linklib" Chris@41: eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" Chris@41: func_append newdlprefiles " $dir/$linklib" Chris@41: else Chris@41: func_append newdlprefiles " $dir/$old_library" Chris@41: # Keep a list of preopened convenience libraries to check Chris@41: # that they are being used correctly in the link pass. Chris@41: test -z "$libdir" && \ Chris@41: func_append dlpreconveniencelibs " $dir/$old_library" Chris@41: fi Chris@41: ;; Chris@41: * ) Chris@41: # Prefer using a static library (so that no silly _DYNAMIC symbols Chris@41: # are required to link). Chris@41: if test -n "$old_library"; then Chris@41: func_append newdlprefiles " $dir/$old_library" Chris@41: # Keep a list of preopened convenience libraries to check Chris@41: # that they are being used correctly in the link pass. Chris@41: test -z "$libdir" && \ Chris@41: func_append dlpreconveniencelibs " $dir/$old_library" Chris@41: # Otherwise, use the dlname, so that lt_dlopen finds it. Chris@41: elif test -n "$dlname"; then Chris@41: func_append newdlprefiles " $dir/$dlname" Chris@41: else Chris@41: func_append newdlprefiles " $dir/$linklib" Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: fi # $pass = dlpreopen Chris@41: Chris@41: if test -z "$libdir"; then Chris@41: # Link the convenience library Chris@41: if test lib = "$linkmode"; then Chris@41: deplibs="$dir/$old_library $deplibs" Chris@41: elif test prog,link = "$linkmode,$pass"; then Chris@41: compile_deplibs="$dir/$old_library $compile_deplibs" Chris@41: finalize_deplibs="$dir/$old_library $finalize_deplibs" Chris@41: else Chris@41: deplibs="$lib $deplibs" # used for prog,scan pass Chris@41: fi Chris@41: continue Chris@41: fi Chris@41: Chris@41: Chris@41: if test prog = "$linkmode" && test link != "$pass"; then Chris@41: func_append newlib_search_path " $ladir" Chris@41: deplibs="$lib $deplibs" Chris@41: Chris@41: linkalldeplibs=false Chris@41: if test no != "$link_all_deplibs" || test -z "$library_names" || Chris@41: test no = "$build_libtool_libs"; then Chris@41: linkalldeplibs=: Chris@41: fi Chris@41: Chris@41: tmp_libs= Chris@41: for deplib in $dependency_libs; do Chris@41: case $deplib in Chris@41: -L*) func_stripname '-L' '' "$deplib" Chris@41: func_resolve_sysroot "$func_stripname_result" Chris@41: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@41: ;; Chris@41: esac Chris@41: # Need to link against all dependency_libs? Chris@41: if $linkalldeplibs; then Chris@41: deplibs="$deplib $deplibs" Chris@41: else Chris@41: # Need to hardcode shared library paths Chris@41: # or/and link against static libraries Chris@41: newdependency_libs="$deplib $newdependency_libs" Chris@41: fi Chris@41: if $opt_preserve_dup_deps; then Chris@41: case "$tmp_libs " in Chris@41: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@41: esac Chris@41: fi Chris@41: func_append tmp_libs " $deplib" Chris@41: done # for deplib Chris@41: continue Chris@41: fi # $linkmode = prog... Chris@41: Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: if test -n "$library_names" && Chris@41: { { test no = "$prefer_static_libs" || Chris@41: test built,yes = "$prefer_static_libs,$installed"; } || Chris@41: test -z "$old_library"; }; then Chris@41: # We need to hardcode the library path Chris@41: if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then Chris@41: # Make sure the rpath contains only unique directories. Chris@41: case $temp_rpath: in Chris@41: *"$absdir:"*) ;; Chris@41: *) func_append temp_rpath "$absdir:" ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: # Hardcode the library path. Chris@41: # Skip directories that are in the system default run-time Chris@41: # search path. Chris@41: case " $sys_lib_dlsearch_path " in Chris@41: *" $absdir "*) ;; Chris@41: *) Chris@41: case "$compile_rpath " in Chris@41: *" $absdir "*) ;; Chris@41: *) func_append compile_rpath " $absdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: case " $sys_lib_dlsearch_path " in Chris@41: *" $libdir "*) ;; Chris@41: *) Chris@41: case "$finalize_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append finalize_rpath " $libdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: fi # $linkmode,$pass = prog,link... Chris@41: Chris@41: if $alldeplibs && Chris@41: { test pass_all = "$deplibs_check_method" || Chris@41: { test yes = "$build_libtool_libs" && Chris@41: test -n "$library_names"; }; }; then Chris@41: # We only need to search for static libraries Chris@41: continue Chris@41: fi Chris@41: fi Chris@41: Chris@41: link_static=no # Whether the deplib will be linked statically Chris@41: use_static_libs=$prefer_static_libs Chris@41: if test built = "$use_static_libs" && test yes = "$installed"; then Chris@41: use_static_libs=no Chris@41: fi Chris@41: if test -n "$library_names" && Chris@41: { test no = "$use_static_libs" || test -z "$old_library"; }; then Chris@41: case $host in Chris@41: *cygwin* | *mingw* | *cegcc* | *os2*) Chris@41: # No point in relinking DLLs because paths are not encoded Chris@41: func_append notinst_deplibs " $lib" Chris@41: need_relink=no Chris@41: ;; Chris@41: *) Chris@41: if test no = "$installed"; then Chris@41: func_append notinst_deplibs " $lib" Chris@41: need_relink=yes Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: # This is a shared library Chris@41: Chris@41: # Warn about portability, can't link against -module's on some Chris@41: # systems (darwin). Don't bleat about dlopened modules though! Chris@41: dlopenmodule= Chris@41: for dlpremoduletest in $dlprefiles; do Chris@41: if test "X$dlpremoduletest" = "X$lib"; then Chris@41: dlopenmodule=$dlpremoduletest Chris@41: break Chris@41: fi Chris@41: done Chris@41: if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then Chris@41: echo Chris@41: if test prog = "$linkmode"; then Chris@41: $ECHO "*** Warning: Linking the executable $output against the loadable module" Chris@41: else Chris@41: $ECHO "*** Warning: Linking the shared library $output against the loadable module" Chris@41: fi Chris@41: $ECHO "*** $linklib is not portable!" Chris@41: fi Chris@41: if test lib = "$linkmode" && Chris@41: test yes = "$hardcode_into_libs"; then Chris@41: # Hardcode the library path. Chris@41: # Skip directories that are in the system default run-time Chris@41: # search path. Chris@41: case " $sys_lib_dlsearch_path " in Chris@41: *" $absdir "*) ;; Chris@41: *) Chris@41: case "$compile_rpath " in Chris@41: *" $absdir "*) ;; Chris@41: *) func_append compile_rpath " $absdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: case " $sys_lib_dlsearch_path " in Chris@41: *" $libdir "*) ;; Chris@41: *) Chris@41: case "$finalize_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append finalize_rpath " $libdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: if test -n "$old_archive_from_expsyms_cmds"; then Chris@41: # figure out the soname Chris@41: set dummy $library_names Chris@41: shift Chris@41: realname=$1 Chris@41: shift Chris@41: libname=`eval "\\$ECHO \"$libname_spec\""` Chris@41: # use dlname if we got it. it's perfectly good, no? Chris@41: if test -n "$dlname"; then Chris@41: soname=$dlname Chris@41: elif test -n "$soname_spec"; then Chris@41: # bleh windows Chris@41: case $host in Chris@41: *cygwin* | mingw* | *cegcc* | *os2*) Chris@41: func_arith $current - $age Chris@41: major=$func_arith_result Chris@41: versuffix=-$major Chris@41: ;; Chris@41: esac Chris@41: eval soname=\"$soname_spec\" Chris@41: else Chris@41: soname=$realname Chris@41: fi Chris@41: Chris@41: # Make a new name for the extract_expsyms_cmds to use Chris@41: soroot=$soname Chris@41: func_basename "$soroot" Chris@41: soname=$func_basename_result Chris@41: func_stripname 'lib' '.dll' "$soname" Chris@41: newlib=libimp-$func_stripname_result.a Chris@41: Chris@41: # If the library has no export list, then create one now Chris@41: if test -f "$output_objdir/$soname-def"; then : Chris@41: else Chris@41: func_verbose "extracting exported symbol list from '$soname'" Chris@41: func_execute_cmds "$extract_expsyms_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: # Create $newlib Chris@41: if test -f "$output_objdir/$newlib"; then :; else Chris@41: func_verbose "generating import library for '$soname'" Chris@41: func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' Chris@41: fi Chris@41: # make sure the library variables are pointing to the new library Chris@41: dir=$output_objdir Chris@41: linklib=$newlib Chris@41: fi # test -n "$old_archive_from_expsyms_cmds" Chris@41: Chris@41: if test prog = "$linkmode" || test relink != "$opt_mode"; then Chris@41: add_shlibpath= Chris@41: add_dir= Chris@41: add= Chris@41: lib_linked=yes Chris@41: case $hardcode_action in Chris@41: immediate | unsupported) Chris@41: if test no = "$hardcode_direct"; then Chris@41: add=$dir/$linklib Chris@41: case $host in Chris@41: *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; Chris@41: *-*-sysv4*uw2*) add_dir=-L$dir ;; Chris@41: *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ Chris@41: *-*-unixware7*) add_dir=-L$dir ;; Chris@41: *-*-darwin* ) Chris@41: # if the lib is a (non-dlopened) module then we cannot Chris@41: # link against it, someone is ignoring the earlier warnings Chris@41: if /usr/bin/file -L $add 2> /dev/null | Chris@41: $GREP ": [^:]* bundle" >/dev/null; then Chris@41: if test "X$dlopenmodule" != "X$lib"; then Chris@41: $ECHO "*** Warning: lib $linklib is a module, not a shared library" Chris@41: if test -z "$old_library"; then Chris@41: echo Chris@41: echo "*** And there doesn't seem to be a static archive available" Chris@41: echo "*** The link will probably fail, sorry" Chris@41: else Chris@41: add=$dir/$old_library Chris@41: fi Chris@41: elif test -n "$old_library"; then Chris@41: add=$dir/$old_library Chris@41: fi Chris@41: fi Chris@41: esac Chris@41: elif test no = "$hardcode_minus_L"; then Chris@41: case $host in Chris@41: *-*-sunos*) add_shlibpath=$dir ;; Chris@41: esac Chris@41: add_dir=-L$dir Chris@41: add=-l$name Chris@41: elif test no = "$hardcode_shlibpath_var"; then Chris@41: add_shlibpath=$dir Chris@41: add=-l$name Chris@41: else Chris@41: lib_linked=no Chris@41: fi Chris@41: ;; Chris@41: relink) Chris@41: if test yes = "$hardcode_direct" && Chris@41: test no = "$hardcode_direct_absolute"; then Chris@41: add=$dir/$linklib Chris@41: elif test yes = "$hardcode_minus_L"; then Chris@41: add_dir=-L$absdir Chris@41: # Try looking first in the location we're being installed to. Chris@41: if test -n "$inst_prefix_dir"; then Chris@41: case $libdir in Chris@41: [\\/]*) Chris@41: func_append add_dir " -L$inst_prefix_dir$libdir" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: add=-l$name Chris@41: elif test yes = "$hardcode_shlibpath_var"; then Chris@41: add_shlibpath=$dir Chris@41: add=-l$name Chris@41: else Chris@41: lib_linked=no Chris@41: fi Chris@41: ;; Chris@41: *) lib_linked=no ;; Chris@41: esac Chris@41: Chris@41: if test yes != "$lib_linked"; then Chris@41: func_fatal_configuration "unsupported hardcode properties" Chris@41: fi Chris@41: Chris@41: if test -n "$add_shlibpath"; then Chris@41: case :$compile_shlibpath: in Chris@41: *":$add_shlibpath:"*) ;; Chris@41: *) func_append compile_shlibpath "$add_shlibpath:" ;; Chris@41: esac Chris@41: fi Chris@41: if test prog = "$linkmode"; then Chris@41: test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" Chris@41: test -n "$add" && compile_deplibs="$add $compile_deplibs" Chris@41: else Chris@41: test -n "$add_dir" && deplibs="$add_dir $deplibs" Chris@41: test -n "$add" && deplibs="$add $deplibs" Chris@41: if test yes != "$hardcode_direct" && Chris@41: test yes != "$hardcode_minus_L" && Chris@41: test yes = "$hardcode_shlibpath_var"; then Chris@41: case :$finalize_shlibpath: in Chris@41: *":$libdir:"*) ;; Chris@41: *) func_append finalize_shlibpath "$libdir:" ;; Chris@41: esac Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test prog = "$linkmode" || test relink = "$opt_mode"; then Chris@41: add_shlibpath= Chris@41: add_dir= Chris@41: add= Chris@41: # Finalize command for both is simple: just hardcode it. Chris@41: if test yes = "$hardcode_direct" && Chris@41: test no = "$hardcode_direct_absolute"; then Chris@41: add=$libdir/$linklib Chris@41: elif test yes = "$hardcode_minus_L"; then Chris@41: add_dir=-L$libdir Chris@41: add=-l$name Chris@41: elif test yes = "$hardcode_shlibpath_var"; then Chris@41: case :$finalize_shlibpath: in Chris@41: *":$libdir:"*) ;; Chris@41: *) func_append finalize_shlibpath "$libdir:" ;; Chris@41: esac Chris@41: add=-l$name Chris@41: elif test yes = "$hardcode_automatic"; then Chris@41: if test -n "$inst_prefix_dir" && Chris@41: test -f "$inst_prefix_dir$libdir/$linklib"; then Chris@41: add=$inst_prefix_dir$libdir/$linklib Chris@41: else Chris@41: add=$libdir/$linklib Chris@41: fi Chris@41: else Chris@41: # We cannot seem to hardcode it, guess we'll fake it. Chris@41: add_dir=-L$libdir Chris@41: # Try looking first in the location we're being installed to. Chris@41: if test -n "$inst_prefix_dir"; then Chris@41: case $libdir in Chris@41: [\\/]*) Chris@41: func_append add_dir " -L$inst_prefix_dir$libdir" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: add=-l$name Chris@41: fi Chris@41: Chris@41: if test prog = "$linkmode"; then Chris@41: test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" Chris@41: test -n "$add" && finalize_deplibs="$add $finalize_deplibs" Chris@41: else Chris@41: test -n "$add_dir" && deplibs="$add_dir $deplibs" Chris@41: test -n "$add" && deplibs="$add $deplibs" Chris@41: fi Chris@41: fi Chris@41: elif test prog = "$linkmode"; then Chris@41: # Here we assume that one of hardcode_direct or hardcode_minus_L Chris@41: # is not unsupported. This is valid on all known static and Chris@41: # shared platforms. Chris@41: if test unsupported != "$hardcode_direct"; then Chris@41: test -n "$old_library" && linklib=$old_library Chris@41: compile_deplibs="$dir/$linklib $compile_deplibs" Chris@41: finalize_deplibs="$dir/$linklib $finalize_deplibs" Chris@41: else Chris@41: compile_deplibs="-l$name -L$dir $compile_deplibs" Chris@41: finalize_deplibs="-l$name -L$dir $finalize_deplibs" Chris@41: fi Chris@41: elif test yes = "$build_libtool_libs"; then Chris@41: # Not a shared library Chris@41: if test pass_all != "$deplibs_check_method"; then Chris@41: # We're trying link a shared library against a static one Chris@41: # but the system doesn't support it. Chris@41: Chris@41: # Just print a warning and add the library to dependency_libs so Chris@41: # that the program can be linked against the static library. Chris@41: echo Chris@41: $ECHO "*** Warning: This system cannot link to static lib archive $lib." Chris@41: echo "*** I have the capability to make that library automatically link in when" Chris@41: echo "*** you link to this library. But I can only do this if you have a" Chris@41: echo "*** shared version of the library, which you do not appear to have." Chris@41: if test yes = "$module"; then Chris@41: echo "*** But as you try to build a module library, libtool will still create " Chris@41: echo "*** a static module, that should work as long as the dlopening application" Chris@41: echo "*** is linked with the -dlopen flag to resolve symbols at runtime." Chris@41: if test -z "$global_symbol_pipe"; then Chris@41: echo Chris@41: echo "*** However, this would only work if libtool was able to extract symbol" Chris@41: echo "*** lists from a program, using 'nm' or equivalent, but libtool could" Chris@41: echo "*** not find such a program. So, this module is probably useless." Chris@41: echo "*** 'nm' from GNU binutils and a full rebuild may help." Chris@41: fi Chris@41: if test no = "$build_old_libs"; then Chris@41: build_libtool_libs=module Chris@41: build_old_libs=yes Chris@41: else Chris@41: build_libtool_libs=no Chris@41: fi Chris@41: fi Chris@41: else Chris@41: deplibs="$dir/$old_library $deplibs" Chris@41: link_static=yes Chris@41: fi Chris@41: fi # link shared/static library? Chris@41: Chris@41: if test lib = "$linkmode"; then Chris@41: if test -n "$dependency_libs" && Chris@41: { test yes != "$hardcode_into_libs" || Chris@41: test yes = "$build_old_libs" || Chris@41: test yes = "$link_static"; }; then Chris@41: # Extract -R from dependency_libs Chris@41: temp_deplibs= Chris@41: for libdir in $dependency_libs; do Chris@41: case $libdir in Chris@41: -R*) func_stripname '-R' '' "$libdir" Chris@41: temp_xrpath=$func_stripname_result Chris@41: case " $xrpath " in Chris@41: *" $temp_xrpath "*) ;; Chris@41: *) func_append xrpath " $temp_xrpath";; Chris@41: esac;; Chris@41: *) func_append temp_deplibs " $libdir";; Chris@41: esac Chris@41: done Chris@41: dependency_libs=$temp_deplibs Chris@41: fi Chris@41: Chris@41: func_append newlib_search_path " $absdir" Chris@41: # Link against this library Chris@41: test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" Chris@41: # ... and its dependency_libs Chris@41: tmp_libs= Chris@41: for deplib in $dependency_libs; do Chris@41: newdependency_libs="$deplib $newdependency_libs" Chris@41: case $deplib in Chris@41: -L*) func_stripname '-L' '' "$deplib" Chris@41: func_resolve_sysroot "$func_stripname_result";; Chris@41: *) func_resolve_sysroot "$deplib" ;; Chris@41: esac Chris@41: if $opt_preserve_dup_deps; then Chris@41: case "$tmp_libs " in Chris@41: *" $func_resolve_sysroot_result "*) Chris@41: func_append specialdeplibs " $func_resolve_sysroot_result" ;; Chris@41: esac Chris@41: fi Chris@41: func_append tmp_libs " $func_resolve_sysroot_result" Chris@41: done Chris@41: Chris@41: if test no != "$link_all_deplibs"; then Chris@41: # Add the search paths of all dependency libraries Chris@41: for deplib in $dependency_libs; do Chris@41: path= Chris@41: case $deplib in Chris@41: -L*) path=$deplib ;; Chris@41: *.la) Chris@41: func_resolve_sysroot "$deplib" Chris@41: deplib=$func_resolve_sysroot_result Chris@41: func_dirname "$deplib" "" "." Chris@41: dir=$func_dirname_result Chris@41: # We need an absolute path. Chris@41: case $dir in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; Chris@41: *) Chris@41: absdir=`cd "$dir" && pwd` Chris@41: if test -z "$absdir"; then Chris@41: func_warning "cannot determine absolute directory name of '$dir'" Chris@41: absdir=$dir Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: if $GREP "^installed=no" $deplib > /dev/null; then Chris@41: case $host in Chris@41: *-*-darwin*) Chris@41: depdepl= Chris@41: eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` Chris@41: if test -n "$deplibrary_names"; then Chris@41: for tmp in $deplibrary_names; do Chris@41: depdepl=$tmp Chris@41: done Chris@41: if test -f "$absdir/$objdir/$depdepl"; then Chris@41: depdepl=$absdir/$objdir/$depdepl Chris@41: darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` Chris@41: if test -z "$darwin_install_name"; then Chris@41: darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` Chris@41: fi Chris@41: func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" Chris@41: func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" Chris@41: path= Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: path=-L$absdir/$objdir Chris@41: ;; Chris@41: esac Chris@41: else Chris@41: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` Chris@41: test -z "$libdir" && \ Chris@41: func_fatal_error "'$deplib' is not a valid libtool archive" Chris@41: test "$absdir" != "$libdir" && \ Chris@41: func_warning "'$deplib' seems to be moved" Chris@41: Chris@41: path=-L$absdir Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: case " $deplibs " in Chris@41: *" $path "*) ;; Chris@41: *) deplibs="$path $deplibs" ;; Chris@41: esac Chris@41: done Chris@41: fi # link_all_deplibs != no Chris@41: fi # linkmode = lib Chris@41: done # for deplib in $libs Chris@41: if test link = "$pass"; then Chris@41: if test prog = "$linkmode"; then Chris@41: compile_deplibs="$new_inherited_linker_flags $compile_deplibs" Chris@41: finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" Chris@41: else Chris@41: compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: fi Chris@41: fi Chris@41: dependency_libs=$newdependency_libs Chris@41: if test dlpreopen = "$pass"; then Chris@41: # Link the dlpreopened libraries before other libraries Chris@41: for deplib in $save_deplibs; do Chris@41: deplibs="$deplib $deplibs" Chris@41: done Chris@41: fi Chris@41: if test dlopen != "$pass"; then Chris@41: test conv = "$pass" || { Chris@41: # Make sure lib_search_path contains only unique directories. Chris@41: lib_search_path= Chris@41: for dir in $newlib_search_path; do Chris@41: case "$lib_search_path " in Chris@41: *" $dir "*) ;; Chris@41: *) func_append lib_search_path " $dir" ;; Chris@41: esac Chris@41: done Chris@41: newlib_search_path= Chris@41: } Chris@41: Chris@41: if test prog,link = "$linkmode,$pass"; then Chris@41: vars="compile_deplibs finalize_deplibs" Chris@41: else Chris@41: vars=deplibs Chris@41: fi Chris@41: for var in $vars dependency_libs; do Chris@41: # Add libraries to $var in reverse order Chris@41: eval tmp_libs=\"\$$var\" Chris@41: new_libs= Chris@41: for deplib in $tmp_libs; do Chris@41: # FIXME: Pedantically, this is the right thing to do, so Chris@41: # that some nasty dependency loop isn't accidentally Chris@41: # broken: Chris@41: #new_libs="$deplib $new_libs" Chris@41: # Pragmatically, this seems to cause very few problems in Chris@41: # practice: Chris@41: case $deplib in Chris@41: -L*) new_libs="$deplib $new_libs" ;; Chris@41: -R*) ;; Chris@41: *) Chris@41: # And here is the reason: when a library appears more Chris@41: # than once as an explicit dependence of a library, or Chris@41: # is implicitly linked in more than once by the Chris@41: # compiler, it is considered special, and multiple Chris@41: # occurrences thereof are not removed. Compare this Chris@41: # with having the same library being listed as a Chris@41: # dependency of multiple other libraries: in this case, Chris@41: # we know (pedantically, we assume) the library does not Chris@41: # need to be listed more than once, so we keep only the Chris@41: # last copy. This is not always right, but it is rare Chris@41: # enough that we require users that really mean to play Chris@41: # such unportable linking tricks to link the library Chris@41: # using -Wl,-lname, so that libtool does not consider it Chris@41: # for duplicate removal. Chris@41: case " $specialdeplibs " in Chris@41: *" $deplib "*) new_libs="$deplib $new_libs" ;; Chris@41: *) Chris@41: case " $new_libs " in Chris@41: *" $deplib "*) ;; Chris@41: *) new_libs="$deplib $new_libs" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: tmp_libs= Chris@41: for deplib in $new_libs; do Chris@41: case $deplib in Chris@41: -L*) Chris@41: case " $tmp_libs " in Chris@41: *" $deplib "*) ;; Chris@41: *) func_append tmp_libs " $deplib" ;; Chris@41: esac Chris@41: ;; Chris@41: *) func_append tmp_libs " $deplib" ;; Chris@41: esac Chris@41: done Chris@41: eval $var=\"$tmp_libs\" Chris@41: done # for var Chris@41: fi Chris@41: Chris@41: # Add Sun CC postdeps if required: Chris@41: test CXX = "$tagname" && { Chris@41: case $host_os in Chris@41: linux*) Chris@41: case `$CC -V 2>&1 | sed 5q` in Chris@41: *Sun\ C*) # Sun C++ 5.9 Chris@41: func_suncc_cstd_abi Chris@41: Chris@41: if test no != "$suncc_use_cstd_abi"; then Chris@41: func_append postdeps ' -library=Cstd -library=Crun' Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: Chris@41: solaris*) Chris@41: func_cc_basename "$CC" Chris@41: case $func_cc_basename_result in Chris@41: CC* | sunCC*) Chris@41: func_suncc_cstd_abi Chris@41: Chris@41: if test no != "$suncc_use_cstd_abi"; then Chris@41: func_append postdeps ' -library=Cstd -library=Crun' Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: Chris@41: # Last step: remove runtime libs from dependency_libs Chris@41: # (they stay in deplibs) Chris@41: tmp_libs= Chris@41: for i in $dependency_libs; do Chris@41: case " $predeps $postdeps $compiler_lib_search_path " in Chris@41: *" $i "*) Chris@41: i= Chris@41: ;; Chris@41: esac Chris@41: if test -n "$i"; then Chris@41: func_append tmp_libs " $i" Chris@41: fi Chris@41: done Chris@41: dependency_libs=$tmp_libs Chris@41: done # for pass Chris@41: if test prog = "$linkmode"; then Chris@41: dlfiles=$newdlfiles Chris@41: fi Chris@41: if test prog = "$linkmode" || test lib = "$linkmode"; then Chris@41: dlprefiles=$newdlprefiles Chris@41: fi Chris@41: Chris@41: case $linkmode in Chris@41: oldlib) Chris@41: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then Chris@41: func_warning "'-dlopen' is ignored for archives" Chris@41: fi Chris@41: Chris@41: case " $deplibs" in Chris@41: *\ -l* | *\ -L*) Chris@41: func_warning "'-l' and '-L' are ignored for archives" ;; Chris@41: esac Chris@41: Chris@41: test -n "$rpath" && \ Chris@41: func_warning "'-rpath' is ignored for archives" Chris@41: Chris@41: test -n "$xrpath" && \ Chris@41: func_warning "'-R' is ignored for archives" Chris@41: Chris@41: test -n "$vinfo" && \ Chris@41: func_warning "'-version-info/-version-number' is ignored for archives" Chris@41: Chris@41: test -n "$release" && \ Chris@41: func_warning "'-release' is ignored for archives" Chris@41: Chris@41: test -n "$export_symbols$export_symbols_regex" && \ Chris@41: func_warning "'-export-symbols' is ignored for archives" Chris@41: Chris@41: # Now set the variables for building old libraries. Chris@41: build_libtool_libs=no Chris@41: oldlibs=$output Chris@41: func_append objs "$old_deplibs" Chris@41: ;; Chris@41: Chris@41: lib) Chris@41: # Make sure we only generate libraries of the form 'libNAME.la'. Chris@41: case $outputname in Chris@41: lib*) Chris@41: func_stripname 'lib' '.la' "$outputname" Chris@41: name=$func_stripname_result Chris@41: eval shared_ext=\"$shrext_cmds\" Chris@41: eval libname=\"$libname_spec\" Chris@41: ;; Chris@41: *) Chris@41: test no = "$module" \ Chris@41: && func_fatal_help "libtool library '$output' must begin with 'lib'" Chris@41: Chris@41: if test no != "$need_lib_prefix"; then Chris@41: # Add the "lib" prefix for modules if required Chris@41: func_stripname '' '.la' "$outputname" Chris@41: name=$func_stripname_result Chris@41: eval shared_ext=\"$shrext_cmds\" Chris@41: eval libname=\"$libname_spec\" Chris@41: else Chris@41: func_stripname '' '.la' "$outputname" Chris@41: libname=$func_stripname_result Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: Chris@41: if test -n "$objs"; then Chris@41: if test pass_all != "$deplibs_check_method"; then Chris@41: func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" Chris@41: else Chris@41: echo Chris@41: $ECHO "*** Warning: Linking the shared library $output against the non-libtool" Chris@41: $ECHO "*** objects $objs is not portable!" Chris@41: func_append libobjs " $objs" Chris@41: fi Chris@41: fi Chris@41: Chris@41: test no = "$dlself" \ Chris@41: || func_warning "'-dlopen self' is ignored for libtool libraries" Chris@41: Chris@41: set dummy $rpath Chris@41: shift Chris@41: test 1 -lt "$#" \ Chris@41: && func_warning "ignoring multiple '-rpath's for a libtool library" Chris@41: Chris@41: install_libdir=$1 Chris@41: Chris@41: oldlibs= Chris@41: if test -z "$rpath"; then Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: # Building a libtool convenience library. Chris@41: # Some compilers have problems with a '.al' extension so Chris@41: # convenience libraries should have the same extension an Chris@41: # archive normally would. Chris@41: oldlibs="$output_objdir/$libname.$libext $oldlibs" Chris@41: build_libtool_libs=convenience Chris@41: build_old_libs=yes Chris@41: fi Chris@41: Chris@41: test -n "$vinfo" && \ Chris@41: func_warning "'-version-info/-version-number' is ignored for convenience libraries" Chris@41: Chris@41: test -n "$release" && \ Chris@41: func_warning "'-release' is ignored for convenience libraries" Chris@41: else Chris@41: Chris@41: # Parse the version information argument. Chris@41: save_ifs=$IFS; IFS=: Chris@41: set dummy $vinfo 0 0 0 Chris@41: shift Chris@41: IFS=$save_ifs Chris@41: Chris@41: test -n "$7" && \ Chris@41: func_fatal_help "too many parameters to '-version-info'" Chris@41: Chris@41: # convert absolute version numbers to libtool ages Chris@41: # this retains compatibility with .la files and attempts Chris@41: # to make the code below a bit more comprehensible Chris@41: Chris@41: case $vinfo_number in Chris@41: yes) Chris@41: number_major=$1 Chris@41: number_minor=$2 Chris@41: number_revision=$3 Chris@41: # Chris@41: # There are really only two kinds -- those that Chris@41: # use the current revision as the major version Chris@41: # and those that subtract age and use age as Chris@41: # a minor version. But, then there is irix Chris@41: # that has an extra 1 added just for fun Chris@41: # Chris@41: case $version_type in Chris@41: # correct linux to gnu/linux during the next big refactor Chris@41: darwin|freebsd-elf|linux|osf|windows|none) Chris@41: func_arith $number_major + $number_minor Chris@41: current=$func_arith_result Chris@41: age=$number_minor Chris@41: revision=$number_revision Chris@41: ;; Chris@41: freebsd-aout|qnx|sunos) Chris@41: current=$number_major Chris@41: revision=$number_minor Chris@41: age=0 Chris@41: ;; Chris@41: irix|nonstopux) Chris@41: func_arith $number_major + $number_minor Chris@41: current=$func_arith_result Chris@41: age=$number_minor Chris@41: revision=$number_minor Chris@41: lt_irix_increment=no Chris@41: ;; Chris@41: *) Chris@41: func_fatal_configuration "$modename: unknown library version type '$version_type'" Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: no) Chris@41: current=$1 Chris@41: revision=$2 Chris@41: age=$3 Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Check that each of the things are valid numbers. Chris@41: case $current in Chris@41: 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]) ;; Chris@41: *) Chris@41: func_error "CURRENT '$current' must be a nonnegative integer" Chris@41: func_fatal_error "'$vinfo' is not valid version information" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: case $revision in Chris@41: 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]) ;; Chris@41: *) Chris@41: func_error "REVISION '$revision' must be a nonnegative integer" Chris@41: func_fatal_error "'$vinfo' is not valid version information" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: case $age in Chris@41: 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]) ;; Chris@41: *) Chris@41: func_error "AGE '$age' must be a nonnegative integer" Chris@41: func_fatal_error "'$vinfo' is not valid version information" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: if test "$age" -gt "$current"; then Chris@41: func_error "AGE '$age' is greater than the current interface number '$current'" Chris@41: func_fatal_error "'$vinfo' is not valid version information" Chris@41: fi Chris@41: Chris@41: # Calculate the version variables. Chris@41: major= Chris@41: versuffix= Chris@41: verstring= Chris@41: case $version_type in Chris@41: none) ;; Chris@41: Chris@41: darwin) Chris@41: # Like Linux, but with the current version available in Chris@41: # verstring for coding it into the library header Chris@41: func_arith $current - $age Chris@41: major=.$func_arith_result Chris@41: versuffix=$major.$age.$revision Chris@41: # Darwin ld doesn't like 0 for these options... Chris@41: func_arith $current + 1 Chris@41: minor_current=$func_arith_result Chris@41: xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" Chris@41: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" Chris@41: # On Darwin other compilers Chris@41: case $CC in Chris@41: nagfor*) Chris@41: verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" Chris@41: ;; Chris@41: *) Chris@41: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: Chris@41: freebsd-aout) Chris@41: major=.$current Chris@41: versuffix=.$current.$revision Chris@41: ;; Chris@41: Chris@41: freebsd-elf) Chris@41: func_arith $current - $age Chris@41: major=.$func_arith_result Chris@41: versuffix=$major.$age.$revision Chris@41: ;; Chris@41: Chris@41: irix | nonstopux) Chris@41: if test no = "$lt_irix_increment"; then Chris@41: func_arith $current - $age Chris@41: else Chris@41: func_arith $current - $age + 1 Chris@41: fi Chris@41: major=$func_arith_result Chris@41: Chris@41: case $version_type in Chris@41: nonstopux) verstring_prefix=nonstopux ;; Chris@41: *) verstring_prefix=sgi ;; Chris@41: esac Chris@41: verstring=$verstring_prefix$major.$revision Chris@41: Chris@41: # Add in all the interfaces that we are compatible with. Chris@41: loop=$revision Chris@41: while test 0 -ne "$loop"; do Chris@41: func_arith $revision - $loop Chris@41: iface=$func_arith_result Chris@41: func_arith $loop - 1 Chris@41: loop=$func_arith_result Chris@41: verstring=$verstring_prefix$major.$iface:$verstring Chris@41: done Chris@41: Chris@41: # Before this point, $major must not contain '.'. Chris@41: major=.$major Chris@41: versuffix=$major.$revision Chris@41: ;; Chris@41: Chris@41: linux) # correct to gnu/linux during the next big refactor Chris@41: func_arith $current - $age Chris@41: major=.$func_arith_result Chris@41: versuffix=$major.$age.$revision Chris@41: ;; Chris@41: Chris@41: osf) Chris@41: func_arith $current - $age Chris@41: major=.$func_arith_result Chris@41: versuffix=.$current.$age.$revision Chris@41: verstring=$current.$age.$revision Chris@41: Chris@41: # Add in all the interfaces that we are compatible with. Chris@41: loop=$age Chris@41: while test 0 -ne "$loop"; do Chris@41: func_arith $current - $loop Chris@41: iface=$func_arith_result Chris@41: func_arith $loop - 1 Chris@41: loop=$func_arith_result Chris@41: verstring=$verstring:$iface.0 Chris@41: done Chris@41: Chris@41: # Make executables depend on our current version. Chris@41: func_append verstring ":$current.0" Chris@41: ;; Chris@41: Chris@41: qnx) Chris@41: major=.$current Chris@41: versuffix=.$current Chris@41: ;; Chris@41: Chris@41: sco) Chris@41: major=.$current Chris@41: versuffix=.$current Chris@41: ;; Chris@41: Chris@41: sunos) Chris@41: major=.$current Chris@41: versuffix=.$current.$revision Chris@41: ;; Chris@41: Chris@41: windows) Chris@41: # Use '-' rather than '.', since we only want one Chris@41: # extension on DOS 8.3 file systems. Chris@41: func_arith $current - $age Chris@41: major=$func_arith_result Chris@41: versuffix=-$major Chris@41: ;; Chris@41: Chris@41: *) Chris@41: func_fatal_configuration "unknown library version type '$version_type'" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Clear the version info if we defaulted, and they specified a release. Chris@41: if test -z "$vinfo" && test -n "$release"; then Chris@41: major= Chris@41: case $version_type in Chris@41: darwin) Chris@41: # we can't check for "0.0" in archive_cmds due to quoting Chris@41: # problems, so we reset it completely Chris@41: verstring= Chris@41: ;; Chris@41: *) Chris@41: verstring=0.0 Chris@41: ;; Chris@41: esac Chris@41: if test no = "$need_version"; then Chris@41: versuffix= Chris@41: else Chris@41: versuffix=.0.0 Chris@41: fi Chris@41: fi Chris@41: Chris@41: # Remove version info from name if versioning should be avoided Chris@41: if test yes,no = "$avoid_version,$need_version"; then Chris@41: major= Chris@41: versuffix= Chris@41: verstring= Chris@41: fi Chris@41: Chris@41: # Check to see if the archive will have undefined symbols. Chris@41: if test yes = "$allow_undefined"; then Chris@41: if test unsupported = "$allow_undefined_flag"; then Chris@41: if test yes = "$build_old_libs"; then Chris@41: func_warning "undefined symbols not allowed in $host shared libraries; building static only" Chris@41: build_libtool_libs=no Chris@41: else Chris@41: func_fatal_error "can't build $host shared library unless -no-undefined is specified" Chris@41: fi Chris@41: fi Chris@41: else Chris@41: # Don't allow undefined symbols. Chris@41: allow_undefined_flag=$no_undefined_flag Chris@41: fi Chris@41: Chris@41: fi Chris@41: Chris@41: func_generate_dlsyms "$libname" "$libname" : Chris@41: func_append libobjs " $symfileobj" Chris@41: test " " = "$libobjs" && libobjs= Chris@41: Chris@41: if test relink != "$opt_mode"; then Chris@41: # Remove our outputs, but don't remove object files since they Chris@41: # may have been created when compiling PIC objects. Chris@41: removelist= Chris@41: tempremovelist=`$ECHO "$output_objdir/*"` Chris@41: for p in $tempremovelist; do Chris@41: case $p in Chris@41: *.$objext | *.gcno) Chris@41: ;; Chris@41: $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) Chris@41: if test -n "$precious_files_regex"; then Chris@41: if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 Chris@41: then Chris@41: continue Chris@41: fi Chris@41: fi Chris@41: func_append removelist " $p" Chris@41: ;; Chris@41: *) ;; Chris@41: esac Chris@41: done Chris@41: test -n "$removelist" && \ Chris@41: func_show_eval "${RM}r \$removelist" Chris@41: fi Chris@41: Chris@41: # Now set the variables for building old libraries. Chris@41: if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then Chris@41: func_append oldlibs " $output_objdir/$libname.$libext" Chris@41: Chris@41: # Transform .lo files to .o files. Chris@41: oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` Chris@41: fi Chris@41: Chris@41: # Eliminate all temporary directories. Chris@41: #for path in $notinst_path; do Chris@41: # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` Chris@41: # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` Chris@41: # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` Chris@41: #done Chris@41: Chris@41: if test -n "$xrpath"; then Chris@41: # If the user specified any rpath flags, then add them. Chris@41: temp_xrpath= Chris@41: for libdir in $xrpath; do Chris@41: func_replace_sysroot "$libdir" Chris@41: func_append temp_xrpath " -R$func_replace_sysroot_result" Chris@41: case "$finalize_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append finalize_rpath " $libdir" ;; Chris@41: esac Chris@41: done Chris@41: if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then Chris@41: dependency_libs="$temp_xrpath $dependency_libs" Chris@41: fi Chris@41: fi Chris@41: Chris@41: # Make sure dlfiles contains only unique files that won't be dlpreopened Chris@41: old_dlfiles=$dlfiles Chris@41: dlfiles= Chris@41: for lib in $old_dlfiles; do Chris@41: case " $dlprefiles $dlfiles " in Chris@41: *" $lib "*) ;; Chris@41: *) func_append dlfiles " $lib" ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: # Make sure dlprefiles contains only unique files Chris@41: old_dlprefiles=$dlprefiles Chris@41: dlprefiles= Chris@41: for lib in $old_dlprefiles; do Chris@41: case "$dlprefiles " in Chris@41: *" $lib "*) ;; Chris@41: *) func_append dlprefiles " $lib" ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: if test -n "$rpath"; then Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) Chris@41: # these systems don't actually have a c library (as such)! Chris@41: ;; Chris@41: *-*-rhapsody* | *-*-darwin1.[012]) Chris@41: # Rhapsody C library is in the System framework Chris@41: func_append deplibs " System.ltframework" Chris@41: ;; Chris@41: *-*-netbsd*) Chris@41: # Don't link with libc until the a.out ld.so is fixed. Chris@41: ;; Chris@41: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) Chris@41: # Do not include libc due to us having libc/libc_r. Chris@41: ;; Chris@41: *-*-sco3.2v5* | *-*-sco5v6*) Chris@41: # Causes problems with __ctype Chris@41: ;; Chris@41: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) Chris@41: # Compiler inserts libc in the correct place for threads to work Chris@41: ;; Chris@41: *) Chris@41: # Add libc to deplibs on all other systems if necessary. Chris@41: if test yes = "$build_libtool_need_lc"; then Chris@41: func_append deplibs " -lc" Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: # Transform deplibs into only deplibs that can be linked in shared. Chris@41: name_save=$name Chris@41: libname_save=$libname Chris@41: release_save=$release Chris@41: versuffix_save=$versuffix Chris@41: major_save=$major Chris@41: # I'm not sure if I'm treating the release correctly. I think Chris@41: # release should show up in the -l (ie -lgmp5) so we don't want to Chris@41: # add it in twice. Is that correct? Chris@41: release= Chris@41: versuffix= Chris@41: major= Chris@41: newdeplibs= Chris@41: droppeddeps=no Chris@41: case $deplibs_check_method in Chris@41: pass_all) Chris@41: # Don't check for shared/static. Everything works. Chris@41: # This might be a little naive. We might want to check Chris@41: # whether the library exists or not. But this is on Chris@41: # osf3 & osf4 and I'm not really sure... Just Chris@41: # implementing what was already the behavior. Chris@41: newdeplibs=$deplibs Chris@41: ;; Chris@41: test_compile) Chris@41: # This code stresses the "libraries are programs" paradigm to its Chris@41: # limits. Maybe even breaks it. We compile a program, linking it Chris@41: # against the deplibs as a proxy for the library. Then we can check Chris@41: # whether they linked in statically or dynamically with ldd. Chris@41: $opt_dry_run || $RM conftest.c Chris@41: cat > conftest.c </dev/null` Chris@41: $nocaseglob Chris@41: else Chris@41: potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` Chris@41: fi Chris@41: for potent_lib in $potential_libs; do Chris@41: # Follow soft links. Chris@41: if ls -lLd "$potent_lib" 2>/dev/null | Chris@41: $GREP " -> " >/dev/null; then Chris@41: continue Chris@41: fi Chris@41: # The statement above tries to avoid entering an Chris@41: # endless loop below, in case of cyclic links. Chris@41: # We might still enter an endless loop, since a link Chris@41: # loop can be closed while we follow links, Chris@41: # but so what? Chris@41: potlib=$potent_lib Chris@41: while test -h "$potlib" 2>/dev/null; do Chris@41: potliblink=`ls -ld $potlib | $SED 's/.* -> //'` Chris@41: case $potliblink in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; Chris@41: *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; Chris@41: esac Chris@41: done Chris@41: if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | Chris@41: $SED -e 10q | Chris@41: $EGREP "$file_magic_regex" > /dev/null; then Chris@41: func_append newdeplibs " $a_deplib" Chris@41: a_deplib= Chris@41: break 2 Chris@41: fi Chris@41: done Chris@41: done Chris@41: fi Chris@41: if test -n "$a_deplib"; then Chris@41: droppeddeps=yes Chris@41: echo Chris@41: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." Chris@41: echo "*** I have the capability to make that library automatically link in when" Chris@41: echo "*** you link to this library. But I can only do this if you have a" Chris@41: echo "*** shared version of the library, which you do not appear to have" Chris@41: echo "*** because I did check the linker path looking for a file starting" Chris@41: if test -z "$potlib"; then Chris@41: $ECHO "*** with $libname but no candidates were found. (...for file magic test)" Chris@41: else Chris@41: $ECHO "*** with $libname and none of the candidates passed a file format test" Chris@41: $ECHO "*** using a file magic. Last file checked: $potlib" Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: # Add a -L argument. Chris@41: func_append newdeplibs " $a_deplib" Chris@41: ;; Chris@41: esac Chris@41: done # Gone through all deplibs. Chris@41: ;; Chris@41: match_pattern*) Chris@41: set dummy $deplibs_check_method; shift Chris@41: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` Chris@41: for a_deplib in $deplibs; do Chris@41: case $a_deplib in Chris@41: -l*) Chris@41: func_stripname -l '' "$a_deplib" Chris@41: name=$func_stripname_result Chris@41: if test yes = "$allow_libtool_libs_with_static_runtimes"; then Chris@41: case " $predeps $postdeps " in Chris@41: *" $a_deplib "*) Chris@41: func_append newdeplibs " $a_deplib" Chris@41: a_deplib= Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: if test -n "$a_deplib"; then Chris@41: libname=`eval "\\$ECHO \"$libname_spec\""` Chris@41: for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do Chris@41: potential_libs=`ls $i/$libname[.-]* 2>/dev/null` Chris@41: for potent_lib in $potential_libs; do Chris@41: potlib=$potent_lib # see symlink-check above in file_magic test Chris@41: if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ Chris@41: $EGREP "$match_pattern_regex" > /dev/null; then Chris@41: func_append newdeplibs " $a_deplib" Chris@41: a_deplib= Chris@41: break 2 Chris@41: fi Chris@41: done Chris@41: done Chris@41: fi Chris@41: if test -n "$a_deplib"; then Chris@41: droppeddeps=yes Chris@41: echo Chris@41: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." Chris@41: echo "*** I have the capability to make that library automatically link in when" Chris@41: echo "*** you link to this library. But I can only do this if you have a" Chris@41: echo "*** shared version of the library, which you do not appear to have" Chris@41: echo "*** because I did check the linker path looking for a file starting" Chris@41: if test -z "$potlib"; then Chris@41: $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" Chris@41: else Chris@41: $ECHO "*** with $libname and none of the candidates passed a file format test" Chris@41: $ECHO "*** using a regex pattern. Last file checked: $potlib" Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: *) Chris@41: # Add a -L argument. Chris@41: func_append newdeplibs " $a_deplib" Chris@41: ;; Chris@41: esac Chris@41: done # Gone through all deplibs. Chris@41: ;; Chris@41: none | unknown | *) Chris@41: newdeplibs= Chris@41: tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` Chris@41: if test yes = "$allow_libtool_libs_with_static_runtimes"; then Chris@41: for i in $predeps $postdeps; do Chris@41: # can't use Xsed below, because $i might contain '/' Chris@41: tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` Chris@41: done Chris@41: fi Chris@41: case $tmp_deplibs in Chris@41: *[!\ \ ]*) Chris@41: echo Chris@41: if test none = "$deplibs_check_method"; then Chris@41: echo "*** Warning: inter-library dependencies are not supported in this platform." Chris@41: else Chris@41: echo "*** Warning: inter-library dependencies are not known to be supported." Chris@41: fi Chris@41: echo "*** All declared inter-library dependencies are being dropped." Chris@41: droppeddeps=yes Chris@41: ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: versuffix=$versuffix_save Chris@41: major=$major_save Chris@41: release=$release_save Chris@41: libname=$libname_save Chris@41: name=$name_save Chris@41: Chris@41: case $host in Chris@41: *-*-rhapsody* | *-*-darwin1.[012]) Chris@41: # On Rhapsody replace the C library with the System framework Chris@41: newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` Chris@41: ;; Chris@41: esac Chris@41: Chris@41: if test yes = "$droppeddeps"; then Chris@41: if test yes = "$module"; then Chris@41: echo Chris@41: echo "*** Warning: libtool could not satisfy all declared inter-library" Chris@41: $ECHO "*** dependencies of module $libname. Therefore, libtool will create" Chris@41: echo "*** a static module, that should work as long as the dlopening" Chris@41: echo "*** application is linked with the -dlopen flag." Chris@41: if test -z "$global_symbol_pipe"; then Chris@41: echo Chris@41: echo "*** However, this would only work if libtool was able to extract symbol" Chris@41: echo "*** lists from a program, using 'nm' or equivalent, but libtool could" Chris@41: echo "*** not find such a program. So, this module is probably useless." Chris@41: echo "*** 'nm' from GNU binutils and a full rebuild may help." Chris@41: fi Chris@41: if test no = "$build_old_libs"; then Chris@41: oldlibs=$output_objdir/$libname.$libext Chris@41: build_libtool_libs=module Chris@41: build_old_libs=yes Chris@41: else Chris@41: build_libtool_libs=no Chris@41: fi Chris@41: else Chris@41: echo "*** The inter-library dependencies that have been dropped here will be" Chris@41: echo "*** automatically added whenever a program is linked with this library" Chris@41: echo "*** or is declared to -dlopen it." Chris@41: Chris@41: if test no = "$allow_undefined"; then Chris@41: echo Chris@41: echo "*** Since this library must not contain undefined symbols," Chris@41: echo "*** because either the platform does not support them or" Chris@41: echo "*** it was explicitly requested with -no-undefined," Chris@41: echo "*** libtool will only create a static version of it." Chris@41: if test no = "$build_old_libs"; then Chris@41: oldlibs=$output_objdir/$libname.$libext Chris@41: build_libtool_libs=module Chris@41: build_old_libs=yes Chris@41: else Chris@41: build_libtool_libs=no Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: # Done checking deplibs! Chris@41: deplibs=$newdeplibs Chris@41: fi Chris@41: # Time to change all our "foo.ltframework" stuff back to "-framework foo" Chris@41: case $host in Chris@41: *-*-darwin*) Chris@41: newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # move library search paths that coincide with paths to not yet Chris@41: # installed libraries to the beginning of the library search list Chris@41: new_libs= Chris@41: for path in $notinst_path; do Chris@41: case " $new_libs " in Chris@41: *" -L$path/$objdir "*) ;; Chris@41: *) Chris@41: case " $deplibs " in Chris@41: *" -L$path/$objdir "*) Chris@41: func_append new_libs " -L$path/$objdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: for deplib in $deplibs; do Chris@41: case $deplib in Chris@41: -L*) Chris@41: case " $new_libs " in Chris@41: *" $deplib "*) ;; Chris@41: *) func_append new_libs " $deplib" ;; Chris@41: esac Chris@41: ;; Chris@41: *) func_append new_libs " $deplib" ;; Chris@41: esac Chris@41: done Chris@41: deplibs=$new_libs Chris@41: Chris@41: # All the library-specific variables (install_libdir is set above). Chris@41: library_names= Chris@41: old_library= Chris@41: dlname= Chris@41: Chris@41: # Test again, we may have decided not to build it any more Chris@41: if test yes = "$build_libtool_libs"; then Chris@41: # Remove $wl instances when linking with ld. Chris@41: # FIXME: should test the right _cmds variable. Chris@41: case $archive_cmds in Chris@41: *\$LD\ *) wl= ;; Chris@41: esac Chris@41: if test yes = "$hardcode_into_libs"; then Chris@41: # Hardcode the library paths Chris@41: hardcode_libdirs= Chris@41: dep_rpath= Chris@41: rpath=$finalize_rpath Chris@41: test relink = "$opt_mode" || rpath=$compile_rpath$rpath Chris@41: for libdir in $rpath; do Chris@41: if test -n "$hardcode_libdir_flag_spec"; then Chris@41: if test -n "$hardcode_libdir_separator"; then Chris@41: func_replace_sysroot "$libdir" Chris@41: libdir=$func_replace_sysroot_result Chris@41: if test -z "$hardcode_libdirs"; then Chris@41: hardcode_libdirs=$libdir Chris@41: else Chris@41: # Just accumulate the unique libdirs. Chris@41: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@41: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@41: ;; Chris@41: *) Chris@41: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: else Chris@41: eval flag=\"$hardcode_libdir_flag_spec\" Chris@41: func_append dep_rpath " $flag" Chris@41: fi Chris@41: elif test -n "$runpath_var"; then Chris@41: case "$perm_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append perm_rpath " $libdir" ;; Chris@41: esac Chris@41: fi Chris@41: done Chris@41: # Substitute the hardcoded libdirs into the rpath. Chris@41: if test -n "$hardcode_libdir_separator" && Chris@41: test -n "$hardcode_libdirs"; then Chris@41: libdir=$hardcode_libdirs Chris@41: eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" Chris@41: fi Chris@41: if test -n "$runpath_var" && test -n "$perm_rpath"; then Chris@41: # We should set the runpath_var. Chris@41: rpath= Chris@41: for dir in $perm_rpath; do Chris@41: func_append rpath "$dir:" Chris@41: done Chris@41: eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" Chris@41: fi Chris@41: test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" Chris@41: fi Chris@41: Chris@41: shlibpath=$finalize_shlibpath Chris@41: test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath Chris@41: if test -n "$shlibpath"; then Chris@41: eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" Chris@41: fi Chris@41: Chris@41: # Get the real and link names of the library. Chris@41: eval shared_ext=\"$shrext_cmds\" Chris@41: eval library_names=\"$library_names_spec\" Chris@41: set dummy $library_names Chris@41: shift Chris@41: realname=$1 Chris@41: shift Chris@41: Chris@41: if test -n "$soname_spec"; then Chris@41: eval soname=\"$soname_spec\" Chris@41: else Chris@41: soname=$realname Chris@41: fi Chris@41: if test -z "$dlname"; then Chris@41: dlname=$soname Chris@41: fi Chris@41: Chris@41: lib=$output_objdir/$realname Chris@41: linknames= Chris@41: for link Chris@41: do Chris@41: func_append linknames " $link" Chris@41: done Chris@41: Chris@41: # Use standard objects if they are pic Chris@41: test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@41: test "X$libobjs" = "X " && libobjs= Chris@41: Chris@41: delfiles= Chris@41: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@41: $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" Chris@41: export_symbols=$output_objdir/$libname.uexp Chris@41: func_append delfiles " $export_symbols" Chris@41: fi Chris@41: Chris@41: orig_export_symbols= Chris@41: case $host_os in Chris@41: cygwin* | mingw* | cegcc*) Chris@41: if test -n "$export_symbols" && test -z "$export_symbols_regex"; then Chris@41: # exporting using user supplied symfile Chris@41: func_dll_def_p "$export_symbols" || { Chris@41: # and it's NOT already a .def file. Must figure out Chris@41: # which of the given symbols are data symbols and tag Chris@41: # them as such. So, trigger use of export_symbols_cmds. Chris@41: # export_symbols gets reassigned inside the "prepare Chris@41: # the list of exported symbols" if statement, so the Chris@41: # include_expsyms logic still works. Chris@41: orig_export_symbols=$export_symbols Chris@41: export_symbols= Chris@41: always_export_symbols=yes Chris@41: } Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Prepare the list of exported symbols Chris@41: if test -z "$export_symbols"; then Chris@41: if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then Chris@41: func_verbose "generating symbol list for '$libname.la'" Chris@41: export_symbols=$output_objdir/$libname.exp Chris@41: $opt_dry_run || $RM $export_symbols Chris@41: cmds=$export_symbols_cmds Chris@41: save_ifs=$IFS; IFS='~' Chris@41: for cmd1 in $cmds; do Chris@41: IFS=$save_ifs Chris@41: # Take the normal branch if the nm_file_list_spec branch Chris@41: # doesn't work or if tool conversion is not needed. Chris@41: case $nm_file_list_spec~$to_tool_file_cmd in Chris@41: *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) Chris@41: try_normal_branch=yes Chris@41: eval cmd=\"$cmd1\" Chris@41: func_len " $cmd" Chris@41: len=$func_len_result Chris@41: ;; Chris@41: *) Chris@41: try_normal_branch=no Chris@41: ;; Chris@41: esac Chris@41: if test yes = "$try_normal_branch" \ Chris@41: && { test "$len" -lt "$max_cmd_len" \ Chris@41: || test "$max_cmd_len" -le -1; } Chris@41: then Chris@41: func_show_eval "$cmd" 'exit $?' Chris@41: skipped_export=false Chris@41: elif test -n "$nm_file_list_spec"; then Chris@41: func_basename "$output" Chris@41: output_la=$func_basename_result Chris@41: save_libobjs=$libobjs Chris@41: save_output=$output Chris@41: output=$output_objdir/$output_la.nm Chris@41: func_to_tool_file "$output" Chris@41: libobjs=$nm_file_list_spec$func_to_tool_file_result Chris@41: func_append delfiles " $output" Chris@41: func_verbose "creating $NM input file list: $output" Chris@41: for obj in $save_libobjs; do Chris@41: func_to_tool_file "$obj" Chris@41: $ECHO "$func_to_tool_file_result" Chris@41: done > "$output" Chris@41: eval cmd=\"$cmd1\" Chris@41: func_show_eval "$cmd" 'exit $?' Chris@41: output=$save_output Chris@41: libobjs=$save_libobjs Chris@41: skipped_export=false Chris@41: else Chris@41: # The command line is too long to execute in one step. Chris@41: func_verbose "using reloadable object file for export list..." Chris@41: skipped_export=: Chris@41: # Break out early, otherwise skipped_export may be Chris@41: # set to false by a later but shorter cmd. Chris@41: break Chris@41: fi Chris@41: done Chris@41: IFS=$save_ifs Chris@41: if test -n "$export_symbols_regex" && test : != "$skipped_export"; then Chris@41: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' Chris@41: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@41: tmp_export_symbols=$export_symbols Chris@41: test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols Chris@41: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' Chris@41: fi Chris@41: Chris@41: if test : != "$skipped_export" && test -n "$orig_export_symbols"; then Chris@41: # The given exports_symbols file has to be filtered, so filter it. Chris@41: func_verbose "filter symbol list for '$libname.la' to tag DATA exports" Chris@41: # FIXME: $output_objdir/$libname.filter potentially contains lots of Chris@41: # 's' commands, which not all seds can handle. GNU sed should be fine Chris@41: # though. Also, the filter scales superlinearly with the number of Chris@41: # global variables. join(1) would be nice here, but unfortunately Chris@41: # isn't a blessed tool. Chris@41: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter Chris@41: func_append delfiles " $export_symbols $output_objdir/$libname.filter" Chris@41: export_symbols=$output_objdir/$libname.def Chris@41: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols Chris@41: fi Chris@41: Chris@41: tmp_deplibs= Chris@41: for test_deplib in $deplibs; do Chris@41: case " $convenience " in Chris@41: *" $test_deplib "*) ;; Chris@41: *) Chris@41: func_append tmp_deplibs " $test_deplib" Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: deplibs=$tmp_deplibs Chris@41: Chris@41: if test -n "$convenience"; then Chris@41: if test -n "$whole_archive_flag_spec" && Chris@41: test yes = "$compiler_needs_object" && Chris@41: test -z "$libobjs"; then Chris@41: # extract the archives, so we have objects to list. Chris@41: # TODO: could optimize this to just extract one archive. Chris@41: whole_archive_flag_spec= Chris@41: fi Chris@41: if test -n "$whole_archive_flag_spec"; then Chris@41: save_libobjs=$libobjs Chris@41: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" Chris@41: test "X$libobjs" = "X " && libobjs= Chris@41: else Chris@41: gentop=$output_objdir/${outputname}x Chris@41: func_append generated " $gentop" Chris@41: Chris@41: func_extract_archives $gentop $convenience Chris@41: func_append libobjs " $func_extract_archives_result" Chris@41: test "X$libobjs" = "X " && libobjs= Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then Chris@41: eval flag=\"$thread_safe_flag_spec\" Chris@41: func_append linker_flags " $flag" Chris@41: fi Chris@41: Chris@41: # Make a backup of the uninstalled library when relinking Chris@41: if test relink = "$opt_mode"; then Chris@41: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? Chris@41: fi Chris@41: Chris@41: # Do each of the archive commands. Chris@41: if test yes = "$module" && test -n "$module_cmds"; then Chris@41: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then Chris@41: eval test_cmds=\"$module_expsym_cmds\" Chris@41: cmds=$module_expsym_cmds Chris@41: else Chris@41: eval test_cmds=\"$module_cmds\" Chris@41: cmds=$module_cmds Chris@41: fi Chris@41: else Chris@41: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then Chris@41: eval test_cmds=\"$archive_expsym_cmds\" Chris@41: cmds=$archive_expsym_cmds Chris@41: else Chris@41: eval test_cmds=\"$archive_cmds\" Chris@41: cmds=$archive_cmds Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test : != "$skipped_export" && Chris@41: func_len " $test_cmds" && Chris@41: len=$func_len_result && Chris@41: test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then Chris@41: : Chris@41: else Chris@41: # The command line is too long to link in one step, link piecewise Chris@41: # or, if using GNU ld and skipped_export is not :, use a linker Chris@41: # script. Chris@41: Chris@41: # Save the value of $output and $libobjs because we want to Chris@41: # use them later. If we have whole_archive_flag_spec, we Chris@41: # want to use save_libobjs as it was before Chris@41: # whole_archive_flag_spec was expanded, because we can't Chris@41: # assume the linker understands whole_archive_flag_spec. Chris@41: # This may have to be revisited, in case too many Chris@41: # convenience libraries get linked in and end up exceeding Chris@41: # the spec. Chris@41: if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then Chris@41: save_libobjs=$libobjs Chris@41: fi Chris@41: save_output=$output Chris@41: func_basename "$output" Chris@41: output_la=$func_basename_result Chris@41: Chris@41: # Clear the reloadable object creation command queue and Chris@41: # initialize k to one. Chris@41: test_cmds= Chris@41: concat_cmds= Chris@41: objlist= Chris@41: last_robj= Chris@41: k=1 Chris@41: Chris@41: if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then Chris@41: output=$output_objdir/$output_la.lnkscript Chris@41: func_verbose "creating GNU ld script: $output" Chris@41: echo 'INPUT (' > $output Chris@41: for obj in $save_libobjs Chris@41: do Chris@41: func_to_tool_file "$obj" Chris@41: $ECHO "$func_to_tool_file_result" >> $output Chris@41: done Chris@41: echo ')' >> $output Chris@41: func_append delfiles " $output" Chris@41: func_to_tool_file "$output" Chris@41: output=$func_to_tool_file_result Chris@41: elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then Chris@41: output=$output_objdir/$output_la.lnk Chris@41: func_verbose "creating linker input file list: $output" Chris@41: : > $output Chris@41: set x $save_libobjs Chris@41: shift Chris@41: firstobj= Chris@41: if test yes = "$compiler_needs_object"; then Chris@41: firstobj="$1 " Chris@41: shift Chris@41: fi Chris@41: for obj Chris@41: do Chris@41: func_to_tool_file "$obj" Chris@41: $ECHO "$func_to_tool_file_result" >> $output Chris@41: done Chris@41: func_append delfiles " $output" Chris@41: func_to_tool_file "$output" Chris@41: output=$firstobj\"$file_list_spec$func_to_tool_file_result\" Chris@41: else Chris@41: if test -n "$save_libobjs"; then Chris@41: func_verbose "creating reloadable object files..." Chris@41: output=$output_objdir/$output_la-$k.$objext Chris@41: eval test_cmds=\"$reload_cmds\" Chris@41: func_len " $test_cmds" Chris@41: len0=$func_len_result Chris@41: len=$len0 Chris@41: Chris@41: # Loop over the list of objects to be linked. Chris@41: for obj in $save_libobjs Chris@41: do Chris@41: func_len " $obj" Chris@41: func_arith $len + $func_len_result Chris@41: len=$func_arith_result Chris@41: if test -z "$objlist" || Chris@41: test "$len" -lt "$max_cmd_len"; then Chris@41: func_append objlist " $obj" Chris@41: else Chris@41: # The command $test_cmds is almost too long, add a Chris@41: # command to the queue. Chris@41: if test 1 -eq "$k"; then Chris@41: # The first file doesn't have a previous command to add. Chris@41: reload_objs=$objlist Chris@41: eval concat_cmds=\"$reload_cmds\" Chris@41: else Chris@41: # All subsequent reloadable object files will link in Chris@41: # the last one created. Chris@41: reload_objs="$objlist $last_robj" Chris@41: eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" Chris@41: fi Chris@41: last_robj=$output_objdir/$output_la-$k.$objext Chris@41: func_arith $k + 1 Chris@41: k=$func_arith_result Chris@41: output=$output_objdir/$output_la-$k.$objext Chris@41: objlist=" $obj" Chris@41: func_len " $last_robj" Chris@41: func_arith $len0 + $func_len_result Chris@41: len=$func_arith_result Chris@41: fi Chris@41: done Chris@41: # Handle the remaining objects by creating one last Chris@41: # reloadable object file. All subsequent reloadable object Chris@41: # files will link in the last one created. Chris@41: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@41: reload_objs="$objlist $last_robj" Chris@41: eval concat_cmds=\"\$concat_cmds$reload_cmds\" Chris@41: if test -n "$last_robj"; then Chris@41: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" Chris@41: fi Chris@41: func_append delfiles " $output" Chris@41: Chris@41: else Chris@41: output= Chris@41: fi Chris@41: Chris@41: ${skipped_export-false} && { Chris@41: func_verbose "generating symbol list for '$libname.la'" Chris@41: export_symbols=$output_objdir/$libname.exp Chris@41: $opt_dry_run || $RM $export_symbols Chris@41: libobjs=$output Chris@41: # Append the command to create the export file. Chris@41: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@41: eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" Chris@41: if test -n "$last_robj"; then Chris@41: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" Chris@41: fi Chris@41: } Chris@41: Chris@41: test -n "$save_libobjs" && Chris@41: func_verbose "creating a temporary reloadable object file: $output" Chris@41: Chris@41: # Loop through the commands generated above and execute them. Chris@41: save_ifs=$IFS; IFS='~' Chris@41: for cmd in $concat_cmds; do Chris@41: IFS=$save_ifs Chris@41: $opt_quiet || { Chris@41: func_quote_for_expand "$cmd" Chris@41: eval "func_echo $func_quote_for_expand_result" Chris@41: } Chris@41: $opt_dry_run || eval "$cmd" || { Chris@41: lt_exit=$? Chris@41: Chris@41: # Restore the uninstalled library and exit Chris@41: if test relink = "$opt_mode"; then Chris@41: ( cd "$output_objdir" && \ Chris@41: $RM "${realname}T" && \ Chris@41: $MV "${realname}U" "$realname" ) Chris@41: fi Chris@41: Chris@41: exit $lt_exit Chris@41: } Chris@41: done Chris@41: IFS=$save_ifs Chris@41: Chris@41: if test -n "$export_symbols_regex" && ${skipped_export-false}; then Chris@41: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' Chris@41: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' Chris@41: fi Chris@41: fi Chris@41: Chris@41: ${skipped_export-false} && { Chris@41: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@41: tmp_export_symbols=$export_symbols Chris@41: test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols Chris@41: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' Chris@41: fi Chris@41: Chris@41: if test -n "$orig_export_symbols"; then Chris@41: # The given exports_symbols file has to be filtered, so filter it. Chris@41: func_verbose "filter symbol list for '$libname.la' to tag DATA exports" Chris@41: # FIXME: $output_objdir/$libname.filter potentially contains lots of Chris@41: # 's' commands, which not all seds can handle. GNU sed should be fine Chris@41: # though. Also, the filter scales superlinearly with the number of Chris@41: # global variables. join(1) would be nice here, but unfortunately Chris@41: # isn't a blessed tool. Chris@41: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter Chris@41: func_append delfiles " $export_symbols $output_objdir/$libname.filter" Chris@41: export_symbols=$output_objdir/$libname.def Chris@41: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols Chris@41: fi Chris@41: } Chris@41: Chris@41: libobjs=$output Chris@41: # Restore the value of output. Chris@41: output=$save_output Chris@41: Chris@41: if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then Chris@41: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" Chris@41: test "X$libobjs" = "X " && libobjs= Chris@41: fi Chris@41: # Expand the library linking commands again to reset the Chris@41: # value of $libobjs for piecewise linking. Chris@41: Chris@41: # Do each of the archive commands. Chris@41: if test yes = "$module" && test -n "$module_cmds"; then Chris@41: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then Chris@41: cmds=$module_expsym_cmds Chris@41: else Chris@41: cmds=$module_cmds Chris@41: fi Chris@41: else Chris@41: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then Chris@41: cmds=$archive_expsym_cmds Chris@41: else Chris@41: cmds=$archive_cmds Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test -n "$delfiles"; then Chris@41: # Append the command to remove temporary files to $cmds. Chris@41: eval cmds=\"\$cmds~\$RM $delfiles\" Chris@41: fi Chris@41: Chris@41: # Add any objects from preloaded convenience libraries Chris@41: if test -n "$dlprefiles"; then Chris@41: gentop=$output_objdir/${outputname}x Chris@41: func_append generated " $gentop" Chris@41: Chris@41: func_extract_archives $gentop $dlprefiles Chris@41: func_append libobjs " $func_extract_archives_result" Chris@41: test "X$libobjs" = "X " && libobjs= Chris@41: fi Chris@41: Chris@41: save_ifs=$IFS; IFS='~' Chris@41: for cmd in $cmds; do Chris@41: IFS=$sp$nl Chris@41: eval cmd=\"$cmd\" Chris@41: IFS=$save_ifs Chris@41: $opt_quiet || { Chris@41: func_quote_for_expand "$cmd" Chris@41: eval "func_echo $func_quote_for_expand_result" Chris@41: } Chris@41: $opt_dry_run || eval "$cmd" || { Chris@41: lt_exit=$? Chris@41: Chris@41: # Restore the uninstalled library and exit Chris@41: if test relink = "$opt_mode"; then Chris@41: ( cd "$output_objdir" && \ Chris@41: $RM "${realname}T" && \ Chris@41: $MV "${realname}U" "$realname" ) Chris@41: fi Chris@41: Chris@41: exit $lt_exit Chris@41: } Chris@41: done Chris@41: IFS=$save_ifs Chris@41: Chris@41: # Restore the uninstalled library and exit Chris@41: if test relink = "$opt_mode"; then Chris@41: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? Chris@41: Chris@41: if test -n "$convenience"; then Chris@41: if test -z "$whole_archive_flag_spec"; then Chris@41: func_show_eval '${RM}r "$gentop"' Chris@41: fi Chris@41: fi Chris@41: Chris@41: exit $EXIT_SUCCESS Chris@41: fi Chris@41: Chris@41: # Create links to the real library. Chris@41: for linkname in $linknames; do Chris@41: if test "$realname" != "$linkname"; then Chris@41: func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' Chris@41: fi Chris@41: done Chris@41: Chris@41: # If -module or -export-dynamic was specified, set the dlname. Chris@41: if test yes = "$module" || test yes = "$export_dynamic"; then Chris@41: # On all known operating systems, these are identical. Chris@41: dlname=$soname Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: Chris@41: obj) Chris@41: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then Chris@41: func_warning "'-dlopen' is ignored for objects" Chris@41: fi Chris@41: Chris@41: case " $deplibs" in Chris@41: *\ -l* | *\ -L*) Chris@41: func_warning "'-l' and '-L' are ignored for objects" ;; Chris@41: esac Chris@41: Chris@41: test -n "$rpath" && \ Chris@41: func_warning "'-rpath' is ignored for objects" Chris@41: Chris@41: test -n "$xrpath" && \ Chris@41: func_warning "'-R' is ignored for objects" Chris@41: Chris@41: test -n "$vinfo" && \ Chris@41: func_warning "'-version-info' is ignored for objects" Chris@41: Chris@41: test -n "$release" && \ Chris@41: func_warning "'-release' is ignored for objects" Chris@41: Chris@41: case $output in Chris@41: *.lo) Chris@41: test -n "$objs$old_deplibs" && \ Chris@41: func_fatal_error "cannot build library object '$output' from non-libtool objects" Chris@41: Chris@41: libobj=$output Chris@41: func_lo2o "$libobj" Chris@41: obj=$func_lo2o_result Chris@41: ;; Chris@41: *) Chris@41: libobj= Chris@41: obj=$output Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Delete the old objects. Chris@41: $opt_dry_run || $RM $obj $libobj Chris@41: Chris@41: # Objects from convenience libraries. This assumes Chris@41: # single-version convenience libraries. Whenever we create Chris@41: # different ones for PIC/non-PIC, this we'll have to duplicate Chris@41: # the extraction. Chris@41: reload_conv_objs= Chris@41: gentop= Chris@41: # if reload_cmds runs $LD directly, get rid of -Wl from Chris@41: # whole_archive_flag_spec and hope we can get by with turning comma Chris@41: # into space. Chris@41: case $reload_cmds in Chris@41: *\$LD[\ \$]*) wl= ;; Chris@41: esac Chris@41: if test -n "$convenience"; then Chris@41: if test -n "$whole_archive_flag_spec"; then Chris@41: eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" Chris@41: test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` Chris@41: reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags Chris@41: else Chris@41: gentop=$output_objdir/${obj}x Chris@41: func_append generated " $gentop" Chris@41: Chris@41: func_extract_archives $gentop $convenience Chris@41: reload_conv_objs="$reload_objs $func_extract_archives_result" Chris@41: fi Chris@41: fi Chris@41: Chris@41: # If we're not building shared, we need to use non_pic_objs Chris@41: test yes = "$build_libtool_libs" || libobjs=$non_pic_objects Chris@41: Chris@41: # Create the old-style object. Chris@41: reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs Chris@41: Chris@41: output=$obj Chris@41: func_execute_cmds "$reload_cmds" 'exit $?' Chris@41: Chris@41: # Exit if we aren't doing a library object file. Chris@41: if test -z "$libobj"; then Chris@41: if test -n "$gentop"; then Chris@41: func_show_eval '${RM}r "$gentop"' Chris@41: fi Chris@41: Chris@41: exit $EXIT_SUCCESS Chris@41: fi Chris@41: Chris@41: test yes = "$build_libtool_libs" || { Chris@41: if test -n "$gentop"; then Chris@41: func_show_eval '${RM}r "$gentop"' Chris@41: fi Chris@41: Chris@41: # Create an invalid libtool object if no PIC, so that we don't Chris@41: # accidentally link it into a program. Chris@41: # $show "echo timestamp > $libobj" Chris@41: # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? Chris@41: exit $EXIT_SUCCESS Chris@41: } Chris@41: Chris@41: if test -n "$pic_flag" || test default != "$pic_mode"; then Chris@41: # Only do commands if we really have different PIC objects. Chris@41: reload_objs="$libobjs $reload_conv_objs" Chris@41: output=$libobj Chris@41: func_execute_cmds "$reload_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: if test -n "$gentop"; then Chris@41: func_show_eval '${RM}r "$gentop"' Chris@41: fi Chris@41: Chris@41: exit $EXIT_SUCCESS Chris@41: ;; Chris@41: Chris@41: prog) Chris@41: case $host in Chris@41: *cygwin*) func_stripname '' '.exe' "$output" Chris@41: output=$func_stripname_result.exe;; Chris@41: esac Chris@41: test -n "$vinfo" && \ Chris@41: func_warning "'-version-info' is ignored for programs" Chris@41: Chris@41: test -n "$release" && \ Chris@41: func_warning "'-release' is ignored for programs" Chris@41: Chris@41: $preload \ Chris@41: && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ Chris@41: && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." Chris@41: Chris@41: case $host in Chris@41: *-*-rhapsody* | *-*-darwin1.[012]) Chris@41: # On Rhapsody replace the C library is the System framework Chris@41: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` Chris@41: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` Chris@41: ;; Chris@41: esac Chris@41: Chris@41: case $host in Chris@41: *-*-darwin*) Chris@41: # Don't allow lazy linking, it breaks C++ global constructors Chris@41: # But is supposedly fixed on 10.4 or later (yay!). Chris@41: if test CXX = "$tagname"; then Chris@41: case ${MACOSX_DEPLOYMENT_TARGET-10.0} in Chris@41: 10.[0123]) Chris@41: func_append compile_command " $wl-bind_at_load" Chris@41: func_append finalize_command " $wl-bind_at_load" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: # Time to change all our "foo.ltframework" stuff back to "-framework foo" Chris@41: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@41: ;; Chris@41: esac Chris@41: Chris@41: Chris@41: # move library search paths that coincide with paths to not yet Chris@41: # installed libraries to the beginning of the library search list Chris@41: new_libs= Chris@41: for path in $notinst_path; do Chris@41: case " $new_libs " in Chris@41: *" -L$path/$objdir "*) ;; Chris@41: *) Chris@41: case " $compile_deplibs " in Chris@41: *" -L$path/$objdir "*) Chris@41: func_append new_libs " -L$path/$objdir" ;; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: for deplib in $compile_deplibs; do Chris@41: case $deplib in Chris@41: -L*) Chris@41: case " $new_libs " in Chris@41: *" $deplib "*) ;; Chris@41: *) func_append new_libs " $deplib" ;; Chris@41: esac Chris@41: ;; Chris@41: *) func_append new_libs " $deplib" ;; Chris@41: esac Chris@41: done Chris@41: compile_deplibs=$new_libs Chris@41: Chris@41: Chris@41: func_append compile_command " $compile_deplibs" Chris@41: func_append finalize_command " $finalize_deplibs" Chris@41: Chris@41: if test -n "$rpath$xrpath"; then Chris@41: # If the user specified any rpath flags, then add them. Chris@41: for libdir in $rpath $xrpath; do Chris@41: # This is the magic to use -rpath. Chris@41: case "$finalize_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append finalize_rpath " $libdir" ;; Chris@41: esac Chris@41: done Chris@41: fi Chris@41: Chris@41: # Now hardcode the library paths Chris@41: rpath= Chris@41: hardcode_libdirs= Chris@41: for libdir in $compile_rpath $finalize_rpath; do Chris@41: if test -n "$hardcode_libdir_flag_spec"; then Chris@41: if test -n "$hardcode_libdir_separator"; then Chris@41: if test -z "$hardcode_libdirs"; then Chris@41: hardcode_libdirs=$libdir Chris@41: else Chris@41: # Just accumulate the unique libdirs. Chris@41: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@41: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@41: ;; Chris@41: *) Chris@41: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: else Chris@41: eval flag=\"$hardcode_libdir_flag_spec\" Chris@41: func_append rpath " $flag" Chris@41: fi Chris@41: elif test -n "$runpath_var"; then Chris@41: case "$perm_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append perm_rpath " $libdir" ;; Chris@41: esac Chris@41: fi Chris@41: case $host in Chris@41: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@41: testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` Chris@41: case :$dllsearchpath: in Chris@41: *":$libdir:"*) ;; Chris@41: ::) dllsearchpath=$libdir;; Chris@41: *) func_append dllsearchpath ":$libdir";; Chris@41: esac Chris@41: case :$dllsearchpath: in Chris@41: *":$testbindir:"*) ;; Chris@41: ::) dllsearchpath=$testbindir;; Chris@41: *) func_append dllsearchpath ":$testbindir";; Chris@41: esac Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: # Substitute the hardcoded libdirs into the rpath. Chris@41: if test -n "$hardcode_libdir_separator" && Chris@41: test -n "$hardcode_libdirs"; then Chris@41: libdir=$hardcode_libdirs Chris@41: eval rpath=\" $hardcode_libdir_flag_spec\" Chris@41: fi Chris@41: compile_rpath=$rpath Chris@41: Chris@41: rpath= Chris@41: hardcode_libdirs= Chris@41: for libdir in $finalize_rpath; do Chris@41: if test -n "$hardcode_libdir_flag_spec"; then Chris@41: if test -n "$hardcode_libdir_separator"; then Chris@41: if test -z "$hardcode_libdirs"; then Chris@41: hardcode_libdirs=$libdir Chris@41: else Chris@41: # Just accumulate the unique libdirs. Chris@41: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@41: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@41: ;; Chris@41: *) Chris@41: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: else Chris@41: eval flag=\"$hardcode_libdir_flag_spec\" Chris@41: func_append rpath " $flag" Chris@41: fi Chris@41: elif test -n "$runpath_var"; then Chris@41: case "$finalize_perm_rpath " in Chris@41: *" $libdir "*) ;; Chris@41: *) func_append finalize_perm_rpath " $libdir" ;; Chris@41: esac Chris@41: fi Chris@41: done Chris@41: # Substitute the hardcoded libdirs into the rpath. Chris@41: if test -n "$hardcode_libdir_separator" && Chris@41: test -n "$hardcode_libdirs"; then Chris@41: libdir=$hardcode_libdirs Chris@41: eval rpath=\" $hardcode_libdir_flag_spec\" Chris@41: fi Chris@41: finalize_rpath=$rpath Chris@41: Chris@41: if test -n "$libobjs" && test yes = "$build_old_libs"; then Chris@41: # Transform all the library objects into standard objects. Chris@41: compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@41: finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@41: fi Chris@41: Chris@41: func_generate_dlsyms "$outputname" "@PROGRAM@" false Chris@41: Chris@41: # template prelinking step Chris@41: if test -n "$prelink_cmds"; then Chris@41: func_execute_cmds "$prelink_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: wrappers_required=: Chris@41: case $host in Chris@41: *cegcc* | *mingw32ce*) Chris@41: # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. Chris@41: wrappers_required=false Chris@41: ;; Chris@41: *cygwin* | *mingw* ) Chris@41: test yes = "$build_libtool_libs" || wrappers_required=false Chris@41: ;; Chris@41: *) Chris@41: if test no = "$need_relink" || test yes != "$build_libtool_libs"; then Chris@41: wrappers_required=false Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: $wrappers_required || { Chris@41: # Replace the output file specification. Chris@41: compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` Chris@41: link_command=$compile_command$compile_rpath Chris@41: Chris@41: # We have no uninstalled library dependencies, so finalize right now. Chris@41: exit_status=0 Chris@41: func_show_eval "$link_command" 'exit_status=$?' Chris@41: Chris@41: if test -n "$postlink_cmds"; then Chris@41: func_to_tool_file "$output" Chris@41: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` Chris@41: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: # Delete the generated files. Chris@41: if test -f "$output_objdir/${outputname}S.$objext"; then Chris@41: func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' Chris@41: fi Chris@41: Chris@41: exit $exit_status Chris@41: } Chris@41: Chris@41: if test -n "$compile_shlibpath$finalize_shlibpath"; then Chris@41: compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" Chris@41: fi Chris@41: if test -n "$finalize_shlibpath"; then Chris@41: finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" Chris@41: fi Chris@41: Chris@41: compile_var= Chris@41: finalize_var= Chris@41: if test -n "$runpath_var"; then Chris@41: if test -n "$perm_rpath"; then Chris@41: # We should set the runpath_var. Chris@41: rpath= Chris@41: for dir in $perm_rpath; do Chris@41: func_append rpath "$dir:" Chris@41: done Chris@41: compile_var="$runpath_var=\"$rpath\$$runpath_var\" " Chris@41: fi Chris@41: if test -n "$finalize_perm_rpath"; then Chris@41: # We should set the runpath_var. Chris@41: rpath= Chris@41: for dir in $finalize_perm_rpath; do Chris@41: func_append rpath "$dir:" Chris@41: done Chris@41: finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test yes = "$no_install"; then Chris@41: # We don't need to create a wrapper script. Chris@41: link_command=$compile_var$compile_command$compile_rpath Chris@41: # Replace the output file specification. Chris@41: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` Chris@41: # Delete the old output file. Chris@41: $opt_dry_run || $RM $output Chris@41: # Link the executable and exit Chris@41: func_show_eval "$link_command" 'exit $?' Chris@41: Chris@41: if test -n "$postlink_cmds"; then Chris@41: func_to_tool_file "$output" Chris@41: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` Chris@41: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: exit $EXIT_SUCCESS Chris@41: fi Chris@41: Chris@41: case $hardcode_action,$fast_install in Chris@41: relink,*) Chris@41: # Fast installation is not supported Chris@41: link_command=$compile_var$compile_command$compile_rpath Chris@41: relink_command=$finalize_var$finalize_command$finalize_rpath Chris@41: Chris@41: func_warning "this platform does not like uninstalled shared libraries" Chris@41: func_warning "'$output' will be relinked during installation" Chris@41: ;; Chris@41: *,yes) Chris@41: link_command=$finalize_var$compile_command$finalize_rpath Chris@41: relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` Chris@41: ;; Chris@41: *,no) Chris@41: link_command=$compile_var$compile_command$compile_rpath Chris@41: relink_command=$finalize_var$finalize_command$finalize_rpath Chris@41: ;; Chris@41: *,needless) Chris@41: link_command=$finalize_var$compile_command$finalize_rpath Chris@41: relink_command= Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # Replace the output file specification. Chris@41: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` Chris@41: Chris@41: # Delete the old output files. Chris@41: $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname Chris@41: Chris@41: func_show_eval "$link_command" 'exit $?' Chris@41: Chris@41: if test -n "$postlink_cmds"; then Chris@41: func_to_tool_file "$output_objdir/$outputname" Chris@41: 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'` Chris@41: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@41: fi Chris@41: Chris@41: # Now create the wrapper script. Chris@41: func_verbose "creating $output" Chris@41: Chris@41: # Quote the relink command for shipping. Chris@41: if test -n "$relink_command"; then Chris@41: # Preserve any variables that may affect compiler behavior Chris@41: for var in $variables_saved_for_relink; do Chris@41: if eval test -z \"\${$var+set}\"; then Chris@41: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" Chris@41: elif eval var_value=\$$var; test -z "$var_value"; then Chris@41: relink_command="$var=; export $var; $relink_command" Chris@41: else Chris@41: func_quote_for_eval "$var_value" Chris@41: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" Chris@41: fi Chris@41: done Chris@41: relink_command="(cd `pwd`; $relink_command)" Chris@41: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` Chris@41: fi Chris@41: Chris@41: # Only actually do things if not in dry run mode. Chris@41: $opt_dry_run || { Chris@41: # win32 will think the script is a binary if it has Chris@41: # a .exe suffix, so we strip it off here. Chris@41: case $output in Chris@41: *.exe) func_stripname '' '.exe' "$output" Chris@41: output=$func_stripname_result ;; Chris@41: esac Chris@41: # test for cygwin because mv fails w/o .exe extensions Chris@41: case $host in Chris@41: *cygwin*) Chris@41: exeext=.exe Chris@41: func_stripname '' '.exe' "$outputname" Chris@41: outputname=$func_stripname_result ;; Chris@41: *) exeext= ;; Chris@41: esac Chris@41: case $host in Chris@41: *cygwin* | *mingw* ) Chris@41: func_dirname_and_basename "$output" "" "." Chris@41: output_name=$func_basename_result Chris@41: output_path=$func_dirname_result Chris@41: cwrappersource=$output_path/$objdir/lt-$output_name.c Chris@41: cwrapper=$output_path/$output_name.exe Chris@41: $RM $cwrappersource $cwrapper Chris@41: trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 Chris@41: Chris@41: func_emit_cwrapperexe_src > $cwrappersource Chris@41: Chris@41: # The wrapper executable is built using the $host compiler, Chris@41: # because it contains $host paths and files. If cross- Chris@41: # compiling, it, like the target executable, must be Chris@41: # executed on the $host or under an emulation environment. Chris@41: $opt_dry_run || { Chris@41: $LTCC $LTCFLAGS -o $cwrapper $cwrappersource Chris@41: $STRIP $cwrapper Chris@41: } Chris@41: Chris@41: # Now, create the wrapper script for func_source use: Chris@41: func_ltwrapper_scriptname $cwrapper Chris@41: $RM $func_ltwrapper_scriptname_result Chris@41: trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 Chris@41: $opt_dry_run || { Chris@41: # note: this script will not be executed, so do not chmod. Chris@41: if test "x$build" = "x$host"; then Chris@41: $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result Chris@41: else Chris@41: func_emit_wrapper no > $func_ltwrapper_scriptname_result Chris@41: fi Chris@41: } Chris@41: ;; Chris@41: * ) Chris@41: $RM $output Chris@41: trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 Chris@41: Chris@41: func_emit_wrapper no > $output Chris@41: chmod +x $output Chris@41: ;; Chris@41: esac Chris@41: } Chris@41: exit $EXIT_SUCCESS Chris@41: ;; Chris@41: esac Chris@41: Chris@41: # See if we need to build an old-fashioned archive. Chris@41: for oldlib in $oldlibs; do Chris@41: Chris@41: case $build_libtool_libs in Chris@41: convenience) Chris@41: oldobjs="$libobjs_save $symfileobj" Chris@41: addlibs=$convenience Chris@41: build_libtool_libs=no Chris@41: ;; Chris@41: module) Chris@41: oldobjs=$libobjs_save Chris@41: addlibs=$old_convenience Chris@41: build_libtool_libs=no Chris@41: ;; Chris@41: *) Chris@41: oldobjs="$old_deplibs $non_pic_objects" Chris@41: $preload && test -f "$symfileobj" \ Chris@41: && func_append oldobjs " $symfileobj" Chris@41: addlibs=$old_convenience Chris@41: ;; Chris@41: esac Chris@41: Chris@41: if test -n "$addlibs"; then Chris@41: gentop=$output_objdir/${outputname}x Chris@41: func_append generated " $gentop" Chris@41: Chris@41: func_extract_archives $gentop $addlibs Chris@41: func_append oldobjs " $func_extract_archives_result" Chris@41: fi Chris@41: Chris@41: # Do each command in the archive commands. Chris@41: if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then Chris@41: cmds=$old_archive_from_new_cmds Chris@41: else Chris@41: Chris@41: # Add any objects from preloaded convenience libraries Chris@41: if test -n "$dlprefiles"; then Chris@41: gentop=$output_objdir/${outputname}x Chris@41: func_append generated " $gentop" Chris@41: Chris@41: func_extract_archives $gentop $dlprefiles Chris@41: func_append oldobjs " $func_extract_archives_result" Chris@41: fi Chris@41: Chris@41: # POSIX demands no paths to be encoded in archives. We have Chris@41: # to avoid creating archives with duplicate basenames if we Chris@41: # might have to extract them afterwards, e.g., when creating a Chris@41: # static archive out of a convenience library, or when linking Chris@41: # the entirety of a libtool archive into another (currently Chris@41: # not supported by libtool). Chris@41: if (for obj in $oldobjs Chris@41: do Chris@41: func_basename "$obj" Chris@41: $ECHO "$func_basename_result" Chris@41: done | sort | sort -uc >/dev/null 2>&1); then Chris@41: : Chris@41: else Chris@41: echo "copying selected object files to avoid basename conflicts..." Chris@41: gentop=$output_objdir/${outputname}x Chris@41: func_append generated " $gentop" Chris@41: func_mkdir_p "$gentop" Chris@41: save_oldobjs=$oldobjs Chris@41: oldobjs= Chris@41: counter=1 Chris@41: for obj in $save_oldobjs Chris@41: do Chris@41: func_basename "$obj" Chris@41: objbase=$func_basename_result Chris@41: case " $oldobjs " in Chris@41: " ") oldobjs=$obj ;; Chris@41: *[\ /]"$objbase "*) Chris@41: while :; do Chris@41: # Make sure we don't pick an alternate name that also Chris@41: # overlaps. Chris@41: newobj=lt$counter-$objbase Chris@41: func_arith $counter + 1 Chris@41: counter=$func_arith_result Chris@41: case " $oldobjs " in Chris@41: *[\ /]"$newobj "*) ;; Chris@41: *) if test ! -f "$gentop/$newobj"; then break; fi ;; Chris@41: esac Chris@41: done Chris@41: func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" Chris@41: func_append oldobjs " $gentop/$newobj" Chris@41: ;; Chris@41: *) func_append oldobjs " $obj" ;; Chris@41: esac Chris@41: done Chris@41: fi Chris@41: func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 Chris@41: tool_oldlib=$func_to_tool_file_result Chris@41: eval cmds=\"$old_archive_cmds\" Chris@41: Chris@41: func_len " $cmds" Chris@41: len=$func_len_result Chris@41: if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then Chris@41: cmds=$old_archive_cmds Chris@41: elif test -n "$archiver_list_spec"; then Chris@41: func_verbose "using command file archive linking..." Chris@41: for obj in $oldobjs Chris@41: do Chris@41: func_to_tool_file "$obj" Chris@41: $ECHO "$func_to_tool_file_result" Chris@41: done > $output_objdir/$libname.libcmd Chris@41: func_to_tool_file "$output_objdir/$libname.libcmd" Chris@41: oldobjs=" $archiver_list_spec$func_to_tool_file_result" Chris@41: cmds=$old_archive_cmds Chris@41: else Chris@41: # the command line is too long to link in one step, link in parts Chris@41: func_verbose "using piecewise archive linking..." Chris@41: save_RANLIB=$RANLIB Chris@41: RANLIB=: Chris@41: objlist= Chris@41: concat_cmds= Chris@41: save_oldobjs=$oldobjs Chris@41: oldobjs= Chris@41: # Is there a better way of finding the last object in the list? Chris@41: for obj in $save_oldobjs Chris@41: do Chris@41: last_oldobj=$obj Chris@41: done Chris@41: eval test_cmds=\"$old_archive_cmds\" Chris@41: func_len " $test_cmds" Chris@41: len0=$func_len_result Chris@41: len=$len0 Chris@41: for obj in $save_oldobjs Chris@41: do Chris@41: func_len " $obj" Chris@41: func_arith $len + $func_len_result Chris@41: len=$func_arith_result Chris@41: func_append objlist " $obj" Chris@41: if test "$len" -lt "$max_cmd_len"; then Chris@41: : Chris@41: else Chris@41: # the above command should be used before it gets too long Chris@41: oldobjs=$objlist Chris@41: if test "$obj" = "$last_oldobj"; then Chris@41: RANLIB=$save_RANLIB Chris@41: fi Chris@41: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@41: eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" Chris@41: objlist= Chris@41: len=$len0 Chris@41: fi Chris@41: done Chris@41: RANLIB=$save_RANLIB Chris@41: oldobjs=$objlist Chris@41: if test -z "$oldobjs"; then Chris@41: eval cmds=\"\$concat_cmds\" Chris@41: else Chris@41: eval cmds=\"\$concat_cmds~\$old_archive_cmds\" Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: func_execute_cmds "$cmds" 'exit $?' Chris@41: done Chris@41: Chris@41: test -n "$generated" && \ Chris@41: func_show_eval "${RM}r$generated" Chris@41: Chris@41: # Now create the libtool archive. Chris@41: case $output in Chris@41: *.la) Chris@41: old_library= Chris@41: test yes = "$build_old_libs" && old_library=$libname.$libext Chris@41: func_verbose "creating $output" Chris@41: Chris@41: # Preserve any variables that may affect compiler behavior Chris@41: for var in $variables_saved_for_relink; do Chris@41: if eval test -z \"\${$var+set}\"; then Chris@41: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" Chris@41: elif eval var_value=\$$var; test -z "$var_value"; then Chris@41: relink_command="$var=; export $var; $relink_command" Chris@41: else Chris@41: func_quote_for_eval "$var_value" Chris@41: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" Chris@41: fi Chris@41: done Chris@41: # Quote the link command for shipping. Chris@41: relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" Chris@41: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` Chris@41: if test yes = "$hardcode_automatic"; then Chris@41: relink_command= Chris@41: fi Chris@41: Chris@41: # Only create the output if not a dry run. Chris@41: $opt_dry_run || { Chris@41: for installed in no yes; do Chris@41: if test yes = "$installed"; then Chris@41: if test -z "$install_libdir"; then Chris@41: break Chris@41: fi Chris@41: output=$output_objdir/${outputname}i Chris@41: # Replace all uninstalled libtool libraries with the installed ones Chris@41: newdependency_libs= Chris@41: for deplib in $dependency_libs; do Chris@41: case $deplib in Chris@41: *.la) Chris@41: func_basename "$deplib" Chris@41: name=$func_basename_result Chris@41: func_resolve_sysroot "$deplib" Chris@41: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` Chris@41: test -z "$libdir" && \ Chris@41: func_fatal_error "'$deplib' is not a valid libtool archive" Chris@41: func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" Chris@41: ;; Chris@41: -L*) Chris@41: func_stripname -L '' "$deplib" Chris@41: func_replace_sysroot "$func_stripname_result" Chris@41: func_append newdependency_libs " -L$func_replace_sysroot_result" Chris@41: ;; Chris@41: -R*) Chris@41: func_stripname -R '' "$deplib" Chris@41: func_replace_sysroot "$func_stripname_result" Chris@41: func_append newdependency_libs " -R$func_replace_sysroot_result" Chris@41: ;; Chris@41: *) func_append newdependency_libs " $deplib" ;; Chris@41: esac Chris@41: done Chris@41: dependency_libs=$newdependency_libs Chris@41: newdlfiles= Chris@41: Chris@41: for lib in $dlfiles; do Chris@41: case $lib in Chris@41: *.la) Chris@41: func_basename "$lib" Chris@41: name=$func_basename_result Chris@41: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` Chris@41: test -z "$libdir" && \ Chris@41: func_fatal_error "'$lib' is not a valid libtool archive" Chris@41: func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" Chris@41: ;; Chris@41: *) func_append newdlfiles " $lib" ;; Chris@41: esac Chris@41: done Chris@41: dlfiles=$newdlfiles Chris@41: newdlprefiles= Chris@41: for lib in $dlprefiles; do Chris@41: case $lib in Chris@41: *.la) Chris@41: # Only pass preopened files to the pseudo-archive (for Chris@41: # eventual linking with the app. that links it) if we Chris@41: # didn't already link the preopened objects directly into Chris@41: # the library: Chris@41: func_basename "$lib" Chris@41: name=$func_basename_result Chris@41: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` Chris@41: test -z "$libdir" && \ Chris@41: func_fatal_error "'$lib' is not a valid libtool archive" Chris@41: func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" Chris@41: ;; Chris@41: esac Chris@41: done Chris@41: dlprefiles=$newdlprefiles Chris@41: else Chris@41: newdlfiles= Chris@41: for lib in $dlfiles; do Chris@41: case $lib in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; Chris@41: *) abs=`pwd`"/$lib" ;; Chris@41: esac Chris@41: func_append newdlfiles " $abs" Chris@41: done Chris@41: dlfiles=$newdlfiles Chris@41: newdlprefiles= Chris@41: for lib in $dlprefiles; do Chris@41: case $lib in Chris@41: [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; Chris@41: *) abs=`pwd`"/$lib" ;; Chris@41: esac Chris@41: func_append newdlprefiles " $abs" Chris@41: done Chris@41: dlprefiles=$newdlprefiles Chris@41: fi Chris@41: $RM $output Chris@41: # place dlname in correct position for cygwin Chris@41: # In fact, it would be nice if we could use this code for all target Chris@41: # systems that can't hard-code library paths into their executables Chris@41: # and that have no shared library path variable independent of PATH, Chris@41: # but it turns out we can't easily determine that from inspecting Chris@41: # libtool variables, so we have to hard-code the OSs to which it Chris@41: # applies here; at the moment, that means platforms that use the PE Chris@41: # object format with DLL files. See the long comment at the top of Chris@41: # tests/bindir.at for full details. Chris@41: tdlname=$dlname Chris@41: case $host,$output,$installed,$module,$dlname in Chris@41: *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) Chris@41: # If a -bindir argument was supplied, place the dll there. Chris@41: if test -n "$bindir"; then Chris@41: func_relative_path "$install_libdir" "$bindir" Chris@41: tdlname=$func_relative_path_result/$dlname Chris@41: else Chris@41: # Otherwise fall back on heuristic. Chris@41: tdlname=../bin/$dlname Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: $ECHO > $output "\ Chris@41: # $outputname - a libtool library file Chris@41: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION Chris@41: # Chris@41: # Please DO NOT delete this file! Chris@41: # It is necessary for linking the library. Chris@41: Chris@41: # The name that we can dlopen(3). Chris@41: dlname='$tdlname' Chris@41: Chris@41: # Names of this library. Chris@41: library_names='$library_names' Chris@41: Chris@41: # The name of the static archive. Chris@41: old_library='$old_library' Chris@41: Chris@41: # Linker flags that cannot go in dependency_libs. Chris@41: inherited_linker_flags='$new_inherited_linker_flags' Chris@41: Chris@41: # Libraries that this one depends upon. Chris@41: dependency_libs='$dependency_libs' Chris@41: Chris@41: # Names of additional weak libraries provided by this library Chris@41: weak_library_names='$weak_libs' Chris@41: Chris@41: # Version information for $libname. Chris@41: current=$current Chris@41: age=$age Chris@41: revision=$revision Chris@41: Chris@41: # Is this an already installed library? Chris@41: installed=$installed Chris@41: Chris@41: # Should we warn about portability when linking against -modules? Chris@41: shouldnotlink=$module Chris@41: Chris@41: # Files to dlopen/dlpreopen Chris@41: dlopen='$dlfiles' Chris@41: dlpreopen='$dlprefiles' Chris@41: Chris@41: # Directory that this library needs to be installed in: Chris@41: libdir='$install_libdir'" Chris@41: if test no,yes = "$installed,$need_relink"; then Chris@41: $ECHO >> $output "\ Chris@41: relink_command=\"$relink_command\"" Chris@41: fi Chris@41: done Chris@41: } Chris@41: Chris@41: # Do a symbolic link so that the libtool archive can be found in Chris@41: # LD_LIBRARY_PATH before the program is installed. Chris@41: func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' Chris@41: ;; Chris@41: esac Chris@41: exit $EXIT_SUCCESS Chris@41: } Chris@41: Chris@41: if test link = "$opt_mode" || test relink = "$opt_mode"; then Chris@41: func_mode_link ${1+"$@"} Chris@41: fi Chris@41: Chris@41: Chris@41: # func_mode_uninstall arg... Chris@41: func_mode_uninstall () Chris@41: { Chris@41: $debug_cmd Chris@41: Chris@41: RM=$nonopt Chris@41: files= Chris@41: rmforce=false Chris@41: exit_status=0 Chris@41: Chris@41: # This variable tells wrapper scripts just to set variables rather Chris@41: # than running their programs. Chris@41: libtool_install_magic=$magic Chris@41: Chris@41: for arg Chris@41: do Chris@41: case $arg in Chris@41: -f) func_append RM " $arg"; rmforce=: ;; Chris@41: -*) func_append RM " $arg" ;; Chris@41: *) func_append files " $arg" ;; Chris@41: esac Chris@41: done Chris@41: Chris@41: test -z "$RM" && \ Chris@41: func_fatal_help "you must specify an RM program" Chris@41: Chris@41: rmdirs= Chris@41: Chris@41: for file in $files; do Chris@41: func_dirname "$file" "" "." Chris@41: dir=$func_dirname_result Chris@41: if test . = "$dir"; then Chris@41: odir=$objdir Chris@41: else Chris@41: odir=$dir/$objdir Chris@41: fi Chris@41: func_basename "$file" Chris@41: name=$func_basename_result Chris@41: test uninstall = "$opt_mode" && odir=$dir Chris@41: Chris@41: # Remember odir for removal later, being careful to avoid duplicates Chris@41: if test clean = "$opt_mode"; then Chris@41: case " $rmdirs " in Chris@41: *" $odir "*) ;; Chris@41: *) func_append rmdirs " $odir" ;; Chris@41: esac Chris@41: fi Chris@41: Chris@41: # Don't error if the file doesn't exist and rm -f was used. Chris@41: if { test -L "$file"; } >/dev/null 2>&1 || Chris@41: { test -h "$file"; } >/dev/null 2>&1 || Chris@41: test -f "$file"; then Chris@41: : Chris@41: elif test -d "$file"; then Chris@41: exit_status=1 Chris@41: continue Chris@41: elif $rmforce; then Chris@41: continue Chris@41: fi Chris@41: Chris@41: rmfiles=$file Chris@41: Chris@41: case $name in Chris@41: *.la) Chris@41: # Possibly a libtool archive, so verify it. Chris@41: if func_lalib_p "$file"; then Chris@41: func_source $dir/$name Chris@41: Chris@41: # Delete the libtool libraries and symlinks. Chris@41: for n in $library_names; do Chris@41: func_append rmfiles " $odir/$n" Chris@41: done Chris@41: test -n "$old_library" && func_append rmfiles " $odir/$old_library" Chris@41: Chris@41: case $opt_mode in Chris@41: clean) Chris@41: case " $library_names " in Chris@41: *" $dlname "*) ;; Chris@41: *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; Chris@41: esac Chris@41: test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" Chris@41: ;; Chris@41: uninstall) Chris@41: if test -n "$library_names"; then Chris@41: # Do each command in the postuninstall commands. Chris@41: func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' Chris@41: fi Chris@41: Chris@41: if test -n "$old_library"; then Chris@41: # Do each command in the old_postuninstall commands. Chris@41: func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' Chris@41: fi Chris@41: # FIXME: should reinstall the best remaining shared library. Chris@41: ;; Chris@41: esac Chris@41: fi Chris@41: ;; Chris@41: Chris@41: *.lo) Chris@41: # Possibly a libtool object, so verify it. Chris@41: if func_lalib_p "$file"; then Chris@41: Chris@41: # Read the .lo file Chris@41: func_source $dir/$name Chris@41: Chris@41: # Add PIC object to the list of files to remove. Chris@41: if test -n "$pic_object" && test none != "$pic_object"; then Chris@41: func_append rmfiles " $dir/$pic_object" Chris@41: fi Chris@41: Chris@41: # Add non-PIC object to the list of files to remove. Chris@41: if test -n "$non_pic_object" && test none != "$non_pic_object"; then Chris@41: func_append rmfiles " $dir/$non_pic_object" Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: Chris@41: *) Chris@41: if test clean = "$opt_mode"; then Chris@41: noexename=$name Chris@41: case $file in Chris@41: *.exe) Chris@41: func_stripname '' '.exe' "$file" Chris@41: file=$func_stripname_result Chris@41: func_stripname '' '.exe' "$name" Chris@41: noexename=$func_stripname_result Chris@41: # $file with .exe has already been added to rmfiles, Chris@41: # add $file without .exe Chris@41: func_append rmfiles " $file" Chris@41: ;; Chris@41: esac Chris@41: # Do a test to see if this is a libtool program. Chris@41: if func_ltwrapper_p "$file"; then Chris@41: if func_ltwrapper_executable_p "$file"; then Chris@41: func_ltwrapper_scriptname "$file" Chris@41: relink_command= Chris@41: func_source $func_ltwrapper_scriptname_result Chris@41: func_append rmfiles " $func_ltwrapper_scriptname_result" Chris@41: else Chris@41: relink_command= Chris@41: func_source $dir/$noexename Chris@41: fi Chris@41: Chris@41: # note $name still contains .exe if it was in $file originally Chris@41: # as does the version of $file that was added into $rmfiles Chris@41: func_append rmfiles " $odir/$name $odir/${name}S.$objext" Chris@41: if test yes = "$fast_install" && test -n "$relink_command"; then Chris@41: func_append rmfiles " $odir/lt-$name" Chris@41: fi Chris@41: if test "X$noexename" != "X$name"; then Chris@41: func_append rmfiles " $odir/lt-$noexename.c" Chris@41: fi Chris@41: fi Chris@41: fi Chris@41: ;; Chris@41: esac Chris@41: func_show_eval "$RM $rmfiles" 'exit_status=1' Chris@41: done Chris@41: Chris@41: # Try to remove the $objdir's in the directories where we deleted files Chris@41: for dir in $rmdirs; do Chris@41: if test -d "$dir"; then Chris@41: func_show_eval "rmdir $dir >/dev/null 2>&1" Chris@41: fi Chris@41: done Chris@41: Chris@41: exit $exit_status Chris@41: } Chris@41: Chris@41: if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then Chris@41: func_mode_uninstall ${1+"$@"} Chris@41: fi Chris@41: Chris@41: test -z "$opt_mode" && { Chris@41: help=$generic_help Chris@41: func_fatal_help "you must specify a MODE" Chris@41: } Chris@41: Chris@41: test -z "$exec_cmd" && \ Chris@41: func_fatal_help "invalid operation mode '$opt_mode'" Chris@41: Chris@41: if test -n "$exec_cmd"; then Chris@41: eval exec "$exec_cmd" Chris@41: exit $EXIT_FAILURE Chris@41: fi Chris@41: Chris@41: exit $exit_status Chris@41: Chris@41: Chris@41: # The TAGs below are defined such that we never get into a situation Chris@41: # where we disable both kinds of libraries. Given conflicting Chris@41: # choices, we go for a static library, that is the most portable, Chris@41: # since we can't tell whether shared libraries were disabled because Chris@41: # the user asked for that or because the platform doesn't support Chris@41: # them. This is particularly important on AIX, because we don't Chris@41: # support having both static and shared libraries enabled at the same Chris@41: # time on that platform, so we default to a shared-only configuration. Chris@41: # If a disable-shared tag is given, we'll fallback to a static-only Chris@41: # configuration. But we'll never go from static-only to shared-only. Chris@41: Chris@41: # ### BEGIN LIBTOOL TAG CONFIG: disable-shared Chris@41: build_libtool_libs=no Chris@41: build_old_libs=yes Chris@41: # ### END LIBTOOL TAG CONFIG: disable-shared Chris@41: Chris@41: # ### BEGIN LIBTOOL TAG CONFIG: disable-static Chris@41: build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` Chris@41: # ### END LIBTOOL TAG CONFIG: disable-static Chris@41: Chris@41: # Local Variables: Chris@41: # mode:shell-script Chris@41: # sh-indentation:2 Chris@41: # End: