adam@1826: # Generated from ltmain.m4sh. adam@1826: adam@1826: # ltmain.sh (GNU libtool) 2.2.6b adamc@1133: # Written by Gordon Matzigkeit , 1996 adamc@1133: adam@1826: # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. adamc@1133: # This is free software; see the source for copying conditions. There is NO adamc@1133: # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. adamc@1133: adamc@1133: # GNU Libtool is free software; you can redistribute it and/or modify adamc@1133: # it under the terms of the GNU General Public License as published by adamc@1133: # the Free Software Foundation; either version 2 of the License, or adamc@1133: # (at your option) any later version. adamc@1133: # adamc@1133: # As a special exception to the GNU General Public License, adamc@1133: # if you distribute this file as part of a program or library that adamc@1133: # is built using GNU Libtool, you may include this file under the adamc@1133: # same distribution terms that you use for the rest of that program. adamc@1133: # adamc@1133: # GNU Libtool is distributed in the hope that it will be useful, but adamc@1133: # WITHOUT ANY WARRANTY; without even the implied warranty of adamc@1133: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU adamc@1133: # General Public License for more details. adamc@1133: # adamc@1133: # You should have received a copy of the GNU General Public License adamc@1133: # along with GNU Libtool; see the file COPYING. If not, a copy adamc@1133: # can be downloaded from http://www.gnu.org/licenses/gpl.html, adamc@1133: # or obtained by writing to the Free Software Foundation, Inc., adamc@1133: # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. adamc@1133: adamc@1133: # Usage: $progname [OPTION]... [MODE-ARG]... adamc@1133: # adamc@1133: # Provide generalized library-building support services. adamc@1133: # adam@1826: # --config show all configuration variables adam@1826: # --debug enable verbose shell tracing adam@1826: # -n, --dry-run display commands without modifying any files adam@1826: # --features display basic configuration information and exit adam@1826: # --mode=MODE use operation mode MODE adam@1826: # --preserve-dup-deps don't remove duplicate dependency libraries adam@1826: # --quiet, --silent don't print informational messages adam@1826: # --tag=TAG use configuration variables from tag TAG adam@1826: # -v, --verbose print informational messages (default) adam@1826: # --version print version information adam@1826: # -h, --help print short or long help message adamc@1133: # adamc@1133: # MODE must be one of the following: adamc@1133: # adam@1826: # clean remove files from the build directory adam@1826: # compile compile a source file into a libtool object adam@1826: # execute automatically set library path, then run a program adam@1826: # finish complete the installation of libtool libraries adam@1826: # install install libraries or executables adam@1826: # link create a library or an executable adam@1826: # uninstall remove libraries from an installed directory adamc@1133: # adam@1826: # MODE-ARGS vary depending on the MODE. adamc@1133: # Try `$progname --help --mode=MODE' for a more detailed description of MODE. adamc@1133: # adamc@1133: # When reporting a bug, please describe a test case to reproduce it and adamc@1133: # include the following information: adamc@1133: # adam@1826: # host-triplet: $host adam@1826: # shell: $SHELL adam@1826: # compiler: $LTCC adam@1826: # compiler flags: $LTCFLAGS adam@1826: # linker: $LD (gnu? $with_gnu_ld) adam@1826: # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 adam@1826: # automake: $automake_version adam@1826: # autoconf: $autoconf_version adamc@1133: # adamc@1133: # Report bugs to . adam@1826: adam@1826: PROGRAM=ltmain.sh adamc@1133: PACKAGE=libtool adam@1826: VERSION="2.2.6b Debian-2.2.6b-2" adamc@1133: TIMESTAMP="" adam@1826: package_revision=1.3017 adamc@1133: adamc@1133: # Be Bourne compatible adamc@1133: if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then adamc@1133: emulate sh adamc@1133: NULLCMD=: adamc@1133: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which adamc@1133: # is contrary to our usage. Disable this feature. adamc@1133: alias -g '${1+"$@"}'='"$@"' adamc@1133: setopt NO_GLOB_SUBST adamc@1133: else adamc@1133: case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac adamc@1133: fi adamc@1133: BIN_SH=xpg4; export BIN_SH # for Tru64 adamc@1133: DUALCASE=1; export DUALCASE # for MKS sh adamc@1133: adamc@1133: # NLS nuisances: We save the old values to restore during execute mode. adam@1826: # Only set LANG and LC_ALL to C if already set. adam@1826: # These must not be set unconditionally because not all systems understand adam@1826: # e.g. LANG=C (notably SCO). adamc@1133: lt_user_locale= adamc@1133: lt_safe_locale= adamc@1133: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES adamc@1133: do adamc@1133: eval "if test \"\${$lt_var+set}\" = set; then adamc@1133: save_$lt_var=\$$lt_var adamc@1133: $lt_var=C adamc@1133: export $lt_var adamc@1133: lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" adamc@1133: lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" adamc@1133: fi" adamc@1133: done adamc@1133: adamc@1133: $lt_unset CDPATH adamc@1133: adamc@1133: adamc@1133: adamc@1133: adamc@1133: adamc@1133: : ${CP="cp -f"} adam@1826: : ${ECHO="echo"} adam@1826: : ${EGREP="/bin/grep -E"} adam@1826: : ${FGREP="/bin/grep -F"} adam@1826: : ${GREP="/bin/grep"} adam@1826: : ${LN_S="ln -s"} adamc@1133: : ${MAKE="make"} adamc@1133: : ${MKDIR="mkdir"} adamc@1133: : ${MV="mv -f"} adamc@1133: : ${RM="rm -f"} adam@1826: : ${SED="/bin/sed"} adamc@1133: : ${SHELL="${CONFIG_SHELL-/bin/sh}"} adamc@1133: : ${Xsed="$SED -e 1s/^X//"} adamc@1133: adamc@1133: # Global variables: adamc@1133: EXIT_SUCCESS=0 adamc@1133: EXIT_FAILURE=1 adamc@1133: EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. adamc@1133: EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. adamc@1133: adamc@1133: exit_status=$EXIT_SUCCESS adamc@1133: adamc@1133: # Make sure IFS has a sensible default adamc@1133: lt_nl=' adamc@1133: ' adamc@1133: IFS=" $lt_nl" adamc@1133: adamc@1133: dirname="s,/[^/]*$,," adamc@1133: basename="s,^.*/,," adamc@1133: adamc@1133: # func_dirname_and_basename file append nondir_replacement adamc@1133: # perform func_basename and func_dirname in a single function adamc@1133: # call: adamc@1133: # dirname: Compute the dirname of FILE. If nonempty, adamc@1133: # add APPEND to the result, otherwise set result adamc@1133: # to NONDIR_REPLACEMENT. adamc@1133: # value returned in "$func_dirname_result" adamc@1133: # basename: Compute filename of FILE. adamc@1133: # value retuned in "$func_basename_result" adamc@1133: # Implementation must be kept synchronized with func_dirname adamc@1133: # and func_basename. For efficiency, we do not delegate to adamc@1133: # those functions but instead duplicate the functionality here. adamc@1133: func_dirname_and_basename () adamc@1133: { adam@1826: # Extract subdirectory from the argument. adam@1826: func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` adam@1826: if test "X$func_dirname_result" = "X${1}"; then adam@1826: func_dirname_result="${3}" adam@1826: else adam@1826: func_dirname_result="$func_dirname_result${2}" adam@1826: fi adam@1826: func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` adam@1459: } adam@1459: adam@1826: # Generated shell functions inserted here. adam@1826: adam@1826: # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh adam@1826: # is ksh but when the shell is invoked as "sh" and the current value of adam@1826: # the _XPG environment variable is not equal to 1 (one), the special adam@1826: # positional parameter $0, within a function call, is the name of the adam@1826: # function. adam@1826: progpath="$0" adamc@1133: adamc@1133: # The name of this program: adam@1826: # In the unlikely event $progname began with a '-', it would play havoc with adam@1826: # func_echo (imagine progname=-n), so we prepend ./ in that case: adamc@1133: func_dirname_and_basename "$progpath" adamc@1133: progname=$func_basename_result adam@1826: case $progname in adam@1826: -*) progname=./$progname ;; adam@1826: esac adamc@1133: adamc@1133: # Make sure we have an absolute path for reexecution: adamc@1133: case $progpath in adamc@1133: [\\/]*|[A-Za-z]:\\*) ;; adamc@1133: *[\\/]*) adamc@1133: progdir=$func_dirname_result adamc@1133: progdir=`cd "$progdir" && pwd` adamc@1133: progpath="$progdir/$progname" adamc@1133: ;; adamc@1133: *) adamc@1133: save_IFS="$IFS" adam@1826: IFS=: adamc@1133: for progdir in $PATH; do adamc@1133: IFS="$save_IFS" adamc@1133: test -x "$progdir/$progname" && break adamc@1133: done adamc@1133: IFS="$save_IFS" adamc@1133: test -n "$progdir" || progdir=`pwd` adamc@1133: progpath="$progdir/$progname" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Sed substitution that helps us do robust quoting. It backslashifies adamc@1133: # metacharacters that are still active within double-quoted strings. adamc@1133: Xsed="${SED}"' -e 1s/^X//' adamc@1133: sed_quote_subst='s/\([`"$\\]\)/\\\1/g' adamc@1133: adamc@1133: # Same as above, but do not quote variable references. adamc@1133: double_quote_subst='s/\(["`\\]\)/\\\1/g' adamc@1133: adamc@1133: # Re-`\' parameter expansions in output of double_quote_subst that were adamc@1133: # `\'-ed in input to the same. If an odd number of `\' preceded a '$' adamc@1133: # in input to double_quote_subst, that '$' was protected from expansion. adamc@1133: # Since each input `\' is now two `\'s, look for any number of runs of adamc@1133: # four `\'s followed by two `\'s and then a '$'. `\' that '$'. adamc@1133: bs='\\' adamc@1133: bs2='\\\\' adamc@1133: bs4='\\\\\\\\' adamc@1133: dollar='\$' adamc@1133: sed_double_backslash="\ adamc@1133: s/$bs4/&\\ adamc@1133: /g adamc@1133: s/^$bs2$dollar/$bs&/ adamc@1133: s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g adamc@1133: s/\n//g" adamc@1133: adamc@1133: # Standard options: adamc@1133: opt_dry_run=false adamc@1133: opt_help=false adamc@1133: opt_quiet=false adamc@1133: opt_verbose=false adamc@1133: opt_warning=: adamc@1133: adamc@1133: # func_echo arg... adamc@1133: # Echo program name prefixed message, along with the current mode adamc@1133: # name if it has been set yet. adamc@1133: func_echo () adamc@1133: { adam@1826: $ECHO "$progname${mode+: }$mode: $*" adamc@1133: } adamc@1133: adamc@1133: # func_verbose arg... adamc@1133: # Echo program name prefixed message in verbose mode only. adamc@1133: func_verbose () adamc@1133: { adamc@1133: $opt_verbose && func_echo ${1+"$@"} adamc@1133: adamc@1133: # A bug in bash halts the script if the last line of a function adamc@1133: # fails when set -e is in force, so we need another command to adamc@1133: # work around that: adamc@1133: : adamc@1133: } adamc@1133: adamc@1133: # func_error arg... adamc@1133: # Echo program name prefixed message to standard error. adamc@1133: func_error () adamc@1133: { adam@1826: $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 adamc@1133: } adamc@1133: adamc@1133: # func_warning arg... adamc@1133: # Echo program name prefixed warning message to standard error. adamc@1133: func_warning () adamc@1133: { adam@1826: $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 adamc@1133: adamc@1133: # bash bug again: adamc@1133: : adamc@1133: } adamc@1133: adamc@1133: # func_fatal_error arg... adamc@1133: # Echo program name prefixed message to standard error, and exit. adamc@1133: func_fatal_error () adamc@1133: { adamc@1133: func_error ${1+"$@"} adamc@1133: exit $EXIT_FAILURE adamc@1133: } adamc@1133: adamc@1133: # func_fatal_help arg... adamc@1133: # Echo program name prefixed message to standard error, followed by adamc@1133: # a help hint, and exit. adamc@1133: func_fatal_help () adamc@1133: { adamc@1133: func_error ${1+"$@"} adamc@1133: func_fatal_error "$help" adamc@1133: } adamc@1133: help="Try \`$progname --help' for more information." ## default adamc@1133: adamc@1133: adamc@1133: # func_grep expression filename adamc@1133: # Check whether EXPRESSION matches any line of FILENAME, without output. adamc@1133: func_grep () adamc@1133: { adamc@1133: $GREP "$1" "$2" >/dev/null 2>&1 adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_mkdir_p directory-path adamc@1133: # Make sure the entire path to DIRECTORY-PATH is available. adamc@1133: func_mkdir_p () adamc@1133: { adamc@1133: my_directory_path="$1" adamc@1133: my_dir_list= adamc@1133: adamc@1133: if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then adamc@1133: adamc@1133: # Protect directory names starting with `-' adamc@1133: case $my_directory_path in adamc@1133: -*) my_directory_path="./$my_directory_path" ;; adamc@1133: esac adamc@1133: adamc@1133: # While some portion of DIR does not yet exist... adamc@1133: while test ! -d "$my_directory_path"; do adamc@1133: # ...make a list in topmost first order. Use a colon delimited adamc@1133: # list incase some portion of path contains whitespace. adamc@1133: my_dir_list="$my_directory_path:$my_dir_list" adamc@1133: adamc@1133: # If the last portion added has no slash in it, the list is done adamc@1133: case $my_directory_path in */*) ;; *) break ;; esac adamc@1133: adamc@1133: # ...otherwise throw away the child directory and loop adam@1826: my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` adamc@1133: done adam@1826: my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` adamc@1133: adamc@1133: save_mkdir_p_IFS="$IFS"; IFS=':' adamc@1133: for my_dir in $my_dir_list; do adamc@1133: IFS="$save_mkdir_p_IFS" adamc@1133: # mkdir can fail with a `File exist' error if two processes adamc@1133: # try to create one of the directories concurrently. Don't adamc@1133: # stop in that case! adamc@1133: $MKDIR "$my_dir" 2>/dev/null || : adamc@1133: done adamc@1133: IFS="$save_mkdir_p_IFS" adamc@1133: adamc@1133: # Bail out if we (or some other process) failed to create a directory. adamc@1133: test -d "$my_directory_path" || \ adamc@1133: func_fatal_error "Failed to create \`$1'" adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_mktempdir [string] adamc@1133: # Make a temporary directory that won't clash with other running adamc@1133: # libtool processes, and avoids race conditions if possible. If adamc@1133: # given, STRING is the basename for that directory. adamc@1133: func_mktempdir () adamc@1133: { adamc@1133: my_template="${TMPDIR-/tmp}/${1-$progname}" adamc@1133: adamc@1133: if test "$opt_dry_run" = ":"; then adamc@1133: # Return a directory name, but don't create it in dry-run mode adamc@1133: my_tmpdir="${my_template}-$$" adamc@1133: else adamc@1133: adamc@1133: # If mktemp works, use that first and foremost adamc@1133: my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` adamc@1133: adamc@1133: if test ! -d "$my_tmpdir"; then adamc@1133: # Failing that, at least try and use $RANDOM to avoid a race adamc@1133: my_tmpdir="${my_template}-${RANDOM-0}$$" adamc@1133: adamc@1133: save_mktempdir_umask=`umask` adamc@1133: umask 0077 adamc@1133: $MKDIR "$my_tmpdir" adamc@1133: umask $save_mktempdir_umask adamc@1133: fi adamc@1133: adamc@1133: # If we're not in dry-run mode, bomb out on failure adamc@1133: test -d "$my_tmpdir" || \ adamc@1133: func_fatal_error "cannot create temporary directory \`$my_tmpdir'" adamc@1133: fi adamc@1133: adam@1826: $ECHO "X$my_tmpdir" | $Xsed adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_quote_for_eval arg adamc@1133: # Aesthetically quote ARG to be evaled later. adamc@1133: # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT adamc@1133: # is double-quoted, suitable for a subsequent eval, whereas adamc@1133: # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters adamc@1133: # which are still active within double quotes backslashified. adamc@1133: func_quote_for_eval () adamc@1133: { adamc@1133: case $1 in adamc@1133: *[\\\`\"\$]*) adam@1826: func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; adamc@1133: *) adamc@1133: func_quote_for_eval_unquoted_result="$1" ;; adamc@1133: esac adamc@1133: adamc@1133: case $func_quote_for_eval_unquoted_result in adamc@1133: # Double-quote args containing shell metacharacters to delay adamc@1133: # word splitting, command substitution and and variable adamc@1133: # expansion for a subsequent eval. adamc@1133: # Many Bourne shells cannot handle close brackets correctly adamc@1133: # in scan sets, so we specify it separately. adamc@1133: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") adamc@1133: func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" adamc@1133: ;; adamc@1133: *) adamc@1133: func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" adamc@1133: esac adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_quote_for_expand arg adamc@1133: # Aesthetically quote ARG to be evaled later; same as above, adamc@1133: # but do not quote variable references. adamc@1133: func_quote_for_expand () adamc@1133: { adamc@1133: case $1 in adamc@1133: *[\\\`\"]*) adam@1826: my_arg=`$ECHO "X$1" | $Xsed \ adamc@1133: -e "$double_quote_subst" -e "$sed_double_backslash"` ;; adamc@1133: *) adamc@1133: my_arg="$1" ;; adamc@1133: esac adamc@1133: adamc@1133: case $my_arg in adamc@1133: # Double-quote args containing shell metacharacters to delay adamc@1133: # word splitting and command substitution for a subsequent eval. adamc@1133: # Many Bourne shells cannot handle close brackets correctly adamc@1133: # in scan sets, so we specify it separately. adamc@1133: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") adamc@1133: my_arg="\"$my_arg\"" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: func_quote_for_expand_result="$my_arg" adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_show_eval cmd [fail_exp] adamc@1133: # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is adamc@1133: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP adamc@1133: # is given, then evaluate it. adamc@1133: func_show_eval () adamc@1133: { adamc@1133: my_cmd="$1" adamc@1133: my_fail_exp="${2-:}" adamc@1133: adamc@1133: ${opt_silent-false} || { adamc@1133: func_quote_for_expand "$my_cmd" adamc@1133: eval "func_echo $func_quote_for_expand_result" adamc@1133: } adamc@1133: adamc@1133: if ${opt_dry_run-false}; then :; else adamc@1133: eval "$my_cmd" adamc@1133: my_status=$? adamc@1133: if test "$my_status" -eq 0; then :; else adamc@1133: eval "(exit $my_status); $my_fail_exp" adamc@1133: fi adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_show_eval_locale cmd [fail_exp] adamc@1133: # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is adamc@1133: # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP adamc@1133: # is given, then evaluate it. Use the saved locale for evaluation. adamc@1133: func_show_eval_locale () adamc@1133: { adamc@1133: my_cmd="$1" adamc@1133: my_fail_exp="${2-:}" adamc@1133: adamc@1133: ${opt_silent-false} || { adamc@1133: func_quote_for_expand "$my_cmd" adamc@1133: eval "func_echo $func_quote_for_expand_result" adamc@1133: } adamc@1133: adamc@1133: if ${opt_dry_run-false}; then :; else adamc@1133: eval "$lt_user_locale adamc@1133: $my_cmd" adamc@1133: my_status=$? adamc@1133: eval "$lt_safe_locale" adamc@1133: if test "$my_status" -eq 0; then :; else adamc@1133: eval "(exit $my_status); $my_fail_exp" adamc@1133: fi adamc@1133: fi adamc@1133: } adamc@1133: adam@1826: adam@1826: adamc@1133: adamc@1133: adamc@1133: # func_version adamc@1133: # Echo version message to standard output and exit. adamc@1133: func_version () adamc@1133: { adam@1826: $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { adamc@1133: s/^# // adamc@1133: s/^# *$// adamc@1133: s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ adamc@1133: p adamc@1133: }' < "$progpath" adamc@1133: exit $? adamc@1133: } adamc@1133: adamc@1133: # func_usage adamc@1133: # Echo short help message to standard output and exit. adamc@1133: func_usage () adamc@1133: { adam@1826: $SED -n '/^# Usage:/,/# -h/ { adamc@1133: s/^# // adamc@1133: s/^# *$// adamc@1133: s/\$progname/'$progname'/ adamc@1133: p adamc@1133: }' < "$progpath" adam@1826: $ECHO adamc@1133: $ECHO "run \`$progname --help | more' for full usage" adamc@1133: exit $? adamc@1133: } adamc@1133: adam@1826: # func_help adam@1826: # Echo long help message to standard output and exit. adamc@1133: func_help () adamc@1133: { adamc@1133: $SED -n '/^# Usage:/,/# Report bugs to/ { adamc@1133: s/^# // adamc@1133: s/^# *$// adamc@1133: s*\$progname*'$progname'* adamc@1133: s*\$host*'"$host"'* adamc@1133: s*\$SHELL*'"$SHELL"'* adamc@1133: s*\$LTCC*'"$LTCC"'* adamc@1133: s*\$LTCFLAGS*'"$LTCFLAGS"'* adamc@1133: s*\$LD*'"$LD"'* adamc@1133: s/\$with_gnu_ld/'"$with_gnu_ld"'/ adam@1826: s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ adam@1826: s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ adamc@1133: p adam@1826: }' < "$progpath" adam@1826: exit $? adamc@1133: } adamc@1133: adamc@1133: # func_missing_arg argname adamc@1133: # Echo program name prefixed message to standard error and set global adamc@1133: # exit_cmd. adamc@1133: func_missing_arg () adamc@1133: { adam@1826: func_error "missing argument for $1" adamc@1133: exit_cmd=exit adamc@1133: } adamc@1133: adamc@1133: exit_cmd=: adamc@1133: adamc@1133: adamc@1133: adamc@1133: adamc@1133: adam@1826: # Check that we have a working $ECHO. adam@1826: if test "X$1" = X--no-reexec; then adam@1826: # Discard the --no-reexec flag, and continue. adam@1826: shift adam@1826: elif test "X$1" = X--fallback-echo; then adam@1826: # Avoid inline document here, it may be left over adam@1826: : adam@1826: elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then adam@1826: # Yippee, $ECHO works! adam@1826: : adam@1826: else adam@1826: # Restart under the correct shell, and then maybe $ECHO will work. adam@1826: exec $SHELL "$progpath" --no-reexec ${1+"$@"} adam@1826: fi adam@1826: adam@1826: if test "X$1" = X--fallback-echo; then adam@1826: # used as fallback echo adam@1826: shift adam@1826: cat </dev/null 2>&1; then adamc@1133: taglist="$taglist $tagname" adamc@1133: adamc@1133: # Evaluate the configuration. Be careful to quote the path adamc@1133: # and the sed script, to avoid splitting on whitespace, but adamc@1133: # also don't use non-portable quotes within backquotes within adamc@1133: # quotes we have to do it in 2 steps: adamc@1133: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` adamc@1133: eval "$extractedcf" adamc@1133: else adamc@1133: func_error "ignoring unknown tag $tagname" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: } adamc@1133: adam@1826: # Parse options once, thoroughly. This comes as soon as possible in adam@1826: # the script to make things like `libtool --version' happen quickly. adam@1826: { adam@1826: adam@1826: # Shorthand for --mode=foo, only valid as the first argument adam@1826: case $1 in adam@1826: clean|clea|cle|cl) adam@1826: shift; set dummy --mode clean ${1+"$@"}; shift adam@1826: ;; adam@1826: compile|compil|compi|comp|com|co|c) adam@1826: shift; set dummy --mode compile ${1+"$@"}; shift adam@1826: ;; adam@1826: execute|execut|execu|exec|exe|ex|e) adam@1826: shift; set dummy --mode execute ${1+"$@"}; shift adam@1826: ;; adam@1826: finish|finis|fini|fin|fi|f) adam@1826: shift; set dummy --mode finish ${1+"$@"}; shift adam@1826: ;; adam@1826: install|instal|insta|inst|ins|in|i) adam@1826: shift; set dummy --mode install ${1+"$@"}; shift adam@1826: ;; adam@1826: link|lin|li|l) adam@1826: shift; set dummy --mode link ${1+"$@"}; shift adam@1826: ;; adam@1826: uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) adam@1826: shift; set dummy --mode uninstall ${1+"$@"}; shift adam@1826: ;; adam@1826: esac adam@1826: adam@1826: # Parse non-mode specific arguments: adam@1826: while test "$#" -gt 0; do adam@1826: opt="$1" adam@1826: shift adam@1826: adam@1826: case $opt in adam@1826: --config) func_config ;; adam@1826: adam@1826: --debug) preserve_args="$preserve_args $opt" adam@1826: func_echo "enabling shell trace mode" adam@1826: opt_debug='set -x' adam@1826: $opt_debug adam@1826: ;; adam@1826: adam@1826: -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break adam@1826: execute_dlfiles="$execute_dlfiles $1" adam@1826: shift adam@1826: ;; adam@1826: adam@1826: --dry-run | -n) opt_dry_run=: ;; adam@1826: --features) func_features ;; adam@1826: --finish) mode="finish" ;; adam@1826: adam@1826: --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break adam@1826: case $1 in adam@1826: # Valid mode arguments: adam@1826: clean) ;; adam@1826: compile) ;; adam@1826: execute) ;; adam@1826: finish) ;; adam@1826: install) ;; adam@1826: link) ;; adam@1826: relink) ;; adam@1826: uninstall) ;; adam@1826: adam@1826: # Catch anything else as an error adam@1826: *) func_error "invalid argument for $opt" adam@1826: exit_cmd=exit adam@1826: break adam@1826: ;; adam@1826: esac adam@1826: adam@1826: mode="$1" adam@1826: shift adam@1826: ;; adam@1826: adam@1826: --preserve-dup-deps) adam@1826: opt_duplicate_deps=: ;; adam@1826: adam@1826: --quiet|--silent) preserve_args="$preserve_args $opt" adam@1826: opt_silent=: adam@1826: ;; adam@1826: adam@1826: --verbose| -v) preserve_args="$preserve_args $opt" adam@1826: opt_silent=false adam@1826: ;; adam@1826: adam@1826: --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break adam@1826: preserve_args="$preserve_args $opt $1" adam@1826: func_enable_tag "$1" # tagname is set here adam@1826: shift adam@1826: ;; adam@1826: adam@1826: # Separate optargs to long options: adam@1826: -dlopen=*|--mode=*|--tag=*) adam@1826: func_opt_split "$opt" adam@1826: set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} adam@1826: shift adam@1826: ;; adam@1826: adam@1826: -\?|-h) func_usage ;; adam@1826: --help) opt_help=: ;; adam@1826: --version) func_version ;; adam@1826: adam@1826: -*) func_fatal_help "unrecognized option \`$opt'" ;; adam@1826: adam@1826: *) nonopt="$opt" adam@1826: break adam@1826: ;; adam@1826: esac adam@1826: done adam@1826: adam@1826: adam@1826: case $host in adam@1826: *cygwin* | *mingw* | *pw32* | *cegcc*) adam@1826: # don't eliminate duplications in $postdeps and $predeps adam@1826: opt_duplicate_compiler_generated_deps=: adam@1826: ;; adam@1826: *) adam@1826: opt_duplicate_compiler_generated_deps=$opt_duplicate_deps adam@1826: ;; adam@1826: esac adam@1826: adam@1826: # Having warned about all mis-specified options, bail out if adam@1826: # anything was wrong. adam@1826: $exit_cmd $EXIT_FAILURE adam@1826: } adam@1826: adamc@1133: # func_check_version_match adamc@1133: # Ensure that we are using m4 macros, and libtool script from the same adamc@1133: # release of libtool. adamc@1133: func_check_version_match () adamc@1133: { adamc@1133: if test "$package_revision" != "$macro_revision"; then adamc@1133: if test "$VERSION" != "$macro_version"; then adamc@1133: if test -z "$macro_version"; then adamc@1133: cat >&2 <<_LT_EOF adamc@1133: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the adamc@1133: $progname: definition of this LT_INIT comes from an older release. adamc@1133: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION adamc@1133: $progname: and run autoconf again. adamc@1133: _LT_EOF adamc@1133: else adamc@1133: cat >&2 <<_LT_EOF adamc@1133: $progname: Version mismatch error. This is $PACKAGE $VERSION, but the adamc@1133: $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. adamc@1133: $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION adamc@1133: $progname: and run autoconf again. adamc@1133: _LT_EOF adamc@1133: fi adamc@1133: else adamc@1133: cat >&2 <<_LT_EOF adamc@1133: $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, adamc@1133: $progname: but the definition of this LT_INIT comes from revision $macro_revision. adamc@1133: $progname: You should recreate aclocal.m4 with macros from revision $package_revision adamc@1133: $progname: of $PACKAGE $VERSION and run autoconf again. adamc@1133: _LT_EOF adamc@1133: fi adamc@1133: adamc@1133: exit $EXIT_MISMATCH adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: adamc@1133: ## ----------- ## adamc@1133: ## Main. ## adamc@1133: ## ----------- ## adamc@1133: adam@1826: $opt_help || { adam@1826: # Sanity checks first: adam@1826: func_check_version_match adam@1826: adam@1826: if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then adam@1826: func_fatal_configuration "not configured to build any kind of library" adam@1826: fi adam@1826: adam@1826: test -z "$mode" && func_fatal_error "error: you must specify a MODE." adam@1826: adam@1826: adam@1826: # Darwin sucks adam@1826: eval std_shrext=\"$shrext_cmds\" adam@1826: adam@1826: adam@1826: # Only execute mode is allowed to have -dlopen flags. adam@1826: if test -n "$execute_dlfiles" && test "$mode" != execute; then adam@1826: func_error "unrecognized option \`-dlopen'" adam@1826: $ECHO "$help" 1>&2 adam@1826: exit $EXIT_FAILURE adam@1826: fi adam@1826: adam@1826: # Change the help message to a mode-specific one. adam@1826: generic_help="$help" adam@1826: help="Try \`$progname --help --mode=$mode' for more information." adam@1826: } adam@1826: adam@1826: adamc@1133: # func_lalib_p file adamc@1133: # True iff FILE is a libtool `.la' library or `.lo' object file. adamc@1133: # This function is only a basic sanity check; it will hardly flush out adamc@1133: # determined imposters. adamc@1133: func_lalib_p () adamc@1133: { adamc@1133: test -f "$1" && adamc@1133: $SED -e 4q "$1" 2>/dev/null \ adamc@1133: | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 adamc@1133: } adamc@1133: adamc@1133: # func_lalib_unsafe_p file adamc@1133: # True iff FILE is a libtool `.la' library or `.lo' object file. adamc@1133: # This function implements the same check as func_lalib_p without adamc@1133: # resorting to external programs. To this end, it redirects stdin and adamc@1133: # closes it afterwards, without saving the original file descriptor. adamc@1133: # As a safety measure, use it only where a negative result would be adamc@1133: # fatal anyway. Works if `file' does not exist. adamc@1133: func_lalib_unsafe_p () adamc@1133: { adamc@1133: lalib_p=no adamc@1133: if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then adamc@1133: for lalib_p_l in 1 2 3 4 adamc@1133: do adamc@1133: read lalib_p_line adamc@1133: case "$lalib_p_line" in adamc@1133: \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; adamc@1133: esac adamc@1133: done adamc@1133: exec 0<&5 5<&- adamc@1133: fi adamc@1133: test "$lalib_p" = yes adamc@1133: } adamc@1133: adamc@1133: # func_ltwrapper_script_p file adamc@1133: # True iff FILE is a libtool wrapper script adamc@1133: # This function is only a basic sanity check; it will hardly flush out adamc@1133: # determined imposters. adamc@1133: func_ltwrapper_script_p () adamc@1133: { adamc@1133: func_lalib_p "$1" adamc@1133: } adamc@1133: adamc@1133: # func_ltwrapper_executable_p file adamc@1133: # True iff FILE is a libtool wrapper executable adamc@1133: # This function is only a basic sanity check; it will hardly flush out adamc@1133: # determined imposters. adamc@1133: func_ltwrapper_executable_p () adamc@1133: { adamc@1133: func_ltwrapper_exec_suffix= adamc@1133: case $1 in adamc@1133: *.exe) ;; adamc@1133: *) func_ltwrapper_exec_suffix=.exe ;; adamc@1133: esac adamc@1133: $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 adamc@1133: } adamc@1133: adamc@1133: # func_ltwrapper_scriptname file adamc@1133: # Assumes file is an ltwrapper_executable adamc@1133: # uses $file to determine the appropriate filename for a adamc@1133: # temporary ltwrapper_script. adamc@1133: func_ltwrapper_scriptname () adamc@1133: { adam@1826: func_ltwrapper_scriptname_result="" adam@1826: if func_ltwrapper_executable_p "$1"; then adam@1826: func_dirname_and_basename "$1" "" "." adam@1826: func_stripname '' '.exe' "$func_basename_result" adam@1826: func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" adam@1826: fi adamc@1133: } adamc@1133: adamc@1133: # func_ltwrapper_p file adamc@1133: # True iff FILE is a libtool wrapper script or wrapper executable adamc@1133: # This function is only a basic sanity check; it will hardly flush out adamc@1133: # determined imposters. adamc@1133: func_ltwrapper_p () adamc@1133: { adamc@1133: func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_execute_cmds commands fail_cmd adamc@1133: # Execute tilde-delimited COMMANDS. adamc@1133: # If FAIL_CMD is given, eval that upon failure. adamc@1133: # FAIL_CMD may read-access the current command in variable CMD! adamc@1133: func_execute_cmds () adamc@1133: { adamc@1133: $opt_debug adamc@1133: save_ifs=$IFS; IFS='~' adamc@1133: for cmd in $1; do adamc@1133: IFS=$save_ifs adamc@1133: eval cmd=\"$cmd\" adamc@1133: func_show_eval "$cmd" "${2-:}" adamc@1133: done adamc@1133: IFS=$save_ifs adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_source file adamc@1133: # Source FILE, adding directory component if necessary. adamc@1133: # Note that it is not necessary on cygwin/mingw to append a dot to adamc@1133: # FILE even if both FILE and FILE.exe exist: automatic-append-.exe adamc@1133: # behavior happens only for exec(3), not for open(2)! Also, sourcing adamc@1133: # `FILE.' does not work on cygwin managed mounts. adamc@1133: func_source () adamc@1133: { adamc@1133: $opt_debug adamc@1133: case $1 in adamc@1133: */* | *\\*) . "$1" ;; adamc@1133: *) . "./$1" ;; adamc@1133: esac adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_infer_tag arg adamc@1133: # Infer tagged configuration to use if any are available and adamc@1133: # if one wasn't chosen via the "--tag" command line option. adamc@1133: # Only attempt this if the compiler in the base compile adamc@1133: # command doesn't match the default compiler. adamc@1133: # arg is usually of the form 'gcc ...' adamc@1133: func_infer_tag () adamc@1133: { adamc@1133: $opt_debug adamc@1133: if test -n "$available_tags" && test -z "$tagname"; then adamc@1133: CC_quoted= adamc@1133: for arg in $CC; do adam@1826: func_quote_for_eval "$arg" adam@1826: CC_quoted="$CC_quoted $func_quote_for_eval_result" adamc@1133: done adamc@1133: case $@ in adamc@1133: # Blanks in the command may have been stripped by the calling shell, adamc@1133: # but not from the CC environment variable when configure was run. adam@1826: " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; adamc@1133: # Blanks at the start of $base_compile will cause this to fail adamc@1133: # if we don't check for them as well. adamc@1133: *) adamc@1133: for z in $available_tags; do adamc@1133: if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then adamc@1133: # Evaluate the configuration. adamc@1133: eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" adamc@1133: CC_quoted= adamc@1133: for arg in $CC; do adamc@1133: # Double-quote args containing other shell metacharacters. adam@1826: func_quote_for_eval "$arg" adam@1826: CC_quoted="$CC_quoted $func_quote_for_eval_result" adamc@1133: done adamc@1133: case "$@ " in adam@1826: " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) adamc@1133: # The compiler in the base compile command matches adamc@1133: # the one in the tagged configuration. adamc@1133: # Assume this is the tagged configuration we want. adamc@1133: tagname=$z adamc@1133: break adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: done adamc@1133: # If $tagname still isn't set, then no tagged configuration adamc@1133: # was found and let the user know that the "--tag" command adamc@1133: # line option must be used. adamc@1133: if test -z "$tagname"; then adamc@1133: func_echo "unable to infer tagged configuration" adamc@1133: func_fatal_error "specify a tag with \`--tag'" adamc@1133: # else adamc@1133: # func_verbose "using $tagname tagged configuration" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: adamc@1133: adamc@1133: # func_write_libtool_object output_name pic_name nonpic_name adamc@1133: # Create a libtool object file (analogous to a ".la" file), adamc@1133: # but don't create it if we're doing a dry run. adamc@1133: func_write_libtool_object () adamc@1133: { adamc@1133: write_libobj=${1} adamc@1133: if test "$build_libtool_libs" = yes; then adamc@1133: write_lobj=\'${2}\' adamc@1133: else adamc@1133: write_lobj=none adamc@1133: fi adamc@1133: adamc@1133: if test "$build_old_libs" = yes; then adamc@1133: write_oldobj=\'${3}\' adamc@1133: else adamc@1133: write_oldobj=none adamc@1133: fi adamc@1133: adamc@1133: $opt_dry_run || { adamc@1133: cat >${write_libobj}T <?"'"'"' &()|`$[]' \ adamc@1133: && func_warning "libobj name \`$libobj' may not contain shell special characters." adamc@1133: func_dirname_and_basename "$obj" "/" "" adamc@1133: objname="$func_basename_result" adamc@1133: xdir="$func_dirname_result" adamc@1133: lobj=${xdir}$objdir/$objname adamc@1133: adamc@1133: test -z "$base_compile" && \ adamc@1133: func_fatal_help "you must specify a compilation command" adamc@1133: adamc@1133: # Delete any leftover library objects. adamc@1133: if test "$build_old_libs" = yes; then adamc@1133: removelist="$obj $lobj $libobj ${libobj}T" adamc@1133: else adamc@1133: removelist="$lobj $libobj ${libobj}T" adamc@1133: fi adamc@1133: adamc@1133: # On Cygwin there's no "real" PIC flag so we must build both object types adamc@1133: case $host_os in adamc@1133: cygwin* | mingw* | pw32* | os2* | cegcc*) adamc@1133: pic_mode=default adamc@1133: ;; adamc@1133: esac adamc@1133: if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then adamc@1133: # non-PIC code in shared libraries is not supported adamc@1133: pic_mode=default adamc@1133: fi adamc@1133: adamc@1133: # Calculate the filename of the output object if compiler does adamc@1133: # not support -o with -c adamc@1133: if test "$compiler_c_o" = no; then adam@1826: output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} adamc@1133: lockfile="$output_obj.lock" adamc@1133: else adamc@1133: output_obj= adamc@1133: need_locks=no adamc@1133: lockfile= adamc@1133: fi adamc@1133: adamc@1133: # Lock this critical section if it is needed adamc@1133: # We use this script file to make the link, it avoids creating a new file adamc@1133: if test "$need_locks" = yes; then adamc@1133: until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do adamc@1133: func_echo "Waiting for $lockfile to be removed" adamc@1133: sleep 2 adamc@1133: done adamc@1133: elif test "$need_locks" = warn; then adamc@1133: if test -f "$lockfile"; then adamc@1133: $ECHO "\ adamc@1133: *** ERROR, $lockfile exists and contains: adamc@1133: `cat $lockfile 2>/dev/null` adamc@1133: adamc@1133: This indicates that another process is trying to use the same adamc@1133: temporary object file, and libtool could not work around it because adamc@1133: your compiler does not support \`-c' and \`-o' together. If you adamc@1133: repeat this compilation, it may succeed, by chance, but you had better adamc@1133: avoid parallel builds (make -j) in this platform, or get a better adamc@1133: compiler." adamc@1133: adamc@1133: $opt_dry_run || $RM $removelist adamc@1133: exit $EXIT_FAILURE adamc@1133: fi adam@1826: removelist="$removelist $output_obj" adamc@1133: $ECHO "$srcfile" > "$lockfile" adamc@1133: fi adamc@1133: adamc@1133: $opt_dry_run || $RM $removelist adam@1826: removelist="$removelist $lockfile" adamc@1133: trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 adamc@1133: adam@1826: if test -n "$fix_srcfile_path"; then adam@1826: eval srcfile=\"$fix_srcfile_path\" adam@1826: fi adamc@1133: func_quote_for_eval "$srcfile" adamc@1133: qsrcfile=$func_quote_for_eval_result adamc@1133: adamc@1133: # Only build a PIC object if we are building libtool libraries. adamc@1133: if test "$build_libtool_libs" = yes; then adamc@1133: # Without this assignment, base_compile gets emptied. adamc@1133: fbsd_hideous_sh_bug=$base_compile adamc@1133: adamc@1133: if test "$pic_mode" != no; then adamc@1133: command="$base_compile $qsrcfile $pic_flag" adamc@1133: else adamc@1133: # Don't build PIC code adamc@1133: command="$base_compile $qsrcfile" adamc@1133: fi adamc@1133: adamc@1133: func_mkdir_p "$xdir$objdir" adamc@1133: adamc@1133: if test -z "$output_obj"; then adamc@1133: # Place PIC objects in $objdir adam@1826: command="$command -o $lobj" adamc@1133: fi adamc@1133: adamc@1133: func_show_eval_locale "$command" \ adamc@1133: 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' adamc@1133: adamc@1133: if test "$need_locks" = warn && adamc@1133: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then adamc@1133: $ECHO "\ adamc@1133: *** ERROR, $lockfile contains: adamc@1133: `cat $lockfile 2>/dev/null` adamc@1133: adamc@1133: but it should contain: adamc@1133: $srcfile adamc@1133: adamc@1133: This indicates that another process is trying to use the same adamc@1133: temporary object file, and libtool could not work around it because adamc@1133: your compiler does not support \`-c' and \`-o' together. If you adamc@1133: repeat this compilation, it may succeed, by chance, but you had better adamc@1133: avoid parallel builds (make -j) in this platform, or get a better adamc@1133: compiler." adamc@1133: adamc@1133: $opt_dry_run || $RM $removelist adamc@1133: exit $EXIT_FAILURE adamc@1133: fi adamc@1133: adamc@1133: # Just move the object if needed, then go on to compile the next one adamc@1133: if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then adamc@1133: func_show_eval '$MV "$output_obj" "$lobj"' \ adamc@1133: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' adamc@1133: fi adamc@1133: adamc@1133: # Allow error messages only from the first compilation. adamc@1133: if test "$suppress_opt" = yes; then adamc@1133: suppress_output=' >/dev/null 2>&1' adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Only build a position-dependent object if we build old libraries. adamc@1133: if test "$build_old_libs" = yes; then adamc@1133: if test "$pic_mode" != yes; then adamc@1133: # Don't build PIC code adamc@1133: command="$base_compile $qsrcfile$pie_flag" adamc@1133: else adamc@1133: command="$base_compile $qsrcfile $pic_flag" adamc@1133: fi adamc@1133: if test "$compiler_c_o" = yes; then adam@1826: command="$command -o $obj" adamc@1133: fi adamc@1133: adamc@1133: # Suppress compiler output if we already did a PIC compilation. adam@1826: command="$command$suppress_output" adamc@1133: func_show_eval_locale "$command" \ adamc@1133: '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' adamc@1133: adamc@1133: if test "$need_locks" = warn && adamc@1133: test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then adamc@1133: $ECHO "\ adamc@1133: *** ERROR, $lockfile contains: adamc@1133: `cat $lockfile 2>/dev/null` adamc@1133: adamc@1133: but it should contain: adamc@1133: $srcfile adamc@1133: adamc@1133: This indicates that another process is trying to use the same adamc@1133: temporary object file, and libtool could not work around it because adamc@1133: your compiler does not support \`-c' and \`-o' together. If you adamc@1133: repeat this compilation, it may succeed, by chance, but you had better adamc@1133: avoid parallel builds (make -j) in this platform, or get a better adamc@1133: compiler." adamc@1133: adamc@1133: $opt_dry_run || $RM $removelist adamc@1133: exit $EXIT_FAILURE adamc@1133: fi adamc@1133: adamc@1133: # Just move the object if needed adamc@1133: if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then adamc@1133: func_show_eval '$MV "$output_obj" "$obj"' \ adamc@1133: 'error=$?; $opt_dry_run || $RM $removelist; exit $error' adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: $opt_dry_run || { adamc@1133: func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" adamc@1133: adamc@1133: # Unlock the critical section if it was locked adamc@1133: if test "$need_locks" != no; then adamc@1133: removelist=$lockfile adamc@1133: $RM "$lockfile" adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: exit $EXIT_SUCCESS adamc@1133: } adamc@1133: adamc@1133: $opt_help || { adam@1826: test "$mode" = compile && func_mode_compile ${1+"$@"} adamc@1133: } adamc@1133: adamc@1133: func_mode_help () adamc@1133: { adamc@1133: # We need to display help for each of the modes. adam@1826: case $mode in adamc@1133: "") adamc@1133: # Generic help is extracted from the usage comments adamc@1133: # at the start of this file. adamc@1133: func_help adamc@1133: ;; adamc@1133: adamc@1133: clean) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... adamc@1133: adamc@1133: Remove files from the build directory. adamc@1133: adamc@1133: RM is the name of the program to use to delete files associated with each FILE adamc@1133: (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed adamc@1133: to RM. adamc@1133: adamc@1133: If FILE is a libtool library, object or program, all the files associated adamc@1133: with it are deleted. Otherwise, only FILE itself is deleted using RM." adamc@1133: ;; adamc@1133: adamc@1133: compile) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE adamc@1133: adamc@1133: Compile a source file into a libtool library object. adamc@1133: adamc@1133: This mode accepts the following additional options: adamc@1133: adamc@1133: -o OUTPUT-FILE set the output file name to OUTPUT-FILE adamc@1133: -no-suppress do not suppress compiler output for multiple passes adam@1826: -prefer-pic try to building PIC objects only adam@1826: -prefer-non-pic try to building non-PIC objects only adamc@1133: -shared do not build a \`.o' file suitable for static linking adamc@1133: -static only build a \`.o' file suitable for static linking adamc@1133: adamc@1133: COMPILE-COMMAND is a command to be used in creating a \`standard' object file adamc@1133: from the given SOURCEFILE. adamc@1133: adamc@1133: The output file name is determined by removing the directory component from adamc@1133: SOURCEFILE, then substituting the C source code suffix \`.c' with the adamc@1133: library object suffix, \`.lo'." adamc@1133: ;; adamc@1133: adamc@1133: execute) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... adamc@1133: adamc@1133: Automatically set library path, then run a program. adamc@1133: adamc@1133: This mode accepts the following additional options: adamc@1133: adamc@1133: -dlopen FILE add the directory containing FILE to the library path adamc@1133: adamc@1133: This mode sets the library path environment variable according to \`-dlopen' adamc@1133: flags. adamc@1133: adamc@1133: If any of the ARGS are libtool executable wrappers, then they are translated adamc@1133: into their corresponding uninstalled binary, and any of their required library adamc@1133: directories are added to the library path. adamc@1133: adamc@1133: Then, COMMAND is executed, with ARGS as arguments." adamc@1133: ;; adamc@1133: adamc@1133: finish) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... adamc@1133: adamc@1133: Complete the installation of libtool libraries. adamc@1133: adamc@1133: Each LIBDIR is a directory that contains libtool libraries. adamc@1133: adamc@1133: The commands that this mode executes may require superuser privileges. Use adamc@1133: the \`--dry-run' option if you just want to see what would be executed." adamc@1133: ;; adamc@1133: adamc@1133: install) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... adamc@1133: adamc@1133: Install executables or libraries. adamc@1133: adamc@1133: INSTALL-COMMAND is the installation command. The first component should be adamc@1133: either the \`install' or \`cp' program. adamc@1133: adamc@1133: The following components of INSTALL-COMMAND are treated specially: adamc@1133: adam@1826: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation adamc@1133: adamc@1133: The rest of the components are interpreted as arguments to that command (only adamc@1133: BSD-compatible install options are recognized)." adamc@1133: ;; adamc@1133: adamc@1133: link) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... adamc@1133: adamc@1133: Link object files or libraries together to form another library, or to adamc@1133: create an executable program. adamc@1133: adamc@1133: LINK-COMMAND is a command using the C compiler that you would use to create adamc@1133: a program from several object files. adamc@1133: adamc@1133: The following components of LINK-COMMAND are treated specially: adamc@1133: adamc@1133: -all-static do not do any dynamic linking at all adamc@1133: -avoid-version do not add a version suffix if possible adamc@1133: -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime adamc@1133: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols adamc@1133: -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) adamc@1133: -export-symbols SYMFILE adamc@1133: try to export only the symbols listed in SYMFILE adamc@1133: -export-symbols-regex REGEX adamc@1133: try to export only the symbols matching REGEX adamc@1133: -LLIBDIR search LIBDIR for required installed libraries adamc@1133: -lNAME OUTPUT-FILE requires the installed library libNAME adamc@1133: -module build a library that can dlopened adamc@1133: -no-fast-install disable the fast-install mode adamc@1133: -no-install link a not-installable executable adamc@1133: -no-undefined declare that a library does not refer to external symbols adamc@1133: -o OUTPUT-FILE create OUTPUT-FILE from the specified objects adamc@1133: -objectlist FILE Use a list of object files found in FILE to specify objects adamc@1133: -precious-files-regex REGEX adamc@1133: don't remove output files matching REGEX adamc@1133: -release RELEASE specify package release information adamc@1133: -rpath LIBDIR the created library will eventually be installed in LIBDIR adamc@1133: -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries adamc@1133: -shared only do dynamic linking of libtool libraries adamc@1133: -shrext SUFFIX override the standard shared library file extension adamc@1133: -static do not do any dynamic linking of uninstalled libtool libraries adamc@1133: -static-libtool-libs adamc@1133: do not do any dynamic linking of libtool libraries adamc@1133: -version-info CURRENT[:REVISION[:AGE]] adamc@1133: specify library version info [each variable defaults to 0] adamc@1133: -weak LIBNAME declare that the target provides the LIBNAME interface adamc@1133: adamc@1133: All other options (arguments beginning with \`-') are ignored. adamc@1133: adamc@1133: Every other argument is treated as a filename. Files ending in \`.la' are adamc@1133: treated as uninstalled libtool libraries, other files are standard or library adamc@1133: object files. adamc@1133: adamc@1133: If the OUTPUT-FILE ends in \`.la', then a libtool library is created, adamc@1133: only library objects (\`.lo' files) may be specified, and \`-rpath' is adamc@1133: required, except when creating a convenience library. adamc@1133: adamc@1133: If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created adamc@1133: using \`ar' and \`ranlib', or on Windows using \`lib'. adamc@1133: adamc@1133: If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file adamc@1133: is created, otherwise an executable program is created." adamc@1133: ;; adamc@1133: adamc@1133: uninstall) adamc@1133: $ECHO \ adamc@1133: "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... adamc@1133: adamc@1133: Remove libraries from an installation directory. adamc@1133: adamc@1133: RM is the name of the program to use to delete files associated with each FILE adamc@1133: (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed adamc@1133: to RM. adamc@1133: adamc@1133: If FILE is a libtool library, all the files associated with it are deleted. adamc@1133: Otherwise, only FILE itself is deleted using RM." adamc@1133: ;; adamc@1133: adamc@1133: *) adam@1826: func_fatal_help "invalid operation mode \`$mode'" adamc@1133: ;; adamc@1133: esac adamc@1133: adam@1826: $ECHO adamc@1133: $ECHO "Try \`$progname --help' for more information about other modes." adam@1826: adam@1826: exit $? adam@1459: } adam@1459: adam@1826: # Now that we've collected a possible --mode arg, show help if necessary adam@1826: $opt_help && func_mode_help adamc@1133: adamc@1133: adamc@1133: # func_mode_execute arg... adamc@1133: func_mode_execute () adamc@1133: { adamc@1133: $opt_debug adamc@1133: # The first argument is the command name. adamc@1133: cmd="$nonopt" adamc@1133: test -z "$cmd" && \ adamc@1133: func_fatal_help "you must specify a COMMAND" adamc@1133: adamc@1133: # Handle -dlopen flags immediately. adam@1826: for file in $execute_dlfiles; do adamc@1133: test -f "$file" \ adamc@1133: || func_fatal_help "\`$file' is not a file" adamc@1133: adamc@1133: dir= adamc@1133: case $file in adamc@1133: *.la) adamc@1133: # Check to see that this really is a libtool archive. adamc@1133: func_lalib_unsafe_p "$file" \ adamc@1133: || func_fatal_help "\`$lib' is not a valid libtool archive" adamc@1133: adamc@1133: # Read the libtool library. adamc@1133: dlname= adamc@1133: library_names= adamc@1133: func_source "$file" adamc@1133: adamc@1133: # Skip this library if it cannot be dlopened. adamc@1133: if test -z "$dlname"; then adamc@1133: # Warn if it was a shared library. adamc@1133: test -n "$library_names" && \ adamc@1133: func_warning "\`$file' was not linked with \`-export-dynamic'" adamc@1133: continue adamc@1133: fi adamc@1133: adamc@1133: func_dirname "$file" "" "." adamc@1133: dir="$func_dirname_result" adamc@1133: adamc@1133: if test -f "$dir/$objdir/$dlname"; then adam@1826: dir="$dir/$objdir" adamc@1133: else adamc@1133: if test ! -f "$dir/$dlname"; then adamc@1133: func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: adamc@1133: *.lo) adamc@1133: # Just add the directory containing the .lo file. adamc@1133: func_dirname "$file" "" "." adamc@1133: dir="$func_dirname_result" adamc@1133: ;; adamc@1133: adamc@1133: *) adamc@1133: func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" adamc@1133: continue adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Get the absolute pathname. adamc@1133: absdir=`cd "$dir" && pwd` adamc@1133: test -n "$absdir" && dir="$absdir" adamc@1133: adamc@1133: # Now add the directory to shlibpath_var. adamc@1133: if eval "test -z \"\$$shlibpath_var\""; then adamc@1133: eval "$shlibpath_var=\"\$dir\"" adamc@1133: else adamc@1133: eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" adamc@1133: fi adamc@1133: done adamc@1133: adamc@1133: # This variable tells wrapper scripts just to set shlibpath_var adamc@1133: # rather than running their programs. adamc@1133: libtool_execute_magic="$magic" adamc@1133: adamc@1133: # Check if any of the arguments is a wrapper script. adamc@1133: args= adamc@1133: for file adamc@1133: do adamc@1133: case $file in adam@1826: -*) ;; adamc@1133: *) adamc@1133: # Do a test to see if this is really a libtool program. adamc@1133: if func_ltwrapper_script_p "$file"; then adamc@1133: func_source "$file" adamc@1133: # Transform arg to wrapped name. adamc@1133: file="$progdir/$program" adamc@1133: elif func_ltwrapper_executable_p "$file"; then adamc@1133: func_ltwrapper_scriptname "$file" adamc@1133: func_source "$func_ltwrapper_scriptname_result" adamc@1133: # Transform arg to wrapped name. adamc@1133: file="$progdir/$program" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: # Quote arguments (to preserve shell metacharacters). adam@1826: func_quote_for_eval "$file" adam@1826: args="$args $func_quote_for_eval_result" adamc@1133: done adamc@1133: adamc@1133: if test "X$opt_dry_run" = Xfalse; then adamc@1133: if test -n "$shlibpath_var"; then adamc@1133: # Export the shlibpath_var. adamc@1133: eval "export $shlibpath_var" adamc@1133: fi adamc@1133: adamc@1133: # Restore saved environment variables adamc@1133: for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES adamc@1133: do adamc@1133: eval "if test \"\${save_$lt_var+set}\" = set; then adamc@1133: $lt_var=\$save_$lt_var; export $lt_var adamc@1133: else adamc@1133: $lt_unset $lt_var adamc@1133: fi" adamc@1133: done adamc@1133: adamc@1133: # Now prepare to actually exec the command. adamc@1133: exec_cmd="\$cmd$args" adamc@1133: else adamc@1133: # Display what would be done. adamc@1133: if test -n "$shlibpath_var"; then adamc@1133: eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" adam@1826: $ECHO "export $shlibpath_var" adamc@1133: fi adamc@1133: $ECHO "$cmd$args" adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: } adamc@1133: adam@1826: test "$mode" = execute && func_mode_execute ${1+"$@"} adamc@1133: adamc@1133: adamc@1133: # func_mode_finish arg... adamc@1133: func_mode_finish () adamc@1133: { adamc@1133: $opt_debug adam@1826: libdirs="$nonopt" adamc@1133: admincmds= adamc@1133: adamc@1133: if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then adam@1826: for dir adam@1826: do adam@1826: libdirs="$libdirs $dir" adam@1826: done adam@1826: adamc@1133: for libdir in $libdirs; do adamc@1133: if test -n "$finish_cmds"; then adamc@1133: # Do each command in the finish commands. adamc@1133: func_execute_cmds "$finish_cmds" 'admincmds="$admincmds adamc@1133: '"$cmd"'"' adamc@1133: fi adamc@1133: if test -n "$finish_eval"; then adamc@1133: # Do the single finish_eval. adamc@1133: eval cmds=\"$finish_eval\" adam@1826: $opt_dry_run || eval "$cmds" || admincmds="$admincmds adamc@1133: $cmds" adamc@1133: fi adamc@1133: done adamc@1133: fi adamc@1133: adamc@1133: # Exit here if they wanted silent mode. adamc@1133: $opt_silent && exit $EXIT_SUCCESS adamc@1133: adam@1826: $ECHO "X----------------------------------------------------------------------" | $Xsed adam@1826: $ECHO "Libraries have been installed in:" adam@1826: for libdir in $libdirs; do adam@1826: $ECHO " $libdir" adam@1826: done adam@1826: $ECHO adam@1826: $ECHO "If you ever happen to want to link against installed libraries" adam@1826: $ECHO "in a given directory, LIBDIR, you must either use libtool, and" adam@1826: $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" adam@1826: $ECHO "flag during linking and do at least one of the following:" adam@1826: if test -n "$shlibpath_var"; then adam@1826: $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" adam@1826: $ECHO " during execution" adamc@1133: fi adam@1826: if test -n "$runpath_var"; then adam@1826: $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" adam@1826: $ECHO " during linking" adam@1826: fi adam@1826: if test -n "$hardcode_libdir_flag_spec"; then adam@1826: libdir=LIBDIR adam@1826: eval flag=\"$hardcode_libdir_flag_spec\" adam@1826: adam@1826: $ECHO " - use the \`$flag' linker flag" adam@1826: fi adam@1826: if test -n "$admincmds"; then adam@1826: $ECHO " - have your system administrator run these commands:$admincmds" adam@1826: fi adam@1826: if test -f /etc/ld.so.conf; then adam@1826: $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" adam@1826: fi adam@1826: $ECHO adam@1826: adam@1826: $ECHO "See any operating system documentation about shared libraries for" adam@1826: case $host in adam@1826: solaris2.[6789]|solaris2.1[0-9]) adam@1826: $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" adam@1826: $ECHO "pages." adam@1826: ;; adam@1826: *) adam@1826: $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." adam@1826: ;; adam@1826: esac adam@1826: $ECHO "X----------------------------------------------------------------------" | $Xsed adamc@1133: exit $EXIT_SUCCESS adamc@1133: } adamc@1133: adam@1826: test "$mode" = finish && func_mode_finish ${1+"$@"} adamc@1133: adamc@1133: adamc@1133: # func_mode_install arg... adamc@1133: func_mode_install () adamc@1133: { adamc@1133: $opt_debug adamc@1133: # There may be an optional sh(1) argument at the beginning of adamc@1133: # install_prog (especially on Windows NT). adamc@1133: if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || adamc@1133: # Allow the use of GNU shtool's install command. adam@1826: $ECHO "X$nonopt" | $GREP shtool >/dev/null; then adamc@1133: # Aesthetically quote it. adamc@1133: func_quote_for_eval "$nonopt" adamc@1133: install_prog="$func_quote_for_eval_result " adamc@1133: arg=$1 adamc@1133: shift adamc@1133: else adamc@1133: install_prog= adamc@1133: arg=$nonopt adamc@1133: fi adamc@1133: adamc@1133: # The real first argument should be the name of the installation program. adamc@1133: # Aesthetically quote it. adamc@1133: func_quote_for_eval "$arg" adam@1826: install_prog="$install_prog$func_quote_for_eval_result" adamc@1133: adamc@1133: # We need to accept at least all the BSD install flags. adamc@1133: dest= adamc@1133: files= adamc@1133: opts= adamc@1133: prev= adamc@1133: install_type= adamc@1133: isdir=no adamc@1133: stripme= adamc@1133: for arg adamc@1133: do adamc@1133: if test -n "$dest"; then adam@1826: files="$files $dest" adamc@1133: dest=$arg adamc@1133: continue adamc@1133: fi adamc@1133: adamc@1133: case $arg in adamc@1133: -d) isdir=yes ;; adamc@1133: -f) adam@1826: case " $install_prog " in adam@1826: *[\\\ /]cp\ *) ;; adam@1826: *) prev=$arg ;; adam@1826: esac adamc@1133: ;; adamc@1133: -g | -m | -o) adamc@1133: prev=$arg adamc@1133: ;; adamc@1133: -s) adamc@1133: stripme=" -s" adamc@1133: continue adamc@1133: ;; adamc@1133: -*) adamc@1133: ;; adamc@1133: *) adamc@1133: # If the previous option needed an argument, then skip it. adamc@1133: if test -n "$prev"; then adamc@1133: prev= adamc@1133: else adamc@1133: dest=$arg adamc@1133: continue adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Aesthetically quote the argument. adamc@1133: func_quote_for_eval "$arg" adam@1826: install_prog="$install_prog $func_quote_for_eval_result" adamc@1133: done adamc@1133: adamc@1133: test -z "$install_prog" && \ adamc@1133: func_fatal_help "you must specify an install program" adamc@1133: adamc@1133: test -n "$prev" && \ adamc@1133: func_fatal_help "the \`$prev' option requires an argument" adamc@1133: adamc@1133: if test -z "$files"; then adamc@1133: if test -z "$dest"; then adamc@1133: func_fatal_help "no file or destination specified" adamc@1133: else adamc@1133: func_fatal_help "you must specify a destination" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Strip any trailing slash from the destination. adamc@1133: func_stripname '' '/' "$dest" adamc@1133: dest=$func_stripname_result adamc@1133: adamc@1133: # Check to see that the destination is a directory. adamc@1133: test -d "$dest" && isdir=yes adamc@1133: if test "$isdir" = yes; then adamc@1133: destdir="$dest" adamc@1133: destname= adamc@1133: else adamc@1133: func_dirname_and_basename "$dest" "" "." adamc@1133: destdir="$func_dirname_result" adamc@1133: destname="$func_basename_result" adamc@1133: adamc@1133: # Not a directory, so check to see that there is only one file specified. adamc@1133: set dummy $files; shift adamc@1133: test "$#" -gt 1 && \ adamc@1133: func_fatal_help "\`$dest' is not a directory" adamc@1133: fi adamc@1133: case $destdir in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) ;; adamc@1133: *) adamc@1133: for file in $files; do adamc@1133: case $file in adamc@1133: *.lo) ;; adamc@1133: *) adamc@1133: func_fatal_help "\`$destdir' must be an absolute directory name" adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # This variable tells wrapper scripts just to set variables rather adamc@1133: # than running their programs. adamc@1133: libtool_install_magic="$magic" adamc@1133: adamc@1133: staticlibs= adamc@1133: future_libdirs= adamc@1133: current_libdirs= adamc@1133: for file in $files; do adamc@1133: adamc@1133: # Do each installation. adamc@1133: case $file in adamc@1133: *.$libext) adamc@1133: # Do the static libraries later. adam@1826: staticlibs="$staticlibs $file" adamc@1133: ;; adamc@1133: adamc@1133: *.la) adamc@1133: # Check to see that this really is a libtool archive. adamc@1133: func_lalib_unsafe_p "$file" \ adamc@1133: || func_fatal_help "\`$file' is not a valid libtool archive" adamc@1133: adamc@1133: library_names= adamc@1133: old_library= adamc@1133: relink_command= adamc@1133: func_source "$file" adamc@1133: adamc@1133: # Add the libdir to current_libdirs if it is the destination. adamc@1133: if test "X$destdir" = "X$libdir"; then adamc@1133: case "$current_libdirs " in adamc@1133: *" $libdir "*) ;; adam@1826: *) current_libdirs="$current_libdirs $libdir" ;; adamc@1133: esac adamc@1133: else adamc@1133: # Note the libdir as a future libdir. adamc@1133: case "$future_libdirs " in adamc@1133: *" $libdir "*) ;; adam@1826: *) future_libdirs="$future_libdirs $libdir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: adamc@1133: func_dirname "$file" "/" "" adamc@1133: dir="$func_dirname_result" adam@1826: dir="$dir$objdir" adamc@1133: adamc@1133: if test -n "$relink_command"; then adamc@1133: # Determine the prefix the user has applied to our future dir. adam@1826: inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` adamc@1133: adamc@1133: # Don't allow the user to place us outside of our expected adamc@1133: # location b/c this prevents finding dependent libraries that adamc@1133: # are installed to the same prefix. adamc@1133: # At present, this check doesn't affect windows .dll's that adamc@1133: # are installed into $libdir/../bin (currently, that works fine) adamc@1133: # but it's something to keep an eye on. adamc@1133: test "$inst_prefix_dir" = "$destdir" && \ adamc@1133: func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" adamc@1133: adamc@1133: if test -n "$inst_prefix_dir"; then adamc@1133: # Stick the inst_prefix_dir data into the link command. adam@1826: relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` adamc@1133: else adam@1826: relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` adamc@1133: fi adamc@1133: adamc@1133: func_warning "relinking \`$file'" adamc@1133: func_show_eval "$relink_command" \ adamc@1133: 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' adamc@1133: fi adamc@1133: adamc@1133: # See the names of the shared library. adamc@1133: set dummy $library_names; shift adamc@1133: if test -n "$1"; then adamc@1133: realname="$1" adamc@1133: shift adamc@1133: adamc@1133: srcname="$realname" adamc@1133: test -n "$relink_command" && srcname="$realname"T adamc@1133: adamc@1133: # Install the shared library and build the symlinks. adam@1826: func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ adamc@1133: 'exit $?' adamc@1133: tstripme="$stripme" adamc@1133: case $host_os in adamc@1133: cygwin* | mingw* | pw32* | cegcc*) adamc@1133: case $realname in adamc@1133: *.dll.a) adamc@1133: tstripme="" adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: if test -n "$tstripme" && test -n "$striplib"; then adamc@1133: func_show_eval "$striplib $destdir/$realname" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: if test "$#" -gt 0; then adamc@1133: # Delete the old symlinks, and create new ones. adamc@1133: # Try `ln -sf' first, because the `ln' binary might depend on adamc@1133: # the symlink we replace! Solaris /bin/ln does not understand -f, adamc@1133: # so we also need to try rm && ln -s. adamc@1133: for linkname adamc@1133: do adamc@1133: test "$linkname" != "$realname" \ adamc@1133: && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" adamc@1133: done adamc@1133: fi adamc@1133: adamc@1133: # Do each command in the postinstall commands. adamc@1133: lib="$destdir/$realname" adamc@1133: func_execute_cmds "$postinstall_cmds" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: # Install the pseudo-library for information purposes. adamc@1133: func_basename "$file" adamc@1133: name="$func_basename_result" adamc@1133: instname="$dir/$name"i adamc@1133: func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' adamc@1133: adamc@1133: # Maybe install the static library, too. adam@1826: test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" adamc@1133: ;; adamc@1133: adamc@1133: *.lo) adamc@1133: # Install (i.e. copy) a libtool object. adamc@1133: adamc@1133: # Figure out destination file name, if it wasn't already specified. adamc@1133: if test -n "$destname"; then adamc@1133: destfile="$destdir/$destname" adamc@1133: else adamc@1133: func_basename "$file" adamc@1133: destfile="$func_basename_result" adamc@1133: destfile="$destdir/$destfile" adamc@1133: fi adamc@1133: adamc@1133: # Deduce the name of the destination old-style object file. adamc@1133: case $destfile in adamc@1133: *.lo) adamc@1133: func_lo2o "$destfile" adamc@1133: staticdest=$func_lo2o_result adamc@1133: ;; adamc@1133: *.$objext) adamc@1133: staticdest="$destfile" adamc@1133: destfile= adamc@1133: ;; adamc@1133: *) adamc@1133: func_fatal_help "cannot copy a libtool object to \`$destfile'" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Install the libtool object if requested. adamc@1133: test -n "$destfile" && \ adamc@1133: func_show_eval "$install_prog $file $destfile" 'exit $?' adamc@1133: adamc@1133: # Install the old object if enabled. adamc@1133: if test "$build_old_libs" = yes; then adamc@1133: # Deduce the name of the old-style object file. adamc@1133: func_lo2o "$file" adamc@1133: staticobj=$func_lo2o_result adamc@1133: func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' adamc@1133: fi adamc@1133: exit $EXIT_SUCCESS adamc@1133: ;; adamc@1133: adamc@1133: *) adamc@1133: # Figure out destination file name, if it wasn't already specified. adamc@1133: if test -n "$destname"; then adamc@1133: destfile="$destdir/$destname" adamc@1133: else adamc@1133: func_basename "$file" adamc@1133: destfile="$func_basename_result" adamc@1133: destfile="$destdir/$destfile" adamc@1133: fi adamc@1133: adamc@1133: # If the file is missing, and there is a .exe on the end, strip it adamc@1133: # because it is most likely a libtool script we actually want to adamc@1133: # install adamc@1133: stripped_ext="" adamc@1133: case $file in adamc@1133: *.exe) adamc@1133: if test ! -f "$file"; then adamc@1133: func_stripname '' '.exe' "$file" adamc@1133: file=$func_stripname_result adamc@1133: stripped_ext=".exe" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Do a test to see if this is really a libtool program. adamc@1133: case $host in adamc@1133: *cygwin* | *mingw*) adamc@1133: if func_ltwrapper_executable_p "$file"; then adamc@1133: func_ltwrapper_scriptname "$file" adamc@1133: wrapper=$func_ltwrapper_scriptname_result adamc@1133: else adamc@1133: func_stripname '' '.exe' "$file" adamc@1133: wrapper=$func_stripname_result adamc@1133: fi adamc@1133: ;; adamc@1133: *) adamc@1133: wrapper=$file adamc@1133: ;; adamc@1133: esac adamc@1133: if func_ltwrapper_script_p "$wrapper"; then adamc@1133: notinst_deplibs= adamc@1133: relink_command= adamc@1133: adamc@1133: func_source "$wrapper" adamc@1133: adamc@1133: # Check the variables that should have been set. adamc@1133: test -z "$generated_by_libtool_version" && \ adamc@1133: func_fatal_error "invalid libtool wrapper script \`$wrapper'" adamc@1133: adamc@1133: finalize=yes adamc@1133: for lib in $notinst_deplibs; do adamc@1133: # Check to see that each library is installed. adamc@1133: libdir= adamc@1133: if test -f "$lib"; then adamc@1133: func_source "$lib" adamc@1133: fi adam@1826: libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test adamc@1133: if test -n "$libdir" && test ! -f "$libfile"; then adamc@1133: func_warning "\`$lib' has not been installed in \`$libdir'" adamc@1133: finalize=no adamc@1133: fi adamc@1133: done adamc@1133: adamc@1133: relink_command= adamc@1133: func_source "$wrapper" adamc@1133: adamc@1133: outputname= adamc@1133: if test "$fast_install" = no && test -n "$relink_command"; then adamc@1133: $opt_dry_run || { adamc@1133: if test "$finalize" = yes; then adamc@1133: tmpdir=`func_mktempdir` adamc@1133: func_basename "$file$stripped_ext" adamc@1133: file="$func_basename_result" adamc@1133: outputname="$tmpdir/$file" adamc@1133: # Replace the output file specification. adam@1826: relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` adamc@1133: adamc@1133: $opt_silent || { adamc@1133: func_quote_for_expand "$relink_command" adamc@1133: eval "func_echo $func_quote_for_expand_result" adamc@1133: } adamc@1133: if eval "$relink_command"; then : adamc@1133: else adamc@1133: func_error "error: relink \`$file' with the above command before installing it" adamc@1133: $opt_dry_run || ${RM}r "$tmpdir" adamc@1133: continue adamc@1133: fi adamc@1133: file="$outputname" adamc@1133: else adamc@1133: func_warning "cannot relink \`$file'" adamc@1133: fi adamc@1133: } adamc@1133: else adamc@1133: # Install the binary that we compiled earlier. adam@1826: file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # remove .exe since cygwin /usr/bin/install will append another adamc@1133: # one anyway adamc@1133: case $install_prog,$host in adamc@1133: */usr/bin/install*,*cygwin*) adamc@1133: case $file:$destfile in adamc@1133: *.exe:*.exe) adamc@1133: # this is ok adamc@1133: ;; adamc@1133: *.exe:*) adamc@1133: destfile=$destfile.exe adamc@1133: ;; adamc@1133: *:*.exe) adamc@1133: func_stripname '' '.exe' "$destfile" adamc@1133: destfile=$func_stripname_result adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' adamc@1133: $opt_dry_run || if test -n "$outputname"; then adamc@1133: ${RM}r "$tmpdir" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: for file in $staticlibs; do adamc@1133: func_basename "$file" adamc@1133: name="$func_basename_result" adamc@1133: adamc@1133: # Set up the ranlib parameters. adamc@1133: oldlib="$destdir/$name" adamc@1133: adamc@1133: func_show_eval "$install_prog \$file \$oldlib" 'exit $?' adamc@1133: adamc@1133: if test -n "$stripme" && test -n "$old_striplib"; then adam@1826: func_show_eval "$old_striplib $oldlib" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: # Do each command in the postinstall commands. adamc@1133: func_execute_cmds "$old_postinstall_cmds" 'exit $?' adamc@1133: done adamc@1133: adamc@1133: test -n "$future_libdirs" && \ adamc@1133: func_warning "remember to run \`$progname --finish$future_libdirs'" adamc@1133: adamc@1133: if test -n "$current_libdirs"; then adamc@1133: # Maybe just do a dry run. adamc@1133: $opt_dry_run && current_libdirs=" -n$current_libdirs" adamc@1133: exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' adamc@1133: else adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: } adamc@1133: adam@1826: test "$mode" = install && func_mode_install ${1+"$@"} adamc@1133: adamc@1133: adamc@1133: # func_generate_dlsyms outputname originator pic_p adamc@1133: # Extract symbols from dlprefiles and create ${outputname}S.o with adamc@1133: # a dlpreopen symbol table. adamc@1133: func_generate_dlsyms () adamc@1133: { adamc@1133: $opt_debug adamc@1133: my_outputname="$1" adamc@1133: my_originator="$2" adamc@1133: my_pic_p="${3-no}" adamc@1133: my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` adamc@1133: my_dlsyms= adamc@1133: adamc@1133: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then adamc@1133: if test -n "$NM" && test -n "$global_symbol_pipe"; then adamc@1133: my_dlsyms="${my_outputname}S.c" adamc@1133: else adamc@1133: func_error "not configured to extract global symbols from dlpreopened files" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test -n "$my_dlsyms"; then adamc@1133: case $my_dlsyms in adamc@1133: "") ;; adamc@1133: *.c) adamc@1133: # Discover the nlist of each of the dlfiles. adamc@1133: nlist="$output_objdir/${my_outputname}.nm" adamc@1133: adamc@1133: func_show_eval "$RM $nlist ${nlist}S ${nlist}T" adamc@1133: adamc@1133: # Parse the name list into a source file. adamc@1133: func_verbose "creating $output_objdir/$my_dlsyms" adamc@1133: adamc@1133: $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ adamc@1133: /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ adamc@1133: /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ adamc@1133: adamc@1133: #ifdef __cplusplus adamc@1133: extern \"C\" { adamc@1133: #endif adamc@1133: adamc@1133: /* External symbol declarations for the compiler. */\ adamc@1133: " adamc@1133: adamc@1133: if test "$dlself" = yes; then adamc@1133: func_verbose "generating symbol list for \`$output'" adamc@1133: adamc@1133: $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" adamc@1133: adamc@1133: # Add our own program objects to the symbol list. adam@1826: progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` adamc@1133: for progfile in $progfiles; do adam@1826: func_verbose "extracting global C symbols from \`$progfile'" adam@1826: $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" adamc@1133: done adamc@1133: adamc@1133: if test -n "$exclude_expsyms"; then adamc@1133: $opt_dry_run || { adamc@1133: eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' adamc@1133: eval '$MV "$nlist"T "$nlist"' adamc@1133: } adamc@1133: fi adamc@1133: adamc@1133: if test -n "$export_symbols_regex"; then adamc@1133: $opt_dry_run || { adamc@1133: eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' adamc@1133: eval '$MV "$nlist"T "$nlist"' adamc@1133: } adamc@1133: fi adamc@1133: adamc@1133: # Prepare the list of exported symbols adamc@1133: if test -z "$export_symbols"; then adamc@1133: export_symbols="$output_objdir/$outputname.exp" adamc@1133: $opt_dry_run || { adamc@1133: $RM $export_symbols adamc@1133: eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' adamc@1133: case $host in adamc@1133: *cygwin* | *mingw* | *cegcc* ) adamc@1133: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' adamc@1133: eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' adamc@1133: ;; adamc@1133: esac adamc@1133: } adamc@1133: else adamc@1133: $opt_dry_run || { adamc@1133: eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' adamc@1133: eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' adamc@1133: eval '$MV "$nlist"T "$nlist"' adamc@1133: case $host in adam@1826: *cygwin | *mingw* | *cegcc* ) adamc@1133: eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' adamc@1133: eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' adamc@1133: ;; adamc@1133: esac adamc@1133: } adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: for dlprefile in $dlprefiles; do adamc@1133: func_verbose "extracting global C symbols from \`$dlprefile'" adamc@1133: func_basename "$dlprefile" adamc@1133: name="$func_basename_result" adam@1826: $opt_dry_run || { adam@1826: eval '$ECHO ": $name " >> "$nlist"' adam@1826: eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" adam@1826: } adamc@1133: done adamc@1133: adamc@1133: $opt_dry_run || { adamc@1133: # Make sure we have at least an empty file. adamc@1133: test -f "$nlist" || : > "$nlist" adamc@1133: adamc@1133: if test -n "$exclude_expsyms"; then adamc@1133: $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T adamc@1133: $MV "$nlist"T "$nlist" adamc@1133: fi adamc@1133: adamc@1133: # Try sorting and uniquifying the output. adamc@1133: if $GREP -v "^: " < "$nlist" | adamc@1133: if sort -k 3 /dev/null 2>&1; then adamc@1133: sort -k 3 adamc@1133: else adamc@1133: sort +2 adamc@1133: fi | adamc@1133: uniq > "$nlist"S; then adamc@1133: : adamc@1133: else adamc@1133: $GREP -v "^: " < "$nlist" > "$nlist"S adamc@1133: fi adamc@1133: adamc@1133: if test -f "$nlist"S; then adamc@1133: eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' adamc@1133: else adam@1826: $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" adamc@1133: fi adamc@1133: adam@1826: $ECHO >> "$output_objdir/$my_dlsyms" "\ adamc@1133: adamc@1133: /* The mapping between symbol names and symbols. */ adamc@1133: typedef struct { adamc@1133: const char *name; adamc@1133: void *address; adamc@1133: } lt_dlsymlist; adam@1826: " adam@1826: case $host in adam@1826: *cygwin* | *mingw* | *cegcc* ) adam@1826: $ECHO >> "$output_objdir/$my_dlsyms" "\ adam@1826: /* DATA imports from DLLs on WIN32 con't be const, because adam@1826: runtime relocations are performed -- see ld's documentation adam@1826: on pseudo-relocs. */" adam@1826: lt_dlsym_const= ;; adam@1826: *osf5*) adam@1826: echo >> "$output_objdir/$my_dlsyms" "\ adam@1826: /* This system does not cope well with relocations in const data */" adam@1826: lt_dlsym_const= ;; adam@1826: *) adam@1826: lt_dlsym_const=const ;; adam@1826: esac adam@1826: adam@1826: $ECHO >> "$output_objdir/$my_dlsyms" "\ adam@1826: extern $lt_dlsym_const lt_dlsymlist adamc@1133: lt_${my_prefix}_LTX_preloaded_symbols[]; adam@1826: $lt_dlsym_const lt_dlsymlist adamc@1133: lt_${my_prefix}_LTX_preloaded_symbols[] = adamc@1133: {\ adamc@1133: { \"$my_originator\", (void *) 0 }," adamc@1133: adamc@1133: case $need_lib_prefix in adamc@1133: no) adamc@1133: eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" adamc@1133: ;; adamc@1133: *) adamc@1133: eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" adamc@1133: ;; adamc@1133: esac adam@1826: $ECHO >> "$output_objdir/$my_dlsyms" "\ adamc@1133: {0, (void *) 0} adamc@1133: }; adamc@1133: adamc@1133: /* This works around a problem in FreeBSD linker */ adamc@1133: #ifdef FREEBSD_WORKAROUND adamc@1133: static const void *lt_preloaded_setup() { adamc@1133: return lt_${my_prefix}_LTX_preloaded_symbols; adamc@1133: } adamc@1133: #endif adamc@1133: adamc@1133: #ifdef __cplusplus adamc@1133: } adamc@1133: #endif\ adamc@1133: " adamc@1133: } # !$opt_dry_run adamc@1133: adamc@1133: pic_flag_for_symtable= adamc@1133: case "$compile_command " in adamc@1133: *" -static "*) ;; adamc@1133: *) adamc@1133: case $host in adamc@1133: # compiling the symbol table file with pic_flag works around adamc@1133: # a FreeBSD bug that causes programs to crash when -lm is adamc@1133: # linked before any other PIC object. But we must not use adamc@1133: # pic_flag when linking with -static. The problem exists in adamc@1133: # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. adam@1826: *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) adamc@1133: pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; adamc@1133: *-*-hpux*) adamc@1133: pic_flag_for_symtable=" $pic_flag" ;; adamc@1133: *) adamc@1133: if test "X$my_pic_p" != Xno; then adamc@1133: pic_flag_for_symtable=" $pic_flag" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: symtab_cflags= adamc@1133: for arg in $LTCFLAGS; do adamc@1133: case $arg in adamc@1133: -pie | -fpie | -fPIE) ;; adam@1826: *) symtab_cflags="$symtab_cflags $arg" ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: # Now compile the dynamic symbol file. adamc@1133: func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' adamc@1133: adamc@1133: # Clean up the generated files. adamc@1133: func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' adamc@1133: adamc@1133: # Transform the symbol file into the correct name. adamc@1133: symfileobj="$output_objdir/${my_outputname}S.$objext" adamc@1133: case $host in adamc@1133: *cygwin* | *mingw* | *cegcc* ) adamc@1133: if test -f "$output_objdir/$my_outputname.def"; then adam@1826: compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` adam@1826: finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` adamc@1133: else adam@1826: compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` adam@1826: finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` adamc@1133: fi adamc@1133: ;; adamc@1133: *) adam@1826: compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` adam@1826: finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: *) adamc@1133: func_fatal_error "unknown suffix for \`$my_dlsyms'" adamc@1133: ;; adamc@1133: esac adamc@1133: else adamc@1133: # We keep going just in case the user didn't refer to adamc@1133: # lt_preloaded_symbols. The linker will fail if global_symbol_pipe adamc@1133: # really was required. adamc@1133: adamc@1133: # Nullify the symbol file. adam@1826: compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` adam@1826: finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: # func_win32_libid arg adamc@1133: # return the library type of file 'arg' adamc@1133: # adamc@1133: # Need a lot of goo to handle *both* DLLs and import libs adamc@1133: # Has to be a shell function in order to 'eat' the argument adamc@1133: # that is supplied when $file_magic_command is called. adamc@1133: func_win32_libid () adamc@1133: { adamc@1133: $opt_debug adamc@1133: win32_libid_type="unknown" adamc@1133: win32_fileres=`file -L $1 2>/dev/null` adamc@1133: case $win32_fileres in adamc@1133: *ar\ archive\ import\ library*) # definitely import adamc@1133: win32_libid_type="x86 archive import" adamc@1133: ;; adamc@1133: *ar\ archive*) # could be an import, or static adamc@1133: if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | adam@1826: $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then adam@1826: win32_nmres=`eval $NM -f posix -A $1 | adamc@1133: $SED -n -e ' adamc@1133: 1,100{ adamc@1133: / I /{ adamc@1133: s,.*,import, adamc@1133: p adamc@1133: q adamc@1133: } adamc@1133: }'` adamc@1133: case $win32_nmres in adamc@1133: import*) win32_libid_type="x86 archive import";; adamc@1133: *) win32_libid_type="x86 archive static";; adamc@1133: esac adamc@1133: fi adamc@1133: ;; adamc@1133: *DLL*) adamc@1133: win32_libid_type="x86 DLL" adamc@1133: ;; adamc@1133: *executable*) # but shell scripts are "executable" too... adamc@1133: case $win32_fileres in adamc@1133: *MS\ Windows\ PE\ Intel*) adamc@1133: win32_libid_type="x86 DLL" adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: $ECHO "$win32_libid_type" adamc@1133: } adamc@1133: adamc@1133: adamc@1133: adamc@1133: # func_extract_an_archive dir oldlib adamc@1133: func_extract_an_archive () adamc@1133: { adamc@1133: $opt_debug adamc@1133: f_ex_an_ar_dir="$1"; shift adamc@1133: f_ex_an_ar_oldlib="$1" adam@1826: func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' adamc@1133: if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then adamc@1133: : adamc@1133: else adamc@1133: func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" adamc@1133: fi adamc@1133: } adamc@1133: adamc@1133: adamc@1133: # func_extract_archives gentop oldlib ... adamc@1133: func_extract_archives () adamc@1133: { adamc@1133: $opt_debug adamc@1133: my_gentop="$1"; shift adamc@1133: my_oldlibs=${1+"$@"} adamc@1133: my_oldobjs="" adamc@1133: my_xlib="" adamc@1133: my_xabs="" adamc@1133: my_xdir="" adamc@1133: adamc@1133: for my_xlib in $my_oldlibs; do adamc@1133: # Extract the objects. adamc@1133: case $my_xlib in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; adamc@1133: *) my_xabs=`pwd`"/$my_xlib" ;; adamc@1133: esac adamc@1133: func_basename "$my_xlib" adamc@1133: my_xlib="$func_basename_result" adamc@1133: my_xlib_u=$my_xlib adamc@1133: while :; do adamc@1133: case " $extracted_archives " in adamc@1133: *" $my_xlib_u "*) adamc@1133: func_arith $extracted_serial + 1 adamc@1133: extracted_serial=$func_arith_result adamc@1133: my_xlib_u=lt$extracted_serial-$my_xlib ;; adamc@1133: *) break ;; adamc@1133: esac adamc@1133: done adamc@1133: extracted_archives="$extracted_archives $my_xlib_u" adamc@1133: my_xdir="$my_gentop/$my_xlib_u" adamc@1133: adamc@1133: func_mkdir_p "$my_xdir" adamc@1133: adamc@1133: case $host in adamc@1133: *-darwin*) adamc@1133: func_verbose "Extracting $my_xabs" adamc@1133: # Do not bother doing anything if just a dry run adamc@1133: $opt_dry_run || { adamc@1133: darwin_orig_dir=`pwd` adamc@1133: cd $my_xdir || exit $? adamc@1133: darwin_archive=$my_xabs adamc@1133: darwin_curdir=`pwd` adamc@1133: darwin_base_archive=`basename "$darwin_archive"` adamc@1133: darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` adamc@1133: if test -n "$darwin_arches"; then adamc@1133: darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` adamc@1133: darwin_arch= adamc@1133: func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" adamc@1133: for darwin_arch in $darwin_arches ; do adamc@1133: func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" adamc@1133: $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" adamc@1133: cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" adamc@1133: func_extract_an_archive "`pwd`" "${darwin_base_archive}" adamc@1133: cd "$darwin_curdir" adamc@1133: $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" adamc@1133: done # $darwin_arches adamc@1133: ## Okay now we've a bunch of thin objects, gotta fatten them up :) adamc@1133: darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` adamc@1133: darwin_file= adamc@1133: darwin_files= adamc@1133: for darwin_file in $darwin_filelist; do adam@1826: darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` adamc@1133: $LIPO -create -output "$darwin_file" $darwin_files adamc@1133: done # $darwin_filelist adamc@1133: $RM -rf unfat-$$ adamc@1133: cd "$darwin_orig_dir" adamc@1133: else adamc@1133: cd $darwin_orig_dir adamc@1133: func_extract_an_archive "$my_xdir" "$my_xabs" adamc@1133: fi # $darwin_arches adamc@1133: } # !$opt_dry_run adamc@1133: ;; adamc@1133: *) adamc@1133: func_extract_an_archive "$my_xdir" "$my_xabs" adamc@1133: ;; adamc@1133: esac adam@1826: my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` adamc@1133: done adamc@1133: adamc@1133: func_extract_archives_result="$my_oldobjs" adamc@1133: } adamc@1133: adamc@1133: adam@1826: adam@1826: # func_emit_wrapper_part1 [arg=no] adam@1826: # adam@1826: # Emit the first part of a libtool wrapper script on stdout. adam@1826: # For more information, see the description associated with adam@1826: # func_emit_wrapper(), below. adam@1826: func_emit_wrapper_part1 () adam@1826: { adam@1826: func_emit_wrapper_part1_arg1=no adam@1826: if test -n "$1" ; then adam@1826: func_emit_wrapper_part1_arg1=$1 adam@1826: fi adam@1826: adam@1826: $ECHO "\ adam@1826: #! $SHELL adam@1826: adam@1826: # $output - temporary wrapper script for $objdir/$outputname adam@1826: # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION adam@1826: # adam@1826: # The $output program cannot be directly executed until all the libtool adam@1826: # libraries that it depends on are installed. adam@1826: # adam@1826: # This wrapper script should never be moved out of the build directory. adam@1826: # If it is, it will not operate correctly. adam@1826: adam@1826: # Sed substitution that helps us do robust quoting. It backslashifies adam@1826: # metacharacters that are still active within double-quoted strings. adam@1826: Xsed='${SED} -e 1s/^X//' adam@1826: sed_quote_subst='$sed_quote_subst' adam@1826: adam@1826: # Be Bourne compatible adam@1826: if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then adam@1826: emulate sh adam@1826: NULLCMD=: adam@1826: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which adam@1826: # is contrary to our usage. Disable this feature. adam@1826: alias -g '\${1+\"\$@\"}'='\"\$@\"' adam@1826: setopt NO_GLOB_SUBST adam@1826: else adam@1826: case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac adam@1826: fi adam@1826: BIN_SH=xpg4; export BIN_SH # for Tru64 adam@1826: DUALCASE=1; export DUALCASE # for MKS sh adam@1826: adam@1826: # The HP-UX ksh and POSIX shell print the target directory to stdout adam@1826: # if CDPATH is set. adam@1826: (unset CDPATH) >/dev/null 2>&1 && unset CDPATH adam@1826: adam@1826: relink_command=\"$relink_command\" adam@1826: adam@1826: # This environment variable determines our operation mode. adam@1826: if test \"\$libtool_install_magic\" = \"$magic\"; then adam@1826: # install mode needs the following variables: adam@1826: generated_by_libtool_version='$macro_version' adam@1826: notinst_deplibs='$notinst_deplibs' adam@1826: else adam@1826: # When we are sourced in execute mode, \$file and \$ECHO are already set. adam@1826: if test \"\$libtool_execute_magic\" != \"$magic\"; then adam@1826: ECHO=\"$qecho\" adam@1826: file=\"\$0\" adam@1826: # Make sure echo works. adam@1826: if test \"X\$1\" = X--no-reexec; then adam@1826: # Discard the --no-reexec flag, and continue. adam@1826: shift adam@1826: elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then adam@1826: # Yippee, \$ECHO works! adam@1826: : adam@1826: else adam@1826: # Restart under the correct shell, and then maybe \$ECHO will work. adam@1826: exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} adam@1826: fi adam@1826: fi\ adam@1826: " adam@1826: $ECHO "\ adam@1826: adam@1826: # Find the directory that this script lives in. adam@1826: thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` adam@1826: test \"x\$thisdir\" = \"x\$file\" && thisdir=. adam@1826: adam@1826: # Follow symbolic links until we get to the real thisdir. adam@1826: file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` adam@1826: while test -n \"\$file\"; do adam@1826: destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` adam@1826: adam@1826: # If there was a directory component, then change thisdir. adam@1826: if test \"x\$destdir\" != \"x\$file\"; then adam@1826: case \"\$destdir\" in adam@1826: [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; adam@1826: *) thisdir=\"\$thisdir/\$destdir\" ;; adam@1826: esac adam@1826: fi adam@1826: adam@1826: file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` adam@1826: file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` adam@1826: done adam@1826: " adam@1826: } adam@1826: # end: func_emit_wrapper_part1 adam@1826: adam@1826: # func_emit_wrapper_part2 [arg=no] adam@1826: # adam@1826: # Emit the second part of a libtool wrapper script on stdout. adam@1826: # For more information, see the description associated with adam@1826: # func_emit_wrapper(), below. adam@1826: func_emit_wrapper_part2 () adam@1826: { adam@1826: func_emit_wrapper_part2_arg1=no adam@1826: if test -n "$1" ; then adam@1826: func_emit_wrapper_part2_arg1=$1 adam@1826: fi adam@1826: adam@1826: $ECHO "\ adam@1826: adam@1826: # Usually 'no', except on cygwin/mingw when embedded into adam@1826: # the cwrapper. adam@1826: WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 adam@1826: if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then adam@1826: # special case for '.' adam@1826: if test \"\$thisdir\" = \".\"; then adam@1826: thisdir=\`pwd\` adam@1826: fi adam@1826: # remove .libs from thisdir adam@1826: case \"\$thisdir\" in adam@1826: *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; adam@1826: $objdir ) thisdir=. ;; adam@1826: esac adam@1826: fi adam@1826: adam@1826: # Try to get the absolute directory name. adam@1826: absdir=\`cd \"\$thisdir\" && pwd\` adam@1826: test -n \"\$absdir\" && thisdir=\"\$absdir\" adam@1826: " adam@1826: adam@1826: if test "$fast_install" = yes; then adam@1826: $ECHO "\ adam@1826: program=lt-'$outputname'$exeext adam@1826: progdir=\"\$thisdir/$objdir\" adam@1826: adam@1826: if test ! -f \"\$progdir/\$program\" || adam@1826: { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ adam@1826: test \"X\$file\" != \"X\$progdir/\$program\"; }; then adam@1826: adam@1826: file=\"\$\$-\$program\" adam@1826: adam@1826: if test ! -d \"\$progdir\"; then adam@1826: $MKDIR \"\$progdir\" adam@1826: else adam@1826: $RM \"\$progdir/\$file\" adam@1826: fi" adam@1826: adam@1826: $ECHO "\ adam@1826: adam@1826: # relink executable if necessary adam@1826: if test -n \"\$relink_command\"; then adam@1826: if relink_command_output=\`eval \$relink_command 2>&1\`; then : adam@1826: else adam@1826: $ECHO \"\$relink_command_output\" >&2 adam@1826: $RM \"\$progdir/\$file\" adam@1826: exit 1 adam@1826: fi adam@1826: fi adam@1826: adam@1826: $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || adam@1826: { $RM \"\$progdir/\$program\"; adam@1826: $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } adam@1826: $RM \"\$progdir/\$file\" adam@1826: fi" adam@1826: else adam@1826: $ECHO "\ adam@1826: program='$outputname' adam@1826: progdir=\"\$thisdir/$objdir\" adam@1826: " adam@1826: fi adam@1826: adam@1826: $ECHO "\ adam@1826: adam@1826: if test -f \"\$progdir/\$program\"; then" adam@1826: adam@1826: # Export our shlibpath_var if we have one. adam@1826: if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then adam@1826: $ECHO "\ adam@1826: # Add our own library path to $shlibpath_var adam@1826: $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" adam@1826: adam@1826: # Some systems cannot cope with colon-terminated $shlibpath_var adam@1826: # The second colon is a workaround for a bug in BeOS R4 sed adam@1826: $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` adam@1826: adam@1826: export $shlibpath_var adam@1826: " adam@1826: fi adam@1826: adam@1826: # fixup the dll searchpath if we need to. adam@1826: if test -n "$dllsearchpath"; then adam@1826: $ECHO "\ adam@1826: # Add the dll search path components to the executable PATH adam@1826: PATH=$dllsearchpath:\$PATH adam@1826: " adam@1826: fi adam@1826: adam@1826: $ECHO "\ adam@1826: if test \"\$libtool_execute_magic\" != \"$magic\"; then adam@1826: # Run the actual program with our arguments. adam@1826: " adam@1826: case $host in adam@1826: # Backslashes separate directories on plain windows adam@1826: *-*-mingw | *-*-os2* | *-cegcc*) adam@1826: $ECHO "\ adam@1826: exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} adam@1826: " adam@1826: ;; adam@1826: adam@1826: *) adam@1826: $ECHO "\ adam@1826: exec \"\$progdir/\$program\" \${1+\"\$@\"} adam@1826: " adam@1826: ;; adam@1826: esac adam@1826: $ECHO "\ adam@1826: \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 adam@1826: exit 1 adam@1826: fi adam@1826: else adam@1826: # The program doesn't exist. adam@1826: \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 adam@1826: \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 adam@1826: $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 adam@1826: exit 1 adam@1826: fi adam@1826: fi\ adam@1826: " adam@1826: } adam@1826: # end: func_emit_wrapper_part2 adam@1826: adam@1826: adamc@1133: # func_emit_wrapper [arg=no] adamc@1133: # adamc@1133: # Emit a libtool wrapper script on stdout. adamc@1133: # Don't directly open a file because we may want to adamc@1133: # incorporate the script contents within a cygwin/mingw adamc@1133: # wrapper executable. Must ONLY be called from within adamc@1133: # func_mode_link because it depends on a number of variables adamc@1133: # set therein. adamc@1133: # adamc@1133: # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR adamc@1133: # variable will take. If 'yes', then the emitted script adamc@1133: # will assume that the directory in which it is stored is adamc@1133: # the $objdir directory. This is a cygwin/mingw-specific adamc@1133: # behavior. adamc@1133: func_emit_wrapper () adamc@1133: { adam@1826: func_emit_wrapper_arg1=no adam@1826: if test -n "$1" ; then adam@1826: func_emit_wrapper_arg1=$1 adam@1826: fi adam@1826: adam@1826: # split this up so that func_emit_cwrapperexe_src adam@1826: # can call each part independently. adam@1826: func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" adam@1826: func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" adam@1826: } adam@1826: adam@1826: adam@1826: # func_to_host_path arg adamc@1133: # adam@1826: # Convert paths to host format when used with build tools. adam@1826: # Intended for use with "native" mingw (where libtool itself adam@1826: # is running under the msys shell), or in the following cross- adam@1826: # build environments: adam@1826: # $build $host adam@1826: # mingw (msys) mingw [e.g. native] adam@1826: # cygwin mingw adam@1826: # *nix + wine mingw adam@1826: # where wine is equipped with the `winepath' executable. adam@1826: # In the native mingw case, the (msys) shell automatically adam@1826: # converts paths for any non-msys applications it launches, adam@1826: # but that facility isn't available from inside the cwrapper. adam@1826: # Similar accommodations are necessary for $host mingw and adam@1826: # $build cygwin. Calling this function does no harm for other adam@1826: # $host/$build combinations not listed above. adamc@1133: # adam@1826: # ARG is the path (on $build) that should be converted to adam@1826: # the proper representation for $host. The result is stored adam@1826: # in $func_to_host_path_result. adam@1826: func_to_host_path () adam@1459: { adam@1826: func_to_host_path_result="$1" adam@1826: if test -n "$1" ; then adam@1826: case $host in adam@1826: *mingw* ) adam@1826: lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' adam@1826: case $build in adam@1826: *mingw* ) # actually, msys adam@1826: # awkward: cmd appends spaces to result adam@1826: lt_sed_strip_trailing_spaces="s/[ ]*\$//" adam@1826: func_to_host_path_tmp1=`( cmd //c echo "$1" |\ adam@1826: $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` adam@1826: func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ adam@1826: $SED -e "$lt_sed_naive_backslashify"` adam@1826: ;; adam@1826: *cygwin* ) adam@1826: func_to_host_path_tmp1=`cygpath -w "$1"` adam@1826: func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ adam@1826: $SED -e "$lt_sed_naive_backslashify"` adam@1826: ;; adam@1826: * ) adam@1826: # Unfortunately, winepath does not exit with a non-zero adam@1826: # error code, so we are forced to check the contents of adam@1826: # stdout. On the other hand, if the command is not adam@1826: # found, the shell will set an exit code of 127 and print adam@1826: # *an error message* to stdout. So we must check for both adam@1826: # error code of zero AND non-empty stdout, which explains adam@1826: # the odd construction: adam@1826: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` adam@1826: if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then adam@1826: func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ adam@1826: $SED -e "$lt_sed_naive_backslashify"` adam@1826: else adam@1826: # Allow warning below. adam@1826: func_to_host_path_result="" adam@1826: fi adam@1826: ;; adam@1826: esac adam@1826: if test -z "$func_to_host_path_result" ; then adam@1826: func_error "Could not determine host path corresponding to" adam@1826: func_error " '$1'" adam@1826: func_error "Continuing, but uninstalled executables may not work." adam@1826: # Fallback: adam@1826: func_to_host_path_result="$1" adam@1826: fi adam@1826: ;; adam@1459: esac adam@1459: fi adam@1459: } adam@1826: # end: func_to_host_path adam@1826: adam@1826: # func_to_host_pathlist arg adam@1826: # adam@1826: # Convert pathlists to host format when used with build tools. adam@1826: # See func_to_host_path(), above. This function supports the adam@1826: # following $build/$host combinations (but does no harm for adam@1826: # combinations not listed here): adam@1826: # $build $host adam@1826: # mingw (msys) mingw [e.g. native] adam@1826: # cygwin mingw adam@1826: # *nix + wine mingw adam@1826: # adam@1826: # Path separators are also converted from $build format to adam@1826: # $host format. If ARG begins or ends with a path separator adam@1826: # character, it is preserved (but converted to $host format) adam@1826: # on output. adam@1826: # adam@1826: # ARG is a pathlist (on $build) that should be converted to adam@1826: # the proper representation on $host. The result is stored adam@1826: # in $func_to_host_pathlist_result. adam@1826: func_to_host_pathlist () adam@1459: { adam@1826: func_to_host_pathlist_result="$1" adam@1826: if test -n "$1" ; then adam@1826: case $host in adam@1826: *mingw* ) adam@1826: lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' adam@1826: # Remove leading and trailing path separator characters from adam@1826: # ARG. msys behavior is inconsistent here, cygpath turns them adam@1826: # into '.;' and ';.', and winepath ignores them completely. adam@1826: func_to_host_pathlist_tmp2="$1" adam@1826: # Once set for this call, this variable should not be adam@1826: # reassigned. It is used in tha fallback case. adam@1826: func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ adam@1826: $SED -e 's|^:*||' -e 's|:*$||'` adam@1826: case $build in adam@1826: *mingw* ) # Actually, msys. adam@1826: # Awkward: cmd appends spaces to result. adam@1826: lt_sed_strip_trailing_spaces="s/[ ]*\$//" adam@1826: func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ adam@1826: $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` adam@1826: func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ adam@1826: $SED -e "$lt_sed_naive_backslashify"` adam@1826: ;; adam@1826: *cygwin* ) adam@1826: func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` adam@1826: func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ adam@1826: $SED -e "$lt_sed_naive_backslashify"` adam@1826: ;; adam@1826: * ) adam@1826: # unfortunately, winepath doesn't convert pathlists adam@1826: func_to_host_pathlist_result="" adam@1826: func_to_host_pathlist_oldIFS=$IFS adam@1826: IFS=: adam@1826: for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do adam@1826: IFS=$func_to_host_pathlist_oldIFS adam@1826: if test -n "$func_to_host_pathlist_f" ; then adam@1826: func_to_host_path "$func_to_host_pathlist_f" adam@1826: if test -n "$func_to_host_path_result" ; then adam@1826: if test -z "$func_to_host_pathlist_result" ; then adam@1826: func_to_host_pathlist_result="$func_to_host_path_result" adam@1826: else adam@1826: func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" adam@1826: fi adam@1826: fi adam@1826: fi adam@1826: IFS=: adam@1826: done adam@1826: IFS=$func_to_host_pathlist_oldIFS adam@1826: ;; adam@1826: esac adam@1826: if test -z "$func_to_host_pathlist_result" ; then adam@1826: func_error "Could not determine the host path(s) corresponding to" adam@1826: func_error " '$1'" adam@1826: func_error "Continuing, but uninstalled executables may not work." adam@1826: # Fallback. This may break if $1 contains DOS-style drive adam@1826: # specifications. The fix is not to complicate the expression adam@1826: # below, but for the user to provide a working wine installation adam@1826: # with winepath so that path translation in the cross-to-mingw adam@1826: # case works properly. adam@1826: lt_replace_pathsep_nix_to_dos="s|:|;|g" adam@1826: func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ adam@1826: $SED -e "$lt_replace_pathsep_nix_to_dos"` adam@1826: fi adam@1826: # Now, add the leading and trailing path separators back adam@1826: case "$1" in adam@1826: :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" adam@1826: ;; adam@1826: esac adam@1826: case "$1" in adam@1826: *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" adam@1826: ;; adam@1826: esac adam@1826: ;; adamc@1133: esac adamc@1133: fi adam@1459: } adam@1826: # end: func_to_host_pathlist adamc@1133: adamc@1133: # func_emit_cwrapperexe_src adamc@1133: # emit the source code for a wrapper executable on stdout adamc@1133: # Must ONLY be called from within func_mode_link because adamc@1133: # it depends on a number of variable set therein. adamc@1133: func_emit_cwrapperexe_src () adamc@1133: { adamc@1133: cat < adamc@1133: #include adamc@1133: #ifdef _MSC_VER adamc@1133: # include adamc@1133: # include adamc@1133: # include adam@1826: # define setmode _setmode adamc@1133: #else adamc@1133: # include adamc@1133: # include adamc@1133: # ifdef __CYGWIN__ adamc@1133: # include adam@1826: # define HAVE_SETENV adam@1826: # ifdef __STRICT_ANSI__ adam@1826: char *realpath (const char *, char *); adam@1826: int putenv (char *); adam@1826: int setenv (const char *, const char *, int); adam@1826: # endif adamc@1133: # endif adamc@1133: #endif adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: #include adamc@1133: adamc@1133: #if defined(PATH_MAX) adamc@1133: # define LT_PATHMAX PATH_MAX adamc@1133: #elif defined(MAXPATHLEN) adamc@1133: # define LT_PATHMAX MAXPATHLEN adamc@1133: #else adamc@1133: # define LT_PATHMAX 1024 adamc@1133: #endif adamc@1133: adamc@1133: #ifndef S_IXOTH adamc@1133: # define S_IXOTH 0 adamc@1133: #endif adamc@1133: #ifndef S_IXGRP adamc@1133: # define S_IXGRP 0 adamc@1133: #endif adamc@1133: adam@1826: #ifdef _MSC_VER adam@1826: # define S_IXUSR _S_IEXEC adam@1826: # define stat _stat adam@1826: # ifndef _INTPTR_T_DEFINED adam@1826: # define intptr_t int adam@1826: # endif adam@1826: #endif adam@1826: adamc@1133: #ifndef DIR_SEPARATOR adamc@1133: # define DIR_SEPARATOR '/' adamc@1133: # define PATH_SEPARATOR ':' adamc@1133: #endif adamc@1133: adamc@1133: #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ adamc@1133: defined (__OS2__) adamc@1133: # define HAVE_DOS_BASED_FILE_SYSTEM adamc@1133: # define FOPEN_WB "wb" adamc@1133: # ifndef DIR_SEPARATOR_2 adamc@1133: # define DIR_SEPARATOR_2 '\\' adamc@1133: # endif adamc@1133: # ifndef PATH_SEPARATOR_2 adamc@1133: # define PATH_SEPARATOR_2 ';' adamc@1133: # endif adamc@1133: #endif adamc@1133: adamc@1133: #ifndef DIR_SEPARATOR_2 adamc@1133: # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) adamc@1133: #else /* DIR_SEPARATOR_2 */ adamc@1133: # define IS_DIR_SEPARATOR(ch) \ adamc@1133: (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) adamc@1133: #endif /* DIR_SEPARATOR_2 */ adamc@1133: adamc@1133: #ifndef PATH_SEPARATOR_2 adamc@1133: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) adamc@1133: #else /* PATH_SEPARATOR_2 */ adamc@1133: # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) adamc@1133: #endif /* PATH_SEPARATOR_2 */ adamc@1133: adam@1826: #ifdef __CYGWIN__ adam@1826: # define FOPEN_WB "wb" adam@1826: #endif adam@1826: adamc@1133: #ifndef FOPEN_WB adamc@1133: # define FOPEN_WB "w" adamc@1133: #endif adamc@1133: #ifndef _O_BINARY adamc@1133: # define _O_BINARY 0 adamc@1133: #endif adamc@1133: adamc@1133: #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) adamc@1133: #define XFREE(stale) do { \ adamc@1133: if (stale) { free ((void *) stale); stale = 0; } \ adamc@1133: } while (0) adamc@1133: adam@1826: #undef LTWRAPPER_DEBUGPRINTF adam@1826: #if defined DEBUGWRAPPER adam@1826: # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args adam@1826: static void adam@1826: ltwrapper_debugprintf (const char *fmt, ...) adam@1826: { adam@1826: va_list args; adam@1826: va_start (args, fmt); adam@1826: (void) vfprintf (stderr, fmt, args); adam@1826: va_end (args); adam@1826: } adamc@1133: #else adam@1826: # define LTWRAPPER_DEBUGPRINTF(args) adamc@1133: #endif adamc@1133: adam@1826: const char *program_name = NULL; adamc@1133: adamc@1133: void *xmalloc (size_t num); adamc@1133: char *xstrdup (const char *string); adamc@1133: const char *base_name (const char *name); adamc@1133: char *find_executable (const char *wrapper); adamc@1133: char *chase_symlinks (const char *pathspec); adamc@1133: int make_executable (const char *path); adamc@1133: int check_executable (const char *path); adamc@1133: char *strendzap (char *str, const char *pat); adam@1826: void lt_fatal (const char *message, ...); adamc@1133: void lt_setenv (const char *name, const char *value); adamc@1133: char *lt_extend_str (const char *orig_value, const char *add, int to_end); adam@1826: void lt_opt_process_env_set (const char *arg); adam@1826: void lt_opt_process_env_prepend (const char *arg); adam@1826: void lt_opt_process_env_append (const char *arg); adam@1826: int lt_split_name_value (const char *arg, char** name, char** value); adamc@1133: void lt_update_exe_path (const char *name, const char *value); adamc@1133: void lt_update_lib_path (const char *name, const char *value); adam@1826: adam@1826: static const char *script_text_part1 = adamc@1133: EOF adamc@1133: adam@1826: func_emit_wrapper_part1 yes | adam@1826: $SED -e 's/\([\\"]\)/\\\1/g' \ adam@1826: -e 's/^/ "/' -e 's/$/\\n"/' adam@1826: echo ";" adamc@1133: cat <"))); adamc@1133: for (i = 0; i < newargc; i++) adamc@1133: { adam@1826: LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); adamc@1133: } adamc@1133: adamc@1133: EOF adamc@1133: adamc@1133: case $host_os in adamc@1133: mingw*) adamc@1133: cat <<"EOF" adamc@1133: /* execv doesn't actually work on mingw as expected on unix */ adamc@1133: rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); adamc@1133: if (rval == -1) adamc@1133: { adamc@1133: /* failed to start process */ adam@1826: LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); adamc@1133: return 127; adamc@1133: } adamc@1133: return rval; adamc@1133: EOF adamc@1133: ;; adamc@1133: *) adamc@1133: cat <<"EOF" adamc@1133: execv (lt_argv_zero, newargz); adamc@1133: return rval; /* =127, but avoids unused variable warning */ adamc@1133: EOF adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: cat <<"EOF" adamc@1133: } adamc@1133: adamc@1133: void * adamc@1133: xmalloc (size_t num) adamc@1133: { adamc@1133: void *p = (void *) malloc (num); adamc@1133: if (!p) adam@1826: lt_fatal ("Memory exhausted"); adamc@1133: adamc@1133: return p; adamc@1133: } adamc@1133: adamc@1133: char * adamc@1133: xstrdup (const char *string) adamc@1133: { adamc@1133: return string ? strcpy ((char *) xmalloc (strlen (string) + 1), adamc@1133: string) : NULL; adamc@1133: } adamc@1133: adamc@1133: const char * adamc@1133: base_name (const char *name) adamc@1133: { adamc@1133: const char *base; adamc@1133: adamc@1133: #if defined (HAVE_DOS_BASED_FILE_SYSTEM) adamc@1133: /* Skip over the disk name in MSDOS pathnames. */ adamc@1133: if (isalpha ((unsigned char) name[0]) && name[1] == ':') adamc@1133: name += 2; adamc@1133: #endif adamc@1133: adamc@1133: for (base = name; *name; name++) adamc@1133: if (IS_DIR_SEPARATOR (*name)) adamc@1133: base = name + 1; adamc@1133: return base; adamc@1133: } adamc@1133: adamc@1133: int adamc@1133: check_executable (const char *path) adamc@1133: { adamc@1133: struct stat st; adamc@1133: adam@1826: LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", adam@1826: path ? (*path ? path : "EMPTY!") : "NULL!")); adamc@1133: if ((!path) || (!*path)) adamc@1133: return 0; adamc@1133: adamc@1133: if ((stat (path, &st) >= 0) adamc@1133: && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) adamc@1133: return 1; adamc@1133: else adamc@1133: return 0; adamc@1133: } adamc@1133: adamc@1133: int adamc@1133: make_executable (const char *path) adamc@1133: { adamc@1133: int rval = 0; adamc@1133: struct stat st; adamc@1133: adam@1826: LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", adam@1826: path ? (*path ? path : "EMPTY!") : "NULL!")); adamc@1133: if ((!path) || (!*path)) adamc@1133: return 0; adamc@1133: adamc@1133: if (stat (path, &st) >= 0) adamc@1133: { adamc@1133: rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); adamc@1133: } adamc@1133: return rval; adamc@1133: } adamc@1133: adamc@1133: /* Searches for the full path of the wrapper. Returns adamc@1133: newly allocated full path name if found, NULL otherwise adamc@1133: Does not chase symlinks, even on platforms that support them. adamc@1133: */ adamc@1133: char * adamc@1133: find_executable (const char *wrapper) adamc@1133: { adamc@1133: int has_slash = 0; adamc@1133: const char *p; adamc@1133: const char *p_next; adamc@1133: /* static buffer for getcwd */ adamc@1133: char tmp[LT_PATHMAX + 1]; adamc@1133: int tmp_len; adamc@1133: char *concat_name; adamc@1133: adam@1826: LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", adam@1826: wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); adamc@1133: adamc@1133: if ((wrapper == NULL) || (*wrapper == '\0')) adamc@1133: return NULL; adamc@1133: adamc@1133: /* Absolute path? */ adamc@1133: #if defined (HAVE_DOS_BASED_FILE_SYSTEM) adamc@1133: if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') adamc@1133: { adamc@1133: concat_name = xstrdup (wrapper); adamc@1133: if (check_executable (concat_name)) adamc@1133: return concat_name; adamc@1133: XFREE (concat_name); adamc@1133: } adamc@1133: else adamc@1133: { adamc@1133: #endif adamc@1133: if (IS_DIR_SEPARATOR (wrapper[0])) adamc@1133: { adamc@1133: concat_name = xstrdup (wrapper); adamc@1133: if (check_executable (concat_name)) adamc@1133: return concat_name; adamc@1133: XFREE (concat_name); adamc@1133: } adamc@1133: #if defined (HAVE_DOS_BASED_FILE_SYSTEM) adamc@1133: } adamc@1133: #endif adamc@1133: adamc@1133: for (p = wrapper; *p; p++) adamc@1133: if (*p == '/') adamc@1133: { adamc@1133: has_slash = 1; adamc@1133: break; adamc@1133: } adamc@1133: if (!has_slash) adamc@1133: { adamc@1133: /* no slashes; search PATH */ adamc@1133: const char *path = getenv ("PATH"); adamc@1133: if (path != NULL) adamc@1133: { adamc@1133: for (p = path; *p; p = p_next) adamc@1133: { adamc@1133: const char *q; adamc@1133: size_t p_len; adamc@1133: for (q = p; *q; q++) adamc@1133: if (IS_PATH_SEPARATOR (*q)) adamc@1133: break; adamc@1133: p_len = q - p; adamc@1133: p_next = (*q == '\0' ? q : q + 1); adamc@1133: if (p_len == 0) adamc@1133: { adamc@1133: /* empty path: current directory */ adamc@1133: if (getcwd (tmp, LT_PATHMAX) == NULL) adam@1826: lt_fatal ("getcwd failed"); adamc@1133: tmp_len = strlen (tmp); adamc@1133: concat_name = adamc@1133: XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); adamc@1133: memcpy (concat_name, tmp, tmp_len); adamc@1133: concat_name[tmp_len] = '/'; adamc@1133: strcpy (concat_name + tmp_len + 1, wrapper); adamc@1133: } adamc@1133: else adamc@1133: { adamc@1133: concat_name = adamc@1133: XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); adamc@1133: memcpy (concat_name, p, p_len); adamc@1133: concat_name[p_len] = '/'; adamc@1133: strcpy (concat_name + p_len + 1, wrapper); adamc@1133: } adamc@1133: if (check_executable (concat_name)) adamc@1133: return concat_name; adamc@1133: XFREE (concat_name); adamc@1133: } adamc@1133: } adamc@1133: /* not found in PATH; assume curdir */ adamc@1133: } adamc@1133: /* Relative path | not found in path: prepend cwd */ adamc@1133: if (getcwd (tmp, LT_PATHMAX) == NULL) adam@1826: lt_fatal ("getcwd failed"); adamc@1133: tmp_len = strlen (tmp); adamc@1133: concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); adamc@1133: memcpy (concat_name, tmp, tmp_len); adamc@1133: concat_name[tmp_len] = '/'; adamc@1133: strcpy (concat_name + tmp_len + 1, wrapper); adamc@1133: adamc@1133: if (check_executable (concat_name)) adamc@1133: return concat_name; adamc@1133: XFREE (concat_name); adamc@1133: return NULL; adamc@1133: } adamc@1133: adamc@1133: char * adamc@1133: chase_symlinks (const char *pathspec) adamc@1133: { adamc@1133: #ifndef S_ISLNK adamc@1133: return xstrdup (pathspec); adamc@1133: #else adamc@1133: char buf[LT_PATHMAX]; adamc@1133: struct stat s; adamc@1133: char *tmp_pathspec = xstrdup (pathspec); adamc@1133: char *p; adamc@1133: int has_symlinks = 0; adamc@1133: while (strlen (tmp_pathspec) && !has_symlinks) adamc@1133: { adam@1826: LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", adam@1826: tmp_pathspec)); adamc@1133: if (lstat (tmp_pathspec, &s) == 0) adamc@1133: { adamc@1133: if (S_ISLNK (s.st_mode) != 0) adamc@1133: { adamc@1133: has_symlinks = 1; adamc@1133: break; adamc@1133: } adamc@1133: adamc@1133: /* search backwards for last DIR_SEPARATOR */ adamc@1133: p = tmp_pathspec + strlen (tmp_pathspec) - 1; adamc@1133: while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) adamc@1133: p--; adamc@1133: if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) adamc@1133: { adamc@1133: /* no more DIR_SEPARATORS left */ adamc@1133: break; adamc@1133: } adamc@1133: *p = '\0'; adamc@1133: } adamc@1133: else adamc@1133: { adam@1826: char *errstr = strerror (errno); adam@1826: lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); adamc@1133: } adamc@1133: } adamc@1133: XFREE (tmp_pathspec); adamc@1133: adamc@1133: if (!has_symlinks) adamc@1133: { adamc@1133: return xstrdup (pathspec); adamc@1133: } adamc@1133: adamc@1133: tmp_pathspec = realpath (pathspec, buf); adamc@1133: if (tmp_pathspec == 0) adamc@1133: { adam@1826: lt_fatal ("Could not follow symlinks for %s", pathspec); adamc@1133: } adamc@1133: return xstrdup (tmp_pathspec); adamc@1133: #endif adamc@1133: } adamc@1133: adamc@1133: char * adamc@1133: strendzap (char *str, const char *pat) adamc@1133: { adamc@1133: size_t len, patlen; adamc@1133: adamc@1133: assert (str != NULL); adamc@1133: assert (pat != NULL); adamc@1133: adamc@1133: len = strlen (str); adamc@1133: patlen = strlen (pat); adamc@1133: adamc@1133: if (patlen <= len) adamc@1133: { adamc@1133: str += len - patlen; adamc@1133: if (strcmp (str, pat) == 0) adamc@1133: *str = '\0'; adamc@1133: } adamc@1133: return str; adamc@1133: } adamc@1133: adamc@1133: static void adam@1826: lt_error_core (int exit_status, const char *mode, adamc@1133: const char *message, va_list ap) adamc@1133: { adam@1826: fprintf (stderr, "%s: %s: ", program_name, mode); adamc@1133: vfprintf (stderr, message, ap); adamc@1133: fprintf (stderr, ".\n"); adamc@1133: adamc@1133: if (exit_status >= 0) adamc@1133: exit (exit_status); adamc@1133: } adamc@1133: adamc@1133: void adam@1826: lt_fatal (const char *message, ...) adamc@1133: { adamc@1133: va_list ap; adamc@1133: va_start (ap, message); adam@1826: lt_error_core (EXIT_FAILURE, "FATAL", message, ap); adamc@1133: va_end (ap); adamc@1133: } adamc@1133: adamc@1133: void adamc@1133: lt_setenv (const char *name, const char *value) adamc@1133: { adam@1826: LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", adam@1826: (name ? name : ""), adam@1826: (value ? value : ""))); adamc@1133: { adamc@1133: #ifdef HAVE_SETENV adamc@1133: /* always make a copy, for consistency with !HAVE_SETENV */ adamc@1133: char *str = xstrdup (value); adamc@1133: setenv (name, str, 1); adamc@1133: #else adamc@1133: int len = strlen (name) + 1 + strlen (value) + 1; adamc@1133: char *str = XMALLOC (char, len); adamc@1133: sprintf (str, "%s=%s", name, value); adamc@1133: if (putenv (str) != EXIT_SUCCESS) adamc@1133: { adamc@1133: XFREE (str); adamc@1133: } adamc@1133: #endif adamc@1133: } adamc@1133: } adamc@1133: adamc@1133: char * adamc@1133: lt_extend_str (const char *orig_value, const char *add, int to_end) adamc@1133: { adamc@1133: char *new_value; adamc@1133: if (orig_value && *orig_value) adamc@1133: { adamc@1133: int orig_value_len = strlen (orig_value); adamc@1133: int add_len = strlen (add); adamc@1133: new_value = XMALLOC (char, add_len + orig_value_len + 1); adamc@1133: if (to_end) adamc@1133: { adamc@1133: strcpy (new_value, orig_value); adamc@1133: strcpy (new_value + orig_value_len, add); adamc@1133: } adamc@1133: else adamc@1133: { adamc@1133: strcpy (new_value, add); adamc@1133: strcpy (new_value + add_len, orig_value); adamc@1133: } adamc@1133: } adamc@1133: else adamc@1133: { adamc@1133: new_value = xstrdup (add); adamc@1133: } adamc@1133: return new_value; adamc@1133: } adamc@1133: adam@1826: int adam@1826: lt_split_name_value (const char *arg, char** name, char** value) adam@1826: { adam@1826: const char *p; adam@1826: int len; adam@1826: if (!arg || !*arg) adam@1826: return 1; adam@1826: adam@1826: p = strchr (arg, (int)'='); adam@1826: adam@1826: if (!p) adam@1826: return 1; adam@1826: adam@1826: *value = xstrdup (++p); adam@1826: adam@1826: len = strlen (arg) - strlen (*value); adam@1826: *name = XMALLOC (char, len); adam@1826: strncpy (*name, arg, len-1); adam@1826: (*name)[len - 1] = '\0'; adam@1826: adam@1826: return 0; adam@1826: } adam@1826: adam@1826: void adam@1826: lt_opt_process_env_set (const char *arg) adam@1826: { adam@1826: char *name = NULL; adam@1826: char *value = NULL; adam@1826: adam@1826: if (lt_split_name_value (arg, &name, &value) != 0) adam@1826: { adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); adam@1826: } adam@1826: adam@1826: lt_setenv (name, value); adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: } adam@1826: adam@1826: void adam@1826: lt_opt_process_env_prepend (const char *arg) adam@1826: { adam@1826: char *name = NULL; adam@1826: char *value = NULL; adam@1826: char *new_value = NULL; adam@1826: adam@1826: if (lt_split_name_value (arg, &name, &value) != 0) adam@1826: { adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); adam@1826: } adam@1826: adam@1826: new_value = lt_extend_str (getenv (name), value, 0); adam@1826: lt_setenv (name, new_value); adam@1826: XFREE (new_value); adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: } adam@1826: adam@1826: void adam@1826: lt_opt_process_env_append (const char *arg) adam@1826: { adam@1826: char *name = NULL; adam@1826: char *value = NULL; adam@1826: char *new_value = NULL; adam@1826: adam@1826: if (lt_split_name_value (arg, &name, &value) != 0) adam@1826: { adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); adam@1826: } adam@1826: adam@1826: new_value = lt_extend_str (getenv (name), value, 1); adam@1826: lt_setenv (name, new_value); adam@1826: XFREE (new_value); adam@1826: XFREE (name); adam@1826: XFREE (value); adam@1826: } adam@1826: adamc@1133: void adamc@1133: lt_update_exe_path (const char *name, const char *value) adamc@1133: { adam@1826: LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", adam@1826: (name ? name : ""), adam@1826: (value ? value : ""))); adamc@1133: adamc@1133: if (name && *name && value && *value) adamc@1133: { adamc@1133: char *new_value = lt_extend_str (getenv (name), value, 0); adamc@1133: /* some systems can't cope with a ':'-terminated path #' */ adamc@1133: int len = strlen (new_value); adamc@1133: while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) adamc@1133: { adamc@1133: new_value[len-1] = '\0'; adamc@1133: } adamc@1133: lt_setenv (name, new_value); adamc@1133: XFREE (new_value); adamc@1133: } adamc@1133: } adamc@1133: adamc@1133: void adamc@1133: lt_update_lib_path (const char *name, const char *value) adamc@1133: { adam@1826: LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", adam@1826: (name ? name : ""), adam@1826: (value ? value : ""))); adamc@1133: adamc@1133: if (name && *name && value && *value) adamc@1133: { adamc@1133: char *new_value = lt_extend_str (getenv (name), value, 0); adamc@1133: lt_setenv (name, new_value); adamc@1133: XFREE (new_value); adamc@1133: } adamc@1133: } adamc@1133: adam@1826: adam@1459: EOF adamc@1133: } adamc@1133: # end: func_emit_cwrapperexe_src adamc@1133: adamc@1133: # func_mode_link arg... adamc@1133: func_mode_link () adamc@1133: { adamc@1133: $opt_debug adamc@1133: case $host in adamc@1133: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) adamc@1133: # It is impossible to link a dll without this setting, and adamc@1133: # we shouldn't force the makefile maintainer to figure out adamc@1133: # which system we are compiling for in order to pass an extra adamc@1133: # flag for every libtool invocation. adamc@1133: # allow_undefined=no adamc@1133: adamc@1133: # FIXME: Unfortunately, there are problems with the above when trying adamc@1133: # to make a dll which has undefined symbols, in which case not adamc@1133: # even a static library is built. For now, we need to specify adamc@1133: # -no-undefined on the libtool link line when we can be certain adamc@1133: # that all symbols are satisfied, otherwise we get a static library. adamc@1133: allow_undefined=yes adamc@1133: ;; adamc@1133: *) adamc@1133: allow_undefined=yes adamc@1133: ;; adamc@1133: esac adamc@1133: libtool_args=$nonopt adamc@1133: base_compile="$nonopt $@" adamc@1133: compile_command=$nonopt adamc@1133: finalize_command=$nonopt adamc@1133: adamc@1133: compile_rpath= adamc@1133: finalize_rpath= adamc@1133: compile_shlibpath= adamc@1133: finalize_shlibpath= adamc@1133: convenience= adamc@1133: old_convenience= adamc@1133: deplibs= adamc@1133: old_deplibs= adamc@1133: compiler_flags= adamc@1133: linker_flags= adamc@1133: dllsearchpath= adamc@1133: lib_search_path=`pwd` adamc@1133: inst_prefix_dir= adamc@1133: new_inherited_linker_flags= adamc@1133: adamc@1133: avoid_version=no adamc@1133: dlfiles= adamc@1133: dlprefiles= adamc@1133: dlself=no adamc@1133: export_dynamic=no adamc@1133: export_symbols= adamc@1133: export_symbols_regex= adamc@1133: generated= adamc@1133: libobjs= adamc@1133: ltlibs= adamc@1133: module=no adamc@1133: no_install=no adamc@1133: objs= adamc@1133: non_pic_objects= adamc@1133: precious_files_regex= adamc@1133: prefer_static_libs=no adamc@1133: preload=no adamc@1133: prev= adamc@1133: prevarg= adamc@1133: release= adamc@1133: rpath= adamc@1133: xrpath= adamc@1133: perm_rpath= adamc@1133: temp_rpath= adamc@1133: thread_safe=no adamc@1133: vinfo= adamc@1133: vinfo_number=no adamc@1133: weak_libs= adamc@1133: single_module="${wl}-single_module" adamc@1133: func_infer_tag $base_compile adamc@1133: adamc@1133: # We need to know -static, to get the right output filenames. adamc@1133: for arg adamc@1133: do adamc@1133: case $arg in adamc@1133: -shared) adamc@1133: test "$build_libtool_libs" != yes && \ adamc@1133: func_fatal_configuration "can not build a shared library" adamc@1133: build_old_libs=no adamc@1133: break adamc@1133: ;; adamc@1133: -all-static | -static | -static-libtool-libs) adamc@1133: case $arg in adamc@1133: -all-static) adamc@1133: if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then adamc@1133: func_warning "complete static linking is impossible in this configuration" adamc@1133: fi adamc@1133: if test -n "$link_static_flag"; then adamc@1133: dlopen_self=$dlopen_self_static adamc@1133: fi adamc@1133: prefer_static_libs=yes adamc@1133: ;; adamc@1133: -static) adamc@1133: if test -z "$pic_flag" && test -n "$link_static_flag"; then adamc@1133: dlopen_self=$dlopen_self_static adamc@1133: fi adamc@1133: prefer_static_libs=built adamc@1133: ;; adamc@1133: -static-libtool-libs) adamc@1133: if test -z "$pic_flag" && test -n "$link_static_flag"; then adamc@1133: dlopen_self=$dlopen_self_static adamc@1133: fi adamc@1133: prefer_static_libs=yes adamc@1133: ;; adamc@1133: esac adamc@1133: build_libtool_libs=no adamc@1133: build_old_libs=yes adamc@1133: break adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: # See if our shared archives depend on static archives. adamc@1133: test -n "$old_archive_from_new_cmds" && build_old_libs=yes adamc@1133: adamc@1133: # Go through the arguments, transforming them on the way. adamc@1133: while test "$#" -gt 0; do adamc@1133: arg="$1" adamc@1133: shift adamc@1133: func_quote_for_eval "$arg" adamc@1133: qarg=$func_quote_for_eval_unquoted_result adamc@1133: func_append libtool_args " $func_quote_for_eval_result" adamc@1133: adamc@1133: # If the previous option needs an argument, assign it. adamc@1133: if test -n "$prev"; then adamc@1133: case $prev in adamc@1133: output) adamc@1133: func_append compile_command " @OUTPUT@" adamc@1133: func_append finalize_command " @OUTPUT@" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: case $prev in adamc@1133: dlfiles|dlprefiles) adamc@1133: if test "$preload" = no; then adamc@1133: # Add the symbol object into the linking commands. adamc@1133: func_append compile_command " @SYMFILE@" adamc@1133: func_append finalize_command " @SYMFILE@" adamc@1133: preload=yes adamc@1133: fi adamc@1133: case $arg in adamc@1133: *.la | *.lo) ;; # We handle these cases below. adamc@1133: force) adamc@1133: if test "$dlself" = no; then adamc@1133: dlself=needless adamc@1133: export_dynamic=yes adamc@1133: fi adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: self) adamc@1133: if test "$prev" = dlprefiles; then adamc@1133: dlself=yes adamc@1133: elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then adamc@1133: dlself=yes adamc@1133: else adamc@1133: dlself=needless adamc@1133: export_dynamic=yes adamc@1133: fi adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: *) adamc@1133: if test "$prev" = dlfiles; then adam@1826: dlfiles="$dlfiles $arg" adamc@1133: else adam@1826: dlprefiles="$dlprefiles $arg" adamc@1133: fi adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: expsyms) adamc@1133: export_symbols="$arg" adamc@1133: test -f "$arg" \ adamc@1133: || func_fatal_error "symbol file \`$arg' does not exist" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: expsyms_regex) adamc@1133: export_symbols_regex="$arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: framework) adamc@1133: case $host in adamc@1133: *-*-darwin*) adamc@1133: case "$deplibs " in adamc@1133: *" $qarg.ltframework "*) ;; adam@1826: *) deplibs="$deplibs $qarg.ltframework" # this is fixed later adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: inst_prefix) adamc@1133: inst_prefix_dir="$arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: objectlist) adamc@1133: if test -f "$arg"; then adamc@1133: save_arg=$arg adamc@1133: moreargs= adamc@1133: for fil in `cat "$save_arg"` adamc@1133: do adam@1826: # moreargs="$moreargs $fil" adamc@1133: arg=$fil adamc@1133: # A libtool-controlled object. adamc@1133: adamc@1133: # Check to see that this really is a libtool object. adamc@1133: if func_lalib_unsafe_p "$arg"; then adamc@1133: pic_object= adamc@1133: non_pic_object= adamc@1133: adamc@1133: # Read the .lo file adamc@1133: func_source "$arg" adamc@1133: adamc@1133: if test -z "$pic_object" || adamc@1133: test -z "$non_pic_object" || adamc@1133: test "$pic_object" = none && adamc@1133: test "$non_pic_object" = none; then adamc@1133: func_fatal_error "cannot find name of object for \`$arg'" adamc@1133: fi adamc@1133: adamc@1133: # Extract subdirectory from the argument. adamc@1133: func_dirname "$arg" "/" "" adamc@1133: xdir="$func_dirname_result" adamc@1133: adamc@1133: if test "$pic_object" != none; then adamc@1133: # Prepend the subdirectory the object is found in. adamc@1133: pic_object="$xdir$pic_object" adamc@1133: adamc@1133: if test "$prev" = dlfiles; then adamc@1133: if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then adam@1826: dlfiles="$dlfiles $pic_object" adamc@1133: prev= adamc@1133: continue adamc@1133: else adamc@1133: # If libtool objects are unsupported, then we need to preload. adamc@1133: prev=dlprefiles adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # CHECK ME: I think I busted this. -Ossama adamc@1133: if test "$prev" = dlprefiles; then adamc@1133: # Preload the old-style object. adam@1826: dlprefiles="$dlprefiles $pic_object" adamc@1133: prev= adamc@1133: fi adamc@1133: adamc@1133: # A PIC object. adamc@1133: func_append libobjs " $pic_object" adamc@1133: arg="$pic_object" adamc@1133: fi adamc@1133: adamc@1133: # Non-PIC object. adamc@1133: if test "$non_pic_object" != none; then adamc@1133: # Prepend the subdirectory the object is found in. adamc@1133: non_pic_object="$xdir$non_pic_object" adamc@1133: adamc@1133: # A standard non-PIC object adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: if test -z "$pic_object" || test "$pic_object" = none ; then adamc@1133: arg="$non_pic_object" adamc@1133: fi adamc@1133: else adamc@1133: # If the PIC object exists, use it instead. adamc@1133: # $xdir was prepended to $pic_object above. adamc@1133: non_pic_object="$pic_object" adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: fi adamc@1133: else adamc@1133: # Only an error if not doing a dry-run. adamc@1133: if $opt_dry_run; then adamc@1133: # Extract subdirectory from the argument. adamc@1133: func_dirname "$arg" "/" "" adamc@1133: xdir="$func_dirname_result" adamc@1133: adamc@1133: func_lo2o "$arg" adamc@1133: pic_object=$xdir$objdir/$func_lo2o_result adamc@1133: non_pic_object=$xdir$func_lo2o_result adamc@1133: func_append libobjs " $pic_object" adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: else adamc@1133: func_fatal_error "\`$arg' is not a valid libtool object" adamc@1133: fi adamc@1133: fi adamc@1133: done adamc@1133: else adamc@1133: func_fatal_error "link input file \`$arg' does not exist" adamc@1133: fi adamc@1133: arg=$save_arg adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: precious_regex) adamc@1133: precious_files_regex="$arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: release) adamc@1133: release="-$arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: rpath | xrpath) adamc@1133: # We need an absolute path. adamc@1133: case $arg in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) ;; adamc@1133: *) adamc@1133: func_fatal_error "only absolute run-paths are allowed" adamc@1133: ;; adamc@1133: esac adamc@1133: if test "$prev" = rpath; then adamc@1133: case "$rpath " in adamc@1133: *" $arg "*) ;; adam@1826: *) rpath="$rpath $arg" ;; adamc@1133: esac adamc@1133: else adamc@1133: case "$xrpath " in adamc@1133: *" $arg "*) ;; adam@1826: *) xrpath="$xrpath $arg" ;; adamc@1133: esac adamc@1133: fi adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: shrext) adamc@1133: shrext_cmds="$arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: weak) adam@1826: weak_libs="$weak_libs $arg" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: xcclinker) adam@1826: linker_flags="$linker_flags $qarg" adam@1826: compiler_flags="$compiler_flags $qarg" adamc@1133: prev= adamc@1133: func_append compile_command " $qarg" adamc@1133: func_append finalize_command " $qarg" adamc@1133: continue adamc@1133: ;; adamc@1133: xcompiler) adam@1826: compiler_flags="$compiler_flags $qarg" adamc@1133: prev= adamc@1133: func_append compile_command " $qarg" adamc@1133: func_append finalize_command " $qarg" adamc@1133: continue adamc@1133: ;; adamc@1133: xlinker) adam@1826: linker_flags="$linker_flags $qarg" adam@1826: compiler_flags="$compiler_flags $wl$qarg" adamc@1133: prev= adamc@1133: func_append compile_command " $wl$qarg" adamc@1133: func_append finalize_command " $wl$qarg" adamc@1133: continue adamc@1133: ;; adamc@1133: *) adamc@1133: eval "$prev=\"\$arg\"" adamc@1133: prev= adamc@1133: continue adamc@1133: ;; adamc@1133: esac adamc@1133: fi # test -n "$prev" adamc@1133: adamc@1133: prevarg="$arg" adamc@1133: adamc@1133: case $arg in adamc@1133: -all-static) adamc@1133: if test -n "$link_static_flag"; then adamc@1133: # See comment for -static flag below, for more details. adamc@1133: func_append compile_command " $link_static_flag" adamc@1133: func_append finalize_command " $link_static_flag" adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -allow-undefined) adamc@1133: # FIXME: remove this flag sometime in the future. adamc@1133: func_fatal_error "\`-allow-undefined' must not be used because it is the default" adamc@1133: ;; adamc@1133: adamc@1133: -avoid-version) adamc@1133: avoid_version=yes adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -dlopen) adamc@1133: prev=dlfiles adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -dlpreopen) adamc@1133: prev=dlprefiles adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -export-dynamic) adamc@1133: export_dynamic=yes adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -export-symbols | -export-symbols-regex) adamc@1133: if test -n "$export_symbols" || test -n "$export_symbols_regex"; then adamc@1133: func_fatal_error "more than one -exported-symbols argument is not allowed" adamc@1133: fi adamc@1133: if test "X$arg" = "X-export-symbols"; then adamc@1133: prev=expsyms adamc@1133: else adamc@1133: prev=expsyms_regex adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -framework) adamc@1133: prev=framework adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -inst-prefix-dir) adamc@1133: prev=inst_prefix adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* adamc@1133: # so, if we see these flags be careful not to treat them like -L adamc@1133: -L[A-Z][A-Z]*:*) adamc@1133: case $with_gcc/$host in adamc@1133: no/*-*-irix* | /*-*-irix*) adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adamc@1133: ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -L*) adam@1826: func_stripname '-L' '' "$arg" adam@1826: dir=$func_stripname_result adam@1826: if test -z "$dir"; then adamc@1133: if test "$#" -gt 0; then adamc@1133: func_fatal_error "require no space between \`-L' and \`$1'" adamc@1133: else adamc@1133: func_fatal_error "need path for \`-L' option" adamc@1133: fi adamc@1133: fi adamc@1133: # We need an absolute path. adamc@1133: case $dir in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) ;; adamc@1133: *) adamc@1133: absdir=`cd "$dir" && pwd` adamc@1133: test -z "$absdir" && \ adamc@1133: func_fatal_error "cannot determine absolute directory name of \`$dir'" adamc@1133: dir="$absdir" adamc@1133: ;; adamc@1133: esac adamc@1133: case "$deplibs " in adam@1826: *" -L$dir "*) ;; adamc@1133: *) adam@1826: deplibs="$deplibs -L$dir" adam@1826: lib_search_path="$lib_search_path $dir" adamc@1133: ;; adamc@1133: esac adamc@1133: case $host in adamc@1133: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) adam@1826: testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` adamc@1133: case :$dllsearchpath: in adamc@1133: *":$dir:"*) ;; adamc@1133: ::) dllsearchpath=$dir;; adam@1826: *) dllsearchpath="$dllsearchpath:$dir";; adamc@1133: esac adamc@1133: case :$dllsearchpath: in adamc@1133: *":$testbindir:"*) ;; adamc@1133: ::) dllsearchpath=$testbindir;; adam@1826: *) dllsearchpath="$dllsearchpath:$testbindir";; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -l*) adamc@1133: if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then adamc@1133: case $host in adam@1826: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) adamc@1133: # These systems don't actually have a C or math library (as such) adamc@1133: continue adamc@1133: ;; adamc@1133: *-*-os2*) adamc@1133: # These systems don't actually have a C library (as such) adamc@1133: test "X$arg" = "X-lc" && continue adamc@1133: ;; adamc@1133: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) adamc@1133: # Do not include libc due to us having libc/libc_r. adamc@1133: test "X$arg" = "X-lc" && continue adamc@1133: ;; adamc@1133: *-*-rhapsody* | *-*-darwin1.[012]) adamc@1133: # Rhapsody C and math libraries are in the System framework adam@1826: deplibs="$deplibs System.ltframework" adamc@1133: continue adamc@1133: ;; adamc@1133: *-*-sco3.2v5* | *-*-sco5v6*) adamc@1133: # Causes problems with __ctype adamc@1133: test "X$arg" = "X-lc" && continue adamc@1133: ;; adamc@1133: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) adamc@1133: # Compiler inserts libc in the correct place for threads to work adamc@1133: test "X$arg" = "X-lc" && continue adamc@1133: ;; adamc@1133: esac adamc@1133: elif test "X$arg" = "X-lc_r"; then adamc@1133: case $host in adamc@1133: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) adamc@1133: # Do not include libc_r directly, use -pthread flag. adamc@1133: continue adamc@1133: ;; adamc@1133: esac adamc@1133: fi adam@1826: deplibs="$deplibs $arg" adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -module) adamc@1133: module=yes adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: # Tru64 UNIX uses -model [arg] to determine the layout of C++ adamc@1133: # classes, name mangling, and exception handling. adamc@1133: # Darwin uses the -arch flag to determine output architecture. adam@1826: -model|-arch|-isysroot) adam@1826: compiler_flags="$compiler_flags $arg" adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adamc@1133: prev=xcompiler adamc@1133: continue adamc@1133: ;; adamc@1133: adam@1826: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) adam@1826: compiler_flags="$compiler_flags $arg" adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adamc@1133: case "$new_inherited_linker_flags " in adamc@1133: *" $arg "*) ;; adam@1826: * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -multi_module) adamc@1133: single_module="${wl}-multi_module" adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -no-fast-install) adamc@1133: fast_install=no adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -no-install) adamc@1133: case $host in adamc@1133: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) adamc@1133: # The PATH hackery in wrapper scripts is required on Windows adamc@1133: # and Darwin in order for the loader to find any dlls it needs. adamc@1133: func_warning "\`-no-install' is ignored for $host" adamc@1133: func_warning "assuming \`-no-fast-install' instead" adamc@1133: fast_install=no adamc@1133: ;; adamc@1133: *) no_install=yes ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -no-undefined) adamc@1133: allow_undefined=no adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -objectlist) adamc@1133: prev=objectlist adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -o) prev=output ;; adamc@1133: adamc@1133: -precious-files-regex) adamc@1133: prev=precious_regex adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -release) adamc@1133: prev=release adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -rpath) adamc@1133: prev=rpath adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -R) adamc@1133: prev=xrpath adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -R*) adamc@1133: func_stripname '-R' '' "$arg" adamc@1133: dir=$func_stripname_result adamc@1133: # We need an absolute path. adamc@1133: case $dir in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) ;; adamc@1133: *) adamc@1133: func_fatal_error "only absolute run-paths are allowed" adamc@1133: ;; adamc@1133: esac adamc@1133: case "$xrpath " in adamc@1133: *" $dir "*) ;; adam@1826: *) xrpath="$xrpath $dir" ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -shared) adamc@1133: # The effects of -shared are defined in a previous loop. adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -shrext) adamc@1133: prev=shrext adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -static | -static-libtool-libs) adamc@1133: # The effects of -static are defined in a previous loop. adamc@1133: # We used to do the same as -all-static on platforms that adamc@1133: # didn't have a PIC flag, but the assumption that the effects adamc@1133: # would be equivalent was wrong. It would break on at least adamc@1133: # Digital Unix and AIX. adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -thread-safe) adamc@1133: thread_safe=yes adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -version-info) adamc@1133: prev=vinfo adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -version-number) adamc@1133: prev=vinfo adamc@1133: vinfo_number=yes adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -weak) adamc@1133: prev=weak adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -Wc,*) adamc@1133: func_stripname '-Wc,' '' "$arg" adamc@1133: args=$func_stripname_result adamc@1133: arg= adamc@1133: save_ifs="$IFS"; IFS=',' adamc@1133: for flag in $args; do adamc@1133: IFS="$save_ifs" adamc@1133: func_quote_for_eval "$flag" adam@1826: arg="$arg $wl$func_quote_for_eval_result" adam@1826: compiler_flags="$compiler_flags $func_quote_for_eval_result" adamc@1133: done adamc@1133: IFS="$save_ifs" adamc@1133: func_stripname ' ' '' "$arg" adamc@1133: arg=$func_stripname_result adamc@1133: ;; adamc@1133: adamc@1133: -Wl,*) adamc@1133: func_stripname '-Wl,' '' "$arg" adamc@1133: args=$func_stripname_result adamc@1133: arg= adamc@1133: save_ifs="$IFS"; IFS=',' adamc@1133: for flag in $args; do adamc@1133: IFS="$save_ifs" adamc@1133: func_quote_for_eval "$flag" adam@1826: arg="$arg $wl$func_quote_for_eval_result" adam@1826: compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" adam@1826: linker_flags="$linker_flags $func_quote_for_eval_result" adamc@1133: done adamc@1133: IFS="$save_ifs" adamc@1133: func_stripname ' ' '' "$arg" adamc@1133: arg=$func_stripname_result adamc@1133: ;; adamc@1133: adamc@1133: -Xcompiler) adamc@1133: prev=xcompiler adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -Xlinker) adamc@1133: prev=xlinker adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: -XCClinker) adamc@1133: prev=xcclinker adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: # -msg_* for osf cc adamc@1133: -msg_*) adamc@1133: func_quote_for_eval "$arg" adamc@1133: arg="$func_quote_for_eval_result" adamc@1133: ;; adamc@1133: adam@1826: # -64, -mips[0-9] enable 64-bit mode on the SGI compiler adam@1826: # -r[0-9][0-9]* specifies the processor on the SGI compiler adam@1826: # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler adam@1826: # +DA*, +DD* enable 64-bit mode on the HP compiler adam@1826: # -q* pass through compiler args for the IBM compiler adam@1826: # -m*, -t[45]*, -txscale* pass through architecture-specific adam@1826: # compiler args for GCC adam@1826: # -F/path gives path to uninstalled frameworks, gcc on darwin adam@1826: # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC adam@1826: # @file GCC response files adamc@1133: -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ adam@1826: -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) adamc@1133: func_quote_for_eval "$arg" adamc@1133: arg="$func_quote_for_eval_result" adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adam@1826: compiler_flags="$compiler_flags $arg" adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: # Some other compiler flag. adamc@1133: -* | +*) adamc@1133: func_quote_for_eval "$arg" adamc@1133: arg="$func_quote_for_eval_result" adamc@1133: ;; adamc@1133: adamc@1133: *.$objext) adamc@1133: # A standard object. adam@1826: objs="$objs $arg" adamc@1133: ;; adamc@1133: adamc@1133: *.lo) adamc@1133: # A libtool-controlled object. adamc@1133: adamc@1133: # Check to see that this really is a libtool object. adamc@1133: if func_lalib_unsafe_p "$arg"; then adamc@1133: pic_object= adamc@1133: non_pic_object= adamc@1133: adamc@1133: # Read the .lo file adamc@1133: func_source "$arg" adamc@1133: adamc@1133: if test -z "$pic_object" || adamc@1133: test -z "$non_pic_object" || adamc@1133: test "$pic_object" = none && adamc@1133: test "$non_pic_object" = none; then adamc@1133: func_fatal_error "cannot find name of object for \`$arg'" adamc@1133: fi adamc@1133: adamc@1133: # Extract subdirectory from the argument. adamc@1133: func_dirname "$arg" "/" "" adamc@1133: xdir="$func_dirname_result" adamc@1133: adamc@1133: if test "$pic_object" != none; then adamc@1133: # Prepend the subdirectory the object is found in. adamc@1133: pic_object="$xdir$pic_object" adamc@1133: adamc@1133: if test "$prev" = dlfiles; then adamc@1133: if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then adam@1826: dlfiles="$dlfiles $pic_object" adamc@1133: prev= adamc@1133: continue adamc@1133: else adamc@1133: # If libtool objects are unsupported, then we need to preload. adamc@1133: prev=dlprefiles adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # CHECK ME: I think I busted this. -Ossama adamc@1133: if test "$prev" = dlprefiles; then adamc@1133: # Preload the old-style object. adam@1826: dlprefiles="$dlprefiles $pic_object" adamc@1133: prev= adamc@1133: fi adamc@1133: adamc@1133: # A PIC object. adamc@1133: func_append libobjs " $pic_object" adamc@1133: arg="$pic_object" adamc@1133: fi adamc@1133: adamc@1133: # Non-PIC object. adamc@1133: if test "$non_pic_object" != none; then adamc@1133: # Prepend the subdirectory the object is found in. adamc@1133: non_pic_object="$xdir$non_pic_object" adamc@1133: adamc@1133: # A standard non-PIC object adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: if test -z "$pic_object" || test "$pic_object" = none ; then adamc@1133: arg="$non_pic_object" adamc@1133: fi adamc@1133: else adamc@1133: # If the PIC object exists, use it instead. adamc@1133: # $xdir was prepended to $pic_object above. adamc@1133: non_pic_object="$pic_object" adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: fi adamc@1133: else adamc@1133: # Only an error if not doing a dry-run. adamc@1133: if $opt_dry_run; then adamc@1133: # Extract subdirectory from the argument. adamc@1133: func_dirname "$arg" "/" "" adamc@1133: xdir="$func_dirname_result" adamc@1133: adamc@1133: func_lo2o "$arg" adamc@1133: pic_object=$xdir$objdir/$func_lo2o_result adamc@1133: non_pic_object=$xdir$func_lo2o_result adamc@1133: func_append libobjs " $pic_object" adamc@1133: func_append non_pic_objects " $non_pic_object" adamc@1133: else adamc@1133: func_fatal_error "\`$arg' is not a valid libtool object" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: adamc@1133: *.$libext) adamc@1133: # An archive. adam@1826: deplibs="$deplibs $arg" adam@1826: old_deplibs="$old_deplibs $arg" adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: *.la) adamc@1133: # A libtool-controlled library. adamc@1133: adamc@1133: if test "$prev" = dlfiles; then adamc@1133: # This library was specified with -dlopen. adam@1826: dlfiles="$dlfiles $arg" adamc@1133: prev= adamc@1133: elif test "$prev" = dlprefiles; then adamc@1133: # The library was specified with -dlpreopen. adam@1826: dlprefiles="$dlprefiles $arg" adamc@1133: prev= adamc@1133: else adam@1826: deplibs="$deplibs $arg" adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: adamc@1133: # Some other compiler argument. adamc@1133: *) adamc@1133: # Unknown arguments in both finalize_command and compile_command need adamc@1133: # to be aesthetically quoted because they are evaled later. adamc@1133: func_quote_for_eval "$arg" adamc@1133: arg="$func_quote_for_eval_result" adamc@1133: ;; adamc@1133: esac # arg adamc@1133: adamc@1133: # Now actually substitute the argument into the commands. adamc@1133: if test -n "$arg"; then adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adamc@1133: fi adamc@1133: done # argument parsing loop adamc@1133: adamc@1133: test -n "$prev" && \ adamc@1133: func_fatal_help "the \`$prevarg' option requires an argument" adamc@1133: adamc@1133: if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then adamc@1133: eval arg=\"$export_dynamic_flag_spec\" adamc@1133: func_append compile_command " $arg" adamc@1133: func_append finalize_command " $arg" adamc@1133: fi adamc@1133: adamc@1133: oldlibs= adamc@1133: # calculate the name of the file, without its directory adamc@1133: func_basename "$output" adamc@1133: outputname="$func_basename_result" adamc@1133: libobjs_save="$libobjs" adamc@1133: adamc@1133: if test -n "$shlibpath_var"; then adamc@1133: # get the directories listed in $shlibpath_var adam@1826: eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` adamc@1133: else adamc@1133: shlib_search_path= adamc@1133: fi adamc@1133: eval sys_lib_search_path=\"$sys_lib_search_path_spec\" adamc@1133: eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" adamc@1133: adamc@1133: func_dirname "$output" "/" "" adamc@1133: output_objdir="$func_dirname_result$objdir" adamc@1133: # Create the object directory. adamc@1133: func_mkdir_p "$output_objdir" adamc@1133: adamc@1133: # Determine the type of output adamc@1133: case $output in adamc@1133: "") adamc@1133: func_fatal_help "you must specify an output file" adamc@1133: ;; adamc@1133: *.$libext) linkmode=oldlib ;; adamc@1133: *.lo | *.$objext) linkmode=obj ;; adamc@1133: *.la) linkmode=lib ;; adamc@1133: *) linkmode=prog ;; # Anything else should be a program. adamc@1133: esac adamc@1133: adamc@1133: specialdeplibs= adamc@1133: adamc@1133: libs= adamc@1133: # Find all interdependent deplibs by searching for libraries adamc@1133: # that are linked more than once (e.g. -la -lb -la) adamc@1133: for deplib in $deplibs; do adam@1826: if $opt_duplicate_deps ; then adamc@1133: case "$libs " in adam@1826: *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; adamc@1133: esac adamc@1133: fi adam@1826: libs="$libs $deplib" adamc@1133: done adamc@1133: adamc@1133: if test "$linkmode" = lib; then adamc@1133: libs="$predeps $libs $compiler_lib_search_path $postdeps" adamc@1133: adamc@1133: # Compute libraries that are listed more than once in $predeps adamc@1133: # $postdeps and mark them as special (i.e., whose duplicates are adamc@1133: # not to be eliminated). adamc@1133: pre_post_deps= adamc@1133: if $opt_duplicate_compiler_generated_deps; then adamc@1133: for pre_post_dep in $predeps $postdeps; do adamc@1133: case "$pre_post_deps " in adam@1826: *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; adamc@1133: esac adam@1826: pre_post_deps="$pre_post_deps $pre_post_dep" adamc@1133: done adamc@1133: fi adamc@1133: pre_post_deps= adamc@1133: fi adamc@1133: adamc@1133: deplibs= adamc@1133: newdependency_libs= adamc@1133: newlib_search_path= adamc@1133: need_relink=no # whether we're linking any uninstalled libtool libraries adamc@1133: notinst_deplibs= # not-installed libtool libraries adamc@1133: notinst_path= # paths that contain not-installed libtool libraries adamc@1133: adamc@1133: case $linkmode in adamc@1133: lib) adamc@1133: passes="conv dlpreopen link" adamc@1133: for file in $dlfiles $dlprefiles; do adamc@1133: case $file in adamc@1133: *.la) ;; adamc@1133: *) adamc@1133: func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: ;; adamc@1133: prog) adamc@1133: compile_deplibs= adamc@1133: finalize_deplibs= adamc@1133: alldeplibs=no adamc@1133: newdlfiles= adamc@1133: newdlprefiles= adamc@1133: passes="conv scan dlopen dlpreopen link" adamc@1133: ;; adamc@1133: *) passes="conv" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: for pass in $passes; do adamc@1133: # The preopen pass in lib mode reverses $deplibs; put it back here adamc@1133: # so that -L comes before libs that need it for instance... adamc@1133: if test "$linkmode,$pass" = "lib,link"; then adamc@1133: ## FIXME: Find the place where the list is rebuilt in the wrong adamc@1133: ## order, and fix it there properly adamc@1133: tmp_deplibs= adamc@1133: for deplib in $deplibs; do adamc@1133: tmp_deplibs="$deplib $tmp_deplibs" adamc@1133: done adamc@1133: deplibs="$tmp_deplibs" adamc@1133: fi adamc@1133: adamc@1133: if test "$linkmode,$pass" = "lib,link" || adamc@1133: test "$linkmode,$pass" = "prog,scan"; then adamc@1133: libs="$deplibs" adamc@1133: deplibs= adamc@1133: fi adamc@1133: if test "$linkmode" = prog; then adamc@1133: case $pass in adamc@1133: dlopen) libs="$dlfiles" ;; adamc@1133: dlpreopen) libs="$dlprefiles" ;; adamc@1133: link) adamc@1133: libs="$deplibs %DEPLIBS%" adamc@1133: test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: if test "$linkmode,$pass" = "lib,dlpreopen"; then adamc@1133: # Collect and forward deplibs of preopened libtool libs adamc@1133: for lib in $dlprefiles; do adamc@1133: # Ignore non-libtool-libs adamc@1133: dependency_libs= adamc@1133: case $lib in adam@1826: *.la) func_source "$lib" ;; adamc@1133: esac adamc@1133: adamc@1133: # Collect preopened libtool deplibs, except any this library adamc@1133: # has declared as weak libs adamc@1133: for deplib in $dependency_libs; do adam@1826: deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` adamc@1133: case " $weak_libs " in adamc@1133: *" $deplib_base "*) ;; adam@1826: *) deplibs="$deplibs $deplib" ;; adamc@1133: esac adamc@1133: done adamc@1133: done adamc@1133: libs="$dlprefiles" adamc@1133: fi adamc@1133: if test "$pass" = dlopen; then adamc@1133: # Collect dlpreopened libraries adamc@1133: save_deplibs="$deplibs" adamc@1133: deplibs= adamc@1133: fi adamc@1133: adamc@1133: for deplib in $libs; do adamc@1133: lib= adamc@1133: found=no adamc@1133: case $deplib in adam@1826: -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) adamc@1133: if test "$linkmode,$pass" = "prog,link"; then adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: else adam@1826: compiler_flags="$compiler_flags $deplib" adamc@1133: if test "$linkmode" = lib ; then adamc@1133: case "$new_inherited_linker_flags " in adamc@1133: *" $deplib "*) ;; adam@1826: * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; adamc@1133: esac adamc@1133: fi adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: -l*) adamc@1133: if test "$linkmode" != lib && test "$linkmode" != prog; then adamc@1133: func_warning "\`-l' is ignored for archives/objects" adamc@1133: continue adamc@1133: fi adamc@1133: func_stripname '-l' '' "$deplib" adamc@1133: name=$func_stripname_result adamc@1133: if test "$linkmode" = lib; then adamc@1133: searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" adamc@1133: else adamc@1133: searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" adamc@1133: fi adamc@1133: for searchdir in $searchdirs; do adamc@1133: for search_ext in .la $std_shrext .so .a; do adamc@1133: # Search the libtool library adamc@1133: lib="$searchdir/lib${name}${search_ext}" adamc@1133: if test -f "$lib"; then adamc@1133: if test "$search_ext" = ".la"; then adamc@1133: found=yes adamc@1133: else adamc@1133: found=no adamc@1133: fi adamc@1133: break 2 adamc@1133: fi adamc@1133: done adamc@1133: done adamc@1133: if test "$found" != yes; then adamc@1133: # deplib doesn't seem to be a libtool library adamc@1133: if test "$linkmode,$pass" = "prog,link"; then adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: else adamc@1133: deplibs="$deplib $deplibs" adamc@1133: test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" adamc@1133: fi adamc@1133: continue adamc@1133: else # deplib is a libtool library adamc@1133: # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, adamc@1133: # We need to do some special things here, and not later. adamc@1133: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then adamc@1133: case " $predeps $postdeps " in adamc@1133: *" $deplib "*) adamc@1133: if func_lalib_p "$lib"; then adamc@1133: library_names= adamc@1133: old_library= adamc@1133: func_source "$lib" adamc@1133: for l in $old_library $library_names; do adamc@1133: ll="$l" adamc@1133: done adamc@1133: if test "X$ll" = "X$old_library" ; then # only static version available adamc@1133: found=no adamc@1133: func_dirname "$lib" "" "." adamc@1133: ladir="$func_dirname_result" adamc@1133: lib=$ladir/$old_library adamc@1133: if test "$linkmode,$pass" = "prog,link"; then adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: else adamc@1133: deplibs="$deplib $deplibs" adamc@1133: test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" adamc@1133: fi adamc@1133: continue adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: *) ;; adamc@1133: esac adamc@1133: fi adamc@1133: fi adamc@1133: ;; # -l adamc@1133: *.ltframework) adamc@1133: if test "$linkmode,$pass" = "prog,link"; then adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: else adamc@1133: deplibs="$deplib $deplibs" adamc@1133: if test "$linkmode" = lib ; then adamc@1133: case "$new_inherited_linker_flags " in adamc@1133: *" $deplib "*) ;; adam@1826: * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; adamc@1133: esac adamc@1133: fi adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: -L*) adamc@1133: case $linkmode in adamc@1133: lib) adamc@1133: deplibs="$deplib $deplibs" adamc@1133: test "$pass" = conv && continue adamc@1133: newdependency_libs="$deplib $newdependency_libs" adamc@1133: func_stripname '-L' '' "$deplib" adam@1826: newlib_search_path="$newlib_search_path $func_stripname_result" adamc@1133: ;; adamc@1133: prog) adamc@1133: if test "$pass" = conv; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: continue adamc@1133: fi adamc@1133: if test "$pass" = scan; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: else adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: fi adamc@1133: func_stripname '-L' '' "$deplib" adam@1826: newlib_search_path="$newlib_search_path $func_stripname_result" adamc@1133: ;; adamc@1133: *) adamc@1133: func_warning "\`-L' is ignored for archives/objects" adamc@1133: ;; adamc@1133: esac # linkmode adamc@1133: continue adamc@1133: ;; # -L adamc@1133: -R*) adamc@1133: if test "$pass" = link; then adamc@1133: func_stripname '-R' '' "$deplib" adam@1826: dir=$func_stripname_result adamc@1133: # Make sure the xrpath contains only unique directories. adamc@1133: case "$xrpath " in adamc@1133: *" $dir "*) ;; adam@1826: *) xrpath="$xrpath $dir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: deplibs="$deplib $deplibs" adamc@1133: continue adamc@1133: ;; adam@1826: *.la) lib="$deplib" ;; adamc@1133: *.$libext) adamc@1133: if test "$pass" = conv; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: continue adamc@1133: fi adamc@1133: case $linkmode in adamc@1133: lib) adamc@1133: # Linking convenience modules into shared libraries is allowed, adamc@1133: # but linking other static libraries is non-portable. adamc@1133: case " $dlpreconveniencelibs " in adamc@1133: *" $deplib "*) ;; adamc@1133: *) adamc@1133: valid_a_lib=no adamc@1133: case $deplibs_check_method in adamc@1133: match_pattern*) adamc@1133: set dummy $deplibs_check_method; shift adamc@1133: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` adam@1826: if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ adamc@1133: | $EGREP "$match_pattern_regex" > /dev/null; then adamc@1133: valid_a_lib=yes adamc@1133: fi adamc@1133: ;; adamc@1133: pass_all) adamc@1133: valid_a_lib=yes adamc@1133: ;; adamc@1133: esac adamc@1133: if test "$valid_a_lib" != yes; then adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: Trying to link with static lib archive $deplib." adam@1826: $ECHO "*** I have the capability to make that library automatically link in when" adam@1826: $ECHO "*** you link to this library. But I can only do this if you have a" adam@1826: $ECHO "*** shared version of the library, which you do not appear to have" adam@1826: $ECHO "*** because the file extensions .$libext of this argument makes me believe" adam@1826: $ECHO "*** that it is just a static archive that I should not use here." adamc@1133: else adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: Linking the shared library $output against the" adamc@1133: $ECHO "*** static library $deplib is not portable!" adamc@1133: deplibs="$deplib $deplibs" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: continue adamc@1133: ;; adamc@1133: prog) adamc@1133: if test "$pass" != link; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: else adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: esac # linkmode adamc@1133: ;; # *.$libext adamc@1133: *.lo | *.$objext) adamc@1133: if test "$pass" = conv; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: elif test "$linkmode" = prog; then adamc@1133: if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then adamc@1133: # If there is no dlopen support or we're linking statically, adamc@1133: # we need to preload. adam@1826: newdlprefiles="$newdlprefiles $deplib" adamc@1133: compile_deplibs="$deplib $compile_deplibs" adamc@1133: finalize_deplibs="$deplib $finalize_deplibs" adamc@1133: else adam@1826: newdlfiles="$newdlfiles $deplib" adamc@1133: fi adamc@1133: fi adamc@1133: continue adamc@1133: ;; adamc@1133: %DEPLIBS%) adamc@1133: alldeplibs=yes adamc@1133: continue adamc@1133: ;; adamc@1133: esac # case $deplib adamc@1133: adamc@1133: if test "$found" = yes || test -f "$lib"; then : adamc@1133: else adamc@1133: func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" adamc@1133: fi adamc@1133: adamc@1133: # Check to see that this really is a libtool archive. adamc@1133: func_lalib_unsafe_p "$lib" \ adamc@1133: || func_fatal_error "\`$lib' is not a valid libtool archive" adamc@1133: adamc@1133: func_dirname "$lib" "" "." adamc@1133: ladir="$func_dirname_result" adamc@1133: adamc@1133: dlname= adamc@1133: dlopen= adamc@1133: dlpreopen= adamc@1133: libdir= adamc@1133: library_names= adamc@1133: old_library= adamc@1133: inherited_linker_flags= adamc@1133: # If the library was installed with an old release of libtool, adamc@1133: # it will not redefine variables installed, or shouldnotlink adamc@1133: installed=yes adamc@1133: shouldnotlink=no adamc@1133: avoidtemprpath= adamc@1133: adamc@1133: adamc@1133: # Read the .la file adamc@1133: func_source "$lib" adamc@1133: adamc@1133: # Convert "-framework foo" to "foo.ltframework" adamc@1133: if test -n "$inherited_linker_flags"; then adam@1826: tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` adamc@1133: for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do adamc@1133: case " $new_inherited_linker_flags " in adamc@1133: *" $tmp_inherited_linker_flag "*) ;; adam@1826: *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; adamc@1133: esac adamc@1133: done adamc@1133: fi adam@1826: dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adamc@1133: if test "$linkmode,$pass" = "lib,link" || adamc@1133: test "$linkmode,$pass" = "prog,scan" || adamc@1133: { test "$linkmode" != prog && test "$linkmode" != lib; }; then adam@1826: test -n "$dlopen" && dlfiles="$dlfiles $dlopen" adam@1826: test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" adamc@1133: fi adamc@1133: adamc@1133: if test "$pass" = conv; then adamc@1133: # Only check for convenience libraries adamc@1133: deplibs="$lib $deplibs" adamc@1133: if test -z "$libdir"; then adamc@1133: if test -z "$old_library"; then adamc@1133: func_fatal_error "cannot find name of link library for \`$lib'" adamc@1133: fi adamc@1133: # It is a libtool convenience library, so add in its objects. adam@1826: convenience="$convenience $ladir/$objdir/$old_library" adam@1826: old_convenience="$old_convenience $ladir/$objdir/$old_library" adamc@1133: tmp_libs= adamc@1133: for deplib in $dependency_libs; do adamc@1133: deplibs="$deplib $deplibs" adam@1826: if $opt_duplicate_deps ; then adamc@1133: case "$tmp_libs " in adam@1826: *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; adamc@1133: esac adamc@1133: fi adam@1826: tmp_libs="$tmp_libs $deplib" adamc@1133: done adamc@1133: elif test "$linkmode" != prog && test "$linkmode" != lib; then adamc@1133: func_fatal_error "\`$lib' is not a convenience library" adamc@1133: fi adamc@1133: continue adamc@1133: fi # $pass = conv adamc@1133: adamc@1133: adamc@1133: # Get the name of the library we link against. adamc@1133: linklib= adam@1826: for l in $old_library $library_names; do adam@1826: linklib="$l" adam@1826: done adamc@1133: if test -z "$linklib"; then adamc@1133: func_fatal_error "cannot find name of link library for \`$lib'" adamc@1133: fi adamc@1133: adamc@1133: # This library was specified with -dlopen. adamc@1133: if test "$pass" = dlopen; then adamc@1133: if test -z "$libdir"; then adamc@1133: func_fatal_error "cannot -dlopen a convenience library: \`$lib'" adamc@1133: fi adamc@1133: if test -z "$dlname" || adamc@1133: test "$dlopen_support" != yes || adamc@1133: test "$build_libtool_libs" = no; then adamc@1133: # If there is no dlname, no dlopen support or we're linking adamc@1133: # statically, we need to preload. We also need to preload any adamc@1133: # dependent libraries so libltdl's deplib preloader doesn't adamc@1133: # bomb out in the load deplibs phase. adam@1826: dlprefiles="$dlprefiles $lib $dependency_libs" adamc@1133: else adam@1826: newdlfiles="$newdlfiles $lib" adamc@1133: fi adamc@1133: continue adamc@1133: fi # $pass = dlopen adamc@1133: adamc@1133: # We need an absolute path. adamc@1133: case $ladir in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; adamc@1133: *) adamc@1133: abs_ladir=`cd "$ladir" && pwd` adamc@1133: if test -z "$abs_ladir"; then adamc@1133: func_warning "cannot determine absolute directory name of \`$ladir'" adamc@1133: func_warning "passing it literally to the linker, although it might fail" adamc@1133: abs_ladir="$ladir" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: func_basename "$lib" adamc@1133: laname="$func_basename_result" adamc@1133: adamc@1133: # Find the relevant object directory and library name. adamc@1133: if test "X$installed" = Xyes; then adam@1826: if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then adamc@1133: func_warning "library \`$lib' was moved." adamc@1133: dir="$ladir" adamc@1133: absdir="$abs_ladir" adamc@1133: libdir="$abs_ladir" adamc@1133: else adam@1826: dir="$libdir" adam@1826: absdir="$libdir" adamc@1133: fi adamc@1133: test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes adamc@1133: else adamc@1133: if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then adamc@1133: dir="$ladir" adamc@1133: absdir="$abs_ladir" adamc@1133: # Remove this search path later adam@1826: notinst_path="$notinst_path $abs_ladir" adamc@1133: else adamc@1133: dir="$ladir/$objdir" adamc@1133: absdir="$abs_ladir/$objdir" adamc@1133: # Remove this search path later adam@1826: notinst_path="$notinst_path $abs_ladir" adamc@1133: fi adamc@1133: fi # $installed = yes adamc@1133: func_stripname 'lib' '.la' "$laname" adamc@1133: name=$func_stripname_result adamc@1133: adamc@1133: # This library was specified with -dlpreopen. adamc@1133: if test "$pass" = dlpreopen; then adamc@1133: if test -z "$libdir" && test "$linkmode" = prog; then adamc@1133: func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" adamc@1133: fi adam@1826: # Prefer using a static library (so that no silly _DYNAMIC symbols adam@1826: # are required to link). adam@1826: if test -n "$old_library"; then adam@1826: newdlprefiles="$newdlprefiles $dir/$old_library" adam@1826: # Keep a list of preopened convenience libraries to check adam@1826: # that they are being used correctly in the link pass. adam@1826: test -z "$libdir" && \ adam@1826: dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" adam@1826: # Otherwise, use the dlname, so that lt_dlopen finds it. adam@1826: elif test -n "$dlname"; then adam@1826: newdlprefiles="$newdlprefiles $dir/$dlname" adam@1826: else adam@1826: newdlprefiles="$newdlprefiles $dir/$linklib" adam@1826: fi adamc@1133: fi # $pass = dlpreopen adamc@1133: adamc@1133: if test -z "$libdir"; then adamc@1133: # Link the convenience library adamc@1133: if test "$linkmode" = lib; then adamc@1133: deplibs="$dir/$old_library $deplibs" adamc@1133: elif test "$linkmode,$pass" = "prog,link"; then adamc@1133: compile_deplibs="$dir/$old_library $compile_deplibs" adamc@1133: finalize_deplibs="$dir/$old_library $finalize_deplibs" adamc@1133: else adamc@1133: deplibs="$lib $deplibs" # used for prog,scan pass adamc@1133: fi adamc@1133: continue adamc@1133: fi adamc@1133: adamc@1133: adamc@1133: if test "$linkmode" = prog && test "$pass" != link; then adam@1826: newlib_search_path="$newlib_search_path $ladir" adamc@1133: deplibs="$lib $deplibs" adamc@1133: adamc@1133: linkalldeplibs=no adamc@1133: if test "$link_all_deplibs" != no || test -z "$library_names" || adamc@1133: test "$build_libtool_libs" = no; then adamc@1133: linkalldeplibs=yes adamc@1133: fi adamc@1133: adamc@1133: tmp_libs= adamc@1133: for deplib in $dependency_libs; do adamc@1133: case $deplib in adamc@1133: -L*) func_stripname '-L' '' "$deplib" adam@1826: newlib_search_path="$newlib_search_path $func_stripname_result" adamc@1133: ;; adamc@1133: esac adamc@1133: # Need to link against all dependency_libs? adamc@1133: if test "$linkalldeplibs" = yes; then adamc@1133: deplibs="$deplib $deplibs" adamc@1133: else adamc@1133: # Need to hardcode shared library paths adamc@1133: # or/and link against static libraries adamc@1133: newdependency_libs="$deplib $newdependency_libs" adamc@1133: fi adam@1826: if $opt_duplicate_deps ; then adamc@1133: case "$tmp_libs " in adam@1826: *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; adamc@1133: esac adamc@1133: fi adam@1826: tmp_libs="$tmp_libs $deplib" adamc@1133: done # for deplib adamc@1133: continue adamc@1133: fi # $linkmode = prog... adamc@1133: adamc@1133: if test "$linkmode,$pass" = "prog,link"; then adamc@1133: if test -n "$library_names" && adamc@1133: { { test "$prefer_static_libs" = no || adamc@1133: test "$prefer_static_libs,$installed" = "built,yes"; } || adamc@1133: test -z "$old_library"; }; then adamc@1133: # We need to hardcode the library path adamc@1133: if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then adamc@1133: # Make sure the rpath contains only unique directories. adamc@1133: case "$temp_rpath:" in adamc@1133: *"$absdir:"*) ;; adam@1826: *) temp_rpath="$temp_rpath$absdir:" ;; adamc@1133: esac adamc@1133: fi adamc@1133: adamc@1133: # Hardcode the library path. adamc@1133: # Skip directories that are in the system default run-time adamc@1133: # search path. adamc@1133: case " $sys_lib_dlsearch_path " in adamc@1133: *" $absdir "*) ;; adamc@1133: *) adamc@1133: case "$compile_rpath " in adamc@1133: *" $absdir "*) ;; adam@1826: *) compile_rpath="$compile_rpath $absdir" adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: case " $sys_lib_dlsearch_path " in adamc@1133: *" $libdir "*) ;; adamc@1133: *) adamc@1133: case "$finalize_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) finalize_rpath="$finalize_rpath $libdir" adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: fi # $linkmode,$pass = prog,link... adamc@1133: adamc@1133: if test "$alldeplibs" = yes && adamc@1133: { test "$deplibs_check_method" = pass_all || adamc@1133: { test "$build_libtool_libs" = yes && adamc@1133: test -n "$library_names"; }; }; then adamc@1133: # We only need to search for static libraries adamc@1133: continue adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: link_static=no # Whether the deplib will be linked statically adamc@1133: use_static_libs=$prefer_static_libs adamc@1133: if test "$use_static_libs" = built && test "$installed" = yes; then adamc@1133: use_static_libs=no adamc@1133: fi adamc@1133: if test -n "$library_names" && adamc@1133: { test "$use_static_libs" = no || test -z "$old_library"; }; then adamc@1133: case $host in adamc@1133: *cygwin* | *mingw* | *cegcc*) adamc@1133: # No point in relinking DLLs because paths are not encoded adam@1826: notinst_deplibs="$notinst_deplibs $lib" adamc@1133: need_relink=no adamc@1133: ;; adamc@1133: *) adamc@1133: if test "$installed" = no; then adam@1826: notinst_deplibs="$notinst_deplibs $lib" adamc@1133: need_relink=yes adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: # This is a shared library adamc@1133: adamc@1133: # Warn about portability, can't link against -module's on some adamc@1133: # systems (darwin). Don't bleat about dlopened modules though! adamc@1133: dlopenmodule="" adamc@1133: for dlpremoduletest in $dlprefiles; do adamc@1133: if test "X$dlpremoduletest" = "X$lib"; then adamc@1133: dlopenmodule="$dlpremoduletest" adamc@1133: break adamc@1133: fi adamc@1133: done adamc@1133: if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then adam@1826: $ECHO adamc@1133: if test "$linkmode" = prog; then adamc@1133: $ECHO "*** Warning: Linking the executable $output against the loadable module" adamc@1133: else adamc@1133: $ECHO "*** Warning: Linking the shared library $output against the loadable module" adamc@1133: fi adamc@1133: $ECHO "*** $linklib is not portable!" adamc@1133: fi adamc@1133: if test "$linkmode" = lib && adamc@1133: test "$hardcode_into_libs" = yes; then adamc@1133: # Hardcode the library path. adamc@1133: # Skip directories that are in the system default run-time adamc@1133: # search path. adamc@1133: case " $sys_lib_dlsearch_path " in adamc@1133: *" $absdir "*) ;; adamc@1133: *) adamc@1133: case "$compile_rpath " in adamc@1133: *" $absdir "*) ;; adam@1826: *) compile_rpath="$compile_rpath $absdir" adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: case " $sys_lib_dlsearch_path " in adamc@1133: *" $libdir "*) ;; adamc@1133: *) adamc@1133: case "$finalize_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) finalize_rpath="$finalize_rpath $libdir" adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: adamc@1133: if test -n "$old_archive_from_expsyms_cmds"; then adamc@1133: # figure out the soname adamc@1133: set dummy $library_names adamc@1133: shift adamc@1133: realname="$1" adamc@1133: shift adamc@1133: libname=`eval "\\$ECHO \"$libname_spec\""` adamc@1133: # use dlname if we got it. it's perfectly good, no? adamc@1133: if test -n "$dlname"; then adamc@1133: soname="$dlname" adamc@1133: elif test -n "$soname_spec"; then adamc@1133: # bleh windows adamc@1133: case $host in adamc@1133: *cygwin* | mingw* | *cegcc*) adamc@1133: func_arith $current - $age adamc@1133: major=$func_arith_result adamc@1133: versuffix="-$major" adamc@1133: ;; adamc@1133: esac adamc@1133: eval soname=\"$soname_spec\" adamc@1133: else adamc@1133: soname="$realname" adamc@1133: fi adamc@1133: adamc@1133: # Make a new name for the extract_expsyms_cmds to use adamc@1133: soroot="$soname" adamc@1133: func_basename "$soroot" adamc@1133: soname="$func_basename_result" adamc@1133: func_stripname 'lib' '.dll' "$soname" adamc@1133: newlib=libimp-$func_stripname_result.a adamc@1133: adamc@1133: # If the library has no export list, then create one now adamc@1133: if test -f "$output_objdir/$soname-def"; then : adamc@1133: else adamc@1133: func_verbose "extracting exported symbol list from \`$soname'" adamc@1133: func_execute_cmds "$extract_expsyms_cmds" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: # Create $newlib adamc@1133: if test -f "$output_objdir/$newlib"; then :; else adamc@1133: func_verbose "generating import library for \`$soname'" adamc@1133: func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' adamc@1133: fi adamc@1133: # make sure the library variables are pointing to the new library adamc@1133: dir=$output_objdir adamc@1133: linklib=$newlib adamc@1133: fi # test -n "$old_archive_from_expsyms_cmds" adamc@1133: adam@1826: if test "$linkmode" = prog || test "$mode" != relink; then adamc@1133: add_shlibpath= adamc@1133: add_dir= adamc@1133: add= adamc@1133: lib_linked=yes adamc@1133: case $hardcode_action in adamc@1133: immediate | unsupported) adamc@1133: if test "$hardcode_direct" = no; then adamc@1133: add="$dir/$linklib" adamc@1133: case $host in adamc@1133: *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; adamc@1133: *-*-sysv4*uw2*) add_dir="-L$dir" ;; adamc@1133: *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ adamc@1133: *-*-unixware7*) add_dir="-L$dir" ;; adamc@1133: *-*-darwin* ) adamc@1133: # if the lib is a (non-dlopened) module then we can not adamc@1133: # link against it, someone is ignoring the earlier warnings adamc@1133: if /usr/bin/file -L $add 2> /dev/null | adamc@1133: $GREP ": [^:]* bundle" >/dev/null ; then adamc@1133: if test "X$dlopenmodule" != "X$lib"; then adamc@1133: $ECHO "*** Warning: lib $linklib is a module, not a shared library" adamc@1133: if test -z "$old_library" ; then adam@1826: $ECHO adam@1826: $ECHO "*** And there doesn't seem to be a static archive available" adam@1826: $ECHO "*** The link will probably fail, sorry" adamc@1133: else adamc@1133: add="$dir/$old_library" adamc@1133: fi adamc@1133: elif test -n "$old_library"; then adamc@1133: add="$dir/$old_library" adamc@1133: fi adamc@1133: fi adamc@1133: esac adamc@1133: elif test "$hardcode_minus_L" = no; then adamc@1133: case $host in adamc@1133: *-*-sunos*) add_shlibpath="$dir" ;; adamc@1133: esac adamc@1133: add_dir="-L$dir" adamc@1133: add="-l$name" adamc@1133: elif test "$hardcode_shlibpath_var" = no; then adamc@1133: add_shlibpath="$dir" adamc@1133: add="-l$name" adamc@1133: else adamc@1133: lib_linked=no adamc@1133: fi adamc@1133: ;; adamc@1133: relink) adamc@1133: if test "$hardcode_direct" = yes && adamc@1133: test "$hardcode_direct_absolute" = no; then adamc@1133: add="$dir/$linklib" adamc@1133: elif test "$hardcode_minus_L" = yes; then adam@1826: add_dir="-L$dir" adamc@1133: # Try looking first in the location we're being installed to. adamc@1133: if test -n "$inst_prefix_dir"; then adamc@1133: case $libdir in adamc@1133: [\\/]*) adam@1826: add_dir="$add_dir -L$inst_prefix_dir$libdir" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: add="-l$name" adamc@1133: elif test "$hardcode_shlibpath_var" = yes; then adamc@1133: add_shlibpath="$dir" adamc@1133: add="-l$name" adamc@1133: else adamc@1133: lib_linked=no adamc@1133: fi adamc@1133: ;; adamc@1133: *) lib_linked=no ;; adamc@1133: esac adamc@1133: adamc@1133: if test "$lib_linked" != yes; then adamc@1133: func_fatal_configuration "unsupported hardcode properties" adamc@1133: fi adamc@1133: adamc@1133: if test -n "$add_shlibpath"; then adamc@1133: case :$compile_shlibpath: in adamc@1133: *":$add_shlibpath:"*) ;; adam@1826: *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; adamc@1133: esac adamc@1133: fi adamc@1133: if test "$linkmode" = prog; then adamc@1133: test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" adamc@1133: test -n "$add" && compile_deplibs="$add $compile_deplibs" adamc@1133: else adamc@1133: test -n "$add_dir" && deplibs="$add_dir $deplibs" adamc@1133: test -n "$add" && deplibs="$add $deplibs" adamc@1133: if test "$hardcode_direct" != yes && adamc@1133: test "$hardcode_minus_L" != yes && adamc@1133: test "$hardcode_shlibpath_var" = yes; then adamc@1133: case :$finalize_shlibpath: in adamc@1133: *":$libdir:"*) ;; adam@1826: *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; adamc@1133: esac adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: adam@1826: if test "$linkmode" = prog || test "$mode" = relink; then adamc@1133: add_shlibpath= adamc@1133: add_dir= adamc@1133: add= adamc@1133: # Finalize command for both is simple: just hardcode it. adamc@1133: if test "$hardcode_direct" = yes && adamc@1133: test "$hardcode_direct_absolute" = no; then adamc@1133: add="$libdir/$linklib" adamc@1133: elif test "$hardcode_minus_L" = yes; then adamc@1133: add_dir="-L$libdir" adamc@1133: add="-l$name" adamc@1133: elif test "$hardcode_shlibpath_var" = yes; then adamc@1133: case :$finalize_shlibpath: in adamc@1133: *":$libdir:"*) ;; adam@1826: *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; adamc@1133: esac adamc@1133: add="-l$name" adamc@1133: elif test "$hardcode_automatic" = yes; then adamc@1133: if test -n "$inst_prefix_dir" && adamc@1133: test -f "$inst_prefix_dir$libdir/$linklib" ; then adamc@1133: add="$inst_prefix_dir$libdir/$linklib" adamc@1133: else adamc@1133: add="$libdir/$linklib" adamc@1133: fi adamc@1133: else adamc@1133: # We cannot seem to hardcode it, guess we'll fake it. adamc@1133: add_dir="-L$libdir" adamc@1133: # Try looking first in the location we're being installed to. adamc@1133: if test -n "$inst_prefix_dir"; then adamc@1133: case $libdir in adamc@1133: [\\/]*) adam@1826: add_dir="$add_dir -L$inst_prefix_dir$libdir" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: add="-l$name" adamc@1133: fi adamc@1133: adamc@1133: if test "$linkmode" = prog; then adamc@1133: test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" adamc@1133: test -n "$add" && finalize_deplibs="$add $finalize_deplibs" adamc@1133: else adamc@1133: test -n "$add_dir" && deplibs="$add_dir $deplibs" adamc@1133: test -n "$add" && deplibs="$add $deplibs" adamc@1133: fi adamc@1133: fi adamc@1133: elif test "$linkmode" = prog; then adamc@1133: # Here we assume that one of hardcode_direct or hardcode_minus_L adamc@1133: # is not unsupported. This is valid on all known static and adamc@1133: # shared platforms. adamc@1133: if test "$hardcode_direct" != unsupported; then adamc@1133: test -n "$old_library" && linklib="$old_library" adamc@1133: compile_deplibs="$dir/$linklib $compile_deplibs" adamc@1133: finalize_deplibs="$dir/$linklib $finalize_deplibs" adamc@1133: else adamc@1133: compile_deplibs="-l$name -L$dir $compile_deplibs" adamc@1133: finalize_deplibs="-l$name -L$dir $finalize_deplibs" adamc@1133: fi adamc@1133: elif test "$build_libtool_libs" = yes; then adamc@1133: # Not a shared library adamc@1133: if test "$deplibs_check_method" != pass_all; then adamc@1133: # We're trying link a shared library against a static one adamc@1133: # but the system doesn't support it. adamc@1133: adamc@1133: # Just print a warning and add the library to dependency_libs so adamc@1133: # that the program can be linked against the static library. adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: This system can not link to static lib archive $lib." adam@1826: $ECHO "*** I have the capability to make that library automatically link in when" adam@1826: $ECHO "*** you link to this library. But I can only do this if you have a" adam@1826: $ECHO "*** shared version of the library, which you do not appear to have." adamc@1133: if test "$module" = yes; then adam@1826: $ECHO "*** But as you try to build a module library, libtool will still create " adam@1826: $ECHO "*** a static module, that should work as long as the dlopening application" adam@1826: $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." adamc@1133: if test -z "$global_symbol_pipe"; then adam@1826: $ECHO adam@1826: $ECHO "*** However, this would only work if libtool was able to extract symbol" adam@1826: $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" adam@1826: $ECHO "*** not find such a program. So, this module is probably useless." adam@1826: $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." adamc@1133: fi adamc@1133: if test "$build_old_libs" = no; then adamc@1133: build_libtool_libs=module adamc@1133: build_old_libs=yes adamc@1133: else adamc@1133: build_libtool_libs=no adamc@1133: fi adamc@1133: fi adamc@1133: else adamc@1133: deplibs="$dir/$old_library $deplibs" adamc@1133: link_static=yes adamc@1133: fi adamc@1133: fi # link shared/static library? adamc@1133: adamc@1133: if test "$linkmode" = lib; then adamc@1133: if test -n "$dependency_libs" && adamc@1133: { test "$hardcode_into_libs" != yes || adamc@1133: test "$build_old_libs" = yes || adamc@1133: test "$link_static" = yes; }; then adamc@1133: # Extract -R from dependency_libs adamc@1133: temp_deplibs= adamc@1133: for libdir in $dependency_libs; do adamc@1133: case $libdir in adamc@1133: -R*) func_stripname '-R' '' "$libdir" adamc@1133: temp_xrpath=$func_stripname_result adamc@1133: case " $xrpath " in adamc@1133: *" $temp_xrpath "*) ;; adam@1826: *) xrpath="$xrpath $temp_xrpath";; adamc@1133: esac;; adam@1826: *) temp_deplibs="$temp_deplibs $libdir";; adamc@1133: esac adamc@1133: done adamc@1133: dependency_libs="$temp_deplibs" adamc@1133: fi adamc@1133: adam@1826: newlib_search_path="$newlib_search_path $absdir" adamc@1133: # Link against this library adamc@1133: test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" adamc@1133: # ... and its dependency_libs adamc@1133: tmp_libs= adamc@1133: for deplib in $dependency_libs; do adamc@1133: newdependency_libs="$deplib $newdependency_libs" adam@1826: if $opt_duplicate_deps ; then adamc@1133: case "$tmp_libs " in adam@1826: *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; adamc@1133: esac adamc@1133: fi adam@1826: tmp_libs="$tmp_libs $deplib" adamc@1133: done adamc@1133: adamc@1133: if test "$link_all_deplibs" != no; then adamc@1133: # Add the search paths of all dependency libraries adamc@1133: for deplib in $dependency_libs; do adamc@1133: path= adamc@1133: case $deplib in adamc@1133: -L*) path="$deplib" ;; adamc@1133: *.la) adamc@1133: func_dirname "$deplib" "" "." adam@1826: dir="$func_dirname_result" adamc@1133: # We need an absolute path. adamc@1133: case $dir in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; adamc@1133: *) adamc@1133: absdir=`cd "$dir" && pwd` adamc@1133: if test -z "$absdir"; then adamc@1133: func_warning "cannot determine absolute directory name of \`$dir'" adamc@1133: absdir="$dir" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: if $GREP "^installed=no" $deplib > /dev/null; then adamc@1133: case $host in adamc@1133: *-*-darwin*) adamc@1133: depdepl= adamc@1133: eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` adamc@1133: if test -n "$deplibrary_names" ; then adamc@1133: for tmp in $deplibrary_names ; do adamc@1133: depdepl=$tmp adamc@1133: done adamc@1133: if test -f "$absdir/$objdir/$depdepl" ; then adamc@1133: depdepl="$absdir/$objdir/$depdepl" adamc@1133: darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` adamc@1133: if test -z "$darwin_install_name"; then adamc@1133: darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` adamc@1133: fi adam@1826: compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" adam@1826: linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" adamc@1133: path= adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: *) adamc@1133: path="-L$absdir/$objdir" adamc@1133: ;; adamc@1133: esac adamc@1133: else adamc@1133: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` adamc@1133: test -z "$libdir" && \ adamc@1133: func_fatal_error "\`$deplib' is not a valid libtool archive" adamc@1133: test "$absdir" != "$libdir" && \ adamc@1133: func_warning "\`$deplib' seems to be moved" adamc@1133: adamc@1133: path="-L$absdir" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: case " $deplibs " in adamc@1133: *" $path "*) ;; adamc@1133: *) deplibs="$path $deplibs" ;; adamc@1133: esac adamc@1133: done adamc@1133: fi # link_all_deplibs != no adamc@1133: fi # linkmode = lib adamc@1133: done # for deplib in $libs adamc@1133: if test "$pass" = link; then adamc@1133: if test "$linkmode" = "prog"; then adamc@1133: compile_deplibs="$new_inherited_linker_flags $compile_deplibs" adamc@1133: finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" adamc@1133: else adam@1826: compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adamc@1133: fi adamc@1133: fi adamc@1133: dependency_libs="$newdependency_libs" adamc@1133: if test "$pass" = dlpreopen; then adamc@1133: # Link the dlpreopened libraries before other libraries adamc@1133: for deplib in $save_deplibs; do adamc@1133: deplibs="$deplib $deplibs" adamc@1133: done adamc@1133: fi adamc@1133: if test "$pass" != dlopen; then adamc@1133: if test "$pass" != conv; then adamc@1133: # Make sure lib_search_path contains only unique directories. adamc@1133: lib_search_path= adamc@1133: for dir in $newlib_search_path; do adamc@1133: case "$lib_search_path " in adamc@1133: *" $dir "*) ;; adam@1826: *) lib_search_path="$lib_search_path $dir" ;; adamc@1133: esac adamc@1133: done adamc@1133: newlib_search_path= adamc@1133: fi adamc@1133: adamc@1133: if test "$linkmode,$pass" != "prog,link"; then adamc@1133: vars="deplibs" adamc@1133: else adamc@1133: vars="compile_deplibs finalize_deplibs" adamc@1133: fi adamc@1133: for var in $vars dependency_libs; do adamc@1133: # Add libraries to $var in reverse order adamc@1133: eval tmp_libs=\"\$$var\" adamc@1133: new_libs= adamc@1133: for deplib in $tmp_libs; do adamc@1133: # FIXME: Pedantically, this is the right thing to do, so adamc@1133: # that some nasty dependency loop isn't accidentally adamc@1133: # broken: adamc@1133: #new_libs="$deplib $new_libs" adamc@1133: # Pragmatically, this seems to cause very few problems in adamc@1133: # practice: adamc@1133: case $deplib in adamc@1133: -L*) new_libs="$deplib $new_libs" ;; adamc@1133: -R*) ;; adamc@1133: *) adamc@1133: # And here is the reason: when a library appears more adamc@1133: # than once as an explicit dependence of a library, or adamc@1133: # is implicitly linked in more than once by the adamc@1133: # compiler, it is considered special, and multiple adamc@1133: # occurrences thereof are not removed. Compare this adamc@1133: # with having the same library being listed as a adamc@1133: # dependency of multiple other libraries: in this case, adamc@1133: # we know (pedantically, we assume) the library does not adamc@1133: # need to be listed more than once, so we keep only the adamc@1133: # last copy. This is not always right, but it is rare adamc@1133: # enough that we require users that really mean to play adamc@1133: # such unportable linking tricks to link the library adamc@1133: # using -Wl,-lname, so that libtool does not consider it adamc@1133: # for duplicate removal. adamc@1133: case " $specialdeplibs " in adamc@1133: *" $deplib "*) new_libs="$deplib $new_libs" ;; adamc@1133: *) adamc@1133: case " $new_libs " in adamc@1133: *" $deplib "*) ;; adamc@1133: *) new_libs="$deplib $new_libs" ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: tmp_libs= adamc@1133: for deplib in $new_libs; do adamc@1133: case $deplib in adamc@1133: -L*) adamc@1133: case " $tmp_libs " in adamc@1133: *" $deplib "*) ;; adam@1826: *) tmp_libs="$tmp_libs $deplib" ;; adamc@1133: esac adamc@1133: ;; adam@1826: *) tmp_libs="$tmp_libs $deplib" ;; adamc@1133: esac adamc@1133: done adamc@1133: eval $var=\"$tmp_libs\" adamc@1133: done # for var adamc@1133: fi adamc@1133: # Last step: remove runtime libs from dependency_libs adamc@1133: # (they stay in deplibs) adamc@1133: tmp_libs= adamc@1133: for i in $dependency_libs ; do adamc@1133: case " $predeps $postdeps $compiler_lib_search_path " in adamc@1133: *" $i "*) adamc@1133: i="" adamc@1133: ;; adamc@1133: esac adamc@1133: if test -n "$i" ; then adam@1826: tmp_libs="$tmp_libs $i" adamc@1133: fi adamc@1133: done adamc@1133: dependency_libs=$tmp_libs adamc@1133: done # for pass adamc@1133: if test "$linkmode" = prog; then adamc@1133: dlfiles="$newdlfiles" adamc@1133: fi adamc@1133: if test "$linkmode" = prog || test "$linkmode" = lib; then adamc@1133: dlprefiles="$newdlprefiles" adamc@1133: fi adamc@1133: adamc@1133: case $linkmode in adamc@1133: oldlib) adamc@1133: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then adamc@1133: func_warning "\`-dlopen' is ignored for archives" adamc@1133: fi adamc@1133: adamc@1133: case " $deplibs" in adamc@1133: *\ -l* | *\ -L*) adamc@1133: func_warning "\`-l' and \`-L' are ignored for archives" ;; adamc@1133: esac adamc@1133: adamc@1133: test -n "$rpath" && \ adamc@1133: func_warning "\`-rpath' is ignored for archives" adamc@1133: adamc@1133: test -n "$xrpath" && \ adamc@1133: func_warning "\`-R' is ignored for archives" adamc@1133: adamc@1133: test -n "$vinfo" && \ adamc@1133: func_warning "\`-version-info/-version-number' is ignored for archives" adamc@1133: adamc@1133: test -n "$release" && \ adamc@1133: func_warning "\`-release' is ignored for archives" adamc@1133: adamc@1133: test -n "$export_symbols$export_symbols_regex" && \ adamc@1133: func_warning "\`-export-symbols' is ignored for archives" adamc@1133: adamc@1133: # Now set the variables for building old libraries. adamc@1133: build_libtool_libs=no adamc@1133: oldlibs="$output" adam@1826: objs="$objs$old_deplibs" adamc@1133: ;; adamc@1133: adamc@1133: lib) adamc@1133: # Make sure we only generate libraries of the form `libNAME.la'. adamc@1133: case $outputname in adamc@1133: lib*) adamc@1133: func_stripname 'lib' '.la' "$outputname" adamc@1133: name=$func_stripname_result adamc@1133: eval shared_ext=\"$shrext_cmds\" adamc@1133: eval libname=\"$libname_spec\" adamc@1133: ;; adamc@1133: *) adamc@1133: test "$module" = no && \ adamc@1133: func_fatal_help "libtool library \`$output' must begin with \`lib'" adamc@1133: adamc@1133: if test "$need_lib_prefix" != no; then adamc@1133: # Add the "lib" prefix for modules if required adamc@1133: func_stripname '' '.la' "$outputname" adamc@1133: name=$func_stripname_result adamc@1133: eval shared_ext=\"$shrext_cmds\" adamc@1133: eval libname=\"$libname_spec\" adamc@1133: else adamc@1133: func_stripname '' '.la' "$outputname" adamc@1133: libname=$func_stripname_result adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: if test -n "$objs"; then adamc@1133: if test "$deplibs_check_method" != pass_all; then adamc@1133: func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" adamc@1133: else adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: Linking the shared library $output against the non-libtool" adamc@1133: $ECHO "*** objects $objs is not portable!" adam@1826: libobjs="$libobjs $objs" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: test "$dlself" != no && \ adamc@1133: func_warning "\`-dlopen self' is ignored for libtool libraries" adamc@1133: adamc@1133: set dummy $rpath adamc@1133: shift adamc@1133: test "$#" -gt 1 && \ adamc@1133: func_warning "ignoring multiple \`-rpath's for a libtool library" adamc@1133: adamc@1133: install_libdir="$1" adamc@1133: adamc@1133: oldlibs= adamc@1133: if test -z "$rpath"; then adamc@1133: if test "$build_libtool_libs" = yes; then adamc@1133: # Building a libtool convenience library. adamc@1133: # Some compilers have problems with a `.al' extension so adamc@1133: # convenience libraries should have the same extension an adamc@1133: # archive normally would. adamc@1133: oldlibs="$output_objdir/$libname.$libext $oldlibs" adamc@1133: build_libtool_libs=convenience adamc@1133: build_old_libs=yes adamc@1133: fi adamc@1133: adamc@1133: test -n "$vinfo" && \ adamc@1133: func_warning "\`-version-info/-version-number' is ignored for convenience libraries" adamc@1133: adamc@1133: test -n "$release" && \ adamc@1133: func_warning "\`-release' is ignored for convenience libraries" adamc@1133: else adamc@1133: adamc@1133: # Parse the version information argument. adamc@1133: save_ifs="$IFS"; IFS=':' adamc@1133: set dummy $vinfo 0 0 0 adamc@1133: shift adamc@1133: IFS="$save_ifs" adamc@1133: adamc@1133: test -n "$7" && \ adamc@1133: func_fatal_help "too many parameters to \`-version-info'" adamc@1133: adamc@1133: # convert absolute version numbers to libtool ages adamc@1133: # this retains compatibility with .la files and attempts adamc@1133: # to make the code below a bit more comprehensible adamc@1133: adamc@1133: case $vinfo_number in adamc@1133: yes) adamc@1133: number_major="$1" adamc@1133: number_minor="$2" adamc@1133: number_revision="$3" adamc@1133: # adamc@1133: # There are really only two kinds -- those that adamc@1133: # use the current revision as the major version adamc@1133: # and those that subtract age and use age as adamc@1133: # a minor version. But, then there is irix adamc@1133: # which has an extra 1 added just for fun adamc@1133: # adamc@1133: case $version_type in adamc@1133: darwin|linux|osf|windows|none) adamc@1133: func_arith $number_major + $number_minor adamc@1133: current=$func_arith_result adamc@1133: age="$number_minor" adamc@1133: revision="$number_revision" adamc@1133: ;; adam@1826: freebsd-aout|freebsd-elf|sunos) adamc@1133: current="$number_major" adamc@1133: revision="$number_minor" adamc@1133: age="0" adamc@1133: ;; adamc@1133: irix|nonstopux) adamc@1133: func_arith $number_major + $number_minor adamc@1133: current=$func_arith_result adamc@1133: age="$number_minor" adamc@1133: revision="$number_minor" adamc@1133: lt_irix_increment=no adamc@1133: ;; adamc@1133: *) adamc@1133: func_fatal_configuration "$modename: unknown library version type \`$version_type'" adamc@1133: ;; adamc@1133: esac adamc@1133: ;; adamc@1133: no) adamc@1133: current="$1" adamc@1133: revision="$2" adamc@1133: age="$3" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Check that each of the things are valid numbers. adamc@1133: case $current in adamc@1133: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; adamc@1133: *) adamc@1133: func_error "CURRENT \`$current' must be a nonnegative integer" adamc@1133: func_fatal_error "\`$vinfo' is not valid version information" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: case $revision in adamc@1133: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; adamc@1133: *) adamc@1133: func_error "REVISION \`$revision' must be a nonnegative integer" adamc@1133: func_fatal_error "\`$vinfo' is not valid version information" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: case $age in adamc@1133: 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; adamc@1133: *) adamc@1133: func_error "AGE \`$age' must be a nonnegative integer" adamc@1133: func_fatal_error "\`$vinfo' is not valid version information" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: if test "$age" -gt "$current"; then adamc@1133: func_error "AGE \`$age' is greater than the current interface number \`$current'" adamc@1133: func_fatal_error "\`$vinfo' is not valid version information" adamc@1133: fi adamc@1133: adamc@1133: # Calculate the version variables. adamc@1133: major= adamc@1133: versuffix= adamc@1133: verstring= adamc@1133: case $version_type in adamc@1133: none) ;; adamc@1133: adamc@1133: darwin) adamc@1133: # Like Linux, but with the current version available in adamc@1133: # verstring for coding it into the library header adamc@1133: func_arith $current - $age adamc@1133: major=.$func_arith_result adamc@1133: versuffix="$major.$age.$revision" adamc@1133: # Darwin ld doesn't like 0 for these options... adamc@1133: func_arith $current + 1 adamc@1133: minor_current=$func_arith_result adamc@1133: xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" adamc@1133: verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" adamc@1133: ;; adamc@1133: adamc@1133: freebsd-aout) adamc@1133: major=".$current" adamc@1133: versuffix=".$current.$revision"; adamc@1133: ;; adamc@1133: adamc@1133: freebsd-elf) adamc@1133: major=".$current" adamc@1133: versuffix=".$current" adamc@1133: ;; adamc@1133: adamc@1133: irix | nonstopux) adamc@1133: if test "X$lt_irix_increment" = "Xno"; then adamc@1133: func_arith $current - $age adamc@1133: else adamc@1133: func_arith $current - $age + 1 adamc@1133: fi adamc@1133: major=$func_arith_result adamc@1133: adamc@1133: case $version_type in adamc@1133: nonstopux) verstring_prefix=nonstopux ;; adamc@1133: *) verstring_prefix=sgi ;; adamc@1133: esac adamc@1133: verstring="$verstring_prefix$major.$revision" adamc@1133: adamc@1133: # Add in all the interfaces that we are compatible with. adamc@1133: loop=$revision adamc@1133: while test "$loop" -ne 0; do adamc@1133: func_arith $revision - $loop adamc@1133: iface=$func_arith_result adamc@1133: func_arith $loop - 1 adamc@1133: loop=$func_arith_result adamc@1133: verstring="$verstring_prefix$major.$iface:$verstring" adamc@1133: done adamc@1133: adamc@1133: # Before this point, $major must not contain `.'. adamc@1133: major=.$major adamc@1133: versuffix="$major.$revision" adamc@1133: ;; adamc@1133: adam@1826: linux) adamc@1133: func_arith $current - $age adamc@1133: major=.$func_arith_result adamc@1133: versuffix="$major.$age.$revision" adamc@1133: ;; adamc@1133: adamc@1133: osf) adamc@1133: func_arith $current - $age adamc@1133: major=.$func_arith_result adamc@1133: versuffix=".$current.$age.$revision" adamc@1133: verstring="$current.$age.$revision" adamc@1133: adamc@1133: # Add in all the interfaces that we are compatible with. adamc@1133: loop=$age adamc@1133: while test "$loop" -ne 0; do adamc@1133: func_arith $current - $loop adamc@1133: iface=$func_arith_result adamc@1133: func_arith $loop - 1 adamc@1133: loop=$func_arith_result adamc@1133: verstring="$verstring:${iface}.0" adamc@1133: done adamc@1133: adamc@1133: # Make executables depend on our current version. adam@1826: verstring="$verstring:${current}.0" adamc@1133: ;; adamc@1133: adamc@1133: qnx) adamc@1133: major=".$current" adamc@1133: versuffix=".$current" adamc@1133: ;; adamc@1133: adamc@1133: sunos) adamc@1133: major=".$current" adamc@1133: versuffix=".$current.$revision" adamc@1133: ;; adamc@1133: adamc@1133: windows) adamc@1133: # Use '-' rather than '.', since we only want one adamc@1133: # extension on DOS 8.3 filesystems. adamc@1133: func_arith $current - $age adamc@1133: major=$func_arith_result adamc@1133: versuffix="-$major" adamc@1133: ;; adamc@1133: adamc@1133: *) adamc@1133: func_fatal_configuration "unknown library version type \`$version_type'" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Clear the version info if we defaulted, and they specified a release. adamc@1133: if test -z "$vinfo" && test -n "$release"; then adamc@1133: major= adamc@1133: case $version_type in adamc@1133: darwin) adamc@1133: # we can't check for "0.0" in archive_cmds due to quoting adamc@1133: # problems, so we reset it completely adamc@1133: verstring= adamc@1133: ;; adamc@1133: *) adamc@1133: verstring="0.0" adamc@1133: ;; adamc@1133: esac adamc@1133: if test "$need_version" = no; then adamc@1133: versuffix= adamc@1133: else adamc@1133: versuffix=".0.0" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Remove version info from name if versioning should be avoided adamc@1133: if test "$avoid_version" = yes && test "$need_version" = no; then adamc@1133: major= adamc@1133: versuffix= adamc@1133: verstring="" adamc@1133: fi adamc@1133: adamc@1133: # Check to see if the archive will have undefined symbols. adamc@1133: if test "$allow_undefined" = yes; then adamc@1133: if test "$allow_undefined_flag" = unsupported; then adamc@1133: func_warning "undefined symbols not allowed in $host shared libraries" adamc@1133: build_libtool_libs=no adamc@1133: build_old_libs=yes adamc@1133: fi adamc@1133: else adamc@1133: # Don't allow undefined symbols. adamc@1133: allow_undefined_flag="$no_undefined_flag" adamc@1133: fi adamc@1133: adamc@1133: fi adamc@1133: adamc@1133: func_generate_dlsyms "$libname" "$libname" "yes" adam@1826: libobjs="$libobjs $symfileobj" adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: adam@1826: if test "$mode" != relink; then adamc@1133: # Remove our outputs, but don't remove object files since they adamc@1133: # may have been created when compiling PIC objects. adamc@1133: removelist= adamc@1133: tempremovelist=`$ECHO "$output_objdir/*"` adamc@1133: for p in $tempremovelist; do adamc@1133: case $p in adamc@1133: *.$objext | *.gcno) adamc@1133: ;; adamc@1133: $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) adamc@1133: if test "X$precious_files_regex" != "X"; then adamc@1133: if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 adamc@1133: then adamc@1133: continue adamc@1133: fi adamc@1133: fi adam@1826: removelist="$removelist $p" adamc@1133: ;; adamc@1133: *) ;; adamc@1133: esac adamc@1133: done adamc@1133: test -n "$removelist" && \ adamc@1133: func_show_eval "${RM}r \$removelist" adamc@1133: fi adamc@1133: adamc@1133: # Now set the variables for building old libraries. adamc@1133: if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then adam@1826: oldlibs="$oldlibs $output_objdir/$libname.$libext" adamc@1133: adamc@1133: # Transform .lo files to .o files. adam@1826: oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` adamc@1133: fi adamc@1133: adamc@1133: # Eliminate all temporary directories. adamc@1133: #for path in $notinst_path; do adam@1826: # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` adam@1826: # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` adam@1826: # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` adamc@1133: #done adamc@1133: adamc@1133: if test -n "$xrpath"; then adamc@1133: # If the user specified any rpath flags, then add them. adamc@1133: temp_xrpath= adamc@1133: for libdir in $xrpath; do adam@1826: temp_xrpath="$temp_xrpath -R$libdir" adamc@1133: case "$finalize_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) finalize_rpath="$finalize_rpath $libdir" ;; adamc@1133: esac adamc@1133: done adamc@1133: if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then adamc@1133: dependency_libs="$temp_xrpath $dependency_libs" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Make sure dlfiles contains only unique files that won't be dlpreopened adamc@1133: old_dlfiles="$dlfiles" adamc@1133: dlfiles= adamc@1133: for lib in $old_dlfiles; do adamc@1133: case " $dlprefiles $dlfiles " in adamc@1133: *" $lib "*) ;; adam@1826: *) dlfiles="$dlfiles $lib" ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: # Make sure dlprefiles contains only unique files adamc@1133: old_dlprefiles="$dlprefiles" adamc@1133: dlprefiles= adamc@1133: for lib in $old_dlprefiles; do adamc@1133: case "$dlprefiles " in adamc@1133: *" $lib "*) ;; adam@1826: *) dlprefiles="$dlprefiles $lib" ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: if test "$build_libtool_libs" = yes; then adamc@1133: if test -n "$rpath"; then adamc@1133: case $host in adam@1826: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) adamc@1133: # these systems don't actually have a c library (as such)! adamc@1133: ;; adamc@1133: *-*-rhapsody* | *-*-darwin1.[012]) adamc@1133: # Rhapsody C library is in the System framework adam@1826: deplibs="$deplibs System.ltframework" adamc@1133: ;; adamc@1133: *-*-netbsd*) adamc@1133: # Don't link with libc until the a.out ld.so is fixed. adamc@1133: ;; adamc@1133: *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) adamc@1133: # Do not include libc due to us having libc/libc_r. adamc@1133: ;; adamc@1133: *-*-sco3.2v5* | *-*-sco5v6*) adamc@1133: # Causes problems with __ctype adamc@1133: ;; adamc@1133: *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) adamc@1133: # Compiler inserts libc in the correct place for threads to work adamc@1133: ;; adamc@1133: *) adamc@1133: # Add libc to deplibs on all other systems if necessary. adamc@1133: if test "$build_libtool_need_lc" = "yes"; then adam@1826: deplibs="$deplibs -lc" adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: adamc@1133: # Transform deplibs into only deplibs that can be linked in shared. adamc@1133: name_save=$name adamc@1133: libname_save=$libname adamc@1133: release_save=$release adamc@1133: versuffix_save=$versuffix adamc@1133: major_save=$major adamc@1133: # I'm not sure if I'm treating the release correctly. I think adamc@1133: # release should show up in the -l (ie -lgmp5) so we don't want to adamc@1133: # add it in twice. Is that correct? adamc@1133: release="" adamc@1133: versuffix="" adamc@1133: major="" adamc@1133: newdeplibs= adamc@1133: droppeddeps=no adamc@1133: case $deplibs_check_method in adamc@1133: pass_all) adamc@1133: # Don't check for shared/static. Everything works. adamc@1133: # This might be a little naive. We might want to check adamc@1133: # whether the library exists or not. But this is on adamc@1133: # osf3 & osf4 and I'm not really sure... Just adamc@1133: # implementing what was already the behavior. adamc@1133: newdeplibs=$deplibs adamc@1133: ;; adamc@1133: test_compile) adamc@1133: # This code stresses the "libraries are programs" paradigm to its adamc@1133: # limits. Maybe even breaks it. We compile a program, linking it adamc@1133: # against the deplibs as a proxy for the library. Then we can check adamc@1133: # whether they linked in statically or dynamically with ldd. adamc@1133: $opt_dry_run || $RM conftest.c adamc@1133: cat > conftest.c </dev/null` adamc@1133: for potent_lib in $potential_libs; do adamc@1133: # Follow soft links. adamc@1133: if ls -lLd "$potent_lib" 2>/dev/null | adamc@1133: $GREP " -> " >/dev/null; then adamc@1133: continue adamc@1133: fi adamc@1133: # The statement above tries to avoid entering an adamc@1133: # endless loop below, in case of cyclic links. adamc@1133: # We might still enter an endless loop, since a link adamc@1133: # loop can be closed while we follow links, adamc@1133: # but so what? adamc@1133: potlib="$potent_lib" adamc@1133: while test -h "$potlib" 2>/dev/null; do adamc@1133: potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` adamc@1133: case $potliblink in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; adam@1826: *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; adamc@1133: esac adamc@1133: done adamc@1133: if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | adamc@1133: $SED -e 10q | adamc@1133: $EGREP "$file_magic_regex" > /dev/null; then adam@1826: newdeplibs="$newdeplibs $a_deplib" adamc@1133: a_deplib="" adamc@1133: break 2 adamc@1133: fi adamc@1133: done adamc@1133: done adamc@1133: fi adamc@1133: if test -n "$a_deplib" ; then adamc@1133: droppeddeps=yes adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." adam@1826: $ECHO "*** I have the capability to make that library automatically link in when" adam@1826: $ECHO "*** you link to this library. But I can only do this if you have a" adam@1826: $ECHO "*** shared version of the library, which you do not appear to have" adam@1826: $ECHO "*** because I did check the linker path looking for a file starting" adamc@1133: if test -z "$potlib" ; then adamc@1133: $ECHO "*** with $libname but no candidates were found. (...for file magic test)" adamc@1133: else adamc@1133: $ECHO "*** with $libname and none of the candidates passed a file format test" adamc@1133: $ECHO "*** using a file magic. Last file checked: $potlib" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: *) adamc@1133: # Add a -L argument. adam@1826: newdeplibs="$newdeplibs $a_deplib" adamc@1133: ;; adamc@1133: esac adamc@1133: done # Gone through all deplibs. adamc@1133: ;; adamc@1133: match_pattern*) adamc@1133: set dummy $deplibs_check_method; shift adamc@1133: match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` adamc@1133: for a_deplib in $deplibs; do adamc@1133: case $a_deplib in adamc@1133: -l*) adamc@1133: func_stripname -l '' "$a_deplib" adamc@1133: name=$func_stripname_result adamc@1133: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then adamc@1133: case " $predeps $postdeps " in adamc@1133: *" $a_deplib "*) adam@1826: newdeplibs="$newdeplibs $a_deplib" adamc@1133: a_deplib="" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: if test -n "$a_deplib" ; then adamc@1133: libname=`eval "\\$ECHO \"$libname_spec\""` adamc@1133: for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do adamc@1133: potential_libs=`ls $i/$libname[.-]* 2>/dev/null` adamc@1133: for potent_lib in $potential_libs; do adamc@1133: potlib="$potent_lib" # see symlink-check above in file_magic test adam@1826: if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ adamc@1133: $EGREP "$match_pattern_regex" > /dev/null; then adam@1826: newdeplibs="$newdeplibs $a_deplib" adamc@1133: a_deplib="" adamc@1133: break 2 adamc@1133: fi adamc@1133: done adamc@1133: done adamc@1133: fi adamc@1133: if test -n "$a_deplib" ; then adamc@1133: droppeddeps=yes adam@1826: $ECHO adamc@1133: $ECHO "*** Warning: linker path does not have real file for library $a_deplib." adam@1826: $ECHO "*** I have the capability to make that library automatically link in when" adam@1826: $ECHO "*** you link to this library. But I can only do this if you have a" adam@1826: $ECHO "*** shared version of the library, which you do not appear to have" adam@1826: $ECHO "*** because I did check the linker path looking for a file starting" adamc@1133: if test -z "$potlib" ; then adamc@1133: $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" adamc@1133: else adamc@1133: $ECHO "*** with $libname and none of the candidates passed a file format test" adamc@1133: $ECHO "*** using a regex pattern. Last file checked: $potlib" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: *) adamc@1133: # Add a -L argument. adam@1826: newdeplibs="$newdeplibs $a_deplib" adamc@1133: ;; adamc@1133: esac adamc@1133: done # Gone through all deplibs. adamc@1133: ;; adamc@1133: none | unknown | *) adamc@1133: newdeplibs="" adam@1826: tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ adam@1826: -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` adamc@1133: if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then adamc@1133: for i in $predeps $postdeps ; do adamc@1133: # can't use Xsed below, because $i might contain '/' adam@1826: tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` adamc@1133: done adamc@1133: fi adam@1826: if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | adam@1826: $GREP . >/dev/null; then adam@1826: $ECHO adamc@1133: if test "X$deplibs_check_method" = "Xnone"; then adam@1826: $ECHO "*** Warning: inter-library dependencies are not supported in this platform." adamc@1133: else adam@1826: $ECHO "*** Warning: inter-library dependencies are not known to be supported." adamc@1133: fi adam@1826: $ECHO "*** All declared inter-library dependencies are being dropped." adamc@1133: droppeddeps=yes adam@1826: fi adamc@1133: ;; adamc@1133: esac adamc@1133: versuffix=$versuffix_save adamc@1133: major=$major_save adamc@1133: release=$release_save adamc@1133: libname=$libname_save adamc@1133: name=$name_save adamc@1133: adamc@1133: case $host in adamc@1133: *-*-rhapsody* | *-*-darwin1.[012]) adamc@1133: # On Rhapsody replace the C library with the System framework adam@1826: newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: if test "$droppeddeps" = yes; then adamc@1133: if test "$module" = yes; then adam@1826: $ECHO adam@1826: $ECHO "*** Warning: libtool could not satisfy all declared inter-library" adamc@1133: $ECHO "*** dependencies of module $libname. Therefore, libtool will create" adam@1826: $ECHO "*** a static module, that should work as long as the dlopening" adam@1826: $ECHO "*** application is linked with the -dlopen flag." adamc@1133: if test -z "$global_symbol_pipe"; then adam@1826: $ECHO adam@1826: $ECHO "*** However, this would only work if libtool was able to extract symbol" adam@1826: $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" adam@1826: $ECHO "*** not find such a program. So, this module is probably useless." adam@1826: $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." adamc@1133: fi adamc@1133: if test "$build_old_libs" = no; then adamc@1133: oldlibs="$output_objdir/$libname.$libext" adamc@1133: build_libtool_libs=module adamc@1133: build_old_libs=yes adamc@1133: else adamc@1133: build_libtool_libs=no adamc@1133: fi adamc@1133: else adam@1826: $ECHO "*** The inter-library dependencies that have been dropped here will be" adam@1826: $ECHO "*** automatically added whenever a program is linked with this library" adam@1826: $ECHO "*** or is declared to -dlopen it." adamc@1133: adamc@1133: if test "$allow_undefined" = no; then adam@1826: $ECHO adam@1826: $ECHO "*** Since this library must not contain undefined symbols," adam@1826: $ECHO "*** because either the platform does not support them or" adam@1826: $ECHO "*** it was explicitly requested with -no-undefined," adam@1826: $ECHO "*** libtool will only create a static version of it." adamc@1133: if test "$build_old_libs" = no; then adamc@1133: oldlibs="$output_objdir/$libname.$libext" adamc@1133: build_libtool_libs=module adamc@1133: build_old_libs=yes adamc@1133: else adamc@1133: build_libtool_libs=no adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: # Done checking deplibs! adamc@1133: deplibs=$newdeplibs adamc@1133: fi adamc@1133: # Time to change all our "foo.ltframework" stuff back to "-framework foo" adamc@1133: case $host in adamc@1133: *-*-darwin*) adam@1826: newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adam@1826: new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adam@1826: deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # move library search paths that coincide with paths to not yet adamc@1133: # installed libraries to the beginning of the library search list adamc@1133: new_libs= adamc@1133: for path in $notinst_path; do adamc@1133: case " $new_libs " in adamc@1133: *" -L$path/$objdir "*) ;; adamc@1133: *) adamc@1133: case " $deplibs " in adamc@1133: *" -L$path/$objdir "*) adam@1826: new_libs="$new_libs -L$path/$objdir" ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: for deplib in $deplibs; do adamc@1133: case $deplib in adamc@1133: -L*) adamc@1133: case " $new_libs " in adamc@1133: *" $deplib "*) ;; adam@1826: *) new_libs="$new_libs $deplib" ;; adamc@1133: esac adamc@1133: ;; adam@1826: *) new_libs="$new_libs $deplib" ;; adamc@1133: esac adamc@1133: done adamc@1133: deplibs="$new_libs" adamc@1133: adamc@1133: # All the library-specific variables (install_libdir is set above). adamc@1133: library_names= adamc@1133: old_library= adamc@1133: dlname= adamc@1133: adamc@1133: # Test again, we may have decided not to build it any more adamc@1133: if test "$build_libtool_libs" = yes; then adamc@1133: if test "$hardcode_into_libs" = yes; then adamc@1133: # Hardcode the library paths adamc@1133: hardcode_libdirs= adamc@1133: dep_rpath= adamc@1133: rpath="$finalize_rpath" adam@1826: test "$mode" != relink && rpath="$compile_rpath$rpath" adamc@1133: for libdir in $rpath; do adamc@1133: if test -n "$hardcode_libdir_flag_spec"; then adamc@1133: if test -n "$hardcode_libdir_separator"; then adamc@1133: if test -z "$hardcode_libdirs"; then adamc@1133: hardcode_libdirs="$libdir" adamc@1133: else adamc@1133: # Just accumulate the unique libdirs. adamc@1133: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in adamc@1133: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) adamc@1133: ;; adamc@1133: *) adam@1826: hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: else adamc@1133: eval flag=\"$hardcode_libdir_flag_spec\" adam@1826: dep_rpath="$dep_rpath $flag" adamc@1133: fi adamc@1133: elif test -n "$runpath_var"; then adamc@1133: case "$perm_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) perm_rpath="$perm_rpath $libdir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: done adamc@1133: # Substitute the hardcoded libdirs into the rpath. adamc@1133: if test -n "$hardcode_libdir_separator" && adamc@1133: test -n "$hardcode_libdirs"; then adamc@1133: libdir="$hardcode_libdirs" adam@1826: if test -n "$hardcode_libdir_flag_spec_ld"; then adam@1826: eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" adam@1826: else adam@1826: eval dep_rpath=\"$hardcode_libdir_flag_spec\" adam@1826: fi adamc@1133: fi adamc@1133: if test -n "$runpath_var" && test -n "$perm_rpath"; then adamc@1133: # We should set the runpath_var. adamc@1133: rpath= adamc@1133: for dir in $perm_rpath; do adam@1826: rpath="$rpath$dir:" adamc@1133: done adamc@1133: eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" adamc@1133: fi adamc@1133: test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" adamc@1133: fi adamc@1133: adamc@1133: shlibpath="$finalize_shlibpath" adam@1826: test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" adamc@1133: if test -n "$shlibpath"; then adamc@1133: eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" adamc@1133: fi adamc@1133: adamc@1133: # Get the real and link names of the library. adamc@1133: eval shared_ext=\"$shrext_cmds\" adamc@1133: eval library_names=\"$library_names_spec\" adamc@1133: set dummy $library_names adamc@1133: shift adamc@1133: realname="$1" adamc@1133: shift adamc@1133: adamc@1133: if test -n "$soname_spec"; then adamc@1133: eval soname=\"$soname_spec\" adamc@1133: else adamc@1133: soname="$realname" adamc@1133: fi adamc@1133: if test -z "$dlname"; then adamc@1133: dlname=$soname adamc@1133: fi adamc@1133: adamc@1133: lib="$output_objdir/$realname" adamc@1133: linknames= adamc@1133: for link adamc@1133: do adam@1826: linknames="$linknames $link" adamc@1133: done adamc@1133: adamc@1133: # Use standard objects if they are pic adam@1826: test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: adamc@1133: delfiles= adamc@1133: if test -n "$export_symbols" && test -n "$include_expsyms"; then adamc@1133: $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" adamc@1133: export_symbols="$output_objdir/$libname.uexp" adam@1826: delfiles="$delfiles $export_symbols" adamc@1133: fi adamc@1133: adamc@1133: orig_export_symbols= adamc@1133: case $host_os in adamc@1133: cygwin* | mingw* | cegcc*) adamc@1133: if test -n "$export_symbols" && test -z "$export_symbols_regex"; then adamc@1133: # exporting using user supplied symfile adamc@1133: if test "x`$SED 1q $export_symbols`" != xEXPORTS; then adamc@1133: # and it's NOT already a .def file. Must figure out adamc@1133: # which of the given symbols are data symbols and tag adamc@1133: # them as such. So, trigger use of export_symbols_cmds. adamc@1133: # export_symbols gets reassigned inside the "prepare adamc@1133: # the list of exported symbols" if statement, so the adamc@1133: # include_expsyms logic still works. adamc@1133: orig_export_symbols="$export_symbols" adamc@1133: export_symbols= adamc@1133: always_export_symbols=yes adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Prepare the list of exported symbols adamc@1133: if test -z "$export_symbols"; then adamc@1133: if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then adamc@1133: func_verbose "generating symbol list for \`$libname.la'" adamc@1133: export_symbols="$output_objdir/$libname.exp" adamc@1133: $opt_dry_run || $RM $export_symbols adamc@1133: cmds=$export_symbols_cmds adamc@1133: save_ifs="$IFS"; IFS='~' adam@1826: for cmd in $cmds; do adamc@1133: IFS="$save_ifs" adam@1826: eval cmd=\"$cmd\" adam@1826: func_len " $cmd" adam@1826: len=$func_len_result adam@1826: if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then adamc@1133: func_show_eval "$cmd" 'exit $?' adamc@1133: skipped_export=false adamc@1133: else adamc@1133: # The command line is too long to execute in one step. adamc@1133: func_verbose "using reloadable object file for export list..." adamc@1133: skipped_export=: adamc@1133: # Break out early, otherwise skipped_export may be adamc@1133: # set to false by a later but shorter cmd. adamc@1133: break adamc@1133: fi adamc@1133: done adamc@1133: IFS="$save_ifs" adamc@1133: if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then adamc@1133: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' adamc@1133: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test -n "$export_symbols" && test -n "$include_expsyms"; then adamc@1133: tmp_export_symbols="$export_symbols" adamc@1133: test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" adam@1826: $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' adamc@1133: fi adamc@1133: adamc@1133: if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then adamc@1133: # The given exports_symbols file has to be filtered, so filter it. adamc@1133: func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" adamc@1133: # FIXME: $output_objdir/$libname.filter potentially contains lots of adamc@1133: # 's' commands which not all seds can handle. GNU sed should be fine adamc@1133: # though. Also, the filter scales superlinearly with the number of adamc@1133: # global variables. join(1) would be nice here, but unfortunately adamc@1133: # isn't a blessed tool. adamc@1133: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter adam@1826: delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" adamc@1133: export_symbols=$output_objdir/$libname.def adamc@1133: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols adamc@1133: fi adamc@1133: adamc@1133: tmp_deplibs= adamc@1133: for test_deplib in $deplibs; do adamc@1133: case " $convenience " in adamc@1133: *" $test_deplib "*) ;; adamc@1133: *) adam@1826: tmp_deplibs="$tmp_deplibs $test_deplib" adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: deplibs="$tmp_deplibs" adamc@1133: adamc@1133: if test -n "$convenience"; then adamc@1133: if test -n "$whole_archive_flag_spec" && adamc@1133: test "$compiler_needs_object" = yes && adamc@1133: test -z "$libobjs"; then adamc@1133: # extract the archives, so we have objects to list. adamc@1133: # TODO: could optimize this to just extract one archive. adamc@1133: whole_archive_flag_spec= adamc@1133: fi adamc@1133: if test -n "$whole_archive_flag_spec"; then adamc@1133: save_libobjs=$libobjs adamc@1133: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: else adamc@1133: gentop="$output_objdir/${outputname}x" adam@1826: generated="$generated $gentop" adamc@1133: adamc@1133: func_extract_archives $gentop $convenience adam@1826: libobjs="$libobjs $func_extract_archives_result" adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then adamc@1133: eval flag=\"$thread_safe_flag_spec\" adam@1826: linker_flags="$linker_flags $flag" adamc@1133: fi adamc@1133: adamc@1133: # Make a backup of the uninstalled library when relinking adam@1826: if test "$mode" = relink; then adamc@1133: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? adamc@1133: fi adamc@1133: adamc@1133: # Do each of the archive commands. adamc@1133: if test "$module" = yes && test -n "$module_cmds" ; then adamc@1133: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then adamc@1133: eval test_cmds=\"$module_expsym_cmds\" adamc@1133: cmds=$module_expsym_cmds adamc@1133: else adamc@1133: eval test_cmds=\"$module_cmds\" adamc@1133: cmds=$module_cmds adamc@1133: fi adamc@1133: else adamc@1133: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then adamc@1133: eval test_cmds=\"$archive_expsym_cmds\" adamc@1133: cmds=$archive_expsym_cmds adamc@1133: else adamc@1133: eval test_cmds=\"$archive_cmds\" adamc@1133: cmds=$archive_cmds adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test "X$skipped_export" != "X:" && adamc@1133: func_len " $test_cmds" && adamc@1133: len=$func_len_result && adamc@1133: test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then adamc@1133: : adamc@1133: else adamc@1133: # The command line is too long to link in one step, link piecewise adamc@1133: # or, if using GNU ld and skipped_export is not :, use a linker adamc@1133: # script. adamc@1133: adamc@1133: # Save the value of $output and $libobjs because we want to adamc@1133: # use them later. If we have whole_archive_flag_spec, we adamc@1133: # want to use save_libobjs as it was before adamc@1133: # whole_archive_flag_spec was expanded, because we can't adamc@1133: # assume the linker understands whole_archive_flag_spec. adamc@1133: # This may have to be revisited, in case too many adamc@1133: # convenience libraries get linked in and end up exceeding adamc@1133: # the spec. adamc@1133: if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then adamc@1133: save_libobjs=$libobjs adamc@1133: fi adamc@1133: save_output=$output adam@1826: output_la=`$ECHO "X$output" | $Xsed -e "$basename"` adamc@1133: adamc@1133: # Clear the reloadable object creation command queue and adamc@1133: # initialize k to one. adamc@1133: test_cmds= adamc@1133: concat_cmds= adamc@1133: objlist= adamc@1133: last_robj= adamc@1133: k=1 adamc@1133: adamc@1133: if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then adamc@1133: output=${output_objdir}/${output_la}.lnkscript adamc@1133: func_verbose "creating GNU ld script: $output" adam@1826: $ECHO 'INPUT (' > $output adamc@1133: for obj in $save_libobjs adamc@1133: do adam@1826: $ECHO "$obj" >> $output adamc@1133: done adam@1826: $ECHO ')' >> $output adam@1826: delfiles="$delfiles $output" adamc@1133: elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then adamc@1133: output=${output_objdir}/${output_la}.lnk adamc@1133: func_verbose "creating linker input file list: $output" adamc@1133: : > $output adamc@1133: set x $save_libobjs adamc@1133: shift adamc@1133: firstobj= adamc@1133: if test "$compiler_needs_object" = yes; then adamc@1133: firstobj="$1 " adamc@1133: shift adamc@1133: fi adamc@1133: for obj adamc@1133: do adam@1826: $ECHO "$obj" >> $output adamc@1133: done adam@1826: delfiles="$delfiles $output" adam@1826: output=$firstobj\"$file_list_spec$output\" adamc@1133: else adamc@1133: if test -n "$save_libobjs"; then adamc@1133: func_verbose "creating reloadable object files..." adamc@1133: output=$output_objdir/$output_la-${k}.$objext adamc@1133: eval test_cmds=\"$reload_cmds\" adamc@1133: func_len " $test_cmds" adamc@1133: len0=$func_len_result adamc@1133: len=$len0 adamc@1133: adamc@1133: # Loop over the list of objects to be linked. adamc@1133: for obj in $save_libobjs adamc@1133: do adamc@1133: func_len " $obj" adamc@1133: func_arith $len + $func_len_result adamc@1133: len=$func_arith_result adamc@1133: if test "X$objlist" = X || adamc@1133: test "$len" -lt "$max_cmd_len"; then adamc@1133: func_append objlist " $obj" adamc@1133: else adamc@1133: # The command $test_cmds is almost too long, add a adamc@1133: # command to the queue. adamc@1133: if test "$k" -eq 1 ; then adamc@1133: # The first file doesn't have a previous command to add. adam@1826: eval concat_cmds=\"$reload_cmds $objlist $last_robj\" adamc@1133: else adamc@1133: # All subsequent reloadable object files will link in adamc@1133: # the last one created. adam@1826: eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" adamc@1133: fi adamc@1133: last_robj=$output_objdir/$output_la-${k}.$objext adamc@1133: func_arith $k + 1 adamc@1133: k=$func_arith_result adamc@1133: output=$output_objdir/$output_la-${k}.$objext adam@1826: objlist=$obj adamc@1133: func_len " $last_robj" adamc@1133: func_arith $len0 + $func_len_result adamc@1133: len=$func_arith_result adamc@1133: fi adamc@1133: done adamc@1133: # Handle the remaining objects by creating one last adamc@1133: # reloadable object file. All subsequent reloadable object adamc@1133: # files will link in the last one created. adamc@1133: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ adam@1826: eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" adamc@1133: if test -n "$last_robj"; then adamc@1133: eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" adamc@1133: fi adam@1826: delfiles="$delfiles $output" adamc@1133: adamc@1133: else adamc@1133: output= adamc@1133: fi adamc@1133: adamc@1133: if ${skipped_export-false}; then adamc@1133: func_verbose "generating symbol list for \`$libname.la'" adamc@1133: export_symbols="$output_objdir/$libname.exp" adamc@1133: $opt_dry_run || $RM $export_symbols adamc@1133: libobjs=$output adamc@1133: # Append the command to create the export file. adamc@1133: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ adamc@1133: eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" adamc@1133: if test -n "$last_robj"; then adamc@1133: eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: test -n "$save_libobjs" && adamc@1133: func_verbose "creating a temporary reloadable object file: $output" adamc@1133: adamc@1133: # Loop through the commands generated above and execute them. adamc@1133: save_ifs="$IFS"; IFS='~' adamc@1133: for cmd in $concat_cmds; do adamc@1133: IFS="$save_ifs" adamc@1133: $opt_silent || { adamc@1133: func_quote_for_expand "$cmd" adamc@1133: eval "func_echo $func_quote_for_expand_result" adamc@1133: } adamc@1133: $opt_dry_run || eval "$cmd" || { adamc@1133: lt_exit=$? adamc@1133: adamc@1133: # Restore the uninstalled library and exit adam@1826: if test "$mode" = relink; then adamc@1133: ( cd "$output_objdir" && \ adamc@1133: $RM "${realname}T" && \ adamc@1133: $MV "${realname}U" "$realname" ) adamc@1133: fi adamc@1133: adamc@1133: exit $lt_exit adamc@1133: } adamc@1133: done adamc@1133: IFS="$save_ifs" adamc@1133: adamc@1133: if test -n "$export_symbols_regex" && ${skipped_export-false}; then adamc@1133: func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' adamc@1133: func_show_eval '$MV "${export_symbols}T" "$export_symbols"' adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if ${skipped_export-false}; then adamc@1133: if test -n "$export_symbols" && test -n "$include_expsyms"; then adamc@1133: tmp_export_symbols="$export_symbols" adamc@1133: test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" adam@1826: $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' adamc@1133: fi adamc@1133: adamc@1133: if test -n "$orig_export_symbols"; then adamc@1133: # The given exports_symbols file has to be filtered, so filter it. adamc@1133: func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" adamc@1133: # FIXME: $output_objdir/$libname.filter potentially contains lots of adamc@1133: # 's' commands which not all seds can handle. GNU sed should be fine adamc@1133: # though. Also, the filter scales superlinearly with the number of adamc@1133: # global variables. join(1) would be nice here, but unfortunately adamc@1133: # isn't a blessed tool. adamc@1133: $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter adam@1826: delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" adamc@1133: export_symbols=$output_objdir/$libname.def adamc@1133: $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: libobjs=$output adamc@1133: # Restore the value of output. adamc@1133: output=$save_output adamc@1133: adamc@1133: if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then adamc@1133: eval libobjs=\"\$libobjs $whole_archive_flag_spec\" adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: fi adamc@1133: # Expand the library linking commands again to reset the adamc@1133: # value of $libobjs for piecewise linking. adamc@1133: adamc@1133: # Do each of the archive commands. adamc@1133: if test "$module" = yes && test -n "$module_cmds" ; then adamc@1133: if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then adamc@1133: cmds=$module_expsym_cmds adamc@1133: else adamc@1133: cmds=$module_cmds adamc@1133: fi adamc@1133: else adamc@1133: if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then adamc@1133: cmds=$archive_expsym_cmds adamc@1133: else adamc@1133: cmds=$archive_cmds adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test -n "$delfiles"; then adamc@1133: # Append the command to remove temporary files to $cmds. adamc@1133: eval cmds=\"\$cmds~\$RM $delfiles\" adamc@1133: fi adamc@1133: adamc@1133: # Add any objects from preloaded convenience libraries adamc@1133: if test -n "$dlprefiles"; then adamc@1133: gentop="$output_objdir/${outputname}x" adam@1826: generated="$generated $gentop" adamc@1133: adamc@1133: func_extract_archives $gentop $dlprefiles adam@1826: libobjs="$libobjs $func_extract_archives_result" adamc@1133: test "X$libobjs" = "X " && libobjs= adamc@1133: fi adamc@1133: adamc@1133: save_ifs="$IFS"; IFS='~' adamc@1133: for cmd in $cmds; do adamc@1133: IFS="$save_ifs" adamc@1133: eval cmd=\"$cmd\" adamc@1133: $opt_silent || { adamc@1133: func_quote_for_expand "$cmd" adamc@1133: eval "func_echo $func_quote_for_expand_result" adamc@1133: } adamc@1133: $opt_dry_run || eval "$cmd" || { adamc@1133: lt_exit=$? adamc@1133: adamc@1133: # Restore the uninstalled library and exit adam@1826: if test "$mode" = relink; then adamc@1133: ( cd "$output_objdir" && \ adamc@1133: $RM "${realname}T" && \ adamc@1133: $MV "${realname}U" "$realname" ) adamc@1133: fi adamc@1133: adamc@1133: exit $lt_exit adamc@1133: } adamc@1133: done adamc@1133: IFS="$save_ifs" adamc@1133: adamc@1133: # Restore the uninstalled library and exit adam@1826: if test "$mode" = relink; then adamc@1133: $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? adamc@1133: adamc@1133: if test -n "$convenience"; then adamc@1133: if test -z "$whole_archive_flag_spec"; then adamc@1133: func_show_eval '${RM}r "$gentop"' adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: adamc@1133: # Create links to the real library. adamc@1133: for linkname in $linknames; do adamc@1133: if test "$realname" != "$linkname"; then adamc@1133: func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' adamc@1133: fi adamc@1133: done adamc@1133: adamc@1133: # If -module or -export-dynamic was specified, set the dlname. adamc@1133: if test "$module" = yes || test "$export_dynamic" = yes; then adamc@1133: # On all known operating systems, these are identical. adamc@1133: dlname="$soname" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: adamc@1133: obj) adamc@1133: if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then adamc@1133: func_warning "\`-dlopen' is ignored for objects" adamc@1133: fi adamc@1133: adamc@1133: case " $deplibs" in adamc@1133: *\ -l* | *\ -L*) adamc@1133: func_warning "\`-l' and \`-L' are ignored for objects" ;; adamc@1133: esac adamc@1133: adamc@1133: test -n "$rpath" && \ adamc@1133: func_warning "\`-rpath' is ignored for objects" adamc@1133: adamc@1133: test -n "$xrpath" && \ adamc@1133: func_warning "\`-R' is ignored for objects" adamc@1133: adamc@1133: test -n "$vinfo" && \ adamc@1133: func_warning "\`-version-info' is ignored for objects" adamc@1133: adamc@1133: test -n "$release" && \ adamc@1133: func_warning "\`-release' is ignored for objects" adamc@1133: adamc@1133: case $output in adamc@1133: *.lo) adamc@1133: test -n "$objs$old_deplibs" && \ adamc@1133: func_fatal_error "cannot build library object \`$output' from non-libtool objects" adamc@1133: adamc@1133: libobj=$output adamc@1133: func_lo2o "$libobj" adamc@1133: obj=$func_lo2o_result adamc@1133: ;; adamc@1133: *) adamc@1133: libobj= adamc@1133: obj="$output" adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # Delete the old objects. adamc@1133: $opt_dry_run || $RM $obj $libobj adamc@1133: adamc@1133: # Objects from convenience libraries. This assumes adamc@1133: # single-version convenience libraries. Whenever we create adamc@1133: # different ones for PIC/non-PIC, this we'll have to duplicate adamc@1133: # the extraction. adamc@1133: reload_conv_objs= adamc@1133: gentop= adamc@1133: # reload_cmds runs $LD directly, so let us get rid of adamc@1133: # -Wl from whole_archive_flag_spec and hope we can get by with adamc@1133: # turning comma into space.. adamc@1133: wl= adamc@1133: adamc@1133: if test -n "$convenience"; then adamc@1133: if test -n "$whole_archive_flag_spec"; then adamc@1133: eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" adam@1826: reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` adamc@1133: else adamc@1133: gentop="$output_objdir/${obj}x" adam@1826: generated="$generated $gentop" adamc@1133: adamc@1133: func_extract_archives $gentop $convenience adamc@1133: reload_conv_objs="$reload_objs $func_extract_archives_result" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Create the old-style object. adam@1826: reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test adamc@1133: adamc@1133: output="$obj" adamc@1133: func_execute_cmds "$reload_cmds" 'exit $?' adamc@1133: adamc@1133: # Exit if we aren't doing a library object file. adamc@1133: if test -z "$libobj"; then adamc@1133: if test -n "$gentop"; then adamc@1133: func_show_eval '${RM}r "$gentop"' adamc@1133: fi adamc@1133: adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: adamc@1133: if test "$build_libtool_libs" != yes; then adamc@1133: if test -n "$gentop"; then adamc@1133: func_show_eval '${RM}r "$gentop"' adamc@1133: fi adamc@1133: adamc@1133: # Create an invalid libtool object if no PIC, so that we don't adamc@1133: # accidentally link it into a program. adamc@1133: # $show "echo timestamp > $libobj" adamc@1133: # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: adamc@1133: if test -n "$pic_flag" || test "$pic_mode" != default; then adamc@1133: # Only do commands if we really have different PIC objects. adamc@1133: reload_objs="$libobjs $reload_conv_objs" adamc@1133: output="$libobj" adamc@1133: func_execute_cmds "$reload_cmds" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: if test -n "$gentop"; then adamc@1133: func_show_eval '${RM}r "$gentop"' adamc@1133: fi adamc@1133: adamc@1133: exit $EXIT_SUCCESS adamc@1133: ;; adamc@1133: adamc@1133: prog) adamc@1133: case $host in adamc@1133: *cygwin*) func_stripname '' '.exe' "$output" adamc@1133: output=$func_stripname_result.exe;; adamc@1133: esac adamc@1133: test -n "$vinfo" && \ adamc@1133: func_warning "\`-version-info' is ignored for programs" adamc@1133: adamc@1133: test -n "$release" && \ adamc@1133: func_warning "\`-release' is ignored for programs" adamc@1133: adamc@1133: test "$preload" = yes \ adamc@1133: && test "$dlopen_support" = unknown \ adamc@1133: && test "$dlopen_self" = unknown \ adamc@1133: && test "$dlopen_self_static" = unknown && \ adamc@1133: func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." adamc@1133: adamc@1133: case $host in adamc@1133: *-*-rhapsody* | *-*-darwin1.[012]) adamc@1133: # On Rhapsody replace the C library is the System framework adam@1826: compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` adam@1826: finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: case $host in adamc@1133: *-*-darwin*) adamc@1133: # Don't allow lazy linking, it breaks C++ global constructors adamc@1133: # But is supposedly fixed on 10.4 or later (yay!). adamc@1133: if test "$tagname" = CXX ; then adamc@1133: case ${MACOSX_DEPLOYMENT_TARGET-10.0} in adamc@1133: 10.[0123]) adam@1826: compile_command="$compile_command ${wl}-bind_at_load" adam@1826: finalize_command="$finalize_command ${wl}-bind_at_load" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: # Time to change all our "foo.ltframework" stuff back to "-framework foo" adam@1826: compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adam@1826: finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: adamc@1133: # move library search paths that coincide with paths to not yet adamc@1133: # installed libraries to the beginning of the library search list adamc@1133: new_libs= adamc@1133: for path in $notinst_path; do adamc@1133: case " $new_libs " in adamc@1133: *" -L$path/$objdir "*) ;; adamc@1133: *) adamc@1133: case " $compile_deplibs " in adamc@1133: *" -L$path/$objdir "*) adam@1826: new_libs="$new_libs -L$path/$objdir" ;; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: for deplib in $compile_deplibs; do adamc@1133: case $deplib in adamc@1133: -L*) adamc@1133: case " $new_libs " in adamc@1133: *" $deplib "*) ;; adam@1826: *) new_libs="$new_libs $deplib" ;; adamc@1133: esac adamc@1133: ;; adam@1826: *) new_libs="$new_libs $deplib" ;; adamc@1133: esac adamc@1133: done adamc@1133: compile_deplibs="$new_libs" adamc@1133: adamc@1133: adam@1826: compile_command="$compile_command $compile_deplibs" adam@1826: finalize_command="$finalize_command $finalize_deplibs" adamc@1133: adamc@1133: if test -n "$rpath$xrpath"; then adamc@1133: # If the user specified any rpath flags, then add them. adamc@1133: for libdir in $rpath $xrpath; do adamc@1133: # This is the magic to use -rpath. adamc@1133: case "$finalize_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) finalize_rpath="$finalize_rpath $libdir" ;; adamc@1133: esac adamc@1133: done adamc@1133: fi adamc@1133: adamc@1133: # Now hardcode the library paths adamc@1133: rpath= adamc@1133: hardcode_libdirs= adamc@1133: for libdir in $compile_rpath $finalize_rpath; do adamc@1133: if test -n "$hardcode_libdir_flag_spec"; then adamc@1133: if test -n "$hardcode_libdir_separator"; then adamc@1133: if test -z "$hardcode_libdirs"; then adamc@1133: hardcode_libdirs="$libdir" adamc@1133: else adamc@1133: # Just accumulate the unique libdirs. adamc@1133: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in adamc@1133: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) adamc@1133: ;; adamc@1133: *) adam@1826: hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: else adamc@1133: eval flag=\"$hardcode_libdir_flag_spec\" adam@1826: rpath="$rpath $flag" adamc@1133: fi adamc@1133: elif test -n "$runpath_var"; then adamc@1133: case "$perm_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) perm_rpath="$perm_rpath $libdir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: case $host in adamc@1133: *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) adamc@1133: testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` adamc@1133: case :$dllsearchpath: in adamc@1133: *":$libdir:"*) ;; adamc@1133: ::) dllsearchpath=$libdir;; adam@1826: *) dllsearchpath="$dllsearchpath:$libdir";; adamc@1133: esac adamc@1133: case :$dllsearchpath: in adamc@1133: *":$testbindir:"*) ;; adamc@1133: ::) dllsearchpath=$testbindir;; adam@1826: *) dllsearchpath="$dllsearchpath:$testbindir";; adamc@1133: esac adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: # Substitute the hardcoded libdirs into the rpath. adamc@1133: if test -n "$hardcode_libdir_separator" && adamc@1133: test -n "$hardcode_libdirs"; then adamc@1133: libdir="$hardcode_libdirs" adamc@1133: eval rpath=\" $hardcode_libdir_flag_spec\" adamc@1133: fi adamc@1133: compile_rpath="$rpath" adamc@1133: adamc@1133: rpath= adamc@1133: hardcode_libdirs= adamc@1133: for libdir in $finalize_rpath; do adamc@1133: if test -n "$hardcode_libdir_flag_spec"; then adamc@1133: if test -n "$hardcode_libdir_separator"; then adamc@1133: if test -z "$hardcode_libdirs"; then adamc@1133: hardcode_libdirs="$libdir" adamc@1133: else adamc@1133: # Just accumulate the unique libdirs. adamc@1133: case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in adamc@1133: *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) adamc@1133: ;; adamc@1133: *) adam@1826: hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: else adamc@1133: eval flag=\"$hardcode_libdir_flag_spec\" adam@1826: rpath="$rpath $flag" adamc@1133: fi adamc@1133: elif test -n "$runpath_var"; then adamc@1133: case "$finalize_perm_rpath " in adamc@1133: *" $libdir "*) ;; adam@1826: *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: done adamc@1133: # Substitute the hardcoded libdirs into the rpath. adamc@1133: if test -n "$hardcode_libdir_separator" && adamc@1133: test -n "$hardcode_libdirs"; then adamc@1133: libdir="$hardcode_libdirs" adamc@1133: eval rpath=\" $hardcode_libdir_flag_spec\" adamc@1133: fi adamc@1133: finalize_rpath="$rpath" adamc@1133: adamc@1133: if test -n "$libobjs" && test "$build_old_libs" = yes; then adamc@1133: # Transform all the library objects into standard objects. adam@1826: compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` adam@1826: finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` adamc@1133: fi adamc@1133: adamc@1133: func_generate_dlsyms "$outputname" "@PROGRAM@" "no" adamc@1133: adamc@1133: # template prelinking step adamc@1133: if test -n "$prelink_cmds"; then adamc@1133: func_execute_cmds "$prelink_cmds" 'exit $?' adamc@1133: fi adamc@1133: adamc@1133: wrappers_required=yes adamc@1133: case $host in adamc@1133: *cygwin* | *mingw* ) adamc@1133: if test "$build_libtool_libs" != yes; then adamc@1133: wrappers_required=no adamc@1133: fi adamc@1133: ;; adam@1826: *cegcc) adam@1826: # Disable wrappers for cegcc, we are cross compiling anyway. adam@1826: wrappers_required=no adam@1826: ;; adamc@1133: *) adamc@1133: if test "$need_relink" = no || test "$build_libtool_libs" != yes; then adamc@1133: wrappers_required=no adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: if test "$wrappers_required" = no; then adamc@1133: # Replace the output file specification. adam@1826: compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` adamc@1133: link_command="$compile_command$compile_rpath" adamc@1133: adamc@1133: # We have no uninstalled library dependencies, so finalize right now. adamc@1133: exit_status=0 adamc@1133: func_show_eval "$link_command" 'exit_status=$?' adamc@1133: adamc@1133: # Delete the generated files. adamc@1133: if test -f "$output_objdir/${outputname}S.${objext}"; then adamc@1133: func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' adamc@1133: fi adamc@1133: adamc@1133: exit $exit_status adamc@1133: fi adamc@1133: adamc@1133: if test -n "$compile_shlibpath$finalize_shlibpath"; then adamc@1133: compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" adamc@1133: fi adamc@1133: if test -n "$finalize_shlibpath"; then adamc@1133: finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" adamc@1133: fi adamc@1133: adamc@1133: compile_var= adamc@1133: finalize_var= adamc@1133: if test -n "$runpath_var"; then adamc@1133: if test -n "$perm_rpath"; then adamc@1133: # We should set the runpath_var. adamc@1133: rpath= adamc@1133: for dir in $perm_rpath; do adam@1826: rpath="$rpath$dir:" adamc@1133: done adamc@1133: compile_var="$runpath_var=\"$rpath\$$runpath_var\" " adamc@1133: fi adamc@1133: if test -n "$finalize_perm_rpath"; then adamc@1133: # We should set the runpath_var. adamc@1133: rpath= adamc@1133: for dir in $finalize_perm_rpath; do adam@1826: rpath="$rpath$dir:" adamc@1133: done adamc@1133: finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: if test "$no_install" = yes; then adamc@1133: # We don't need to create a wrapper script. adamc@1133: link_command="$compile_var$compile_command$compile_rpath" adamc@1133: # Replace the output file specification. adam@1826: link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` adamc@1133: # Delete the old output file. adamc@1133: $opt_dry_run || $RM $output adamc@1133: # Link the executable and exit adamc@1133: func_show_eval "$link_command" 'exit $?' adamc@1133: exit $EXIT_SUCCESS adamc@1133: fi adamc@1133: adamc@1133: if test "$hardcode_action" = relink; then adamc@1133: # Fast installation is not supported adamc@1133: link_command="$compile_var$compile_command$compile_rpath" adamc@1133: relink_command="$finalize_var$finalize_command$finalize_rpath" adamc@1133: adamc@1133: func_warning "this platform does not like uninstalled shared libraries" adamc@1133: func_warning "\`$output' will be relinked during installation" adamc@1133: else adamc@1133: if test "$fast_install" != no; then adamc@1133: link_command="$finalize_var$compile_command$finalize_rpath" adamc@1133: if test "$fast_install" = yes; then adam@1826: relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` adamc@1133: else adamc@1133: # fast_install is set to needless adamc@1133: relink_command= adamc@1133: fi adamc@1133: else adamc@1133: link_command="$compile_var$compile_command$compile_rpath" adamc@1133: relink_command="$finalize_var$finalize_command$finalize_rpath" adamc@1133: fi adamc@1133: fi adamc@1133: adamc@1133: # Replace the output file specification. adam@1826: link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` adamc@1133: adamc@1133: # Delete the old output files. adamc@1133: $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname adamc@1133: adamc@1133: func_show_eval "$link_command" 'exit $?' adamc@1133: adamc@1133: # Now create the wrapper script. adamc@1133: func_verbose "creating $output" adamc@1133: adamc@1133: # Quote the relink command for shipping. adamc@1133: if test -n "$relink_command"; then adamc@1133: # Preserve any variables that may affect compiler behavior adamc@1133: for var in $variables_saved_for_relink; do adamc@1133: if eval test -z \"\${$var+set}\"; then adamc@1133: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" adamc@1133: elif eval var_value=\$$var; test -z "$var_value"; then adamc@1133: relink_command="$var=; export $var; $relink_command" adamc@1133: else adamc@1133: func_quote_for_eval "$var_value" adamc@1133: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" adamc@1133: fi adamc@1133: done adamc@1133: relink_command="(cd `pwd`; $relink_command)" adam@1826: relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` adam@1826: fi adam@1826: adam@1826: # Quote $ECHO for shipping. adam@1826: if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then adam@1826: case $progpath in adam@1826: [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; adam@1826: *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; adam@1826: esac adam@1826: qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` adam@1826: else adam@1826: qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` adamc@1133: fi adamc@1133: adamc@1133: # Only actually do things if not in dry run mode. adamc@1133: $opt_dry_run || { adamc@1133: # win32 will think the script is a binary if it has adamc@1133: # a .exe suffix, so we strip it off here. adamc@1133: case $output in adamc@1133: *.exe) func_stripname '' '.exe' "$output" adamc@1133: output=$func_stripname_result ;; adamc@1133: esac adamc@1133: # test for cygwin because mv fails w/o .exe extensions adamc@1133: case $host in adamc@1133: *cygwin*) adamc@1133: exeext=.exe adamc@1133: func_stripname '' '.exe' "$outputname" adamc@1133: outputname=$func_stripname_result ;; adamc@1133: *) exeext= ;; adamc@1133: esac adamc@1133: case $host in adamc@1133: *cygwin* | *mingw* ) adamc@1133: func_dirname_and_basename "$output" "" "." adamc@1133: output_name=$func_basename_result adamc@1133: output_path=$func_dirname_result adamc@1133: cwrappersource="$output_path/$objdir/lt-$output_name.c" adamc@1133: cwrapper="$output_path/$output_name.exe" adamc@1133: $RM $cwrappersource $cwrapper adamc@1133: trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 adamc@1133: adamc@1133: func_emit_cwrapperexe_src > $cwrappersource adamc@1133: adamc@1133: # The wrapper executable is built using the $host compiler, adamc@1133: # because it contains $host paths and files. If cross- adamc@1133: # compiling, it, like the target executable, must be adamc@1133: # executed on the $host or under an emulation environment. adamc@1133: $opt_dry_run || { adamc@1133: $LTCC $LTCFLAGS -o $cwrapper $cwrappersource adamc@1133: $STRIP $cwrapper adamc@1133: } adamc@1133: adamc@1133: # Now, create the wrapper script for func_source use: adamc@1133: func_ltwrapper_scriptname $cwrapper adamc@1133: $RM $func_ltwrapper_scriptname_result adamc@1133: trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 adamc@1133: $opt_dry_run || { adamc@1133: # note: this script will not be executed, so do not chmod. adamc@1133: if test "x$build" = "x$host" ; then adamc@1133: $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result adamc@1133: else adamc@1133: func_emit_wrapper no > $func_ltwrapper_scriptname_result adamc@1133: fi adamc@1133: } adamc@1133: ;; adamc@1133: * ) adamc@1133: $RM $output adamc@1133: trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 adamc@1133: adamc@1133: func_emit_wrapper no > $output adamc@1133: chmod +x $output adamc@1133: ;; adamc@1133: esac adamc@1133: } adamc@1133: exit $EXIT_SUCCESS adamc@1133: ;; adamc@1133: esac adamc@1133: adamc@1133: # See if we need to build an old-fashioned archive. adamc@1133: for oldlib in $oldlibs; do adamc@1133: adamc@1133: if test "$build_libtool_libs" = convenience; then adamc@1133: oldobjs="$libobjs_save $symfileobj" adamc@1133: addlibs="$convenience" adamc@1133: build_libtool_libs=no adamc@1133: else adamc@1133: if test "$build_libtool_libs" = module; then adamc@1133: oldobjs="$libobjs_save" adamc@1133: build_libtool_libs=no adamc@1133: else adamc@1133: oldobjs="$old_deplibs $non_pic_objects" adamc@1133: if test "$preload" = yes && test -f "$symfileobj"; then adam@1826: oldobjs="$oldobjs $symfileobj" adamc@1133: fi adamc@1133: fi adamc@1133: addlibs="$old_convenience" adamc@1133: fi adamc@1133: adamc@1133: if test -n "$addlibs"; then adamc@1133: gentop="$output_objdir/${outputname}x" adam@1826: generated="$generated $gentop" adamc@1133: adamc@1133: func_extract_archives $gentop $addlibs adam@1826: oldobjs="$oldobjs $func_extract_archives_result" adamc@1133: fi adamc@1133: adamc@1133: # Do each command in the archive commands. adamc@1133: if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then adamc@1133: cmds=$old_archive_from_new_cmds adamc@1133: else adamc@1133: adamc@1133: # Add any objects from preloaded convenience libraries adamc@1133: if test -n "$dlprefiles"; then adamc@1133: gentop="$output_objdir/${outputname}x" adam@1826: generated="$generated $gentop" adamc@1133: adamc@1133: func_extract_archives $gentop $dlprefiles adam@1826: oldobjs="$oldobjs $func_extract_archives_result" adamc@1133: fi adamc@1133: adamc@1133: # POSIX demands no paths to be encoded in archives. We have adamc@1133: # to avoid creating archives with duplicate basenames if we adamc@1133: # might have to extract them afterwards, e.g., when creating a adamc@1133: # static archive out of a convenience library, or when linking adamc@1133: # the entirety of a libtool archive into another (currently adamc@1133: # not supported by libtool). adamc@1133: if (for obj in $oldobjs adamc@1133: do adamc@1133: func_basename "$obj" adamc@1133: $ECHO "$func_basename_result" adamc@1133: done | sort | sort -uc >/dev/null 2>&1); then adamc@1133: : adamc@1133: else adam@1826: $ECHO "copying selected object files to avoid basename conflicts..." adamc@1133: gentop="$output_objdir/${outputname}x" adam@1826: generated="$generated $gentop" adamc@1133: func_mkdir_p "$gentop" adamc@1133: save_oldobjs=$oldobjs adamc@1133: oldobjs= adamc@1133: counter=1 adamc@1133: for obj in $save_oldobjs adamc@1133: do adamc@1133: func_basename "$obj" adamc@1133: objbase="$func_basename_result" adamc@1133: case " $oldobjs " in adamc@1133: " ") oldobjs=$obj ;; adamc@1133: *[\ /]"$objbase "*) adamc@1133: while :; do adamc@1133: # Make sure we don't pick an alternate name that also adamc@1133: # overlaps. adamc@1133: newobj=lt$counter-$objbase adamc@1133: func_arith $counter + 1 adamc@1133: counter=$func_arith_result adamc@1133: case " $oldobjs " in adamc@1133: *[\ /]"$newobj "*) ;; adamc@1133: *) if test ! -f "$gentop/$newobj"; then break; fi ;; adamc@1133: esac adamc@1133: done adamc@1133: func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" adam@1826: oldobjs="$oldobjs $gentop/$newobj" adamc@1133: ;; adam@1826: *) oldobjs="$oldobjs $obj" ;; adamc@1133: esac adamc@1133: done adamc@1133: fi adamc@1133: eval cmds=\"$old_archive_cmds\" adamc@1133: adamc@1133: func_len " $cmds" adamc@1133: len=$func_len_result adamc@1133: if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then adamc@1133: cmds=$old_archive_cmds adamc@1133: else adamc@1133: # the command line is too long to link in one step, link in parts adamc@1133: func_verbose "using piecewise archive linking..." adamc@1133: save_RANLIB=$RANLIB adamc@1133: RANLIB=: adamc@1133: objlist= adamc@1133: concat_cmds= adamc@1133: save_oldobjs=$oldobjs adamc@1133: oldobjs= adamc@1133: # Is there a better way of finding the last object in the list? adamc@1133: for obj in $save_oldobjs adamc@1133: do adamc@1133: last_oldobj=$obj adamc@1133: done adamc@1133: eval test_cmds=\"$old_archive_cmds\" adamc@1133: func_len " $test_cmds" adamc@1133: len0=$func_len_result adamc@1133: len=$len0 adamc@1133: for obj in $save_oldobjs adamc@1133: do adamc@1133: func_len " $obj" adamc@1133: func_arith $len + $func_len_result adamc@1133: len=$func_arith_result adamc@1133: func_append objlist " $obj" adamc@1133: if test "$len" -lt "$max_cmd_len"; then adamc@1133: : adamc@1133: else adamc@1133: # the above command should be used before it gets too long adamc@1133: oldobjs=$objlist adamc@1133: if test "$obj" = "$last_oldobj" ; then adamc@1133: RANLIB=$save_RANLIB adamc@1133: fi adamc@1133: test -z "$concat_cmds" || concat_cmds=$concat_cmds~ adamc@1133: eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" adamc@1133: objlist= adamc@1133: len=$len0 adamc@1133: fi adamc@1133: done adamc@1133: RANLIB=$save_RANLIB adamc@1133: oldobjs=$objlist adamc@1133: if test "X$oldobjs" = "X" ; then adamc@1133: eval cmds=\"\$concat_cmds\" adamc@1133: else adamc@1133: eval cmds=\"\$concat_cmds~\$old_archive_cmds\" adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: func_execute_cmds "$cmds" 'exit $?' adamc@1133: done adamc@1133: adamc@1133: test -n "$generated" && \ adamc@1133: func_show_eval "${RM}r$generated" adamc@1133: adamc@1133: # Now create the libtool archive. adamc@1133: case $output in adamc@1133: *.la) adamc@1133: old_library= adamc@1133: test "$build_old_libs" = yes && old_library="$libname.$libext" adamc@1133: func_verbose "creating $output" adamc@1133: adamc@1133: # Preserve any variables that may affect compiler behavior adamc@1133: for var in $variables_saved_for_relink; do adamc@1133: if eval test -z \"\${$var+set}\"; then adamc@1133: relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" adamc@1133: elif eval var_value=\$$var; test -z "$var_value"; then adamc@1133: relink_command="$var=; export $var; $relink_command" adamc@1133: else adamc@1133: func_quote_for_eval "$var_value" adamc@1133: relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" adamc@1133: fi adamc@1133: done adamc@1133: # Quote the link command for shipping. adamc@1133: relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" adam@1826: relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` adamc@1133: if test "$hardcode_automatic" = yes ; then adamc@1133: relink_command= adamc@1133: fi adamc@1133: adamc@1133: # Only create the output if not a dry run. adamc@1133: $opt_dry_run || { adamc@1133: for installed in no yes; do adamc@1133: if test "$installed" = yes; then adamc@1133: if test -z "$install_libdir"; then adamc@1133: break adamc@1133: fi adamc@1133: output="$output_objdir/$outputname"i adamc@1133: # Replace all uninstalled libtool libraries with the installed ones adamc@1133: newdependency_libs= adamc@1133: for deplib in $dependency_libs; do adamc@1133: case $deplib in adamc@1133: *.la) adamc@1133: func_basename "$deplib" adamc@1133: name="$func_basename_result" adam@1826: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` adamc@1133: test -z "$libdir" && \ adamc@1133: func_fatal_error "\`$deplib' is not a valid libtool archive" adam@1826: newdependency_libs="$newdependency_libs $libdir/$name" adamc@1133: ;; adam@1826: *) newdependency_libs="$newdependency_libs $deplib" ;; adamc@1133: esac adamc@1133: done adamc@1133: dependency_libs="$newdependency_libs" adamc@1133: newdlfiles= adamc@1133: adamc@1133: for lib in $dlfiles; do adamc@1133: case $lib in adamc@1133: *.la) adamc@1133: func_basename "$lib" adamc@1133: name="$func_basename_result" adamc@1133: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` adamc@1133: test -z "$libdir" && \ adamc@1133: func_fatal_error "\`$lib' is not a valid libtool archive" adam@1826: newdlfiles="$newdlfiles $libdir/$name" adamc@1133: ;; adam@1826: *) newdlfiles="$newdlfiles $lib" ;; adamc@1133: esac adamc@1133: done adamc@1133: dlfiles="$newdlfiles" adamc@1133: newdlprefiles= adamc@1133: for lib in $dlprefiles; do adamc@1133: case $lib in adamc@1133: *.la) adamc@1133: # Only pass preopened files to the pseudo-archive (for adamc@1133: # eventual linking with the app. that links it) if we adamc@1133: # didn't already link the preopened objects directly into adamc@1133: # the library: adamc@1133: func_basename "$lib" adamc@1133: name="$func_basename_result" adamc@1133: eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` adamc@1133: test -z "$libdir" && \ adamc@1133: func_fatal_error "\`$lib' is not a valid libtool archive" adam@1826: newdlprefiles="$newdlprefiles $libdir/$name" adamc@1133: ;; adamc@1133: esac adamc@1133: done adamc@1133: dlprefiles="$newdlprefiles" adamc@1133: else adamc@1133: newdlfiles= adamc@1133: for lib in $dlfiles; do adamc@1133: case $lib in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; adamc@1133: *) abs=`pwd`"/$lib" ;; adamc@1133: esac adam@1826: newdlfiles="$newdlfiles $abs" adamc@1133: done adamc@1133: dlfiles="$newdlfiles" adamc@1133: newdlprefiles= adamc@1133: for lib in $dlprefiles; do adamc@1133: case $lib in adamc@1133: [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; adamc@1133: *) abs=`pwd`"/$lib" ;; adamc@1133: esac adam@1826: newdlprefiles="$newdlprefiles $abs" adamc@1133: done adamc@1133: dlprefiles="$newdlprefiles" adamc@1133: fi adamc@1133: $RM $output adamc@1133: # place dlname in correct position for cygwin adamc@1133: tdlname=$dlname adamc@1133: case $host,$output,$installed,$module,$dlname in adam@1826: *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; adamc@1133: esac adamc@1133: $ECHO > $output "\ adamc@1133: # $outputname - a libtool library file adamc@1133: # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION adamc@1133: # adamc@1133: # Please DO NOT delete this file! adamc@1133: # It is necessary for linking the library. adamc@1133: adamc@1133: # The name that we can dlopen(3). adamc@1133: dlname='$tdlname' adamc@1133: adamc@1133: # Names of this library. adamc@1133: library_names='$library_names' adamc@1133: adamc@1133: # The name of the static archive. adamc@1133: old_library='$old_library' adamc@1133: adamc@1133: # Linker flags that can not go in dependency_libs. adamc@1133: inherited_linker_flags='$new_inherited_linker_flags' adamc@1133: adamc@1133: # Libraries that this one depends upon. adamc@1133: dependency_libs='$dependency_libs' adamc@1133: adamc@1133: # Names of additional weak libraries provided by this library adamc@1133: weak_library_names='$weak_libs' adamc@1133: adamc@1133: # Version information for $libname. adamc@1133: current=$current adamc@1133: age=$age adamc@1133: revision=$revision adamc@1133: adamc@1133: # Is this an already installed library? adamc@1133: installed=$installed adamc@1133: adamc@1133: # Should we warn about portability when linking against -modules? adamc@1133: shouldnotlink=$module adamc@1133: adamc@1133: # Files to dlopen/dlpreopen adamc@1133: dlopen='$dlfiles' adamc@1133: dlpreopen='$dlprefiles' adamc@1133: adamc@1133: # Directory that this library needs to be installed in: adamc@1133: libdir='$install_libdir'" adamc@1133: if test "$installed" = no && test "$need_relink" = yes; then adamc@1133: $ECHO >> $output "\ adamc@1133: relink_command=\"$relink_command\"" adamc@1133: fi adamc@1133: done adamc@1133: } adamc@1133: adamc@1133: # Do a symbolic link so that the libtool archive can be found in adamc@1133: # LD_LIBRARY_PATH before the program is installed. adamc@1133: func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' adamc@1133: ;; adamc@1133: esac adamc@1133: exit $EXIT_SUCCESS adamc@1133: } adamc@1133: adam@1826: { test "$mode" = link || test "$mode" = relink; } && adamc@1133: func_mode_link ${1+"$@"} adamc@1133: adamc@1133: adamc@1133: # func_mode_uninstall arg... adamc@1133: func_mode_uninstall () adamc@1133: { adamc@1133: $opt_debug adamc@1133: RM="$nonopt" adamc@1133: files= adamc@1133: rmforce= adamc@1133: exit_status=0 adamc@1133: adamc@1133: # This variable tells wrapper scripts just to set variables rather adamc@1133: # than running their programs. adamc@1133: libtool_install_magic="$magic" adamc@1133: adamc@1133: for arg adamc@1133: do adamc@1133: case $arg in adam@1826: -f) RM="$RM $arg"; rmforce=yes ;; adam@1826: -*) RM="$RM $arg" ;; adam@1826: *) files="$files $arg" ;; adamc@1133: esac adamc@1133: done adamc@1133: adamc@1133: test -z "$RM" && \ adamc@1133: func_fatal_help "you must specify an RM program" adamc@1133: adamc@1133: rmdirs= adamc@1133: adam@1826: origobjdir="$objdir" adamc@1133: for file in $files; do adamc@1133: func_dirname "$file" "" "." adamc@1133: dir="$func_dirname_result" adamc@1133: if test "X$dir" = X.; then adam@1826: objdir="$origobjdir" adamc@1133: else adam@1826: objdir="$dir/$origobjdir" adamc@1133: fi adamc@1133: func_basename "$file" adamc@1133: name="$func_basename_result" adam@1826: test "$mode" = uninstall && objdir="$dir" adam@1826: adam@1826: # Remember objdir for removal later, being careful to avoid duplicates adam@1826: if test "$mode" = clean; then adamc@1133: case " $rmdirs " in adam@1826: *" $objdir "*) ;; adam@1826: *) rmdirs="$rmdirs $objdir" ;; adamc@1133: esac adamc@1133: fi adamc@1133: adamc@1133: # Don't error if the file doesn't exist and rm -f was used. adamc@1133: if { test -L "$file"; } >/dev/null 2>&1 || adamc@1133: { test -h "$file"; } >/dev/null 2>&1 || adamc@1133: test -f "$file"; then adamc@1133: : adamc@1133: elif test -d "$file"; then adamc@1133: exit_status=1 adamc@1133: continue adamc@1133: elif test "$rmforce" = yes; then adamc@1133: continue adamc@1133: fi adamc@1133: adamc@1133: rmfiles="$file" adamc@1133: adamc@1133: case $name in adamc@1133: *.la) adamc@1133: # Possibly a libtool archive, so verify it. adamc@1133: if func_lalib_p "$file"; then adamc@1133: func_source $dir/$name adamc@1133: adamc@1133: # Delete the libtool libraries and symlinks. adamc@1133: for n in $library_names; do adam@1826: rmfiles="$rmfiles $objdir/$n" adamc@1133: done adam@1826: test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" adam@1826: adam@1826: case "$mode" in adamc@1133: clean) adam@1826: case " $library_names " in adam@1826: # " " in the beginning catches empty $dlname adamc@1133: *" $dlname "*) ;; adam@1826: *) rmfiles="$rmfiles $objdir/$dlname" ;; adamc@1133: esac adam@1826: test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" adamc@1133: ;; adamc@1133: uninstall) adamc@1133: if test -n "$library_names"; then adamc@1133: # Do each command in the postuninstall commands. adamc@1133: func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' adamc@1133: fi adamc@1133: adamc@1133: if test -n "$old_library"; then adamc@1133: # Do each command in the old_postuninstall commands. adamc@1133: func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' adamc@1133: fi adamc@1133: # FIXME: should reinstall the best remaining shared library. adamc@1133: ;; adamc@1133: esac adamc@1133: fi adamc@1133: ;; adamc@1133: adamc@1133: *.lo) adamc@1133: # Possibly a libtool object, so verify it. adamc@1133: if func_lalib_p "$file"; then adamc@1133: adamc@1133: # Read the .lo file adamc@1133: func_source $dir/$name adamc@1133: adamc@1133: # Add PIC object to the list of files to remove. adamc@1133: if test -n "$pic_object" && adamc@1133: test "$pic_object" != none; then adam@1826: rmfiles="$rmfiles $dir/$pic_object" adamc@1133: fi adamc@1133: adamc@1133: # Add non-PIC object to the list of files to remove. adamc@1133: if test -n "$non_pic_object" && adamc@1133: test "$non_pic_object" != none; then adam@1826: rmfiles="$rmfiles $dir/$non_pic_object" adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: adamc@1133: *) adam@1826: if test "$mode" = clean ; then adamc@1133: noexename=$name adamc@1133: case $file in adamc@1133: *.exe) adamc@1133: func_stripname '' '.exe' "$file" adamc@1133: file=$func_stripname_result adamc@1133: func_stripname '' '.exe' "$name" adamc@1133: noexename=$func_stripname_result adamc@1133: # $file with .exe has already been added to rmfiles, adamc@1133: # add $file without .exe adam@1826: rmfiles="$rmfiles $file" adamc@1133: ;; adamc@1133: esac adamc@1133: # Do a test to see if this is a libtool program. adamc@1133: if func_ltwrapper_p "$file"; then adamc@1133: if func_ltwrapper_executable_p "$file"; then adamc@1133: func_ltwrapper_scriptname "$file" adamc@1133: relink_command= adamc@1133: func_source $func_ltwrapper_scriptname_result adam@1826: rmfiles="$rmfiles $func_ltwrapper_scriptname_result" adamc@1133: else adamc@1133: relink_command= adamc@1133: func_source $dir/$noexename adamc@1133: fi adamc@1133: adamc@1133: # note $name still contains .exe if it was in $file originally adamc@1133: # as does the version of $file that was added into $rmfiles adam@1826: rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" adamc@1133: if test "$fast_install" = yes && test -n "$relink_command"; then adam@1826: rmfiles="$rmfiles $objdir/lt-$name" adamc@1133: fi adamc@1133: if test "X$noexename" != "X$name" ; then adam@1826: rmfiles="$rmfiles $objdir/lt-${noexename}.c" adamc@1133: fi adamc@1133: fi adamc@1133: fi adamc@1133: ;; adamc@1133: esac adamc@1133: func_show_eval "$RM $rmfiles" 'exit_status=1' adamc@1133: done adam@1826: objdir="$origobjdir" adamc@1133: adamc@1133: # Try to remove the ${objdir}s in the directories where we deleted files adamc@1133: for dir in $rmdirs; do adamc@1133: if test -d "$dir"; then adamc@1133: func_show_eval "rmdir $dir >/dev/null 2>&1" adamc@1133: fi adamc@1133: done adamc@1133: adamc@1133: exit $exit_status adamc@1133: } adamc@1133: adam@1826: { test "$mode" = uninstall || test "$mode" = clean; } && adamc@1133: func_mode_uninstall ${1+"$@"} adamc@1133: adam@1826: test -z "$mode" && { adamc@1133: help="$generic_help" adamc@1133: func_fatal_help "you must specify a MODE" adamc@1133: } adamc@1133: adamc@1133: test -z "$exec_cmd" && \ adam@1826: func_fatal_help "invalid operation mode \`$mode'" adamc@1133: adamc@1133: if test -n "$exec_cmd"; then adamc@1133: eval exec "$exec_cmd" adamc@1133: exit $EXIT_FAILURE adamc@1133: fi adamc@1133: adamc@1133: exit $exit_status adamc@1133: adamc@1133: adamc@1133: # The TAGs below are defined such that we never get into a situation adamc@1133: # in which we disable both kinds of libraries. Given conflicting adamc@1133: # choices, we go for a static library, that is the most portable, adamc@1133: # since we can't tell whether shared libraries were disabled because adamc@1133: # the user asked for that or because the platform doesn't support adamc@1133: # them. This is particularly important on AIX, because we don't adamc@1133: # support having both static and shared libraries enabled at the same adamc@1133: # time on that platform, so we default to a shared-only configuration. adamc@1133: # If a disable-shared tag is given, we'll fallback to a static-only adamc@1133: # configuration. But we'll never go from static-only to shared-only. adamc@1133: adamc@1133: # ### BEGIN LIBTOOL TAG CONFIG: disable-shared adamc@1133: build_libtool_libs=no adamc@1133: build_old_libs=yes adamc@1133: # ### END LIBTOOL TAG CONFIG: disable-shared adamc@1133: adamc@1133: # ### BEGIN LIBTOOL TAG CONFIG: disable-static adamc@1133: build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` adamc@1133: # ### END LIBTOOL TAG CONFIG: disable-static adamc@1133: adamc@1133: # Local Variables: adamc@1133: # mode:shell-script adamc@1133: # sh-indentation:2 adamc@1133: # End: adamc@1133: # vi:sw=2 adamc@1133: