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