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