105a1a286Smrg# Generated from ltmain.m4sh. 205a1a286Smrg 305a1a286Smrg# libtool (GNU libtool) 2.2.10 405a1a286Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 505a1a286Smrg 605a1a286Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 705a1a286Smrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 805a1a286Smrg# This is free software; see the source for copying conditions. There is NO 905a1a286Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1005a1a286Smrg 1105a1a286Smrg# GNU Libtool is free software; you can redistribute it and/or modify 12d9c7fc6cSmrg# it under the terms of the GNU General Public License as published by 13d9c7fc6cSmrg# the Free Software Foundation; either version 2 of the License, or 14d9c7fc6cSmrg# (at your option) any later version. 15d9c7fc6cSmrg# 1605a1a286Smrg# As a special exception to the GNU General Public License, 1705a1a286Smrg# if you distribute this file as part of a program or library that 1805a1a286Smrg# is built using GNU Libtool, you may include this file under the 1905a1a286Smrg# same distribution terms that you use for the rest of that program. 2005a1a286Smrg# 2105a1a286Smrg# GNU Libtool is distributed in the hope that it will be useful, but 22d9c7fc6cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 23d9c7fc6cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24d9c7fc6cSmrg# General Public License for more details. 25d9c7fc6cSmrg# 26d9c7fc6cSmrg# You should have received a copy of the GNU General Public License 2705a1a286Smrg# along with GNU Libtool; see the file COPYING. If not, a copy 2805a1a286Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 2905a1a286Smrg# or obtained by writing to the Free Software Foundation, Inc., 3005a1a286Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 3105a1a286Smrg 3205a1a286Smrg# Usage: $progname [OPTION]... [MODE-ARG]... 3305a1a286Smrg# 3405a1a286Smrg# Provide generalized library-building support services. 35d9c7fc6cSmrg# 3605a1a286Smrg# --config show all configuration variables 3705a1a286Smrg# --debug enable verbose shell tracing 3805a1a286Smrg# -n, --dry-run display commands without modifying any files 3905a1a286Smrg# --features display basic configuration information and exit 4005a1a286Smrg# --mode=MODE use operation mode MODE 4105a1a286Smrg# --preserve-dup-deps don't remove duplicate dependency libraries 4205a1a286Smrg# --quiet, --silent don't print informational messages 4305a1a286Smrg# --no-quiet, --no-silent 4405a1a286Smrg# print informational messages (default) 4505a1a286Smrg# --tag=TAG use configuration variables from tag TAG 4605a1a286Smrg# -v, --verbose print more informational messages than default 4705a1a286Smrg# --no-verbose don't print the extra informational messages 4805a1a286Smrg# --version print version information 4905a1a286Smrg# -h, --help, --help-all print short, long, or detailed help message 5005a1a286Smrg# 5105a1a286Smrg# MODE must be one of the following: 5205a1a286Smrg# 5305a1a286Smrg# clean remove files from the build directory 5405a1a286Smrg# compile compile a source file into a libtool object 5505a1a286Smrg# execute automatically set library path, then run a program 5605a1a286Smrg# finish complete the installation of libtool libraries 5705a1a286Smrg# install install libraries or executables 5805a1a286Smrg# link create a library or an executable 5905a1a286Smrg# uninstall remove libraries from an installed directory 6005a1a286Smrg# 6105a1a286Smrg# MODE-ARGS vary depending on the MODE. When passed as first option, 6205a1a286Smrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 6305a1a286Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 6405a1a286Smrg# 6505a1a286Smrg# When reporting a bug, please describe a test case to reproduce it and 6605a1a286Smrg# include the following information: 6705a1a286Smrg# 6805a1a286Smrg# host-triplet: $host 6905a1a286Smrg# shell: $SHELL 7005a1a286Smrg# compiler: $LTCC 7105a1a286Smrg# compiler flags: $LTCFLAGS 7205a1a286Smrg# linker: $LD (gnu? $with_gnu_ld) 7305a1a286Smrg# $progname: (GNU libtool) 2.2.10 7405a1a286Smrg# automake: $automake_version 7505a1a286Smrg# autoconf: $autoconf_version 7605a1a286Smrg# 7705a1a286Smrg# Report bugs to <bug-libtool@gnu.org>. 7805a1a286Smrg 7905a1a286SmrgPROGRAM=libtool 8005a1a286SmrgPACKAGE=libtool 8105a1a286SmrgVERSION=2.2.10 8205a1a286SmrgTIMESTAMP="" 8305a1a286Smrgpackage_revision=1.3175 8405a1a286Smrg 8505a1a286Smrg# Be Bourne compatible 8605a1a286Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 8705a1a286Smrg emulate sh 8805a1a286Smrg NULLCMD=: 8905a1a286Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 9005a1a286Smrg # is contrary to our usage. Disable this feature. 9105a1a286Smrg alias -g '${1+"$@"}'='"$@"' 9205a1a286Smrg setopt NO_GLOB_SUBST 9305a1a286Smrgelse 9405a1a286Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 9505a1a286Smrgfi 9605a1a286SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 9705a1a286SmrgDUALCASE=1; export DUALCASE # for MKS sh 9805a1a286Smrg 9905a1a286Smrg# A function that is used when there is no print builtin or printf. 10005a1a286Smrgfunc_fallback_echo () 10105a1a286Smrg{ 10205a1a286Smrg eval 'cat <<_LTECHO_EOF 10305a1a286Smrg$1 10405a1a286Smrg_LTECHO_EOF' 10505a1a286Smrg} 10605a1a286Smrg 10705a1a286Smrg# NLS nuisances: We save the old values to restore during execute mode. 10805a1a286Smrglt_user_locale= 10905a1a286Smrglt_safe_locale= 11005a1a286Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11105a1a286Smrgdo 11205a1a286Smrg eval "if test \"\${$lt_var+set}\" = set; then 11305a1a286Smrg save_$lt_var=\$$lt_var 11405a1a286Smrg $lt_var=C 11505a1a286Smrg export $lt_var 11605a1a286Smrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 11705a1a286Smrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 11805a1a286Smrg fi" 11905a1a286Smrgdone 12005a1a286SmrgLC_ALL=C 12105a1a286SmrgLANGUAGE=C 12205a1a286Smrgexport LANGUAGE LC_ALL 12305a1a286Smrg 12405a1a286Smrg$lt_unset CDPATH 125d9c7fc6cSmrg 126d9c7fc6cSmrg 127d9c7fc6cSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 128d9c7fc6cSmrg# is ksh but when the shell is invoked as "sh" and the current value of 129d9c7fc6cSmrg# the _XPG environment variable is not equal to 1 (one), the special 130d9c7fc6cSmrg# positional parameter $0, within a function call, is the name of the 131d9c7fc6cSmrg# function. 132d9c7fc6cSmrgprogpath="$0" 133d9c7fc6cSmrg 13405a1a286Smrg 13505a1a286Smrg 13605a1a286Smrg: ${CP="cp -f"} 13705a1a286Smrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 13805a1a286Smrg: ${EGREP="grep -E"} 13905a1a286Smrg: ${FGREP="grep -F"} 14005a1a286Smrg: ${GREP="grep"} 14105a1a286Smrg: ${LN_S="ln -s"} 14205a1a286Smrg: ${MAKE="make"} 14305a1a286Smrg: ${MKDIR="mkdir"} 14405a1a286Smrg: ${MV="mv -f"} 14505a1a286Smrg: ${RM="rm -f"} 14605a1a286Smrg: ${SED="sed"} 14705a1a286Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 14805a1a286Smrg: ${Xsed="$SED -e 1s/^X//"} 149d9c7fc6cSmrg 150d9c7fc6cSmrg# Global variables: 151d9c7fc6cSmrgEXIT_SUCCESS=0 152d9c7fc6cSmrgEXIT_FAILURE=1 15305a1a286SmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 15405a1a286SmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 155d9c7fc6cSmrg 15605a1a286Smrgexit_status=$EXIT_SUCCESS 157d9c7fc6cSmrg 15805a1a286Smrg# Make sure IFS has a sensible default 15905a1a286Smrglt_nl=' 16005a1a286Smrg' 16105a1a286SmrgIFS=" $lt_nl" 162d9c7fc6cSmrg 16305a1a286Smrgdirname="s,/[^/]*$,," 16405a1a286Smrgbasename="s,^.*/,," 16505a1a286Smrg 16605a1a286Smrg# func_dirname_and_basename file append nondir_replacement 16705a1a286Smrg# perform func_basename and func_dirname in a single function 16805a1a286Smrg# call: 16905a1a286Smrg# dirname: Compute the dirname of FILE. If nonempty, 17005a1a286Smrg# add APPEND to the result, otherwise set result 17105a1a286Smrg# to NONDIR_REPLACEMENT. 17205a1a286Smrg# value returned in "$func_dirname_result" 17305a1a286Smrg# basename: Compute filename of FILE. 17405a1a286Smrg# value retuned in "$func_basename_result" 17505a1a286Smrg# Implementation must be kept synchronized with func_dirname 17605a1a286Smrg# and func_basename. For efficiency, we do not delegate to 17705a1a286Smrg# those functions but instead duplicate the functionality here. 17805a1a286Smrgfunc_dirname_and_basename () 17905a1a286Smrg{ 18005a1a286Smrg # Extract subdirectory from the argument. 18105a1a286Smrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 18205a1a286Smrg if test "X$func_dirname_result" = "X${1}"; then 18305a1a286Smrg func_dirname_result="${3}" 18405a1a286Smrg else 18505a1a286Smrg func_dirname_result="$func_dirname_result${2}" 18605a1a286Smrg fi 18705a1a286Smrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 18805a1a286Smrg} 189d9c7fc6cSmrg 19005a1a286Smrg# Generated shell functions inserted here. 19105a1a286Smrg 19205a1a286Smrg# These SED scripts presuppose an absolute path with a trailing slash. 19305a1a286Smrgpathcar='s,^/\([^/]*\).*$,\1,' 19405a1a286Smrgpathcdr='s,^/[^/]*,,' 19505a1a286Smrgremovedotparts=':dotsl 19605a1a286Smrg s@/\./@/@g 19705a1a286Smrg t dotsl 19805a1a286Smrg s,/\.$,/,' 19905a1a286Smrgcollapseslashes='s@/\{1,\}@/@g' 20005a1a286Smrgfinalslash='s,/*$,/,' 20105a1a286Smrg 20205a1a286Smrg# func_normal_abspath PATH 20305a1a286Smrg# Remove doubled-up and trailing slashes, "." path components, 20405a1a286Smrg# and cancel out any ".." path components in PATH after making 20505a1a286Smrg# it an absolute path. 20605a1a286Smrg# value returned in "$func_normal_abspath_result" 20705a1a286Smrgfunc_normal_abspath () 20805a1a286Smrg{ 20905a1a286Smrg # Start from root dir and reassemble the path. 21005a1a286Smrg func_normal_abspath_result= 21105a1a286Smrg func_normal_abspath_tpath=$1 21205a1a286Smrg func_normal_abspath_altnamespace= 21305a1a286Smrg case $func_normal_abspath_tpath in 21405a1a286Smrg "") 21505a1a286Smrg # Empty path, that just means $cwd. 21605a1a286Smrg func_stripname '' '/' "`pwd`" 21705a1a286Smrg func_normal_abspath_result=$func_stripname_result 21805a1a286Smrg return 21905a1a286Smrg ;; 22005a1a286Smrg # The next three entries are used to spot a run of precisely 22105a1a286Smrg # two leading slashes without using negated character classes; 22205a1a286Smrg # we take advantage of case's first-match behaviour. 22305a1a286Smrg ///*) 22405a1a286Smrg # Unusual form of absolute path, do nothing. 22505a1a286Smrg ;; 22605a1a286Smrg //*) 22705a1a286Smrg # Not necessarily an ordinary path; POSIX reserves leading '//' 22805a1a286Smrg # and for example Cygwin uses it to access remote file shares 22905a1a286Smrg # over CIFS/SMB, so we conserve a leading double slash if found. 23005a1a286Smrg func_normal_abspath_altnamespace=/ 23105a1a286Smrg ;; 23205a1a286Smrg /*) 23305a1a286Smrg # Absolute path, do nothing. 23405a1a286Smrg ;; 23505a1a286Smrg *) 23605a1a286Smrg # Relative path, prepend $cwd. 23705a1a286Smrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 23805a1a286Smrg ;; 23905a1a286Smrg esac 24005a1a286Smrg # Cancel out all the simple stuff to save iterations. We also want 24105a1a286Smrg # the path to end with a slash for ease of parsing, so make sure 24205a1a286Smrg # there is one (and only one) here. 24305a1a286Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 24405a1a286Smrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 24505a1a286Smrg while :; do 24605a1a286Smrg # Processed it all yet? 24705a1a286Smrg if test "$func_normal_abspath_tpath" = / ; then 24805a1a286Smrg # If we ascended to the root using ".." the result may be empty now. 24905a1a286Smrg if test -z "$func_normal_abspath_result" ; then 25005a1a286Smrg func_normal_abspath_result=/ 25105a1a286Smrg fi 25205a1a286Smrg break 25305a1a286Smrg fi 25405a1a286Smrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 25505a1a286Smrg -e "$pathcar"` 25605a1a286Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 25705a1a286Smrg -e "$pathcdr"` 25805a1a286Smrg # Figure out what to do with it 25905a1a286Smrg case $func_normal_abspath_tcomponent in 26005a1a286Smrg "") 26105a1a286Smrg # Trailing empty path component, ignore it. 26205a1a286Smrg ;; 26305a1a286Smrg ..) 26405a1a286Smrg # Parent dir; strip last assembled component from result. 26505a1a286Smrg func_dirname "$func_normal_abspath_result" 26605a1a286Smrg func_normal_abspath_result=$func_dirname_result 26705a1a286Smrg ;; 26805a1a286Smrg *) 26905a1a286Smrg # Actual path component, append it. 27005a1a286Smrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 27105a1a286Smrg ;; 27205a1a286Smrg esac 27305a1a286Smrg done 27405a1a286Smrg # Restore leading double-slash if one was found on entry. 27505a1a286Smrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 27605a1a286Smrg} 277d9c7fc6cSmrg 27805a1a286Smrg# func_relative_path SRCDIR DSTDIR 27905a1a286Smrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 28005a1a286Smrg# slash if non-empty, suitable for immediately appending a filename 28105a1a286Smrg# without needing to append a separator. 28205a1a286Smrg# value returned in "$func_relative_path_result" 28305a1a286Smrgfunc_relative_path () 28405a1a286Smrg{ 28505a1a286Smrg func_relative_path_result= 28605a1a286Smrg func_normal_abspath "$1" 28705a1a286Smrg func_relative_path_tlibdir=$func_normal_abspath_result 28805a1a286Smrg func_normal_abspath "$2" 28905a1a286Smrg func_relative_path_tbindir=$func_normal_abspath_result 29005a1a286Smrg 29105a1a286Smrg # Ascend the tree starting from libdir 29205a1a286Smrg while :; do 29305a1a286Smrg # check if we have found a prefix of bindir 29405a1a286Smrg case $func_relative_path_tbindir in 29505a1a286Smrg $func_relative_path_tlibdir) 29605a1a286Smrg # found an exact match 29705a1a286Smrg func_relative_path_tcancelled= 29805a1a286Smrg break 29905a1a286Smrg ;; 30005a1a286Smrg $func_relative_path_tlibdir*) 30105a1a286Smrg # found a matching prefix 30205a1a286Smrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 30305a1a286Smrg func_relative_path_tcancelled=$func_stripname_result 30405a1a286Smrg if test -z "$func_relative_path_result"; then 30505a1a286Smrg func_relative_path_result=. 30605a1a286Smrg fi 30705a1a286Smrg break 30805a1a286Smrg ;; 30905a1a286Smrg *) 31005a1a286Smrg func_dirname $func_relative_path_tlibdir 31105a1a286Smrg func_relative_path_tlibdir=${func_dirname_result} 31205a1a286Smrg if test "x$func_relative_path_tlibdir" = x ; then 31305a1a286Smrg # Have to descend all the way to the root! 31405a1a286Smrg func_relative_path_result=../$func_relative_path_result 31505a1a286Smrg func_relative_path_tcancelled=$func_relative_path_tbindir 31605a1a286Smrg break 31705a1a286Smrg fi 31805a1a286Smrg func_relative_path_result=../$func_relative_path_result 31905a1a286Smrg ;; 32005a1a286Smrg esac 32105a1a286Smrg done 32205a1a286Smrg 32305a1a286Smrg # Now calculate path; take care to avoid doubling-up slashes. 32405a1a286Smrg func_stripname '' '/' "$func_relative_path_result" 32505a1a286Smrg func_relative_path_result=$func_stripname_result 32605a1a286Smrg func_stripname '/' '/' "$func_relative_path_tcancelled" 32705a1a286Smrg if test "x$func_stripname_result" != x ; then 32805a1a286Smrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 32905a1a286Smrg fi 33005a1a286Smrg 33105a1a286Smrg # Normalisation. If bindir is libdir, return empty string, 33205a1a286Smrg # else relative path ending with a slash; either way, target 33305a1a286Smrg # file name can be directly appended. 33405a1a286Smrg if test ! -z "$func_relative_path_result"; then 33505a1a286Smrg func_stripname './' '' "$func_relative_path_result/" 33605a1a286Smrg func_relative_path_result=$func_stripname_result 33705a1a286Smrg fi 33805a1a286Smrg} 33905a1a286Smrg 34005a1a286Smrg# The name of this program: 34105a1a286Smrgfunc_dirname_and_basename "$progpath" 34205a1a286Smrgprogname=$func_basename_result 34305a1a286Smrg 34405a1a286Smrg# Make sure we have an absolute path for reexecution: 34505a1a286Smrgcase $progpath in 34605a1a286Smrg [\\/]*|[A-Za-z]:\\*) ;; 34705a1a286Smrg *[\\/]*) 34805a1a286Smrg progdir=$func_dirname_result 34905a1a286Smrg progdir=`cd "$progdir" && pwd` 35005a1a286Smrg progpath="$progdir/$progname" 35105a1a286Smrg ;; 35205a1a286Smrg *) 35305a1a286Smrg save_IFS="$IFS" 35405a1a286Smrg IFS=: 35505a1a286Smrg for progdir in $PATH; do 35605a1a286Smrg IFS="$save_IFS" 35705a1a286Smrg test -x "$progdir/$progname" && break 35805a1a286Smrg done 35905a1a286Smrg IFS="$save_IFS" 36005a1a286Smrg test -n "$progdir" || progdir=`pwd` 36105a1a286Smrg progpath="$progdir/$progname" 36205a1a286Smrg ;; 36305a1a286Smrgesac 364d9c7fc6cSmrg 365d9c7fc6cSmrg# Sed substitution that helps us do robust quoting. It backslashifies 366d9c7fc6cSmrg# metacharacters that are still active within double-quoted strings. 367d9c7fc6cSmrgXsed="${SED}"' -e 1s/^X//' 36805a1a286Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 36905a1a286Smrg 37005a1a286Smrg# Same as above, but do not quote variable references. 37105a1a286Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 37205a1a286Smrg 37305a1a286Smrg# Re-`\' parameter expansions in output of double_quote_subst that were 37405a1a286Smrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 37505a1a286Smrg# in input to double_quote_subst, that '$' was protected from expansion. 37605a1a286Smrg# Since each input `\' is now two `\'s, look for any number of runs of 37705a1a286Smrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 37805a1a286Smrgbs='\\' 37905a1a286Smrgbs2='\\\\' 38005a1a286Smrgbs4='\\\\\\\\' 38105a1a286Smrgdollar='\$' 38205a1a286Smrgsed_double_backslash="\ 38305a1a286Smrg s/$bs4/&\\ 38405a1a286Smrg/g 38505a1a286Smrg s/^$bs2$dollar/$bs&/ 38605a1a286Smrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 38705a1a286Smrg s/\n//g" 38805a1a286Smrg 38905a1a286Smrg# Standard options: 39005a1a286Smrgopt_dry_run=false 39105a1a286Smrgopt_help=false 39205a1a286Smrgopt_quiet=false 39305a1a286Smrgopt_verbose=false 39405a1a286Smrgopt_warning=: 39505a1a286Smrg 39605a1a286Smrg# func_echo arg... 39705a1a286Smrg# Echo program name prefixed message, along with the current mode 39805a1a286Smrg# name if it has been set yet. 39905a1a286Smrgfunc_echo () 40005a1a286Smrg{ 40105a1a286Smrg $ECHO "$progname${mode+: }$mode: $*" 40205a1a286Smrg} 403d9c7fc6cSmrg 40405a1a286Smrg# func_verbose arg... 40505a1a286Smrg# Echo program name prefixed message in verbose mode only. 40605a1a286Smrgfunc_verbose () 40705a1a286Smrg{ 40805a1a286Smrg $opt_verbose && func_echo ${1+"$@"} 409d9c7fc6cSmrg 41005a1a286Smrg # A bug in bash halts the script if the last line of a function 41105a1a286Smrg # fails when set -e is in force, so we need another command to 41205a1a286Smrg # work around that: 41305a1a286Smrg : 41405a1a286Smrg} 415d9c7fc6cSmrg 41605a1a286Smrg# func_echo_all arg... 41705a1a286Smrg# Invoke $ECHO with all args, space-separated. 41805a1a286Smrgfunc_echo_all () 41905a1a286Smrg{ 42005a1a286Smrg $ECHO "$*" 42105a1a286Smrg} 422d9c7fc6cSmrg 42305a1a286Smrg# func_error arg... 42405a1a286Smrg# Echo program name prefixed message to standard error. 42505a1a286Smrgfunc_error () 42605a1a286Smrg{ 42705a1a286Smrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 42805a1a286Smrg} 42905a1a286Smrg 43005a1a286Smrg# func_warning arg... 43105a1a286Smrg# Echo program name prefixed warning message to standard error. 43205a1a286Smrgfunc_warning () 43305a1a286Smrg{ 43405a1a286Smrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 43505a1a286Smrg 43605a1a286Smrg # bash bug again: 43705a1a286Smrg : 43805a1a286Smrg} 43905a1a286Smrg 44005a1a286Smrg# func_fatal_error arg... 44105a1a286Smrg# Echo program name prefixed message to standard error, and exit. 44205a1a286Smrgfunc_fatal_error () 44305a1a286Smrg{ 44405a1a286Smrg func_error ${1+"$@"} 44505a1a286Smrg exit $EXIT_FAILURE 44605a1a286Smrg} 44705a1a286Smrg 44805a1a286Smrg# func_fatal_help arg... 44905a1a286Smrg# Echo program name prefixed message to standard error, followed by 45005a1a286Smrg# a help hint, and exit. 45105a1a286Smrgfunc_fatal_help () 45205a1a286Smrg{ 45305a1a286Smrg func_error ${1+"$@"} 45405a1a286Smrg func_fatal_error "$help" 45505a1a286Smrg} 45605a1a286Smrghelp="Try \`$progname --help' for more information." ## default 45705a1a286Smrg 45805a1a286Smrg 45905a1a286Smrg# func_grep expression filename 46005a1a286Smrg# Check whether EXPRESSION matches any line of FILENAME, without output. 46105a1a286Smrgfunc_grep () 46205a1a286Smrg{ 46305a1a286Smrg $GREP "$1" "$2" >/dev/null 2>&1 46405a1a286Smrg} 46505a1a286Smrg 46605a1a286Smrg 46705a1a286Smrg# func_mkdir_p directory-path 46805a1a286Smrg# Make sure the entire path to DIRECTORY-PATH is available. 46905a1a286Smrgfunc_mkdir_p () 47005a1a286Smrg{ 47105a1a286Smrg my_directory_path="$1" 47205a1a286Smrg my_dir_list= 47305a1a286Smrg 47405a1a286Smrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 47505a1a286Smrg 47605a1a286Smrg # Protect directory names starting with `-' 47705a1a286Smrg case $my_directory_path in 47805a1a286Smrg -*) my_directory_path="./$my_directory_path" ;; 47905a1a286Smrg esac 48005a1a286Smrg 48105a1a286Smrg # While some portion of DIR does not yet exist... 48205a1a286Smrg while test ! -d "$my_directory_path"; do 48305a1a286Smrg # ...make a list in topmost first order. Use a colon delimited 48405a1a286Smrg # list incase some portion of path contains whitespace. 48505a1a286Smrg my_dir_list="$my_directory_path:$my_dir_list" 48605a1a286Smrg 48705a1a286Smrg # If the last portion added has no slash in it, the list is done 48805a1a286Smrg case $my_directory_path in */*) ;; *) break ;; esac 48905a1a286Smrg 49005a1a286Smrg # ...otherwise throw away the child directory and loop 49105a1a286Smrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 49205a1a286Smrg done 49305a1a286Smrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 49405a1a286Smrg 49505a1a286Smrg save_mkdir_p_IFS="$IFS"; IFS=':' 49605a1a286Smrg for my_dir in $my_dir_list; do 49705a1a286Smrg IFS="$save_mkdir_p_IFS" 49805a1a286Smrg # mkdir can fail with a `File exist' error if two processes 49905a1a286Smrg # try to create one of the directories concurrently. Don't 50005a1a286Smrg # stop in that case! 50105a1a286Smrg $MKDIR "$my_dir" 2>/dev/null || : 50205a1a286Smrg done 50305a1a286Smrg IFS="$save_mkdir_p_IFS" 50405a1a286Smrg 50505a1a286Smrg # Bail out if we (or some other process) failed to create a directory. 50605a1a286Smrg test -d "$my_directory_path" || \ 50705a1a286Smrg func_fatal_error "Failed to create \`$1'" 50805a1a286Smrg fi 50905a1a286Smrg} 510d9c7fc6cSmrg 511d9c7fc6cSmrg 512d9c7fc6cSmrg# func_mktempdir [string] 513d9c7fc6cSmrg# Make a temporary directory that won't clash with other running 514d9c7fc6cSmrg# libtool processes, and avoids race conditions if possible. If 515d9c7fc6cSmrg# given, STRING is the basename for that directory. 516d9c7fc6cSmrgfunc_mktempdir () 517d9c7fc6cSmrg{ 518d9c7fc6cSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 519d9c7fc6cSmrg 52005a1a286Smrg if test "$opt_dry_run" = ":"; then 521d9c7fc6cSmrg # Return a directory name, but don't create it in dry-run mode 522d9c7fc6cSmrg my_tmpdir="${my_template}-$$" 523d9c7fc6cSmrg else 524d9c7fc6cSmrg 525d9c7fc6cSmrg # If mktemp works, use that first and foremost 526d9c7fc6cSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 527d9c7fc6cSmrg 528d9c7fc6cSmrg if test ! -d "$my_tmpdir"; then 52905a1a286Smrg # Failing that, at least try and use $RANDOM to avoid a race 53005a1a286Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 531d9c7fc6cSmrg 53205a1a286Smrg save_mktempdir_umask=`umask` 53305a1a286Smrg umask 0077 53405a1a286Smrg $MKDIR "$my_tmpdir" 53505a1a286Smrg umask $save_mktempdir_umask 536d9c7fc6cSmrg fi 537d9c7fc6cSmrg 538d9c7fc6cSmrg # If we're not in dry-run mode, bomb out on failure 53905a1a286Smrg test -d "$my_tmpdir" || \ 54005a1a286Smrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 541d9c7fc6cSmrg fi 542d9c7fc6cSmrg 54305a1a286Smrg $ECHO "$my_tmpdir" 544d9c7fc6cSmrg} 545d9c7fc6cSmrg 546d9c7fc6cSmrg 54705a1a286Smrg# func_quote_for_eval arg 54805a1a286Smrg# Aesthetically quote ARG to be evaled later. 54905a1a286Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 55005a1a286Smrg# is double-quoted, suitable for a subsequent eval, whereas 55105a1a286Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 55205a1a286Smrg# which are still active within double quotes backslashified. 55305a1a286Smrgfunc_quote_for_eval () 554d9c7fc6cSmrg{ 55505a1a286Smrg case $1 in 55605a1a286Smrg *[\\\`\"\$]*) 55705a1a286Smrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 55805a1a286Smrg *) 55905a1a286Smrg func_quote_for_eval_unquoted_result="$1" ;; 56005a1a286Smrg esac 56105a1a286Smrg 56205a1a286Smrg case $func_quote_for_eval_unquoted_result in 56305a1a286Smrg # Double-quote args containing shell metacharacters to delay 56405a1a286Smrg # word splitting, command substitution and and variable 56505a1a286Smrg # expansion for a subsequent eval. 56605a1a286Smrg # Many Bourne shells cannot handle close brackets correctly 56705a1a286Smrg # in scan sets, so we specify it separately. 56805a1a286Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 56905a1a286Smrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 57005a1a286Smrg ;; 57105a1a286Smrg *) 57205a1a286Smrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 573d9c7fc6cSmrg esac 574d9c7fc6cSmrg} 575d9c7fc6cSmrg 576d9c7fc6cSmrg 57705a1a286Smrg# func_quote_for_expand arg 57805a1a286Smrg# Aesthetically quote ARG to be evaled later; same as above, 57905a1a286Smrg# but do not quote variable references. 58005a1a286Smrgfunc_quote_for_expand () 581d9c7fc6cSmrg{ 58205a1a286Smrg case $1 in 58305a1a286Smrg *[\\\`\"]*) 58405a1a286Smrg my_arg=`$ECHO "$1" | $SED \ 58505a1a286Smrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 586d9c7fc6cSmrg *) 58705a1a286Smrg my_arg="$1" ;; 58805a1a286Smrg esac 58905a1a286Smrg 59005a1a286Smrg case $my_arg in 59105a1a286Smrg # Double-quote args containing shell metacharacters to delay 59205a1a286Smrg # word splitting and command substitution for a subsequent eval. 59305a1a286Smrg # Many Bourne shells cannot handle close brackets correctly 59405a1a286Smrg # in scan sets, so we specify it separately. 59505a1a286Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59605a1a286Smrg my_arg="\"$my_arg\"" 59705a1a286Smrg ;; 59805a1a286Smrg esac 59905a1a286Smrg 60005a1a286Smrg func_quote_for_expand_result="$my_arg" 601d9c7fc6cSmrg} 602d9c7fc6cSmrg 603d9c7fc6cSmrg 60405a1a286Smrg# func_show_eval cmd [fail_exp] 60505a1a286Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 60605a1a286Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 60705a1a286Smrg# is given, then evaluate it. 60805a1a286Smrgfunc_show_eval () 609d9c7fc6cSmrg{ 61005a1a286Smrg my_cmd="$1" 61105a1a286Smrg my_fail_exp="${2-:}" 612d9c7fc6cSmrg 61305a1a286Smrg ${opt_silent-false} || { 61405a1a286Smrg func_quote_for_expand "$my_cmd" 61505a1a286Smrg eval "func_echo $func_quote_for_expand_result" 61605a1a286Smrg } 61705a1a286Smrg 61805a1a286Smrg if ${opt_dry_run-false}; then :; else 61905a1a286Smrg eval "$my_cmd" 62005a1a286Smrg my_status=$? 62105a1a286Smrg if test "$my_status" -eq 0; then :; else 62205a1a286Smrg eval "(exit $my_status); $my_fail_exp" 62305a1a286Smrg fi 624d9c7fc6cSmrg fi 625d9c7fc6cSmrg} 626d9c7fc6cSmrg 62705a1a286Smrg 62805a1a286Smrg# func_show_eval_locale cmd [fail_exp] 62905a1a286Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 63005a1a286Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 63105a1a286Smrg# is given, then evaluate it. Use the saved locale for evaluation. 63205a1a286Smrgfunc_show_eval_locale () 633d9c7fc6cSmrg{ 63405a1a286Smrg my_cmd="$1" 63505a1a286Smrg my_fail_exp="${2-:}" 636d9c7fc6cSmrg 63705a1a286Smrg ${opt_silent-false} || { 63805a1a286Smrg func_quote_for_expand "$my_cmd" 63905a1a286Smrg eval "func_echo $func_quote_for_expand_result" 64005a1a286Smrg } 641d9c7fc6cSmrg 64205a1a286Smrg if ${opt_dry_run-false}; then :; else 64305a1a286Smrg eval "$lt_user_locale 64405a1a286Smrg $my_cmd" 64505a1a286Smrg my_status=$? 64605a1a286Smrg eval "$lt_safe_locale" 64705a1a286Smrg if test "$my_status" -eq 0; then :; else 64805a1a286Smrg eval "(exit $my_status); $my_fail_exp" 649d9c7fc6cSmrg fi 65005a1a286Smrg fi 651d9c7fc6cSmrg} 652d9c7fc6cSmrg 653d9c7fc6cSmrg 65405a1a286Smrg# func_version 65505a1a286Smrg# Echo version message to standard output and exit. 65605a1a286Smrgfunc_version () 65705a1a286Smrg{ 65805a1a286Smrg $SED -n '/(C)/!b go 65905a1a286Smrg :more 66005a1a286Smrg /\./!{ 66105a1a286Smrg N 66205a1a286Smrg s/\n# / / 66305a1a286Smrg b more 66405a1a286Smrg } 66505a1a286Smrg :go 66605a1a286Smrg /^# '$PROGRAM' (GNU /,/# warranty; / { 66705a1a286Smrg s/^# // 66805a1a286Smrg s/^# *$// 66905a1a286Smrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 67005a1a286Smrg p 67105a1a286Smrg }' < "$progpath" 67205a1a286Smrg exit $? 67305a1a286Smrg} 674d9c7fc6cSmrg 67505a1a286Smrg# func_usage 67605a1a286Smrg# Echo short help message to standard output and exit. 67705a1a286Smrgfunc_usage () 67805a1a286Smrg{ 67905a1a286Smrg $SED -n '/^# Usage:/,/^# *.*--help/ { 68005a1a286Smrg s/^# // 68105a1a286Smrg s/^# *$// 68205a1a286Smrg s/\$progname/'$progname'/ 68305a1a286Smrg p 68405a1a286Smrg }' < "$progpath" 68505a1a286Smrg echo 68605a1a286Smrg $ECHO "run \`$progname --help | more' for full usage" 68705a1a286Smrg exit $? 68805a1a286Smrg} 689d9c7fc6cSmrg 69005a1a286Smrg# func_help [NOEXIT] 69105a1a286Smrg# Echo long help message to standard output and exit, 69205a1a286Smrg# unless 'noexit' is passed as argument. 69305a1a286Smrgfunc_help () 69405a1a286Smrg{ 69505a1a286Smrg $SED -n '/^# Usage:/,/# Report bugs to/ { 69605a1a286Smrg s/^# // 69705a1a286Smrg s/^# *$// 69805a1a286Smrg s*\$progname*'$progname'* 69905a1a286Smrg s*\$host*'"$host"'* 70005a1a286Smrg s*\$SHELL*'"$SHELL"'* 70105a1a286Smrg s*\$LTCC*'"$LTCC"'* 70205a1a286Smrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 70305a1a286Smrg s*\$LD*'"$LD"'* 70405a1a286Smrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 70505a1a286Smrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 70605a1a286Smrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 70705a1a286Smrg p 70805a1a286Smrg }' < "$progpath" 70905a1a286Smrg ret=$? 71005a1a286Smrg if test -z "$1"; then 71105a1a286Smrg exit $ret 71205a1a286Smrg fi 71305a1a286Smrg} 714d9c7fc6cSmrg 71505a1a286Smrg# func_missing_arg argname 71605a1a286Smrg# Echo program name prefixed message to standard error and set global 71705a1a286Smrg# exit_cmd. 71805a1a286Smrgfunc_missing_arg () 71905a1a286Smrg{ 72005a1a286Smrg func_error "missing argument for $1." 72105a1a286Smrg exit_cmd=exit 72205a1a286Smrg} 723d9c7fc6cSmrg 72405a1a286Smrgexit_cmd=: 725d9c7fc6cSmrg 726d9c7fc6cSmrg 727d9c7fc6cSmrg 728d9c7fc6cSmrg 72905a1a286Smrg 73005a1a286Smrg 73105a1a286Smrgmagic="%%%MAGIC variable%%%" 73205a1a286Smrgmagic_exe="%%%MAGIC EXE variable%%%" 73305a1a286Smrg 73405a1a286Smrg# Global variables. 73505a1a286Smrg# $mode is unset 73605a1a286Smrgnonopt= 73705a1a286Smrgexecute_dlfiles= 73805a1a286Smrgpreserve_args= 73905a1a286Smrglo2o="s/\\.lo\$/.${objext}/" 74005a1a286Smrgo2lo="s/\\.${objext}\$/.lo/" 74105a1a286Smrgextracted_archives= 74205a1a286Smrgextracted_serial=0 74305a1a286Smrg 74405a1a286Smrgopt_dry_run=false 74505a1a286Smrgopt_duplicate_deps=false 74605a1a286Smrgopt_silent=false 74705a1a286Smrgopt_debug=: 74805a1a286Smrg 74905a1a286Smrg# If this variable is set in any of the actions, the command in it 75005a1a286Smrg# will be execed at the end. This prevents here-documents from being 75105a1a286Smrg# left over by shells. 75205a1a286Smrgexec_cmd= 75305a1a286Smrg 75405a1a286Smrg# func_fatal_configuration arg... 75505a1a286Smrg# Echo program name prefixed message to standard error, followed by 75605a1a286Smrg# a configuration failure hint, and exit. 75705a1a286Smrgfunc_fatal_configuration () 75805a1a286Smrg{ 75905a1a286Smrg func_error ${1+"$@"} 76005a1a286Smrg func_error "See the $PACKAGE documentation for more information." 76105a1a286Smrg func_fatal_error "Fatal configuration error." 76205a1a286Smrg} 76305a1a286Smrg 76405a1a286Smrg 76505a1a286Smrg# func_config 76605a1a286Smrg# Display the configuration for all the tags in this script. 76705a1a286Smrgfunc_config () 76805a1a286Smrg{ 76905a1a286Smrg re_begincf='^# ### BEGIN LIBTOOL' 77005a1a286Smrg re_endcf='^# ### END LIBTOOL' 77105a1a286Smrg 77205a1a286Smrg # Default configuration. 77305a1a286Smrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 77405a1a286Smrg 775d9c7fc6cSmrg # Now print the configurations for the tags. 776d9c7fc6cSmrg for tagname in $taglist; do 77705a1a286Smrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 778d9c7fc6cSmrg done 779d9c7fc6cSmrg 78005a1a286Smrg exit $? 78105a1a286Smrg} 782d9c7fc6cSmrg 78305a1a286Smrg# func_features 78405a1a286Smrg# Display the features supported by this script. 78505a1a286Smrgfunc_features () 78605a1a286Smrg{ 78705a1a286Smrg echo "host: $host" 788d9c7fc6cSmrg if test "$build_libtool_libs" = yes; then 78905a1a286Smrg echo "enable shared libraries" 790d9c7fc6cSmrg else 79105a1a286Smrg echo "disable shared libraries" 792d9c7fc6cSmrg fi 793d9c7fc6cSmrg if test "$build_old_libs" = yes; then 79405a1a286Smrg echo "enable static libraries" 795d9c7fc6cSmrg else 79605a1a286Smrg echo "disable static libraries" 797d9c7fc6cSmrg fi 79805a1a286Smrg 799d9c7fc6cSmrg exit $? 80005a1a286Smrg} 801d9c7fc6cSmrg 80205a1a286Smrg# func_enable_tag tagname 80305a1a286Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or 80405a1a286Smrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 80505a1a286Smrg# variable here. 80605a1a286Smrgfunc_enable_tag () 80705a1a286Smrg{ 80805a1a286Smrg # Global variable: 80905a1a286Smrg tagname="$1" 810d9c7fc6cSmrg 81105a1a286Smrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 81205a1a286Smrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 81305a1a286Smrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 814d9c7fc6cSmrg 81505a1a286Smrg # Validate tagname. 81605a1a286Smrg case $tagname in 81705a1a286Smrg *[!-_A-Za-z0-9,/]*) 81805a1a286Smrg func_fatal_error "invalid tag name: $tagname" 81905a1a286Smrg ;; 82005a1a286Smrg esac 821d9c7fc6cSmrg 82205a1a286Smrg # Don't test for the "default" C tag, as we know it's 82305a1a286Smrg # there but not specially marked. 82405a1a286Smrg case $tagname in 82505a1a286Smrg CC) ;; 82605a1a286Smrg *) 82705a1a286Smrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 82805a1a286Smrg taglist="$taglist $tagname" 82905a1a286Smrg 83005a1a286Smrg # Evaluate the configuration. Be careful to quote the path 83105a1a286Smrg # and the sed script, to avoid splitting on whitespace, but 83205a1a286Smrg # also don't use non-portable quotes within backquotes within 83305a1a286Smrg # quotes we have to do it in 2 steps: 83405a1a286Smrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 83505a1a286Smrg eval "$extractedcf" 83605a1a286Smrg else 83705a1a286Smrg func_error "ignoring unknown tag $tagname" 83805a1a286Smrg fi 83905a1a286Smrg ;; 84005a1a286Smrg esac 84105a1a286Smrg} 842d9c7fc6cSmrg 84305a1a286Smrg# Parse options once, thoroughly. This comes as soon as possible in 84405a1a286Smrg# the script to make things like `libtool --version' happen quickly. 84505a1a286Smrg{ 84605a1a286Smrg 84705a1a286Smrg # Shorthand for --mode=foo, only valid as the first argument 84805a1a286Smrg case $1 in 84905a1a286Smrg clean|clea|cle|cl) 85005a1a286Smrg shift; set dummy --mode clean ${1+"$@"}; shift 851d9c7fc6cSmrg ;; 85205a1a286Smrg compile|compil|compi|comp|com|co|c) 85305a1a286Smrg shift; set dummy --mode compile ${1+"$@"}; shift 854d9c7fc6cSmrg ;; 85505a1a286Smrg execute|execut|execu|exec|exe|ex|e) 85605a1a286Smrg shift; set dummy --mode execute ${1+"$@"}; shift 857d9c7fc6cSmrg ;; 85805a1a286Smrg finish|finis|fini|fin|fi|f) 85905a1a286Smrg shift; set dummy --mode finish ${1+"$@"}; shift 860d9c7fc6cSmrg ;; 86105a1a286Smrg install|instal|insta|inst|ins|in|i) 86205a1a286Smrg shift; set dummy --mode install ${1+"$@"}; shift 86305a1a286Smrg ;; 86405a1a286Smrg link|lin|li|l) 86505a1a286Smrg shift; set dummy --mode link ${1+"$@"}; shift 86605a1a286Smrg ;; 86705a1a286Smrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 86805a1a286Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 869d9c7fc6cSmrg ;; 870d9c7fc6cSmrg esac 871d9c7fc6cSmrg 87205a1a286Smrg # Parse non-mode specific arguments: 87305a1a286Smrg while test "$#" -gt 0; do 87405a1a286Smrg opt="$1" 87505a1a286Smrg shift 876d9c7fc6cSmrg 87705a1a286Smrg case $opt in 87805a1a286Smrg --config) func_config ;; 879d9c7fc6cSmrg 88005a1a286Smrg --debug) preserve_args="$preserve_args $opt" 88105a1a286Smrg func_echo "enabling shell trace mode" 88205a1a286Smrg opt_debug='set -x' 88305a1a286Smrg $opt_debug 88405a1a286Smrg ;; 885d9c7fc6cSmrg 88605a1a286Smrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 88705a1a286Smrg execute_dlfiles="$execute_dlfiles $1" 88805a1a286Smrg shift 88905a1a286Smrg ;; 890d9c7fc6cSmrg 89105a1a286Smrg --dry-run | -n) opt_dry_run=: ;; 89205a1a286Smrg --features) func_features ;; 89305a1a286Smrg --finish) mode="finish" ;; 89405a1a286Smrg 89505a1a286Smrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 89605a1a286Smrg case $1 in 89705a1a286Smrg # Valid mode arguments: 89805a1a286Smrg clean) ;; 89905a1a286Smrg compile) ;; 90005a1a286Smrg execute) ;; 90105a1a286Smrg finish) ;; 90205a1a286Smrg install) ;; 90305a1a286Smrg link) ;; 90405a1a286Smrg relink) ;; 90505a1a286Smrg uninstall) ;; 90605a1a286Smrg 90705a1a286Smrg # Catch anything else as an error 90805a1a286Smrg *) func_error "invalid argument for $opt" 90905a1a286Smrg exit_cmd=exit 91005a1a286Smrg break 91105a1a286Smrg ;; 91205a1a286Smrg esac 91305a1a286Smrg 91405a1a286Smrg mode="$1" 91505a1a286Smrg shift 91605a1a286Smrg ;; 91705a1a286Smrg 91805a1a286Smrg --preserve-dup-deps) 91905a1a286Smrg opt_duplicate_deps=: ;; 92005a1a286Smrg 92105a1a286Smrg --quiet|--silent) preserve_args="$preserve_args $opt" 92205a1a286Smrg opt_silent=: 92305a1a286Smrg opt_verbose=false 92405a1a286Smrg ;; 92505a1a286Smrg 92605a1a286Smrg --no-quiet|--no-silent) 92705a1a286Smrg preserve_args="$preserve_args $opt" 92805a1a286Smrg opt_silent=false 92905a1a286Smrg ;; 93005a1a286Smrg 93105a1a286Smrg --verbose| -v) preserve_args="$preserve_args $opt" 93205a1a286Smrg opt_silent=false 93305a1a286Smrg opt_verbose=: 93405a1a286Smrg ;; 93505a1a286Smrg 93605a1a286Smrg --no-verbose) preserve_args="$preserve_args $opt" 93705a1a286Smrg opt_verbose=false 93805a1a286Smrg ;; 93905a1a286Smrg 94005a1a286Smrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 94105a1a286Smrg preserve_args="$preserve_args $opt $1" 94205a1a286Smrg func_enable_tag "$1" # tagname is set here 94305a1a286Smrg shift 94405a1a286Smrg ;; 94505a1a286Smrg 94605a1a286Smrg # Separate optargs to long options: 94705a1a286Smrg -dlopen=*|--mode=*|--tag=*) 94805a1a286Smrg func_opt_split "$opt" 94905a1a286Smrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 95005a1a286Smrg shift 95105a1a286Smrg ;; 95205a1a286Smrg 95305a1a286Smrg -\?|-h) func_usage ;; 95405a1a286Smrg --help) opt_help=: ;; 95505a1a286Smrg --help-all) opt_help=': help-all' ;; 95605a1a286Smrg --version) func_version ;; 95705a1a286Smrg 95805a1a286Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 95905a1a286Smrg 96005a1a286Smrg *) nonopt="$opt" 96105a1a286Smrg break 96205a1a286Smrg ;; 96305a1a286Smrg esac 96405a1a286Smrg done 96505a1a286Smrg 96605a1a286Smrg 96705a1a286Smrg case $host in 96805a1a286Smrg *cygwin* | *mingw* | *pw32* | *cegcc*) 96905a1a286Smrg # don't eliminate duplications in $postdeps and $predeps 97005a1a286Smrg opt_duplicate_compiler_generated_deps=: 971d9c7fc6cSmrg ;; 972d9c7fc6cSmrg *) 97305a1a286Smrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 97405a1a286Smrg ;; 97505a1a286Smrg esac 976d9c7fc6cSmrg 97705a1a286Smrg # Having warned about all mis-specified options, bail out if 97805a1a286Smrg # anything was wrong. 97905a1a286Smrg $exit_cmd $EXIT_FAILURE 98005a1a286Smrg} 98105a1a286Smrg 98205a1a286Smrg# func_check_version_match 98305a1a286Smrg# Ensure that we are using m4 macros, and libtool script from the same 98405a1a286Smrg# release of libtool. 98505a1a286Smrgfunc_check_version_match () 98605a1a286Smrg{ 98705a1a286Smrg if test "$package_revision" != "$macro_revision"; then 98805a1a286Smrg if test "$VERSION" != "$macro_version"; then 98905a1a286Smrg if test -z "$macro_version"; then 99005a1a286Smrg cat >&2 <<_LT_EOF 99105a1a286Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99205a1a286Smrg$progname: definition of this LT_INIT comes from an older release. 99305a1a286Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 99405a1a286Smrg$progname: and run autoconf again. 99505a1a286Smrg_LT_EOF 99605a1a286Smrg else 99705a1a286Smrg cat >&2 <<_LT_EOF 99805a1a286Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99905a1a286Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 100005a1a286Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 100105a1a286Smrg$progname: and run autoconf again. 100205a1a286Smrg_LT_EOF 1003d9c7fc6cSmrg fi 100405a1a286Smrg else 100505a1a286Smrg cat >&2 <<_LT_EOF 100605a1a286Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 100705a1a286Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 100805a1a286Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 100905a1a286Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 101005a1a286Smrg_LT_EOF 101105a1a286Smrg fi 101205a1a286Smrg 101305a1a286Smrg exit $EXIT_MISMATCH 101405a1a286Smrg fi 101505a1a286Smrg} 101605a1a286Smrg 101705a1a286Smrg 101805a1a286Smrg## ----------- ## 101905a1a286Smrg## Main. ## 102005a1a286Smrg## ----------- ## 102105a1a286Smrg 102205a1a286Smrg$opt_help || { 102305a1a286Smrg # Sanity checks first: 102405a1a286Smrg func_check_version_match 102505a1a286Smrg 102605a1a286Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 102705a1a286Smrg func_fatal_configuration "not configured to build any kind of library" 1028d9c7fc6cSmrg fi 1029d9c7fc6cSmrg 103005a1a286Smrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 103105a1a286Smrg 103205a1a286Smrg 103305a1a286Smrg # Darwin sucks 103405a1a286Smrg eval std_shrext=\"$shrext_cmds\" 103505a1a286Smrg 103605a1a286Smrg 1037d9c7fc6cSmrg # Only execute mode is allowed to have -dlopen flags. 1038d9c7fc6cSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 103905a1a286Smrg func_error "unrecognized option \`-dlopen'" 104005a1a286Smrg $ECHO "$help" 1>&2 1041d9c7fc6cSmrg exit $EXIT_FAILURE 1042d9c7fc6cSmrg fi 1043d9c7fc6cSmrg 1044d9c7fc6cSmrg # Change the help message to a mode-specific one. 1045d9c7fc6cSmrg generic_help="$help" 104605a1a286Smrg help="Try \`$progname --help --mode=$mode' for more information." 104705a1a286Smrg} 1048d9c7fc6cSmrg 1049d9c7fc6cSmrg 105005a1a286Smrg# func_lalib_p file 105105a1a286Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 105205a1a286Smrg# This function is only a basic sanity check; it will hardly flush out 105305a1a286Smrg# determined imposters. 105405a1a286Smrgfunc_lalib_p () 105505a1a286Smrg{ 105605a1a286Smrg test -f "$1" && 105705a1a286Smrg $SED -e 4q "$1" 2>/dev/null \ 105805a1a286Smrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 105905a1a286Smrg} 1060d9c7fc6cSmrg 106105a1a286Smrg# func_lalib_unsafe_p file 106205a1a286Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 106305a1a286Smrg# This function implements the same check as func_lalib_p without 106405a1a286Smrg# resorting to external programs. To this end, it redirects stdin and 106505a1a286Smrg# closes it afterwards, without saving the original file descriptor. 106605a1a286Smrg# As a safety measure, use it only where a negative result would be 106705a1a286Smrg# fatal anyway. Works if `file' does not exist. 106805a1a286Smrgfunc_lalib_unsafe_p () 106905a1a286Smrg{ 107005a1a286Smrg lalib_p=no 107105a1a286Smrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 107205a1a286Smrg for lalib_p_l in 1 2 3 4 107305a1a286Smrg do 107405a1a286Smrg read lalib_p_line 107505a1a286Smrg case "$lalib_p_line" in 107605a1a286Smrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 107705a1a286Smrg esac 107805a1a286Smrg done 107905a1a286Smrg exec 0<&5 5<&- 108005a1a286Smrg fi 108105a1a286Smrg test "$lalib_p" = yes 108205a1a286Smrg} 1083d9c7fc6cSmrg 108405a1a286Smrg# func_ltwrapper_script_p file 108505a1a286Smrg# True iff FILE is a libtool wrapper script 108605a1a286Smrg# This function is only a basic sanity check; it will hardly flush out 108705a1a286Smrg# determined imposters. 108805a1a286Smrgfunc_ltwrapper_script_p () 108905a1a286Smrg{ 109005a1a286Smrg func_lalib_p "$1" 109105a1a286Smrg} 1092d9c7fc6cSmrg 109305a1a286Smrg# func_ltwrapper_executable_p file 109405a1a286Smrg# True iff FILE is a libtool wrapper executable 109505a1a286Smrg# This function is only a basic sanity check; it will hardly flush out 109605a1a286Smrg# determined imposters. 109705a1a286Smrgfunc_ltwrapper_executable_p () 109805a1a286Smrg{ 109905a1a286Smrg func_ltwrapper_exec_suffix= 110005a1a286Smrg case $1 in 110105a1a286Smrg *.exe) ;; 110205a1a286Smrg *) func_ltwrapper_exec_suffix=.exe ;; 110305a1a286Smrg esac 110405a1a286Smrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 110505a1a286Smrg} 1106d9c7fc6cSmrg 110705a1a286Smrg# func_ltwrapper_scriptname file 110805a1a286Smrg# Assumes file is an ltwrapper_executable 110905a1a286Smrg# uses $file to determine the appropriate filename for a 111005a1a286Smrg# temporary ltwrapper_script. 111105a1a286Smrgfunc_ltwrapper_scriptname () 111205a1a286Smrg{ 111305a1a286Smrg func_ltwrapper_scriptname_result="" 111405a1a286Smrg if func_ltwrapper_executable_p "$1"; then 111505a1a286Smrg func_dirname_and_basename "$1" "" "." 111605a1a286Smrg func_stripname '' '.exe' "$func_basename_result" 111705a1a286Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 111805a1a286Smrg fi 111905a1a286Smrg} 112005a1a286Smrg 112105a1a286Smrg# func_ltwrapper_p file 112205a1a286Smrg# True iff FILE is a libtool wrapper script or wrapper executable 112305a1a286Smrg# This function is only a basic sanity check; it will hardly flush out 112405a1a286Smrg# determined imposters. 112505a1a286Smrgfunc_ltwrapper_p () 112605a1a286Smrg{ 112705a1a286Smrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 112805a1a286Smrg} 112905a1a286Smrg 113005a1a286Smrg 113105a1a286Smrg# func_execute_cmds commands fail_cmd 113205a1a286Smrg# Execute tilde-delimited COMMANDS. 113305a1a286Smrg# If FAIL_CMD is given, eval that upon failure. 113405a1a286Smrg# FAIL_CMD may read-access the current command in variable CMD! 113505a1a286Smrgfunc_execute_cmds () 113605a1a286Smrg{ 113705a1a286Smrg $opt_debug 113805a1a286Smrg save_ifs=$IFS; IFS='~' 113905a1a286Smrg for cmd in $1; do 114005a1a286Smrg IFS=$save_ifs 114105a1a286Smrg eval cmd=\"$cmd\" 114205a1a286Smrg func_show_eval "$cmd" "${2-:}" 114305a1a286Smrg done 114405a1a286Smrg IFS=$save_ifs 114505a1a286Smrg} 114605a1a286Smrg 114705a1a286Smrg 114805a1a286Smrg# func_source file 114905a1a286Smrg# Source FILE, adding directory component if necessary. 115005a1a286Smrg# Note that it is not necessary on cygwin/mingw to append a dot to 115105a1a286Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 115205a1a286Smrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 115305a1a286Smrg# `FILE.' does not work on cygwin managed mounts. 115405a1a286Smrgfunc_source () 115505a1a286Smrg{ 115605a1a286Smrg $opt_debug 115705a1a286Smrg case $1 in 115805a1a286Smrg */* | *\\*) . "$1" ;; 115905a1a286Smrg *) . "./$1" ;; 116005a1a286Smrg esac 116105a1a286Smrg} 116205a1a286Smrg 116305a1a286Smrg 116405a1a286Smrg# func_infer_tag arg 116505a1a286Smrg# Infer tagged configuration to use if any are available and 116605a1a286Smrg# if one wasn't chosen via the "--tag" command line option. 116705a1a286Smrg# Only attempt this if the compiler in the base compile 116805a1a286Smrg# command doesn't match the default compiler. 116905a1a286Smrg# arg is usually of the form 'gcc ...' 117005a1a286Smrgfunc_infer_tag () 117105a1a286Smrg{ 117205a1a286Smrg $opt_debug 117305a1a286Smrg if test -n "$available_tags" && test -z "$tagname"; then 117405a1a286Smrg CC_quoted= 117505a1a286Smrg for arg in $CC; do 117605a1a286Smrg func_quote_for_eval "$arg" 117705a1a286Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 117805a1a286Smrg done 117905a1a286Smrg CC_expanded=`func_echo_all $CC` 118005a1a286Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 118105a1a286Smrg case $@ in 118205a1a286Smrg # Blanks in the command may have been stripped by the calling shell, 118305a1a286Smrg # but not from the CC environment variable when configure was run. 118405a1a286Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 118505a1a286Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 118605a1a286Smrg # Blanks at the start of $base_compile will cause this to fail 118705a1a286Smrg # if we don't check for them as well. 118805a1a286Smrg *) 118905a1a286Smrg for z in $available_tags; do 119005a1a286Smrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 119105a1a286Smrg # Evaluate the configuration. 119205a1a286Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 119305a1a286Smrg CC_quoted= 119405a1a286Smrg for arg in $CC; do 119505a1a286Smrg # Double-quote args containing other shell metacharacters. 119605a1a286Smrg func_quote_for_eval "$arg" 119705a1a286Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 119805a1a286Smrg done 119905a1a286Smrg CC_expanded=`func_echo_all $CC` 120005a1a286Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 120105a1a286Smrg case "$@ " in 120205a1a286Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 120305a1a286Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 120405a1a286Smrg # The compiler in the base compile command matches 120505a1a286Smrg # the one in the tagged configuration. 120605a1a286Smrg # Assume this is the tagged configuration we want. 120705a1a286Smrg tagname=$z 120805a1a286Smrg break 120905a1a286Smrg ;; 121005a1a286Smrg esac 121105a1a286Smrg fi 121205a1a286Smrg done 121305a1a286Smrg # If $tagname still isn't set, then no tagged configuration 121405a1a286Smrg # was found and let the user know that the "--tag" command 121505a1a286Smrg # line option must be used. 121605a1a286Smrg if test -z "$tagname"; then 121705a1a286Smrg func_echo "unable to infer tagged configuration" 121805a1a286Smrg func_fatal_error "specify a tag with \`--tag'" 121905a1a286Smrg# else 122005a1a286Smrg# func_verbose "using $tagname tagged configuration" 122105a1a286Smrg fi 122205a1a286Smrg ;; 122305a1a286Smrg esac 122405a1a286Smrg fi 122505a1a286Smrg} 122605a1a286Smrg 122705a1a286Smrg 122805a1a286Smrg 122905a1a286Smrg# func_write_libtool_object output_name pic_name nonpic_name 123005a1a286Smrg# Create a libtool object file (analogous to a ".la" file), 123105a1a286Smrg# but don't create it if we're doing a dry run. 123205a1a286Smrgfunc_write_libtool_object () 123305a1a286Smrg{ 123405a1a286Smrg write_libobj=${1} 123505a1a286Smrg if test "$build_libtool_libs" = yes; then 123605a1a286Smrg write_lobj=\'${2}\' 123705a1a286Smrg else 123805a1a286Smrg write_lobj=none 123905a1a286Smrg fi 124005a1a286Smrg 124105a1a286Smrg if test "$build_old_libs" = yes; then 124205a1a286Smrg write_oldobj=\'${3}\' 124305a1a286Smrg else 124405a1a286Smrg write_oldobj=none 124505a1a286Smrg fi 124605a1a286Smrg 124705a1a286Smrg $opt_dry_run || { 124805a1a286Smrg cat >${write_libobj}T <<EOF 124905a1a286Smrg# $write_libobj - a libtool object file 125005a1a286Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 125105a1a286Smrg# 125205a1a286Smrg# Please DO NOT delete this file! 125305a1a286Smrg# It is necessary for linking the library. 125405a1a286Smrg 125505a1a286Smrg# Name of the PIC object. 125605a1a286Smrgpic_object=$write_lobj 125705a1a286Smrg 125805a1a286Smrg# Name of the non-PIC object 125905a1a286Smrgnon_pic_object=$write_oldobj 126005a1a286Smrg 126105a1a286SmrgEOF 126205a1a286Smrg $MV "${write_libobj}T" "${write_libobj}" 126305a1a286Smrg } 126405a1a286Smrg} 126505a1a286Smrg 126605a1a286Smrg# func_mode_compile arg... 126705a1a286Smrgfunc_mode_compile () 126805a1a286Smrg{ 126905a1a286Smrg $opt_debug 127005a1a286Smrg # Get the compilation command and the source file. 127105a1a286Smrg base_compile= 127205a1a286Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 127305a1a286Smrg suppress_opt=yes 127405a1a286Smrg suppress_output= 127505a1a286Smrg arg_mode=normal 127605a1a286Smrg libobj= 127705a1a286Smrg later= 127805a1a286Smrg pie_flag= 127905a1a286Smrg 128005a1a286Smrg for arg 128105a1a286Smrg do 128205a1a286Smrg case $arg_mode in 128305a1a286Smrg arg ) 128405a1a286Smrg # do not "continue". Instead, add this to base_compile 128505a1a286Smrg lastarg="$arg" 128605a1a286Smrg arg_mode=normal 128705a1a286Smrg ;; 128805a1a286Smrg 128905a1a286Smrg target ) 129005a1a286Smrg libobj="$arg" 129105a1a286Smrg arg_mode=normal 129205a1a286Smrg continue 129305a1a286Smrg ;; 129405a1a286Smrg 129505a1a286Smrg normal ) 129605a1a286Smrg # Accept any command-line options. 129705a1a286Smrg case $arg in 129805a1a286Smrg -o) 129905a1a286Smrg test -n "$libobj" && \ 130005a1a286Smrg func_fatal_error "you cannot specify \`-o' more than once" 130105a1a286Smrg arg_mode=target 130205a1a286Smrg continue 130305a1a286Smrg ;; 130405a1a286Smrg 130505a1a286Smrg -pie | -fpie | -fPIE) 130605a1a286Smrg pie_flag="$pie_flag $arg" 130705a1a286Smrg continue 130805a1a286Smrg ;; 130905a1a286Smrg 131005a1a286Smrg -shared | -static | -prefer-pic | -prefer-non-pic) 131105a1a286Smrg later="$later $arg" 131205a1a286Smrg continue 131305a1a286Smrg ;; 131405a1a286Smrg 131505a1a286Smrg -no-suppress) 131605a1a286Smrg suppress_opt=no 131705a1a286Smrg continue 1318d9c7fc6cSmrg ;; 1319d9c7fc6cSmrg 1320d9c7fc6cSmrg -Xcompiler) 1321d9c7fc6cSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 1322d9c7fc6cSmrg continue # The current "srcfile" will either be retained or 1323d9c7fc6cSmrg ;; # replaced later. I would guess that would be a bug. 1324d9c7fc6cSmrg 1325d9c7fc6cSmrg -Wc,*) 132605a1a286Smrg func_stripname '-Wc,' '' "$arg" 132705a1a286Smrg args=$func_stripname_result 1328d9c7fc6cSmrg lastarg= 1329d9c7fc6cSmrg save_ifs="$IFS"; IFS=',' 133005a1a286Smrg for arg in $args; do 1331d9c7fc6cSmrg IFS="$save_ifs" 133205a1a286Smrg func_quote_for_eval "$arg" 133305a1a286Smrg lastarg="$lastarg $func_quote_for_eval_result" 1334d9c7fc6cSmrg done 1335d9c7fc6cSmrg IFS="$save_ifs" 133605a1a286Smrg func_stripname ' ' '' "$lastarg" 133705a1a286Smrg lastarg=$func_stripname_result 1338d9c7fc6cSmrg 1339d9c7fc6cSmrg # Add the arguments to base_compile. 1340d9c7fc6cSmrg base_compile="$base_compile $lastarg" 1341d9c7fc6cSmrg continue 1342d9c7fc6cSmrg ;; 1343d9c7fc6cSmrg 134405a1a286Smrg *) 1345d9c7fc6cSmrg # Accept the current argument as the source file. 1346d9c7fc6cSmrg # The previous "srcfile" becomes the current argument. 1347d9c7fc6cSmrg # 1348d9c7fc6cSmrg lastarg="$srcfile" 1349d9c7fc6cSmrg srcfile="$arg" 1350d9c7fc6cSmrg ;; 1351d9c7fc6cSmrg esac # case $arg 1352d9c7fc6cSmrg ;; 1353d9c7fc6cSmrg esac # case $arg_mode 1354d9c7fc6cSmrg 1355d9c7fc6cSmrg # Aesthetically quote the previous argument. 135605a1a286Smrg func_quote_for_eval "$lastarg" 135705a1a286Smrg base_compile="$base_compile $func_quote_for_eval_result" 1358d9c7fc6cSmrg done # for arg 1359d9c7fc6cSmrg 1360d9c7fc6cSmrg case $arg_mode in 1361d9c7fc6cSmrg arg) 136205a1a286Smrg func_fatal_error "you must specify an argument for -Xcompile" 1363d9c7fc6cSmrg ;; 1364d9c7fc6cSmrg target) 136505a1a286Smrg func_fatal_error "you must specify a target with \`-o'" 1366d9c7fc6cSmrg ;; 1367d9c7fc6cSmrg *) 1368d9c7fc6cSmrg # Get the name of the library object. 136905a1a286Smrg test -z "$libobj" && { 137005a1a286Smrg func_basename "$srcfile" 137105a1a286Smrg libobj="$func_basename_result" 137205a1a286Smrg } 1373d9c7fc6cSmrg ;; 1374d9c7fc6cSmrg esac 1375d9c7fc6cSmrg 1376d9c7fc6cSmrg # Recognize several different file suffixes. 1377d9c7fc6cSmrg # If the user specifies -o file.o, it is replaced with file.lo 1378d9c7fc6cSmrg case $libobj in 137905a1a286Smrg *.[cCFSifmso] | \ 138005a1a286Smrg *.ada | *.adb | *.ads | *.asm | \ 138105a1a286Smrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 138205a1a286Smrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 138305a1a286Smrg func_xform "$libobj" 138405a1a286Smrg libobj=$func_xform_result 138505a1a286Smrg ;; 1386d9c7fc6cSmrg esac 1387d9c7fc6cSmrg 1388d9c7fc6cSmrg case $libobj in 138905a1a286Smrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1390d9c7fc6cSmrg *) 139105a1a286Smrg func_fatal_error "cannot determine name of library object from \`$libobj'" 1392d9c7fc6cSmrg ;; 1393d9c7fc6cSmrg esac 1394d9c7fc6cSmrg 1395d9c7fc6cSmrg func_infer_tag $base_compile 1396d9c7fc6cSmrg 1397d9c7fc6cSmrg for arg in $later; do 1398d9c7fc6cSmrg case $arg in 139905a1a286Smrg -shared) 140005a1a286Smrg test "$build_libtool_libs" != yes && \ 140105a1a286Smrg func_fatal_configuration "can not build a shared library" 140205a1a286Smrg build_old_libs=no 140305a1a286Smrg continue 140405a1a286Smrg ;; 140505a1a286Smrg 1406d9c7fc6cSmrg -static) 140705a1a286Smrg build_libtool_libs=no 1408d9c7fc6cSmrg build_old_libs=yes 1409d9c7fc6cSmrg continue 1410d9c7fc6cSmrg ;; 1411d9c7fc6cSmrg 1412d9c7fc6cSmrg -prefer-pic) 1413d9c7fc6cSmrg pic_mode=yes 1414d9c7fc6cSmrg continue 1415d9c7fc6cSmrg ;; 1416d9c7fc6cSmrg 1417d9c7fc6cSmrg -prefer-non-pic) 1418d9c7fc6cSmrg pic_mode=no 1419d9c7fc6cSmrg continue 1420d9c7fc6cSmrg ;; 1421d9c7fc6cSmrg esac 1422d9c7fc6cSmrg done 1423d9c7fc6cSmrg 142405a1a286Smrg func_quote_for_eval "$libobj" 142505a1a286Smrg test "X$libobj" != "X$func_quote_for_eval_result" \ 142605a1a286Smrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 142705a1a286Smrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 142805a1a286Smrg func_dirname_and_basename "$obj" "/" "" 142905a1a286Smrg objname="$func_basename_result" 143005a1a286Smrg xdir="$func_dirname_result" 1431d9c7fc6cSmrg lobj=${xdir}$objdir/$objname 1432d9c7fc6cSmrg 143305a1a286Smrg test -z "$base_compile" && \ 143405a1a286Smrg func_fatal_help "you must specify a compilation command" 1435d9c7fc6cSmrg 1436d9c7fc6cSmrg # Delete any leftover library objects. 1437d9c7fc6cSmrg if test "$build_old_libs" = yes; then 1438d9c7fc6cSmrg removelist="$obj $lobj $libobj ${libobj}T" 1439d9c7fc6cSmrg else 1440d9c7fc6cSmrg removelist="$lobj $libobj ${libobj}T" 1441d9c7fc6cSmrg fi 1442d9c7fc6cSmrg 1443d9c7fc6cSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 1444d9c7fc6cSmrg case $host_os in 144505a1a286Smrg cygwin* | mingw* | pw32* | os2* | cegcc*) 1446d9c7fc6cSmrg pic_mode=default 1447d9c7fc6cSmrg ;; 1448d9c7fc6cSmrg esac 1449d9c7fc6cSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1450d9c7fc6cSmrg # non-PIC code in shared libraries is not supported 1451d9c7fc6cSmrg pic_mode=default 1452d9c7fc6cSmrg fi 1453d9c7fc6cSmrg 1454d9c7fc6cSmrg # Calculate the filename of the output object if compiler does 1455d9c7fc6cSmrg # not support -o with -c 1456d9c7fc6cSmrg if test "$compiler_c_o" = no; then 145705a1a286Smrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 1458d9c7fc6cSmrg lockfile="$output_obj.lock" 1459d9c7fc6cSmrg else 1460d9c7fc6cSmrg output_obj= 1461d9c7fc6cSmrg need_locks=no 1462d9c7fc6cSmrg lockfile= 1463d9c7fc6cSmrg fi 1464d9c7fc6cSmrg 1465d9c7fc6cSmrg # Lock this critical section if it is needed 1466d9c7fc6cSmrg # We use this script file to make the link, it avoids creating a new file 1467d9c7fc6cSmrg if test "$need_locks" = yes; then 146805a1a286Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 146905a1a286Smrg func_echo "Waiting for $lockfile to be removed" 1470d9c7fc6cSmrg sleep 2 1471d9c7fc6cSmrg done 1472d9c7fc6cSmrg elif test "$need_locks" = warn; then 1473d9c7fc6cSmrg if test -f "$lockfile"; then 147405a1a286Smrg $ECHO "\ 1475d9c7fc6cSmrg*** ERROR, $lockfile exists and contains: 1476d9c7fc6cSmrg`cat $lockfile 2>/dev/null` 1477d9c7fc6cSmrg 1478d9c7fc6cSmrgThis indicates that another process is trying to use the same 1479d9c7fc6cSmrgtemporary object file, and libtool could not work around it because 1480d9c7fc6cSmrgyour compiler does not support \`-c' and \`-o' together. If you 1481d9c7fc6cSmrgrepeat this compilation, it may succeed, by chance, but you had better 1482d9c7fc6cSmrgavoid parallel builds (make -j) in this platform, or get a better 1483d9c7fc6cSmrgcompiler." 1484d9c7fc6cSmrg 148505a1a286Smrg $opt_dry_run || $RM $removelist 1486d9c7fc6cSmrg exit $EXIT_FAILURE 1487d9c7fc6cSmrg fi 148805a1a286Smrg removelist="$removelist $output_obj" 148905a1a286Smrg $ECHO "$srcfile" > "$lockfile" 1490d9c7fc6cSmrg fi 1491d9c7fc6cSmrg 149205a1a286Smrg $opt_dry_run || $RM $removelist 149305a1a286Smrg removelist="$removelist $lockfile" 149405a1a286Smrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 149505a1a286Smrg 1496d9c7fc6cSmrg if test -n "$fix_srcfile_path"; then 1497d9c7fc6cSmrg eval srcfile=\"$fix_srcfile_path\" 1498d9c7fc6cSmrg fi 149905a1a286Smrg func_quote_for_eval "$srcfile" 150005a1a286Smrg qsrcfile=$func_quote_for_eval_result 1501d9c7fc6cSmrg 1502d9c7fc6cSmrg # Only build a PIC object if we are building libtool libraries. 1503d9c7fc6cSmrg if test "$build_libtool_libs" = yes; then 1504d9c7fc6cSmrg # Without this assignment, base_compile gets emptied. 1505d9c7fc6cSmrg fbsd_hideous_sh_bug=$base_compile 1506d9c7fc6cSmrg 1507d9c7fc6cSmrg if test "$pic_mode" != no; then 1508d9c7fc6cSmrg command="$base_compile $qsrcfile $pic_flag" 1509d9c7fc6cSmrg else 1510d9c7fc6cSmrg # Don't build PIC code 1511d9c7fc6cSmrg command="$base_compile $qsrcfile" 1512d9c7fc6cSmrg fi 1513d9c7fc6cSmrg 151405a1a286Smrg func_mkdir_p "$xdir$objdir" 1515d9c7fc6cSmrg 1516d9c7fc6cSmrg if test -z "$output_obj"; then 1517d9c7fc6cSmrg # Place PIC objects in $objdir 1518d9c7fc6cSmrg command="$command -o $lobj" 1519d9c7fc6cSmrg fi 1520d9c7fc6cSmrg 152105a1a286Smrg func_show_eval_locale "$command" \ 152205a1a286Smrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1523d9c7fc6cSmrg 1524d9c7fc6cSmrg if test "$need_locks" = warn && 1525d9c7fc6cSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 152605a1a286Smrg $ECHO "\ 1527d9c7fc6cSmrg*** ERROR, $lockfile contains: 1528d9c7fc6cSmrg`cat $lockfile 2>/dev/null` 1529d9c7fc6cSmrg 1530d9c7fc6cSmrgbut it should contain: 1531d9c7fc6cSmrg$srcfile 1532d9c7fc6cSmrg 1533d9c7fc6cSmrgThis indicates that another process is trying to use the same 1534d9c7fc6cSmrgtemporary object file, and libtool could not work around it because 1535d9c7fc6cSmrgyour compiler does not support \`-c' and \`-o' together. If you 1536d9c7fc6cSmrgrepeat this compilation, it may succeed, by chance, but you had better 1537d9c7fc6cSmrgavoid parallel builds (make -j) in this platform, or get a better 1538d9c7fc6cSmrgcompiler." 1539d9c7fc6cSmrg 154005a1a286Smrg $opt_dry_run || $RM $removelist 1541d9c7fc6cSmrg exit $EXIT_FAILURE 1542d9c7fc6cSmrg fi 1543d9c7fc6cSmrg 1544d9c7fc6cSmrg # Just move the object if needed, then go on to compile the next one 1545d9c7fc6cSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 154605a1a286Smrg func_show_eval '$MV "$output_obj" "$lobj"' \ 154705a1a286Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1548d9c7fc6cSmrg fi 1549d9c7fc6cSmrg 1550d9c7fc6cSmrg # Allow error messages only from the first compilation. 1551d9c7fc6cSmrg if test "$suppress_opt" = yes; then 155205a1a286Smrg suppress_output=' >/dev/null 2>&1' 1553d9c7fc6cSmrg fi 1554d9c7fc6cSmrg fi 1555d9c7fc6cSmrg 1556d9c7fc6cSmrg # Only build a position-dependent object if we build old libraries. 1557d9c7fc6cSmrg if test "$build_old_libs" = yes; then 1558d9c7fc6cSmrg if test "$pic_mode" != yes; then 1559d9c7fc6cSmrg # Don't build PIC code 156005a1a286Smrg command="$base_compile $qsrcfile$pie_flag" 1561d9c7fc6cSmrg else 1562d9c7fc6cSmrg command="$base_compile $qsrcfile $pic_flag" 1563d9c7fc6cSmrg fi 1564d9c7fc6cSmrg if test "$compiler_c_o" = yes; then 1565d9c7fc6cSmrg command="$command -o $obj" 1566d9c7fc6cSmrg fi 1567d9c7fc6cSmrg 1568d9c7fc6cSmrg # Suppress compiler output if we already did a PIC compilation. 1569d9c7fc6cSmrg command="$command$suppress_output" 157005a1a286Smrg func_show_eval_locale "$command" \ 157105a1a286Smrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1572d9c7fc6cSmrg 1573d9c7fc6cSmrg if test "$need_locks" = warn && 1574d9c7fc6cSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 157505a1a286Smrg $ECHO "\ 1576d9c7fc6cSmrg*** ERROR, $lockfile contains: 1577d9c7fc6cSmrg`cat $lockfile 2>/dev/null` 1578d9c7fc6cSmrg 1579d9c7fc6cSmrgbut it should contain: 1580d9c7fc6cSmrg$srcfile 1581d9c7fc6cSmrg 1582d9c7fc6cSmrgThis indicates that another process is trying to use the same 1583d9c7fc6cSmrgtemporary object file, and libtool could not work around it because 1584d9c7fc6cSmrgyour compiler does not support \`-c' and \`-o' together. If you 1585d9c7fc6cSmrgrepeat this compilation, it may succeed, by chance, but you had better 1586d9c7fc6cSmrgavoid parallel builds (make -j) in this platform, or get a better 1587d9c7fc6cSmrgcompiler." 1588d9c7fc6cSmrg 158905a1a286Smrg $opt_dry_run || $RM $removelist 1590d9c7fc6cSmrg exit $EXIT_FAILURE 1591d9c7fc6cSmrg fi 1592d9c7fc6cSmrg 1593d9c7fc6cSmrg # Just move the object if needed 1594d9c7fc6cSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 159505a1a286Smrg func_show_eval '$MV "$output_obj" "$obj"' \ 159605a1a286Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1597d9c7fc6cSmrg fi 1598d9c7fc6cSmrg fi 1599d9c7fc6cSmrg 160005a1a286Smrg $opt_dry_run || { 160105a1a286Smrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1602d9c7fc6cSmrg 160305a1a286Smrg # Unlock the critical section if it was locked 160405a1a286Smrg if test "$need_locks" != no; then 160505a1a286Smrg removelist=$lockfile 160605a1a286Smrg $RM "$lockfile" 160705a1a286Smrg fi 160805a1a286Smrg } 1609d9c7fc6cSmrg 1610d9c7fc6cSmrg exit $EXIT_SUCCESS 161105a1a286Smrg} 1612d9c7fc6cSmrg 161305a1a286Smrg$opt_help || { 161405a1a286Smrg test "$mode" = compile && func_mode_compile ${1+"$@"} 161505a1a286Smrg} 1616d9c7fc6cSmrg 161705a1a286Smrgfunc_mode_help () 161805a1a286Smrg{ 161905a1a286Smrg # We need to display help for each of the modes. 162005a1a286Smrg case $mode in 162105a1a286Smrg "") 162205a1a286Smrg # Generic help is extracted from the usage comments 162305a1a286Smrg # at the start of this file. 162405a1a286Smrg func_help 162505a1a286Smrg ;; 1626d9c7fc6cSmrg 162705a1a286Smrg clean) 162805a1a286Smrg $ECHO \ 162905a1a286Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1630d9c7fc6cSmrg 163105a1a286SmrgRemove files from the build directory. 1632d9c7fc6cSmrg 163305a1a286SmrgRM is the name of the program to use to delete files associated with each FILE 163405a1a286Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 163505a1a286Smrgto RM. 1636d9c7fc6cSmrg 163705a1a286SmrgIf FILE is a libtool library, object or program, all the files associated 163805a1a286Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 163905a1a286Smrg ;; 1640d9c7fc6cSmrg 164105a1a286Smrg compile) 164205a1a286Smrg $ECHO \ 164305a1a286Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1644d9c7fc6cSmrg 164505a1a286SmrgCompile a source file into a libtool library object. 1646d9c7fc6cSmrg 164705a1a286SmrgThis mode accepts the following additional options: 1648d9c7fc6cSmrg 164905a1a286Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 165005a1a286Smrg -no-suppress do not suppress compiler output for multiple passes 165105a1a286Smrg -prefer-pic try to build PIC objects only 165205a1a286Smrg -prefer-non-pic try to build non-PIC objects only 165305a1a286Smrg -shared do not build a \`.o' file suitable for static linking 165405a1a286Smrg -static only build a \`.o' file suitable for static linking 165505a1a286Smrg -Wc,FLAG pass FLAG directly to the compiler 1656d9c7fc6cSmrg 165705a1a286SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 165805a1a286Smrgfrom the given SOURCEFILE. 1659d9c7fc6cSmrg 166005a1a286SmrgThe output file name is determined by removing the directory component from 166105a1a286SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 166205a1a286Smrglibrary object suffix, \`.lo'." 166305a1a286Smrg ;; 1664d9c7fc6cSmrg 166505a1a286Smrg execute) 166605a1a286Smrg $ECHO \ 166705a1a286Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1668d9c7fc6cSmrg 166905a1a286SmrgAutomatically set library path, then run a program. 1670d9c7fc6cSmrg 167105a1a286SmrgThis mode accepts the following additional options: 1672d9c7fc6cSmrg 167305a1a286Smrg -dlopen FILE add the directory containing FILE to the library path 1674d9c7fc6cSmrg 167505a1a286SmrgThis mode sets the library path environment variable according to \`-dlopen' 167605a1a286Smrgflags. 1677d9c7fc6cSmrg 167805a1a286SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 167905a1a286Smrginto their corresponding uninstalled binary, and any of their required library 168005a1a286Smrgdirectories are added to the library path. 1681d9c7fc6cSmrg 168205a1a286SmrgThen, COMMAND is executed, with ARGS as arguments." 168305a1a286Smrg ;; 1684d9c7fc6cSmrg 168505a1a286Smrg finish) 168605a1a286Smrg $ECHO \ 168705a1a286Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1688d9c7fc6cSmrg 168905a1a286SmrgComplete the installation of libtool libraries. 1690d9c7fc6cSmrg 169105a1a286SmrgEach LIBDIR is a directory that contains libtool libraries. 1692d9c7fc6cSmrg 169305a1a286SmrgThe commands that this mode executes may require superuser privileges. Use 169405a1a286Smrgthe \`--dry-run' option if you just want to see what would be executed." 169505a1a286Smrg ;; 1696d9c7fc6cSmrg 169705a1a286Smrg install) 169805a1a286Smrg $ECHO \ 169905a1a286Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1700d9c7fc6cSmrg 170105a1a286SmrgInstall executables or libraries. 1702d9c7fc6cSmrg 170305a1a286SmrgINSTALL-COMMAND is the installation command. The first component should be 170405a1a286Smrgeither the \`install' or \`cp' program. 1705d9c7fc6cSmrg 170605a1a286SmrgThe following components of INSTALL-COMMAND are treated specially: 1707d9c7fc6cSmrg 170805a1a286Smrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1709d9c7fc6cSmrg 171005a1a286SmrgThe rest of the components are interpreted as arguments to that command (only 171105a1a286SmrgBSD-compatible install options are recognized)." 171205a1a286Smrg ;; 1713d9c7fc6cSmrg 171405a1a286Smrg link) 171505a1a286Smrg $ECHO \ 171605a1a286Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1717d9c7fc6cSmrg 171805a1a286SmrgLink object files or libraries together to form another library, or to 171905a1a286Smrgcreate an executable program. 1720d9c7fc6cSmrg 172105a1a286SmrgLINK-COMMAND is a command using the C compiler that you would use to create 172205a1a286Smrga program from several object files. 1723d9c7fc6cSmrg 172405a1a286SmrgThe following components of LINK-COMMAND are treated specially: 1725d9c7fc6cSmrg 172605a1a286Smrg -all-static do not do any dynamic linking at all 172705a1a286Smrg -avoid-version do not add a version suffix if possible 172805a1a286Smrg -bindir BINDIR specify path to binaries directory (for systems where 172905a1a286Smrg libraries must be found in the PATH setting at runtime) 173005a1a286Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 173105a1a286Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 173205a1a286Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 173305a1a286Smrg -export-symbols SYMFILE 173405a1a286Smrg try to export only the symbols listed in SYMFILE 173505a1a286Smrg -export-symbols-regex REGEX 173605a1a286Smrg try to export only the symbols matching REGEX 173705a1a286Smrg -LLIBDIR search LIBDIR for required installed libraries 173805a1a286Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 173905a1a286Smrg -module build a library that can dlopened 174005a1a286Smrg -no-fast-install disable the fast-install mode 174105a1a286Smrg -no-install link a not-installable executable 174205a1a286Smrg -no-undefined declare that a library does not refer to external symbols 174305a1a286Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 174405a1a286Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 174505a1a286Smrg -precious-files-regex REGEX 174605a1a286Smrg don't remove output files matching REGEX 174705a1a286Smrg -release RELEASE specify package release information 174805a1a286Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 174905a1a286Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 175005a1a286Smrg -shared only do dynamic linking of libtool libraries 175105a1a286Smrg -shrext SUFFIX override the standard shared library file extension 175205a1a286Smrg -static do not do any dynamic linking of uninstalled libtool libraries 175305a1a286Smrg -static-libtool-libs 175405a1a286Smrg do not do any dynamic linking of libtool libraries 175505a1a286Smrg -version-info CURRENT[:REVISION[:AGE]] 175605a1a286Smrg specify library version info [each variable defaults to 0] 175705a1a286Smrg -weak LIBNAME declare that the target provides the LIBNAME interface 175805a1a286Smrg -Wc,FLAG 175905a1a286Smrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 176005a1a286Smrg -Wl,FLAG 176105a1a286Smrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 176205a1a286Smrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 1763d9c7fc6cSmrg 176405a1a286SmrgAll other options (arguments beginning with \`-') are ignored. 1765d9c7fc6cSmrg 176605a1a286SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 176705a1a286Smrgtreated as uninstalled libtool libraries, other files are standard or library 176805a1a286Smrgobject files. 1769d9c7fc6cSmrg 177005a1a286SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 177105a1a286Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 177205a1a286Smrgrequired, except when creating a convenience library. 1773d9c7fc6cSmrg 177405a1a286SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 177505a1a286Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 1776d9c7fc6cSmrg 177705a1a286SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 177805a1a286Smrgis created, otherwise an executable program is created." 1779d9c7fc6cSmrg ;; 1780d9c7fc6cSmrg 178105a1a286Smrg uninstall) 178205a1a286Smrg $ECHO \ 178305a1a286Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1784d9c7fc6cSmrg 178505a1a286SmrgRemove libraries from an installation directory. 1786d9c7fc6cSmrg 178705a1a286SmrgRM is the name of the program to use to delete files associated with each FILE 178805a1a286Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 178905a1a286Smrgto RM. 1790d9c7fc6cSmrg 179105a1a286SmrgIf FILE is a libtool library, all the files associated with it are deleted. 179205a1a286SmrgOtherwise, only FILE itself is deleted using RM." 179305a1a286Smrg ;; 1794d9c7fc6cSmrg 179505a1a286Smrg *) 179605a1a286Smrg func_fatal_help "invalid operation mode \`$mode'" 179705a1a286Smrg ;; 179805a1a286Smrg esac 1799d9c7fc6cSmrg 180005a1a286Smrg echo 180105a1a286Smrg $ECHO "Try \`$progname --help' for more information about other modes." 180205a1a286Smrg} 1803d9c7fc6cSmrg 180405a1a286Smrg# Now that we've collected a possible --mode arg, show help if necessary 180505a1a286Smrgif $opt_help; then 180605a1a286Smrg if test "$opt_help" = :; then 180705a1a286Smrg func_mode_help 180805a1a286Smrg else 180905a1a286Smrg { 181005a1a286Smrg func_help noexit 181105a1a286Smrg for mode in compile link execute install finish uninstall clean; do 181205a1a286Smrg func_mode_help 181305a1a286Smrg done 181405a1a286Smrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 181505a1a286Smrg { 181605a1a286Smrg func_help noexit 181705a1a286Smrg for mode in compile link execute install finish uninstall clean; do 181805a1a286Smrg echo 181905a1a286Smrg func_mode_help 182005a1a286Smrg done 182105a1a286Smrg } | 182205a1a286Smrg sed '1d 182305a1a286Smrg /^When reporting/,/^Report/{ 182405a1a286Smrg H 182505a1a286Smrg d 182605a1a286Smrg } 182705a1a286Smrg $x 182805a1a286Smrg /information about other modes/d 182905a1a286Smrg /more detailed .*MODE/d 183005a1a286Smrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 183105a1a286Smrg fi 183205a1a286Smrg exit $? 183305a1a286Smrgfi 1834d9c7fc6cSmrg 1835d9c7fc6cSmrg 183605a1a286Smrg# func_mode_execute arg... 183705a1a286Smrgfunc_mode_execute () 183805a1a286Smrg{ 183905a1a286Smrg $opt_debug 184005a1a286Smrg # The first argument is the command name. 184105a1a286Smrg cmd="$nonopt" 184205a1a286Smrg test -z "$cmd" && \ 184305a1a286Smrg func_fatal_help "you must specify a COMMAND" 1844d9c7fc6cSmrg 184505a1a286Smrg # Handle -dlopen flags immediately. 184605a1a286Smrg for file in $execute_dlfiles; do 184705a1a286Smrg test -f "$file" \ 184805a1a286Smrg || func_fatal_help "\`$file' is not a file" 1849d9c7fc6cSmrg 185005a1a286Smrg dir= 185105a1a286Smrg case $file in 185205a1a286Smrg *.la) 185305a1a286Smrg # Check to see that this really is a libtool archive. 185405a1a286Smrg func_lalib_unsafe_p "$file" \ 185505a1a286Smrg || func_fatal_help "\`$lib' is not a valid libtool archive" 1856d9c7fc6cSmrg 185705a1a286Smrg # Read the libtool library. 185805a1a286Smrg dlname= 185905a1a286Smrg library_names= 186005a1a286Smrg func_source "$file" 1861d9c7fc6cSmrg 186205a1a286Smrg # Skip this library if it cannot be dlopened. 186305a1a286Smrg if test -z "$dlname"; then 186405a1a286Smrg # Warn if it was a shared library. 186505a1a286Smrg test -n "$library_names" && \ 186605a1a286Smrg func_warning "\`$file' was not linked with \`-export-dynamic'" 186705a1a286Smrg continue 186805a1a286Smrg fi 1869d9c7fc6cSmrg 187005a1a286Smrg func_dirname "$file" "" "." 187105a1a286Smrg dir="$func_dirname_result" 1872d9c7fc6cSmrg 187305a1a286Smrg if test -f "$dir/$objdir/$dlname"; then 187405a1a286Smrg dir="$dir/$objdir" 187505a1a286Smrg else 187605a1a286Smrg if test ! -f "$dir/$dlname"; then 187705a1a286Smrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 187805a1a286Smrg fi 187905a1a286Smrg fi 1880d9c7fc6cSmrg ;; 1881d9c7fc6cSmrg 188205a1a286Smrg *.lo) 188305a1a286Smrg # Just add the directory containing the .lo file. 188405a1a286Smrg func_dirname "$file" "" "." 188505a1a286Smrg dir="$func_dirname_result" 1886d9c7fc6cSmrg ;; 1887d9c7fc6cSmrg 188805a1a286Smrg *) 188905a1a286Smrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1890d9c7fc6cSmrg continue 1891d9c7fc6cSmrg ;; 189205a1a286Smrg esac 1893d9c7fc6cSmrg 189405a1a286Smrg # Get the absolute pathname. 189505a1a286Smrg absdir=`cd "$dir" && pwd` 189605a1a286Smrg test -n "$absdir" && dir="$absdir" 1897d9c7fc6cSmrg 189805a1a286Smrg # Now add the directory to shlibpath_var. 189905a1a286Smrg if eval "test -z \"\$$shlibpath_var\""; then 190005a1a286Smrg eval "$shlibpath_var=\"\$dir\"" 190105a1a286Smrg else 190205a1a286Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 190305a1a286Smrg fi 190405a1a286Smrg done 1905d9c7fc6cSmrg 190605a1a286Smrg # This variable tells wrapper scripts just to set shlibpath_var 190705a1a286Smrg # rather than running their programs. 190805a1a286Smrg libtool_execute_magic="$magic" 1909d9c7fc6cSmrg 191005a1a286Smrg # Check if any of the arguments is a wrapper script. 191105a1a286Smrg args= 191205a1a286Smrg for file 191305a1a286Smrg do 191405a1a286Smrg case $file in 191505a1a286Smrg -* | *.la | *.lo ) ;; 191605a1a286Smrg *) 191705a1a286Smrg # Do a test to see if this is really a libtool program. 191805a1a286Smrg if func_ltwrapper_script_p "$file"; then 191905a1a286Smrg func_source "$file" 192005a1a286Smrg # Transform arg to wrapped name. 192105a1a286Smrg file="$progdir/$program" 192205a1a286Smrg elif func_ltwrapper_executable_p "$file"; then 192305a1a286Smrg func_ltwrapper_scriptname "$file" 192405a1a286Smrg func_source "$func_ltwrapper_scriptname_result" 192505a1a286Smrg # Transform arg to wrapped name. 192605a1a286Smrg file="$progdir/$program" 192705a1a286Smrg fi 1928d9c7fc6cSmrg ;; 192905a1a286Smrg esac 193005a1a286Smrg # Quote arguments (to preserve shell metacharacters). 193105a1a286Smrg func_quote_for_eval "$file" 193205a1a286Smrg args="$args $func_quote_for_eval_result" 193305a1a286Smrg done 1934d9c7fc6cSmrg 193505a1a286Smrg if test "X$opt_dry_run" = Xfalse; then 193605a1a286Smrg if test -n "$shlibpath_var"; then 193705a1a286Smrg # Export the shlibpath_var. 193805a1a286Smrg eval "export $shlibpath_var" 193905a1a286Smrg fi 1940d9c7fc6cSmrg 194105a1a286Smrg # Restore saved environment variables 194205a1a286Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 194305a1a286Smrg do 194405a1a286Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 194505a1a286Smrg $lt_var=\$save_$lt_var; export $lt_var 194605a1a286Smrg else 194705a1a286Smrg $lt_unset $lt_var 194805a1a286Smrg fi" 194905a1a286Smrg done 1950d9c7fc6cSmrg 195105a1a286Smrg # Now prepare to actually exec the command. 195205a1a286Smrg exec_cmd="\$cmd$args" 195305a1a286Smrg else 195405a1a286Smrg # Display what would be done. 195505a1a286Smrg if test -n "$shlibpath_var"; then 195605a1a286Smrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 195705a1a286Smrg echo "export $shlibpath_var" 195805a1a286Smrg fi 195905a1a286Smrg $ECHO "$cmd$args" 196005a1a286Smrg exit $EXIT_SUCCESS 196105a1a286Smrg fi 196205a1a286Smrg} 1963d9c7fc6cSmrg 196405a1a286Smrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 1965d9c7fc6cSmrg 1966d9c7fc6cSmrg 196705a1a286Smrg# func_mode_finish arg... 196805a1a286Smrgfunc_mode_finish () 196905a1a286Smrg{ 197005a1a286Smrg $opt_debug 197105a1a286Smrg libdirs="$nonopt" 197205a1a286Smrg admincmds= 1973d9c7fc6cSmrg 197405a1a286Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 197505a1a286Smrg for dir 197605a1a286Smrg do 197705a1a286Smrg libdirs="$libdirs $dir" 197805a1a286Smrg done 1979d9c7fc6cSmrg 198005a1a286Smrg for libdir in $libdirs; do 198105a1a286Smrg if test -n "$finish_cmds"; then 198205a1a286Smrg # Do each command in the finish commands. 198305a1a286Smrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 198405a1a286Smrg'"$cmd"'"' 198505a1a286Smrg fi 198605a1a286Smrg if test -n "$finish_eval"; then 198705a1a286Smrg # Do the single finish_eval. 198805a1a286Smrg eval cmds=\"$finish_eval\" 198905a1a286Smrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 199005a1a286Smrg $cmds" 199105a1a286Smrg fi 199205a1a286Smrg done 199305a1a286Smrg fi 1994d9c7fc6cSmrg 199505a1a286Smrg # Exit here if they wanted silent mode. 199605a1a286Smrg $opt_silent && exit $EXIT_SUCCESS 1997d9c7fc6cSmrg 199805a1a286Smrg echo "----------------------------------------------------------------------" 199905a1a286Smrg echo "Libraries have been installed in:" 200005a1a286Smrg for libdir in $libdirs; do 200105a1a286Smrg $ECHO " $libdir" 200205a1a286Smrg done 200305a1a286Smrg echo 200405a1a286Smrg echo "If you ever happen to want to link against installed libraries" 200505a1a286Smrg echo "in a given directory, LIBDIR, you must either use libtool, and" 200605a1a286Smrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 200705a1a286Smrg echo "flag during linking and do at least one of the following:" 200805a1a286Smrg if test -n "$shlibpath_var"; then 200905a1a286Smrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 201005a1a286Smrg echo " during execution" 201105a1a286Smrg fi 201205a1a286Smrg if test -n "$runpath_var"; then 201305a1a286Smrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 201405a1a286Smrg echo " during linking" 201505a1a286Smrg fi 201605a1a286Smrg if test -n "$hardcode_libdir_flag_spec"; then 201705a1a286Smrg libdir=LIBDIR 201805a1a286Smrg eval flag=\"$hardcode_libdir_flag_spec\" 2019d9c7fc6cSmrg 202005a1a286Smrg $ECHO " - use the \`$flag' linker flag" 202105a1a286Smrg fi 202205a1a286Smrg if test -n "$admincmds"; then 202305a1a286Smrg $ECHO " - have your system administrator run these commands:$admincmds" 202405a1a286Smrg fi 202505a1a286Smrg if test -f /etc/ld.so.conf; then 202605a1a286Smrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 202705a1a286Smrg fi 202805a1a286Smrg echo 2029d9c7fc6cSmrg 203005a1a286Smrg echo "See any operating system documentation about shared libraries for" 203105a1a286Smrg case $host in 203205a1a286Smrg solaris2.[6789]|solaris2.1[0-9]) 203305a1a286Smrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 203405a1a286Smrg echo "pages." 2035d9c7fc6cSmrg ;; 203605a1a286Smrg *) 203705a1a286Smrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 203805a1a286Smrg ;; 203905a1a286Smrg esac 204005a1a286Smrg echo "----------------------------------------------------------------------" 204105a1a286Smrg exit $EXIT_SUCCESS 204205a1a286Smrg} 2043d9c7fc6cSmrg 204405a1a286Smrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 2045d9c7fc6cSmrg 2046d9c7fc6cSmrg 204705a1a286Smrg# func_mode_install arg... 204805a1a286Smrgfunc_mode_install () 204905a1a286Smrg{ 205005a1a286Smrg $opt_debug 205105a1a286Smrg # There may be an optional sh(1) argument at the beginning of 205205a1a286Smrg # install_prog (especially on Windows NT). 205305a1a286Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 205405a1a286Smrg # Allow the use of GNU shtool's install command. 205505a1a286Smrg case $nonopt in *shtool*) :;; *) false;; esac; then 205605a1a286Smrg # Aesthetically quote it. 205705a1a286Smrg func_quote_for_eval "$nonopt" 205805a1a286Smrg install_prog="$func_quote_for_eval_result " 205905a1a286Smrg arg=$1 206005a1a286Smrg shift 206105a1a286Smrg else 206205a1a286Smrg install_prog= 206305a1a286Smrg arg=$nonopt 206405a1a286Smrg fi 206505a1a286Smrg 206605a1a286Smrg # The real first argument should be the name of the installation program. 206705a1a286Smrg # Aesthetically quote it. 206805a1a286Smrg func_quote_for_eval "$arg" 206905a1a286Smrg install_prog="$install_prog$func_quote_for_eval_result" 207005a1a286Smrg install_shared_prog=$install_prog 207105a1a286Smrg case " $install_prog " in 207205a1a286Smrg *[\\\ /]cp\ *) install_cp=: ;; 207305a1a286Smrg *) install_cp=false ;; 207405a1a286Smrg esac 207505a1a286Smrg 207605a1a286Smrg # We need to accept at least all the BSD install flags. 207705a1a286Smrg dest= 207805a1a286Smrg files= 207905a1a286Smrg opts= 208005a1a286Smrg prev= 208105a1a286Smrg install_type= 208205a1a286Smrg isdir=no 208305a1a286Smrg stripme= 208405a1a286Smrg no_mode=: 208505a1a286Smrg for arg 208605a1a286Smrg do 208705a1a286Smrg arg2= 208805a1a286Smrg if test -n "$dest"; then 208905a1a286Smrg files="$files $dest" 209005a1a286Smrg dest=$arg 209105a1a286Smrg continue 209205a1a286Smrg fi 209305a1a286Smrg 209405a1a286Smrg case $arg in 209505a1a286Smrg -d) isdir=yes ;; 209605a1a286Smrg -f) 209705a1a286Smrg if $install_cp; then :; else 209805a1a286Smrg prev=$arg 2099d9c7fc6cSmrg fi 210005a1a286Smrg ;; 210105a1a286Smrg -g | -m | -o) 210205a1a286Smrg prev=$arg 210305a1a286Smrg ;; 210405a1a286Smrg -s) 210505a1a286Smrg stripme=" -s" 2106d9c7fc6cSmrg continue 2107d9c7fc6cSmrg ;; 210805a1a286Smrg -*) 210905a1a286Smrg ;; 2110d9c7fc6cSmrg *) 211105a1a286Smrg # If the previous option needed an argument, then skip it. 211205a1a286Smrg if test -n "$prev"; then 211305a1a286Smrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 211405a1a286Smrg arg2=$install_override_mode 211505a1a286Smrg no_mode=false 211605a1a286Smrg fi 211705a1a286Smrg prev= 211805a1a286Smrg else 211905a1a286Smrg dest=$arg 212005a1a286Smrg continue 212105a1a286Smrg fi 2122d9c7fc6cSmrg ;; 212305a1a286Smrg esac 2124d9c7fc6cSmrg 212505a1a286Smrg # Aesthetically quote the argument. 212605a1a286Smrg func_quote_for_eval "$arg" 212705a1a286Smrg install_prog="$install_prog $func_quote_for_eval_result" 212805a1a286Smrg if test -n "$arg2"; then 212905a1a286Smrg func_quote_for_eval "$arg2" 2130d9c7fc6cSmrg fi 213105a1a286Smrg install_shared_prog="$install_shared_prog $func_quote_for_eval_result" 213205a1a286Smrg done 2133d9c7fc6cSmrg 213405a1a286Smrg test -z "$install_prog" && \ 213505a1a286Smrg func_fatal_help "you must specify an install program" 2136d9c7fc6cSmrg 213705a1a286Smrg test -n "$prev" && \ 213805a1a286Smrg func_fatal_help "the \`$prev' option requires an argument" 2139d9c7fc6cSmrg 214005a1a286Smrg if test -n "$install_override_mode" && $no_mode; then 214105a1a286Smrg if $install_cp; then :; else 214205a1a286Smrg func_quote_for_eval "$install_override_mode" 214305a1a286Smrg install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" 214405a1a286Smrg fi 2145d9c7fc6cSmrg fi 2146d9c7fc6cSmrg 214705a1a286Smrg if test -z "$files"; then 214805a1a286Smrg if test -z "$dest"; then 214905a1a286Smrg func_fatal_help "no file or destination specified" 215005a1a286Smrg else 215105a1a286Smrg func_fatal_help "you must specify a destination" 2152d9c7fc6cSmrg fi 2153d9c7fc6cSmrg fi 2154d9c7fc6cSmrg 215505a1a286Smrg # Strip any trailing slash from the destination. 215605a1a286Smrg func_stripname '' '/' "$dest" 215705a1a286Smrg dest=$func_stripname_result 2158d9c7fc6cSmrg 215905a1a286Smrg # Check to see that the destination is a directory. 216005a1a286Smrg test -d "$dest" && isdir=yes 216105a1a286Smrg if test "$isdir" = yes; then 216205a1a286Smrg destdir="$dest" 216305a1a286Smrg destname= 216405a1a286Smrg else 216505a1a286Smrg func_dirname_and_basename "$dest" "" "." 216605a1a286Smrg destdir="$func_dirname_result" 216705a1a286Smrg destname="$func_basename_result" 216805a1a286Smrg 216905a1a286Smrg # Not a directory, so check to see that there is only one file specified. 217005a1a286Smrg set dummy $files; shift 217105a1a286Smrg test "$#" -gt 1 && \ 217205a1a286Smrg func_fatal_help "\`$dest' is not a directory" 217305a1a286Smrg fi 217405a1a286Smrg case $destdir in 217505a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 2176d9c7fc6cSmrg *) 217705a1a286Smrg for file in $files; do 217805a1a286Smrg case $file in 217905a1a286Smrg *.lo) ;; 218005a1a286Smrg *) 218105a1a286Smrg func_fatal_help "\`$destdir' must be an absolute directory name" 218205a1a286Smrg ;; 218305a1a286Smrg esac 218405a1a286Smrg done 2185d9c7fc6cSmrg ;; 2186d9c7fc6cSmrg esac 2187d9c7fc6cSmrg 218805a1a286Smrg # This variable tells wrapper scripts just to set variables rather 218905a1a286Smrg # than running their programs. 219005a1a286Smrg libtool_install_magic="$magic" 2191d9c7fc6cSmrg 219205a1a286Smrg staticlibs= 219305a1a286Smrg future_libdirs= 219405a1a286Smrg current_libdirs= 219505a1a286Smrg for file in $files; do 2196d9c7fc6cSmrg 219705a1a286Smrg # Do each installation. 219805a1a286Smrg case $file in 219905a1a286Smrg *.$libext) 220005a1a286Smrg # Do the static libraries later. 220105a1a286Smrg staticlibs="$staticlibs $file" 220205a1a286Smrg ;; 220305a1a286Smrg 220405a1a286Smrg *.la) 220505a1a286Smrg # Check to see that this really is a libtool archive. 220605a1a286Smrg func_lalib_unsafe_p "$file" \ 220705a1a286Smrg || func_fatal_help "\`$file' is not a valid libtool archive" 220805a1a286Smrg 220905a1a286Smrg library_names= 221005a1a286Smrg old_library= 221105a1a286Smrg relink_command= 221205a1a286Smrg func_source "$file" 221305a1a286Smrg 221405a1a286Smrg # Add the libdir to current_libdirs if it is the destination. 221505a1a286Smrg if test "X$destdir" = "X$libdir"; then 221605a1a286Smrg case "$current_libdirs " in 221705a1a286Smrg *" $libdir "*) ;; 221805a1a286Smrg *) current_libdirs="$current_libdirs $libdir" ;; 2219d9c7fc6cSmrg esac 222005a1a286Smrg else 222105a1a286Smrg # Note the libdir as a future libdir. 222205a1a286Smrg case "$future_libdirs " in 222305a1a286Smrg *" $libdir "*) ;; 222405a1a286Smrg *) future_libdirs="$future_libdirs $libdir" ;; 222505a1a286Smrg esac 222605a1a286Smrg fi 2227d9c7fc6cSmrg 222805a1a286Smrg func_dirname "$file" "/" "" 222905a1a286Smrg dir="$func_dirname_result" 223005a1a286Smrg dir="$dir$objdir" 223105a1a286Smrg 223205a1a286Smrg if test -n "$relink_command"; then 223305a1a286Smrg # Determine the prefix the user has applied to our future dir. 223405a1a286Smrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 223505a1a286Smrg 223605a1a286Smrg # Don't allow the user to place us outside of our expected 223705a1a286Smrg # location b/c this prevents finding dependent libraries that 223805a1a286Smrg # are installed to the same prefix. 223905a1a286Smrg # At present, this check doesn't affect windows .dll's that 224005a1a286Smrg # are installed into $libdir/../bin (currently, that works fine) 224105a1a286Smrg # but it's something to keep an eye on. 224205a1a286Smrg test "$inst_prefix_dir" = "$destdir" && \ 224305a1a286Smrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 224405a1a286Smrg 224505a1a286Smrg if test -n "$inst_prefix_dir"; then 224605a1a286Smrg # Stick the inst_prefix_dir data into the link command. 224705a1a286Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 224805a1a286Smrg else 224905a1a286Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 225005a1a286Smrg fi 225105a1a286Smrg 225205a1a286Smrg func_warning "relinking \`$file'" 225305a1a286Smrg func_show_eval "$relink_command" \ 225405a1a286Smrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 225505a1a286Smrg fi 225605a1a286Smrg 225705a1a286Smrg # See the names of the shared library. 225805a1a286Smrg set dummy $library_names; shift 225905a1a286Smrg if test -n "$1"; then 226005a1a286Smrg realname="$1" 226105a1a286Smrg shift 226205a1a286Smrg 226305a1a286Smrg srcname="$realname" 226405a1a286Smrg test -n "$relink_command" && srcname="$realname"T 226505a1a286Smrg 226605a1a286Smrg # Install the shared library and build the symlinks. 226705a1a286Smrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 226805a1a286Smrg 'exit $?' 226905a1a286Smrg tstripme="$stripme" 227005a1a286Smrg case $host_os in 227105a1a286Smrg cygwin* | mingw* | pw32* | cegcc*) 227205a1a286Smrg case $realname in 227305a1a286Smrg *.dll.a) 227405a1a286Smrg tstripme="" 227505a1a286Smrg ;; 227605a1a286Smrg esac 2277d9c7fc6cSmrg ;; 2278d9c7fc6cSmrg esac 227905a1a286Smrg if test -n "$tstripme" && test -n "$striplib"; then 228005a1a286Smrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 2281d9c7fc6cSmrg fi 228205a1a286Smrg 228305a1a286Smrg if test "$#" -gt 0; then 228405a1a286Smrg # Delete the old symlinks, and create new ones. 228505a1a286Smrg # Try `ln -sf' first, because the `ln' binary might depend on 228605a1a286Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 228705a1a286Smrg # so we also need to try rm && ln -s. 228805a1a286Smrg for linkname 228905a1a286Smrg do 229005a1a286Smrg test "$linkname" != "$realname" \ 229105a1a286Smrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2292d9c7fc6cSmrg done 2293d9c7fc6cSmrg fi 2294d9c7fc6cSmrg 229505a1a286Smrg # Do each command in the postinstall commands. 229605a1a286Smrg lib="$destdir/$realname" 229705a1a286Smrg func_execute_cmds "$postinstall_cmds" 'exit $?' 2298d9c7fc6cSmrg fi 2299d9c7fc6cSmrg 230005a1a286Smrg # Install the pseudo-library for information purposes. 230105a1a286Smrg func_basename "$file" 230205a1a286Smrg name="$func_basename_result" 230305a1a286Smrg instname="$dir/$name"i 230405a1a286Smrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2305d9c7fc6cSmrg 230605a1a286Smrg # Maybe install the static library, too. 230705a1a286Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 230805a1a286Smrg ;; 2309d9c7fc6cSmrg 231005a1a286Smrg *.lo) 231105a1a286Smrg # Install (i.e. copy) a libtool object. 2312d9c7fc6cSmrg 231305a1a286Smrg # Figure out destination file name, if it wasn't already specified. 231405a1a286Smrg if test -n "$destname"; then 231505a1a286Smrg destfile="$destdir/$destname" 231605a1a286Smrg else 231705a1a286Smrg func_basename "$file" 231805a1a286Smrg destfile="$func_basename_result" 231905a1a286Smrg destfile="$destdir/$destfile" 232005a1a286Smrg fi 232105a1a286Smrg 232205a1a286Smrg # Deduce the name of the destination old-style object file. 232305a1a286Smrg case $destfile in 232405a1a286Smrg *.lo) 232505a1a286Smrg func_lo2o "$destfile" 232605a1a286Smrg staticdest=$func_lo2o_result 232705a1a286Smrg ;; 232805a1a286Smrg *.$objext) 232905a1a286Smrg staticdest="$destfile" 233005a1a286Smrg destfile= 233105a1a286Smrg ;; 233205a1a286Smrg *) 233305a1a286Smrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 233405a1a286Smrg ;; 2335d9c7fc6cSmrg esac 2336d9c7fc6cSmrg 233705a1a286Smrg # Install the libtool object if requested. 233805a1a286Smrg test -n "$destfile" && \ 233905a1a286Smrg func_show_eval "$install_prog $file $destfile" 'exit $?' 234005a1a286Smrg 234105a1a286Smrg # Install the old object if enabled. 234205a1a286Smrg if test "$build_old_libs" = yes; then 234305a1a286Smrg # Deduce the name of the old-style object file. 234405a1a286Smrg func_lo2o "$file" 234505a1a286Smrg staticobj=$func_lo2o_result 234605a1a286Smrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2347d9c7fc6cSmrg fi 234805a1a286Smrg exit $EXIT_SUCCESS 234905a1a286Smrg ;; 2350d9c7fc6cSmrg 235105a1a286Smrg *) 235205a1a286Smrg # Figure out destination file name, if it wasn't already specified. 235305a1a286Smrg if test -n "$destname"; then 235405a1a286Smrg destfile="$destdir/$destname" 235505a1a286Smrg else 235605a1a286Smrg func_basename "$file" 235705a1a286Smrg destfile="$func_basename_result" 235805a1a286Smrg destfile="$destdir/$destfile" 235905a1a286Smrg fi 236005a1a286Smrg 236105a1a286Smrg # If the file is missing, and there is a .exe on the end, strip it 236205a1a286Smrg # because it is most likely a libtool script we actually want to 236305a1a286Smrg # install 236405a1a286Smrg stripped_ext="" 236505a1a286Smrg case $file in 236605a1a286Smrg *.exe) 236705a1a286Smrg if test ! -f "$file"; then 236805a1a286Smrg func_stripname '' '.exe' "$file" 236905a1a286Smrg file=$func_stripname_result 237005a1a286Smrg stripped_ext=".exe" 2371d9c7fc6cSmrg fi 237205a1a286Smrg ;; 237305a1a286Smrg esac 2374d9c7fc6cSmrg 237505a1a286Smrg # Do a test to see if this is really a libtool program. 237605a1a286Smrg case $host in 237705a1a286Smrg *cygwin* | *mingw*) 237805a1a286Smrg if func_ltwrapper_executable_p "$file"; then 237905a1a286Smrg func_ltwrapper_scriptname "$file" 238005a1a286Smrg wrapper=$func_ltwrapper_scriptname_result 238105a1a286Smrg else 238205a1a286Smrg func_stripname '' '.exe' "$file" 238305a1a286Smrg wrapper=$func_stripname_result 238405a1a286Smrg fi 238505a1a286Smrg ;; 238605a1a286Smrg *) 238705a1a286Smrg wrapper=$file 238805a1a286Smrg ;; 238905a1a286Smrg esac 239005a1a286Smrg if func_ltwrapper_script_p "$wrapper"; then 239105a1a286Smrg notinst_deplibs= 239205a1a286Smrg relink_command= 2393d9c7fc6cSmrg 239405a1a286Smrg func_source "$wrapper" 2395d9c7fc6cSmrg 239605a1a286Smrg # Check the variables that should have been set. 239705a1a286Smrg test -z "$generated_by_libtool_version" && \ 239805a1a286Smrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 239905a1a286Smrg 240005a1a286Smrg finalize=yes 240105a1a286Smrg for lib in $notinst_deplibs; do 240205a1a286Smrg # Check to see that each library is installed. 240305a1a286Smrg libdir= 240405a1a286Smrg if test -f "$lib"; then 240505a1a286Smrg func_source "$lib" 240605a1a286Smrg fi 240705a1a286Smrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 240805a1a286Smrg if test -n "$libdir" && test ! -f "$libfile"; then 240905a1a286Smrg func_warning "\`$lib' has not been installed in \`$libdir'" 241005a1a286Smrg finalize=no 241105a1a286Smrg fi 241205a1a286Smrg done 241305a1a286Smrg 241405a1a286Smrg relink_command= 241505a1a286Smrg func_source "$wrapper" 241605a1a286Smrg 241705a1a286Smrg outputname= 241805a1a286Smrg if test "$fast_install" = no && test -n "$relink_command"; then 241905a1a286Smrg $opt_dry_run || { 242005a1a286Smrg if test "$finalize" = yes; then 242105a1a286Smrg tmpdir=`func_mktempdir` 242205a1a286Smrg func_basename "$file$stripped_ext" 242305a1a286Smrg file="$func_basename_result" 242405a1a286Smrg outputname="$tmpdir/$file" 242505a1a286Smrg # Replace the output file specification. 242605a1a286Smrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 242705a1a286Smrg 242805a1a286Smrg $opt_silent || { 242905a1a286Smrg func_quote_for_expand "$relink_command" 243005a1a286Smrg eval "func_echo $func_quote_for_expand_result" 243105a1a286Smrg } 243205a1a286Smrg if eval "$relink_command"; then : 243305a1a286Smrg else 243405a1a286Smrg func_error "error: relink \`$file' with the above command before installing it" 243505a1a286Smrg $opt_dry_run || ${RM}r "$tmpdir" 243605a1a286Smrg continue 243705a1a286Smrg fi 243805a1a286Smrg file="$outputname" 243905a1a286Smrg else 244005a1a286Smrg func_warning "cannot relink \`$file'" 244105a1a286Smrg fi 244205a1a286Smrg } 2443d9c7fc6cSmrg else 244405a1a286Smrg # Install the binary that we compiled earlier. 244505a1a286Smrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 2446d9c7fc6cSmrg fi 244705a1a286Smrg fi 2448d9c7fc6cSmrg 244905a1a286Smrg # remove .exe since cygwin /usr/bin/install will append another 245005a1a286Smrg # one anyway 245105a1a286Smrg case $install_prog,$host in 245205a1a286Smrg */usr/bin/install*,*cygwin*) 245305a1a286Smrg case $file:$destfile in 245405a1a286Smrg *.exe:*.exe) 245505a1a286Smrg # this is ok 245605a1a286Smrg ;; 245705a1a286Smrg *.exe:*) 245805a1a286Smrg destfile=$destfile.exe 245905a1a286Smrg ;; 246005a1a286Smrg *:*.exe) 246105a1a286Smrg func_stripname '' '.exe' "$destfile" 246205a1a286Smrg destfile=$func_stripname_result 246305a1a286Smrg ;; 246405a1a286Smrg esac 2465d9c7fc6cSmrg ;; 2466d9c7fc6cSmrg esac 246705a1a286Smrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 246805a1a286Smrg $opt_dry_run || if test -n "$outputname"; then 246905a1a286Smrg ${RM}r "$tmpdir" 247005a1a286Smrg fi 247105a1a286Smrg ;; 247205a1a286Smrg esac 247305a1a286Smrg done 2474d9c7fc6cSmrg 247505a1a286Smrg for file in $staticlibs; do 247605a1a286Smrg func_basename "$file" 247705a1a286Smrg name="$func_basename_result" 2478d9c7fc6cSmrg 247905a1a286Smrg # Set up the ranlib parameters. 248005a1a286Smrg oldlib="$destdir/$name" 2481d9c7fc6cSmrg 248205a1a286Smrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 2483d9c7fc6cSmrg 248405a1a286Smrg if test -n "$stripme" && test -n "$old_striplib"; then 248505a1a286Smrg func_show_eval "$old_striplib $oldlib" 'exit $?' 248605a1a286Smrg fi 2487d9c7fc6cSmrg 248805a1a286Smrg # Do each command in the postinstall commands. 248905a1a286Smrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 249005a1a286Smrg done 2491d9c7fc6cSmrg 249205a1a286Smrg test -n "$future_libdirs" && \ 249305a1a286Smrg func_warning "remember to run \`$progname --finish$future_libdirs'" 2494d9c7fc6cSmrg 249505a1a286Smrg if test -n "$current_libdirs"; then 249605a1a286Smrg # Maybe just do a dry run. 249705a1a286Smrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 249805a1a286Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 249905a1a286Smrg else 250005a1a286Smrg exit $EXIT_SUCCESS 250105a1a286Smrg fi 250205a1a286Smrg} 2503d9c7fc6cSmrg 250405a1a286Smrgtest "$mode" = install && func_mode_install ${1+"$@"} 2505d9c7fc6cSmrg 2506d9c7fc6cSmrg 250705a1a286Smrg# func_generate_dlsyms outputname originator pic_p 250805a1a286Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with 250905a1a286Smrg# a dlpreopen symbol table. 251005a1a286Smrgfunc_generate_dlsyms () 251105a1a286Smrg{ 251205a1a286Smrg $opt_debug 251305a1a286Smrg my_outputname="$1" 251405a1a286Smrg my_originator="$2" 251505a1a286Smrg my_pic_p="${3-no}" 251605a1a286Smrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 251705a1a286Smrg my_dlsyms= 251805a1a286Smrg 251905a1a286Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 252005a1a286Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 252105a1a286Smrg my_dlsyms="${my_outputname}S.c" 252205a1a286Smrg else 252305a1a286Smrg func_error "not configured to extract global symbols from dlpreopened files" 252405a1a286Smrg fi 252505a1a286Smrg fi 2526d9c7fc6cSmrg 252705a1a286Smrg if test -n "$my_dlsyms"; then 252805a1a286Smrg case $my_dlsyms in 252905a1a286Smrg "") ;; 253005a1a286Smrg *.c) 253105a1a286Smrg # Discover the nlist of each of the dlfiles. 253205a1a286Smrg nlist="$output_objdir/${my_outputname}.nm" 253305a1a286Smrg 253405a1a286Smrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 253505a1a286Smrg 253605a1a286Smrg # Parse the name list into a source file. 253705a1a286Smrg func_verbose "creating $output_objdir/$my_dlsyms" 253805a1a286Smrg 253905a1a286Smrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 254005a1a286Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 254105a1a286Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 254205a1a286Smrg 254305a1a286Smrg#ifdef __cplusplus 254405a1a286Smrgextern \"C\" { 254505a1a286Smrg#endif 254605a1a286Smrg 254705a1a286Smrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 254805a1a286Smrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 254905a1a286Smrg#endif 255005a1a286Smrg 255105a1a286Smrg/* External symbol declarations for the compiler. */\ 255205a1a286Smrg" 255305a1a286Smrg 255405a1a286Smrg if test "$dlself" = yes; then 255505a1a286Smrg func_verbose "generating symbol list for \`$output'" 255605a1a286Smrg 255705a1a286Smrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 255805a1a286Smrg 255905a1a286Smrg # Add our own program objects to the symbol list. 256005a1a286Smrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 256105a1a286Smrg for progfile in $progfiles; do 256205a1a286Smrg func_verbose "extracting global C symbols from \`$progfile'" 256305a1a286Smrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 256405a1a286Smrg done 256505a1a286Smrg 256605a1a286Smrg if test -n "$exclude_expsyms"; then 256705a1a286Smrg $opt_dry_run || { 256805a1a286Smrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 256905a1a286Smrg eval '$MV "$nlist"T "$nlist"' 257005a1a286Smrg } 2571d9c7fc6cSmrg fi 2572d9c7fc6cSmrg 257305a1a286Smrg if test -n "$export_symbols_regex"; then 257405a1a286Smrg $opt_dry_run || { 257505a1a286Smrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 257605a1a286Smrg eval '$MV "$nlist"T "$nlist"' 257705a1a286Smrg } 2578d9c7fc6cSmrg fi 257905a1a286Smrg 258005a1a286Smrg # Prepare the list of exported symbols 258105a1a286Smrg if test -z "$export_symbols"; then 258205a1a286Smrg export_symbols="$output_objdir/$outputname.exp" 258305a1a286Smrg $opt_dry_run || { 258405a1a286Smrg $RM $export_symbols 258505a1a286Smrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 258605a1a286Smrg case $host in 258705a1a286Smrg *cygwin* | *mingw* | *cegcc* ) 258805a1a286Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 258905a1a286Smrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 259005a1a286Smrg ;; 2591d9c7fc6cSmrg esac 259205a1a286Smrg } 259305a1a286Smrg else 259405a1a286Smrg $opt_dry_run || { 259505a1a286Smrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 259605a1a286Smrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 259705a1a286Smrg eval '$MV "$nlist"T "$nlist"' 259805a1a286Smrg case $host in 259905a1a286Smrg *cygwin* | *mingw* | *cegcc* ) 260005a1a286Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 260105a1a286Smrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 260205a1a286Smrg ;; 2603d9c7fc6cSmrg esac 260405a1a286Smrg } 2605d9c7fc6cSmrg fi 260605a1a286Smrg fi 2607d9c7fc6cSmrg 260805a1a286Smrg for dlprefile in $dlprefiles; do 260905a1a286Smrg func_verbose "extracting global C symbols from \`$dlprefile'" 261005a1a286Smrg func_basename "$dlprefile" 261105a1a286Smrg name="$func_basename_result" 261205a1a286Smrg $opt_dry_run || { 261305a1a286Smrg eval '$ECHO ": $name " >> "$nlist"' 261405a1a286Smrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 261505a1a286Smrg } 261605a1a286Smrg done 2617d9c7fc6cSmrg 261805a1a286Smrg $opt_dry_run || { 261905a1a286Smrg # Make sure we have at least an empty file. 262005a1a286Smrg test -f "$nlist" || : > "$nlist" 2621d9c7fc6cSmrg 262205a1a286Smrg if test -n "$exclude_expsyms"; then 262305a1a286Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 262405a1a286Smrg $MV "$nlist"T "$nlist" 2625d9c7fc6cSmrg fi 2626d9c7fc6cSmrg 262705a1a286Smrg # Try sorting and uniquifying the output. 262805a1a286Smrg if $GREP -v "^: " < "$nlist" | 262905a1a286Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 263005a1a286Smrg sort -k 3 2631d9c7fc6cSmrg else 263205a1a286Smrg sort +2 263305a1a286Smrg fi | 263405a1a286Smrg uniq > "$nlist"S; then 263505a1a286Smrg : 2636d9c7fc6cSmrg else 263705a1a286Smrg $GREP -v "^: " < "$nlist" > "$nlist"S 2638d9c7fc6cSmrg fi 2639d9c7fc6cSmrg 264005a1a286Smrg if test -f "$nlist"S; then 264105a1a286Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2642d9c7fc6cSmrg else 264305a1a286Smrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 2644d9c7fc6cSmrg fi 2645d9c7fc6cSmrg 264605a1a286Smrg echo >> "$output_objdir/$my_dlsyms" "\ 2647d9c7fc6cSmrg 264805a1a286Smrg/* The mapping between symbol names and symbols. */ 264905a1a286Smrgtypedef struct { 265005a1a286Smrg const char *name; 265105a1a286Smrg void *address; 265205a1a286Smrg} lt_dlsymlist; 265305a1a286Smrg" 265405a1a286Smrg case $host in 265505a1a286Smrg *cygwin* | *mingw* | *cegcc* ) 265605a1a286Smrg echo >> "$output_objdir/$my_dlsyms" "\ 265705a1a286Smrg/* DATA imports from DLLs on WIN32 con't be const, because 265805a1a286Smrg runtime relocations are performed -- see ld's documentation 265905a1a286Smrg on pseudo-relocs. */" 266005a1a286Smrg lt_dlsym_const= ;; 266105a1a286Smrg *osf5*) 266205a1a286Smrg echo >> "$output_objdir/$my_dlsyms" "\ 266305a1a286Smrg/* This system does not cope well with relocations in const data */" 266405a1a286Smrg lt_dlsym_const= ;; 266505a1a286Smrg *) 266605a1a286Smrg lt_dlsym_const=const ;; 266705a1a286Smrg esac 2668d9c7fc6cSmrg 266905a1a286Smrg echo >> "$output_objdir/$my_dlsyms" "\ 267005a1a286Smrgextern $lt_dlsym_const lt_dlsymlist 267105a1a286Smrglt_${my_prefix}_LTX_preloaded_symbols[]; 267205a1a286Smrg$lt_dlsym_const lt_dlsymlist 267305a1a286Smrglt_${my_prefix}_LTX_preloaded_symbols[] = 267405a1a286Smrg{\ 267505a1a286Smrg { \"$my_originator\", (void *) 0 }," 2676d9c7fc6cSmrg 267705a1a286Smrg case $need_lib_prefix in 267805a1a286Smrg no) 267905a1a286Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 268005a1a286Smrg ;; 268105a1a286Smrg *) 268205a1a286Smrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 268305a1a286Smrg ;; 268405a1a286Smrg esac 268505a1a286Smrg echo >> "$output_objdir/$my_dlsyms" "\ 268605a1a286Smrg {0, (void *) 0} 268705a1a286Smrg}; 2688d9c7fc6cSmrg 268905a1a286Smrg/* This works around a problem in FreeBSD linker */ 269005a1a286Smrg#ifdef FREEBSD_WORKAROUND 269105a1a286Smrgstatic const void *lt_preloaded_setup() { 269205a1a286Smrg return lt_${my_prefix}_LTX_preloaded_symbols; 269305a1a286Smrg} 269405a1a286Smrg#endif 2695d9c7fc6cSmrg 269605a1a286Smrg#ifdef __cplusplus 269705a1a286Smrg} 269805a1a286Smrg#endif\ 269905a1a286Smrg" 270005a1a286Smrg } # !$opt_dry_run 2701d9c7fc6cSmrg 270205a1a286Smrg pic_flag_for_symtable= 270305a1a286Smrg case "$compile_command " in 270405a1a286Smrg *" -static "*) ;; 270505a1a286Smrg *) 270605a1a286Smrg case $host in 270705a1a286Smrg # compiling the symbol table file with pic_flag works around 270805a1a286Smrg # a FreeBSD bug that causes programs to crash when -lm is 270905a1a286Smrg # linked before any other PIC object. But we must not use 271005a1a286Smrg # pic_flag when linking with -static. The problem exists in 271105a1a286Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 271205a1a286Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 271305a1a286Smrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 271405a1a286Smrg *-*-hpux*) 271505a1a286Smrg pic_flag_for_symtable=" $pic_flag" ;; 271605a1a286Smrg *) 271705a1a286Smrg if test "X$my_pic_p" != Xno; then 271805a1a286Smrg pic_flag_for_symtable=" $pic_flag" 271905a1a286Smrg fi 272005a1a286Smrg ;; 272105a1a286Smrg esac 272205a1a286Smrg ;; 272305a1a286Smrg esac 272405a1a286Smrg symtab_cflags= 272505a1a286Smrg for arg in $LTCFLAGS; do 272605a1a286Smrg case $arg in 272705a1a286Smrg -pie | -fpie | -fPIE) ;; 272805a1a286Smrg *) symtab_cflags="$symtab_cflags $arg" ;; 272905a1a286Smrg esac 273005a1a286Smrg done 2731d9c7fc6cSmrg 273205a1a286Smrg # Now compile the dynamic symbol file. 273305a1a286Smrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2734d9c7fc6cSmrg 273505a1a286Smrg # Clean up the generated files. 273605a1a286Smrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2737d9c7fc6cSmrg 273805a1a286Smrg # Transform the symbol file into the correct name. 273905a1a286Smrg symfileobj="$output_objdir/${my_outputname}S.$objext" 274005a1a286Smrg case $host in 274105a1a286Smrg *cygwin* | *mingw* | *cegcc* ) 274205a1a286Smrg if test -f "$output_objdir/$my_outputname.def"; then 274305a1a286Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 274405a1a286Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 274505a1a286Smrg else 274605a1a286Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 274705a1a286Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 274805a1a286Smrg fi 274905a1a286Smrg ;; 275005a1a286Smrg *) 275105a1a286Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 275205a1a286Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 275305a1a286Smrg ;; 275405a1a286Smrg esac 2755d9c7fc6cSmrg ;; 2756d9c7fc6cSmrg *) 275705a1a286Smrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 2758d9c7fc6cSmrg ;; 2759d9c7fc6cSmrg esac 276005a1a286Smrg else 276105a1a286Smrg # We keep going just in case the user didn't refer to 276205a1a286Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 276305a1a286Smrg # really was required. 2764d9c7fc6cSmrg 276505a1a286Smrg # Nullify the symbol file. 276605a1a286Smrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 276705a1a286Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 276805a1a286Smrg fi 276905a1a286Smrg} 2770d9c7fc6cSmrg 277105a1a286Smrg# func_win32_libid arg 277205a1a286Smrg# return the library type of file 'arg' 277305a1a286Smrg# 277405a1a286Smrg# Need a lot of goo to handle *both* DLLs and import libs 277505a1a286Smrg# Has to be a shell function in order to 'eat' the argument 277605a1a286Smrg# that is supplied when $file_magic_command is called. 277705a1a286Smrg# Despite the name, also deal with 64 bit binaries. 277805a1a286Smrgfunc_win32_libid () 277905a1a286Smrg{ 278005a1a286Smrg $opt_debug 278105a1a286Smrg win32_libid_type="unknown" 278205a1a286Smrg win32_fileres=`file -L $1 2>/dev/null` 278305a1a286Smrg case $win32_fileres in 278405a1a286Smrg *ar\ archive\ import\ library*) # definitely import 278505a1a286Smrg win32_libid_type="x86 archive import" 278605a1a286Smrg ;; 278705a1a286Smrg *ar\ archive*) # could be an import, or static 278805a1a286Smrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 278905a1a286Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 279005a1a286Smrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 279105a1a286Smrg win32_nmres=`eval $NM -f posix -A $1 | 279205a1a286Smrg $SED -n -e ' 279305a1a286Smrg 1,100{ 279405a1a286Smrg / I /{ 279505a1a286Smrg s,.*,import, 279605a1a286Smrg p 279705a1a286Smrg q 279805a1a286Smrg } 279905a1a286Smrg }'` 280005a1a286Smrg case $win32_nmres in 280105a1a286Smrg import*) win32_libid_type="x86 archive import";; 280205a1a286Smrg *) win32_libid_type="x86 archive static";; 280305a1a286Smrg esac 280405a1a286Smrg fi 280505a1a286Smrg ;; 280605a1a286Smrg *DLL*) 280705a1a286Smrg win32_libid_type="x86 DLL" 280805a1a286Smrg ;; 280905a1a286Smrg *executable*) # but shell scripts are "executable" too... 281005a1a286Smrg case $win32_fileres in 281105a1a286Smrg *MS\ Windows\ PE\ Intel*) 281205a1a286Smrg win32_libid_type="x86 DLL" 281305a1a286Smrg ;; 281405a1a286Smrg esac 281505a1a286Smrg ;; 281605a1a286Smrg esac 281705a1a286Smrg $ECHO "$win32_libid_type" 281805a1a286Smrg} 2819d9c7fc6cSmrg 2820d9c7fc6cSmrg 2821d9c7fc6cSmrg 282205a1a286Smrg# func_extract_an_archive dir oldlib 282305a1a286Smrgfunc_extract_an_archive () 282405a1a286Smrg{ 282505a1a286Smrg $opt_debug 282605a1a286Smrg f_ex_an_ar_dir="$1"; shift 282705a1a286Smrg f_ex_an_ar_oldlib="$1" 282805a1a286Smrg if test "$lock_old_archive_extraction" = yes; then 282905a1a286Smrg lockfile=$f_ex_an_ar_oldlib.lock 283005a1a286Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 283105a1a286Smrg func_echo "Waiting for $lockfile to be removed" 283205a1a286Smrg sleep 2 283305a1a286Smrg done 283405a1a286Smrg fi 283505a1a286Smrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 283605a1a286Smrg 'stat=$?; rm -f "$lockfile"; exit $stat' 283705a1a286Smrg if test "$lock_old_archive_extraction" = yes; then 283805a1a286Smrg $opt_dry_run || rm -f "$lockfile" 283905a1a286Smrg fi 284005a1a286Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 284105a1a286Smrg : 284205a1a286Smrg else 284305a1a286Smrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 284405a1a286Smrg fi 284505a1a286Smrg} 2846d9c7fc6cSmrg 2847d9c7fc6cSmrg 284805a1a286Smrg# func_extract_archives gentop oldlib ... 284905a1a286Smrgfunc_extract_archives () 285005a1a286Smrg{ 285105a1a286Smrg $opt_debug 285205a1a286Smrg my_gentop="$1"; shift 285305a1a286Smrg my_oldlibs=${1+"$@"} 285405a1a286Smrg my_oldobjs="" 285505a1a286Smrg my_xlib="" 285605a1a286Smrg my_xabs="" 285705a1a286Smrg my_xdir="" 2858d9c7fc6cSmrg 285905a1a286Smrg for my_xlib in $my_oldlibs; do 286005a1a286Smrg # Extract the objects. 286105a1a286Smrg case $my_xlib in 286205a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 286305a1a286Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 286405a1a286Smrg esac 286505a1a286Smrg func_basename "$my_xlib" 286605a1a286Smrg my_xlib="$func_basename_result" 286705a1a286Smrg my_xlib_u=$my_xlib 286805a1a286Smrg while :; do 286905a1a286Smrg case " $extracted_archives " in 287005a1a286Smrg *" $my_xlib_u "*) 287105a1a286Smrg func_arith $extracted_serial + 1 287205a1a286Smrg extracted_serial=$func_arith_result 287305a1a286Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 287405a1a286Smrg *) break ;; 2875d9c7fc6cSmrg esac 287605a1a286Smrg done 287705a1a286Smrg extracted_archives="$extracted_archives $my_xlib_u" 287805a1a286Smrg my_xdir="$my_gentop/$my_xlib_u" 2879d9c7fc6cSmrg 288005a1a286Smrg func_mkdir_p "$my_xdir" 2881d9c7fc6cSmrg 288205a1a286Smrg case $host in 288305a1a286Smrg *-darwin*) 288405a1a286Smrg func_verbose "Extracting $my_xabs" 288505a1a286Smrg # Do not bother doing anything if just a dry run 288605a1a286Smrg $opt_dry_run || { 288705a1a286Smrg darwin_orig_dir=`pwd` 288805a1a286Smrg cd $my_xdir || exit $? 288905a1a286Smrg darwin_archive=$my_xabs 289005a1a286Smrg darwin_curdir=`pwd` 289105a1a286Smrg darwin_base_archive=`basename "$darwin_archive"` 289205a1a286Smrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 289305a1a286Smrg if test -n "$darwin_arches"; then 289405a1a286Smrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 289505a1a286Smrg darwin_arch= 289605a1a286Smrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 289705a1a286Smrg for darwin_arch in $darwin_arches ; do 289805a1a286Smrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 289905a1a286Smrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 290005a1a286Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 290105a1a286Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 290205a1a286Smrg cd "$darwin_curdir" 290305a1a286Smrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 290405a1a286Smrg done # $darwin_arches 290505a1a286Smrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 290605a1a286Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 290705a1a286Smrg darwin_file= 290805a1a286Smrg darwin_files= 290905a1a286Smrg for darwin_file in $darwin_filelist; do 291005a1a286Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 291105a1a286Smrg $LIPO -create -output "$darwin_file" $darwin_files 291205a1a286Smrg done # $darwin_filelist 291305a1a286Smrg $RM -rf unfat-$$ 291405a1a286Smrg cd "$darwin_orig_dir" 291505a1a286Smrg else 291605a1a286Smrg cd $darwin_orig_dir 291705a1a286Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 291805a1a286Smrg fi # $darwin_arches 291905a1a286Smrg } # !$opt_dry_run 292005a1a286Smrg ;; 292105a1a286Smrg *) 292205a1a286Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 292305a1a286Smrg ;; 292405a1a286Smrg esac 292505a1a286Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 292605a1a286Smrg done 2927d9c7fc6cSmrg 292805a1a286Smrg func_extract_archives_result="$my_oldobjs" 292905a1a286Smrg} 2930d9c7fc6cSmrg 2931d9c7fc6cSmrg 293205a1a286Smrg# func_emit_wrapper [arg=no] 293305a1a286Smrg# 293405a1a286Smrg# Emit a libtool wrapper script on stdout. 293505a1a286Smrg# Don't directly open a file because we may want to 293605a1a286Smrg# incorporate the script contents within a cygwin/mingw 293705a1a286Smrg# wrapper executable. Must ONLY be called from within 293805a1a286Smrg# func_mode_link because it depends on a number of variables 293905a1a286Smrg# set therein. 294005a1a286Smrg# 294105a1a286Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 294205a1a286Smrg# variable will take. If 'yes', then the emitted script 294305a1a286Smrg# will assume that the directory in which it is stored is 294405a1a286Smrg# the $objdir directory. This is a cygwin/mingw-specific 294505a1a286Smrg# behavior. 294605a1a286Smrgfunc_emit_wrapper () 294705a1a286Smrg{ 294805a1a286Smrg func_emit_wrapper_arg1=${1-no} 2949d9c7fc6cSmrg 295005a1a286Smrg $ECHO "\ 295105a1a286Smrg#! $SHELL 2952d9c7fc6cSmrg 295305a1a286Smrg# $output - temporary wrapper script for $objdir/$outputname 295405a1a286Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 295505a1a286Smrg# 295605a1a286Smrg# The $output program cannot be directly executed until all the libtool 295705a1a286Smrg# libraries that it depends on are installed. 295805a1a286Smrg# 295905a1a286Smrg# This wrapper script should never be moved out of the build directory. 296005a1a286Smrg# If it is, it will not operate correctly. 2961d9c7fc6cSmrg 296205a1a286Smrg# Sed substitution that helps us do robust quoting. It backslashifies 296305a1a286Smrg# metacharacters that are still active within double-quoted strings. 296405a1a286Smrgsed_quote_subst='$sed_quote_subst' 2965d9c7fc6cSmrg 296605a1a286Smrg# Be Bourne compatible 296705a1a286Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 296805a1a286Smrg emulate sh 296905a1a286Smrg NULLCMD=: 297005a1a286Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 297105a1a286Smrg # is contrary to our usage. Disable this feature. 297205a1a286Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 297305a1a286Smrg setopt NO_GLOB_SUBST 297405a1a286Smrgelse 297505a1a286Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 297605a1a286Smrgfi 297705a1a286SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 297805a1a286SmrgDUALCASE=1; export DUALCASE # for MKS sh 2979d9c7fc6cSmrg 298005a1a286Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 298105a1a286Smrg# if CDPATH is set. 298205a1a286Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2983d9c7fc6cSmrg 298405a1a286Smrgrelink_command=\"$relink_command\" 2985d9c7fc6cSmrg 298605a1a286Smrg# This environment variable determines our operation mode. 298705a1a286Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 298805a1a286Smrg # install mode needs the following variables: 298905a1a286Smrg generated_by_libtool_version='$macro_version' 299005a1a286Smrg notinst_deplibs='$notinst_deplibs' 299105a1a286Smrgelse 299205a1a286Smrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 299305a1a286Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 299405a1a286Smrg file=\"\$0\"" 2995d9c7fc6cSmrg 299605a1a286Smrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 299705a1a286Smrg $ECHO "\ 2998d9c7fc6cSmrg 299905a1a286Smrg# A function that is used when there is no print builtin or printf. 300005a1a286Smrgfunc_fallback_echo () 300105a1a286Smrg{ 300205a1a286Smrg eval 'cat <<_LTECHO_EOF 300305a1a286Smrg\$1 300405a1a286Smrg_LTECHO_EOF' 300505a1a286Smrg} 300605a1a286Smrg ECHO=\"$qECHO\" 300705a1a286Smrg fi 3008d9c7fc6cSmrg 300905a1a286Smrg# Very basic option parsing. These options are (a) specific to 301005a1a286Smrg# the libtool wrapper, (b) are identical between the wrapper 301105a1a286Smrg# /script/ and the wrapper /executable/ which is used only on 301205a1a286Smrg# windows platforms, and (c) all begin with the string "--lt-" 301305a1a286Smrg# (application programs are unlikely to have options which match 301405a1a286Smrg# this pattern). 301505a1a286Smrg# 301605a1a286Smrg# There are only two supported options: --lt-debug and 301705a1a286Smrg# --lt-dump-script. There is, deliberately, no --lt-help. 301805a1a286Smrg# 301905a1a286Smrg# The first argument to this parsing function should be the 302005a1a286Smrg# script's $0 value, followed by "$@". 302105a1a286Smrglt_option_debug= 302205a1a286Smrgfunc_parse_lt_options () 302305a1a286Smrg{ 302405a1a286Smrg lt_script_arg0=\$0 302505a1a286Smrg shift 302605a1a286Smrg for lt_opt 302705a1a286Smrg do 302805a1a286Smrg case \"\$lt_opt\" in 302905a1a286Smrg --lt-debug) lt_option_debug=1 ;; 303005a1a286Smrg --lt-dump-script) 303105a1a286Smrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 303205a1a286Smrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 303305a1a286Smrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 303405a1a286Smrg cat \"\$lt_dump_D/\$lt_dump_F\" 303505a1a286Smrg exit 0 303605a1a286Smrg ;; 303705a1a286Smrg --lt-*) 303805a1a286Smrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 303905a1a286Smrg exit 1 304005a1a286Smrg ;; 304105a1a286Smrg esac 304205a1a286Smrg done 3043d9c7fc6cSmrg 304405a1a286Smrg # Print the debug banner immediately: 304505a1a286Smrg if test -n \"\$lt_option_debug\"; then 304605a1a286Smrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 304705a1a286Smrg fi 304805a1a286Smrg} 3049d9c7fc6cSmrg 305005a1a286Smrg# Used when --lt-debug. Prints its arguments to stdout 305105a1a286Smrg# (redirection is the responsibility of the caller) 305205a1a286Smrgfunc_lt_dump_args () 305305a1a286Smrg{ 305405a1a286Smrg lt_dump_args_N=1; 305505a1a286Smrg for lt_arg 305605a1a286Smrg do 305705a1a286Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 305805a1a286Smrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 305905a1a286Smrg done 306005a1a286Smrg} 3061d9c7fc6cSmrg 306205a1a286Smrg# Core function for launching the target application 306305a1a286Smrgfunc_exec_program_core () 306405a1a286Smrg{ 306505a1a286Smrg" 306605a1a286Smrg case $host in 306705a1a286Smrg # Backslashes separate directories on plain windows 306805a1a286Smrg *-*-mingw | *-*-os2* | *-cegcc*) 306905a1a286Smrg $ECHO "\ 307005a1a286Smrg if test -n \"\$lt_option_debug\"; then 307105a1a286Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 307205a1a286Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 307305a1a286Smrg fi 307405a1a286Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 307505a1a286Smrg" 307605a1a286Smrg ;; 3077d9c7fc6cSmrg 307805a1a286Smrg *) 307905a1a286Smrg $ECHO "\ 308005a1a286Smrg if test -n \"\$lt_option_debug\"; then 308105a1a286Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 308205a1a286Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 308305a1a286Smrg fi 308405a1a286Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 308505a1a286Smrg" 308605a1a286Smrg ;; 308705a1a286Smrg esac 308805a1a286Smrg $ECHO "\ 308905a1a286Smrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 309005a1a286Smrg exit 1 309105a1a286Smrg} 3092d9c7fc6cSmrg 309305a1a286Smrg# A function to encapsulate launching the target application 309405a1a286Smrg# Strips options in the --lt-* namespace from \$@ and 309505a1a286Smrg# launches target application with the remaining arguments. 309605a1a286Smrgfunc_exec_program () 309705a1a286Smrg{ 309805a1a286Smrg for lt_wr_arg 309905a1a286Smrg do 310005a1a286Smrg case \$lt_wr_arg in 310105a1a286Smrg --lt-*) ;; 310205a1a286Smrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 310305a1a286Smrg esac 310405a1a286Smrg shift 310505a1a286Smrg done 310605a1a286Smrg func_exec_program_core \${1+\"\$@\"} 310705a1a286Smrg} 3108d9c7fc6cSmrg 310905a1a286Smrg # Parse options 311005a1a286Smrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 311105a1a286Smrg 311205a1a286Smrg # Find the directory that this script lives in. 311305a1a286Smrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 311405a1a286Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 311505a1a286Smrg 311605a1a286Smrg # Follow symbolic links until we get to the real thisdir. 311705a1a286Smrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 311805a1a286Smrg while test -n \"\$file\"; do 311905a1a286Smrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 312005a1a286Smrg 312105a1a286Smrg # If there was a directory component, then change thisdir. 312205a1a286Smrg if test \"x\$destdir\" != \"x\$file\"; then 312305a1a286Smrg case \"\$destdir\" in 312405a1a286Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 312505a1a286Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 312605a1a286Smrg esac 312705a1a286Smrg fi 312805a1a286Smrg 312905a1a286Smrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 313005a1a286Smrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 313105a1a286Smrg done 313205a1a286Smrg 313305a1a286Smrg # Usually 'no', except on cygwin/mingw when embedded into 313405a1a286Smrg # the cwrapper. 313505a1a286Smrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 313605a1a286Smrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 313705a1a286Smrg # special case for '.' 313805a1a286Smrg if test \"\$thisdir\" = \".\"; then 313905a1a286Smrg thisdir=\`pwd\` 314005a1a286Smrg fi 314105a1a286Smrg # remove .libs from thisdir 314205a1a286Smrg case \"\$thisdir\" in 314305a1a286Smrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 314405a1a286Smrg $objdir ) thisdir=. ;; 314505a1a286Smrg esac 314605a1a286Smrg fi 314705a1a286Smrg 314805a1a286Smrg # Try to get the absolute directory name. 314905a1a286Smrg absdir=\`cd \"\$thisdir\" && pwd\` 315005a1a286Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 315105a1a286Smrg" 315205a1a286Smrg 315305a1a286Smrg if test "$fast_install" = yes; then 315405a1a286Smrg $ECHO "\ 315505a1a286Smrg program=lt-'$outputname'$exeext 315605a1a286Smrg progdir=\"\$thisdir/$objdir\" 315705a1a286Smrg 315805a1a286Smrg if test ! -f \"\$progdir/\$program\" || 315905a1a286Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 316005a1a286Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 316105a1a286Smrg 316205a1a286Smrg file=\"\$\$-\$program\" 316305a1a286Smrg 316405a1a286Smrg if test ! -d \"\$progdir\"; then 316505a1a286Smrg $MKDIR \"\$progdir\" 316605a1a286Smrg else 316705a1a286Smrg $RM \"\$progdir/\$file\" 316805a1a286Smrg fi" 316905a1a286Smrg 317005a1a286Smrg $ECHO "\ 317105a1a286Smrg 317205a1a286Smrg # relink executable if necessary 317305a1a286Smrg if test -n \"\$relink_command\"; then 317405a1a286Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 317505a1a286Smrg else 317605a1a286Smrg $ECHO \"\$relink_command_output\" >&2 317705a1a286Smrg $RM \"\$progdir/\$file\" 317805a1a286Smrg exit 1 3179d9c7fc6cSmrg fi 318005a1a286Smrg fi 3181d9c7fc6cSmrg 318205a1a286Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 318305a1a286Smrg { $RM \"\$progdir/\$program\"; 318405a1a286Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 318505a1a286Smrg $RM \"\$progdir/\$file\" 318605a1a286Smrg fi" 318705a1a286Smrg else 318805a1a286Smrg $ECHO "\ 318905a1a286Smrg program='$outputname' 319005a1a286Smrg progdir=\"\$thisdir/$objdir\" 319105a1a286Smrg" 3192d9c7fc6cSmrg fi 3193d9c7fc6cSmrg 319405a1a286Smrg $ECHO "\ 3195d9c7fc6cSmrg 319605a1a286Smrg if test -f \"\$progdir/\$program\"; then" 3197d9c7fc6cSmrg 319805a1a286Smrg # Export our shlibpath_var if we have one. 319905a1a286Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 320005a1a286Smrg $ECHO "\ 320105a1a286Smrg # Add our own library path to $shlibpath_var 320205a1a286Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 3203d9c7fc6cSmrg 320405a1a286Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 320505a1a286Smrg # The second colon is a workaround for a bug in BeOS R4 sed 320605a1a286Smrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 320705a1a286Smrg 320805a1a286Smrg export $shlibpath_var 320905a1a286Smrg" 3210d9c7fc6cSmrg fi 3211d9c7fc6cSmrg 321205a1a286Smrg # fixup the dll searchpath if we need to. 321305a1a286Smrg if test -n "$dllsearchpath"; then 321405a1a286Smrg $ECHO "\ 321505a1a286Smrg # Add the dll search path components to the executable PATH 321605a1a286Smrg PATH=$dllsearchpath:\$PATH 321705a1a286Smrg" 321805a1a286Smrg fi 3219d9c7fc6cSmrg 322005a1a286Smrg $ECHO "\ 322105a1a286Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 322205a1a286Smrg # Run the actual program with our arguments. 322305a1a286Smrg func_exec_program \${1+\"\$@\"} 322405a1a286Smrg fi 322505a1a286Smrg else 322605a1a286Smrg # The program doesn't exist. 322705a1a286Smrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 322805a1a286Smrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 322905a1a286Smrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 323005a1a286Smrg exit 1 323105a1a286Smrg fi 323205a1a286Smrgfi\ 323305a1a286Smrg" 323405a1a286Smrg} 3235d9c7fc6cSmrg 3236d9c7fc6cSmrg 323705a1a286Smrg# func_to_host_path arg 323805a1a286Smrg# 323905a1a286Smrg# Convert paths to host format when used with build tools. 324005a1a286Smrg# Intended for use with "native" mingw (where libtool itself 324105a1a286Smrg# is running under the msys shell), or in the following cross- 324205a1a286Smrg# build environments: 324305a1a286Smrg# $build $host 324405a1a286Smrg# mingw (msys) mingw [e.g. native] 324505a1a286Smrg# cygwin mingw 324605a1a286Smrg# *nix + wine mingw 324705a1a286Smrg# where wine is equipped with the `winepath' executable. 324805a1a286Smrg# In the native mingw case, the (msys) shell automatically 324905a1a286Smrg# converts paths for any non-msys applications it launches, 325005a1a286Smrg# but that facility isn't available from inside the cwrapper. 325105a1a286Smrg# Similar accommodations are necessary for $host mingw and 325205a1a286Smrg# $build cygwin. Calling this function does no harm for other 325305a1a286Smrg# $host/$build combinations not listed above. 325405a1a286Smrg# 325505a1a286Smrg# ARG is the path (on $build) that should be converted to 325605a1a286Smrg# the proper representation for $host. The result is stored 325705a1a286Smrg# in $func_to_host_path_result. 325805a1a286Smrgfunc_to_host_path () 325905a1a286Smrg{ 326005a1a286Smrg func_to_host_path_result="$1" 326105a1a286Smrg if test -n "$1"; then 326205a1a286Smrg case $host in 326305a1a286Smrg *mingw* ) 326405a1a286Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 326505a1a286Smrg case $build in 326605a1a286Smrg *mingw* ) # actually, msys 326705a1a286Smrg # awkward: cmd appends spaces to result 326805a1a286Smrg func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | 326905a1a286Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 327005a1a286Smrg ;; 327105a1a286Smrg *cygwin* ) 327205a1a286Smrg func_to_host_path_result=`cygpath -w "$1" | 327305a1a286Smrg $SED -e "$lt_sed_naive_backslashify"` 327405a1a286Smrg ;; 327505a1a286Smrg * ) 327605a1a286Smrg # Unfortunately, winepath does not exit with a non-zero 327705a1a286Smrg # error code, so we are forced to check the contents of 327805a1a286Smrg # stdout. On the other hand, if the command is not 327905a1a286Smrg # found, the shell will set an exit code of 127 and print 328005a1a286Smrg # *an error message* to stdout. So we must check for both 328105a1a286Smrg # error code of zero AND non-empty stdout, which explains 328205a1a286Smrg # the odd construction: 328305a1a286Smrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 328405a1a286Smrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 328505a1a286Smrg func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | 328605a1a286Smrg $SED -e "$lt_sed_naive_backslashify"` 328705a1a286Smrg else 328805a1a286Smrg # Allow warning below. 328905a1a286Smrg func_to_host_path_result= 329005a1a286Smrg fi 329105a1a286Smrg ;; 329205a1a286Smrg esac 329305a1a286Smrg if test -z "$func_to_host_path_result" ; then 329405a1a286Smrg func_error "Could not determine host path corresponding to" 329505a1a286Smrg func_error " \`$1'" 329605a1a286Smrg func_error "Continuing, but uninstalled executables may not work." 329705a1a286Smrg # Fallback: 329805a1a286Smrg func_to_host_path_result="$1" 329905a1a286Smrg fi 330005a1a286Smrg ;; 330105a1a286Smrg esac 330205a1a286Smrg fi 330305a1a286Smrg} 330405a1a286Smrg# end: func_to_host_path 330505a1a286Smrg 330605a1a286Smrg# func_to_host_pathlist arg 330705a1a286Smrg# 330805a1a286Smrg# Convert pathlists to host format when used with build tools. 330905a1a286Smrg# See func_to_host_path(), above. This function supports the 331005a1a286Smrg# following $build/$host combinations (but does no harm for 331105a1a286Smrg# combinations not listed here): 331205a1a286Smrg# $build $host 331305a1a286Smrg# mingw (msys) mingw [e.g. native] 331405a1a286Smrg# cygwin mingw 331505a1a286Smrg# *nix + wine mingw 331605a1a286Smrg# 331705a1a286Smrg# Path separators are also converted from $build format to 331805a1a286Smrg# $host format. If ARG begins or ends with a path separator 331905a1a286Smrg# character, it is preserved (but converted to $host format) 332005a1a286Smrg# on output. 332105a1a286Smrg# 332205a1a286Smrg# ARG is a pathlist (on $build) that should be converted to 332305a1a286Smrg# the proper representation on $host. The result is stored 332405a1a286Smrg# in $func_to_host_pathlist_result. 332505a1a286Smrgfunc_to_host_pathlist () 332605a1a286Smrg{ 332705a1a286Smrg func_to_host_pathlist_result="$1" 332805a1a286Smrg if test -n "$1"; then 332905a1a286Smrg case $host in 333005a1a286Smrg *mingw* ) 333105a1a286Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 333205a1a286Smrg # Remove leading and trailing path separator characters from 333305a1a286Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 333405a1a286Smrg # into '.;' and ';.', and winepath ignores them completely. 333505a1a286Smrg func_stripname : : "$1" 333605a1a286Smrg func_to_host_pathlist_tmp1=$func_stripname_result 333705a1a286Smrg case $build in 333805a1a286Smrg *mingw* ) # Actually, msys. 333905a1a286Smrg # Awkward: cmd appends spaces to result. 334005a1a286Smrg func_to_host_pathlist_result=` 334105a1a286Smrg ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | 334205a1a286Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 334305a1a286Smrg ;; 334405a1a286Smrg *cygwin* ) 334505a1a286Smrg func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | 334605a1a286Smrg $SED -e "$lt_sed_naive_backslashify"` 334705a1a286Smrg ;; 334805a1a286Smrg * ) 334905a1a286Smrg # unfortunately, winepath doesn't convert pathlists 335005a1a286Smrg func_to_host_pathlist_result="" 335105a1a286Smrg func_to_host_pathlist_oldIFS=$IFS 335205a1a286Smrg IFS=: 335305a1a286Smrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 335405a1a286Smrg IFS=$func_to_host_pathlist_oldIFS 335505a1a286Smrg if test -n "$func_to_host_pathlist_f" ; then 335605a1a286Smrg func_to_host_path "$func_to_host_pathlist_f" 335705a1a286Smrg if test -n "$func_to_host_path_result" ; then 335805a1a286Smrg if test -z "$func_to_host_pathlist_result" ; then 335905a1a286Smrg func_to_host_pathlist_result="$func_to_host_path_result" 336005a1a286Smrg else 336105a1a286Smrg func_append func_to_host_pathlist_result ";$func_to_host_path_result" 336205a1a286Smrg fi 336305a1a286Smrg fi 336405a1a286Smrg fi 336505a1a286Smrg done 336605a1a286Smrg IFS=$func_to_host_pathlist_oldIFS 336705a1a286Smrg ;; 336805a1a286Smrg esac 336905a1a286Smrg if test -z "$func_to_host_pathlist_result"; then 337005a1a286Smrg func_error "Could not determine the host path(s) corresponding to" 337105a1a286Smrg func_error " \`$1'" 337205a1a286Smrg func_error "Continuing, but uninstalled executables may not work." 337305a1a286Smrg # Fallback. This may break if $1 contains DOS-style drive 337405a1a286Smrg # specifications. The fix is not to complicate the expression 337505a1a286Smrg # below, but for the user to provide a working wine installation 337605a1a286Smrg # with winepath so that path translation in the cross-to-mingw 337705a1a286Smrg # case works properly. 337805a1a286Smrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 337905a1a286Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 338005a1a286Smrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 338105a1a286Smrg fi 338205a1a286Smrg # Now, add the leading and trailing path separators back 338305a1a286Smrg case "$1" in 338405a1a286Smrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 338505a1a286Smrg ;; 338605a1a286Smrg esac 338705a1a286Smrg case "$1" in 338805a1a286Smrg *: ) func_append func_to_host_pathlist_result ";" 338905a1a286Smrg ;; 339005a1a286Smrg esac 339105a1a286Smrg ;; 339205a1a286Smrg esac 339305a1a286Smrg fi 339405a1a286Smrg} 339505a1a286Smrg# end: func_to_host_pathlist 339605a1a286Smrg 339705a1a286Smrg# func_emit_cwrapperexe_src 339805a1a286Smrg# emit the source code for a wrapper executable on stdout 339905a1a286Smrg# Must ONLY be called from within func_mode_link because 340005a1a286Smrg# it depends on a number of variable set therein. 340105a1a286Smrgfunc_emit_cwrapperexe_src () 340205a1a286Smrg{ 340305a1a286Smrg cat <<EOF 340405a1a286Smrg 340505a1a286Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 340605a1a286Smrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 340705a1a286Smrg 340805a1a286Smrg The $output program cannot be directly executed until all the libtool 340905a1a286Smrg libraries that it depends on are installed. 341005a1a286Smrg 341105a1a286Smrg This wrapper executable should never be moved out of the build directory. 341205a1a286Smrg If it is, it will not operate correctly. 341305a1a286Smrg*/ 341405a1a286SmrgEOF 341505a1a286Smrg cat <<"EOF" 341605a1a286Smrg#ifdef _MSC_VER 341705a1a286Smrg# define _CRT_SECURE_NO_DEPRECATE 1 341805a1a286Smrg#endif 341905a1a286Smrg#include <stdio.h> 342005a1a286Smrg#include <stdlib.h> 342105a1a286Smrg#ifdef _MSC_VER 342205a1a286Smrg# include <direct.h> 342305a1a286Smrg# include <process.h> 342405a1a286Smrg# include <io.h> 342505a1a286Smrg#else 342605a1a286Smrg# include <unistd.h> 342705a1a286Smrg# include <stdint.h> 342805a1a286Smrg# ifdef __CYGWIN__ 342905a1a286Smrg# include <io.h> 343005a1a286Smrg# endif 343105a1a286Smrg#endif 343205a1a286Smrg#include <malloc.h> 343305a1a286Smrg#include <stdarg.h> 343405a1a286Smrg#include <assert.h> 343505a1a286Smrg#include <string.h> 343605a1a286Smrg#include <ctype.h> 343705a1a286Smrg#include <errno.h> 343805a1a286Smrg#include <fcntl.h> 343905a1a286Smrg#include <sys/stat.h> 344005a1a286Smrg 344105a1a286Smrg/* declarations of non-ANSI functions */ 344205a1a286Smrg#if defined(__MINGW32__) 344305a1a286Smrg# ifdef __STRICT_ANSI__ 344405a1a286Smrgint _putenv (const char *); 344505a1a286Smrg# endif 344605a1a286Smrg#elif defined(__CYGWIN__) 344705a1a286Smrg# ifdef __STRICT_ANSI__ 344805a1a286Smrgchar *realpath (const char *, char *); 344905a1a286Smrgint putenv (char *); 345005a1a286Smrgint setenv (const char *, const char *, int); 345105a1a286Smrg# endif 345205a1a286Smrg/* #elif defined (other platforms) ... */ 345305a1a286Smrg#endif 345405a1a286Smrg 345505a1a286Smrg/* portability defines, excluding path handling macros */ 345605a1a286Smrg#if defined(_MSC_VER) 345705a1a286Smrg# define setmode _setmode 345805a1a286Smrg# define stat _stat 345905a1a286Smrg# define chmod _chmod 346005a1a286Smrg# define getcwd _getcwd 346105a1a286Smrg# define putenv _putenv 346205a1a286Smrg# define S_IXUSR _S_IEXEC 346305a1a286Smrg# ifndef _INTPTR_T_DEFINED 346405a1a286Smrg# define _INTPTR_T_DEFINED 346505a1a286Smrg# define intptr_t int 346605a1a286Smrg# endif 346705a1a286Smrg#elif defined(__MINGW32__) 346805a1a286Smrg# define setmode _setmode 346905a1a286Smrg# define stat _stat 347005a1a286Smrg# define chmod _chmod 347105a1a286Smrg# define getcwd _getcwd 347205a1a286Smrg# define putenv _putenv 347305a1a286Smrg#elif defined(__CYGWIN__) 347405a1a286Smrg# define HAVE_SETENV 347505a1a286Smrg# define FOPEN_WB "wb" 347605a1a286Smrg/* #elif defined (other platforms) ... */ 347705a1a286Smrg#endif 347805a1a286Smrg 347905a1a286Smrg#if defined(PATH_MAX) 348005a1a286Smrg# define LT_PATHMAX PATH_MAX 348105a1a286Smrg#elif defined(MAXPATHLEN) 348205a1a286Smrg# define LT_PATHMAX MAXPATHLEN 348305a1a286Smrg#else 348405a1a286Smrg# define LT_PATHMAX 1024 348505a1a286Smrg#endif 348605a1a286Smrg 348705a1a286Smrg#ifndef S_IXOTH 348805a1a286Smrg# define S_IXOTH 0 348905a1a286Smrg#endif 349005a1a286Smrg#ifndef S_IXGRP 349105a1a286Smrg# define S_IXGRP 0 349205a1a286Smrg#endif 349305a1a286Smrg 349405a1a286Smrg/* path handling portability macros */ 349505a1a286Smrg#ifndef DIR_SEPARATOR 349605a1a286Smrg# define DIR_SEPARATOR '/' 349705a1a286Smrg# define PATH_SEPARATOR ':' 349805a1a286Smrg#endif 349905a1a286Smrg 350005a1a286Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 350105a1a286Smrg defined (__OS2__) 350205a1a286Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 350305a1a286Smrg# define FOPEN_WB "wb" 350405a1a286Smrg# ifndef DIR_SEPARATOR_2 350505a1a286Smrg# define DIR_SEPARATOR_2 '\\' 350605a1a286Smrg# endif 350705a1a286Smrg# ifndef PATH_SEPARATOR_2 350805a1a286Smrg# define PATH_SEPARATOR_2 ';' 350905a1a286Smrg# endif 351005a1a286Smrg#endif 351105a1a286Smrg 351205a1a286Smrg#ifndef DIR_SEPARATOR_2 351305a1a286Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 351405a1a286Smrg#else /* DIR_SEPARATOR_2 */ 351505a1a286Smrg# define IS_DIR_SEPARATOR(ch) \ 351605a1a286Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 351705a1a286Smrg#endif /* DIR_SEPARATOR_2 */ 351805a1a286Smrg 351905a1a286Smrg#ifndef PATH_SEPARATOR_2 352005a1a286Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 352105a1a286Smrg#else /* PATH_SEPARATOR_2 */ 352205a1a286Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 352305a1a286Smrg#endif /* PATH_SEPARATOR_2 */ 352405a1a286Smrg 352505a1a286Smrg#ifndef FOPEN_WB 352605a1a286Smrg# define FOPEN_WB "w" 352705a1a286Smrg#endif 352805a1a286Smrg#ifndef _O_BINARY 352905a1a286Smrg# define _O_BINARY 0 353005a1a286Smrg#endif 353105a1a286Smrg 353205a1a286Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 353305a1a286Smrg#define XFREE(stale) do { \ 353405a1a286Smrg if (stale) { free ((void *) stale); stale = 0; } \ 353505a1a286Smrg} while (0) 353605a1a286Smrg 353705a1a286Smrg#if defined(LT_DEBUGWRAPPER) 353805a1a286Smrgstatic int lt_debug = 1; 353905a1a286Smrg#else 354005a1a286Smrgstatic int lt_debug = 0; 354105a1a286Smrg#endif 354205a1a286Smrg 354305a1a286Smrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 354405a1a286Smrg 354505a1a286Smrgvoid *xmalloc (size_t num); 354605a1a286Smrgchar *xstrdup (const char *string); 354705a1a286Smrgconst char *base_name (const char *name); 354805a1a286Smrgchar *find_executable (const char *wrapper); 354905a1a286Smrgchar *chase_symlinks (const char *pathspec); 355005a1a286Smrgint make_executable (const char *path); 355105a1a286Smrgint check_executable (const char *path); 355205a1a286Smrgchar *strendzap (char *str, const char *pat); 355305a1a286Smrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 355405a1a286Smrgvoid lt_fatal (const char *file, int line, const char *message, ...); 355505a1a286Smrgstatic const char *nonnull (const char *s); 355605a1a286Smrgstatic const char *nonempty (const char *s); 355705a1a286Smrgvoid lt_setenv (const char *name, const char *value); 355805a1a286Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 355905a1a286Smrgvoid lt_update_exe_path (const char *name, const char *value); 356005a1a286Smrgvoid lt_update_lib_path (const char *name, const char *value); 356105a1a286Smrgchar **prepare_spawn (char **argv); 356205a1a286Smrgvoid lt_dump_script (FILE *f); 356305a1a286SmrgEOF 356405a1a286Smrg 356505a1a286Smrg cat <<EOF 356605a1a286Smrgconst char * MAGIC_EXE = "$magic_exe"; 356705a1a286Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 356805a1a286SmrgEOF 356905a1a286Smrg 357005a1a286Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 357105a1a286Smrg func_to_host_pathlist "$temp_rpath" 357205a1a286Smrg cat <<EOF 357305a1a286Smrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 3574d9c7fc6cSmrgEOF 3575d9c7fc6cSmrg else 357605a1a286Smrg cat <<"EOF" 357705a1a286Smrgconst char * LIB_PATH_VALUE = ""; 357805a1a286SmrgEOF 3579d9c7fc6cSmrg fi 358005a1a286Smrg 358105a1a286Smrg if test -n "$dllsearchpath"; then 358205a1a286Smrg func_to_host_pathlist "$dllsearchpath:" 358305a1a286Smrg cat <<EOF 358405a1a286Smrgconst char * EXE_PATH_VARNAME = "PATH"; 358505a1a286Smrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 358605a1a286SmrgEOF 3587d9c7fc6cSmrg else 358805a1a286Smrg cat <<"EOF" 358905a1a286Smrgconst char * EXE_PATH_VARNAME = ""; 359005a1a286Smrgconst char * EXE_PATH_VALUE = ""; 359105a1a286SmrgEOF 3592d9c7fc6cSmrg fi 359305a1a286Smrg 359405a1a286Smrg if test "$fast_install" = yes; then 359505a1a286Smrg cat <<EOF 359605a1a286Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 359705a1a286SmrgEOF 3598d9c7fc6cSmrg else 359905a1a286Smrg cat <<EOF 360005a1a286Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 360105a1a286SmrgEOF 3602d9c7fc6cSmrg fi 3603d9c7fc6cSmrg 3604d9c7fc6cSmrg 360505a1a286Smrg cat <<"EOF" 3606d9c7fc6cSmrg 360705a1a286Smrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 3608d9c7fc6cSmrg 360905a1a286Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 361005a1a286Smrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 361105a1a286Smrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 3612d9c7fc6cSmrg 361305a1a286Smrgint 361405a1a286Smrgmain (int argc, char *argv[]) 361505a1a286Smrg{ 361605a1a286Smrg char **newargz; 361705a1a286Smrg int newargc; 361805a1a286Smrg char *tmp_pathspec; 361905a1a286Smrg char *actual_cwrapper_path; 362005a1a286Smrg char *actual_cwrapper_name; 362105a1a286Smrg char *target_name; 362205a1a286Smrg char *lt_argv_zero; 362305a1a286Smrg intptr_t rval = 127; 3624d9c7fc6cSmrg 362505a1a286Smrg int i; 3626d9c7fc6cSmrg 362705a1a286Smrg program_name = (char *) xstrdup (base_name (argv[0])); 362805a1a286Smrg newargz = XMALLOC (char *, argc + 1); 3629d9c7fc6cSmrg 363005a1a286Smrg /* very simple arg parsing; don't want to rely on getopt 363105a1a286Smrg * also, copy all non cwrapper options to newargz, except 363205a1a286Smrg * argz[0], which is handled differently 363305a1a286Smrg */ 363405a1a286Smrg newargc=0; 363505a1a286Smrg for (i = 1; i < argc; i++) 363605a1a286Smrg { 363705a1a286Smrg if (strcmp (argv[i], dumpscript_opt) == 0) 363805a1a286Smrg { 363905a1a286SmrgEOF 364005a1a286Smrg case "$host" in 364105a1a286Smrg *mingw* | *cygwin* ) 364205a1a286Smrg # make stdout use "unix" line endings 364305a1a286Smrg echo " setmode(1,_O_BINARY);" 364405a1a286Smrg ;; 3645d9c7fc6cSmrg esac 3646d9c7fc6cSmrg 364705a1a286Smrg cat <<"EOF" 364805a1a286Smrg lt_dump_script (stdout); 364905a1a286Smrg return 0; 365005a1a286Smrg } 365105a1a286Smrg if (strcmp (argv[i], debug_opt) == 0) 365205a1a286Smrg { 365305a1a286Smrg lt_debug = 1; 365405a1a286Smrg continue; 365505a1a286Smrg } 365605a1a286Smrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 365705a1a286Smrg { 365805a1a286Smrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 365905a1a286Smrg namespace, but it is not one of the ones we know about and 366005a1a286Smrg have already dealt with, above (inluding dump-script), then 366105a1a286Smrg report an error. Otherwise, targets might begin to believe 366205a1a286Smrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 366305a1a286Smrg namespace. The first time any user complains about this, we'll 366405a1a286Smrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 366505a1a286Smrg or a configure.ac-settable value. 366605a1a286Smrg */ 366705a1a286Smrg lt_fatal (__FILE__, __LINE__, 366805a1a286Smrg "unrecognized %s option: '%s'", 366905a1a286Smrg ltwrapper_option_prefix, argv[i]); 367005a1a286Smrg } 367105a1a286Smrg /* otherwise ... */ 367205a1a286Smrg newargz[++newargc] = xstrdup (argv[i]); 367305a1a286Smrg } 367405a1a286Smrg newargz[++newargc] = NULL; 3675d9c7fc6cSmrg 367605a1a286SmrgEOF 367705a1a286Smrg cat <<EOF 367805a1a286Smrg /* The GNU banner must be the first non-error debug message */ 367905a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 368005a1a286SmrgEOF 368105a1a286Smrg cat <<"EOF" 368205a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 368305a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 368405a1a286Smrg 368505a1a286Smrg tmp_pathspec = find_executable (argv[0]); 368605a1a286Smrg if (tmp_pathspec == NULL) 368705a1a286Smrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 368805a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 368905a1a286Smrg "(main) found exe (before symlink chase) at: %s\n", 369005a1a286Smrg tmp_pathspec); 369105a1a286Smrg 369205a1a286Smrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 369305a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 369405a1a286Smrg "(main) found exe (after symlink chase) at: %s\n", 369505a1a286Smrg actual_cwrapper_path); 369605a1a286Smrg XFREE (tmp_pathspec); 369705a1a286Smrg 369805a1a286Smrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 369905a1a286Smrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 370005a1a286Smrg 370105a1a286Smrg /* wrapper name transforms */ 370205a1a286Smrg strendzap (actual_cwrapper_name, ".exe"); 370305a1a286Smrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 370405a1a286Smrg XFREE (actual_cwrapper_name); 370505a1a286Smrg actual_cwrapper_name = tmp_pathspec; 370605a1a286Smrg tmp_pathspec = 0; 370705a1a286Smrg 370805a1a286Smrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 370905a1a286Smrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 371005a1a286Smrg strendzap (target_name, ".exe"); 371105a1a286Smrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 371205a1a286Smrg XFREE (target_name); 371305a1a286Smrg target_name = tmp_pathspec; 371405a1a286Smrg tmp_pathspec = 0; 371505a1a286Smrg 371605a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 371705a1a286Smrg "(main) libtool target name: %s\n", 371805a1a286Smrg target_name); 371905a1a286SmrgEOF 3720d9c7fc6cSmrg 372105a1a286Smrg cat <<EOF 372205a1a286Smrg newargz[0] = 372305a1a286Smrg XMALLOC (char, (strlen (actual_cwrapper_path) + 372405a1a286Smrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 372505a1a286Smrg strcpy (newargz[0], actual_cwrapper_path); 372605a1a286Smrg strcat (newargz[0], "$objdir"); 372705a1a286Smrg strcat (newargz[0], "/"); 372805a1a286SmrgEOF 3729d9c7fc6cSmrg 373005a1a286Smrg cat <<"EOF" 373105a1a286Smrg /* stop here, and copy so we don't have to do this twice */ 373205a1a286Smrg tmp_pathspec = xstrdup (newargz[0]); 3733d9c7fc6cSmrg 373405a1a286Smrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 373505a1a286Smrg strcat (newargz[0], actual_cwrapper_name); 3736d9c7fc6cSmrg 373705a1a286Smrg /* DO want the lt- prefix here if it exists, so use target_name */ 373805a1a286Smrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 373905a1a286Smrg XFREE (tmp_pathspec); 374005a1a286Smrg tmp_pathspec = NULL; 374105a1a286SmrgEOF 3742d9c7fc6cSmrg 374305a1a286Smrg case $host_os in 374405a1a286Smrg mingw*) 374505a1a286Smrg cat <<"EOF" 374605a1a286Smrg { 374705a1a286Smrg char* p; 374805a1a286Smrg while ((p = strchr (newargz[0], '\\')) != NULL) 374905a1a286Smrg { 375005a1a286Smrg *p = '/'; 375105a1a286Smrg } 375205a1a286Smrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 375305a1a286Smrg { 375405a1a286Smrg *p = '/'; 375505a1a286Smrg } 375605a1a286Smrg } 375705a1a286SmrgEOF 375805a1a286Smrg ;; 375905a1a286Smrg esac 3760d9c7fc6cSmrg 376105a1a286Smrg cat <<"EOF" 376205a1a286Smrg XFREE (target_name); 376305a1a286Smrg XFREE (actual_cwrapper_path); 376405a1a286Smrg XFREE (actual_cwrapper_name); 3765d9c7fc6cSmrg 376605a1a286Smrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 376705a1a286Smrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 376805a1a286Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 376905a1a286Smrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3770d9c7fc6cSmrg 377105a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 377205a1a286Smrg nonnull (lt_argv_zero)); 377305a1a286Smrg for (i = 0; i < newargc; i++) 377405a1a286Smrg { 377505a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 377605a1a286Smrg i, nonnull (newargz[i])); 377705a1a286Smrg } 3778d9c7fc6cSmrg 377905a1a286SmrgEOF 3780d9c7fc6cSmrg 378105a1a286Smrg case $host_os in 378205a1a286Smrg mingw*) 378305a1a286Smrg cat <<"EOF" 378405a1a286Smrg /* execv doesn't actually work on mingw as expected on unix */ 378505a1a286Smrg newargz = prepare_spawn (newargz); 378605a1a286Smrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 378705a1a286Smrg if (rval == -1) 378805a1a286Smrg { 378905a1a286Smrg /* failed to start process */ 379005a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 379105a1a286Smrg "(main) failed to launch target \"%s\": %s\n", 379205a1a286Smrg lt_argv_zero, nonnull (strerror (errno))); 379305a1a286Smrg return 127; 379405a1a286Smrg } 379505a1a286Smrg return rval; 379605a1a286SmrgEOF 379705a1a286Smrg ;; 379805a1a286Smrg *) 379905a1a286Smrg cat <<"EOF" 380005a1a286Smrg execv (lt_argv_zero, newargz); 380105a1a286Smrg return rval; /* =127, but avoids unused variable warning */ 380205a1a286SmrgEOF 380305a1a286Smrg ;; 380405a1a286Smrg esac 3805d9c7fc6cSmrg 380605a1a286Smrg cat <<"EOF" 380705a1a286Smrg} 3808d9c7fc6cSmrg 380905a1a286Smrgvoid * 381005a1a286Smrgxmalloc (size_t num) 381105a1a286Smrg{ 381205a1a286Smrg void *p = (void *) malloc (num); 381305a1a286Smrg if (!p) 381405a1a286Smrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 3815d9c7fc6cSmrg 381605a1a286Smrg return p; 381705a1a286Smrg} 3818d9c7fc6cSmrg 381905a1a286Smrgchar * 382005a1a286Smrgxstrdup (const char *string) 382105a1a286Smrg{ 382205a1a286Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 382305a1a286Smrg string) : NULL; 382405a1a286Smrg} 3825d9c7fc6cSmrg 382605a1a286Smrgconst char * 382705a1a286Smrgbase_name (const char *name) 382805a1a286Smrg{ 382905a1a286Smrg const char *base; 3830d9c7fc6cSmrg 383105a1a286Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 383205a1a286Smrg /* Skip over the disk name in MSDOS pathnames. */ 383305a1a286Smrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 383405a1a286Smrg name += 2; 383505a1a286Smrg#endif 3836d9c7fc6cSmrg 383705a1a286Smrg for (base = name; *name; name++) 383805a1a286Smrg if (IS_DIR_SEPARATOR (*name)) 383905a1a286Smrg base = name + 1; 384005a1a286Smrg return base; 384105a1a286Smrg} 3842d9c7fc6cSmrg 384305a1a286Smrgint 384405a1a286Smrgcheck_executable (const char *path) 384505a1a286Smrg{ 384605a1a286Smrg struct stat st; 3847d9c7fc6cSmrg 384805a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 384905a1a286Smrg nonempty (path)); 385005a1a286Smrg if ((!path) || (!*path)) 385105a1a286Smrg return 0; 3852d9c7fc6cSmrg 385305a1a286Smrg if ((stat (path, &st) >= 0) 385405a1a286Smrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 385505a1a286Smrg return 1; 385605a1a286Smrg else 385705a1a286Smrg return 0; 385805a1a286Smrg} 3859d9c7fc6cSmrg 386005a1a286Smrgint 386105a1a286Smrgmake_executable (const char *path) 386205a1a286Smrg{ 386305a1a286Smrg int rval = 0; 386405a1a286Smrg struct stat st; 3865d9c7fc6cSmrg 386605a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 386705a1a286Smrg nonempty (path)); 386805a1a286Smrg if ((!path) || (!*path)) 386905a1a286Smrg return 0; 3870d9c7fc6cSmrg 387105a1a286Smrg if (stat (path, &st) >= 0) 387205a1a286Smrg { 387305a1a286Smrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 387405a1a286Smrg } 387505a1a286Smrg return rval; 387605a1a286Smrg} 3877d9c7fc6cSmrg 387805a1a286Smrg/* Searches for the full path of the wrapper. Returns 387905a1a286Smrg newly allocated full path name if found, NULL otherwise 388005a1a286Smrg Does not chase symlinks, even on platforms that support them. 388105a1a286Smrg*/ 388205a1a286Smrgchar * 388305a1a286Smrgfind_executable (const char *wrapper) 388405a1a286Smrg{ 388505a1a286Smrg int has_slash = 0; 388605a1a286Smrg const char *p; 388705a1a286Smrg const char *p_next; 388805a1a286Smrg /* static buffer for getcwd */ 388905a1a286Smrg char tmp[LT_PATHMAX + 1]; 389005a1a286Smrg int tmp_len; 389105a1a286Smrg char *concat_name; 3892d9c7fc6cSmrg 389305a1a286Smrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 389405a1a286Smrg nonempty (wrapper)); 3895d9c7fc6cSmrg 389605a1a286Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 389705a1a286Smrg return NULL; 3898d9c7fc6cSmrg 389905a1a286Smrg /* Absolute path? */ 390005a1a286Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 390105a1a286Smrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 390205a1a286Smrg { 390305a1a286Smrg concat_name = xstrdup (wrapper); 390405a1a286Smrg if (check_executable (concat_name)) 390505a1a286Smrg return concat_name; 390605a1a286Smrg XFREE (concat_name); 390705a1a286Smrg } 390805a1a286Smrg else 390905a1a286Smrg { 391005a1a286Smrg#endif 391105a1a286Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 391205a1a286Smrg { 391305a1a286Smrg concat_name = xstrdup (wrapper); 391405a1a286Smrg if (check_executable (concat_name)) 391505a1a286Smrg return concat_name; 391605a1a286Smrg XFREE (concat_name); 391705a1a286Smrg } 391805a1a286Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 391905a1a286Smrg } 392005a1a286Smrg#endif 3921d9c7fc6cSmrg 392205a1a286Smrg for (p = wrapper; *p; p++) 392305a1a286Smrg if (*p == '/') 392405a1a286Smrg { 392505a1a286Smrg has_slash = 1; 392605a1a286Smrg break; 392705a1a286Smrg } 392805a1a286Smrg if (!has_slash) 392905a1a286Smrg { 393005a1a286Smrg /* no slashes; search PATH */ 393105a1a286Smrg const char *path = getenv ("PATH"); 393205a1a286Smrg if (path != NULL) 393305a1a286Smrg { 393405a1a286Smrg for (p = path; *p; p = p_next) 393505a1a286Smrg { 393605a1a286Smrg const char *q; 393705a1a286Smrg size_t p_len; 393805a1a286Smrg for (q = p; *q; q++) 393905a1a286Smrg if (IS_PATH_SEPARATOR (*q)) 394005a1a286Smrg break; 394105a1a286Smrg p_len = q - p; 394205a1a286Smrg p_next = (*q == '\0' ? q : q + 1); 394305a1a286Smrg if (p_len == 0) 394405a1a286Smrg { 394505a1a286Smrg /* empty path: current directory */ 394605a1a286Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 394705a1a286Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 394805a1a286Smrg nonnull (strerror (errno))); 394905a1a286Smrg tmp_len = strlen (tmp); 395005a1a286Smrg concat_name = 395105a1a286Smrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 395205a1a286Smrg memcpy (concat_name, tmp, tmp_len); 395305a1a286Smrg concat_name[tmp_len] = '/'; 395405a1a286Smrg strcpy (concat_name + tmp_len + 1, wrapper); 395505a1a286Smrg } 395605a1a286Smrg else 395705a1a286Smrg { 395805a1a286Smrg concat_name = 395905a1a286Smrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 396005a1a286Smrg memcpy (concat_name, p, p_len); 396105a1a286Smrg concat_name[p_len] = '/'; 396205a1a286Smrg strcpy (concat_name + p_len + 1, wrapper); 396305a1a286Smrg } 396405a1a286Smrg if (check_executable (concat_name)) 396505a1a286Smrg return concat_name; 396605a1a286Smrg XFREE (concat_name); 396705a1a286Smrg } 396805a1a286Smrg } 396905a1a286Smrg /* not found in PATH; assume curdir */ 397005a1a286Smrg } 397105a1a286Smrg /* Relative path | not found in path: prepend cwd */ 397205a1a286Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 397305a1a286Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 397405a1a286Smrg nonnull (strerror (errno))); 397505a1a286Smrg tmp_len = strlen (tmp); 397605a1a286Smrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 397705a1a286Smrg memcpy (concat_name, tmp, tmp_len); 397805a1a286Smrg concat_name[tmp_len] = '/'; 397905a1a286Smrg strcpy (concat_name + tmp_len + 1, wrapper); 3980d9c7fc6cSmrg 398105a1a286Smrg if (check_executable (concat_name)) 398205a1a286Smrg return concat_name; 398305a1a286Smrg XFREE (concat_name); 398405a1a286Smrg return NULL; 398505a1a286Smrg} 3986d9c7fc6cSmrg 398705a1a286Smrgchar * 398805a1a286Smrgchase_symlinks (const char *pathspec) 398905a1a286Smrg{ 399005a1a286Smrg#ifndef S_ISLNK 399105a1a286Smrg return xstrdup (pathspec); 399205a1a286Smrg#else 399305a1a286Smrg char buf[LT_PATHMAX]; 399405a1a286Smrg struct stat s; 399505a1a286Smrg char *tmp_pathspec = xstrdup (pathspec); 399605a1a286Smrg char *p; 399705a1a286Smrg int has_symlinks = 0; 399805a1a286Smrg while (strlen (tmp_pathspec) && !has_symlinks) 399905a1a286Smrg { 400005a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 400105a1a286Smrg "checking path component for symlinks: %s\n", 400205a1a286Smrg tmp_pathspec); 400305a1a286Smrg if (lstat (tmp_pathspec, &s) == 0) 400405a1a286Smrg { 400505a1a286Smrg if (S_ISLNK (s.st_mode) != 0) 400605a1a286Smrg { 400705a1a286Smrg has_symlinks = 1; 400805a1a286Smrg break; 400905a1a286Smrg } 4010d9c7fc6cSmrg 401105a1a286Smrg /* search backwards for last DIR_SEPARATOR */ 401205a1a286Smrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 401305a1a286Smrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401405a1a286Smrg p--; 401505a1a286Smrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401605a1a286Smrg { 401705a1a286Smrg /* no more DIR_SEPARATORS left */ 401805a1a286Smrg break; 401905a1a286Smrg } 402005a1a286Smrg *p = '\0'; 402105a1a286Smrg } 402205a1a286Smrg else 402305a1a286Smrg { 402405a1a286Smrg lt_fatal (__FILE__, __LINE__, 402505a1a286Smrg "error accessing file \"%s\": %s", 402605a1a286Smrg tmp_pathspec, nonnull (strerror (errno))); 402705a1a286Smrg } 402805a1a286Smrg } 402905a1a286Smrg XFREE (tmp_pathspec); 4030d9c7fc6cSmrg 403105a1a286Smrg if (!has_symlinks) 403205a1a286Smrg { 403305a1a286Smrg return xstrdup (pathspec); 403405a1a286Smrg } 4035d9c7fc6cSmrg 403605a1a286Smrg tmp_pathspec = realpath (pathspec, buf); 403705a1a286Smrg if (tmp_pathspec == 0) 403805a1a286Smrg { 403905a1a286Smrg lt_fatal (__FILE__, __LINE__, 404005a1a286Smrg "could not follow symlinks for %s", pathspec); 404105a1a286Smrg } 404205a1a286Smrg return xstrdup (tmp_pathspec); 404305a1a286Smrg#endif 404405a1a286Smrg} 4045d9c7fc6cSmrg 404605a1a286Smrgchar * 404705a1a286Smrgstrendzap (char *str, const char *pat) 404805a1a286Smrg{ 404905a1a286Smrg size_t len, patlen; 4050d9c7fc6cSmrg 405105a1a286Smrg assert (str != NULL); 405205a1a286Smrg assert (pat != NULL); 4053d9c7fc6cSmrg 405405a1a286Smrg len = strlen (str); 405505a1a286Smrg patlen = strlen (pat); 4056d9c7fc6cSmrg 405705a1a286Smrg if (patlen <= len) 405805a1a286Smrg { 405905a1a286Smrg str += len - patlen; 406005a1a286Smrg if (strcmp (str, pat) == 0) 406105a1a286Smrg *str = '\0'; 406205a1a286Smrg } 406305a1a286Smrg return str; 406405a1a286Smrg} 4065d9c7fc6cSmrg 406605a1a286Smrgvoid 406705a1a286Smrglt_debugprintf (const char *file, int line, const char *fmt, ...) 406805a1a286Smrg{ 406905a1a286Smrg va_list args; 407005a1a286Smrg if (lt_debug) 407105a1a286Smrg { 407205a1a286Smrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 407305a1a286Smrg va_start (args, fmt); 407405a1a286Smrg (void) vfprintf (stderr, fmt, args); 407505a1a286Smrg va_end (args); 407605a1a286Smrg } 407705a1a286Smrg} 4078d9c7fc6cSmrg 407905a1a286Smrgstatic void 408005a1a286Smrglt_error_core (int exit_status, const char *file, 408105a1a286Smrg int line, const char *mode, 408205a1a286Smrg const char *message, va_list ap) 408305a1a286Smrg{ 408405a1a286Smrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 408505a1a286Smrg vfprintf (stderr, message, ap); 408605a1a286Smrg fprintf (stderr, ".\n"); 4087d9c7fc6cSmrg 408805a1a286Smrg if (exit_status >= 0) 408905a1a286Smrg exit (exit_status); 409005a1a286Smrg} 4091d9c7fc6cSmrg 409205a1a286Smrgvoid 409305a1a286Smrglt_fatal (const char *file, int line, const char *message, ...) 409405a1a286Smrg{ 409505a1a286Smrg va_list ap; 409605a1a286Smrg va_start (ap, message); 409705a1a286Smrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 409805a1a286Smrg va_end (ap); 409905a1a286Smrg} 4100d9c7fc6cSmrg 410105a1a286Smrgstatic const char * 410205a1a286Smrgnonnull (const char *s) 410305a1a286Smrg{ 410405a1a286Smrg return s ? s : "(null)"; 410505a1a286Smrg} 4106d9c7fc6cSmrg 410705a1a286Smrgstatic const char * 410805a1a286Smrgnonempty (const char *s) 410905a1a286Smrg{ 411005a1a286Smrg return (s && !*s) ? "(empty)" : nonnull (s); 411105a1a286Smrg} 4112d9c7fc6cSmrg 411305a1a286Smrgvoid 411405a1a286Smrglt_setenv (const char *name, const char *value) 411505a1a286Smrg{ 411605a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 411705a1a286Smrg "(lt_setenv) setting '%s' to '%s'\n", 411805a1a286Smrg nonnull (name), nonnull (value)); 411905a1a286Smrg { 412005a1a286Smrg#ifdef HAVE_SETENV 412105a1a286Smrg /* always make a copy, for consistency with !HAVE_SETENV */ 412205a1a286Smrg char *str = xstrdup (value); 412305a1a286Smrg setenv (name, str, 1); 412405a1a286Smrg#else 412505a1a286Smrg int len = strlen (name) + 1 + strlen (value) + 1; 412605a1a286Smrg char *str = XMALLOC (char, len); 412705a1a286Smrg sprintf (str, "%s=%s", name, value); 412805a1a286Smrg if (putenv (str) != EXIT_SUCCESS) 412905a1a286Smrg { 413005a1a286Smrg XFREE (str); 413105a1a286Smrg } 413205a1a286Smrg#endif 413305a1a286Smrg } 413405a1a286Smrg} 4135d9c7fc6cSmrg 413605a1a286Smrgchar * 413705a1a286Smrglt_extend_str (const char *orig_value, const char *add, int to_end) 413805a1a286Smrg{ 413905a1a286Smrg char *new_value; 414005a1a286Smrg if (orig_value && *orig_value) 414105a1a286Smrg { 414205a1a286Smrg int orig_value_len = strlen (orig_value); 414305a1a286Smrg int add_len = strlen (add); 414405a1a286Smrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 414505a1a286Smrg if (to_end) 414605a1a286Smrg { 414705a1a286Smrg strcpy (new_value, orig_value); 414805a1a286Smrg strcpy (new_value + orig_value_len, add); 414905a1a286Smrg } 415005a1a286Smrg else 415105a1a286Smrg { 415205a1a286Smrg strcpy (new_value, add); 415305a1a286Smrg strcpy (new_value + add_len, orig_value); 415405a1a286Smrg } 415505a1a286Smrg } 415605a1a286Smrg else 415705a1a286Smrg { 415805a1a286Smrg new_value = xstrdup (add); 415905a1a286Smrg } 416005a1a286Smrg return new_value; 416105a1a286Smrg} 4162d9c7fc6cSmrg 416305a1a286Smrgvoid 416405a1a286Smrglt_update_exe_path (const char *name, const char *value) 416505a1a286Smrg{ 416605a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 416705a1a286Smrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 416805a1a286Smrg nonnull (name), nonnull (value)); 4169d9c7fc6cSmrg 417005a1a286Smrg if (name && *name && value && *value) 417105a1a286Smrg { 417205a1a286Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 417305a1a286Smrg /* some systems can't cope with a ':'-terminated path #' */ 417405a1a286Smrg int len = strlen (new_value); 417505a1a286Smrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 417605a1a286Smrg { 417705a1a286Smrg new_value[len-1] = '\0'; 417805a1a286Smrg } 417905a1a286Smrg lt_setenv (name, new_value); 418005a1a286Smrg XFREE (new_value); 418105a1a286Smrg } 418205a1a286Smrg} 4183d9c7fc6cSmrg 418405a1a286Smrgvoid 418505a1a286Smrglt_update_lib_path (const char *name, const char *value) 418605a1a286Smrg{ 418705a1a286Smrg lt_debugprintf (__FILE__, __LINE__, 418805a1a286Smrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 418905a1a286Smrg nonnull (name), nonnull (value)); 4190d9c7fc6cSmrg 419105a1a286Smrg if (name && *name && value && *value) 419205a1a286Smrg { 419305a1a286Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 419405a1a286Smrg lt_setenv (name, new_value); 419505a1a286Smrg XFREE (new_value); 419605a1a286Smrg } 419705a1a286Smrg} 4198d9c7fc6cSmrg 419905a1a286SmrgEOF 420005a1a286Smrg case $host_os in 420105a1a286Smrg mingw*) 420205a1a286Smrg cat <<"EOF" 420305a1a286Smrg 420405a1a286Smrg/* Prepares an argument vector before calling spawn(). 420505a1a286Smrg Note that spawn() does not by itself call the command interpreter 420605a1a286Smrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 420705a1a286Smrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 420805a1a286Smrg GetVersionEx(&v); 420905a1a286Smrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 421005a1a286Smrg }) ? "cmd.exe" : "command.com"). 421105a1a286Smrg Instead it simply concatenates the arguments, separated by ' ', and calls 421205a1a286Smrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 421305a1a286Smrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 421405a1a286Smrg special way: 421505a1a286Smrg - Space and tab are interpreted as delimiters. They are not treated as 421605a1a286Smrg delimiters if they are surrounded by double quotes: "...". 421705a1a286Smrg - Unescaped double quotes are removed from the input. Their only effect is 421805a1a286Smrg that within double quotes, space and tab are treated like normal 421905a1a286Smrg characters. 422005a1a286Smrg - Backslashes not followed by double quotes are not special. 422105a1a286Smrg - But 2*n+1 backslashes followed by a double quote become 422205a1a286Smrg n backslashes followed by a double quote (n >= 0): 422305a1a286Smrg \" -> " 422405a1a286Smrg \\\" -> \" 422505a1a286Smrg \\\\\" -> \\" 422605a1a286Smrg */ 422705a1a286Smrg#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" 422805a1a286Smrg#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" 422905a1a286Smrgchar ** 423005a1a286Smrgprepare_spawn (char **argv) 423105a1a286Smrg{ 423205a1a286Smrg size_t argc; 423305a1a286Smrg char **new_argv; 423405a1a286Smrg size_t i; 4235d9c7fc6cSmrg 423605a1a286Smrg /* Count number of arguments. */ 423705a1a286Smrg for (argc = 0; argv[argc] != NULL; argc++) 423805a1a286Smrg ; 4239d9c7fc6cSmrg 424005a1a286Smrg /* Allocate new argument vector. */ 424105a1a286Smrg new_argv = XMALLOC (char *, argc + 1); 4242d9c7fc6cSmrg 424305a1a286Smrg /* Put quoted arguments into the new argument vector. */ 424405a1a286Smrg for (i = 0; i < argc; i++) 424505a1a286Smrg { 424605a1a286Smrg const char *string = argv[i]; 424705a1a286Smrg 424805a1a286Smrg if (string[0] == '\0') 424905a1a286Smrg new_argv[i] = xstrdup ("\"\""); 425005a1a286Smrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 425105a1a286Smrg { 425205a1a286Smrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 425305a1a286Smrg size_t length; 425405a1a286Smrg unsigned int backslashes; 425505a1a286Smrg const char *s; 425605a1a286Smrg char *quoted_string; 425705a1a286Smrg char *p; 425805a1a286Smrg 425905a1a286Smrg length = 0; 426005a1a286Smrg backslashes = 0; 426105a1a286Smrg if (quote_around) 426205a1a286Smrg length++; 426305a1a286Smrg for (s = string; *s != '\0'; s++) 426405a1a286Smrg { 426505a1a286Smrg char c = *s; 426605a1a286Smrg if (c == '"') 426705a1a286Smrg length += backslashes + 1; 426805a1a286Smrg length++; 426905a1a286Smrg if (c == '\\') 427005a1a286Smrg backslashes++; 427105a1a286Smrg else 427205a1a286Smrg backslashes = 0; 427305a1a286Smrg } 427405a1a286Smrg if (quote_around) 427505a1a286Smrg length += backslashes + 1; 427605a1a286Smrg 427705a1a286Smrg quoted_string = XMALLOC (char, length + 1); 427805a1a286Smrg 427905a1a286Smrg p = quoted_string; 428005a1a286Smrg backslashes = 0; 428105a1a286Smrg if (quote_around) 428205a1a286Smrg *p++ = '"'; 428305a1a286Smrg for (s = string; *s != '\0'; s++) 428405a1a286Smrg { 428505a1a286Smrg char c = *s; 428605a1a286Smrg if (c == '"') 428705a1a286Smrg { 428805a1a286Smrg unsigned int j; 428905a1a286Smrg for (j = backslashes + 1; j > 0; j--) 429005a1a286Smrg *p++ = '\\'; 429105a1a286Smrg } 429205a1a286Smrg *p++ = c; 429305a1a286Smrg if (c == '\\') 429405a1a286Smrg backslashes++; 429505a1a286Smrg else 429605a1a286Smrg backslashes = 0; 429705a1a286Smrg } 429805a1a286Smrg if (quote_around) 429905a1a286Smrg { 430005a1a286Smrg unsigned int j; 430105a1a286Smrg for (j = backslashes; j > 0; j--) 430205a1a286Smrg *p++ = '\\'; 430305a1a286Smrg *p++ = '"'; 430405a1a286Smrg } 430505a1a286Smrg *p = '\0'; 4306d9c7fc6cSmrg 430705a1a286Smrg new_argv[i] = quoted_string; 430805a1a286Smrg } 430905a1a286Smrg else 431005a1a286Smrg new_argv[i] = (char *) string; 431105a1a286Smrg } 431205a1a286Smrg new_argv[argc] = NULL; 4313d9c7fc6cSmrg 431405a1a286Smrg return new_argv; 431505a1a286Smrg} 431605a1a286SmrgEOF 4317d9c7fc6cSmrg ;; 4318d9c7fc6cSmrg esac 4319d9c7fc6cSmrg 432005a1a286Smrg cat <<"EOF" 432105a1a286Smrgvoid lt_dump_script (FILE* f) 432205a1a286Smrg{ 432305a1a286SmrgEOF 432405a1a286Smrg func_emit_wrapper yes | 432505a1a286Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 432605a1a286Smrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 4327d9c7fc6cSmrg 432805a1a286Smrg cat <<"EOF" 4329d9c7fc6cSmrg} 433005a1a286SmrgEOF 4331d9c7fc6cSmrg} 433205a1a286Smrg# end: func_emit_cwrapperexe_src 4333d9c7fc6cSmrg 433405a1a286Smrg# func_win32_import_lib_p ARG 433505a1a286Smrg# True if ARG is an import lib, as indicated by $file_magic_cmd 433605a1a286Smrgfunc_win32_import_lib_p () 433705a1a286Smrg{ 433805a1a286Smrg $opt_debug 433905a1a286Smrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 434005a1a286Smrg *import*) : ;; 434105a1a286Smrg *) false ;; 434205a1a286Smrg esac 4343d9c7fc6cSmrg} 4344d9c7fc6cSmrg 434505a1a286Smrg# func_mode_link arg... 434605a1a286Smrgfunc_mode_link () 434705a1a286Smrg{ 434805a1a286Smrg $opt_debug 434905a1a286Smrg case $host in 435005a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 435105a1a286Smrg # It is impossible to link a dll without this setting, and 435205a1a286Smrg # we shouldn't force the makefile maintainer to figure out 435305a1a286Smrg # which system we are compiling for in order to pass an extra 435405a1a286Smrg # flag for every libtool invocation. 435505a1a286Smrg # allow_undefined=no 435605a1a286Smrg 435705a1a286Smrg # FIXME: Unfortunately, there are problems with the above when trying 435805a1a286Smrg # to make a dll which has undefined symbols, in which case not 435905a1a286Smrg # even a static library is built. For now, we need to specify 436005a1a286Smrg # -no-undefined on the libtool link line when we can be certain 436105a1a286Smrg # that all symbols are satisfied, otherwise we get a static library. 436205a1a286Smrg allow_undefined=yes 436305a1a286Smrg ;; 436405a1a286Smrg *) 436505a1a286Smrg allow_undefined=yes 436605a1a286Smrg ;; 436705a1a286Smrg esac 436805a1a286Smrg libtool_args=$nonopt 436905a1a286Smrg base_compile="$nonopt $@" 437005a1a286Smrg compile_command=$nonopt 437105a1a286Smrg finalize_command=$nonopt 437205a1a286Smrg 437305a1a286Smrg compile_rpath= 437405a1a286Smrg finalize_rpath= 437505a1a286Smrg compile_shlibpath= 437605a1a286Smrg finalize_shlibpath= 437705a1a286Smrg convenience= 437805a1a286Smrg old_convenience= 437905a1a286Smrg deplibs= 438005a1a286Smrg old_deplibs= 438105a1a286Smrg compiler_flags= 438205a1a286Smrg linker_flags= 438305a1a286Smrg dllsearchpath= 438405a1a286Smrg lib_search_path=`pwd` 438505a1a286Smrg inst_prefix_dir= 438605a1a286Smrg new_inherited_linker_flags= 438705a1a286Smrg 438805a1a286Smrg avoid_version=no 438905a1a286Smrg bindir= 439005a1a286Smrg dlfiles= 439105a1a286Smrg dlprefiles= 439205a1a286Smrg dlself=no 439305a1a286Smrg export_dynamic=no 439405a1a286Smrg export_symbols= 439505a1a286Smrg export_symbols_regex= 439605a1a286Smrg generated= 439705a1a286Smrg libobjs= 439805a1a286Smrg ltlibs= 439905a1a286Smrg module=no 440005a1a286Smrg no_install=no 440105a1a286Smrg objs= 440205a1a286Smrg non_pic_objects= 440305a1a286Smrg precious_files_regex= 440405a1a286Smrg prefer_static_libs=no 440505a1a286Smrg preload=no 440605a1a286Smrg prev= 440705a1a286Smrg prevarg= 440805a1a286Smrg release= 440905a1a286Smrg rpath= 441005a1a286Smrg xrpath= 441105a1a286Smrg perm_rpath= 441205a1a286Smrg temp_rpath= 441305a1a286Smrg thread_safe=no 441405a1a286Smrg vinfo= 441505a1a286Smrg vinfo_number=no 441605a1a286Smrg weak_libs= 441705a1a286Smrg single_module="${wl}-single_module" 441805a1a286Smrg func_infer_tag $base_compile 441905a1a286Smrg 442005a1a286Smrg # We need to know -static, to get the right output filenames. 442105a1a286Smrg for arg 442205a1a286Smrg do 442305a1a286Smrg case $arg in 442405a1a286Smrg -shared) 442505a1a286Smrg test "$build_libtool_libs" != yes && \ 442605a1a286Smrg func_fatal_configuration "can not build a shared library" 442705a1a286Smrg build_old_libs=no 442805a1a286Smrg break 442905a1a286Smrg ;; 443005a1a286Smrg -all-static | -static | -static-libtool-libs) 443105a1a286Smrg case $arg in 443205a1a286Smrg -all-static) 443305a1a286Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 443405a1a286Smrg func_warning "complete static linking is impossible in this configuration" 443505a1a286Smrg fi 443605a1a286Smrg if test -n "$link_static_flag"; then 443705a1a286Smrg dlopen_self=$dlopen_self_static 443805a1a286Smrg fi 443905a1a286Smrg prefer_static_libs=yes 4440d9c7fc6cSmrg ;; 444105a1a286Smrg -static) 444205a1a286Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444305a1a286Smrg dlopen_self=$dlopen_self_static 444405a1a286Smrg fi 444505a1a286Smrg prefer_static_libs=built 444605a1a286Smrg ;; 444705a1a286Smrg -static-libtool-libs) 444805a1a286Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444905a1a286Smrg dlopen_self=$dlopen_self_static 445005a1a286Smrg fi 445105a1a286Smrg prefer_static_libs=yes 4452d9c7fc6cSmrg ;; 4453d9c7fc6cSmrg esac 445405a1a286Smrg build_libtool_libs=no 445505a1a286Smrg build_old_libs=yes 445605a1a286Smrg break 445705a1a286Smrg ;; 445805a1a286Smrg esac 445905a1a286Smrg done 4460d9c7fc6cSmrg 446105a1a286Smrg # See if our shared archives depend on static archives. 446205a1a286Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4463d9c7fc6cSmrg 446405a1a286Smrg # Go through the arguments, transforming them on the way. 446505a1a286Smrg while test "$#" -gt 0; do 446605a1a286Smrg arg="$1" 446705a1a286Smrg shift 446805a1a286Smrg func_quote_for_eval "$arg" 446905a1a286Smrg qarg=$func_quote_for_eval_unquoted_result 447005a1a286Smrg func_append libtool_args " $func_quote_for_eval_result" 4471d9c7fc6cSmrg 447205a1a286Smrg # If the previous option needs an argument, assign it. 447305a1a286Smrg if test -n "$prev"; then 447405a1a286Smrg case $prev in 447505a1a286Smrg output) 447605a1a286Smrg func_append compile_command " @OUTPUT@" 447705a1a286Smrg func_append finalize_command " @OUTPUT@" 447805a1a286Smrg ;; 447905a1a286Smrg esac 4480d9c7fc6cSmrg 448105a1a286Smrg case $prev in 448205a1a286Smrg bindir) 448305a1a286Smrg bindir="$arg" 448405a1a286Smrg prev= 448505a1a286Smrg continue 448605a1a286Smrg ;; 448705a1a286Smrg dlfiles|dlprefiles) 448805a1a286Smrg if test "$preload" = no; then 448905a1a286Smrg # Add the symbol object into the linking commands. 449005a1a286Smrg func_append compile_command " @SYMFILE@" 449105a1a286Smrg func_append finalize_command " @SYMFILE@" 449205a1a286Smrg preload=yes 449305a1a286Smrg fi 449405a1a286Smrg case $arg in 449505a1a286Smrg *.la | *.lo) ;; # We handle these cases below. 449605a1a286Smrg force) 449705a1a286Smrg if test "$dlself" = no; then 449805a1a286Smrg dlself=needless 449905a1a286Smrg export_dynamic=yes 450005a1a286Smrg fi 450105a1a286Smrg prev= 450205a1a286Smrg continue 450305a1a286Smrg ;; 450405a1a286Smrg self) 450505a1a286Smrg if test "$prev" = dlprefiles; then 450605a1a286Smrg dlself=yes 450705a1a286Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 450805a1a286Smrg dlself=yes 450905a1a286Smrg else 451005a1a286Smrg dlself=needless 451105a1a286Smrg export_dynamic=yes 451205a1a286Smrg fi 451305a1a286Smrg prev= 451405a1a286Smrg continue 4515d9c7fc6cSmrg ;; 4516d9c7fc6cSmrg *) 451705a1a286Smrg if test "$prev" = dlfiles; then 451805a1a286Smrg dlfiles="$dlfiles $arg" 451905a1a286Smrg else 452005a1a286Smrg dlprefiles="$dlprefiles $arg" 452105a1a286Smrg fi 452205a1a286Smrg prev= 452305a1a286Smrg continue 4524d9c7fc6cSmrg ;; 4525d9c7fc6cSmrg esac 452605a1a286Smrg ;; 452705a1a286Smrg expsyms) 452805a1a286Smrg export_symbols="$arg" 452905a1a286Smrg test -f "$arg" \ 453005a1a286Smrg || func_fatal_error "symbol file \`$arg' does not exist" 453105a1a286Smrg prev= 453205a1a286Smrg continue 453305a1a286Smrg ;; 453405a1a286Smrg expsyms_regex) 453505a1a286Smrg export_symbols_regex="$arg" 453605a1a286Smrg prev= 453705a1a286Smrg continue 453805a1a286Smrg ;; 453905a1a286Smrg framework) 454005a1a286Smrg case $host in 454105a1a286Smrg *-*-darwin*) 454205a1a286Smrg case "$deplibs " in 454305a1a286Smrg *" $qarg.ltframework "*) ;; 454405a1a286Smrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 454505a1a286Smrg ;; 454605a1a286Smrg esac 454705a1a286Smrg ;; 454805a1a286Smrg esac 454905a1a286Smrg prev= 455005a1a286Smrg continue 455105a1a286Smrg ;; 455205a1a286Smrg inst_prefix) 455305a1a286Smrg inst_prefix_dir="$arg" 455405a1a286Smrg prev= 455505a1a286Smrg continue 455605a1a286Smrg ;; 455705a1a286Smrg objectlist) 455805a1a286Smrg if test -f "$arg"; then 455905a1a286Smrg save_arg=$arg 456005a1a286Smrg moreargs= 456105a1a286Smrg for fil in `cat "$save_arg"` 456205a1a286Smrg do 456305a1a286Smrg# moreargs="$moreargs $fil" 456405a1a286Smrg arg=$fil 456505a1a286Smrg # A libtool-controlled object. 4566d9c7fc6cSmrg 456705a1a286Smrg # Check to see that this really is a libtool object. 456805a1a286Smrg if func_lalib_unsafe_p "$arg"; then 456905a1a286Smrg pic_object= 457005a1a286Smrg non_pic_object= 4571d9c7fc6cSmrg 457205a1a286Smrg # Read the .lo file 457305a1a286Smrg func_source "$arg" 4574d9c7fc6cSmrg 457505a1a286Smrg if test -z "$pic_object" || 457605a1a286Smrg test -z "$non_pic_object" || 457705a1a286Smrg test "$pic_object" = none && 457805a1a286Smrg test "$non_pic_object" = none; then 457905a1a286Smrg func_fatal_error "cannot find name of object for \`$arg'" 458005a1a286Smrg fi 4581d9c7fc6cSmrg 458205a1a286Smrg # Extract subdirectory from the argument. 458305a1a286Smrg func_dirname "$arg" "/" "" 458405a1a286Smrg xdir="$func_dirname_result" 4585d9c7fc6cSmrg 458605a1a286Smrg if test "$pic_object" != none; then 458705a1a286Smrg # Prepend the subdirectory the object is found in. 458805a1a286Smrg pic_object="$xdir$pic_object" 4589d9c7fc6cSmrg 459005a1a286Smrg if test "$prev" = dlfiles; then 459105a1a286Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 459205a1a286Smrg dlfiles="$dlfiles $pic_object" 459305a1a286Smrg prev= 459405a1a286Smrg continue 459505a1a286Smrg else 459605a1a286Smrg # If libtool objects are unsupported, then we need to preload. 459705a1a286Smrg prev=dlprefiles 459805a1a286Smrg fi 459905a1a286Smrg fi 4600d9c7fc6cSmrg 460105a1a286Smrg # CHECK ME: I think I busted this. -Ossama 460205a1a286Smrg if test "$prev" = dlprefiles; then 460305a1a286Smrg # Preload the old-style object. 460405a1a286Smrg dlprefiles="$dlprefiles $pic_object" 460505a1a286Smrg prev= 460605a1a286Smrg fi 4607d9c7fc6cSmrg 460805a1a286Smrg # A PIC object. 460905a1a286Smrg func_append libobjs " $pic_object" 461005a1a286Smrg arg="$pic_object" 461105a1a286Smrg fi 4612d9c7fc6cSmrg 461305a1a286Smrg # Non-PIC object. 461405a1a286Smrg if test "$non_pic_object" != none; then 461505a1a286Smrg # Prepend the subdirectory the object is found in. 461605a1a286Smrg non_pic_object="$xdir$non_pic_object" 4617d9c7fc6cSmrg 461805a1a286Smrg # A standard non-PIC object 461905a1a286Smrg func_append non_pic_objects " $non_pic_object" 462005a1a286Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 462105a1a286Smrg arg="$non_pic_object" 462205a1a286Smrg fi 462305a1a286Smrg else 462405a1a286Smrg # If the PIC object exists, use it instead. 462505a1a286Smrg # $xdir was prepended to $pic_object above. 462605a1a286Smrg non_pic_object="$pic_object" 462705a1a286Smrg func_append non_pic_objects " $non_pic_object" 462805a1a286Smrg fi 462905a1a286Smrg else 463005a1a286Smrg # Only an error if not doing a dry-run. 463105a1a286Smrg if $opt_dry_run; then 463205a1a286Smrg # Extract subdirectory from the argument. 463305a1a286Smrg func_dirname "$arg" "/" "" 463405a1a286Smrg xdir="$func_dirname_result" 463505a1a286Smrg 463605a1a286Smrg func_lo2o "$arg" 463705a1a286Smrg pic_object=$xdir$objdir/$func_lo2o_result 463805a1a286Smrg non_pic_object=$xdir$func_lo2o_result 463905a1a286Smrg func_append libobjs " $pic_object" 464005a1a286Smrg func_append non_pic_objects " $non_pic_object" 464105a1a286Smrg else 464205a1a286Smrg func_fatal_error "\`$arg' is not a valid libtool object" 464305a1a286Smrg fi 464405a1a286Smrg fi 464505a1a286Smrg done 464605a1a286Smrg else 464705a1a286Smrg func_fatal_error "link input file \`$arg' does not exist" 464805a1a286Smrg fi 464905a1a286Smrg arg=$save_arg 465005a1a286Smrg prev= 465105a1a286Smrg continue 465205a1a286Smrg ;; 465305a1a286Smrg precious_regex) 465405a1a286Smrg precious_files_regex="$arg" 465505a1a286Smrg prev= 465605a1a286Smrg continue 465705a1a286Smrg ;; 465805a1a286Smrg release) 465905a1a286Smrg release="-$arg" 466005a1a286Smrg prev= 466105a1a286Smrg continue 466205a1a286Smrg ;; 466305a1a286Smrg rpath | xrpath) 466405a1a286Smrg # We need an absolute path. 466505a1a286Smrg case $arg in 466605a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 466705a1a286Smrg *) 466805a1a286Smrg func_fatal_error "only absolute run-paths are allowed" 466905a1a286Smrg ;; 467005a1a286Smrg esac 467105a1a286Smrg if test "$prev" = rpath; then 467205a1a286Smrg case "$rpath " in 467305a1a286Smrg *" $arg "*) ;; 467405a1a286Smrg *) rpath="$rpath $arg" ;; 467505a1a286Smrg esac 467605a1a286Smrg else 467705a1a286Smrg case "$xrpath " in 467805a1a286Smrg *" $arg "*) ;; 467905a1a286Smrg *) xrpath="$xrpath $arg" ;; 468005a1a286Smrg esac 468105a1a286Smrg fi 468205a1a286Smrg prev= 468305a1a286Smrg continue 468405a1a286Smrg ;; 468505a1a286Smrg shrext) 468605a1a286Smrg shrext_cmds="$arg" 468705a1a286Smrg prev= 468805a1a286Smrg continue 468905a1a286Smrg ;; 469005a1a286Smrg weak) 469105a1a286Smrg weak_libs="$weak_libs $arg" 469205a1a286Smrg prev= 469305a1a286Smrg continue 469405a1a286Smrg ;; 469505a1a286Smrg xcclinker) 469605a1a286Smrg linker_flags="$linker_flags $qarg" 469705a1a286Smrg compiler_flags="$compiler_flags $qarg" 469805a1a286Smrg prev= 469905a1a286Smrg func_append compile_command " $qarg" 470005a1a286Smrg func_append finalize_command " $qarg" 470105a1a286Smrg continue 470205a1a286Smrg ;; 470305a1a286Smrg xcompiler) 470405a1a286Smrg compiler_flags="$compiler_flags $qarg" 470505a1a286Smrg prev= 470605a1a286Smrg func_append compile_command " $qarg" 470705a1a286Smrg func_append finalize_command " $qarg" 470805a1a286Smrg continue 470905a1a286Smrg ;; 471005a1a286Smrg xlinker) 471105a1a286Smrg linker_flags="$linker_flags $qarg" 471205a1a286Smrg compiler_flags="$compiler_flags $wl$qarg" 471305a1a286Smrg prev= 471405a1a286Smrg func_append compile_command " $wl$qarg" 471505a1a286Smrg func_append finalize_command " $wl$qarg" 471605a1a286Smrg continue 471705a1a286Smrg ;; 471805a1a286Smrg *) 471905a1a286Smrg eval "$prev=\"\$arg\"" 472005a1a286Smrg prev= 472105a1a286Smrg continue 472205a1a286Smrg ;; 4723d9c7fc6cSmrg esac 472405a1a286Smrg fi # test -n "$prev" 4725d9c7fc6cSmrg 472605a1a286Smrg prevarg="$arg" 4727d9c7fc6cSmrg 472805a1a286Smrg case $arg in 472905a1a286Smrg -all-static) 473005a1a286Smrg if test -n "$link_static_flag"; then 473105a1a286Smrg # See comment for -static flag below, for more details. 473205a1a286Smrg func_append compile_command " $link_static_flag" 473305a1a286Smrg func_append finalize_command " $link_static_flag" 473405a1a286Smrg fi 473505a1a286Smrg continue 473605a1a286Smrg ;; 4737d9c7fc6cSmrg 473805a1a286Smrg -allow-undefined) 473905a1a286Smrg # FIXME: remove this flag sometime in the future. 474005a1a286Smrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 474105a1a286Smrg ;; 4742d9c7fc6cSmrg 474305a1a286Smrg -avoid-version) 474405a1a286Smrg avoid_version=yes 474505a1a286Smrg continue 474605a1a286Smrg ;; 4747d9c7fc6cSmrg 474805a1a286Smrg -bindir) 474905a1a286Smrg prev=bindir 475005a1a286Smrg continue 475105a1a286Smrg ;; 4752d9c7fc6cSmrg 475305a1a286Smrg -dlopen) 475405a1a286Smrg prev=dlfiles 475505a1a286Smrg continue 475605a1a286Smrg ;; 4757d9c7fc6cSmrg 475805a1a286Smrg -dlpreopen) 475905a1a286Smrg prev=dlprefiles 476005a1a286Smrg continue 476105a1a286Smrg ;; 4762d9c7fc6cSmrg 476305a1a286Smrg -export-dynamic) 476405a1a286Smrg export_dynamic=yes 476505a1a286Smrg continue 476605a1a286Smrg ;; 4767d9c7fc6cSmrg 476805a1a286Smrg -export-symbols | -export-symbols-regex) 476905a1a286Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 477005a1a286Smrg func_fatal_error "more than one -exported-symbols argument is not allowed" 477105a1a286Smrg fi 477205a1a286Smrg if test "X$arg" = "X-export-symbols"; then 477305a1a286Smrg prev=expsyms 477405a1a286Smrg else 477505a1a286Smrg prev=expsyms_regex 477605a1a286Smrg fi 477705a1a286Smrg continue 477805a1a286Smrg ;; 4779d9c7fc6cSmrg 478005a1a286Smrg -framework) 478105a1a286Smrg prev=framework 478205a1a286Smrg continue 478305a1a286Smrg ;; 4784d9c7fc6cSmrg 478505a1a286Smrg -inst-prefix-dir) 478605a1a286Smrg prev=inst_prefix 478705a1a286Smrg continue 478805a1a286Smrg ;; 4789d9c7fc6cSmrg 479005a1a286Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 479105a1a286Smrg # so, if we see these flags be careful not to treat them like -L 479205a1a286Smrg -L[A-Z][A-Z]*:*) 479305a1a286Smrg case $with_gcc/$host in 479405a1a286Smrg no/*-*-irix* | /*-*-irix*) 479505a1a286Smrg func_append compile_command " $arg" 479605a1a286Smrg func_append finalize_command " $arg" 479705a1a286Smrg ;; 479805a1a286Smrg esac 479905a1a286Smrg continue 480005a1a286Smrg ;; 4801d9c7fc6cSmrg 480205a1a286Smrg -L*) 480305a1a286Smrg func_stripname '-L' '' "$arg" 480405a1a286Smrg dir=$func_stripname_result 480505a1a286Smrg if test -z "$dir"; then 480605a1a286Smrg if test "$#" -gt 0; then 480705a1a286Smrg func_fatal_error "require no space between \`-L' and \`$1'" 480805a1a286Smrg else 480905a1a286Smrg func_fatal_error "need path for \`-L' option" 481005a1a286Smrg fi 481105a1a286Smrg fi 481205a1a286Smrg # We need an absolute path. 481305a1a286Smrg case $dir in 481405a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 481505a1a286Smrg *) 481605a1a286Smrg absdir=`cd "$dir" && pwd` 481705a1a286Smrg test -z "$absdir" && \ 481805a1a286Smrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 481905a1a286Smrg dir="$absdir" 482005a1a286Smrg ;; 482105a1a286Smrg esac 482205a1a286Smrg case "$deplibs " in 482305a1a286Smrg *" -L$dir "*) ;; 482405a1a286Smrg *) 482505a1a286Smrg deplibs="$deplibs -L$dir" 482605a1a286Smrg lib_search_path="$lib_search_path $dir" 482705a1a286Smrg ;; 482805a1a286Smrg esac 482905a1a286Smrg case $host in 483005a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 483105a1a286Smrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 483205a1a286Smrg case :$dllsearchpath: in 483305a1a286Smrg *":$dir:"*) ;; 483405a1a286Smrg ::) dllsearchpath=$dir;; 483505a1a286Smrg *) dllsearchpath="$dllsearchpath:$dir";; 483605a1a286Smrg esac 483705a1a286Smrg case :$dllsearchpath: in 483805a1a286Smrg *":$testbindir:"*) ;; 483905a1a286Smrg ::) dllsearchpath=$testbindir;; 484005a1a286Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 484105a1a286Smrg esac 484205a1a286Smrg ;; 484305a1a286Smrg esac 484405a1a286Smrg continue 484505a1a286Smrg ;; 4846d9c7fc6cSmrg 484705a1a286Smrg -l*) 484805a1a286Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 484905a1a286Smrg case $host in 485005a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 485105a1a286Smrg # These systems don't actually have a C or math library (as such) 485205a1a286Smrg continue 485305a1a286Smrg ;; 485405a1a286Smrg *-*-os2*) 485505a1a286Smrg # These systems don't actually have a C library (as such) 485605a1a286Smrg test "X$arg" = "X-lc" && continue 485705a1a286Smrg ;; 485805a1a286Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 485905a1a286Smrg # Do not include libc due to us having libc/libc_r. 486005a1a286Smrg test "X$arg" = "X-lc" && continue 486105a1a286Smrg ;; 486205a1a286Smrg *-*-rhapsody* | *-*-darwin1.[012]) 486305a1a286Smrg # Rhapsody C and math libraries are in the System framework 486405a1a286Smrg deplibs="$deplibs System.ltframework" 486505a1a286Smrg continue 486605a1a286Smrg ;; 486705a1a286Smrg *-*-sco3.2v5* | *-*-sco5v6*) 486805a1a286Smrg # Causes problems with __ctype 486905a1a286Smrg test "X$arg" = "X-lc" && continue 487005a1a286Smrg ;; 487105a1a286Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 487205a1a286Smrg # Compiler inserts libc in the correct place for threads to work 487305a1a286Smrg test "X$arg" = "X-lc" && continue 487405a1a286Smrg ;; 487505a1a286Smrg esac 487605a1a286Smrg elif test "X$arg" = "X-lc_r"; then 487705a1a286Smrg case $host in 487805a1a286Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 487905a1a286Smrg # Do not include libc_r directly, use -pthread flag. 488005a1a286Smrg continue 488105a1a286Smrg ;; 488205a1a286Smrg esac 488305a1a286Smrg fi 488405a1a286Smrg deplibs="$deplibs $arg" 488505a1a286Smrg continue 488605a1a286Smrg ;; 4887d9c7fc6cSmrg 488805a1a286Smrg -module) 488905a1a286Smrg module=yes 489005a1a286Smrg continue 489105a1a286Smrg ;; 4892d9c7fc6cSmrg 489305a1a286Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 489405a1a286Smrg # classes, name mangling, and exception handling. 489505a1a286Smrg # Darwin uses the -arch flag to determine output architecture. 489605a1a286Smrg -model|-arch|-isysroot) 489705a1a286Smrg compiler_flags="$compiler_flags $arg" 489805a1a286Smrg func_append compile_command " $arg" 489905a1a286Smrg func_append finalize_command " $arg" 490005a1a286Smrg prev=xcompiler 490105a1a286Smrg continue 490205a1a286Smrg ;; 4903d9c7fc6cSmrg 490405a1a286Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 490505a1a286Smrg compiler_flags="$compiler_flags $arg" 490605a1a286Smrg func_append compile_command " $arg" 490705a1a286Smrg func_append finalize_command " $arg" 490805a1a286Smrg case "$new_inherited_linker_flags " in 490905a1a286Smrg *" $arg "*) ;; 491005a1a286Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 491105a1a286Smrg esac 491205a1a286Smrg continue 491305a1a286Smrg ;; 4914d9c7fc6cSmrg 491505a1a286Smrg -multi_module) 491605a1a286Smrg single_module="${wl}-multi_module" 491705a1a286Smrg continue 491805a1a286Smrg ;; 4919d9c7fc6cSmrg 492005a1a286Smrg -no-fast-install) 492105a1a286Smrg fast_install=no 492205a1a286Smrg continue 492305a1a286Smrg ;; 4924d9c7fc6cSmrg 492505a1a286Smrg -no-install) 492605a1a286Smrg case $host in 492705a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 492805a1a286Smrg # The PATH hackery in wrapper scripts is required on Windows 492905a1a286Smrg # and Darwin in order for the loader to find any dlls it needs. 493005a1a286Smrg func_warning "\`-no-install' is ignored for $host" 493105a1a286Smrg func_warning "assuming \`-no-fast-install' instead" 493205a1a286Smrg fast_install=no 493305a1a286Smrg ;; 493405a1a286Smrg *) no_install=yes ;; 493505a1a286Smrg esac 493605a1a286Smrg continue 493705a1a286Smrg ;; 4938d9c7fc6cSmrg 493905a1a286Smrg -no-undefined) 494005a1a286Smrg allow_undefined=no 494105a1a286Smrg continue 494205a1a286Smrg ;; 4943d9c7fc6cSmrg 494405a1a286Smrg -objectlist) 494505a1a286Smrg prev=objectlist 494605a1a286Smrg continue 494705a1a286Smrg ;; 4948d9c7fc6cSmrg 494905a1a286Smrg -o) prev=output ;; 4950d9c7fc6cSmrg 495105a1a286Smrg -precious-files-regex) 495205a1a286Smrg prev=precious_regex 495305a1a286Smrg continue 495405a1a286Smrg ;; 4955d9c7fc6cSmrg 495605a1a286Smrg -release) 495705a1a286Smrg prev=release 495805a1a286Smrg continue 495905a1a286Smrg ;; 4960d9c7fc6cSmrg 496105a1a286Smrg -rpath) 496205a1a286Smrg prev=rpath 496305a1a286Smrg continue 496405a1a286Smrg ;; 4965d9c7fc6cSmrg 496605a1a286Smrg -R) 496705a1a286Smrg prev=xrpath 496805a1a286Smrg continue 496905a1a286Smrg ;; 4970d9c7fc6cSmrg 497105a1a286Smrg -R*) 497205a1a286Smrg func_stripname '-R' '' "$arg" 497305a1a286Smrg dir=$func_stripname_result 497405a1a286Smrg # We need an absolute path. 497505a1a286Smrg case $dir in 497605a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 497705a1a286Smrg *) 497805a1a286Smrg func_fatal_error "only absolute run-paths are allowed" 497905a1a286Smrg ;; 498005a1a286Smrg esac 498105a1a286Smrg case "$xrpath " in 498205a1a286Smrg *" $dir "*) ;; 498305a1a286Smrg *) xrpath="$xrpath $dir" ;; 498405a1a286Smrg esac 498505a1a286Smrg continue 498605a1a286Smrg ;; 4987d9c7fc6cSmrg 498805a1a286Smrg -shared) 498905a1a286Smrg # The effects of -shared are defined in a previous loop. 499005a1a286Smrg continue 499105a1a286Smrg ;; 4992d9c7fc6cSmrg 499305a1a286Smrg -shrext) 499405a1a286Smrg prev=shrext 499505a1a286Smrg continue 499605a1a286Smrg ;; 4997d9c7fc6cSmrg 499805a1a286Smrg -static | -static-libtool-libs) 499905a1a286Smrg # The effects of -static are defined in a previous loop. 500005a1a286Smrg # We used to do the same as -all-static on platforms that 500105a1a286Smrg # didn't have a PIC flag, but the assumption that the effects 500205a1a286Smrg # would be equivalent was wrong. It would break on at least 500305a1a286Smrg # Digital Unix and AIX. 500405a1a286Smrg continue 500505a1a286Smrg ;; 5006d9c7fc6cSmrg 500705a1a286Smrg -thread-safe) 500805a1a286Smrg thread_safe=yes 500905a1a286Smrg continue 501005a1a286Smrg ;; 5011d9c7fc6cSmrg 501205a1a286Smrg -version-info) 501305a1a286Smrg prev=vinfo 501405a1a286Smrg continue 501505a1a286Smrg ;; 5016d9c7fc6cSmrg 501705a1a286Smrg -version-number) 501805a1a286Smrg prev=vinfo 501905a1a286Smrg vinfo_number=yes 502005a1a286Smrg continue 502105a1a286Smrg ;; 5022d9c7fc6cSmrg 502305a1a286Smrg -weak) 502405a1a286Smrg prev=weak 502505a1a286Smrg continue 502605a1a286Smrg ;; 5027d9c7fc6cSmrg 502805a1a286Smrg -Wc,*) 502905a1a286Smrg func_stripname '-Wc,' '' "$arg" 503005a1a286Smrg args=$func_stripname_result 503105a1a286Smrg arg= 503205a1a286Smrg save_ifs="$IFS"; IFS=',' 503305a1a286Smrg for flag in $args; do 503405a1a286Smrg IFS="$save_ifs" 503505a1a286Smrg func_quote_for_eval "$flag" 503605a1a286Smrg arg="$arg $func_quote_for_eval_result" 503705a1a286Smrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 503805a1a286Smrg done 503905a1a286Smrg IFS="$save_ifs" 504005a1a286Smrg func_stripname ' ' '' "$arg" 504105a1a286Smrg arg=$func_stripname_result 504205a1a286Smrg ;; 5043d9c7fc6cSmrg 504405a1a286Smrg -Wl,*) 504505a1a286Smrg func_stripname '-Wl,' '' "$arg" 504605a1a286Smrg args=$func_stripname_result 504705a1a286Smrg arg= 504805a1a286Smrg save_ifs="$IFS"; IFS=',' 504905a1a286Smrg for flag in $args; do 505005a1a286Smrg IFS="$save_ifs" 505105a1a286Smrg func_quote_for_eval "$flag" 505205a1a286Smrg arg="$arg $wl$func_quote_for_eval_result" 505305a1a286Smrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 505405a1a286Smrg linker_flags="$linker_flags $func_quote_for_eval_result" 505505a1a286Smrg done 505605a1a286Smrg IFS="$save_ifs" 505705a1a286Smrg func_stripname ' ' '' "$arg" 505805a1a286Smrg arg=$func_stripname_result 505905a1a286Smrg ;; 5060d9c7fc6cSmrg 506105a1a286Smrg -Xcompiler) 506205a1a286Smrg prev=xcompiler 506305a1a286Smrg continue 506405a1a286Smrg ;; 5065d9c7fc6cSmrg 506605a1a286Smrg -Xlinker) 506705a1a286Smrg prev=xlinker 506805a1a286Smrg continue 506905a1a286Smrg ;; 5070d9c7fc6cSmrg 507105a1a286Smrg -XCClinker) 507205a1a286Smrg prev=xcclinker 507305a1a286Smrg continue 507405a1a286Smrg ;; 5075d9c7fc6cSmrg 507605a1a286Smrg # -msg_* for osf cc 507705a1a286Smrg -msg_*) 507805a1a286Smrg func_quote_for_eval "$arg" 507905a1a286Smrg arg="$func_quote_for_eval_result" 508005a1a286Smrg ;; 5081d9c7fc6cSmrg 508205a1a286Smrg # Flags to be passed through unchanged, with rationale: 508305a1a286Smrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 508405a1a286Smrg # -r[0-9][0-9]* specify processor for the SGI compiler 508505a1a286Smrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 508605a1a286Smrg # +DA*, +DD* enable 64-bit mode for the HP compiler 508705a1a286Smrg # -q* compiler args for the IBM compiler 508805a1a286Smrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 508905a1a286Smrg # -F/path path to uninstalled frameworks, gcc on darwin 509005a1a286Smrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 509105a1a286Smrg # @file GCC response files 509205a1a286Smrg # -tp=* Portland pgcc target processor selection 509305a1a286Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 509405a1a286Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) 509505a1a286Smrg func_quote_for_eval "$arg" 509605a1a286Smrg arg="$func_quote_for_eval_result" 509705a1a286Smrg func_append compile_command " $arg" 509805a1a286Smrg func_append finalize_command " $arg" 509905a1a286Smrg compiler_flags="$compiler_flags $arg" 510005a1a286Smrg continue 510105a1a286Smrg ;; 5102d9c7fc6cSmrg 510305a1a286Smrg # Some other compiler flag. 510405a1a286Smrg -* | +*) 510505a1a286Smrg func_quote_for_eval "$arg" 510605a1a286Smrg arg="$func_quote_for_eval_result" 510705a1a286Smrg ;; 5108d9c7fc6cSmrg 510905a1a286Smrg *.$objext) 511005a1a286Smrg # A standard object. 511105a1a286Smrg objs="$objs $arg" 511205a1a286Smrg ;; 5113d9c7fc6cSmrg 511405a1a286Smrg *.lo) 511505a1a286Smrg # A libtool-controlled object. 5116d9c7fc6cSmrg 511705a1a286Smrg # Check to see that this really is a libtool object. 511805a1a286Smrg if func_lalib_unsafe_p "$arg"; then 511905a1a286Smrg pic_object= 512005a1a286Smrg non_pic_object= 5121d9c7fc6cSmrg 512205a1a286Smrg # Read the .lo file 512305a1a286Smrg func_source "$arg" 5124d9c7fc6cSmrg 512505a1a286Smrg if test -z "$pic_object" || 512605a1a286Smrg test -z "$non_pic_object" || 512705a1a286Smrg test "$pic_object" = none && 512805a1a286Smrg test "$non_pic_object" = none; then 512905a1a286Smrg func_fatal_error "cannot find name of object for \`$arg'" 513005a1a286Smrg fi 5131d9c7fc6cSmrg 513205a1a286Smrg # Extract subdirectory from the argument. 513305a1a286Smrg func_dirname "$arg" "/" "" 513405a1a286Smrg xdir="$func_dirname_result" 5135d9c7fc6cSmrg 513605a1a286Smrg if test "$pic_object" != none; then 513705a1a286Smrg # Prepend the subdirectory the object is found in. 513805a1a286Smrg pic_object="$xdir$pic_object" 5139d9c7fc6cSmrg 514005a1a286Smrg if test "$prev" = dlfiles; then 514105a1a286Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 514205a1a286Smrg dlfiles="$dlfiles $pic_object" 514305a1a286Smrg prev= 514405a1a286Smrg continue 514505a1a286Smrg else 514605a1a286Smrg # If libtool objects are unsupported, then we need to preload. 514705a1a286Smrg prev=dlprefiles 514805a1a286Smrg fi 514905a1a286Smrg fi 5150d9c7fc6cSmrg 515105a1a286Smrg # CHECK ME: I think I busted this. -Ossama 515205a1a286Smrg if test "$prev" = dlprefiles; then 515305a1a286Smrg # Preload the old-style object. 515405a1a286Smrg dlprefiles="$dlprefiles $pic_object" 515505a1a286Smrg prev= 515605a1a286Smrg fi 5157d9c7fc6cSmrg 515805a1a286Smrg # A PIC object. 515905a1a286Smrg func_append libobjs " $pic_object" 516005a1a286Smrg arg="$pic_object" 516105a1a286Smrg fi 5162d9c7fc6cSmrg 516305a1a286Smrg # Non-PIC object. 516405a1a286Smrg if test "$non_pic_object" != none; then 516505a1a286Smrg # Prepend the subdirectory the object is found in. 516605a1a286Smrg non_pic_object="$xdir$non_pic_object" 5167d9c7fc6cSmrg 516805a1a286Smrg # A standard non-PIC object 516905a1a286Smrg func_append non_pic_objects " $non_pic_object" 517005a1a286Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 517105a1a286Smrg arg="$non_pic_object" 517205a1a286Smrg fi 517305a1a286Smrg else 517405a1a286Smrg # If the PIC object exists, use it instead. 517505a1a286Smrg # $xdir was prepended to $pic_object above. 517605a1a286Smrg non_pic_object="$pic_object" 517705a1a286Smrg func_append non_pic_objects " $non_pic_object" 517805a1a286Smrg fi 5179d9c7fc6cSmrg else 518005a1a286Smrg # Only an error if not doing a dry-run. 518105a1a286Smrg if $opt_dry_run; then 518205a1a286Smrg # Extract subdirectory from the argument. 518305a1a286Smrg func_dirname "$arg" "/" "" 518405a1a286Smrg xdir="$func_dirname_result" 518505a1a286Smrg 518605a1a286Smrg func_lo2o "$arg" 518705a1a286Smrg pic_object=$xdir$objdir/$func_lo2o_result 518805a1a286Smrg non_pic_object=$xdir$func_lo2o_result 518905a1a286Smrg func_append libobjs " $pic_object" 519005a1a286Smrg func_append non_pic_objects " $non_pic_object" 519105a1a286Smrg else 519205a1a286Smrg func_fatal_error "\`$arg' is not a valid libtool object" 519305a1a286Smrg fi 5194d9c7fc6cSmrg fi 519505a1a286Smrg ;; 5196d9c7fc6cSmrg 519705a1a286Smrg *.$libext) 519805a1a286Smrg # An archive. 519905a1a286Smrg deplibs="$deplibs $arg" 520005a1a286Smrg old_deplibs="$old_deplibs $arg" 520105a1a286Smrg continue 520205a1a286Smrg ;; 5203d9c7fc6cSmrg 520405a1a286Smrg *.la) 520505a1a286Smrg # A libtool-controlled library. 5206d9c7fc6cSmrg 520705a1a286Smrg if test "$prev" = dlfiles; then 520805a1a286Smrg # This library was specified with -dlopen. 520905a1a286Smrg dlfiles="$dlfiles $arg" 521005a1a286Smrg prev= 521105a1a286Smrg elif test "$prev" = dlprefiles; then 521205a1a286Smrg # The library was specified with -dlpreopen. 521305a1a286Smrg dlprefiles="$dlprefiles $arg" 521405a1a286Smrg prev= 521505a1a286Smrg else 521605a1a286Smrg deplibs="$deplibs $arg" 521705a1a286Smrg fi 521805a1a286Smrg continue 521905a1a286Smrg ;; 5220d9c7fc6cSmrg 522105a1a286Smrg # Some other compiler argument. 522205a1a286Smrg *) 522305a1a286Smrg # Unknown arguments in both finalize_command and compile_command need 522405a1a286Smrg # to be aesthetically quoted because they are evaled later. 522505a1a286Smrg func_quote_for_eval "$arg" 522605a1a286Smrg arg="$func_quote_for_eval_result" 522705a1a286Smrg ;; 522805a1a286Smrg esac # arg 5229d9c7fc6cSmrg 523005a1a286Smrg # Now actually substitute the argument into the commands. 523105a1a286Smrg if test -n "$arg"; then 523205a1a286Smrg func_append compile_command " $arg" 523305a1a286Smrg func_append finalize_command " $arg" 523405a1a286Smrg fi 523505a1a286Smrg done # argument parsing loop 5236d9c7fc6cSmrg 523705a1a286Smrg test -n "$prev" && \ 523805a1a286Smrg func_fatal_help "the \`$prevarg' option requires an argument" 523905a1a286Smrg 524005a1a286Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 524105a1a286Smrg eval arg=\"$export_dynamic_flag_spec\" 524205a1a286Smrg func_append compile_command " $arg" 524305a1a286Smrg func_append finalize_command " $arg" 524405a1a286Smrg fi 524505a1a286Smrg 524605a1a286Smrg oldlibs= 524705a1a286Smrg # calculate the name of the file, without its directory 524805a1a286Smrg func_basename "$output" 524905a1a286Smrg outputname="$func_basename_result" 525005a1a286Smrg libobjs_save="$libobjs" 525105a1a286Smrg 525205a1a286Smrg if test -n "$shlibpath_var"; then 525305a1a286Smrg # get the directories listed in $shlibpath_var 525405a1a286Smrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 525505a1a286Smrg else 525605a1a286Smrg shlib_search_path= 525705a1a286Smrg fi 525805a1a286Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 525905a1a286Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 526005a1a286Smrg 526105a1a286Smrg func_dirname "$output" "/" "" 526205a1a286Smrg output_objdir="$func_dirname_result$objdir" 526305a1a286Smrg # Create the object directory. 526405a1a286Smrg func_mkdir_p "$output_objdir" 526505a1a286Smrg 526605a1a286Smrg # Determine the type of output 526705a1a286Smrg case $output in 526805a1a286Smrg "") 526905a1a286Smrg func_fatal_help "you must specify an output file" 527005a1a286Smrg ;; 527105a1a286Smrg *.$libext) linkmode=oldlib ;; 527205a1a286Smrg *.lo | *.$objext) linkmode=obj ;; 527305a1a286Smrg *.la) linkmode=lib ;; 527405a1a286Smrg *) linkmode=prog ;; # Anything else should be a program. 527505a1a286Smrg esac 527605a1a286Smrg 527705a1a286Smrg specialdeplibs= 527805a1a286Smrg 527905a1a286Smrg libs= 528005a1a286Smrg # Find all interdependent deplibs by searching for libraries 528105a1a286Smrg # that are linked more than once (e.g. -la -lb -la) 528205a1a286Smrg for deplib in $deplibs; do 528305a1a286Smrg if $opt_duplicate_deps ; then 528405a1a286Smrg case "$libs " in 528505a1a286Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 528605a1a286Smrg esac 528705a1a286Smrg fi 528805a1a286Smrg libs="$libs $deplib" 528905a1a286Smrg done 529005a1a286Smrg 529105a1a286Smrg if test "$linkmode" = lib; then 529205a1a286Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 529305a1a286Smrg 529405a1a286Smrg # Compute libraries that are listed more than once in $predeps 529505a1a286Smrg # $postdeps and mark them as special (i.e., whose duplicates are 529605a1a286Smrg # not to be eliminated). 529705a1a286Smrg pre_post_deps= 529805a1a286Smrg if $opt_duplicate_compiler_generated_deps; then 529905a1a286Smrg for pre_post_dep in $predeps $postdeps; do 530005a1a286Smrg case "$pre_post_deps " in 530105a1a286Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 530205a1a286Smrg esac 530305a1a286Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 530405a1a286Smrg done 530505a1a286Smrg fi 530605a1a286Smrg pre_post_deps= 530705a1a286Smrg fi 530805a1a286Smrg 530905a1a286Smrg deplibs= 531005a1a286Smrg newdependency_libs= 531105a1a286Smrg newlib_search_path= 531205a1a286Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 531305a1a286Smrg notinst_deplibs= # not-installed libtool libraries 531405a1a286Smrg notinst_path= # paths that contain not-installed libtool libraries 531505a1a286Smrg 531605a1a286Smrg case $linkmode in 531705a1a286Smrg lib) 531805a1a286Smrg passes="conv dlpreopen link" 531905a1a286Smrg for file in $dlfiles $dlprefiles; do 532005a1a286Smrg case $file in 532105a1a286Smrg *.la) ;; 532205a1a286Smrg *) 532305a1a286Smrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 532405a1a286Smrg ;; 532505a1a286Smrg esac 532605a1a286Smrg done 532705a1a286Smrg ;; 532805a1a286Smrg prog) 532905a1a286Smrg compile_deplibs= 533005a1a286Smrg finalize_deplibs= 533105a1a286Smrg alldeplibs=no 533205a1a286Smrg newdlfiles= 533305a1a286Smrg newdlprefiles= 533405a1a286Smrg passes="conv scan dlopen dlpreopen link" 533505a1a286Smrg ;; 533605a1a286Smrg *) passes="conv" 533705a1a286Smrg ;; 533805a1a286Smrg esac 533905a1a286Smrg 534005a1a286Smrg for pass in $passes; do 534105a1a286Smrg # The preopen pass in lib mode reverses $deplibs; put it back here 534205a1a286Smrg # so that -L comes before libs that need it for instance... 534305a1a286Smrg if test "$linkmode,$pass" = "lib,link"; then 534405a1a286Smrg ## FIXME: Find the place where the list is rebuilt in the wrong 534505a1a286Smrg ## order, and fix it there properly 534605a1a286Smrg tmp_deplibs= 534705a1a286Smrg for deplib in $deplibs; do 534805a1a286Smrg tmp_deplibs="$deplib $tmp_deplibs" 534905a1a286Smrg done 535005a1a286Smrg deplibs="$tmp_deplibs" 535105a1a286Smrg fi 535205a1a286Smrg 535305a1a286Smrg if test "$linkmode,$pass" = "lib,link" || 535405a1a286Smrg test "$linkmode,$pass" = "prog,scan"; then 535505a1a286Smrg libs="$deplibs" 535605a1a286Smrg deplibs= 535705a1a286Smrg fi 535805a1a286Smrg if test "$linkmode" = prog; then 535905a1a286Smrg case $pass in 536005a1a286Smrg dlopen) libs="$dlfiles" ;; 536105a1a286Smrg dlpreopen) libs="$dlprefiles" ;; 536205a1a286Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 536305a1a286Smrg esac 536405a1a286Smrg fi 536505a1a286Smrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 536605a1a286Smrg # Collect and forward deplibs of preopened libtool libs 536705a1a286Smrg for lib in $dlprefiles; do 536805a1a286Smrg # Ignore non-libtool-libs 536905a1a286Smrg dependency_libs= 537005a1a286Smrg case $lib in 537105a1a286Smrg *.la) func_source "$lib" ;; 537205a1a286Smrg esac 537305a1a286Smrg 537405a1a286Smrg # Collect preopened libtool deplibs, except any this library 537505a1a286Smrg # has declared as weak libs 537605a1a286Smrg for deplib in $dependency_libs; do 537705a1a286Smrg func_basename "$deplib" 537805a1a286Smrg deplib_base=$func_basename_result 537905a1a286Smrg case " $weak_libs " in 538005a1a286Smrg *" $deplib_base "*) ;; 538105a1a286Smrg *) deplibs="$deplibs $deplib" ;; 538205a1a286Smrg esac 538305a1a286Smrg done 538405a1a286Smrg done 538505a1a286Smrg libs="$dlprefiles" 538605a1a286Smrg fi 538705a1a286Smrg if test "$pass" = dlopen; then 538805a1a286Smrg # Collect dlpreopened libraries 538905a1a286Smrg save_deplibs="$deplibs" 539005a1a286Smrg deplibs= 539105a1a286Smrg fi 539205a1a286Smrg 539305a1a286Smrg for deplib in $libs; do 539405a1a286Smrg lib= 539505a1a286Smrg found=no 539605a1a286Smrg case $deplib in 539705a1a286Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 539805a1a286Smrg if test "$linkmode,$pass" = "prog,link"; then 539905a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 540005a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 540105a1a286Smrg else 540205a1a286Smrg compiler_flags="$compiler_flags $deplib" 540305a1a286Smrg if test "$linkmode" = lib ; then 540405a1a286Smrg case "$new_inherited_linker_flags " in 540505a1a286Smrg *" $deplib "*) ;; 540605a1a286Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 540705a1a286Smrg esac 540805a1a286Smrg fi 540905a1a286Smrg fi 541005a1a286Smrg continue 541105a1a286Smrg ;; 541205a1a286Smrg -l*) 541305a1a286Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 541405a1a286Smrg func_warning "\`-l' is ignored for archives/objects" 541505a1a286Smrg continue 541605a1a286Smrg fi 541705a1a286Smrg func_stripname '-l' '' "$deplib" 541805a1a286Smrg name=$func_stripname_result 541905a1a286Smrg if test "$linkmode" = lib; then 542005a1a286Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 542105a1a286Smrg else 542205a1a286Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 542305a1a286Smrg fi 542405a1a286Smrg for searchdir in $searchdirs; do 542505a1a286Smrg for search_ext in .la $std_shrext .so .a; do 542605a1a286Smrg # Search the libtool library 542705a1a286Smrg lib="$searchdir/lib${name}${search_ext}" 542805a1a286Smrg if test -f "$lib"; then 542905a1a286Smrg if test "$search_ext" = ".la"; then 543005a1a286Smrg found=yes 543105a1a286Smrg else 543205a1a286Smrg found=no 543305a1a286Smrg fi 543405a1a286Smrg break 2 543505a1a286Smrg fi 543605a1a286Smrg done 543705a1a286Smrg done 543805a1a286Smrg if test "$found" != yes; then 543905a1a286Smrg # deplib doesn't seem to be a libtool library 544005a1a286Smrg if test "$linkmode,$pass" = "prog,link"; then 544105a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 544205a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 544305a1a286Smrg else 544405a1a286Smrg deplibs="$deplib $deplibs" 544505a1a286Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 544605a1a286Smrg fi 544705a1a286Smrg continue 544805a1a286Smrg else # deplib is a libtool library 544905a1a286Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 545005a1a286Smrg # We need to do some special things here, and not later. 545105a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 545205a1a286Smrg case " $predeps $postdeps " in 545305a1a286Smrg *" $deplib "*) 545405a1a286Smrg if func_lalib_p "$lib"; then 545505a1a286Smrg library_names= 545605a1a286Smrg old_library= 545705a1a286Smrg func_source "$lib" 545805a1a286Smrg for l in $old_library $library_names; do 545905a1a286Smrg ll="$l" 546005a1a286Smrg done 546105a1a286Smrg if test "X$ll" = "X$old_library" ; then # only static version available 546205a1a286Smrg found=no 546305a1a286Smrg func_dirname "$lib" "" "." 546405a1a286Smrg ladir="$func_dirname_result" 546505a1a286Smrg lib=$ladir/$old_library 546605a1a286Smrg if test "$linkmode,$pass" = "prog,link"; then 546705a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 546805a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 546905a1a286Smrg else 547005a1a286Smrg deplibs="$deplib $deplibs" 547105a1a286Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 547205a1a286Smrg fi 547305a1a286Smrg continue 547405a1a286Smrg fi 547505a1a286Smrg fi 547605a1a286Smrg ;; 547705a1a286Smrg *) ;; 547805a1a286Smrg esac 547905a1a286Smrg fi 548005a1a286Smrg fi 548105a1a286Smrg ;; # -l 548205a1a286Smrg *.ltframework) 548305a1a286Smrg if test "$linkmode,$pass" = "prog,link"; then 548405a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 548505a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 548605a1a286Smrg else 548705a1a286Smrg deplibs="$deplib $deplibs" 548805a1a286Smrg if test "$linkmode" = lib ; then 548905a1a286Smrg case "$new_inherited_linker_flags " in 549005a1a286Smrg *" $deplib "*) ;; 549105a1a286Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 549205a1a286Smrg esac 549305a1a286Smrg fi 549405a1a286Smrg fi 549505a1a286Smrg continue 549605a1a286Smrg ;; 549705a1a286Smrg -L*) 549805a1a286Smrg case $linkmode in 549905a1a286Smrg lib) 550005a1a286Smrg deplibs="$deplib $deplibs" 550105a1a286Smrg test "$pass" = conv && continue 550205a1a286Smrg newdependency_libs="$deplib $newdependency_libs" 550305a1a286Smrg func_stripname '-L' '' "$deplib" 550405a1a286Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 550505a1a286Smrg ;; 550605a1a286Smrg prog) 550705a1a286Smrg if test "$pass" = conv; then 550805a1a286Smrg deplibs="$deplib $deplibs" 550905a1a286Smrg continue 551005a1a286Smrg fi 551105a1a286Smrg if test "$pass" = scan; then 551205a1a286Smrg deplibs="$deplib $deplibs" 551305a1a286Smrg else 551405a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 551505a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 551605a1a286Smrg fi 551705a1a286Smrg func_stripname '-L' '' "$deplib" 551805a1a286Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 551905a1a286Smrg ;; 552005a1a286Smrg *) 552105a1a286Smrg func_warning "\`-L' is ignored for archives/objects" 552205a1a286Smrg ;; 552305a1a286Smrg esac # linkmode 552405a1a286Smrg continue 552505a1a286Smrg ;; # -L 552605a1a286Smrg -R*) 552705a1a286Smrg if test "$pass" = link; then 552805a1a286Smrg func_stripname '-R' '' "$deplib" 552905a1a286Smrg dir=$func_stripname_result 553005a1a286Smrg # Make sure the xrpath contains only unique directories. 553105a1a286Smrg case "$xrpath " in 553205a1a286Smrg *" $dir "*) ;; 553305a1a286Smrg *) xrpath="$xrpath $dir" ;; 553405a1a286Smrg esac 553505a1a286Smrg fi 553605a1a286Smrg deplibs="$deplib $deplibs" 553705a1a286Smrg continue 553805a1a286Smrg ;; 553905a1a286Smrg *.la) lib="$deplib" ;; 554005a1a286Smrg *.$libext) 554105a1a286Smrg if test "$pass" = conv; then 554205a1a286Smrg deplibs="$deplib $deplibs" 554305a1a286Smrg continue 554405a1a286Smrg fi 554505a1a286Smrg case $linkmode in 554605a1a286Smrg lib) 554705a1a286Smrg # Linking convenience modules into shared libraries is allowed, 554805a1a286Smrg # but linking other static libraries is non-portable. 554905a1a286Smrg case " $dlpreconveniencelibs " in 555005a1a286Smrg *" $deplib "*) ;; 555105a1a286Smrg *) 555205a1a286Smrg valid_a_lib=no 555305a1a286Smrg case $deplibs_check_method in 555405a1a286Smrg match_pattern*) 555505a1a286Smrg set dummy $deplibs_check_method; shift 555605a1a286Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 555705a1a286Smrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 555805a1a286Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 555905a1a286Smrg valid_a_lib=yes 556005a1a286Smrg fi 556105a1a286Smrg ;; 556205a1a286Smrg pass_all) 556305a1a286Smrg valid_a_lib=yes 556405a1a286Smrg ;; 556505a1a286Smrg esac 556605a1a286Smrg if test "$valid_a_lib" != yes; then 556705a1a286Smrg echo 556805a1a286Smrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 556905a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 557005a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 557105a1a286Smrg echo "*** shared version of the library, which you do not appear to have" 557205a1a286Smrg echo "*** because the file extensions .$libext of this argument makes me believe" 557305a1a286Smrg echo "*** that it is just a static archive that I should not use here." 557405a1a286Smrg else 557505a1a286Smrg echo 557605a1a286Smrg $ECHO "*** Warning: Linking the shared library $output against the" 557705a1a286Smrg $ECHO "*** static library $deplib is not portable!" 557805a1a286Smrg deplibs="$deplib $deplibs" 557905a1a286Smrg fi 558005a1a286Smrg ;; 558105a1a286Smrg esac 558205a1a286Smrg continue 558305a1a286Smrg ;; 558405a1a286Smrg prog) 558505a1a286Smrg if test "$pass" != link; then 558605a1a286Smrg deplibs="$deplib $deplibs" 558705a1a286Smrg else 558805a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 558905a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 559005a1a286Smrg fi 559105a1a286Smrg continue 559205a1a286Smrg ;; 559305a1a286Smrg esac # linkmode 559405a1a286Smrg ;; # *.$libext 559505a1a286Smrg *.lo | *.$objext) 559605a1a286Smrg if test "$pass" = conv; then 559705a1a286Smrg deplibs="$deplib $deplibs" 559805a1a286Smrg elif test "$linkmode" = prog; then 559905a1a286Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 560005a1a286Smrg # If there is no dlopen support or we're linking statically, 560105a1a286Smrg # we need to preload. 560205a1a286Smrg newdlprefiles="$newdlprefiles $deplib" 560305a1a286Smrg compile_deplibs="$deplib $compile_deplibs" 560405a1a286Smrg finalize_deplibs="$deplib $finalize_deplibs" 560505a1a286Smrg else 560605a1a286Smrg newdlfiles="$newdlfiles $deplib" 560705a1a286Smrg fi 560805a1a286Smrg fi 560905a1a286Smrg continue 561005a1a286Smrg ;; 561105a1a286Smrg %DEPLIBS%) 561205a1a286Smrg alldeplibs=yes 561305a1a286Smrg continue 561405a1a286Smrg ;; 561505a1a286Smrg esac # case $deplib 561605a1a286Smrg 561705a1a286Smrg if test "$found" = yes || test -f "$lib"; then : 561805a1a286Smrg else 561905a1a286Smrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 562005a1a286Smrg fi 562105a1a286Smrg 562205a1a286Smrg # Check to see that this really is a libtool archive. 562305a1a286Smrg func_lalib_unsafe_p "$lib" \ 562405a1a286Smrg || func_fatal_error "\`$lib' is not a valid libtool archive" 562505a1a286Smrg 562605a1a286Smrg func_dirname "$lib" "" "." 562705a1a286Smrg ladir="$func_dirname_result" 562805a1a286Smrg 562905a1a286Smrg dlname= 563005a1a286Smrg dlopen= 563105a1a286Smrg dlpreopen= 563205a1a286Smrg libdir= 563305a1a286Smrg library_names= 563405a1a286Smrg old_library= 563505a1a286Smrg inherited_linker_flags= 563605a1a286Smrg # If the library was installed with an old release of libtool, 563705a1a286Smrg # it will not redefine variables installed, or shouldnotlink 563805a1a286Smrg installed=yes 563905a1a286Smrg shouldnotlink=no 564005a1a286Smrg avoidtemprpath= 564105a1a286Smrg 564205a1a286Smrg 564305a1a286Smrg # Read the .la file 564405a1a286Smrg func_source "$lib" 564505a1a286Smrg 564605a1a286Smrg # Convert "-framework foo" to "foo.ltframework" 564705a1a286Smrg if test -n "$inherited_linker_flags"; then 564805a1a286Smrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 564905a1a286Smrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 565005a1a286Smrg case " $new_inherited_linker_flags " in 565105a1a286Smrg *" $tmp_inherited_linker_flag "*) ;; 565205a1a286Smrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 565305a1a286Smrg esac 565405a1a286Smrg done 565505a1a286Smrg fi 565605a1a286Smrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 565705a1a286Smrg if test "$linkmode,$pass" = "lib,link" || 565805a1a286Smrg test "$linkmode,$pass" = "prog,scan" || 565905a1a286Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 566005a1a286Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 566105a1a286Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 566205a1a286Smrg fi 566305a1a286Smrg 566405a1a286Smrg if test "$pass" = conv; then 566505a1a286Smrg # Only check for convenience libraries 566605a1a286Smrg deplibs="$lib $deplibs" 566705a1a286Smrg if test -z "$libdir"; then 566805a1a286Smrg if test -z "$old_library"; then 566905a1a286Smrg func_fatal_error "cannot find name of link library for \`$lib'" 567005a1a286Smrg fi 567105a1a286Smrg # It is a libtool convenience library, so add in its objects. 567205a1a286Smrg convenience="$convenience $ladir/$objdir/$old_library" 567305a1a286Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 567405a1a286Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 567505a1a286Smrg func_fatal_error "\`$lib' is not a convenience library" 567605a1a286Smrg fi 567705a1a286Smrg tmp_libs= 567805a1a286Smrg for deplib in $dependency_libs; do 567905a1a286Smrg deplibs="$deplib $deplibs" 568005a1a286Smrg if $opt_duplicate_deps ; then 568105a1a286Smrg case "$tmp_libs " in 568205a1a286Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 568305a1a286Smrg esac 568405a1a286Smrg fi 568505a1a286Smrg tmp_libs="$tmp_libs $deplib" 568605a1a286Smrg done 568705a1a286Smrg continue 568805a1a286Smrg fi # $pass = conv 568905a1a286Smrg 569005a1a286Smrg 569105a1a286Smrg # Get the name of the library we link against. 569205a1a286Smrg linklib= 569305a1a286Smrg for l in $old_library $library_names; do 569405a1a286Smrg linklib="$l" 569505a1a286Smrg done 569605a1a286Smrg if test -z "$linklib"; then 569705a1a286Smrg func_fatal_error "cannot find name of link library for \`$lib'" 569805a1a286Smrg fi 569905a1a286Smrg 570005a1a286Smrg # This library was specified with -dlopen. 570105a1a286Smrg if test "$pass" = dlopen; then 570205a1a286Smrg if test -z "$libdir"; then 570305a1a286Smrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 570405a1a286Smrg fi 570505a1a286Smrg if test -z "$dlname" || 570605a1a286Smrg test "$dlopen_support" != yes || 570705a1a286Smrg test "$build_libtool_libs" = no; then 570805a1a286Smrg # If there is no dlname, no dlopen support or we're linking 570905a1a286Smrg # statically, we need to preload. We also need to preload any 571005a1a286Smrg # dependent libraries so libltdl's deplib preloader doesn't 571105a1a286Smrg # bomb out in the load deplibs phase. 571205a1a286Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 571305a1a286Smrg else 571405a1a286Smrg newdlfiles="$newdlfiles $lib" 571505a1a286Smrg fi 571605a1a286Smrg continue 571705a1a286Smrg fi # $pass = dlopen 571805a1a286Smrg 571905a1a286Smrg # We need an absolute path. 572005a1a286Smrg case $ladir in 572105a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 572205a1a286Smrg *) 572305a1a286Smrg abs_ladir=`cd "$ladir" && pwd` 572405a1a286Smrg if test -z "$abs_ladir"; then 572505a1a286Smrg func_warning "cannot determine absolute directory name of \`$ladir'" 572605a1a286Smrg func_warning "passing it literally to the linker, although it might fail" 572705a1a286Smrg abs_ladir="$ladir" 572805a1a286Smrg fi 572905a1a286Smrg ;; 573005a1a286Smrg esac 573105a1a286Smrg func_basename "$lib" 573205a1a286Smrg laname="$func_basename_result" 573305a1a286Smrg 573405a1a286Smrg # Find the relevant object directory and library name. 573505a1a286Smrg if test "X$installed" = Xyes; then 573605a1a286Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 573705a1a286Smrg func_warning "library \`$lib' was moved." 573805a1a286Smrg dir="$ladir" 573905a1a286Smrg absdir="$abs_ladir" 574005a1a286Smrg libdir="$abs_ladir" 574105a1a286Smrg else 574205a1a286Smrg dir="$libdir" 574305a1a286Smrg absdir="$libdir" 574405a1a286Smrg fi 574505a1a286Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 574605a1a286Smrg else 574705a1a286Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 574805a1a286Smrg dir="$ladir" 574905a1a286Smrg absdir="$abs_ladir" 575005a1a286Smrg # Remove this search path later 575105a1a286Smrg notinst_path="$notinst_path $abs_ladir" 575205a1a286Smrg else 575305a1a286Smrg dir="$ladir/$objdir" 575405a1a286Smrg absdir="$abs_ladir/$objdir" 575505a1a286Smrg # Remove this search path later 575605a1a286Smrg notinst_path="$notinst_path $abs_ladir" 575705a1a286Smrg fi 575805a1a286Smrg fi # $installed = yes 575905a1a286Smrg func_stripname 'lib' '.la' "$laname" 576005a1a286Smrg name=$func_stripname_result 576105a1a286Smrg 576205a1a286Smrg # This library was specified with -dlpreopen. 576305a1a286Smrg if test "$pass" = dlpreopen; then 576405a1a286Smrg if test -z "$libdir" && test "$linkmode" = prog; then 576505a1a286Smrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 576605a1a286Smrg fi 576705a1a286Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 576805a1a286Smrg # are required to link). 576905a1a286Smrg if test -n "$old_library"; then 577005a1a286Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 577105a1a286Smrg # Keep a list of preopened convenience libraries to check 577205a1a286Smrg # that they are being used correctly in the link pass. 577305a1a286Smrg test -z "$libdir" && \ 577405a1a286Smrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 577505a1a286Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 577605a1a286Smrg elif test -n "$dlname"; then 577705a1a286Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 577805a1a286Smrg else 577905a1a286Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 578005a1a286Smrg fi 578105a1a286Smrg fi # $pass = dlpreopen 578205a1a286Smrg 578305a1a286Smrg if test -z "$libdir"; then 578405a1a286Smrg # Link the convenience library 578505a1a286Smrg if test "$linkmode" = lib; then 578605a1a286Smrg deplibs="$dir/$old_library $deplibs" 578705a1a286Smrg elif test "$linkmode,$pass" = "prog,link"; then 578805a1a286Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 578905a1a286Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 579005a1a286Smrg else 579105a1a286Smrg deplibs="$lib $deplibs" # used for prog,scan pass 579205a1a286Smrg fi 579305a1a286Smrg continue 579405a1a286Smrg fi 579505a1a286Smrg 579605a1a286Smrg 579705a1a286Smrg if test "$linkmode" = prog && test "$pass" != link; then 579805a1a286Smrg newlib_search_path="$newlib_search_path $ladir" 579905a1a286Smrg deplibs="$lib $deplibs" 580005a1a286Smrg 580105a1a286Smrg linkalldeplibs=no 580205a1a286Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 580305a1a286Smrg test "$build_libtool_libs" = no; then 580405a1a286Smrg linkalldeplibs=yes 580505a1a286Smrg fi 580605a1a286Smrg 580705a1a286Smrg tmp_libs= 580805a1a286Smrg for deplib in $dependency_libs; do 580905a1a286Smrg case $deplib in 581005a1a286Smrg -L*) func_stripname '-L' '' "$deplib" 581105a1a286Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 581205a1a286Smrg ;; 581305a1a286Smrg esac 581405a1a286Smrg # Need to link against all dependency_libs? 581505a1a286Smrg if test "$linkalldeplibs" = yes; then 581605a1a286Smrg deplibs="$deplib $deplibs" 581705a1a286Smrg else 581805a1a286Smrg # Need to hardcode shared library paths 581905a1a286Smrg # or/and link against static libraries 582005a1a286Smrg newdependency_libs="$deplib $newdependency_libs" 582105a1a286Smrg fi 582205a1a286Smrg if $opt_duplicate_deps ; then 582305a1a286Smrg case "$tmp_libs " in 582405a1a286Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 582505a1a286Smrg esac 582605a1a286Smrg fi 582705a1a286Smrg tmp_libs="$tmp_libs $deplib" 582805a1a286Smrg done # for deplib 582905a1a286Smrg continue 583005a1a286Smrg fi # $linkmode = prog... 583105a1a286Smrg 583205a1a286Smrg if test "$linkmode,$pass" = "prog,link"; then 583305a1a286Smrg if test -n "$library_names" && 583405a1a286Smrg { { test "$prefer_static_libs" = no || 583505a1a286Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 583605a1a286Smrg test -z "$old_library"; }; then 583705a1a286Smrg # We need to hardcode the library path 583805a1a286Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 583905a1a286Smrg # Make sure the rpath contains only unique directories. 584005a1a286Smrg case "$temp_rpath:" in 584105a1a286Smrg *"$absdir:"*) ;; 584205a1a286Smrg *) temp_rpath="$temp_rpath$absdir:" ;; 584305a1a286Smrg esac 584405a1a286Smrg fi 584505a1a286Smrg 584605a1a286Smrg # Hardcode the library path. 584705a1a286Smrg # Skip directories that are in the system default run-time 584805a1a286Smrg # search path. 584905a1a286Smrg case " $sys_lib_dlsearch_path " in 585005a1a286Smrg *" $absdir "*) ;; 585105a1a286Smrg *) 585205a1a286Smrg case "$compile_rpath " in 585305a1a286Smrg *" $absdir "*) ;; 585405a1a286Smrg *) compile_rpath="$compile_rpath $absdir" 585505a1a286Smrg esac 585605a1a286Smrg ;; 585705a1a286Smrg esac 585805a1a286Smrg case " $sys_lib_dlsearch_path " in 585905a1a286Smrg *" $libdir "*) ;; 586005a1a286Smrg *) 586105a1a286Smrg case "$finalize_rpath " in 586205a1a286Smrg *" $libdir "*) ;; 586305a1a286Smrg *) finalize_rpath="$finalize_rpath $libdir" 586405a1a286Smrg esac 586505a1a286Smrg ;; 586605a1a286Smrg esac 586705a1a286Smrg fi # $linkmode,$pass = prog,link... 586805a1a286Smrg 586905a1a286Smrg if test "$alldeplibs" = yes && 587005a1a286Smrg { test "$deplibs_check_method" = pass_all || 587105a1a286Smrg { test "$build_libtool_libs" = yes && 587205a1a286Smrg test -n "$library_names"; }; }; then 587305a1a286Smrg # We only need to search for static libraries 587405a1a286Smrg continue 587505a1a286Smrg fi 587605a1a286Smrg fi 587705a1a286Smrg 587805a1a286Smrg link_static=no # Whether the deplib will be linked statically 587905a1a286Smrg use_static_libs=$prefer_static_libs 588005a1a286Smrg if test "$use_static_libs" = built && test "$installed" = yes; then 588105a1a286Smrg use_static_libs=no 588205a1a286Smrg fi 588305a1a286Smrg if test -n "$library_names" && 588405a1a286Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 588505a1a286Smrg case $host in 588605a1a286Smrg *cygwin* | *mingw* | *cegcc*) 588705a1a286Smrg # No point in relinking DLLs because paths are not encoded 588805a1a286Smrg notinst_deplibs="$notinst_deplibs $lib" 588905a1a286Smrg need_relink=no 589005a1a286Smrg ;; 589105a1a286Smrg *) 589205a1a286Smrg if test "$installed" = no; then 589305a1a286Smrg notinst_deplibs="$notinst_deplibs $lib" 589405a1a286Smrg need_relink=yes 589505a1a286Smrg fi 589605a1a286Smrg ;; 589705a1a286Smrg esac 589805a1a286Smrg # This is a shared library 589905a1a286Smrg 590005a1a286Smrg # Warn about portability, can't link against -module's on some 590105a1a286Smrg # systems (darwin). Don't bleat about dlopened modules though! 590205a1a286Smrg dlopenmodule="" 590305a1a286Smrg for dlpremoduletest in $dlprefiles; do 590405a1a286Smrg if test "X$dlpremoduletest" = "X$lib"; then 590505a1a286Smrg dlopenmodule="$dlpremoduletest" 590605a1a286Smrg break 590705a1a286Smrg fi 590805a1a286Smrg done 590905a1a286Smrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 591005a1a286Smrg echo 591105a1a286Smrg if test "$linkmode" = prog; then 591205a1a286Smrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 591305a1a286Smrg else 591405a1a286Smrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 591505a1a286Smrg fi 591605a1a286Smrg $ECHO "*** $linklib is not portable!" 591705a1a286Smrg fi 591805a1a286Smrg if test "$linkmode" = lib && 591905a1a286Smrg test "$hardcode_into_libs" = yes; then 592005a1a286Smrg # Hardcode the library path. 592105a1a286Smrg # Skip directories that are in the system default run-time 592205a1a286Smrg # search path. 592305a1a286Smrg case " $sys_lib_dlsearch_path " in 592405a1a286Smrg *" $absdir "*) ;; 592505a1a286Smrg *) 592605a1a286Smrg case "$compile_rpath " in 592705a1a286Smrg *" $absdir "*) ;; 592805a1a286Smrg *) compile_rpath="$compile_rpath $absdir" 592905a1a286Smrg esac 593005a1a286Smrg ;; 593105a1a286Smrg esac 593205a1a286Smrg case " $sys_lib_dlsearch_path " in 593305a1a286Smrg *" $libdir "*) ;; 593405a1a286Smrg *) 593505a1a286Smrg case "$finalize_rpath " in 593605a1a286Smrg *" $libdir "*) ;; 593705a1a286Smrg *) finalize_rpath="$finalize_rpath $libdir" 593805a1a286Smrg esac 593905a1a286Smrg ;; 594005a1a286Smrg esac 594105a1a286Smrg fi 594205a1a286Smrg 594305a1a286Smrg if test -n "$old_archive_from_expsyms_cmds"; then 594405a1a286Smrg # figure out the soname 594505a1a286Smrg set dummy $library_names 594605a1a286Smrg shift 594705a1a286Smrg realname="$1" 594805a1a286Smrg shift 594905a1a286Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 595005a1a286Smrg # use dlname if we got it. it's perfectly good, no? 595105a1a286Smrg if test -n "$dlname"; then 595205a1a286Smrg soname="$dlname" 595305a1a286Smrg elif test -n "$soname_spec"; then 595405a1a286Smrg # bleh windows 595505a1a286Smrg case $host in 595605a1a286Smrg *cygwin* | mingw* | *cegcc*) 595705a1a286Smrg func_arith $current - $age 595805a1a286Smrg major=$func_arith_result 595905a1a286Smrg versuffix="-$major" 596005a1a286Smrg ;; 596105a1a286Smrg esac 596205a1a286Smrg eval soname=\"$soname_spec\" 596305a1a286Smrg else 596405a1a286Smrg soname="$realname" 596505a1a286Smrg fi 596605a1a286Smrg 596705a1a286Smrg # Make a new name for the extract_expsyms_cmds to use 596805a1a286Smrg soroot="$soname" 596905a1a286Smrg func_basename "$soroot" 597005a1a286Smrg soname="$func_basename_result" 597105a1a286Smrg func_stripname 'lib' '.dll' "$soname" 597205a1a286Smrg newlib=libimp-$func_stripname_result.a 597305a1a286Smrg 597405a1a286Smrg # If the library has no export list, then create one now 597505a1a286Smrg if test -f "$output_objdir/$soname-def"; then : 597605a1a286Smrg else 597705a1a286Smrg func_verbose "extracting exported symbol list from \`$soname'" 597805a1a286Smrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 597905a1a286Smrg fi 598005a1a286Smrg 598105a1a286Smrg # Create $newlib 598205a1a286Smrg if test -f "$output_objdir/$newlib"; then :; else 598305a1a286Smrg func_verbose "generating import library for \`$soname'" 598405a1a286Smrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 598505a1a286Smrg fi 598605a1a286Smrg # make sure the library variables are pointing to the new library 598705a1a286Smrg dir=$output_objdir 598805a1a286Smrg linklib=$newlib 598905a1a286Smrg fi # test -n "$old_archive_from_expsyms_cmds" 599005a1a286Smrg 599105a1a286Smrg if test "$linkmode" = prog || test "$mode" != relink; then 599205a1a286Smrg add_shlibpath= 599305a1a286Smrg add_dir= 599405a1a286Smrg add= 599505a1a286Smrg lib_linked=yes 599605a1a286Smrg case $hardcode_action in 599705a1a286Smrg immediate | unsupported) 599805a1a286Smrg if test "$hardcode_direct" = no; then 599905a1a286Smrg add="$dir/$linklib" 600005a1a286Smrg case $host in 600105a1a286Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 600205a1a286Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 600305a1a286Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 600405a1a286Smrg *-*-unixware7*) add_dir="-L$dir" ;; 600505a1a286Smrg *-*-darwin* ) 600605a1a286Smrg # if the lib is a (non-dlopened) module then we can not 600705a1a286Smrg # link against it, someone is ignoring the earlier warnings 600805a1a286Smrg if /usr/bin/file -L $add 2> /dev/null | 600905a1a286Smrg $GREP ": [^:]* bundle" >/dev/null ; then 601005a1a286Smrg if test "X$dlopenmodule" != "X$lib"; then 601105a1a286Smrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 601205a1a286Smrg if test -z "$old_library" ; then 601305a1a286Smrg echo 601405a1a286Smrg echo "*** And there doesn't seem to be a static archive available" 601505a1a286Smrg echo "*** The link will probably fail, sorry" 601605a1a286Smrg else 601705a1a286Smrg add="$dir/$old_library" 601805a1a286Smrg fi 601905a1a286Smrg elif test -n "$old_library"; then 602005a1a286Smrg add="$dir/$old_library" 602105a1a286Smrg fi 602205a1a286Smrg fi 602305a1a286Smrg esac 602405a1a286Smrg elif test "$hardcode_minus_L" = no; then 602505a1a286Smrg case $host in 602605a1a286Smrg *-*-sunos*) add_shlibpath="$dir" ;; 602705a1a286Smrg esac 602805a1a286Smrg add_dir="-L$dir" 602905a1a286Smrg add="-l$name" 603005a1a286Smrg elif test "$hardcode_shlibpath_var" = no; then 603105a1a286Smrg add_shlibpath="$dir" 603205a1a286Smrg add="-l$name" 603305a1a286Smrg else 603405a1a286Smrg lib_linked=no 603505a1a286Smrg fi 603605a1a286Smrg ;; 603705a1a286Smrg relink) 603805a1a286Smrg if test "$hardcode_direct" = yes && 603905a1a286Smrg test "$hardcode_direct_absolute" = no; then 604005a1a286Smrg add="$dir/$linklib" 604105a1a286Smrg elif test "$hardcode_minus_L" = yes; then 604205a1a286Smrg add_dir="-L$dir" 604305a1a286Smrg # Try looking first in the location we're being installed to. 604405a1a286Smrg if test -n "$inst_prefix_dir"; then 604505a1a286Smrg case $libdir in 604605a1a286Smrg [\\/]*) 604705a1a286Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 604805a1a286Smrg ;; 604905a1a286Smrg esac 605005a1a286Smrg fi 605105a1a286Smrg add="-l$name" 605205a1a286Smrg elif test "$hardcode_shlibpath_var" = yes; then 605305a1a286Smrg add_shlibpath="$dir" 605405a1a286Smrg add="-l$name" 605505a1a286Smrg else 605605a1a286Smrg lib_linked=no 605705a1a286Smrg fi 605805a1a286Smrg ;; 605905a1a286Smrg *) lib_linked=no ;; 606005a1a286Smrg esac 606105a1a286Smrg 606205a1a286Smrg if test "$lib_linked" != yes; then 606305a1a286Smrg func_fatal_configuration "unsupported hardcode properties" 606405a1a286Smrg fi 606505a1a286Smrg 606605a1a286Smrg if test -n "$add_shlibpath"; then 606705a1a286Smrg case :$compile_shlibpath: in 606805a1a286Smrg *":$add_shlibpath:"*) ;; 606905a1a286Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 607005a1a286Smrg esac 607105a1a286Smrg fi 607205a1a286Smrg if test "$linkmode" = prog; then 607305a1a286Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 607405a1a286Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 607505a1a286Smrg else 607605a1a286Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 607705a1a286Smrg test -n "$add" && deplibs="$add $deplibs" 607805a1a286Smrg if test "$hardcode_direct" != yes && 607905a1a286Smrg test "$hardcode_minus_L" != yes && 608005a1a286Smrg test "$hardcode_shlibpath_var" = yes; then 608105a1a286Smrg case :$finalize_shlibpath: in 608205a1a286Smrg *":$libdir:"*) ;; 608305a1a286Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 608405a1a286Smrg esac 608505a1a286Smrg fi 608605a1a286Smrg fi 608705a1a286Smrg fi 608805a1a286Smrg 608905a1a286Smrg if test "$linkmode" = prog || test "$mode" = relink; then 609005a1a286Smrg add_shlibpath= 609105a1a286Smrg add_dir= 609205a1a286Smrg add= 609305a1a286Smrg # Finalize command for both is simple: just hardcode it. 609405a1a286Smrg if test "$hardcode_direct" = yes && 609505a1a286Smrg test "$hardcode_direct_absolute" = no; then 609605a1a286Smrg add="$libdir/$linklib" 609705a1a286Smrg elif test "$hardcode_minus_L" = yes; then 609805a1a286Smrg add_dir="-L$libdir" 609905a1a286Smrg add="-l$name" 610005a1a286Smrg elif test "$hardcode_shlibpath_var" = yes; then 610105a1a286Smrg case :$finalize_shlibpath: in 610205a1a286Smrg *":$libdir:"*) ;; 610305a1a286Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 610405a1a286Smrg esac 610505a1a286Smrg add="-l$name" 610605a1a286Smrg elif test "$hardcode_automatic" = yes; then 610705a1a286Smrg if test -n "$inst_prefix_dir" && 610805a1a286Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 610905a1a286Smrg add="$inst_prefix_dir$libdir/$linklib" 611005a1a286Smrg else 611105a1a286Smrg add="$libdir/$linklib" 611205a1a286Smrg fi 611305a1a286Smrg else 611405a1a286Smrg # We cannot seem to hardcode it, guess we'll fake it. 611505a1a286Smrg add_dir="-L$libdir" 611605a1a286Smrg # Try looking first in the location we're being installed to. 611705a1a286Smrg if test -n "$inst_prefix_dir"; then 611805a1a286Smrg case $libdir in 611905a1a286Smrg [\\/]*) 612005a1a286Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 612105a1a286Smrg ;; 612205a1a286Smrg esac 612305a1a286Smrg fi 612405a1a286Smrg add="-l$name" 612505a1a286Smrg fi 612605a1a286Smrg 612705a1a286Smrg if test "$linkmode" = prog; then 612805a1a286Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 612905a1a286Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 613005a1a286Smrg else 613105a1a286Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 613205a1a286Smrg test -n "$add" && deplibs="$add $deplibs" 613305a1a286Smrg fi 613405a1a286Smrg fi 613505a1a286Smrg elif test "$linkmode" = prog; then 613605a1a286Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 613705a1a286Smrg # is not unsupported. This is valid on all known static and 613805a1a286Smrg # shared platforms. 613905a1a286Smrg if test "$hardcode_direct" != unsupported; then 614005a1a286Smrg test -n "$old_library" && linklib="$old_library" 614105a1a286Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 614205a1a286Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 614305a1a286Smrg else 614405a1a286Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 614505a1a286Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 614605a1a286Smrg fi 614705a1a286Smrg elif test "$build_libtool_libs" = yes; then 614805a1a286Smrg # Not a shared library 614905a1a286Smrg if test "$deplibs_check_method" != pass_all; then 615005a1a286Smrg # We're trying link a shared library against a static one 615105a1a286Smrg # but the system doesn't support it. 615205a1a286Smrg 615305a1a286Smrg # Just print a warning and add the library to dependency_libs so 615405a1a286Smrg # that the program can be linked against the static library. 615505a1a286Smrg echo 615605a1a286Smrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 615705a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 615805a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 615905a1a286Smrg echo "*** shared version of the library, which you do not appear to have." 616005a1a286Smrg if test "$module" = yes; then 616105a1a286Smrg echo "*** But as you try to build a module library, libtool will still create " 616205a1a286Smrg echo "*** a static module, that should work as long as the dlopening application" 616305a1a286Smrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 616405a1a286Smrg if test -z "$global_symbol_pipe"; then 616505a1a286Smrg echo 616605a1a286Smrg echo "*** However, this would only work if libtool was able to extract symbol" 616705a1a286Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 616805a1a286Smrg echo "*** not find such a program. So, this module is probably useless." 616905a1a286Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 617005a1a286Smrg fi 617105a1a286Smrg if test "$build_old_libs" = no; then 617205a1a286Smrg build_libtool_libs=module 617305a1a286Smrg build_old_libs=yes 617405a1a286Smrg else 617505a1a286Smrg build_libtool_libs=no 617605a1a286Smrg fi 617705a1a286Smrg fi 617805a1a286Smrg else 617905a1a286Smrg deplibs="$dir/$old_library $deplibs" 618005a1a286Smrg link_static=yes 618105a1a286Smrg fi 618205a1a286Smrg fi # link shared/static library? 618305a1a286Smrg 618405a1a286Smrg if test "$linkmode" = lib; then 618505a1a286Smrg if test -n "$dependency_libs" && 618605a1a286Smrg { test "$hardcode_into_libs" != yes || 618705a1a286Smrg test "$build_old_libs" = yes || 618805a1a286Smrg test "$link_static" = yes; }; then 618905a1a286Smrg # Extract -R from dependency_libs 619005a1a286Smrg temp_deplibs= 619105a1a286Smrg for libdir in $dependency_libs; do 619205a1a286Smrg case $libdir in 619305a1a286Smrg -R*) func_stripname '-R' '' "$libdir" 619405a1a286Smrg temp_xrpath=$func_stripname_result 619505a1a286Smrg case " $xrpath " in 619605a1a286Smrg *" $temp_xrpath "*) ;; 619705a1a286Smrg *) xrpath="$xrpath $temp_xrpath";; 619805a1a286Smrg esac;; 619905a1a286Smrg *) temp_deplibs="$temp_deplibs $libdir";; 620005a1a286Smrg esac 620105a1a286Smrg done 620205a1a286Smrg dependency_libs="$temp_deplibs" 620305a1a286Smrg fi 620405a1a286Smrg 620505a1a286Smrg newlib_search_path="$newlib_search_path $absdir" 620605a1a286Smrg # Link against this library 620705a1a286Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 620805a1a286Smrg # ... and its dependency_libs 620905a1a286Smrg tmp_libs= 621005a1a286Smrg for deplib in $dependency_libs; do 621105a1a286Smrg newdependency_libs="$deplib $newdependency_libs" 621205a1a286Smrg if $opt_duplicate_deps ; then 621305a1a286Smrg case "$tmp_libs " in 621405a1a286Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 621505a1a286Smrg esac 621605a1a286Smrg fi 621705a1a286Smrg tmp_libs="$tmp_libs $deplib" 621805a1a286Smrg done 621905a1a286Smrg 622005a1a286Smrg if test "$link_all_deplibs" != no; then 622105a1a286Smrg # Add the search paths of all dependency libraries 622205a1a286Smrg for deplib in $dependency_libs; do 622305a1a286Smrg path= 622405a1a286Smrg case $deplib in 622505a1a286Smrg -L*) path="$deplib" ;; 622605a1a286Smrg *.la) 622705a1a286Smrg func_dirname "$deplib" "" "." 622805a1a286Smrg dir="$func_dirname_result" 622905a1a286Smrg # We need an absolute path. 623005a1a286Smrg case $dir in 623105a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 623205a1a286Smrg *) 623305a1a286Smrg absdir=`cd "$dir" && pwd` 623405a1a286Smrg if test -z "$absdir"; then 623505a1a286Smrg func_warning "cannot determine absolute directory name of \`$dir'" 623605a1a286Smrg absdir="$dir" 623705a1a286Smrg fi 623805a1a286Smrg ;; 623905a1a286Smrg esac 624005a1a286Smrg if $GREP "^installed=no" $deplib > /dev/null; then 624105a1a286Smrg case $host in 624205a1a286Smrg *-*-darwin*) 624305a1a286Smrg depdepl= 624405a1a286Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 624505a1a286Smrg if test -n "$deplibrary_names" ; then 624605a1a286Smrg for tmp in $deplibrary_names ; do 624705a1a286Smrg depdepl=$tmp 624805a1a286Smrg done 624905a1a286Smrg if test -f "$absdir/$objdir/$depdepl" ; then 625005a1a286Smrg depdepl="$absdir/$objdir/$depdepl" 625105a1a286Smrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625205a1a286Smrg if test -z "$darwin_install_name"; then 625305a1a286Smrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625405a1a286Smrg fi 625505a1a286Smrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 625605a1a286Smrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 625705a1a286Smrg path= 625805a1a286Smrg fi 625905a1a286Smrg fi 626005a1a286Smrg ;; 626105a1a286Smrg *) 626205a1a286Smrg path="-L$absdir/$objdir" 626305a1a286Smrg ;; 626405a1a286Smrg esac 626505a1a286Smrg else 626605a1a286Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 626705a1a286Smrg test -z "$libdir" && \ 626805a1a286Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 626905a1a286Smrg test "$absdir" != "$libdir" && \ 627005a1a286Smrg func_warning "\`$deplib' seems to be moved" 627105a1a286Smrg 627205a1a286Smrg path="-L$absdir" 627305a1a286Smrg fi 627405a1a286Smrg ;; 627505a1a286Smrg esac 627605a1a286Smrg case " $deplibs " in 627705a1a286Smrg *" $path "*) ;; 627805a1a286Smrg *) deplibs="$path $deplibs" ;; 627905a1a286Smrg esac 628005a1a286Smrg done 628105a1a286Smrg fi # link_all_deplibs != no 628205a1a286Smrg fi # linkmode = lib 628305a1a286Smrg done # for deplib in $libs 628405a1a286Smrg if test "$pass" = link; then 628505a1a286Smrg if test "$linkmode" = "prog"; then 628605a1a286Smrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 628705a1a286Smrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 628805a1a286Smrg else 628905a1a286Smrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 629005a1a286Smrg fi 629105a1a286Smrg fi 629205a1a286Smrg dependency_libs="$newdependency_libs" 629305a1a286Smrg if test "$pass" = dlpreopen; then 629405a1a286Smrg # Link the dlpreopened libraries before other libraries 629505a1a286Smrg for deplib in $save_deplibs; do 629605a1a286Smrg deplibs="$deplib $deplibs" 629705a1a286Smrg done 629805a1a286Smrg fi 629905a1a286Smrg if test "$pass" != dlopen; then 630005a1a286Smrg if test "$pass" != conv; then 630105a1a286Smrg # Make sure lib_search_path contains only unique directories. 630205a1a286Smrg lib_search_path= 630305a1a286Smrg for dir in $newlib_search_path; do 630405a1a286Smrg case "$lib_search_path " in 630505a1a286Smrg *" $dir "*) ;; 630605a1a286Smrg *) lib_search_path="$lib_search_path $dir" ;; 630705a1a286Smrg esac 630805a1a286Smrg done 630905a1a286Smrg newlib_search_path= 631005a1a286Smrg fi 631105a1a286Smrg 631205a1a286Smrg if test "$linkmode,$pass" != "prog,link"; then 631305a1a286Smrg vars="deplibs" 631405a1a286Smrg else 631505a1a286Smrg vars="compile_deplibs finalize_deplibs" 631605a1a286Smrg fi 631705a1a286Smrg for var in $vars dependency_libs; do 631805a1a286Smrg # Add libraries to $var in reverse order 631905a1a286Smrg eval tmp_libs=\"\$$var\" 632005a1a286Smrg new_libs= 632105a1a286Smrg for deplib in $tmp_libs; do 632205a1a286Smrg # FIXME: Pedantically, this is the right thing to do, so 632305a1a286Smrg # that some nasty dependency loop isn't accidentally 632405a1a286Smrg # broken: 632505a1a286Smrg #new_libs="$deplib $new_libs" 632605a1a286Smrg # Pragmatically, this seems to cause very few problems in 632705a1a286Smrg # practice: 632805a1a286Smrg case $deplib in 632905a1a286Smrg -L*) new_libs="$deplib $new_libs" ;; 633005a1a286Smrg -R*) ;; 633105a1a286Smrg *) 633205a1a286Smrg # And here is the reason: when a library appears more 633305a1a286Smrg # than once as an explicit dependence of a library, or 633405a1a286Smrg # is implicitly linked in more than once by the 633505a1a286Smrg # compiler, it is considered special, and multiple 633605a1a286Smrg # occurrences thereof are not removed. Compare this 633705a1a286Smrg # with having the same library being listed as a 633805a1a286Smrg # dependency of multiple other libraries: in this case, 633905a1a286Smrg # we know (pedantically, we assume) the library does not 634005a1a286Smrg # need to be listed more than once, so we keep only the 634105a1a286Smrg # last copy. This is not always right, but it is rare 634205a1a286Smrg # enough that we require users that really mean to play 634305a1a286Smrg # such unportable linking tricks to link the library 634405a1a286Smrg # using -Wl,-lname, so that libtool does not consider it 634505a1a286Smrg # for duplicate removal. 634605a1a286Smrg case " $specialdeplibs " in 634705a1a286Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 634805a1a286Smrg *) 634905a1a286Smrg case " $new_libs " in 635005a1a286Smrg *" $deplib "*) ;; 635105a1a286Smrg *) new_libs="$deplib $new_libs" ;; 635205a1a286Smrg esac 635305a1a286Smrg ;; 635405a1a286Smrg esac 635505a1a286Smrg ;; 635605a1a286Smrg esac 635705a1a286Smrg done 635805a1a286Smrg tmp_libs= 635905a1a286Smrg for deplib in $new_libs; do 636005a1a286Smrg case $deplib in 636105a1a286Smrg -L*) 636205a1a286Smrg case " $tmp_libs " in 636305a1a286Smrg *" $deplib "*) ;; 636405a1a286Smrg *) tmp_libs="$tmp_libs $deplib" ;; 636505a1a286Smrg esac 636605a1a286Smrg ;; 636705a1a286Smrg *) tmp_libs="$tmp_libs $deplib" ;; 636805a1a286Smrg esac 636905a1a286Smrg done 637005a1a286Smrg eval $var=\"$tmp_libs\" 637105a1a286Smrg done # for var 637205a1a286Smrg fi 637305a1a286Smrg # Last step: remove runtime libs from dependency_libs 637405a1a286Smrg # (they stay in deplibs) 637505a1a286Smrg tmp_libs= 637605a1a286Smrg for i in $dependency_libs ; do 637705a1a286Smrg case " $predeps $postdeps $compiler_lib_search_path " in 637805a1a286Smrg *" $i "*) 637905a1a286Smrg i="" 638005a1a286Smrg ;; 638105a1a286Smrg esac 638205a1a286Smrg if test -n "$i" ; then 638305a1a286Smrg tmp_libs="$tmp_libs $i" 638405a1a286Smrg fi 638505a1a286Smrg done 638605a1a286Smrg dependency_libs=$tmp_libs 638705a1a286Smrg done # for pass 638805a1a286Smrg if test "$linkmode" = prog; then 638905a1a286Smrg dlfiles="$newdlfiles" 639005a1a286Smrg fi 639105a1a286Smrg if test "$linkmode" = prog || test "$linkmode" = lib; then 639205a1a286Smrg dlprefiles="$newdlprefiles" 639305a1a286Smrg fi 639405a1a286Smrg 639505a1a286Smrg case $linkmode in 639605a1a286Smrg oldlib) 639705a1a286Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 639805a1a286Smrg func_warning "\`-dlopen' is ignored for archives" 639905a1a286Smrg fi 640005a1a286Smrg 640105a1a286Smrg case " $deplibs" in 640205a1a286Smrg *\ -l* | *\ -L*) 640305a1a286Smrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 640405a1a286Smrg esac 640505a1a286Smrg 640605a1a286Smrg test -n "$rpath" && \ 640705a1a286Smrg func_warning "\`-rpath' is ignored for archives" 640805a1a286Smrg 640905a1a286Smrg test -n "$xrpath" && \ 641005a1a286Smrg func_warning "\`-R' is ignored for archives" 641105a1a286Smrg 641205a1a286Smrg test -n "$vinfo" && \ 641305a1a286Smrg func_warning "\`-version-info/-version-number' is ignored for archives" 641405a1a286Smrg 641505a1a286Smrg test -n "$release" && \ 641605a1a286Smrg func_warning "\`-release' is ignored for archives" 641705a1a286Smrg 641805a1a286Smrg test -n "$export_symbols$export_symbols_regex" && \ 641905a1a286Smrg func_warning "\`-export-symbols' is ignored for archives" 642005a1a286Smrg 642105a1a286Smrg # Now set the variables for building old libraries. 642205a1a286Smrg build_libtool_libs=no 642305a1a286Smrg oldlibs="$output" 642405a1a286Smrg objs="$objs$old_deplibs" 642505a1a286Smrg ;; 642605a1a286Smrg 642705a1a286Smrg lib) 642805a1a286Smrg # Make sure we only generate libraries of the form `libNAME.la'. 642905a1a286Smrg case $outputname in 643005a1a286Smrg lib*) 643105a1a286Smrg func_stripname 'lib' '.la' "$outputname" 643205a1a286Smrg name=$func_stripname_result 643305a1a286Smrg eval shared_ext=\"$shrext_cmds\" 643405a1a286Smrg eval libname=\"$libname_spec\" 643505a1a286Smrg ;; 643605a1a286Smrg *) 643705a1a286Smrg test "$module" = no && \ 643805a1a286Smrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 643905a1a286Smrg 644005a1a286Smrg if test "$need_lib_prefix" != no; then 644105a1a286Smrg # Add the "lib" prefix for modules if required 644205a1a286Smrg func_stripname '' '.la' "$outputname" 644305a1a286Smrg name=$func_stripname_result 644405a1a286Smrg eval shared_ext=\"$shrext_cmds\" 644505a1a286Smrg eval libname=\"$libname_spec\" 644605a1a286Smrg else 644705a1a286Smrg func_stripname '' '.la' "$outputname" 644805a1a286Smrg libname=$func_stripname_result 644905a1a286Smrg fi 645005a1a286Smrg ;; 645105a1a286Smrg esac 645205a1a286Smrg 645305a1a286Smrg if test -n "$objs"; then 645405a1a286Smrg if test "$deplibs_check_method" != pass_all; then 645505a1a286Smrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 645605a1a286Smrg else 645705a1a286Smrg echo 645805a1a286Smrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 645905a1a286Smrg $ECHO "*** objects $objs is not portable!" 646005a1a286Smrg libobjs="$libobjs $objs" 646105a1a286Smrg fi 646205a1a286Smrg fi 646305a1a286Smrg 646405a1a286Smrg test "$dlself" != no && \ 646505a1a286Smrg func_warning "\`-dlopen self' is ignored for libtool libraries" 646605a1a286Smrg 646705a1a286Smrg set dummy $rpath 646805a1a286Smrg shift 646905a1a286Smrg test "$#" -gt 1 && \ 647005a1a286Smrg func_warning "ignoring multiple \`-rpath's for a libtool library" 647105a1a286Smrg 647205a1a286Smrg install_libdir="$1" 647305a1a286Smrg 647405a1a286Smrg oldlibs= 647505a1a286Smrg if test -z "$rpath"; then 647605a1a286Smrg if test "$build_libtool_libs" = yes; then 647705a1a286Smrg # Building a libtool convenience library. 647805a1a286Smrg # Some compilers have problems with a `.al' extension so 647905a1a286Smrg # convenience libraries should have the same extension an 648005a1a286Smrg # archive normally would. 648105a1a286Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 648205a1a286Smrg build_libtool_libs=convenience 648305a1a286Smrg build_old_libs=yes 648405a1a286Smrg fi 648505a1a286Smrg 648605a1a286Smrg test -n "$vinfo" && \ 648705a1a286Smrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 648805a1a286Smrg 648905a1a286Smrg test -n "$release" && \ 649005a1a286Smrg func_warning "\`-release' is ignored for convenience libraries" 649105a1a286Smrg else 649205a1a286Smrg 649305a1a286Smrg # Parse the version information argument. 649405a1a286Smrg save_ifs="$IFS"; IFS=':' 649505a1a286Smrg set dummy $vinfo 0 0 0 649605a1a286Smrg shift 649705a1a286Smrg IFS="$save_ifs" 649805a1a286Smrg 649905a1a286Smrg test -n "$7" && \ 650005a1a286Smrg func_fatal_help "too many parameters to \`-version-info'" 650105a1a286Smrg 650205a1a286Smrg # convert absolute version numbers to libtool ages 650305a1a286Smrg # this retains compatibility with .la files and attempts 650405a1a286Smrg # to make the code below a bit more comprehensible 650505a1a286Smrg 650605a1a286Smrg case $vinfo_number in 650705a1a286Smrg yes) 650805a1a286Smrg number_major="$1" 650905a1a286Smrg number_minor="$2" 651005a1a286Smrg number_revision="$3" 651105a1a286Smrg # 651205a1a286Smrg # There are really only two kinds -- those that 651305a1a286Smrg # use the current revision as the major version 651405a1a286Smrg # and those that subtract age and use age as 651505a1a286Smrg # a minor version. But, then there is irix 651605a1a286Smrg # which has an extra 1 added just for fun 651705a1a286Smrg # 651805a1a286Smrg case $version_type in 651905a1a286Smrg darwin|linux|osf|windows|none) 652005a1a286Smrg func_arith $number_major + $number_minor 652105a1a286Smrg current=$func_arith_result 652205a1a286Smrg age="$number_minor" 652305a1a286Smrg revision="$number_revision" 652405a1a286Smrg ;; 652505a1a286Smrg freebsd-aout|freebsd-elf|qnx|sunos) 652605a1a286Smrg current="$number_major" 652705a1a286Smrg revision="$number_minor" 652805a1a286Smrg age="0" 652905a1a286Smrg ;; 653005a1a286Smrg irix|nonstopux) 653105a1a286Smrg func_arith $number_major + $number_minor 653205a1a286Smrg current=$func_arith_result 653305a1a286Smrg age="$number_minor" 653405a1a286Smrg revision="$number_minor" 653505a1a286Smrg lt_irix_increment=no 653605a1a286Smrg ;; 653705a1a286Smrg esac 653805a1a286Smrg ;; 653905a1a286Smrg no) 654005a1a286Smrg current="$1" 654105a1a286Smrg revision="$2" 654205a1a286Smrg age="$3" 654305a1a286Smrg ;; 654405a1a286Smrg esac 654505a1a286Smrg 654605a1a286Smrg # Check that each of the things are valid numbers. 654705a1a286Smrg case $current in 654805a1a286Smrg 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]) ;; 654905a1a286Smrg *) 655005a1a286Smrg func_error "CURRENT \`$current' must be a nonnegative integer" 655105a1a286Smrg func_fatal_error "\`$vinfo' is not valid version information" 655205a1a286Smrg ;; 655305a1a286Smrg esac 655405a1a286Smrg 655505a1a286Smrg case $revision in 655605a1a286Smrg 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]) ;; 655705a1a286Smrg *) 655805a1a286Smrg func_error "REVISION \`$revision' must be a nonnegative integer" 655905a1a286Smrg func_fatal_error "\`$vinfo' is not valid version information" 656005a1a286Smrg ;; 656105a1a286Smrg esac 656205a1a286Smrg 656305a1a286Smrg case $age in 656405a1a286Smrg 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]) ;; 656505a1a286Smrg *) 656605a1a286Smrg func_error "AGE \`$age' must be a nonnegative integer" 656705a1a286Smrg func_fatal_error "\`$vinfo' is not valid version information" 656805a1a286Smrg ;; 656905a1a286Smrg esac 657005a1a286Smrg 657105a1a286Smrg if test "$age" -gt "$current"; then 657205a1a286Smrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 657305a1a286Smrg func_fatal_error "\`$vinfo' is not valid version information" 657405a1a286Smrg fi 657505a1a286Smrg 657605a1a286Smrg # Calculate the version variables. 657705a1a286Smrg major= 657805a1a286Smrg versuffix= 657905a1a286Smrg verstring= 658005a1a286Smrg case $version_type in 658105a1a286Smrg none) ;; 658205a1a286Smrg 658305a1a286Smrg darwin) 658405a1a286Smrg # Like Linux, but with the current version available in 658505a1a286Smrg # verstring for coding it into the library header 658605a1a286Smrg func_arith $current - $age 658705a1a286Smrg major=.$func_arith_result 658805a1a286Smrg versuffix="$major.$age.$revision" 658905a1a286Smrg # Darwin ld doesn't like 0 for these options... 659005a1a286Smrg func_arith $current + 1 659105a1a286Smrg minor_current=$func_arith_result 659205a1a286Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 659305a1a286Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 659405a1a286Smrg ;; 659505a1a286Smrg 659605a1a286Smrg freebsd-aout) 659705a1a286Smrg major=".$current" 659805a1a286Smrg versuffix=".$current.$revision"; 659905a1a286Smrg ;; 660005a1a286Smrg 660105a1a286Smrg freebsd-elf) 660205a1a286Smrg major=".$current" 660305a1a286Smrg versuffix=".$current" 660405a1a286Smrg ;; 660505a1a286Smrg 660605a1a286Smrg irix | nonstopux) 660705a1a286Smrg if test "X$lt_irix_increment" = "Xno"; then 660805a1a286Smrg func_arith $current - $age 660905a1a286Smrg else 661005a1a286Smrg func_arith $current - $age + 1 661105a1a286Smrg fi 661205a1a286Smrg major=$func_arith_result 661305a1a286Smrg 661405a1a286Smrg case $version_type in 661505a1a286Smrg nonstopux) verstring_prefix=nonstopux ;; 661605a1a286Smrg *) verstring_prefix=sgi ;; 661705a1a286Smrg esac 661805a1a286Smrg verstring="$verstring_prefix$major.$revision" 661905a1a286Smrg 662005a1a286Smrg # Add in all the interfaces that we are compatible with. 662105a1a286Smrg loop=$revision 662205a1a286Smrg while test "$loop" -ne 0; do 662305a1a286Smrg func_arith $revision - $loop 662405a1a286Smrg iface=$func_arith_result 662505a1a286Smrg func_arith $loop - 1 662605a1a286Smrg loop=$func_arith_result 662705a1a286Smrg verstring="$verstring_prefix$major.$iface:$verstring" 662805a1a286Smrg done 662905a1a286Smrg 663005a1a286Smrg # Before this point, $major must not contain `.'. 663105a1a286Smrg major=.$major 663205a1a286Smrg versuffix="$major.$revision" 663305a1a286Smrg ;; 663405a1a286Smrg 663505a1a286Smrg linux) 663605a1a286Smrg func_arith $current - $age 663705a1a286Smrg major=.$func_arith_result 663805a1a286Smrg versuffix="$major.$age.$revision" 663905a1a286Smrg ;; 664005a1a286Smrg 664105a1a286Smrg osf) 664205a1a286Smrg func_arith $current - $age 664305a1a286Smrg major=.$func_arith_result 664405a1a286Smrg versuffix=".$current.$age.$revision" 664505a1a286Smrg verstring="$current.$age.$revision" 664605a1a286Smrg 664705a1a286Smrg # Add in all the interfaces that we are compatible with. 664805a1a286Smrg loop=$age 664905a1a286Smrg while test "$loop" -ne 0; do 665005a1a286Smrg func_arith $current - $loop 665105a1a286Smrg iface=$func_arith_result 665205a1a286Smrg func_arith $loop - 1 665305a1a286Smrg loop=$func_arith_result 665405a1a286Smrg verstring="$verstring:${iface}.0" 665505a1a286Smrg done 665605a1a286Smrg 665705a1a286Smrg # Make executables depend on our current version. 665805a1a286Smrg verstring="$verstring:${current}.0" 665905a1a286Smrg ;; 666005a1a286Smrg 666105a1a286Smrg qnx) 666205a1a286Smrg major=".$current" 666305a1a286Smrg versuffix=".$current" 666405a1a286Smrg ;; 666505a1a286Smrg 666605a1a286Smrg sunos) 666705a1a286Smrg major=".$current" 666805a1a286Smrg versuffix=".$current.$revision" 666905a1a286Smrg ;; 667005a1a286Smrg 667105a1a286Smrg windows) 667205a1a286Smrg # Use '-' rather than '.', since we only want one 667305a1a286Smrg # extension on DOS 8.3 filesystems. 667405a1a286Smrg func_arith $current - $age 667505a1a286Smrg major=$func_arith_result 667605a1a286Smrg versuffix="-$major" 667705a1a286Smrg ;; 667805a1a286Smrg 667905a1a286Smrg *) 668005a1a286Smrg func_fatal_configuration "unknown library version type \`$version_type'" 668105a1a286Smrg ;; 668205a1a286Smrg esac 668305a1a286Smrg 668405a1a286Smrg # Clear the version info if we defaulted, and they specified a release. 668505a1a286Smrg if test -z "$vinfo" && test -n "$release"; then 668605a1a286Smrg major= 668705a1a286Smrg case $version_type in 668805a1a286Smrg darwin) 668905a1a286Smrg # we can't check for "0.0" in archive_cmds due to quoting 669005a1a286Smrg # problems, so we reset it completely 669105a1a286Smrg verstring= 669205a1a286Smrg ;; 669305a1a286Smrg *) 669405a1a286Smrg verstring="0.0" 669505a1a286Smrg ;; 669605a1a286Smrg esac 669705a1a286Smrg if test "$need_version" = no; then 669805a1a286Smrg versuffix= 669905a1a286Smrg else 670005a1a286Smrg versuffix=".0.0" 670105a1a286Smrg fi 670205a1a286Smrg fi 670305a1a286Smrg 670405a1a286Smrg # Remove version info from name if versioning should be avoided 670505a1a286Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 670605a1a286Smrg major= 670705a1a286Smrg versuffix= 670805a1a286Smrg verstring="" 670905a1a286Smrg fi 671005a1a286Smrg 671105a1a286Smrg # Check to see if the archive will have undefined symbols. 671205a1a286Smrg if test "$allow_undefined" = yes; then 671305a1a286Smrg if test "$allow_undefined_flag" = unsupported; then 671405a1a286Smrg func_warning "undefined symbols not allowed in $host shared libraries" 671505a1a286Smrg build_libtool_libs=no 671605a1a286Smrg build_old_libs=yes 671705a1a286Smrg fi 671805a1a286Smrg else 671905a1a286Smrg # Don't allow undefined symbols. 672005a1a286Smrg allow_undefined_flag="$no_undefined_flag" 672105a1a286Smrg fi 672205a1a286Smrg 672305a1a286Smrg fi 672405a1a286Smrg 672505a1a286Smrg func_generate_dlsyms "$libname" "$libname" "yes" 672605a1a286Smrg libobjs="$libobjs $symfileobj" 672705a1a286Smrg test "X$libobjs" = "X " && libobjs= 672805a1a286Smrg 672905a1a286Smrg if test "$mode" != relink; then 673005a1a286Smrg # Remove our outputs, but don't remove object files since they 673105a1a286Smrg # may have been created when compiling PIC objects. 673205a1a286Smrg removelist= 673305a1a286Smrg tempremovelist=`$ECHO "$output_objdir/*"` 673405a1a286Smrg for p in $tempremovelist; do 673505a1a286Smrg case $p in 673605a1a286Smrg *.$objext | *.gcno) 673705a1a286Smrg ;; 673805a1a286Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 673905a1a286Smrg if test "X$precious_files_regex" != "X"; then 674005a1a286Smrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 674105a1a286Smrg then 674205a1a286Smrg continue 674305a1a286Smrg fi 674405a1a286Smrg fi 674505a1a286Smrg removelist="$removelist $p" 674605a1a286Smrg ;; 674705a1a286Smrg *) ;; 674805a1a286Smrg esac 674905a1a286Smrg done 675005a1a286Smrg test -n "$removelist" && \ 675105a1a286Smrg func_show_eval "${RM}r \$removelist" 675205a1a286Smrg fi 675305a1a286Smrg 675405a1a286Smrg # Now set the variables for building old libraries. 675505a1a286Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 675605a1a286Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 675705a1a286Smrg 675805a1a286Smrg # Transform .lo files to .o files. 675905a1a286Smrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 676005a1a286Smrg fi 676105a1a286Smrg 676205a1a286Smrg # Eliminate all temporary directories. 676305a1a286Smrg #for path in $notinst_path; do 676405a1a286Smrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 676505a1a286Smrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 676605a1a286Smrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 676705a1a286Smrg #done 676805a1a286Smrg 676905a1a286Smrg if test -n "$xrpath"; then 677005a1a286Smrg # If the user specified any rpath flags, then add them. 677105a1a286Smrg temp_xrpath= 677205a1a286Smrg for libdir in $xrpath; do 677305a1a286Smrg temp_xrpath="$temp_xrpath -R$libdir" 677405a1a286Smrg case "$finalize_rpath " in 677505a1a286Smrg *" $libdir "*) ;; 677605a1a286Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 677705a1a286Smrg esac 677805a1a286Smrg done 677905a1a286Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 678005a1a286Smrg dependency_libs="$temp_xrpath $dependency_libs" 678105a1a286Smrg fi 678205a1a286Smrg fi 678305a1a286Smrg 678405a1a286Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 678505a1a286Smrg old_dlfiles="$dlfiles" 678605a1a286Smrg dlfiles= 678705a1a286Smrg for lib in $old_dlfiles; do 678805a1a286Smrg case " $dlprefiles $dlfiles " in 678905a1a286Smrg *" $lib "*) ;; 679005a1a286Smrg *) dlfiles="$dlfiles $lib" ;; 679105a1a286Smrg esac 679205a1a286Smrg done 679305a1a286Smrg 679405a1a286Smrg # Make sure dlprefiles contains only unique files 679505a1a286Smrg old_dlprefiles="$dlprefiles" 679605a1a286Smrg dlprefiles= 679705a1a286Smrg for lib in $old_dlprefiles; do 679805a1a286Smrg case "$dlprefiles " in 679905a1a286Smrg *" $lib "*) ;; 680005a1a286Smrg *) dlprefiles="$dlprefiles $lib" ;; 680105a1a286Smrg esac 680205a1a286Smrg done 680305a1a286Smrg 680405a1a286Smrg if test "$build_libtool_libs" = yes; then 680505a1a286Smrg if test -n "$rpath"; then 680605a1a286Smrg case $host in 680705a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 680805a1a286Smrg # these systems don't actually have a c library (as such)! 680905a1a286Smrg ;; 681005a1a286Smrg *-*-rhapsody* | *-*-darwin1.[012]) 681105a1a286Smrg # Rhapsody C library is in the System framework 681205a1a286Smrg deplibs="$deplibs System.ltframework" 681305a1a286Smrg ;; 681405a1a286Smrg *-*-netbsd*) 681505a1a286Smrg # Don't link with libc until the a.out ld.so is fixed. 681605a1a286Smrg ;; 681705a1a286Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 681805a1a286Smrg # Do not include libc due to us having libc/libc_r. 681905a1a286Smrg ;; 682005a1a286Smrg *-*-sco3.2v5* | *-*-sco5v6*) 682105a1a286Smrg # Causes problems with __ctype 682205a1a286Smrg ;; 682305a1a286Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 682405a1a286Smrg # Compiler inserts libc in the correct place for threads to work 682505a1a286Smrg ;; 682605a1a286Smrg *) 682705a1a286Smrg # Add libc to deplibs on all other systems if necessary. 682805a1a286Smrg if test "$build_libtool_need_lc" = "yes"; then 682905a1a286Smrg deplibs="$deplibs -lc" 683005a1a286Smrg fi 683105a1a286Smrg ;; 683205a1a286Smrg esac 683305a1a286Smrg fi 683405a1a286Smrg 683505a1a286Smrg # Transform deplibs into only deplibs that can be linked in shared. 683605a1a286Smrg name_save=$name 683705a1a286Smrg libname_save=$libname 683805a1a286Smrg release_save=$release 683905a1a286Smrg versuffix_save=$versuffix 684005a1a286Smrg major_save=$major 684105a1a286Smrg # I'm not sure if I'm treating the release correctly. I think 684205a1a286Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 684305a1a286Smrg # add it in twice. Is that correct? 684405a1a286Smrg release="" 684505a1a286Smrg versuffix="" 684605a1a286Smrg major="" 684705a1a286Smrg newdeplibs= 684805a1a286Smrg droppeddeps=no 684905a1a286Smrg case $deplibs_check_method in 685005a1a286Smrg pass_all) 685105a1a286Smrg # Don't check for shared/static. Everything works. 685205a1a286Smrg # This might be a little naive. We might want to check 685305a1a286Smrg # whether the library exists or not. But this is on 685405a1a286Smrg # osf3 & osf4 and I'm not really sure... Just 685505a1a286Smrg # implementing what was already the behavior. 685605a1a286Smrg newdeplibs=$deplibs 685705a1a286Smrg ;; 685805a1a286Smrg test_compile) 685905a1a286Smrg # This code stresses the "libraries are programs" paradigm to its 686005a1a286Smrg # limits. Maybe even breaks it. We compile a program, linking it 686105a1a286Smrg # against the deplibs as a proxy for the library. Then we can check 686205a1a286Smrg # whether they linked in statically or dynamically with ldd. 686305a1a286Smrg $opt_dry_run || $RM conftest.c 686405a1a286Smrg cat > conftest.c <<EOF 686505a1a286Smrg int main() { return 0; } 686605a1a286SmrgEOF 686705a1a286Smrg $opt_dry_run || $RM conftest 686805a1a286Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 686905a1a286Smrg ldd_output=`ldd conftest` 687005a1a286Smrg for i in $deplibs; do 687105a1a286Smrg case $i in 687205a1a286Smrg -l*) 687305a1a286Smrg func_stripname -l '' "$i" 687405a1a286Smrg name=$func_stripname_result 687505a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 687605a1a286Smrg case " $predeps $postdeps " in 687705a1a286Smrg *" $i "*) 687805a1a286Smrg newdeplibs="$newdeplibs $i" 687905a1a286Smrg i="" 688005a1a286Smrg ;; 688105a1a286Smrg esac 688205a1a286Smrg fi 688305a1a286Smrg if test -n "$i" ; then 688405a1a286Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 688505a1a286Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 688605a1a286Smrg set dummy $deplib_matches; shift 688705a1a286Smrg deplib_match=$1 688805a1a286Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 688905a1a286Smrg newdeplibs="$newdeplibs $i" 689005a1a286Smrg else 689105a1a286Smrg droppeddeps=yes 689205a1a286Smrg echo 689305a1a286Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 689405a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 689505a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 689605a1a286Smrg echo "*** shared version of the library, which I believe you do not have" 689705a1a286Smrg echo "*** because a test_compile did reveal that the linker did not use it for" 689805a1a286Smrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 689905a1a286Smrg fi 690005a1a286Smrg fi 690105a1a286Smrg ;; 690205a1a286Smrg *) 690305a1a286Smrg newdeplibs="$newdeplibs $i" 690405a1a286Smrg ;; 690505a1a286Smrg esac 690605a1a286Smrg done 690705a1a286Smrg else 690805a1a286Smrg # Error occurred in the first compile. Let's try to salvage 690905a1a286Smrg # the situation: Compile a separate program for each library. 691005a1a286Smrg for i in $deplibs; do 691105a1a286Smrg case $i in 691205a1a286Smrg -l*) 691305a1a286Smrg func_stripname -l '' "$i" 691405a1a286Smrg name=$func_stripname_result 691505a1a286Smrg $opt_dry_run || $RM conftest 691605a1a286Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 691705a1a286Smrg ldd_output=`ldd conftest` 691805a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 691905a1a286Smrg case " $predeps $postdeps " in 692005a1a286Smrg *" $i "*) 692105a1a286Smrg newdeplibs="$newdeplibs $i" 692205a1a286Smrg i="" 692305a1a286Smrg ;; 692405a1a286Smrg esac 692505a1a286Smrg fi 692605a1a286Smrg if test -n "$i" ; then 692705a1a286Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 692805a1a286Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 692905a1a286Smrg set dummy $deplib_matches; shift 693005a1a286Smrg deplib_match=$1 693105a1a286Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 693205a1a286Smrg newdeplibs="$newdeplibs $i" 693305a1a286Smrg else 693405a1a286Smrg droppeddeps=yes 693505a1a286Smrg echo 693605a1a286Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 693705a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 693805a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 693905a1a286Smrg echo "*** shared version of the library, which you do not appear to have" 694005a1a286Smrg echo "*** because a test_compile did reveal that the linker did not use this one" 694105a1a286Smrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 694205a1a286Smrg fi 694305a1a286Smrg fi 694405a1a286Smrg else 694505a1a286Smrg droppeddeps=yes 694605a1a286Smrg echo 694705a1a286Smrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 694805a1a286Smrg echo "*** make it link in! You will probably need to install it or some" 694905a1a286Smrg echo "*** library that it depends on before this library will be fully" 695005a1a286Smrg echo "*** functional. Installing it before continuing would be even better." 695105a1a286Smrg fi 695205a1a286Smrg ;; 695305a1a286Smrg *) 695405a1a286Smrg newdeplibs="$newdeplibs $i" 695505a1a286Smrg ;; 695605a1a286Smrg esac 695705a1a286Smrg done 695805a1a286Smrg fi 695905a1a286Smrg ;; 696005a1a286Smrg file_magic*) 696105a1a286Smrg set dummy $deplibs_check_method; shift 696205a1a286Smrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 696305a1a286Smrg for a_deplib in $deplibs; do 696405a1a286Smrg case $a_deplib in 696505a1a286Smrg -l*) 696605a1a286Smrg func_stripname -l '' "$a_deplib" 696705a1a286Smrg name=$func_stripname_result 696805a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 696905a1a286Smrg case " $predeps $postdeps " in 697005a1a286Smrg *" $a_deplib "*) 697105a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 697205a1a286Smrg a_deplib="" 697305a1a286Smrg ;; 697405a1a286Smrg esac 697505a1a286Smrg fi 697605a1a286Smrg if test -n "$a_deplib" ; then 697705a1a286Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 697805a1a286Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 697905a1a286Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 698005a1a286Smrg for potent_lib in $potential_libs; do 698105a1a286Smrg # Follow soft links. 698205a1a286Smrg if ls -lLd "$potent_lib" 2>/dev/null | 698305a1a286Smrg $GREP " -> " >/dev/null; then 698405a1a286Smrg continue 698505a1a286Smrg fi 698605a1a286Smrg # The statement above tries to avoid entering an 698705a1a286Smrg # endless loop below, in case of cyclic links. 698805a1a286Smrg # We might still enter an endless loop, since a link 698905a1a286Smrg # loop can be closed while we follow links, 699005a1a286Smrg # but so what? 699105a1a286Smrg potlib="$potent_lib" 699205a1a286Smrg while test -h "$potlib" 2>/dev/null; do 699305a1a286Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 699405a1a286Smrg case $potliblink in 699505a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 699605a1a286Smrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 699705a1a286Smrg esac 699805a1a286Smrg done 699905a1a286Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 700005a1a286Smrg $SED -e 10q | 700105a1a286Smrg $EGREP "$file_magic_regex" > /dev/null; then 700205a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 700305a1a286Smrg a_deplib="" 700405a1a286Smrg break 2 700505a1a286Smrg fi 700605a1a286Smrg done 700705a1a286Smrg done 700805a1a286Smrg fi 700905a1a286Smrg if test -n "$a_deplib" ; then 701005a1a286Smrg droppeddeps=yes 701105a1a286Smrg echo 701205a1a286Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 701305a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 701405a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 701505a1a286Smrg echo "*** shared version of the library, which you do not appear to have" 701605a1a286Smrg echo "*** because I did check the linker path looking for a file starting" 701705a1a286Smrg if test -z "$potlib" ; then 701805a1a286Smrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 701905a1a286Smrg else 702005a1a286Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 702105a1a286Smrg $ECHO "*** using a file magic. Last file checked: $potlib" 702205a1a286Smrg fi 702305a1a286Smrg fi 702405a1a286Smrg ;; 702505a1a286Smrg *) 702605a1a286Smrg # Add a -L argument. 702705a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 702805a1a286Smrg ;; 702905a1a286Smrg esac 703005a1a286Smrg done # Gone through all deplibs. 703105a1a286Smrg ;; 703205a1a286Smrg match_pattern*) 703305a1a286Smrg set dummy $deplibs_check_method; shift 703405a1a286Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 703505a1a286Smrg for a_deplib in $deplibs; do 703605a1a286Smrg case $a_deplib in 703705a1a286Smrg -l*) 703805a1a286Smrg func_stripname -l '' "$a_deplib" 703905a1a286Smrg name=$func_stripname_result 704005a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 704105a1a286Smrg case " $predeps $postdeps " in 704205a1a286Smrg *" $a_deplib "*) 704305a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 704405a1a286Smrg a_deplib="" 704505a1a286Smrg ;; 704605a1a286Smrg esac 704705a1a286Smrg fi 704805a1a286Smrg if test -n "$a_deplib" ; then 704905a1a286Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 705005a1a286Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 705105a1a286Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 705205a1a286Smrg for potent_lib in $potential_libs; do 705305a1a286Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 705405a1a286Smrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 705505a1a286Smrg $EGREP "$match_pattern_regex" > /dev/null; then 705605a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 705705a1a286Smrg a_deplib="" 705805a1a286Smrg break 2 705905a1a286Smrg fi 706005a1a286Smrg done 706105a1a286Smrg done 706205a1a286Smrg fi 706305a1a286Smrg if test -n "$a_deplib" ; then 706405a1a286Smrg droppeddeps=yes 706505a1a286Smrg echo 706605a1a286Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 706705a1a286Smrg echo "*** I have the capability to make that library automatically link in when" 706805a1a286Smrg echo "*** you link to this library. But I can only do this if you have a" 706905a1a286Smrg echo "*** shared version of the library, which you do not appear to have" 707005a1a286Smrg echo "*** because I did check the linker path looking for a file starting" 707105a1a286Smrg if test -z "$potlib" ; then 707205a1a286Smrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 707305a1a286Smrg else 707405a1a286Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 707505a1a286Smrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 707605a1a286Smrg fi 707705a1a286Smrg fi 707805a1a286Smrg ;; 707905a1a286Smrg *) 708005a1a286Smrg # Add a -L argument. 708105a1a286Smrg newdeplibs="$newdeplibs $a_deplib" 708205a1a286Smrg ;; 708305a1a286Smrg esac 708405a1a286Smrg done # Gone through all deplibs. 708505a1a286Smrg ;; 708605a1a286Smrg none | unknown | *) 708705a1a286Smrg newdeplibs="" 708805a1a286Smrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 708905a1a286Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 709005a1a286Smrg for i in $predeps $postdeps ; do 709105a1a286Smrg # can't use Xsed below, because $i might contain '/' 709205a1a286Smrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 709305a1a286Smrg done 709405a1a286Smrg fi 709505a1a286Smrg case $tmp_deplibs in 709605a1a286Smrg *[!\ \ ]*) 709705a1a286Smrg echo 709805a1a286Smrg if test "X$deplibs_check_method" = "Xnone"; then 709905a1a286Smrg echo "*** Warning: inter-library dependencies are not supported in this platform." 710005a1a286Smrg else 710105a1a286Smrg echo "*** Warning: inter-library dependencies are not known to be supported." 710205a1a286Smrg fi 710305a1a286Smrg echo "*** All declared inter-library dependencies are being dropped." 710405a1a286Smrg droppeddeps=yes 710505a1a286Smrg ;; 710605a1a286Smrg esac 710705a1a286Smrg ;; 710805a1a286Smrg esac 710905a1a286Smrg versuffix=$versuffix_save 711005a1a286Smrg major=$major_save 711105a1a286Smrg release=$release_save 711205a1a286Smrg libname=$libname_save 711305a1a286Smrg name=$name_save 711405a1a286Smrg 711505a1a286Smrg case $host in 711605a1a286Smrg *-*-rhapsody* | *-*-darwin1.[012]) 711705a1a286Smrg # On Rhapsody replace the C library with the System framework 711805a1a286Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 711905a1a286Smrg ;; 712005a1a286Smrg esac 712105a1a286Smrg 712205a1a286Smrg if test "$droppeddeps" = yes; then 712305a1a286Smrg if test "$module" = yes; then 712405a1a286Smrg echo 712505a1a286Smrg echo "*** Warning: libtool could not satisfy all declared inter-library" 712605a1a286Smrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 712705a1a286Smrg echo "*** a static module, that should work as long as the dlopening" 712805a1a286Smrg echo "*** application is linked with the -dlopen flag." 712905a1a286Smrg if test -z "$global_symbol_pipe"; then 713005a1a286Smrg echo 713105a1a286Smrg echo "*** However, this would only work if libtool was able to extract symbol" 713205a1a286Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 713305a1a286Smrg echo "*** not find such a program. So, this module is probably useless." 713405a1a286Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 713505a1a286Smrg fi 713605a1a286Smrg if test "$build_old_libs" = no; then 713705a1a286Smrg oldlibs="$output_objdir/$libname.$libext" 713805a1a286Smrg build_libtool_libs=module 713905a1a286Smrg build_old_libs=yes 714005a1a286Smrg else 714105a1a286Smrg build_libtool_libs=no 714205a1a286Smrg fi 714305a1a286Smrg else 714405a1a286Smrg echo "*** The inter-library dependencies that have been dropped here will be" 714505a1a286Smrg echo "*** automatically added whenever a program is linked with this library" 714605a1a286Smrg echo "*** or is declared to -dlopen it." 7147d9c7fc6cSmrg 714805a1a286Smrg if test "$allow_undefined" = no; then 714905a1a286Smrg echo 715005a1a286Smrg echo "*** Since this library must not contain undefined symbols," 715105a1a286Smrg echo "*** because either the platform does not support them or" 715205a1a286Smrg echo "*** it was explicitly requested with -no-undefined," 715305a1a286Smrg echo "*** libtool will only create a static version of it." 715405a1a286Smrg if test "$build_old_libs" = no; then 715505a1a286Smrg oldlibs="$output_objdir/$libname.$libext" 715605a1a286Smrg build_libtool_libs=module 715705a1a286Smrg build_old_libs=yes 715805a1a286Smrg else 715905a1a286Smrg build_libtool_libs=no 716005a1a286Smrg fi 716105a1a286Smrg fi 716205a1a286Smrg fi 716305a1a286Smrg fi 716405a1a286Smrg # Done checking deplibs! 716505a1a286Smrg deplibs=$newdeplibs 716605a1a286Smrg fi 716705a1a286Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 716805a1a286Smrg case $host in 716905a1a286Smrg *-*-darwin*) 717005a1a286Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717105a1a286Smrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717205a1a286Smrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7173d9c7fc6cSmrg ;; 717405a1a286Smrg esac 7175d9c7fc6cSmrg 717605a1a286Smrg # move library search paths that coincide with paths to not yet 717705a1a286Smrg # installed libraries to the beginning of the library search list 717805a1a286Smrg new_libs= 717905a1a286Smrg for path in $notinst_path; do 718005a1a286Smrg case " $new_libs " in 718105a1a286Smrg *" -L$path/$objdir "*) ;; 7182d9c7fc6cSmrg *) 718305a1a286Smrg case " $deplibs " in 718405a1a286Smrg *" -L$path/$objdir "*) 718505a1a286Smrg new_libs="$new_libs -L$path/$objdir" ;; 718605a1a286Smrg esac 7187d9c7fc6cSmrg ;; 7188d9c7fc6cSmrg esac 718905a1a286Smrg done 719005a1a286Smrg for deplib in $deplibs; do 719105a1a286Smrg case $deplib in 719205a1a286Smrg -L*) 719305a1a286Smrg case " $new_libs " in 719405a1a286Smrg *" $deplib "*) ;; 719505a1a286Smrg *) new_libs="$new_libs $deplib" ;; 719605a1a286Smrg esac 719705a1a286Smrg ;; 719805a1a286Smrg *) new_libs="$new_libs $deplib" ;; 719905a1a286Smrg esac 720005a1a286Smrg done 720105a1a286Smrg deplibs="$new_libs" 7202d9c7fc6cSmrg 720305a1a286Smrg # All the library-specific variables (install_libdir is set above). 720405a1a286Smrg library_names= 720505a1a286Smrg old_library= 720605a1a286Smrg dlname= 7207d9c7fc6cSmrg 720805a1a286Smrg # Test again, we may have decided not to build it any more 720905a1a286Smrg if test "$build_libtool_libs" = yes; then 721005a1a286Smrg if test "$hardcode_into_libs" = yes; then 721105a1a286Smrg # Hardcode the library paths 721205a1a286Smrg hardcode_libdirs= 721305a1a286Smrg dep_rpath= 721405a1a286Smrg rpath="$finalize_rpath" 721505a1a286Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 721605a1a286Smrg for libdir in $rpath; do 721705a1a286Smrg if test -n "$hardcode_libdir_flag_spec"; then 721805a1a286Smrg if test -n "$hardcode_libdir_separator"; then 721905a1a286Smrg if test -z "$hardcode_libdirs"; then 722005a1a286Smrg hardcode_libdirs="$libdir" 722105a1a286Smrg else 722205a1a286Smrg # Just accumulate the unique libdirs. 722305a1a286Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 722405a1a286Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 722505a1a286Smrg ;; 722605a1a286Smrg *) 722705a1a286Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 722805a1a286Smrg ;; 722905a1a286Smrg esac 723005a1a286Smrg fi 723105a1a286Smrg else 723205a1a286Smrg eval flag=\"$hardcode_libdir_flag_spec\" 723305a1a286Smrg dep_rpath="$dep_rpath $flag" 723405a1a286Smrg fi 723505a1a286Smrg elif test -n "$runpath_var"; then 723605a1a286Smrg case "$perm_rpath " in 723705a1a286Smrg *" $libdir "*) ;; 723805a1a286Smrg *) perm_rpath="$perm_rpath $libdir" ;; 723905a1a286Smrg esac 724005a1a286Smrg fi 724105a1a286Smrg done 724205a1a286Smrg # Substitute the hardcoded libdirs into the rpath. 724305a1a286Smrg if test -n "$hardcode_libdir_separator" && 724405a1a286Smrg test -n "$hardcode_libdirs"; then 724505a1a286Smrg libdir="$hardcode_libdirs" 724605a1a286Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 724705a1a286Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 724805a1a286Smrg else 724905a1a286Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 725005a1a286Smrg fi 725105a1a286Smrg fi 725205a1a286Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 725305a1a286Smrg # We should set the runpath_var. 725405a1a286Smrg rpath= 725505a1a286Smrg for dir in $perm_rpath; do 725605a1a286Smrg rpath="$rpath$dir:" 725705a1a286Smrg done 725805a1a286Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 725905a1a286Smrg fi 726005a1a286Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 7261d9c7fc6cSmrg fi 7262d9c7fc6cSmrg 726305a1a286Smrg shlibpath="$finalize_shlibpath" 726405a1a286Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 726505a1a286Smrg if test -n "$shlibpath"; then 726605a1a286Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 726705a1a286Smrg fi 7268d9c7fc6cSmrg 726905a1a286Smrg # Get the real and link names of the library. 727005a1a286Smrg eval shared_ext=\"$shrext_cmds\" 727105a1a286Smrg eval library_names=\"$library_names_spec\" 727205a1a286Smrg set dummy $library_names 727305a1a286Smrg shift 727405a1a286Smrg realname="$1" 727505a1a286Smrg shift 7276d9c7fc6cSmrg 727705a1a286Smrg if test -n "$soname_spec"; then 727805a1a286Smrg eval soname=\"$soname_spec\" 7279d9c7fc6cSmrg else 728005a1a286Smrg soname="$realname" 728105a1a286Smrg fi 728205a1a286Smrg if test -z "$dlname"; then 728305a1a286Smrg dlname=$soname 728405a1a286Smrg fi 7285d9c7fc6cSmrg 728605a1a286Smrg lib="$output_objdir/$realname" 728705a1a286Smrg linknames= 728805a1a286Smrg for link 728905a1a286Smrg do 729005a1a286Smrg linknames="$linknames $link" 729105a1a286Smrg done 729205a1a286Smrg 729305a1a286Smrg # Use standard objects if they are pic 729405a1a286Smrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 729505a1a286Smrg test "X$libobjs" = "X " && libobjs= 729605a1a286Smrg 729705a1a286Smrg delfiles= 729805a1a286Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 729905a1a286Smrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 730005a1a286Smrg export_symbols="$output_objdir/$libname.uexp" 730105a1a286Smrg delfiles="$delfiles $export_symbols" 730205a1a286Smrg fi 7303d9c7fc6cSmrg 730405a1a286Smrg orig_export_symbols= 730505a1a286Smrg case $host_os in 730605a1a286Smrg cygwin* | mingw* | cegcc*) 730705a1a286Smrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 730805a1a286Smrg # exporting using user supplied symfile 730905a1a286Smrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 731005a1a286Smrg # and it's NOT already a .def file. Must figure out 731105a1a286Smrg # which of the given symbols are data symbols and tag 731205a1a286Smrg # them as such. So, trigger use of export_symbols_cmds. 731305a1a286Smrg # export_symbols gets reassigned inside the "prepare 731405a1a286Smrg # the list of exported symbols" if statement, so the 731505a1a286Smrg # include_expsyms logic still works. 731605a1a286Smrg orig_export_symbols="$export_symbols" 731705a1a286Smrg export_symbols= 731805a1a286Smrg always_export_symbols=yes 7319d9c7fc6cSmrg fi 7320d9c7fc6cSmrg fi 732105a1a286Smrg ;; 732205a1a286Smrg esac 7323d9c7fc6cSmrg 732405a1a286Smrg # Prepare the list of exported symbols 732505a1a286Smrg if test -z "$export_symbols"; then 732605a1a286Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 732705a1a286Smrg func_verbose "generating symbol list for \`$libname.la'" 732805a1a286Smrg export_symbols="$output_objdir/$libname.exp" 732905a1a286Smrg $opt_dry_run || $RM $export_symbols 733005a1a286Smrg cmds=$export_symbols_cmds 733105a1a286Smrg save_ifs="$IFS"; IFS='~' 733205a1a286Smrg for cmd in $cmds; do 733305a1a286Smrg IFS="$save_ifs" 733405a1a286Smrg eval cmd=\"$cmd\" 733505a1a286Smrg func_len " $cmd" 733605a1a286Smrg len=$func_len_result 733705a1a286Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 733805a1a286Smrg func_show_eval "$cmd" 'exit $?' 733905a1a286Smrg skipped_export=false 734005a1a286Smrg else 734105a1a286Smrg # The command line is too long to execute in one step. 734205a1a286Smrg func_verbose "using reloadable object file for export list..." 734305a1a286Smrg skipped_export=: 734405a1a286Smrg # Break out early, otherwise skipped_export may be 734505a1a286Smrg # set to false by a later but shorter cmd. 734605a1a286Smrg break 734705a1a286Smrg fi 734805a1a286Smrg done 734905a1a286Smrg IFS="$save_ifs" 735005a1a286Smrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 735105a1a286Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 735205a1a286Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 735305a1a286Smrg fi 735405a1a286Smrg fi 7355d9c7fc6cSmrg fi 7356d9c7fc6cSmrg 735705a1a286Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 735805a1a286Smrg tmp_export_symbols="$export_symbols" 735905a1a286Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 736005a1a286Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 736105a1a286Smrg fi 7362d9c7fc6cSmrg 736305a1a286Smrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 736405a1a286Smrg # The given exports_symbols file has to be filtered, so filter it. 736505a1a286Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 736605a1a286Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 736705a1a286Smrg # 's' commands which not all seds can handle. GNU sed should be fine 736805a1a286Smrg # though. Also, the filter scales superlinearly with the number of 736905a1a286Smrg # global variables. join(1) would be nice here, but unfortunately 737005a1a286Smrg # isn't a blessed tool. 737105a1a286Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 737205a1a286Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 737305a1a286Smrg export_symbols=$output_objdir/$libname.def 737405a1a286Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 737505a1a286Smrg fi 7376d9c7fc6cSmrg 737705a1a286Smrg tmp_deplibs= 737805a1a286Smrg for test_deplib in $deplibs; do 737905a1a286Smrg case " $convenience " in 738005a1a286Smrg *" $test_deplib "*) ;; 738105a1a286Smrg *) 738205a1a286Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 738305a1a286Smrg ;; 738405a1a286Smrg esac 738505a1a286Smrg done 738605a1a286Smrg deplibs="$tmp_deplibs" 738705a1a286Smrg 738805a1a286Smrg if test -n "$convenience"; then 738905a1a286Smrg if test -n "$whole_archive_flag_spec" && 739005a1a286Smrg test "$compiler_needs_object" = yes && 739105a1a286Smrg test -z "$libobjs"; then 739205a1a286Smrg # extract the archives, so we have objects to list. 739305a1a286Smrg # TODO: could optimize this to just extract one archive. 739405a1a286Smrg whole_archive_flag_spec= 739505a1a286Smrg fi 739605a1a286Smrg if test -n "$whole_archive_flag_spec"; then 739705a1a286Smrg save_libobjs=$libobjs 739805a1a286Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 739905a1a286Smrg test "X$libobjs" = "X " && libobjs= 7400d9c7fc6cSmrg else 740105a1a286Smrg gentop="$output_objdir/${outputname}x" 740205a1a286Smrg generated="$generated $gentop" 740305a1a286Smrg 740405a1a286Smrg func_extract_archives $gentop $convenience 740505a1a286Smrg libobjs="$libobjs $func_extract_archives_result" 740605a1a286Smrg test "X$libobjs" = "X " && libobjs= 7407d9c7fc6cSmrg fi 7408d9c7fc6cSmrg fi 7409d9c7fc6cSmrg 741005a1a286Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 741105a1a286Smrg eval flag=\"$thread_safe_flag_spec\" 741205a1a286Smrg linker_flags="$linker_flags $flag" 741305a1a286Smrg fi 7414d9c7fc6cSmrg 741505a1a286Smrg # Make a backup of the uninstalled library when relinking 741605a1a286Smrg if test "$mode" = relink; then 741705a1a286Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 741805a1a286Smrg fi 7419d9c7fc6cSmrg 742005a1a286Smrg # Do each of the archive commands. 742105a1a286Smrg if test "$module" = yes && test -n "$module_cmds" ; then 742205a1a286Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 742305a1a286Smrg eval test_cmds=\"$module_expsym_cmds\" 742405a1a286Smrg cmds=$module_expsym_cmds 742505a1a286Smrg else 742605a1a286Smrg eval test_cmds=\"$module_cmds\" 742705a1a286Smrg cmds=$module_cmds 742805a1a286Smrg fi 7429d9c7fc6cSmrg else 743005a1a286Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 743105a1a286Smrg eval test_cmds=\"$archive_expsym_cmds\" 743205a1a286Smrg cmds=$archive_expsym_cmds 743305a1a286Smrg else 743405a1a286Smrg eval test_cmds=\"$archive_cmds\" 743505a1a286Smrg cmds=$archive_cmds 743605a1a286Smrg fi 7437d9c7fc6cSmrg fi 7438d9c7fc6cSmrg 743905a1a286Smrg if test "X$skipped_export" != "X:" && 744005a1a286Smrg func_len " $test_cmds" && 744105a1a286Smrg len=$func_len_result && 744205a1a286Smrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 744305a1a286Smrg : 744405a1a286Smrg else 744505a1a286Smrg # The command line is too long to link in one step, link piecewise 744605a1a286Smrg # or, if using GNU ld and skipped_export is not :, use a linker 744705a1a286Smrg # script. 7448d9c7fc6cSmrg 744905a1a286Smrg # Save the value of $output and $libobjs because we want to 745005a1a286Smrg # use them later. If we have whole_archive_flag_spec, we 745105a1a286Smrg # want to use save_libobjs as it was before 745205a1a286Smrg # whole_archive_flag_spec was expanded, because we can't 745305a1a286Smrg # assume the linker understands whole_archive_flag_spec. 745405a1a286Smrg # This may have to be revisited, in case too many 745505a1a286Smrg # convenience libraries get linked in and end up exceeding 745605a1a286Smrg # the spec. 745705a1a286Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 745805a1a286Smrg save_libobjs=$libobjs 745905a1a286Smrg fi 746005a1a286Smrg save_output=$output 746105a1a286Smrg func_basename "$output" 746205a1a286Smrg output_la=$func_basename_result 746305a1a286Smrg 746405a1a286Smrg # Clear the reloadable object creation command queue and 746505a1a286Smrg # initialize k to one. 746605a1a286Smrg test_cmds= 746705a1a286Smrg concat_cmds= 746805a1a286Smrg objlist= 746905a1a286Smrg last_robj= 747005a1a286Smrg k=1 747105a1a286Smrg 747205a1a286Smrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 747305a1a286Smrg output=${output_objdir}/${output_la}.lnkscript 747405a1a286Smrg func_verbose "creating GNU ld script: $output" 747505a1a286Smrg echo 'INPUT (' > $output 747605a1a286Smrg for obj in $save_libobjs 747705a1a286Smrg do 747805a1a286Smrg $ECHO "$obj" >> $output 747905a1a286Smrg done 748005a1a286Smrg echo ')' >> $output 748105a1a286Smrg delfiles="$delfiles $output" 748205a1a286Smrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 748305a1a286Smrg output=${output_objdir}/${output_la}.lnk 748405a1a286Smrg func_verbose "creating linker input file list: $output" 748505a1a286Smrg : > $output 748605a1a286Smrg set x $save_libobjs 748705a1a286Smrg shift 748805a1a286Smrg firstobj= 748905a1a286Smrg if test "$compiler_needs_object" = yes; then 749005a1a286Smrg firstobj="$1 " 749105a1a286Smrg shift 7492d9c7fc6cSmrg fi 749305a1a286Smrg for obj 749405a1a286Smrg do 749505a1a286Smrg $ECHO "$obj" >> $output 7496d9c7fc6cSmrg done 749705a1a286Smrg delfiles="$delfiles $output" 749805a1a286Smrg output=$firstobj\"$file_list_spec$output\" 749905a1a286Smrg else 750005a1a286Smrg if test -n "$save_libobjs"; then 750105a1a286Smrg func_verbose "creating reloadable object files..." 750205a1a286Smrg output=$output_objdir/$output_la-${k}.$objext 750305a1a286Smrg eval test_cmds=\"$reload_cmds\" 750405a1a286Smrg func_len " $test_cmds" 750505a1a286Smrg len0=$func_len_result 750605a1a286Smrg len=$len0 750705a1a286Smrg 750805a1a286Smrg # Loop over the list of objects to be linked. 750905a1a286Smrg for obj in $save_libobjs 751005a1a286Smrg do 751105a1a286Smrg func_len " $obj" 751205a1a286Smrg func_arith $len + $func_len_result 751305a1a286Smrg len=$func_arith_result 751405a1a286Smrg if test "X$objlist" = X || 751505a1a286Smrg test "$len" -lt "$max_cmd_len"; then 751605a1a286Smrg func_append objlist " $obj" 751705a1a286Smrg else 751805a1a286Smrg # The command $test_cmds is almost too long, add a 751905a1a286Smrg # command to the queue. 752005a1a286Smrg if test "$k" -eq 1 ; then 752105a1a286Smrg # The first file doesn't have a previous command to add. 752205a1a286Smrg reload_objs=$objlist 752305a1a286Smrg eval concat_cmds=\"$reload_cmds\" 752405a1a286Smrg else 752505a1a286Smrg # All subsequent reloadable object files will link in 752605a1a286Smrg # the last one created. 752705a1a286Smrg reload_objs="$objlist $last_robj" 752805a1a286Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 752905a1a286Smrg fi 753005a1a286Smrg last_robj=$output_objdir/$output_la-${k}.$objext 753105a1a286Smrg func_arith $k + 1 753205a1a286Smrg k=$func_arith_result 753305a1a286Smrg output=$output_objdir/$output_la-${k}.$objext 753405a1a286Smrg objlist=" $obj" 753505a1a286Smrg func_len " $last_robj" 753605a1a286Smrg func_arith $len0 + $func_len_result 753705a1a286Smrg len=$func_arith_result 753805a1a286Smrg fi 753905a1a286Smrg done 754005a1a286Smrg # Handle the remaining objects by creating one last 754105a1a286Smrg # reloadable object file. All subsequent reloadable object 754205a1a286Smrg # files will link in the last one created. 754305a1a286Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 754405a1a286Smrg reload_objs="$objlist $last_robj" 754505a1a286Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 754605a1a286Smrg if test -n "$last_robj"; then 754705a1a286Smrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 7548d9c7fc6cSmrg fi 754905a1a286Smrg delfiles="$delfiles $output" 755005a1a286Smrg 755105a1a286Smrg else 755205a1a286Smrg output= 755305a1a286Smrg fi 755405a1a286Smrg 755505a1a286Smrg if ${skipped_export-false}; then 755605a1a286Smrg func_verbose "generating symbol list for \`$libname.la'" 755705a1a286Smrg export_symbols="$output_objdir/$libname.exp" 755805a1a286Smrg $opt_dry_run || $RM $export_symbols 755905a1a286Smrg libobjs=$output 756005a1a286Smrg # Append the command to create the export file. 756105a1a286Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 756205a1a286Smrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 756305a1a286Smrg if test -n "$last_robj"; then 756405a1a286Smrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 7565d9c7fc6cSmrg fi 756605a1a286Smrg fi 756705a1a286Smrg 756805a1a286Smrg test -n "$save_libobjs" && 756905a1a286Smrg func_verbose "creating a temporary reloadable object file: $output" 757005a1a286Smrg 757105a1a286Smrg # Loop through the commands generated above and execute them. 757205a1a286Smrg save_ifs="$IFS"; IFS='~' 757305a1a286Smrg for cmd in $concat_cmds; do 757405a1a286Smrg IFS="$save_ifs" 757505a1a286Smrg $opt_silent || { 757605a1a286Smrg func_quote_for_expand "$cmd" 757705a1a286Smrg eval "func_echo $func_quote_for_expand_result" 757805a1a286Smrg } 757905a1a286Smrg $opt_dry_run || eval "$cmd" || { 758005a1a286Smrg lt_exit=$? 758105a1a286Smrg 758205a1a286Smrg # Restore the uninstalled library and exit 758305a1a286Smrg if test "$mode" = relink; then 758405a1a286Smrg ( cd "$output_objdir" && \ 758505a1a286Smrg $RM "${realname}T" && \ 758605a1a286Smrg $MV "${realname}U" "$realname" ) 758705a1a286Smrg fi 758805a1a286Smrg 758905a1a286Smrg exit $lt_exit 759005a1a286Smrg } 7591d9c7fc6cSmrg done 759205a1a286Smrg IFS="$save_ifs" 759305a1a286Smrg 759405a1a286Smrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 759505a1a286Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 759605a1a286Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 759705a1a286Smrg fi 7598d9c7fc6cSmrg fi 7599d9c7fc6cSmrg 760005a1a286Smrg if ${skipped_export-false}; then 760105a1a286Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 760205a1a286Smrg tmp_export_symbols="$export_symbols" 760305a1a286Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 760405a1a286Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 760505a1a286Smrg fi 7606d9c7fc6cSmrg 760705a1a286Smrg if test -n "$orig_export_symbols"; then 760805a1a286Smrg # The given exports_symbols file has to be filtered, so filter it. 760905a1a286Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 761005a1a286Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 761105a1a286Smrg # 's' commands which not all seds can handle. GNU sed should be fine 761205a1a286Smrg # though. Also, the filter scales superlinearly with the number of 761305a1a286Smrg # global variables. join(1) would be nice here, but unfortunately 761405a1a286Smrg # isn't a blessed tool. 761505a1a286Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 761605a1a286Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 761705a1a286Smrg export_symbols=$output_objdir/$libname.def 761805a1a286Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 761905a1a286Smrg fi 762005a1a286Smrg fi 7621d9c7fc6cSmrg 762205a1a286Smrg libobjs=$output 762305a1a286Smrg # Restore the value of output. 762405a1a286Smrg output=$save_output 7625d9c7fc6cSmrg 762605a1a286Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 762705a1a286Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 762805a1a286Smrg test "X$libobjs" = "X " && libobjs= 762905a1a286Smrg fi 763005a1a286Smrg # Expand the library linking commands again to reset the 763105a1a286Smrg # value of $libobjs for piecewise linking. 7632d9c7fc6cSmrg 763305a1a286Smrg # Do each of the archive commands. 763405a1a286Smrg if test "$module" = yes && test -n "$module_cmds" ; then 763505a1a286Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 763605a1a286Smrg cmds=$module_expsym_cmds 763705a1a286Smrg else 763805a1a286Smrg cmds=$module_cmds 763905a1a286Smrg fi 764005a1a286Smrg else 764105a1a286Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 764205a1a286Smrg cmds=$archive_expsym_cmds 764305a1a286Smrg else 764405a1a286Smrg cmds=$archive_cmds 764505a1a286Smrg fi 764605a1a286Smrg fi 764705a1a286Smrg fi 7648d9c7fc6cSmrg 764905a1a286Smrg if test -n "$delfiles"; then 765005a1a286Smrg # Append the command to remove temporary files to $cmds. 765105a1a286Smrg eval cmds=\"\$cmds~\$RM $delfiles\" 765205a1a286Smrg fi 7653d9c7fc6cSmrg 765405a1a286Smrg # Add any objects from preloaded convenience libraries 765505a1a286Smrg if test -n "$dlprefiles"; then 765605a1a286Smrg gentop="$output_objdir/${outputname}x" 765705a1a286Smrg generated="$generated $gentop" 7658d9c7fc6cSmrg 765905a1a286Smrg func_extract_archives $gentop $dlprefiles 766005a1a286Smrg libobjs="$libobjs $func_extract_archives_result" 766105a1a286Smrg test "X$libobjs" = "X " && libobjs= 766205a1a286Smrg fi 7663d9c7fc6cSmrg 766405a1a286Smrg save_ifs="$IFS"; IFS='~' 766505a1a286Smrg for cmd in $cmds; do 766605a1a286Smrg IFS="$save_ifs" 766705a1a286Smrg eval cmd=\"$cmd\" 766805a1a286Smrg $opt_silent || { 766905a1a286Smrg func_quote_for_expand "$cmd" 767005a1a286Smrg eval "func_echo $func_quote_for_expand_result" 767105a1a286Smrg } 767205a1a286Smrg $opt_dry_run || eval "$cmd" || { 767305a1a286Smrg lt_exit=$? 767405a1a286Smrg 767505a1a286Smrg # Restore the uninstalled library and exit 767605a1a286Smrg if test "$mode" = relink; then 767705a1a286Smrg ( cd "$output_objdir" && \ 767805a1a286Smrg $RM "${realname}T" && \ 767905a1a286Smrg $MV "${realname}U" "$realname" ) 768005a1a286Smrg fi 768105a1a286Smrg 768205a1a286Smrg exit $lt_exit 768305a1a286Smrg } 7684d9c7fc6cSmrg done 768505a1a286Smrg IFS="$save_ifs" 7686d9c7fc6cSmrg 768705a1a286Smrg # Restore the uninstalled library and exit 768805a1a286Smrg if test "$mode" = relink; then 768905a1a286Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7690d9c7fc6cSmrg 769105a1a286Smrg if test -n "$convenience"; then 769205a1a286Smrg if test -z "$whole_archive_flag_spec"; then 769305a1a286Smrg func_show_eval '${RM}r "$gentop"' 769405a1a286Smrg fi 769505a1a286Smrg fi 7696d9c7fc6cSmrg 769705a1a286Smrg exit $EXIT_SUCCESS 769805a1a286Smrg fi 769905a1a286Smrg 770005a1a286Smrg # Create links to the real library. 770105a1a286Smrg for linkname in $linknames; do 770205a1a286Smrg if test "$realname" != "$linkname"; then 770305a1a286Smrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 770405a1a286Smrg fi 770505a1a286Smrg done 7706d9c7fc6cSmrg 770705a1a286Smrg # If -module or -export-dynamic was specified, set the dlname. 770805a1a286Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 770905a1a286Smrg # On all known operating systems, these are identical. 771005a1a286Smrg dlname="$soname" 771105a1a286Smrg fi 771205a1a286Smrg fi 7713d9c7fc6cSmrg ;; 7714d9c7fc6cSmrg 771505a1a286Smrg obj) 771605a1a286Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 771705a1a286Smrg func_warning "\`-dlopen' is ignored for objects" 7718d9c7fc6cSmrg fi 7719d9c7fc6cSmrg 772005a1a286Smrg case " $deplibs" in 772105a1a286Smrg *\ -l* | *\ -L*) 772205a1a286Smrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 772305a1a286Smrg esac 772405a1a286Smrg 772505a1a286Smrg test -n "$rpath" && \ 772605a1a286Smrg func_warning "\`-rpath' is ignored for objects" 772705a1a286Smrg 772805a1a286Smrg test -n "$xrpath" && \ 772905a1a286Smrg func_warning "\`-R' is ignored for objects" 773005a1a286Smrg 773105a1a286Smrg test -n "$vinfo" && \ 773205a1a286Smrg func_warning "\`-version-info' is ignored for objects" 773305a1a286Smrg 773405a1a286Smrg test -n "$release" && \ 773505a1a286Smrg func_warning "\`-release' is ignored for objects" 773605a1a286Smrg 773705a1a286Smrg case $output in 773805a1a286Smrg *.lo) 773905a1a286Smrg test -n "$objs$old_deplibs" && \ 774005a1a286Smrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 774105a1a286Smrg 774205a1a286Smrg libobj=$output 774305a1a286Smrg func_lo2o "$libobj" 774405a1a286Smrg obj=$func_lo2o_result 7745d9c7fc6cSmrg ;; 7746d9c7fc6cSmrg *) 774705a1a286Smrg libobj= 774805a1a286Smrg obj="$output" 7749d9c7fc6cSmrg ;; 7750d9c7fc6cSmrg esac 7751d9c7fc6cSmrg 775205a1a286Smrg # Delete the old objects. 775305a1a286Smrg $opt_dry_run || $RM $obj $libobj 7754d9c7fc6cSmrg 775505a1a286Smrg # Objects from convenience libraries. This assumes 775605a1a286Smrg # single-version convenience libraries. Whenever we create 775705a1a286Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 775805a1a286Smrg # the extraction. 775905a1a286Smrg reload_conv_objs= 776005a1a286Smrg gentop= 776105a1a286Smrg # reload_cmds runs $LD directly, so let us get rid of 776205a1a286Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 776305a1a286Smrg # turning comma into space.. 776405a1a286Smrg wl= 7765d9c7fc6cSmrg 776605a1a286Smrg if test -n "$convenience"; then 776705a1a286Smrg if test -n "$whole_archive_flag_spec"; then 776805a1a286Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 776905a1a286Smrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 777005a1a286Smrg else 777105a1a286Smrg gentop="$output_objdir/${obj}x" 777205a1a286Smrg generated="$generated $gentop" 7773d9c7fc6cSmrg 777405a1a286Smrg func_extract_archives $gentop $convenience 777505a1a286Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 777605a1a286Smrg fi 7777d9c7fc6cSmrg fi 7778d9c7fc6cSmrg 777905a1a286Smrg # Create the old-style object. 778005a1a286Smrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 7781d9c7fc6cSmrg 778205a1a286Smrg output="$obj" 778305a1a286Smrg func_execute_cmds "$reload_cmds" 'exit $?' 7784d9c7fc6cSmrg 778505a1a286Smrg # Exit if we aren't doing a library object file. 778605a1a286Smrg if test -z "$libobj"; then 778705a1a286Smrg if test -n "$gentop"; then 778805a1a286Smrg func_show_eval '${RM}r "$gentop"' 778905a1a286Smrg fi 779005a1a286Smrg 779105a1a286Smrg exit $EXIT_SUCCESS 7792d9c7fc6cSmrg fi 779305a1a286Smrg 779405a1a286Smrg if test "$build_libtool_libs" != yes; then 779505a1a286Smrg if test -n "$gentop"; then 779605a1a286Smrg func_show_eval '${RM}r "$gentop"' 779705a1a286Smrg fi 779805a1a286Smrg 779905a1a286Smrg # Create an invalid libtool object if no PIC, so that we don't 780005a1a286Smrg # accidentally link it into a program. 780105a1a286Smrg # $show "echo timestamp > $libobj" 780205a1a286Smrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 780305a1a286Smrg exit $EXIT_SUCCESS 780405a1a286Smrg fi 780505a1a286Smrg 780605a1a286Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 780705a1a286Smrg # Only do commands if we really have different PIC objects. 780805a1a286Smrg reload_objs="$libobjs $reload_conv_objs" 780905a1a286Smrg output="$libobj" 781005a1a286Smrg func_execute_cmds "$reload_cmds" 'exit $?' 781105a1a286Smrg fi 781205a1a286Smrg 781305a1a286Smrg if test -n "$gentop"; then 781405a1a286Smrg func_show_eval '${RM}r "$gentop"' 781505a1a286Smrg fi 781605a1a286Smrg 781705a1a286Smrg exit $EXIT_SUCCESS 7818d9c7fc6cSmrg ;; 7819d9c7fc6cSmrg 782005a1a286Smrg prog) 782105a1a286Smrg case $host in 782205a1a286Smrg *cygwin*) func_stripname '' '.exe' "$output" 782305a1a286Smrg output=$func_stripname_result.exe;; 782405a1a286Smrg esac 782505a1a286Smrg test -n "$vinfo" && \ 782605a1a286Smrg func_warning "\`-version-info' is ignored for programs" 7827d9c7fc6cSmrg 782805a1a286Smrg test -n "$release" && \ 782905a1a286Smrg func_warning "\`-release' is ignored for programs" 7830d9c7fc6cSmrg 783105a1a286Smrg test "$preload" = yes \ 783205a1a286Smrg && test "$dlopen_support" = unknown \ 783305a1a286Smrg && test "$dlopen_self" = unknown \ 783405a1a286Smrg && test "$dlopen_self_static" = unknown && \ 783505a1a286Smrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 783605a1a286Smrg 783705a1a286Smrg case $host in 783805a1a286Smrg *-*-rhapsody* | *-*-darwin1.[012]) 783905a1a286Smrg # On Rhapsody replace the C library is the System framework 784005a1a286Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 784105a1a286Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 7842d9c7fc6cSmrg ;; 784305a1a286Smrg esac 7844d9c7fc6cSmrg 784505a1a286Smrg case $host in 784605a1a286Smrg *-*-darwin*) 784705a1a286Smrg # Don't allow lazy linking, it breaks C++ global constructors 784805a1a286Smrg # But is supposedly fixed on 10.4 or later (yay!). 784905a1a286Smrg if test "$tagname" = CXX ; then 785005a1a286Smrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 785105a1a286Smrg 10.[0123]) 785205a1a286Smrg compile_command="$compile_command ${wl}-bind_at_load" 785305a1a286Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 785405a1a286Smrg ;; 785505a1a286Smrg esac 7856d9c7fc6cSmrg fi 785705a1a286Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 785805a1a286Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 785905a1a286Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 786005a1a286Smrg ;; 786105a1a286Smrg esac 7862d9c7fc6cSmrg 7863d9c7fc6cSmrg 786405a1a286Smrg # move library search paths that coincide with paths to not yet 786505a1a286Smrg # installed libraries to the beginning of the library search list 786605a1a286Smrg new_libs= 786705a1a286Smrg for path in $notinst_path; do 786805a1a286Smrg case " $new_libs " in 786905a1a286Smrg *" -L$path/$objdir "*) ;; 787005a1a286Smrg *) 787105a1a286Smrg case " $compile_deplibs " in 787205a1a286Smrg *" -L$path/$objdir "*) 787305a1a286Smrg new_libs="$new_libs -L$path/$objdir" ;; 7874d9c7fc6cSmrg esac 787505a1a286Smrg ;; 787605a1a286Smrg esac 787705a1a286Smrg done 787805a1a286Smrg for deplib in $compile_deplibs; do 787905a1a286Smrg case $deplib in 788005a1a286Smrg -L*) 788105a1a286Smrg case " $new_libs " in 788205a1a286Smrg *" $deplib "*) ;; 788305a1a286Smrg *) new_libs="$new_libs $deplib" ;; 7884d9c7fc6cSmrg esac 788505a1a286Smrg ;; 788605a1a286Smrg *) new_libs="$new_libs $deplib" ;; 788705a1a286Smrg esac 788805a1a286Smrg done 788905a1a286Smrg compile_deplibs="$new_libs" 7890d9c7fc6cSmrg 7891d9c7fc6cSmrg 789205a1a286Smrg compile_command="$compile_command $compile_deplibs" 789305a1a286Smrg finalize_command="$finalize_command $finalize_deplibs" 7894d9c7fc6cSmrg 789505a1a286Smrg if test -n "$rpath$xrpath"; then 789605a1a286Smrg # If the user specified any rpath flags, then add them. 789705a1a286Smrg for libdir in $rpath $xrpath; do 789805a1a286Smrg # This is the magic to use -rpath. 789905a1a286Smrg case "$finalize_rpath " in 790005a1a286Smrg *" $libdir "*) ;; 790105a1a286Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 790205a1a286Smrg esac 790305a1a286Smrg done 790405a1a286Smrg fi 7905d9c7fc6cSmrg 790605a1a286Smrg # Now hardcode the library paths 790705a1a286Smrg rpath= 790805a1a286Smrg hardcode_libdirs= 790905a1a286Smrg for libdir in $compile_rpath $finalize_rpath; do 791005a1a286Smrg if test -n "$hardcode_libdir_flag_spec"; then 791105a1a286Smrg if test -n "$hardcode_libdir_separator"; then 791205a1a286Smrg if test -z "$hardcode_libdirs"; then 791305a1a286Smrg hardcode_libdirs="$libdir" 791405a1a286Smrg else 791505a1a286Smrg # Just accumulate the unique libdirs. 791605a1a286Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 791705a1a286Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 791805a1a286Smrg ;; 791905a1a286Smrg *) 792005a1a286Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 792105a1a286Smrg ;; 792205a1a286Smrg esac 792305a1a286Smrg fi 7924d9c7fc6cSmrg else 792505a1a286Smrg eval flag=\"$hardcode_libdir_flag_spec\" 792605a1a286Smrg rpath="$rpath $flag" 7927d9c7fc6cSmrg fi 792805a1a286Smrg elif test -n "$runpath_var"; then 792905a1a286Smrg case "$perm_rpath " in 793005a1a286Smrg *" $libdir "*) ;; 793105a1a286Smrg *) perm_rpath="$perm_rpath $libdir" ;; 793205a1a286Smrg esac 793305a1a286Smrg fi 793405a1a286Smrg case $host in 793505a1a286Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 793605a1a286Smrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 793705a1a286Smrg case :$dllsearchpath: in 793805a1a286Smrg *":$libdir:"*) ;; 793905a1a286Smrg ::) dllsearchpath=$libdir;; 794005a1a286Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 794105a1a286Smrg esac 794205a1a286Smrg case :$dllsearchpath: in 794305a1a286Smrg *":$testbindir:"*) ;; 794405a1a286Smrg ::) dllsearchpath=$testbindir;; 794505a1a286Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 794605a1a286Smrg esac 794705a1a286Smrg ;; 794805a1a286Smrg esac 794905a1a286Smrg done 795005a1a286Smrg # Substitute the hardcoded libdirs into the rpath. 795105a1a286Smrg if test -n "$hardcode_libdir_separator" && 795205a1a286Smrg test -n "$hardcode_libdirs"; then 795305a1a286Smrg libdir="$hardcode_libdirs" 795405a1a286Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 795505a1a286Smrg fi 795605a1a286Smrg compile_rpath="$rpath" 7957d9c7fc6cSmrg 795805a1a286Smrg rpath= 795905a1a286Smrg hardcode_libdirs= 796005a1a286Smrg for libdir in $finalize_rpath; do 796105a1a286Smrg if test -n "$hardcode_libdir_flag_spec"; then 796205a1a286Smrg if test -n "$hardcode_libdir_separator"; then 796305a1a286Smrg if test -z "$hardcode_libdirs"; then 796405a1a286Smrg hardcode_libdirs="$libdir" 796505a1a286Smrg else 796605a1a286Smrg # Just accumulate the unique libdirs. 796705a1a286Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 796805a1a286Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 796905a1a286Smrg ;; 797005a1a286Smrg *) 797105a1a286Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 797205a1a286Smrg ;; 797305a1a286Smrg esac 797405a1a286Smrg fi 7975d9c7fc6cSmrg else 797605a1a286Smrg eval flag=\"$hardcode_libdir_flag_spec\" 797705a1a286Smrg rpath="$rpath $flag" 7978d9c7fc6cSmrg fi 797905a1a286Smrg elif test -n "$runpath_var"; then 798005a1a286Smrg case "$finalize_perm_rpath " in 798105a1a286Smrg *" $libdir "*) ;; 798205a1a286Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 798305a1a286Smrg esac 7984d9c7fc6cSmrg fi 798505a1a286Smrg done 798605a1a286Smrg # Substitute the hardcoded libdirs into the rpath. 798705a1a286Smrg if test -n "$hardcode_libdir_separator" && 798805a1a286Smrg test -n "$hardcode_libdirs"; then 798905a1a286Smrg libdir="$hardcode_libdirs" 799005a1a286Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 799105a1a286Smrg fi 799205a1a286Smrg finalize_rpath="$rpath" 7993d9c7fc6cSmrg 799405a1a286Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 799505a1a286Smrg # Transform all the library objects into standard objects. 799605a1a286Smrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 799705a1a286Smrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 799805a1a286Smrg fi 7999d9c7fc6cSmrg 800005a1a286Smrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8001d9c7fc6cSmrg 800205a1a286Smrg # template prelinking step 800305a1a286Smrg if test -n "$prelink_cmds"; then 800405a1a286Smrg func_execute_cmds "$prelink_cmds" 'exit $?' 800505a1a286Smrg fi 8006d9c7fc6cSmrg 800705a1a286Smrg wrappers_required=yes 800805a1a286Smrg case $host in 800905a1a286Smrg *cegcc* | *mingw32ce*) 801005a1a286Smrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 801105a1a286Smrg wrappers_required=no 801205a1a286Smrg ;; 801305a1a286Smrg *cygwin* | *mingw* ) 801405a1a286Smrg if test "$build_libtool_libs" != yes; then 801505a1a286Smrg wrappers_required=no 801605a1a286Smrg fi 801705a1a286Smrg ;; 801805a1a286Smrg *) 801905a1a286Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 802005a1a286Smrg wrappers_required=no 802105a1a286Smrg fi 802205a1a286Smrg ;; 802305a1a286Smrg esac 802405a1a286Smrg if test "$wrappers_required" = no; then 802505a1a286Smrg # Replace the output file specification. 802605a1a286Smrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 802705a1a286Smrg link_command="$compile_command$compile_rpath" 8028d9c7fc6cSmrg 802905a1a286Smrg # We have no uninstalled library dependencies, so finalize right now. 803005a1a286Smrg exit_status=0 803105a1a286Smrg func_show_eval "$link_command" 'exit_status=$?' 8032d9c7fc6cSmrg 803305a1a286Smrg # Delete the generated files. 803405a1a286Smrg if test -f "$output_objdir/${outputname}S.${objext}"; then 803505a1a286Smrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8036d9c7fc6cSmrg fi 8037d9c7fc6cSmrg 803805a1a286Smrg exit $exit_status 803905a1a286Smrg fi 8040d9c7fc6cSmrg 804105a1a286Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 804205a1a286Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 804305a1a286Smrg fi 804405a1a286Smrg if test -n "$finalize_shlibpath"; then 804505a1a286Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 804605a1a286Smrg fi 8047d9c7fc6cSmrg 804805a1a286Smrg compile_var= 804905a1a286Smrg finalize_var= 805005a1a286Smrg if test -n "$runpath_var"; then 805105a1a286Smrg if test -n "$perm_rpath"; then 805205a1a286Smrg # We should set the runpath_var. 805305a1a286Smrg rpath= 805405a1a286Smrg for dir in $perm_rpath; do 805505a1a286Smrg rpath="$rpath$dir:" 805605a1a286Smrg done 805705a1a286Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8058d9c7fc6cSmrg fi 805905a1a286Smrg if test -n "$finalize_perm_rpath"; then 806005a1a286Smrg # We should set the runpath_var. 806105a1a286Smrg rpath= 806205a1a286Smrg for dir in $finalize_perm_rpath; do 806305a1a286Smrg rpath="$rpath$dir:" 806405a1a286Smrg done 806505a1a286Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8066d9c7fc6cSmrg fi 806705a1a286Smrg fi 8068d9c7fc6cSmrg 806905a1a286Smrg if test "$no_install" = yes; then 807005a1a286Smrg # We don't need to create a wrapper script. 807105a1a286Smrg link_command="$compile_var$compile_command$compile_rpath" 807205a1a286Smrg # Replace the output file specification. 807305a1a286Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 807405a1a286Smrg # Delete the old output file. 807505a1a286Smrg $opt_dry_run || $RM $output 807605a1a286Smrg # Link the executable and exit 807705a1a286Smrg func_show_eval "$link_command" 'exit $?' 8078d9c7fc6cSmrg exit $EXIT_SUCCESS 807905a1a286Smrg fi 8080d9c7fc6cSmrg 808105a1a286Smrg if test "$hardcode_action" = relink; then 808205a1a286Smrg # Fast installation is not supported 808305a1a286Smrg link_command="$compile_var$compile_command$compile_rpath" 808405a1a286Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 808505a1a286Smrg 808605a1a286Smrg func_warning "this platform does not like uninstalled shared libraries" 808705a1a286Smrg func_warning "\`$output' will be relinked during installation" 808805a1a286Smrg else 808905a1a286Smrg if test "$fast_install" != no; then 809005a1a286Smrg link_command="$finalize_var$compile_command$finalize_rpath" 809105a1a286Smrg if test "$fast_install" = yes; then 809205a1a286Smrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 809305a1a286Smrg else 809405a1a286Smrg # fast_install is set to needless 809505a1a286Smrg relink_command= 809605a1a286Smrg fi 8097d9c7fc6cSmrg else 809805a1a286Smrg link_command="$compile_var$compile_command$compile_rpath" 809905a1a286Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8100d9c7fc6cSmrg fi 810105a1a286Smrg fi 8102d9c7fc6cSmrg 810305a1a286Smrg # Replace the output file specification. 810405a1a286Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8105d9c7fc6cSmrg 810605a1a286Smrg # Delete the old output files. 810705a1a286Smrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8108d9c7fc6cSmrg 810905a1a286Smrg func_show_eval "$link_command" 'exit $?' 8110d9c7fc6cSmrg 811105a1a286Smrg # Now create the wrapper script. 811205a1a286Smrg func_verbose "creating $output" 8113d9c7fc6cSmrg 811405a1a286Smrg # Quote the relink command for shipping. 811505a1a286Smrg if test -n "$relink_command"; then 811605a1a286Smrg # Preserve any variables that may affect compiler behavior 811705a1a286Smrg for var in $variables_saved_for_relink; do 811805a1a286Smrg if eval test -z \"\${$var+set}\"; then 811905a1a286Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 812005a1a286Smrg elif eval var_value=\$$var; test -z "$var_value"; then 812105a1a286Smrg relink_command="$var=; export $var; $relink_command" 8122d9c7fc6cSmrg else 812305a1a286Smrg func_quote_for_eval "$var_value" 812405a1a286Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8125d9c7fc6cSmrg fi 812605a1a286Smrg done 812705a1a286Smrg relink_command="(cd `pwd`; $relink_command)" 812805a1a286Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 812905a1a286Smrg fi 813005a1a286Smrg 813105a1a286Smrg # Only actually do things if not in dry run mode. 813205a1a286Smrg $opt_dry_run || { 813305a1a286Smrg # win32 will think the script is a binary if it has 813405a1a286Smrg # a .exe suffix, so we strip it off here. 813505a1a286Smrg case $output in 813605a1a286Smrg *.exe) func_stripname '' '.exe' "$output" 813705a1a286Smrg output=$func_stripname_result ;; 8138d9c7fc6cSmrg esac 813905a1a286Smrg # test for cygwin because mv fails w/o .exe extensions 814005a1a286Smrg case $host in 814105a1a286Smrg *cygwin*) 814205a1a286Smrg exeext=.exe 814305a1a286Smrg func_stripname '' '.exe' "$outputname" 814405a1a286Smrg outputname=$func_stripname_result ;; 814505a1a286Smrg *) exeext= ;; 814605a1a286Smrg esac 814705a1a286Smrg case $host in 814805a1a286Smrg *cygwin* | *mingw* ) 814905a1a286Smrg func_dirname_and_basename "$output" "" "." 815005a1a286Smrg output_name=$func_basename_result 815105a1a286Smrg output_path=$func_dirname_result 815205a1a286Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 815305a1a286Smrg cwrapper="$output_path/$output_name.exe" 815405a1a286Smrg $RM $cwrappersource $cwrapper 815505a1a286Smrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 815605a1a286Smrg 815705a1a286Smrg func_emit_cwrapperexe_src > $cwrappersource 815805a1a286Smrg 815905a1a286Smrg # The wrapper executable is built using the $host compiler, 816005a1a286Smrg # because it contains $host paths and files. If cross- 816105a1a286Smrg # compiling, it, like the target executable, must be 816205a1a286Smrg # executed on the $host or under an emulation environment. 816305a1a286Smrg $opt_dry_run || { 816405a1a286Smrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 816505a1a286Smrg $STRIP $cwrapper 816605a1a286Smrg } 8167d9c7fc6cSmrg 816805a1a286Smrg # Now, create the wrapper script for func_source use: 816905a1a286Smrg func_ltwrapper_scriptname $cwrapper 817005a1a286Smrg $RM $func_ltwrapper_scriptname_result 817105a1a286Smrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 817205a1a286Smrg $opt_dry_run || { 817305a1a286Smrg # note: this script will not be executed, so do not chmod. 817405a1a286Smrg if test "x$build" = "x$host" ; then 817505a1a286Smrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 817605a1a286Smrg else 817705a1a286Smrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 817805a1a286Smrg fi 817905a1a286Smrg } 818005a1a286Smrg ;; 818105a1a286Smrg * ) 818205a1a286Smrg $RM $output 818305a1a286Smrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 8184d9c7fc6cSmrg 818505a1a286Smrg func_emit_wrapper no > $output 818605a1a286Smrg chmod +x $output 818705a1a286Smrg ;; 818805a1a286Smrg esac 818905a1a286Smrg } 819005a1a286Smrg exit $EXIT_SUCCESS 819105a1a286Smrg ;; 819205a1a286Smrg esac 8193d9c7fc6cSmrg 819405a1a286Smrg # See if we need to build an old-fashioned archive. 819505a1a286Smrg for oldlib in $oldlibs; do 8196d9c7fc6cSmrg 819705a1a286Smrg if test "$build_libtool_libs" = convenience; then 819805a1a286Smrg oldobjs="$libobjs_save $symfileobj" 819905a1a286Smrg addlibs="$convenience" 820005a1a286Smrg build_libtool_libs=no 820105a1a286Smrg else 820205a1a286Smrg if test "$build_libtool_libs" = module; then 820305a1a286Smrg oldobjs="$libobjs_save" 820405a1a286Smrg build_libtool_libs=no 820505a1a286Smrg else 820605a1a286Smrg oldobjs="$old_deplibs $non_pic_objects" 820705a1a286Smrg if test "$preload" = yes && test -f "$symfileobj"; then 820805a1a286Smrg oldobjs="$oldobjs $symfileobj" 820905a1a286Smrg fi 821005a1a286Smrg fi 821105a1a286Smrg addlibs="$old_convenience" 8212d9c7fc6cSmrg fi 8213d9c7fc6cSmrg 821405a1a286Smrg if test -n "$addlibs"; then 821505a1a286Smrg gentop="$output_objdir/${outputname}x" 821605a1a286Smrg generated="$generated $gentop" 8217d9c7fc6cSmrg 821805a1a286Smrg func_extract_archives $gentop $addlibs 821905a1a286Smrg oldobjs="$oldobjs $func_extract_archives_result" 822005a1a286Smrg fi 8221d9c7fc6cSmrg 822205a1a286Smrg # Do each command in the archive commands. 822305a1a286Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 822405a1a286Smrg cmds=$old_archive_from_new_cmds 822505a1a286Smrg else 8226d9c7fc6cSmrg 822705a1a286Smrg # Add any objects from preloaded convenience libraries 822805a1a286Smrg if test -n "$dlprefiles"; then 822905a1a286Smrg gentop="$output_objdir/${outputname}x" 823005a1a286Smrg generated="$generated $gentop" 8231d9c7fc6cSmrg 823205a1a286Smrg func_extract_archives $gentop $dlprefiles 823305a1a286Smrg oldobjs="$oldobjs $func_extract_archives_result" 823405a1a286Smrg fi 8235d9c7fc6cSmrg 823605a1a286Smrg # POSIX demands no paths to be encoded in archives. We have 823705a1a286Smrg # to avoid creating archives with duplicate basenames if we 823805a1a286Smrg # might have to extract them afterwards, e.g., when creating a 823905a1a286Smrg # static archive out of a convenience library, or when linking 824005a1a286Smrg # the entirety of a libtool archive into another (currently 824105a1a286Smrg # not supported by libtool). 824205a1a286Smrg if (for obj in $oldobjs 824305a1a286Smrg do 824405a1a286Smrg func_basename "$obj" 824505a1a286Smrg $ECHO "$func_basename_result" 824605a1a286Smrg done | sort | sort -uc >/dev/null 2>&1); then 824705a1a286Smrg : 824805a1a286Smrg else 824905a1a286Smrg echo "copying selected object files to avoid basename conflicts..." 825005a1a286Smrg gentop="$output_objdir/${outputname}x" 825105a1a286Smrg generated="$generated $gentop" 825205a1a286Smrg func_mkdir_p "$gentop" 825305a1a286Smrg save_oldobjs=$oldobjs 825405a1a286Smrg oldobjs= 825505a1a286Smrg counter=1 825605a1a286Smrg for obj in $save_oldobjs 825705a1a286Smrg do 825805a1a286Smrg func_basename "$obj" 825905a1a286Smrg objbase="$func_basename_result" 826005a1a286Smrg case " $oldobjs " in 826105a1a286Smrg " ") oldobjs=$obj ;; 826205a1a286Smrg *[\ /]"$objbase "*) 826305a1a286Smrg while :; do 826405a1a286Smrg # Make sure we don't pick an alternate name that also 826505a1a286Smrg # overlaps. 826605a1a286Smrg newobj=lt$counter-$objbase 826705a1a286Smrg func_arith $counter + 1 826805a1a286Smrg counter=$func_arith_result 826905a1a286Smrg case " $oldobjs " in 827005a1a286Smrg *[\ /]"$newobj "*) ;; 827105a1a286Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 827205a1a286Smrg esac 827305a1a286Smrg done 827405a1a286Smrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 827505a1a286Smrg oldobjs="$oldobjs $gentop/$newobj" 827605a1a286Smrg ;; 827705a1a286Smrg *) oldobjs="$oldobjs $obj" ;; 827805a1a286Smrg esac 8279d9c7fc6cSmrg done 8280d9c7fc6cSmrg fi 828105a1a286Smrg eval cmds=\"$old_archive_cmds\" 8282d9c7fc6cSmrg 828305a1a286Smrg func_len " $cmds" 828405a1a286Smrg len=$func_len_result 828505a1a286Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 828605a1a286Smrg cmds=$old_archive_cmds 828705a1a286Smrg else 828805a1a286Smrg # the command line is too long to link in one step, link in parts 828905a1a286Smrg func_verbose "using piecewise archive linking..." 829005a1a286Smrg save_RANLIB=$RANLIB 829105a1a286Smrg RANLIB=: 829205a1a286Smrg objlist= 829305a1a286Smrg concat_cmds= 829405a1a286Smrg save_oldobjs=$oldobjs 829505a1a286Smrg oldobjs= 829605a1a286Smrg # Is there a better way of finding the last object in the list? 829705a1a286Smrg for obj in $save_oldobjs 829805a1a286Smrg do 829905a1a286Smrg last_oldobj=$obj 830005a1a286Smrg done 830105a1a286Smrg eval test_cmds=\"$old_archive_cmds\" 830205a1a286Smrg func_len " $test_cmds" 830305a1a286Smrg len0=$func_len_result 830405a1a286Smrg len=$len0 830505a1a286Smrg for obj in $save_oldobjs 830605a1a286Smrg do 830705a1a286Smrg func_len " $obj" 830805a1a286Smrg func_arith $len + $func_len_result 830905a1a286Smrg len=$func_arith_result 831005a1a286Smrg func_append objlist " $obj" 831105a1a286Smrg if test "$len" -lt "$max_cmd_len"; then 831205a1a286Smrg : 831305a1a286Smrg else 831405a1a286Smrg # the above command should be used before it gets too long 831505a1a286Smrg oldobjs=$objlist 831605a1a286Smrg if test "$obj" = "$last_oldobj" ; then 831705a1a286Smrg RANLIB=$save_RANLIB 831805a1a286Smrg fi 831905a1a286Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 832005a1a286Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 832105a1a286Smrg objlist= 832205a1a286Smrg len=$len0 832305a1a286Smrg fi 832405a1a286Smrg done 832505a1a286Smrg RANLIB=$save_RANLIB 832605a1a286Smrg oldobjs=$objlist 832705a1a286Smrg if test "X$oldobjs" = "X" ; then 832805a1a286Smrg eval cmds=\"\$concat_cmds\" 832905a1a286Smrg else 833005a1a286Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 833105a1a286Smrg fi 833205a1a286Smrg fi 833305a1a286Smrg fi 833405a1a286Smrg func_execute_cmds "$cmds" 'exit $?' 8335d9c7fc6cSmrg done 8336d9c7fc6cSmrg 833705a1a286Smrg test -n "$generated" && \ 833805a1a286Smrg func_show_eval "${RM}r$generated" 8339d9c7fc6cSmrg 834005a1a286Smrg # Now create the libtool archive. 834105a1a286Smrg case $output in 834205a1a286Smrg *.la) 834305a1a286Smrg old_library= 834405a1a286Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 834505a1a286Smrg func_verbose "creating $output" 8346d9c7fc6cSmrg 834705a1a286Smrg # Preserve any variables that may affect compiler behavior 834805a1a286Smrg for var in $variables_saved_for_relink; do 834905a1a286Smrg if eval test -z \"\${$var+set}\"; then 835005a1a286Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 835105a1a286Smrg elif eval var_value=\$$var; test -z "$var_value"; then 835205a1a286Smrg relink_command="$var=; export $var; $relink_command" 8353d9c7fc6cSmrg else 835405a1a286Smrg func_quote_for_eval "$var_value" 835505a1a286Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8356d9c7fc6cSmrg fi 835705a1a286Smrg done 835805a1a286Smrg # Quote the link command for shipping. 835905a1a286Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 836005a1a286Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 836105a1a286Smrg if test "$hardcode_automatic" = yes ; then 836205a1a286Smrg relink_command= 836305a1a286Smrg fi 8364d9c7fc6cSmrg 836505a1a286Smrg # Only create the output if not a dry run. 836605a1a286Smrg $opt_dry_run || { 836705a1a286Smrg for installed in no yes; do 836805a1a286Smrg if test "$installed" = yes; then 836905a1a286Smrg if test -z "$install_libdir"; then 837005a1a286Smrg break 837105a1a286Smrg fi 837205a1a286Smrg output="$output_objdir/$outputname"i 837305a1a286Smrg # Replace all uninstalled libtool libraries with the installed ones 837405a1a286Smrg newdependency_libs= 837505a1a286Smrg for deplib in $dependency_libs; do 837605a1a286Smrg case $deplib in 837705a1a286Smrg *.la) 837805a1a286Smrg func_basename "$deplib" 837905a1a286Smrg name="$func_basename_result" 838005a1a286Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 838105a1a286Smrg test -z "$libdir" && \ 838205a1a286Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 838305a1a286Smrg newdependency_libs="$newdependency_libs $libdir/$name" 838405a1a286Smrg ;; 838505a1a286Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 838605a1a286Smrg esac 838705a1a286Smrg done 838805a1a286Smrg dependency_libs="$newdependency_libs" 838905a1a286Smrg newdlfiles= 8390d9c7fc6cSmrg 839105a1a286Smrg for lib in $dlfiles; do 839205a1a286Smrg case $lib in 839305a1a286Smrg *.la) 839405a1a286Smrg func_basename "$lib" 839505a1a286Smrg name="$func_basename_result" 839605a1a286Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 839705a1a286Smrg test -z "$libdir" && \ 839805a1a286Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 839905a1a286Smrg newdlfiles="$newdlfiles $libdir/$name" 840005a1a286Smrg ;; 840105a1a286Smrg *) newdlfiles="$newdlfiles $lib" ;; 840205a1a286Smrg esac 840305a1a286Smrg done 840405a1a286Smrg dlfiles="$newdlfiles" 840505a1a286Smrg newdlprefiles= 840605a1a286Smrg for lib in $dlprefiles; do 840705a1a286Smrg case $lib in 840805a1a286Smrg *.la) 840905a1a286Smrg # Only pass preopened files to the pseudo-archive (for 841005a1a286Smrg # eventual linking with the app. that links it) if we 841105a1a286Smrg # didn't already link the preopened objects directly into 841205a1a286Smrg # the library: 841305a1a286Smrg func_basename "$lib" 841405a1a286Smrg name="$func_basename_result" 841505a1a286Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 841605a1a286Smrg test -z "$libdir" && \ 841705a1a286Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 841805a1a286Smrg newdlprefiles="$newdlprefiles $libdir/$name" 841905a1a286Smrg ;; 842005a1a286Smrg esac 842105a1a286Smrg done 842205a1a286Smrg dlprefiles="$newdlprefiles" 842305a1a286Smrg else 842405a1a286Smrg newdlfiles= 842505a1a286Smrg for lib in $dlfiles; do 842605a1a286Smrg case $lib in 842705a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 842805a1a286Smrg *) abs=`pwd`"/$lib" ;; 842905a1a286Smrg esac 843005a1a286Smrg newdlfiles="$newdlfiles $abs" 843105a1a286Smrg done 843205a1a286Smrg dlfiles="$newdlfiles" 843305a1a286Smrg newdlprefiles= 843405a1a286Smrg for lib in $dlprefiles; do 843505a1a286Smrg case $lib in 843605a1a286Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 843705a1a286Smrg *) abs=`pwd`"/$lib" ;; 843805a1a286Smrg esac 843905a1a286Smrg newdlprefiles="$newdlprefiles $abs" 844005a1a286Smrg done 844105a1a286Smrg dlprefiles="$newdlprefiles" 844205a1a286Smrg fi 844305a1a286Smrg $RM $output 844405a1a286Smrg # place dlname in correct position for cygwin 844505a1a286Smrg # In fact, it would be nice if we could use this code for all target 844605a1a286Smrg # systems that can't hard-code library paths into their executables 844705a1a286Smrg # and that have no shared library path variable independent of PATH, 844805a1a286Smrg # but it turns out we can't easily determine that from inspecting 844905a1a286Smrg # libtool variables, so we have to hard-code the OSs to which it 845005a1a286Smrg # applies here; at the moment, that means platforms that use the PE 845105a1a286Smrg # object format with DLL files. See the long comment at the top of 845205a1a286Smrg # tests/bindir.at for full details. 845305a1a286Smrg tdlname=$dlname 845405a1a286Smrg case $host,$output,$installed,$module,$dlname in 845505a1a286Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 845605a1a286Smrg # If a -bindir argument was supplied, place the dll there. 845705a1a286Smrg if test "x$bindir" != x ; 845805a1a286Smrg then 845905a1a286Smrg func_relative_path "$install_libdir" "$bindir" 846005a1a286Smrg tdlname=$func_relative_path_result$dlname 846105a1a286Smrg else 846205a1a286Smrg # Otherwise fall back on heuristic. 846305a1a286Smrg tdlname=../bin/$dlname 846405a1a286Smrg fi 846505a1a286Smrg ;; 846605a1a286Smrg esac 846705a1a286Smrg $ECHO > $output "\ 846805a1a286Smrg# $outputname - a libtool library file 846905a1a286Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 847005a1a286Smrg# 847105a1a286Smrg# Please DO NOT delete this file! 847205a1a286Smrg# It is necessary for linking the library. 8473d9c7fc6cSmrg 847405a1a286Smrg# The name that we can dlopen(3). 847505a1a286Smrgdlname='$tdlname' 8476d9c7fc6cSmrg 847705a1a286Smrg# Names of this library. 847805a1a286Smrglibrary_names='$library_names' 8479d9c7fc6cSmrg 848005a1a286Smrg# The name of the static archive. 848105a1a286Smrgold_library='$old_library' 8482d9c7fc6cSmrg 848305a1a286Smrg# Linker flags that can not go in dependency_libs. 848405a1a286Smrginherited_linker_flags='$new_inherited_linker_flags' 8485d9c7fc6cSmrg 848605a1a286Smrg# Libraries that this one depends upon. 848705a1a286Smrgdependency_libs='$dependency_libs' 8488d9c7fc6cSmrg 848905a1a286Smrg# Names of additional weak libraries provided by this library 849005a1a286Smrgweak_library_names='$weak_libs' 8491d9c7fc6cSmrg 849205a1a286Smrg# Version information for $libname. 849305a1a286Smrgcurrent=$current 849405a1a286Smrgage=$age 849505a1a286Smrgrevision=$revision 8496d9c7fc6cSmrg 849705a1a286Smrg# Is this an already installed library? 849805a1a286Smrginstalled=$installed 8499d9c7fc6cSmrg 850005a1a286Smrg# Should we warn about portability when linking against -modules? 850105a1a286Smrgshouldnotlink=$module 8502d9c7fc6cSmrg 850305a1a286Smrg# Files to dlopen/dlpreopen 850405a1a286Smrgdlopen='$dlfiles' 850505a1a286Smrgdlpreopen='$dlprefiles' 8506d9c7fc6cSmrg 850705a1a286Smrg# Directory that this library needs to be installed in: 850805a1a286Smrglibdir='$install_libdir'" 850905a1a286Smrg if test "$installed" = no && test "$need_relink" = yes; then 851005a1a286Smrg $ECHO >> $output "\ 851105a1a286Smrgrelink_command=\"$relink_command\"" 851205a1a286Smrg fi 851305a1a286Smrg done 851405a1a286Smrg } 8515d9c7fc6cSmrg 851605a1a286Smrg # Do a symbolic link so that the libtool archive can be found in 851705a1a286Smrg # LD_LIBRARY_PATH before the program is installed. 851805a1a286Smrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 851905a1a286Smrg ;; 852005a1a286Smrg esac 852105a1a286Smrg exit $EXIT_SUCCESS 852205a1a286Smrg} 8523d9c7fc6cSmrg 852405a1a286Smrg{ test "$mode" = link || test "$mode" = relink; } && 852505a1a286Smrg func_mode_link ${1+"$@"} 8526d9c7fc6cSmrg 8527d9c7fc6cSmrg 852805a1a286Smrg# func_mode_uninstall arg... 852905a1a286Smrgfunc_mode_uninstall () 853005a1a286Smrg{ 853105a1a286Smrg $opt_debug 853205a1a286Smrg RM="$nonopt" 8533d9c7fc6cSmrg files= 8534d9c7fc6cSmrg rmforce= 8535d9c7fc6cSmrg exit_status=0 8536d9c7fc6cSmrg 8537d9c7fc6cSmrg # This variable tells wrapper scripts just to set variables rather 8538d9c7fc6cSmrg # than running their programs. 8539d9c7fc6cSmrg libtool_install_magic="$magic" 8540d9c7fc6cSmrg 8541d9c7fc6cSmrg for arg 8542d9c7fc6cSmrg do 8543d9c7fc6cSmrg case $arg in 854405a1a286Smrg -f) RM="$RM $arg"; rmforce=yes ;; 854505a1a286Smrg -*) RM="$RM $arg" ;; 8546d9c7fc6cSmrg *) files="$files $arg" ;; 8547d9c7fc6cSmrg esac 8548d9c7fc6cSmrg done 8549d9c7fc6cSmrg 855005a1a286Smrg test -z "$RM" && \ 855105a1a286Smrg func_fatal_help "you must specify an RM program" 8552d9c7fc6cSmrg 8553d9c7fc6cSmrg rmdirs= 8554d9c7fc6cSmrg 8555d9c7fc6cSmrg origobjdir="$objdir" 8556d9c7fc6cSmrg for file in $files; do 855705a1a286Smrg func_dirname "$file" "" "." 855805a1a286Smrg dir="$func_dirname_result" 855905a1a286Smrg if test "X$dir" = X.; then 8560d9c7fc6cSmrg objdir="$origobjdir" 8561d9c7fc6cSmrg else 8562d9c7fc6cSmrg objdir="$dir/$origobjdir" 8563d9c7fc6cSmrg fi 856405a1a286Smrg func_basename "$file" 856505a1a286Smrg name="$func_basename_result" 8566d9c7fc6cSmrg test "$mode" = uninstall && objdir="$dir" 8567d9c7fc6cSmrg 8568d9c7fc6cSmrg # Remember objdir for removal later, being careful to avoid duplicates 8569d9c7fc6cSmrg if test "$mode" = clean; then 8570d9c7fc6cSmrg case " $rmdirs " in 8571d9c7fc6cSmrg *" $objdir "*) ;; 8572d9c7fc6cSmrg *) rmdirs="$rmdirs $objdir" ;; 8573d9c7fc6cSmrg esac 8574d9c7fc6cSmrg fi 8575d9c7fc6cSmrg 8576d9c7fc6cSmrg # Don't error if the file doesn't exist and rm -f was used. 857705a1a286Smrg if { test -L "$file"; } >/dev/null 2>&1 || 857805a1a286Smrg { test -h "$file"; } >/dev/null 2>&1 || 857905a1a286Smrg test -f "$file"; then 8580d9c7fc6cSmrg : 8581d9c7fc6cSmrg elif test -d "$file"; then 8582d9c7fc6cSmrg exit_status=1 8583d9c7fc6cSmrg continue 8584d9c7fc6cSmrg elif test "$rmforce" = yes; then 8585d9c7fc6cSmrg continue 8586d9c7fc6cSmrg fi 8587d9c7fc6cSmrg 8588d9c7fc6cSmrg rmfiles="$file" 8589d9c7fc6cSmrg 8590d9c7fc6cSmrg case $name in 8591d9c7fc6cSmrg *.la) 8592d9c7fc6cSmrg # Possibly a libtool archive, so verify it. 859305a1a286Smrg if func_lalib_p "$file"; then 859405a1a286Smrg func_source $dir/$name 8595d9c7fc6cSmrg 8596d9c7fc6cSmrg # Delete the libtool libraries and symlinks. 8597d9c7fc6cSmrg for n in $library_names; do 8598d9c7fc6cSmrg rmfiles="$rmfiles $objdir/$n" 8599d9c7fc6cSmrg done 8600d9c7fc6cSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8601d9c7fc6cSmrg 8602d9c7fc6cSmrg case "$mode" in 8603d9c7fc6cSmrg clean) 8604d9c7fc6cSmrg case " $library_names " in 8605d9c7fc6cSmrg # " " in the beginning catches empty $dlname 8606d9c7fc6cSmrg *" $dlname "*) ;; 8607d9c7fc6cSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 8608d9c7fc6cSmrg esac 860905a1a286Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8610d9c7fc6cSmrg ;; 8611d9c7fc6cSmrg uninstall) 8612d9c7fc6cSmrg if test -n "$library_names"; then 8613d9c7fc6cSmrg # Do each command in the postuninstall commands. 861405a1a286Smrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8615d9c7fc6cSmrg fi 8616d9c7fc6cSmrg 8617d9c7fc6cSmrg if test -n "$old_library"; then 8618d9c7fc6cSmrg # Do each command in the old_postuninstall commands. 861905a1a286Smrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8620d9c7fc6cSmrg fi 8621d9c7fc6cSmrg # FIXME: should reinstall the best remaining shared library. 8622d9c7fc6cSmrg ;; 8623d9c7fc6cSmrg esac 8624d9c7fc6cSmrg fi 8625d9c7fc6cSmrg ;; 8626d9c7fc6cSmrg 8627d9c7fc6cSmrg *.lo) 8628d9c7fc6cSmrg # Possibly a libtool object, so verify it. 862905a1a286Smrg if func_lalib_p "$file"; then 8630d9c7fc6cSmrg 8631d9c7fc6cSmrg # Read the .lo file 863205a1a286Smrg func_source $dir/$name 8633d9c7fc6cSmrg 8634d9c7fc6cSmrg # Add PIC object to the list of files to remove. 863505a1a286Smrg if test -n "$pic_object" && 863605a1a286Smrg test "$pic_object" != none; then 8637d9c7fc6cSmrg rmfiles="$rmfiles $dir/$pic_object" 8638d9c7fc6cSmrg fi 8639d9c7fc6cSmrg 8640d9c7fc6cSmrg # Add non-PIC object to the list of files to remove. 864105a1a286Smrg if test -n "$non_pic_object" && 864205a1a286Smrg test "$non_pic_object" != none; then 8643d9c7fc6cSmrg rmfiles="$rmfiles $dir/$non_pic_object" 8644d9c7fc6cSmrg fi 8645d9c7fc6cSmrg fi 8646d9c7fc6cSmrg ;; 8647d9c7fc6cSmrg 8648d9c7fc6cSmrg *) 8649d9c7fc6cSmrg if test "$mode" = clean ; then 8650d9c7fc6cSmrg noexename=$name 8651d9c7fc6cSmrg case $file in 8652d9c7fc6cSmrg *.exe) 865305a1a286Smrg func_stripname '' '.exe' "$file" 865405a1a286Smrg file=$func_stripname_result 865505a1a286Smrg func_stripname '' '.exe' "$name" 865605a1a286Smrg noexename=$func_stripname_result 8657d9c7fc6cSmrg # $file with .exe has already been added to rmfiles, 8658d9c7fc6cSmrg # add $file without .exe 8659d9c7fc6cSmrg rmfiles="$rmfiles $file" 8660d9c7fc6cSmrg ;; 8661d9c7fc6cSmrg esac 8662d9c7fc6cSmrg # Do a test to see if this is a libtool program. 866305a1a286Smrg if func_ltwrapper_p "$file"; then 866405a1a286Smrg if func_ltwrapper_executable_p "$file"; then 866505a1a286Smrg func_ltwrapper_scriptname "$file" 866605a1a286Smrg relink_command= 866705a1a286Smrg func_source $func_ltwrapper_scriptname_result 866805a1a286Smrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 866905a1a286Smrg else 867005a1a286Smrg relink_command= 867105a1a286Smrg func_source $dir/$noexename 867205a1a286Smrg fi 8673d9c7fc6cSmrg 8674d9c7fc6cSmrg # note $name still contains .exe if it was in $file originally 8675d9c7fc6cSmrg # as does the version of $file that was added into $rmfiles 8676d9c7fc6cSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8677d9c7fc6cSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 8678d9c7fc6cSmrg rmfiles="$rmfiles $objdir/lt-$name" 8679d9c7fc6cSmrg fi 8680d9c7fc6cSmrg if test "X$noexename" != "X$name" ; then 8681d9c7fc6cSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8682d9c7fc6cSmrg fi 8683d9c7fc6cSmrg fi 8684d9c7fc6cSmrg fi 8685d9c7fc6cSmrg ;; 8686d9c7fc6cSmrg esac 868705a1a286Smrg func_show_eval "$RM $rmfiles" 'exit_status=1' 8688d9c7fc6cSmrg done 8689d9c7fc6cSmrg objdir="$origobjdir" 8690d9c7fc6cSmrg 8691d9c7fc6cSmrg # Try to remove the ${objdir}s in the directories where we deleted files 8692d9c7fc6cSmrg for dir in $rmdirs; do 8693d9c7fc6cSmrg if test -d "$dir"; then 869405a1a286Smrg func_show_eval "rmdir $dir >/dev/null 2>&1" 8695d9c7fc6cSmrg fi 8696d9c7fc6cSmrg done 8697d9c7fc6cSmrg 8698d9c7fc6cSmrg exit $exit_status 869905a1a286Smrg} 8700d9c7fc6cSmrg 870105a1a286Smrg{ test "$mode" = uninstall || test "$mode" = clean; } && 870205a1a286Smrg func_mode_uninstall ${1+"$@"} 8703d9c7fc6cSmrg 870405a1a286Smrgtest -z "$mode" && { 870505a1a286Smrg help="$generic_help" 870605a1a286Smrg func_fatal_help "you must specify a MODE" 870705a1a286Smrg} 870805a1a286Smrg 870905a1a286Smrgtest -z "$exec_cmd" && \ 871005a1a286Smrg func_fatal_help "invalid operation mode \`$mode'" 8711d9c7fc6cSmrg 8712d9c7fc6cSmrgif test -n "$exec_cmd"; then 871305a1a286Smrg eval exec "$exec_cmd" 8714d9c7fc6cSmrg exit $EXIT_FAILURE 8715d9c7fc6cSmrgfi 8716d9c7fc6cSmrg 871705a1a286Smrgexit $exit_status 8718d9c7fc6cSmrg 8719d9c7fc6cSmrg 8720d9c7fc6cSmrg# The TAGs below are defined such that we never get into a situation 8721d9c7fc6cSmrg# in which we disable both kinds of libraries. Given conflicting 8722d9c7fc6cSmrg# choices, we go for a static library, that is the most portable, 8723d9c7fc6cSmrg# since we can't tell whether shared libraries were disabled because 8724d9c7fc6cSmrg# the user asked for that or because the platform doesn't support 8725d9c7fc6cSmrg# them. This is particularly important on AIX, because we don't 8726d9c7fc6cSmrg# support having both static and shared libraries enabled at the same 8727d9c7fc6cSmrg# time on that platform, so we default to a shared-only configuration. 8728d9c7fc6cSmrg# If a disable-shared tag is given, we'll fallback to a static-only 8729d9c7fc6cSmrg# configuration. But we'll never go from static-only to shared-only. 8730d9c7fc6cSmrg 8731d9c7fc6cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 873205a1a286Smrgbuild_libtool_libs=no 873305a1a286Smrgbuild_old_libs=yes 8734d9c7fc6cSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 8735d9c7fc6cSmrg 8736d9c7fc6cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 873705a1a286Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8738d9c7fc6cSmrg# ### END LIBTOOL TAG CONFIG: disable-static 8739d9c7fc6cSmrg 8740d9c7fc6cSmrg# Local Variables: 8741d9c7fc6cSmrg# mode:shell-script 8742d9c7fc6cSmrg# sh-indentation:2 8743d9c7fc6cSmrg# End: 874405a1a286Smrg# vi:sw=2 874505a1a286Smrg 8746