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