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