cannam@125: #! /bin/sh cannam@125: ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in cannam@125: ## by inline-source v2014-01-03.01 cannam@125: cannam@125: # libtool (GNU libtool) 2.4.6 cannam@125: # Provide generalized library-building support services. cannam@125: # Written by Gordon Matzigkeit , 1996 cannam@125: cannam@125: # Copyright (C) 1996-2015 Free Software Foundation, Inc. cannam@125: # This is free software; see the source for copying conditions. There is NO cannam@125: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cannam@125: cannam@125: # GNU Libtool is free software; you can redistribute it and/or modify cannam@125: # it under the terms of the GNU General Public License as published by cannam@125: # the Free Software Foundation; either version 2 of the License, or cannam@125: # (at your option) any later version. cannam@125: # cannam@125: # As a special exception to the GNU General Public License, cannam@125: # if you distribute this file as part of a program or library that cannam@125: # is built using GNU Libtool, you may include this file under the cannam@125: # same distribution terms that you use for the rest of that program. cannam@125: # cannam@125: # GNU Libtool is distributed in the hope that it will be useful, but cannam@125: # WITHOUT ANY WARRANTY; without even the implied warranty of cannam@125: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU cannam@125: # General Public License for more details. cannam@125: # cannam@125: # You should have received a copy of the GNU General Public License cannam@125: # along with this program. If not, see . cannam@125: cannam@125: cannam@125: PROGRAM=libtool cannam@125: PACKAGE=libtool cannam@125: VERSION="2.4.6 Debian-2.4.6-0.1" cannam@125: package_revision=2.4.6 cannam@125: cannam@125: cannam@125: ## ------ ## cannam@125: ## Usage. ## cannam@125: ## ------ ## cannam@125: cannam@125: # Run './libtool --help' for help with using this script from the cannam@125: # command line. cannam@125: cannam@125: cannam@125: ## ------------------------------- ## cannam@125: ## User overridable command paths. ## cannam@125: ## ------------------------------- ## cannam@125: cannam@125: # After configure completes, it has a better idea of some of the cannam@125: # shell tools we need than the defaults used by the functions shared cannam@125: # with bootstrap, so set those here where they can still be over- cannam@125: # ridden by the user, but otherwise take precedence. cannam@125: cannam@125: : ${AUTOCONF="autoconf"} cannam@125: : ${AUTOMAKE="automake"} cannam@125: cannam@125: cannam@125: ## -------------------------- ## cannam@125: ## Source external libraries. ## cannam@125: ## -------------------------- ## cannam@125: cannam@125: # Much of our low-level functionality needs to be sourced from external cannam@125: # libraries, which are installed to $pkgauxdir. cannam@125: cannam@125: # Set a version string for this script. cannam@125: scriptversion=2015-01-20.17; # UTC cannam@125: cannam@125: # General shell script boiler plate, and helper functions. cannam@125: # Written by Gary V. Vaughan, 2004 cannam@125: cannam@125: # Copyright (C) 2004-2015 Free Software Foundation, Inc. cannam@125: # This is free software; see the source for copying conditions. There is NO cannam@125: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cannam@125: cannam@125: # This program is free software; you can redistribute it and/or modify cannam@125: # it under the terms of the GNU General Public License as published by cannam@125: # the Free Software Foundation; either version 3 of the License, or cannam@125: # (at your option) any later version. cannam@125: cannam@125: # As a special exception to the GNU General Public License, if you distribute cannam@125: # this file as part of a program or library that is built using GNU Libtool, cannam@125: # you may include this file under the same distribution terms that you use cannam@125: # for the rest of that program. cannam@125: cannam@125: # This program is distributed in the hope that it will be useful, cannam@125: # but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@125: # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU cannam@125: # General Public License for more details. cannam@125: cannam@125: # You should have received a copy of the GNU General Public License cannam@125: # along with this program. If not, see . cannam@125: cannam@125: # Please report bugs or propose patches to gary@gnu.org. cannam@125: cannam@125: cannam@125: ## ------ ## cannam@125: ## Usage. ## cannam@125: ## ------ ## cannam@125: cannam@125: # Evaluate this file near the top of your script to gain access to cannam@125: # the functions and variables defined here: cannam@125: # cannam@125: # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh cannam@125: # cannam@125: # If you need to override any of the default environment variable cannam@125: # settings, do that before evaluating this file. cannam@125: cannam@125: cannam@125: ## -------------------- ## cannam@125: ## Shell normalisation. ## cannam@125: ## -------------------- ## cannam@125: cannam@125: # Some shells need a little help to be as Bourne compatible as possible. cannam@125: # Before doing anything else, make sure all that help has been provided! cannam@125: cannam@125: DUALCASE=1; export DUALCASE # for MKS sh cannam@125: if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : cannam@125: emulate sh cannam@125: NULLCMD=: cannam@125: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which cannam@125: # is contrary to our usage. Disable this feature. cannam@125: alias -g '${1+"$@"}'='"$@"' cannam@125: setopt NO_GLOB_SUBST cannam@125: else cannam@125: case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac cannam@125: fi cannam@125: cannam@125: # NLS nuisances: We save the old values in case they are required later. cannam@125: _G_user_locale= cannam@125: _G_safe_locale= cannam@125: for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES cannam@125: do cannam@125: eval "if test set = \"\${$_G_var+set}\"; then cannam@125: save_$_G_var=\$$_G_var cannam@125: $_G_var=C cannam@125: export $_G_var cannam@125: _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" cannam@125: _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" cannam@125: fi" cannam@125: done cannam@125: cannam@125: # CDPATH. cannam@125: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH cannam@125: cannam@125: # Make sure IFS has a sensible default cannam@125: sp=' ' cannam@125: nl=' cannam@125: ' cannam@125: IFS="$sp $nl" cannam@125: cannam@125: # There are apparently some retarded systems that use ';' as a PATH separator! cannam@125: if test "${PATH_SEPARATOR+set}" != set; then cannam@125: PATH_SEPARATOR=: cannam@125: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { cannam@125: (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || cannam@125: PATH_SEPARATOR=';' cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: cannam@125: ## ------------------------- ## cannam@125: ## Locate command utilities. ## cannam@125: ## ------------------------- ## cannam@125: cannam@125: cannam@125: # func_executable_p FILE cannam@125: # ---------------------- cannam@125: # Check that FILE is an executable regular file. cannam@125: func_executable_p () cannam@125: { cannam@125: test -f "$1" && test -x "$1" cannam@125: } cannam@125: cannam@125: cannam@125: # func_path_progs PROGS_LIST CHECK_FUNC [PATH] cannam@125: # -------------------------------------------- cannam@125: # Search for either a program that responds to --version with output cannam@125: # containing "GNU", or else returned by CHECK_FUNC otherwise, by cannam@125: # trying all the directories in PATH with each of the elements of cannam@125: # PROGS_LIST. cannam@125: # cannam@125: # CHECK_FUNC should accept the path to a candidate program, and cannam@125: # set $func_check_prog_result if it truncates its output less than cannam@125: # $_G_path_prog_max characters. cannam@125: func_path_progs () cannam@125: { cannam@125: _G_progs_list=$1 cannam@125: _G_check_func=$2 cannam@125: _G_PATH=${3-"$PATH"} cannam@125: cannam@125: _G_path_prog_max=0 cannam@125: _G_path_prog_found=false cannam@125: _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} cannam@125: for _G_dir in $_G_PATH; do cannam@125: IFS=$_G_save_IFS cannam@125: test -z "$_G_dir" && _G_dir=. cannam@125: for _G_prog_name in $_G_progs_list; do cannam@125: for _exeext in '' .EXE; do cannam@125: _G_path_prog=$_G_dir/$_G_prog_name$_exeext cannam@125: func_executable_p "$_G_path_prog" || continue cannam@125: case `"$_G_path_prog" --version 2>&1` in cannam@125: *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; cannam@125: *) $_G_check_func $_G_path_prog cannam@125: func_path_progs_result=$func_check_prog_result cannam@125: ;; cannam@125: esac cannam@125: $_G_path_prog_found && break 3 cannam@125: done cannam@125: done cannam@125: done cannam@125: IFS=$_G_save_IFS cannam@125: test -z "$func_path_progs_result" && { cannam@125: echo "no acceptable sed could be found in \$PATH" >&2 cannam@125: exit 1 cannam@125: } cannam@125: } cannam@125: cannam@125: cannam@125: # We want to be able to use the functions in this file before configure cannam@125: # has figured out where the best binaries are kept, which means we have cannam@125: # to search for them ourselves - except when the results are already set cannam@125: # where we skip the searches. cannam@125: cannam@125: # Unless the user overrides by setting SED, search the path for either GNU cannam@125: # sed, or the sed that truncates its output the least. cannam@125: test -z "$SED" && { cannam@125: _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ cannam@125: for _G_i in 1 2 3 4 5 6 7; do cannam@125: _G_sed_script=$_G_sed_script$nl$_G_sed_script cannam@125: done cannam@125: echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed cannam@125: _G_sed_script= cannam@125: cannam@125: func_check_prog_sed () cannam@125: { cannam@125: _G_path_prog=$1 cannam@125: cannam@125: _G_count=0 cannam@125: printf 0123456789 >conftest.in cannam@125: while : cannam@125: do cannam@125: cat conftest.in conftest.in >conftest.tmp cannam@125: mv conftest.tmp conftest.in cannam@125: cp conftest.in conftest.nl cannam@125: echo '' >> conftest.nl cannam@125: "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break cannam@125: diff conftest.out conftest.nl >/dev/null 2>&1 || break cannam@125: _G_count=`expr $_G_count + 1` cannam@125: if test "$_G_count" -gt "$_G_path_prog_max"; then cannam@125: # Best one so far, save it but keep looking for a better one cannam@125: func_check_prog_result=$_G_path_prog cannam@125: _G_path_prog_max=$_G_count cannam@125: fi cannam@125: # 10*(2^10) chars as input seems more than enough cannam@125: test 10 -lt "$_G_count" && break cannam@125: done cannam@125: rm -f conftest.in conftest.tmp conftest.nl conftest.out cannam@125: } cannam@125: cannam@125: func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin cannam@125: rm -f conftest.sed cannam@125: SED=$func_path_progs_result cannam@125: } cannam@125: cannam@125: cannam@125: # Unless the user overrides by setting GREP, search the path for either GNU cannam@125: # grep, or the grep that truncates its output the least. cannam@125: test -z "$GREP" && { cannam@125: func_check_prog_grep () cannam@125: { cannam@125: _G_path_prog=$1 cannam@125: cannam@125: _G_count=0 cannam@125: _G_path_prog_max=0 cannam@125: printf 0123456789 >conftest.in cannam@125: while : cannam@125: do cannam@125: cat conftest.in conftest.in >conftest.tmp cannam@125: mv conftest.tmp conftest.in cannam@125: cp conftest.in conftest.nl cannam@125: echo 'GREP' >> conftest.nl cannam@125: "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break cannam@125: diff conftest.out conftest.nl >/dev/null 2>&1 || break cannam@125: _G_count=`expr $_G_count + 1` cannam@125: if test "$_G_count" -gt "$_G_path_prog_max"; then cannam@125: # Best one so far, save it but keep looking for a better one cannam@125: func_check_prog_result=$_G_path_prog cannam@125: _G_path_prog_max=$_G_count cannam@125: fi cannam@125: # 10*(2^10) chars as input seems more than enough cannam@125: test 10 -lt "$_G_count" && break cannam@125: done cannam@125: rm -f conftest.in conftest.tmp conftest.nl conftest.out cannam@125: } cannam@125: cannam@125: func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin cannam@125: GREP=$func_path_progs_result cannam@125: } cannam@125: cannam@125: cannam@125: ## ------------------------------- ## cannam@125: ## User overridable command paths. ## cannam@125: ## ------------------------------- ## cannam@125: cannam@125: # All uppercase variable names are used for environment variables. These cannam@125: # variables can be overridden by the user before calling a script that cannam@125: # uses them if a suitable command of that name is not already available cannam@125: # in the command search PATH. cannam@125: cannam@125: : ${CP="cp -f"} cannam@125: : ${ECHO="printf %s\n"} cannam@125: : ${EGREP="$GREP -E"} cannam@125: : ${FGREP="$GREP -F"} cannam@125: : ${LN_S="ln -s"} cannam@125: : ${MAKE="make"} cannam@125: : ${MKDIR="mkdir"} cannam@125: : ${MV="mv -f"} cannam@125: : ${RM="rm -f"} cannam@125: : ${SHELL="${CONFIG_SHELL-/bin/sh}"} cannam@125: cannam@125: cannam@125: ## -------------------- ## cannam@125: ## Useful sed snippets. ## cannam@125: ## -------------------- ## cannam@125: cannam@125: sed_dirname='s|/[^/]*$||' cannam@125: sed_basename='s|^.*/||' cannam@125: cannam@125: # Sed substitution that helps us do robust quoting. It backslashifies cannam@125: # metacharacters that are still active within double-quoted strings. cannam@125: sed_quote_subst='s|\([`"$\\]\)|\\\1|g' cannam@125: cannam@125: # Same as above, but do not quote variable references. cannam@125: sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' cannam@125: cannam@125: # Sed substitution that turns a string into a regex matching for the cannam@125: # string literally. cannam@125: sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' cannam@125: cannam@125: # Sed substitution that converts a w32 file name or path cannam@125: # that contains forward slashes, into one that contains cannam@125: # (escaped) backslashes. A very naive implementation. cannam@125: sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' cannam@125: cannam@125: # Re-'\' parameter expansions in output of sed_double_quote_subst that cannam@125: # were '\'-ed in input to the same. If an odd number of '\' preceded a cannam@125: # '$' in input to sed_double_quote_subst, that '$' was protected from cannam@125: # expansion. Since each input '\' is now two '\'s, look for any number cannam@125: # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. cannam@125: _G_bs='\\' cannam@125: _G_bs2='\\\\' cannam@125: _G_bs4='\\\\\\\\' cannam@125: _G_dollar='\$' cannam@125: sed_double_backslash="\ cannam@125: s/$_G_bs4/&\\ cannam@125: /g cannam@125: s/^$_G_bs2$_G_dollar/$_G_bs&/ cannam@125: s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g cannam@125: s/\n//g" cannam@125: cannam@125: cannam@125: ## ----------------- ## cannam@125: ## Global variables. ## cannam@125: ## ----------------- ## cannam@125: cannam@125: # Except for the global variables explicitly listed below, the following cannam@125: # functions in the '^func_' namespace, and the '^require_' namespace cannam@125: # variables initialised in the 'Resource management' section, sourcing cannam@125: # this file will not pollute your global namespace with anything cannam@125: # else. There's no portable way to scope variables in Bourne shell cannam@125: # though, so actually running these functions will sometimes place cannam@125: # results into a variable named after the function, and often use cannam@125: # temporary variables in the '^_G_' namespace. If you are careful to cannam@125: # avoid using those namespaces casually in your sourcing script, things cannam@125: # should continue to work as you expect. And, of course, you can freely cannam@125: # overwrite any of the functions or variables defined here before cannam@125: # calling anything to customize them. cannam@125: cannam@125: EXIT_SUCCESS=0 cannam@125: EXIT_FAILURE=1 cannam@125: EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. cannam@125: EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. cannam@125: cannam@125: # Allow overriding, eg assuming that you follow the convention of cannam@125: # putting '$debug_cmd' at the start of all your functions, you can get cannam@125: # bash to show function call trace with: cannam@125: # cannam@125: # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name cannam@125: debug_cmd=${debug_cmd-":"} cannam@125: exit_cmd=: cannam@125: cannam@125: # By convention, finish your script with: cannam@125: # cannam@125: # exit $exit_status cannam@125: # cannam@125: # so that you can set exit_status to non-zero if you want to indicate cannam@125: # something went wrong during execution without actually bailing out at cannam@125: # the point of failure. cannam@125: exit_status=$EXIT_SUCCESS cannam@125: cannam@125: # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh cannam@125: # is ksh but when the shell is invoked as "sh" and the current value of cannam@125: # the _XPG environment variable is not equal to 1 (one), the special cannam@125: # positional parameter $0, within a function call, is the name of the cannam@125: # function. cannam@125: progpath=$0 cannam@125: cannam@125: # The name of this program. cannam@125: progname=`$ECHO "$progpath" |$SED "$sed_basename"` cannam@125: cannam@125: # Make sure we have an absolute progpath for reexecution: cannam@125: case $progpath in cannam@125: [\\/]*|[A-Za-z]:\\*) ;; cannam@125: *[\\/]*) cannam@125: progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` cannam@125: progdir=`cd "$progdir" && pwd` cannam@125: progpath=$progdir/$progname cannam@125: ;; cannam@125: *) cannam@125: _G_IFS=$IFS cannam@125: IFS=${PATH_SEPARATOR-:} cannam@125: for progdir in $PATH; do cannam@125: IFS=$_G_IFS cannam@125: test -x "$progdir/$progname" && break cannam@125: done cannam@125: IFS=$_G_IFS cannam@125: test -n "$progdir" || progdir=`pwd` cannam@125: progpath=$progdir/$progname cannam@125: ;; cannam@125: esac cannam@125: cannam@125: cannam@125: ## ----------------- ## cannam@125: ## Standard options. ## cannam@125: ## ----------------- ## cannam@125: cannam@125: # The following options affect the operation of the functions defined cannam@125: # below, and should be set appropriately depending on run-time para- cannam@125: # meters passed on the command line. cannam@125: cannam@125: opt_dry_run=false cannam@125: opt_quiet=false cannam@125: opt_verbose=false cannam@125: cannam@125: # Categories 'all' and 'none' are always available. Append any others cannam@125: # you will pass as the first argument to func_warning from your own cannam@125: # code. cannam@125: warning_categories= cannam@125: cannam@125: # By default, display warnings according to 'opt_warning_types'. Set cannam@125: # 'warning_func' to ':' to elide all warnings, or func_fatal_error to cannam@125: # treat the next displayed warning as a fatal error. cannam@125: warning_func=func_warn_and_continue cannam@125: cannam@125: # Set to 'all' to display all warnings, 'none' to suppress all cannam@125: # warnings, or a space delimited list of some subset of cannam@125: # 'warning_categories' to display only the listed warnings. cannam@125: opt_warning_types=all cannam@125: cannam@125: cannam@125: ## -------------------- ## cannam@125: ## Resource management. ## cannam@125: ## -------------------- ## cannam@125: cannam@125: # This section contains definitions for functions that each ensure a cannam@125: # particular resource (a file, or a non-empty configuration variable for cannam@125: # example) is available, and if appropriate to extract default values cannam@125: # from pertinent package files. Call them using their associated cannam@125: # 'require_*' variable to ensure that they are executed, at most, once. cannam@125: # cannam@125: # It's entirely deliberate that calling these functions can set cannam@125: # variables that don't obey the namespace limitations obeyed by the rest cannam@125: # of this file, in order that that they be as useful as possible to cannam@125: # callers. cannam@125: cannam@125: cannam@125: # require_term_colors cannam@125: # ------------------- cannam@125: # Allow display of bold text on terminals that support it. cannam@125: require_term_colors=func_require_term_colors cannam@125: func_require_term_colors () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: test -t 1 && { cannam@125: # COLORTERM and USE_ANSI_COLORS environment variables take cannam@125: # precedence, because most terminfo databases neglect to describe cannam@125: # whether color sequences are supported. cannam@125: test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} cannam@125: cannam@125: if test 1 = "$USE_ANSI_COLORS"; then cannam@125: # Standard ANSI escape sequences cannam@125: tc_reset='' cannam@125: tc_bold=''; tc_standout='' cannam@125: tc_red=''; tc_green='' cannam@125: tc_blue=''; tc_cyan='' cannam@125: else cannam@125: # Otherwise trust the terminfo database after all. cannam@125: test -n "`tput sgr0 2>/dev/null`" && { cannam@125: tc_reset=`tput sgr0` cannam@125: test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` cannam@125: tc_standout=$tc_bold cannam@125: test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` cannam@125: test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` cannam@125: test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` cannam@125: test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` cannam@125: test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` cannam@125: } cannam@125: fi cannam@125: } cannam@125: cannam@125: require_term_colors=: cannam@125: } cannam@125: cannam@125: cannam@125: ## ----------------- ## cannam@125: ## Function library. ## cannam@125: ## ----------------- ## cannam@125: cannam@125: # This section contains a variety of useful functions to call in your cannam@125: # scripts. Take note of the portable wrappers for features provided by cannam@125: # some modern shells, which will fall back to slower equivalents on cannam@125: # less featureful shells. cannam@125: cannam@125: cannam@125: # func_append VAR VALUE cannam@125: # --------------------- cannam@125: # Append VALUE onto the existing contents of VAR. cannam@125: cannam@125: # We should try to minimise forks, especially on Windows where they are cannam@125: # unreasonably slow, so skip the feature probes when bash or zsh are cannam@125: # being used: cannam@125: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then cannam@125: : ${_G_HAVE_ARITH_OP="yes"} cannam@125: : ${_G_HAVE_XSI_OPS="yes"} cannam@125: # The += operator was introduced in bash 3.1 cannam@125: case $BASH_VERSION in cannam@125: [12].* | 3.0 | 3.0*) ;; cannam@125: *) cannam@125: : ${_G_HAVE_PLUSEQ_OP="yes"} cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: # _G_HAVE_PLUSEQ_OP cannam@125: # Can be empty, in which case the shell is probed, "yes" if += is cannam@125: # useable or anything else if it does not work. cannam@125: test -z "$_G_HAVE_PLUSEQ_OP" \ cannam@125: && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ cannam@125: && _G_HAVE_PLUSEQ_OP=yes cannam@125: cannam@125: if test yes = "$_G_HAVE_PLUSEQ_OP" cannam@125: then cannam@125: # This is an XSI compatible shell, allowing a faster implementation... cannam@125: eval 'func_append () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval "$1+=\$2" cannam@125: }' cannam@125: else cannam@125: # ...otherwise fall back to using expr, which is often a shell builtin. cannam@125: func_append () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval "$1=\$$1\$2" cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_append_quoted VAR VALUE cannam@125: # ---------------------------- cannam@125: # Quote VALUE and append to the end of shell variable VAR, separated cannam@125: # by a space. cannam@125: if test yes = "$_G_HAVE_PLUSEQ_OP"; then cannam@125: eval 'func_append_quoted () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_quote_for_eval "$2" cannam@125: eval "$1+=\\ \$func_quote_for_eval_result" cannam@125: }' cannam@125: else cannam@125: func_append_quoted () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_quote_for_eval "$2" cannam@125: eval "$1=\$$1\\ \$func_quote_for_eval_result" cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_append_uniq VAR VALUE cannam@125: # -------------------------- cannam@125: # Append unique VALUE onto the existing contents of VAR, assuming cannam@125: # entries are delimited by the first character of VALUE. For example: cannam@125: # cannam@125: # func_append_uniq options " --another-option option-argument" cannam@125: # cannam@125: # will only append to $options if " --another-option option-argument " cannam@125: # is not already present somewhere in $options already (note spaces at cannam@125: # each end implied by leading space in second argument). cannam@125: func_append_uniq () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval _G_current_value='`$ECHO $'$1'`' cannam@125: _G_delim=`expr "$2" : '\(.\)'` cannam@125: cannam@125: case $_G_delim$_G_current_value$_G_delim in cannam@125: *"$2$_G_delim"*) ;; cannam@125: *) func_append "$@" ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: cannam@125: # func_arith TERM... cannam@125: # ------------------ cannam@125: # Set func_arith_result to the result of evaluating TERMs. cannam@125: test -z "$_G_HAVE_ARITH_OP" \ cannam@125: && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ cannam@125: && _G_HAVE_ARITH_OP=yes cannam@125: cannam@125: if test yes = "$_G_HAVE_ARITH_OP"; then cannam@125: eval 'func_arith () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_arith_result=$(( $* )) cannam@125: }' cannam@125: else cannam@125: func_arith () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_arith_result=`expr "$@"` cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_basename FILE cannam@125: # ------------------ cannam@125: # Set func_basename_result to FILE with everything up to and including cannam@125: # the last / stripped. cannam@125: if test yes = "$_G_HAVE_XSI_OPS"; then cannam@125: # If this shell supports suffix pattern removal, then use it to avoid cannam@125: # forking. Hide the definitions single quotes in case the shell chokes cannam@125: # on unsupported syntax... cannam@125: _b='func_basename_result=${1##*/}' cannam@125: _d='case $1 in cannam@125: */*) func_dirname_result=${1%/*}$2 ;; cannam@125: * ) func_dirname_result=$3 ;; cannam@125: esac' cannam@125: cannam@125: else cannam@125: # ...otherwise fall back to using sed. cannam@125: _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' cannam@125: _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` cannam@125: if test "X$func_dirname_result" = "X$1"; then cannam@125: func_dirname_result=$3 cannam@125: else cannam@125: func_append func_dirname_result "$2" cannam@125: fi' cannam@125: fi cannam@125: cannam@125: eval 'func_basename () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: '"$_b"' cannam@125: }' cannam@125: cannam@125: cannam@125: # func_dirname FILE APPEND NONDIR_REPLACEMENT cannam@125: # ------------------------------------------- cannam@125: # Compute the dirname of FILE. If nonempty, add APPEND to the result, cannam@125: # otherwise set result to NONDIR_REPLACEMENT. cannam@125: eval 'func_dirname () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: '"$_d"' cannam@125: }' cannam@125: cannam@125: cannam@125: # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT cannam@125: # -------------------------------------------------------- cannam@125: # Perform func_basename and func_dirname in a single function cannam@125: # call: cannam@125: # dirname: Compute the dirname of FILE. If nonempty, cannam@125: # add APPEND to the result, otherwise set result cannam@125: # to NONDIR_REPLACEMENT. cannam@125: # value returned in "$func_dirname_result" cannam@125: # basename: Compute filename of FILE. cannam@125: # value retuned in "$func_basename_result" cannam@125: # For efficiency, we do not delegate to the functions above but instead cannam@125: # duplicate the functionality here. cannam@125: eval 'func_dirname_and_basename () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: '"$_b"' cannam@125: '"$_d"' cannam@125: }' cannam@125: cannam@125: cannam@125: # func_echo ARG... cannam@125: # ---------------- cannam@125: # Echo program name prefixed message. cannam@125: func_echo () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_message=$* cannam@125: cannam@125: func_echo_IFS=$IFS cannam@125: IFS=$nl cannam@125: for _G_line in $_G_message; do cannam@125: IFS=$func_echo_IFS cannam@125: $ECHO "$progname: $_G_line" cannam@125: done cannam@125: IFS=$func_echo_IFS cannam@125: } cannam@125: cannam@125: cannam@125: # func_echo_all ARG... cannam@125: # -------------------- cannam@125: # Invoke $ECHO with all args, space-separated. cannam@125: func_echo_all () cannam@125: { cannam@125: $ECHO "$*" cannam@125: } cannam@125: cannam@125: cannam@125: # func_echo_infix_1 INFIX ARG... cannam@125: # ------------------------------ cannam@125: # Echo program name, followed by INFIX on the first line, with any cannam@125: # additional lines not showing INFIX. cannam@125: func_echo_infix_1 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $require_term_colors cannam@125: cannam@125: _G_infix=$1; shift cannam@125: _G_indent=$_G_infix cannam@125: _G_prefix="$progname: $_G_infix: " cannam@125: _G_message=$* cannam@125: cannam@125: # Strip color escape sequences before counting printable length cannam@125: for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" cannam@125: do cannam@125: test -n "$_G_tc" && { cannam@125: _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` cannam@125: _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` cannam@125: } cannam@125: done cannam@125: _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes cannam@125: cannam@125: func_echo_infix_1_IFS=$IFS cannam@125: IFS=$nl cannam@125: for _G_line in $_G_message; do cannam@125: IFS=$func_echo_infix_1_IFS cannam@125: $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 cannam@125: _G_prefix=$_G_indent cannam@125: done cannam@125: IFS=$func_echo_infix_1_IFS cannam@125: } cannam@125: cannam@125: cannam@125: # func_error ARG... cannam@125: # ----------------- cannam@125: # Echo program name prefixed message to standard error. cannam@125: func_error () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $require_term_colors cannam@125: cannam@125: func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 cannam@125: } cannam@125: cannam@125: cannam@125: # func_fatal_error ARG... cannam@125: # ----------------------- cannam@125: # Echo program name prefixed message to standard error, and exit. cannam@125: func_fatal_error () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_error "$*" cannam@125: exit $EXIT_FAILURE cannam@125: } cannam@125: cannam@125: cannam@125: # func_grep EXPRESSION FILENAME cannam@125: # ----------------------------- cannam@125: # Check whether EXPRESSION matches any line of FILENAME, without output. cannam@125: func_grep () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $GREP "$1" "$2" >/dev/null 2>&1 cannam@125: } cannam@125: cannam@125: cannam@125: # func_len STRING cannam@125: # --------------- cannam@125: # Set func_len_result to the length of STRING. STRING may not cannam@125: # start with a hyphen. cannam@125: test -z "$_G_HAVE_XSI_OPS" \ cannam@125: && (eval 'x=a/b/c; cannam@125: test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ cannam@125: && _G_HAVE_XSI_OPS=yes cannam@125: cannam@125: if test yes = "$_G_HAVE_XSI_OPS"; then cannam@125: eval 'func_len () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_len_result=${#1} cannam@125: }' cannam@125: else cannam@125: func_len () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_mkdir_p DIRECTORY-PATH cannam@125: # --------------------------- cannam@125: # Make sure the entire path to DIRECTORY-PATH is available. cannam@125: func_mkdir_p () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_directory_path=$1 cannam@125: _G_dir_list= cannam@125: cannam@125: if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then cannam@125: cannam@125: # Protect directory names starting with '-' cannam@125: case $_G_directory_path in cannam@125: -*) _G_directory_path=./$_G_directory_path ;; cannam@125: esac cannam@125: cannam@125: # While some portion of DIR does not yet exist... cannam@125: while test ! -d "$_G_directory_path"; do cannam@125: # ...make a list in topmost first order. Use a colon delimited cannam@125: # list incase some portion of path contains whitespace. cannam@125: _G_dir_list=$_G_directory_path:$_G_dir_list cannam@125: cannam@125: # If the last portion added has no slash in it, the list is done cannam@125: case $_G_directory_path in */*) ;; *) break ;; esac cannam@125: cannam@125: # ...otherwise throw away the child directory and loop cannam@125: _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` cannam@125: done cannam@125: _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` cannam@125: cannam@125: func_mkdir_p_IFS=$IFS; IFS=: cannam@125: for _G_dir in $_G_dir_list; do cannam@125: IFS=$func_mkdir_p_IFS cannam@125: # mkdir can fail with a 'File exist' error if two processes cannam@125: # try to create one of the directories concurrently. Don't cannam@125: # stop in that case! cannam@125: $MKDIR "$_G_dir" 2>/dev/null || : cannam@125: done cannam@125: IFS=$func_mkdir_p_IFS cannam@125: cannam@125: # Bail out if we (or some other process) failed to create a directory. cannam@125: test -d "$_G_directory_path" || \ cannam@125: func_fatal_error "Failed to create '$1'" cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: # func_mktempdir [BASENAME] cannam@125: # ------------------------- cannam@125: # Make a temporary directory that won't clash with other running cannam@125: # libtool processes, and avoids race conditions if possible. If cannam@125: # given, BASENAME is the basename for that directory. cannam@125: func_mktempdir () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_template=${TMPDIR-/tmp}/${1-$progname} cannam@125: cannam@125: if test : = "$opt_dry_run"; then cannam@125: # Return a directory name, but don't create it in dry-run mode cannam@125: _G_tmpdir=$_G_template-$$ cannam@125: else cannam@125: cannam@125: # If mktemp works, use that first and foremost cannam@125: _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` cannam@125: cannam@125: if test ! -d "$_G_tmpdir"; then cannam@125: # Failing that, at least try and use $RANDOM to avoid a race cannam@125: _G_tmpdir=$_G_template-${RANDOM-0}$$ cannam@125: cannam@125: func_mktempdir_umask=`umask` cannam@125: umask 0077 cannam@125: $MKDIR "$_G_tmpdir" cannam@125: umask $func_mktempdir_umask cannam@125: fi cannam@125: cannam@125: # If we're not in dry-run mode, bomb out on failure cannam@125: test -d "$_G_tmpdir" || \ cannam@125: func_fatal_error "cannot create temporary directory '$_G_tmpdir'" cannam@125: fi cannam@125: cannam@125: $ECHO "$_G_tmpdir" cannam@125: } cannam@125: cannam@125: cannam@125: # func_normal_abspath PATH cannam@125: # ------------------------ cannam@125: # Remove doubled-up and trailing slashes, "." path components, cannam@125: # and cancel out any ".." path components in PATH after making cannam@125: # it an absolute path. cannam@125: func_normal_abspath () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # These SED scripts presuppose an absolute path with a trailing slash. cannam@125: _G_pathcar='s|^/\([^/]*\).*$|\1|' cannam@125: _G_pathcdr='s|^/[^/]*||' cannam@125: _G_removedotparts=':dotsl cannam@125: s|/\./|/|g cannam@125: t dotsl cannam@125: s|/\.$|/|' cannam@125: _G_collapseslashes='s|/\{1,\}|/|g' cannam@125: _G_finalslash='s|/*$|/|' cannam@125: cannam@125: # Start from root dir and reassemble the path. cannam@125: func_normal_abspath_result= cannam@125: func_normal_abspath_tpath=$1 cannam@125: func_normal_abspath_altnamespace= cannam@125: case $func_normal_abspath_tpath in cannam@125: "") cannam@125: # Empty path, that just means $cwd. cannam@125: func_stripname '' '/' "`pwd`" cannam@125: func_normal_abspath_result=$func_stripname_result cannam@125: return cannam@125: ;; cannam@125: # The next three entries are used to spot a run of precisely cannam@125: # two leading slashes without using negated character classes; cannam@125: # we take advantage of case's first-match behaviour. cannam@125: ///*) cannam@125: # Unusual form of absolute path, do nothing. cannam@125: ;; cannam@125: //*) cannam@125: # Not necessarily an ordinary path; POSIX reserves leading '//' cannam@125: # and for example Cygwin uses it to access remote file shares cannam@125: # over CIFS/SMB, so we conserve a leading double slash if found. cannam@125: func_normal_abspath_altnamespace=/ cannam@125: ;; cannam@125: /*) cannam@125: # Absolute path, do nothing. cannam@125: ;; cannam@125: *) cannam@125: # Relative path, prepend $cwd. cannam@125: func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Cancel out all the simple stuff to save iterations. We also want cannam@125: # the path to end with a slash for ease of parsing, so make sure cannam@125: # there is one (and only one) here. cannam@125: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ cannam@125: -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` cannam@125: while :; do cannam@125: # Processed it all yet? cannam@125: if test / = "$func_normal_abspath_tpath"; then cannam@125: # If we ascended to the root using ".." the result may be empty now. cannam@125: if test -z "$func_normal_abspath_result"; then cannam@125: func_normal_abspath_result=/ cannam@125: fi cannam@125: break cannam@125: fi cannam@125: func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ cannam@125: -e "$_G_pathcar"` cannam@125: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ cannam@125: -e "$_G_pathcdr"` cannam@125: # Figure out what to do with it cannam@125: case $func_normal_abspath_tcomponent in cannam@125: "") cannam@125: # Trailing empty path component, ignore it. cannam@125: ;; cannam@125: ..) cannam@125: # Parent dir; strip last assembled component from result. cannam@125: func_dirname "$func_normal_abspath_result" cannam@125: func_normal_abspath_result=$func_dirname_result cannam@125: ;; cannam@125: *) cannam@125: # Actual path component, append it. cannam@125: func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: # Restore leading double-slash if one was found on entry. cannam@125: func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result cannam@125: } cannam@125: cannam@125: cannam@125: # func_notquiet ARG... cannam@125: # -------------------- cannam@125: # Echo program name prefixed message only when not in quiet mode. cannam@125: func_notquiet () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $opt_quiet || func_echo ${1+"$@"} cannam@125: cannam@125: # A bug in bash halts the script if the last line of a function cannam@125: # fails when set -e is in force, so we need another command to cannam@125: # work around that: cannam@125: : cannam@125: } cannam@125: cannam@125: cannam@125: # func_relative_path SRCDIR DSTDIR cannam@125: # -------------------------------- cannam@125: # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. cannam@125: func_relative_path () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_relative_path_result= cannam@125: func_normal_abspath "$1" cannam@125: func_relative_path_tlibdir=$func_normal_abspath_result cannam@125: func_normal_abspath "$2" cannam@125: func_relative_path_tbindir=$func_normal_abspath_result cannam@125: cannam@125: # Ascend the tree starting from libdir cannam@125: while :; do cannam@125: # check if we have found a prefix of bindir cannam@125: case $func_relative_path_tbindir in cannam@125: $func_relative_path_tlibdir) cannam@125: # found an exact match cannam@125: func_relative_path_tcancelled= cannam@125: break cannam@125: ;; cannam@125: $func_relative_path_tlibdir*) cannam@125: # found a matching prefix cannam@125: func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" cannam@125: func_relative_path_tcancelled=$func_stripname_result cannam@125: if test -z "$func_relative_path_result"; then cannam@125: func_relative_path_result=. cannam@125: fi cannam@125: break cannam@125: ;; cannam@125: *) cannam@125: func_dirname $func_relative_path_tlibdir cannam@125: func_relative_path_tlibdir=$func_dirname_result cannam@125: if test -z "$func_relative_path_tlibdir"; then cannam@125: # Have to descend all the way to the root! cannam@125: func_relative_path_result=../$func_relative_path_result cannam@125: func_relative_path_tcancelled=$func_relative_path_tbindir cannam@125: break cannam@125: fi cannam@125: func_relative_path_result=../$func_relative_path_result cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # Now calculate path; take care to avoid doubling-up slashes. cannam@125: func_stripname '' '/' "$func_relative_path_result" cannam@125: func_relative_path_result=$func_stripname_result cannam@125: func_stripname '/' '/' "$func_relative_path_tcancelled" cannam@125: if test -n "$func_stripname_result"; then cannam@125: func_append func_relative_path_result "/$func_stripname_result" cannam@125: fi cannam@125: cannam@125: # Normalisation. If bindir is libdir, return '.' else relative path. cannam@125: if test -n "$func_relative_path_result"; then cannam@125: func_stripname './' '' "$func_relative_path_result" cannam@125: func_relative_path_result=$func_stripname_result cannam@125: fi cannam@125: cannam@125: test -n "$func_relative_path_result" || func_relative_path_result=. cannam@125: cannam@125: : cannam@125: } cannam@125: cannam@125: cannam@125: # func_quote_for_eval ARG... cannam@125: # -------------------------- cannam@125: # Aesthetically quote ARGs to be evaled later. cannam@125: # This function returns two values: cannam@125: # i) func_quote_for_eval_result cannam@125: # double-quoted, suitable for a subsequent eval cannam@125: # ii) func_quote_for_eval_unquoted_result cannam@125: # has all characters that are still active within double cannam@125: # quotes backslashified. cannam@125: func_quote_for_eval () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_quote_for_eval_unquoted_result= cannam@125: func_quote_for_eval_result= cannam@125: while test 0 -lt $#; do cannam@125: case $1 in cannam@125: *[\\\`\"\$]*) cannam@125: _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; cannam@125: *) cannam@125: _G_unquoted_arg=$1 ;; cannam@125: esac cannam@125: if test -n "$func_quote_for_eval_unquoted_result"; then cannam@125: func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" cannam@125: else cannam@125: func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" cannam@125: fi cannam@125: cannam@125: case $_G_unquoted_arg in cannam@125: # Double-quote args containing shell metacharacters to delay cannam@125: # word splitting, command substitution and variable expansion cannam@125: # for a subsequent eval. cannam@125: # Many Bourne shells cannot handle close brackets correctly cannam@125: # in scan sets, so we specify it separately. cannam@125: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") cannam@125: _G_quoted_arg=\"$_G_unquoted_arg\" cannam@125: ;; cannam@125: *) cannam@125: _G_quoted_arg=$_G_unquoted_arg cannam@125: ;; cannam@125: esac cannam@125: cannam@125: if test -n "$func_quote_for_eval_result"; then cannam@125: func_append func_quote_for_eval_result " $_G_quoted_arg" cannam@125: else cannam@125: func_append func_quote_for_eval_result "$_G_quoted_arg" cannam@125: fi cannam@125: shift cannam@125: done cannam@125: } cannam@125: cannam@125: cannam@125: # func_quote_for_expand ARG cannam@125: # ------------------------- cannam@125: # Aesthetically quote ARG to be evaled later; same as above, cannam@125: # but do not quote variable references. cannam@125: func_quote_for_expand () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $1 in cannam@125: *[\\\`\"]*) cannam@125: _G_arg=`$ECHO "$1" | $SED \ cannam@125: -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; cannam@125: *) cannam@125: _G_arg=$1 ;; cannam@125: esac cannam@125: cannam@125: case $_G_arg in cannam@125: # Double-quote args containing shell metacharacters to delay cannam@125: # word splitting and command substitution for a subsequent eval. cannam@125: # Many Bourne shells cannot handle close brackets correctly cannam@125: # in scan sets, so we specify it separately. cannam@125: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") cannam@125: _G_arg=\"$_G_arg\" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: func_quote_for_expand_result=$_G_arg cannam@125: } cannam@125: cannam@125: cannam@125: # func_stripname PREFIX SUFFIX NAME cannam@125: # --------------------------------- cannam@125: # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. cannam@125: # PREFIX and SUFFIX must not contain globbing or regex special cannam@125: # characters, hashes, percent signs, but SUFFIX may contain a leading cannam@125: # dot (in which case that matches only a dot). cannam@125: if test yes = "$_G_HAVE_XSI_OPS"; then cannam@125: eval 'func_stripname () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are cannam@125: # positional parameters, so assign one to ordinary variable first. cannam@125: func_stripname_result=$3 cannam@125: func_stripname_result=${func_stripname_result#"$1"} cannam@125: func_stripname_result=${func_stripname_result%"$2"} cannam@125: }' cannam@125: else cannam@125: func_stripname () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $2 in cannam@125: .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; cannam@125: *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; cannam@125: esac cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_show_eval CMD [FAIL_EXP] cannam@125: # ----------------------------- cannam@125: # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is cannam@125: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP cannam@125: # is given, then evaluate it. cannam@125: func_show_eval () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_cmd=$1 cannam@125: _G_fail_exp=${2-':'} cannam@125: cannam@125: func_quote_for_expand "$_G_cmd" cannam@125: eval "func_notquiet $func_quote_for_expand_result" cannam@125: cannam@125: $opt_dry_run || { cannam@125: eval "$_G_cmd" cannam@125: _G_status=$? cannam@125: if test 0 -ne "$_G_status"; then cannam@125: eval "(exit $_G_status); $_G_fail_exp" cannam@125: fi cannam@125: } cannam@125: } cannam@125: cannam@125: cannam@125: # func_show_eval_locale CMD [FAIL_EXP] cannam@125: # ------------------------------------ cannam@125: # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is cannam@125: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP cannam@125: # is given, then evaluate it. Use the saved locale for evaluation. cannam@125: func_show_eval_locale () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_cmd=$1 cannam@125: _G_fail_exp=${2-':'} cannam@125: cannam@125: $opt_quiet || { cannam@125: func_quote_for_expand "$_G_cmd" cannam@125: eval "func_echo $func_quote_for_expand_result" cannam@125: } cannam@125: cannam@125: $opt_dry_run || { cannam@125: eval "$_G_user_locale cannam@125: $_G_cmd" cannam@125: _G_status=$? cannam@125: eval "$_G_safe_locale" cannam@125: if test 0 -ne "$_G_status"; then cannam@125: eval "(exit $_G_status); $_G_fail_exp" cannam@125: fi cannam@125: } cannam@125: } cannam@125: cannam@125: cannam@125: # func_tr_sh cannam@125: # ---------- cannam@125: # Turn $1 into a string suitable for a shell variable name. cannam@125: # Result is stored in $func_tr_sh_result. All characters cannam@125: # not in the set a-zA-Z0-9_ are replaced with '_'. Further, cannam@125: # if $1 begins with a digit, a '_' is prepended as well. cannam@125: func_tr_sh () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $1 in cannam@125: [0-9]* | *[!a-zA-Z0-9_]*) cannam@125: func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` cannam@125: ;; cannam@125: * ) cannam@125: func_tr_sh_result=$1 cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: cannam@125: # func_verbose ARG... cannam@125: # ------------------- cannam@125: # Echo program name prefixed message in verbose mode only. cannam@125: func_verbose () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $opt_verbose && func_echo "$*" cannam@125: cannam@125: : cannam@125: } cannam@125: cannam@125: cannam@125: # func_warn_and_continue ARG... cannam@125: # ----------------------------- cannam@125: # Echo program name prefixed warning message to standard error. cannam@125: func_warn_and_continue () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $require_term_colors cannam@125: cannam@125: func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 cannam@125: } cannam@125: cannam@125: cannam@125: # func_warning CATEGORY ARG... cannam@125: # ---------------------------- cannam@125: # Echo program name prefixed warning message to standard error. Warning cannam@125: # messages can be filtered according to CATEGORY, where this function cannam@125: # elides messages where CATEGORY is not listed in the global variable cannam@125: # 'opt_warning_types'. cannam@125: func_warning () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # CATEGORY must be in the warning_categories list! cannam@125: case " $warning_categories " in cannam@125: *" $1 "*) ;; cannam@125: *) func_internal_error "invalid warning category '$1'" ;; cannam@125: esac cannam@125: cannam@125: _G_category=$1 cannam@125: shift cannam@125: cannam@125: case " $opt_warning_types " in cannam@125: *" $_G_category "*) $warning_func ${1+"$@"} ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: cannam@125: # func_sort_ver VER1 VER2 cannam@125: # ----------------------- cannam@125: # 'sort -V' is not generally available. cannam@125: # Note this deviates from the version comparison in automake cannam@125: # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a cannam@125: # but this should suffice as we won't be specifying old cannam@125: # version formats or redundant trailing .0 in bootstrap.conf. cannam@125: # If we did want full compatibility then we should probably cannam@125: # use m4_version_compare from autoconf. cannam@125: func_sort_ver () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: printf '%s\n%s\n' "$1" "$2" \ cannam@125: | 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 cannam@125: } cannam@125: cannam@125: # func_lt_ver PREV CURR cannam@125: # --------------------- cannam@125: # Return true if PREV and CURR are in the correct order according to cannam@125: # func_sort_ver, otherwise false. Use it like this: cannam@125: # cannam@125: # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." cannam@125: func_lt_ver () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` cannam@125: } cannam@125: cannam@125: cannam@125: # Local variables: cannam@125: # mode: shell-script cannam@125: # sh-indentation: 2 cannam@125: # eval: (add-hook 'before-save-hook 'time-stamp) cannam@125: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" cannam@125: # time-stamp-time-zone: "UTC" cannam@125: # End: cannam@125: #! /bin/sh cannam@125: cannam@125: # Set a version string for this script. cannam@125: scriptversion=2014-01-07.03; # UTC cannam@125: cannam@125: # A portable, pluggable option parser for Bourne shell. cannam@125: # Written by Gary V. Vaughan, 2010 cannam@125: cannam@125: # Copyright (C) 2010-2015 Free Software Foundation, Inc. cannam@125: # This is free software; see the source for copying conditions. There is NO cannam@125: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cannam@125: cannam@125: # This program is free software: you can redistribute it and/or modify cannam@125: # it under the terms of the GNU General Public License as published by cannam@125: # the Free Software Foundation, either version 3 of the License, or cannam@125: # (at your option) any later version. cannam@125: cannam@125: # This program is distributed in the hope that it will be useful, cannam@125: # but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@125: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@125: # GNU General Public License for more details. cannam@125: cannam@125: # You should have received a copy of the GNU General Public License cannam@125: # along with this program. If not, see . cannam@125: cannam@125: # Please report bugs or propose patches to gary@gnu.org. cannam@125: cannam@125: cannam@125: ## ------ ## cannam@125: ## Usage. ## cannam@125: ## ------ ## cannam@125: cannam@125: # This file is a library for parsing options in your shell scripts along cannam@125: # with assorted other useful supporting features that you can make use cannam@125: # of too. cannam@125: # cannam@125: # For the simplest scripts you might need only: cannam@125: # cannam@125: # #!/bin/sh cannam@125: # . relative/path/to/funclib.sh cannam@125: # . relative/path/to/options-parser cannam@125: # scriptversion=1.0 cannam@125: # func_options ${1+"$@"} cannam@125: # eval set dummy "$func_options_result"; shift cannam@125: # ...rest of your script... cannam@125: # cannam@125: # In order for the '--version' option to work, you will need to have a cannam@125: # suitably formatted comment like the one at the top of this file cannam@125: # starting with '# Written by ' and ending with '# warranty; '. cannam@125: # cannam@125: # For '-h' and '--help' to work, you will also need a one line cannam@125: # description of your script's purpose in a comment directly above the cannam@125: # '# Written by ' line, like the one at the top of this file. cannam@125: # cannam@125: # The default options also support '--debug', which will turn on shell cannam@125: # execution tracing (see the comment above debug_cmd below for another cannam@125: # use), and '--verbose' and the func_verbose function to allow your script cannam@125: # to display verbose messages only when your user has specified cannam@125: # '--verbose'. cannam@125: # cannam@125: # After sourcing this file, you can plug processing for additional cannam@125: # options by amending the variables from the 'Configuration' section cannam@125: # below, and following the instructions in the 'Option parsing' cannam@125: # section further down. cannam@125: cannam@125: ## -------------- ## cannam@125: ## Configuration. ## cannam@125: ## -------------- ## cannam@125: cannam@125: # You should override these variables in your script after sourcing this cannam@125: # file so that they reflect the customisations you have added to the cannam@125: # option parser. cannam@125: cannam@125: # The usage line for option parsing errors and the start of '-h' and cannam@125: # '--help' output messages. You can embed shell variables for delayed cannam@125: # expansion at the time the message is displayed, but you will need to cannam@125: # quote other shell meta-characters carefully to prevent them being cannam@125: # expanded when the contents are evaled. cannam@125: usage='$progpath [OPTION]...' cannam@125: cannam@125: # Short help message in response to '-h' and '--help'. Add to this or cannam@125: # override it after sourcing this library to reflect the full set of cannam@125: # options your script accepts. cannam@125: usage_message="\ cannam@125: --debug enable verbose shell tracing cannam@125: -W, --warnings=CATEGORY cannam@125: report the warnings falling in CATEGORY [all] cannam@125: -v, --verbose verbosely report processing cannam@125: --version print version information and exit cannam@125: -h, --help print short or long help message and exit cannam@125: " cannam@125: cannam@125: # Additional text appended to 'usage_message' in response to '--help'. cannam@125: long_help_message=" cannam@125: Warning categories include: cannam@125: 'all' show all warnings cannam@125: 'none' turn off all the warnings cannam@125: 'error' warnings are treated as fatal errors" cannam@125: cannam@125: # Help message printed before fatal option parsing errors. cannam@125: fatal_help="Try '\$progname --help' for more information." cannam@125: cannam@125: cannam@125: cannam@125: ## ------------------------- ## cannam@125: ## Hook function management. ## cannam@125: ## ------------------------- ## cannam@125: cannam@125: # This section contains functions for adding, removing, and running hooks cannam@125: # to the main code. A hook is just a named list of of function, that can cannam@125: # be run in order later on. cannam@125: cannam@125: # func_hookable FUNC_NAME cannam@125: # ----------------------- cannam@125: # Declare that FUNC_NAME will run hooks added with cannam@125: # 'func_add_hook FUNC_NAME ...'. cannam@125: func_hookable () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_append hookable_fns " $1" cannam@125: } cannam@125: cannam@125: cannam@125: # func_add_hook FUNC_NAME HOOK_FUNC cannam@125: # --------------------------------- cannam@125: # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must cannam@125: # first have been declared "hookable" by a call to 'func_hookable'. cannam@125: func_add_hook () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case " $hookable_fns " in cannam@125: *" $1 "*) ;; cannam@125: *) func_fatal_error "'$1' does not accept hook functions." ;; cannam@125: esac cannam@125: cannam@125: eval func_append ${1}_hooks '" $2"' cannam@125: } cannam@125: cannam@125: cannam@125: # func_remove_hook FUNC_NAME HOOK_FUNC cannam@125: # ------------------------------------ cannam@125: # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. cannam@125: func_remove_hook () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' cannam@125: } cannam@125: cannam@125: cannam@125: # func_run_hooks FUNC_NAME [ARG]... cannam@125: # --------------------------------- cannam@125: # Run all hook functions registered to FUNC_NAME. cannam@125: # It is assumed that the list of hook functions contains nothing more cannam@125: # than a whitespace-delimited list of legal shell function names, and cannam@125: # no effort is wasted trying to catch shell meta-characters or preserve cannam@125: # whitespace. cannam@125: func_run_hooks () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case " $hookable_fns " in cannam@125: *" $1 "*) ;; cannam@125: *) func_fatal_error "'$1' does not support hook funcions.n" ;; cannam@125: esac cannam@125: cannam@125: eval _G_hook_fns=\$$1_hooks; shift cannam@125: cannam@125: for _G_hook in $_G_hook_fns; do cannam@125: eval $_G_hook '"$@"' cannam@125: cannam@125: # store returned options list back into positional cannam@125: # parameters for next 'cmd' execution. cannam@125: eval _G_hook_result=\$${_G_hook}_result cannam@125: eval set dummy "$_G_hook_result"; shift cannam@125: done cannam@125: cannam@125: func_quote_for_eval ${1+"$@"} cannam@125: func_run_hooks_result=$func_quote_for_eval_result cannam@125: } cannam@125: cannam@125: cannam@125: cannam@125: ## --------------- ## cannam@125: ## Option parsing. ## cannam@125: ## --------------- ## cannam@125: cannam@125: # In order to add your own option parsing hooks, you must accept the cannam@125: # full positional parameter list in your hook function, remove any cannam@125: # options that you action, and then pass back the remaining unprocessed cannam@125: # options in '_result', escaped suitably for cannam@125: # 'eval'. Like this: cannam@125: # cannam@125: # my_options_prep () cannam@125: # { cannam@125: # $debug_cmd cannam@125: # cannam@125: # # Extend the existing usage message. cannam@125: # usage_message=$usage_message' cannam@125: # -s, --silent don'\''t print informational messages cannam@125: # ' cannam@125: # cannam@125: # func_quote_for_eval ${1+"$@"} cannam@125: # my_options_prep_result=$func_quote_for_eval_result cannam@125: # } cannam@125: # func_add_hook func_options_prep my_options_prep cannam@125: # cannam@125: # cannam@125: # my_silent_option () cannam@125: # { cannam@125: # $debug_cmd cannam@125: # cannam@125: # # Note that for efficiency, we parse as many options as we can cannam@125: # # recognise in a loop before passing the remainder back to the cannam@125: # # caller on the first unrecognised argument we encounter. cannam@125: # while test $# -gt 0; do cannam@125: # opt=$1; shift cannam@125: # case $opt in cannam@125: # --silent|-s) opt_silent=: ;; cannam@125: # # Separate non-argument short options: cannam@125: # -s*) func_split_short_opt "$_G_opt" cannam@125: # set dummy "$func_split_short_opt_name" \ cannam@125: # "-$func_split_short_opt_arg" ${1+"$@"} cannam@125: # shift cannam@125: # ;; cannam@125: # *) set dummy "$_G_opt" "$*"; shift; break ;; cannam@125: # esac cannam@125: # done cannam@125: # cannam@125: # func_quote_for_eval ${1+"$@"} cannam@125: # my_silent_option_result=$func_quote_for_eval_result cannam@125: # } cannam@125: # func_add_hook func_parse_options my_silent_option cannam@125: # cannam@125: # cannam@125: # my_option_validation () cannam@125: # { cannam@125: # $debug_cmd cannam@125: # cannam@125: # $opt_silent && $opt_verbose && func_fatal_help "\ cannam@125: # '--silent' and '--verbose' options are mutually exclusive." cannam@125: # cannam@125: # func_quote_for_eval ${1+"$@"} cannam@125: # my_option_validation_result=$func_quote_for_eval_result cannam@125: # } cannam@125: # func_add_hook func_validate_options my_option_validation cannam@125: # cannam@125: # You'll alse need to manually amend $usage_message to reflect the extra cannam@125: # options you parse. It's preferable to append if you can, so that cannam@125: # multiple option parsing hooks can be added safely. cannam@125: cannam@125: cannam@125: # func_options [ARG]... cannam@125: # --------------------- cannam@125: # All the functions called inside func_options are hookable. See the cannam@125: # individual implementations for details. cannam@125: func_hookable func_options cannam@125: func_options () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_options_prep ${1+"$@"} cannam@125: eval func_parse_options \ cannam@125: ${func_options_prep_result+"$func_options_prep_result"} cannam@125: eval func_validate_options \ cannam@125: ${func_parse_options_result+"$func_parse_options_result"} cannam@125: cannam@125: eval func_run_hooks func_options \ cannam@125: ${func_validate_options_result+"$func_validate_options_result"} cannam@125: cannam@125: # save modified positional parameters for caller cannam@125: func_options_result=$func_run_hooks_result cannam@125: } cannam@125: cannam@125: cannam@125: # func_options_prep [ARG]... cannam@125: # -------------------------- cannam@125: # All initialisations required before starting the option parse loop. cannam@125: # Note that when calling hook functions, we pass through the list of cannam@125: # positional parameters. If a hook function modifies that list, and cannam@125: # needs to propogate that back to rest of this script, then the complete cannam@125: # modified list must be put in 'func_run_hooks_result' before cannam@125: # returning. cannam@125: func_hookable func_options_prep cannam@125: func_options_prep () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # Option defaults: cannam@125: opt_verbose=false cannam@125: opt_warning_types= cannam@125: cannam@125: func_run_hooks func_options_prep ${1+"$@"} cannam@125: cannam@125: # save modified positional parameters for caller cannam@125: func_options_prep_result=$func_run_hooks_result cannam@125: } cannam@125: cannam@125: cannam@125: # func_parse_options [ARG]... cannam@125: # --------------------------- cannam@125: # The main option parsing loop. cannam@125: func_hookable func_parse_options cannam@125: func_parse_options () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_parse_options_result= cannam@125: cannam@125: # this just eases exit handling cannam@125: while test $# -gt 0; do cannam@125: # Defer to hook functions for initial option parsing, so they cannam@125: # get priority in the event of reusing an option name. cannam@125: func_run_hooks func_parse_options ${1+"$@"} cannam@125: cannam@125: # Adjust func_parse_options positional parameters to match cannam@125: eval set dummy "$func_run_hooks_result"; shift cannam@125: cannam@125: # Break out of the loop if we already parsed every option. cannam@125: test $# -gt 0 || break cannam@125: cannam@125: _G_opt=$1 cannam@125: shift cannam@125: case $_G_opt in cannam@125: --debug|-x) debug_cmd='set -x' cannam@125: func_echo "enabling shell trace mode" cannam@125: $debug_cmd cannam@125: ;; cannam@125: cannam@125: --no-warnings|--no-warning|--no-warn) cannam@125: set dummy --warnings none ${1+"$@"} cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --warnings|--warning|-W) cannam@125: test $# = 0 && func_missing_arg $_G_opt && break cannam@125: case " $warning_categories $1" in cannam@125: *" $1 "*) cannam@125: # trailing space prevents matching last $1 above cannam@125: func_append_uniq opt_warning_types " $1" cannam@125: ;; cannam@125: *all) cannam@125: opt_warning_types=$warning_categories cannam@125: ;; cannam@125: *none) cannam@125: opt_warning_types=none cannam@125: warning_func=: cannam@125: ;; cannam@125: *error) cannam@125: opt_warning_types=$warning_categories cannam@125: warning_func=func_fatal_error cannam@125: ;; cannam@125: *) cannam@125: func_fatal_error \ cannam@125: "unsupported warning category: '$1'" cannam@125: ;; cannam@125: esac cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --verbose|-v) opt_verbose=: ;; cannam@125: --version) func_version ;; cannam@125: -\?|-h) func_usage ;; cannam@125: --help) func_help ;; cannam@125: cannam@125: # Separate optargs to long options (plugins may need this): cannam@125: --*=*) func_split_equals "$_G_opt" cannam@125: set dummy "$func_split_equals_lhs" \ cannam@125: "$func_split_equals_rhs" ${1+"$@"} cannam@125: shift cannam@125: ;; cannam@125: cannam@125: # Separate optargs to short options: cannam@125: -W*) cannam@125: func_split_short_opt "$_G_opt" cannam@125: set dummy "$func_split_short_opt_name" \ cannam@125: "$func_split_short_opt_arg" ${1+"$@"} cannam@125: shift cannam@125: ;; cannam@125: cannam@125: # Separate non-argument short options: cannam@125: -\?*|-h*|-v*|-x*) cannam@125: func_split_short_opt "$_G_opt" cannam@125: set dummy "$func_split_short_opt_name" \ cannam@125: "-$func_split_short_opt_arg" ${1+"$@"} cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --) break ;; cannam@125: -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; cannam@125: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # save modified positional parameters for caller cannam@125: func_quote_for_eval ${1+"$@"} cannam@125: func_parse_options_result=$func_quote_for_eval_result cannam@125: } cannam@125: cannam@125: cannam@125: # func_validate_options [ARG]... cannam@125: # ------------------------------ cannam@125: # Perform any sanity checks on option settings and/or unconsumed cannam@125: # arguments. cannam@125: func_hookable func_validate_options cannam@125: func_validate_options () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # Display all warnings if -W was not given. cannam@125: test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" cannam@125: cannam@125: func_run_hooks func_validate_options ${1+"$@"} cannam@125: cannam@125: # Bail if the options were screwed! cannam@125: $exit_cmd $EXIT_FAILURE cannam@125: cannam@125: # save modified positional parameters for caller cannam@125: func_validate_options_result=$func_run_hooks_result cannam@125: } cannam@125: cannam@125: cannam@125: cannam@125: ## ----------------- ## cannam@125: ## Helper functions. ## cannam@125: ## ----------------- ## cannam@125: cannam@125: # This section contains the helper functions used by the rest of the cannam@125: # hookable option parser framework in ascii-betical order. cannam@125: cannam@125: cannam@125: # func_fatal_help ARG... cannam@125: # ---------------------- cannam@125: # Echo program name prefixed message to standard error, followed by cannam@125: # a help hint, and exit. cannam@125: func_fatal_help () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval \$ECHO \""Usage: $usage"\" cannam@125: eval \$ECHO \""$fatal_help"\" cannam@125: func_error ${1+"$@"} cannam@125: exit $EXIT_FAILURE cannam@125: } cannam@125: cannam@125: cannam@125: # func_help cannam@125: # --------- cannam@125: # Echo long help message to standard output and exit. cannam@125: func_help () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_usage_message cannam@125: $ECHO "$long_help_message" cannam@125: exit 0 cannam@125: } cannam@125: cannam@125: cannam@125: # func_missing_arg ARGNAME cannam@125: # ------------------------ cannam@125: # Echo program name prefixed message to standard error and set global cannam@125: # exit_cmd. cannam@125: func_missing_arg () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_error "Missing argument for '$1'." cannam@125: exit_cmd=exit cannam@125: } cannam@125: cannam@125: cannam@125: # func_split_equals STRING cannam@125: # ------------------------ cannam@125: # Set func_split_equals_lhs and func_split_equals_rhs shell variables after cannam@125: # splitting STRING at the '=' sign. cannam@125: test -z "$_G_HAVE_XSI_OPS" \ cannam@125: && (eval 'x=a/b/c; cannam@125: test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ cannam@125: && _G_HAVE_XSI_OPS=yes cannam@125: cannam@125: if test yes = "$_G_HAVE_XSI_OPS" cannam@125: then cannam@125: # This is an XSI compatible shell, allowing a faster implementation... cannam@125: eval 'func_split_equals () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_split_equals_lhs=${1%%=*} cannam@125: func_split_equals_rhs=${1#*=} cannam@125: test "x$func_split_equals_lhs" = "x$1" \ cannam@125: && func_split_equals_rhs= cannam@125: }' cannam@125: else cannam@125: # ...otherwise fall back to using expr, which is often a shell builtin. cannam@125: func_split_equals () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` cannam@125: func_split_equals_rhs= cannam@125: test "x$func_split_equals_lhs" = "x$1" \ cannam@125: || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` cannam@125: } cannam@125: fi #func_split_equals cannam@125: cannam@125: cannam@125: # func_split_short_opt SHORTOPT cannam@125: # ----------------------------- cannam@125: # Set func_split_short_opt_name and func_split_short_opt_arg shell cannam@125: # variables after splitting SHORTOPT after the 2nd character. cannam@125: if test yes = "$_G_HAVE_XSI_OPS" cannam@125: then cannam@125: # This is an XSI compatible shell, allowing a faster implementation... cannam@125: eval 'func_split_short_opt () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_split_short_opt_arg=${1#??} cannam@125: func_split_short_opt_name=${1%"$func_split_short_opt_arg"} cannam@125: }' cannam@125: else cannam@125: # ...otherwise fall back to using expr, which is often a shell builtin. cannam@125: func_split_short_opt () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` cannam@125: func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` cannam@125: } cannam@125: fi #func_split_short_opt cannam@125: cannam@125: cannam@125: # func_usage cannam@125: # ---------- cannam@125: # Echo short help message to standard output and exit. cannam@125: func_usage () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_usage_message cannam@125: $ECHO "Run '$progname --help |${PAGER-more}' for full usage" cannam@125: exit 0 cannam@125: } cannam@125: cannam@125: cannam@125: # func_usage_message cannam@125: # ------------------ cannam@125: # Echo short help message to standard output. cannam@125: func_usage_message () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: eval \$ECHO \""Usage: $usage"\" cannam@125: echo cannam@125: $SED -n 's|^# || cannam@125: /^Written by/{ cannam@125: x;p;x cannam@125: } cannam@125: h cannam@125: /^Written by/q' < "$progpath" cannam@125: echo cannam@125: eval \$ECHO \""$usage_message"\" cannam@125: } cannam@125: cannam@125: cannam@125: # func_version cannam@125: # ------------ cannam@125: # Echo version message to standard output and exit. cannam@125: func_version () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: printf '%s\n' "$progname $scriptversion" cannam@125: $SED -n ' cannam@125: /(C)/!b go cannam@125: :more cannam@125: /\./!{ cannam@125: N cannam@125: s|\n# | | cannam@125: b more cannam@125: } cannam@125: :go cannam@125: /^# Written by /,/# warranty; / { cannam@125: s|^# || cannam@125: s|^# *$|| cannam@125: s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| cannam@125: p cannam@125: } cannam@125: /^# Written by / { cannam@125: s|^# || cannam@125: p cannam@125: } cannam@125: /^warranty; /q' < "$progpath" cannam@125: cannam@125: exit $? cannam@125: } cannam@125: cannam@125: cannam@125: # Local variables: cannam@125: # mode: shell-script cannam@125: # sh-indentation: 2 cannam@125: # eval: (add-hook 'before-save-hook 'time-stamp) cannam@125: # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" cannam@125: # time-stamp-time-zone: "UTC" cannam@125: # End: cannam@125: cannam@125: # Set a version string. cannam@125: scriptversion='(GNU libtool) 2.4.6' cannam@125: cannam@125: cannam@125: # func_echo ARG... cannam@125: # ---------------- cannam@125: # Libtool also displays the current mode in messages, so override cannam@125: # funclib.sh func_echo with this custom definition. cannam@125: func_echo () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: _G_message=$* cannam@125: cannam@125: func_echo_IFS=$IFS cannam@125: IFS=$nl cannam@125: for _G_line in $_G_message; do cannam@125: IFS=$func_echo_IFS cannam@125: $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" cannam@125: done cannam@125: IFS=$func_echo_IFS cannam@125: } cannam@125: cannam@125: cannam@125: # func_warning ARG... cannam@125: # ------------------- cannam@125: # Libtool warnings are not categorized, so override funclib.sh cannam@125: # func_warning with this simpler definition. cannam@125: func_warning () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $warning_func ${1+"$@"} cannam@125: } cannam@125: cannam@125: cannam@125: ## ---------------- ## cannam@125: ## Options parsing. ## cannam@125: ## ---------------- ## cannam@125: cannam@125: # Hook in the functions to make sure our own options are parsed during cannam@125: # the option parsing loop. cannam@125: cannam@125: usage='$progpath [OPTION]... [MODE-ARG]...' cannam@125: cannam@125: # Short help message in response to '-h'. cannam@125: usage_message="Options: cannam@125: --config show all configuration variables cannam@125: --debug enable verbose shell tracing cannam@125: -n, --dry-run display commands without modifying any files cannam@125: --features display basic configuration information and exit cannam@125: --mode=MODE use operation mode MODE cannam@125: --no-warnings equivalent to '-Wnone' cannam@125: --preserve-dup-deps don't remove duplicate dependency libraries cannam@125: --quiet, --silent don't print informational messages cannam@125: --tag=TAG use configuration variables from tag TAG cannam@125: -v, --verbose print more informational messages than default cannam@125: --version print version information cannam@125: -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] cannam@125: -h, --help, --help-all print short, long, or detailed help message cannam@125: " cannam@125: cannam@125: # Additional text appended to 'usage_message' in response to '--help'. cannam@125: func_help () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_usage_message cannam@125: $ECHO "$long_help_message cannam@125: cannam@125: MODE must be one of the following: cannam@125: cannam@125: clean remove files from the build directory cannam@125: compile compile a source file into a libtool object cannam@125: execute automatically set library path, then run a program cannam@125: finish complete the installation of libtool libraries cannam@125: install install libraries or executables cannam@125: link create a library or an executable cannam@125: uninstall remove libraries from an installed directory cannam@125: cannam@125: MODE-ARGS vary depending on the MODE. When passed as first option, cannam@125: '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. cannam@125: Try '$progname --help --mode=MODE' for a more detailed description of MODE. cannam@125: cannam@125: When reporting a bug, please describe a test case to reproduce it and cannam@125: include the following information: cannam@125: cannam@125: host-triplet: $host cannam@125: shell: $SHELL cannam@125: compiler: $LTCC cannam@125: compiler flags: $LTCFLAGS cannam@125: linker: $LD (gnu? $with_gnu_ld) cannam@125: version: $progname (GNU libtool) 2.4.6 cannam@125: automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` cannam@125: autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` cannam@125: cannam@125: Report bugs to . cannam@125: GNU libtool home page: . cannam@125: General help using GNU software: ." cannam@125: exit 0 cannam@125: } cannam@125: cannam@125: cannam@125: # func_lo2o OBJECT-NAME cannam@125: # --------------------- cannam@125: # Transform OBJECT-NAME from a '.lo' suffix to the platform specific cannam@125: # object suffix. cannam@125: cannam@125: lo2o=s/\\.lo\$/.$objext/ cannam@125: o2lo=s/\\.$objext\$/.lo/ cannam@125: cannam@125: if test yes = "$_G_HAVE_XSI_OPS"; then cannam@125: eval 'func_lo2o () cannam@125: { cannam@125: case $1 in cannam@125: *.lo) func_lo2o_result=${1%.lo}.$objext ;; cannam@125: * ) func_lo2o_result=$1 ;; cannam@125: esac cannam@125: }' cannam@125: cannam@125: # func_xform LIBOBJ-OR-SOURCE cannam@125: # --------------------------- cannam@125: # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) cannam@125: # suffix to a '.lo' libtool-object suffix. cannam@125: eval 'func_xform () cannam@125: { cannam@125: func_xform_result=${1%.*}.lo cannam@125: }' cannam@125: else cannam@125: # ...otherwise fall back to using sed. cannam@125: func_lo2o () cannam@125: { cannam@125: func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` cannam@125: } cannam@125: cannam@125: func_xform () cannam@125: { cannam@125: func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` cannam@125: } cannam@125: fi cannam@125: cannam@125: cannam@125: # func_fatal_configuration ARG... cannam@125: # ------------------------------- cannam@125: # Echo program name prefixed message to standard error, followed by cannam@125: # a configuration failure hint, and exit. cannam@125: func_fatal_configuration () cannam@125: { cannam@125: func__fatal_error ${1+"$@"} \ cannam@125: "See the $PACKAGE documentation for more information." \ cannam@125: "Fatal configuration error." cannam@125: } cannam@125: cannam@125: cannam@125: # func_config cannam@125: # ----------- cannam@125: # Display the configuration for all the tags in this script. cannam@125: func_config () cannam@125: { cannam@125: re_begincf='^# ### BEGIN LIBTOOL' cannam@125: re_endcf='^# ### END LIBTOOL' cannam@125: cannam@125: # Default configuration. cannam@125: $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" cannam@125: cannam@125: # Now print the configurations for the tags. cannam@125: for tagname in $taglist; do cannam@125: $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" cannam@125: done cannam@125: cannam@125: exit $? cannam@125: } cannam@125: cannam@125: cannam@125: # func_features cannam@125: # ------------- cannam@125: # Display the features supported by this script. cannam@125: func_features () cannam@125: { cannam@125: echo "host: $host" cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: echo "enable shared libraries" cannam@125: else cannam@125: echo "disable shared libraries" cannam@125: fi cannam@125: if test yes = "$build_old_libs"; then cannam@125: echo "enable static libraries" cannam@125: else cannam@125: echo "disable static libraries" cannam@125: fi cannam@125: cannam@125: exit $? cannam@125: } cannam@125: cannam@125: cannam@125: # func_enable_tag TAGNAME cannam@125: # ----------------------- cannam@125: # Verify that TAGNAME is valid, and either flag an error and exit, or cannam@125: # enable the TAGNAME tag. We also add TAGNAME to the global $taglist cannam@125: # variable here. cannam@125: func_enable_tag () cannam@125: { cannam@125: # Global variable: cannam@125: tagname=$1 cannam@125: cannam@125: re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" cannam@125: re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" cannam@125: sed_extractcf=/$re_begincf/,/$re_endcf/p cannam@125: cannam@125: # Validate tagname. cannam@125: case $tagname in cannam@125: *[!-_A-Za-z0-9,/]*) cannam@125: func_fatal_error "invalid tag name: $tagname" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Don't test for the "default" C tag, as we know it's cannam@125: # there but not specially marked. cannam@125: case $tagname in cannam@125: CC) ;; cannam@125: *) cannam@125: if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then cannam@125: taglist="$taglist $tagname" cannam@125: cannam@125: # Evaluate the configuration. Be careful to quote the path cannam@125: # and the sed script, to avoid splitting on whitespace, but cannam@125: # also don't use non-portable quotes within backquotes within cannam@125: # quotes we have to do it in 2 steps: cannam@125: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` cannam@125: eval "$extractedcf" cannam@125: else cannam@125: func_error "ignoring unknown tag $tagname" cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: cannam@125: # func_check_version_match cannam@125: # ------------------------ cannam@125: # Ensure that we are using m4 macros, and libtool script from the same cannam@125: # release of libtool. cannam@125: func_check_version_match () cannam@125: { cannam@125: if test "$package_revision" != "$macro_revision"; then cannam@125: if test "$VERSION" != "$macro_version"; then cannam@125: if test -z "$macro_version"; then cannam@125: cat >&2 <<_LT_EOF cannam@125: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the cannam@125: $progname: definition of this LT_INIT comes from an older release. cannam@125: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION cannam@125: $progname: and run autoconf again. cannam@125: _LT_EOF cannam@125: else cannam@125: cat >&2 <<_LT_EOF cannam@125: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the cannam@125: $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. cannam@125: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION cannam@125: $progname: and run autoconf again. cannam@125: _LT_EOF cannam@125: fi cannam@125: else cannam@125: cat >&2 <<_LT_EOF cannam@125: $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, cannam@125: $progname: but the definition of this LT_INIT comes from revision $macro_revision. cannam@125: $progname: You should recreate aclocal.m4 with macros from revision $package_revision cannam@125: $progname: of $PACKAGE $VERSION and run autoconf again. cannam@125: _LT_EOF cannam@125: fi cannam@125: cannam@125: exit $EXIT_MISMATCH cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: # libtool_options_prep [ARG]... cannam@125: # ----------------------------- cannam@125: # Preparation for options parsed by libtool. cannam@125: libtool_options_prep () cannam@125: { cannam@125: $debug_mode cannam@125: cannam@125: # Option defaults: cannam@125: opt_config=false cannam@125: opt_dlopen= cannam@125: opt_dry_run=false cannam@125: opt_help=false cannam@125: opt_mode= cannam@125: opt_preserve_dup_deps=false cannam@125: opt_quiet=false cannam@125: cannam@125: nonopt= cannam@125: preserve_args= cannam@125: cannam@125: # Shorthand for --mode=foo, only valid as the first argument cannam@125: case $1 in cannam@125: clean|clea|cle|cl) cannam@125: shift; set dummy --mode clean ${1+"$@"}; shift cannam@125: ;; cannam@125: compile|compil|compi|comp|com|co|c) cannam@125: shift; set dummy --mode compile ${1+"$@"}; shift cannam@125: ;; cannam@125: execute|execut|execu|exec|exe|ex|e) cannam@125: shift; set dummy --mode execute ${1+"$@"}; shift cannam@125: ;; cannam@125: finish|finis|fini|fin|fi|f) cannam@125: shift; set dummy --mode finish ${1+"$@"}; shift cannam@125: ;; cannam@125: install|instal|insta|inst|ins|in|i) cannam@125: shift; set dummy --mode install ${1+"$@"}; shift cannam@125: ;; cannam@125: link|lin|li|l) cannam@125: shift; set dummy --mode link ${1+"$@"}; shift cannam@125: ;; cannam@125: uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) cannam@125: shift; set dummy --mode uninstall ${1+"$@"}; shift cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Pass back the list of options. cannam@125: func_quote_for_eval ${1+"$@"} cannam@125: libtool_options_prep_result=$func_quote_for_eval_result cannam@125: } cannam@125: func_add_hook func_options_prep libtool_options_prep cannam@125: cannam@125: cannam@125: # libtool_parse_options [ARG]... cannam@125: # --------------------------------- cannam@125: # Provide handling for libtool specific options. cannam@125: libtool_parse_options () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # Perform our own loop to consume as many options as possible in cannam@125: # each iteration. cannam@125: while test $# -gt 0; do cannam@125: _G_opt=$1 cannam@125: shift cannam@125: case $_G_opt in cannam@125: --dry-run|--dryrun|-n) cannam@125: opt_dry_run=: cannam@125: ;; cannam@125: cannam@125: --config) func_config ;; cannam@125: cannam@125: --dlopen|-dlopen) cannam@125: opt_dlopen="${opt_dlopen+$opt_dlopen cannam@125: }$1" cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --preserve-dup-deps) cannam@125: opt_preserve_dup_deps=: ;; cannam@125: cannam@125: --features) func_features ;; cannam@125: cannam@125: --finish) set dummy --mode finish ${1+"$@"}; shift ;; cannam@125: cannam@125: --help) opt_help=: ;; cannam@125: cannam@125: --help-all) opt_help=': help-all' ;; cannam@125: cannam@125: --mode) test $# = 0 && func_missing_arg $_G_opt && break cannam@125: opt_mode=$1 cannam@125: case $1 in cannam@125: # Valid mode arguments: cannam@125: clean|compile|execute|finish|install|link|relink|uninstall) ;; cannam@125: cannam@125: # Catch anything else as an error cannam@125: *) func_error "invalid argument for $_G_opt" cannam@125: exit_cmd=exit cannam@125: break cannam@125: ;; cannam@125: esac cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --no-silent|--no-quiet) cannam@125: opt_quiet=false cannam@125: func_append preserve_args " $_G_opt" cannam@125: ;; cannam@125: cannam@125: --no-warnings|--no-warning|--no-warn) cannam@125: opt_warning=false cannam@125: func_append preserve_args " $_G_opt" cannam@125: ;; cannam@125: cannam@125: --no-verbose) cannam@125: opt_verbose=false cannam@125: func_append preserve_args " $_G_opt" cannam@125: ;; cannam@125: cannam@125: --silent|--quiet) cannam@125: opt_quiet=: cannam@125: opt_verbose=false cannam@125: func_append preserve_args " $_G_opt" cannam@125: ;; cannam@125: cannam@125: --tag) test $# = 0 && func_missing_arg $_G_opt && break cannam@125: opt_tag=$1 cannam@125: func_append preserve_args " $_G_opt $1" cannam@125: func_enable_tag "$1" cannam@125: shift cannam@125: ;; cannam@125: cannam@125: --verbose|-v) opt_quiet=false cannam@125: opt_verbose=: cannam@125: func_append preserve_args " $_G_opt" cannam@125: ;; cannam@125: cannam@125: # An option not handled by this hook function: cannam@125: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: cannam@125: # save modified positional parameters for caller cannam@125: func_quote_for_eval ${1+"$@"} cannam@125: libtool_parse_options_result=$func_quote_for_eval_result cannam@125: } cannam@125: func_add_hook func_parse_options libtool_parse_options cannam@125: cannam@125: cannam@125: cannam@125: # libtool_validate_options [ARG]... cannam@125: # --------------------------------- cannam@125: # Perform any sanity checks on option settings and/or unconsumed cannam@125: # arguments. cannam@125: libtool_validate_options () cannam@125: { cannam@125: # save first non-option argument cannam@125: if test 0 -lt $#; then cannam@125: nonopt=$1 cannam@125: shift cannam@125: fi cannam@125: cannam@125: # preserve --debug cannam@125: test : = "$debug_cmd" || func_append preserve_args " --debug" cannam@125: cannam@125: case $host in cannam@125: # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 cannam@125: # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 cannam@125: *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) cannam@125: # don't eliminate duplications in $postdeps and $predeps cannam@125: opt_duplicate_compiler_generated_deps=: cannam@125: ;; cannam@125: *) cannam@125: opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps cannam@125: ;; cannam@125: esac cannam@125: cannam@125: $opt_help || { cannam@125: # Sanity checks first: cannam@125: func_check_version_match cannam@125: cannam@125: test yes != "$build_libtool_libs" \ cannam@125: && test yes != "$build_old_libs" \ cannam@125: && func_fatal_configuration "not configured to build any kind of library" cannam@125: cannam@125: # Darwin sucks cannam@125: eval std_shrext=\"$shrext_cmds\" cannam@125: cannam@125: # Only execute mode is allowed to have -dlopen flags. cannam@125: if test -n "$opt_dlopen" && test execute != "$opt_mode"; then cannam@125: func_error "unrecognized option '-dlopen'" cannam@125: $ECHO "$help" 1>&2 cannam@125: exit $EXIT_FAILURE cannam@125: fi cannam@125: cannam@125: # Change the help message to a mode-specific one. cannam@125: generic_help=$help cannam@125: help="Try '$progname --help --mode=$opt_mode' for more information." cannam@125: } cannam@125: cannam@125: # Pass back the unparsed argument list cannam@125: func_quote_for_eval ${1+"$@"} cannam@125: libtool_validate_options_result=$func_quote_for_eval_result cannam@125: } cannam@125: func_add_hook func_validate_options libtool_validate_options cannam@125: cannam@125: cannam@125: # Process options as early as possible so that --help and --version cannam@125: # can return quickly. cannam@125: func_options ${1+"$@"} cannam@125: eval set dummy "$func_options_result"; shift cannam@125: cannam@125: cannam@125: cannam@125: ## ----------- ## cannam@125: ## Main. ## cannam@125: ## ----------- ## cannam@125: cannam@125: magic='%%%MAGIC variable%%%' cannam@125: magic_exe='%%%MAGIC EXE variable%%%' cannam@125: cannam@125: # Global variables. cannam@125: extracted_archives= cannam@125: extracted_serial=0 cannam@125: cannam@125: # If this variable is set in any of the actions, the command in it cannam@125: # will be execed at the end. This prevents here-documents from being cannam@125: # left over by shells. cannam@125: exec_cmd= cannam@125: cannam@125: cannam@125: # A function that is used when there is no print builtin or printf. cannam@125: func_fallback_echo () cannam@125: { cannam@125: eval 'cat <<_LTECHO_EOF cannam@125: $1 cannam@125: _LTECHO_EOF' cannam@125: } cannam@125: cannam@125: # func_generated_by_libtool cannam@125: # True iff stdin has been generated by Libtool. This function is only cannam@125: # a basic sanity check; it will hardly flush out determined imposters. cannam@125: func_generated_by_libtool_p () cannam@125: { cannam@125: $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 cannam@125: } cannam@125: cannam@125: # func_lalib_p file cannam@125: # True iff FILE is a libtool '.la' library or '.lo' object file. cannam@125: # This function is only a basic sanity check; it will hardly flush out cannam@125: # determined imposters. cannam@125: func_lalib_p () cannam@125: { cannam@125: test -f "$1" && cannam@125: $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p cannam@125: } cannam@125: cannam@125: # func_lalib_unsafe_p file cannam@125: # True iff FILE is a libtool '.la' library or '.lo' object file. cannam@125: # This function implements the same check as func_lalib_p without cannam@125: # resorting to external programs. To this end, it redirects stdin and cannam@125: # closes it afterwards, without saving the original file descriptor. cannam@125: # As a safety measure, use it only where a negative result would be cannam@125: # fatal anyway. Works if 'file' does not exist. cannam@125: func_lalib_unsafe_p () cannam@125: { cannam@125: lalib_p=no cannam@125: if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then cannam@125: for lalib_p_l in 1 2 3 4 cannam@125: do cannam@125: read lalib_p_line cannam@125: case $lalib_p_line in cannam@125: \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; cannam@125: esac cannam@125: done cannam@125: exec 0<&5 5<&- cannam@125: fi cannam@125: test yes = "$lalib_p" cannam@125: } cannam@125: cannam@125: # func_ltwrapper_script_p file cannam@125: # True iff FILE is a libtool wrapper script cannam@125: # This function is only a basic sanity check; it will hardly flush out cannam@125: # determined imposters. cannam@125: func_ltwrapper_script_p () cannam@125: { cannam@125: test -f "$1" && cannam@125: $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p cannam@125: } cannam@125: cannam@125: # func_ltwrapper_executable_p file cannam@125: # True iff FILE is a libtool wrapper executable cannam@125: # This function is only a basic sanity check; it will hardly flush out cannam@125: # determined imposters. cannam@125: func_ltwrapper_executable_p () cannam@125: { cannam@125: func_ltwrapper_exec_suffix= cannam@125: case $1 in cannam@125: *.exe) ;; cannam@125: *) func_ltwrapper_exec_suffix=.exe ;; cannam@125: esac cannam@125: $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 cannam@125: } cannam@125: cannam@125: # func_ltwrapper_scriptname file cannam@125: # Assumes file is an ltwrapper_executable cannam@125: # uses $file to determine the appropriate filename for a cannam@125: # temporary ltwrapper_script. cannam@125: func_ltwrapper_scriptname () cannam@125: { cannam@125: func_dirname_and_basename "$1" "" "." cannam@125: func_stripname '' '.exe' "$func_basename_result" cannam@125: func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper cannam@125: } cannam@125: cannam@125: # func_ltwrapper_p file cannam@125: # True iff FILE is a libtool wrapper script or wrapper executable cannam@125: # This function is only a basic sanity check; it will hardly flush out cannam@125: # determined imposters. cannam@125: func_ltwrapper_p () cannam@125: { cannam@125: func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" cannam@125: } cannam@125: cannam@125: cannam@125: # func_execute_cmds commands fail_cmd cannam@125: # Execute tilde-delimited COMMANDS. cannam@125: # If FAIL_CMD is given, eval that upon failure. cannam@125: # FAIL_CMD may read-access the current command in variable CMD! cannam@125: func_execute_cmds () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: save_ifs=$IFS; IFS='~' cannam@125: for cmd in $1; do cannam@125: IFS=$sp$nl cannam@125: eval cmd=\"$cmd\" cannam@125: IFS=$save_ifs cannam@125: func_show_eval "$cmd" "${2-:}" cannam@125: done cannam@125: IFS=$save_ifs cannam@125: } cannam@125: cannam@125: cannam@125: # func_source file cannam@125: # Source FILE, adding directory component if necessary. cannam@125: # Note that it is not necessary on cygwin/mingw to append a dot to cannam@125: # FILE even if both FILE and FILE.exe exist: automatic-append-.exe cannam@125: # behavior happens only for exec(3), not for open(2)! Also, sourcing cannam@125: # 'FILE.' does not work on cygwin managed mounts. cannam@125: func_source () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $1 in cannam@125: */* | *\\*) . "$1" ;; cannam@125: *) . "./$1" ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: cannam@125: # func_resolve_sysroot PATH cannam@125: # Replace a leading = in PATH with a sysroot. Store the result into cannam@125: # func_resolve_sysroot_result cannam@125: func_resolve_sysroot () cannam@125: { cannam@125: func_resolve_sysroot_result=$1 cannam@125: case $func_resolve_sysroot_result in cannam@125: =*) cannam@125: func_stripname '=' '' "$func_resolve_sysroot_result" cannam@125: func_resolve_sysroot_result=$lt_sysroot$func_stripname_result cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: # func_replace_sysroot PATH cannam@125: # If PATH begins with the sysroot, replace it with = and cannam@125: # store the result into func_replace_sysroot_result. cannam@125: func_replace_sysroot () cannam@125: { cannam@125: case $lt_sysroot:$1 in cannam@125: ?*:"$lt_sysroot"*) cannam@125: func_stripname "$lt_sysroot" '' "$1" cannam@125: func_replace_sysroot_result='='$func_stripname_result cannam@125: ;; cannam@125: *) cannam@125: # Including no sysroot. cannam@125: func_replace_sysroot_result=$1 cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: # func_infer_tag arg cannam@125: # Infer tagged configuration to use if any are available and cannam@125: # if one wasn't chosen via the "--tag" command line option. cannam@125: # Only attempt this if the compiler in the base compile cannam@125: # command doesn't match the default compiler. cannam@125: # arg is usually of the form 'gcc ...' cannam@125: func_infer_tag () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if test -n "$available_tags" && test -z "$tagname"; then cannam@125: CC_quoted= cannam@125: for arg in $CC; do cannam@125: func_append_quoted CC_quoted "$arg" cannam@125: done cannam@125: CC_expanded=`func_echo_all $CC` cannam@125: CC_quoted_expanded=`func_echo_all $CC_quoted` cannam@125: case $@ in cannam@125: # Blanks in the command may have been stripped by the calling shell, cannam@125: # but not from the CC environment variable when configure was run. cannam@125: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ cannam@125: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; cannam@125: # Blanks at the start of $base_compile will cause this to fail cannam@125: # if we don't check for them as well. cannam@125: *) cannam@125: for z in $available_tags; do cannam@125: if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then cannam@125: # Evaluate the configuration. cannam@125: eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" cannam@125: CC_quoted= cannam@125: for arg in $CC; do cannam@125: # Double-quote args containing other shell metacharacters. cannam@125: func_append_quoted CC_quoted "$arg" cannam@125: done cannam@125: CC_expanded=`func_echo_all $CC` cannam@125: CC_quoted_expanded=`func_echo_all $CC_quoted` cannam@125: case "$@ " in cannam@125: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ cannam@125: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) cannam@125: # The compiler in the base compile command matches cannam@125: # the one in the tagged configuration. cannam@125: # Assume this is the tagged configuration we want. cannam@125: tagname=$z cannam@125: break cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: done cannam@125: # If $tagname still isn't set, then no tagged configuration cannam@125: # was found and let the user know that the "--tag" command cannam@125: # line option must be used. cannam@125: if test -z "$tagname"; then cannam@125: func_echo "unable to infer tagged configuration" cannam@125: func_fatal_error "specify a tag with '--tag'" cannam@125: # else cannam@125: # func_verbose "using $tagname tagged configuration" cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: cannam@125: # func_write_libtool_object output_name pic_name nonpic_name cannam@125: # Create a libtool object file (analogous to a ".la" file), cannam@125: # but don't create it if we're doing a dry run. cannam@125: func_write_libtool_object () cannam@125: { cannam@125: write_libobj=$1 cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: write_lobj=\'$2\' cannam@125: else cannam@125: write_lobj=none cannam@125: fi cannam@125: cannam@125: if test yes = "$build_old_libs"; then cannam@125: write_oldobj=\'$3\' cannam@125: else cannam@125: write_oldobj=none cannam@125: fi cannam@125: cannam@125: $opt_dry_run || { cannam@125: cat >${write_libobj}T </dev/null` cannam@125: if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then cannam@125: func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | cannam@125: $SED -e "$sed_naive_backslashify"` cannam@125: else cannam@125: func_convert_core_file_wine_to_w32_result= cannam@125: fi cannam@125: fi cannam@125: } cannam@125: # end: func_convert_core_file_wine_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_core_path_wine_to_w32 ARG cannam@125: # Helper function used by path conversion functions when $build is *nix, and cannam@125: # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly cannam@125: # configured wine environment available, with the winepath program in $build's cannam@125: # $PATH. Assumes ARG has no leading or trailing path separator characters. cannam@125: # cannam@125: # ARG is path to be converted from $build format to win32. cannam@125: # Result is available in $func_convert_core_path_wine_to_w32_result. cannam@125: # Unconvertible file (directory) names in ARG are skipped; if no directory names cannam@125: # are convertible, then the result may be empty. cannam@125: func_convert_core_path_wine_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # unfortunately, winepath doesn't convert paths, only file names cannam@125: func_convert_core_path_wine_to_w32_result= cannam@125: if test -n "$1"; then cannam@125: oldIFS=$IFS cannam@125: IFS=: cannam@125: for func_convert_core_path_wine_to_w32_f in $1; do cannam@125: IFS=$oldIFS cannam@125: func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" cannam@125: if test -n "$func_convert_core_file_wine_to_w32_result"; then cannam@125: if test -z "$func_convert_core_path_wine_to_w32_result"; then cannam@125: func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result cannam@125: else cannam@125: func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" cannam@125: fi cannam@125: fi cannam@125: done cannam@125: IFS=$oldIFS cannam@125: fi cannam@125: } cannam@125: # end: func_convert_core_path_wine_to_w32 cannam@125: cannam@125: cannam@125: # func_cygpath ARGS... cannam@125: # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when cannam@125: # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) cannam@125: # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or cannam@125: # (2), returns the Cygwin file name or path in func_cygpath_result (input cannam@125: # file name or path is assumed to be in w32 format, as previously converted cannam@125: # from $build's *nix or MSYS format). In case (3), returns the w32 file name cannam@125: # or path in func_cygpath_result (input file name or path is assumed to be in cannam@125: # Cygwin format). Returns an empty string on error. cannam@125: # cannam@125: # ARGS are passed to cygpath, with the last one being the file name or path to cannam@125: # be converted. cannam@125: # cannam@125: # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH cannam@125: # environment variable; do not put it in $PATH. cannam@125: func_cygpath () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then cannam@125: func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` cannam@125: if test "$?" -ne 0; then cannam@125: # on failure, ensure result is empty cannam@125: func_cygpath_result= cannam@125: fi cannam@125: else cannam@125: func_cygpath_result= cannam@125: func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" cannam@125: fi cannam@125: } cannam@125: #end: func_cygpath cannam@125: cannam@125: cannam@125: # func_convert_core_msys_to_w32 ARG cannam@125: # Convert file name or path ARG from MSYS format to w32 format. Return cannam@125: # result in func_convert_core_msys_to_w32_result. cannam@125: func_convert_core_msys_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # awkward: cmd appends spaces to result cannam@125: func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | cannam@125: $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` cannam@125: } cannam@125: #end: func_convert_core_msys_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_file_check ARG1 ARG2 cannam@125: # Verify that ARG1 (a file name in $build format) was converted to $host cannam@125: # format in ARG2. Otherwise, emit an error message, but continue (resetting cannam@125: # func_to_host_file_result to ARG1). cannam@125: func_convert_file_check () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if test -z "$2" && test -n "$1"; then cannam@125: func_error "Could not determine host file name corresponding to" cannam@125: func_error " '$1'" cannam@125: func_error "Continuing, but uninstalled executables may not work." cannam@125: # Fallback: cannam@125: func_to_host_file_result=$1 cannam@125: fi cannam@125: } cannam@125: # end func_convert_file_check cannam@125: cannam@125: cannam@125: # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH cannam@125: # Verify that FROM_PATH (a path in $build format) was converted to $host cannam@125: # format in TO_PATH. Otherwise, emit an error message, but continue, resetting cannam@125: # func_to_host_file_result to a simplistic fallback value (see below). cannam@125: func_convert_path_check () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if test -z "$4" && test -n "$3"; then cannam@125: func_error "Could not determine the host path corresponding to" cannam@125: func_error " '$3'" cannam@125: func_error "Continuing, but uninstalled executables may not work." cannam@125: # Fallback. This is a deliberately simplistic "conversion" and cannam@125: # should not be "improved". See libtool.info. cannam@125: if test "x$1" != "x$2"; then cannam@125: lt_replace_pathsep_chars="s|$1|$2|g" cannam@125: func_to_host_path_result=`echo "$3" | cannam@125: $SED -e "$lt_replace_pathsep_chars"` cannam@125: else cannam@125: func_to_host_path_result=$3 cannam@125: fi cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_check cannam@125: cannam@125: cannam@125: # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG cannam@125: # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT cannam@125: # and appending REPL if ORIG matches BACKPAT. cannam@125: func_convert_path_front_back_pathsep () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $4 in cannam@125: $1 ) func_to_host_path_result=$3$func_to_host_path_result cannam@125: ;; cannam@125: esac cannam@125: case $4 in cannam@125: $2 ) func_append func_to_host_path_result "$3" cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: # end func_convert_path_front_back_pathsep cannam@125: cannam@125: cannam@125: ################################################## cannam@125: # $build to $host FILE NAME CONVERSION FUNCTIONS # cannam@125: ################################################## cannam@125: # invoked via '$to_host_file_cmd ARG' cannam@125: # cannam@125: # In each case, ARG is the path to be converted from $build to $host format. cannam@125: # Result will be available in $func_to_host_file_result. cannam@125: cannam@125: cannam@125: # func_to_host_file ARG cannam@125: # Converts the file name ARG from $build format to $host format. Return result cannam@125: # in func_to_host_file_result. cannam@125: func_to_host_file () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: $to_host_file_cmd "$1" cannam@125: } cannam@125: # end func_to_host_file cannam@125: cannam@125: cannam@125: # func_to_tool_file ARG LAZY cannam@125: # converts the file name ARG from $build format to toolchain format. Return cannam@125: # result in func_to_tool_file_result. If the conversion in use is listed cannam@125: # in (the comma separated) LAZY, no conversion takes place. cannam@125: func_to_tool_file () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case ,$2, in cannam@125: *,"$to_tool_file_cmd",*) cannam@125: func_to_tool_file_result=$1 cannam@125: ;; cannam@125: *) cannam@125: $to_tool_file_cmd "$1" cannam@125: func_to_tool_file_result=$func_to_host_file_result cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: # end func_to_tool_file cannam@125: cannam@125: cannam@125: # func_convert_file_noop ARG cannam@125: # Copy ARG to func_to_host_file_result. cannam@125: func_convert_file_noop () cannam@125: { cannam@125: func_to_host_file_result=$1 cannam@125: } cannam@125: # end func_convert_file_noop cannam@125: cannam@125: cannam@125: # func_convert_file_msys_to_w32 ARG cannam@125: # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic cannam@125: # conversion to w32 is not available inside the cwrapper. Returns result in cannam@125: # func_to_host_file_result. cannam@125: func_convert_file_msys_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_file_result=$1 cannam@125: if test -n "$1"; then cannam@125: func_convert_core_msys_to_w32 "$1" cannam@125: func_to_host_file_result=$func_convert_core_msys_to_w32_result cannam@125: fi cannam@125: func_convert_file_check "$1" "$func_to_host_file_result" cannam@125: } cannam@125: # end func_convert_file_msys_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_file_cygwin_to_w32 ARG cannam@125: # Convert file name ARG from Cygwin to w32 format. Returns result in cannam@125: # func_to_host_file_result. cannam@125: func_convert_file_cygwin_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_file_result=$1 cannam@125: if test -n "$1"; then cannam@125: # because $build is cygwin, we call "the" cygpath in $PATH; no need to use cannam@125: # LT_CYGPATH in this case. cannam@125: func_to_host_file_result=`cygpath -m "$1"` cannam@125: fi cannam@125: func_convert_file_check "$1" "$func_to_host_file_result" cannam@125: } cannam@125: # end func_convert_file_cygwin_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_file_nix_to_w32 ARG cannam@125: # Convert file name ARG from *nix to w32 format. Requires a wine environment cannam@125: # and a working winepath. Returns result in func_to_host_file_result. cannam@125: func_convert_file_nix_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_file_result=$1 cannam@125: if test -n "$1"; then cannam@125: func_convert_core_file_wine_to_w32 "$1" cannam@125: func_to_host_file_result=$func_convert_core_file_wine_to_w32_result cannam@125: fi cannam@125: func_convert_file_check "$1" "$func_to_host_file_result" cannam@125: } cannam@125: # end func_convert_file_nix_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_file_msys_to_cygwin ARG cannam@125: # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. cannam@125: # Returns result in func_to_host_file_result. cannam@125: func_convert_file_msys_to_cygwin () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_file_result=$1 cannam@125: if test -n "$1"; then cannam@125: func_convert_core_msys_to_w32 "$1" cannam@125: func_cygpath -u "$func_convert_core_msys_to_w32_result" cannam@125: func_to_host_file_result=$func_cygpath_result cannam@125: fi cannam@125: func_convert_file_check "$1" "$func_to_host_file_result" cannam@125: } cannam@125: # end func_convert_file_msys_to_cygwin cannam@125: cannam@125: cannam@125: # func_convert_file_nix_to_cygwin ARG cannam@125: # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed cannam@125: # in a wine environment, working winepath, and LT_CYGPATH set. Returns result cannam@125: # in func_to_host_file_result. cannam@125: func_convert_file_nix_to_cygwin () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_file_result=$1 cannam@125: if test -n "$1"; then cannam@125: # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. cannam@125: func_convert_core_file_wine_to_w32 "$1" cannam@125: func_cygpath -u "$func_convert_core_file_wine_to_w32_result" cannam@125: func_to_host_file_result=$func_cygpath_result cannam@125: fi cannam@125: func_convert_file_check "$1" "$func_to_host_file_result" cannam@125: } cannam@125: # end func_convert_file_nix_to_cygwin cannam@125: cannam@125: cannam@125: ############################################# cannam@125: # $build to $host PATH CONVERSION FUNCTIONS # cannam@125: ############################################# cannam@125: # invoked via '$to_host_path_cmd ARG' cannam@125: # cannam@125: # In each case, ARG is the path to be converted from $build to $host format. cannam@125: # The result will be available in $func_to_host_path_result. cannam@125: # cannam@125: # Path separators are also converted from $build format to $host format. If cannam@125: # ARG begins or ends with a path separator character, it is preserved (but cannam@125: # converted to $host format) on output. cannam@125: # cannam@125: # All path conversion functions are named using the following convention: cannam@125: # file name conversion function : func_convert_file_X_to_Y () cannam@125: # path conversion function : func_convert_path_X_to_Y () cannam@125: # where, for any given $build/$host combination the 'X_to_Y' value is the cannam@125: # same. If conversion functions are added for new $build/$host combinations, cannam@125: # the two new functions must follow this pattern, or func_init_to_host_path_cmd cannam@125: # will break. cannam@125: cannam@125: cannam@125: # func_init_to_host_path_cmd cannam@125: # Ensures that function "pointer" variable $to_host_path_cmd is set to the cannam@125: # appropriate value, based on the value of $to_host_file_cmd. cannam@125: to_host_path_cmd= cannam@125: func_init_to_host_path_cmd () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if test -z "$to_host_path_cmd"; then cannam@125: func_stripname 'func_convert_file_' '' "$to_host_file_cmd" cannam@125: to_host_path_cmd=func_convert_path_$func_stripname_result cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: # func_to_host_path ARG cannam@125: # Converts the path ARG from $build format to $host format. Return result cannam@125: # in func_to_host_path_result. cannam@125: func_to_host_path () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_init_to_host_path_cmd cannam@125: $to_host_path_cmd "$1" cannam@125: } cannam@125: # end func_to_host_path cannam@125: cannam@125: cannam@125: # func_convert_path_noop ARG cannam@125: # Copy ARG to func_to_host_path_result. cannam@125: func_convert_path_noop () cannam@125: { cannam@125: func_to_host_path_result=$1 cannam@125: } cannam@125: # end func_convert_path_noop cannam@125: cannam@125: cannam@125: # func_convert_path_msys_to_w32 ARG cannam@125: # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic cannam@125: # conversion to w32 is not available inside the cwrapper. Returns result in cannam@125: # func_to_host_path_result. cannam@125: func_convert_path_msys_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_path_result=$1 cannam@125: if test -n "$1"; then cannam@125: # Remove leading and trailing path separator characters from ARG. MSYS cannam@125: # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; cannam@125: # and winepath ignores them completely. cannam@125: func_stripname : : "$1" cannam@125: func_to_host_path_tmp1=$func_stripname_result cannam@125: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" cannam@125: func_to_host_path_result=$func_convert_core_msys_to_w32_result cannam@125: func_convert_path_check : ";" \ cannam@125: "$func_to_host_path_tmp1" "$func_to_host_path_result" cannam@125: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_msys_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_path_cygwin_to_w32 ARG cannam@125: # Convert path ARG from Cygwin to w32 format. Returns result in cannam@125: # func_to_host_file_result. cannam@125: func_convert_path_cygwin_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_path_result=$1 cannam@125: if test -n "$1"; then cannam@125: # See func_convert_path_msys_to_w32: cannam@125: func_stripname : : "$1" cannam@125: func_to_host_path_tmp1=$func_stripname_result cannam@125: func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` cannam@125: func_convert_path_check : ";" \ cannam@125: "$func_to_host_path_tmp1" "$func_to_host_path_result" cannam@125: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_cygwin_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_path_nix_to_w32 ARG cannam@125: # Convert path ARG from *nix to w32 format. Requires a wine environment and cannam@125: # a working winepath. Returns result in func_to_host_file_result. cannam@125: func_convert_path_nix_to_w32 () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_path_result=$1 cannam@125: if test -n "$1"; then cannam@125: # See func_convert_path_msys_to_w32: cannam@125: func_stripname : : "$1" cannam@125: func_to_host_path_tmp1=$func_stripname_result cannam@125: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" cannam@125: func_to_host_path_result=$func_convert_core_path_wine_to_w32_result cannam@125: func_convert_path_check : ";" \ cannam@125: "$func_to_host_path_tmp1" "$func_to_host_path_result" cannam@125: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_nix_to_w32 cannam@125: cannam@125: cannam@125: # func_convert_path_msys_to_cygwin ARG cannam@125: # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. cannam@125: # Returns result in func_to_host_file_result. cannam@125: func_convert_path_msys_to_cygwin () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_path_result=$1 cannam@125: if test -n "$1"; then cannam@125: # See func_convert_path_msys_to_w32: cannam@125: func_stripname : : "$1" cannam@125: func_to_host_path_tmp1=$func_stripname_result cannam@125: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" cannam@125: func_cygpath -u -p "$func_convert_core_msys_to_w32_result" cannam@125: func_to_host_path_result=$func_cygpath_result cannam@125: func_convert_path_check : : \ cannam@125: "$func_to_host_path_tmp1" "$func_to_host_path_result" cannam@125: func_convert_path_front_back_pathsep ":*" "*:" : "$1" cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_msys_to_cygwin cannam@125: cannam@125: cannam@125: # func_convert_path_nix_to_cygwin ARG cannam@125: # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a cannam@125: # a wine environment, working winepath, and LT_CYGPATH set. Returns result in cannam@125: # func_to_host_file_result. cannam@125: func_convert_path_nix_to_cygwin () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_host_path_result=$1 cannam@125: if test -n "$1"; then cannam@125: # Remove leading and trailing path separator characters from cannam@125: # ARG. msys behavior is inconsistent here, cygpath turns them cannam@125: # into '.;' and ';.', and winepath ignores them completely. cannam@125: func_stripname : : "$1" cannam@125: func_to_host_path_tmp1=$func_stripname_result cannam@125: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" cannam@125: func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" cannam@125: func_to_host_path_result=$func_cygpath_result cannam@125: func_convert_path_check : : \ cannam@125: "$func_to_host_path_tmp1" "$func_to_host_path_result" cannam@125: func_convert_path_front_back_pathsep ":*" "*:" : "$1" cannam@125: fi cannam@125: } cannam@125: # end func_convert_path_nix_to_cygwin cannam@125: cannam@125: cannam@125: # func_dll_def_p FILE cannam@125: # True iff FILE is a Windows DLL '.def' file. cannam@125: # Keep in sync with _LT_DLL_DEF_P in libtool.m4 cannam@125: func_dll_def_p () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_dll_def_p_tmp=`$SED -n \ cannam@125: -e 's/^[ ]*//' \ cannam@125: -e '/^\(;.*\)*$/d' \ cannam@125: -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ cannam@125: -e q \ cannam@125: "$1"` cannam@125: test DEF = "$func_dll_def_p_tmp" cannam@125: } cannam@125: cannam@125: cannam@125: # func_mode_compile arg... cannam@125: func_mode_compile () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # Get the compilation command and the source file. cannam@125: base_compile= cannam@125: srcfile=$nonopt # always keep a non-empty value in "srcfile" cannam@125: suppress_opt=yes cannam@125: suppress_output= cannam@125: arg_mode=normal cannam@125: libobj= cannam@125: later= cannam@125: pie_flag= cannam@125: cannam@125: for arg cannam@125: do cannam@125: case $arg_mode in cannam@125: arg ) cannam@125: # do not "continue". Instead, add this to base_compile cannam@125: lastarg=$arg cannam@125: arg_mode=normal cannam@125: ;; cannam@125: cannam@125: target ) cannam@125: libobj=$arg cannam@125: arg_mode=normal cannam@125: continue cannam@125: ;; cannam@125: cannam@125: normal ) cannam@125: # Accept any command-line options. cannam@125: case $arg in cannam@125: -o) cannam@125: test -n "$libobj" && \ cannam@125: func_fatal_error "you cannot specify '-o' more than once" cannam@125: arg_mode=target cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -pie | -fpie | -fPIE) cannam@125: func_append pie_flag " $arg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -shared | -static | -prefer-pic | -prefer-non-pic) cannam@125: func_append later " $arg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -no-suppress) cannam@125: suppress_opt=no cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -Xcompiler) cannam@125: arg_mode=arg # the next one goes into the "base_compile" arg list cannam@125: continue # The current "srcfile" will either be retained or cannam@125: ;; # replaced later. I would guess that would be a bug. cannam@125: cannam@125: -Wc,*) cannam@125: func_stripname '-Wc,' '' "$arg" cannam@125: args=$func_stripname_result cannam@125: lastarg= cannam@125: save_ifs=$IFS; IFS=, cannam@125: for arg in $args; do cannam@125: IFS=$save_ifs cannam@125: func_append_quoted lastarg "$arg" cannam@125: done cannam@125: IFS=$save_ifs cannam@125: func_stripname ' ' '' "$lastarg" cannam@125: lastarg=$func_stripname_result cannam@125: cannam@125: # Add the arguments to base_compile. cannam@125: func_append base_compile " $lastarg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: *) cannam@125: # Accept the current argument as the source file. cannam@125: # The previous "srcfile" becomes the current argument. cannam@125: # cannam@125: lastarg=$srcfile cannam@125: srcfile=$arg cannam@125: ;; cannam@125: esac # case $arg cannam@125: ;; cannam@125: esac # case $arg_mode cannam@125: cannam@125: # Aesthetically quote the previous argument. cannam@125: func_append_quoted base_compile "$lastarg" cannam@125: done # for arg cannam@125: cannam@125: case $arg_mode in cannam@125: arg) cannam@125: func_fatal_error "you must specify an argument for -Xcompile" cannam@125: ;; cannam@125: target) cannam@125: func_fatal_error "you must specify a target with '-o'" cannam@125: ;; cannam@125: *) cannam@125: # Get the name of the library object. cannam@125: test -z "$libobj" && { cannam@125: func_basename "$srcfile" cannam@125: libobj=$func_basename_result cannam@125: } cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Recognize several different file suffixes. cannam@125: # If the user specifies -o file.o, it is replaced with file.lo cannam@125: case $libobj in cannam@125: *.[cCFSifmso] | \ cannam@125: *.ada | *.adb | *.ads | *.asm | \ cannam@125: *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ cannam@125: *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) cannam@125: func_xform "$libobj" cannam@125: libobj=$func_xform_result cannam@125: ;; cannam@125: esac cannam@125: cannam@125: case $libobj in cannam@125: *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; cannam@125: *) cannam@125: func_fatal_error "cannot determine name of library object from '$libobj'" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: func_infer_tag $base_compile cannam@125: cannam@125: for arg in $later; do cannam@125: case $arg in cannam@125: -shared) cannam@125: test yes = "$build_libtool_libs" \ cannam@125: || func_fatal_configuration "cannot build a shared library" cannam@125: build_old_libs=no cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -static) cannam@125: build_libtool_libs=no cannam@125: build_old_libs=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -prefer-pic) cannam@125: pic_mode=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -prefer-non-pic) cannam@125: pic_mode=no cannam@125: continue cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: func_quote_for_eval "$libobj" cannam@125: test "X$libobj" != "X$func_quote_for_eval_result" \ cannam@125: && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ cannam@125: && func_warning "libobj name '$libobj' may not contain shell special characters." cannam@125: func_dirname_and_basename "$obj" "/" "" cannam@125: objname=$func_basename_result cannam@125: xdir=$func_dirname_result cannam@125: lobj=$xdir$objdir/$objname cannam@125: cannam@125: test -z "$base_compile" && \ cannam@125: func_fatal_help "you must specify a compilation command" cannam@125: cannam@125: # Delete any leftover library objects. cannam@125: if test yes = "$build_old_libs"; then cannam@125: removelist="$obj $lobj $libobj ${libobj}T" cannam@125: else cannam@125: removelist="$lobj $libobj ${libobj}T" cannam@125: fi cannam@125: cannam@125: # On Cygwin there's no "real" PIC flag so we must build both object types cannam@125: case $host_os in cannam@125: cygwin* | mingw* | pw32* | os2* | cegcc*) cannam@125: pic_mode=default cannam@125: ;; cannam@125: esac cannam@125: if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then cannam@125: # non-PIC code in shared libraries is not supported cannam@125: pic_mode=default cannam@125: fi cannam@125: cannam@125: # Calculate the filename of the output object if compiler does cannam@125: # not support -o with -c cannam@125: if test no = "$compiler_c_o"; then cannam@125: output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext cannam@125: lockfile=$output_obj.lock cannam@125: else cannam@125: output_obj= cannam@125: need_locks=no cannam@125: lockfile= cannam@125: fi cannam@125: cannam@125: # Lock this critical section if it is needed cannam@125: # We use this script file to make the link, it avoids creating a new file cannam@125: if test yes = "$need_locks"; then cannam@125: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do cannam@125: func_echo "Waiting for $lockfile to be removed" cannam@125: sleep 2 cannam@125: done cannam@125: elif test warn = "$need_locks"; then cannam@125: if test -f "$lockfile"; then cannam@125: $ECHO "\ cannam@125: *** ERROR, $lockfile exists and contains: cannam@125: `cat $lockfile 2>/dev/null` cannam@125: cannam@125: This indicates that another process is trying to use the same cannam@125: temporary object file, and libtool could not work around it because cannam@125: your compiler does not support '-c' and '-o' together. If you cannam@125: repeat this compilation, it may succeed, by chance, but you had better cannam@125: avoid parallel builds (make -j) in this platform, or get a better cannam@125: compiler." cannam@125: cannam@125: $opt_dry_run || $RM $removelist cannam@125: exit $EXIT_FAILURE cannam@125: fi cannam@125: func_append removelist " $output_obj" cannam@125: $ECHO "$srcfile" > "$lockfile" cannam@125: fi cannam@125: cannam@125: $opt_dry_run || $RM $removelist cannam@125: func_append removelist " $lockfile" cannam@125: trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 cannam@125: cannam@125: func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 cannam@125: srcfile=$func_to_tool_file_result cannam@125: func_quote_for_eval "$srcfile" cannam@125: qsrcfile=$func_quote_for_eval_result cannam@125: cannam@125: # Only build a PIC object if we are building libtool libraries. cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: # Without this assignment, base_compile gets emptied. cannam@125: fbsd_hideous_sh_bug=$base_compile cannam@125: cannam@125: if test no != "$pic_mode"; then cannam@125: command="$base_compile $qsrcfile $pic_flag" cannam@125: else cannam@125: # Don't build PIC code cannam@125: command="$base_compile $qsrcfile" cannam@125: fi cannam@125: cannam@125: func_mkdir_p "$xdir$objdir" cannam@125: cannam@125: if test -z "$output_obj"; then cannam@125: # Place PIC objects in $objdir cannam@125: func_append command " -o $lobj" cannam@125: fi cannam@125: cannam@125: func_show_eval_locale "$command" \ cannam@125: 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' cannam@125: cannam@125: if test warn = "$need_locks" && cannam@125: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then cannam@125: $ECHO "\ cannam@125: *** ERROR, $lockfile contains: cannam@125: `cat $lockfile 2>/dev/null` cannam@125: cannam@125: but it should contain: cannam@125: $srcfile cannam@125: cannam@125: This indicates that another process is trying to use the same cannam@125: temporary object file, and libtool could not work around it because cannam@125: your compiler does not support '-c' and '-o' together. If you cannam@125: repeat this compilation, it may succeed, by chance, but you had better cannam@125: avoid parallel builds (make -j) in this platform, or get a better cannam@125: compiler." cannam@125: cannam@125: $opt_dry_run || $RM $removelist cannam@125: exit $EXIT_FAILURE cannam@125: fi cannam@125: cannam@125: # Just move the object if needed, then go on to compile the next one cannam@125: if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then cannam@125: func_show_eval '$MV "$output_obj" "$lobj"' \ cannam@125: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' cannam@125: fi cannam@125: cannam@125: # Allow error messages only from the first compilation. cannam@125: if test yes = "$suppress_opt"; then cannam@125: suppress_output=' >/dev/null 2>&1' cannam@125: fi cannam@125: fi cannam@125: cannam@125: # Only build a position-dependent object if we build old libraries. cannam@125: if test yes = "$build_old_libs"; then cannam@125: if test yes != "$pic_mode"; then cannam@125: # Don't build PIC code cannam@125: command="$base_compile $qsrcfile$pie_flag" cannam@125: else cannam@125: command="$base_compile $qsrcfile $pic_flag" cannam@125: fi cannam@125: if test yes = "$compiler_c_o"; then cannam@125: func_append command " -o $obj" cannam@125: fi cannam@125: cannam@125: # Suppress compiler output if we already did a PIC compilation. cannam@125: func_append command "$suppress_output" cannam@125: func_show_eval_locale "$command" \ cannam@125: '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' cannam@125: cannam@125: if test warn = "$need_locks" && cannam@125: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then cannam@125: $ECHO "\ cannam@125: *** ERROR, $lockfile contains: cannam@125: `cat $lockfile 2>/dev/null` cannam@125: cannam@125: but it should contain: cannam@125: $srcfile cannam@125: cannam@125: This indicates that another process is trying to use the same cannam@125: temporary object file, and libtool could not work around it because cannam@125: your compiler does not support '-c' and '-o' together. If you cannam@125: repeat this compilation, it may succeed, by chance, but you had better cannam@125: avoid parallel builds (make -j) in this platform, or get a better cannam@125: compiler." cannam@125: cannam@125: $opt_dry_run || $RM $removelist cannam@125: exit $EXIT_FAILURE cannam@125: fi cannam@125: cannam@125: # Just move the object if needed cannam@125: if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then cannam@125: func_show_eval '$MV "$output_obj" "$obj"' \ cannam@125: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' cannam@125: fi cannam@125: fi cannam@125: cannam@125: $opt_dry_run || { cannam@125: func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" cannam@125: cannam@125: # Unlock the critical section if it was locked cannam@125: if test no != "$need_locks"; then cannam@125: removelist=$lockfile cannam@125: $RM "$lockfile" cannam@125: fi cannam@125: } cannam@125: cannam@125: exit $EXIT_SUCCESS cannam@125: } cannam@125: cannam@125: $opt_help || { cannam@125: test compile = "$opt_mode" && func_mode_compile ${1+"$@"} cannam@125: } cannam@125: cannam@125: func_mode_help () cannam@125: { cannam@125: # We need to display help for each of the modes. cannam@125: case $opt_mode in cannam@125: "") cannam@125: # Generic help is extracted from the usage comments cannam@125: # at the start of this file. cannam@125: func_help cannam@125: ;; cannam@125: cannam@125: clean) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... cannam@125: cannam@125: Remove files from the build directory. cannam@125: cannam@125: RM is the name of the program to use to delete files associated with each FILE cannam@125: (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed cannam@125: to RM. cannam@125: cannam@125: If FILE is a libtool library, object or program, all the files associated cannam@125: with it are deleted. Otherwise, only FILE itself is deleted using RM." cannam@125: ;; cannam@125: cannam@125: compile) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE cannam@125: cannam@125: Compile a source file into a libtool library object. cannam@125: cannam@125: This mode accepts the following additional options: cannam@125: cannam@125: -o OUTPUT-FILE set the output file name to OUTPUT-FILE cannam@125: -no-suppress do not suppress compiler output for multiple passes cannam@125: -prefer-pic try to build PIC objects only cannam@125: -prefer-non-pic try to build non-PIC objects only cannam@125: -shared do not build a '.o' file suitable for static linking cannam@125: -static only build a '.o' file suitable for static linking cannam@125: -Wc,FLAG pass FLAG directly to the compiler cannam@125: cannam@125: COMPILE-COMMAND is a command to be used in creating a 'standard' object file cannam@125: from the given SOURCEFILE. cannam@125: cannam@125: The output file name is determined by removing the directory component from cannam@125: SOURCEFILE, then substituting the C source code suffix '.c' with the cannam@125: library object suffix, '.lo'." cannam@125: ;; cannam@125: cannam@125: execute) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... cannam@125: cannam@125: Automatically set library path, then run a program. cannam@125: cannam@125: This mode accepts the following additional options: cannam@125: cannam@125: -dlopen FILE add the directory containing FILE to the library path cannam@125: cannam@125: This mode sets the library path environment variable according to '-dlopen' cannam@125: flags. cannam@125: cannam@125: If any of the ARGS are libtool executable wrappers, then they are translated cannam@125: into their corresponding uninstalled binary, and any of their required library cannam@125: directories are added to the library path. cannam@125: cannam@125: Then, COMMAND is executed, with ARGS as arguments." cannam@125: ;; cannam@125: cannam@125: finish) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... cannam@125: cannam@125: Complete the installation of libtool libraries. cannam@125: cannam@125: Each LIBDIR is a directory that contains libtool libraries. cannam@125: cannam@125: The commands that this mode executes may require superuser privileges. Use cannam@125: the '--dry-run' option if you just want to see what would be executed." cannam@125: ;; cannam@125: cannam@125: install) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... cannam@125: cannam@125: Install executables or libraries. cannam@125: cannam@125: INSTALL-COMMAND is the installation command. The first component should be cannam@125: either the 'install' or 'cp' program. cannam@125: cannam@125: The following components of INSTALL-COMMAND are treated specially: cannam@125: cannam@125: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation cannam@125: cannam@125: The rest of the components are interpreted as arguments to that command (only cannam@125: BSD-compatible install options are recognized)." cannam@125: ;; cannam@125: cannam@125: link) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... cannam@125: cannam@125: Link object files or libraries together to form another library, or to cannam@125: create an executable program. cannam@125: cannam@125: LINK-COMMAND is a command using the C compiler that you would use to create cannam@125: a program from several object files. cannam@125: cannam@125: The following components of LINK-COMMAND are treated specially: cannam@125: cannam@125: -all-static do not do any dynamic linking at all cannam@125: -avoid-version do not add a version suffix if possible cannam@125: -bindir BINDIR specify path to binaries directory (for systems where cannam@125: libraries must be found in the PATH setting at runtime) cannam@125: -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime cannam@125: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols cannam@125: -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) cannam@125: -export-symbols SYMFILE cannam@125: try to export only the symbols listed in SYMFILE cannam@125: -export-symbols-regex REGEX cannam@125: try to export only the symbols matching REGEX cannam@125: -LLIBDIR search LIBDIR for required installed libraries cannam@125: -lNAME OUTPUT-FILE requires the installed library libNAME cannam@125: -module build a library that can dlopened cannam@125: -no-fast-install disable the fast-install mode cannam@125: -no-install link a not-installable executable cannam@125: -no-undefined declare that a library does not refer to external symbols cannam@125: -o OUTPUT-FILE create OUTPUT-FILE from the specified objects cannam@125: -objectlist FILE use a list of object files found in FILE to specify objects cannam@125: -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) cannam@125: -precious-files-regex REGEX cannam@125: don't remove output files matching REGEX cannam@125: -release RELEASE specify package release information cannam@125: -rpath LIBDIR the created library will eventually be installed in LIBDIR cannam@125: -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries cannam@125: -shared only do dynamic linking of libtool libraries cannam@125: -shrext SUFFIX override the standard shared library file extension cannam@125: -static do not do any dynamic linking of uninstalled libtool libraries cannam@125: -static-libtool-libs cannam@125: do not do any dynamic linking of libtool libraries cannam@125: -version-info CURRENT[:REVISION[:AGE]] cannam@125: specify library version info [each variable defaults to 0] cannam@125: -weak LIBNAME declare that the target provides the LIBNAME interface cannam@125: -Wc,FLAG cannam@125: -Xcompiler FLAG pass linker-specific FLAG directly to the compiler cannam@125: -Wl,FLAG cannam@125: -Xlinker FLAG pass linker-specific FLAG directly to the linker cannam@125: -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) cannam@125: cannam@125: All other options (arguments beginning with '-') are ignored. cannam@125: cannam@125: Every other argument is treated as a filename. Files ending in '.la' are cannam@125: treated as uninstalled libtool libraries, other files are standard or library cannam@125: object files. cannam@125: cannam@125: If the OUTPUT-FILE ends in '.la', then a libtool library is created, cannam@125: only library objects ('.lo' files) may be specified, and '-rpath' is cannam@125: required, except when creating a convenience library. cannam@125: cannam@125: If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created cannam@125: using 'ar' and 'ranlib', or on Windows using 'lib'. cannam@125: cannam@125: If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file cannam@125: is created, otherwise an executable program is created." cannam@125: ;; cannam@125: cannam@125: uninstall) cannam@125: $ECHO \ cannam@125: "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... cannam@125: cannam@125: Remove libraries from an installation directory. cannam@125: cannam@125: RM is the name of the program to use to delete files associated with each FILE cannam@125: (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed cannam@125: to RM. cannam@125: cannam@125: If FILE is a libtool library, all the files associated with it are deleted. cannam@125: Otherwise, only FILE itself is deleted using RM." cannam@125: ;; cannam@125: cannam@125: *) cannam@125: func_fatal_help "invalid operation mode '$opt_mode'" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: echo cannam@125: $ECHO "Try '$progname --help' for more information about other modes." cannam@125: } cannam@125: cannam@125: # Now that we've collected a possible --mode arg, show help if necessary cannam@125: if $opt_help; then cannam@125: if test : = "$opt_help"; then cannam@125: func_mode_help cannam@125: else cannam@125: { cannam@125: func_help noexit cannam@125: for opt_mode in compile link execute install finish uninstall clean; do cannam@125: func_mode_help cannam@125: done cannam@125: } | $SED -n '1p; 2,$s/^Usage:/ or: /p' cannam@125: { cannam@125: func_help noexit cannam@125: for opt_mode in compile link execute install finish uninstall clean; do cannam@125: echo cannam@125: func_mode_help cannam@125: done cannam@125: } | cannam@125: $SED '1d cannam@125: /^When reporting/,/^Report/{ cannam@125: H cannam@125: d cannam@125: } cannam@125: $x cannam@125: /information about other modes/d cannam@125: /more detailed .*MODE/d cannam@125: s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' cannam@125: fi cannam@125: exit $? cannam@125: fi cannam@125: cannam@125: cannam@125: # func_mode_execute arg... cannam@125: func_mode_execute () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # The first argument is the command name. cannam@125: cmd=$nonopt cannam@125: test -z "$cmd" && \ cannam@125: func_fatal_help "you must specify a COMMAND" cannam@125: cannam@125: # Handle -dlopen flags immediately. cannam@125: for file in $opt_dlopen; do cannam@125: test -f "$file" \ cannam@125: || func_fatal_help "'$file' is not a file" cannam@125: cannam@125: dir= cannam@125: case $file in cannam@125: *.la) cannam@125: func_resolve_sysroot "$file" cannam@125: file=$func_resolve_sysroot_result cannam@125: cannam@125: # Check to see that this really is a libtool archive. cannam@125: func_lalib_unsafe_p "$file" \ cannam@125: || func_fatal_help "'$lib' is not a valid libtool archive" cannam@125: cannam@125: # Read the libtool library. cannam@125: dlname= cannam@125: library_names= cannam@125: func_source "$file" cannam@125: cannam@125: # Skip this library if it cannot be dlopened. cannam@125: if test -z "$dlname"; then cannam@125: # Warn if it was a shared library. cannam@125: test -n "$library_names" && \ cannam@125: func_warning "'$file' was not linked with '-export-dynamic'" cannam@125: continue cannam@125: fi cannam@125: cannam@125: func_dirname "$file" "" "." cannam@125: dir=$func_dirname_result cannam@125: cannam@125: if test -f "$dir/$objdir/$dlname"; then cannam@125: func_append dir "/$objdir" cannam@125: else cannam@125: if test ! -f "$dir/$dlname"; then cannam@125: func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: cannam@125: *.lo) cannam@125: # Just add the directory containing the .lo file. cannam@125: func_dirname "$file" "" "." cannam@125: dir=$func_dirname_result cannam@125: ;; cannam@125: cannam@125: *) cannam@125: func_warning "'-dlopen' is ignored for non-libtool libraries and objects" cannam@125: continue cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Get the absolute pathname. cannam@125: absdir=`cd "$dir" && pwd` cannam@125: test -n "$absdir" && dir=$absdir cannam@125: cannam@125: # Now add the directory to shlibpath_var. cannam@125: if eval "test -z \"\$$shlibpath_var\""; then cannam@125: eval "$shlibpath_var=\"\$dir\"" cannam@125: else cannam@125: eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" cannam@125: fi cannam@125: done cannam@125: cannam@125: # This variable tells wrapper scripts just to set shlibpath_var cannam@125: # rather than running their programs. cannam@125: libtool_execute_magic=$magic cannam@125: cannam@125: # Check if any of the arguments is a wrapper script. cannam@125: args= cannam@125: for file cannam@125: do cannam@125: case $file in cannam@125: -* | *.la | *.lo ) ;; cannam@125: *) cannam@125: # Do a test to see if this is really a libtool program. cannam@125: if func_ltwrapper_script_p "$file"; then cannam@125: func_source "$file" cannam@125: # Transform arg to wrapped name. cannam@125: file=$progdir/$program cannam@125: elif func_ltwrapper_executable_p "$file"; then cannam@125: func_ltwrapper_scriptname "$file" cannam@125: func_source "$func_ltwrapper_scriptname_result" cannam@125: # Transform arg to wrapped name. cannam@125: file=$progdir/$program cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: # Quote arguments (to preserve shell metacharacters). cannam@125: func_append_quoted args "$file" cannam@125: done cannam@125: cannam@125: if $opt_dry_run; then cannam@125: # Display what would be done. cannam@125: if test -n "$shlibpath_var"; then cannam@125: eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" cannam@125: echo "export $shlibpath_var" cannam@125: fi cannam@125: $ECHO "$cmd$args" cannam@125: exit $EXIT_SUCCESS cannam@125: else cannam@125: if test -n "$shlibpath_var"; then cannam@125: # Export the shlibpath_var. cannam@125: eval "export $shlibpath_var" cannam@125: fi cannam@125: cannam@125: # Restore saved environment variables cannam@125: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES cannam@125: do cannam@125: eval "if test \"\${save_$lt_var+set}\" = set; then cannam@125: $lt_var=\$save_$lt_var; export $lt_var cannam@125: else cannam@125: $lt_unset $lt_var cannam@125: fi" cannam@125: done cannam@125: cannam@125: # Now prepare to actually exec the command. cannam@125: exec_cmd=\$cmd$args cannam@125: fi cannam@125: } cannam@125: cannam@125: test execute = "$opt_mode" && func_mode_execute ${1+"$@"} cannam@125: cannam@125: cannam@125: # func_mode_finish arg... cannam@125: func_mode_finish () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: libs= cannam@125: libdirs= cannam@125: admincmds= cannam@125: cannam@125: for opt in "$nonopt" ${1+"$@"} cannam@125: do cannam@125: if test -d "$opt"; then cannam@125: func_append libdirs " $opt" cannam@125: cannam@125: elif test -f "$opt"; then cannam@125: if func_lalib_unsafe_p "$opt"; then cannam@125: func_append libs " $opt" cannam@125: else cannam@125: func_warning "'$opt' is not a valid libtool archive" cannam@125: fi cannam@125: cannam@125: else cannam@125: func_fatal_error "invalid argument '$opt'" cannam@125: fi cannam@125: done cannam@125: cannam@125: if test -n "$libs"; then cannam@125: if test -n "$lt_sysroot"; then cannam@125: sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` cannam@125: sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" cannam@125: else cannam@125: sysroot_cmd= cannam@125: fi cannam@125: cannam@125: # Remove sysroot references cannam@125: if $opt_dry_run; then cannam@125: for lib in $libs; do cannam@125: echo "removing references to $lt_sysroot and '=' prefixes from $lib" cannam@125: done cannam@125: else cannam@125: tmpdir=`func_mktempdir` cannam@125: for lib in $libs; do cannam@125: $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ cannam@125: > $tmpdir/tmp-la cannam@125: mv -f $tmpdir/tmp-la $lib cannam@125: done cannam@125: ${RM}r "$tmpdir" cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then cannam@125: for libdir in $libdirs; do cannam@125: if test -n "$finish_cmds"; then cannam@125: # Do each command in the finish commands. cannam@125: func_execute_cmds "$finish_cmds" 'admincmds="$admincmds cannam@125: '"$cmd"'"' cannam@125: fi cannam@125: if test -n "$finish_eval"; then cannam@125: # Do the single finish_eval. cannam@125: eval cmds=\"$finish_eval\" cannam@125: $opt_dry_run || eval "$cmds" || func_append admincmds " cannam@125: $cmds" cannam@125: fi cannam@125: done cannam@125: fi cannam@125: cannam@125: # Exit here if they wanted silent mode. cannam@125: $opt_quiet && exit $EXIT_SUCCESS cannam@125: cannam@125: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then cannam@125: echo "----------------------------------------------------------------------" cannam@125: echo "Libraries have been installed in:" cannam@125: for libdir in $libdirs; do cannam@125: $ECHO " $libdir" cannam@125: done cannam@125: echo cannam@125: echo "If you ever happen to want to link against installed libraries" cannam@125: echo "in a given directory, LIBDIR, you must either use libtool, and" cannam@125: echo "specify the full pathname of the library, or use the '-LLIBDIR'" cannam@125: echo "flag during linking and do at least one of the following:" cannam@125: if test -n "$shlibpath_var"; then cannam@125: echo " - add LIBDIR to the '$shlibpath_var' environment variable" cannam@125: echo " during execution" cannam@125: fi cannam@125: if test -n "$runpath_var"; then cannam@125: echo " - add LIBDIR to the '$runpath_var' environment variable" cannam@125: echo " during linking" cannam@125: fi cannam@125: if test -n "$hardcode_libdir_flag_spec"; then cannam@125: libdir=LIBDIR cannam@125: eval flag=\"$hardcode_libdir_flag_spec\" cannam@125: cannam@125: $ECHO " - use the '$flag' linker flag" cannam@125: fi cannam@125: if test -n "$admincmds"; then cannam@125: $ECHO " - have your system administrator run these commands:$admincmds" cannam@125: fi cannam@125: if test -f /etc/ld.so.conf; then cannam@125: echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" cannam@125: fi cannam@125: echo cannam@125: cannam@125: echo "See any operating system documentation about shared libraries for" cannam@125: case $host in cannam@125: solaris2.[6789]|solaris2.1[0-9]) cannam@125: echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" cannam@125: echo "pages." cannam@125: ;; cannam@125: *) cannam@125: echo "more information, such as the ld(1) and ld.so(8) manual pages." cannam@125: ;; cannam@125: esac cannam@125: echo "----------------------------------------------------------------------" cannam@125: fi cannam@125: exit $EXIT_SUCCESS cannam@125: } cannam@125: cannam@125: test finish = "$opt_mode" && func_mode_finish ${1+"$@"} cannam@125: cannam@125: cannam@125: # func_mode_install arg... cannam@125: func_mode_install () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: # There may be an optional sh(1) argument at the beginning of cannam@125: # install_prog (especially on Windows NT). cannam@125: if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || cannam@125: # Allow the use of GNU shtool's install command. cannam@125: case $nonopt in *shtool*) :;; *) false;; esac cannam@125: then cannam@125: # Aesthetically quote it. cannam@125: func_quote_for_eval "$nonopt" cannam@125: install_prog="$func_quote_for_eval_result " cannam@125: arg=$1 cannam@125: shift cannam@125: else cannam@125: install_prog= cannam@125: arg=$nonopt cannam@125: fi cannam@125: cannam@125: # The real first argument should be the name of the installation program. cannam@125: # Aesthetically quote it. cannam@125: func_quote_for_eval "$arg" cannam@125: func_append install_prog "$func_quote_for_eval_result" cannam@125: install_shared_prog=$install_prog cannam@125: case " $install_prog " in cannam@125: *[\\\ /]cp\ *) install_cp=: ;; cannam@125: *) install_cp=false ;; cannam@125: esac cannam@125: cannam@125: # We need to accept at least all the BSD install flags. cannam@125: dest= cannam@125: files= cannam@125: opts= cannam@125: prev= cannam@125: install_type= cannam@125: isdir=false cannam@125: stripme= cannam@125: no_mode=: cannam@125: for arg cannam@125: do cannam@125: arg2= cannam@125: if test -n "$dest"; then cannam@125: func_append files " $dest" cannam@125: dest=$arg cannam@125: continue cannam@125: fi cannam@125: cannam@125: case $arg in cannam@125: -d) isdir=: ;; cannam@125: -f) cannam@125: if $install_cp; then :; else cannam@125: prev=$arg cannam@125: fi cannam@125: ;; cannam@125: -g | -m | -o) cannam@125: prev=$arg cannam@125: ;; cannam@125: -s) cannam@125: stripme=" -s" cannam@125: continue cannam@125: ;; cannam@125: -*) cannam@125: ;; cannam@125: *) cannam@125: # If the previous option needed an argument, then skip it. cannam@125: if test -n "$prev"; then cannam@125: if test X-m = "X$prev" && test -n "$install_override_mode"; then cannam@125: arg2=$install_override_mode cannam@125: no_mode=false cannam@125: fi cannam@125: prev= cannam@125: else cannam@125: dest=$arg cannam@125: continue cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Aesthetically quote the argument. cannam@125: func_quote_for_eval "$arg" cannam@125: func_append install_prog " $func_quote_for_eval_result" cannam@125: if test -n "$arg2"; then cannam@125: func_quote_for_eval "$arg2" cannam@125: fi cannam@125: func_append install_shared_prog " $func_quote_for_eval_result" cannam@125: done cannam@125: cannam@125: test -z "$install_prog" && \ cannam@125: func_fatal_help "you must specify an install program" cannam@125: cannam@125: test -n "$prev" && \ cannam@125: func_fatal_help "the '$prev' option requires an argument" cannam@125: cannam@125: if test -n "$install_override_mode" && $no_mode; then cannam@125: if $install_cp; then :; else cannam@125: func_quote_for_eval "$install_override_mode" cannam@125: func_append install_shared_prog " -m $func_quote_for_eval_result" cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test -z "$files"; then cannam@125: if test -z "$dest"; then cannam@125: func_fatal_help "no file or destination specified" cannam@125: else cannam@125: func_fatal_help "you must specify a destination" cannam@125: fi cannam@125: fi cannam@125: cannam@125: # Strip any trailing slash from the destination. cannam@125: func_stripname '' '/' "$dest" cannam@125: dest=$func_stripname_result cannam@125: cannam@125: # Check to see that the destination is a directory. cannam@125: test -d "$dest" && isdir=: cannam@125: if $isdir; then cannam@125: destdir=$dest cannam@125: destname= cannam@125: else cannam@125: func_dirname_and_basename "$dest" "" "." cannam@125: destdir=$func_dirname_result cannam@125: destname=$func_basename_result cannam@125: cannam@125: # Not a directory, so check to see that there is only one file specified. cannam@125: set dummy $files; shift cannam@125: test "$#" -gt 1 && \ cannam@125: func_fatal_help "'$dest' is not a directory" cannam@125: fi cannam@125: case $destdir in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) ;; cannam@125: *) cannam@125: for file in $files; do cannam@125: case $file in cannam@125: *.lo) ;; cannam@125: *) cannam@125: func_fatal_help "'$destdir' must be an absolute directory name" cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # This variable tells wrapper scripts just to set variables rather cannam@125: # than running their programs. cannam@125: libtool_install_magic=$magic cannam@125: cannam@125: staticlibs= cannam@125: future_libdirs= cannam@125: current_libdirs= cannam@125: for file in $files; do cannam@125: cannam@125: # Do each installation. cannam@125: case $file in cannam@125: *.$libext) cannam@125: # Do the static libraries later. cannam@125: func_append staticlibs " $file" cannam@125: ;; cannam@125: cannam@125: *.la) cannam@125: func_resolve_sysroot "$file" cannam@125: file=$func_resolve_sysroot_result cannam@125: cannam@125: # Check to see that this really is a libtool archive. cannam@125: func_lalib_unsafe_p "$file" \ cannam@125: || func_fatal_help "'$file' is not a valid libtool archive" cannam@125: cannam@125: library_names= cannam@125: old_library= cannam@125: relink_command= cannam@125: func_source "$file" cannam@125: cannam@125: # Add the libdir to current_libdirs if it is the destination. cannam@125: if test "X$destdir" = "X$libdir"; then cannam@125: case "$current_libdirs " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append current_libdirs " $libdir" ;; cannam@125: esac cannam@125: else cannam@125: # Note the libdir as a future libdir. cannam@125: case "$future_libdirs " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append future_libdirs " $libdir" ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: func_dirname "$file" "/" "" cannam@125: dir=$func_dirname_result cannam@125: func_append dir "$objdir" cannam@125: cannam@125: if test -n "$relink_command"; then cannam@125: # Determine the prefix the user has applied to our future dir. cannam@125: inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` cannam@125: cannam@125: # Don't allow the user to place us outside of our expected cannam@125: # location b/c this prevents finding dependent libraries that cannam@125: # are installed to the same prefix. cannam@125: # At present, this check doesn't affect windows .dll's that cannam@125: # are installed into $libdir/../bin (currently, that works fine) cannam@125: # but it's something to keep an eye on. cannam@125: test "$inst_prefix_dir" = "$destdir" && \ cannam@125: func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" cannam@125: cannam@125: if test -n "$inst_prefix_dir"; then cannam@125: # Stick the inst_prefix_dir data into the link command. cannam@125: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` cannam@125: else cannam@125: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` cannam@125: fi cannam@125: cannam@125: func_warning "relinking '$file'" cannam@125: func_show_eval "$relink_command" \ cannam@125: 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' cannam@125: fi cannam@125: cannam@125: # See the names of the shared library. cannam@125: set dummy $library_names; shift cannam@125: if test -n "$1"; then cannam@125: realname=$1 cannam@125: shift cannam@125: cannam@125: srcname=$realname cannam@125: test -n "$relink_command" && srcname=${realname}T cannam@125: cannam@125: # Install the shared library and build the symlinks. cannam@125: func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ cannam@125: 'exit $?' cannam@125: tstripme=$stripme cannam@125: case $host_os in cannam@125: cygwin* | mingw* | pw32* | cegcc*) cannam@125: case $realname in cannam@125: *.dll.a) cannam@125: tstripme= cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: os2*) cannam@125: case $realname in cannam@125: *_dll.a) cannam@125: tstripme= cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: if test -n "$tstripme" && test -n "$striplib"; then cannam@125: func_show_eval "$striplib $destdir/$realname" 'exit $?' cannam@125: fi cannam@125: cannam@125: if test "$#" -gt 0; then cannam@125: # Delete the old symlinks, and create new ones. cannam@125: # Try 'ln -sf' first, because the 'ln' binary might depend on cannam@125: # the symlink we replace! Solaris /bin/ln does not understand -f, cannam@125: # so we also need to try rm && ln -s. cannam@125: for linkname cannam@125: do cannam@125: test "$linkname" != "$realname" \ cannam@125: && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" cannam@125: done cannam@125: fi cannam@125: cannam@125: # Do each command in the postinstall commands. cannam@125: lib=$destdir/$realname cannam@125: func_execute_cmds "$postinstall_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: # Install the pseudo-library for information purposes. cannam@125: func_basename "$file" cannam@125: name=$func_basename_result cannam@125: instname=$dir/${name}i cannam@125: func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' cannam@125: cannam@125: # Maybe install the static library, too. cannam@125: test -n "$old_library" && func_append staticlibs " $dir/$old_library" cannam@125: ;; cannam@125: cannam@125: *.lo) cannam@125: # Install (i.e. copy) a libtool object. cannam@125: cannam@125: # Figure out destination file name, if it wasn't already specified. cannam@125: if test -n "$destname"; then cannam@125: destfile=$destdir/$destname cannam@125: else cannam@125: func_basename "$file" cannam@125: destfile=$func_basename_result cannam@125: destfile=$destdir/$destfile cannam@125: fi cannam@125: cannam@125: # Deduce the name of the destination old-style object file. cannam@125: case $destfile in cannam@125: *.lo) cannam@125: func_lo2o "$destfile" cannam@125: staticdest=$func_lo2o_result cannam@125: ;; cannam@125: *.$objext) cannam@125: staticdest=$destfile cannam@125: destfile= cannam@125: ;; cannam@125: *) cannam@125: func_fatal_help "cannot copy a libtool object to '$destfile'" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Install the libtool object if requested. cannam@125: test -n "$destfile" && \ cannam@125: func_show_eval "$install_prog $file $destfile" 'exit $?' cannam@125: cannam@125: # Install the old object if enabled. cannam@125: if test yes = "$build_old_libs"; then cannam@125: # Deduce the name of the old-style object file. cannam@125: func_lo2o "$file" cannam@125: staticobj=$func_lo2o_result cannam@125: func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' cannam@125: fi cannam@125: exit $EXIT_SUCCESS cannam@125: ;; cannam@125: cannam@125: *) cannam@125: # Figure out destination file name, if it wasn't already specified. cannam@125: if test -n "$destname"; then cannam@125: destfile=$destdir/$destname cannam@125: else cannam@125: func_basename "$file" cannam@125: destfile=$func_basename_result cannam@125: destfile=$destdir/$destfile cannam@125: fi cannam@125: cannam@125: # If the file is missing, and there is a .exe on the end, strip it cannam@125: # because it is most likely a libtool script we actually want to cannam@125: # install cannam@125: stripped_ext= cannam@125: case $file in cannam@125: *.exe) cannam@125: if test ! -f "$file"; then cannam@125: func_stripname '' '.exe' "$file" cannam@125: file=$func_stripname_result cannam@125: stripped_ext=.exe cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Do a test to see if this is really a libtool program. cannam@125: case $host in cannam@125: *cygwin* | *mingw*) cannam@125: if func_ltwrapper_executable_p "$file"; then cannam@125: func_ltwrapper_scriptname "$file" cannam@125: wrapper=$func_ltwrapper_scriptname_result cannam@125: else cannam@125: func_stripname '' '.exe' "$file" cannam@125: wrapper=$func_stripname_result cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: wrapper=$file cannam@125: ;; cannam@125: esac cannam@125: if func_ltwrapper_script_p "$wrapper"; then cannam@125: notinst_deplibs= cannam@125: relink_command= cannam@125: cannam@125: func_source "$wrapper" cannam@125: cannam@125: # Check the variables that should have been set. cannam@125: test -z "$generated_by_libtool_version" && \ cannam@125: func_fatal_error "invalid libtool wrapper script '$wrapper'" cannam@125: cannam@125: finalize=: cannam@125: for lib in $notinst_deplibs; do cannam@125: # Check to see that each library is installed. cannam@125: libdir= cannam@125: if test -f "$lib"; then cannam@125: func_source "$lib" cannam@125: fi cannam@125: libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` cannam@125: if test -n "$libdir" && test ! -f "$libfile"; then cannam@125: func_warning "'$lib' has not been installed in '$libdir'" cannam@125: finalize=false cannam@125: fi cannam@125: done cannam@125: cannam@125: relink_command= cannam@125: func_source "$wrapper" cannam@125: cannam@125: outputname= cannam@125: if test no = "$fast_install" && test -n "$relink_command"; then cannam@125: $opt_dry_run || { cannam@125: if $finalize; then cannam@125: tmpdir=`func_mktempdir` cannam@125: func_basename "$file$stripped_ext" cannam@125: file=$func_basename_result cannam@125: outputname=$tmpdir/$file cannam@125: # Replace the output file specification. cannam@125: relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` cannam@125: cannam@125: $opt_quiet || { cannam@125: func_quote_for_expand "$relink_command" cannam@125: eval "func_echo $func_quote_for_expand_result" cannam@125: } cannam@125: if eval "$relink_command"; then : cannam@125: else cannam@125: func_error "error: relink '$file' with the above command before installing it" cannam@125: $opt_dry_run || ${RM}r "$tmpdir" cannam@125: continue cannam@125: fi cannam@125: file=$outputname cannam@125: else cannam@125: func_warning "cannot relink '$file'" cannam@125: fi cannam@125: } cannam@125: else cannam@125: # Install the binary that we compiled earlier. cannam@125: file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` cannam@125: fi cannam@125: fi cannam@125: cannam@125: # remove .exe since cygwin /usr/bin/install will append another cannam@125: # one anyway cannam@125: case $install_prog,$host in cannam@125: */usr/bin/install*,*cygwin*) cannam@125: case $file:$destfile in cannam@125: *.exe:*.exe) cannam@125: # this is ok cannam@125: ;; cannam@125: *.exe:*) cannam@125: destfile=$destfile.exe cannam@125: ;; cannam@125: *:*.exe) cannam@125: func_stripname '' '.exe' "$destfile" cannam@125: destfile=$func_stripname_result cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' cannam@125: $opt_dry_run || if test -n "$outputname"; then cannam@125: ${RM}r "$tmpdir" cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: for file in $staticlibs; do cannam@125: func_basename "$file" cannam@125: name=$func_basename_result cannam@125: cannam@125: # Set up the ranlib parameters. cannam@125: oldlib=$destdir/$name cannam@125: func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 cannam@125: tool_oldlib=$func_to_tool_file_result cannam@125: cannam@125: func_show_eval "$install_prog \$file \$oldlib" 'exit $?' cannam@125: cannam@125: if test -n "$stripme" && test -n "$old_striplib"; then cannam@125: func_show_eval "$old_striplib $tool_oldlib" 'exit $?' cannam@125: fi cannam@125: cannam@125: # Do each command in the postinstall commands. cannam@125: func_execute_cmds "$old_postinstall_cmds" 'exit $?' cannam@125: done cannam@125: cannam@125: test -n "$future_libdirs" && \ cannam@125: func_warning "remember to run '$progname --finish$future_libdirs'" cannam@125: cannam@125: if test -n "$current_libdirs"; then cannam@125: # Maybe just do a dry run. cannam@125: $opt_dry_run && current_libdirs=" -n$current_libdirs" cannam@125: exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' cannam@125: else cannam@125: exit $EXIT_SUCCESS cannam@125: fi cannam@125: } cannam@125: cannam@125: test install = "$opt_mode" && func_mode_install ${1+"$@"} cannam@125: cannam@125: cannam@125: # func_generate_dlsyms outputname originator pic_p cannam@125: # Extract symbols from dlprefiles and create ${outputname}S.o with cannam@125: # a dlpreopen symbol table. cannam@125: func_generate_dlsyms () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: my_outputname=$1 cannam@125: my_originator=$2 cannam@125: my_pic_p=${3-false} cannam@125: my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` cannam@125: my_dlsyms= cannam@125: cannam@125: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then cannam@125: if test -n "$NM" && test -n "$global_symbol_pipe"; then cannam@125: my_dlsyms=${my_outputname}S.c cannam@125: else cannam@125: func_error "not configured to extract global symbols from dlpreopened files" cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test -n "$my_dlsyms"; then cannam@125: case $my_dlsyms in cannam@125: "") ;; cannam@125: *.c) cannam@125: # Discover the nlist of each of the dlfiles. cannam@125: nlist=$output_objdir/$my_outputname.nm cannam@125: cannam@125: func_show_eval "$RM $nlist ${nlist}S ${nlist}T" cannam@125: cannam@125: # Parse the name list into a source file. cannam@125: func_verbose "creating $output_objdir/$my_dlsyms" cannam@125: cannam@125: $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ cannam@125: /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ cannam@125: /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ cannam@125: cannam@125: #ifdef __cplusplus cannam@125: extern \"C\" { cannam@125: #endif cannam@125: cannam@125: #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) cannam@125: #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" cannam@125: #endif cannam@125: cannam@125: /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ cannam@125: #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE cannam@125: /* DATA imports from DLLs on WIN32 can't be const, because runtime cannam@125: relocations are performed -- see ld's documentation on pseudo-relocs. */ cannam@125: # define LT_DLSYM_CONST cannam@125: #elif defined __osf__ cannam@125: /* This system does not cope well with relocations in const data. */ cannam@125: # define LT_DLSYM_CONST cannam@125: #else cannam@125: # define LT_DLSYM_CONST const cannam@125: #endif cannam@125: cannam@125: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) cannam@125: cannam@125: /* External symbol declarations for the compiler. */\ cannam@125: " cannam@125: cannam@125: if test yes = "$dlself"; then cannam@125: func_verbose "generating symbol list for '$output'" cannam@125: cannam@125: $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" cannam@125: cannam@125: # Add our own program objects to the symbol list. cannam@125: progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` cannam@125: for progfile in $progfiles; do cannam@125: func_to_tool_file "$progfile" func_convert_file_msys_to_w32 cannam@125: func_verbose "extracting global C symbols from '$func_to_tool_file_result'" cannam@125: $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" cannam@125: done cannam@125: cannam@125: if test -n "$exclude_expsyms"; then cannam@125: $opt_dry_run || { cannam@125: eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' cannam@125: eval '$MV "$nlist"T "$nlist"' cannam@125: } cannam@125: fi cannam@125: cannam@125: if test -n "$export_symbols_regex"; then cannam@125: $opt_dry_run || { cannam@125: eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' cannam@125: eval '$MV "$nlist"T "$nlist"' cannam@125: } cannam@125: fi cannam@125: cannam@125: # Prepare the list of exported symbols cannam@125: if test -z "$export_symbols"; then cannam@125: export_symbols=$output_objdir/$outputname.exp cannam@125: $opt_dry_run || { cannam@125: $RM $export_symbols cannam@125: eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' cannam@125: case $host in cannam@125: *cygwin* | *mingw* | *cegcc* ) cannam@125: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' cannam@125: eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: else cannam@125: $opt_dry_run || { cannam@125: eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' cannam@125: eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' cannam@125: eval '$MV "$nlist"T "$nlist"' cannam@125: case $host in cannam@125: *cygwin* | *mingw* | *cegcc* ) cannam@125: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' cannam@125: eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: fi cannam@125: fi cannam@125: cannam@125: for dlprefile in $dlprefiles; do cannam@125: func_verbose "extracting global C symbols from '$dlprefile'" cannam@125: func_basename "$dlprefile" cannam@125: name=$func_basename_result cannam@125: case $host in cannam@125: *cygwin* | *mingw* | *cegcc* ) cannam@125: # if an import library, we need to obtain dlname cannam@125: if func_win32_import_lib_p "$dlprefile"; then cannam@125: func_tr_sh "$dlprefile" cannam@125: eval "curr_lafile=\$libfile_$func_tr_sh_result" cannam@125: dlprefile_dlbasename= cannam@125: if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then cannam@125: # Use subshell, to avoid clobbering current variable values cannam@125: dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` cannam@125: if test -n "$dlprefile_dlname"; then cannam@125: func_basename "$dlprefile_dlname" cannam@125: dlprefile_dlbasename=$func_basename_result cannam@125: else cannam@125: # no lafile. user explicitly requested -dlpreopen . cannam@125: $sharedlib_from_linklib_cmd "$dlprefile" cannam@125: dlprefile_dlbasename=$sharedlib_from_linklib_result cannam@125: fi cannam@125: fi cannam@125: $opt_dry_run || { cannam@125: if test -n "$dlprefile_dlbasename"; then cannam@125: eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' cannam@125: else cannam@125: func_warning "Could not compute DLL name from $name" cannam@125: eval '$ECHO ": $name " >> "$nlist"' cannam@125: fi cannam@125: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 cannam@125: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | cannam@125: $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" cannam@125: } cannam@125: else # not an import lib cannam@125: $opt_dry_run || { cannam@125: eval '$ECHO ": $name " >> "$nlist"' cannam@125: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 cannam@125: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" cannam@125: } cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: $opt_dry_run || { cannam@125: eval '$ECHO ": $name " >> "$nlist"' cannam@125: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 cannam@125: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" cannam@125: } cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: $opt_dry_run || { cannam@125: # Make sure we have at least an empty file. cannam@125: test -f "$nlist" || : > "$nlist" cannam@125: cannam@125: if test -n "$exclude_expsyms"; then cannam@125: $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T cannam@125: $MV "$nlist"T "$nlist" cannam@125: fi cannam@125: cannam@125: # Try sorting and uniquifying the output. cannam@125: if $GREP -v "^: " < "$nlist" | cannam@125: if sort -k 3 /dev/null 2>&1; then cannam@125: sort -k 3 cannam@125: else cannam@125: sort +2 cannam@125: fi | cannam@125: uniq > "$nlist"S; then cannam@125: : cannam@125: else cannam@125: $GREP -v "^: " < "$nlist" > "$nlist"S cannam@125: fi cannam@125: cannam@125: if test -f "$nlist"S; then cannam@125: eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' cannam@125: else cannam@125: echo '/* NONE */' >> "$output_objdir/$my_dlsyms" cannam@125: fi cannam@125: cannam@125: func_show_eval '$RM "${nlist}I"' cannam@125: if test -n "$global_symbol_to_import"; then cannam@125: eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' cannam@125: fi cannam@125: cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: cannam@125: /* The mapping between symbol names and symbols. */ cannam@125: typedef struct { cannam@125: const char *name; cannam@125: void *address; cannam@125: } lt_dlsymlist; cannam@125: extern LT_DLSYM_CONST lt_dlsymlist cannam@125: lt_${my_prefix}_LTX_preloaded_symbols[];\ cannam@125: " cannam@125: cannam@125: if test -s "$nlist"I; then cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: static void lt_syminit(void) cannam@125: { cannam@125: LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; cannam@125: for (; symbol->name; ++symbol) cannam@125: {" cannam@125: $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: } cannam@125: }" cannam@125: fi cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: LT_DLSYM_CONST lt_dlsymlist cannam@125: lt_${my_prefix}_LTX_preloaded_symbols[] = cannam@125: { {\"$my_originator\", (void *) 0}," cannam@125: cannam@125: if test -s "$nlist"I; then cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: {\"@INIT@\", (void *) <_syminit}," cannam@125: fi cannam@125: cannam@125: case $need_lib_prefix in cannam@125: no) cannam@125: eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" cannam@125: ;; cannam@125: *) cannam@125: eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" cannam@125: ;; cannam@125: esac cannam@125: echo >> "$output_objdir/$my_dlsyms" "\ cannam@125: {0, (void *) 0} cannam@125: }; cannam@125: cannam@125: /* This works around a problem in FreeBSD linker */ cannam@125: #ifdef FREEBSD_WORKAROUND cannam@125: static const void *lt_preloaded_setup() { cannam@125: return lt_${my_prefix}_LTX_preloaded_symbols; cannam@125: } cannam@125: #endif cannam@125: cannam@125: #ifdef __cplusplus cannam@125: } cannam@125: #endif\ cannam@125: " cannam@125: } # !$opt_dry_run cannam@125: cannam@125: pic_flag_for_symtable= cannam@125: case "$compile_command " in cannam@125: *" -static "*) ;; cannam@125: *) cannam@125: case $host in cannam@125: # compiling the symbol table file with pic_flag works around cannam@125: # a FreeBSD bug that causes programs to crash when -lm is cannam@125: # linked before any other PIC object. But we must not use cannam@125: # pic_flag when linking with -static. The problem exists in cannam@125: # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. cannam@125: *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) cannam@125: pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; cannam@125: *-*-hpux*) cannam@125: pic_flag_for_symtable=" $pic_flag" ;; cannam@125: *) cannam@125: $my_pic_p && pic_flag_for_symtable=" $pic_flag" cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: symtab_cflags= cannam@125: for arg in $LTCFLAGS; do cannam@125: case $arg in cannam@125: -pie | -fpie | -fPIE) ;; cannam@125: *) func_append symtab_cflags " $arg" ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # Now compile the dynamic symbol file. cannam@125: func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' cannam@125: cannam@125: # Clean up the generated files. cannam@125: func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' cannam@125: cannam@125: # Transform the symbol file into the correct name. cannam@125: symfileobj=$output_objdir/${my_outputname}S.$objext cannam@125: case $host in cannam@125: *cygwin* | *mingw* | *cegcc* ) cannam@125: if test -f "$output_objdir/$my_outputname.def"; then cannam@125: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` cannam@125: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` cannam@125: else cannam@125: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` cannam@125: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` cannam@125: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: *) cannam@125: func_fatal_error "unknown suffix for '$my_dlsyms'" cannam@125: ;; cannam@125: esac cannam@125: else cannam@125: # We keep going just in case the user didn't refer to cannam@125: # lt_preloaded_symbols. The linker will fail if global_symbol_pipe cannam@125: # really was required. cannam@125: cannam@125: # Nullify the symbol file. cannam@125: compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` cannam@125: finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` cannam@125: fi cannam@125: } cannam@125: cannam@125: # func_cygming_gnu_implib_p ARG cannam@125: # This predicate returns with zero status (TRUE) if cannam@125: # ARG is a GNU/binutils-style import library. Returns cannam@125: # with nonzero status (FALSE) otherwise. cannam@125: func_cygming_gnu_implib_p () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_tool_file "$1" func_convert_file_msys_to_w32 cannam@125: 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)$'` cannam@125: test -n "$func_cygming_gnu_implib_tmp" cannam@125: } cannam@125: cannam@125: # func_cygming_ms_implib_p ARG cannam@125: # This predicate returns with zero status (TRUE) if cannam@125: # ARG is an MS-style import library. Returns cannam@125: # with nonzero status (FALSE) otherwise. cannam@125: func_cygming_ms_implib_p () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: func_to_tool_file "$1" func_convert_file_msys_to_w32 cannam@125: func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` cannam@125: test -n "$func_cygming_ms_implib_tmp" cannam@125: } cannam@125: cannam@125: # func_win32_libid arg cannam@125: # return the library type of file 'arg' cannam@125: # cannam@125: # Need a lot of goo to handle *both* DLLs and import libs cannam@125: # Has to be a shell function in order to 'eat' the argument cannam@125: # that is supplied when $file_magic_command is called. cannam@125: # Despite the name, also deal with 64 bit binaries. cannam@125: func_win32_libid () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: win32_libid_type=unknown cannam@125: win32_fileres=`file -L $1 2>/dev/null` cannam@125: case $win32_fileres in cannam@125: *ar\ archive\ import\ library*) # definitely import cannam@125: win32_libid_type="x86 archive import" cannam@125: ;; cannam@125: *ar\ archive*) # could be an import, or static cannam@125: # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. cannam@125: if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | cannam@125: $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then cannam@125: case $nm_interface in cannam@125: "MS dumpbin") cannam@125: if func_cygming_ms_implib_p "$1" || cannam@125: func_cygming_gnu_implib_p "$1" cannam@125: then cannam@125: win32_nmres=import cannam@125: else cannam@125: win32_nmres= cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: func_to_tool_file "$1" func_convert_file_msys_to_w32 cannam@125: win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | cannam@125: $SED -n -e ' cannam@125: 1,100{ cannam@125: / I /{ cannam@125: s|.*|import| cannam@125: p cannam@125: q cannam@125: } cannam@125: }'` cannam@125: ;; cannam@125: esac cannam@125: case $win32_nmres in cannam@125: import*) win32_libid_type="x86 archive import";; cannam@125: *) win32_libid_type="x86 archive static";; cannam@125: esac cannam@125: fi cannam@125: ;; cannam@125: *DLL*) cannam@125: win32_libid_type="x86 DLL" cannam@125: ;; cannam@125: *executable*) # but shell scripts are "executable" too... cannam@125: case $win32_fileres in cannam@125: *MS\ Windows\ PE\ Intel*) cannam@125: win32_libid_type="x86 DLL" cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: $ECHO "$win32_libid_type" cannam@125: } cannam@125: cannam@125: # func_cygming_dll_for_implib ARG cannam@125: # cannam@125: # Platform-specific function to extract the cannam@125: # name of the DLL associated with the specified cannam@125: # import library ARG. cannam@125: # Invoked by eval'ing the libtool variable cannam@125: # $sharedlib_from_linklib_cmd cannam@125: # Result is available in the variable cannam@125: # $sharedlib_from_linklib_result cannam@125: func_cygming_dll_for_implib () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` cannam@125: } cannam@125: cannam@125: # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs cannam@125: # cannam@125: # The is the core of a fallback implementation of a cannam@125: # platform-specific function to extract the name of the cannam@125: # DLL associated with the specified import library LIBNAME. cannam@125: # cannam@125: # SECTION_NAME is either .idata$6 or .idata$7, depending cannam@125: # on the platform and compiler that created the implib. cannam@125: # cannam@125: # Echos the name of the DLL associated with the cannam@125: # specified import library. cannam@125: func_cygming_dll_for_implib_fallback_core () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` cannam@125: $OBJDUMP -s --section "$1" "$2" 2>/dev/null | cannam@125: $SED '/^Contents of section '"$match_literal"':/{ cannam@125: # Place marker at beginning of archive member dllname section cannam@125: s/.*/====MARK====/ cannam@125: p cannam@125: d cannam@125: } cannam@125: # These lines can sometimes be longer than 43 characters, but cannam@125: # are always uninteresting cannam@125: /:[ ]*file format pe[i]\{,1\}-/d cannam@125: /^In archive [^:]*:/d cannam@125: # Ensure marker is printed cannam@125: /^====MARK====/p cannam@125: # Remove all lines with less than 43 characters cannam@125: /^.\{43\}/!d cannam@125: # From remaining lines, remove first 43 characters cannam@125: s/^.\{43\}//' | cannam@125: $SED -n ' cannam@125: # Join marker and all lines until next marker into a single line cannam@125: /^====MARK====/ b para cannam@125: H cannam@125: $ b para cannam@125: b cannam@125: :para cannam@125: x cannam@125: s/\n//g cannam@125: # Remove the marker cannam@125: s/^====MARK====// cannam@125: # Remove trailing dots and whitespace cannam@125: s/[\. \t]*$// cannam@125: # Print cannam@125: /./p' | cannam@125: # we now have a list, one entry per line, of the stringified cannam@125: # contents of the appropriate section of all members of the cannam@125: # archive that possess that section. Heuristic: eliminate cannam@125: # all those that have a first or second character that is cannam@125: # a '.' (that is, objdump's representation of an unprintable cannam@125: # character.) This should work for all archives with less than cannam@125: # 0x302f exports -- but will fail for DLLs whose name actually cannam@125: # begins with a literal '.' or a single character followed by cannam@125: # a '.'. cannam@125: # cannam@125: # Of those that remain, print the first one. cannam@125: $SED -e '/^\./d;/^.\./d;q' cannam@125: } cannam@125: cannam@125: # func_cygming_dll_for_implib_fallback ARG cannam@125: # Platform-specific function to extract the cannam@125: # name of the DLL associated with the specified cannam@125: # import library ARG. cannam@125: # cannam@125: # This fallback implementation is for use when $DLLTOOL cannam@125: # does not support the --identify-strict option. cannam@125: # Invoked by eval'ing the libtool variable cannam@125: # $sharedlib_from_linklib_cmd cannam@125: # Result is available in the variable cannam@125: # $sharedlib_from_linklib_result cannam@125: func_cygming_dll_for_implib_fallback () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: if func_cygming_gnu_implib_p "$1"; then cannam@125: # binutils import library cannam@125: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` cannam@125: elif func_cygming_ms_implib_p "$1"; then cannam@125: # ms-generated import library cannam@125: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` cannam@125: else cannam@125: # unknown cannam@125: sharedlib_from_linklib_result= cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: # func_extract_an_archive dir oldlib cannam@125: func_extract_an_archive () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: f_ex_an_ar_dir=$1; shift cannam@125: f_ex_an_ar_oldlib=$1 cannam@125: if test yes = "$lock_old_archive_extraction"; then cannam@125: lockfile=$f_ex_an_ar_oldlib.lock cannam@125: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do cannam@125: func_echo "Waiting for $lockfile to be removed" cannam@125: sleep 2 cannam@125: done cannam@125: fi cannam@125: func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ cannam@125: 'stat=$?; rm -f "$lockfile"; exit $stat' cannam@125: if test yes = "$lock_old_archive_extraction"; then cannam@125: $opt_dry_run || rm -f "$lockfile" cannam@125: fi cannam@125: if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then cannam@125: : cannam@125: else cannam@125: func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" cannam@125: fi cannam@125: } cannam@125: cannam@125: cannam@125: # func_extract_archives gentop oldlib ... cannam@125: func_extract_archives () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: my_gentop=$1; shift cannam@125: my_oldlibs=${1+"$@"} cannam@125: my_oldobjs= cannam@125: my_xlib= cannam@125: my_xabs= cannam@125: my_xdir= cannam@125: cannam@125: for my_xlib in $my_oldlibs; do cannam@125: # Extract the objects. cannam@125: case $my_xlib in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; cannam@125: *) my_xabs=`pwd`"/$my_xlib" ;; cannam@125: esac cannam@125: func_basename "$my_xlib" cannam@125: my_xlib=$func_basename_result cannam@125: my_xlib_u=$my_xlib cannam@125: while :; do cannam@125: case " $extracted_archives " in cannam@125: *" $my_xlib_u "*) cannam@125: func_arith $extracted_serial + 1 cannam@125: extracted_serial=$func_arith_result cannam@125: my_xlib_u=lt$extracted_serial-$my_xlib ;; cannam@125: *) break ;; cannam@125: esac cannam@125: done cannam@125: extracted_archives="$extracted_archives $my_xlib_u" cannam@125: my_xdir=$my_gentop/$my_xlib_u cannam@125: cannam@125: func_mkdir_p "$my_xdir" cannam@125: cannam@125: case $host in cannam@125: *-darwin*) cannam@125: func_verbose "Extracting $my_xabs" cannam@125: # Do not bother doing anything if just a dry run cannam@125: $opt_dry_run || { cannam@125: darwin_orig_dir=`pwd` cannam@125: cd $my_xdir || exit $? cannam@125: darwin_archive=$my_xabs cannam@125: darwin_curdir=`pwd` cannam@125: func_basename "$darwin_archive" cannam@125: darwin_base_archive=$func_basename_result cannam@125: darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` cannam@125: if test -n "$darwin_arches"; then cannam@125: darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` cannam@125: darwin_arch= cannam@125: func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" cannam@125: for darwin_arch in $darwin_arches; do cannam@125: func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" cannam@125: $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cannam@125: cd "unfat-$$/$darwin_base_archive-$darwin_arch" cannam@125: func_extract_an_archive "`pwd`" "$darwin_base_archive" cannam@125: cd "$darwin_curdir" cannam@125: $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" cannam@125: done # $darwin_arches cannam@125: ## Okay now we've a bunch of thin objects, gotta fatten them up :) cannam@125: darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` cannam@125: darwin_file= cannam@125: darwin_files= cannam@125: for darwin_file in $darwin_filelist; do cannam@125: darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` cannam@125: $LIPO -create -output "$darwin_file" $darwin_files cannam@125: done # $darwin_filelist cannam@125: $RM -rf unfat-$$ cannam@125: cd "$darwin_orig_dir" cannam@125: else cannam@125: cd $darwin_orig_dir cannam@125: func_extract_an_archive "$my_xdir" "$my_xabs" cannam@125: fi # $darwin_arches cannam@125: } # !$opt_dry_run cannam@125: ;; cannam@125: *) cannam@125: func_extract_an_archive "$my_xdir" "$my_xabs" cannam@125: ;; cannam@125: esac cannam@125: my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` cannam@125: done cannam@125: cannam@125: func_extract_archives_result=$my_oldobjs cannam@125: } cannam@125: cannam@125: cannam@125: # func_emit_wrapper [arg=no] cannam@125: # cannam@125: # Emit a libtool wrapper script on stdout. cannam@125: # Don't directly open a file because we may want to cannam@125: # incorporate the script contents within a cygwin/mingw cannam@125: # wrapper executable. Must ONLY be called from within cannam@125: # func_mode_link because it depends on a number of variables cannam@125: # set therein. cannam@125: # cannam@125: # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR cannam@125: # variable will take. If 'yes', then the emitted script cannam@125: # will assume that the directory where it is stored is cannam@125: # the $objdir directory. This is a cygwin/mingw-specific cannam@125: # behavior. cannam@125: func_emit_wrapper () cannam@125: { cannam@125: func_emit_wrapper_arg1=${1-no} cannam@125: cannam@125: $ECHO "\ cannam@125: #! $SHELL cannam@125: cannam@125: # $output - temporary wrapper script for $objdir/$outputname cannam@125: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION cannam@125: # cannam@125: # The $output program cannot be directly executed until all the libtool cannam@125: # libraries that it depends on are installed. cannam@125: # cannam@125: # This wrapper script should never be moved out of the build directory. cannam@125: # If it is, it will not operate correctly. cannam@125: cannam@125: # Sed substitution that helps us do robust quoting. It backslashifies cannam@125: # metacharacters that are still active within double-quoted strings. cannam@125: sed_quote_subst='$sed_quote_subst' cannam@125: cannam@125: # Be Bourne compatible cannam@125: if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then cannam@125: emulate sh cannam@125: NULLCMD=: cannam@125: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which cannam@125: # is contrary to our usage. Disable this feature. cannam@125: alias -g '\${1+\"\$@\"}'='\"\$@\"' cannam@125: setopt NO_GLOB_SUBST cannam@125: else cannam@125: case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac cannam@125: fi cannam@125: BIN_SH=xpg4; export BIN_SH # for Tru64 cannam@125: DUALCASE=1; export DUALCASE # for MKS sh cannam@125: cannam@125: # The HP-UX ksh and POSIX shell print the target directory to stdout cannam@125: # if CDPATH is set. cannam@125: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH cannam@125: cannam@125: relink_command=\"$relink_command\" cannam@125: cannam@125: # This environment variable determines our operation mode. cannam@125: if test \"\$libtool_install_magic\" = \"$magic\"; then cannam@125: # install mode needs the following variables: cannam@125: generated_by_libtool_version='$macro_version' cannam@125: notinst_deplibs='$notinst_deplibs' cannam@125: else cannam@125: # When we are sourced in execute mode, \$file and \$ECHO are already set. cannam@125: if test \"\$libtool_execute_magic\" != \"$magic\"; then cannam@125: file=\"\$0\"" cannam@125: cannam@125: qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` cannam@125: $ECHO "\ cannam@125: cannam@125: # A function that is used when there is no print builtin or printf. cannam@125: func_fallback_echo () cannam@125: { cannam@125: eval 'cat <<_LTECHO_EOF cannam@125: \$1 cannam@125: _LTECHO_EOF' cannam@125: } cannam@125: ECHO=\"$qECHO\" cannam@125: fi cannam@125: cannam@125: # Very basic option parsing. These options are (a) specific to cannam@125: # the libtool wrapper, (b) are identical between the wrapper cannam@125: # /script/ and the wrapper /executable/ that is used only on cannam@125: # windows platforms, and (c) all begin with the string "--lt-" cannam@125: # (application programs are unlikely to have options that match cannam@125: # this pattern). cannam@125: # cannam@125: # There are only two supported options: --lt-debug and cannam@125: # --lt-dump-script. There is, deliberately, no --lt-help. cannam@125: # cannam@125: # The first argument to this parsing function should be the cannam@125: # script's $0 value, followed by "$@". cannam@125: lt_option_debug= cannam@125: func_parse_lt_options () cannam@125: { cannam@125: lt_script_arg0=\$0 cannam@125: shift cannam@125: for lt_opt cannam@125: do cannam@125: case \"\$lt_opt\" in cannam@125: --lt-debug) lt_option_debug=1 ;; cannam@125: --lt-dump-script) cannam@125: lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` cannam@125: test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. cannam@125: lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cannam@125: cat \"\$lt_dump_D/\$lt_dump_F\" cannam@125: exit 0 cannam@125: ;; cannam@125: --lt-*) cannam@125: \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 cannam@125: exit 1 cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # Print the debug banner immediately: cannam@125: if test -n \"\$lt_option_debug\"; then cannam@125: echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 cannam@125: fi cannam@125: } cannam@125: cannam@125: # Used when --lt-debug. Prints its arguments to stdout cannam@125: # (redirection is the responsibility of the caller) cannam@125: func_lt_dump_args () cannam@125: { cannam@125: lt_dump_args_N=1; cannam@125: for lt_arg cannam@125: do cannam@125: \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" cannam@125: lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` cannam@125: done cannam@125: } cannam@125: cannam@125: # Core function for launching the target application cannam@125: func_exec_program_core () cannam@125: { cannam@125: " cannam@125: case $host in cannam@125: # Backslashes separate directories on plain windows cannam@125: *-*-mingw | *-*-os2* | *-cegcc*) cannam@125: $ECHO "\ cannam@125: if test -n \"\$lt_option_debug\"; then cannam@125: \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 cannam@125: func_lt_dump_args \${1+\"\$@\"} 1>&2 cannam@125: fi cannam@125: exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} cannam@125: " cannam@125: ;; cannam@125: cannam@125: *) cannam@125: $ECHO "\ cannam@125: if test -n \"\$lt_option_debug\"; then cannam@125: \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 cannam@125: func_lt_dump_args \${1+\"\$@\"} 1>&2 cannam@125: fi cannam@125: exec \"\$progdir/\$program\" \${1+\"\$@\"} cannam@125: " cannam@125: ;; cannam@125: esac cannam@125: $ECHO "\ cannam@125: \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 cannam@125: exit 1 cannam@125: } cannam@125: cannam@125: # A function to encapsulate launching the target application cannam@125: # Strips options in the --lt-* namespace from \$@ and cannam@125: # launches target application with the remaining arguments. cannam@125: func_exec_program () cannam@125: { cannam@125: case \" \$* \" in cannam@125: *\\ --lt-*) cannam@125: for lt_wr_arg cannam@125: do cannam@125: case \$lt_wr_arg in cannam@125: --lt-*) ;; cannam@125: *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; cannam@125: esac cannam@125: shift cannam@125: done ;; cannam@125: esac cannam@125: func_exec_program_core \${1+\"\$@\"} cannam@125: } cannam@125: cannam@125: # Parse options cannam@125: func_parse_lt_options \"\$0\" \${1+\"\$@\"} cannam@125: cannam@125: # Find the directory that this script lives in. cannam@125: thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` cannam@125: test \"x\$thisdir\" = \"x\$file\" && thisdir=. cannam@125: cannam@125: # Follow symbolic links until we get to the real thisdir. cannam@125: file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` cannam@125: while test -n \"\$file\"; do cannam@125: destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` cannam@125: cannam@125: # If there was a directory component, then change thisdir. cannam@125: if test \"x\$destdir\" != \"x\$file\"; then cannam@125: case \"\$destdir\" in cannam@125: [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; cannam@125: *) thisdir=\"\$thisdir/\$destdir\" ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` cannam@125: file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` cannam@125: done cannam@125: cannam@125: # Usually 'no', except on cygwin/mingw when embedded into cannam@125: # the cwrapper. cannam@125: WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 cannam@125: if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then cannam@125: # special case for '.' cannam@125: if test \"\$thisdir\" = \".\"; then cannam@125: thisdir=\`pwd\` cannam@125: fi cannam@125: # remove .libs from thisdir cannam@125: case \"\$thisdir\" in cannam@125: *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; cannam@125: $objdir ) thisdir=. ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: # Try to get the absolute directory name. cannam@125: absdir=\`cd \"\$thisdir\" && pwd\` cannam@125: test -n \"\$absdir\" && thisdir=\"\$absdir\" cannam@125: " cannam@125: cannam@125: if test yes = "$fast_install"; then cannam@125: $ECHO "\ cannam@125: program=lt-'$outputname'$exeext cannam@125: progdir=\"\$thisdir/$objdir\" cannam@125: cannam@125: if test ! -f \"\$progdir/\$program\" || cannam@125: { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ cannam@125: test \"X\$file\" != \"X\$progdir/\$program\"; }; then cannam@125: cannam@125: file=\"\$\$-\$program\" cannam@125: cannam@125: if test ! -d \"\$progdir\"; then cannam@125: $MKDIR \"\$progdir\" cannam@125: else cannam@125: $RM \"\$progdir/\$file\" cannam@125: fi" cannam@125: cannam@125: $ECHO "\ cannam@125: cannam@125: # relink executable if necessary cannam@125: if test -n \"\$relink_command\"; then cannam@125: if relink_command_output=\`eval \$relink_command 2>&1\`; then : cannam@125: else cannam@125: \$ECHO \"\$relink_command_output\" >&2 cannam@125: $RM \"\$progdir/\$file\" cannam@125: exit 1 cannam@125: fi cannam@125: fi cannam@125: cannam@125: $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || cannam@125: { $RM \"\$progdir/\$program\"; cannam@125: $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } cannam@125: $RM \"\$progdir/\$file\" cannam@125: fi" cannam@125: else cannam@125: $ECHO "\ cannam@125: program='$outputname' cannam@125: progdir=\"\$thisdir/$objdir\" cannam@125: " cannam@125: fi cannam@125: cannam@125: $ECHO "\ cannam@125: cannam@125: if test -f \"\$progdir/\$program\"; then" cannam@125: cannam@125: # fixup the dll searchpath if we need to. cannam@125: # cannam@125: # Fix the DLL searchpath if we need to. Do this before prepending cannam@125: # to shlibpath, because on Windows, both are PATH and uninstalled cannam@125: # libraries must come first. cannam@125: if test -n "$dllsearchpath"; then cannam@125: $ECHO "\ cannam@125: # Add the dll search path components to the executable PATH cannam@125: PATH=$dllsearchpath:\$PATH cannam@125: " cannam@125: fi cannam@125: cannam@125: # Export our shlibpath_var if we have one. cannam@125: if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then cannam@125: $ECHO "\ cannam@125: # Add our own library path to $shlibpath_var cannam@125: $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" cannam@125: cannam@125: # Some systems cannot cope with colon-terminated $shlibpath_var cannam@125: # The second colon is a workaround for a bug in BeOS R4 sed cannam@125: $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` cannam@125: cannam@125: export $shlibpath_var cannam@125: " cannam@125: fi cannam@125: cannam@125: $ECHO "\ cannam@125: if test \"\$libtool_execute_magic\" != \"$magic\"; then cannam@125: # Run the actual program with our arguments. cannam@125: func_exec_program \${1+\"\$@\"} cannam@125: fi cannam@125: else cannam@125: # The program doesn't exist. cannam@125: \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 cannam@125: \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 cannam@125: \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 cannam@125: exit 1 cannam@125: fi cannam@125: fi\ cannam@125: " cannam@125: } cannam@125: cannam@125: cannam@125: # func_emit_cwrapperexe_src cannam@125: # emit the source code for a wrapper executable on stdout cannam@125: # Must ONLY be called from within func_mode_link because cannam@125: # it depends on a number of variable set therein. cannam@125: func_emit_cwrapperexe_src () cannam@125: { cannam@125: cat < cannam@125: #include cannam@125: #ifdef _MSC_VER cannam@125: # include cannam@125: # include cannam@125: # include cannam@125: #else cannam@125: # include cannam@125: # include cannam@125: # ifdef __CYGWIN__ cannam@125: # include cannam@125: # endif cannam@125: #endif cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: cannam@125: #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) cannam@125: cannam@125: /* declarations of non-ANSI functions */ cannam@125: #if defined __MINGW32__ cannam@125: # ifdef __STRICT_ANSI__ cannam@125: int _putenv (const char *); cannam@125: # endif cannam@125: #elif defined __CYGWIN__ cannam@125: # ifdef __STRICT_ANSI__ cannam@125: char *realpath (const char *, char *); cannam@125: int putenv (char *); cannam@125: int setenv (const char *, const char *, int); cannam@125: # endif cannam@125: /* #elif defined other_platform || defined ... */ cannam@125: #endif cannam@125: cannam@125: /* portability defines, excluding path handling macros */ cannam@125: #if defined _MSC_VER cannam@125: # define setmode _setmode cannam@125: # define stat _stat cannam@125: # define chmod _chmod cannam@125: # define getcwd _getcwd cannam@125: # define putenv _putenv cannam@125: # define S_IXUSR _S_IEXEC cannam@125: #elif defined __MINGW32__ cannam@125: # define setmode _setmode cannam@125: # define stat _stat cannam@125: # define chmod _chmod cannam@125: # define getcwd _getcwd cannam@125: # define putenv _putenv cannam@125: #elif defined __CYGWIN__ cannam@125: # define HAVE_SETENV cannam@125: # define FOPEN_WB "wb" cannam@125: /* #elif defined other platforms ... */ cannam@125: #endif cannam@125: cannam@125: #if defined PATH_MAX cannam@125: # define LT_PATHMAX PATH_MAX cannam@125: #elif defined MAXPATHLEN cannam@125: # define LT_PATHMAX MAXPATHLEN cannam@125: #else cannam@125: # define LT_PATHMAX 1024 cannam@125: #endif cannam@125: cannam@125: #ifndef S_IXOTH cannam@125: # define S_IXOTH 0 cannam@125: #endif cannam@125: #ifndef S_IXGRP cannam@125: # define S_IXGRP 0 cannam@125: #endif cannam@125: cannam@125: /* path handling portability macros */ cannam@125: #ifndef DIR_SEPARATOR cannam@125: # define DIR_SEPARATOR '/' cannam@125: # define PATH_SEPARATOR ':' cannam@125: #endif cannam@125: cannam@125: #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ cannam@125: defined __OS2__ cannam@125: # define HAVE_DOS_BASED_FILE_SYSTEM cannam@125: # define FOPEN_WB "wb" cannam@125: # ifndef DIR_SEPARATOR_2 cannam@125: # define DIR_SEPARATOR_2 '\\' cannam@125: # endif cannam@125: # ifndef PATH_SEPARATOR_2 cannam@125: # define PATH_SEPARATOR_2 ';' cannam@125: # endif cannam@125: #endif cannam@125: cannam@125: #ifndef DIR_SEPARATOR_2 cannam@125: # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) cannam@125: #else /* DIR_SEPARATOR_2 */ cannam@125: # define IS_DIR_SEPARATOR(ch) \ cannam@125: (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) cannam@125: #endif /* DIR_SEPARATOR_2 */ cannam@125: cannam@125: #ifndef PATH_SEPARATOR_2 cannam@125: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) cannam@125: #else /* PATH_SEPARATOR_2 */ cannam@125: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) cannam@125: #endif /* PATH_SEPARATOR_2 */ cannam@125: cannam@125: #ifndef FOPEN_WB cannam@125: # define FOPEN_WB "w" cannam@125: #endif cannam@125: #ifndef _O_BINARY cannam@125: # define _O_BINARY 0 cannam@125: #endif cannam@125: cannam@125: #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) cannam@125: #define XFREE(stale) do { \ cannam@125: if (stale) { free (stale); stale = 0; } \ cannam@125: } while (0) cannam@125: cannam@125: #if defined LT_DEBUGWRAPPER cannam@125: static int lt_debug = 1; cannam@125: #else cannam@125: static int lt_debug = 0; cannam@125: #endif cannam@125: cannam@125: const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ cannam@125: cannam@125: void *xmalloc (size_t num); cannam@125: char *xstrdup (const char *string); cannam@125: const char *base_name (const char *name); cannam@125: char *find_executable (const char *wrapper); cannam@125: char *chase_symlinks (const char *pathspec); cannam@125: int make_executable (const char *path); cannam@125: int check_executable (const char *path); cannam@125: char *strendzap (char *str, const char *pat); cannam@125: void lt_debugprintf (const char *file, int line, const char *fmt, ...); cannam@125: void lt_fatal (const char *file, int line, const char *message, ...); cannam@125: static const char *nonnull (const char *s); cannam@125: static const char *nonempty (const char *s); cannam@125: void lt_setenv (const char *name, const char *value); cannam@125: char *lt_extend_str (const char *orig_value, const char *add, int to_end); cannam@125: void lt_update_exe_path (const char *name, const char *value); cannam@125: void lt_update_lib_path (const char *name, const char *value); cannam@125: char **prepare_spawn (char **argv); cannam@125: void lt_dump_script (FILE *f); cannam@125: EOF cannam@125: cannam@125: cat <= 0) cannam@125: && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) cannam@125: return 1; cannam@125: else cannam@125: return 0; cannam@125: } cannam@125: cannam@125: int cannam@125: make_executable (const char *path) cannam@125: { cannam@125: int rval = 0; cannam@125: struct stat st; cannam@125: cannam@125: lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", cannam@125: nonempty (path)); cannam@125: if ((!path) || (!*path)) cannam@125: return 0; cannam@125: cannam@125: if (stat (path, &st) >= 0) cannam@125: { cannam@125: rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); cannam@125: } cannam@125: return rval; cannam@125: } cannam@125: cannam@125: /* Searches for the full path of the wrapper. Returns cannam@125: newly allocated full path name if found, NULL otherwise cannam@125: Does not chase symlinks, even on platforms that support them. cannam@125: */ cannam@125: char * cannam@125: find_executable (const char *wrapper) cannam@125: { cannam@125: int has_slash = 0; cannam@125: const char *p; cannam@125: const char *p_next; cannam@125: /* static buffer for getcwd */ cannam@125: char tmp[LT_PATHMAX + 1]; cannam@125: size_t tmp_len; cannam@125: char *concat_name; cannam@125: cannam@125: lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", cannam@125: nonempty (wrapper)); cannam@125: cannam@125: if ((wrapper == NULL) || (*wrapper == '\0')) cannam@125: return NULL; cannam@125: cannam@125: /* Absolute path? */ cannam@125: #if defined HAVE_DOS_BASED_FILE_SYSTEM cannam@125: if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') cannam@125: { cannam@125: concat_name = xstrdup (wrapper); cannam@125: if (check_executable (concat_name)) cannam@125: return concat_name; cannam@125: XFREE (concat_name); cannam@125: } cannam@125: else cannam@125: { cannam@125: #endif cannam@125: if (IS_DIR_SEPARATOR (wrapper[0])) cannam@125: { cannam@125: concat_name = xstrdup (wrapper); cannam@125: if (check_executable (concat_name)) cannam@125: return concat_name; cannam@125: XFREE (concat_name); cannam@125: } cannam@125: #if defined HAVE_DOS_BASED_FILE_SYSTEM cannam@125: } cannam@125: #endif cannam@125: cannam@125: for (p = wrapper; *p; p++) cannam@125: if (*p == '/') cannam@125: { cannam@125: has_slash = 1; cannam@125: break; cannam@125: } cannam@125: if (!has_slash) cannam@125: { cannam@125: /* no slashes; search PATH */ cannam@125: const char *path = getenv ("PATH"); cannam@125: if (path != NULL) cannam@125: { cannam@125: for (p = path; *p; p = p_next) cannam@125: { cannam@125: const char *q; cannam@125: size_t p_len; cannam@125: for (q = p; *q; q++) cannam@125: if (IS_PATH_SEPARATOR (*q)) cannam@125: break; cannam@125: p_len = (size_t) (q - p); cannam@125: p_next = (*q == '\0' ? q : q + 1); cannam@125: if (p_len == 0) cannam@125: { cannam@125: /* empty path: current directory */ cannam@125: if (getcwd (tmp, LT_PATHMAX) == NULL) cannam@125: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", cannam@125: nonnull (strerror (errno))); cannam@125: tmp_len = strlen (tmp); cannam@125: concat_name = cannam@125: XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); cannam@125: memcpy (concat_name, tmp, tmp_len); cannam@125: concat_name[tmp_len] = '/'; cannam@125: strcpy (concat_name + tmp_len + 1, wrapper); cannam@125: } cannam@125: else cannam@125: { cannam@125: concat_name = cannam@125: XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); cannam@125: memcpy (concat_name, p, p_len); cannam@125: concat_name[p_len] = '/'; cannam@125: strcpy (concat_name + p_len + 1, wrapper); cannam@125: } cannam@125: if (check_executable (concat_name)) cannam@125: return concat_name; cannam@125: XFREE (concat_name); cannam@125: } cannam@125: } cannam@125: /* not found in PATH; assume curdir */ cannam@125: } cannam@125: /* Relative path | not found in path: prepend cwd */ cannam@125: if (getcwd (tmp, LT_PATHMAX) == NULL) cannam@125: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", cannam@125: nonnull (strerror (errno))); cannam@125: tmp_len = strlen (tmp); cannam@125: concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); cannam@125: memcpy (concat_name, tmp, tmp_len); cannam@125: concat_name[tmp_len] = '/'; cannam@125: strcpy (concat_name + tmp_len + 1, wrapper); cannam@125: cannam@125: if (check_executable (concat_name)) cannam@125: return concat_name; cannam@125: XFREE (concat_name); cannam@125: return NULL; cannam@125: } cannam@125: cannam@125: char * cannam@125: chase_symlinks (const char *pathspec) cannam@125: { cannam@125: #ifndef S_ISLNK cannam@125: return xstrdup (pathspec); cannam@125: #else cannam@125: char buf[LT_PATHMAX]; cannam@125: struct stat s; cannam@125: char *tmp_pathspec = xstrdup (pathspec); cannam@125: char *p; cannam@125: int has_symlinks = 0; cannam@125: while (strlen (tmp_pathspec) && !has_symlinks) cannam@125: { cannam@125: lt_debugprintf (__FILE__, __LINE__, cannam@125: "checking path component for symlinks: %s\n", cannam@125: tmp_pathspec); cannam@125: if (lstat (tmp_pathspec, &s) == 0) cannam@125: { cannam@125: if (S_ISLNK (s.st_mode) != 0) cannam@125: { cannam@125: has_symlinks = 1; cannam@125: break; cannam@125: } cannam@125: cannam@125: /* search backwards for last DIR_SEPARATOR */ cannam@125: p = tmp_pathspec + strlen (tmp_pathspec) - 1; cannam@125: while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) cannam@125: p--; cannam@125: if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) cannam@125: { cannam@125: /* no more DIR_SEPARATORS left */ cannam@125: break; cannam@125: } cannam@125: *p = '\0'; cannam@125: } cannam@125: else cannam@125: { cannam@125: lt_fatal (__FILE__, __LINE__, cannam@125: "error accessing file \"%s\": %s", cannam@125: tmp_pathspec, nonnull (strerror (errno))); cannam@125: } cannam@125: } cannam@125: XFREE (tmp_pathspec); cannam@125: cannam@125: if (!has_symlinks) cannam@125: { cannam@125: return xstrdup (pathspec); cannam@125: } cannam@125: cannam@125: tmp_pathspec = realpath (pathspec, buf); cannam@125: if (tmp_pathspec == 0) cannam@125: { cannam@125: lt_fatal (__FILE__, __LINE__, cannam@125: "could not follow symlinks for %s", pathspec); cannam@125: } cannam@125: return xstrdup (tmp_pathspec); cannam@125: #endif cannam@125: } cannam@125: cannam@125: char * cannam@125: strendzap (char *str, const char *pat) cannam@125: { cannam@125: size_t len, patlen; cannam@125: cannam@125: assert (str != NULL); cannam@125: assert (pat != NULL); cannam@125: cannam@125: len = strlen (str); cannam@125: patlen = strlen (pat); cannam@125: cannam@125: if (patlen <= len) cannam@125: { cannam@125: str += len - patlen; cannam@125: if (STREQ (str, pat)) cannam@125: *str = '\0'; cannam@125: } cannam@125: return str; cannam@125: } cannam@125: cannam@125: void cannam@125: lt_debugprintf (const char *file, int line, const char *fmt, ...) cannam@125: { cannam@125: va_list args; cannam@125: if (lt_debug) cannam@125: { cannam@125: (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); cannam@125: va_start (args, fmt); cannam@125: (void) vfprintf (stderr, fmt, args); cannam@125: va_end (args); cannam@125: } cannam@125: } cannam@125: cannam@125: static void cannam@125: lt_error_core (int exit_status, const char *file, cannam@125: int line, const char *mode, cannam@125: const char *message, va_list ap) cannam@125: { cannam@125: fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); cannam@125: vfprintf (stderr, message, ap); cannam@125: fprintf (stderr, ".\n"); cannam@125: cannam@125: if (exit_status >= 0) cannam@125: exit (exit_status); cannam@125: } cannam@125: cannam@125: void cannam@125: lt_fatal (const char *file, int line, const char *message, ...) cannam@125: { cannam@125: va_list ap; cannam@125: va_start (ap, message); cannam@125: lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); cannam@125: va_end (ap); cannam@125: } cannam@125: cannam@125: static const char * cannam@125: nonnull (const char *s) cannam@125: { cannam@125: return s ? s : "(null)"; cannam@125: } cannam@125: cannam@125: static const char * cannam@125: nonempty (const char *s) cannam@125: { cannam@125: return (s && !*s) ? "(empty)" : nonnull (s); cannam@125: } cannam@125: cannam@125: void cannam@125: lt_setenv (const char *name, const char *value) cannam@125: { cannam@125: lt_debugprintf (__FILE__, __LINE__, cannam@125: "(lt_setenv) setting '%s' to '%s'\n", cannam@125: nonnull (name), nonnull (value)); cannam@125: { cannam@125: #ifdef HAVE_SETENV cannam@125: /* always make a copy, for consistency with !HAVE_SETENV */ cannam@125: char *str = xstrdup (value); cannam@125: setenv (name, str, 1); cannam@125: #else cannam@125: size_t len = strlen (name) + 1 + strlen (value) + 1; cannam@125: char *str = XMALLOC (char, len); cannam@125: sprintf (str, "%s=%s", name, value); cannam@125: if (putenv (str) != EXIT_SUCCESS) cannam@125: { cannam@125: XFREE (str); cannam@125: } cannam@125: #endif cannam@125: } cannam@125: } cannam@125: cannam@125: char * cannam@125: lt_extend_str (const char *orig_value, const char *add, int to_end) cannam@125: { cannam@125: char *new_value; cannam@125: if (orig_value && *orig_value) cannam@125: { cannam@125: size_t orig_value_len = strlen (orig_value); cannam@125: size_t add_len = strlen (add); cannam@125: new_value = XMALLOC (char, add_len + orig_value_len + 1); cannam@125: if (to_end) cannam@125: { cannam@125: strcpy (new_value, orig_value); cannam@125: strcpy (new_value + orig_value_len, add); cannam@125: } cannam@125: else cannam@125: { cannam@125: strcpy (new_value, add); cannam@125: strcpy (new_value + add_len, orig_value); cannam@125: } cannam@125: } cannam@125: else cannam@125: { cannam@125: new_value = xstrdup (add); cannam@125: } cannam@125: return new_value; cannam@125: } cannam@125: cannam@125: void cannam@125: lt_update_exe_path (const char *name, const char *value) cannam@125: { cannam@125: lt_debugprintf (__FILE__, __LINE__, cannam@125: "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", cannam@125: nonnull (name), nonnull (value)); cannam@125: cannam@125: if (name && *name && value && *value) cannam@125: { cannam@125: char *new_value = lt_extend_str (getenv (name), value, 0); cannam@125: /* some systems can't cope with a ':'-terminated path #' */ cannam@125: size_t len = strlen (new_value); cannam@125: while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) cannam@125: { cannam@125: new_value[--len] = '\0'; cannam@125: } cannam@125: lt_setenv (name, new_value); cannam@125: XFREE (new_value); cannam@125: } cannam@125: } cannam@125: cannam@125: void cannam@125: lt_update_lib_path (const char *name, const char *value) cannam@125: { cannam@125: lt_debugprintf (__FILE__, __LINE__, cannam@125: "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", cannam@125: nonnull (name), nonnull (value)); cannam@125: cannam@125: if (name && *name && value && *value) cannam@125: { cannam@125: char *new_value = lt_extend_str (getenv (name), value, 0); cannam@125: lt_setenv (name, new_value); cannam@125: XFREE (new_value); cannam@125: } cannam@125: } cannam@125: cannam@125: EOF cannam@125: case $host_os in cannam@125: mingw*) cannam@125: cat <<"EOF" cannam@125: cannam@125: /* Prepares an argument vector before calling spawn(). cannam@125: Note that spawn() does not by itself call the command interpreter cannam@125: (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : cannam@125: ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); cannam@125: GetVersionEx(&v); cannam@125: v.dwPlatformId == VER_PLATFORM_WIN32_NT; cannam@125: }) ? "cmd.exe" : "command.com"). cannam@125: Instead it simply concatenates the arguments, separated by ' ', and calls cannam@125: CreateProcess(). We must quote the arguments since Win32 CreateProcess() cannam@125: interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a cannam@125: special way: cannam@125: - Space and tab are interpreted as delimiters. They are not treated as cannam@125: delimiters if they are surrounded by double quotes: "...". cannam@125: - Unescaped double quotes are removed from the input. Their only effect is cannam@125: that within double quotes, space and tab are treated like normal cannam@125: characters. cannam@125: - Backslashes not followed by double quotes are not special. cannam@125: - But 2*n+1 backslashes followed by a double quote become cannam@125: n backslashes followed by a double quote (n >= 0): cannam@125: \" -> " cannam@125: \\\" -> \" cannam@125: \\\\\" -> \\" cannam@125: */ cannam@125: #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" cannam@125: #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" cannam@125: char ** cannam@125: prepare_spawn (char **argv) cannam@125: { cannam@125: size_t argc; cannam@125: char **new_argv; cannam@125: size_t i; cannam@125: cannam@125: /* Count number of arguments. */ cannam@125: for (argc = 0; argv[argc] != NULL; argc++) cannam@125: ; cannam@125: cannam@125: /* Allocate new argument vector. */ cannam@125: new_argv = XMALLOC (char *, argc + 1); cannam@125: cannam@125: /* Put quoted arguments into the new argument vector. */ cannam@125: for (i = 0; i < argc; i++) cannam@125: { cannam@125: const char *string = argv[i]; cannam@125: cannam@125: if (string[0] == '\0') cannam@125: new_argv[i] = xstrdup ("\"\""); cannam@125: else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) cannam@125: { cannam@125: int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); cannam@125: size_t length; cannam@125: unsigned int backslashes; cannam@125: const char *s; cannam@125: char *quoted_string; cannam@125: char *p; cannam@125: cannam@125: length = 0; cannam@125: backslashes = 0; cannam@125: if (quote_around) cannam@125: length++; cannam@125: for (s = string; *s != '\0'; s++) cannam@125: { cannam@125: char c = *s; cannam@125: if (c == '"') cannam@125: length += backslashes + 1; cannam@125: length++; cannam@125: if (c == '\\') cannam@125: backslashes++; cannam@125: else cannam@125: backslashes = 0; cannam@125: } cannam@125: if (quote_around) cannam@125: length += backslashes + 1; cannam@125: cannam@125: quoted_string = XMALLOC (char, length + 1); cannam@125: cannam@125: p = quoted_string; cannam@125: backslashes = 0; cannam@125: if (quote_around) cannam@125: *p++ = '"'; cannam@125: for (s = string; *s != '\0'; s++) cannam@125: { cannam@125: char c = *s; cannam@125: if (c == '"') cannam@125: { cannam@125: unsigned int j; cannam@125: for (j = backslashes + 1; j > 0; j--) cannam@125: *p++ = '\\'; cannam@125: } cannam@125: *p++ = c; cannam@125: if (c == '\\') cannam@125: backslashes++; cannam@125: else cannam@125: backslashes = 0; cannam@125: } cannam@125: if (quote_around) cannam@125: { cannam@125: unsigned int j; cannam@125: for (j = backslashes; j > 0; j--) cannam@125: *p++ = '\\'; cannam@125: *p++ = '"'; cannam@125: } cannam@125: *p = '\0'; cannam@125: cannam@125: new_argv[i] = quoted_string; cannam@125: } cannam@125: else cannam@125: new_argv[i] = (char *) string; cannam@125: } cannam@125: new_argv[argc] = NULL; cannam@125: cannam@125: return new_argv; cannam@125: } cannam@125: EOF cannam@125: ;; cannam@125: esac cannam@125: cannam@125: cat <<"EOF" cannam@125: void lt_dump_script (FILE* f) cannam@125: { cannam@125: EOF cannam@125: func_emit_wrapper yes | cannam@125: $SED -n -e ' cannam@125: s/^\(.\{79\}\)\(..*\)/\1\ cannam@125: \2/ cannam@125: h cannam@125: s/\([\\"]\)/\\\1/g cannam@125: s/$/\\n/ cannam@125: s/\([^\n]*\).*/ fputs ("\1", f);/p cannam@125: g cannam@125: D' cannam@125: cat <<"EOF" cannam@125: } cannam@125: EOF cannam@125: } cannam@125: # end: func_emit_cwrapperexe_src cannam@125: cannam@125: # func_win32_import_lib_p ARG cannam@125: # True if ARG is an import lib, as indicated by $file_magic_cmd cannam@125: func_win32_import_lib_p () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in cannam@125: *import*) : ;; cannam@125: *) false ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: # func_suncc_cstd_abi cannam@125: # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! cannam@125: # Several compiler flags select an ABI that is incompatible with the cannam@125: # Cstd library. Avoid specifying it if any are in CXXFLAGS. cannam@125: func_suncc_cstd_abi () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case " $compile_command " in cannam@125: *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) cannam@125: suncc_use_cstd_abi=no cannam@125: ;; cannam@125: *) cannam@125: suncc_use_cstd_abi=yes cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: # func_mode_link arg... cannam@125: func_mode_link () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) cannam@125: # It is impossible to link a dll without this setting, and cannam@125: # we shouldn't force the makefile maintainer to figure out cannam@125: # what system we are compiling for in order to pass an extra cannam@125: # flag for every libtool invocation. cannam@125: # allow_undefined=no cannam@125: cannam@125: # FIXME: Unfortunately, there are problems with the above when trying cannam@125: # to make a dll that has undefined symbols, in which case not cannam@125: # even a static library is built. For now, we need to specify cannam@125: # -no-undefined on the libtool link line when we can be certain cannam@125: # that all symbols are satisfied, otherwise we get a static library. cannam@125: allow_undefined=yes cannam@125: ;; cannam@125: *) cannam@125: allow_undefined=yes cannam@125: ;; cannam@125: esac cannam@125: libtool_args=$nonopt cannam@125: base_compile="$nonopt $@" cannam@125: compile_command=$nonopt cannam@125: finalize_command=$nonopt cannam@125: cannam@125: compile_rpath= cannam@125: finalize_rpath= cannam@125: compile_shlibpath= cannam@125: finalize_shlibpath= cannam@125: convenience= cannam@125: old_convenience= cannam@125: deplibs= cannam@125: old_deplibs= cannam@125: compiler_flags= cannam@125: linker_flags= cannam@125: dllsearchpath= cannam@125: lib_search_path=`pwd` cannam@125: inst_prefix_dir= cannam@125: new_inherited_linker_flags= cannam@125: cannam@125: avoid_version=no cannam@125: bindir= cannam@125: dlfiles= cannam@125: dlprefiles= cannam@125: dlself=no cannam@125: export_dynamic=no cannam@125: export_symbols= cannam@125: export_symbols_regex= cannam@125: generated= cannam@125: libobjs= cannam@125: ltlibs= cannam@125: module=no cannam@125: no_install=no cannam@125: objs= cannam@125: os2dllname= cannam@125: non_pic_objects= cannam@125: precious_files_regex= cannam@125: prefer_static_libs=no cannam@125: preload=false cannam@125: prev= cannam@125: prevarg= cannam@125: release= cannam@125: rpath= cannam@125: xrpath= cannam@125: perm_rpath= cannam@125: temp_rpath= cannam@125: thread_safe=no cannam@125: vinfo= cannam@125: vinfo_number=no cannam@125: weak_libs= cannam@125: single_module=$wl-single_module cannam@125: func_infer_tag $base_compile cannam@125: cannam@125: # We need to know -static, to get the right output filenames. cannam@125: for arg cannam@125: do cannam@125: case $arg in cannam@125: -shared) cannam@125: test yes != "$build_libtool_libs" \ cannam@125: && func_fatal_configuration "cannot build a shared library" cannam@125: build_old_libs=no cannam@125: break cannam@125: ;; cannam@125: -all-static | -static | -static-libtool-libs) cannam@125: case $arg in cannam@125: -all-static) cannam@125: if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then cannam@125: func_warning "complete static linking is impossible in this configuration" cannam@125: fi cannam@125: if test -n "$link_static_flag"; then cannam@125: dlopen_self=$dlopen_self_static cannam@125: fi cannam@125: prefer_static_libs=yes cannam@125: ;; cannam@125: -static) cannam@125: if test -z "$pic_flag" && test -n "$link_static_flag"; then cannam@125: dlopen_self=$dlopen_self_static cannam@125: fi cannam@125: prefer_static_libs=built cannam@125: ;; cannam@125: -static-libtool-libs) cannam@125: if test -z "$pic_flag" && test -n "$link_static_flag"; then cannam@125: dlopen_self=$dlopen_self_static cannam@125: fi cannam@125: prefer_static_libs=yes cannam@125: ;; cannam@125: esac cannam@125: build_libtool_libs=no cannam@125: build_old_libs=yes cannam@125: break cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # See if our shared archives depend on static archives. cannam@125: test -n "$old_archive_from_new_cmds" && build_old_libs=yes cannam@125: cannam@125: # Go through the arguments, transforming them on the way. cannam@125: while test "$#" -gt 0; do cannam@125: arg=$1 cannam@125: shift cannam@125: func_quote_for_eval "$arg" cannam@125: qarg=$func_quote_for_eval_unquoted_result cannam@125: func_append libtool_args " $func_quote_for_eval_result" cannam@125: cannam@125: # If the previous option needs an argument, assign it. cannam@125: if test -n "$prev"; then cannam@125: case $prev in cannam@125: output) cannam@125: func_append compile_command " @OUTPUT@" cannam@125: func_append finalize_command " @OUTPUT@" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: case $prev in cannam@125: bindir) cannam@125: bindir=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: dlfiles|dlprefiles) cannam@125: $preload || { cannam@125: # Add the symbol object into the linking commands. cannam@125: func_append compile_command " @SYMFILE@" cannam@125: func_append finalize_command " @SYMFILE@" cannam@125: preload=: cannam@125: } cannam@125: case $arg in cannam@125: *.la | *.lo) ;; # We handle these cases below. cannam@125: force) cannam@125: if test no = "$dlself"; then cannam@125: dlself=needless cannam@125: export_dynamic=yes cannam@125: fi cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: self) cannam@125: if test dlprefiles = "$prev"; then cannam@125: dlself=yes cannam@125: elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then cannam@125: dlself=yes cannam@125: else cannam@125: dlself=needless cannam@125: export_dynamic=yes cannam@125: fi cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: *) cannam@125: if test dlfiles = "$prev"; then cannam@125: func_append dlfiles " $arg" cannam@125: else cannam@125: func_append dlprefiles " $arg" cannam@125: fi cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: expsyms) cannam@125: export_symbols=$arg cannam@125: test -f "$arg" \ cannam@125: || func_fatal_error "symbol file '$arg' does not exist" cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: expsyms_regex) cannam@125: export_symbols_regex=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: framework) cannam@125: case $host in cannam@125: *-*-darwin*) cannam@125: case "$deplibs " in cannam@125: *" $qarg.ltframework "*) ;; cannam@125: *) func_append deplibs " $qarg.ltframework" # this is fixed later cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: inst_prefix) cannam@125: inst_prefix_dir=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: mllvm) cannam@125: # Clang does not use LLVM to link, so we can simply discard any cannam@125: # '-mllvm $arg' options when doing the link step. cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: objectlist) cannam@125: if test -f "$arg"; then cannam@125: save_arg=$arg cannam@125: moreargs= cannam@125: for fil in `cat "$save_arg"` cannam@125: do cannam@125: # func_append moreargs " $fil" cannam@125: arg=$fil cannam@125: # A libtool-controlled object. cannam@125: cannam@125: # Check to see that this really is a libtool object. cannam@125: if func_lalib_unsafe_p "$arg"; then cannam@125: pic_object= cannam@125: non_pic_object= cannam@125: cannam@125: # Read the .lo file cannam@125: func_source "$arg" cannam@125: cannam@125: if test -z "$pic_object" || cannam@125: test -z "$non_pic_object" || cannam@125: test none = "$pic_object" && cannam@125: test none = "$non_pic_object"; then cannam@125: func_fatal_error "cannot find name of object for '$arg'" cannam@125: fi cannam@125: cannam@125: # Extract subdirectory from the argument. cannam@125: func_dirname "$arg" "/" "" cannam@125: xdir=$func_dirname_result cannam@125: cannam@125: if test none != "$pic_object"; then cannam@125: # Prepend the subdirectory the object is found in. cannam@125: pic_object=$xdir$pic_object cannam@125: cannam@125: if test dlfiles = "$prev"; then cannam@125: if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then cannam@125: func_append dlfiles " $pic_object" cannam@125: prev= cannam@125: continue cannam@125: else cannam@125: # If libtool objects are unsupported, then we need to preload. cannam@125: prev=dlprefiles cannam@125: fi cannam@125: fi cannam@125: cannam@125: # CHECK ME: I think I busted this. -Ossama cannam@125: if test dlprefiles = "$prev"; then cannam@125: # Preload the old-style object. cannam@125: func_append dlprefiles " $pic_object" cannam@125: prev= cannam@125: fi cannam@125: cannam@125: # A PIC object. cannam@125: func_append libobjs " $pic_object" cannam@125: arg=$pic_object cannam@125: fi cannam@125: cannam@125: # Non-PIC object. cannam@125: if test none != "$non_pic_object"; then cannam@125: # Prepend the subdirectory the object is found in. cannam@125: non_pic_object=$xdir$non_pic_object cannam@125: cannam@125: # A standard non-PIC object cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: if test -z "$pic_object" || test none = "$pic_object"; then cannam@125: arg=$non_pic_object cannam@125: fi cannam@125: else cannam@125: # If the PIC object exists, use it instead. cannam@125: # $xdir was prepended to $pic_object above. cannam@125: non_pic_object=$pic_object cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: fi cannam@125: else cannam@125: # Only an error if not doing a dry-run. cannam@125: if $opt_dry_run; then cannam@125: # Extract subdirectory from the argument. cannam@125: func_dirname "$arg" "/" "" cannam@125: xdir=$func_dirname_result cannam@125: cannam@125: func_lo2o "$arg" cannam@125: pic_object=$xdir$objdir/$func_lo2o_result cannam@125: non_pic_object=$xdir$func_lo2o_result cannam@125: func_append libobjs " $pic_object" cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: else cannam@125: func_fatal_error "'$arg' is not a valid libtool object" cannam@125: fi cannam@125: fi cannam@125: done cannam@125: else cannam@125: func_fatal_error "link input file '$arg' does not exist" cannam@125: fi cannam@125: arg=$save_arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: os2dllname) cannam@125: os2dllname=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: precious_regex) cannam@125: precious_files_regex=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: release) cannam@125: release=-$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: rpath | xrpath) cannam@125: # We need an absolute path. cannam@125: case $arg in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) ;; cannam@125: *) cannam@125: func_fatal_error "only absolute run-paths are allowed" cannam@125: ;; cannam@125: esac cannam@125: if test rpath = "$prev"; then cannam@125: case "$rpath " in cannam@125: *" $arg "*) ;; cannam@125: *) func_append rpath " $arg" ;; cannam@125: esac cannam@125: else cannam@125: case "$xrpath " in cannam@125: *" $arg "*) ;; cannam@125: *) func_append xrpath " $arg" ;; cannam@125: esac cannam@125: fi cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: shrext) cannam@125: shrext_cmds=$arg cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: weak) cannam@125: func_append weak_libs " $arg" cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: xcclinker) cannam@125: func_append linker_flags " $qarg" cannam@125: func_append compiler_flags " $qarg" cannam@125: prev= cannam@125: func_append compile_command " $qarg" cannam@125: func_append finalize_command " $qarg" cannam@125: continue cannam@125: ;; cannam@125: xcompiler) cannam@125: func_append compiler_flags " $qarg" cannam@125: prev= cannam@125: func_append compile_command " $qarg" cannam@125: func_append finalize_command " $qarg" cannam@125: continue cannam@125: ;; cannam@125: xlinker) cannam@125: func_append linker_flags " $qarg" cannam@125: func_append compiler_flags " $wl$qarg" cannam@125: prev= cannam@125: func_append compile_command " $wl$qarg" cannam@125: func_append finalize_command " $wl$qarg" cannam@125: continue cannam@125: ;; cannam@125: *) cannam@125: eval "$prev=\"\$arg\"" cannam@125: prev= cannam@125: continue cannam@125: ;; cannam@125: esac cannam@125: fi # test -n "$prev" cannam@125: cannam@125: prevarg=$arg cannam@125: cannam@125: case $arg in cannam@125: -all-static) cannam@125: if test -n "$link_static_flag"; then cannam@125: # See comment for -static flag below, for more details. cannam@125: func_append compile_command " $link_static_flag" cannam@125: func_append finalize_command " $link_static_flag" cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -allow-undefined) cannam@125: # FIXME: remove this flag sometime in the future. cannam@125: func_fatal_error "'-allow-undefined' must not be used because it is the default" cannam@125: ;; cannam@125: cannam@125: -avoid-version) cannam@125: avoid_version=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -bindir) cannam@125: prev=bindir cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -dlopen) cannam@125: prev=dlfiles cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -dlpreopen) cannam@125: prev=dlprefiles cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -export-dynamic) cannam@125: export_dynamic=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -export-symbols | -export-symbols-regex) cannam@125: if test -n "$export_symbols" || test -n "$export_symbols_regex"; then cannam@125: func_fatal_error "more than one -exported-symbols argument is not allowed" cannam@125: fi cannam@125: if test X-export-symbols = "X$arg"; then cannam@125: prev=expsyms cannam@125: else cannam@125: prev=expsyms_regex cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -framework) cannam@125: prev=framework cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -inst-prefix-dir) cannam@125: prev=inst_prefix cannam@125: continue cannam@125: ;; cannam@125: cannam@125: # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* cannam@125: # so, if we see these flags be careful not to treat them like -L cannam@125: -L[A-Z][A-Z]*:*) cannam@125: case $with_gcc/$host in cannam@125: no/*-*-irix* | /*-*-irix*) cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -L*) cannam@125: func_stripname "-L" '' "$arg" cannam@125: if test -z "$func_stripname_result"; then cannam@125: if test "$#" -gt 0; then cannam@125: func_fatal_error "require no space between '-L' and '$1'" cannam@125: else cannam@125: func_fatal_error "need path for '-L' option" cannam@125: fi cannam@125: fi cannam@125: func_resolve_sysroot "$func_stripname_result" cannam@125: dir=$func_resolve_sysroot_result cannam@125: # We need an absolute path. cannam@125: case $dir in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) ;; cannam@125: *) cannam@125: absdir=`cd "$dir" && pwd` cannam@125: test -z "$absdir" && \ cannam@125: func_fatal_error "cannot determine absolute directory name of '$dir'" cannam@125: dir=$absdir cannam@125: ;; cannam@125: esac cannam@125: case "$deplibs " in cannam@125: *" -L$dir "* | *" $arg "*) cannam@125: # Will only happen for absolute or sysroot arguments cannam@125: ;; cannam@125: *) cannam@125: # Preserve sysroot, but never include relative directories cannam@125: case $dir in cannam@125: [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; cannam@125: *) func_append deplibs " -L$dir" ;; cannam@125: esac cannam@125: func_append lib_search_path " $dir" cannam@125: ;; cannam@125: esac cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) cannam@125: testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` cannam@125: case :$dllsearchpath: in cannam@125: *":$dir:"*) ;; cannam@125: ::) dllsearchpath=$dir;; cannam@125: *) func_append dllsearchpath ":$dir";; cannam@125: esac cannam@125: case :$dllsearchpath: in cannam@125: *":$testbindir:"*) ;; cannam@125: ::) dllsearchpath=$testbindir;; cannam@125: *) func_append dllsearchpath ":$testbindir";; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -l*) cannam@125: if test X-lc = "X$arg" || test X-lm = "X$arg"; then cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) cannam@125: # These systems don't actually have a C or math library (as such) cannam@125: continue cannam@125: ;; cannam@125: *-*-os2*) cannam@125: # These systems don't actually have a C library (as such) cannam@125: test X-lc = "X$arg" && continue cannam@125: ;; cannam@125: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) cannam@125: # Do not include libc due to us having libc/libc_r. cannam@125: test X-lc = "X$arg" && continue cannam@125: ;; cannam@125: *-*-rhapsody* | *-*-darwin1.[012]) cannam@125: # Rhapsody C and math libraries are in the System framework cannam@125: func_append deplibs " System.ltframework" cannam@125: continue cannam@125: ;; cannam@125: *-*-sco3.2v5* | *-*-sco5v6*) cannam@125: # Causes problems with __ctype cannam@125: test X-lc = "X$arg" && continue cannam@125: ;; cannam@125: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) cannam@125: # Compiler inserts libc in the correct place for threads to work cannam@125: test X-lc = "X$arg" && continue cannam@125: ;; cannam@125: esac cannam@125: elif test X-lc_r = "X$arg"; then cannam@125: case $host in cannam@125: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) cannam@125: # Do not include libc_r directly, use -pthread flag. cannam@125: continue cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: func_append deplibs " $arg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -mllvm) cannam@125: prev=mllvm cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -module) cannam@125: module=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: # Tru64 UNIX uses -model [arg] to determine the layout of C++ cannam@125: # classes, name mangling, and exception handling. cannam@125: # Darwin uses the -arch flag to determine output architecture. cannam@125: -model|-arch|-isysroot|--sysroot) cannam@125: func_append compiler_flags " $arg" cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: prev=xcompiler cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ cannam@125: |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) cannam@125: func_append compiler_flags " $arg" cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: case "$new_inherited_linker_flags " in cannam@125: *" $arg "*) ;; cannam@125: * ) func_append new_inherited_linker_flags " $arg" ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -multi_module) cannam@125: single_module=$wl-multi_module cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -no-fast-install) cannam@125: fast_install=no cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -no-install) cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) cannam@125: # The PATH hackery in wrapper scripts is required on Windows cannam@125: # and Darwin in order for the loader to find any dlls it needs. cannam@125: func_warning "'-no-install' is ignored for $host" cannam@125: func_warning "assuming '-no-fast-install' instead" cannam@125: fast_install=no cannam@125: ;; cannam@125: *) no_install=yes ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -no-undefined) cannam@125: allow_undefined=no cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -objectlist) cannam@125: prev=objectlist cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -os2dllname) cannam@125: prev=os2dllname cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -o) prev=output ;; cannam@125: cannam@125: -precious-files-regex) cannam@125: prev=precious_regex cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -release) cannam@125: prev=release cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -rpath) cannam@125: prev=rpath cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -R) cannam@125: prev=xrpath cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -R*) cannam@125: func_stripname '-R' '' "$arg" cannam@125: dir=$func_stripname_result cannam@125: # We need an absolute path. cannam@125: case $dir in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) ;; cannam@125: =*) cannam@125: func_stripname '=' '' "$dir" cannam@125: dir=$lt_sysroot$func_stripname_result cannam@125: ;; cannam@125: *) cannam@125: func_fatal_error "only absolute run-paths are allowed" cannam@125: ;; cannam@125: esac cannam@125: case "$xrpath " in cannam@125: *" $dir "*) ;; cannam@125: *) func_append xrpath " $dir" ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -shared) cannam@125: # The effects of -shared are defined in a previous loop. cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -shrext) cannam@125: prev=shrext cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -static | -static-libtool-libs) cannam@125: # The effects of -static are defined in a previous loop. cannam@125: # We used to do the same as -all-static on platforms that cannam@125: # didn't have a PIC flag, but the assumption that the effects cannam@125: # would be equivalent was wrong. It would break on at least cannam@125: # Digital Unix and AIX. cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -thread-safe) cannam@125: thread_safe=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -version-info) cannam@125: prev=vinfo cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -version-number) cannam@125: prev=vinfo cannam@125: vinfo_number=yes cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -weak) cannam@125: prev=weak cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -Wc,*) cannam@125: func_stripname '-Wc,' '' "$arg" cannam@125: args=$func_stripname_result cannam@125: arg= cannam@125: save_ifs=$IFS; IFS=, cannam@125: for flag in $args; do cannam@125: IFS=$save_ifs cannam@125: func_quote_for_eval "$flag" cannam@125: func_append arg " $func_quote_for_eval_result" cannam@125: func_append compiler_flags " $func_quote_for_eval_result" cannam@125: done cannam@125: IFS=$save_ifs cannam@125: func_stripname ' ' '' "$arg" cannam@125: arg=$func_stripname_result cannam@125: ;; cannam@125: cannam@125: -Wl,*) cannam@125: func_stripname '-Wl,' '' "$arg" cannam@125: args=$func_stripname_result cannam@125: arg= cannam@125: save_ifs=$IFS; IFS=, cannam@125: for flag in $args; do cannam@125: IFS=$save_ifs cannam@125: func_quote_for_eval "$flag" cannam@125: func_append arg " $wl$func_quote_for_eval_result" cannam@125: func_append compiler_flags " $wl$func_quote_for_eval_result" cannam@125: func_append linker_flags " $func_quote_for_eval_result" cannam@125: done cannam@125: IFS=$save_ifs cannam@125: func_stripname ' ' '' "$arg" cannam@125: arg=$func_stripname_result cannam@125: ;; cannam@125: cannam@125: -Xcompiler) cannam@125: prev=xcompiler cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -Xlinker) cannam@125: prev=xlinker cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -XCClinker) cannam@125: prev=xcclinker cannam@125: continue cannam@125: ;; cannam@125: cannam@125: # -msg_* for osf cc cannam@125: -msg_*) cannam@125: func_quote_for_eval "$arg" cannam@125: arg=$func_quote_for_eval_result cannam@125: ;; cannam@125: cannam@125: # Flags to be passed through unchanged, with rationale: cannam@125: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler cannam@125: # -r[0-9][0-9]* specify processor for the SGI compiler cannam@125: # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler cannam@125: # +DA*, +DD* enable 64-bit mode for the HP compiler cannam@125: # -q* compiler args for the IBM compiler cannam@125: # -m*, -t[45]*, -txscale* architecture-specific flags for GCC cannam@125: # -F/path path to uninstalled frameworks, gcc on darwin cannam@125: # -p, -pg, --coverage, -fprofile-* profiling flags for GCC cannam@125: # -fstack-protector* stack protector flags for GCC cannam@125: # @file GCC response files cannam@125: # -tp=* Portland pgcc target processor selection cannam@125: # --sysroot=* for sysroot support cannam@125: # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization cannam@125: # -specs=* GCC specs files cannam@125: # -stdlib=* select c++ std lib with clang cannam@125: # -fsanitize=* Clang/GCC memory and address sanitizer cannam@125: -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ cannam@125: -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ cannam@125: -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ cannam@125: -specs=*|-fsanitize=*) cannam@125: func_quote_for_eval "$arg" cannam@125: arg=$func_quote_for_eval_result cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: func_append compiler_flags " $arg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: -Z*) cannam@125: if test os2 = "`expr $host : '.*\(os2\)'`"; then cannam@125: # OS/2 uses -Zxxx to specify OS/2-specific options cannam@125: compiler_flags="$compiler_flags $arg" cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: case $arg in cannam@125: -Zlinker | -Zstack) cannam@125: prev=xcompiler cannam@125: ;; cannam@125: esac cannam@125: continue cannam@125: else cannam@125: # Otherwise treat like 'Some other compiler flag' below cannam@125: func_quote_for_eval "$arg" cannam@125: arg=$func_quote_for_eval_result cannam@125: fi cannam@125: ;; cannam@125: cannam@125: # Some other compiler flag. cannam@125: -* | +*) cannam@125: func_quote_for_eval "$arg" cannam@125: arg=$func_quote_for_eval_result cannam@125: ;; cannam@125: cannam@125: *.$objext) cannam@125: # A standard object. cannam@125: func_append objs " $arg" cannam@125: ;; cannam@125: cannam@125: *.lo) cannam@125: # A libtool-controlled object. cannam@125: cannam@125: # Check to see that this really is a libtool object. cannam@125: if func_lalib_unsafe_p "$arg"; then cannam@125: pic_object= cannam@125: non_pic_object= cannam@125: cannam@125: # Read the .lo file cannam@125: func_source "$arg" cannam@125: cannam@125: if test -z "$pic_object" || cannam@125: test -z "$non_pic_object" || cannam@125: test none = "$pic_object" && cannam@125: test none = "$non_pic_object"; then cannam@125: func_fatal_error "cannot find name of object for '$arg'" cannam@125: fi cannam@125: cannam@125: # Extract subdirectory from the argument. cannam@125: func_dirname "$arg" "/" "" cannam@125: xdir=$func_dirname_result cannam@125: cannam@125: test none = "$pic_object" || { cannam@125: # Prepend the subdirectory the object is found in. cannam@125: pic_object=$xdir$pic_object cannam@125: cannam@125: if test dlfiles = "$prev"; then cannam@125: if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then cannam@125: func_append dlfiles " $pic_object" cannam@125: prev= cannam@125: continue cannam@125: else cannam@125: # If libtool objects are unsupported, then we need to preload. cannam@125: prev=dlprefiles cannam@125: fi cannam@125: fi cannam@125: cannam@125: # CHECK ME: I think I busted this. -Ossama cannam@125: if test dlprefiles = "$prev"; then cannam@125: # Preload the old-style object. cannam@125: func_append dlprefiles " $pic_object" cannam@125: prev= cannam@125: fi cannam@125: cannam@125: # A PIC object. cannam@125: func_append libobjs " $pic_object" cannam@125: arg=$pic_object cannam@125: } cannam@125: cannam@125: # Non-PIC object. cannam@125: if test none != "$non_pic_object"; then cannam@125: # Prepend the subdirectory the object is found in. cannam@125: non_pic_object=$xdir$non_pic_object cannam@125: cannam@125: # A standard non-PIC object cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: if test -z "$pic_object" || test none = "$pic_object"; then cannam@125: arg=$non_pic_object cannam@125: fi cannam@125: else cannam@125: # If the PIC object exists, use it instead. cannam@125: # $xdir was prepended to $pic_object above. cannam@125: non_pic_object=$pic_object cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: fi cannam@125: else cannam@125: # Only an error if not doing a dry-run. cannam@125: if $opt_dry_run; then cannam@125: # Extract subdirectory from the argument. cannam@125: func_dirname "$arg" "/" "" cannam@125: xdir=$func_dirname_result cannam@125: cannam@125: func_lo2o "$arg" cannam@125: pic_object=$xdir$objdir/$func_lo2o_result cannam@125: non_pic_object=$xdir$func_lo2o_result cannam@125: func_append libobjs " $pic_object" cannam@125: func_append non_pic_objects " $non_pic_object" cannam@125: else cannam@125: func_fatal_error "'$arg' is not a valid libtool object" cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: cannam@125: *.$libext) cannam@125: # An archive. cannam@125: func_append deplibs " $arg" cannam@125: func_append old_deplibs " $arg" cannam@125: continue cannam@125: ;; cannam@125: cannam@125: *.la) cannam@125: # A libtool-controlled library. cannam@125: cannam@125: func_resolve_sysroot "$arg" cannam@125: if test dlfiles = "$prev"; then cannam@125: # This library was specified with -dlopen. cannam@125: func_append dlfiles " $func_resolve_sysroot_result" cannam@125: prev= cannam@125: elif test dlprefiles = "$prev"; then cannam@125: # The library was specified with -dlpreopen. cannam@125: func_append dlprefiles " $func_resolve_sysroot_result" cannam@125: prev= cannam@125: else cannam@125: func_append deplibs " $func_resolve_sysroot_result" cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: cannam@125: # Some other compiler argument. cannam@125: *) cannam@125: # Unknown arguments in both finalize_command and compile_command need cannam@125: # to be aesthetically quoted because they are evaled later. cannam@125: func_quote_for_eval "$arg" cannam@125: arg=$func_quote_for_eval_result cannam@125: ;; cannam@125: esac # arg cannam@125: cannam@125: # Now actually substitute the argument into the commands. cannam@125: if test -n "$arg"; then cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: fi cannam@125: done # argument parsing loop cannam@125: cannam@125: test -n "$prev" && \ cannam@125: func_fatal_help "the '$prevarg' option requires an argument" cannam@125: cannam@125: if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then cannam@125: eval arg=\"$export_dynamic_flag_spec\" cannam@125: func_append compile_command " $arg" cannam@125: func_append finalize_command " $arg" cannam@125: fi cannam@125: cannam@125: oldlibs= cannam@125: # calculate the name of the file, without its directory cannam@125: func_basename "$output" cannam@125: outputname=$func_basename_result cannam@125: libobjs_save=$libobjs cannam@125: cannam@125: if test -n "$shlibpath_var"; then cannam@125: # get the directories listed in $shlibpath_var cannam@125: eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` cannam@125: else cannam@125: shlib_search_path= cannam@125: fi cannam@125: eval sys_lib_search_path=\"$sys_lib_search_path_spec\" cannam@125: eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" cannam@125: cannam@125: # Definition is injected by LT_CONFIG during libtool generation. cannam@125: func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" cannam@125: cannam@125: func_dirname "$output" "/" "" cannam@125: output_objdir=$func_dirname_result$objdir cannam@125: func_to_tool_file "$output_objdir/" cannam@125: tool_output_objdir=$func_to_tool_file_result cannam@125: # Create the object directory. cannam@125: func_mkdir_p "$output_objdir" cannam@125: cannam@125: # Determine the type of output cannam@125: case $output in cannam@125: "") cannam@125: func_fatal_help "you must specify an output file" cannam@125: ;; cannam@125: *.$libext) linkmode=oldlib ;; cannam@125: *.lo | *.$objext) linkmode=obj ;; cannam@125: *.la) linkmode=lib ;; cannam@125: *) linkmode=prog ;; # Anything else should be a program. cannam@125: esac cannam@125: cannam@125: specialdeplibs= cannam@125: cannam@125: libs= cannam@125: # Find all interdependent deplibs by searching for libraries cannam@125: # that are linked more than once (e.g. -la -lb -la) cannam@125: for deplib in $deplibs; do cannam@125: if $opt_preserve_dup_deps; then cannam@125: case "$libs " in cannam@125: *" $deplib "*) func_append specialdeplibs " $deplib" ;; cannam@125: esac cannam@125: fi cannam@125: func_append libs " $deplib" cannam@125: done cannam@125: cannam@125: if test lib = "$linkmode"; then cannam@125: libs="$predeps $libs $compiler_lib_search_path $postdeps" cannam@125: cannam@125: # Compute libraries that are listed more than once in $predeps cannam@125: # $postdeps and mark them as special (i.e., whose duplicates are cannam@125: # not to be eliminated). cannam@125: pre_post_deps= cannam@125: if $opt_duplicate_compiler_generated_deps; then cannam@125: for pre_post_dep in $predeps $postdeps; do cannam@125: case "$pre_post_deps " in cannam@125: *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; cannam@125: esac cannam@125: func_append pre_post_deps " $pre_post_dep" cannam@125: done cannam@125: fi cannam@125: pre_post_deps= cannam@125: fi cannam@125: cannam@125: deplibs= cannam@125: newdependency_libs= cannam@125: newlib_search_path= cannam@125: need_relink=no # whether we're linking any uninstalled libtool libraries cannam@125: notinst_deplibs= # not-installed libtool libraries cannam@125: notinst_path= # paths that contain not-installed libtool libraries cannam@125: cannam@125: case $linkmode in cannam@125: lib) cannam@125: passes="conv dlpreopen link" cannam@125: for file in $dlfiles $dlprefiles; do cannam@125: case $file in cannam@125: *.la) ;; cannam@125: *) cannam@125: func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: ;; cannam@125: prog) cannam@125: compile_deplibs= cannam@125: finalize_deplibs= cannam@125: alldeplibs=false cannam@125: newdlfiles= cannam@125: newdlprefiles= cannam@125: passes="conv scan dlopen dlpreopen link" cannam@125: ;; cannam@125: *) passes="conv" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: for pass in $passes; do cannam@125: # The preopen pass in lib mode reverses $deplibs; put it back here cannam@125: # so that -L comes before libs that need it for instance... cannam@125: if test lib,link = "$linkmode,$pass"; then cannam@125: ## FIXME: Find the place where the list is rebuilt in the wrong cannam@125: ## order, and fix it there properly cannam@125: tmp_deplibs= cannam@125: for deplib in $deplibs; do cannam@125: tmp_deplibs="$deplib $tmp_deplibs" cannam@125: done cannam@125: deplibs=$tmp_deplibs cannam@125: fi cannam@125: cannam@125: if test lib,link = "$linkmode,$pass" || cannam@125: test prog,scan = "$linkmode,$pass"; then cannam@125: libs=$deplibs cannam@125: deplibs= cannam@125: fi cannam@125: if test prog = "$linkmode"; then cannam@125: case $pass in cannam@125: dlopen) libs=$dlfiles ;; cannam@125: dlpreopen) libs=$dlprefiles ;; cannam@125: link) cannam@125: libs="$deplibs %DEPLIBS%" cannam@125: test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: if test lib,dlpreopen = "$linkmode,$pass"; then cannam@125: # Collect and forward deplibs of preopened libtool libs cannam@125: for lib in $dlprefiles; do cannam@125: # Ignore non-libtool-libs cannam@125: dependency_libs= cannam@125: func_resolve_sysroot "$lib" cannam@125: case $lib in cannam@125: *.la) func_source "$func_resolve_sysroot_result" ;; cannam@125: esac cannam@125: cannam@125: # Collect preopened libtool deplibs, except any this library cannam@125: # has declared as weak libs cannam@125: for deplib in $dependency_libs; do cannam@125: func_basename "$deplib" cannam@125: deplib_base=$func_basename_result cannam@125: case " $weak_libs " in cannam@125: *" $deplib_base "*) ;; cannam@125: *) func_append deplibs " $deplib" ;; cannam@125: esac cannam@125: done cannam@125: done cannam@125: libs=$dlprefiles cannam@125: fi cannam@125: if test dlopen = "$pass"; then cannam@125: # Collect dlpreopened libraries cannam@125: save_deplibs=$deplibs cannam@125: deplibs= cannam@125: fi cannam@125: cannam@125: for deplib in $libs; do cannam@125: lib= cannam@125: found=false cannam@125: case $deplib in cannam@125: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ cannam@125: |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: else cannam@125: func_append compiler_flags " $deplib" cannam@125: if test lib = "$linkmode"; then cannam@125: case "$new_inherited_linker_flags " in cannam@125: *" $deplib "*) ;; cannam@125: * ) func_append new_inherited_linker_flags " $deplib" ;; cannam@125: esac cannam@125: fi cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: -l*) cannam@125: if test lib != "$linkmode" && test prog != "$linkmode"; then cannam@125: func_warning "'-l' is ignored for archives/objects" cannam@125: continue cannam@125: fi cannam@125: func_stripname '-l' '' "$deplib" cannam@125: name=$func_stripname_result cannam@125: if test lib = "$linkmode"; then cannam@125: searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" cannam@125: else cannam@125: searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" cannam@125: fi cannam@125: for searchdir in $searchdirs; do cannam@125: for search_ext in .la $std_shrext .so .a; do cannam@125: # Search the libtool library cannam@125: lib=$searchdir/lib$name$search_ext cannam@125: if test -f "$lib"; then cannam@125: if test .la = "$search_ext"; then cannam@125: found=: cannam@125: else cannam@125: found=false cannam@125: fi cannam@125: break 2 cannam@125: fi cannam@125: done cannam@125: done cannam@125: if $found; then cannam@125: # deplib is a libtool library cannam@125: # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, cannam@125: # We need to do some special things here, and not later. cannam@125: if test yes = "$allow_libtool_libs_with_static_runtimes"; then cannam@125: case " $predeps $postdeps " in cannam@125: *" $deplib "*) cannam@125: if func_lalib_p "$lib"; then cannam@125: library_names= cannam@125: old_library= cannam@125: func_source "$lib" cannam@125: for l in $old_library $library_names; do cannam@125: ll=$l cannam@125: done cannam@125: if test "X$ll" = "X$old_library"; then # only static version available cannam@125: found=false cannam@125: func_dirname "$lib" "" "." cannam@125: ladir=$func_dirname_result cannam@125: lib=$ladir/$old_library cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: else cannam@125: deplibs="$deplib $deplibs" cannam@125: test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" cannam@125: fi cannam@125: continue cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: *) ;; cannam@125: esac cannam@125: fi cannam@125: else cannam@125: # deplib doesn't seem to be a libtool library cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: else cannam@125: deplibs="$deplib $deplibs" cannam@125: test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" cannam@125: fi cannam@125: continue cannam@125: fi cannam@125: ;; # -l cannam@125: *.ltframework) cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: else cannam@125: deplibs="$deplib $deplibs" cannam@125: if test lib = "$linkmode"; then cannam@125: case "$new_inherited_linker_flags " in cannam@125: *" $deplib "*) ;; cannam@125: * ) func_append new_inherited_linker_flags " $deplib" ;; cannam@125: esac cannam@125: fi cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: -L*) cannam@125: case $linkmode in cannam@125: lib) cannam@125: deplibs="$deplib $deplibs" cannam@125: test conv = "$pass" && continue cannam@125: newdependency_libs="$deplib $newdependency_libs" cannam@125: func_stripname '-L' '' "$deplib" cannam@125: func_resolve_sysroot "$func_stripname_result" cannam@125: func_append newlib_search_path " $func_resolve_sysroot_result" cannam@125: ;; cannam@125: prog) cannam@125: if test conv = "$pass"; then cannam@125: deplibs="$deplib $deplibs" cannam@125: continue cannam@125: fi cannam@125: if test scan = "$pass"; then cannam@125: deplibs="$deplib $deplibs" cannam@125: else cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: fi cannam@125: func_stripname '-L' '' "$deplib" cannam@125: func_resolve_sysroot "$func_stripname_result" cannam@125: func_append newlib_search_path " $func_resolve_sysroot_result" cannam@125: ;; cannam@125: *) cannam@125: func_warning "'-L' is ignored for archives/objects" cannam@125: ;; cannam@125: esac # linkmode cannam@125: continue cannam@125: ;; # -L cannam@125: -R*) cannam@125: if test link = "$pass"; then cannam@125: func_stripname '-R' '' "$deplib" cannam@125: func_resolve_sysroot "$func_stripname_result" cannam@125: dir=$func_resolve_sysroot_result cannam@125: # Make sure the xrpath contains only unique directories. cannam@125: case "$xrpath " in cannam@125: *" $dir "*) ;; cannam@125: *) func_append xrpath " $dir" ;; cannam@125: esac cannam@125: fi cannam@125: deplibs="$deplib $deplibs" cannam@125: continue cannam@125: ;; cannam@125: *.la) cannam@125: func_resolve_sysroot "$deplib" cannam@125: lib=$func_resolve_sysroot_result cannam@125: ;; cannam@125: *.$libext) cannam@125: if test conv = "$pass"; then cannam@125: deplibs="$deplib $deplibs" cannam@125: continue cannam@125: fi cannam@125: case $linkmode in cannam@125: lib) cannam@125: # Linking convenience modules into shared libraries is allowed, cannam@125: # but linking other static libraries is non-portable. cannam@125: case " $dlpreconveniencelibs " in cannam@125: *" $deplib "*) ;; cannam@125: *) cannam@125: valid_a_lib=false cannam@125: case $deplibs_check_method in cannam@125: match_pattern*) cannam@125: set dummy $deplibs_check_method; shift cannam@125: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` cannam@125: if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ cannam@125: | $EGREP "$match_pattern_regex" > /dev/null; then cannam@125: valid_a_lib=: cannam@125: fi cannam@125: ;; cannam@125: pass_all) cannam@125: valid_a_lib=: cannam@125: ;; cannam@125: esac cannam@125: if $valid_a_lib; then cannam@125: echo cannam@125: $ECHO "*** Warning: Linking the shared library $output against the" cannam@125: $ECHO "*** static library $deplib is not portable!" cannam@125: deplibs="$deplib $deplibs" cannam@125: else cannam@125: echo cannam@125: $ECHO "*** Warning: Trying to link with static lib archive $deplib." cannam@125: echo "*** I have the capability to make that library automatically link in when" cannam@125: echo "*** you link to this library. But I can only do this if you have a" cannam@125: echo "*** shared version of the library, which you do not appear to have" cannam@125: echo "*** because the file extensions .$libext of this argument makes me believe" cannam@125: echo "*** that it is just a static archive that I should not use here." cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: continue cannam@125: ;; cannam@125: prog) cannam@125: if test link != "$pass"; then cannam@125: deplibs="$deplib $deplibs" cannam@125: else cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: esac # linkmode cannam@125: ;; # *.$libext cannam@125: *.lo | *.$objext) cannam@125: if test conv = "$pass"; then cannam@125: deplibs="$deplib $deplibs" cannam@125: elif test prog = "$linkmode"; then cannam@125: if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then cannam@125: # If there is no dlopen support or we're linking statically, cannam@125: # we need to preload. cannam@125: func_append newdlprefiles " $deplib" cannam@125: compile_deplibs="$deplib $compile_deplibs" cannam@125: finalize_deplibs="$deplib $finalize_deplibs" cannam@125: else cannam@125: func_append newdlfiles " $deplib" cannam@125: fi cannam@125: fi cannam@125: continue cannam@125: ;; cannam@125: %DEPLIBS%) cannam@125: alldeplibs=: cannam@125: continue cannam@125: ;; cannam@125: esac # case $deplib cannam@125: cannam@125: $found || test -f "$lib" \ cannam@125: || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" cannam@125: cannam@125: # Check to see that this really is a libtool archive. cannam@125: func_lalib_unsafe_p "$lib" \ cannam@125: || func_fatal_error "'$lib' is not a valid libtool archive" cannam@125: cannam@125: func_dirname "$lib" "" "." cannam@125: ladir=$func_dirname_result cannam@125: cannam@125: dlname= cannam@125: dlopen= cannam@125: dlpreopen= cannam@125: libdir= cannam@125: library_names= cannam@125: old_library= cannam@125: inherited_linker_flags= cannam@125: # If the library was installed with an old release of libtool, cannam@125: # it will not redefine variables installed, or shouldnotlink cannam@125: installed=yes cannam@125: shouldnotlink=no cannam@125: avoidtemprpath= cannam@125: cannam@125: cannam@125: # Read the .la file cannam@125: func_source "$lib" cannam@125: cannam@125: # Convert "-framework foo" to "foo.ltframework" cannam@125: if test -n "$inherited_linker_flags"; then cannam@125: tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` cannam@125: for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do cannam@125: case " $new_inherited_linker_flags " in cannam@125: *" $tmp_inherited_linker_flag "*) ;; cannam@125: *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; cannam@125: esac cannam@125: done cannam@125: fi cannam@125: dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: if test lib,link = "$linkmode,$pass" || cannam@125: test prog,scan = "$linkmode,$pass" || cannam@125: { test prog != "$linkmode" && test lib != "$linkmode"; }; then cannam@125: test -n "$dlopen" && func_append dlfiles " $dlopen" cannam@125: test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" cannam@125: fi cannam@125: cannam@125: if test conv = "$pass"; then cannam@125: # Only check for convenience libraries cannam@125: deplibs="$lib $deplibs" cannam@125: if test -z "$libdir"; then cannam@125: if test -z "$old_library"; then cannam@125: func_fatal_error "cannot find name of link library for '$lib'" cannam@125: fi cannam@125: # It is a libtool convenience library, so add in its objects. cannam@125: func_append convenience " $ladir/$objdir/$old_library" cannam@125: func_append old_convenience " $ladir/$objdir/$old_library" cannam@125: tmp_libs= cannam@125: for deplib in $dependency_libs; do cannam@125: deplibs="$deplib $deplibs" cannam@125: if $opt_preserve_dup_deps; then cannam@125: case "$tmp_libs " in cannam@125: *" $deplib "*) func_append specialdeplibs " $deplib" ;; cannam@125: esac cannam@125: fi cannam@125: func_append tmp_libs " $deplib" cannam@125: done cannam@125: elif test prog != "$linkmode" && test lib != "$linkmode"; then cannam@125: func_fatal_error "'$lib' is not a convenience library" cannam@125: fi cannam@125: continue cannam@125: fi # $pass = conv cannam@125: cannam@125: cannam@125: # Get the name of the library we link against. cannam@125: linklib= cannam@125: if test -n "$old_library" && cannam@125: { test yes = "$prefer_static_libs" || cannam@125: test built,no = "$prefer_static_libs,$installed"; }; then cannam@125: linklib=$old_library cannam@125: else cannam@125: for l in $old_library $library_names; do cannam@125: linklib=$l cannam@125: done cannam@125: fi cannam@125: if test -z "$linklib"; then cannam@125: func_fatal_error "cannot find name of link library for '$lib'" cannam@125: fi cannam@125: cannam@125: # This library was specified with -dlopen. cannam@125: if test dlopen = "$pass"; then cannam@125: test -z "$libdir" \ cannam@125: && func_fatal_error "cannot -dlopen a convenience library: '$lib'" cannam@125: if test -z "$dlname" || cannam@125: test yes != "$dlopen_support" || cannam@125: test no = "$build_libtool_libs" cannam@125: then cannam@125: # If there is no dlname, no dlopen support or we're linking cannam@125: # statically, we need to preload. We also need to preload any cannam@125: # dependent libraries so libltdl's deplib preloader doesn't cannam@125: # bomb out in the load deplibs phase. cannam@125: func_append dlprefiles " $lib $dependency_libs" cannam@125: else cannam@125: func_append newdlfiles " $lib" cannam@125: fi cannam@125: continue cannam@125: fi # $pass = dlopen cannam@125: cannam@125: # We need an absolute path. cannam@125: case $ladir in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; cannam@125: *) cannam@125: abs_ladir=`cd "$ladir" && pwd` cannam@125: if test -z "$abs_ladir"; then cannam@125: func_warning "cannot determine absolute directory name of '$ladir'" cannam@125: func_warning "passing it literally to the linker, although it might fail" cannam@125: abs_ladir=$ladir cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: func_basename "$lib" cannam@125: laname=$func_basename_result cannam@125: cannam@125: # Find the relevant object directory and library name. cannam@125: if test yes = "$installed"; then cannam@125: if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then cannam@125: func_warning "library '$lib' was moved." cannam@125: dir=$ladir cannam@125: absdir=$abs_ladir cannam@125: libdir=$abs_ladir cannam@125: else cannam@125: dir=$lt_sysroot$libdir cannam@125: absdir=$lt_sysroot$libdir cannam@125: fi cannam@125: test yes = "$hardcode_automatic" && avoidtemprpath=yes cannam@125: else cannam@125: if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then cannam@125: dir=$ladir cannam@125: absdir=$abs_ladir cannam@125: # Remove this search path later cannam@125: func_append notinst_path " $abs_ladir" cannam@125: else cannam@125: dir=$ladir/$objdir cannam@125: absdir=$abs_ladir/$objdir cannam@125: # Remove this search path later cannam@125: func_append notinst_path " $abs_ladir" cannam@125: fi cannam@125: fi # $installed = yes cannam@125: func_stripname 'lib' '.la' "$laname" cannam@125: name=$func_stripname_result cannam@125: cannam@125: # This library was specified with -dlpreopen. cannam@125: if test dlpreopen = "$pass"; then cannam@125: if test -z "$libdir" && test prog = "$linkmode"; then cannam@125: func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" cannam@125: fi cannam@125: case $host in cannam@125: # special handling for platforms with PE-DLLs. cannam@125: *cygwin* | *mingw* | *cegcc* ) cannam@125: # Linker will automatically link against shared library if both cannam@125: # static and shared are present. Therefore, ensure we extract cannam@125: # symbols from the import library if a shared library is present cannam@125: # (otherwise, the dlopen module name will be incorrect). We do cannam@125: # this by putting the import library name into $newdlprefiles. cannam@125: # We recover the dlopen module name by 'saving' the la file cannam@125: # name in a special purpose variable, and (later) extracting the cannam@125: # dlname from the la file. cannam@125: if test -n "$dlname"; then cannam@125: func_tr_sh "$dir/$linklib" cannam@125: eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" cannam@125: func_append newdlprefiles " $dir/$linklib" cannam@125: else cannam@125: func_append newdlprefiles " $dir/$old_library" cannam@125: # Keep a list of preopened convenience libraries to check cannam@125: # that they are being used correctly in the link pass. cannam@125: test -z "$libdir" && \ cannam@125: func_append dlpreconveniencelibs " $dir/$old_library" cannam@125: fi cannam@125: ;; cannam@125: * ) cannam@125: # Prefer using a static library (so that no silly _DYNAMIC symbols cannam@125: # are required to link). cannam@125: if test -n "$old_library"; then cannam@125: func_append newdlprefiles " $dir/$old_library" cannam@125: # Keep a list of preopened convenience libraries to check cannam@125: # that they are being used correctly in the link pass. cannam@125: test -z "$libdir" && \ cannam@125: func_append dlpreconveniencelibs " $dir/$old_library" cannam@125: # Otherwise, use the dlname, so that lt_dlopen finds it. cannam@125: elif test -n "$dlname"; then cannam@125: func_append newdlprefiles " $dir/$dlname" cannam@125: else cannam@125: func_append newdlprefiles " $dir/$linklib" cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: fi # $pass = dlpreopen cannam@125: cannam@125: if test -z "$libdir"; then cannam@125: # Link the convenience library cannam@125: if test lib = "$linkmode"; then cannam@125: deplibs="$dir/$old_library $deplibs" cannam@125: elif test prog,link = "$linkmode,$pass"; then cannam@125: compile_deplibs="$dir/$old_library $compile_deplibs" cannam@125: finalize_deplibs="$dir/$old_library $finalize_deplibs" cannam@125: else cannam@125: deplibs="$lib $deplibs" # used for prog,scan pass cannam@125: fi cannam@125: continue cannam@125: fi cannam@125: cannam@125: cannam@125: if test prog = "$linkmode" && test link != "$pass"; then cannam@125: func_append newlib_search_path " $ladir" cannam@125: deplibs="$lib $deplibs" cannam@125: cannam@125: linkalldeplibs=false cannam@125: if test no != "$link_all_deplibs" || test -z "$library_names" || cannam@125: test no = "$build_libtool_libs"; then cannam@125: linkalldeplibs=: cannam@125: fi cannam@125: cannam@125: tmp_libs= cannam@125: for deplib in $dependency_libs; do cannam@125: case $deplib in cannam@125: -L*) func_stripname '-L' '' "$deplib" cannam@125: func_resolve_sysroot "$func_stripname_result" cannam@125: func_append newlib_search_path " $func_resolve_sysroot_result" cannam@125: ;; cannam@125: esac cannam@125: # Need to link against all dependency_libs? cannam@125: if $linkalldeplibs; then cannam@125: deplibs="$deplib $deplibs" cannam@125: else cannam@125: # Need to hardcode shared library paths cannam@125: # or/and link against static libraries cannam@125: newdependency_libs="$deplib $newdependency_libs" cannam@125: fi cannam@125: if $opt_preserve_dup_deps; then cannam@125: case "$tmp_libs " in cannam@125: *" $deplib "*) func_append specialdeplibs " $deplib" ;; cannam@125: esac cannam@125: fi cannam@125: func_append tmp_libs " $deplib" cannam@125: done # for deplib cannam@125: continue cannam@125: fi # $linkmode = prog... cannam@125: cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: if test -n "$library_names" && cannam@125: { { test no = "$prefer_static_libs" || cannam@125: test built,yes = "$prefer_static_libs,$installed"; } || cannam@125: test -z "$old_library"; }; then cannam@125: # We need to hardcode the library path cannam@125: if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then cannam@125: # Make sure the rpath contains only unique directories. cannam@125: case $temp_rpath: in cannam@125: *"$absdir:"*) ;; cannam@125: *) func_append temp_rpath "$absdir:" ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: # Hardcode the library path. cannam@125: # Skip directories that are in the system default run-time cannam@125: # search path. cannam@125: case " $sys_lib_dlsearch_path " in cannam@125: *" $absdir "*) ;; cannam@125: *) cannam@125: case "$compile_rpath " in cannam@125: *" $absdir "*) ;; cannam@125: *) func_append compile_rpath " $absdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: case " $sys_lib_dlsearch_path " in cannam@125: *" $libdir "*) ;; cannam@125: *) cannam@125: case "$finalize_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append finalize_rpath " $libdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: fi # $linkmode,$pass = prog,link... cannam@125: cannam@125: if $alldeplibs && cannam@125: { test pass_all = "$deplibs_check_method" || cannam@125: { test yes = "$build_libtool_libs" && cannam@125: test -n "$library_names"; }; }; then cannam@125: # We only need to search for static libraries cannam@125: continue cannam@125: fi cannam@125: fi cannam@125: cannam@125: link_static=no # Whether the deplib will be linked statically cannam@125: use_static_libs=$prefer_static_libs cannam@125: if test built = "$use_static_libs" && test yes = "$installed"; then cannam@125: use_static_libs=no cannam@125: fi cannam@125: if test -n "$library_names" && cannam@125: { test no = "$use_static_libs" || test -z "$old_library"; }; then cannam@125: case $host in cannam@125: *cygwin* | *mingw* | *cegcc* | *os2*) cannam@125: # No point in relinking DLLs because paths are not encoded cannam@125: func_append notinst_deplibs " $lib" cannam@125: need_relink=no cannam@125: ;; cannam@125: *) cannam@125: if test no = "$installed"; then cannam@125: func_append notinst_deplibs " $lib" cannam@125: need_relink=yes cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: # This is a shared library cannam@125: cannam@125: # Warn about portability, can't link against -module's on some cannam@125: # systems (darwin). Don't bleat about dlopened modules though! cannam@125: dlopenmodule= cannam@125: for dlpremoduletest in $dlprefiles; do cannam@125: if test "X$dlpremoduletest" = "X$lib"; then cannam@125: dlopenmodule=$dlpremoduletest cannam@125: break cannam@125: fi cannam@125: done cannam@125: if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then cannam@125: echo cannam@125: if test prog = "$linkmode"; then cannam@125: $ECHO "*** Warning: Linking the executable $output against the loadable module" cannam@125: else cannam@125: $ECHO "*** Warning: Linking the shared library $output against the loadable module" cannam@125: fi cannam@125: $ECHO "*** $linklib is not portable!" cannam@125: fi cannam@125: if test lib = "$linkmode" && cannam@125: test yes = "$hardcode_into_libs"; then cannam@125: # Hardcode the library path. cannam@125: # Skip directories that are in the system default run-time cannam@125: # search path. cannam@125: case " $sys_lib_dlsearch_path " in cannam@125: *" $absdir "*) ;; cannam@125: *) cannam@125: case "$compile_rpath " in cannam@125: *" $absdir "*) ;; cannam@125: *) func_append compile_rpath " $absdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: case " $sys_lib_dlsearch_path " in cannam@125: *" $libdir "*) ;; cannam@125: *) cannam@125: case "$finalize_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append finalize_rpath " $libdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: if test -n "$old_archive_from_expsyms_cmds"; then cannam@125: # figure out the soname cannam@125: set dummy $library_names cannam@125: shift cannam@125: realname=$1 cannam@125: shift cannam@125: libname=`eval "\\$ECHO \"$libname_spec\""` cannam@125: # use dlname if we got it. it's perfectly good, no? cannam@125: if test -n "$dlname"; then cannam@125: soname=$dlname cannam@125: elif test -n "$soname_spec"; then cannam@125: # bleh windows cannam@125: case $host in cannam@125: *cygwin* | mingw* | *cegcc* | *os2*) cannam@125: func_arith $current - $age cannam@125: major=$func_arith_result cannam@125: versuffix=-$major cannam@125: ;; cannam@125: esac cannam@125: eval soname=\"$soname_spec\" cannam@125: else cannam@125: soname=$realname cannam@125: fi cannam@125: cannam@125: # Make a new name for the extract_expsyms_cmds to use cannam@125: soroot=$soname cannam@125: func_basename "$soroot" cannam@125: soname=$func_basename_result cannam@125: func_stripname 'lib' '.dll' "$soname" cannam@125: newlib=libimp-$func_stripname_result.a cannam@125: cannam@125: # If the library has no export list, then create one now cannam@125: if test -f "$output_objdir/$soname-def"; then : cannam@125: else cannam@125: func_verbose "extracting exported symbol list from '$soname'" cannam@125: func_execute_cmds "$extract_expsyms_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: # Create $newlib cannam@125: if test -f "$output_objdir/$newlib"; then :; else cannam@125: func_verbose "generating import library for '$soname'" cannam@125: func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' cannam@125: fi cannam@125: # make sure the library variables are pointing to the new library cannam@125: dir=$output_objdir cannam@125: linklib=$newlib cannam@125: fi # test -n "$old_archive_from_expsyms_cmds" cannam@125: cannam@125: if test prog = "$linkmode" || test relink != "$opt_mode"; then cannam@125: add_shlibpath= cannam@125: add_dir= cannam@125: add= cannam@125: lib_linked=yes cannam@125: case $hardcode_action in cannam@125: immediate | unsupported) cannam@125: if test no = "$hardcode_direct"; then cannam@125: add=$dir/$linklib cannam@125: case $host in cannam@125: *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; cannam@125: *-*-sysv4*uw2*) add_dir=-L$dir ;; cannam@125: *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ cannam@125: *-*-unixware7*) add_dir=-L$dir ;; cannam@125: *-*-darwin* ) cannam@125: # if the lib is a (non-dlopened) module then we cannot cannam@125: # link against it, someone is ignoring the earlier warnings cannam@125: if /usr/bin/file -L $add 2> /dev/null | cannam@125: $GREP ": [^:]* bundle" >/dev/null; then cannam@125: if test "X$dlopenmodule" != "X$lib"; then cannam@125: $ECHO "*** Warning: lib $linklib is a module, not a shared library" cannam@125: if test -z "$old_library"; then cannam@125: echo cannam@125: echo "*** And there doesn't seem to be a static archive available" cannam@125: echo "*** The link will probably fail, sorry" cannam@125: else cannam@125: add=$dir/$old_library cannam@125: fi cannam@125: elif test -n "$old_library"; then cannam@125: add=$dir/$old_library cannam@125: fi cannam@125: fi cannam@125: esac cannam@125: elif test no = "$hardcode_minus_L"; then cannam@125: case $host in cannam@125: *-*-sunos*) add_shlibpath=$dir ;; cannam@125: esac cannam@125: add_dir=-L$dir cannam@125: add=-l$name cannam@125: elif test no = "$hardcode_shlibpath_var"; then cannam@125: add_shlibpath=$dir cannam@125: add=-l$name cannam@125: else cannam@125: lib_linked=no cannam@125: fi cannam@125: ;; cannam@125: relink) cannam@125: if test yes = "$hardcode_direct" && cannam@125: test no = "$hardcode_direct_absolute"; then cannam@125: add=$dir/$linklib cannam@125: elif test yes = "$hardcode_minus_L"; then cannam@125: add_dir=-L$absdir cannam@125: # Try looking first in the location we're being installed to. cannam@125: if test -n "$inst_prefix_dir"; then cannam@125: case $libdir in cannam@125: [\\/]*) cannam@125: func_append add_dir " -L$inst_prefix_dir$libdir" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: add=-l$name cannam@125: elif test yes = "$hardcode_shlibpath_var"; then cannam@125: add_shlibpath=$dir cannam@125: add=-l$name cannam@125: else cannam@125: lib_linked=no cannam@125: fi cannam@125: ;; cannam@125: *) lib_linked=no ;; cannam@125: esac cannam@125: cannam@125: if test yes != "$lib_linked"; then cannam@125: func_fatal_configuration "unsupported hardcode properties" cannam@125: fi cannam@125: cannam@125: if test -n "$add_shlibpath"; then cannam@125: case :$compile_shlibpath: in cannam@125: *":$add_shlibpath:"*) ;; cannam@125: *) func_append compile_shlibpath "$add_shlibpath:" ;; cannam@125: esac cannam@125: fi cannam@125: if test prog = "$linkmode"; then cannam@125: test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" cannam@125: test -n "$add" && compile_deplibs="$add $compile_deplibs" cannam@125: else cannam@125: test -n "$add_dir" && deplibs="$add_dir $deplibs" cannam@125: test -n "$add" && deplibs="$add $deplibs" cannam@125: if test yes != "$hardcode_direct" && cannam@125: test yes != "$hardcode_minus_L" && cannam@125: test yes = "$hardcode_shlibpath_var"; then cannam@125: case :$finalize_shlibpath: in cannam@125: *":$libdir:"*) ;; cannam@125: *) func_append finalize_shlibpath "$libdir:" ;; cannam@125: esac cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test prog = "$linkmode" || test relink = "$opt_mode"; then cannam@125: add_shlibpath= cannam@125: add_dir= cannam@125: add= cannam@125: # Finalize command for both is simple: just hardcode it. cannam@125: if test yes = "$hardcode_direct" && cannam@125: test no = "$hardcode_direct_absolute"; then cannam@125: add=$libdir/$linklib cannam@125: elif test yes = "$hardcode_minus_L"; then cannam@125: add_dir=-L$libdir cannam@125: add=-l$name cannam@125: elif test yes = "$hardcode_shlibpath_var"; then cannam@125: case :$finalize_shlibpath: in cannam@125: *":$libdir:"*) ;; cannam@125: *) func_append finalize_shlibpath "$libdir:" ;; cannam@125: esac cannam@125: add=-l$name cannam@125: elif test yes = "$hardcode_automatic"; then cannam@125: if test -n "$inst_prefix_dir" && cannam@125: test -f "$inst_prefix_dir$libdir/$linklib"; then cannam@125: add=$inst_prefix_dir$libdir/$linklib cannam@125: else cannam@125: add=$libdir/$linklib cannam@125: fi cannam@125: else cannam@125: # We cannot seem to hardcode it, guess we'll fake it. cannam@125: add_dir=-L$libdir cannam@125: # Try looking first in the location we're being installed to. cannam@125: if test -n "$inst_prefix_dir"; then cannam@125: case $libdir in cannam@125: [\\/]*) cannam@125: func_append add_dir " -L$inst_prefix_dir$libdir" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: add=-l$name cannam@125: fi cannam@125: cannam@125: if test prog = "$linkmode"; then cannam@125: test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" cannam@125: test -n "$add" && finalize_deplibs="$add $finalize_deplibs" cannam@125: else cannam@125: test -n "$add_dir" && deplibs="$add_dir $deplibs" cannam@125: test -n "$add" && deplibs="$add $deplibs" cannam@125: fi cannam@125: fi cannam@125: elif test prog = "$linkmode"; then cannam@125: # Here we assume that one of hardcode_direct or hardcode_minus_L cannam@125: # is not unsupported. This is valid on all known static and cannam@125: # shared platforms. cannam@125: if test unsupported != "$hardcode_direct"; then cannam@125: test -n "$old_library" && linklib=$old_library cannam@125: compile_deplibs="$dir/$linklib $compile_deplibs" cannam@125: finalize_deplibs="$dir/$linklib $finalize_deplibs" cannam@125: else cannam@125: compile_deplibs="-l$name -L$dir $compile_deplibs" cannam@125: finalize_deplibs="-l$name -L$dir $finalize_deplibs" cannam@125: fi cannam@125: elif test yes = "$build_libtool_libs"; then cannam@125: # Not a shared library cannam@125: if test pass_all != "$deplibs_check_method"; then cannam@125: # We're trying link a shared library against a static one cannam@125: # but the system doesn't support it. cannam@125: cannam@125: # Just print a warning and add the library to dependency_libs so cannam@125: # that the program can be linked against the static library. cannam@125: echo cannam@125: $ECHO "*** Warning: This system cannot link to static lib archive $lib." cannam@125: echo "*** I have the capability to make that library automatically link in when" cannam@125: echo "*** you link to this library. But I can only do this if you have a" cannam@125: echo "*** shared version of the library, which you do not appear to have." cannam@125: if test yes = "$module"; then cannam@125: echo "*** But as you try to build a module library, libtool will still create " cannam@125: echo "*** a static module, that should work as long as the dlopening application" cannam@125: echo "*** is linked with the -dlopen flag to resolve symbols at runtime." cannam@125: if test -z "$global_symbol_pipe"; then cannam@125: echo cannam@125: echo "*** However, this would only work if libtool was able to extract symbol" cannam@125: echo "*** lists from a program, using 'nm' or equivalent, but libtool could" cannam@125: echo "*** not find such a program. So, this module is probably useless." cannam@125: echo "*** 'nm' from GNU binutils and a full rebuild may help." cannam@125: fi cannam@125: if test no = "$build_old_libs"; then cannam@125: build_libtool_libs=module cannam@125: build_old_libs=yes cannam@125: else cannam@125: build_libtool_libs=no cannam@125: fi cannam@125: fi cannam@125: else cannam@125: deplibs="$dir/$old_library $deplibs" cannam@125: link_static=yes cannam@125: fi cannam@125: fi # link shared/static library? cannam@125: cannam@125: if test lib = "$linkmode"; then cannam@125: if test -n "$dependency_libs" && cannam@125: { test yes != "$hardcode_into_libs" || cannam@125: test yes = "$build_old_libs" || cannam@125: test yes = "$link_static"; }; then cannam@125: # Extract -R from dependency_libs cannam@125: temp_deplibs= cannam@125: for libdir in $dependency_libs; do cannam@125: case $libdir in cannam@125: -R*) func_stripname '-R' '' "$libdir" cannam@125: temp_xrpath=$func_stripname_result cannam@125: case " $xrpath " in cannam@125: *" $temp_xrpath "*) ;; cannam@125: *) func_append xrpath " $temp_xrpath";; cannam@125: esac;; cannam@125: *) func_append temp_deplibs " $libdir";; cannam@125: esac cannam@125: done cannam@125: dependency_libs=$temp_deplibs cannam@125: fi cannam@125: cannam@125: func_append newlib_search_path " $absdir" cannam@125: # Link against this library cannam@125: test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" cannam@125: # ... and its dependency_libs cannam@125: tmp_libs= cannam@125: for deplib in $dependency_libs; do cannam@125: newdependency_libs="$deplib $newdependency_libs" cannam@125: case $deplib in cannam@125: -L*) func_stripname '-L' '' "$deplib" cannam@125: func_resolve_sysroot "$func_stripname_result";; cannam@125: *) func_resolve_sysroot "$deplib" ;; cannam@125: esac cannam@125: if $opt_preserve_dup_deps; then cannam@125: case "$tmp_libs " in cannam@125: *" $func_resolve_sysroot_result "*) cannam@125: func_append specialdeplibs " $func_resolve_sysroot_result" ;; cannam@125: esac cannam@125: fi cannam@125: func_append tmp_libs " $func_resolve_sysroot_result" cannam@125: done cannam@125: cannam@125: if test no != "$link_all_deplibs"; then cannam@125: # Add the search paths of all dependency libraries cannam@125: for deplib in $dependency_libs; do cannam@125: path= cannam@125: case $deplib in cannam@125: -L*) path=$deplib ;; cannam@125: *.la) cannam@125: func_resolve_sysroot "$deplib" cannam@125: deplib=$func_resolve_sysroot_result cannam@125: func_dirname "$deplib" "" "." cannam@125: dir=$func_dirname_result cannam@125: # We need an absolute path. cannam@125: case $dir in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; cannam@125: *) cannam@125: absdir=`cd "$dir" && pwd` cannam@125: if test -z "$absdir"; then cannam@125: func_warning "cannot determine absolute directory name of '$dir'" cannam@125: absdir=$dir cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: if $GREP "^installed=no" $deplib > /dev/null; then cannam@125: case $host in cannam@125: *-*-darwin*) cannam@125: depdepl= cannam@125: eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` cannam@125: if test -n "$deplibrary_names"; then cannam@125: for tmp in $deplibrary_names; do cannam@125: depdepl=$tmp cannam@125: done cannam@125: if test -f "$absdir/$objdir/$depdepl"; then cannam@125: depdepl=$absdir/$objdir/$depdepl cannam@125: darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` cannam@125: if test -z "$darwin_install_name"; then cannam@125: darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` cannam@125: fi cannam@125: func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" cannam@125: func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" cannam@125: path= cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: path=-L$absdir/$objdir cannam@125: ;; cannam@125: esac cannam@125: else cannam@125: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` cannam@125: test -z "$libdir" && \ cannam@125: func_fatal_error "'$deplib' is not a valid libtool archive" cannam@125: test "$absdir" != "$libdir" && \ cannam@125: func_warning "'$deplib' seems to be moved" cannam@125: cannam@125: path=-L$absdir cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: case " $deplibs " in cannam@125: *" $path "*) ;; cannam@125: *) deplibs="$path $deplibs" ;; cannam@125: esac cannam@125: done cannam@125: fi # link_all_deplibs != no cannam@125: fi # linkmode = lib cannam@125: done # for deplib in $libs cannam@125: if test link = "$pass"; then cannam@125: if test prog = "$linkmode"; then cannam@125: compile_deplibs="$new_inherited_linker_flags $compile_deplibs" cannam@125: finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" cannam@125: else cannam@125: compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: fi cannam@125: fi cannam@125: dependency_libs=$newdependency_libs cannam@125: if test dlpreopen = "$pass"; then cannam@125: # Link the dlpreopened libraries before other libraries cannam@125: for deplib in $save_deplibs; do cannam@125: deplibs="$deplib $deplibs" cannam@125: done cannam@125: fi cannam@125: if test dlopen != "$pass"; then cannam@125: test conv = "$pass" || { cannam@125: # Make sure lib_search_path contains only unique directories. cannam@125: lib_search_path= cannam@125: for dir in $newlib_search_path; do cannam@125: case "$lib_search_path " in cannam@125: *" $dir "*) ;; cannam@125: *) func_append lib_search_path " $dir" ;; cannam@125: esac cannam@125: done cannam@125: newlib_search_path= cannam@125: } cannam@125: cannam@125: if test prog,link = "$linkmode,$pass"; then cannam@125: vars="compile_deplibs finalize_deplibs" cannam@125: else cannam@125: vars=deplibs cannam@125: fi cannam@125: for var in $vars dependency_libs; do cannam@125: # Add libraries to $var in reverse order cannam@125: eval tmp_libs=\"\$$var\" cannam@125: new_libs= cannam@125: for deplib in $tmp_libs; do cannam@125: # FIXME: Pedantically, this is the right thing to do, so cannam@125: # that some nasty dependency loop isn't accidentally cannam@125: # broken: cannam@125: #new_libs="$deplib $new_libs" cannam@125: # Pragmatically, this seems to cause very few problems in cannam@125: # practice: cannam@125: case $deplib in cannam@125: -L*) new_libs="$deplib $new_libs" ;; cannam@125: -R*) ;; cannam@125: *) cannam@125: # And here is the reason: when a library appears more cannam@125: # than once as an explicit dependence of a library, or cannam@125: # is implicitly linked in more than once by the cannam@125: # compiler, it is considered special, and multiple cannam@125: # occurrences thereof are not removed. Compare this cannam@125: # with having the same library being listed as a cannam@125: # dependency of multiple other libraries: in this case, cannam@125: # we know (pedantically, we assume) the library does not cannam@125: # need to be listed more than once, so we keep only the cannam@125: # last copy. This is not always right, but it is rare cannam@125: # enough that we require users that really mean to play cannam@125: # such unportable linking tricks to link the library cannam@125: # using -Wl,-lname, so that libtool does not consider it cannam@125: # for duplicate removal. cannam@125: case " $specialdeplibs " in cannam@125: *" $deplib "*) new_libs="$deplib $new_libs" ;; cannam@125: *) cannam@125: case " $new_libs " in cannam@125: *" $deplib "*) ;; cannam@125: *) new_libs="$deplib $new_libs" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: tmp_libs= cannam@125: for deplib in $new_libs; do cannam@125: case $deplib in cannam@125: -L*) cannam@125: case " $tmp_libs " in cannam@125: *" $deplib "*) ;; cannam@125: *) func_append tmp_libs " $deplib" ;; cannam@125: esac cannam@125: ;; cannam@125: *) func_append tmp_libs " $deplib" ;; cannam@125: esac cannam@125: done cannam@125: eval $var=\"$tmp_libs\" cannam@125: done # for var cannam@125: fi cannam@125: cannam@125: # Add Sun CC postdeps if required: cannam@125: test CXX = "$tagname" && { cannam@125: case $host_os in cannam@125: linux*) cannam@125: case `$CC -V 2>&1 | sed 5q` in cannam@125: *Sun\ C*) # Sun C++ 5.9 cannam@125: func_suncc_cstd_abi cannam@125: cannam@125: if test no != "$suncc_use_cstd_abi"; then cannam@125: func_append postdeps ' -library=Cstd -library=Crun' cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: cannam@125: solaris*) cannam@125: func_cc_basename "$CC" cannam@125: case $func_cc_basename_result in cannam@125: CC* | sunCC*) cannam@125: func_suncc_cstd_abi cannam@125: cannam@125: if test no != "$suncc_use_cstd_abi"; then cannam@125: func_append postdeps ' -library=Cstd -library=Crun' cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: cannam@125: # Last step: remove runtime libs from dependency_libs cannam@125: # (they stay in deplibs) cannam@125: tmp_libs= cannam@125: for i in $dependency_libs; do cannam@125: case " $predeps $postdeps $compiler_lib_search_path " in cannam@125: *" $i "*) cannam@125: i= cannam@125: ;; cannam@125: esac cannam@125: if test -n "$i"; then cannam@125: func_append tmp_libs " $i" cannam@125: fi cannam@125: done cannam@125: dependency_libs=$tmp_libs cannam@125: done # for pass cannam@125: if test prog = "$linkmode"; then cannam@125: dlfiles=$newdlfiles cannam@125: fi cannam@125: if test prog = "$linkmode" || test lib = "$linkmode"; then cannam@125: dlprefiles=$newdlprefiles cannam@125: fi cannam@125: cannam@125: case $linkmode in cannam@125: oldlib) cannam@125: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then cannam@125: func_warning "'-dlopen' is ignored for archives" cannam@125: fi cannam@125: cannam@125: case " $deplibs" in cannam@125: *\ -l* | *\ -L*) cannam@125: func_warning "'-l' and '-L' are ignored for archives" ;; cannam@125: esac cannam@125: cannam@125: test -n "$rpath" && \ cannam@125: func_warning "'-rpath' is ignored for archives" cannam@125: cannam@125: test -n "$xrpath" && \ cannam@125: func_warning "'-R' is ignored for archives" cannam@125: cannam@125: test -n "$vinfo" && \ cannam@125: func_warning "'-version-info/-version-number' is ignored for archives" cannam@125: cannam@125: test -n "$release" && \ cannam@125: func_warning "'-release' is ignored for archives" cannam@125: cannam@125: test -n "$export_symbols$export_symbols_regex" && \ cannam@125: func_warning "'-export-symbols' is ignored for archives" cannam@125: cannam@125: # Now set the variables for building old libraries. cannam@125: build_libtool_libs=no cannam@125: oldlibs=$output cannam@125: func_append objs "$old_deplibs" cannam@125: ;; cannam@125: cannam@125: lib) cannam@125: # Make sure we only generate libraries of the form 'libNAME.la'. cannam@125: case $outputname in cannam@125: lib*) cannam@125: func_stripname 'lib' '.la' "$outputname" cannam@125: name=$func_stripname_result cannam@125: eval shared_ext=\"$shrext_cmds\" cannam@125: eval libname=\"$libname_spec\" cannam@125: ;; cannam@125: *) cannam@125: test no = "$module" \ cannam@125: && func_fatal_help "libtool library '$output' must begin with 'lib'" cannam@125: cannam@125: if test no != "$need_lib_prefix"; then cannam@125: # Add the "lib" prefix for modules if required cannam@125: func_stripname '' '.la' "$outputname" cannam@125: name=$func_stripname_result cannam@125: eval shared_ext=\"$shrext_cmds\" cannam@125: eval libname=\"$libname_spec\" cannam@125: else cannam@125: func_stripname '' '.la' "$outputname" cannam@125: libname=$func_stripname_result cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: cannam@125: if test -n "$objs"; then cannam@125: if test pass_all != "$deplibs_check_method"; then cannam@125: func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" cannam@125: else cannam@125: echo cannam@125: $ECHO "*** Warning: Linking the shared library $output against the non-libtool" cannam@125: $ECHO "*** objects $objs is not portable!" cannam@125: func_append libobjs " $objs" cannam@125: fi cannam@125: fi cannam@125: cannam@125: test no = "$dlself" \ cannam@125: || func_warning "'-dlopen self' is ignored for libtool libraries" cannam@125: cannam@125: set dummy $rpath cannam@125: shift cannam@125: test 1 -lt "$#" \ cannam@125: && func_warning "ignoring multiple '-rpath's for a libtool library" cannam@125: cannam@125: install_libdir=$1 cannam@125: cannam@125: oldlibs= cannam@125: if test -z "$rpath"; then cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: # Building a libtool convenience library. cannam@125: # Some compilers have problems with a '.al' extension so cannam@125: # convenience libraries should have the same extension an cannam@125: # archive normally would. cannam@125: oldlibs="$output_objdir/$libname.$libext $oldlibs" cannam@125: build_libtool_libs=convenience cannam@125: build_old_libs=yes cannam@125: fi cannam@125: cannam@125: test -n "$vinfo" && \ cannam@125: func_warning "'-version-info/-version-number' is ignored for convenience libraries" cannam@125: cannam@125: test -n "$release" && \ cannam@125: func_warning "'-release' is ignored for convenience libraries" cannam@125: else cannam@125: cannam@125: # Parse the version information argument. cannam@125: save_ifs=$IFS; IFS=: cannam@125: set dummy $vinfo 0 0 0 cannam@125: shift cannam@125: IFS=$save_ifs cannam@125: cannam@125: test -n "$7" && \ cannam@125: func_fatal_help "too many parameters to '-version-info'" cannam@125: cannam@125: # convert absolute version numbers to libtool ages cannam@125: # this retains compatibility with .la files and attempts cannam@125: # to make the code below a bit more comprehensible cannam@125: cannam@125: case $vinfo_number in cannam@125: yes) cannam@125: number_major=$1 cannam@125: number_minor=$2 cannam@125: number_revision=$3 cannam@125: # cannam@125: # There are really only two kinds -- those that cannam@125: # use the current revision as the major version cannam@125: # and those that subtract age and use age as cannam@125: # a minor version. But, then there is irix cannam@125: # that has an extra 1 added just for fun cannam@125: # cannam@125: case $version_type in cannam@125: # correct linux to gnu/linux during the next big refactor cannam@125: darwin|freebsd-elf|linux|osf|windows|none) cannam@125: func_arith $number_major + $number_minor cannam@125: current=$func_arith_result cannam@125: age=$number_minor cannam@125: revision=$number_revision cannam@125: ;; cannam@125: freebsd-aout|qnx|sunos) cannam@125: current=$number_major cannam@125: revision=$number_minor cannam@125: age=0 cannam@125: ;; cannam@125: irix|nonstopux) cannam@125: func_arith $number_major + $number_minor cannam@125: current=$func_arith_result cannam@125: age=$number_minor cannam@125: revision=$number_minor cannam@125: lt_irix_increment=no cannam@125: ;; cannam@125: *) cannam@125: func_fatal_configuration "$modename: unknown library version type '$version_type'" cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: no) cannam@125: current=$1 cannam@125: revision=$2 cannam@125: age=$3 cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Check that each of the things are valid numbers. cannam@125: case $current in cannam@125: 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]) ;; cannam@125: *) cannam@125: func_error "CURRENT '$current' must be a nonnegative integer" cannam@125: func_fatal_error "'$vinfo' is not valid version information" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: case $revision in cannam@125: 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]) ;; cannam@125: *) cannam@125: func_error "REVISION '$revision' must be a nonnegative integer" cannam@125: func_fatal_error "'$vinfo' is not valid version information" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: case $age in cannam@125: 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]) ;; cannam@125: *) cannam@125: func_error "AGE '$age' must be a nonnegative integer" cannam@125: func_fatal_error "'$vinfo' is not valid version information" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: if test "$age" -gt "$current"; then cannam@125: func_error "AGE '$age' is greater than the current interface number '$current'" cannam@125: func_fatal_error "'$vinfo' is not valid version information" cannam@125: fi cannam@125: cannam@125: # Calculate the version variables. cannam@125: major= cannam@125: versuffix= cannam@125: verstring= cannam@125: case $version_type in cannam@125: none) ;; cannam@125: cannam@125: darwin) cannam@125: # Like Linux, but with the current version available in cannam@125: # verstring for coding it into the library header cannam@125: func_arith $current - $age cannam@125: major=.$func_arith_result cannam@125: versuffix=$major.$age.$revision cannam@125: # Darwin ld doesn't like 0 for these options... cannam@125: func_arith $current + 1 cannam@125: minor_current=$func_arith_result cannam@125: xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" cannam@125: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" cannam@125: # On Darwin other compilers cannam@125: case $CC in cannam@125: nagfor*) cannam@125: verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" cannam@125: ;; cannam@125: *) cannam@125: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: cannam@125: freebsd-aout) cannam@125: major=.$current cannam@125: versuffix=.$current.$revision cannam@125: ;; cannam@125: cannam@125: freebsd-elf) cannam@125: func_arith $current - $age cannam@125: major=.$func_arith_result cannam@125: versuffix=$major.$age.$revision cannam@125: ;; cannam@125: cannam@125: irix | nonstopux) cannam@125: if test no = "$lt_irix_increment"; then cannam@125: func_arith $current - $age cannam@125: else cannam@125: func_arith $current - $age + 1 cannam@125: fi cannam@125: major=$func_arith_result cannam@125: cannam@125: case $version_type in cannam@125: nonstopux) verstring_prefix=nonstopux ;; cannam@125: *) verstring_prefix=sgi ;; cannam@125: esac cannam@125: verstring=$verstring_prefix$major.$revision cannam@125: cannam@125: # Add in all the interfaces that we are compatible with. cannam@125: loop=$revision cannam@125: while test 0 -ne "$loop"; do cannam@125: func_arith $revision - $loop cannam@125: iface=$func_arith_result cannam@125: func_arith $loop - 1 cannam@125: loop=$func_arith_result cannam@125: verstring=$verstring_prefix$major.$iface:$verstring cannam@125: done cannam@125: cannam@125: # Before this point, $major must not contain '.'. cannam@125: major=.$major cannam@125: versuffix=$major.$revision cannam@125: ;; cannam@125: cannam@125: linux) # correct to gnu/linux during the next big refactor cannam@125: func_arith $current - $age cannam@125: major=.$func_arith_result cannam@125: versuffix=$major.$age.$revision cannam@125: ;; cannam@125: cannam@125: osf) cannam@125: func_arith $current - $age cannam@125: major=.$func_arith_result cannam@125: versuffix=.$current.$age.$revision cannam@125: verstring=$current.$age.$revision cannam@125: cannam@125: # Add in all the interfaces that we are compatible with. cannam@125: loop=$age cannam@125: while test 0 -ne "$loop"; do cannam@125: func_arith $current - $loop cannam@125: iface=$func_arith_result cannam@125: func_arith $loop - 1 cannam@125: loop=$func_arith_result cannam@125: verstring=$verstring:$iface.0 cannam@125: done cannam@125: cannam@125: # Make executables depend on our current version. cannam@125: func_append verstring ":$current.0" cannam@125: ;; cannam@125: cannam@125: qnx) cannam@125: major=.$current cannam@125: versuffix=.$current cannam@125: ;; cannam@125: cannam@125: sco) cannam@125: major=.$current cannam@125: versuffix=.$current cannam@125: ;; cannam@125: cannam@125: sunos) cannam@125: major=.$current cannam@125: versuffix=.$current.$revision cannam@125: ;; cannam@125: cannam@125: windows) cannam@125: # Use '-' rather than '.', since we only want one cannam@125: # extension on DOS 8.3 file systems. cannam@125: func_arith $current - $age cannam@125: major=$func_arith_result cannam@125: versuffix=-$major cannam@125: ;; cannam@125: cannam@125: *) cannam@125: func_fatal_configuration "unknown library version type '$version_type'" cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Clear the version info if we defaulted, and they specified a release. cannam@125: if test -z "$vinfo" && test -n "$release"; then cannam@125: major= cannam@125: case $version_type in cannam@125: darwin) cannam@125: # we can't check for "0.0" in archive_cmds due to quoting cannam@125: # problems, so we reset it completely cannam@125: verstring= cannam@125: ;; cannam@125: *) cannam@125: verstring=0.0 cannam@125: ;; cannam@125: esac cannam@125: if test no = "$need_version"; then cannam@125: versuffix= cannam@125: else cannam@125: versuffix=.0.0 cannam@125: fi cannam@125: fi cannam@125: cannam@125: # Remove version info from name if versioning should be avoided cannam@125: if test yes,no = "$avoid_version,$need_version"; then cannam@125: major= cannam@125: versuffix= cannam@125: verstring= cannam@125: fi cannam@125: cannam@125: # Check to see if the archive will have undefined symbols. cannam@125: if test yes = "$allow_undefined"; then cannam@125: if test unsupported = "$allow_undefined_flag"; then cannam@125: if test yes = "$build_old_libs"; then cannam@125: func_warning "undefined symbols not allowed in $host shared libraries; building static only" cannam@125: build_libtool_libs=no cannam@125: else cannam@125: func_fatal_error "can't build $host shared library unless -no-undefined is specified" cannam@125: fi cannam@125: fi cannam@125: else cannam@125: # Don't allow undefined symbols. cannam@125: allow_undefined_flag=$no_undefined_flag cannam@125: fi cannam@125: cannam@125: fi cannam@125: cannam@125: func_generate_dlsyms "$libname" "$libname" : cannam@125: func_append libobjs " $symfileobj" cannam@125: test " " = "$libobjs" && libobjs= cannam@125: cannam@125: if test relink != "$opt_mode"; then cannam@125: # Remove our outputs, but don't remove object files since they cannam@125: # may have been created when compiling PIC objects. cannam@125: removelist= cannam@125: tempremovelist=`$ECHO "$output_objdir/*"` cannam@125: for p in $tempremovelist; do cannam@125: case $p in cannam@125: *.$objext | *.gcno) cannam@125: ;; cannam@125: $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) cannam@125: if test -n "$precious_files_regex"; then cannam@125: if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 cannam@125: then cannam@125: continue cannam@125: fi cannam@125: fi cannam@125: func_append removelist " $p" cannam@125: ;; cannam@125: *) ;; cannam@125: esac cannam@125: done cannam@125: test -n "$removelist" && \ cannam@125: func_show_eval "${RM}r \$removelist" cannam@125: fi cannam@125: cannam@125: # Now set the variables for building old libraries. cannam@125: if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then cannam@125: func_append oldlibs " $output_objdir/$libname.$libext" cannam@125: cannam@125: # Transform .lo files to .o files. cannam@125: oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` cannam@125: fi cannam@125: cannam@125: # Eliminate all temporary directories. cannam@125: #for path in $notinst_path; do cannam@125: # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` cannam@125: # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` cannam@125: # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` cannam@125: #done cannam@125: cannam@125: if test -n "$xrpath"; then cannam@125: # If the user specified any rpath flags, then add them. cannam@125: temp_xrpath= cannam@125: for libdir in $xrpath; do cannam@125: func_replace_sysroot "$libdir" cannam@125: func_append temp_xrpath " -R$func_replace_sysroot_result" cannam@125: case "$finalize_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append finalize_rpath " $libdir" ;; cannam@125: esac cannam@125: done cannam@125: if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then cannam@125: dependency_libs="$temp_xrpath $dependency_libs" cannam@125: fi cannam@125: fi cannam@125: cannam@125: # Make sure dlfiles contains only unique files that won't be dlpreopened cannam@125: old_dlfiles=$dlfiles cannam@125: dlfiles= cannam@125: for lib in $old_dlfiles; do cannam@125: case " $dlprefiles $dlfiles " in cannam@125: *" $lib "*) ;; cannam@125: *) func_append dlfiles " $lib" ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: # Make sure dlprefiles contains only unique files cannam@125: old_dlprefiles=$dlprefiles cannam@125: dlprefiles= cannam@125: for lib in $old_dlprefiles; do cannam@125: case "$dlprefiles " in cannam@125: *" $lib "*) ;; cannam@125: *) func_append dlprefiles " $lib" ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: if test -n "$rpath"; then cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) cannam@125: # these systems don't actually have a c library (as such)! cannam@125: ;; cannam@125: *-*-rhapsody* | *-*-darwin1.[012]) cannam@125: # Rhapsody C library is in the System framework cannam@125: func_append deplibs " System.ltframework" cannam@125: ;; cannam@125: *-*-netbsd*) cannam@125: # Don't link with libc until the a.out ld.so is fixed. cannam@125: ;; cannam@125: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) cannam@125: # Do not include libc due to us having libc/libc_r. cannam@125: ;; cannam@125: *-*-sco3.2v5* | *-*-sco5v6*) cannam@125: # Causes problems with __ctype cannam@125: ;; cannam@125: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) cannam@125: # Compiler inserts libc in the correct place for threads to work cannam@125: ;; cannam@125: *) cannam@125: # Add libc to deplibs on all other systems if necessary. cannam@125: if test yes = "$build_libtool_need_lc"; then cannam@125: func_append deplibs " -lc" cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: # Transform deplibs into only deplibs that can be linked in shared. cannam@125: name_save=$name cannam@125: libname_save=$libname cannam@125: release_save=$release cannam@125: versuffix_save=$versuffix cannam@125: major_save=$major cannam@125: # I'm not sure if I'm treating the release correctly. I think cannam@125: # release should show up in the -l (ie -lgmp5) so we don't want to cannam@125: # add it in twice. Is that correct? cannam@125: release= cannam@125: versuffix= cannam@125: major= cannam@125: newdeplibs= cannam@125: droppeddeps=no cannam@125: case $deplibs_check_method in cannam@125: pass_all) cannam@125: # Don't check for shared/static. Everything works. cannam@125: # This might be a little naive. We might want to check cannam@125: # whether the library exists or not. But this is on cannam@125: # osf3 & osf4 and I'm not really sure... Just cannam@125: # implementing what was already the behavior. cannam@125: newdeplibs=$deplibs cannam@125: ;; cannam@125: test_compile) cannam@125: # This code stresses the "libraries are programs" paradigm to its cannam@125: # limits. Maybe even breaks it. We compile a program, linking it cannam@125: # against the deplibs as a proxy for the library. Then we can check cannam@125: # whether they linked in statically or dynamically with ldd. cannam@125: $opt_dry_run || $RM conftest.c cannam@125: cat > conftest.c </dev/null` cannam@125: $nocaseglob cannam@125: else cannam@125: potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` cannam@125: fi cannam@125: for potent_lib in $potential_libs; do cannam@125: # Follow soft links. cannam@125: if ls -lLd "$potent_lib" 2>/dev/null | cannam@125: $GREP " -> " >/dev/null; then cannam@125: continue cannam@125: fi cannam@125: # The statement above tries to avoid entering an cannam@125: # endless loop below, in case of cyclic links. cannam@125: # We might still enter an endless loop, since a link cannam@125: # loop can be closed while we follow links, cannam@125: # but so what? cannam@125: potlib=$potent_lib cannam@125: while test -h "$potlib" 2>/dev/null; do cannam@125: potliblink=`ls -ld $potlib | $SED 's/.* -> //'` cannam@125: case $potliblink in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; cannam@125: *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; cannam@125: esac cannam@125: done cannam@125: if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | cannam@125: $SED -e 10q | cannam@125: $EGREP "$file_magic_regex" > /dev/null; then cannam@125: func_append newdeplibs " $a_deplib" cannam@125: a_deplib= cannam@125: break 2 cannam@125: fi cannam@125: done cannam@125: done cannam@125: fi cannam@125: if test -n "$a_deplib"; then cannam@125: droppeddeps=yes cannam@125: echo cannam@125: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." cannam@125: echo "*** I have the capability to make that library automatically link in when" cannam@125: echo "*** you link to this library. But I can only do this if you have a" cannam@125: echo "*** shared version of the library, which you do not appear to have" cannam@125: echo "*** because I did check the linker path looking for a file starting" cannam@125: if test -z "$potlib"; then cannam@125: $ECHO "*** with $libname but no candidates were found. (...for file magic test)" cannam@125: else cannam@125: $ECHO "*** with $libname and none of the candidates passed a file format test" cannam@125: $ECHO "*** using a file magic. Last file checked: $potlib" cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: # Add a -L argument. cannam@125: func_append newdeplibs " $a_deplib" cannam@125: ;; cannam@125: esac cannam@125: done # Gone through all deplibs. cannam@125: ;; cannam@125: match_pattern*) cannam@125: set dummy $deplibs_check_method; shift cannam@125: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` cannam@125: for a_deplib in $deplibs; do cannam@125: case $a_deplib in cannam@125: -l*) cannam@125: func_stripname -l '' "$a_deplib" cannam@125: name=$func_stripname_result cannam@125: if test yes = "$allow_libtool_libs_with_static_runtimes"; then cannam@125: case " $predeps $postdeps " in cannam@125: *" $a_deplib "*) cannam@125: func_append newdeplibs " $a_deplib" cannam@125: a_deplib= cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: if test -n "$a_deplib"; then cannam@125: libname=`eval "\\$ECHO \"$libname_spec\""` cannam@125: for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do cannam@125: potential_libs=`ls $i/$libname[.-]* 2>/dev/null` cannam@125: for potent_lib in $potential_libs; do cannam@125: potlib=$potent_lib # see symlink-check above in file_magic test cannam@125: if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ cannam@125: $EGREP "$match_pattern_regex" > /dev/null; then cannam@125: func_append newdeplibs " $a_deplib" cannam@125: a_deplib= cannam@125: break 2 cannam@125: fi cannam@125: done cannam@125: done cannam@125: fi cannam@125: if test -n "$a_deplib"; then cannam@125: droppeddeps=yes cannam@125: echo cannam@125: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." cannam@125: echo "*** I have the capability to make that library automatically link in when" cannam@125: echo "*** you link to this library. But I can only do this if you have a" cannam@125: echo "*** shared version of the library, which you do not appear to have" cannam@125: echo "*** because I did check the linker path looking for a file starting" cannam@125: if test -z "$potlib"; then cannam@125: $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" cannam@125: else cannam@125: $ECHO "*** with $libname and none of the candidates passed a file format test" cannam@125: $ECHO "*** using a regex pattern. Last file checked: $potlib" cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: *) cannam@125: # Add a -L argument. cannam@125: func_append newdeplibs " $a_deplib" cannam@125: ;; cannam@125: esac cannam@125: done # Gone through all deplibs. cannam@125: ;; cannam@125: none | unknown | *) cannam@125: newdeplibs= cannam@125: tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` cannam@125: if test yes = "$allow_libtool_libs_with_static_runtimes"; then cannam@125: for i in $predeps $postdeps; do cannam@125: # can't use Xsed below, because $i might contain '/' cannam@125: tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` cannam@125: done cannam@125: fi cannam@125: case $tmp_deplibs in cannam@125: *[!\ \ ]*) cannam@125: echo cannam@125: if test none = "$deplibs_check_method"; then cannam@125: echo "*** Warning: inter-library dependencies are not supported in this platform." cannam@125: else cannam@125: echo "*** Warning: inter-library dependencies are not known to be supported." cannam@125: fi cannam@125: echo "*** All declared inter-library dependencies are being dropped." cannam@125: droppeddeps=yes cannam@125: ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: versuffix=$versuffix_save cannam@125: major=$major_save cannam@125: release=$release_save cannam@125: libname=$libname_save cannam@125: name=$name_save cannam@125: cannam@125: case $host in cannam@125: *-*-rhapsody* | *-*-darwin1.[012]) cannam@125: # On Rhapsody replace the C library with the System framework cannam@125: newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` cannam@125: ;; cannam@125: esac cannam@125: cannam@125: if test yes = "$droppeddeps"; then cannam@125: if test yes = "$module"; then cannam@125: echo cannam@125: echo "*** Warning: libtool could not satisfy all declared inter-library" cannam@125: $ECHO "*** dependencies of module $libname. Therefore, libtool will create" cannam@125: echo "*** a static module, that should work as long as the dlopening" cannam@125: echo "*** application is linked with the -dlopen flag." cannam@125: if test -z "$global_symbol_pipe"; then cannam@125: echo cannam@125: echo "*** However, this would only work if libtool was able to extract symbol" cannam@125: echo "*** lists from a program, using 'nm' or equivalent, but libtool could" cannam@125: echo "*** not find such a program. So, this module is probably useless." cannam@125: echo "*** 'nm' from GNU binutils and a full rebuild may help." cannam@125: fi cannam@125: if test no = "$build_old_libs"; then cannam@125: oldlibs=$output_objdir/$libname.$libext cannam@125: build_libtool_libs=module cannam@125: build_old_libs=yes cannam@125: else cannam@125: build_libtool_libs=no cannam@125: fi cannam@125: else cannam@125: echo "*** The inter-library dependencies that have been dropped here will be" cannam@125: echo "*** automatically added whenever a program is linked with this library" cannam@125: echo "*** or is declared to -dlopen it." cannam@125: cannam@125: if test no = "$allow_undefined"; then cannam@125: echo cannam@125: echo "*** Since this library must not contain undefined symbols," cannam@125: echo "*** because either the platform does not support them or" cannam@125: echo "*** it was explicitly requested with -no-undefined," cannam@125: echo "*** libtool will only create a static version of it." cannam@125: if test no = "$build_old_libs"; then cannam@125: oldlibs=$output_objdir/$libname.$libext cannam@125: build_libtool_libs=module cannam@125: build_old_libs=yes cannam@125: else cannam@125: build_libtool_libs=no cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: # Done checking deplibs! cannam@125: deplibs=$newdeplibs cannam@125: fi cannam@125: # Time to change all our "foo.ltframework" stuff back to "-framework foo" cannam@125: case $host in cannam@125: *-*-darwin*) cannam@125: newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # move library search paths that coincide with paths to not yet cannam@125: # installed libraries to the beginning of the library search list cannam@125: new_libs= cannam@125: for path in $notinst_path; do cannam@125: case " $new_libs " in cannam@125: *" -L$path/$objdir "*) ;; cannam@125: *) cannam@125: case " $deplibs " in cannam@125: *" -L$path/$objdir "*) cannam@125: func_append new_libs " -L$path/$objdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: for deplib in $deplibs; do cannam@125: case $deplib in cannam@125: -L*) cannam@125: case " $new_libs " in cannam@125: *" $deplib "*) ;; cannam@125: *) func_append new_libs " $deplib" ;; cannam@125: esac cannam@125: ;; cannam@125: *) func_append new_libs " $deplib" ;; cannam@125: esac cannam@125: done cannam@125: deplibs=$new_libs cannam@125: cannam@125: # All the library-specific variables (install_libdir is set above). cannam@125: library_names= cannam@125: old_library= cannam@125: dlname= cannam@125: cannam@125: # Test again, we may have decided not to build it any more cannam@125: if test yes = "$build_libtool_libs"; then cannam@125: # Remove $wl instances when linking with ld. cannam@125: # FIXME: should test the right _cmds variable. cannam@125: case $archive_cmds in cannam@125: *\$LD\ *) wl= ;; cannam@125: esac cannam@125: if test yes = "$hardcode_into_libs"; then cannam@125: # Hardcode the library paths cannam@125: hardcode_libdirs= cannam@125: dep_rpath= cannam@125: rpath=$finalize_rpath cannam@125: test relink = "$opt_mode" || rpath=$compile_rpath$rpath cannam@125: for libdir in $rpath; do cannam@125: if test -n "$hardcode_libdir_flag_spec"; then cannam@125: if test -n "$hardcode_libdir_separator"; then cannam@125: func_replace_sysroot "$libdir" cannam@125: libdir=$func_replace_sysroot_result cannam@125: if test -z "$hardcode_libdirs"; then cannam@125: hardcode_libdirs=$libdir cannam@125: else cannam@125: # Just accumulate the unique libdirs. cannam@125: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in cannam@125: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) cannam@125: ;; cannam@125: *) cannam@125: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: else cannam@125: eval flag=\"$hardcode_libdir_flag_spec\" cannam@125: func_append dep_rpath " $flag" cannam@125: fi cannam@125: elif test -n "$runpath_var"; then cannam@125: case "$perm_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append perm_rpath " $libdir" ;; cannam@125: esac cannam@125: fi cannam@125: done cannam@125: # Substitute the hardcoded libdirs into the rpath. cannam@125: if test -n "$hardcode_libdir_separator" && cannam@125: test -n "$hardcode_libdirs"; then cannam@125: libdir=$hardcode_libdirs cannam@125: eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" cannam@125: fi cannam@125: if test -n "$runpath_var" && test -n "$perm_rpath"; then cannam@125: # We should set the runpath_var. cannam@125: rpath= cannam@125: for dir in $perm_rpath; do cannam@125: func_append rpath "$dir:" cannam@125: done cannam@125: eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" cannam@125: fi cannam@125: test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" cannam@125: fi cannam@125: cannam@125: shlibpath=$finalize_shlibpath cannam@125: test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath cannam@125: if test -n "$shlibpath"; then cannam@125: eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" cannam@125: fi cannam@125: cannam@125: # Get the real and link names of the library. cannam@125: eval shared_ext=\"$shrext_cmds\" cannam@125: eval library_names=\"$library_names_spec\" cannam@125: set dummy $library_names cannam@125: shift cannam@125: realname=$1 cannam@125: shift cannam@125: cannam@125: if test -n "$soname_spec"; then cannam@125: eval soname=\"$soname_spec\" cannam@125: else cannam@125: soname=$realname cannam@125: fi cannam@125: if test -z "$dlname"; then cannam@125: dlname=$soname cannam@125: fi cannam@125: cannam@125: lib=$output_objdir/$realname cannam@125: linknames= cannam@125: for link cannam@125: do cannam@125: func_append linknames " $link" cannam@125: done cannam@125: cannam@125: # Use standard objects if they are pic cannam@125: test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` cannam@125: test "X$libobjs" = "X " && libobjs= cannam@125: cannam@125: delfiles= cannam@125: if test -n "$export_symbols" && test -n "$include_expsyms"; then cannam@125: $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" cannam@125: export_symbols=$output_objdir/$libname.uexp cannam@125: func_append delfiles " $export_symbols" cannam@125: fi cannam@125: cannam@125: orig_export_symbols= cannam@125: case $host_os in cannam@125: cygwin* | mingw* | cegcc*) cannam@125: if test -n "$export_symbols" && test -z "$export_symbols_regex"; then cannam@125: # exporting using user supplied symfile cannam@125: func_dll_def_p "$export_symbols" || { cannam@125: # and it's NOT already a .def file. Must figure out cannam@125: # which of the given symbols are data symbols and tag cannam@125: # them as such. So, trigger use of export_symbols_cmds. cannam@125: # export_symbols gets reassigned inside the "prepare cannam@125: # the list of exported symbols" if statement, so the cannam@125: # include_expsyms logic still works. cannam@125: orig_export_symbols=$export_symbols cannam@125: export_symbols= cannam@125: always_export_symbols=yes cannam@125: } cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Prepare the list of exported symbols cannam@125: if test -z "$export_symbols"; then cannam@125: if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then cannam@125: func_verbose "generating symbol list for '$libname.la'" cannam@125: export_symbols=$output_objdir/$libname.exp cannam@125: $opt_dry_run || $RM $export_symbols cannam@125: cmds=$export_symbols_cmds cannam@125: save_ifs=$IFS; IFS='~' cannam@125: for cmd1 in $cmds; do cannam@125: IFS=$save_ifs cannam@125: # Take the normal branch if the nm_file_list_spec branch cannam@125: # doesn't work or if tool conversion is not needed. cannam@125: case $nm_file_list_spec~$to_tool_file_cmd in cannam@125: *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) cannam@125: try_normal_branch=yes cannam@125: eval cmd=\"$cmd1\" cannam@125: func_len " $cmd" cannam@125: len=$func_len_result cannam@125: ;; cannam@125: *) cannam@125: try_normal_branch=no cannam@125: ;; cannam@125: esac cannam@125: if test yes = "$try_normal_branch" \ cannam@125: && { test "$len" -lt "$max_cmd_len" \ cannam@125: || test "$max_cmd_len" -le -1; } cannam@125: then cannam@125: func_show_eval "$cmd" 'exit $?' cannam@125: skipped_export=false cannam@125: elif test -n "$nm_file_list_spec"; then cannam@125: func_basename "$output" cannam@125: output_la=$func_basename_result cannam@125: save_libobjs=$libobjs cannam@125: save_output=$output cannam@125: output=$output_objdir/$output_la.nm cannam@125: func_to_tool_file "$output" cannam@125: libobjs=$nm_file_list_spec$func_to_tool_file_result cannam@125: func_append delfiles " $output" cannam@125: func_verbose "creating $NM input file list: $output" cannam@125: for obj in $save_libobjs; do cannam@125: func_to_tool_file "$obj" cannam@125: $ECHO "$func_to_tool_file_result" cannam@125: done > "$output" cannam@125: eval cmd=\"$cmd1\" cannam@125: func_show_eval "$cmd" 'exit $?' cannam@125: output=$save_output cannam@125: libobjs=$save_libobjs cannam@125: skipped_export=false cannam@125: else cannam@125: # The command line is too long to execute in one step. cannam@125: func_verbose "using reloadable object file for export list..." cannam@125: skipped_export=: cannam@125: # Break out early, otherwise skipped_export may be cannam@125: # set to false by a later but shorter cmd. cannam@125: break cannam@125: fi cannam@125: done cannam@125: IFS=$save_ifs cannam@125: if test -n "$export_symbols_regex" && test : != "$skipped_export"; then cannam@125: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' cannam@125: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test -n "$export_symbols" && test -n "$include_expsyms"; then cannam@125: tmp_export_symbols=$export_symbols cannam@125: test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols cannam@125: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' cannam@125: fi cannam@125: cannam@125: if test : != "$skipped_export" && test -n "$orig_export_symbols"; then cannam@125: # The given exports_symbols file has to be filtered, so filter it. cannam@125: func_verbose "filter symbol list for '$libname.la' to tag DATA exports" cannam@125: # FIXME: $output_objdir/$libname.filter potentially contains lots of cannam@125: # 's' commands, which not all seds can handle. GNU sed should be fine cannam@125: # though. Also, the filter scales superlinearly with the number of cannam@125: # global variables. join(1) would be nice here, but unfortunately cannam@125: # isn't a blessed tool. cannam@125: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter cannam@125: func_append delfiles " $export_symbols $output_objdir/$libname.filter" cannam@125: export_symbols=$output_objdir/$libname.def cannam@125: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols cannam@125: fi cannam@125: cannam@125: tmp_deplibs= cannam@125: for test_deplib in $deplibs; do cannam@125: case " $convenience " in cannam@125: *" $test_deplib "*) ;; cannam@125: *) cannam@125: func_append tmp_deplibs " $test_deplib" cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: deplibs=$tmp_deplibs cannam@125: cannam@125: if test -n "$convenience"; then cannam@125: if test -n "$whole_archive_flag_spec" && cannam@125: test yes = "$compiler_needs_object" && cannam@125: test -z "$libobjs"; then cannam@125: # extract the archives, so we have objects to list. cannam@125: # TODO: could optimize this to just extract one archive. cannam@125: whole_archive_flag_spec= cannam@125: fi cannam@125: if test -n "$whole_archive_flag_spec"; then cannam@125: save_libobjs=$libobjs cannam@125: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" cannam@125: test "X$libobjs" = "X " && libobjs= cannam@125: else cannam@125: gentop=$output_objdir/${outputname}x cannam@125: func_append generated " $gentop" cannam@125: cannam@125: func_extract_archives $gentop $convenience cannam@125: func_append libobjs " $func_extract_archives_result" cannam@125: test "X$libobjs" = "X " && libobjs= cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then cannam@125: eval flag=\"$thread_safe_flag_spec\" cannam@125: func_append linker_flags " $flag" cannam@125: fi cannam@125: cannam@125: # Make a backup of the uninstalled library when relinking cannam@125: if test relink = "$opt_mode"; then cannam@125: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? cannam@125: fi cannam@125: cannam@125: # Do each of the archive commands. cannam@125: if test yes = "$module" && test -n "$module_cmds"; then cannam@125: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cannam@125: eval test_cmds=\"$module_expsym_cmds\" cannam@125: cmds=$module_expsym_cmds cannam@125: else cannam@125: eval test_cmds=\"$module_cmds\" cannam@125: cmds=$module_cmds cannam@125: fi cannam@125: else cannam@125: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cannam@125: eval test_cmds=\"$archive_expsym_cmds\" cannam@125: cmds=$archive_expsym_cmds cannam@125: else cannam@125: eval test_cmds=\"$archive_cmds\" cannam@125: cmds=$archive_cmds cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test : != "$skipped_export" && cannam@125: func_len " $test_cmds" && cannam@125: len=$func_len_result && cannam@125: test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cannam@125: : cannam@125: else cannam@125: # The command line is too long to link in one step, link piecewise cannam@125: # or, if using GNU ld and skipped_export is not :, use a linker cannam@125: # script. cannam@125: cannam@125: # Save the value of $output and $libobjs because we want to cannam@125: # use them later. If we have whole_archive_flag_spec, we cannam@125: # want to use save_libobjs as it was before cannam@125: # whole_archive_flag_spec was expanded, because we can't cannam@125: # assume the linker understands whole_archive_flag_spec. cannam@125: # This may have to be revisited, in case too many cannam@125: # convenience libraries get linked in and end up exceeding cannam@125: # the spec. cannam@125: if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then cannam@125: save_libobjs=$libobjs cannam@125: fi cannam@125: save_output=$output cannam@125: func_basename "$output" cannam@125: output_la=$func_basename_result cannam@125: cannam@125: # Clear the reloadable object creation command queue and cannam@125: # initialize k to one. cannam@125: test_cmds= cannam@125: concat_cmds= cannam@125: objlist= cannam@125: last_robj= cannam@125: k=1 cannam@125: cannam@125: if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then cannam@125: output=$output_objdir/$output_la.lnkscript cannam@125: func_verbose "creating GNU ld script: $output" cannam@125: echo 'INPUT (' > $output cannam@125: for obj in $save_libobjs cannam@125: do cannam@125: func_to_tool_file "$obj" cannam@125: $ECHO "$func_to_tool_file_result" >> $output cannam@125: done cannam@125: echo ')' >> $output cannam@125: func_append delfiles " $output" cannam@125: func_to_tool_file "$output" cannam@125: output=$func_to_tool_file_result cannam@125: elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then cannam@125: output=$output_objdir/$output_la.lnk cannam@125: func_verbose "creating linker input file list: $output" cannam@125: : > $output cannam@125: set x $save_libobjs cannam@125: shift cannam@125: firstobj= cannam@125: if test yes = "$compiler_needs_object"; then cannam@125: firstobj="$1 " cannam@125: shift cannam@125: fi cannam@125: for obj cannam@125: do cannam@125: func_to_tool_file "$obj" cannam@125: $ECHO "$func_to_tool_file_result" >> $output cannam@125: done cannam@125: func_append delfiles " $output" cannam@125: func_to_tool_file "$output" cannam@125: output=$firstobj\"$file_list_spec$func_to_tool_file_result\" cannam@125: else cannam@125: if test -n "$save_libobjs"; then cannam@125: func_verbose "creating reloadable object files..." cannam@125: output=$output_objdir/$output_la-$k.$objext cannam@125: eval test_cmds=\"$reload_cmds\" cannam@125: func_len " $test_cmds" cannam@125: len0=$func_len_result cannam@125: len=$len0 cannam@125: cannam@125: # Loop over the list of objects to be linked. cannam@125: for obj in $save_libobjs cannam@125: do cannam@125: func_len " $obj" cannam@125: func_arith $len + $func_len_result cannam@125: len=$func_arith_result cannam@125: if test -z "$objlist" || cannam@125: test "$len" -lt "$max_cmd_len"; then cannam@125: func_append objlist " $obj" cannam@125: else cannam@125: # The command $test_cmds is almost too long, add a cannam@125: # command to the queue. cannam@125: if test 1 -eq "$k"; then cannam@125: # The first file doesn't have a previous command to add. cannam@125: reload_objs=$objlist cannam@125: eval concat_cmds=\"$reload_cmds\" cannam@125: else cannam@125: # All subsequent reloadable object files will link in cannam@125: # the last one created. cannam@125: reload_objs="$objlist $last_robj" cannam@125: eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" cannam@125: fi cannam@125: last_robj=$output_objdir/$output_la-$k.$objext cannam@125: func_arith $k + 1 cannam@125: k=$func_arith_result cannam@125: output=$output_objdir/$output_la-$k.$objext cannam@125: objlist=" $obj" cannam@125: func_len " $last_robj" cannam@125: func_arith $len0 + $func_len_result cannam@125: len=$func_arith_result cannam@125: fi cannam@125: done cannam@125: # Handle the remaining objects by creating one last cannam@125: # reloadable object file. All subsequent reloadable object cannam@125: # files will link in the last one created. cannam@125: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ cannam@125: reload_objs="$objlist $last_robj" cannam@125: eval concat_cmds=\"\$concat_cmds$reload_cmds\" cannam@125: if test -n "$last_robj"; then cannam@125: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" cannam@125: fi cannam@125: func_append delfiles " $output" cannam@125: cannam@125: else cannam@125: output= cannam@125: fi cannam@125: cannam@125: ${skipped_export-false} && { cannam@125: func_verbose "generating symbol list for '$libname.la'" cannam@125: export_symbols=$output_objdir/$libname.exp cannam@125: $opt_dry_run || $RM $export_symbols cannam@125: libobjs=$output cannam@125: # Append the command to create the export file. cannam@125: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ cannam@125: eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" cannam@125: if test -n "$last_robj"; then cannam@125: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" cannam@125: fi cannam@125: } cannam@125: cannam@125: test -n "$save_libobjs" && cannam@125: func_verbose "creating a temporary reloadable object file: $output" cannam@125: cannam@125: # Loop through the commands generated above and execute them. cannam@125: save_ifs=$IFS; IFS='~' cannam@125: for cmd in $concat_cmds; do cannam@125: IFS=$save_ifs cannam@125: $opt_quiet || { cannam@125: func_quote_for_expand "$cmd" cannam@125: eval "func_echo $func_quote_for_expand_result" cannam@125: } cannam@125: $opt_dry_run || eval "$cmd" || { cannam@125: lt_exit=$? cannam@125: cannam@125: # Restore the uninstalled library and exit cannam@125: if test relink = "$opt_mode"; then cannam@125: ( cd "$output_objdir" && \ cannam@125: $RM "${realname}T" && \ cannam@125: $MV "${realname}U" "$realname" ) cannam@125: fi cannam@125: cannam@125: exit $lt_exit cannam@125: } cannam@125: done cannam@125: IFS=$save_ifs cannam@125: cannam@125: if test -n "$export_symbols_regex" && ${skipped_export-false}; then cannam@125: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' cannam@125: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' cannam@125: fi cannam@125: fi cannam@125: cannam@125: ${skipped_export-false} && { cannam@125: if test -n "$export_symbols" && test -n "$include_expsyms"; then cannam@125: tmp_export_symbols=$export_symbols cannam@125: test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols cannam@125: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' cannam@125: fi cannam@125: cannam@125: if test -n "$orig_export_symbols"; then cannam@125: # The given exports_symbols file has to be filtered, so filter it. cannam@125: func_verbose "filter symbol list for '$libname.la' to tag DATA exports" cannam@125: # FIXME: $output_objdir/$libname.filter potentially contains lots of cannam@125: # 's' commands, which not all seds can handle. GNU sed should be fine cannam@125: # though. Also, the filter scales superlinearly with the number of cannam@125: # global variables. join(1) would be nice here, but unfortunately cannam@125: # isn't a blessed tool. cannam@125: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter cannam@125: func_append delfiles " $export_symbols $output_objdir/$libname.filter" cannam@125: export_symbols=$output_objdir/$libname.def cannam@125: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols cannam@125: fi cannam@125: } cannam@125: cannam@125: libobjs=$output cannam@125: # Restore the value of output. cannam@125: output=$save_output cannam@125: cannam@125: if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then cannam@125: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" cannam@125: test "X$libobjs" = "X " && libobjs= cannam@125: fi cannam@125: # Expand the library linking commands again to reset the cannam@125: # value of $libobjs for piecewise linking. cannam@125: cannam@125: # Do each of the archive commands. cannam@125: if test yes = "$module" && test -n "$module_cmds"; then cannam@125: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cannam@125: cmds=$module_expsym_cmds cannam@125: else cannam@125: cmds=$module_cmds cannam@125: fi cannam@125: else cannam@125: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cannam@125: cmds=$archive_expsym_cmds cannam@125: else cannam@125: cmds=$archive_cmds cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test -n "$delfiles"; then cannam@125: # Append the command to remove temporary files to $cmds. cannam@125: eval cmds=\"\$cmds~\$RM $delfiles\" cannam@125: fi cannam@125: cannam@125: # Add any objects from preloaded convenience libraries cannam@125: if test -n "$dlprefiles"; then cannam@125: gentop=$output_objdir/${outputname}x cannam@125: func_append generated " $gentop" cannam@125: cannam@125: func_extract_archives $gentop $dlprefiles cannam@125: func_append libobjs " $func_extract_archives_result" cannam@125: test "X$libobjs" = "X " && libobjs= cannam@125: fi cannam@125: cannam@125: save_ifs=$IFS; IFS='~' cannam@125: for cmd in $cmds; do cannam@125: IFS=$sp$nl cannam@125: eval cmd=\"$cmd\" cannam@125: IFS=$save_ifs cannam@125: $opt_quiet || { cannam@125: func_quote_for_expand "$cmd" cannam@125: eval "func_echo $func_quote_for_expand_result" cannam@125: } cannam@125: $opt_dry_run || eval "$cmd" || { cannam@125: lt_exit=$? cannam@125: cannam@125: # Restore the uninstalled library and exit cannam@125: if test relink = "$opt_mode"; then cannam@125: ( cd "$output_objdir" && \ cannam@125: $RM "${realname}T" && \ cannam@125: $MV "${realname}U" "$realname" ) cannam@125: fi cannam@125: cannam@125: exit $lt_exit cannam@125: } cannam@125: done cannam@125: IFS=$save_ifs cannam@125: cannam@125: # Restore the uninstalled library and exit cannam@125: if test relink = "$opt_mode"; then cannam@125: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? cannam@125: cannam@125: if test -n "$convenience"; then cannam@125: if test -z "$whole_archive_flag_spec"; then cannam@125: func_show_eval '${RM}r "$gentop"' cannam@125: fi cannam@125: fi cannam@125: cannam@125: exit $EXIT_SUCCESS cannam@125: fi cannam@125: cannam@125: # Create links to the real library. cannam@125: for linkname in $linknames; do cannam@125: if test "$realname" != "$linkname"; then cannam@125: func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' cannam@125: fi cannam@125: done cannam@125: cannam@125: # If -module or -export-dynamic was specified, set the dlname. cannam@125: if test yes = "$module" || test yes = "$export_dynamic"; then cannam@125: # On all known operating systems, these are identical. cannam@125: dlname=$soname cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: cannam@125: obj) cannam@125: if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then cannam@125: func_warning "'-dlopen' is ignored for objects" cannam@125: fi cannam@125: cannam@125: case " $deplibs" in cannam@125: *\ -l* | *\ -L*) cannam@125: func_warning "'-l' and '-L' are ignored for objects" ;; cannam@125: esac cannam@125: cannam@125: test -n "$rpath" && \ cannam@125: func_warning "'-rpath' is ignored for objects" cannam@125: cannam@125: test -n "$xrpath" && \ cannam@125: func_warning "'-R' is ignored for objects" cannam@125: cannam@125: test -n "$vinfo" && \ cannam@125: func_warning "'-version-info' is ignored for objects" cannam@125: cannam@125: test -n "$release" && \ cannam@125: func_warning "'-release' is ignored for objects" cannam@125: cannam@125: case $output in cannam@125: *.lo) cannam@125: test -n "$objs$old_deplibs" && \ cannam@125: func_fatal_error "cannot build library object '$output' from non-libtool objects" cannam@125: cannam@125: libobj=$output cannam@125: func_lo2o "$libobj" cannam@125: obj=$func_lo2o_result cannam@125: ;; cannam@125: *) cannam@125: libobj= cannam@125: obj=$output cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Delete the old objects. cannam@125: $opt_dry_run || $RM $obj $libobj cannam@125: cannam@125: # Objects from convenience libraries. This assumes cannam@125: # single-version convenience libraries. Whenever we create cannam@125: # different ones for PIC/non-PIC, this we'll have to duplicate cannam@125: # the extraction. cannam@125: reload_conv_objs= cannam@125: gentop= cannam@125: # if reload_cmds runs $LD directly, get rid of -Wl from cannam@125: # whole_archive_flag_spec and hope we can get by with turning comma cannam@125: # into space. cannam@125: case $reload_cmds in cannam@125: *\$LD[\ \$]*) wl= ;; cannam@125: esac cannam@125: if test -n "$convenience"; then cannam@125: if test -n "$whole_archive_flag_spec"; then cannam@125: eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" cannam@125: test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` cannam@125: reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags cannam@125: else cannam@125: gentop=$output_objdir/${obj}x cannam@125: func_append generated " $gentop" cannam@125: cannam@125: func_extract_archives $gentop $convenience cannam@125: reload_conv_objs="$reload_objs $func_extract_archives_result" cannam@125: fi cannam@125: fi cannam@125: cannam@125: # If we're not building shared, we need to use non_pic_objs cannam@125: test yes = "$build_libtool_libs" || libobjs=$non_pic_objects cannam@125: cannam@125: # Create the old-style object. cannam@125: reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs cannam@125: cannam@125: output=$obj cannam@125: func_execute_cmds "$reload_cmds" 'exit $?' cannam@125: cannam@125: # Exit if we aren't doing a library object file. cannam@125: if test -z "$libobj"; then cannam@125: if test -n "$gentop"; then cannam@125: func_show_eval '${RM}r "$gentop"' cannam@125: fi cannam@125: cannam@125: exit $EXIT_SUCCESS cannam@125: fi cannam@125: cannam@125: test yes = "$build_libtool_libs" || { cannam@125: if test -n "$gentop"; then cannam@125: func_show_eval '${RM}r "$gentop"' cannam@125: fi cannam@125: cannam@125: # Create an invalid libtool object if no PIC, so that we don't cannam@125: # accidentally link it into a program. cannam@125: # $show "echo timestamp > $libobj" cannam@125: # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? cannam@125: exit $EXIT_SUCCESS cannam@125: } cannam@125: cannam@125: if test -n "$pic_flag" || test default != "$pic_mode"; then cannam@125: # Only do commands if we really have different PIC objects. cannam@125: reload_objs="$libobjs $reload_conv_objs" cannam@125: output=$libobj cannam@125: func_execute_cmds "$reload_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: if test -n "$gentop"; then cannam@125: func_show_eval '${RM}r "$gentop"' cannam@125: fi cannam@125: cannam@125: exit $EXIT_SUCCESS cannam@125: ;; cannam@125: cannam@125: prog) cannam@125: case $host in cannam@125: *cygwin*) func_stripname '' '.exe' "$output" cannam@125: output=$func_stripname_result.exe;; cannam@125: esac cannam@125: test -n "$vinfo" && \ cannam@125: func_warning "'-version-info' is ignored for programs" cannam@125: cannam@125: test -n "$release" && \ cannam@125: func_warning "'-release' is ignored for programs" cannam@125: cannam@125: $preload \ cannam@125: && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ cannam@125: && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." cannam@125: cannam@125: case $host in cannam@125: *-*-rhapsody* | *-*-darwin1.[012]) cannam@125: # On Rhapsody replace the C library is the System framework cannam@125: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` cannam@125: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` cannam@125: ;; cannam@125: esac cannam@125: cannam@125: case $host in cannam@125: *-*-darwin*) cannam@125: # Don't allow lazy linking, it breaks C++ global constructors cannam@125: # But is supposedly fixed on 10.4 or later (yay!). cannam@125: if test CXX = "$tagname"; then cannam@125: case ${MACOSX_DEPLOYMENT_TARGET-10.0} in cannam@125: 10.[0123]) cannam@125: func_append compile_command " $wl-bind_at_load" cannam@125: func_append finalize_command " $wl-bind_at_load" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: # Time to change all our "foo.ltframework" stuff back to "-framework foo" cannam@125: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` cannam@125: ;; cannam@125: esac cannam@125: cannam@125: cannam@125: # move library search paths that coincide with paths to not yet cannam@125: # installed libraries to the beginning of the library search list cannam@125: new_libs= cannam@125: for path in $notinst_path; do cannam@125: case " $new_libs " in cannam@125: *" -L$path/$objdir "*) ;; cannam@125: *) cannam@125: case " $compile_deplibs " in cannam@125: *" -L$path/$objdir "*) cannam@125: func_append new_libs " -L$path/$objdir" ;; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: for deplib in $compile_deplibs; do cannam@125: case $deplib in cannam@125: -L*) cannam@125: case " $new_libs " in cannam@125: *" $deplib "*) ;; cannam@125: *) func_append new_libs " $deplib" ;; cannam@125: esac cannam@125: ;; cannam@125: *) func_append new_libs " $deplib" ;; cannam@125: esac cannam@125: done cannam@125: compile_deplibs=$new_libs cannam@125: cannam@125: cannam@125: func_append compile_command " $compile_deplibs" cannam@125: func_append finalize_command " $finalize_deplibs" cannam@125: cannam@125: if test -n "$rpath$xrpath"; then cannam@125: # If the user specified any rpath flags, then add them. cannam@125: for libdir in $rpath $xrpath; do cannam@125: # This is the magic to use -rpath. cannam@125: case "$finalize_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append finalize_rpath " $libdir" ;; cannam@125: esac cannam@125: done cannam@125: fi cannam@125: cannam@125: # Now hardcode the library paths cannam@125: rpath= cannam@125: hardcode_libdirs= cannam@125: for libdir in $compile_rpath $finalize_rpath; do cannam@125: if test -n "$hardcode_libdir_flag_spec"; then cannam@125: if test -n "$hardcode_libdir_separator"; then cannam@125: if test -z "$hardcode_libdirs"; then cannam@125: hardcode_libdirs=$libdir cannam@125: else cannam@125: # Just accumulate the unique libdirs. cannam@125: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in cannam@125: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) cannam@125: ;; cannam@125: *) cannam@125: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: else cannam@125: eval flag=\"$hardcode_libdir_flag_spec\" cannam@125: func_append rpath " $flag" cannam@125: fi cannam@125: elif test -n "$runpath_var"; then cannam@125: case "$perm_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append perm_rpath " $libdir" ;; cannam@125: esac cannam@125: fi cannam@125: case $host in cannam@125: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) cannam@125: testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` cannam@125: case :$dllsearchpath: in cannam@125: *":$libdir:"*) ;; cannam@125: ::) dllsearchpath=$libdir;; cannam@125: *) func_append dllsearchpath ":$libdir";; cannam@125: esac cannam@125: case :$dllsearchpath: in cannam@125: *":$testbindir:"*) ;; cannam@125: ::) dllsearchpath=$testbindir;; cannam@125: *) func_append dllsearchpath ":$testbindir";; cannam@125: esac cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: # Substitute the hardcoded libdirs into the rpath. cannam@125: if test -n "$hardcode_libdir_separator" && cannam@125: test -n "$hardcode_libdirs"; then cannam@125: libdir=$hardcode_libdirs cannam@125: eval rpath=\" $hardcode_libdir_flag_spec\" cannam@125: fi cannam@125: compile_rpath=$rpath cannam@125: cannam@125: rpath= cannam@125: hardcode_libdirs= cannam@125: for libdir in $finalize_rpath; do cannam@125: if test -n "$hardcode_libdir_flag_spec"; then cannam@125: if test -n "$hardcode_libdir_separator"; then cannam@125: if test -z "$hardcode_libdirs"; then cannam@125: hardcode_libdirs=$libdir cannam@125: else cannam@125: # Just accumulate the unique libdirs. cannam@125: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in cannam@125: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) cannam@125: ;; cannam@125: *) cannam@125: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: else cannam@125: eval flag=\"$hardcode_libdir_flag_spec\" cannam@125: func_append rpath " $flag" cannam@125: fi cannam@125: elif test -n "$runpath_var"; then cannam@125: case "$finalize_perm_rpath " in cannam@125: *" $libdir "*) ;; cannam@125: *) func_append finalize_perm_rpath " $libdir" ;; cannam@125: esac cannam@125: fi cannam@125: done cannam@125: # Substitute the hardcoded libdirs into the rpath. cannam@125: if test -n "$hardcode_libdir_separator" && cannam@125: test -n "$hardcode_libdirs"; then cannam@125: libdir=$hardcode_libdirs cannam@125: eval rpath=\" $hardcode_libdir_flag_spec\" cannam@125: fi cannam@125: finalize_rpath=$rpath cannam@125: cannam@125: if test -n "$libobjs" && test yes = "$build_old_libs"; then cannam@125: # Transform all the library objects into standard objects. cannam@125: compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` cannam@125: finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` cannam@125: fi cannam@125: cannam@125: func_generate_dlsyms "$outputname" "@PROGRAM@" false cannam@125: cannam@125: # template prelinking step cannam@125: if test -n "$prelink_cmds"; then cannam@125: func_execute_cmds "$prelink_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: wrappers_required=: cannam@125: case $host in cannam@125: *cegcc* | *mingw32ce*) cannam@125: # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. cannam@125: wrappers_required=false cannam@125: ;; cannam@125: *cygwin* | *mingw* ) cannam@125: test yes = "$build_libtool_libs" || wrappers_required=false cannam@125: ;; cannam@125: *) cannam@125: if test no = "$need_relink" || test yes != "$build_libtool_libs"; then cannam@125: wrappers_required=false cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: $wrappers_required || { cannam@125: # Replace the output file specification. cannam@125: compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` cannam@125: link_command=$compile_command$compile_rpath cannam@125: cannam@125: # We have no uninstalled library dependencies, so finalize right now. cannam@125: exit_status=0 cannam@125: func_show_eval "$link_command" 'exit_status=$?' cannam@125: cannam@125: if test -n "$postlink_cmds"; then cannam@125: func_to_tool_file "$output" cannam@125: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` cannam@125: func_execute_cmds "$postlink_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: # Delete the generated files. cannam@125: if test -f "$output_objdir/${outputname}S.$objext"; then cannam@125: func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' cannam@125: fi cannam@125: cannam@125: exit $exit_status cannam@125: } cannam@125: cannam@125: if test -n "$compile_shlibpath$finalize_shlibpath"; then cannam@125: compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" cannam@125: fi cannam@125: if test -n "$finalize_shlibpath"; then cannam@125: finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" cannam@125: fi cannam@125: cannam@125: compile_var= cannam@125: finalize_var= cannam@125: if test -n "$runpath_var"; then cannam@125: if test -n "$perm_rpath"; then cannam@125: # We should set the runpath_var. cannam@125: rpath= cannam@125: for dir in $perm_rpath; do cannam@125: func_append rpath "$dir:" cannam@125: done cannam@125: compile_var="$runpath_var=\"$rpath\$$runpath_var\" " cannam@125: fi cannam@125: if test -n "$finalize_perm_rpath"; then cannam@125: # We should set the runpath_var. cannam@125: rpath= cannam@125: for dir in $finalize_perm_rpath; do cannam@125: func_append rpath "$dir:" cannam@125: done cannam@125: finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " cannam@125: fi cannam@125: fi cannam@125: cannam@125: if test yes = "$no_install"; then cannam@125: # We don't need to create a wrapper script. cannam@125: link_command=$compile_var$compile_command$compile_rpath cannam@125: # Replace the output file specification. cannam@125: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` cannam@125: # Delete the old output file. cannam@125: $opt_dry_run || $RM $output cannam@125: # Link the executable and exit cannam@125: func_show_eval "$link_command" 'exit $?' cannam@125: cannam@125: if test -n "$postlink_cmds"; then cannam@125: func_to_tool_file "$output" cannam@125: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` cannam@125: func_execute_cmds "$postlink_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: exit $EXIT_SUCCESS cannam@125: fi cannam@125: cannam@125: case $hardcode_action,$fast_install in cannam@125: relink,*) cannam@125: # Fast installation is not supported cannam@125: link_command=$compile_var$compile_command$compile_rpath cannam@125: relink_command=$finalize_var$finalize_command$finalize_rpath cannam@125: cannam@125: func_warning "this platform does not like uninstalled shared libraries" cannam@125: func_warning "'$output' will be relinked during installation" cannam@125: ;; cannam@125: *,yes) cannam@125: link_command=$finalize_var$compile_command$finalize_rpath cannam@125: relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` cannam@125: ;; cannam@125: *,no) cannam@125: link_command=$compile_var$compile_command$compile_rpath cannam@125: relink_command=$finalize_var$finalize_command$finalize_rpath cannam@125: ;; cannam@125: *,needless) cannam@125: link_command=$finalize_var$compile_command$finalize_rpath cannam@125: relink_command= cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # Replace the output file specification. cannam@125: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` cannam@125: cannam@125: # Delete the old output files. cannam@125: $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname cannam@125: cannam@125: func_show_eval "$link_command" 'exit $?' cannam@125: cannam@125: if test -n "$postlink_cmds"; then cannam@125: func_to_tool_file "$output_objdir/$outputname" cannam@125: 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'` cannam@125: func_execute_cmds "$postlink_cmds" 'exit $?' cannam@125: fi cannam@125: cannam@125: # Now create the wrapper script. cannam@125: func_verbose "creating $output" cannam@125: cannam@125: # Quote the relink command for shipping. cannam@125: if test -n "$relink_command"; then cannam@125: # Preserve any variables that may affect compiler behavior cannam@125: for var in $variables_saved_for_relink; do cannam@125: if eval test -z \"\${$var+set}\"; then cannam@125: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" cannam@125: elif eval var_value=\$$var; test -z "$var_value"; then cannam@125: relink_command="$var=; export $var; $relink_command" cannam@125: else cannam@125: func_quote_for_eval "$var_value" cannam@125: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" cannam@125: fi cannam@125: done cannam@125: relink_command="(cd `pwd`; $relink_command)" cannam@125: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` cannam@125: fi cannam@125: cannam@125: # Only actually do things if not in dry run mode. cannam@125: $opt_dry_run || { cannam@125: # win32 will think the script is a binary if it has cannam@125: # a .exe suffix, so we strip it off here. cannam@125: case $output in cannam@125: *.exe) func_stripname '' '.exe' "$output" cannam@125: output=$func_stripname_result ;; cannam@125: esac cannam@125: # test for cygwin because mv fails w/o .exe extensions cannam@125: case $host in cannam@125: *cygwin*) cannam@125: exeext=.exe cannam@125: func_stripname '' '.exe' "$outputname" cannam@125: outputname=$func_stripname_result ;; cannam@125: *) exeext= ;; cannam@125: esac cannam@125: case $host in cannam@125: *cygwin* | *mingw* ) cannam@125: func_dirname_and_basename "$output" "" "." cannam@125: output_name=$func_basename_result cannam@125: output_path=$func_dirname_result cannam@125: cwrappersource=$output_path/$objdir/lt-$output_name.c cannam@125: cwrapper=$output_path/$output_name.exe cannam@125: $RM $cwrappersource $cwrapper cannam@125: trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cannam@125: cannam@125: func_emit_cwrapperexe_src > $cwrappersource cannam@125: cannam@125: # The wrapper executable is built using the $host compiler, cannam@125: # because it contains $host paths and files. If cross- cannam@125: # compiling, it, like the target executable, must be cannam@125: # executed on the $host or under an emulation environment. cannam@125: $opt_dry_run || { cannam@125: $LTCC $LTCFLAGS -o $cwrapper $cwrappersource cannam@125: $STRIP $cwrapper cannam@125: } cannam@125: cannam@125: # Now, create the wrapper script for func_source use: cannam@125: func_ltwrapper_scriptname $cwrapper cannam@125: $RM $func_ltwrapper_scriptname_result cannam@125: trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 cannam@125: $opt_dry_run || { cannam@125: # note: this script will not be executed, so do not chmod. cannam@125: if test "x$build" = "x$host"; then cannam@125: $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result cannam@125: else cannam@125: func_emit_wrapper no > $func_ltwrapper_scriptname_result cannam@125: fi cannam@125: } cannam@125: ;; cannam@125: * ) cannam@125: $RM $output cannam@125: trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 cannam@125: cannam@125: func_emit_wrapper no > $output cannam@125: chmod +x $output cannam@125: ;; cannam@125: esac cannam@125: } cannam@125: exit $EXIT_SUCCESS cannam@125: ;; cannam@125: esac cannam@125: cannam@125: # See if we need to build an old-fashioned archive. cannam@125: for oldlib in $oldlibs; do cannam@125: cannam@125: case $build_libtool_libs in cannam@125: convenience) cannam@125: oldobjs="$libobjs_save $symfileobj" cannam@125: addlibs=$convenience cannam@125: build_libtool_libs=no cannam@125: ;; cannam@125: module) cannam@125: oldobjs=$libobjs_save cannam@125: addlibs=$old_convenience cannam@125: build_libtool_libs=no cannam@125: ;; cannam@125: *) cannam@125: oldobjs="$old_deplibs $non_pic_objects" cannam@125: $preload && test -f "$symfileobj" \ cannam@125: && func_append oldobjs " $symfileobj" cannam@125: addlibs=$old_convenience cannam@125: ;; cannam@125: esac cannam@125: cannam@125: if test -n "$addlibs"; then cannam@125: gentop=$output_objdir/${outputname}x cannam@125: func_append generated " $gentop" cannam@125: cannam@125: func_extract_archives $gentop $addlibs cannam@125: func_append oldobjs " $func_extract_archives_result" cannam@125: fi cannam@125: cannam@125: # Do each command in the archive commands. cannam@125: if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cannam@125: cmds=$old_archive_from_new_cmds cannam@125: else cannam@125: cannam@125: # Add any objects from preloaded convenience libraries cannam@125: if test -n "$dlprefiles"; then cannam@125: gentop=$output_objdir/${outputname}x cannam@125: func_append generated " $gentop" cannam@125: cannam@125: func_extract_archives $gentop $dlprefiles cannam@125: func_append oldobjs " $func_extract_archives_result" cannam@125: fi cannam@125: cannam@125: # POSIX demands no paths to be encoded in archives. We have cannam@125: # to avoid creating archives with duplicate basenames if we cannam@125: # might have to extract them afterwards, e.g., when creating a cannam@125: # static archive out of a convenience library, or when linking cannam@125: # the entirety of a libtool archive into another (currently cannam@125: # not supported by libtool). cannam@125: if (for obj in $oldobjs cannam@125: do cannam@125: func_basename "$obj" cannam@125: $ECHO "$func_basename_result" cannam@125: done | sort | sort -uc >/dev/null 2>&1); then cannam@125: : cannam@125: else cannam@125: echo "copying selected object files to avoid basename conflicts..." cannam@125: gentop=$output_objdir/${outputname}x cannam@125: func_append generated " $gentop" cannam@125: func_mkdir_p "$gentop" cannam@125: save_oldobjs=$oldobjs cannam@125: oldobjs= cannam@125: counter=1 cannam@125: for obj in $save_oldobjs cannam@125: do cannam@125: func_basename "$obj" cannam@125: objbase=$func_basename_result cannam@125: case " $oldobjs " in cannam@125: " ") oldobjs=$obj ;; cannam@125: *[\ /]"$objbase "*) cannam@125: while :; do cannam@125: # Make sure we don't pick an alternate name that also cannam@125: # overlaps. cannam@125: newobj=lt$counter-$objbase cannam@125: func_arith $counter + 1 cannam@125: counter=$func_arith_result cannam@125: case " $oldobjs " in cannam@125: *[\ /]"$newobj "*) ;; cannam@125: *) if test ! -f "$gentop/$newobj"; then break; fi ;; cannam@125: esac cannam@125: done cannam@125: func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" cannam@125: func_append oldobjs " $gentop/$newobj" cannam@125: ;; cannam@125: *) func_append oldobjs " $obj" ;; cannam@125: esac cannam@125: done cannam@125: fi cannam@125: func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 cannam@125: tool_oldlib=$func_to_tool_file_result cannam@125: eval cmds=\"$old_archive_cmds\" cannam@125: cannam@125: func_len " $cmds" cannam@125: len=$func_len_result cannam@125: if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cannam@125: cmds=$old_archive_cmds cannam@125: elif test -n "$archiver_list_spec"; then cannam@125: func_verbose "using command file archive linking..." cannam@125: for obj in $oldobjs cannam@125: do cannam@125: func_to_tool_file "$obj" cannam@125: $ECHO "$func_to_tool_file_result" cannam@125: done > $output_objdir/$libname.libcmd cannam@125: func_to_tool_file "$output_objdir/$libname.libcmd" cannam@125: oldobjs=" $archiver_list_spec$func_to_tool_file_result" cannam@125: cmds=$old_archive_cmds cannam@125: else cannam@125: # the command line is too long to link in one step, link in parts cannam@125: func_verbose "using piecewise archive linking..." cannam@125: save_RANLIB=$RANLIB cannam@125: RANLIB=: cannam@125: objlist= cannam@125: concat_cmds= cannam@125: save_oldobjs=$oldobjs cannam@125: oldobjs= cannam@125: # Is there a better way of finding the last object in the list? cannam@125: for obj in $save_oldobjs cannam@125: do cannam@125: last_oldobj=$obj cannam@125: done cannam@125: eval test_cmds=\"$old_archive_cmds\" cannam@125: func_len " $test_cmds" cannam@125: len0=$func_len_result cannam@125: len=$len0 cannam@125: for obj in $save_oldobjs cannam@125: do cannam@125: func_len " $obj" cannam@125: func_arith $len + $func_len_result cannam@125: len=$func_arith_result cannam@125: func_append objlist " $obj" cannam@125: if test "$len" -lt "$max_cmd_len"; then cannam@125: : cannam@125: else cannam@125: # the above command should be used before it gets too long cannam@125: oldobjs=$objlist cannam@125: if test "$obj" = "$last_oldobj"; then cannam@125: RANLIB=$save_RANLIB cannam@125: fi cannam@125: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ cannam@125: eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" cannam@125: objlist= cannam@125: len=$len0 cannam@125: fi cannam@125: done cannam@125: RANLIB=$save_RANLIB cannam@125: oldobjs=$objlist cannam@125: if test -z "$oldobjs"; then cannam@125: eval cmds=\"\$concat_cmds\" cannam@125: else cannam@125: eval cmds=\"\$concat_cmds~\$old_archive_cmds\" cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: func_execute_cmds "$cmds" 'exit $?' cannam@125: done cannam@125: cannam@125: test -n "$generated" && \ cannam@125: func_show_eval "${RM}r$generated" cannam@125: cannam@125: # Now create the libtool archive. cannam@125: case $output in cannam@125: *.la) cannam@125: old_library= cannam@125: test yes = "$build_old_libs" && old_library=$libname.$libext cannam@125: func_verbose "creating $output" cannam@125: cannam@125: # Preserve any variables that may affect compiler behavior cannam@125: for var in $variables_saved_for_relink; do cannam@125: if eval test -z \"\${$var+set}\"; then cannam@125: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" cannam@125: elif eval var_value=\$$var; test -z "$var_value"; then cannam@125: relink_command="$var=; export $var; $relink_command" cannam@125: else cannam@125: func_quote_for_eval "$var_value" cannam@125: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" cannam@125: fi cannam@125: done cannam@125: # Quote the link command for shipping. cannam@125: relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" cannam@125: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` cannam@125: if test yes = "$hardcode_automatic"; then cannam@125: relink_command= cannam@125: fi cannam@125: cannam@125: # Only create the output if not a dry run. cannam@125: $opt_dry_run || { cannam@125: for installed in no yes; do cannam@125: if test yes = "$installed"; then cannam@125: if test -z "$install_libdir"; then cannam@125: break cannam@125: fi cannam@125: output=$output_objdir/${outputname}i cannam@125: # Replace all uninstalled libtool libraries with the installed ones cannam@125: newdependency_libs= cannam@125: for deplib in $dependency_libs; do cannam@125: case $deplib in cannam@125: *.la) cannam@125: func_basename "$deplib" cannam@125: name=$func_basename_result cannam@125: func_resolve_sysroot "$deplib" cannam@125: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` cannam@125: test -z "$libdir" && \ cannam@125: func_fatal_error "'$deplib' is not a valid libtool archive" cannam@125: func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" cannam@125: ;; cannam@125: -L*) cannam@125: func_stripname -L '' "$deplib" cannam@125: func_replace_sysroot "$func_stripname_result" cannam@125: func_append newdependency_libs " -L$func_replace_sysroot_result" cannam@125: ;; cannam@125: -R*) cannam@125: func_stripname -R '' "$deplib" cannam@125: func_replace_sysroot "$func_stripname_result" cannam@125: func_append newdependency_libs " -R$func_replace_sysroot_result" cannam@125: ;; cannam@125: *) func_append newdependency_libs " $deplib" ;; cannam@125: esac cannam@125: done cannam@125: dependency_libs=$newdependency_libs cannam@125: newdlfiles= cannam@125: cannam@125: for lib in $dlfiles; do cannam@125: case $lib in cannam@125: *.la) cannam@125: func_basename "$lib" cannam@125: name=$func_basename_result cannam@125: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` cannam@125: test -z "$libdir" && \ cannam@125: func_fatal_error "'$lib' is not a valid libtool archive" cannam@125: func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" cannam@125: ;; cannam@125: *) func_append newdlfiles " $lib" ;; cannam@125: esac cannam@125: done cannam@125: dlfiles=$newdlfiles cannam@125: newdlprefiles= cannam@125: for lib in $dlprefiles; do cannam@125: case $lib in cannam@125: *.la) cannam@125: # Only pass preopened files to the pseudo-archive (for cannam@125: # eventual linking with the app. that links it) if we cannam@125: # didn't already link the preopened objects directly into cannam@125: # the library: cannam@125: func_basename "$lib" cannam@125: name=$func_basename_result cannam@125: eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` cannam@125: test -z "$libdir" && \ cannam@125: func_fatal_error "'$lib' is not a valid libtool archive" cannam@125: func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" cannam@125: ;; cannam@125: esac cannam@125: done cannam@125: dlprefiles=$newdlprefiles cannam@125: else cannam@125: newdlfiles= cannam@125: for lib in $dlfiles; do cannam@125: case $lib in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; cannam@125: *) abs=`pwd`"/$lib" ;; cannam@125: esac cannam@125: func_append newdlfiles " $abs" cannam@125: done cannam@125: dlfiles=$newdlfiles cannam@125: newdlprefiles= cannam@125: for lib in $dlprefiles; do cannam@125: case $lib in cannam@125: [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; cannam@125: *) abs=`pwd`"/$lib" ;; cannam@125: esac cannam@125: func_append newdlprefiles " $abs" cannam@125: done cannam@125: dlprefiles=$newdlprefiles cannam@125: fi cannam@125: $RM $output cannam@125: # place dlname in correct position for cygwin cannam@125: # In fact, it would be nice if we could use this code for all target cannam@125: # systems that can't hard-code library paths into their executables cannam@125: # and that have no shared library path variable independent of PATH, cannam@125: # but it turns out we can't easily determine that from inspecting cannam@125: # libtool variables, so we have to hard-code the OSs to which it cannam@125: # applies here; at the moment, that means platforms that use the PE cannam@125: # object format with DLL files. See the long comment at the top of cannam@125: # tests/bindir.at for full details. cannam@125: tdlname=$dlname cannam@125: case $host,$output,$installed,$module,$dlname in cannam@125: *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) cannam@125: # If a -bindir argument was supplied, place the dll there. cannam@125: if test -n "$bindir"; then cannam@125: func_relative_path "$install_libdir" "$bindir" cannam@125: tdlname=$func_relative_path_result/$dlname cannam@125: else cannam@125: # Otherwise fall back on heuristic. cannam@125: tdlname=../bin/$dlname cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: $ECHO > $output "\ cannam@125: # $outputname - a libtool library file cannam@125: # Generated by $PROGRAM (GNU $PACKAGE) $VERSION cannam@125: # cannam@125: # Please DO NOT delete this file! cannam@125: # It is necessary for linking the library. cannam@125: cannam@125: # The name that we can dlopen(3). cannam@125: dlname='$tdlname' cannam@125: cannam@125: # Names of this library. cannam@125: library_names='$library_names' cannam@125: cannam@125: # The name of the static archive. cannam@125: old_library='$old_library' cannam@125: cannam@125: # Linker flags that cannot go in dependency_libs. cannam@125: inherited_linker_flags='$new_inherited_linker_flags' cannam@125: cannam@125: # Libraries that this one depends upon. cannam@125: dependency_libs='$dependency_libs' cannam@125: cannam@125: # Names of additional weak libraries provided by this library cannam@125: weak_library_names='$weak_libs' cannam@125: cannam@125: # Version information for $libname. cannam@125: current=$current cannam@125: age=$age cannam@125: revision=$revision cannam@125: cannam@125: # Is this an already installed library? cannam@125: installed=$installed cannam@125: cannam@125: # Should we warn about portability when linking against -modules? cannam@125: shouldnotlink=$module cannam@125: cannam@125: # Files to dlopen/dlpreopen cannam@125: dlopen='$dlfiles' cannam@125: dlpreopen='$dlprefiles' cannam@125: cannam@125: # Directory that this library needs to be installed in: cannam@125: libdir='$install_libdir'" cannam@125: if test no,yes = "$installed,$need_relink"; then cannam@125: $ECHO >> $output "\ cannam@125: relink_command=\"$relink_command\"" cannam@125: fi cannam@125: done cannam@125: } cannam@125: cannam@125: # Do a symbolic link so that the libtool archive can be found in cannam@125: # LD_LIBRARY_PATH before the program is installed. cannam@125: func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' cannam@125: ;; cannam@125: esac cannam@125: exit $EXIT_SUCCESS cannam@125: } cannam@125: cannam@125: if test link = "$opt_mode" || test relink = "$opt_mode"; then cannam@125: func_mode_link ${1+"$@"} cannam@125: fi cannam@125: cannam@125: cannam@125: # func_mode_uninstall arg... cannam@125: func_mode_uninstall () cannam@125: { cannam@125: $debug_cmd cannam@125: cannam@125: RM=$nonopt cannam@125: files= cannam@125: rmforce=false cannam@125: exit_status=0 cannam@125: cannam@125: # This variable tells wrapper scripts just to set variables rather cannam@125: # than running their programs. cannam@125: libtool_install_magic=$magic cannam@125: cannam@125: for arg cannam@125: do cannam@125: case $arg in cannam@125: -f) func_append RM " $arg"; rmforce=: ;; cannam@125: -*) func_append RM " $arg" ;; cannam@125: *) func_append files " $arg" ;; cannam@125: esac cannam@125: done cannam@125: cannam@125: test -z "$RM" && \ cannam@125: func_fatal_help "you must specify an RM program" cannam@125: cannam@125: rmdirs= cannam@125: cannam@125: for file in $files; do cannam@125: func_dirname "$file" "" "." cannam@125: dir=$func_dirname_result cannam@125: if test . = "$dir"; then cannam@125: odir=$objdir cannam@125: else cannam@125: odir=$dir/$objdir cannam@125: fi cannam@125: func_basename "$file" cannam@125: name=$func_basename_result cannam@125: test uninstall = "$opt_mode" && odir=$dir cannam@125: cannam@125: # Remember odir for removal later, being careful to avoid duplicates cannam@125: if test clean = "$opt_mode"; then cannam@125: case " $rmdirs " in cannam@125: *" $odir "*) ;; cannam@125: *) func_append rmdirs " $odir" ;; cannam@125: esac cannam@125: fi cannam@125: cannam@125: # Don't error if the file doesn't exist and rm -f was used. cannam@125: if { test -L "$file"; } >/dev/null 2>&1 || cannam@125: { test -h "$file"; } >/dev/null 2>&1 || cannam@125: test -f "$file"; then cannam@125: : cannam@125: elif test -d "$file"; then cannam@125: exit_status=1 cannam@125: continue cannam@125: elif $rmforce; then cannam@125: continue cannam@125: fi cannam@125: cannam@125: rmfiles=$file cannam@125: cannam@125: case $name in cannam@125: *.la) cannam@125: # Possibly a libtool archive, so verify it. cannam@125: if func_lalib_p "$file"; then cannam@125: func_source $dir/$name cannam@125: cannam@125: # Delete the libtool libraries and symlinks. cannam@125: for n in $library_names; do cannam@125: func_append rmfiles " $odir/$n" cannam@125: done cannam@125: test -n "$old_library" && func_append rmfiles " $odir/$old_library" cannam@125: cannam@125: case $opt_mode in cannam@125: clean) cannam@125: case " $library_names " in cannam@125: *" $dlname "*) ;; cannam@125: *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; cannam@125: esac cannam@125: test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" cannam@125: ;; cannam@125: uninstall) cannam@125: if test -n "$library_names"; then cannam@125: # Do each command in the postuninstall commands. cannam@125: func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' cannam@125: fi cannam@125: cannam@125: if test -n "$old_library"; then cannam@125: # Do each command in the old_postuninstall commands. cannam@125: func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' cannam@125: fi cannam@125: # FIXME: should reinstall the best remaining shared library. cannam@125: ;; cannam@125: esac cannam@125: fi cannam@125: ;; cannam@125: cannam@125: *.lo) cannam@125: # Possibly a libtool object, so verify it. cannam@125: if func_lalib_p "$file"; then cannam@125: cannam@125: # Read the .lo file cannam@125: func_source $dir/$name cannam@125: cannam@125: # Add PIC object to the list of files to remove. cannam@125: if test -n "$pic_object" && test none != "$pic_object"; then cannam@125: func_append rmfiles " $dir/$pic_object" cannam@125: fi cannam@125: cannam@125: # Add non-PIC object to the list of files to remove. cannam@125: if test -n "$non_pic_object" && test none != "$non_pic_object"; then cannam@125: func_append rmfiles " $dir/$non_pic_object" cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: cannam@125: *) cannam@125: if test clean = "$opt_mode"; then cannam@125: noexename=$name cannam@125: case $file in cannam@125: *.exe) cannam@125: func_stripname '' '.exe' "$file" cannam@125: file=$func_stripname_result cannam@125: func_stripname '' '.exe' "$name" cannam@125: noexename=$func_stripname_result cannam@125: # $file with .exe has already been added to rmfiles, cannam@125: # add $file without .exe cannam@125: func_append rmfiles " $file" cannam@125: ;; cannam@125: esac cannam@125: # Do a test to see if this is a libtool program. cannam@125: if func_ltwrapper_p "$file"; then cannam@125: if func_ltwrapper_executable_p "$file"; then cannam@125: func_ltwrapper_scriptname "$file" cannam@125: relink_command= cannam@125: func_source $func_ltwrapper_scriptname_result cannam@125: func_append rmfiles " $func_ltwrapper_scriptname_result" cannam@125: else cannam@125: relink_command= cannam@125: func_source $dir/$noexename cannam@125: fi cannam@125: cannam@125: # note $name still contains .exe if it was in $file originally cannam@125: # as does the version of $file that was added into $rmfiles cannam@125: func_append rmfiles " $odir/$name $odir/${name}S.$objext" cannam@125: if test yes = "$fast_install" && test -n "$relink_command"; then cannam@125: func_append rmfiles " $odir/lt-$name" cannam@125: fi cannam@125: if test "X$noexename" != "X$name"; then cannam@125: func_append rmfiles " $odir/lt-$noexename.c" cannam@125: fi cannam@125: fi cannam@125: fi cannam@125: ;; cannam@125: esac cannam@125: func_show_eval "$RM $rmfiles" 'exit_status=1' cannam@125: done cannam@125: cannam@125: # Try to remove the $objdir's in the directories where we deleted files cannam@125: for dir in $rmdirs; do cannam@125: if test -d "$dir"; then cannam@125: func_show_eval "rmdir $dir >/dev/null 2>&1" cannam@125: fi cannam@125: done cannam@125: cannam@125: exit $exit_status cannam@125: } cannam@125: cannam@125: if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then cannam@125: func_mode_uninstall ${1+"$@"} cannam@125: fi cannam@125: cannam@125: test -z "$opt_mode" && { cannam@125: help=$generic_help cannam@125: func_fatal_help "you must specify a MODE" cannam@125: } cannam@125: cannam@125: test -z "$exec_cmd" && \ cannam@125: func_fatal_help "invalid operation mode '$opt_mode'" cannam@125: cannam@125: if test -n "$exec_cmd"; then cannam@125: eval exec "$exec_cmd" cannam@125: exit $EXIT_FAILURE cannam@125: fi cannam@125: cannam@125: exit $exit_status cannam@125: cannam@125: cannam@125: # The TAGs below are defined such that we never get into a situation cannam@125: # where we disable both kinds of libraries. Given conflicting cannam@125: # choices, we go for a static library, that is the most portable, cannam@125: # since we can't tell whether shared libraries were disabled because cannam@125: # the user asked for that or because the platform doesn't support cannam@125: # them. This is particularly important on AIX, because we don't cannam@125: # support having both static and shared libraries enabled at the same cannam@125: # time on that platform, so we default to a shared-only configuration. cannam@125: # If a disable-shared tag is given, we'll fallback to a static-only cannam@125: # configuration. But we'll never go from static-only to shared-only. cannam@125: cannam@125: # ### BEGIN LIBTOOL TAG CONFIG: disable-shared cannam@125: build_libtool_libs=no cannam@125: build_old_libs=yes cannam@125: # ### END LIBTOOL TAG CONFIG: disable-shared cannam@125: cannam@125: # ### BEGIN LIBTOOL TAG CONFIG: disable-static cannam@125: build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` cannam@125: # ### END LIBTOOL TAG CONFIG: disable-static cannam@125: cannam@125: # Local Variables: cannam@125: # mode:shell-script cannam@125: # sh-indentation:2 cannam@125: # End: