Chris@39: Chris@39: # libtool (GNU libtool) 2.4 Chris@39: # Written by Gordon Matzigkeit , 1996 Chris@39: Chris@39: # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, Chris@39: # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Chris@39: # This is free software; see the source for copying conditions. There is NO Chris@39: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Chris@39: Chris@39: # GNU Libtool is free software; you can redistribute it and/or modify Chris@39: # it under the terms of the GNU General Public License as published by Chris@39: # the Free Software Foundation; either version 2 of the License, or Chris@39: # (at your option) any later version. Chris@39: # Chris@39: # As a special exception to the GNU General Public License, Chris@39: # if you distribute this file as part of a program or library that Chris@39: # is built using GNU Libtool, you may include this file under the Chris@39: # same distribution terms that you use for the rest of that program. Chris@39: # Chris@39: # GNU Libtool is distributed in the hope that it will be useful, but Chris@39: # WITHOUT ANY WARRANTY; without even the implied warranty of Chris@39: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Chris@39: # General Public License for more details. Chris@39: # Chris@39: # You should have received a copy of the GNU General Public License Chris@39: # along with GNU Libtool; see the file COPYING. If not, a copy Chris@39: # can be downloaded from http://www.gnu.org/licenses/gpl.html, Chris@39: # or obtained by writing to the Free Software Foundation, Inc., Chris@39: # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Chris@39: Chris@39: # Usage: $progname [OPTION]... [MODE-ARG]... Chris@39: # Chris@39: # Provide generalized library-building support services. Chris@39: # Chris@39: # --config show all configuration variables Chris@39: # --debug enable verbose shell tracing Chris@39: # -n, --dry-run display commands without modifying any files Chris@39: # --features display basic configuration information and exit Chris@39: # --mode=MODE use operation mode MODE Chris@39: # --preserve-dup-deps don't remove duplicate dependency libraries Chris@39: # --quiet, --silent don't print informational messages Chris@39: # --no-quiet, --no-silent Chris@39: # print informational messages (default) Chris@39: # --tag=TAG use configuration variables from tag TAG Chris@39: # -v, --verbose print more informational messages than default Chris@39: # --no-verbose don't print the extra informational messages Chris@39: # --version print version information Chris@39: # -h, --help, --help-all print short, long, or detailed help message Chris@39: # Chris@39: # MODE must be one of the following: Chris@39: # Chris@39: # clean remove files from the build directory Chris@39: # compile compile a source file into a libtool object Chris@39: # execute automatically set library path, then run a program Chris@39: # finish complete the installation of libtool libraries Chris@39: # install install libraries or executables Chris@39: # link create a library or an executable Chris@39: # uninstall remove libraries from an installed directory Chris@39: # Chris@39: # MODE-ARGS vary depending on the MODE. When passed as first option, Chris@39: # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. Chris@39: # Try `$progname --help --mode=MODE' for a more detailed description of MODE. Chris@39: # Chris@39: # When reporting a bug, please describe a test case to reproduce it and Chris@39: # include the following information: Chris@39: # Chris@39: # host-triplet: $host Chris@39: # shell: $SHELL Chris@39: # compiler: $LTCC Chris@39: # compiler flags: $LTCFLAGS Chris@39: # linker: $LD (gnu? $with_gnu_ld) Chris@39: # $progname: (GNU libtool) 2.4 Debian-2.4-2ubuntu1 Chris@39: # automake: $automake_version Chris@39: # autoconf: $autoconf_version Chris@39: # Chris@39: # Report bugs to . Chris@39: # GNU libtool home page: . Chris@39: # General help using GNU software: . Chris@39: Chris@39: PROGRAM=libtool Chris@39: PACKAGE=libtool Chris@39: VERSION="2.4 Debian-2.4-2ubuntu1" Chris@39: TIMESTAMP="" Chris@39: package_revision=1.3293 Chris@39: Chris@39: # Be Bourne compatible Chris@39: if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then Chris@39: emulate sh Chris@39: NULLCMD=: Chris@39: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which Chris@39: # is contrary to our usage. Disable this feature. Chris@39: alias -g '${1+"$@"}'='"$@"' Chris@39: setopt NO_GLOB_SUBST Chris@39: else Chris@39: case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac Chris@39: fi Chris@39: BIN_SH=xpg4; export BIN_SH # for Tru64 Chris@39: DUALCASE=1; export DUALCASE # for MKS sh Chris@39: Chris@39: # A function that is used when there is no print builtin or printf. Chris@39: func_fallback_echo () Chris@39: { Chris@39: eval 'cat <<_LTECHO_EOF Chris@39: $1 Chris@39: _LTECHO_EOF' Chris@39: } Chris@39: Chris@39: # NLS nuisances: We save the old values to restore during execute mode. Chris@39: lt_user_locale= Chris@39: lt_safe_locale= Chris@39: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES Chris@39: do Chris@39: eval "if test \"\${$lt_var+set}\" = set; then Chris@39: save_$lt_var=\$$lt_var Chris@39: $lt_var=C Chris@39: export $lt_var Chris@39: lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" Chris@39: lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" Chris@39: fi" Chris@39: done Chris@39: LC_ALL=C Chris@39: LANGUAGE=C Chris@39: export LANGUAGE LC_ALL Chris@39: Chris@39: $lt_unset CDPATH Chris@39: Chris@39: Chris@39: # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh Chris@39: # is ksh but when the shell is invoked as "sh" and the current value of Chris@39: # the _XPG environment variable is not equal to 1 (one), the special Chris@39: # positional parameter $0, within a function call, is the name of the Chris@39: # function. Chris@39: progpath="$0" Chris@39: Chris@39: Chris@39: Chris@39: : ${CP="cp -f"} Chris@39: test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} Chris@39: : ${EGREP="/bin/grep -E"} Chris@39: : ${FGREP="/bin/grep -F"} Chris@39: : ${GREP="/bin/grep"} Chris@39: : ${LN_S="ln -s"} Chris@39: : ${MAKE="make"} Chris@39: : ${MKDIR="mkdir"} Chris@39: : ${MV="mv -f"} Chris@39: : ${RM="rm -f"} Chris@39: : ${SED="/bin/sed"} Chris@39: : ${SHELL="${CONFIG_SHELL-/bin/sh}"} Chris@39: : ${Xsed="$SED -e 1s/^X//"} Chris@39: Chris@39: # Global variables: Chris@39: EXIT_SUCCESS=0 Chris@39: EXIT_FAILURE=1 Chris@39: EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. Chris@39: EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. Chris@39: Chris@39: exit_status=$EXIT_SUCCESS Chris@39: Chris@39: # Make sure IFS has a sensible default Chris@39: lt_nl=' Chris@39: ' Chris@39: IFS=" $lt_nl" Chris@39: Chris@39: dirname="s,/[^/]*$,," Chris@39: basename="s,^.*/,," Chris@39: Chris@39: # func_dirname file append nondir_replacement Chris@39: # Compute the dirname of FILE. If nonempty, add APPEND to the result, Chris@39: # otherwise set result to NONDIR_REPLACEMENT. Chris@39: func_dirname () Chris@39: { Chris@39: func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` Chris@39: if test "X$func_dirname_result" = "X${1}"; then Chris@39: func_dirname_result="${3}" Chris@39: else Chris@39: func_dirname_result="$func_dirname_result${2}" Chris@39: fi Chris@39: } # func_dirname may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_basename file Chris@39: func_basename () Chris@39: { Chris@39: func_basename_result=`$ECHO "${1}" | $SED "$basename"` Chris@39: } # func_basename may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_dirname_and_basename file append nondir_replacement Chris@39: # perform func_basename and func_dirname in a single function Chris@39: # call: Chris@39: # dirname: Compute the dirname of FILE. If nonempty, Chris@39: # add APPEND to the result, otherwise set result Chris@39: # to NONDIR_REPLACEMENT. Chris@39: # value returned in "$func_dirname_result" Chris@39: # basename: Compute filename of FILE. Chris@39: # value retuned in "$func_basename_result" Chris@39: # Implementation must be kept synchronized with func_dirname Chris@39: # and func_basename. For efficiency, we do not delegate to Chris@39: # those functions but instead duplicate the functionality here. Chris@39: func_dirname_and_basename () Chris@39: { Chris@39: # Extract subdirectory from the argument. Chris@39: func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` Chris@39: if test "X$func_dirname_result" = "X${1}"; then Chris@39: func_dirname_result="${3}" Chris@39: else Chris@39: func_dirname_result="$func_dirname_result${2}" Chris@39: fi Chris@39: func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` Chris@39: } # func_dirname_and_basename may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_stripname prefix suffix name Chris@39: # strip PREFIX and SUFFIX off of NAME. Chris@39: # PREFIX and SUFFIX must not contain globbing or regex special Chris@39: # characters, hashes, percent signs, but SUFFIX may contain a leading Chris@39: # dot (in which case that matches only a dot). Chris@39: # func_strip_suffix prefix name Chris@39: func_stripname () Chris@39: { Chris@39: case ${2} in Chris@39: .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; Chris@39: *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; Chris@39: esac Chris@39: } # func_stripname may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # These SED scripts presuppose an absolute path with a trailing slash. Chris@39: pathcar='s,^/\([^/]*\).*$,\1,' Chris@39: pathcdr='s,^/[^/]*,,' Chris@39: removedotparts=':dotsl Chris@39: s@/\./@/@g Chris@39: t dotsl Chris@39: s,/\.$,/,' Chris@39: collapseslashes='s@/\{1,\}@/@g' Chris@39: finalslash='s,/*$,/,' Chris@39: Chris@39: # func_normal_abspath PATH Chris@39: # Remove doubled-up and trailing slashes, "." path components, Chris@39: # and cancel out any ".." path components in PATH after making Chris@39: # it an absolute path. Chris@39: # value returned in "$func_normal_abspath_result" Chris@39: func_normal_abspath () Chris@39: { Chris@39: # Start from root dir and reassemble the path. Chris@39: func_normal_abspath_result= Chris@39: func_normal_abspath_tpath=$1 Chris@39: func_normal_abspath_altnamespace= Chris@39: case $func_normal_abspath_tpath in Chris@39: "") Chris@39: # Empty path, that just means $cwd. Chris@39: func_stripname '' '/' "`pwd`" Chris@39: func_normal_abspath_result=$func_stripname_result Chris@39: return Chris@39: ;; Chris@39: # The next three entries are used to spot a run of precisely Chris@39: # two leading slashes without using negated character classes; Chris@39: # we take advantage of case's first-match behaviour. Chris@39: ///*) Chris@39: # Unusual form of absolute path, do nothing. Chris@39: ;; Chris@39: //*) Chris@39: # Not necessarily an ordinary path; POSIX reserves leading '//' Chris@39: # and for example Cygwin uses it to access remote file shares Chris@39: # over CIFS/SMB, so we conserve a leading double slash if found. Chris@39: func_normal_abspath_altnamespace=/ Chris@39: ;; Chris@39: /*) Chris@39: # Absolute path, do nothing. Chris@39: ;; Chris@39: *) Chris@39: # Relative path, prepend $cwd. Chris@39: func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath Chris@39: ;; Chris@39: esac Chris@39: # Cancel out all the simple stuff to save iterations. We also want Chris@39: # the path to end with a slash for ease of parsing, so make sure Chris@39: # there is one (and only one) here. Chris@39: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@39: -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` Chris@39: while :; do Chris@39: # Processed it all yet? Chris@39: if test "$func_normal_abspath_tpath" = / ; then Chris@39: # If we ascended to the root using ".." the result may be empty now. Chris@39: if test -z "$func_normal_abspath_result" ; then Chris@39: func_normal_abspath_result=/ Chris@39: fi Chris@39: break Chris@39: fi Chris@39: func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@39: -e "$pathcar"` Chris@39: func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ Chris@39: -e "$pathcdr"` Chris@39: # Figure out what to do with it Chris@39: case $func_normal_abspath_tcomponent in Chris@39: "") Chris@39: # Trailing empty path component, ignore it. Chris@39: ;; Chris@39: ..) Chris@39: # Parent dir; strip last assembled component from result. Chris@39: func_dirname "$func_normal_abspath_result" Chris@39: func_normal_abspath_result=$func_dirname_result Chris@39: ;; Chris@39: *) Chris@39: # Actual path component, append it. Chris@39: func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: # Restore leading double-slash if one was found on entry. Chris@39: func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result Chris@39: } Chris@39: Chris@39: # func_relative_path SRCDIR DSTDIR Chris@39: # generates a relative path from SRCDIR to DSTDIR, with a trailing Chris@39: # slash if non-empty, suitable for immediately appending a filename Chris@39: # without needing to append a separator. Chris@39: # value returned in "$func_relative_path_result" Chris@39: func_relative_path () Chris@39: { Chris@39: func_relative_path_result= Chris@39: func_normal_abspath "$1" Chris@39: func_relative_path_tlibdir=$func_normal_abspath_result Chris@39: func_normal_abspath "$2" Chris@39: func_relative_path_tbindir=$func_normal_abspath_result Chris@39: Chris@39: # Ascend the tree starting from libdir Chris@39: while :; do Chris@39: # check if we have found a prefix of bindir Chris@39: case $func_relative_path_tbindir in Chris@39: $func_relative_path_tlibdir) Chris@39: # found an exact match Chris@39: func_relative_path_tcancelled= Chris@39: break Chris@39: ;; Chris@39: $func_relative_path_tlibdir*) Chris@39: # found a matching prefix Chris@39: func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" Chris@39: func_relative_path_tcancelled=$func_stripname_result Chris@39: if test -z "$func_relative_path_result"; then Chris@39: func_relative_path_result=. Chris@39: fi Chris@39: break Chris@39: ;; Chris@39: *) Chris@39: func_dirname $func_relative_path_tlibdir Chris@39: func_relative_path_tlibdir=${func_dirname_result} Chris@39: if test "x$func_relative_path_tlibdir" = x ; then Chris@39: # Have to descend all the way to the root! Chris@39: func_relative_path_result=../$func_relative_path_result Chris@39: func_relative_path_tcancelled=$func_relative_path_tbindir Chris@39: break Chris@39: fi Chris@39: func_relative_path_result=../$func_relative_path_result Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # Now calculate path; take care to avoid doubling-up slashes. Chris@39: func_stripname '' '/' "$func_relative_path_result" Chris@39: func_relative_path_result=$func_stripname_result Chris@39: func_stripname '/' '/' "$func_relative_path_tcancelled" Chris@39: if test "x$func_stripname_result" != x ; then Chris@39: func_relative_path_result=${func_relative_path_result}/${func_stripname_result} Chris@39: fi Chris@39: Chris@39: # Normalisation. If bindir is libdir, return empty string, Chris@39: # else relative path ending with a slash; either way, target Chris@39: # file name can be directly appended. Chris@39: if test ! -z "$func_relative_path_result"; then Chris@39: func_stripname './' '' "$func_relative_path_result/" Chris@39: func_relative_path_result=$func_stripname_result Chris@39: fi Chris@39: } Chris@39: Chris@39: # The name of this program: Chris@39: func_dirname_and_basename "$progpath" Chris@39: progname=$func_basename_result Chris@39: Chris@39: # Make sure we have an absolute path for reexecution: Chris@39: case $progpath in Chris@39: [\\/]*|[A-Za-z]:\\*) ;; Chris@39: *[\\/]*) Chris@39: progdir=$func_dirname_result Chris@39: progdir=`cd "$progdir" && pwd` Chris@39: progpath="$progdir/$progname" Chris@39: ;; Chris@39: *) Chris@39: save_IFS="$IFS" Chris@39: IFS=: Chris@39: for progdir in $PATH; do Chris@39: IFS="$save_IFS" Chris@39: test -x "$progdir/$progname" && break Chris@39: done Chris@39: IFS="$save_IFS" Chris@39: test -n "$progdir" || progdir=`pwd` Chris@39: progpath="$progdir/$progname" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Sed substitution that helps us do robust quoting. It backslashifies Chris@39: # metacharacters that are still active within double-quoted strings. Chris@39: Xsed="${SED}"' -e 1s/^X//' Chris@39: sed_quote_subst='s/\([`"$\\]\)/\\\1/g' Chris@39: Chris@39: # Same as above, but do not quote variable references. Chris@39: double_quote_subst='s/\(["`\\]\)/\\\1/g' Chris@39: Chris@39: # Sed substitution that turns a string into a regex matching for the Chris@39: # string literally. Chris@39: sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' Chris@39: Chris@39: # Sed substitution that converts a w32 file name or path Chris@39: # which contains forward slashes, into one that contains Chris@39: # (escaped) backslashes. A very naive implementation. Chris@39: lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' Chris@39: Chris@39: # Re-`\' parameter expansions in output of double_quote_subst that were Chris@39: # `\'-ed in input to the same. If an odd number of `\' preceded a '$' Chris@39: # in input to double_quote_subst, that '$' was protected from expansion. Chris@39: # Since each input `\' is now two `\'s, look for any number of runs of Chris@39: # four `\'s followed by two `\'s and then a '$'. `\' that '$'. Chris@39: bs='\\' Chris@39: bs2='\\\\' Chris@39: bs4='\\\\\\\\' Chris@39: dollar='\$' Chris@39: sed_double_backslash="\ Chris@39: s/$bs4/&\\ Chris@39: /g Chris@39: s/^$bs2$dollar/$bs&/ Chris@39: s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g Chris@39: s/\n//g" Chris@39: Chris@39: # Standard options: Chris@39: opt_dry_run=false Chris@39: opt_help=false Chris@39: opt_quiet=false Chris@39: opt_verbose=false Chris@39: opt_warning=: Chris@39: Chris@39: # func_echo arg... Chris@39: # Echo program name prefixed message, along with the current mode Chris@39: # name if it has been set yet. Chris@39: func_echo () Chris@39: { Chris@39: $ECHO "$progname: ${opt_mode+$opt_mode: }$*" Chris@39: } Chris@39: Chris@39: # func_verbose arg... Chris@39: # Echo program name prefixed message in verbose mode only. Chris@39: func_verbose () Chris@39: { Chris@39: $opt_verbose && func_echo ${1+"$@"} Chris@39: Chris@39: # A bug in bash halts the script if the last line of a function Chris@39: # fails when set -e is in force, so we need another command to Chris@39: # work around that: Chris@39: : Chris@39: } Chris@39: Chris@39: # func_echo_all arg... Chris@39: # Invoke $ECHO with all args, space-separated. Chris@39: func_echo_all () Chris@39: { Chris@39: $ECHO "$*" Chris@39: } Chris@39: Chris@39: # func_error arg... Chris@39: # Echo program name prefixed message to standard error. Chris@39: func_error () Chris@39: { Chris@39: $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 Chris@39: } Chris@39: Chris@39: # func_warning arg... Chris@39: # Echo program name prefixed warning message to standard error. Chris@39: func_warning () Chris@39: { Chris@39: $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 Chris@39: Chris@39: # bash bug again: Chris@39: : Chris@39: } Chris@39: Chris@39: # func_fatal_error arg... Chris@39: # Echo program name prefixed message to standard error, and exit. Chris@39: func_fatal_error () Chris@39: { Chris@39: func_error ${1+"$@"} Chris@39: exit $EXIT_FAILURE Chris@39: } Chris@39: Chris@39: # func_fatal_help arg... Chris@39: # Echo program name prefixed message to standard error, followed by Chris@39: # a help hint, and exit. Chris@39: func_fatal_help () Chris@39: { Chris@39: func_error ${1+"$@"} Chris@39: func_fatal_error "$help" Chris@39: } Chris@39: help="Try \`$progname --help' for more information." ## default Chris@39: Chris@39: Chris@39: # func_grep expression filename Chris@39: # Check whether EXPRESSION matches any line of FILENAME, without output. Chris@39: func_grep () Chris@39: { Chris@39: $GREP "$1" "$2" >/dev/null 2>&1 Chris@39: } Chris@39: Chris@39: Chris@39: # func_mkdir_p directory-path Chris@39: # Make sure the entire path to DIRECTORY-PATH is available. Chris@39: func_mkdir_p () Chris@39: { Chris@39: my_directory_path="$1" Chris@39: my_dir_list= Chris@39: Chris@39: if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then Chris@39: Chris@39: # Protect directory names starting with `-' Chris@39: case $my_directory_path in Chris@39: -*) my_directory_path="./$my_directory_path" ;; Chris@39: esac Chris@39: Chris@39: # While some portion of DIR does not yet exist... Chris@39: while test ! -d "$my_directory_path"; do Chris@39: # ...make a list in topmost first order. Use a colon delimited Chris@39: # list incase some portion of path contains whitespace. Chris@39: my_dir_list="$my_directory_path:$my_dir_list" Chris@39: Chris@39: # If the last portion added has no slash in it, the list is done Chris@39: case $my_directory_path in */*) ;; *) break ;; esac Chris@39: Chris@39: # ...otherwise throw away the child directory and loop Chris@39: my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` Chris@39: done Chris@39: my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` Chris@39: Chris@39: save_mkdir_p_IFS="$IFS"; IFS=':' Chris@39: for my_dir in $my_dir_list; do Chris@39: IFS="$save_mkdir_p_IFS" Chris@39: # mkdir can fail with a `File exist' error if two processes Chris@39: # try to create one of the directories concurrently. Don't Chris@39: # stop in that case! Chris@39: $MKDIR "$my_dir" 2>/dev/null || : Chris@39: done Chris@39: IFS="$save_mkdir_p_IFS" Chris@39: Chris@39: # Bail out if we (or some other process) failed to create a directory. Chris@39: test -d "$my_directory_path" || \ Chris@39: func_fatal_error "Failed to create \`$1'" Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # func_mktempdir [string] Chris@39: # Make a temporary directory that won't clash with other running Chris@39: # libtool processes, and avoids race conditions if possible. If Chris@39: # given, STRING is the basename for that directory. Chris@39: func_mktempdir () Chris@39: { Chris@39: my_template="${TMPDIR-/tmp}/${1-$progname}" Chris@39: Chris@39: if test "$opt_dry_run" = ":"; then Chris@39: # Return a directory name, but don't create it in dry-run mode Chris@39: my_tmpdir="${my_template}-$$" Chris@39: else Chris@39: Chris@39: # If mktemp works, use that first and foremost Chris@39: my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` Chris@39: Chris@39: if test ! -d "$my_tmpdir"; then Chris@39: # Failing that, at least try and use $RANDOM to avoid a race Chris@39: my_tmpdir="${my_template}-${RANDOM-0}$$" Chris@39: Chris@39: save_mktempdir_umask=`umask` Chris@39: umask 0077 Chris@39: $MKDIR "$my_tmpdir" Chris@39: umask $save_mktempdir_umask Chris@39: fi Chris@39: Chris@39: # If we're not in dry-run mode, bomb out on failure Chris@39: test -d "$my_tmpdir" || \ Chris@39: func_fatal_error "cannot create temporary directory \`$my_tmpdir'" Chris@39: fi Chris@39: Chris@39: $ECHO "$my_tmpdir" Chris@39: } Chris@39: Chris@39: Chris@39: # func_quote_for_eval arg Chris@39: # Aesthetically quote ARG to be evaled later. Chris@39: # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT Chris@39: # is double-quoted, suitable for a subsequent eval, whereas Chris@39: # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters Chris@39: # which are still active within double quotes backslashified. Chris@39: func_quote_for_eval () Chris@39: { Chris@39: case $1 in Chris@39: *[\\\`\"\$]*) Chris@39: func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; Chris@39: *) Chris@39: func_quote_for_eval_unquoted_result="$1" ;; Chris@39: esac Chris@39: Chris@39: case $func_quote_for_eval_unquoted_result in Chris@39: # Double-quote args containing shell metacharacters to delay Chris@39: # word splitting, command substitution and and variable Chris@39: # expansion for a subsequent eval. Chris@39: # Many Bourne shells cannot handle close brackets correctly Chris@39: # in scan sets, so we specify it separately. Chris@39: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") Chris@39: func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" Chris@39: ;; Chris@39: *) Chris@39: func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" Chris@39: esac Chris@39: } Chris@39: Chris@39: Chris@39: # func_quote_for_expand arg Chris@39: # Aesthetically quote ARG to be evaled later; same as above, Chris@39: # but do not quote variable references. Chris@39: func_quote_for_expand () Chris@39: { Chris@39: case $1 in Chris@39: *[\\\`\"]*) Chris@39: my_arg=`$ECHO "$1" | $SED \ Chris@39: -e "$double_quote_subst" -e "$sed_double_backslash"` ;; Chris@39: *) Chris@39: my_arg="$1" ;; Chris@39: esac Chris@39: Chris@39: case $my_arg in Chris@39: # Double-quote args containing shell metacharacters to delay Chris@39: # word splitting and command substitution for a subsequent eval. Chris@39: # Many Bourne shells cannot handle close brackets correctly Chris@39: # in scan sets, so we specify it separately. Chris@39: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") Chris@39: my_arg="\"$my_arg\"" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: func_quote_for_expand_result="$my_arg" Chris@39: } Chris@39: Chris@39: Chris@39: # func_show_eval cmd [fail_exp] Chris@39: # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is Chris@39: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP Chris@39: # is given, then evaluate it. Chris@39: func_show_eval () Chris@39: { Chris@39: my_cmd="$1" Chris@39: my_fail_exp="${2-:}" Chris@39: Chris@39: ${opt_silent-false} || { Chris@39: func_quote_for_expand "$my_cmd" Chris@39: eval "func_echo $func_quote_for_expand_result" Chris@39: } Chris@39: Chris@39: if ${opt_dry_run-false}; then :; else Chris@39: eval "$my_cmd" Chris@39: my_status=$? Chris@39: if test "$my_status" -eq 0; then :; else Chris@39: eval "(exit $my_status); $my_fail_exp" Chris@39: fi Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # func_show_eval_locale cmd [fail_exp] Chris@39: # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is Chris@39: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP Chris@39: # is given, then evaluate it. Use the saved locale for evaluation. Chris@39: func_show_eval_locale () Chris@39: { Chris@39: my_cmd="$1" Chris@39: my_fail_exp="${2-:}" Chris@39: Chris@39: ${opt_silent-false} || { Chris@39: func_quote_for_expand "$my_cmd" Chris@39: eval "func_echo $func_quote_for_expand_result" Chris@39: } Chris@39: Chris@39: if ${opt_dry_run-false}; then :; else Chris@39: eval "$lt_user_locale Chris@39: $my_cmd" Chris@39: my_status=$? Chris@39: eval "$lt_safe_locale" Chris@39: if test "$my_status" -eq 0; then :; else Chris@39: eval "(exit $my_status); $my_fail_exp" Chris@39: fi Chris@39: fi Chris@39: } Chris@39: Chris@39: # func_tr_sh Chris@39: # Turn $1 into a string suitable for a shell variable name. Chris@39: # Result is stored in $func_tr_sh_result. All characters Chris@39: # not in the set a-zA-Z0-9_ are replaced with '_'. Further, Chris@39: # if $1 begins with a digit, a '_' is prepended as well. Chris@39: func_tr_sh () Chris@39: { Chris@39: case $1 in Chris@39: [0-9]* | *[!a-zA-Z0-9_]*) Chris@39: func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` Chris@39: ;; Chris@39: * ) Chris@39: func_tr_sh_result=$1 Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: Chris@39: # func_version Chris@39: # Echo version message to standard output and exit. Chris@39: func_version () Chris@39: { Chris@39: $opt_debug Chris@39: Chris@39: $SED -n '/(C)/!b go Chris@39: :more Chris@39: /\./!{ Chris@39: N Chris@39: s/\n# / / Chris@39: b more Chris@39: } Chris@39: :go Chris@39: /^# '$PROGRAM' (GNU /,/# warranty; / { Chris@39: s/^# // Chris@39: s/^# *$// Chris@39: s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ Chris@39: p Chris@39: }' < "$progpath" Chris@39: exit $? Chris@39: } Chris@39: Chris@39: # func_usage Chris@39: # Echo short help message to standard output and exit. Chris@39: func_usage () Chris@39: { Chris@39: $opt_debug Chris@39: Chris@39: $SED -n '/^# Usage:/,/^# *.*--help/ { Chris@39: s/^# // Chris@39: s/^# *$// Chris@39: s/\$progname/'$progname'/ Chris@39: p Chris@39: }' < "$progpath" Chris@39: echo Chris@39: $ECHO "run \`$progname --help | more' for full usage" Chris@39: exit $? Chris@39: } Chris@39: Chris@39: # func_help [NOEXIT] Chris@39: # Echo long help message to standard output and exit, Chris@39: # unless 'noexit' is passed as argument. Chris@39: func_help () Chris@39: { Chris@39: $opt_debug Chris@39: Chris@39: $SED -n '/^# Usage:/,/# Report bugs to/ { Chris@39: :print Chris@39: s/^# // Chris@39: s/^# *$// Chris@39: s*\$progname*'$progname'* Chris@39: s*\$host*'"$host"'* Chris@39: s*\$SHELL*'"$SHELL"'* Chris@39: s*\$LTCC*'"$LTCC"'* Chris@39: s*\$LTCFLAGS*'"$LTCFLAGS"'* Chris@39: s*\$LD*'"$LD"'* Chris@39: s/\$with_gnu_ld/'"$with_gnu_ld"'/ Chris@39: s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ Chris@39: s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ Chris@39: p Chris@39: d Chris@39: } Chris@39: /^# .* home page:/b print Chris@39: /^# General help using/b print Chris@39: ' < "$progpath" Chris@39: ret=$? Chris@39: if test -z "$1"; then Chris@39: exit $ret Chris@39: fi Chris@39: } Chris@39: Chris@39: # func_missing_arg argname Chris@39: # Echo program name prefixed message to standard error and set global Chris@39: # exit_cmd. Chris@39: func_missing_arg () Chris@39: { Chris@39: $opt_debug Chris@39: Chris@39: func_error "missing argument for $1." Chris@39: exit_cmd=exit Chris@39: } Chris@39: Chris@39: Chris@39: # func_split_short_opt shortopt Chris@39: # Set func_split_short_opt_name and func_split_short_opt_arg shell Chris@39: # variables after splitting SHORTOPT after the 2nd character. Chris@39: func_split_short_opt () Chris@39: { Chris@39: my_sed_short_opt='1s/^\(..\).*$/\1/;q' Chris@39: my_sed_short_rest='1s/^..\(.*\)$/\1/;q' Chris@39: Chris@39: func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` Chris@39: func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` Chris@39: } # func_split_short_opt may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_split_long_opt longopt Chris@39: # Set func_split_long_opt_name and func_split_long_opt_arg shell Chris@39: # variables after splitting LONGOPT at the `=' sign. Chris@39: func_split_long_opt () Chris@39: { Chris@39: my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' Chris@39: my_sed_long_arg='1s/^--[^=]*=//' Chris@39: Chris@39: func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` Chris@39: func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` Chris@39: } # func_split_long_opt may be replaced by extended shell implementation Chris@39: Chris@39: exit_cmd=: Chris@39: Chris@39: Chris@39: Chris@39: Chris@39: Chris@39: magic="%%%MAGIC variable%%%" Chris@39: magic_exe="%%%MAGIC EXE variable%%%" Chris@39: Chris@39: # Global variables. Chris@39: nonopt= Chris@39: preserve_args= Chris@39: lo2o="s/\\.lo\$/.${objext}/" Chris@39: o2lo="s/\\.${objext}\$/.lo/" Chris@39: extracted_archives= Chris@39: extracted_serial=0 Chris@39: Chris@39: # If this variable is set in any of the actions, the command in it Chris@39: # will be execed at the end. This prevents here-documents from being Chris@39: # left over by shells. Chris@39: exec_cmd= Chris@39: Chris@39: # func_append var value Chris@39: # Append VALUE to the end of shell variable VAR. Chris@39: func_append () Chris@39: { Chris@39: eval "${1}=\$${1}\${2}" Chris@39: } # func_append may be replaced by extended shell implementation Chris@39: Chris@39: # func_append_quoted var value Chris@39: # Quote VALUE and append to the end of shell variable VAR, separated Chris@39: # by a space. Chris@39: func_append_quoted () Chris@39: { Chris@39: func_quote_for_eval "${2}" Chris@39: eval "${1}=\$${1}\\ \$func_quote_for_eval_result" Chris@39: } # func_append_quoted may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_arith arithmetic-term... Chris@39: func_arith () Chris@39: { Chris@39: func_arith_result=`expr "${@}"` Chris@39: } # func_arith may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_len string Chris@39: # STRING may not start with a hyphen. Chris@39: func_len () Chris@39: { Chris@39: func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` Chris@39: } # func_len may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_lo2o object Chris@39: func_lo2o () Chris@39: { Chris@39: func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` Chris@39: } # func_lo2o may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_xform libobj-or-source Chris@39: func_xform () Chris@39: { Chris@39: func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` Chris@39: } # func_xform may be replaced by extended shell implementation Chris@39: Chris@39: Chris@39: # func_fatal_configuration arg... Chris@39: # Echo program name prefixed message to standard error, followed by Chris@39: # a configuration failure hint, and exit. Chris@39: func_fatal_configuration () Chris@39: { Chris@39: func_error ${1+"$@"} Chris@39: func_error "See the $PACKAGE documentation for more information." Chris@39: func_fatal_error "Fatal configuration error." Chris@39: } Chris@39: Chris@39: Chris@39: # func_config Chris@39: # Display the configuration for all the tags in this script. Chris@39: func_config () Chris@39: { Chris@39: re_begincf='^# ### BEGIN LIBTOOL' Chris@39: re_endcf='^# ### END LIBTOOL' Chris@39: Chris@39: # Default configuration. Chris@39: $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" Chris@39: Chris@39: # Now print the configurations for the tags. Chris@39: for tagname in $taglist; do Chris@39: $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" Chris@39: done Chris@39: Chris@39: exit $? Chris@39: } Chris@39: Chris@39: # func_features Chris@39: # Display the features supported by this script. Chris@39: func_features () Chris@39: { Chris@39: echo "host: $host" Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: echo "enable shared libraries" Chris@39: else Chris@39: echo "disable shared libraries" Chris@39: fi Chris@39: if test "$build_old_libs" = yes; then Chris@39: echo "enable static libraries" Chris@39: else Chris@39: echo "disable static libraries" Chris@39: fi Chris@39: Chris@39: exit $? Chris@39: } Chris@39: Chris@39: # func_enable_tag tagname Chris@39: # Verify that TAGNAME is valid, and either flag an error and exit, or Chris@39: # enable the TAGNAME tag. We also add TAGNAME to the global $taglist Chris@39: # variable here. Chris@39: func_enable_tag () Chris@39: { Chris@39: # Global variable: Chris@39: tagname="$1" Chris@39: Chris@39: re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" Chris@39: re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" Chris@39: sed_extractcf="/$re_begincf/,/$re_endcf/p" Chris@39: Chris@39: # Validate tagname. Chris@39: case $tagname in Chris@39: *[!-_A-Za-z0-9,/]*) Chris@39: func_fatal_error "invalid tag name: $tagname" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Don't test for the "default" C tag, as we know it's Chris@39: # there but not specially marked. Chris@39: case $tagname in Chris@39: CC) ;; Chris@39: *) Chris@39: if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then Chris@39: taglist="$taglist $tagname" Chris@39: Chris@39: # Evaluate the configuration. Be careful to quote the path Chris@39: # and the sed script, to avoid splitting on whitespace, but Chris@39: # also don't use non-portable quotes within backquotes within Chris@39: # quotes we have to do it in 2 steps: Chris@39: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` Chris@39: eval "$extractedcf" Chris@39: else Chris@39: func_error "ignoring unknown tag $tagname" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: # func_check_version_match Chris@39: # Ensure that we are using m4 macros, and libtool script from the same Chris@39: # release of libtool. Chris@39: func_check_version_match () Chris@39: { Chris@39: if test "$package_revision" != "$macro_revision"; then Chris@39: if test "$VERSION" != "$macro_version"; then Chris@39: if test -z "$macro_version"; then Chris@39: cat >&2 <<_LT_EOF Chris@39: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the Chris@39: $progname: definition of this LT_INIT comes from an older release. Chris@39: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION Chris@39: $progname: and run autoconf again. Chris@39: _LT_EOF Chris@39: else Chris@39: cat >&2 <<_LT_EOF Chris@39: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the Chris@39: $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. Chris@39: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION Chris@39: $progname: and run autoconf again. Chris@39: _LT_EOF Chris@39: fi Chris@39: else Chris@39: cat >&2 <<_LT_EOF Chris@39: $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, Chris@39: $progname: but the definition of this LT_INIT comes from revision $macro_revision. Chris@39: $progname: You should recreate aclocal.m4 with macros from revision $package_revision Chris@39: $progname: of $PACKAGE $VERSION and run autoconf again. Chris@39: _LT_EOF Chris@39: fi Chris@39: Chris@39: exit $EXIT_MISMATCH Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # Shorthand for --mode=foo, only valid as the first argument Chris@39: case $1 in Chris@39: clean|clea|cle|cl) Chris@39: shift; set dummy --mode clean ${1+"$@"}; shift Chris@39: ;; Chris@39: compile|compil|compi|comp|com|co|c) Chris@39: shift; set dummy --mode compile ${1+"$@"}; shift Chris@39: ;; Chris@39: execute|execut|execu|exec|exe|ex|e) Chris@39: shift; set dummy --mode execute ${1+"$@"}; shift Chris@39: ;; Chris@39: finish|finis|fini|fin|fi|f) Chris@39: shift; set dummy --mode finish ${1+"$@"}; shift Chris@39: ;; Chris@39: install|instal|insta|inst|ins|in|i) Chris@39: shift; set dummy --mode install ${1+"$@"}; shift Chris@39: ;; Chris@39: link|lin|li|l) Chris@39: shift; set dummy --mode link ${1+"$@"}; shift Chris@39: ;; Chris@39: uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) Chris@39: shift; set dummy --mode uninstall ${1+"$@"}; shift Chris@39: ;; Chris@39: esac Chris@39: Chris@39: Chris@39: Chris@39: # Option defaults: Chris@39: opt_debug=: Chris@39: opt_dry_run=false Chris@39: opt_config=false Chris@39: opt_preserve_dup_deps=false Chris@39: opt_features=false Chris@39: opt_finish=false Chris@39: opt_help=false Chris@39: opt_help_all=false Chris@39: opt_silent=: Chris@39: opt_verbose=: Chris@39: opt_silent=false Chris@39: opt_verbose=false Chris@39: Chris@39: Chris@39: # Parse options once, thoroughly. This comes as soon as possible in the Chris@39: # script to make things like `--version' happen as quickly as we can. Chris@39: { Chris@39: # this just eases exit handling Chris@39: while test $# -gt 0; do Chris@39: opt="$1" Chris@39: shift Chris@39: case $opt in Chris@39: --debug|-x) opt_debug='set -x' Chris@39: func_echo "enabling shell trace mode" Chris@39: $opt_debug Chris@39: ;; Chris@39: --dry-run|--dryrun|-n) Chris@39: opt_dry_run=: Chris@39: ;; Chris@39: --config) Chris@39: opt_config=: Chris@39: func_config Chris@39: ;; Chris@39: --dlopen|-dlopen) Chris@39: optarg="$1" Chris@39: opt_dlopen="${opt_dlopen+$opt_dlopen Chris@39: }$optarg" Chris@39: shift Chris@39: ;; Chris@39: --preserve-dup-deps) Chris@39: opt_preserve_dup_deps=: Chris@39: ;; Chris@39: --features) Chris@39: opt_features=: Chris@39: func_features Chris@39: ;; Chris@39: --finish) Chris@39: opt_finish=: Chris@39: set dummy --mode finish ${1+"$@"}; shift Chris@39: ;; Chris@39: --help) Chris@39: opt_help=: Chris@39: ;; Chris@39: --help-all) Chris@39: opt_help_all=: Chris@39: opt_help=': help-all' Chris@39: ;; Chris@39: --mode) Chris@39: test $# = 0 && func_missing_arg $opt && break Chris@39: optarg="$1" Chris@39: opt_mode="$optarg" Chris@39: case $optarg in Chris@39: # Valid mode arguments: Chris@39: clean|compile|execute|finish|install|link|relink|uninstall) ;; Chris@39: Chris@39: # Catch anything else as an error Chris@39: *) func_error "invalid argument for $opt" Chris@39: exit_cmd=exit Chris@39: break Chris@39: ;; Chris@39: esac Chris@39: shift Chris@39: ;; Chris@39: --no-silent|--no-quiet) Chris@39: opt_silent=false Chris@39: func_append preserve_args " $opt" Chris@39: ;; Chris@39: --no-verbose) Chris@39: opt_verbose=false Chris@39: func_append preserve_args " $opt" Chris@39: ;; Chris@39: --silent|--quiet) Chris@39: opt_silent=: Chris@39: func_append preserve_args " $opt" Chris@39: opt_verbose=false Chris@39: ;; Chris@39: --verbose|-v) Chris@39: opt_verbose=: Chris@39: func_append preserve_args " $opt" Chris@39: opt_silent=false Chris@39: ;; Chris@39: --tag) Chris@39: test $# = 0 && func_missing_arg $opt && break Chris@39: optarg="$1" Chris@39: opt_tag="$optarg" Chris@39: func_append preserve_args " $opt $optarg" Chris@39: func_enable_tag "$optarg" Chris@39: shift Chris@39: ;; Chris@39: Chris@39: -\?|-h) func_usage ;; Chris@39: --help) func_help ;; Chris@39: --version) func_version ;; Chris@39: Chris@39: # Separate optargs to long options: Chris@39: --*=*) Chris@39: func_split_long_opt "$opt" Chris@39: set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} Chris@39: shift Chris@39: ;; Chris@39: Chris@39: # Separate non-argument short options: Chris@39: -\?*|-h*|-n*|-v*) Chris@39: func_split_short_opt "$opt" Chris@39: set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} Chris@39: shift Chris@39: ;; Chris@39: Chris@39: --) break ;; Chris@39: -*) func_fatal_help "unrecognized option \`$opt'" ;; Chris@39: *) set dummy "$opt" ${1+"$@"}; shift; break ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # Validate options: Chris@39: Chris@39: # save first non-option argument Chris@39: if test "$#" -gt 0; then Chris@39: nonopt="$opt" Chris@39: shift Chris@39: fi Chris@39: Chris@39: # preserve --debug Chris@39: test "$opt_debug" = : || func_append preserve_args " --debug" Chris@39: Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *pw32* | *cegcc*) Chris@39: # don't eliminate duplications in $postdeps and $predeps Chris@39: opt_duplicate_compiler_generated_deps=: Chris@39: ;; Chris@39: *) Chris@39: opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps Chris@39: ;; Chris@39: esac Chris@39: Chris@39: $opt_help || { Chris@39: # Sanity checks first: Chris@39: func_check_version_match Chris@39: Chris@39: if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then Chris@39: func_fatal_configuration "not configured to build any kind of library" Chris@39: fi Chris@39: Chris@39: # Darwin sucks Chris@39: eval std_shrext=\"$shrext_cmds\" Chris@39: Chris@39: # Only execute mode is allowed to have -dlopen flags. Chris@39: if test -n "$opt_dlopen" && test "$opt_mode" != execute; then Chris@39: func_error "unrecognized option \`-dlopen'" Chris@39: $ECHO "$help" 1>&2 Chris@39: exit $EXIT_FAILURE Chris@39: fi Chris@39: Chris@39: # Change the help message to a mode-specific one. Chris@39: generic_help="$help" Chris@39: help="Try \`$progname --help --mode=$opt_mode' for more information." Chris@39: } Chris@39: Chris@39: Chris@39: # Bail if the options were screwed Chris@39: $exit_cmd $EXIT_FAILURE Chris@39: } Chris@39: Chris@39: Chris@39: Chris@39: Chris@39: ## ----------- ## Chris@39: ## Main. ## Chris@39: ## ----------- ## Chris@39: Chris@39: # func_lalib_p file Chris@39: # True iff FILE is a libtool `.la' library or `.lo' object file. Chris@39: # This function is only a basic sanity check; it will hardly flush out Chris@39: # determined imposters. Chris@39: func_lalib_p () Chris@39: { Chris@39: test -f "$1" && Chris@39: $SED -e 4q "$1" 2>/dev/null \ Chris@39: | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 Chris@39: } Chris@39: Chris@39: # func_lalib_unsafe_p file Chris@39: # True iff FILE is a libtool `.la' library or `.lo' object file. Chris@39: # This function implements the same check as func_lalib_p without Chris@39: # resorting to external programs. To this end, it redirects stdin and Chris@39: # closes it afterwards, without saving the original file descriptor. Chris@39: # As a safety measure, use it only where a negative result would be Chris@39: # fatal anyway. Works if `file' does not exist. Chris@39: func_lalib_unsafe_p () Chris@39: { Chris@39: lalib_p=no Chris@39: if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then Chris@39: for lalib_p_l in 1 2 3 4 Chris@39: do Chris@39: read lalib_p_line Chris@39: case "$lalib_p_line" in Chris@39: \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; Chris@39: esac Chris@39: done Chris@39: exec 0<&5 5<&- Chris@39: fi Chris@39: test "$lalib_p" = yes Chris@39: } Chris@39: Chris@39: # func_ltwrapper_script_p file Chris@39: # True iff FILE is a libtool wrapper script Chris@39: # This function is only a basic sanity check; it will hardly flush out Chris@39: # determined imposters. Chris@39: func_ltwrapper_script_p () Chris@39: { Chris@39: func_lalib_p "$1" Chris@39: } Chris@39: Chris@39: # func_ltwrapper_executable_p file Chris@39: # True iff FILE is a libtool wrapper executable Chris@39: # This function is only a basic sanity check; it will hardly flush out Chris@39: # determined imposters. Chris@39: func_ltwrapper_executable_p () Chris@39: { Chris@39: func_ltwrapper_exec_suffix= Chris@39: case $1 in Chris@39: *.exe) ;; Chris@39: *) func_ltwrapper_exec_suffix=.exe ;; Chris@39: esac Chris@39: $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 Chris@39: } Chris@39: Chris@39: # func_ltwrapper_scriptname file Chris@39: # Assumes file is an ltwrapper_executable Chris@39: # uses $file to determine the appropriate filename for a Chris@39: # temporary ltwrapper_script. Chris@39: func_ltwrapper_scriptname () Chris@39: { Chris@39: func_dirname_and_basename "$1" "" "." Chris@39: func_stripname '' '.exe' "$func_basename_result" Chris@39: func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" Chris@39: } Chris@39: Chris@39: # func_ltwrapper_p file Chris@39: # True iff FILE is a libtool wrapper script or wrapper executable Chris@39: # This function is only a basic sanity check; it will hardly flush out Chris@39: # determined imposters. Chris@39: func_ltwrapper_p () Chris@39: { Chris@39: func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" Chris@39: } Chris@39: Chris@39: Chris@39: # func_execute_cmds commands fail_cmd Chris@39: # Execute tilde-delimited COMMANDS. Chris@39: # If FAIL_CMD is given, eval that upon failure. Chris@39: # FAIL_CMD may read-access the current command in variable CMD! Chris@39: func_execute_cmds () Chris@39: { Chris@39: $opt_debug Chris@39: save_ifs=$IFS; IFS='~' Chris@39: for cmd in $1; do Chris@39: IFS=$save_ifs Chris@39: eval cmd=\"$cmd\" Chris@39: func_show_eval "$cmd" "${2-:}" Chris@39: done Chris@39: IFS=$save_ifs Chris@39: } Chris@39: Chris@39: Chris@39: # func_source file Chris@39: # Source FILE, adding directory component if necessary. Chris@39: # Note that it is not necessary on cygwin/mingw to append a dot to Chris@39: # FILE even if both FILE and FILE.exe exist: automatic-append-.exe Chris@39: # behavior happens only for exec(3), not for open(2)! Also, sourcing Chris@39: # `FILE.' does not work on cygwin managed mounts. Chris@39: func_source () Chris@39: { Chris@39: $opt_debug Chris@39: case $1 in Chris@39: */* | *\\*) . "$1" ;; Chris@39: *) . "./$1" ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: Chris@39: # func_resolve_sysroot PATH Chris@39: # Replace a leading = in PATH with a sysroot. Store the result into Chris@39: # func_resolve_sysroot_result Chris@39: func_resolve_sysroot () Chris@39: { Chris@39: func_resolve_sysroot_result=$1 Chris@39: case $func_resolve_sysroot_result in Chris@39: =*) Chris@39: func_stripname '=' '' "$func_resolve_sysroot_result" Chris@39: func_resolve_sysroot_result=$lt_sysroot$func_stripname_result Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: # func_replace_sysroot PATH Chris@39: # If PATH begins with the sysroot, replace it with = and Chris@39: # store the result into func_replace_sysroot_result. Chris@39: func_replace_sysroot () Chris@39: { Chris@39: case "$lt_sysroot:$1" in Chris@39: ?*:"$lt_sysroot"*) Chris@39: func_stripname "$lt_sysroot" '' "$1" Chris@39: func_replace_sysroot_result="=$func_stripname_result" Chris@39: ;; Chris@39: *) Chris@39: # Including no sysroot. Chris@39: func_replace_sysroot_result=$1 Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: # func_infer_tag arg Chris@39: # Infer tagged configuration to use if any are available and Chris@39: # if one wasn't chosen via the "--tag" command line option. Chris@39: # Only attempt this if the compiler in the base compile Chris@39: # command doesn't match the default compiler. Chris@39: # arg is usually of the form 'gcc ...' Chris@39: func_infer_tag () Chris@39: { Chris@39: $opt_debug Chris@39: if test -n "$available_tags" && test -z "$tagname"; then Chris@39: CC_quoted= Chris@39: for arg in $CC; do Chris@39: func_append_quoted CC_quoted "$arg" Chris@39: done Chris@39: CC_expanded=`func_echo_all $CC` Chris@39: CC_quoted_expanded=`func_echo_all $CC_quoted` Chris@39: case $@ in Chris@39: # Blanks in the command may have been stripped by the calling shell, Chris@39: # but not from the CC environment variable when configure was run. Chris@39: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ Chris@39: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; Chris@39: # Blanks at the start of $base_compile will cause this to fail Chris@39: # if we don't check for them as well. Chris@39: *) Chris@39: for z in $available_tags; do Chris@39: if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then Chris@39: # Evaluate the configuration. Chris@39: eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" Chris@39: CC_quoted= Chris@39: for arg in $CC; do Chris@39: # Double-quote args containing other shell metacharacters. Chris@39: func_append_quoted CC_quoted "$arg" Chris@39: done Chris@39: CC_expanded=`func_echo_all $CC` Chris@39: CC_quoted_expanded=`func_echo_all $CC_quoted` Chris@39: case "$@ " in Chris@39: " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ Chris@39: " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) Chris@39: # The compiler in the base compile command matches Chris@39: # the one in the tagged configuration. Chris@39: # Assume this is the tagged configuration we want. Chris@39: tagname=$z Chris@39: break Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: done Chris@39: # If $tagname still isn't set, then no tagged configuration Chris@39: # was found and let the user know that the "--tag" command Chris@39: # line option must be used. Chris@39: if test -z "$tagname"; then Chris@39: func_echo "unable to infer tagged configuration" Chris@39: func_fatal_error "specify a tag with \`--tag'" Chris@39: # else Chris@39: # func_verbose "using $tagname tagged configuration" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: Chris@39: # func_write_libtool_object output_name pic_name nonpic_name Chris@39: # Create a libtool object file (analogous to a ".la" file), Chris@39: # but don't create it if we're doing a dry run. Chris@39: func_write_libtool_object () Chris@39: { Chris@39: write_libobj=${1} Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: write_lobj=\'${2}\' Chris@39: else Chris@39: write_lobj=none Chris@39: fi Chris@39: Chris@39: if test "$build_old_libs" = yes; then Chris@39: write_oldobj=\'${3}\' Chris@39: else Chris@39: write_oldobj=none Chris@39: fi Chris@39: Chris@39: $opt_dry_run || { Chris@39: cat >${write_libobj}T </dev/null` Chris@39: if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then Chris@39: func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | Chris@39: $SED -e "$lt_sed_naive_backslashify"` Chris@39: else Chris@39: func_convert_core_file_wine_to_w32_result= Chris@39: fi Chris@39: fi Chris@39: } Chris@39: # end: func_convert_core_file_wine_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_core_path_wine_to_w32 ARG Chris@39: # Helper function used by path conversion functions when $build is *nix, and Chris@39: # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly Chris@39: # configured wine environment available, with the winepath program in $build's Chris@39: # $PATH. Assumes ARG has no leading or trailing path separator characters. Chris@39: # Chris@39: # ARG is path to be converted from $build format to win32. Chris@39: # Result is available in $func_convert_core_path_wine_to_w32_result. Chris@39: # Unconvertible file (directory) names in ARG are skipped; if no directory names Chris@39: # are convertible, then the result may be empty. Chris@39: func_convert_core_path_wine_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: # unfortunately, winepath doesn't convert paths, only file names Chris@39: func_convert_core_path_wine_to_w32_result="" Chris@39: if test -n "$1"; then Chris@39: oldIFS=$IFS Chris@39: IFS=: Chris@39: for func_convert_core_path_wine_to_w32_f in $1; do Chris@39: IFS=$oldIFS Chris@39: func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" Chris@39: if test -n "$func_convert_core_file_wine_to_w32_result" ; then Chris@39: if test -z "$func_convert_core_path_wine_to_w32_result"; then Chris@39: func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" Chris@39: else Chris@39: func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" Chris@39: fi Chris@39: fi Chris@39: done Chris@39: IFS=$oldIFS Chris@39: fi Chris@39: } Chris@39: # end: func_convert_core_path_wine_to_w32 Chris@39: Chris@39: Chris@39: # func_cygpath ARGS... Chris@39: # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when Chris@39: # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) Chris@39: # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or Chris@39: # (2), returns the Cygwin file name or path in func_cygpath_result (input Chris@39: # file name or path is assumed to be in w32 format, as previously converted Chris@39: # from $build's *nix or MSYS format). In case (3), returns the w32 file name Chris@39: # or path in func_cygpath_result (input file name or path is assumed to be in Chris@39: # Cygwin format). Returns an empty string on error. Chris@39: # Chris@39: # ARGS are passed to cygpath, with the last one being the file name or path to Chris@39: # be converted. Chris@39: # Chris@39: # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH Chris@39: # environment variable; do not put it in $PATH. Chris@39: func_cygpath () Chris@39: { Chris@39: $opt_debug Chris@39: if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then Chris@39: func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` Chris@39: if test "$?" -ne 0; then Chris@39: # on failure, ensure result is empty Chris@39: func_cygpath_result= Chris@39: fi Chris@39: else Chris@39: func_cygpath_result= Chris@39: func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" Chris@39: fi Chris@39: } Chris@39: #end: func_cygpath Chris@39: Chris@39: Chris@39: # func_convert_core_msys_to_w32 ARG Chris@39: # Convert file name or path ARG from MSYS format to w32 format. Return Chris@39: # result in func_convert_core_msys_to_w32_result. Chris@39: func_convert_core_msys_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: # awkward: cmd appends spaces to result Chris@39: func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | Chris@39: $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` Chris@39: } Chris@39: #end: func_convert_core_msys_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_file_check ARG1 ARG2 Chris@39: # Verify that ARG1 (a file name in $build format) was converted to $host Chris@39: # format in ARG2. Otherwise, emit an error message, but continue (resetting Chris@39: # func_to_host_file_result to ARG1). Chris@39: func_convert_file_check () Chris@39: { Chris@39: $opt_debug Chris@39: if test -z "$2" && test -n "$1" ; then Chris@39: func_error "Could not determine host file name corresponding to" Chris@39: func_error " \`$1'" Chris@39: func_error "Continuing, but uninstalled executables may not work." Chris@39: # Fallback: Chris@39: func_to_host_file_result="$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_file_check Chris@39: Chris@39: Chris@39: # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH Chris@39: # Verify that FROM_PATH (a path in $build format) was converted to $host Chris@39: # format in TO_PATH. Otherwise, emit an error message, but continue, resetting Chris@39: # func_to_host_file_result to a simplistic fallback value (see below). Chris@39: func_convert_path_check () Chris@39: { Chris@39: $opt_debug Chris@39: if test -z "$4" && test -n "$3"; then Chris@39: func_error "Could not determine the host path corresponding to" Chris@39: func_error " \`$3'" Chris@39: func_error "Continuing, but uninstalled executables may not work." Chris@39: # Fallback. This is a deliberately simplistic "conversion" and Chris@39: # should not be "improved". See libtool.info. Chris@39: if test "x$1" != "x$2"; then Chris@39: lt_replace_pathsep_chars="s|$1|$2|g" Chris@39: func_to_host_path_result=`echo "$3" | Chris@39: $SED -e "$lt_replace_pathsep_chars"` Chris@39: else Chris@39: func_to_host_path_result="$3" Chris@39: fi Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_check Chris@39: Chris@39: Chris@39: # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG Chris@39: # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT Chris@39: # and appending REPL if ORIG matches BACKPAT. Chris@39: func_convert_path_front_back_pathsep () Chris@39: { Chris@39: $opt_debug Chris@39: case $4 in Chris@39: $1 ) func_to_host_path_result="$3$func_to_host_path_result" Chris@39: ;; Chris@39: esac Chris@39: case $4 in Chris@39: $2 ) func_append func_to_host_path_result "$3" Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: # end func_convert_path_front_back_pathsep Chris@39: Chris@39: Chris@39: ################################################## Chris@39: # $build to $host FILE NAME CONVERSION FUNCTIONS # Chris@39: ################################################## Chris@39: # invoked via `$to_host_file_cmd ARG' Chris@39: # Chris@39: # In each case, ARG is the path to be converted from $build to $host format. Chris@39: # Result will be available in $func_to_host_file_result. Chris@39: Chris@39: Chris@39: # func_to_host_file ARG Chris@39: # Converts the file name ARG from $build format to $host format. Return result Chris@39: # in func_to_host_file_result. Chris@39: func_to_host_file () Chris@39: { Chris@39: $opt_debug Chris@39: $to_host_file_cmd "$1" Chris@39: } Chris@39: # end func_to_host_file Chris@39: Chris@39: Chris@39: # func_to_tool_file ARG LAZY Chris@39: # converts the file name ARG from $build format to toolchain format. Return Chris@39: # result in func_to_tool_file_result. If the conversion in use is listed Chris@39: # in (the comma separated) LAZY, no conversion takes place. Chris@39: func_to_tool_file () Chris@39: { Chris@39: $opt_debug Chris@39: case ,$2, in Chris@39: *,"$to_tool_file_cmd",*) Chris@39: func_to_tool_file_result=$1 Chris@39: ;; Chris@39: *) Chris@39: $to_tool_file_cmd "$1" Chris@39: func_to_tool_file_result=$func_to_host_file_result Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: # end func_to_tool_file Chris@39: Chris@39: Chris@39: # func_convert_file_noop ARG Chris@39: # Copy ARG to func_to_host_file_result. Chris@39: func_convert_file_noop () Chris@39: { Chris@39: func_to_host_file_result="$1" Chris@39: } Chris@39: # end func_convert_file_noop Chris@39: Chris@39: Chris@39: # func_convert_file_msys_to_w32 ARG Chris@39: # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic Chris@39: # conversion to w32 is not available inside the cwrapper. Returns result in Chris@39: # func_to_host_file_result. Chris@39: func_convert_file_msys_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_file_result="$1" Chris@39: if test -n "$1"; then Chris@39: func_convert_core_msys_to_w32 "$1" Chris@39: func_to_host_file_result="$func_convert_core_msys_to_w32_result" Chris@39: fi Chris@39: func_convert_file_check "$1" "$func_to_host_file_result" Chris@39: } Chris@39: # end func_convert_file_msys_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_file_cygwin_to_w32 ARG Chris@39: # Convert file name ARG from Cygwin to w32 format. Returns result in Chris@39: # func_to_host_file_result. Chris@39: func_convert_file_cygwin_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_file_result="$1" Chris@39: if test -n "$1"; then Chris@39: # because $build is cygwin, we call "the" cygpath in $PATH; no need to use Chris@39: # LT_CYGPATH in this case. Chris@39: func_to_host_file_result=`cygpath -m "$1"` Chris@39: fi Chris@39: func_convert_file_check "$1" "$func_to_host_file_result" Chris@39: } Chris@39: # end func_convert_file_cygwin_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_file_nix_to_w32 ARG Chris@39: # Convert file name ARG from *nix to w32 format. Requires a wine environment Chris@39: # and a working winepath. Returns result in func_to_host_file_result. Chris@39: func_convert_file_nix_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_file_result="$1" Chris@39: if test -n "$1"; then Chris@39: func_convert_core_file_wine_to_w32 "$1" Chris@39: func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" Chris@39: fi Chris@39: func_convert_file_check "$1" "$func_to_host_file_result" Chris@39: } Chris@39: # end func_convert_file_nix_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_file_msys_to_cygwin ARG Chris@39: # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. Chris@39: # Returns result in func_to_host_file_result. Chris@39: func_convert_file_msys_to_cygwin () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_file_result="$1" Chris@39: if test -n "$1"; then Chris@39: func_convert_core_msys_to_w32 "$1" Chris@39: func_cygpath -u "$func_convert_core_msys_to_w32_result" Chris@39: func_to_host_file_result="$func_cygpath_result" Chris@39: fi Chris@39: func_convert_file_check "$1" "$func_to_host_file_result" Chris@39: } Chris@39: # end func_convert_file_msys_to_cygwin Chris@39: Chris@39: Chris@39: # func_convert_file_nix_to_cygwin ARG Chris@39: # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed Chris@39: # in a wine environment, working winepath, and LT_CYGPATH set. Returns result Chris@39: # in func_to_host_file_result. Chris@39: func_convert_file_nix_to_cygwin () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_file_result="$1" Chris@39: if test -n "$1"; then Chris@39: # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. Chris@39: func_convert_core_file_wine_to_w32 "$1" Chris@39: func_cygpath -u "$func_convert_core_file_wine_to_w32_result" Chris@39: func_to_host_file_result="$func_cygpath_result" Chris@39: fi Chris@39: func_convert_file_check "$1" "$func_to_host_file_result" Chris@39: } Chris@39: # end func_convert_file_nix_to_cygwin Chris@39: Chris@39: Chris@39: ############################################# Chris@39: # $build to $host PATH CONVERSION FUNCTIONS # Chris@39: ############################################# Chris@39: # invoked via `$to_host_path_cmd ARG' Chris@39: # Chris@39: # In each case, ARG is the path to be converted from $build to $host format. Chris@39: # The result will be available in $func_to_host_path_result. Chris@39: # Chris@39: # Path separators are also converted from $build format to $host format. If Chris@39: # ARG begins or ends with a path separator character, it is preserved (but Chris@39: # converted to $host format) on output. Chris@39: # Chris@39: # All path conversion functions are named using the following convention: Chris@39: # file name conversion function : func_convert_file_X_to_Y () Chris@39: # path conversion function : func_convert_path_X_to_Y () Chris@39: # where, for any given $build/$host combination the 'X_to_Y' value is the Chris@39: # same. If conversion functions are added for new $build/$host combinations, Chris@39: # the two new functions must follow this pattern, or func_init_to_host_path_cmd Chris@39: # will break. Chris@39: Chris@39: Chris@39: # func_init_to_host_path_cmd Chris@39: # Ensures that function "pointer" variable $to_host_path_cmd is set to the Chris@39: # appropriate value, based on the value of $to_host_file_cmd. Chris@39: to_host_path_cmd= Chris@39: func_init_to_host_path_cmd () Chris@39: { Chris@39: $opt_debug Chris@39: if test -z "$to_host_path_cmd"; then Chris@39: func_stripname 'func_convert_file_' '' "$to_host_file_cmd" Chris@39: to_host_path_cmd="func_convert_path_${func_stripname_result}" Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # func_to_host_path ARG Chris@39: # Converts the path ARG from $build format to $host format. Return result Chris@39: # in func_to_host_path_result. Chris@39: func_to_host_path () Chris@39: { Chris@39: $opt_debug Chris@39: func_init_to_host_path_cmd Chris@39: $to_host_path_cmd "$1" Chris@39: } Chris@39: # end func_to_host_path Chris@39: Chris@39: Chris@39: # func_convert_path_noop ARG Chris@39: # Copy ARG to func_to_host_path_result. Chris@39: func_convert_path_noop () Chris@39: { Chris@39: func_to_host_path_result="$1" Chris@39: } Chris@39: # end func_convert_path_noop Chris@39: Chris@39: Chris@39: # func_convert_path_msys_to_w32 ARG Chris@39: # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic Chris@39: # conversion to w32 is not available inside the cwrapper. Returns result in Chris@39: # func_to_host_path_result. Chris@39: func_convert_path_msys_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_path_result="$1" Chris@39: if test -n "$1"; then Chris@39: # Remove leading and trailing path separator characters from ARG. MSYS Chris@39: # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; Chris@39: # and winepath ignores them completely. Chris@39: func_stripname : : "$1" Chris@39: func_to_host_path_tmp1=$func_stripname_result Chris@39: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" Chris@39: func_to_host_path_result="$func_convert_core_msys_to_w32_result" Chris@39: func_convert_path_check : ";" \ Chris@39: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@39: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_msys_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_path_cygwin_to_w32 ARG Chris@39: # Convert path ARG from Cygwin to w32 format. Returns result in Chris@39: # func_to_host_file_result. Chris@39: func_convert_path_cygwin_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_path_result="$1" Chris@39: if test -n "$1"; then Chris@39: # See func_convert_path_msys_to_w32: Chris@39: func_stripname : : "$1" Chris@39: func_to_host_path_tmp1=$func_stripname_result Chris@39: func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` Chris@39: func_convert_path_check : ";" \ Chris@39: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@39: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_cygwin_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_path_nix_to_w32 ARG Chris@39: # Convert path ARG from *nix to w32 format. Requires a wine environment and Chris@39: # a working winepath. Returns result in func_to_host_file_result. Chris@39: func_convert_path_nix_to_w32 () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_path_result="$1" Chris@39: if test -n "$1"; then Chris@39: # See func_convert_path_msys_to_w32: Chris@39: func_stripname : : "$1" Chris@39: func_to_host_path_tmp1=$func_stripname_result Chris@39: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" Chris@39: func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" Chris@39: func_convert_path_check : ";" \ Chris@39: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@39: func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_nix_to_w32 Chris@39: Chris@39: Chris@39: # func_convert_path_msys_to_cygwin ARG Chris@39: # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. Chris@39: # Returns result in func_to_host_file_result. Chris@39: func_convert_path_msys_to_cygwin () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_path_result="$1" Chris@39: if test -n "$1"; then Chris@39: # See func_convert_path_msys_to_w32: Chris@39: func_stripname : : "$1" Chris@39: func_to_host_path_tmp1=$func_stripname_result Chris@39: func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" Chris@39: func_cygpath -u -p "$func_convert_core_msys_to_w32_result" Chris@39: func_to_host_path_result="$func_cygpath_result" Chris@39: func_convert_path_check : : \ Chris@39: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@39: func_convert_path_front_back_pathsep ":*" "*:" : "$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_msys_to_cygwin Chris@39: Chris@39: Chris@39: # func_convert_path_nix_to_cygwin ARG Chris@39: # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a Chris@39: # a wine environment, working winepath, and LT_CYGPATH set. Returns result in Chris@39: # func_to_host_file_result. Chris@39: func_convert_path_nix_to_cygwin () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_host_path_result="$1" Chris@39: if test -n "$1"; then Chris@39: # Remove leading and trailing path separator characters from Chris@39: # ARG. msys behavior is inconsistent here, cygpath turns them Chris@39: # into '.;' and ';.', and winepath ignores them completely. Chris@39: func_stripname : : "$1" Chris@39: func_to_host_path_tmp1=$func_stripname_result Chris@39: func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" Chris@39: func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" Chris@39: func_to_host_path_result="$func_cygpath_result" Chris@39: func_convert_path_check : : \ Chris@39: "$func_to_host_path_tmp1" "$func_to_host_path_result" Chris@39: func_convert_path_front_back_pathsep ":*" "*:" : "$1" Chris@39: fi Chris@39: } Chris@39: # end func_convert_path_nix_to_cygwin Chris@39: Chris@39: Chris@39: # func_mode_compile arg... Chris@39: func_mode_compile () Chris@39: { Chris@39: $opt_debug Chris@39: # Get the compilation command and the source file. Chris@39: base_compile= Chris@39: srcfile="$nonopt" # always keep a non-empty value in "srcfile" Chris@39: suppress_opt=yes Chris@39: suppress_output= Chris@39: arg_mode=normal Chris@39: libobj= Chris@39: later= Chris@39: pie_flag= Chris@39: Chris@39: for arg Chris@39: do Chris@39: case $arg_mode in Chris@39: arg ) Chris@39: # do not "continue". Instead, add this to base_compile Chris@39: lastarg="$arg" Chris@39: arg_mode=normal Chris@39: ;; Chris@39: Chris@39: target ) Chris@39: libobj="$arg" Chris@39: arg_mode=normal Chris@39: continue Chris@39: ;; Chris@39: Chris@39: normal ) Chris@39: # Accept any command-line options. Chris@39: case $arg in Chris@39: -o) Chris@39: test -n "$libobj" && \ Chris@39: func_fatal_error "you cannot specify \`-o' more than once" Chris@39: arg_mode=target Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -pie | -fpie | -fPIE) Chris@39: func_append pie_flag " $arg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -shared | -static | -prefer-pic | -prefer-non-pic) Chris@39: func_append later " $arg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -no-suppress) Chris@39: suppress_opt=no Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -Xcompiler) Chris@39: arg_mode=arg # the next one goes into the "base_compile" arg list Chris@39: continue # The current "srcfile" will either be retained or Chris@39: ;; # replaced later. I would guess that would be a bug. Chris@39: Chris@39: -Wc,*) Chris@39: func_stripname '-Wc,' '' "$arg" Chris@39: args=$func_stripname_result Chris@39: lastarg= Chris@39: save_ifs="$IFS"; IFS=',' Chris@39: for arg in $args; do Chris@39: IFS="$save_ifs" Chris@39: func_append_quoted lastarg "$arg" Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: func_stripname ' ' '' "$lastarg" Chris@39: lastarg=$func_stripname_result Chris@39: Chris@39: # Add the arguments to base_compile. Chris@39: func_append base_compile " $lastarg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: *) Chris@39: # Accept the current argument as the source file. Chris@39: # The previous "srcfile" becomes the current argument. Chris@39: # Chris@39: lastarg="$srcfile" Chris@39: srcfile="$arg" Chris@39: ;; Chris@39: esac # case $arg Chris@39: ;; Chris@39: esac # case $arg_mode Chris@39: Chris@39: # Aesthetically quote the previous argument. Chris@39: func_append_quoted base_compile "$lastarg" Chris@39: done # for arg Chris@39: Chris@39: case $arg_mode in Chris@39: arg) Chris@39: func_fatal_error "you must specify an argument for -Xcompile" Chris@39: ;; Chris@39: target) Chris@39: func_fatal_error "you must specify a target with \`-o'" Chris@39: ;; Chris@39: *) Chris@39: # Get the name of the library object. Chris@39: test -z "$libobj" && { Chris@39: func_basename "$srcfile" Chris@39: libobj="$func_basename_result" Chris@39: } Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Recognize several different file suffixes. Chris@39: # If the user specifies -o file.o, it is replaced with file.lo Chris@39: case $libobj in Chris@39: *.[cCFSifmso] | \ Chris@39: *.ada | *.adb | *.ads | *.asm | \ Chris@39: *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ Chris@39: *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) Chris@39: func_xform "$libobj" Chris@39: libobj=$func_xform_result Chris@39: ;; Chris@39: esac Chris@39: Chris@39: case $libobj in Chris@39: *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; Chris@39: *) Chris@39: func_fatal_error "cannot determine name of library object from \`$libobj'" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: func_infer_tag $base_compile Chris@39: Chris@39: for arg in $later; do Chris@39: case $arg in Chris@39: -shared) Chris@39: test "$build_libtool_libs" != yes && \ Chris@39: func_fatal_configuration "can not build a shared library" Chris@39: build_old_libs=no Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -static) Chris@39: build_libtool_libs=no Chris@39: build_old_libs=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -prefer-pic) Chris@39: pic_mode=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -prefer-non-pic) Chris@39: pic_mode=no Chris@39: continue Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: func_quote_for_eval "$libobj" Chris@39: test "X$libobj" != "X$func_quote_for_eval_result" \ Chris@39: && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ Chris@39: && func_warning "libobj name \`$libobj' may not contain shell special characters." Chris@39: func_dirname_and_basename "$obj" "/" "" Chris@39: objname="$func_basename_result" Chris@39: xdir="$func_dirname_result" Chris@39: lobj=${xdir}$objdir/$objname Chris@39: Chris@39: test -z "$base_compile" && \ Chris@39: func_fatal_help "you must specify a compilation command" Chris@39: Chris@39: # Delete any leftover library objects. Chris@39: if test "$build_old_libs" = yes; then Chris@39: removelist="$obj $lobj $libobj ${libobj}T" Chris@39: else Chris@39: removelist="$lobj $libobj ${libobj}T" Chris@39: fi Chris@39: Chris@39: # On Cygwin there's no "real" PIC flag so we must build both object types Chris@39: case $host_os in Chris@39: cygwin* | mingw* | pw32* | os2* | cegcc*) Chris@39: pic_mode=default Chris@39: ;; Chris@39: esac Chris@39: if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then Chris@39: # non-PIC code in shared libraries is not supported Chris@39: pic_mode=default Chris@39: fi Chris@39: Chris@39: # Calculate the filename of the output object if compiler does Chris@39: # not support -o with -c Chris@39: if test "$compiler_c_o" = no; then Chris@39: output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} Chris@39: lockfile="$output_obj.lock" Chris@39: else Chris@39: output_obj= Chris@39: need_locks=no Chris@39: lockfile= Chris@39: fi Chris@39: Chris@39: # Lock this critical section if it is needed Chris@39: # We use this script file to make the link, it avoids creating a new file Chris@39: if test "$need_locks" = yes; then Chris@39: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do Chris@39: func_echo "Waiting for $lockfile to be removed" Chris@39: sleep 2 Chris@39: done Chris@39: elif test "$need_locks" = warn; then Chris@39: if test -f "$lockfile"; then Chris@39: $ECHO "\ Chris@39: *** ERROR, $lockfile exists and contains: Chris@39: `cat $lockfile 2>/dev/null` Chris@39: Chris@39: This indicates that another process is trying to use the same Chris@39: temporary object file, and libtool could not work around it because Chris@39: your compiler does not support \`-c' and \`-o' together. If you Chris@39: repeat this compilation, it may succeed, by chance, but you had better Chris@39: avoid parallel builds (make -j) in this platform, or get a better Chris@39: compiler." Chris@39: Chris@39: $opt_dry_run || $RM $removelist Chris@39: exit $EXIT_FAILURE Chris@39: fi Chris@39: func_append removelist " $output_obj" Chris@39: $ECHO "$srcfile" > "$lockfile" Chris@39: fi Chris@39: Chris@39: $opt_dry_run || $RM $removelist Chris@39: func_append removelist " $lockfile" Chris@39: trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 Chris@39: Chris@39: func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 Chris@39: srcfile=$func_to_tool_file_result Chris@39: func_quote_for_eval "$srcfile" Chris@39: qsrcfile=$func_quote_for_eval_result Chris@39: Chris@39: # Only build a PIC object if we are building libtool libraries. Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: # Without this assignment, base_compile gets emptied. Chris@39: fbsd_hideous_sh_bug=$base_compile Chris@39: Chris@39: if test "$pic_mode" != no; then Chris@39: command="$base_compile $qsrcfile $pic_flag" Chris@39: else Chris@39: # Don't build PIC code Chris@39: command="$base_compile $qsrcfile" Chris@39: fi Chris@39: Chris@39: func_mkdir_p "$xdir$objdir" Chris@39: Chris@39: if test -z "$output_obj"; then Chris@39: # Place PIC objects in $objdir Chris@39: func_append command " -o $lobj" Chris@39: fi Chris@39: Chris@39: func_show_eval_locale "$command" \ Chris@39: 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' Chris@39: Chris@39: if test "$need_locks" = warn && Chris@39: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then Chris@39: $ECHO "\ Chris@39: *** ERROR, $lockfile contains: Chris@39: `cat $lockfile 2>/dev/null` Chris@39: Chris@39: but it should contain: Chris@39: $srcfile Chris@39: Chris@39: This indicates that another process is trying to use the same Chris@39: temporary object file, and libtool could not work around it because Chris@39: your compiler does not support \`-c' and \`-o' together. If you Chris@39: repeat this compilation, it may succeed, by chance, but you had better Chris@39: avoid parallel builds (make -j) in this platform, or get a better Chris@39: compiler." Chris@39: Chris@39: $opt_dry_run || $RM $removelist Chris@39: exit $EXIT_FAILURE Chris@39: fi Chris@39: Chris@39: # Just move the object if needed, then go on to compile the next one Chris@39: if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then Chris@39: func_show_eval '$MV "$output_obj" "$lobj"' \ Chris@39: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' Chris@39: fi Chris@39: Chris@39: # Allow error messages only from the first compilation. Chris@39: if test "$suppress_opt" = yes; then Chris@39: suppress_output=' >/dev/null 2>&1' Chris@39: fi Chris@39: fi Chris@39: Chris@39: # Only build a position-dependent object if we build old libraries. Chris@39: if test "$build_old_libs" = yes; then Chris@39: if test "$pic_mode" != yes; then Chris@39: # Don't build PIC code Chris@39: command="$base_compile $qsrcfile$pie_flag" Chris@39: else Chris@39: command="$base_compile $qsrcfile $pic_flag" Chris@39: fi Chris@39: if test "$compiler_c_o" = yes; then Chris@39: func_append command " -o $obj" Chris@39: fi Chris@39: Chris@39: # Suppress compiler output if we already did a PIC compilation. Chris@39: func_append command "$suppress_output" Chris@39: func_show_eval_locale "$command" \ Chris@39: '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' Chris@39: Chris@39: if test "$need_locks" = warn && Chris@39: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then Chris@39: $ECHO "\ Chris@39: *** ERROR, $lockfile contains: Chris@39: `cat $lockfile 2>/dev/null` Chris@39: Chris@39: but it should contain: Chris@39: $srcfile Chris@39: Chris@39: This indicates that another process is trying to use the same Chris@39: temporary object file, and libtool could not work around it because Chris@39: your compiler does not support \`-c' and \`-o' together. If you Chris@39: repeat this compilation, it may succeed, by chance, but you had better Chris@39: avoid parallel builds (make -j) in this platform, or get a better Chris@39: compiler." Chris@39: Chris@39: $opt_dry_run || $RM $removelist Chris@39: exit $EXIT_FAILURE Chris@39: fi Chris@39: Chris@39: # Just move the object if needed Chris@39: if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then Chris@39: func_show_eval '$MV "$output_obj" "$obj"' \ Chris@39: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' Chris@39: fi Chris@39: fi Chris@39: Chris@39: $opt_dry_run || { Chris@39: func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" Chris@39: Chris@39: # Unlock the critical section if it was locked Chris@39: if test "$need_locks" != no; then Chris@39: removelist=$lockfile Chris@39: $RM "$lockfile" Chris@39: fi Chris@39: } Chris@39: Chris@39: exit $EXIT_SUCCESS Chris@39: } Chris@39: Chris@39: $opt_help || { Chris@39: test "$opt_mode" = compile && func_mode_compile ${1+"$@"} Chris@39: } Chris@39: Chris@39: func_mode_help () Chris@39: { Chris@39: # We need to display help for each of the modes. Chris@39: case $opt_mode in Chris@39: "") Chris@39: # Generic help is extracted from the usage comments Chris@39: # at the start of this file. Chris@39: func_help Chris@39: ;; Chris@39: Chris@39: clean) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Chris@39: Chris@39: Remove files from the build directory. Chris@39: Chris@39: RM is the name of the program to use to delete files associated with each FILE Chris@39: (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed Chris@39: to RM. Chris@39: Chris@39: If FILE is a libtool library, object or program, all the files associated Chris@39: with it are deleted. Otherwise, only FILE itself is deleted using RM." Chris@39: ;; Chris@39: Chris@39: compile) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Chris@39: Chris@39: Compile a source file into a libtool library object. Chris@39: Chris@39: This mode accepts the following additional options: Chris@39: Chris@39: -o OUTPUT-FILE set the output file name to OUTPUT-FILE Chris@39: -no-suppress do not suppress compiler output for multiple passes Chris@39: -prefer-pic try to build PIC objects only Chris@39: -prefer-non-pic try to build non-PIC objects only Chris@39: -shared do not build a \`.o' file suitable for static linking Chris@39: -static only build a \`.o' file suitable for static linking Chris@39: -Wc,FLAG pass FLAG directly to the compiler Chris@39: Chris@39: COMPILE-COMMAND is a command to be used in creating a \`standard' object file Chris@39: from the given SOURCEFILE. Chris@39: Chris@39: The output file name is determined by removing the directory component from Chris@39: SOURCEFILE, then substituting the C source code suffix \`.c' with the Chris@39: library object suffix, \`.lo'." Chris@39: ;; Chris@39: Chris@39: execute) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Chris@39: Chris@39: Automatically set library path, then run a program. Chris@39: Chris@39: This mode accepts the following additional options: Chris@39: Chris@39: -dlopen FILE add the directory containing FILE to the library path Chris@39: Chris@39: This mode sets the library path environment variable according to \`-dlopen' Chris@39: flags. Chris@39: Chris@39: If any of the ARGS are libtool executable wrappers, then they are translated Chris@39: into their corresponding uninstalled binary, and any of their required library Chris@39: directories are added to the library path. Chris@39: Chris@39: Then, COMMAND is executed, with ARGS as arguments." Chris@39: ;; Chris@39: Chris@39: finish) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Chris@39: Chris@39: Complete the installation of libtool libraries. Chris@39: Chris@39: Each LIBDIR is a directory that contains libtool libraries. Chris@39: Chris@39: The commands that this mode executes may require superuser privileges. Use Chris@39: the \`--dry-run' option if you just want to see what would be executed." Chris@39: ;; Chris@39: Chris@39: install) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Chris@39: Chris@39: Install executables or libraries. Chris@39: Chris@39: INSTALL-COMMAND is the installation command. The first component should be Chris@39: either the \`install' or \`cp' program. Chris@39: Chris@39: The following components of INSTALL-COMMAND are treated specially: Chris@39: Chris@39: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation Chris@39: Chris@39: The rest of the components are interpreted as arguments to that command (only Chris@39: BSD-compatible install options are recognized)." Chris@39: ;; Chris@39: Chris@39: link) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Chris@39: Chris@39: Link object files or libraries together to form another library, or to Chris@39: create an executable program. Chris@39: Chris@39: LINK-COMMAND is a command using the C compiler that you would use to create Chris@39: a program from several object files. Chris@39: Chris@39: The following components of LINK-COMMAND are treated specially: Chris@39: Chris@39: -all-static do not do any dynamic linking at all Chris@39: -avoid-version do not add a version suffix if possible Chris@39: -bindir BINDIR specify path to binaries directory (for systems where Chris@39: libraries must be found in the PATH setting at runtime) Chris@39: -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime Chris@39: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols Chris@39: -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) Chris@39: -export-symbols SYMFILE Chris@39: try to export only the symbols listed in SYMFILE Chris@39: -export-symbols-regex REGEX Chris@39: try to export only the symbols matching REGEX Chris@39: -LLIBDIR search LIBDIR for required installed libraries Chris@39: -lNAME OUTPUT-FILE requires the installed library libNAME Chris@39: -module build a library that can dlopened Chris@39: -no-fast-install disable the fast-install mode Chris@39: -no-install link a not-installable executable Chris@39: -no-undefined declare that a library does not refer to external symbols Chris@39: -o OUTPUT-FILE create OUTPUT-FILE from the specified objects Chris@39: -objectlist FILE Use a list of object files found in FILE to specify objects Chris@39: -precious-files-regex REGEX Chris@39: don't remove output files matching REGEX Chris@39: -release RELEASE specify package release information Chris@39: -rpath LIBDIR the created library will eventually be installed in LIBDIR Chris@39: -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries Chris@39: -shared only do dynamic linking of libtool libraries Chris@39: -shrext SUFFIX override the standard shared library file extension Chris@39: -static do not do any dynamic linking of uninstalled libtool libraries Chris@39: -static-libtool-libs Chris@39: do not do any dynamic linking of libtool libraries Chris@39: -version-info CURRENT[:REVISION[:AGE]] Chris@39: specify library version info [each variable defaults to 0] Chris@39: -weak LIBNAME declare that the target provides the LIBNAME interface Chris@39: -Wc,FLAG Chris@39: -Xcompiler FLAG pass linker-specific FLAG directly to the compiler Chris@39: -Wl,FLAG Chris@39: -Xlinker FLAG pass linker-specific FLAG directly to the linker Chris@39: -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) Chris@39: Chris@39: All other options (arguments beginning with \`-') are ignored. Chris@39: Chris@39: Every other argument is treated as a filename. Files ending in \`.la' are Chris@39: treated as uninstalled libtool libraries, other files are standard or library Chris@39: object files. Chris@39: Chris@39: If the OUTPUT-FILE ends in \`.la', then a libtool library is created, Chris@39: only library objects (\`.lo' files) may be specified, and \`-rpath' is Chris@39: required, except when creating a convenience library. Chris@39: Chris@39: If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created Chris@39: using \`ar' and \`ranlib', or on Windows using \`lib'. Chris@39: Chris@39: If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file Chris@39: is created, otherwise an executable program is created." Chris@39: ;; Chris@39: Chris@39: uninstall) Chris@39: $ECHO \ Chris@39: "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Chris@39: Chris@39: Remove libraries from an installation directory. Chris@39: Chris@39: RM is the name of the program to use to delete files associated with each FILE Chris@39: (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed Chris@39: to RM. Chris@39: Chris@39: If FILE is a libtool library, all the files associated with it are deleted. Chris@39: Otherwise, only FILE itself is deleted using RM." Chris@39: ;; Chris@39: Chris@39: *) Chris@39: func_fatal_help "invalid operation mode \`$opt_mode'" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: echo Chris@39: $ECHO "Try \`$progname --help' for more information about other modes." Chris@39: } Chris@39: Chris@39: # Now that we've collected a possible --mode arg, show help if necessary Chris@39: if $opt_help; then Chris@39: if test "$opt_help" = :; then Chris@39: func_mode_help Chris@39: else Chris@39: { Chris@39: func_help noexit Chris@39: for opt_mode in compile link execute install finish uninstall clean; do Chris@39: func_mode_help Chris@39: done Chris@39: } | sed -n '1p; 2,$s/^Usage:/ or: /p' Chris@39: { Chris@39: func_help noexit Chris@39: for opt_mode in compile link execute install finish uninstall clean; do Chris@39: echo Chris@39: func_mode_help Chris@39: done Chris@39: } | Chris@39: sed '1d Chris@39: /^When reporting/,/^Report/{ Chris@39: H Chris@39: d Chris@39: } Chris@39: $x Chris@39: /information about other modes/d Chris@39: /more detailed .*MODE/d Chris@39: s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' Chris@39: fi Chris@39: exit $? Chris@39: fi Chris@39: Chris@39: Chris@39: # func_mode_execute arg... Chris@39: func_mode_execute () Chris@39: { Chris@39: $opt_debug Chris@39: # The first argument is the command name. Chris@39: cmd="$nonopt" Chris@39: test -z "$cmd" && \ Chris@39: func_fatal_help "you must specify a COMMAND" Chris@39: Chris@39: # Handle -dlopen flags immediately. Chris@39: for file in $opt_dlopen; do Chris@39: test -f "$file" \ Chris@39: || func_fatal_help "\`$file' is not a file" Chris@39: Chris@39: dir= Chris@39: case $file in Chris@39: *.la) Chris@39: func_resolve_sysroot "$file" Chris@39: file=$func_resolve_sysroot_result Chris@39: Chris@39: # Check to see that this really is a libtool archive. Chris@39: func_lalib_unsafe_p "$file" \ Chris@39: || func_fatal_help "\`$lib' is not a valid libtool archive" Chris@39: Chris@39: # Read the libtool library. Chris@39: dlname= Chris@39: library_names= Chris@39: func_source "$file" Chris@39: Chris@39: # Skip this library if it cannot be dlopened. Chris@39: if test -z "$dlname"; then Chris@39: # Warn if it was a shared library. Chris@39: test -n "$library_names" && \ Chris@39: func_warning "\`$file' was not linked with \`-export-dynamic'" Chris@39: continue Chris@39: fi Chris@39: Chris@39: func_dirname "$file" "" "." Chris@39: dir="$func_dirname_result" Chris@39: Chris@39: if test -f "$dir/$objdir/$dlname"; then Chris@39: func_append dir "/$objdir" Chris@39: else Chris@39: if test ! -f "$dir/$dlname"; then Chris@39: func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: Chris@39: *.lo) Chris@39: # Just add the directory containing the .lo file. Chris@39: func_dirname "$file" "" "." Chris@39: dir="$func_dirname_result" Chris@39: ;; Chris@39: Chris@39: *) Chris@39: func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" Chris@39: continue Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Get the absolute pathname. Chris@39: absdir=`cd "$dir" && pwd` Chris@39: test -n "$absdir" && dir="$absdir" Chris@39: Chris@39: # Now add the directory to shlibpath_var. Chris@39: if eval "test -z \"\$$shlibpath_var\""; then Chris@39: eval "$shlibpath_var=\"\$dir\"" Chris@39: else Chris@39: eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" Chris@39: fi Chris@39: done Chris@39: Chris@39: # This variable tells wrapper scripts just to set shlibpath_var Chris@39: # rather than running their programs. Chris@39: libtool_execute_magic="$magic" Chris@39: Chris@39: # Check if any of the arguments is a wrapper script. Chris@39: args= Chris@39: for file Chris@39: do Chris@39: case $file in Chris@39: -* | *.la | *.lo ) ;; Chris@39: *) Chris@39: # Do a test to see if this is really a libtool program. Chris@39: if func_ltwrapper_script_p "$file"; then Chris@39: func_source "$file" Chris@39: # Transform arg to wrapped name. Chris@39: file="$progdir/$program" Chris@39: elif func_ltwrapper_executable_p "$file"; then Chris@39: func_ltwrapper_scriptname "$file" Chris@39: func_source "$func_ltwrapper_scriptname_result" Chris@39: # Transform arg to wrapped name. Chris@39: file="$progdir/$program" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: # Quote arguments (to preserve shell metacharacters). Chris@39: func_append_quoted args "$file" Chris@39: done Chris@39: Chris@39: if test "X$opt_dry_run" = Xfalse; then Chris@39: if test -n "$shlibpath_var"; then Chris@39: # Export the shlibpath_var. Chris@39: eval "export $shlibpath_var" Chris@39: fi Chris@39: Chris@39: # Restore saved environment variables Chris@39: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES Chris@39: do Chris@39: eval "if test \"\${save_$lt_var+set}\" = set; then Chris@39: $lt_var=\$save_$lt_var; export $lt_var Chris@39: else Chris@39: $lt_unset $lt_var Chris@39: fi" Chris@39: done Chris@39: Chris@39: # Now prepare to actually exec the command. Chris@39: exec_cmd="\$cmd$args" Chris@39: else Chris@39: # Display what would be done. Chris@39: if test -n "$shlibpath_var"; then Chris@39: eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" Chris@39: echo "export $shlibpath_var" Chris@39: fi Chris@39: $ECHO "$cmd$args" Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: } Chris@39: Chris@39: test "$opt_mode" = execute && func_mode_execute ${1+"$@"} Chris@39: Chris@39: Chris@39: # func_mode_finish arg... Chris@39: func_mode_finish () Chris@39: { Chris@39: $opt_debug Chris@39: libs= Chris@39: libdirs= Chris@39: admincmds= Chris@39: Chris@39: for opt in "$nonopt" ${1+"$@"} Chris@39: do Chris@39: if test -d "$opt"; then Chris@39: func_append libdirs " $opt" Chris@39: Chris@39: elif test -f "$opt"; then Chris@39: if func_lalib_unsafe_p "$opt"; then Chris@39: func_append libs " $opt" Chris@39: else Chris@39: func_warning "\`$opt' is not a valid libtool archive" Chris@39: fi Chris@39: Chris@39: else Chris@39: func_fatal_error "invalid argument \`$opt'" Chris@39: fi Chris@39: done Chris@39: Chris@39: if test -n "$libs"; then Chris@39: if test -n "$lt_sysroot"; then Chris@39: sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` Chris@39: sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" Chris@39: else Chris@39: sysroot_cmd= Chris@39: fi Chris@39: Chris@39: # Remove sysroot references Chris@39: if $opt_dry_run; then Chris@39: for lib in $libs; do Chris@39: echo "removing references to $lt_sysroot and \`=' prefixes from $lib" Chris@39: done Chris@39: else Chris@39: tmpdir=`func_mktempdir` Chris@39: for lib in $libs; do Chris@39: sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ Chris@39: > $tmpdir/tmp-la Chris@39: mv -f $tmpdir/tmp-la $lib Chris@39: done Chris@39: ${RM}r "$tmpdir" Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then Chris@39: for libdir in $libdirs; do Chris@39: if test -n "$finish_cmds"; then Chris@39: # Do each command in the finish commands. Chris@39: func_execute_cmds "$finish_cmds" 'admincmds="$admincmds Chris@39: '"$cmd"'"' Chris@39: fi Chris@39: if test -n "$finish_eval"; then Chris@39: # Do the single finish_eval. Chris@39: eval cmds=\"$finish_eval\" Chris@39: $opt_dry_run || eval "$cmds" || func_append admincmds " Chris@39: $cmds" Chris@39: fi Chris@39: done Chris@39: fi Chris@39: Chris@39: # Exit here if they wanted silent mode. Chris@39: $opt_silent && exit $EXIT_SUCCESS Chris@39: Chris@39: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then Chris@39: echo "----------------------------------------------------------------------" Chris@39: echo "Libraries have been installed in:" Chris@39: for libdir in $libdirs; do Chris@39: $ECHO " $libdir" Chris@39: done Chris@39: echo Chris@39: echo "If you ever happen to want to link against installed libraries" Chris@39: echo "in a given directory, LIBDIR, you must either use libtool, and" Chris@39: echo "specify the full pathname of the library, or use the \`-LLIBDIR'" Chris@39: echo "flag during linking and do at least one of the following:" Chris@39: if test -n "$shlibpath_var"; then Chris@39: echo " - add LIBDIR to the \`$shlibpath_var' environment variable" Chris@39: echo " during execution" Chris@39: fi Chris@39: if test -n "$runpath_var"; then Chris@39: echo " - add LIBDIR to the \`$runpath_var' environment variable" Chris@39: echo " during linking" Chris@39: fi Chris@39: if test -n "$hardcode_libdir_flag_spec"; then Chris@39: libdir=LIBDIR Chris@39: eval flag=\"$hardcode_libdir_flag_spec\" Chris@39: Chris@39: $ECHO " - use the \`$flag' linker flag" Chris@39: fi Chris@39: if test -n "$admincmds"; then Chris@39: $ECHO " - have your system administrator run these commands:$admincmds" Chris@39: fi Chris@39: if test -f /etc/ld.so.conf; then Chris@39: echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" Chris@39: fi Chris@39: echo Chris@39: Chris@39: echo "See any operating system documentation about shared libraries for" Chris@39: case $host in Chris@39: solaris2.[6789]|solaris2.1[0-9]) Chris@39: echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" Chris@39: echo "pages." Chris@39: ;; Chris@39: *) Chris@39: echo "more information, such as the ld(1) and ld.so(8) manual pages." Chris@39: ;; Chris@39: esac Chris@39: echo "----------------------------------------------------------------------" Chris@39: fi Chris@39: exit $EXIT_SUCCESS Chris@39: } Chris@39: Chris@39: test "$opt_mode" = finish && func_mode_finish ${1+"$@"} Chris@39: Chris@39: Chris@39: # func_mode_install arg... Chris@39: func_mode_install () Chris@39: { Chris@39: $opt_debug Chris@39: # There may be an optional sh(1) argument at the beginning of Chris@39: # install_prog (especially on Windows NT). Chris@39: if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || Chris@39: # Allow the use of GNU shtool's install command. Chris@39: case $nonopt in *shtool*) :;; *) false;; esac; then Chris@39: # Aesthetically quote it. Chris@39: func_quote_for_eval "$nonopt" Chris@39: install_prog="$func_quote_for_eval_result " Chris@39: arg=$1 Chris@39: shift Chris@39: else Chris@39: install_prog= Chris@39: arg=$nonopt Chris@39: fi Chris@39: Chris@39: # The real first argument should be the name of the installation program. Chris@39: # Aesthetically quote it. Chris@39: func_quote_for_eval "$arg" Chris@39: func_append install_prog "$func_quote_for_eval_result" Chris@39: install_shared_prog=$install_prog Chris@39: case " $install_prog " in Chris@39: *[\\\ /]cp\ *) install_cp=: ;; Chris@39: *) install_cp=false ;; Chris@39: esac Chris@39: Chris@39: # We need to accept at least all the BSD install flags. Chris@39: dest= Chris@39: files= Chris@39: opts= Chris@39: prev= Chris@39: install_type= Chris@39: isdir=no Chris@39: stripme= Chris@39: no_mode=: Chris@39: for arg Chris@39: do Chris@39: arg2= Chris@39: if test -n "$dest"; then Chris@39: func_append files " $dest" Chris@39: dest=$arg Chris@39: continue Chris@39: fi Chris@39: Chris@39: case $arg in Chris@39: -d) isdir=yes ;; Chris@39: -f) Chris@39: if $install_cp; then :; else Chris@39: prev=$arg Chris@39: fi Chris@39: ;; Chris@39: -g | -m | -o) Chris@39: prev=$arg Chris@39: ;; Chris@39: -s) Chris@39: stripme=" -s" Chris@39: continue Chris@39: ;; Chris@39: -*) Chris@39: ;; Chris@39: *) Chris@39: # If the previous option needed an argument, then skip it. Chris@39: if test -n "$prev"; then Chris@39: if test "x$prev" = x-m && test -n "$install_override_mode"; then Chris@39: arg2=$install_override_mode Chris@39: no_mode=false Chris@39: fi Chris@39: prev= Chris@39: else Chris@39: dest=$arg Chris@39: continue Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Aesthetically quote the argument. Chris@39: func_quote_for_eval "$arg" Chris@39: func_append install_prog " $func_quote_for_eval_result" Chris@39: if test -n "$arg2"; then Chris@39: func_quote_for_eval "$arg2" Chris@39: fi Chris@39: func_append install_shared_prog " $func_quote_for_eval_result" Chris@39: done Chris@39: Chris@39: test -z "$install_prog" && \ Chris@39: func_fatal_help "you must specify an install program" Chris@39: Chris@39: test -n "$prev" && \ Chris@39: func_fatal_help "the \`$prev' option requires an argument" Chris@39: Chris@39: if test -n "$install_override_mode" && $no_mode; then Chris@39: if $install_cp; then :; else Chris@39: func_quote_for_eval "$install_override_mode" Chris@39: func_append install_shared_prog " -m $func_quote_for_eval_result" Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test -z "$files"; then Chris@39: if test -z "$dest"; then Chris@39: func_fatal_help "no file or destination specified" Chris@39: else Chris@39: func_fatal_help "you must specify a destination" Chris@39: fi Chris@39: fi Chris@39: Chris@39: # Strip any trailing slash from the destination. Chris@39: func_stripname '' '/' "$dest" Chris@39: dest=$func_stripname_result Chris@39: Chris@39: # Check to see that the destination is a directory. Chris@39: test -d "$dest" && isdir=yes Chris@39: if test "$isdir" = yes; then Chris@39: destdir="$dest" Chris@39: destname= Chris@39: else Chris@39: func_dirname_and_basename "$dest" "" "." Chris@39: destdir="$func_dirname_result" Chris@39: destname="$func_basename_result" Chris@39: Chris@39: # Not a directory, so check to see that there is only one file specified. Chris@39: set dummy $files; shift Chris@39: test "$#" -gt 1 && \ Chris@39: func_fatal_help "\`$dest' is not a directory" Chris@39: fi Chris@39: case $destdir in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@39: *) Chris@39: for file in $files; do Chris@39: case $file in Chris@39: *.lo) ;; Chris@39: *) Chris@39: func_fatal_help "\`$destdir' must be an absolute directory name" Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # This variable tells wrapper scripts just to set variables rather Chris@39: # than running their programs. Chris@39: libtool_install_magic="$magic" Chris@39: Chris@39: staticlibs= Chris@39: future_libdirs= Chris@39: current_libdirs= Chris@39: for file in $files; do Chris@39: Chris@39: # Do each installation. Chris@39: case $file in Chris@39: *.$libext) Chris@39: # Do the static libraries later. Chris@39: func_append staticlibs " $file" Chris@39: ;; Chris@39: Chris@39: *.la) Chris@39: func_resolve_sysroot "$file" Chris@39: file=$func_resolve_sysroot_result Chris@39: Chris@39: # Check to see that this really is a libtool archive. Chris@39: func_lalib_unsafe_p "$file" \ Chris@39: || func_fatal_help "\`$file' is not a valid libtool archive" Chris@39: Chris@39: library_names= Chris@39: old_library= Chris@39: relink_command= Chris@39: func_source "$file" Chris@39: Chris@39: # Add the libdir to current_libdirs if it is the destination. Chris@39: if test "X$destdir" = "X$libdir"; then Chris@39: case "$current_libdirs " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append current_libdirs " $libdir" ;; Chris@39: esac Chris@39: else Chris@39: # Note the libdir as a future libdir. Chris@39: case "$future_libdirs " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append future_libdirs " $libdir" ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: func_dirname "$file" "/" "" Chris@39: dir="$func_dirname_result" Chris@39: func_append dir "$objdir" Chris@39: Chris@39: if test -n "$relink_command"; then Chris@39: # Determine the prefix the user has applied to our future dir. Chris@39: inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` Chris@39: Chris@39: # Don't allow the user to place us outside of our expected Chris@39: # location b/c this prevents finding dependent libraries that Chris@39: # are installed to the same prefix. Chris@39: # At present, this check doesn't affect windows .dll's that Chris@39: # are installed into $libdir/../bin (currently, that works fine) Chris@39: # but it's something to keep an eye on. Chris@39: test "$inst_prefix_dir" = "$destdir" && \ Chris@39: func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" Chris@39: Chris@39: if test -n "$inst_prefix_dir"; then Chris@39: # Stick the inst_prefix_dir data into the link command. Chris@39: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` Chris@39: else Chris@39: relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` Chris@39: fi Chris@39: Chris@39: func_warning "relinking \`$file'" Chris@39: func_show_eval "$relink_command" \ Chris@39: 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' Chris@39: fi Chris@39: Chris@39: # See the names of the shared library. Chris@39: set dummy $library_names; shift Chris@39: if test -n "$1"; then Chris@39: realname="$1" Chris@39: shift Chris@39: Chris@39: srcname="$realname" Chris@39: test -n "$relink_command" && srcname="$realname"T Chris@39: Chris@39: # Install the shared library and build the symlinks. Chris@39: func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ Chris@39: 'exit $?' Chris@39: tstripme="$stripme" Chris@39: case $host_os in Chris@39: cygwin* | mingw* | pw32* | cegcc*) Chris@39: case $realname in Chris@39: *.dll.a) Chris@39: tstripme="" Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: if test -n "$tstripme" && test -n "$striplib"; then Chris@39: func_show_eval "$striplib $destdir/$realname" 'exit $?' Chris@39: fi Chris@39: Chris@39: if test "$#" -gt 0; then Chris@39: # Delete the old symlinks, and create new ones. Chris@39: # Try `ln -sf' first, because the `ln' binary might depend on Chris@39: # the symlink we replace! Solaris /bin/ln does not understand -f, Chris@39: # so we also need to try rm && ln -s. Chris@39: for linkname Chris@39: do Chris@39: test "$linkname" != "$realname" \ Chris@39: && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" Chris@39: done Chris@39: fi Chris@39: Chris@39: # Do each command in the postinstall commands. Chris@39: lib="$destdir/$realname" Chris@39: func_execute_cmds "$postinstall_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: # Install the pseudo-library for information purposes. Chris@39: func_basename "$file" Chris@39: name="$func_basename_result" Chris@39: instname="$dir/$name"i Chris@39: func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' Chris@39: Chris@39: # Maybe install the static library, too. Chris@39: test -n "$old_library" && func_append staticlibs " $dir/$old_library" Chris@39: ;; Chris@39: Chris@39: *.lo) Chris@39: # Install (i.e. copy) a libtool object. Chris@39: Chris@39: # Figure out destination file name, if it wasn't already specified. Chris@39: if test -n "$destname"; then Chris@39: destfile="$destdir/$destname" Chris@39: else Chris@39: func_basename "$file" Chris@39: destfile="$func_basename_result" Chris@39: destfile="$destdir/$destfile" Chris@39: fi Chris@39: Chris@39: # Deduce the name of the destination old-style object file. Chris@39: case $destfile in Chris@39: *.lo) Chris@39: func_lo2o "$destfile" Chris@39: staticdest=$func_lo2o_result Chris@39: ;; Chris@39: *.$objext) Chris@39: staticdest="$destfile" Chris@39: destfile= Chris@39: ;; Chris@39: *) Chris@39: func_fatal_help "cannot copy a libtool object to \`$destfile'" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Install the libtool object if requested. Chris@39: test -n "$destfile" && \ Chris@39: func_show_eval "$install_prog $file $destfile" 'exit $?' Chris@39: Chris@39: # Install the old object if enabled. Chris@39: if test "$build_old_libs" = yes; then Chris@39: # Deduce the name of the old-style object file. Chris@39: func_lo2o "$file" Chris@39: staticobj=$func_lo2o_result Chris@39: func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' Chris@39: fi Chris@39: exit $EXIT_SUCCESS Chris@39: ;; Chris@39: Chris@39: *) Chris@39: # Figure out destination file name, if it wasn't already specified. Chris@39: if test -n "$destname"; then Chris@39: destfile="$destdir/$destname" Chris@39: else Chris@39: func_basename "$file" Chris@39: destfile="$func_basename_result" Chris@39: destfile="$destdir/$destfile" Chris@39: fi Chris@39: Chris@39: # If the file is missing, and there is a .exe on the end, strip it Chris@39: # because it is most likely a libtool script we actually want to Chris@39: # install Chris@39: stripped_ext="" Chris@39: case $file in Chris@39: *.exe) Chris@39: if test ! -f "$file"; then Chris@39: func_stripname '' '.exe' "$file" Chris@39: file=$func_stripname_result Chris@39: stripped_ext=".exe" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Do a test to see if this is really a libtool program. Chris@39: case $host in Chris@39: *cygwin* | *mingw*) Chris@39: if func_ltwrapper_executable_p "$file"; then Chris@39: func_ltwrapper_scriptname "$file" Chris@39: wrapper=$func_ltwrapper_scriptname_result Chris@39: else Chris@39: func_stripname '' '.exe' "$file" Chris@39: wrapper=$func_stripname_result Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: wrapper=$file Chris@39: ;; Chris@39: esac Chris@39: if func_ltwrapper_script_p "$wrapper"; then Chris@39: notinst_deplibs= Chris@39: relink_command= Chris@39: Chris@39: func_source "$wrapper" Chris@39: Chris@39: # Check the variables that should have been set. Chris@39: test -z "$generated_by_libtool_version" && \ Chris@39: func_fatal_error "invalid libtool wrapper script \`$wrapper'" Chris@39: Chris@39: finalize=yes Chris@39: for lib in $notinst_deplibs; do Chris@39: # Check to see that each library is installed. Chris@39: libdir= Chris@39: if test -f "$lib"; then Chris@39: func_source "$lib" Chris@39: fi Chris@39: libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test Chris@39: if test -n "$libdir" && test ! -f "$libfile"; then Chris@39: func_warning "\`$lib' has not been installed in \`$libdir'" Chris@39: finalize=no Chris@39: fi Chris@39: done Chris@39: Chris@39: relink_command= Chris@39: func_source "$wrapper" Chris@39: Chris@39: outputname= Chris@39: if test "$fast_install" = no && test -n "$relink_command"; then Chris@39: $opt_dry_run || { Chris@39: if test "$finalize" = yes; then Chris@39: tmpdir=`func_mktempdir` Chris@39: func_basename "$file$stripped_ext" Chris@39: file="$func_basename_result" Chris@39: outputname="$tmpdir/$file" Chris@39: # Replace the output file specification. Chris@39: relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` Chris@39: Chris@39: $opt_silent || { Chris@39: func_quote_for_expand "$relink_command" Chris@39: eval "func_echo $func_quote_for_expand_result" Chris@39: } Chris@39: if eval "$relink_command"; then : Chris@39: else Chris@39: func_error "error: relink \`$file' with the above command before installing it" Chris@39: $opt_dry_run || ${RM}r "$tmpdir" Chris@39: continue Chris@39: fi Chris@39: file="$outputname" Chris@39: else Chris@39: func_warning "cannot relink \`$file'" Chris@39: fi Chris@39: } Chris@39: else Chris@39: # Install the binary that we compiled earlier. Chris@39: file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` Chris@39: fi Chris@39: fi Chris@39: Chris@39: # remove .exe since cygwin /usr/bin/install will append another Chris@39: # one anyway Chris@39: case $install_prog,$host in Chris@39: */usr/bin/install*,*cygwin*) Chris@39: case $file:$destfile in Chris@39: *.exe:*.exe) Chris@39: # this is ok Chris@39: ;; Chris@39: *.exe:*) Chris@39: destfile=$destfile.exe Chris@39: ;; Chris@39: *:*.exe) Chris@39: func_stripname '' '.exe' "$destfile" Chris@39: destfile=$func_stripname_result Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' Chris@39: $opt_dry_run || if test -n "$outputname"; then Chris@39: ${RM}r "$tmpdir" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: for file in $staticlibs; do Chris@39: func_basename "$file" Chris@39: name="$func_basename_result" Chris@39: Chris@39: # Set up the ranlib parameters. Chris@39: oldlib="$destdir/$name" Chris@39: Chris@39: func_show_eval "$install_prog \$file \$oldlib" 'exit $?' Chris@39: Chris@39: if test -n "$stripme" && test -n "$old_striplib"; then Chris@39: func_show_eval "$old_striplib $oldlib" 'exit $?' Chris@39: fi Chris@39: Chris@39: # Do each command in the postinstall commands. Chris@39: func_execute_cmds "$old_postinstall_cmds" 'exit $?' Chris@39: done Chris@39: Chris@39: test -n "$future_libdirs" && \ Chris@39: func_warning "remember to run \`$progname --finish$future_libdirs'" Chris@39: Chris@39: if test -n "$current_libdirs"; then Chris@39: # Maybe just do a dry run. Chris@39: $opt_dry_run && current_libdirs=" -n$current_libdirs" Chris@39: exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' Chris@39: else Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: } Chris@39: Chris@39: test "$opt_mode" = install && func_mode_install ${1+"$@"} Chris@39: Chris@39: Chris@39: # func_generate_dlsyms outputname originator pic_p Chris@39: # Extract symbols from dlprefiles and create ${outputname}S.o with Chris@39: # a dlpreopen symbol table. Chris@39: func_generate_dlsyms () Chris@39: { Chris@39: $opt_debug Chris@39: my_outputname="$1" Chris@39: my_originator="$2" Chris@39: my_pic_p="${3-no}" Chris@39: my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` Chris@39: my_dlsyms= Chris@39: Chris@39: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then Chris@39: if test -n "$NM" && test -n "$global_symbol_pipe"; then Chris@39: my_dlsyms="${my_outputname}S.c" Chris@39: else Chris@39: func_error "not configured to extract global symbols from dlpreopened files" Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test -n "$my_dlsyms"; then Chris@39: case $my_dlsyms in Chris@39: "") ;; Chris@39: *.c) Chris@39: # Discover the nlist of each of the dlfiles. Chris@39: nlist="$output_objdir/${my_outputname}.nm" Chris@39: Chris@39: func_show_eval "$RM $nlist ${nlist}S ${nlist}T" Chris@39: Chris@39: # Parse the name list into a source file. Chris@39: func_verbose "creating $output_objdir/$my_dlsyms" Chris@39: Chris@39: $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ Chris@39: /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ Chris@39: /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ Chris@39: Chris@39: #ifdef __cplusplus Chris@39: extern \"C\" { Chris@39: #endif Chris@39: Chris@39: #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) Chris@39: #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" Chris@39: #endif Chris@39: Chris@39: /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ Chris@39: #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) Chris@39: /* DATA imports from DLLs on WIN32 con't be const, because runtime Chris@39: relocations are performed -- see ld's documentation on pseudo-relocs. */ Chris@39: # define LT_DLSYM_CONST Chris@39: #elif defined(__osf__) Chris@39: /* This system does not cope well with relocations in const data. */ Chris@39: # define LT_DLSYM_CONST Chris@39: #else Chris@39: # define LT_DLSYM_CONST const Chris@39: #endif Chris@39: Chris@39: /* External symbol declarations for the compiler. */\ Chris@39: " Chris@39: Chris@39: if test "$dlself" = yes; then Chris@39: func_verbose "generating symbol list for \`$output'" Chris@39: Chris@39: $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" Chris@39: Chris@39: # Add our own program objects to the symbol list. Chris@39: progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@39: for progfile in $progfiles; do Chris@39: func_to_tool_file "$progfile" func_convert_file_msys_to_w32 Chris@39: func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" Chris@39: $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" Chris@39: done Chris@39: Chris@39: if test -n "$exclude_expsyms"; then Chris@39: $opt_dry_run || { Chris@39: eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' Chris@39: eval '$MV "$nlist"T "$nlist"' Chris@39: } Chris@39: fi Chris@39: Chris@39: if test -n "$export_symbols_regex"; then Chris@39: $opt_dry_run || { Chris@39: eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' Chris@39: eval '$MV "$nlist"T "$nlist"' Chris@39: } Chris@39: fi Chris@39: Chris@39: # Prepare the list of exported symbols Chris@39: if test -z "$export_symbols"; then Chris@39: export_symbols="$output_objdir/$outputname.exp" Chris@39: $opt_dry_run || { Chris@39: $RM $export_symbols Chris@39: eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *cegcc* ) Chris@39: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' Chris@39: eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: else Chris@39: $opt_dry_run || { Chris@39: eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' Chris@39: eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' Chris@39: eval '$MV "$nlist"T "$nlist"' Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *cegcc* ) Chris@39: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' Chris@39: eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: fi Chris@39: fi Chris@39: Chris@39: for dlprefile in $dlprefiles; do Chris@39: func_verbose "extracting global C symbols from \`$dlprefile'" Chris@39: func_basename "$dlprefile" Chris@39: name="$func_basename_result" Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *cegcc* ) Chris@39: # if an import library, we need to obtain dlname Chris@39: if func_win32_import_lib_p "$dlprefile"; then Chris@39: func_tr_sh "$dlprefile" Chris@39: eval "curr_lafile=\$libfile_$func_tr_sh_result" Chris@39: dlprefile_dlbasename="" Chris@39: if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then Chris@39: # Use subshell, to avoid clobbering current variable values Chris@39: dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` Chris@39: if test -n "$dlprefile_dlname" ; then Chris@39: func_basename "$dlprefile_dlname" Chris@39: dlprefile_dlbasename="$func_basename_result" Chris@39: else Chris@39: # no lafile. user explicitly requested -dlpreopen . Chris@39: $sharedlib_from_linklib_cmd "$dlprefile" Chris@39: dlprefile_dlbasename=$sharedlib_from_linklib_result Chris@39: fi Chris@39: fi Chris@39: $opt_dry_run || { Chris@39: if test -n "$dlprefile_dlbasename" ; then Chris@39: eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' Chris@39: else Chris@39: func_warning "Could not compute DLL name from $name" Chris@39: eval '$ECHO ": $name " >> "$nlist"' Chris@39: fi Chris@39: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@39: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | Chris@39: $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" Chris@39: } Chris@39: else # not an import lib Chris@39: $opt_dry_run || { Chris@39: eval '$ECHO ": $name " >> "$nlist"' Chris@39: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@39: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" Chris@39: } Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: $opt_dry_run || { Chris@39: eval '$ECHO ": $name " >> "$nlist"' Chris@39: func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 Chris@39: eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" Chris@39: } Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: $opt_dry_run || { Chris@39: # Make sure we have at least an empty file. Chris@39: test -f "$nlist" || : > "$nlist" Chris@39: Chris@39: if test -n "$exclude_expsyms"; then Chris@39: $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T Chris@39: $MV "$nlist"T "$nlist" Chris@39: fi Chris@39: Chris@39: # Try sorting and uniquifying the output. Chris@39: if $GREP -v "^: " < "$nlist" | Chris@39: if sort -k 3 /dev/null 2>&1; then Chris@39: sort -k 3 Chris@39: else Chris@39: sort +2 Chris@39: fi | Chris@39: uniq > "$nlist"S; then Chris@39: : Chris@39: else Chris@39: $GREP -v "^: " < "$nlist" > "$nlist"S Chris@39: fi Chris@39: Chris@39: if test -f "$nlist"S; then Chris@39: eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' Chris@39: else Chris@39: echo '/* NONE */' >> "$output_objdir/$my_dlsyms" Chris@39: fi Chris@39: Chris@39: echo >> "$output_objdir/$my_dlsyms" "\ Chris@39: Chris@39: /* The mapping between symbol names and symbols. */ Chris@39: typedef struct { Chris@39: const char *name; Chris@39: void *address; Chris@39: } lt_dlsymlist; Chris@39: extern LT_DLSYM_CONST lt_dlsymlist Chris@39: lt_${my_prefix}_LTX_preloaded_symbols[]; Chris@39: LT_DLSYM_CONST lt_dlsymlist Chris@39: lt_${my_prefix}_LTX_preloaded_symbols[] = Chris@39: {\ Chris@39: { \"$my_originator\", (void *) 0 }," Chris@39: Chris@39: case $need_lib_prefix in Chris@39: no) Chris@39: eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" Chris@39: ;; Chris@39: *) Chris@39: eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" Chris@39: ;; Chris@39: esac Chris@39: echo >> "$output_objdir/$my_dlsyms" "\ Chris@39: {0, (void *) 0} Chris@39: }; Chris@39: Chris@39: /* This works around a problem in FreeBSD linker */ Chris@39: #ifdef FREEBSD_WORKAROUND Chris@39: static const void *lt_preloaded_setup() { Chris@39: return lt_${my_prefix}_LTX_preloaded_symbols; Chris@39: } Chris@39: #endif Chris@39: Chris@39: #ifdef __cplusplus Chris@39: } Chris@39: #endif\ Chris@39: " Chris@39: } # !$opt_dry_run Chris@39: Chris@39: pic_flag_for_symtable= Chris@39: case "$compile_command " in Chris@39: *" -static "*) ;; Chris@39: *) Chris@39: case $host in Chris@39: # compiling the symbol table file with pic_flag works around Chris@39: # a FreeBSD bug that causes programs to crash when -lm is Chris@39: # linked before any other PIC object. But we must not use Chris@39: # pic_flag when linking with -static. The problem exists in Chris@39: # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. Chris@39: *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) Chris@39: pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; Chris@39: *-*-hpux*) Chris@39: pic_flag_for_symtable=" $pic_flag" ;; Chris@39: *) Chris@39: if test "X$my_pic_p" != Xno; then Chris@39: pic_flag_for_symtable=" $pic_flag" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: symtab_cflags= Chris@39: for arg in $LTCFLAGS; do Chris@39: case $arg in Chris@39: -pie | -fpie | -fPIE) ;; Chris@39: *) func_append symtab_cflags " $arg" ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # Now compile the dynamic symbol file. Chris@39: func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' Chris@39: Chris@39: # Clean up the generated files. Chris@39: func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' Chris@39: Chris@39: # Transform the symbol file into the correct name. Chris@39: symfileobj="$output_objdir/${my_outputname}S.$objext" Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *cegcc* ) Chris@39: if test -f "$output_objdir/$my_outputname.def"; then Chris@39: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` Chris@39: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` Chris@39: else Chris@39: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@39: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@39: finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: *) Chris@39: func_fatal_error "unknown suffix for \`$my_dlsyms'" Chris@39: ;; Chris@39: esac Chris@39: else Chris@39: # We keep going just in case the user didn't refer to Chris@39: # lt_preloaded_symbols. The linker will fail if global_symbol_pipe Chris@39: # really was required. Chris@39: Chris@39: # Nullify the symbol file. Chris@39: compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` Chris@39: finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` Chris@39: fi Chris@39: } Chris@39: Chris@39: # func_win32_libid arg Chris@39: # return the library type of file 'arg' Chris@39: # Chris@39: # Need a lot of goo to handle *both* DLLs and import libs Chris@39: # Has to be a shell function in order to 'eat' the argument Chris@39: # that is supplied when $file_magic_command is called. Chris@39: # Despite the name, also deal with 64 bit binaries. Chris@39: func_win32_libid () Chris@39: { Chris@39: $opt_debug Chris@39: win32_libid_type="unknown" Chris@39: win32_fileres=`file -L $1 2>/dev/null` Chris@39: case $win32_fileres in Chris@39: *ar\ archive\ import\ library*) # definitely import Chris@39: win32_libid_type="x86 archive import" Chris@39: ;; Chris@39: *ar\ archive*) # could be an import, or static Chris@39: # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. Chris@39: if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | Chris@39: $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then Chris@39: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@39: win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | Chris@39: $SED -n -e ' Chris@39: 1,100{ Chris@39: / I /{ Chris@39: s,.*,import, Chris@39: p Chris@39: q Chris@39: } Chris@39: }'` Chris@39: case $win32_nmres in Chris@39: import*) win32_libid_type="x86 archive import";; Chris@39: *) win32_libid_type="x86 archive static";; Chris@39: esac Chris@39: fi Chris@39: ;; Chris@39: *DLL*) Chris@39: win32_libid_type="x86 DLL" Chris@39: ;; Chris@39: *executable*) # but shell scripts are "executable" too... Chris@39: case $win32_fileres in Chris@39: *MS\ Windows\ PE\ Intel*) Chris@39: win32_libid_type="x86 DLL" Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: $ECHO "$win32_libid_type" Chris@39: } Chris@39: Chris@39: # func_cygming_dll_for_implib ARG Chris@39: # Chris@39: # Platform-specific function to extract the Chris@39: # name of the DLL associated with the specified Chris@39: # import library ARG. Chris@39: # Invoked by eval'ing the libtool variable Chris@39: # $sharedlib_from_linklib_cmd Chris@39: # Result is available in the variable Chris@39: # $sharedlib_from_linklib_result Chris@39: func_cygming_dll_for_implib () Chris@39: { Chris@39: $opt_debug Chris@39: sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` Chris@39: } Chris@39: Chris@39: # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs Chris@39: # Chris@39: # The is the core of a fallback implementation of a Chris@39: # platform-specific function to extract the name of the Chris@39: # DLL associated with the specified import library LIBNAME. Chris@39: # Chris@39: # SECTION_NAME is either .idata$6 or .idata$7, depending Chris@39: # on the platform and compiler that created the implib. Chris@39: # Chris@39: # Echos the name of the DLL associated with the Chris@39: # specified import library. Chris@39: func_cygming_dll_for_implib_fallback_core () Chris@39: { Chris@39: $opt_debug Chris@39: match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` Chris@39: $OBJDUMP -s --section "$1" "$2" 2>/dev/null | Chris@39: $SED '/^Contents of section '"$match_literal"':/{ Chris@39: # Place marker at beginning of archive member dllname section Chris@39: s/.*/====MARK====/ Chris@39: p Chris@39: d Chris@39: } Chris@39: # These lines can sometimes be longer than 43 characters, but Chris@39: # are always uninteresting Chris@39: /:[ ]*file format pe[i]\{,1\}-/d Chris@39: /^In archive [^:]*:/d Chris@39: # Ensure marker is printed Chris@39: /^====MARK====/p Chris@39: # Remove all lines with less than 43 characters Chris@39: /^.\{43\}/!d Chris@39: # From remaining lines, remove first 43 characters Chris@39: s/^.\{43\}//' | Chris@39: $SED -n ' Chris@39: # Join marker and all lines until next marker into a single line Chris@39: /^====MARK====/ b para Chris@39: H Chris@39: $ b para Chris@39: b Chris@39: :para Chris@39: x Chris@39: s/\n//g Chris@39: # Remove the marker Chris@39: s/^====MARK====// Chris@39: # Remove trailing dots and whitespace Chris@39: s/[\. \t]*$// Chris@39: # Print Chris@39: /./p' | Chris@39: # we now have a list, one entry per line, of the stringified Chris@39: # contents of the appropriate section of all members of the Chris@39: # archive which possess that section. Heuristic: eliminate Chris@39: # all those which have a first or second character that is Chris@39: # a '.' (that is, objdump's representation of an unprintable Chris@39: # character.) This should work for all archives with less than Chris@39: # 0x302f exports -- but will fail for DLLs whose name actually Chris@39: # begins with a literal '.' or a single character followed by Chris@39: # a '.'. Chris@39: # Chris@39: # Of those that remain, print the first one. Chris@39: $SED -e '/^\./d;/^.\./d;q' Chris@39: } Chris@39: Chris@39: # func_cygming_gnu_implib_p ARG Chris@39: # This predicate returns with zero status (TRUE) if Chris@39: # ARG is a GNU/binutils-style import library. Returns Chris@39: # with nonzero status (FALSE) otherwise. Chris@39: func_cygming_gnu_implib_p () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@39: func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` Chris@39: test -n "$func_cygming_gnu_implib_tmp" Chris@39: } Chris@39: Chris@39: # func_cygming_ms_implib_p ARG Chris@39: # This predicate returns with zero status (TRUE) if Chris@39: # ARG is an MS-style import library. Returns Chris@39: # with nonzero status (FALSE) otherwise. Chris@39: func_cygming_ms_implib_p () Chris@39: { Chris@39: $opt_debug Chris@39: func_to_tool_file "$1" func_convert_file_msys_to_w32 Chris@39: func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` Chris@39: test -n "$func_cygming_ms_implib_tmp" Chris@39: } Chris@39: Chris@39: # func_cygming_dll_for_implib_fallback ARG Chris@39: # Platform-specific function to extract the Chris@39: # name of the DLL associated with the specified Chris@39: # import library ARG. Chris@39: # Chris@39: # This fallback implementation is for use when $DLLTOOL Chris@39: # does not support the --identify-strict option. Chris@39: # Invoked by eval'ing the libtool variable Chris@39: # $sharedlib_from_linklib_cmd Chris@39: # Result is available in the variable Chris@39: # $sharedlib_from_linklib_result Chris@39: func_cygming_dll_for_implib_fallback () Chris@39: { Chris@39: $opt_debug Chris@39: if func_cygming_gnu_implib_p "$1" ; then Chris@39: # binutils import library Chris@39: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` Chris@39: elif func_cygming_ms_implib_p "$1" ; then Chris@39: # ms-generated import library Chris@39: sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` Chris@39: else Chris@39: # unknown Chris@39: sharedlib_from_linklib_result="" Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # func_extract_an_archive dir oldlib Chris@39: func_extract_an_archive () Chris@39: { Chris@39: $opt_debug Chris@39: f_ex_an_ar_dir="$1"; shift Chris@39: f_ex_an_ar_oldlib="$1" Chris@39: if test "$lock_old_archive_extraction" = yes; then Chris@39: lockfile=$f_ex_an_ar_oldlib.lock Chris@39: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do Chris@39: func_echo "Waiting for $lockfile to be removed" Chris@39: sleep 2 Chris@39: done Chris@39: fi Chris@39: func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ Chris@39: 'stat=$?; rm -f "$lockfile"; exit $stat' Chris@39: if test "$lock_old_archive_extraction" = yes; then Chris@39: $opt_dry_run || rm -f "$lockfile" Chris@39: fi Chris@39: if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then Chris@39: : Chris@39: else Chris@39: func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" Chris@39: fi Chris@39: } Chris@39: Chris@39: Chris@39: # func_extract_archives gentop oldlib ... Chris@39: func_extract_archives () Chris@39: { Chris@39: $opt_debug Chris@39: my_gentop="$1"; shift Chris@39: my_oldlibs=${1+"$@"} Chris@39: my_oldobjs="" Chris@39: my_xlib="" Chris@39: my_xabs="" Chris@39: my_xdir="" Chris@39: Chris@39: for my_xlib in $my_oldlibs; do Chris@39: # Extract the objects. Chris@39: case $my_xlib in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; Chris@39: *) my_xabs=`pwd`"/$my_xlib" ;; Chris@39: esac Chris@39: func_basename "$my_xlib" Chris@39: my_xlib="$func_basename_result" Chris@39: my_xlib_u=$my_xlib Chris@39: while :; do Chris@39: case " $extracted_archives " in Chris@39: *" $my_xlib_u "*) Chris@39: func_arith $extracted_serial + 1 Chris@39: extracted_serial=$func_arith_result Chris@39: my_xlib_u=lt$extracted_serial-$my_xlib ;; Chris@39: *) break ;; Chris@39: esac Chris@39: done Chris@39: extracted_archives="$extracted_archives $my_xlib_u" Chris@39: my_xdir="$my_gentop/$my_xlib_u" Chris@39: Chris@39: func_mkdir_p "$my_xdir" Chris@39: Chris@39: case $host in Chris@39: *-darwin*) Chris@39: func_verbose "Extracting $my_xabs" Chris@39: # Do not bother doing anything if just a dry run Chris@39: $opt_dry_run || { Chris@39: darwin_orig_dir=`pwd` Chris@39: cd $my_xdir || exit $? Chris@39: darwin_archive=$my_xabs Chris@39: darwin_curdir=`pwd` Chris@39: darwin_base_archive=`basename "$darwin_archive"` Chris@39: darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` Chris@39: if test -n "$darwin_arches"; then Chris@39: darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` Chris@39: darwin_arch= Chris@39: func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" Chris@39: for darwin_arch in $darwin_arches ; do Chris@39: func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" Chris@39: $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" Chris@39: cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" Chris@39: func_extract_an_archive "`pwd`" "${darwin_base_archive}" Chris@39: cd "$darwin_curdir" Chris@39: $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" Chris@39: done # $darwin_arches Chris@39: ## Okay now we've a bunch of thin objects, gotta fatten them up :) Chris@39: darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` Chris@39: darwin_file= Chris@39: darwin_files= Chris@39: for darwin_file in $darwin_filelist; do Chris@39: darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` Chris@39: $LIPO -create -output "$darwin_file" $darwin_files Chris@39: done # $darwin_filelist Chris@39: $RM -rf unfat-$$ Chris@39: cd "$darwin_orig_dir" Chris@39: else Chris@39: cd $darwin_orig_dir Chris@39: func_extract_an_archive "$my_xdir" "$my_xabs" Chris@39: fi # $darwin_arches Chris@39: } # !$opt_dry_run Chris@39: ;; Chris@39: *) Chris@39: func_extract_an_archive "$my_xdir" "$my_xabs" Chris@39: ;; Chris@39: esac Chris@39: my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` Chris@39: done Chris@39: Chris@39: func_extract_archives_result="$my_oldobjs" Chris@39: } Chris@39: Chris@39: Chris@39: # func_emit_wrapper [arg=no] Chris@39: # Chris@39: # Emit a libtool wrapper script on stdout. Chris@39: # Don't directly open a file because we may want to Chris@39: # incorporate the script contents within a cygwin/mingw Chris@39: # wrapper executable. Must ONLY be called from within Chris@39: # func_mode_link because it depends on a number of variables Chris@39: # set therein. Chris@39: # Chris@39: # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR Chris@39: # variable will take. If 'yes', then the emitted script Chris@39: # will assume that the directory in which it is stored is Chris@39: # the $objdir directory. This is a cygwin/mingw-specific Chris@39: # behavior. Chris@39: func_emit_wrapper () Chris@39: { Chris@39: func_emit_wrapper_arg1=${1-no} Chris@39: Chris@39: $ECHO "\ Chris@39: #! $SHELL Chris@39: Chris@39: # $output - temporary wrapper script for $objdir/$outputname Chris@39: # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION Chris@39: # Chris@39: # The $output program cannot be directly executed until all the libtool Chris@39: # libraries that it depends on are installed. Chris@39: # Chris@39: # This wrapper script should never be moved out of the build directory. Chris@39: # If it is, it will not operate correctly. Chris@39: Chris@39: # Sed substitution that helps us do robust quoting. It backslashifies Chris@39: # metacharacters that are still active within double-quoted strings. Chris@39: sed_quote_subst='$sed_quote_subst' Chris@39: Chris@39: # Be Bourne compatible Chris@39: if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then Chris@39: emulate sh Chris@39: NULLCMD=: Chris@39: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which Chris@39: # is contrary to our usage. Disable this feature. Chris@39: alias -g '\${1+\"\$@\"}'='\"\$@\"' Chris@39: setopt NO_GLOB_SUBST Chris@39: else Chris@39: case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac Chris@39: fi Chris@39: BIN_SH=xpg4; export BIN_SH # for Tru64 Chris@39: DUALCASE=1; export DUALCASE # for MKS sh Chris@39: Chris@39: # The HP-UX ksh and POSIX shell print the target directory to stdout Chris@39: # if CDPATH is set. Chris@39: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH Chris@39: Chris@39: relink_command=\"$relink_command\" Chris@39: Chris@39: # This environment variable determines our operation mode. Chris@39: if test \"\$libtool_install_magic\" = \"$magic\"; then Chris@39: # install mode needs the following variables: Chris@39: generated_by_libtool_version='$macro_version' Chris@39: notinst_deplibs='$notinst_deplibs' Chris@39: else Chris@39: # When we are sourced in execute mode, \$file and \$ECHO are already set. Chris@39: if test \"\$libtool_execute_magic\" != \"$magic\"; then Chris@39: file=\"\$0\"" Chris@39: Chris@39: qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` Chris@39: $ECHO "\ Chris@39: Chris@39: # A function that is used when there is no print builtin or printf. Chris@39: func_fallback_echo () Chris@39: { Chris@39: eval 'cat <<_LTECHO_EOF Chris@39: \$1 Chris@39: _LTECHO_EOF' Chris@39: } Chris@39: ECHO=\"$qECHO\" Chris@39: fi Chris@39: Chris@39: # Very basic option parsing. These options are (a) specific to Chris@39: # the libtool wrapper, (b) are identical between the wrapper Chris@39: # /script/ and the wrapper /executable/ which is used only on Chris@39: # windows platforms, and (c) all begin with the string "--lt-" Chris@39: # (application programs are unlikely to have options which match Chris@39: # this pattern). Chris@39: # Chris@39: # There are only two supported options: --lt-debug and Chris@39: # --lt-dump-script. There is, deliberately, no --lt-help. Chris@39: # Chris@39: # The first argument to this parsing function should be the Chris@39: # script's $0 value, followed by "$@". Chris@39: lt_option_debug= Chris@39: func_parse_lt_options () Chris@39: { Chris@39: lt_script_arg0=\$0 Chris@39: shift Chris@39: for lt_opt Chris@39: do Chris@39: case \"\$lt_opt\" in Chris@39: --lt-debug) lt_option_debug=1 ;; Chris@39: --lt-dump-script) Chris@39: lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` Chris@39: test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. Chris@39: lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` Chris@39: cat \"\$lt_dump_D/\$lt_dump_F\" Chris@39: exit 0 Chris@39: ;; Chris@39: --lt-*) Chris@39: \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 Chris@39: exit 1 Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # Print the debug banner immediately: Chris@39: if test -n \"\$lt_option_debug\"; then Chris@39: echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 Chris@39: fi Chris@39: } Chris@39: Chris@39: # Used when --lt-debug. Prints its arguments to stdout Chris@39: # (redirection is the responsibility of the caller) Chris@39: func_lt_dump_args () Chris@39: { Chris@39: lt_dump_args_N=1; Chris@39: for lt_arg Chris@39: do Chris@39: \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" Chris@39: lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` Chris@39: done Chris@39: } Chris@39: Chris@39: # Core function for launching the target application Chris@39: func_exec_program_core () Chris@39: { Chris@39: " Chris@39: case $host in Chris@39: # Backslashes separate directories on plain windows Chris@39: *-*-mingw | *-*-os2* | *-cegcc*) Chris@39: $ECHO "\ Chris@39: if test -n \"\$lt_option_debug\"; then Chris@39: \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 Chris@39: func_lt_dump_args \${1+\"\$@\"} 1>&2 Chris@39: fi Chris@39: exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} Chris@39: " Chris@39: ;; Chris@39: Chris@39: *) Chris@39: $ECHO "\ Chris@39: if test -n \"\$lt_option_debug\"; then Chris@39: \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 Chris@39: func_lt_dump_args \${1+\"\$@\"} 1>&2 Chris@39: fi Chris@39: exec \"\$progdir/\$program\" \${1+\"\$@\"} Chris@39: " Chris@39: ;; Chris@39: esac Chris@39: $ECHO "\ Chris@39: \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 Chris@39: exit 1 Chris@39: } Chris@39: Chris@39: # A function to encapsulate launching the target application Chris@39: # Strips options in the --lt-* namespace from \$@ and Chris@39: # launches target application with the remaining arguments. Chris@39: func_exec_program () Chris@39: { Chris@39: for lt_wr_arg Chris@39: do Chris@39: case \$lt_wr_arg in Chris@39: --lt-*) ;; Chris@39: *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; Chris@39: esac Chris@39: shift Chris@39: done Chris@39: func_exec_program_core \${1+\"\$@\"} Chris@39: } Chris@39: Chris@39: # Parse options Chris@39: func_parse_lt_options \"\$0\" \${1+\"\$@\"} Chris@39: Chris@39: # Find the directory that this script lives in. Chris@39: thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` Chris@39: test \"x\$thisdir\" = \"x\$file\" && thisdir=. Chris@39: Chris@39: # Follow symbolic links until we get to the real thisdir. Chris@39: file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` Chris@39: while test -n \"\$file\"; do Chris@39: destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` Chris@39: Chris@39: # If there was a directory component, then change thisdir. Chris@39: if test \"x\$destdir\" != \"x\$file\"; then Chris@39: case \"\$destdir\" in Chris@39: [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; Chris@39: *) thisdir=\"\$thisdir/\$destdir\" ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` Chris@39: file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` Chris@39: done Chris@39: Chris@39: # Usually 'no', except on cygwin/mingw when embedded into Chris@39: # the cwrapper. Chris@39: WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 Chris@39: if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then Chris@39: # special case for '.' Chris@39: if test \"\$thisdir\" = \".\"; then Chris@39: thisdir=\`pwd\` Chris@39: fi Chris@39: # remove .libs from thisdir Chris@39: case \"\$thisdir\" in Chris@39: *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; Chris@39: $objdir ) thisdir=. ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: # Try to get the absolute directory name. Chris@39: absdir=\`cd \"\$thisdir\" && pwd\` Chris@39: test -n \"\$absdir\" && thisdir=\"\$absdir\" Chris@39: " Chris@39: Chris@39: if test "$fast_install" = yes; then Chris@39: $ECHO "\ Chris@39: program=lt-'$outputname'$exeext Chris@39: progdir=\"\$thisdir/$objdir\" Chris@39: Chris@39: if test ! -f \"\$progdir/\$program\" || Chris@39: { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ Chris@39: test \"X\$file\" != \"X\$progdir/\$program\"; }; then Chris@39: Chris@39: file=\"\$\$-\$program\" Chris@39: Chris@39: if test ! -d \"\$progdir\"; then Chris@39: $MKDIR \"\$progdir\" Chris@39: else Chris@39: $RM \"\$progdir/\$file\" Chris@39: fi" Chris@39: Chris@39: $ECHO "\ Chris@39: Chris@39: # relink executable if necessary Chris@39: if test -n \"\$relink_command\"; then Chris@39: if relink_command_output=\`eval \$relink_command 2>&1\`; then : Chris@39: else Chris@39: $ECHO \"\$relink_command_output\" >&2 Chris@39: $RM \"\$progdir/\$file\" Chris@39: exit 1 Chris@39: fi Chris@39: fi Chris@39: Chris@39: $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || Chris@39: { $RM \"\$progdir/\$program\"; Chris@39: $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } Chris@39: $RM \"\$progdir/\$file\" Chris@39: fi" Chris@39: else Chris@39: $ECHO "\ Chris@39: program='$outputname' Chris@39: progdir=\"\$thisdir/$objdir\" Chris@39: " Chris@39: fi Chris@39: Chris@39: $ECHO "\ Chris@39: Chris@39: if test -f \"\$progdir/\$program\"; then" Chris@39: Chris@39: # fixup the dll searchpath if we need to. Chris@39: # Chris@39: # Fix the DLL searchpath if we need to. Do this before prepending Chris@39: # to shlibpath, because on Windows, both are PATH and uninstalled Chris@39: # libraries must come first. Chris@39: if test -n "$dllsearchpath"; then Chris@39: $ECHO "\ Chris@39: # Add the dll search path components to the executable PATH Chris@39: PATH=$dllsearchpath:\$PATH Chris@39: " Chris@39: fi Chris@39: Chris@39: # Export our shlibpath_var if we have one. Chris@39: if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then Chris@39: $ECHO "\ Chris@39: # Add our own library path to $shlibpath_var Chris@39: $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" Chris@39: Chris@39: # Some systems cannot cope with colon-terminated $shlibpath_var Chris@39: # The second colon is a workaround for a bug in BeOS R4 sed Chris@39: $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` Chris@39: Chris@39: export $shlibpath_var Chris@39: " Chris@39: fi Chris@39: Chris@39: $ECHO "\ Chris@39: if test \"\$libtool_execute_magic\" != \"$magic\"; then Chris@39: # Run the actual program with our arguments. Chris@39: func_exec_program \${1+\"\$@\"} Chris@39: fi Chris@39: else Chris@39: # The program doesn't exist. Chris@39: \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 Chris@39: \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 Chris@39: \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 Chris@39: exit 1 Chris@39: fi Chris@39: fi\ Chris@39: " Chris@39: } Chris@39: Chris@39: Chris@39: # func_emit_cwrapperexe_src Chris@39: # emit the source code for a wrapper executable on stdout Chris@39: # Must ONLY be called from within func_mode_link because Chris@39: # it depends on a number of variable set therein. Chris@39: func_emit_cwrapperexe_src () Chris@39: { Chris@39: cat < Chris@39: #include Chris@39: #ifdef _MSC_VER Chris@39: # include Chris@39: # include Chris@39: # include Chris@39: #else Chris@39: # include Chris@39: # include Chris@39: # ifdef __CYGWIN__ Chris@39: # include Chris@39: # endif Chris@39: #endif Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: #include Chris@39: Chris@39: /* declarations of non-ANSI functions */ Chris@39: #if defined(__MINGW32__) Chris@39: # ifdef __STRICT_ANSI__ Chris@39: int _putenv (const char *); Chris@39: # endif Chris@39: #elif defined(__CYGWIN__) Chris@39: # ifdef __STRICT_ANSI__ Chris@39: char *realpath (const char *, char *); Chris@39: int putenv (char *); Chris@39: int setenv (const char *, const char *, int); Chris@39: # endif Chris@39: /* #elif defined (other platforms) ... */ Chris@39: #endif Chris@39: Chris@39: /* portability defines, excluding path handling macros */ Chris@39: #if defined(_MSC_VER) Chris@39: # define setmode _setmode Chris@39: # define stat _stat Chris@39: # define chmod _chmod Chris@39: # define getcwd _getcwd Chris@39: # define putenv _putenv Chris@39: # define S_IXUSR _S_IEXEC Chris@39: # ifndef _INTPTR_T_DEFINED Chris@39: # define _INTPTR_T_DEFINED Chris@39: # define intptr_t int Chris@39: # endif Chris@39: #elif defined(__MINGW32__) Chris@39: # define setmode _setmode Chris@39: # define stat _stat Chris@39: # define chmod _chmod Chris@39: # define getcwd _getcwd Chris@39: # define putenv _putenv Chris@39: #elif defined(__CYGWIN__) Chris@39: # define HAVE_SETENV Chris@39: # define FOPEN_WB "wb" Chris@39: /* #elif defined (other platforms) ... */ Chris@39: #endif Chris@39: Chris@39: #if defined(PATH_MAX) Chris@39: # define LT_PATHMAX PATH_MAX Chris@39: #elif defined(MAXPATHLEN) Chris@39: # define LT_PATHMAX MAXPATHLEN Chris@39: #else Chris@39: # define LT_PATHMAX 1024 Chris@39: #endif Chris@39: Chris@39: #ifndef S_IXOTH Chris@39: # define S_IXOTH 0 Chris@39: #endif Chris@39: #ifndef S_IXGRP Chris@39: # define S_IXGRP 0 Chris@39: #endif Chris@39: Chris@39: /* path handling portability macros */ Chris@39: #ifndef DIR_SEPARATOR Chris@39: # define DIR_SEPARATOR '/' Chris@39: # define PATH_SEPARATOR ':' Chris@39: #endif Chris@39: Chris@39: #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ Chris@39: defined (__OS2__) Chris@39: # define HAVE_DOS_BASED_FILE_SYSTEM Chris@39: # define FOPEN_WB "wb" Chris@39: # ifndef DIR_SEPARATOR_2 Chris@39: # define DIR_SEPARATOR_2 '\\' Chris@39: # endif Chris@39: # ifndef PATH_SEPARATOR_2 Chris@39: # define PATH_SEPARATOR_2 ';' Chris@39: # endif Chris@39: #endif Chris@39: Chris@39: #ifndef DIR_SEPARATOR_2 Chris@39: # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) Chris@39: #else /* DIR_SEPARATOR_2 */ Chris@39: # define IS_DIR_SEPARATOR(ch) \ Chris@39: (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) Chris@39: #endif /* DIR_SEPARATOR_2 */ Chris@39: Chris@39: #ifndef PATH_SEPARATOR_2 Chris@39: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) Chris@39: #else /* PATH_SEPARATOR_2 */ Chris@39: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) Chris@39: #endif /* PATH_SEPARATOR_2 */ Chris@39: Chris@39: #ifndef FOPEN_WB Chris@39: # define FOPEN_WB "w" Chris@39: #endif Chris@39: #ifndef _O_BINARY Chris@39: # define _O_BINARY 0 Chris@39: #endif Chris@39: Chris@39: #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) Chris@39: #define XFREE(stale) do { \ Chris@39: if (stale) { free ((void *) stale); stale = 0; } \ Chris@39: } while (0) Chris@39: Chris@39: #if defined(LT_DEBUGWRAPPER) Chris@39: static int lt_debug = 1; Chris@39: #else Chris@39: static int lt_debug = 0; Chris@39: #endif Chris@39: Chris@39: const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ Chris@39: Chris@39: void *xmalloc (size_t num); Chris@39: char *xstrdup (const char *string); Chris@39: const char *base_name (const char *name); Chris@39: char *find_executable (const char *wrapper); Chris@39: char *chase_symlinks (const char *pathspec); Chris@39: int make_executable (const char *path); Chris@39: int check_executable (const char *path); Chris@39: char *strendzap (char *str, const char *pat); Chris@39: void lt_debugprintf (const char *file, int line, const char *fmt, ...); Chris@39: void lt_fatal (const char *file, int line, const char *message, ...); Chris@39: static const char *nonnull (const char *s); Chris@39: static const char *nonempty (const char *s); Chris@39: void lt_setenv (const char *name, const char *value); Chris@39: char *lt_extend_str (const char *orig_value, const char *add, int to_end); Chris@39: void lt_update_exe_path (const char *name, const char *value); Chris@39: void lt_update_lib_path (const char *name, const char *value); Chris@39: char **prepare_spawn (char **argv); Chris@39: void lt_dump_script (FILE *f); Chris@39: EOF Chris@39: Chris@39: cat <= 0) Chris@39: && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) Chris@39: return 1; Chris@39: else Chris@39: return 0; Chris@39: } Chris@39: Chris@39: int Chris@39: make_executable (const char *path) Chris@39: { Chris@39: int rval = 0; Chris@39: struct stat st; Chris@39: Chris@39: lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", Chris@39: nonempty (path)); Chris@39: if ((!path) || (!*path)) Chris@39: return 0; Chris@39: Chris@39: if (stat (path, &st) >= 0) Chris@39: { Chris@39: rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); Chris@39: } Chris@39: return rval; Chris@39: } Chris@39: Chris@39: /* Searches for the full path of the wrapper. Returns Chris@39: newly allocated full path name if found, NULL otherwise Chris@39: Does not chase symlinks, even on platforms that support them. Chris@39: */ Chris@39: char * Chris@39: find_executable (const char *wrapper) Chris@39: { Chris@39: int has_slash = 0; Chris@39: const char *p; Chris@39: const char *p_next; Chris@39: /* static buffer for getcwd */ Chris@39: char tmp[LT_PATHMAX + 1]; Chris@39: int tmp_len; Chris@39: char *concat_name; Chris@39: Chris@39: lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", Chris@39: nonempty (wrapper)); Chris@39: Chris@39: if ((wrapper == NULL) || (*wrapper == '\0')) Chris@39: return NULL; Chris@39: Chris@39: /* Absolute path? */ Chris@39: #if defined (HAVE_DOS_BASED_FILE_SYSTEM) Chris@39: if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') Chris@39: { Chris@39: concat_name = xstrdup (wrapper); Chris@39: if (check_executable (concat_name)) Chris@39: return concat_name; Chris@39: XFREE (concat_name); Chris@39: } Chris@39: else Chris@39: { Chris@39: #endif Chris@39: if (IS_DIR_SEPARATOR (wrapper[0])) Chris@39: { Chris@39: concat_name = xstrdup (wrapper); Chris@39: if (check_executable (concat_name)) Chris@39: return concat_name; Chris@39: XFREE (concat_name); Chris@39: } Chris@39: #if defined (HAVE_DOS_BASED_FILE_SYSTEM) Chris@39: } Chris@39: #endif Chris@39: Chris@39: for (p = wrapper; *p; p++) Chris@39: if (*p == '/') Chris@39: { Chris@39: has_slash = 1; Chris@39: break; Chris@39: } Chris@39: if (!has_slash) Chris@39: { Chris@39: /* no slashes; search PATH */ Chris@39: const char *path = getenv ("PATH"); Chris@39: if (path != NULL) Chris@39: { Chris@39: for (p = path; *p; p = p_next) Chris@39: { Chris@39: const char *q; Chris@39: size_t p_len; Chris@39: for (q = p; *q; q++) Chris@39: if (IS_PATH_SEPARATOR (*q)) Chris@39: break; Chris@39: p_len = q - p; Chris@39: p_next = (*q == '\0' ? q : q + 1); Chris@39: if (p_len == 0) Chris@39: { Chris@39: /* empty path: current directory */ Chris@39: if (getcwd (tmp, LT_PATHMAX) == NULL) Chris@39: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", Chris@39: nonnull (strerror (errno))); Chris@39: tmp_len = strlen (tmp); Chris@39: concat_name = Chris@39: XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); Chris@39: memcpy (concat_name, tmp, tmp_len); Chris@39: concat_name[tmp_len] = '/'; Chris@39: strcpy (concat_name + tmp_len + 1, wrapper); Chris@39: } Chris@39: else Chris@39: { Chris@39: concat_name = Chris@39: XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); Chris@39: memcpy (concat_name, p, p_len); Chris@39: concat_name[p_len] = '/'; Chris@39: strcpy (concat_name + p_len + 1, wrapper); Chris@39: } Chris@39: if (check_executable (concat_name)) Chris@39: return concat_name; Chris@39: XFREE (concat_name); Chris@39: } Chris@39: } Chris@39: /* not found in PATH; assume curdir */ Chris@39: } Chris@39: /* Relative path | not found in path: prepend cwd */ Chris@39: if (getcwd (tmp, LT_PATHMAX) == NULL) Chris@39: lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", Chris@39: nonnull (strerror (errno))); Chris@39: tmp_len = strlen (tmp); Chris@39: concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); Chris@39: memcpy (concat_name, tmp, tmp_len); Chris@39: concat_name[tmp_len] = '/'; Chris@39: strcpy (concat_name + tmp_len + 1, wrapper); Chris@39: Chris@39: if (check_executable (concat_name)) Chris@39: return concat_name; Chris@39: XFREE (concat_name); Chris@39: return NULL; Chris@39: } Chris@39: Chris@39: char * Chris@39: chase_symlinks (const char *pathspec) Chris@39: { Chris@39: #ifndef S_ISLNK Chris@39: return xstrdup (pathspec); Chris@39: #else Chris@39: char buf[LT_PATHMAX]; Chris@39: struct stat s; Chris@39: char *tmp_pathspec = xstrdup (pathspec); Chris@39: char *p; Chris@39: int has_symlinks = 0; Chris@39: while (strlen (tmp_pathspec) && !has_symlinks) Chris@39: { Chris@39: lt_debugprintf (__FILE__, __LINE__, Chris@39: "checking path component for symlinks: %s\n", Chris@39: tmp_pathspec); Chris@39: if (lstat (tmp_pathspec, &s) == 0) Chris@39: { Chris@39: if (S_ISLNK (s.st_mode) != 0) Chris@39: { Chris@39: has_symlinks = 1; Chris@39: break; Chris@39: } Chris@39: Chris@39: /* search backwards for last DIR_SEPARATOR */ Chris@39: p = tmp_pathspec + strlen (tmp_pathspec) - 1; Chris@39: while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) Chris@39: p--; Chris@39: if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) Chris@39: { Chris@39: /* no more DIR_SEPARATORS left */ Chris@39: break; Chris@39: } Chris@39: *p = '\0'; Chris@39: } Chris@39: else Chris@39: { Chris@39: lt_fatal (__FILE__, __LINE__, Chris@39: "error accessing file \"%s\": %s", Chris@39: tmp_pathspec, nonnull (strerror (errno))); Chris@39: } Chris@39: } Chris@39: XFREE (tmp_pathspec); Chris@39: Chris@39: if (!has_symlinks) Chris@39: { Chris@39: return xstrdup (pathspec); Chris@39: } Chris@39: Chris@39: tmp_pathspec = realpath (pathspec, buf); Chris@39: if (tmp_pathspec == 0) Chris@39: { Chris@39: lt_fatal (__FILE__, __LINE__, Chris@39: "could not follow symlinks for %s", pathspec); Chris@39: } Chris@39: return xstrdup (tmp_pathspec); Chris@39: #endif Chris@39: } Chris@39: Chris@39: char * Chris@39: strendzap (char *str, const char *pat) Chris@39: { Chris@39: size_t len, patlen; Chris@39: Chris@39: assert (str != NULL); Chris@39: assert (pat != NULL); Chris@39: Chris@39: len = strlen (str); Chris@39: patlen = strlen (pat); Chris@39: Chris@39: if (patlen <= len) Chris@39: { Chris@39: str += len - patlen; Chris@39: if (strcmp (str, pat) == 0) Chris@39: *str = '\0'; Chris@39: } Chris@39: return str; Chris@39: } Chris@39: Chris@39: void Chris@39: lt_debugprintf (const char *file, int line, const char *fmt, ...) Chris@39: { Chris@39: va_list args; Chris@39: if (lt_debug) Chris@39: { Chris@39: (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); Chris@39: va_start (args, fmt); Chris@39: (void) vfprintf (stderr, fmt, args); Chris@39: va_end (args); Chris@39: } Chris@39: } Chris@39: Chris@39: static void Chris@39: lt_error_core (int exit_status, const char *file, Chris@39: int line, const char *mode, Chris@39: const char *message, va_list ap) Chris@39: { Chris@39: fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); Chris@39: vfprintf (stderr, message, ap); Chris@39: fprintf (stderr, ".\n"); Chris@39: Chris@39: if (exit_status >= 0) Chris@39: exit (exit_status); Chris@39: } Chris@39: Chris@39: void Chris@39: lt_fatal (const char *file, int line, const char *message, ...) Chris@39: { Chris@39: va_list ap; Chris@39: va_start (ap, message); Chris@39: lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); Chris@39: va_end (ap); Chris@39: } Chris@39: Chris@39: static const char * Chris@39: nonnull (const char *s) Chris@39: { Chris@39: return s ? s : "(null)"; Chris@39: } Chris@39: Chris@39: static const char * Chris@39: nonempty (const char *s) Chris@39: { Chris@39: return (s && !*s) ? "(empty)" : nonnull (s); Chris@39: } Chris@39: Chris@39: void Chris@39: lt_setenv (const char *name, const char *value) Chris@39: { Chris@39: lt_debugprintf (__FILE__, __LINE__, Chris@39: "(lt_setenv) setting '%s' to '%s'\n", Chris@39: nonnull (name), nonnull (value)); Chris@39: { Chris@39: #ifdef HAVE_SETENV Chris@39: /* always make a copy, for consistency with !HAVE_SETENV */ Chris@39: char *str = xstrdup (value); Chris@39: setenv (name, str, 1); Chris@39: #else Chris@39: int len = strlen (name) + 1 + strlen (value) + 1; Chris@39: char *str = XMALLOC (char, len); Chris@39: sprintf (str, "%s=%s", name, value); Chris@39: if (putenv (str) != EXIT_SUCCESS) Chris@39: { Chris@39: XFREE (str); Chris@39: } Chris@39: #endif Chris@39: } Chris@39: } Chris@39: Chris@39: char * Chris@39: lt_extend_str (const char *orig_value, const char *add, int to_end) Chris@39: { Chris@39: char *new_value; Chris@39: if (orig_value && *orig_value) Chris@39: { Chris@39: int orig_value_len = strlen (orig_value); Chris@39: int add_len = strlen (add); Chris@39: new_value = XMALLOC (char, add_len + orig_value_len + 1); Chris@39: if (to_end) Chris@39: { Chris@39: strcpy (new_value, orig_value); Chris@39: strcpy (new_value + orig_value_len, add); Chris@39: } Chris@39: else Chris@39: { Chris@39: strcpy (new_value, add); Chris@39: strcpy (new_value + add_len, orig_value); Chris@39: } Chris@39: } Chris@39: else Chris@39: { Chris@39: new_value = xstrdup (add); Chris@39: } Chris@39: return new_value; Chris@39: } Chris@39: Chris@39: void Chris@39: lt_update_exe_path (const char *name, const char *value) Chris@39: { Chris@39: lt_debugprintf (__FILE__, __LINE__, Chris@39: "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", Chris@39: nonnull (name), nonnull (value)); Chris@39: Chris@39: if (name && *name && value && *value) Chris@39: { Chris@39: char *new_value = lt_extend_str (getenv (name), value, 0); Chris@39: /* some systems can't cope with a ':'-terminated path #' */ Chris@39: int len = strlen (new_value); Chris@39: while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) Chris@39: { Chris@39: new_value[len-1] = '\0'; Chris@39: } Chris@39: lt_setenv (name, new_value); Chris@39: XFREE (new_value); Chris@39: } Chris@39: } Chris@39: Chris@39: void Chris@39: lt_update_lib_path (const char *name, const char *value) Chris@39: { Chris@39: lt_debugprintf (__FILE__, __LINE__, Chris@39: "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", Chris@39: nonnull (name), nonnull (value)); Chris@39: Chris@39: if (name && *name && value && *value) Chris@39: { Chris@39: char *new_value = lt_extend_str (getenv (name), value, 0); Chris@39: lt_setenv (name, new_value); Chris@39: XFREE (new_value); Chris@39: } Chris@39: } Chris@39: Chris@39: EOF Chris@39: case $host_os in Chris@39: mingw*) Chris@39: cat <<"EOF" Chris@39: Chris@39: /* Prepares an argument vector before calling spawn(). Chris@39: Note that spawn() does not by itself call the command interpreter Chris@39: (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : Chris@39: ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); Chris@39: GetVersionEx(&v); Chris@39: v.dwPlatformId == VER_PLATFORM_WIN32_NT; Chris@39: }) ? "cmd.exe" : "command.com"). Chris@39: Instead it simply concatenates the arguments, separated by ' ', and calls Chris@39: CreateProcess(). We must quote the arguments since Win32 CreateProcess() Chris@39: interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a Chris@39: special way: Chris@39: - Space and tab are interpreted as delimiters. They are not treated as Chris@39: delimiters if they are surrounded by double quotes: "...". Chris@39: - Unescaped double quotes are removed from the input. Their only effect is Chris@39: that within double quotes, space and tab are treated like normal Chris@39: characters. Chris@39: - Backslashes not followed by double quotes are not special. Chris@39: - But 2*n+1 backslashes followed by a double quote become Chris@39: n backslashes followed by a double quote (n >= 0): Chris@39: \" -> " Chris@39: \\\" -> \" Chris@39: \\\\\" -> \\" Chris@39: */ Chris@39: #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" Chris@39: #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" Chris@39: char ** Chris@39: prepare_spawn (char **argv) Chris@39: { Chris@39: size_t argc; Chris@39: char **new_argv; Chris@39: size_t i; Chris@39: Chris@39: /* Count number of arguments. */ Chris@39: for (argc = 0; argv[argc] != NULL; argc++) Chris@39: ; Chris@39: Chris@39: /* Allocate new argument vector. */ Chris@39: new_argv = XMALLOC (char *, argc + 1); Chris@39: Chris@39: /* Put quoted arguments into the new argument vector. */ Chris@39: for (i = 0; i < argc; i++) Chris@39: { Chris@39: const char *string = argv[i]; Chris@39: Chris@39: if (string[0] == '\0') Chris@39: new_argv[i] = xstrdup ("\"\""); Chris@39: else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) Chris@39: { Chris@39: int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); Chris@39: size_t length; Chris@39: unsigned int backslashes; Chris@39: const char *s; Chris@39: char *quoted_string; Chris@39: char *p; Chris@39: Chris@39: length = 0; Chris@39: backslashes = 0; Chris@39: if (quote_around) Chris@39: length++; Chris@39: for (s = string; *s != '\0'; s++) Chris@39: { Chris@39: char c = *s; Chris@39: if (c == '"') Chris@39: length += backslashes + 1; Chris@39: length++; Chris@39: if (c == '\\') Chris@39: backslashes++; Chris@39: else Chris@39: backslashes = 0; Chris@39: } Chris@39: if (quote_around) Chris@39: length += backslashes + 1; Chris@39: Chris@39: quoted_string = XMALLOC (char, length + 1); Chris@39: Chris@39: p = quoted_string; Chris@39: backslashes = 0; Chris@39: if (quote_around) Chris@39: *p++ = '"'; Chris@39: for (s = string; *s != '\0'; s++) Chris@39: { Chris@39: char c = *s; Chris@39: if (c == '"') Chris@39: { Chris@39: unsigned int j; Chris@39: for (j = backslashes + 1; j > 0; j--) Chris@39: *p++ = '\\'; Chris@39: } Chris@39: *p++ = c; Chris@39: if (c == '\\') Chris@39: backslashes++; Chris@39: else Chris@39: backslashes = 0; Chris@39: } Chris@39: if (quote_around) Chris@39: { Chris@39: unsigned int j; Chris@39: for (j = backslashes; j > 0; j--) Chris@39: *p++ = '\\'; Chris@39: *p++ = '"'; Chris@39: } Chris@39: *p = '\0'; Chris@39: Chris@39: new_argv[i] = quoted_string; Chris@39: } Chris@39: else Chris@39: new_argv[i] = (char *) string; Chris@39: } Chris@39: new_argv[argc] = NULL; Chris@39: Chris@39: return new_argv; Chris@39: } Chris@39: EOF Chris@39: ;; Chris@39: esac Chris@39: Chris@39: cat <<"EOF" Chris@39: void lt_dump_script (FILE* f) Chris@39: { Chris@39: EOF Chris@39: func_emit_wrapper yes | Chris@39: $SED -e 's/\([\\"]\)/\\\1/g' \ Chris@39: -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' Chris@39: Chris@39: cat <<"EOF" Chris@39: } Chris@39: EOF Chris@39: } Chris@39: # end: func_emit_cwrapperexe_src Chris@39: Chris@39: # func_win32_import_lib_p ARG Chris@39: # True if ARG is an import lib, as indicated by $file_magic_cmd Chris@39: func_win32_import_lib_p () Chris@39: { Chris@39: $opt_debug Chris@39: case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in Chris@39: *import*) : ;; Chris@39: *) false ;; Chris@39: esac Chris@39: } Chris@39: Chris@39: # func_mode_link arg... Chris@39: func_mode_link () Chris@39: { Chris@39: $opt_debug Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@39: # It is impossible to link a dll without this setting, and Chris@39: # we shouldn't force the makefile maintainer to figure out Chris@39: # which system we are compiling for in order to pass an extra Chris@39: # flag for every libtool invocation. Chris@39: # allow_undefined=no Chris@39: Chris@39: # FIXME: Unfortunately, there are problems with the above when trying Chris@39: # to make a dll which has undefined symbols, in which case not Chris@39: # even a static library is built. For now, we need to specify Chris@39: # -no-undefined on the libtool link line when we can be certain Chris@39: # that all symbols are satisfied, otherwise we get a static library. Chris@39: allow_undefined=yes Chris@39: ;; Chris@39: *) Chris@39: allow_undefined=yes Chris@39: ;; Chris@39: esac Chris@39: libtool_args=$nonopt Chris@39: base_compile="$nonopt $@" Chris@39: compile_command=$nonopt Chris@39: finalize_command=$nonopt Chris@39: Chris@39: compile_rpath= Chris@39: finalize_rpath= Chris@39: compile_shlibpath= Chris@39: finalize_shlibpath= Chris@39: convenience= Chris@39: old_convenience= Chris@39: deplibs= Chris@39: old_deplibs= Chris@39: compiler_flags= Chris@39: linker_flags= Chris@39: dllsearchpath= Chris@39: lib_search_path=`pwd` Chris@39: inst_prefix_dir= Chris@39: new_inherited_linker_flags= Chris@39: Chris@39: avoid_version=no Chris@39: bindir= Chris@39: dlfiles= Chris@39: dlprefiles= Chris@39: dlself=no Chris@39: export_dynamic=no Chris@39: export_symbols= Chris@39: export_symbols_regex= Chris@39: generated= Chris@39: libobjs= Chris@39: ltlibs= Chris@39: module=no Chris@39: no_install=no Chris@39: objs= Chris@39: non_pic_objects= Chris@39: precious_files_regex= Chris@39: prefer_static_libs=no Chris@39: preload=no Chris@39: prev= Chris@39: prevarg= Chris@39: release= Chris@39: rpath= Chris@39: xrpath= Chris@39: perm_rpath= Chris@39: temp_rpath= Chris@39: thread_safe=no Chris@39: vinfo= Chris@39: vinfo_number=no Chris@39: weak_libs= Chris@39: single_module="${wl}-single_module" Chris@39: func_infer_tag $base_compile Chris@39: Chris@39: # We need to know -static, to get the right output filenames. Chris@39: for arg Chris@39: do Chris@39: case $arg in Chris@39: -shared) Chris@39: test "$build_libtool_libs" != yes && \ Chris@39: func_fatal_configuration "can not build a shared library" Chris@39: build_old_libs=no Chris@39: break Chris@39: ;; Chris@39: -all-static | -static | -static-libtool-libs) Chris@39: case $arg in Chris@39: -all-static) Chris@39: if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then Chris@39: func_warning "complete static linking is impossible in this configuration" Chris@39: fi Chris@39: if test -n "$link_static_flag"; then Chris@39: dlopen_self=$dlopen_self_static Chris@39: fi Chris@39: prefer_static_libs=yes Chris@39: ;; Chris@39: -static) Chris@39: if test -z "$pic_flag" && test -n "$link_static_flag"; then Chris@39: dlopen_self=$dlopen_self_static Chris@39: fi Chris@39: prefer_static_libs=built Chris@39: ;; Chris@39: -static-libtool-libs) Chris@39: if test -z "$pic_flag" && test -n "$link_static_flag"; then Chris@39: dlopen_self=$dlopen_self_static Chris@39: fi Chris@39: prefer_static_libs=yes Chris@39: ;; Chris@39: esac Chris@39: build_libtool_libs=no Chris@39: build_old_libs=yes Chris@39: break Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # See if our shared archives depend on static archives. Chris@39: test -n "$old_archive_from_new_cmds" && build_old_libs=yes Chris@39: Chris@39: # Go through the arguments, transforming them on the way. Chris@39: while test "$#" -gt 0; do Chris@39: arg="$1" Chris@39: shift Chris@39: func_quote_for_eval "$arg" Chris@39: qarg=$func_quote_for_eval_unquoted_result Chris@39: func_append libtool_args " $func_quote_for_eval_result" Chris@39: Chris@39: # If the previous option needs an argument, assign it. Chris@39: if test -n "$prev"; then Chris@39: case $prev in Chris@39: output) Chris@39: func_append compile_command " @OUTPUT@" Chris@39: func_append finalize_command " @OUTPUT@" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: case $prev in Chris@39: bindir) Chris@39: bindir="$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: dlfiles|dlprefiles) Chris@39: if test "$preload" = no; then Chris@39: # Add the symbol object into the linking commands. Chris@39: func_append compile_command " @SYMFILE@" Chris@39: func_append finalize_command " @SYMFILE@" Chris@39: preload=yes Chris@39: fi Chris@39: case $arg in Chris@39: *.la | *.lo) ;; # We handle these cases below. Chris@39: force) Chris@39: if test "$dlself" = no; then Chris@39: dlself=needless Chris@39: export_dynamic=yes Chris@39: fi Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: self) Chris@39: if test "$prev" = dlprefiles; then Chris@39: dlself=yes Chris@39: elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then Chris@39: dlself=yes Chris@39: else Chris@39: dlself=needless Chris@39: export_dynamic=yes Chris@39: fi Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: *) Chris@39: if test "$prev" = dlfiles; then Chris@39: func_append dlfiles " $arg" Chris@39: else Chris@39: func_append dlprefiles " $arg" Chris@39: fi Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: expsyms) Chris@39: export_symbols="$arg" Chris@39: test -f "$arg" \ Chris@39: || func_fatal_error "symbol file \`$arg' does not exist" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: expsyms_regex) Chris@39: export_symbols_regex="$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: framework) Chris@39: case $host in Chris@39: *-*-darwin*) Chris@39: case "$deplibs " in Chris@39: *" $qarg.ltframework "*) ;; Chris@39: *) func_append deplibs " $qarg.ltframework" # this is fixed later Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: inst_prefix) Chris@39: inst_prefix_dir="$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: objectlist) Chris@39: if test -f "$arg"; then Chris@39: save_arg=$arg Chris@39: moreargs= Chris@39: for fil in `cat "$save_arg"` Chris@39: do Chris@39: # func_append moreargs " $fil" Chris@39: arg=$fil Chris@39: # A libtool-controlled object. Chris@39: Chris@39: # Check to see that this really is a libtool object. Chris@39: if func_lalib_unsafe_p "$arg"; then Chris@39: pic_object= Chris@39: non_pic_object= Chris@39: Chris@39: # Read the .lo file Chris@39: func_source "$arg" Chris@39: Chris@39: if test -z "$pic_object" || Chris@39: test -z "$non_pic_object" || Chris@39: test "$pic_object" = none && Chris@39: test "$non_pic_object" = none; then Chris@39: func_fatal_error "cannot find name of object for \`$arg'" Chris@39: fi Chris@39: Chris@39: # Extract subdirectory from the argument. Chris@39: func_dirname "$arg" "/" "" Chris@39: xdir="$func_dirname_result" Chris@39: Chris@39: if test "$pic_object" != none; then Chris@39: # Prepend the subdirectory the object is found in. Chris@39: pic_object="$xdir$pic_object" Chris@39: Chris@39: if test "$prev" = dlfiles; then Chris@39: if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then Chris@39: func_append dlfiles " $pic_object" Chris@39: prev= Chris@39: continue Chris@39: else Chris@39: # If libtool objects are unsupported, then we need to preload. Chris@39: prev=dlprefiles Chris@39: fi Chris@39: fi Chris@39: Chris@39: # CHECK ME: I think I busted this. -Ossama Chris@39: if test "$prev" = dlprefiles; then Chris@39: # Preload the old-style object. Chris@39: func_append dlprefiles " $pic_object" Chris@39: prev= Chris@39: fi Chris@39: Chris@39: # A PIC object. Chris@39: func_append libobjs " $pic_object" Chris@39: arg="$pic_object" Chris@39: fi Chris@39: Chris@39: # Non-PIC object. Chris@39: if test "$non_pic_object" != none; then Chris@39: # Prepend the subdirectory the object is found in. Chris@39: non_pic_object="$xdir$non_pic_object" Chris@39: Chris@39: # A standard non-PIC object Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: if test -z "$pic_object" || test "$pic_object" = none ; then Chris@39: arg="$non_pic_object" Chris@39: fi Chris@39: else Chris@39: # If the PIC object exists, use it instead. Chris@39: # $xdir was prepended to $pic_object above. Chris@39: non_pic_object="$pic_object" Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: fi Chris@39: else Chris@39: # Only an error if not doing a dry-run. Chris@39: if $opt_dry_run; then Chris@39: # Extract subdirectory from the argument. Chris@39: func_dirname "$arg" "/" "" Chris@39: xdir="$func_dirname_result" Chris@39: Chris@39: func_lo2o "$arg" Chris@39: pic_object=$xdir$objdir/$func_lo2o_result Chris@39: non_pic_object=$xdir$func_lo2o_result Chris@39: func_append libobjs " $pic_object" Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: else Chris@39: func_fatal_error "\`$arg' is not a valid libtool object" Chris@39: fi Chris@39: fi Chris@39: done Chris@39: else Chris@39: func_fatal_error "link input file \`$arg' does not exist" Chris@39: fi Chris@39: arg=$save_arg Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: precious_regex) Chris@39: precious_files_regex="$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: release) Chris@39: release="-$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: rpath | xrpath) Chris@39: # We need an absolute path. Chris@39: case $arg in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@39: *) Chris@39: func_fatal_error "only absolute run-paths are allowed" Chris@39: ;; Chris@39: esac Chris@39: if test "$prev" = rpath; then Chris@39: case "$rpath " in Chris@39: *" $arg "*) ;; Chris@39: *) func_append rpath " $arg" ;; Chris@39: esac Chris@39: else Chris@39: case "$xrpath " in Chris@39: *" $arg "*) ;; Chris@39: *) func_append xrpath " $arg" ;; Chris@39: esac Chris@39: fi Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: shrext) Chris@39: shrext_cmds="$arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: weak) Chris@39: func_append weak_libs " $arg" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: xcclinker) Chris@39: func_append linker_flags " $qarg" Chris@39: func_append compiler_flags " $qarg" Chris@39: prev= Chris@39: func_append compile_command " $qarg" Chris@39: func_append finalize_command " $qarg" Chris@39: continue Chris@39: ;; Chris@39: xcompiler) Chris@39: func_append compiler_flags " $qarg" Chris@39: prev= Chris@39: func_append compile_command " $qarg" Chris@39: func_append finalize_command " $qarg" Chris@39: continue Chris@39: ;; Chris@39: xlinker) Chris@39: func_append linker_flags " $qarg" Chris@39: func_append compiler_flags " $wl$qarg" Chris@39: prev= Chris@39: func_append compile_command " $wl$qarg" Chris@39: func_append finalize_command " $wl$qarg" Chris@39: continue Chris@39: ;; Chris@39: *) Chris@39: eval "$prev=\"\$arg\"" Chris@39: prev= Chris@39: continue Chris@39: ;; Chris@39: esac Chris@39: fi # test -n "$prev" Chris@39: Chris@39: prevarg="$arg" Chris@39: Chris@39: case $arg in Chris@39: -all-static) Chris@39: if test -n "$link_static_flag"; then Chris@39: # See comment for -static flag below, for more details. Chris@39: func_append compile_command " $link_static_flag" Chris@39: func_append finalize_command " $link_static_flag" Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -allow-undefined) Chris@39: # FIXME: remove this flag sometime in the future. Chris@39: func_fatal_error "\`-allow-undefined' must not be used because it is the default" Chris@39: ;; Chris@39: Chris@39: -avoid-version) Chris@39: avoid_version=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -bindir) Chris@39: prev=bindir Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -dlopen) Chris@39: prev=dlfiles Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -dlpreopen) Chris@39: prev=dlprefiles Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -export-dynamic) Chris@39: export_dynamic=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -export-symbols | -export-symbols-regex) Chris@39: if test -n "$export_symbols" || test -n "$export_symbols_regex"; then Chris@39: func_fatal_error "more than one -exported-symbols argument is not allowed" Chris@39: fi Chris@39: if test "X$arg" = "X-export-symbols"; then Chris@39: prev=expsyms Chris@39: else Chris@39: prev=expsyms_regex Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -framework) Chris@39: prev=framework Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -inst-prefix-dir) Chris@39: prev=inst_prefix Chris@39: continue Chris@39: ;; Chris@39: Chris@39: # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* Chris@39: # so, if we see these flags be careful not to treat them like -L Chris@39: -L[A-Z][A-Z]*:*) Chris@39: case $with_gcc/$host in Chris@39: no/*-*-irix* | /*-*-irix*) Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -L*) Chris@39: func_stripname "-L" '' "$arg" Chris@39: if test -z "$func_stripname_result"; then Chris@39: if test "$#" -gt 0; then Chris@39: func_fatal_error "require no space between \`-L' and \`$1'" Chris@39: else Chris@39: func_fatal_error "need path for \`-L' option" Chris@39: fi Chris@39: fi Chris@39: func_resolve_sysroot "$func_stripname_result" Chris@39: dir=$func_resolve_sysroot_result Chris@39: # We need an absolute path. Chris@39: case $dir in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@39: *) Chris@39: absdir=`cd "$dir" && pwd` Chris@39: test -z "$absdir" && \ Chris@39: func_fatal_error "cannot determine absolute directory name of \`$dir'" Chris@39: dir="$absdir" Chris@39: ;; Chris@39: esac Chris@39: case "$deplibs " in Chris@39: *" -L$dir "* | *" $arg "*) Chris@39: # Will only happen for absolute or sysroot arguments Chris@39: ;; Chris@39: *) Chris@39: # Preserve sysroot, but never include relative directories Chris@39: case $dir in Chris@39: [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; Chris@39: *) func_append deplibs " -L$dir" ;; Chris@39: esac Chris@39: func_append lib_search_path " $dir" Chris@39: ;; Chris@39: esac Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@39: testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` Chris@39: case :$dllsearchpath: in Chris@39: *":$dir:"*) ;; Chris@39: ::) dllsearchpath=$dir;; Chris@39: *) func_append dllsearchpath ":$dir";; Chris@39: esac Chris@39: case :$dllsearchpath: in Chris@39: *":$testbindir:"*) ;; Chris@39: ::) dllsearchpath=$testbindir;; Chris@39: *) func_append dllsearchpath ":$testbindir";; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -l*) Chris@39: if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) Chris@39: # These systems don't actually have a C or math library (as such) Chris@39: continue Chris@39: ;; Chris@39: *-*-os2*) Chris@39: # These systems don't actually have a C library (as such) Chris@39: test "X$arg" = "X-lc" && continue Chris@39: ;; Chris@39: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) Chris@39: # Do not include libc due to us having libc/libc_r. Chris@39: test "X$arg" = "X-lc" && continue Chris@39: ;; Chris@39: *-*-rhapsody* | *-*-darwin1.[012]) Chris@39: # Rhapsody C and math libraries are in the System framework Chris@39: func_append deplibs " System.ltframework" Chris@39: continue Chris@39: ;; Chris@39: *-*-sco3.2v5* | *-*-sco5v6*) Chris@39: # Causes problems with __ctype Chris@39: test "X$arg" = "X-lc" && continue Chris@39: ;; Chris@39: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) Chris@39: # Compiler inserts libc in the correct place for threads to work Chris@39: test "X$arg" = "X-lc" && continue Chris@39: ;; Chris@39: esac Chris@39: elif test "X$arg" = "X-lc_r"; then Chris@39: case $host in Chris@39: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) Chris@39: # Do not include libc_r directly, use -pthread flag. Chris@39: continue Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: func_append deplibs " $arg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -module) Chris@39: module=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: # Tru64 UNIX uses -model [arg] to determine the layout of C++ Chris@39: # classes, name mangling, and exception handling. Chris@39: # Darwin uses the -arch flag to determine output architecture. Chris@39: -model|-arch|-isysroot|--sysroot) Chris@39: func_append compiler_flags " $arg" Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: prev=xcompiler Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) Chris@39: func_append compiler_flags " $arg" Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: case "$new_inherited_linker_flags " in Chris@39: *" $arg "*) ;; Chris@39: * ) func_append new_inherited_linker_flags " $arg" ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -multi_module) Chris@39: single_module="${wl}-multi_module" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -no-fast-install) Chris@39: fast_install=no Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -no-install) Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) Chris@39: # The PATH hackery in wrapper scripts is required on Windows Chris@39: # and Darwin in order for the loader to find any dlls it needs. Chris@39: func_warning "\`-no-install' is ignored for $host" Chris@39: func_warning "assuming \`-no-fast-install' instead" Chris@39: fast_install=no Chris@39: ;; Chris@39: *) no_install=yes ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -no-undefined) Chris@39: allow_undefined=no Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -objectlist) Chris@39: prev=objectlist Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -o) prev=output ;; Chris@39: Chris@39: -precious-files-regex) Chris@39: prev=precious_regex Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -release) Chris@39: prev=release Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -rpath) Chris@39: prev=rpath Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -R) Chris@39: prev=xrpath Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -R*) Chris@39: func_stripname '-R' '' "$arg" Chris@39: dir=$func_stripname_result Chris@39: # We need an absolute path. Chris@39: case $dir in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) ;; Chris@39: =*) Chris@39: func_stripname '=' '' "$dir" Chris@39: dir=$lt_sysroot$func_stripname_result Chris@39: ;; Chris@39: *) Chris@39: func_fatal_error "only absolute run-paths are allowed" Chris@39: ;; Chris@39: esac Chris@39: case "$xrpath " in Chris@39: *" $dir "*) ;; Chris@39: *) func_append xrpath " $dir" ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -shared) Chris@39: # The effects of -shared are defined in a previous loop. Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -shrext) Chris@39: prev=shrext Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -static | -static-libtool-libs) Chris@39: # The effects of -static are defined in a previous loop. Chris@39: # We used to do the same as -all-static on platforms that Chris@39: # didn't have a PIC flag, but the assumption that the effects Chris@39: # would be equivalent was wrong. It would break on at least Chris@39: # Digital Unix and AIX. Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -thread-safe) Chris@39: thread_safe=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -version-info) Chris@39: prev=vinfo Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -version-number) Chris@39: prev=vinfo Chris@39: vinfo_number=yes Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -weak) Chris@39: prev=weak Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -Wc,*) Chris@39: func_stripname '-Wc,' '' "$arg" Chris@39: args=$func_stripname_result Chris@39: arg= Chris@39: save_ifs="$IFS"; IFS=',' Chris@39: for flag in $args; do Chris@39: IFS="$save_ifs" Chris@39: func_quote_for_eval "$flag" Chris@39: func_append arg " $func_quote_for_eval_result" Chris@39: func_append compiler_flags " $func_quote_for_eval_result" Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: func_stripname ' ' '' "$arg" Chris@39: arg=$func_stripname_result Chris@39: ;; Chris@39: Chris@39: -Wl,*) Chris@39: func_stripname '-Wl,' '' "$arg" Chris@39: args=$func_stripname_result Chris@39: arg= Chris@39: save_ifs="$IFS"; IFS=',' Chris@39: for flag in $args; do Chris@39: IFS="$save_ifs" Chris@39: func_quote_for_eval "$flag" Chris@39: func_append arg " $wl$func_quote_for_eval_result" Chris@39: func_append compiler_flags " $wl$func_quote_for_eval_result" Chris@39: func_append linker_flags " $func_quote_for_eval_result" Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: func_stripname ' ' '' "$arg" Chris@39: arg=$func_stripname_result Chris@39: ;; Chris@39: Chris@39: -Xcompiler) Chris@39: prev=xcompiler Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -Xlinker) Chris@39: prev=xlinker Chris@39: continue Chris@39: ;; Chris@39: Chris@39: -XCClinker) Chris@39: prev=xcclinker Chris@39: continue Chris@39: ;; Chris@39: Chris@39: # -msg_* for osf cc Chris@39: -msg_*) Chris@39: func_quote_for_eval "$arg" Chris@39: arg="$func_quote_for_eval_result" Chris@39: ;; Chris@39: Chris@39: # Flags to be passed through unchanged, with rationale: Chris@39: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler Chris@39: # -r[0-9][0-9]* specify processor for the SGI compiler Chris@39: # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler Chris@39: # +DA*, +DD* enable 64-bit mode for the HP compiler Chris@39: # -q* compiler args for the IBM compiler Chris@39: # -m*, -t[45]*, -txscale* architecture-specific flags for GCC Chris@39: # -F/path path to uninstalled frameworks, gcc on darwin Chris@39: # -p, -pg, --coverage, -fprofile-* profiling flags for GCC Chris@39: # @file GCC response files Chris@39: # -tp=* Portland pgcc target processor selection Chris@39: # --sysroot=* for sysroot support Chris@39: # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization Chris@39: -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ Chris@39: -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ Chris@39: -O*|-flto*|-fwhopr*|-fuse-linker-plugin) Chris@39: func_quote_for_eval "$arg" Chris@39: arg="$func_quote_for_eval_result" Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: func_append compiler_flags " $arg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: # Some other compiler flag. Chris@39: -* | +*) Chris@39: func_quote_for_eval "$arg" Chris@39: arg="$func_quote_for_eval_result" Chris@39: ;; Chris@39: Chris@39: *.$objext) Chris@39: # A standard object. Chris@39: func_append objs " $arg" Chris@39: ;; Chris@39: Chris@39: *.lo) Chris@39: # A libtool-controlled object. Chris@39: Chris@39: # Check to see that this really is a libtool object. Chris@39: if func_lalib_unsafe_p "$arg"; then Chris@39: pic_object= Chris@39: non_pic_object= Chris@39: Chris@39: # Read the .lo file Chris@39: func_source "$arg" Chris@39: Chris@39: if test -z "$pic_object" || Chris@39: test -z "$non_pic_object" || Chris@39: test "$pic_object" = none && Chris@39: test "$non_pic_object" = none; then Chris@39: func_fatal_error "cannot find name of object for \`$arg'" Chris@39: fi Chris@39: Chris@39: # Extract subdirectory from the argument. Chris@39: func_dirname "$arg" "/" "" Chris@39: xdir="$func_dirname_result" Chris@39: Chris@39: if test "$pic_object" != none; then Chris@39: # Prepend the subdirectory the object is found in. Chris@39: pic_object="$xdir$pic_object" Chris@39: Chris@39: if test "$prev" = dlfiles; then Chris@39: if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then Chris@39: func_append dlfiles " $pic_object" Chris@39: prev= Chris@39: continue Chris@39: else Chris@39: # If libtool objects are unsupported, then we need to preload. Chris@39: prev=dlprefiles Chris@39: fi Chris@39: fi Chris@39: Chris@39: # CHECK ME: I think I busted this. -Ossama Chris@39: if test "$prev" = dlprefiles; then Chris@39: # Preload the old-style object. Chris@39: func_append dlprefiles " $pic_object" Chris@39: prev= Chris@39: fi Chris@39: Chris@39: # A PIC object. Chris@39: func_append libobjs " $pic_object" Chris@39: arg="$pic_object" Chris@39: fi Chris@39: Chris@39: # Non-PIC object. Chris@39: if test "$non_pic_object" != none; then Chris@39: # Prepend the subdirectory the object is found in. Chris@39: non_pic_object="$xdir$non_pic_object" Chris@39: Chris@39: # A standard non-PIC object Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: if test -z "$pic_object" || test "$pic_object" = none ; then Chris@39: arg="$non_pic_object" Chris@39: fi Chris@39: else Chris@39: # If the PIC object exists, use it instead. Chris@39: # $xdir was prepended to $pic_object above. Chris@39: non_pic_object="$pic_object" Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: fi Chris@39: else Chris@39: # Only an error if not doing a dry-run. Chris@39: if $opt_dry_run; then Chris@39: # Extract subdirectory from the argument. Chris@39: func_dirname "$arg" "/" "" Chris@39: xdir="$func_dirname_result" Chris@39: Chris@39: func_lo2o "$arg" Chris@39: pic_object=$xdir$objdir/$func_lo2o_result Chris@39: non_pic_object=$xdir$func_lo2o_result Chris@39: func_append libobjs " $pic_object" Chris@39: func_append non_pic_objects " $non_pic_object" Chris@39: else Chris@39: func_fatal_error "\`$arg' is not a valid libtool object" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: Chris@39: *.$libext) Chris@39: # An archive. Chris@39: func_append deplibs " $arg" Chris@39: func_append old_deplibs " $arg" Chris@39: continue Chris@39: ;; Chris@39: Chris@39: *.la) Chris@39: # A libtool-controlled library. Chris@39: Chris@39: func_resolve_sysroot "$arg" Chris@39: if test "$prev" = dlfiles; then Chris@39: # This library was specified with -dlopen. Chris@39: func_append dlfiles " $func_resolve_sysroot_result" Chris@39: prev= Chris@39: elif test "$prev" = dlprefiles; then Chris@39: # The library was specified with -dlpreopen. Chris@39: func_append dlprefiles " $func_resolve_sysroot_result" Chris@39: prev= Chris@39: else Chris@39: func_append deplibs " $func_resolve_sysroot_result" Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: Chris@39: # Some other compiler argument. Chris@39: *) Chris@39: # Unknown arguments in both finalize_command and compile_command need Chris@39: # to be aesthetically quoted because they are evaled later. Chris@39: func_quote_for_eval "$arg" Chris@39: arg="$func_quote_for_eval_result" Chris@39: ;; Chris@39: esac # arg Chris@39: Chris@39: # Now actually substitute the argument into the commands. Chris@39: if test -n "$arg"; then Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: fi Chris@39: done # argument parsing loop Chris@39: Chris@39: test -n "$prev" && \ Chris@39: func_fatal_help "the \`$prevarg' option requires an argument" Chris@39: Chris@39: if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then Chris@39: eval arg=\"$export_dynamic_flag_spec\" Chris@39: func_append compile_command " $arg" Chris@39: func_append finalize_command " $arg" Chris@39: fi Chris@39: Chris@39: oldlibs= Chris@39: # calculate the name of the file, without its directory Chris@39: func_basename "$output" Chris@39: outputname="$func_basename_result" Chris@39: libobjs_save="$libobjs" Chris@39: Chris@39: if test -n "$shlibpath_var"; then Chris@39: # get the directories listed in $shlibpath_var Chris@39: eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` Chris@39: else Chris@39: shlib_search_path= Chris@39: fi Chris@39: eval sys_lib_search_path=\"$sys_lib_search_path_spec\" Chris@39: eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" Chris@39: Chris@39: func_dirname "$output" "/" "" Chris@39: output_objdir="$func_dirname_result$objdir" Chris@39: func_to_tool_file "$output_objdir/" Chris@39: tool_output_objdir=$func_to_tool_file_result Chris@39: # Create the object directory. Chris@39: func_mkdir_p "$output_objdir" Chris@39: Chris@39: # Determine the type of output Chris@39: case $output in Chris@39: "") Chris@39: func_fatal_help "you must specify an output file" Chris@39: ;; Chris@39: *.$libext) linkmode=oldlib ;; Chris@39: *.lo | *.$objext) linkmode=obj ;; Chris@39: *.la) linkmode=lib ;; Chris@39: *) linkmode=prog ;; # Anything else should be a program. Chris@39: esac Chris@39: Chris@39: specialdeplibs= Chris@39: Chris@39: libs= Chris@39: # Find all interdependent deplibs by searching for libraries Chris@39: # that are linked more than once (e.g. -la -lb -la) Chris@39: for deplib in $deplibs; do Chris@39: if $opt_preserve_dup_deps ; then Chris@39: case "$libs " in Chris@39: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@39: esac Chris@39: fi Chris@39: func_append libs " $deplib" Chris@39: done Chris@39: Chris@39: if test "$linkmode" = lib; then Chris@39: libs="$predeps $libs $compiler_lib_search_path $postdeps" Chris@39: Chris@39: # Compute libraries that are listed more than once in $predeps Chris@39: # $postdeps and mark them as special (i.e., whose duplicates are Chris@39: # not to be eliminated). Chris@39: pre_post_deps= Chris@39: if $opt_duplicate_compiler_generated_deps; then Chris@39: for pre_post_dep in $predeps $postdeps; do Chris@39: case "$pre_post_deps " in Chris@39: *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; Chris@39: esac Chris@39: func_append pre_post_deps " $pre_post_dep" Chris@39: done Chris@39: fi Chris@39: pre_post_deps= Chris@39: fi Chris@39: Chris@39: deplibs= Chris@39: newdependency_libs= Chris@39: newlib_search_path= Chris@39: need_relink=no # whether we're linking any uninstalled libtool libraries Chris@39: notinst_deplibs= # not-installed libtool libraries Chris@39: notinst_path= # paths that contain not-installed libtool libraries Chris@39: Chris@39: case $linkmode in Chris@39: lib) Chris@39: passes="conv dlpreopen link" Chris@39: for file in $dlfiles $dlprefiles; do Chris@39: case $file in Chris@39: *.la) ;; Chris@39: *) Chris@39: func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: ;; Chris@39: prog) Chris@39: compile_deplibs= Chris@39: finalize_deplibs= Chris@39: alldeplibs=no Chris@39: newdlfiles= Chris@39: newdlprefiles= Chris@39: passes="conv scan dlopen dlpreopen link" Chris@39: ;; Chris@39: *) passes="conv" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: for pass in $passes; do Chris@39: # The preopen pass in lib mode reverses $deplibs; put it back here Chris@39: # so that -L comes before libs that need it for instance... Chris@39: if test "$linkmode,$pass" = "lib,link"; then Chris@39: ## FIXME: Find the place where the list is rebuilt in the wrong Chris@39: ## order, and fix it there properly Chris@39: tmp_deplibs= Chris@39: for deplib in $deplibs; do Chris@39: tmp_deplibs="$deplib $tmp_deplibs" Chris@39: done Chris@39: deplibs="$tmp_deplibs" Chris@39: fi Chris@39: Chris@39: if test "$linkmode,$pass" = "lib,link" || Chris@39: test "$linkmode,$pass" = "prog,scan"; then Chris@39: libs="$deplibs" Chris@39: deplibs= Chris@39: fi Chris@39: if test "$linkmode" = prog; then Chris@39: case $pass in Chris@39: dlopen) libs="$dlfiles" ;; Chris@39: dlpreopen) libs="$dlprefiles" ;; Chris@39: link) Chris@39: libs="$deplibs %DEPLIBS%" Chris@39: test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: if test "$linkmode,$pass" = "lib,dlpreopen"; then Chris@39: # Collect and forward deplibs of preopened libtool libs Chris@39: for lib in $dlprefiles; do Chris@39: # Ignore non-libtool-libs Chris@39: dependency_libs= Chris@39: func_resolve_sysroot "$lib" Chris@39: case $lib in Chris@39: *.la) func_source "$func_resolve_sysroot_result" ;; Chris@39: esac Chris@39: Chris@39: # Collect preopened libtool deplibs, except any this library Chris@39: # has declared as weak libs Chris@39: for deplib in $dependency_libs; do Chris@39: func_basename "$deplib" Chris@39: deplib_base=$func_basename_result Chris@39: case " $weak_libs " in Chris@39: *" $deplib_base "*) ;; Chris@39: *) func_append deplibs " $deplib" ;; Chris@39: esac Chris@39: done Chris@39: done Chris@39: libs="$dlprefiles" Chris@39: fi Chris@39: if test "$pass" = dlopen; then Chris@39: # Collect dlpreopened libraries Chris@39: save_deplibs="$deplibs" Chris@39: deplibs= Chris@39: fi Chris@39: Chris@39: for deplib in $libs; do Chris@39: lib= Chris@39: found=no Chris@39: case $deplib in Chris@39: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) Chris@39: if test "$linkmode,$pass" = "prog,link"; then Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: else Chris@39: func_append compiler_flags " $deplib" Chris@39: if test "$linkmode" = lib ; then Chris@39: case "$new_inherited_linker_flags " in Chris@39: *" $deplib "*) ;; Chris@39: * ) func_append new_inherited_linker_flags " $deplib" ;; Chris@39: esac Chris@39: fi Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: -l*) Chris@39: if test "$linkmode" != lib && test "$linkmode" != prog; then Chris@39: func_warning "\`-l' is ignored for archives/objects" Chris@39: continue Chris@39: fi Chris@39: func_stripname '-l' '' "$deplib" Chris@39: name=$func_stripname_result Chris@39: if test "$linkmode" = lib; then Chris@39: searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" Chris@39: else Chris@39: searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" Chris@39: fi Chris@39: for searchdir in $searchdirs; do Chris@39: for search_ext in .la $std_shrext .so .a; do Chris@39: # Search the libtool library Chris@39: lib="$searchdir/lib${name}${search_ext}" Chris@39: if test -f "$lib"; then Chris@39: if test "$search_ext" = ".la"; then Chris@39: found=yes Chris@39: else Chris@39: found=no Chris@39: fi Chris@39: break 2 Chris@39: fi Chris@39: done Chris@39: done Chris@39: if test "$found" != yes; then Chris@39: # deplib doesn't seem to be a libtool library Chris@39: if test "$linkmode,$pass" = "prog,link"; then Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: else Chris@39: deplibs="$deplib $deplibs" Chris@39: test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" Chris@39: fi Chris@39: continue Chris@39: else # deplib is a libtool library Chris@39: # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, Chris@39: # We need to do some special things here, and not later. Chris@39: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then Chris@39: case " $predeps $postdeps " in Chris@39: *" $deplib "*) Chris@39: if func_lalib_p "$lib"; then Chris@39: library_names= Chris@39: old_library= Chris@39: func_source "$lib" Chris@39: for l in $old_library $library_names; do Chris@39: ll="$l" Chris@39: done Chris@39: if test "X$ll" = "X$old_library" ; then # only static version available Chris@39: found=no Chris@39: func_dirname "$lib" "" "." Chris@39: ladir="$func_dirname_result" Chris@39: lib=$ladir/$old_library Chris@39: if test "$linkmode,$pass" = "prog,link"; then Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: else Chris@39: deplibs="$deplib $deplibs" Chris@39: test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" Chris@39: fi Chris@39: continue Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: *) ;; Chris@39: esac Chris@39: fi Chris@39: fi Chris@39: ;; # -l Chris@39: *.ltframework) Chris@39: if test "$linkmode,$pass" = "prog,link"; then Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: else Chris@39: deplibs="$deplib $deplibs" Chris@39: if test "$linkmode" = lib ; then Chris@39: case "$new_inherited_linker_flags " in Chris@39: *" $deplib "*) ;; Chris@39: * ) func_append new_inherited_linker_flags " $deplib" ;; Chris@39: esac Chris@39: fi Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: -L*) Chris@39: case $linkmode in Chris@39: lib) Chris@39: deplibs="$deplib $deplibs" Chris@39: test "$pass" = conv && continue Chris@39: newdependency_libs="$deplib $newdependency_libs" Chris@39: func_stripname '-L' '' "$deplib" Chris@39: func_resolve_sysroot "$func_stripname_result" Chris@39: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@39: ;; Chris@39: prog) Chris@39: if test "$pass" = conv; then Chris@39: deplibs="$deplib $deplibs" Chris@39: continue Chris@39: fi Chris@39: if test "$pass" = scan; then Chris@39: deplibs="$deplib $deplibs" Chris@39: else Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: fi Chris@39: func_stripname '-L' '' "$deplib" Chris@39: func_resolve_sysroot "$func_stripname_result" Chris@39: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@39: ;; Chris@39: *) Chris@39: func_warning "\`-L' is ignored for archives/objects" Chris@39: ;; Chris@39: esac # linkmode Chris@39: continue Chris@39: ;; # -L Chris@39: -R*) Chris@39: if test "$pass" = link; then Chris@39: func_stripname '-R' '' "$deplib" Chris@39: func_resolve_sysroot "$func_stripname_result" Chris@39: dir=$func_resolve_sysroot_result Chris@39: # Make sure the xrpath contains only unique directories. Chris@39: case "$xrpath " in Chris@39: *" $dir "*) ;; Chris@39: *) func_append xrpath " $dir" ;; Chris@39: esac Chris@39: fi Chris@39: deplibs="$deplib $deplibs" Chris@39: continue Chris@39: ;; Chris@39: *.la) Chris@39: func_resolve_sysroot "$deplib" Chris@39: lib=$func_resolve_sysroot_result Chris@39: ;; Chris@39: *.$libext) Chris@39: if test "$pass" = conv; then Chris@39: deplibs="$deplib $deplibs" Chris@39: continue Chris@39: fi Chris@39: case $linkmode in Chris@39: lib) Chris@39: # Linking convenience modules into shared libraries is allowed, Chris@39: # but linking other static libraries is non-portable. Chris@39: case " $dlpreconveniencelibs " in Chris@39: *" $deplib "*) ;; Chris@39: *) Chris@39: valid_a_lib=no Chris@39: case $deplibs_check_method in Chris@39: match_pattern*) Chris@39: set dummy $deplibs_check_method; shift Chris@39: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` Chris@39: if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ Chris@39: | $EGREP "$match_pattern_regex" > /dev/null; then Chris@39: valid_a_lib=yes Chris@39: fi Chris@39: ;; Chris@39: pass_all) Chris@39: valid_a_lib=yes Chris@39: ;; Chris@39: esac Chris@39: if test "$valid_a_lib" != yes; then Chris@39: echo Chris@39: $ECHO "*** Warning: Trying to link with static lib archive $deplib." Chris@39: echo "*** I have the capability to make that library automatically link in when" Chris@39: echo "*** you link to this library. But I can only do this if you have a" Chris@39: echo "*** shared version of the library, which you do not appear to have" Chris@39: echo "*** because the file extensions .$libext of this argument makes me believe" Chris@39: echo "*** that it is just a static archive that I should not use here." Chris@39: else Chris@39: echo Chris@39: $ECHO "*** Warning: Linking the shared library $output against the" Chris@39: $ECHO "*** static library $deplib is not portable!" Chris@39: deplibs="$deplib $deplibs" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: continue Chris@39: ;; Chris@39: prog) Chris@39: if test "$pass" != link; then Chris@39: deplibs="$deplib $deplibs" Chris@39: else Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: esac # linkmode Chris@39: ;; # *.$libext Chris@39: *.lo | *.$objext) Chris@39: if test "$pass" = conv; then Chris@39: deplibs="$deplib $deplibs" Chris@39: elif test "$linkmode" = prog; then Chris@39: if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then Chris@39: # If there is no dlopen support or we're linking statically, Chris@39: # we need to preload. Chris@39: func_append newdlprefiles " $deplib" Chris@39: compile_deplibs="$deplib $compile_deplibs" Chris@39: finalize_deplibs="$deplib $finalize_deplibs" Chris@39: else Chris@39: func_append newdlfiles " $deplib" Chris@39: fi Chris@39: fi Chris@39: continue Chris@39: ;; Chris@39: %DEPLIBS%) Chris@39: alldeplibs=yes Chris@39: continue Chris@39: ;; Chris@39: esac # case $deplib Chris@39: Chris@39: if test "$found" = yes || test -f "$lib"; then : Chris@39: else Chris@39: func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" Chris@39: fi Chris@39: Chris@39: # Check to see that this really is a libtool archive. Chris@39: func_lalib_unsafe_p "$lib" \ Chris@39: || func_fatal_error "\`$lib' is not a valid libtool archive" Chris@39: Chris@39: func_dirname "$lib" "" "." Chris@39: ladir="$func_dirname_result" Chris@39: Chris@39: dlname= Chris@39: dlopen= Chris@39: dlpreopen= Chris@39: libdir= Chris@39: library_names= Chris@39: old_library= Chris@39: inherited_linker_flags= Chris@39: # If the library was installed with an old release of libtool, Chris@39: # it will not redefine variables installed, or shouldnotlink Chris@39: installed=yes Chris@39: shouldnotlink=no Chris@39: avoidtemprpath= Chris@39: Chris@39: Chris@39: # Read the .la file Chris@39: func_source "$lib" Chris@39: Chris@39: # Convert "-framework foo" to "foo.ltframework" Chris@39: if test -n "$inherited_linker_flags"; then Chris@39: tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` Chris@39: for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do Chris@39: case " $new_inherited_linker_flags " in Chris@39: *" $tmp_inherited_linker_flag "*) ;; Chris@39: *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; Chris@39: esac Chris@39: done Chris@39: fi Chris@39: dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: if test "$linkmode,$pass" = "lib,link" || Chris@39: test "$linkmode,$pass" = "prog,scan" || Chris@39: { test "$linkmode" != prog && test "$linkmode" != lib; }; then Chris@39: test -n "$dlopen" && func_append dlfiles " $dlopen" Chris@39: test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" Chris@39: fi Chris@39: Chris@39: if test "$pass" = conv; then Chris@39: # Only check for convenience libraries Chris@39: deplibs="$lib $deplibs" Chris@39: if test -z "$libdir"; then Chris@39: if test -z "$old_library"; then Chris@39: func_fatal_error "cannot find name of link library for \`$lib'" Chris@39: fi Chris@39: # It is a libtool convenience library, so add in its objects. Chris@39: func_append convenience " $ladir/$objdir/$old_library" Chris@39: func_append old_convenience " $ladir/$objdir/$old_library" Chris@39: tmp_libs= Chris@39: for deplib in $dependency_libs; do Chris@39: deplibs="$deplib $deplibs" Chris@39: if $opt_preserve_dup_deps ; then Chris@39: case "$tmp_libs " in Chris@39: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@39: esac Chris@39: fi Chris@39: func_append tmp_libs " $deplib" Chris@39: done Chris@39: elif test "$linkmode" != prog && test "$linkmode" != lib; then Chris@39: func_fatal_error "\`$lib' is not a convenience library" Chris@39: fi Chris@39: continue Chris@39: fi # $pass = conv Chris@39: Chris@39: Chris@39: # Get the name of the library we link against. Chris@39: linklib= Chris@39: if test -n "$old_library" && Chris@39: { test "$prefer_static_libs" = yes || Chris@39: test "$prefer_static_libs,$installed" = "built,no"; }; then Chris@39: linklib=$old_library Chris@39: else Chris@39: for l in $old_library $library_names; do Chris@39: linklib="$l" Chris@39: done Chris@39: fi Chris@39: if test -z "$linklib"; then Chris@39: func_fatal_error "cannot find name of link library for \`$lib'" Chris@39: fi Chris@39: Chris@39: # This library was specified with -dlopen. Chris@39: if test "$pass" = dlopen; then Chris@39: if test -z "$libdir"; then Chris@39: func_fatal_error "cannot -dlopen a convenience library: \`$lib'" Chris@39: fi Chris@39: if test -z "$dlname" || Chris@39: test "$dlopen_support" != yes || Chris@39: test "$build_libtool_libs" = no; then Chris@39: # If there is no dlname, no dlopen support or we're linking Chris@39: # statically, we need to preload. We also need to preload any Chris@39: # dependent libraries so libltdl's deplib preloader doesn't Chris@39: # bomb out in the load deplibs phase. Chris@39: func_append dlprefiles " $lib $dependency_libs" Chris@39: else Chris@39: func_append newdlfiles " $lib" Chris@39: fi Chris@39: continue Chris@39: fi # $pass = dlopen Chris@39: Chris@39: # We need an absolute path. Chris@39: case $ladir in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; Chris@39: *) Chris@39: abs_ladir=`cd "$ladir" && pwd` Chris@39: if test -z "$abs_ladir"; then Chris@39: func_warning "cannot determine absolute directory name of \`$ladir'" Chris@39: func_warning "passing it literally to the linker, although it might fail" Chris@39: abs_ladir="$ladir" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: func_basename "$lib" Chris@39: laname="$func_basename_result" Chris@39: Chris@39: # Find the relevant object directory and library name. Chris@39: if test "X$installed" = Xyes; then Chris@39: if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then Chris@39: func_warning "library \`$lib' was moved." Chris@39: dir="$ladir" Chris@39: absdir="$abs_ladir" Chris@39: libdir="$abs_ladir" Chris@39: else Chris@39: dir="$lt_sysroot$libdir" Chris@39: absdir="$lt_sysroot$libdir" Chris@39: fi Chris@39: test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes Chris@39: else Chris@39: if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then Chris@39: dir="$ladir" Chris@39: absdir="$abs_ladir" Chris@39: # Remove this search path later Chris@39: func_append notinst_path " $abs_ladir" Chris@39: else Chris@39: dir="$ladir/$objdir" Chris@39: absdir="$abs_ladir/$objdir" Chris@39: # Remove this search path later Chris@39: func_append notinst_path " $abs_ladir" Chris@39: fi Chris@39: fi # $installed = yes Chris@39: func_stripname 'lib' '.la' "$laname" Chris@39: name=$func_stripname_result Chris@39: Chris@39: # This library was specified with -dlpreopen. Chris@39: if test "$pass" = dlpreopen; then Chris@39: if test -z "$libdir" && test "$linkmode" = prog; then Chris@39: func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" Chris@39: fi Chris@39: case "$host" in Chris@39: # special handling for platforms with PE-DLLs. Chris@39: *cygwin* | *mingw* | *cegcc* ) Chris@39: # Linker will automatically link against shared library if both Chris@39: # static and shared are present. Therefore, ensure we extract Chris@39: # symbols from the import library if a shared library is present Chris@39: # (otherwise, the dlopen module name will be incorrect). We do Chris@39: # this by putting the import library name into $newdlprefiles. Chris@39: # We recover the dlopen module name by 'saving' the la file Chris@39: # name in a special purpose variable, and (later) extracting the Chris@39: # dlname from the la file. Chris@39: if test -n "$dlname"; then Chris@39: func_tr_sh "$dir/$linklib" Chris@39: eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" Chris@39: func_append newdlprefiles " $dir/$linklib" Chris@39: else Chris@39: func_append newdlprefiles " $dir/$old_library" Chris@39: # Keep a list of preopened convenience libraries to check Chris@39: # that they are being used correctly in the link pass. Chris@39: test -z "$libdir" && \ Chris@39: func_append dlpreconveniencelibs " $dir/$old_library" Chris@39: fi Chris@39: ;; Chris@39: * ) Chris@39: # Prefer using a static library (so that no silly _DYNAMIC symbols Chris@39: # are required to link). Chris@39: if test -n "$old_library"; then Chris@39: func_append newdlprefiles " $dir/$old_library" Chris@39: # Keep a list of preopened convenience libraries to check Chris@39: # that they are being used correctly in the link pass. Chris@39: test -z "$libdir" && \ Chris@39: func_append dlpreconveniencelibs " $dir/$old_library" Chris@39: # Otherwise, use the dlname, so that lt_dlopen finds it. Chris@39: elif test -n "$dlname"; then Chris@39: func_append newdlprefiles " $dir/$dlname" Chris@39: else Chris@39: func_append newdlprefiles " $dir/$linklib" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: fi # $pass = dlpreopen Chris@39: Chris@39: if test -z "$libdir"; then Chris@39: # Link the convenience library Chris@39: if test "$linkmode" = lib; then Chris@39: deplibs="$dir/$old_library $deplibs" Chris@39: elif test "$linkmode,$pass" = "prog,link"; then Chris@39: compile_deplibs="$dir/$old_library $compile_deplibs" Chris@39: finalize_deplibs="$dir/$old_library $finalize_deplibs" Chris@39: else Chris@39: deplibs="$lib $deplibs" # used for prog,scan pass Chris@39: fi Chris@39: continue Chris@39: fi Chris@39: Chris@39: Chris@39: if test "$linkmode" = prog && test "$pass" != link; then Chris@39: func_append newlib_search_path " $ladir" Chris@39: deplibs="$lib $deplibs" Chris@39: Chris@39: linkalldeplibs=no Chris@39: if test "$link_all_deplibs" != no || test -z "$library_names" || Chris@39: test "$build_libtool_libs" = no; then Chris@39: linkalldeplibs=yes Chris@39: fi Chris@39: Chris@39: tmp_libs= Chris@39: for deplib in $dependency_libs; do Chris@39: case $deplib in Chris@39: -L*) func_stripname '-L' '' "$deplib" Chris@39: func_resolve_sysroot "$func_stripname_result" Chris@39: func_append newlib_search_path " $func_resolve_sysroot_result" Chris@39: ;; Chris@39: esac Chris@39: # Need to link against all dependency_libs? Chris@39: if test "$linkalldeplibs" = yes; then Chris@39: deplibs="$deplib $deplibs" Chris@39: else Chris@39: # Need to hardcode shared library paths Chris@39: # or/and link against static libraries Chris@39: newdependency_libs="$deplib $newdependency_libs" Chris@39: fi Chris@39: if $opt_preserve_dup_deps ; then Chris@39: case "$tmp_libs " in Chris@39: *" $deplib "*) func_append specialdeplibs " $deplib" ;; Chris@39: esac Chris@39: fi Chris@39: func_append tmp_libs " $deplib" Chris@39: done # for deplib Chris@39: continue Chris@39: fi # $linkmode = prog... Chris@39: Chris@39: if test "$linkmode,$pass" = "prog,link"; then Chris@39: if test -n "$library_names" && Chris@39: { { test "$prefer_static_libs" = no || Chris@39: test "$prefer_static_libs,$installed" = "built,yes"; } || Chris@39: test -z "$old_library"; }; then Chris@39: # We need to hardcode the library path Chris@39: if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then Chris@39: # Make sure the rpath contains only unique directories. Chris@39: case "$temp_rpath:" in Chris@39: *"$absdir:"*) ;; Chris@39: *) func_append temp_rpath "$absdir:" ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: # Hardcode the library path. Chris@39: # Skip directories that are in the system default run-time Chris@39: # search path. Chris@39: case " $sys_lib_dlsearch_path " in Chris@39: *" $absdir "*) ;; Chris@39: *) Chris@39: case "$compile_rpath " in Chris@39: *" $absdir "*) ;; Chris@39: *) func_append compile_rpath " $absdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: case " $sys_lib_dlsearch_path " in Chris@39: *" $libdir "*) ;; Chris@39: *) Chris@39: case "$finalize_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append finalize_rpath " $libdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: fi # $linkmode,$pass = prog,link... Chris@39: Chris@39: if test "$alldeplibs" = yes && Chris@39: { test "$deplibs_check_method" = pass_all || Chris@39: { test "$build_libtool_libs" = yes && Chris@39: test -n "$library_names"; }; }; then Chris@39: # We only need to search for static libraries Chris@39: continue Chris@39: fi Chris@39: fi Chris@39: Chris@39: link_static=no # Whether the deplib will be linked statically Chris@39: use_static_libs=$prefer_static_libs Chris@39: if test "$use_static_libs" = built && test "$installed" = yes; then Chris@39: use_static_libs=no Chris@39: fi Chris@39: if test -n "$library_names" && Chris@39: { test "$use_static_libs" = no || test -z "$old_library"; }; then Chris@39: case $host in Chris@39: *cygwin* | *mingw* | *cegcc*) Chris@39: # No point in relinking DLLs because paths are not encoded Chris@39: func_append notinst_deplibs " $lib" Chris@39: need_relink=no Chris@39: ;; Chris@39: *) Chris@39: if test "$installed" = no; then Chris@39: func_append notinst_deplibs " $lib" Chris@39: need_relink=yes Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: # This is a shared library Chris@39: Chris@39: # Warn about portability, can't link against -module's on some Chris@39: # systems (darwin). Don't bleat about dlopened modules though! Chris@39: dlopenmodule="" Chris@39: for dlpremoduletest in $dlprefiles; do Chris@39: if test "X$dlpremoduletest" = "X$lib"; then Chris@39: dlopenmodule="$dlpremoduletest" Chris@39: break Chris@39: fi Chris@39: done Chris@39: if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then Chris@39: echo Chris@39: if test "$linkmode" = prog; then Chris@39: $ECHO "*** Warning: Linking the executable $output against the loadable module" Chris@39: else Chris@39: $ECHO "*** Warning: Linking the shared library $output against the loadable module" Chris@39: fi Chris@39: $ECHO "*** $linklib is not portable!" Chris@39: fi Chris@39: if test "$linkmode" = lib && Chris@39: test "$hardcode_into_libs" = yes; then Chris@39: # Hardcode the library path. Chris@39: # Skip directories that are in the system default run-time Chris@39: # search path. Chris@39: case " $sys_lib_dlsearch_path " in Chris@39: *" $absdir "*) ;; Chris@39: *) Chris@39: case "$compile_rpath " in Chris@39: *" $absdir "*) ;; Chris@39: *) func_append compile_rpath " $absdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: case " $sys_lib_dlsearch_path " in Chris@39: *" $libdir "*) ;; Chris@39: *) Chris@39: case "$finalize_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append finalize_rpath " $libdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: if test -n "$old_archive_from_expsyms_cmds"; then Chris@39: # figure out the soname Chris@39: set dummy $library_names Chris@39: shift Chris@39: realname="$1" Chris@39: shift Chris@39: libname=`eval "\\$ECHO \"$libname_spec\""` Chris@39: # use dlname if we got it. it's perfectly good, no? Chris@39: if test -n "$dlname"; then Chris@39: soname="$dlname" Chris@39: elif test -n "$soname_spec"; then Chris@39: # bleh windows Chris@39: case $host in Chris@39: *cygwin* | mingw* | *cegcc*) Chris@39: func_arith $current - $age Chris@39: major=$func_arith_result Chris@39: versuffix="-$major" Chris@39: ;; Chris@39: esac Chris@39: eval soname=\"$soname_spec\" Chris@39: else Chris@39: soname="$realname" Chris@39: fi Chris@39: Chris@39: # Make a new name for the extract_expsyms_cmds to use Chris@39: soroot="$soname" Chris@39: func_basename "$soroot" Chris@39: soname="$func_basename_result" Chris@39: func_stripname 'lib' '.dll' "$soname" Chris@39: newlib=libimp-$func_stripname_result.a Chris@39: Chris@39: # If the library has no export list, then create one now Chris@39: if test -f "$output_objdir/$soname-def"; then : Chris@39: else Chris@39: func_verbose "extracting exported symbol list from \`$soname'" Chris@39: func_execute_cmds "$extract_expsyms_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: # Create $newlib Chris@39: if test -f "$output_objdir/$newlib"; then :; else Chris@39: func_verbose "generating import library for \`$soname'" Chris@39: func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' Chris@39: fi Chris@39: # make sure the library variables are pointing to the new library Chris@39: dir=$output_objdir Chris@39: linklib=$newlib Chris@39: fi # test -n "$old_archive_from_expsyms_cmds" Chris@39: Chris@39: if test "$linkmode" = prog || test "$opt_mode" != relink; then Chris@39: add_shlibpath= Chris@39: add_dir= Chris@39: add= Chris@39: lib_linked=yes Chris@39: case $hardcode_action in Chris@39: immediate | unsupported) Chris@39: if test "$hardcode_direct" = no; then Chris@39: add="$dir/$linklib" Chris@39: case $host in Chris@39: *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; Chris@39: *-*-sysv4*uw2*) add_dir="-L$dir" ;; Chris@39: *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ Chris@39: *-*-unixware7*) add_dir="-L$dir" ;; Chris@39: *-*-darwin* ) Chris@39: # if the lib is a (non-dlopened) module then we can not Chris@39: # link against it, someone is ignoring the earlier warnings Chris@39: if /usr/bin/file -L $add 2> /dev/null | Chris@39: $GREP ": [^:]* bundle" >/dev/null ; then Chris@39: if test "X$dlopenmodule" != "X$lib"; then Chris@39: $ECHO "*** Warning: lib $linklib is a module, not a shared library" Chris@39: if test -z "$old_library" ; then Chris@39: echo Chris@39: echo "*** And there doesn't seem to be a static archive available" Chris@39: echo "*** The link will probably fail, sorry" Chris@39: else Chris@39: add="$dir/$old_library" Chris@39: fi Chris@39: elif test -n "$old_library"; then Chris@39: add="$dir/$old_library" Chris@39: fi Chris@39: fi Chris@39: esac Chris@39: elif test "$hardcode_minus_L" = no; then Chris@39: case $host in Chris@39: *-*-sunos*) add_shlibpath="$dir" ;; Chris@39: esac Chris@39: add_dir="-L$dir" Chris@39: add="-l$name" Chris@39: elif test "$hardcode_shlibpath_var" = no; then Chris@39: add_shlibpath="$dir" Chris@39: add="-l$name" Chris@39: else Chris@39: lib_linked=no Chris@39: fi Chris@39: ;; Chris@39: relink) Chris@39: if test "$hardcode_direct" = yes && Chris@39: test "$hardcode_direct_absolute" = no; then Chris@39: add="$dir/$linklib" Chris@39: elif test "$hardcode_minus_L" = yes; then Chris@39: add_dir="-L$dir" Chris@39: # Try looking first in the location we're being installed to. Chris@39: if test -n "$inst_prefix_dir"; then Chris@39: case $libdir in Chris@39: [\\/]*) Chris@39: func_append add_dir " -L$inst_prefix_dir$libdir" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: add="-l$name" Chris@39: elif test "$hardcode_shlibpath_var" = yes; then Chris@39: add_shlibpath="$dir" Chris@39: add="-l$name" Chris@39: else Chris@39: lib_linked=no Chris@39: fi Chris@39: ;; Chris@39: *) lib_linked=no ;; Chris@39: esac Chris@39: Chris@39: if test "$lib_linked" != yes; then Chris@39: func_fatal_configuration "unsupported hardcode properties" Chris@39: fi Chris@39: Chris@39: if test -n "$add_shlibpath"; then Chris@39: case :$compile_shlibpath: in Chris@39: *":$add_shlibpath:"*) ;; Chris@39: *) func_append compile_shlibpath "$add_shlibpath:" ;; Chris@39: esac Chris@39: fi Chris@39: if test "$linkmode" = prog; then Chris@39: test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" Chris@39: test -n "$add" && compile_deplibs="$add $compile_deplibs" Chris@39: else Chris@39: test -n "$add_dir" && deplibs="$add_dir $deplibs" Chris@39: test -n "$add" && deplibs="$add $deplibs" Chris@39: if test "$hardcode_direct" != yes && Chris@39: test "$hardcode_minus_L" != yes && Chris@39: test "$hardcode_shlibpath_var" = yes; then Chris@39: case :$finalize_shlibpath: in Chris@39: *":$libdir:"*) ;; Chris@39: *) func_append finalize_shlibpath "$libdir:" ;; Chris@39: esac Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test "$linkmode" = prog || test "$opt_mode" = relink; then Chris@39: add_shlibpath= Chris@39: add_dir= Chris@39: add= Chris@39: # Finalize command for both is simple: just hardcode it. Chris@39: if test "$hardcode_direct" = yes && Chris@39: test "$hardcode_direct_absolute" = no; then Chris@39: add="$libdir/$linklib" Chris@39: elif test "$hardcode_minus_L" = yes; then Chris@39: add_dir="-L$libdir" Chris@39: add="-l$name" Chris@39: elif test "$hardcode_shlibpath_var" = yes; then Chris@39: case :$finalize_shlibpath: in Chris@39: *":$libdir:"*) ;; Chris@39: *) func_append finalize_shlibpath "$libdir:" ;; Chris@39: esac Chris@39: add="-l$name" Chris@39: elif test "$hardcode_automatic" = yes; then Chris@39: if test -n "$inst_prefix_dir" && Chris@39: test -f "$inst_prefix_dir$libdir/$linklib" ; then Chris@39: add="$inst_prefix_dir$libdir/$linklib" Chris@39: else Chris@39: add="$libdir/$linklib" Chris@39: fi Chris@39: else Chris@39: # We cannot seem to hardcode it, guess we'll fake it. Chris@39: add_dir="-L$libdir" Chris@39: # Try looking first in the location we're being installed to. Chris@39: if test -n "$inst_prefix_dir"; then Chris@39: case $libdir in Chris@39: [\\/]*) Chris@39: func_append add_dir " -L$inst_prefix_dir$libdir" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: add="-l$name" Chris@39: fi Chris@39: Chris@39: if test "$linkmode" = prog; then Chris@39: test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" Chris@39: test -n "$add" && finalize_deplibs="$add $finalize_deplibs" Chris@39: else Chris@39: test -n "$add_dir" && deplibs="$add_dir $deplibs" Chris@39: test -n "$add" && deplibs="$add $deplibs" Chris@39: fi Chris@39: fi Chris@39: elif test "$linkmode" = prog; then Chris@39: # Here we assume that one of hardcode_direct or hardcode_minus_L Chris@39: # is not unsupported. This is valid on all known static and Chris@39: # shared platforms. Chris@39: if test "$hardcode_direct" != unsupported; then Chris@39: test -n "$old_library" && linklib="$old_library" Chris@39: compile_deplibs="$dir/$linklib $compile_deplibs" Chris@39: finalize_deplibs="$dir/$linklib $finalize_deplibs" Chris@39: else Chris@39: compile_deplibs="-l$name -L$dir $compile_deplibs" Chris@39: finalize_deplibs="-l$name -L$dir $finalize_deplibs" Chris@39: fi Chris@39: elif test "$build_libtool_libs" = yes; then Chris@39: # Not a shared library Chris@39: if test "$deplibs_check_method" != pass_all; then Chris@39: # We're trying link a shared library against a static one Chris@39: # but the system doesn't support it. Chris@39: Chris@39: # Just print a warning and add the library to dependency_libs so Chris@39: # that the program can be linked against the static library. Chris@39: echo Chris@39: $ECHO "*** Warning: This system can not link to static lib archive $lib." Chris@39: echo "*** I have the capability to make that library automatically link in when" Chris@39: echo "*** you link to this library. But I can only do this if you have a" Chris@39: echo "*** shared version of the library, which you do not appear to have." Chris@39: if test "$module" = yes; then Chris@39: echo "*** But as you try to build a module library, libtool will still create " Chris@39: echo "*** a static module, that should work as long as the dlopening application" Chris@39: echo "*** is linked with the -dlopen flag to resolve symbols at runtime." Chris@39: if test -z "$global_symbol_pipe"; then Chris@39: echo Chris@39: echo "*** However, this would only work if libtool was able to extract symbol" Chris@39: echo "*** lists from a program, using \`nm' or equivalent, but libtool could" Chris@39: echo "*** not find such a program. So, this module is probably useless." Chris@39: echo "*** \`nm' from GNU binutils and a full rebuild may help." Chris@39: fi Chris@39: if test "$build_old_libs" = no; then Chris@39: build_libtool_libs=module Chris@39: build_old_libs=yes Chris@39: else Chris@39: build_libtool_libs=no Chris@39: fi Chris@39: fi Chris@39: else Chris@39: deplibs="$dir/$old_library $deplibs" Chris@39: link_static=yes Chris@39: fi Chris@39: fi # link shared/static library? Chris@39: Chris@39: if test "$linkmode" = lib; then Chris@39: if test -n "$dependency_libs" && Chris@39: { test "$hardcode_into_libs" != yes || Chris@39: test "$build_old_libs" = yes || Chris@39: test "$link_static" = yes; }; then Chris@39: # Extract -R from dependency_libs Chris@39: temp_deplibs= Chris@39: for libdir in $dependency_libs; do Chris@39: case $libdir in Chris@39: -R*) func_stripname '-R' '' "$libdir" Chris@39: temp_xrpath=$func_stripname_result Chris@39: case " $xrpath " in Chris@39: *" $temp_xrpath "*) ;; Chris@39: *) func_append xrpath " $temp_xrpath";; Chris@39: esac;; Chris@39: *) func_append temp_deplibs " $libdir";; Chris@39: esac Chris@39: done Chris@39: dependency_libs="$temp_deplibs" Chris@39: fi Chris@39: Chris@39: func_append newlib_search_path " $absdir" Chris@39: # Link against this library Chris@39: test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" Chris@39: # ... and its dependency_libs Chris@39: tmp_libs= Chris@39: for deplib in $dependency_libs; do Chris@39: newdependency_libs="$deplib $newdependency_libs" Chris@39: case $deplib in Chris@39: -L*) func_stripname '-L' '' "$deplib" Chris@39: func_resolve_sysroot "$func_stripname_result";; Chris@39: *) func_resolve_sysroot "$deplib" ;; Chris@39: esac Chris@39: if $opt_preserve_dup_deps ; then Chris@39: case "$tmp_libs " in Chris@39: *" $func_resolve_sysroot_result "*) Chris@39: func_append specialdeplibs " $func_resolve_sysroot_result" ;; Chris@39: esac Chris@39: fi Chris@39: func_append tmp_libs " $func_resolve_sysroot_result" Chris@39: done Chris@39: Chris@39: if test "$link_all_deplibs" != no; then Chris@39: # Add the search paths of all dependency libraries Chris@39: for deplib in $dependency_libs; do Chris@39: path= Chris@39: case $deplib in Chris@39: -L*) path="$deplib" ;; Chris@39: *.la) Chris@39: func_resolve_sysroot "$deplib" Chris@39: deplib=$func_resolve_sysroot_result Chris@39: func_dirname "$deplib" "" "." Chris@39: dir=$func_dirname_result Chris@39: # We need an absolute path. Chris@39: case $dir in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; Chris@39: *) Chris@39: absdir=`cd "$dir" && pwd` Chris@39: if test -z "$absdir"; then Chris@39: func_warning "cannot determine absolute directory name of \`$dir'" Chris@39: absdir="$dir" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: if $GREP "^installed=no" $deplib > /dev/null; then Chris@39: case $host in Chris@39: *-*-darwin*) Chris@39: depdepl= Chris@39: eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` Chris@39: if test -n "$deplibrary_names" ; then Chris@39: for tmp in $deplibrary_names ; do Chris@39: depdepl=$tmp Chris@39: done Chris@39: if test -f "$absdir/$objdir/$depdepl" ; then Chris@39: depdepl="$absdir/$objdir/$depdepl" Chris@39: darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` Chris@39: if test -z "$darwin_install_name"; then Chris@39: darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` Chris@39: fi Chris@39: func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" Chris@39: func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" Chris@39: path= Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: path="-L$absdir/$objdir" Chris@39: ;; Chris@39: esac Chris@39: else Chris@39: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` Chris@39: test -z "$libdir" && \ Chris@39: func_fatal_error "\`$deplib' is not a valid libtool archive" Chris@39: test "$absdir" != "$libdir" && \ Chris@39: func_warning "\`$deplib' seems to be moved" Chris@39: Chris@39: path="-L$absdir" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: case " $deplibs " in Chris@39: *" $path "*) ;; Chris@39: *) deplibs="$path $deplibs" ;; Chris@39: esac Chris@39: done Chris@39: fi # link_all_deplibs != no Chris@39: fi # linkmode = lib Chris@39: done # for deplib in $libs Chris@39: if test "$pass" = link; then Chris@39: if test "$linkmode" = "prog"; then Chris@39: compile_deplibs="$new_inherited_linker_flags $compile_deplibs" Chris@39: finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" Chris@39: else Chris@39: compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: fi Chris@39: fi Chris@39: dependency_libs="$newdependency_libs" Chris@39: if test "$pass" = dlpreopen; then Chris@39: # Link the dlpreopened libraries before other libraries Chris@39: for deplib in $save_deplibs; do Chris@39: deplibs="$deplib $deplibs" Chris@39: done Chris@39: fi Chris@39: if test "$pass" != dlopen; then Chris@39: if test "$pass" != conv; then Chris@39: # Make sure lib_search_path contains only unique directories. Chris@39: lib_search_path= Chris@39: for dir in $newlib_search_path; do Chris@39: case "$lib_search_path " in Chris@39: *" $dir "*) ;; Chris@39: *) func_append lib_search_path " $dir" ;; Chris@39: esac Chris@39: done Chris@39: newlib_search_path= Chris@39: fi Chris@39: Chris@39: if test "$linkmode,$pass" != "prog,link"; then Chris@39: vars="deplibs" Chris@39: else Chris@39: vars="compile_deplibs finalize_deplibs" Chris@39: fi Chris@39: for var in $vars dependency_libs; do Chris@39: # Add libraries to $var in reverse order Chris@39: eval tmp_libs=\"\$$var\" Chris@39: new_libs= Chris@39: for deplib in $tmp_libs; do Chris@39: # FIXME: Pedantically, this is the right thing to do, so Chris@39: # that some nasty dependency loop isn't accidentally Chris@39: # broken: Chris@39: #new_libs="$deplib $new_libs" Chris@39: # Pragmatically, this seems to cause very few problems in Chris@39: # practice: Chris@39: case $deplib in Chris@39: -L*) new_libs="$deplib $new_libs" ;; Chris@39: -R*) ;; Chris@39: *) Chris@39: # And here is the reason: when a library appears more Chris@39: # than once as an explicit dependence of a library, or Chris@39: # is implicitly linked in more than once by the Chris@39: # compiler, it is considered special, and multiple Chris@39: # occurrences thereof are not removed. Compare this Chris@39: # with having the same library being listed as a Chris@39: # dependency of multiple other libraries: in this case, Chris@39: # we know (pedantically, we assume) the library does not Chris@39: # need to be listed more than once, so we keep only the Chris@39: # last copy. This is not always right, but it is rare Chris@39: # enough that we require users that really mean to play Chris@39: # such unportable linking tricks to link the library Chris@39: # using -Wl,-lname, so that libtool does not consider it Chris@39: # for duplicate removal. Chris@39: case " $specialdeplibs " in Chris@39: *" $deplib "*) new_libs="$deplib $new_libs" ;; Chris@39: *) Chris@39: case " $new_libs " in Chris@39: *" $deplib "*) ;; Chris@39: *) new_libs="$deplib $new_libs" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: tmp_libs= Chris@39: for deplib in $new_libs; do Chris@39: case $deplib in Chris@39: -L*) Chris@39: case " $tmp_libs " in Chris@39: *" $deplib "*) ;; Chris@39: *) func_append tmp_libs " $deplib" ;; Chris@39: esac Chris@39: ;; Chris@39: *) func_append tmp_libs " $deplib" ;; Chris@39: esac Chris@39: done Chris@39: eval $var=\"$tmp_libs\" Chris@39: done # for var Chris@39: fi Chris@39: # Last step: remove runtime libs from dependency_libs Chris@39: # (they stay in deplibs) Chris@39: tmp_libs= Chris@39: for i in $dependency_libs ; do Chris@39: case " $predeps $postdeps $compiler_lib_search_path " in Chris@39: *" $i "*) Chris@39: i="" Chris@39: ;; Chris@39: esac Chris@39: if test -n "$i" ; then Chris@39: func_append tmp_libs " $i" Chris@39: fi Chris@39: done Chris@39: dependency_libs=$tmp_libs Chris@39: done # for pass Chris@39: if test "$linkmode" = prog; then Chris@39: dlfiles="$newdlfiles" Chris@39: fi Chris@39: if test "$linkmode" = prog || test "$linkmode" = lib; then Chris@39: dlprefiles="$newdlprefiles" Chris@39: fi Chris@39: Chris@39: case $linkmode in Chris@39: oldlib) Chris@39: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then Chris@39: func_warning "\`-dlopen' is ignored for archives" Chris@39: fi Chris@39: Chris@39: case " $deplibs" in Chris@39: *\ -l* | *\ -L*) Chris@39: func_warning "\`-l' and \`-L' are ignored for archives" ;; Chris@39: esac Chris@39: Chris@39: test -n "$rpath" && \ Chris@39: func_warning "\`-rpath' is ignored for archives" Chris@39: Chris@39: test -n "$xrpath" && \ Chris@39: func_warning "\`-R' is ignored for archives" Chris@39: Chris@39: test -n "$vinfo" && \ Chris@39: func_warning "\`-version-info/-version-number' is ignored for archives" Chris@39: Chris@39: test -n "$release" && \ Chris@39: func_warning "\`-release' is ignored for archives" Chris@39: Chris@39: test -n "$export_symbols$export_symbols_regex" && \ Chris@39: func_warning "\`-export-symbols' is ignored for archives" Chris@39: Chris@39: # Now set the variables for building old libraries. Chris@39: build_libtool_libs=no Chris@39: oldlibs="$output" Chris@39: func_append objs "$old_deplibs" Chris@39: ;; Chris@39: Chris@39: lib) Chris@39: # Make sure we only generate libraries of the form `libNAME.la'. Chris@39: case $outputname in Chris@39: lib*) Chris@39: func_stripname 'lib' '.la' "$outputname" Chris@39: name=$func_stripname_result Chris@39: eval shared_ext=\"$shrext_cmds\" Chris@39: eval libname=\"$libname_spec\" Chris@39: ;; Chris@39: *) Chris@39: test "$module" = no && \ Chris@39: func_fatal_help "libtool library \`$output' must begin with \`lib'" Chris@39: Chris@39: if test "$need_lib_prefix" != no; then Chris@39: # Add the "lib" prefix for modules if required Chris@39: func_stripname '' '.la' "$outputname" Chris@39: name=$func_stripname_result Chris@39: eval shared_ext=\"$shrext_cmds\" Chris@39: eval libname=\"$libname_spec\" Chris@39: else Chris@39: func_stripname '' '.la' "$outputname" Chris@39: libname=$func_stripname_result Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: Chris@39: if test -n "$objs"; then Chris@39: if test "$deplibs_check_method" != pass_all; then Chris@39: func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" Chris@39: else Chris@39: echo Chris@39: $ECHO "*** Warning: Linking the shared library $output against the non-libtool" Chris@39: $ECHO "*** objects $objs is not portable!" Chris@39: func_append libobjs " $objs" Chris@39: fi Chris@39: fi Chris@39: Chris@39: test "$dlself" != no && \ Chris@39: func_warning "\`-dlopen self' is ignored for libtool libraries" Chris@39: Chris@39: set dummy $rpath Chris@39: shift Chris@39: test "$#" -gt 1 && \ Chris@39: func_warning "ignoring multiple \`-rpath's for a libtool library" Chris@39: Chris@39: install_libdir="$1" Chris@39: Chris@39: oldlibs= Chris@39: if test -z "$rpath"; then Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: # Building a libtool convenience library. Chris@39: # Some compilers have problems with a `.al' extension so Chris@39: # convenience libraries should have the same extension an Chris@39: # archive normally would. Chris@39: oldlibs="$output_objdir/$libname.$libext $oldlibs" Chris@39: build_libtool_libs=convenience Chris@39: build_old_libs=yes Chris@39: fi Chris@39: Chris@39: test -n "$vinfo" && \ Chris@39: func_warning "\`-version-info/-version-number' is ignored for convenience libraries" Chris@39: Chris@39: test -n "$release" && \ Chris@39: func_warning "\`-release' is ignored for convenience libraries" Chris@39: else Chris@39: Chris@39: # Parse the version information argument. Chris@39: save_ifs="$IFS"; IFS=':' Chris@39: set dummy $vinfo 0 0 0 Chris@39: shift Chris@39: IFS="$save_ifs" Chris@39: Chris@39: test -n "$7" && \ Chris@39: func_fatal_help "too many parameters to \`-version-info'" Chris@39: Chris@39: # convert absolute version numbers to libtool ages Chris@39: # this retains compatibility with .la files and attempts Chris@39: # to make the code below a bit more comprehensible Chris@39: Chris@39: case $vinfo_number in Chris@39: yes) Chris@39: number_major="$1" Chris@39: number_minor="$2" Chris@39: number_revision="$3" Chris@39: # Chris@39: # There are really only two kinds -- those that Chris@39: # use the current revision as the major version Chris@39: # and those that subtract age and use age as Chris@39: # a minor version. But, then there is irix Chris@39: # which has an extra 1 added just for fun Chris@39: # Chris@39: case $version_type in Chris@39: darwin|linux|osf|windows|none) Chris@39: func_arith $number_major + $number_minor Chris@39: current=$func_arith_result Chris@39: age="$number_minor" Chris@39: revision="$number_revision" Chris@39: ;; Chris@39: freebsd-aout|freebsd-elf|qnx|sunos) Chris@39: current="$number_major" Chris@39: revision="$number_minor" Chris@39: age="0" Chris@39: ;; Chris@39: irix|nonstopux) Chris@39: func_arith $number_major + $number_minor Chris@39: current=$func_arith_result Chris@39: age="$number_minor" Chris@39: revision="$number_minor" Chris@39: lt_irix_increment=no Chris@39: ;; Chris@39: *) Chris@39: func_fatal_configuration "$modename: unknown library version type \`$version_type'" Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: no) Chris@39: current="$1" Chris@39: revision="$2" Chris@39: age="$3" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Check that each of the things are valid numbers. Chris@39: case $current in Chris@39: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; Chris@39: *) Chris@39: func_error "CURRENT \`$current' must be a nonnegative integer" Chris@39: func_fatal_error "\`$vinfo' is not valid version information" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: case $revision in Chris@39: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; Chris@39: *) Chris@39: func_error "REVISION \`$revision' must be a nonnegative integer" Chris@39: func_fatal_error "\`$vinfo' is not valid version information" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: case $age in Chris@39: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; Chris@39: *) Chris@39: func_error "AGE \`$age' must be a nonnegative integer" Chris@39: func_fatal_error "\`$vinfo' is not valid version information" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: if test "$age" -gt "$current"; then Chris@39: func_error "AGE \`$age' is greater than the current interface number \`$current'" Chris@39: func_fatal_error "\`$vinfo' is not valid version information" Chris@39: fi Chris@39: Chris@39: # Calculate the version variables. Chris@39: major= Chris@39: versuffix= Chris@39: verstring= Chris@39: case $version_type in Chris@39: none) ;; Chris@39: Chris@39: darwin) Chris@39: # Like Linux, but with the current version available in Chris@39: # verstring for coding it into the library header Chris@39: func_arith $current - $age Chris@39: major=.$func_arith_result Chris@39: versuffix="$major.$age.$revision" Chris@39: # Darwin ld doesn't like 0 for these options... Chris@39: func_arith $current + 1 Chris@39: minor_current=$func_arith_result Chris@39: xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" Chris@39: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" Chris@39: ;; Chris@39: Chris@39: freebsd-aout) Chris@39: major=".$current" Chris@39: versuffix=".$current.$revision"; Chris@39: ;; Chris@39: Chris@39: freebsd-elf) Chris@39: major=".$current" Chris@39: versuffix=".$current" Chris@39: ;; Chris@39: Chris@39: irix | nonstopux) Chris@39: if test "X$lt_irix_increment" = "Xno"; then Chris@39: func_arith $current - $age Chris@39: else Chris@39: func_arith $current - $age + 1 Chris@39: fi Chris@39: major=$func_arith_result Chris@39: Chris@39: case $version_type in Chris@39: nonstopux) verstring_prefix=nonstopux ;; Chris@39: *) verstring_prefix=sgi ;; Chris@39: esac Chris@39: verstring="$verstring_prefix$major.$revision" Chris@39: Chris@39: # Add in all the interfaces that we are compatible with. Chris@39: loop=$revision Chris@39: while test "$loop" -ne 0; do Chris@39: func_arith $revision - $loop Chris@39: iface=$func_arith_result Chris@39: func_arith $loop - 1 Chris@39: loop=$func_arith_result Chris@39: verstring="$verstring_prefix$major.$iface:$verstring" Chris@39: done Chris@39: Chris@39: # Before this point, $major must not contain `.'. Chris@39: major=.$major Chris@39: versuffix="$major.$revision" Chris@39: ;; Chris@39: Chris@39: linux) Chris@39: func_arith $current - $age Chris@39: major=.$func_arith_result Chris@39: versuffix="$major.$age.$revision" Chris@39: ;; Chris@39: Chris@39: osf) Chris@39: func_arith $current - $age Chris@39: major=.$func_arith_result Chris@39: versuffix=".$current.$age.$revision" Chris@39: verstring="$current.$age.$revision" Chris@39: Chris@39: # Add in all the interfaces that we are compatible with. Chris@39: loop=$age Chris@39: while test "$loop" -ne 0; do Chris@39: func_arith $current - $loop Chris@39: iface=$func_arith_result Chris@39: func_arith $loop - 1 Chris@39: loop=$func_arith_result Chris@39: verstring="$verstring:${iface}.0" Chris@39: done Chris@39: Chris@39: # Make executables depend on our current version. Chris@39: func_append verstring ":${current}.0" Chris@39: ;; Chris@39: Chris@39: qnx) Chris@39: major=".$current" Chris@39: versuffix=".$current" Chris@39: ;; Chris@39: Chris@39: sunos) Chris@39: major=".$current" Chris@39: versuffix=".$current.$revision" Chris@39: ;; Chris@39: Chris@39: windows) Chris@39: # Use '-' rather than '.', since we only want one Chris@39: # extension on DOS 8.3 filesystems. Chris@39: func_arith $current - $age Chris@39: major=$func_arith_result Chris@39: versuffix="-$major" Chris@39: ;; Chris@39: Chris@39: *) Chris@39: func_fatal_configuration "unknown library version type \`$version_type'" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Clear the version info if we defaulted, and they specified a release. Chris@39: if test -z "$vinfo" && test -n "$release"; then Chris@39: major= Chris@39: case $version_type in Chris@39: darwin) Chris@39: # we can't check for "0.0" in archive_cmds due to quoting Chris@39: # problems, so we reset it completely Chris@39: verstring= Chris@39: ;; Chris@39: *) Chris@39: verstring="0.0" Chris@39: ;; Chris@39: esac Chris@39: if test "$need_version" = no; then Chris@39: versuffix= Chris@39: else Chris@39: versuffix=".0.0" Chris@39: fi Chris@39: fi Chris@39: Chris@39: # Remove version info from name if versioning should be avoided Chris@39: if test "$avoid_version" = yes && test "$need_version" = no; then Chris@39: major= Chris@39: versuffix= Chris@39: verstring="" Chris@39: fi Chris@39: Chris@39: # Check to see if the archive will have undefined symbols. Chris@39: if test "$allow_undefined" = yes; then Chris@39: if test "$allow_undefined_flag" = unsupported; then Chris@39: func_warning "undefined symbols not allowed in $host shared libraries" Chris@39: build_libtool_libs=no Chris@39: build_old_libs=yes Chris@39: fi Chris@39: else Chris@39: # Don't allow undefined symbols. Chris@39: allow_undefined_flag="$no_undefined_flag" Chris@39: fi Chris@39: Chris@39: fi Chris@39: Chris@39: func_generate_dlsyms "$libname" "$libname" "yes" Chris@39: func_append libobjs " $symfileobj" Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: Chris@39: if test "$opt_mode" != relink; then Chris@39: # Remove our outputs, but don't remove object files since they Chris@39: # may have been created when compiling PIC objects. Chris@39: removelist= Chris@39: tempremovelist=`$ECHO "$output_objdir/*"` Chris@39: for p in $tempremovelist; do Chris@39: case $p in Chris@39: *.$objext | *.gcno) Chris@39: ;; Chris@39: $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) Chris@39: if test "X$precious_files_regex" != "X"; then Chris@39: if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 Chris@39: then Chris@39: continue Chris@39: fi Chris@39: fi Chris@39: func_append removelist " $p" Chris@39: ;; Chris@39: *) ;; Chris@39: esac Chris@39: done Chris@39: test -n "$removelist" && \ Chris@39: func_show_eval "${RM}r \$removelist" Chris@39: fi Chris@39: Chris@39: # Now set the variables for building old libraries. Chris@39: if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then Chris@39: func_append oldlibs " $output_objdir/$libname.$libext" Chris@39: Chris@39: # Transform .lo files to .o files. Chris@39: oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` Chris@39: fi Chris@39: Chris@39: # Eliminate all temporary directories. Chris@39: #for path in $notinst_path; do Chris@39: # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` Chris@39: # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` Chris@39: # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` Chris@39: #done Chris@39: Chris@39: if test -n "$xrpath"; then Chris@39: # If the user specified any rpath flags, then add them. Chris@39: temp_xrpath= Chris@39: for libdir in $xrpath; do Chris@39: func_replace_sysroot "$libdir" Chris@39: func_append temp_xrpath " -R$func_replace_sysroot_result" Chris@39: case "$finalize_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append finalize_rpath " $libdir" ;; Chris@39: esac Chris@39: done Chris@39: if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then Chris@39: dependency_libs="$temp_xrpath $dependency_libs" Chris@39: fi Chris@39: fi Chris@39: Chris@39: # Make sure dlfiles contains only unique files that won't be dlpreopened Chris@39: old_dlfiles="$dlfiles" Chris@39: dlfiles= Chris@39: for lib in $old_dlfiles; do Chris@39: case " $dlprefiles $dlfiles " in Chris@39: *" $lib "*) ;; Chris@39: *) func_append dlfiles " $lib" ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: # Make sure dlprefiles contains only unique files Chris@39: old_dlprefiles="$dlprefiles" Chris@39: dlprefiles= Chris@39: for lib in $old_dlprefiles; do Chris@39: case "$dlprefiles " in Chris@39: *" $lib "*) ;; Chris@39: *) func_append dlprefiles " $lib" ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: if test -n "$rpath"; then Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) Chris@39: # these systems don't actually have a c library (as such)! Chris@39: ;; Chris@39: *-*-rhapsody* | *-*-darwin1.[012]) Chris@39: # Rhapsody C library is in the System framework Chris@39: func_append deplibs " System.ltframework" Chris@39: ;; Chris@39: *-*-netbsd*) Chris@39: # Don't link with libc until the a.out ld.so is fixed. Chris@39: ;; Chris@39: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) Chris@39: # Do not include libc due to us having libc/libc_r. Chris@39: ;; Chris@39: *-*-sco3.2v5* | *-*-sco5v6*) Chris@39: # Causes problems with __ctype Chris@39: ;; Chris@39: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) Chris@39: # Compiler inserts libc in the correct place for threads to work Chris@39: ;; Chris@39: *) Chris@39: # Add libc to deplibs on all other systems if necessary. Chris@39: if test "$build_libtool_need_lc" = "yes"; then Chris@39: func_append deplibs " -lc" Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: # Transform deplibs into only deplibs that can be linked in shared. Chris@39: name_save=$name Chris@39: libname_save=$libname Chris@39: release_save=$release Chris@39: versuffix_save=$versuffix Chris@39: major_save=$major Chris@39: # I'm not sure if I'm treating the release correctly. I think Chris@39: # release should show up in the -l (ie -lgmp5) so we don't want to Chris@39: # add it in twice. Is that correct? Chris@39: release="" Chris@39: versuffix="" Chris@39: major="" Chris@39: newdeplibs= Chris@39: droppeddeps=no Chris@39: case $deplibs_check_method in Chris@39: pass_all) Chris@39: # Don't check for shared/static. Everything works. Chris@39: # This might be a little naive. We might want to check Chris@39: # whether the library exists or not. But this is on Chris@39: # osf3 & osf4 and I'm not really sure... Just Chris@39: # implementing what was already the behavior. Chris@39: newdeplibs=$deplibs Chris@39: ;; Chris@39: test_compile) Chris@39: # This code stresses the "libraries are programs" paradigm to its Chris@39: # limits. Maybe even breaks it. We compile a program, linking it Chris@39: # against the deplibs as a proxy for the library. Then we can check Chris@39: # whether they linked in statically or dynamically with ldd. Chris@39: $opt_dry_run || $RM conftest.c Chris@39: cat > conftest.c </dev/null` Chris@39: $nocaseglob Chris@39: else Chris@39: potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` Chris@39: fi Chris@39: for potent_lib in $potential_libs; do Chris@39: # Follow soft links. Chris@39: if ls -lLd "$potent_lib" 2>/dev/null | Chris@39: $GREP " -> " >/dev/null; then Chris@39: continue Chris@39: fi Chris@39: # The statement above tries to avoid entering an Chris@39: # endless loop below, in case of cyclic links. Chris@39: # We might still enter an endless loop, since a link Chris@39: # loop can be closed while we follow links, Chris@39: # but so what? Chris@39: potlib="$potent_lib" Chris@39: while test -h "$potlib" 2>/dev/null; do Chris@39: potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` Chris@39: case $potliblink in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; Chris@39: *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; Chris@39: esac Chris@39: done Chris@39: if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | Chris@39: $SED -e 10q | Chris@39: $EGREP "$file_magic_regex" > /dev/null; then Chris@39: func_append newdeplibs " $a_deplib" Chris@39: a_deplib="" Chris@39: break 2 Chris@39: fi Chris@39: done Chris@39: done Chris@39: fi Chris@39: if test -n "$a_deplib" ; then Chris@39: droppeddeps=yes Chris@39: echo Chris@39: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." Chris@39: echo "*** I have the capability to make that library automatically link in when" Chris@39: echo "*** you link to this library. But I can only do this if you have a" Chris@39: echo "*** shared version of the library, which you do not appear to have" Chris@39: echo "*** because I did check the linker path looking for a file starting" Chris@39: if test -z "$potlib" ; then Chris@39: $ECHO "*** with $libname but no candidates were found. (...for file magic test)" Chris@39: else Chris@39: $ECHO "*** with $libname and none of the candidates passed a file format test" Chris@39: $ECHO "*** using a file magic. Last file checked: $potlib" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: # Add a -L argument. Chris@39: func_append newdeplibs " $a_deplib" Chris@39: ;; Chris@39: esac Chris@39: done # Gone through all deplibs. Chris@39: ;; Chris@39: match_pattern*) Chris@39: set dummy $deplibs_check_method; shift Chris@39: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` Chris@39: for a_deplib in $deplibs; do Chris@39: case $a_deplib in Chris@39: -l*) Chris@39: func_stripname -l '' "$a_deplib" Chris@39: name=$func_stripname_result Chris@39: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then Chris@39: case " $predeps $postdeps " in Chris@39: *" $a_deplib "*) Chris@39: func_append newdeplibs " $a_deplib" Chris@39: a_deplib="" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: if test -n "$a_deplib" ; then Chris@39: libname=`eval "\\$ECHO \"$libname_spec\""` Chris@39: for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do Chris@39: potential_libs=`ls $i/$libname[.-]* 2>/dev/null` Chris@39: for potent_lib in $potential_libs; do Chris@39: potlib="$potent_lib" # see symlink-check above in file_magic test Chris@39: if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ Chris@39: $EGREP "$match_pattern_regex" > /dev/null; then Chris@39: func_append newdeplibs " $a_deplib" Chris@39: a_deplib="" Chris@39: break 2 Chris@39: fi Chris@39: done Chris@39: done Chris@39: fi Chris@39: if test -n "$a_deplib" ; then Chris@39: droppeddeps=yes Chris@39: echo Chris@39: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." Chris@39: echo "*** I have the capability to make that library automatically link in when" Chris@39: echo "*** you link to this library. But I can only do this if you have a" Chris@39: echo "*** shared version of the library, which you do not appear to have" Chris@39: echo "*** because I did check the linker path looking for a file starting" Chris@39: if test -z "$potlib" ; then Chris@39: $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" Chris@39: else Chris@39: $ECHO "*** with $libname and none of the candidates passed a file format test" Chris@39: $ECHO "*** using a regex pattern. Last file checked: $potlib" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: # Add a -L argument. Chris@39: func_append newdeplibs " $a_deplib" Chris@39: ;; Chris@39: esac Chris@39: done # Gone through all deplibs. Chris@39: ;; Chris@39: none | unknown | *) Chris@39: newdeplibs="" Chris@39: tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` Chris@39: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then Chris@39: for i in $predeps $postdeps ; do Chris@39: # can't use Xsed below, because $i might contain '/' Chris@39: tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` Chris@39: done Chris@39: fi Chris@39: case $tmp_deplibs in Chris@39: *[!\ \ ]*) Chris@39: echo Chris@39: if test "X$deplibs_check_method" = "Xnone"; then Chris@39: echo "*** Warning: inter-library dependencies are not supported in this platform." Chris@39: else Chris@39: echo "*** Warning: inter-library dependencies are not known to be supported." Chris@39: fi Chris@39: echo "*** All declared inter-library dependencies are being dropped." Chris@39: droppeddeps=yes Chris@39: ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: versuffix=$versuffix_save Chris@39: major=$major_save Chris@39: release=$release_save Chris@39: libname=$libname_save Chris@39: name=$name_save Chris@39: Chris@39: case $host in Chris@39: *-*-rhapsody* | *-*-darwin1.[012]) Chris@39: # On Rhapsody replace the C library with the System framework Chris@39: newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` Chris@39: ;; Chris@39: esac Chris@39: Chris@39: if test "$droppeddeps" = yes; then Chris@39: if test "$module" = yes; then Chris@39: echo Chris@39: echo "*** Warning: libtool could not satisfy all declared inter-library" Chris@39: $ECHO "*** dependencies of module $libname. Therefore, libtool will create" Chris@39: echo "*** a static module, that should work as long as the dlopening" Chris@39: echo "*** application is linked with the -dlopen flag." Chris@39: if test -z "$global_symbol_pipe"; then Chris@39: echo Chris@39: echo "*** However, this would only work if libtool was able to extract symbol" Chris@39: echo "*** lists from a program, using \`nm' or equivalent, but libtool could" Chris@39: echo "*** not find such a program. So, this module is probably useless." Chris@39: echo "*** \`nm' from GNU binutils and a full rebuild may help." Chris@39: fi Chris@39: if test "$build_old_libs" = no; then Chris@39: oldlibs="$output_objdir/$libname.$libext" Chris@39: build_libtool_libs=module Chris@39: build_old_libs=yes Chris@39: else Chris@39: build_libtool_libs=no Chris@39: fi Chris@39: else Chris@39: echo "*** The inter-library dependencies that have been dropped here will be" Chris@39: echo "*** automatically added whenever a program is linked with this library" Chris@39: echo "*** or is declared to -dlopen it." Chris@39: Chris@39: if test "$allow_undefined" = no; then Chris@39: echo Chris@39: echo "*** Since this library must not contain undefined symbols," Chris@39: echo "*** because either the platform does not support them or" Chris@39: echo "*** it was explicitly requested with -no-undefined," Chris@39: echo "*** libtool will only create a static version of it." Chris@39: if test "$build_old_libs" = no; then Chris@39: oldlibs="$output_objdir/$libname.$libext" Chris@39: build_libtool_libs=module Chris@39: build_old_libs=yes Chris@39: else Chris@39: build_libtool_libs=no Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: # Done checking deplibs! Chris@39: deplibs=$newdeplibs Chris@39: fi Chris@39: # Time to change all our "foo.ltframework" stuff back to "-framework foo" Chris@39: case $host in Chris@39: *-*-darwin*) Chris@39: newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # move library search paths that coincide with paths to not yet Chris@39: # installed libraries to the beginning of the library search list Chris@39: new_libs= Chris@39: for path in $notinst_path; do Chris@39: case " $new_libs " in Chris@39: *" -L$path/$objdir "*) ;; Chris@39: *) Chris@39: case " $deplibs " in Chris@39: *" -L$path/$objdir "*) Chris@39: func_append new_libs " -L$path/$objdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: for deplib in $deplibs; do Chris@39: case $deplib in Chris@39: -L*) Chris@39: case " $new_libs " in Chris@39: *" $deplib "*) ;; Chris@39: *) func_append new_libs " $deplib" ;; Chris@39: esac Chris@39: ;; Chris@39: *) func_append new_libs " $deplib" ;; Chris@39: esac Chris@39: done Chris@39: deplibs="$new_libs" Chris@39: Chris@39: # All the library-specific variables (install_libdir is set above). Chris@39: library_names= Chris@39: old_library= Chris@39: dlname= Chris@39: Chris@39: # Test again, we may have decided not to build it any more Chris@39: if test "$build_libtool_libs" = yes; then Chris@39: if test "$hardcode_into_libs" = yes; then Chris@39: # Hardcode the library paths Chris@39: hardcode_libdirs= Chris@39: dep_rpath= Chris@39: rpath="$finalize_rpath" Chris@39: test "$opt_mode" != relink && rpath="$compile_rpath$rpath" Chris@39: for libdir in $rpath; do Chris@39: if test -n "$hardcode_libdir_flag_spec"; then Chris@39: if test -n "$hardcode_libdir_separator"; then Chris@39: func_replace_sysroot "$libdir" Chris@39: libdir=$func_replace_sysroot_result Chris@39: if test -z "$hardcode_libdirs"; then Chris@39: hardcode_libdirs="$libdir" Chris@39: else Chris@39: # Just accumulate the unique libdirs. Chris@39: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@39: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@39: ;; Chris@39: *) Chris@39: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: else Chris@39: eval flag=\"$hardcode_libdir_flag_spec\" Chris@39: func_append dep_rpath " $flag" Chris@39: fi Chris@39: elif test -n "$runpath_var"; then Chris@39: case "$perm_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_apped perm_rpath " $libdir" ;; Chris@39: esac Chris@39: fi Chris@39: done Chris@39: # Substitute the hardcoded libdirs into the rpath. Chris@39: if test -n "$hardcode_libdir_separator" && Chris@39: test -n "$hardcode_libdirs"; then Chris@39: libdir="$hardcode_libdirs" Chris@39: if test -n "$hardcode_libdir_flag_spec_ld"; then Chris@39: eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" Chris@39: else Chris@39: eval dep_rpath=\"$hardcode_libdir_flag_spec\" Chris@39: fi Chris@39: fi Chris@39: if test -n "$runpath_var" && test -n "$perm_rpath"; then Chris@39: # We should set the runpath_var. Chris@39: rpath= Chris@39: for dir in $perm_rpath; do Chris@39: func_append rpath "$dir:" Chris@39: done Chris@39: eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" Chris@39: fi Chris@39: test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" Chris@39: fi Chris@39: Chris@39: shlibpath="$finalize_shlibpath" Chris@39: test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" Chris@39: if test -n "$shlibpath"; then Chris@39: eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" Chris@39: fi Chris@39: Chris@39: # Get the real and link names of the library. Chris@39: eval shared_ext=\"$shrext_cmds\" Chris@39: eval library_names=\"$library_names_spec\" Chris@39: set dummy $library_names Chris@39: shift Chris@39: realname="$1" Chris@39: shift Chris@39: Chris@39: if test -n "$soname_spec"; then Chris@39: eval soname=\"$soname_spec\" Chris@39: else Chris@39: soname="$realname" Chris@39: fi Chris@39: if test -z "$dlname"; then Chris@39: dlname=$soname Chris@39: fi Chris@39: Chris@39: lib="$output_objdir/$realname" Chris@39: linknames= Chris@39: for link Chris@39: do Chris@39: func_append linknames " $link" Chris@39: done Chris@39: Chris@39: # Use standard objects if they are pic Chris@39: test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: Chris@39: delfiles= Chris@39: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@39: $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" Chris@39: export_symbols="$output_objdir/$libname.uexp" Chris@39: func_append delfiles " $export_symbols" Chris@39: fi Chris@39: Chris@39: orig_export_symbols= Chris@39: case $host_os in Chris@39: cygwin* | mingw* | cegcc*) Chris@39: if test -n "$export_symbols" && test -z "$export_symbols_regex"; then Chris@39: # exporting using user supplied symfile Chris@39: if test "x`$SED 1q $export_symbols`" != xEXPORTS; then Chris@39: # and it's NOT already a .def file. Must figure out Chris@39: # which of the given symbols are data symbols and tag Chris@39: # them as such. So, trigger use of export_symbols_cmds. Chris@39: # export_symbols gets reassigned inside the "prepare Chris@39: # the list of exported symbols" if statement, so the Chris@39: # include_expsyms logic still works. Chris@39: orig_export_symbols="$export_symbols" Chris@39: export_symbols= Chris@39: always_export_symbols=yes Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Prepare the list of exported symbols Chris@39: if test -z "$export_symbols"; then Chris@39: if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then Chris@39: func_verbose "generating symbol list for \`$libname.la'" Chris@39: export_symbols="$output_objdir/$libname.exp" Chris@39: $opt_dry_run || $RM $export_symbols Chris@39: cmds=$export_symbols_cmds Chris@39: save_ifs="$IFS"; IFS='~' Chris@39: for cmd1 in $cmds; do Chris@39: IFS="$save_ifs" Chris@39: # Take the normal branch if the nm_file_list_spec branch Chris@39: # doesn't work or if tool conversion is not needed. Chris@39: case $nm_file_list_spec~$to_tool_file_cmd in Chris@39: *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) Chris@39: try_normal_branch=yes Chris@39: eval cmd=\"$cmd1\" Chris@39: func_len " $cmd" Chris@39: len=$func_len_result Chris@39: ;; Chris@39: *) Chris@39: try_normal_branch=no Chris@39: ;; Chris@39: esac Chris@39: if test "$try_normal_branch" = yes \ Chris@39: && { test "$len" -lt "$max_cmd_len" \ Chris@39: || test "$max_cmd_len" -le -1; } Chris@39: then Chris@39: func_show_eval "$cmd" 'exit $?' Chris@39: skipped_export=false Chris@39: elif test -n "$nm_file_list_spec"; then Chris@39: func_basename "$output" Chris@39: output_la=$func_basename_result Chris@39: save_libobjs=$libobjs Chris@39: save_output=$output Chris@39: output=${output_objdir}/${output_la}.nm Chris@39: func_to_tool_file "$output" Chris@39: libobjs=$nm_file_list_spec$func_to_tool_file_result Chris@39: func_append delfiles " $output" Chris@39: func_verbose "creating $NM input file list: $output" Chris@39: for obj in $save_libobjs; do Chris@39: func_to_tool_file "$obj" Chris@39: $ECHO "$func_to_tool_file_result" Chris@39: done > "$output" Chris@39: eval cmd=\"$cmd1\" Chris@39: func_show_eval "$cmd" 'exit $?' Chris@39: output=$save_output Chris@39: libobjs=$save_libobjs Chris@39: skipped_export=false Chris@39: else Chris@39: # The command line is too long to execute in one step. Chris@39: func_verbose "using reloadable object file for export list..." Chris@39: skipped_export=: Chris@39: # Break out early, otherwise skipped_export may be Chris@39: # set to false by a later but shorter cmd. Chris@39: break Chris@39: fi Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then Chris@39: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' Chris@39: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@39: tmp_export_symbols="$export_symbols" Chris@39: test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" Chris@39: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' Chris@39: fi Chris@39: Chris@39: if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then Chris@39: # The given exports_symbols file has to be filtered, so filter it. Chris@39: func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" Chris@39: # FIXME: $output_objdir/$libname.filter potentially contains lots of Chris@39: # 's' commands which not all seds can handle. GNU sed should be fine Chris@39: # though. Also, the filter scales superlinearly with the number of Chris@39: # global variables. join(1) would be nice here, but unfortunately Chris@39: # isn't a blessed tool. Chris@39: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter Chris@39: func_append delfiles " $export_symbols $output_objdir/$libname.filter" Chris@39: export_symbols=$output_objdir/$libname.def Chris@39: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols Chris@39: fi Chris@39: Chris@39: tmp_deplibs= Chris@39: for test_deplib in $deplibs; do Chris@39: case " $convenience " in Chris@39: *" $test_deplib "*) ;; Chris@39: *) Chris@39: func_append tmp_deplibs " $test_deplib" Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: deplibs="$tmp_deplibs" Chris@39: Chris@39: if test -n "$convenience"; then Chris@39: if test -n "$whole_archive_flag_spec" && Chris@39: test "$compiler_needs_object" = yes && Chris@39: test -z "$libobjs"; then Chris@39: # extract the archives, so we have objects to list. Chris@39: # TODO: could optimize this to just extract one archive. Chris@39: whole_archive_flag_spec= Chris@39: fi Chris@39: if test -n "$whole_archive_flag_spec"; then Chris@39: save_libobjs=$libobjs Chris@39: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: else Chris@39: gentop="$output_objdir/${outputname}x" Chris@39: func_append generated " $gentop" Chris@39: Chris@39: func_extract_archives $gentop $convenience Chris@39: func_append libobjs " $func_extract_archives_result" Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then Chris@39: eval flag=\"$thread_safe_flag_spec\" Chris@39: func_append linker_flags " $flag" Chris@39: fi Chris@39: Chris@39: # Make a backup of the uninstalled library when relinking Chris@39: if test "$opt_mode" = relink; then Chris@39: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? Chris@39: fi Chris@39: Chris@39: # Do each of the archive commands. Chris@39: if test "$module" = yes && test -n "$module_cmds" ; then Chris@39: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then Chris@39: eval test_cmds=\"$module_expsym_cmds\" Chris@39: cmds=$module_expsym_cmds Chris@39: else Chris@39: eval test_cmds=\"$module_cmds\" Chris@39: cmds=$module_cmds Chris@39: fi Chris@39: else Chris@39: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then Chris@39: eval test_cmds=\"$archive_expsym_cmds\" Chris@39: cmds=$archive_expsym_cmds Chris@39: else Chris@39: eval test_cmds=\"$archive_cmds\" Chris@39: cmds=$archive_cmds Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test "X$skipped_export" != "X:" && Chris@39: func_len " $test_cmds" && Chris@39: len=$func_len_result && Chris@39: test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then Chris@39: : Chris@39: else Chris@39: # The command line is too long to link in one step, link piecewise Chris@39: # or, if using GNU ld and skipped_export is not :, use a linker Chris@39: # script. Chris@39: Chris@39: # Save the value of $output and $libobjs because we want to Chris@39: # use them later. If we have whole_archive_flag_spec, we Chris@39: # want to use save_libobjs as it was before Chris@39: # whole_archive_flag_spec was expanded, because we can't Chris@39: # assume the linker understands whole_archive_flag_spec. Chris@39: # This may have to be revisited, in case too many Chris@39: # convenience libraries get linked in and end up exceeding Chris@39: # the spec. Chris@39: if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then Chris@39: save_libobjs=$libobjs Chris@39: fi Chris@39: save_output=$output Chris@39: func_basename "$output" Chris@39: output_la=$func_basename_result Chris@39: Chris@39: # Clear the reloadable object creation command queue and Chris@39: # initialize k to one. Chris@39: test_cmds= Chris@39: concat_cmds= Chris@39: objlist= Chris@39: last_robj= Chris@39: k=1 Chris@39: Chris@39: if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then Chris@39: output=${output_objdir}/${output_la}.lnkscript Chris@39: func_verbose "creating GNU ld script: $output" Chris@39: echo 'INPUT (' > $output Chris@39: for obj in $save_libobjs Chris@39: do Chris@39: func_to_tool_file "$obj" Chris@39: $ECHO "$func_to_tool_file_result" >> $output Chris@39: done Chris@39: echo ')' >> $output Chris@39: func_append delfiles " $output" Chris@39: func_to_tool_file "$output" Chris@39: output=$func_to_tool_file_result Chris@39: elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then Chris@39: output=${output_objdir}/${output_la}.lnk Chris@39: func_verbose "creating linker input file list: $output" Chris@39: : > $output Chris@39: set x $save_libobjs Chris@39: shift Chris@39: firstobj= Chris@39: if test "$compiler_needs_object" = yes; then Chris@39: firstobj="$1 " Chris@39: shift Chris@39: fi Chris@39: for obj Chris@39: do Chris@39: func_to_tool_file "$obj" Chris@39: $ECHO "$func_to_tool_file_result" >> $output Chris@39: done Chris@39: func_append delfiles " $output" Chris@39: func_to_tool_file "$output" Chris@39: output=$firstobj\"$file_list_spec$func_to_tool_file_result\" Chris@39: else Chris@39: if test -n "$save_libobjs"; then Chris@39: func_verbose "creating reloadable object files..." Chris@39: output=$output_objdir/$output_la-${k}.$objext Chris@39: eval test_cmds=\"$reload_cmds\" Chris@39: func_len " $test_cmds" Chris@39: len0=$func_len_result Chris@39: len=$len0 Chris@39: Chris@39: # Loop over the list of objects to be linked. Chris@39: for obj in $save_libobjs Chris@39: do Chris@39: func_len " $obj" Chris@39: func_arith $len + $func_len_result Chris@39: len=$func_arith_result Chris@39: if test "X$objlist" = X || Chris@39: test "$len" -lt "$max_cmd_len"; then Chris@39: func_append objlist " $obj" Chris@39: else Chris@39: # The command $test_cmds is almost too long, add a Chris@39: # command to the queue. Chris@39: if test "$k" -eq 1 ; then Chris@39: # The first file doesn't have a previous command to add. Chris@39: reload_objs=$objlist Chris@39: eval concat_cmds=\"$reload_cmds\" Chris@39: else Chris@39: # All subsequent reloadable object files will link in Chris@39: # the last one created. Chris@39: reload_objs="$objlist $last_robj" Chris@39: eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" Chris@39: fi Chris@39: last_robj=$output_objdir/$output_la-${k}.$objext Chris@39: func_arith $k + 1 Chris@39: k=$func_arith_result Chris@39: output=$output_objdir/$output_la-${k}.$objext Chris@39: objlist=" $obj" Chris@39: func_len " $last_robj" Chris@39: func_arith $len0 + $func_len_result Chris@39: len=$func_arith_result Chris@39: fi Chris@39: done Chris@39: # Handle the remaining objects by creating one last Chris@39: # reloadable object file. All subsequent reloadable object Chris@39: # files will link in the last one created. Chris@39: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@39: reload_objs="$objlist $last_robj" Chris@39: eval concat_cmds=\"\${concat_cmds}$reload_cmds\" Chris@39: if test -n "$last_robj"; then Chris@39: eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" Chris@39: fi Chris@39: func_append delfiles " $output" Chris@39: Chris@39: else Chris@39: output= Chris@39: fi Chris@39: Chris@39: if ${skipped_export-false}; then Chris@39: func_verbose "generating symbol list for \`$libname.la'" Chris@39: export_symbols="$output_objdir/$libname.exp" Chris@39: $opt_dry_run || $RM $export_symbols Chris@39: libobjs=$output Chris@39: # Append the command to create the export file. Chris@39: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@39: eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" Chris@39: if test -n "$last_robj"; then Chris@39: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" Chris@39: fi Chris@39: fi Chris@39: Chris@39: test -n "$save_libobjs" && Chris@39: func_verbose "creating a temporary reloadable object file: $output" Chris@39: Chris@39: # Loop through the commands generated above and execute them. Chris@39: save_ifs="$IFS"; IFS='~' Chris@39: for cmd in $concat_cmds; do Chris@39: IFS="$save_ifs" Chris@39: $opt_silent || { Chris@39: func_quote_for_expand "$cmd" Chris@39: eval "func_echo $func_quote_for_expand_result" Chris@39: } Chris@39: $opt_dry_run || eval "$cmd" || { Chris@39: lt_exit=$? Chris@39: Chris@39: # Restore the uninstalled library and exit Chris@39: if test "$opt_mode" = relink; then Chris@39: ( cd "$output_objdir" && \ Chris@39: $RM "${realname}T" && \ Chris@39: $MV "${realname}U" "$realname" ) Chris@39: fi Chris@39: Chris@39: exit $lt_exit Chris@39: } Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: Chris@39: if test -n "$export_symbols_regex" && ${skipped_export-false}; then Chris@39: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' Chris@39: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' Chris@39: fi Chris@39: fi Chris@39: Chris@39: if ${skipped_export-false}; then Chris@39: if test -n "$export_symbols" && test -n "$include_expsyms"; then Chris@39: tmp_export_symbols="$export_symbols" Chris@39: test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" Chris@39: $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' Chris@39: fi Chris@39: Chris@39: if test -n "$orig_export_symbols"; then Chris@39: # The given exports_symbols file has to be filtered, so filter it. Chris@39: func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" Chris@39: # FIXME: $output_objdir/$libname.filter potentially contains lots of Chris@39: # 's' commands which not all seds can handle. GNU sed should be fine Chris@39: # though. Also, the filter scales superlinearly with the number of Chris@39: # global variables. join(1) would be nice here, but unfortunately Chris@39: # isn't a blessed tool. Chris@39: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter Chris@39: func_append delfiles " $export_symbols $output_objdir/$libname.filter" Chris@39: export_symbols=$output_objdir/$libname.def Chris@39: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols Chris@39: fi Chris@39: fi Chris@39: Chris@39: libobjs=$output Chris@39: # Restore the value of output. Chris@39: output=$save_output Chris@39: Chris@39: if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then Chris@39: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: fi Chris@39: # Expand the library linking commands again to reset the Chris@39: # value of $libobjs for piecewise linking. Chris@39: Chris@39: # Do each of the archive commands. Chris@39: if test "$module" = yes && test -n "$module_cmds" ; then Chris@39: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then Chris@39: cmds=$module_expsym_cmds Chris@39: else Chris@39: cmds=$module_cmds Chris@39: fi Chris@39: else Chris@39: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then Chris@39: cmds=$archive_expsym_cmds Chris@39: else Chris@39: cmds=$archive_cmds Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test -n "$delfiles"; then Chris@39: # Append the command to remove temporary files to $cmds. Chris@39: eval cmds=\"\$cmds~\$RM $delfiles\" Chris@39: fi Chris@39: Chris@39: # Add any objects from preloaded convenience libraries Chris@39: if test -n "$dlprefiles"; then Chris@39: gentop="$output_objdir/${outputname}x" Chris@39: func_append generated " $gentop" Chris@39: Chris@39: func_extract_archives $gentop $dlprefiles Chris@39: func_append libobjs " $func_extract_archives_result" Chris@39: test "X$libobjs" = "X " && libobjs= Chris@39: fi Chris@39: Chris@39: save_ifs="$IFS"; IFS='~' Chris@39: for cmd in $cmds; do Chris@39: IFS="$save_ifs" Chris@39: eval cmd=\"$cmd\" Chris@39: $opt_silent || { Chris@39: func_quote_for_expand "$cmd" Chris@39: eval "func_echo $func_quote_for_expand_result" Chris@39: } Chris@39: $opt_dry_run || eval "$cmd" || { Chris@39: lt_exit=$? Chris@39: Chris@39: # Restore the uninstalled library and exit Chris@39: if test "$opt_mode" = relink; then Chris@39: ( cd "$output_objdir" && \ Chris@39: $RM "${realname}T" && \ Chris@39: $MV "${realname}U" "$realname" ) Chris@39: fi Chris@39: Chris@39: exit $lt_exit Chris@39: } Chris@39: done Chris@39: IFS="$save_ifs" Chris@39: Chris@39: # Restore the uninstalled library and exit Chris@39: if test "$opt_mode" = relink; then Chris@39: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? Chris@39: Chris@39: if test -n "$convenience"; then Chris@39: if test -z "$whole_archive_flag_spec"; then Chris@39: func_show_eval '${RM}r "$gentop"' Chris@39: fi Chris@39: fi Chris@39: Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: Chris@39: # Create links to the real library. Chris@39: for linkname in $linknames; do Chris@39: if test "$realname" != "$linkname"; then Chris@39: func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' Chris@39: fi Chris@39: done Chris@39: Chris@39: # If -module or -export-dynamic was specified, set the dlname. Chris@39: if test "$module" = yes || test "$export_dynamic" = yes; then Chris@39: # On all known operating systems, these are identical. Chris@39: dlname="$soname" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: Chris@39: obj) Chris@39: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then Chris@39: func_warning "\`-dlopen' is ignored for objects" Chris@39: fi Chris@39: Chris@39: case " $deplibs" in Chris@39: *\ -l* | *\ -L*) Chris@39: func_warning "\`-l' and \`-L' are ignored for objects" ;; Chris@39: esac Chris@39: Chris@39: test -n "$rpath" && \ Chris@39: func_warning "\`-rpath' is ignored for objects" Chris@39: Chris@39: test -n "$xrpath" && \ Chris@39: func_warning "\`-R' is ignored for objects" Chris@39: Chris@39: test -n "$vinfo" && \ Chris@39: func_warning "\`-version-info' is ignored for objects" Chris@39: Chris@39: test -n "$release" && \ Chris@39: func_warning "\`-release' is ignored for objects" Chris@39: Chris@39: case $output in Chris@39: *.lo) Chris@39: test -n "$objs$old_deplibs" && \ Chris@39: func_fatal_error "cannot build library object \`$output' from non-libtool objects" Chris@39: Chris@39: libobj=$output Chris@39: func_lo2o "$libobj" Chris@39: obj=$func_lo2o_result Chris@39: ;; Chris@39: *) Chris@39: libobj= Chris@39: obj="$output" Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # Delete the old objects. Chris@39: $opt_dry_run || $RM $obj $libobj Chris@39: Chris@39: # Objects from convenience libraries. This assumes Chris@39: # single-version convenience libraries. Whenever we create Chris@39: # different ones for PIC/non-PIC, this we'll have to duplicate Chris@39: # the extraction. Chris@39: reload_conv_objs= Chris@39: gentop= Chris@39: # reload_cmds runs $LD directly, so let us get rid of Chris@39: # -Wl from whole_archive_flag_spec and hope we can get by with Chris@39: # turning comma into space.. Chris@39: wl= Chris@39: Chris@39: if test -n "$convenience"; then Chris@39: if test -n "$whole_archive_flag_spec"; then Chris@39: eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" Chris@39: reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` Chris@39: else Chris@39: gentop="$output_objdir/${obj}x" Chris@39: func_append generated " $gentop" Chris@39: Chris@39: func_extract_archives $gentop $convenience Chris@39: reload_conv_objs="$reload_objs $func_extract_archives_result" Chris@39: fi Chris@39: fi Chris@39: Chris@39: # If we're not building shared, we need to use non_pic_objs Chris@39: test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" Chris@39: Chris@39: # Create the old-style object. Chris@39: reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test Chris@39: Chris@39: output="$obj" Chris@39: func_execute_cmds "$reload_cmds" 'exit $?' Chris@39: Chris@39: # Exit if we aren't doing a library object file. Chris@39: if test -z "$libobj"; then Chris@39: if test -n "$gentop"; then Chris@39: func_show_eval '${RM}r "$gentop"' Chris@39: fi Chris@39: Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: Chris@39: if test "$build_libtool_libs" != yes; then Chris@39: if test -n "$gentop"; then Chris@39: func_show_eval '${RM}r "$gentop"' Chris@39: fi Chris@39: Chris@39: # Create an invalid libtool object if no PIC, so that we don't Chris@39: # accidentally link it into a program. Chris@39: # $show "echo timestamp > $libobj" Chris@39: # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: Chris@39: if test -n "$pic_flag" || test "$pic_mode" != default; then Chris@39: # Only do commands if we really have different PIC objects. Chris@39: reload_objs="$libobjs $reload_conv_objs" Chris@39: output="$libobj" Chris@39: func_execute_cmds "$reload_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: if test -n "$gentop"; then Chris@39: func_show_eval '${RM}r "$gentop"' Chris@39: fi Chris@39: Chris@39: exit $EXIT_SUCCESS Chris@39: ;; Chris@39: Chris@39: prog) Chris@39: case $host in Chris@39: *cygwin*) func_stripname '' '.exe' "$output" Chris@39: output=$func_stripname_result.exe;; Chris@39: esac Chris@39: test -n "$vinfo" && \ Chris@39: func_warning "\`-version-info' is ignored for programs" Chris@39: Chris@39: test -n "$release" && \ Chris@39: func_warning "\`-release' is ignored for programs" Chris@39: Chris@39: test "$preload" = yes \ Chris@39: && test "$dlopen_support" = unknown \ Chris@39: && test "$dlopen_self" = unknown \ Chris@39: && test "$dlopen_self_static" = unknown && \ Chris@39: func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." Chris@39: Chris@39: case $host in Chris@39: *-*-rhapsody* | *-*-darwin1.[012]) Chris@39: # On Rhapsody replace the C library is the System framework Chris@39: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` Chris@39: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` Chris@39: ;; Chris@39: esac Chris@39: Chris@39: case $host in Chris@39: *-*-darwin*) Chris@39: # Don't allow lazy linking, it breaks C++ global constructors Chris@39: # But is supposedly fixed on 10.4 or later (yay!). Chris@39: if test "$tagname" = CXX ; then Chris@39: case ${MACOSX_DEPLOYMENT_TARGET-10.0} in Chris@39: 10.[0123]) Chris@39: func_append compile_command " ${wl}-bind_at_load" Chris@39: func_append finalize_command " ${wl}-bind_at_load" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: # Time to change all our "foo.ltframework" stuff back to "-framework foo" Chris@39: compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` Chris@39: ;; Chris@39: esac Chris@39: Chris@39: Chris@39: # move library search paths that coincide with paths to not yet Chris@39: # installed libraries to the beginning of the library search list Chris@39: new_libs= Chris@39: for path in $notinst_path; do Chris@39: case " $new_libs " in Chris@39: *" -L$path/$objdir "*) ;; Chris@39: *) Chris@39: case " $compile_deplibs " in Chris@39: *" -L$path/$objdir "*) Chris@39: func_append new_libs " -L$path/$objdir" ;; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: for deplib in $compile_deplibs; do Chris@39: case $deplib in Chris@39: -L*) Chris@39: case " $new_libs " in Chris@39: *" $deplib "*) ;; Chris@39: *) func_append new_libs " $deplib" ;; Chris@39: esac Chris@39: ;; Chris@39: *) func_append new_libs " $deplib" ;; Chris@39: esac Chris@39: done Chris@39: compile_deplibs="$new_libs" Chris@39: Chris@39: Chris@39: func_append compile_command " $compile_deplibs" Chris@39: func_append finalize_command " $finalize_deplibs" Chris@39: Chris@39: if test -n "$rpath$xrpath"; then Chris@39: # If the user specified any rpath flags, then add them. Chris@39: for libdir in $rpath $xrpath; do Chris@39: # This is the magic to use -rpath. Chris@39: case "$finalize_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append finalize_rpath " $libdir" ;; Chris@39: esac Chris@39: done Chris@39: fi Chris@39: Chris@39: # Now hardcode the library paths Chris@39: rpath= Chris@39: hardcode_libdirs= Chris@39: for libdir in $compile_rpath $finalize_rpath; do Chris@39: if test -n "$hardcode_libdir_flag_spec"; then Chris@39: if test -n "$hardcode_libdir_separator"; then Chris@39: if test -z "$hardcode_libdirs"; then Chris@39: hardcode_libdirs="$libdir" Chris@39: else Chris@39: # Just accumulate the unique libdirs. Chris@39: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@39: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@39: ;; Chris@39: *) Chris@39: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: else Chris@39: eval flag=\"$hardcode_libdir_flag_spec\" Chris@39: func_append rpath " $flag" Chris@39: fi Chris@39: elif test -n "$runpath_var"; then Chris@39: case "$perm_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append perm_rpath " $libdir" ;; Chris@39: esac Chris@39: fi Chris@39: case $host in Chris@39: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) Chris@39: testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` Chris@39: case :$dllsearchpath: in Chris@39: *":$libdir:"*) ;; Chris@39: ::) dllsearchpath=$libdir;; Chris@39: *) func_append dllsearchpath ":$libdir";; Chris@39: esac Chris@39: case :$dllsearchpath: in Chris@39: *":$testbindir:"*) ;; Chris@39: ::) dllsearchpath=$testbindir;; Chris@39: *) func_append dllsearchpath ":$testbindir";; Chris@39: esac Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: # Substitute the hardcoded libdirs into the rpath. Chris@39: if test -n "$hardcode_libdir_separator" && Chris@39: test -n "$hardcode_libdirs"; then Chris@39: libdir="$hardcode_libdirs" Chris@39: eval rpath=\" $hardcode_libdir_flag_spec\" Chris@39: fi Chris@39: compile_rpath="$rpath" Chris@39: Chris@39: rpath= Chris@39: hardcode_libdirs= Chris@39: for libdir in $finalize_rpath; do Chris@39: if test -n "$hardcode_libdir_flag_spec"; then Chris@39: if test -n "$hardcode_libdir_separator"; then Chris@39: if test -z "$hardcode_libdirs"; then Chris@39: hardcode_libdirs="$libdir" Chris@39: else Chris@39: # Just accumulate the unique libdirs. Chris@39: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in Chris@39: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) Chris@39: ;; Chris@39: *) Chris@39: func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: else Chris@39: eval flag=\"$hardcode_libdir_flag_spec\" Chris@39: func_append rpath " $flag" Chris@39: fi Chris@39: elif test -n "$runpath_var"; then Chris@39: case "$finalize_perm_rpath " in Chris@39: *" $libdir "*) ;; Chris@39: *) func_append finalize_perm_rpath " $libdir" ;; Chris@39: esac Chris@39: fi Chris@39: done Chris@39: # Substitute the hardcoded libdirs into the rpath. Chris@39: if test -n "$hardcode_libdir_separator" && Chris@39: test -n "$hardcode_libdirs"; then Chris@39: libdir="$hardcode_libdirs" Chris@39: eval rpath=\" $hardcode_libdir_flag_spec\" Chris@39: fi Chris@39: finalize_rpath="$rpath" Chris@39: Chris@39: if test -n "$libobjs" && test "$build_old_libs" = yes; then Chris@39: # Transform all the library objects into standard objects. Chris@39: compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@39: finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` Chris@39: fi Chris@39: Chris@39: func_generate_dlsyms "$outputname" "@PROGRAM@" "no" Chris@39: Chris@39: # template prelinking step Chris@39: if test -n "$prelink_cmds"; then Chris@39: func_execute_cmds "$prelink_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: wrappers_required=yes Chris@39: case $host in Chris@39: *cegcc* | *mingw32ce*) Chris@39: # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. Chris@39: wrappers_required=no Chris@39: ;; Chris@39: *cygwin* | *mingw* ) Chris@39: if test "$build_libtool_libs" != yes; then Chris@39: wrappers_required=no Chris@39: fi Chris@39: ;; Chris@39: *) Chris@39: if test "$need_relink" = no || test "$build_libtool_libs" != yes; then Chris@39: wrappers_required=no Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: if test "$wrappers_required" = no; then Chris@39: # Replace the output file specification. Chris@39: compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` Chris@39: link_command="$compile_command$compile_rpath" Chris@39: Chris@39: # We have no uninstalled library dependencies, so finalize right now. Chris@39: exit_status=0 Chris@39: func_show_eval "$link_command" 'exit_status=$?' Chris@39: Chris@39: if test -n "$postlink_cmds"; then Chris@39: func_to_tool_file "$output" Chris@39: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` Chris@39: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: # Delete the generated files. Chris@39: if test -f "$output_objdir/${outputname}S.${objext}"; then Chris@39: func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' Chris@39: fi Chris@39: Chris@39: exit $exit_status Chris@39: fi Chris@39: Chris@39: if test -n "$compile_shlibpath$finalize_shlibpath"; then Chris@39: compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" Chris@39: fi Chris@39: if test -n "$finalize_shlibpath"; then Chris@39: finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" Chris@39: fi Chris@39: Chris@39: compile_var= Chris@39: finalize_var= Chris@39: if test -n "$runpath_var"; then Chris@39: if test -n "$perm_rpath"; then Chris@39: # We should set the runpath_var. Chris@39: rpath= Chris@39: for dir in $perm_rpath; do Chris@39: func_append rpath "$dir:" Chris@39: done Chris@39: compile_var="$runpath_var=\"$rpath\$$runpath_var\" " Chris@39: fi Chris@39: if test -n "$finalize_perm_rpath"; then Chris@39: # We should set the runpath_var. Chris@39: rpath= Chris@39: for dir in $finalize_perm_rpath; do Chris@39: func_append rpath "$dir:" Chris@39: done Chris@39: finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " Chris@39: fi Chris@39: fi Chris@39: Chris@39: if test "$no_install" = yes; then Chris@39: # We don't need to create a wrapper script. Chris@39: link_command="$compile_var$compile_command$compile_rpath" Chris@39: # Replace the output file specification. Chris@39: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` Chris@39: # Delete the old output file. Chris@39: $opt_dry_run || $RM $output Chris@39: # Link the executable and exit Chris@39: func_show_eval "$link_command" 'exit $?' Chris@39: Chris@39: if test -n "$postlink_cmds"; then Chris@39: func_to_tool_file "$output" Chris@39: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` Chris@39: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: exit $EXIT_SUCCESS Chris@39: fi Chris@39: Chris@39: if test "$hardcode_action" = relink; then Chris@39: # Fast installation is not supported Chris@39: link_command="$compile_var$compile_command$compile_rpath" Chris@39: relink_command="$finalize_var$finalize_command$finalize_rpath" Chris@39: Chris@39: func_warning "this platform does not like uninstalled shared libraries" Chris@39: func_warning "\`$output' will be relinked during installation" Chris@39: else Chris@39: if test "$fast_install" != no; then Chris@39: link_command="$finalize_var$compile_command$finalize_rpath" Chris@39: if test "$fast_install" = yes; then Chris@39: relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` Chris@39: else Chris@39: # fast_install is set to needless Chris@39: relink_command= Chris@39: fi Chris@39: else Chris@39: link_command="$compile_var$compile_command$compile_rpath" Chris@39: relink_command="$finalize_var$finalize_command$finalize_rpath" Chris@39: fi Chris@39: fi Chris@39: Chris@39: # Replace the output file specification. Chris@39: link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` Chris@39: Chris@39: # Delete the old output files. Chris@39: $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname Chris@39: Chris@39: func_show_eval "$link_command" 'exit $?' Chris@39: Chris@39: if test -n "$postlink_cmds"; then Chris@39: func_to_tool_file "$output_objdir/$outputname" Chris@39: postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` Chris@39: func_execute_cmds "$postlink_cmds" 'exit $?' Chris@39: fi Chris@39: Chris@39: # Now create the wrapper script. Chris@39: func_verbose "creating $output" Chris@39: Chris@39: # Quote the relink command for shipping. Chris@39: if test -n "$relink_command"; then Chris@39: # Preserve any variables that may affect compiler behavior Chris@39: for var in $variables_saved_for_relink; do Chris@39: if eval test -z \"\${$var+set}\"; then Chris@39: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" Chris@39: elif eval var_value=\$$var; test -z "$var_value"; then Chris@39: relink_command="$var=; export $var; $relink_command" Chris@39: else Chris@39: func_quote_for_eval "$var_value" Chris@39: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" Chris@39: fi Chris@39: done Chris@39: relink_command="(cd `pwd`; $relink_command)" Chris@39: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` Chris@39: fi Chris@39: Chris@39: # Only actually do things if not in dry run mode. Chris@39: $opt_dry_run || { Chris@39: # win32 will think the script is a binary if it has Chris@39: # a .exe suffix, so we strip it off here. Chris@39: case $output in Chris@39: *.exe) func_stripname '' '.exe' "$output" Chris@39: output=$func_stripname_result ;; Chris@39: esac Chris@39: # test for cygwin because mv fails w/o .exe extensions Chris@39: case $host in Chris@39: *cygwin*) Chris@39: exeext=.exe Chris@39: func_stripname '' '.exe' "$outputname" Chris@39: outputname=$func_stripname_result ;; Chris@39: *) exeext= ;; Chris@39: esac Chris@39: case $host in Chris@39: *cygwin* | *mingw* ) Chris@39: func_dirname_and_basename "$output" "" "." Chris@39: output_name=$func_basename_result Chris@39: output_path=$func_dirname_result Chris@39: cwrappersource="$output_path/$objdir/lt-$output_name.c" Chris@39: cwrapper="$output_path/$output_name.exe" Chris@39: $RM $cwrappersource $cwrapper Chris@39: trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 Chris@39: Chris@39: func_emit_cwrapperexe_src > $cwrappersource Chris@39: Chris@39: # The wrapper executable is built using the $host compiler, Chris@39: # because it contains $host paths and files. If cross- Chris@39: # compiling, it, like the target executable, must be Chris@39: # executed on the $host or under an emulation environment. Chris@39: $opt_dry_run || { Chris@39: $LTCC $LTCFLAGS -o $cwrapper $cwrappersource Chris@39: $STRIP $cwrapper Chris@39: } Chris@39: Chris@39: # Now, create the wrapper script for func_source use: Chris@39: func_ltwrapper_scriptname $cwrapper Chris@39: $RM $func_ltwrapper_scriptname_result Chris@39: trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 Chris@39: $opt_dry_run || { Chris@39: # note: this script will not be executed, so do not chmod. Chris@39: if test "x$build" = "x$host" ; then Chris@39: $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result Chris@39: else Chris@39: func_emit_wrapper no > $func_ltwrapper_scriptname_result Chris@39: fi Chris@39: } Chris@39: ;; Chris@39: * ) Chris@39: $RM $output Chris@39: trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 Chris@39: Chris@39: func_emit_wrapper no > $output Chris@39: chmod +x $output Chris@39: ;; Chris@39: esac Chris@39: } Chris@39: exit $EXIT_SUCCESS Chris@39: ;; Chris@39: esac Chris@39: Chris@39: # See if we need to build an old-fashioned archive. Chris@39: for oldlib in $oldlibs; do Chris@39: Chris@39: if test "$build_libtool_libs" = convenience; then Chris@39: oldobjs="$libobjs_save $symfileobj" Chris@39: addlibs="$convenience" Chris@39: build_libtool_libs=no Chris@39: else Chris@39: if test "$build_libtool_libs" = module; then Chris@39: oldobjs="$libobjs_save" Chris@39: build_libtool_libs=no Chris@39: else Chris@39: oldobjs="$old_deplibs $non_pic_objects" Chris@39: if test "$preload" = yes && test -f "$symfileobj"; then Chris@39: func_append oldobjs " $symfileobj" Chris@39: fi Chris@39: fi Chris@39: addlibs="$old_convenience" Chris@39: fi Chris@39: Chris@39: if test -n "$addlibs"; then Chris@39: gentop="$output_objdir/${outputname}x" Chris@39: func_append generated " $gentop" Chris@39: Chris@39: func_extract_archives $gentop $addlibs Chris@39: func_append oldobjs " $func_extract_archives_result" Chris@39: fi Chris@39: Chris@39: # Do each command in the archive commands. Chris@39: if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then Chris@39: cmds=$old_archive_from_new_cmds Chris@39: else Chris@39: Chris@39: # Add any objects from preloaded convenience libraries Chris@39: if test -n "$dlprefiles"; then Chris@39: gentop="$output_objdir/${outputname}x" Chris@39: func_append generated " $gentop" Chris@39: Chris@39: func_extract_archives $gentop $dlprefiles Chris@39: func_append oldobjs " $func_extract_archives_result" Chris@39: fi Chris@39: Chris@39: # POSIX demands no paths to be encoded in archives. We have Chris@39: # to avoid creating archives with duplicate basenames if we Chris@39: # might have to extract them afterwards, e.g., when creating a Chris@39: # static archive out of a convenience library, or when linking Chris@39: # the entirety of a libtool archive into another (currently Chris@39: # not supported by libtool). Chris@39: if (for obj in $oldobjs Chris@39: do Chris@39: func_basename "$obj" Chris@39: $ECHO "$func_basename_result" Chris@39: done | sort | sort -uc >/dev/null 2>&1); then Chris@39: : Chris@39: else Chris@39: echo "copying selected object files to avoid basename conflicts..." Chris@39: gentop="$output_objdir/${outputname}x" Chris@39: func_append generated " $gentop" Chris@39: func_mkdir_p "$gentop" Chris@39: save_oldobjs=$oldobjs Chris@39: oldobjs= Chris@39: counter=1 Chris@39: for obj in $save_oldobjs Chris@39: do Chris@39: func_basename "$obj" Chris@39: objbase="$func_basename_result" Chris@39: case " $oldobjs " in Chris@39: " ") oldobjs=$obj ;; Chris@39: *[\ /]"$objbase "*) Chris@39: while :; do Chris@39: # Make sure we don't pick an alternate name that also Chris@39: # overlaps. Chris@39: newobj=lt$counter-$objbase Chris@39: func_arith $counter + 1 Chris@39: counter=$func_arith_result Chris@39: case " $oldobjs " in Chris@39: *[\ /]"$newobj "*) ;; Chris@39: *) if test ! -f "$gentop/$newobj"; then break; fi ;; Chris@39: esac Chris@39: done Chris@39: func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" Chris@39: func_append oldobjs " $gentop/$newobj" Chris@39: ;; Chris@39: *) func_append oldobjs " $obj" ;; Chris@39: esac Chris@39: done Chris@39: fi Chris@39: eval cmds=\"$old_archive_cmds\" Chris@39: Chris@39: func_len " $cmds" Chris@39: len=$func_len_result Chris@39: if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then Chris@39: cmds=$old_archive_cmds Chris@39: elif test -n "$archiver_list_spec"; then Chris@39: func_verbose "using command file archive linking..." Chris@39: for obj in $oldobjs Chris@39: do Chris@39: func_to_tool_file "$obj" Chris@39: $ECHO "$func_to_tool_file_result" Chris@39: done > $output_objdir/$libname.libcmd Chris@39: func_to_tool_file "$output_objdir/$libname.libcmd" Chris@39: oldobjs=" $archiver_list_spec$func_to_tool_file_result" Chris@39: cmds=$old_archive_cmds Chris@39: else Chris@39: # the command line is too long to link in one step, link in parts Chris@39: func_verbose "using piecewise archive linking..." Chris@39: save_RANLIB=$RANLIB Chris@39: RANLIB=: Chris@39: objlist= Chris@39: concat_cmds= Chris@39: save_oldobjs=$oldobjs Chris@39: oldobjs= Chris@39: # Is there a better way of finding the last object in the list? Chris@39: for obj in $save_oldobjs Chris@39: do Chris@39: last_oldobj=$obj Chris@39: done Chris@39: eval test_cmds=\"$old_archive_cmds\" Chris@39: func_len " $test_cmds" Chris@39: len0=$func_len_result Chris@39: len=$len0 Chris@39: for obj in $save_oldobjs Chris@39: do Chris@39: func_len " $obj" Chris@39: func_arith $len + $func_len_result Chris@39: len=$func_arith_result Chris@39: func_append objlist " $obj" Chris@39: if test "$len" -lt "$max_cmd_len"; then Chris@39: : Chris@39: else Chris@39: # the above command should be used before it gets too long Chris@39: oldobjs=$objlist Chris@39: if test "$obj" = "$last_oldobj" ; then Chris@39: RANLIB=$save_RANLIB Chris@39: fi Chris@39: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ Chris@39: eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" Chris@39: objlist= Chris@39: len=$len0 Chris@39: fi Chris@39: done Chris@39: RANLIB=$save_RANLIB Chris@39: oldobjs=$objlist Chris@39: if test "X$oldobjs" = "X" ; then Chris@39: eval cmds=\"\$concat_cmds\" Chris@39: else Chris@39: eval cmds=\"\$concat_cmds~\$old_archive_cmds\" Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: func_execute_cmds "$cmds" 'exit $?' Chris@39: done Chris@39: Chris@39: test -n "$generated" && \ Chris@39: func_show_eval "${RM}r$generated" Chris@39: Chris@39: # Now create the libtool archive. Chris@39: case $output in Chris@39: *.la) Chris@39: old_library= Chris@39: test "$build_old_libs" = yes && old_library="$libname.$libext" Chris@39: func_verbose "creating $output" Chris@39: Chris@39: # Preserve any variables that may affect compiler behavior Chris@39: for var in $variables_saved_for_relink; do Chris@39: if eval test -z \"\${$var+set}\"; then Chris@39: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" Chris@39: elif eval var_value=\$$var; test -z "$var_value"; then Chris@39: relink_command="$var=; export $var; $relink_command" Chris@39: else Chris@39: func_quote_for_eval "$var_value" Chris@39: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" Chris@39: fi Chris@39: done Chris@39: # Quote the link command for shipping. Chris@39: relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" Chris@39: relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` Chris@39: if test "$hardcode_automatic" = yes ; then Chris@39: relink_command= Chris@39: fi Chris@39: Chris@39: # Only create the output if not a dry run. Chris@39: $opt_dry_run || { Chris@39: for installed in no yes; do Chris@39: if test "$installed" = yes; then Chris@39: if test -z "$install_libdir"; then Chris@39: break Chris@39: fi Chris@39: output="$output_objdir/$outputname"i Chris@39: # Replace all uninstalled libtool libraries with the installed ones Chris@39: newdependency_libs= Chris@39: for deplib in $dependency_libs; do Chris@39: case $deplib in Chris@39: *.la) Chris@39: func_basename "$deplib" Chris@39: name="$func_basename_result" Chris@39: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` Chris@39: test -z "$libdir" && \ Chris@39: func_fatal_error "\`$deplib' is not a valid libtool archive" Chris@39: func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" Chris@39: ;; Chris@39: -L*) Chris@39: func_stripname -L '' "$deplib" Chris@39: func_replace_sysroot "$func_stripname_result" Chris@39: func_append newdependency_libs " -L$func_replace_sysroot_result" Chris@39: ;; Chris@39: -R*) Chris@39: func_stripname -R '' "$deplib" Chris@39: func_replace_sysroot "$func_stripname_result" Chris@39: func_append newdependency_libs " -R$func_replace_sysroot_result" Chris@39: ;; Chris@39: *) func_append newdependency_libs " $deplib" ;; Chris@39: esac Chris@39: done Chris@39: dependency_libs="$newdependency_libs" Chris@39: newdlfiles= Chris@39: Chris@39: for lib in $dlfiles; do Chris@39: case $lib in Chris@39: *.la) Chris@39: func_basename "$lib" Chris@39: name="$func_basename_result" Chris@39: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` Chris@39: test -z "$libdir" && \ Chris@39: func_fatal_error "\`$lib' is not a valid libtool archive" Chris@39: func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" Chris@39: ;; Chris@39: *) func_append newdlfiles " $lib" ;; Chris@39: esac Chris@39: done Chris@39: dlfiles="$newdlfiles" Chris@39: newdlprefiles= Chris@39: for lib in $dlprefiles; do Chris@39: case $lib in Chris@39: *.la) Chris@39: # Only pass preopened files to the pseudo-archive (for Chris@39: # eventual linking with the app. that links it) if we Chris@39: # didn't already link the preopened objects directly into Chris@39: # the library: Chris@39: func_basename "$lib" Chris@39: name="$func_basename_result" Chris@39: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` Chris@39: test -z "$libdir" && \ Chris@39: func_fatal_error "\`$lib' is not a valid libtool archive" Chris@39: func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" Chris@39: ;; Chris@39: esac Chris@39: done Chris@39: dlprefiles="$newdlprefiles" Chris@39: else Chris@39: newdlfiles= Chris@39: for lib in $dlfiles; do Chris@39: case $lib in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; Chris@39: *) abs=`pwd`"/$lib" ;; Chris@39: esac Chris@39: func_append newdlfiles " $abs" Chris@39: done Chris@39: dlfiles="$newdlfiles" Chris@39: newdlprefiles= Chris@39: for lib in $dlprefiles; do Chris@39: case $lib in Chris@39: [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; Chris@39: *) abs=`pwd`"/$lib" ;; Chris@39: esac Chris@39: func_append newdlprefiles " $abs" Chris@39: done Chris@39: dlprefiles="$newdlprefiles" Chris@39: fi Chris@39: $RM $output Chris@39: # place dlname in correct position for cygwin Chris@39: # In fact, it would be nice if we could use this code for all target Chris@39: # systems that can't hard-code library paths into their executables Chris@39: # and that have no shared library path variable independent of PATH, Chris@39: # but it turns out we can't easily determine that from inspecting Chris@39: # libtool variables, so we have to hard-code the OSs to which it Chris@39: # applies here; at the moment, that means platforms that use the PE Chris@39: # object format with DLL files. See the long comment at the top of Chris@39: # tests/bindir.at for full details. Chris@39: tdlname=$dlname Chris@39: case $host,$output,$installed,$module,$dlname in Chris@39: *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) Chris@39: # If a -bindir argument was supplied, place the dll there. Chris@39: if test "x$bindir" != x ; Chris@39: then Chris@39: func_relative_path "$install_libdir" "$bindir" Chris@39: tdlname=$func_relative_path_result$dlname Chris@39: else Chris@39: # Otherwise fall back on heuristic. Chris@39: tdlname=../bin/$dlname Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: $ECHO > $output "\ Chris@39: # $outputname - a libtool library file Chris@39: # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION Chris@39: # Chris@39: # Please DO NOT delete this file! Chris@39: # It is necessary for linking the library. Chris@39: Chris@39: # The name that we can dlopen(3). Chris@39: dlname='$tdlname' Chris@39: Chris@39: # Names of this library. Chris@39: library_names='$library_names' Chris@39: Chris@39: # The name of the static archive. Chris@39: old_library='$old_library' Chris@39: Chris@39: # Linker flags that can not go in dependency_libs. Chris@39: inherited_linker_flags='$new_inherited_linker_flags' Chris@39: Chris@39: # Libraries that this one depends upon. Chris@39: dependency_libs='$dependency_libs' Chris@39: Chris@39: # Names of additional weak libraries provided by this library Chris@39: weak_library_names='$weak_libs' Chris@39: Chris@39: # Version information for $libname. Chris@39: current=$current Chris@39: age=$age Chris@39: revision=$revision Chris@39: Chris@39: # Is this an already installed library? Chris@39: installed=$installed Chris@39: Chris@39: # Should we warn about portability when linking against -modules? Chris@39: shouldnotlink=$module Chris@39: Chris@39: # Files to dlopen/dlpreopen Chris@39: dlopen='$dlfiles' Chris@39: dlpreopen='$dlprefiles' Chris@39: Chris@39: # Directory that this library needs to be installed in: Chris@39: libdir='$install_libdir'" Chris@39: if test "$installed" = no && test "$need_relink" = yes; then Chris@39: $ECHO >> $output "\ Chris@39: relink_command=\"$relink_command\"" Chris@39: fi Chris@39: done Chris@39: } Chris@39: Chris@39: # Do a symbolic link so that the libtool archive can be found in Chris@39: # LD_LIBRARY_PATH before the program is installed. Chris@39: func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' Chris@39: ;; Chris@39: esac Chris@39: exit $EXIT_SUCCESS Chris@39: } Chris@39: Chris@39: { test "$opt_mode" = link || test "$opt_mode" = relink; } && Chris@39: func_mode_link ${1+"$@"} Chris@39: Chris@39: Chris@39: # func_mode_uninstall arg... Chris@39: func_mode_uninstall () Chris@39: { Chris@39: $opt_debug Chris@39: RM="$nonopt" Chris@39: files= Chris@39: rmforce= Chris@39: exit_status=0 Chris@39: Chris@39: # This variable tells wrapper scripts just to set variables rather Chris@39: # than running their programs. Chris@39: libtool_install_magic="$magic" Chris@39: Chris@39: for arg Chris@39: do Chris@39: case $arg in Chris@39: -f) func_append RM " $arg"; rmforce=yes ;; Chris@39: -*) func_append RM " $arg" ;; Chris@39: *) func_append files " $arg" ;; Chris@39: esac Chris@39: done Chris@39: Chris@39: test -z "$RM" && \ Chris@39: func_fatal_help "you must specify an RM program" Chris@39: Chris@39: rmdirs= Chris@39: Chris@39: for file in $files; do Chris@39: func_dirname "$file" "" "." Chris@39: dir="$func_dirname_result" Chris@39: if test "X$dir" = X.; then Chris@39: odir="$objdir" Chris@39: else Chris@39: odir="$dir/$objdir" Chris@39: fi Chris@39: func_basename "$file" Chris@39: name="$func_basename_result" Chris@39: test "$opt_mode" = uninstall && odir="$dir" Chris@39: Chris@39: # Remember odir for removal later, being careful to avoid duplicates Chris@39: if test "$opt_mode" = clean; then Chris@39: case " $rmdirs " in Chris@39: *" $odir "*) ;; Chris@39: *) func_append rmdirs " $odir" ;; Chris@39: esac Chris@39: fi Chris@39: Chris@39: # Don't error if the file doesn't exist and rm -f was used. Chris@39: if { test -L "$file"; } >/dev/null 2>&1 || Chris@39: { test -h "$file"; } >/dev/null 2>&1 || Chris@39: test -f "$file"; then Chris@39: : Chris@39: elif test -d "$file"; then Chris@39: exit_status=1 Chris@39: continue Chris@39: elif test "$rmforce" = yes; then Chris@39: continue Chris@39: fi Chris@39: Chris@39: rmfiles="$file" Chris@39: Chris@39: case $name in Chris@39: *.la) Chris@39: # Possibly a libtool archive, so verify it. Chris@39: if func_lalib_p "$file"; then Chris@39: func_source $dir/$name Chris@39: Chris@39: # Delete the libtool libraries and symlinks. Chris@39: for n in $library_names; do Chris@39: func_append rmfiles " $odir/$n" Chris@39: done Chris@39: test -n "$old_library" && func_append rmfiles " $odir/$old_library" Chris@39: Chris@39: case "$opt_mode" in Chris@39: clean) Chris@39: case " $library_names " in Chris@39: *" $dlname "*) ;; Chris@39: *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; Chris@39: esac Chris@39: test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" Chris@39: ;; Chris@39: uninstall) Chris@39: if test -n "$library_names"; then Chris@39: # Do each command in the postuninstall commands. Chris@39: func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' Chris@39: fi Chris@39: Chris@39: if test -n "$old_library"; then Chris@39: # Do each command in the old_postuninstall commands. Chris@39: func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' Chris@39: fi Chris@39: # FIXME: should reinstall the best remaining shared library. Chris@39: ;; Chris@39: esac Chris@39: fi Chris@39: ;; Chris@39: Chris@39: *.lo) Chris@39: # Possibly a libtool object, so verify it. Chris@39: if func_lalib_p "$file"; then Chris@39: Chris@39: # Read the .lo file Chris@39: func_source $dir/$name Chris@39: Chris@39: # Add PIC object to the list of files to remove. Chris@39: if test -n "$pic_object" && Chris@39: test "$pic_object" != none; then Chris@39: func_append rmfiles " $dir/$pic_object" Chris@39: fi Chris@39: Chris@39: # Add non-PIC object to the list of files to remove. Chris@39: if test -n "$non_pic_object" && Chris@39: test "$non_pic_object" != none; then Chris@39: func_append rmfiles " $dir/$non_pic_object" Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: Chris@39: *) Chris@39: if test "$opt_mode" = clean ; then Chris@39: noexename=$name Chris@39: case $file in Chris@39: *.exe) Chris@39: func_stripname '' '.exe' "$file" Chris@39: file=$func_stripname_result Chris@39: func_stripname '' '.exe' "$name" Chris@39: noexename=$func_stripname_result Chris@39: # $file with .exe has already been added to rmfiles, Chris@39: # add $file without .exe Chris@39: func_append rmfiles " $file" Chris@39: ;; Chris@39: esac Chris@39: # Do a test to see if this is a libtool program. Chris@39: if func_ltwrapper_p "$file"; then Chris@39: if func_ltwrapper_executable_p "$file"; then Chris@39: func_ltwrapper_scriptname "$file" Chris@39: relink_command= Chris@39: func_source $func_ltwrapper_scriptname_result Chris@39: func_append rmfiles " $func_ltwrapper_scriptname_result" Chris@39: else Chris@39: relink_command= Chris@39: func_source $dir/$noexename Chris@39: fi Chris@39: Chris@39: # note $name still contains .exe if it was in $file originally Chris@39: # as does the version of $file that was added into $rmfiles Chris@39: func_append rmfiles " $odir/$name $odir/${name}S.${objext}" Chris@39: if test "$fast_install" = yes && test -n "$relink_command"; then Chris@39: func_append rmfiles " $odir/lt-$name" Chris@39: fi Chris@39: if test "X$noexename" != "X$name" ; then Chris@39: func_append rmfiles " $odir/lt-${noexename}.c" Chris@39: fi Chris@39: fi Chris@39: fi Chris@39: ;; Chris@39: esac Chris@39: func_show_eval "$RM $rmfiles" 'exit_status=1' Chris@39: done Chris@39: Chris@39: # Try to remove the ${objdir}s in the directories where we deleted files Chris@39: for dir in $rmdirs; do Chris@39: if test -d "$dir"; then Chris@39: func_show_eval "rmdir $dir >/dev/null 2>&1" Chris@39: fi Chris@39: done Chris@39: Chris@39: exit $exit_status Chris@39: } Chris@39: Chris@39: { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && Chris@39: func_mode_uninstall ${1+"$@"} Chris@39: Chris@39: test -z "$opt_mode" && { Chris@39: help="$generic_help" Chris@39: func_fatal_help "you must specify a MODE" Chris@39: } Chris@39: Chris@39: test -z "$exec_cmd" && \ Chris@39: func_fatal_help "invalid operation mode \`$opt_mode'" Chris@39: Chris@39: if test -n "$exec_cmd"; then Chris@39: eval exec "$exec_cmd" Chris@39: exit $EXIT_FAILURE Chris@39: fi Chris@39: Chris@39: exit $exit_status Chris@39: Chris@39: Chris@39: # The TAGs below are defined such that we never get into a situation Chris@39: # in which we disable both kinds of libraries. Given conflicting Chris@39: # choices, we go for a static library, that is the most portable, Chris@39: # since we can't tell whether shared libraries were disabled because Chris@39: # the user asked for that or because the platform doesn't support Chris@39: # them. This is particularly important on AIX, because we don't Chris@39: # support having both static and shared libraries enabled at the same Chris@39: # time on that platform, so we default to a shared-only configuration. Chris@39: # If a disable-shared tag is given, we'll fallback to a static-only Chris@39: # configuration. But we'll never go from static-only to shared-only. Chris@39: Chris@39: # ### BEGIN LIBTOOL TAG CONFIG: disable-shared Chris@39: build_libtool_libs=no Chris@39: build_old_libs=yes Chris@39: # ### END LIBTOOL TAG CONFIG: disable-shared Chris@39: Chris@39: # ### BEGIN LIBTOOL TAG CONFIG: disable-static Chris@39: build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` Chris@39: # ### END LIBTOOL TAG CONFIG: disable-static Chris@39: Chris@39: # Local Variables: Chris@39: # mode:shell-script Chris@39: # sh-indentation:2 Chris@39: # End: Chris@39: # vi:sw=2 Chris@39: