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