140dd5a57Smrg# Generated from ltmain.m4sh. 240dd5a57Smrg 340dd5a57Smrg# libtool (GNU libtool) 2.2.10 440dd5a57Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 540dd5a57Smrg 640dd5a57Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 740dd5a57Smrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 840dd5a57Smrg# This is free software; see the source for copying conditions. There is NO 940dd5a57Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1040dd5a57Smrg 1140dd5a57Smrg# GNU Libtool is free software; you can redistribute it and/or modify 1240dd5a57Smrg# it under the terms of the GNU General Public License as published by 1340dd5a57Smrg# the Free Software Foundation; either version 2 of the License, or 1440dd5a57Smrg# (at your option) any later version. 1540dd5a57Smrg# 1640dd5a57Smrg# As a special exception to the GNU General Public License, 1740dd5a57Smrg# if you distribute this file as part of a program or library that 1840dd5a57Smrg# is built using GNU Libtool, you may include this file under the 1940dd5a57Smrg# same distribution terms that you use for the rest of that program. 2040dd5a57Smrg# 2140dd5a57Smrg# GNU Libtool is distributed in the hope that it will be useful, but 2240dd5a57Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 2340dd5a57Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2440dd5a57Smrg# General Public License for more details. 2540dd5a57Smrg# 2640dd5a57Smrg# You should have received a copy of the GNU General Public License 2740dd5a57Smrg# along with GNU Libtool; see the file COPYING. If not, a copy 2840dd5a57Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 2940dd5a57Smrg# or obtained by writing to the Free Software Foundation, Inc., 3040dd5a57Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 3140dd5a57Smrg 3240dd5a57Smrg# Usage: $progname [OPTION]... [MODE-ARG]... 3340dd5a57Smrg# 3440dd5a57Smrg# Provide generalized library-building support services. 3540dd5a57Smrg# 3640dd5a57Smrg# --config show all configuration variables 3740dd5a57Smrg# --debug enable verbose shell tracing 3840dd5a57Smrg# -n, --dry-run display commands without modifying any files 3940dd5a57Smrg# --features display basic configuration information and exit 4040dd5a57Smrg# --mode=MODE use operation mode MODE 4140dd5a57Smrg# --preserve-dup-deps don't remove duplicate dependency libraries 4240dd5a57Smrg# --quiet, --silent don't print informational messages 4340dd5a57Smrg# --no-quiet, --no-silent 4440dd5a57Smrg# print informational messages (default) 4540dd5a57Smrg# --tag=TAG use configuration variables from tag TAG 4640dd5a57Smrg# -v, --verbose print more informational messages than default 4740dd5a57Smrg# --no-verbose don't print the extra informational messages 4840dd5a57Smrg# --version print version information 4940dd5a57Smrg# -h, --help, --help-all print short, long, or detailed help message 5040dd5a57Smrg# 5140dd5a57Smrg# MODE must be one of the following: 5240dd5a57Smrg# 5340dd5a57Smrg# clean remove files from the build directory 5440dd5a57Smrg# compile compile a source file into a libtool object 5540dd5a57Smrg# execute automatically set library path, then run a program 5640dd5a57Smrg# finish complete the installation of libtool libraries 5740dd5a57Smrg# install install libraries or executables 5840dd5a57Smrg# link create a library or an executable 5940dd5a57Smrg# uninstall remove libraries from an installed directory 6040dd5a57Smrg# 6140dd5a57Smrg# MODE-ARGS vary depending on the MODE. When passed as first option, 6240dd5a57Smrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 6340dd5a57Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 6440dd5a57Smrg# 6540dd5a57Smrg# When reporting a bug, please describe a test case to reproduce it and 6640dd5a57Smrg# include the following information: 6740dd5a57Smrg# 6840dd5a57Smrg# host-triplet: $host 6940dd5a57Smrg# shell: $SHELL 7040dd5a57Smrg# compiler: $LTCC 7140dd5a57Smrg# compiler flags: $LTCFLAGS 7240dd5a57Smrg# linker: $LD (gnu? $with_gnu_ld) 7340dd5a57Smrg# $progname: (GNU libtool) 2.2.10 7440dd5a57Smrg# automake: $automake_version 7540dd5a57Smrg# autoconf: $autoconf_version 7640dd5a57Smrg# 7740dd5a57Smrg# Report bugs to <bug-libtool@gnu.org>. 7840dd5a57Smrg 7940dd5a57SmrgPROGRAM=libtool 8040dd5a57SmrgPACKAGE=libtool 8140dd5a57SmrgVERSION=2.2.10 8240dd5a57SmrgTIMESTAMP="" 8340dd5a57Smrgpackage_revision=1.3175 8440dd5a57Smrg 8540dd5a57Smrg# Be Bourne compatible 8640dd5a57Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 8740dd5a57Smrg emulate sh 8840dd5a57Smrg NULLCMD=: 8940dd5a57Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 9040dd5a57Smrg # is contrary to our usage. Disable this feature. 9140dd5a57Smrg alias -g '${1+"$@"}'='"$@"' 9240dd5a57Smrg setopt NO_GLOB_SUBST 9340dd5a57Smrgelse 9440dd5a57Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 9540dd5a57Smrgfi 9640dd5a57SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 9740dd5a57SmrgDUALCASE=1; export DUALCASE # for MKS sh 9840dd5a57Smrg 9940dd5a57Smrg# A function that is used when there is no print builtin or printf. 10040dd5a57Smrgfunc_fallback_echo () 10140dd5a57Smrg{ 10240dd5a57Smrg eval 'cat <<_LTECHO_EOF 10340dd5a57Smrg$1 10440dd5a57Smrg_LTECHO_EOF' 10540dd5a57Smrg} 10640dd5a57Smrg 10740dd5a57Smrg# NLS nuisances: We save the old values to restore during execute mode. 10840dd5a57Smrglt_user_locale= 10940dd5a57Smrglt_safe_locale= 11040dd5a57Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11140dd5a57Smrgdo 11240dd5a57Smrg eval "if test \"\${$lt_var+set}\" = set; then 11340dd5a57Smrg save_$lt_var=\$$lt_var 11440dd5a57Smrg $lt_var=C 11540dd5a57Smrg export $lt_var 11640dd5a57Smrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 11740dd5a57Smrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 11840dd5a57Smrg fi" 11940dd5a57Smrgdone 12040dd5a57SmrgLC_ALL=C 12140dd5a57SmrgLANGUAGE=C 12240dd5a57Smrgexport LANGUAGE LC_ALL 12340dd5a57Smrg 12440dd5a57Smrg$lt_unset CDPATH 12540dd5a57Smrg 12640dd5a57Smrg 12740dd5a57Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 12840dd5a57Smrg# is ksh but when the shell is invoked as "sh" and the current value of 12940dd5a57Smrg# the _XPG environment variable is not equal to 1 (one), the special 13040dd5a57Smrg# positional parameter $0, within a function call, is the name of the 13140dd5a57Smrg# function. 13240dd5a57Smrgprogpath="$0" 13340dd5a57Smrg 13440dd5a57Smrg 13540dd5a57Smrg 13640dd5a57Smrg: ${CP="cp -f"} 13740dd5a57Smrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 13840dd5a57Smrg: ${EGREP="/bin/grep -E"} 13940dd5a57Smrg: ${FGREP="/bin/grep -F"} 14040dd5a57Smrg: ${GREP="/bin/grep"} 14140dd5a57Smrg: ${LN_S="ln -s"} 14240dd5a57Smrg: ${MAKE="make"} 14340dd5a57Smrg: ${MKDIR="mkdir"} 14440dd5a57Smrg: ${MV="mv -f"} 14540dd5a57Smrg: ${RM="rm -f"} 14640dd5a57Smrg: ${SED="/bin/sed"} 14740dd5a57Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 14840dd5a57Smrg: ${Xsed="$SED -e 1s/^X//"} 14940dd5a57Smrg 15040dd5a57Smrg# Global variables: 15140dd5a57SmrgEXIT_SUCCESS=0 15240dd5a57SmrgEXIT_FAILURE=1 15340dd5a57SmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 15440dd5a57SmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 15540dd5a57Smrg 15640dd5a57Smrgexit_status=$EXIT_SUCCESS 15740dd5a57Smrg 15840dd5a57Smrg# Make sure IFS has a sensible default 15940dd5a57Smrglt_nl=' 16040dd5a57Smrg' 16140dd5a57SmrgIFS=" $lt_nl" 16240dd5a57Smrg 16340dd5a57Smrgdirname="s,/[^/]*$,," 16440dd5a57Smrgbasename="s,^.*/,," 16540dd5a57Smrg 16640dd5a57Smrg# func_dirname_and_basename file append nondir_replacement 16740dd5a57Smrg# perform func_basename and func_dirname in a single function 16840dd5a57Smrg# call: 16940dd5a57Smrg# dirname: Compute the dirname of FILE. If nonempty, 17040dd5a57Smrg# add APPEND to the result, otherwise set result 17140dd5a57Smrg# to NONDIR_REPLACEMENT. 17240dd5a57Smrg# value returned in "$func_dirname_result" 17340dd5a57Smrg# basename: Compute filename of FILE. 17440dd5a57Smrg# value retuned in "$func_basename_result" 17540dd5a57Smrg# Implementation must be kept synchronized with func_dirname 17640dd5a57Smrg# and func_basename. For efficiency, we do not delegate to 17740dd5a57Smrg# those functions but instead duplicate the functionality here. 17840dd5a57Smrgfunc_dirname_and_basename () 17940dd5a57Smrg{ 18040dd5a57Smrg # Extract subdirectory from the argument. 18140dd5a57Smrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 18240dd5a57Smrg if test "X$func_dirname_result" = "X${1}"; then 18340dd5a57Smrg func_dirname_result="${3}" 18440dd5a57Smrg else 18540dd5a57Smrg func_dirname_result="$func_dirname_result${2}" 18640dd5a57Smrg fi 18740dd5a57Smrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 18840dd5a57Smrg} 18940dd5a57Smrg 19040dd5a57Smrg# Generated shell functions inserted here. 19140dd5a57Smrg 19240dd5a57Smrg# These SED scripts presuppose an absolute path with a trailing slash. 19340dd5a57Smrgpathcar='s,^/\([^/]*\).*$,\1,' 19440dd5a57Smrgpathcdr='s,^/[^/]*,,' 19540dd5a57Smrgremovedotparts=':dotsl 19640dd5a57Smrg s@/\./@/@g 19740dd5a57Smrg t dotsl 19840dd5a57Smrg s,/\.$,/,' 19940dd5a57Smrgcollapseslashes='s@/\{1,\}@/@g' 20040dd5a57Smrgfinalslash='s,/*$,/,' 20140dd5a57Smrg 20240dd5a57Smrg# func_normal_abspath PATH 20340dd5a57Smrg# Remove doubled-up and trailing slashes, "." path components, 20440dd5a57Smrg# and cancel out any ".." path components in PATH after making 20540dd5a57Smrg# it an absolute path. 20640dd5a57Smrg# value returned in "$func_normal_abspath_result" 20740dd5a57Smrgfunc_normal_abspath () 20840dd5a57Smrg{ 20940dd5a57Smrg # Start from root dir and reassemble the path. 21040dd5a57Smrg func_normal_abspath_result= 21140dd5a57Smrg func_normal_abspath_tpath=$1 21240dd5a57Smrg func_normal_abspath_altnamespace= 21340dd5a57Smrg case $func_normal_abspath_tpath in 21440dd5a57Smrg "") 21540dd5a57Smrg # Empty path, that just means $cwd. 21640dd5a57Smrg func_stripname '' '/' "`pwd`" 21740dd5a57Smrg func_normal_abspath_result=$func_stripname_result 21840dd5a57Smrg return 21940dd5a57Smrg ;; 22040dd5a57Smrg # The next three entries are used to spot a run of precisely 22140dd5a57Smrg # two leading slashes without using negated character classes; 22240dd5a57Smrg # we take advantage of case's first-match behaviour. 22340dd5a57Smrg ///*) 22440dd5a57Smrg # Unusual form of absolute path, do nothing. 22540dd5a57Smrg ;; 22640dd5a57Smrg //*) 22740dd5a57Smrg # Not necessarily an ordinary path; POSIX reserves leading '//' 22840dd5a57Smrg # and for example Cygwin uses it to access remote file shares 22940dd5a57Smrg # over CIFS/SMB, so we conserve a leading double slash if found. 23040dd5a57Smrg func_normal_abspath_altnamespace=/ 23140dd5a57Smrg ;; 23240dd5a57Smrg /*) 23340dd5a57Smrg # Absolute path, do nothing. 23440dd5a57Smrg ;; 23540dd5a57Smrg *) 23640dd5a57Smrg # Relative path, prepend $cwd. 23740dd5a57Smrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 23840dd5a57Smrg ;; 23940dd5a57Smrg esac 24040dd5a57Smrg # Cancel out all the simple stuff to save iterations. We also want 24140dd5a57Smrg # the path to end with a slash for ease of parsing, so make sure 24240dd5a57Smrg # there is one (and only one) here. 24340dd5a57Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 24440dd5a57Smrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 24540dd5a57Smrg while :; do 24640dd5a57Smrg # Processed it all yet? 24740dd5a57Smrg if test "$func_normal_abspath_tpath" = / ; then 24840dd5a57Smrg # If we ascended to the root using ".." the result may be empty now. 24940dd5a57Smrg if test -z "$func_normal_abspath_result" ; then 25040dd5a57Smrg func_normal_abspath_result=/ 25140dd5a57Smrg fi 25240dd5a57Smrg break 25340dd5a57Smrg fi 25440dd5a57Smrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 25540dd5a57Smrg -e "$pathcar"` 25640dd5a57Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 25740dd5a57Smrg -e "$pathcdr"` 25840dd5a57Smrg # Figure out what to do with it 25940dd5a57Smrg case $func_normal_abspath_tcomponent in 26040dd5a57Smrg "") 26140dd5a57Smrg # Trailing empty path component, ignore it. 26240dd5a57Smrg ;; 26340dd5a57Smrg ..) 26440dd5a57Smrg # Parent dir; strip last assembled component from result. 26540dd5a57Smrg func_dirname "$func_normal_abspath_result" 26640dd5a57Smrg func_normal_abspath_result=$func_dirname_result 26740dd5a57Smrg ;; 26840dd5a57Smrg *) 26940dd5a57Smrg # Actual path component, append it. 27040dd5a57Smrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 27140dd5a57Smrg ;; 27240dd5a57Smrg esac 27340dd5a57Smrg done 27440dd5a57Smrg # Restore leading double-slash if one was found on entry. 27540dd5a57Smrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 27640dd5a57Smrg} 27740dd5a57Smrg 27840dd5a57Smrg# func_relative_path SRCDIR DSTDIR 27940dd5a57Smrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 28040dd5a57Smrg# slash if non-empty, suitable for immediately appending a filename 28140dd5a57Smrg# without needing to append a separator. 28240dd5a57Smrg# value returned in "$func_relative_path_result" 28340dd5a57Smrgfunc_relative_path () 28440dd5a57Smrg{ 28540dd5a57Smrg func_relative_path_result= 28640dd5a57Smrg func_normal_abspath "$1" 28740dd5a57Smrg func_relative_path_tlibdir=$func_normal_abspath_result 28840dd5a57Smrg func_normal_abspath "$2" 28940dd5a57Smrg func_relative_path_tbindir=$func_normal_abspath_result 29040dd5a57Smrg 29140dd5a57Smrg # Ascend the tree starting from libdir 29240dd5a57Smrg while :; do 29340dd5a57Smrg # check if we have found a prefix of bindir 29440dd5a57Smrg case $func_relative_path_tbindir in 29540dd5a57Smrg $func_relative_path_tlibdir) 29640dd5a57Smrg # found an exact match 29740dd5a57Smrg func_relative_path_tcancelled= 29840dd5a57Smrg break 29940dd5a57Smrg ;; 30040dd5a57Smrg $func_relative_path_tlibdir*) 30140dd5a57Smrg # found a matching prefix 30240dd5a57Smrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 30340dd5a57Smrg func_relative_path_tcancelled=$func_stripname_result 30440dd5a57Smrg if test -z "$func_relative_path_result"; then 30540dd5a57Smrg func_relative_path_result=. 30640dd5a57Smrg fi 30740dd5a57Smrg break 30840dd5a57Smrg ;; 30940dd5a57Smrg *) 31040dd5a57Smrg func_dirname $func_relative_path_tlibdir 31140dd5a57Smrg func_relative_path_tlibdir=${func_dirname_result} 31240dd5a57Smrg if test "x$func_relative_path_tlibdir" = x ; then 31340dd5a57Smrg # Have to descend all the way to the root! 31440dd5a57Smrg func_relative_path_result=../$func_relative_path_result 31540dd5a57Smrg func_relative_path_tcancelled=$func_relative_path_tbindir 31640dd5a57Smrg break 31740dd5a57Smrg fi 31840dd5a57Smrg func_relative_path_result=../$func_relative_path_result 31940dd5a57Smrg ;; 32040dd5a57Smrg esac 32140dd5a57Smrg done 32240dd5a57Smrg 32340dd5a57Smrg # Now calculate path; take care to avoid doubling-up slashes. 32440dd5a57Smrg func_stripname '' '/' "$func_relative_path_result" 32540dd5a57Smrg func_relative_path_result=$func_stripname_result 32640dd5a57Smrg func_stripname '/' '/' "$func_relative_path_tcancelled" 32740dd5a57Smrg if test "x$func_stripname_result" != x ; then 32840dd5a57Smrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 32940dd5a57Smrg fi 33040dd5a57Smrg 33140dd5a57Smrg # Normalisation. If bindir is libdir, return empty string, 33240dd5a57Smrg # else relative path ending with a slash; either way, target 33340dd5a57Smrg # file name can be directly appended. 33440dd5a57Smrg if test ! -z "$func_relative_path_result"; then 33540dd5a57Smrg func_stripname './' '' "$func_relative_path_result/" 33640dd5a57Smrg func_relative_path_result=$func_stripname_result 33740dd5a57Smrg fi 33840dd5a57Smrg} 33940dd5a57Smrg 34040dd5a57Smrg# The name of this program: 34140dd5a57Smrgfunc_dirname_and_basename "$progpath" 34240dd5a57Smrgprogname=$func_basename_result 34340dd5a57Smrg 34440dd5a57Smrg# Make sure we have an absolute path for reexecution: 34540dd5a57Smrgcase $progpath in 34640dd5a57Smrg [\\/]*|[A-Za-z]:\\*) ;; 34740dd5a57Smrg *[\\/]*) 34840dd5a57Smrg progdir=$func_dirname_result 34940dd5a57Smrg progdir=`cd "$progdir" && pwd` 35040dd5a57Smrg progpath="$progdir/$progname" 35140dd5a57Smrg ;; 35240dd5a57Smrg *) 35340dd5a57Smrg save_IFS="$IFS" 35440dd5a57Smrg IFS=: 35540dd5a57Smrg for progdir in $PATH; do 35640dd5a57Smrg IFS="$save_IFS" 35740dd5a57Smrg test -x "$progdir/$progname" && break 35840dd5a57Smrg done 35940dd5a57Smrg IFS="$save_IFS" 36040dd5a57Smrg test -n "$progdir" || progdir=`pwd` 36140dd5a57Smrg progpath="$progdir/$progname" 36240dd5a57Smrg ;; 36340dd5a57Smrgesac 36440dd5a57Smrg 36540dd5a57Smrg# Sed substitution that helps us do robust quoting. It backslashifies 36640dd5a57Smrg# metacharacters that are still active within double-quoted strings. 36740dd5a57SmrgXsed="${SED}"' -e 1s/^X//' 36840dd5a57Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 36940dd5a57Smrg 37040dd5a57Smrg# Same as above, but do not quote variable references. 37140dd5a57Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 37240dd5a57Smrg 37340dd5a57Smrg# Re-`\' parameter expansions in output of double_quote_subst that were 37440dd5a57Smrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 37540dd5a57Smrg# in input to double_quote_subst, that '$' was protected from expansion. 37640dd5a57Smrg# Since each input `\' is now two `\'s, look for any number of runs of 37740dd5a57Smrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 37840dd5a57Smrgbs='\\' 37940dd5a57Smrgbs2='\\\\' 38040dd5a57Smrgbs4='\\\\\\\\' 38140dd5a57Smrgdollar='\$' 38240dd5a57Smrgsed_double_backslash="\ 38340dd5a57Smrg s/$bs4/&\\ 38440dd5a57Smrg/g 38540dd5a57Smrg s/^$bs2$dollar/$bs&/ 38640dd5a57Smrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 38740dd5a57Smrg s/\n//g" 38840dd5a57Smrg 38940dd5a57Smrg# Standard options: 39040dd5a57Smrgopt_dry_run=false 39140dd5a57Smrgopt_help=false 39240dd5a57Smrgopt_quiet=false 39340dd5a57Smrgopt_verbose=false 39440dd5a57Smrgopt_warning=: 39540dd5a57Smrg 39640dd5a57Smrg# func_echo arg... 39740dd5a57Smrg# Echo program name prefixed message, along with the current mode 39840dd5a57Smrg# name if it has been set yet. 39940dd5a57Smrgfunc_echo () 40040dd5a57Smrg{ 40140dd5a57Smrg $ECHO "$progname${mode+: }$mode: $*" 40240dd5a57Smrg} 40340dd5a57Smrg 40440dd5a57Smrg# func_verbose arg... 40540dd5a57Smrg# Echo program name prefixed message in verbose mode only. 40640dd5a57Smrgfunc_verbose () 40740dd5a57Smrg{ 40840dd5a57Smrg $opt_verbose && func_echo ${1+"$@"} 40940dd5a57Smrg 41040dd5a57Smrg # A bug in bash halts the script if the last line of a function 41140dd5a57Smrg # fails when set -e is in force, so we need another command to 41240dd5a57Smrg # work around that: 41340dd5a57Smrg : 41440dd5a57Smrg} 41540dd5a57Smrg 41640dd5a57Smrg# func_echo_all arg... 41740dd5a57Smrg# Invoke $ECHO with all args, space-separated. 41840dd5a57Smrgfunc_echo_all () 41940dd5a57Smrg{ 42040dd5a57Smrg $ECHO "$*" 42140dd5a57Smrg} 42240dd5a57Smrg 42340dd5a57Smrg# func_error arg... 42440dd5a57Smrg# Echo program name prefixed message to standard error. 42540dd5a57Smrgfunc_error () 42640dd5a57Smrg{ 42740dd5a57Smrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 42840dd5a57Smrg} 42940dd5a57Smrg 43040dd5a57Smrg# func_warning arg... 43140dd5a57Smrg# Echo program name prefixed warning message to standard error. 43240dd5a57Smrgfunc_warning () 43340dd5a57Smrg{ 43440dd5a57Smrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 43540dd5a57Smrg 43640dd5a57Smrg # bash bug again: 43740dd5a57Smrg : 43840dd5a57Smrg} 43940dd5a57Smrg 44040dd5a57Smrg# func_fatal_error arg... 44140dd5a57Smrg# Echo program name prefixed message to standard error, and exit. 44240dd5a57Smrgfunc_fatal_error () 44340dd5a57Smrg{ 44440dd5a57Smrg func_error ${1+"$@"} 44540dd5a57Smrg exit $EXIT_FAILURE 44640dd5a57Smrg} 44740dd5a57Smrg 44840dd5a57Smrg# func_fatal_help arg... 44940dd5a57Smrg# Echo program name prefixed message to standard error, followed by 45040dd5a57Smrg# a help hint, and exit. 45140dd5a57Smrgfunc_fatal_help () 45240dd5a57Smrg{ 45340dd5a57Smrg func_error ${1+"$@"} 45440dd5a57Smrg func_fatal_error "$help" 45540dd5a57Smrg} 45640dd5a57Smrghelp="Try \`$progname --help' for more information." ## default 45740dd5a57Smrg 45840dd5a57Smrg 45940dd5a57Smrg# func_grep expression filename 46040dd5a57Smrg# Check whether EXPRESSION matches any line of FILENAME, without output. 46140dd5a57Smrgfunc_grep () 46240dd5a57Smrg{ 46340dd5a57Smrg $GREP "$1" "$2" >/dev/null 2>&1 46440dd5a57Smrg} 46540dd5a57Smrg 46640dd5a57Smrg 46740dd5a57Smrg# func_mkdir_p directory-path 46840dd5a57Smrg# Make sure the entire path to DIRECTORY-PATH is available. 46940dd5a57Smrgfunc_mkdir_p () 47040dd5a57Smrg{ 47140dd5a57Smrg my_directory_path="$1" 47240dd5a57Smrg my_dir_list= 47340dd5a57Smrg 47440dd5a57Smrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 47540dd5a57Smrg 47640dd5a57Smrg # Protect directory names starting with `-' 47740dd5a57Smrg case $my_directory_path in 47840dd5a57Smrg -*) my_directory_path="./$my_directory_path" ;; 47940dd5a57Smrg esac 48040dd5a57Smrg 48140dd5a57Smrg # While some portion of DIR does not yet exist... 48240dd5a57Smrg while test ! -d "$my_directory_path"; do 48340dd5a57Smrg # ...make a list in topmost first order. Use a colon delimited 48440dd5a57Smrg # list incase some portion of path contains whitespace. 48540dd5a57Smrg my_dir_list="$my_directory_path:$my_dir_list" 48640dd5a57Smrg 48740dd5a57Smrg # If the last portion added has no slash in it, the list is done 48840dd5a57Smrg case $my_directory_path in */*) ;; *) break ;; esac 48940dd5a57Smrg 49040dd5a57Smrg # ...otherwise throw away the child directory and loop 49140dd5a57Smrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 49240dd5a57Smrg done 49340dd5a57Smrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 49440dd5a57Smrg 49540dd5a57Smrg save_mkdir_p_IFS="$IFS"; IFS=':' 49640dd5a57Smrg for my_dir in $my_dir_list; do 49740dd5a57Smrg IFS="$save_mkdir_p_IFS" 49840dd5a57Smrg # mkdir can fail with a `File exist' error if two processes 49940dd5a57Smrg # try to create one of the directories concurrently. Don't 50040dd5a57Smrg # stop in that case! 50140dd5a57Smrg $MKDIR "$my_dir" 2>/dev/null || : 50240dd5a57Smrg done 50340dd5a57Smrg IFS="$save_mkdir_p_IFS" 50440dd5a57Smrg 50540dd5a57Smrg # Bail out if we (or some other process) failed to create a directory. 50640dd5a57Smrg test -d "$my_directory_path" || \ 50740dd5a57Smrg func_fatal_error "Failed to create \`$1'" 50840dd5a57Smrg fi 50940dd5a57Smrg} 51040dd5a57Smrg 51140dd5a57Smrg 51240dd5a57Smrg# func_mktempdir [string] 51340dd5a57Smrg# Make a temporary directory that won't clash with other running 51440dd5a57Smrg# libtool processes, and avoids race conditions if possible. If 51540dd5a57Smrg# given, STRING is the basename for that directory. 51640dd5a57Smrgfunc_mktempdir () 51740dd5a57Smrg{ 51840dd5a57Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 51940dd5a57Smrg 52040dd5a57Smrg if test "$opt_dry_run" = ":"; then 52140dd5a57Smrg # Return a directory name, but don't create it in dry-run mode 52240dd5a57Smrg my_tmpdir="${my_template}-$$" 52340dd5a57Smrg else 52440dd5a57Smrg 52540dd5a57Smrg # If mktemp works, use that first and foremost 52640dd5a57Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 52740dd5a57Smrg 52840dd5a57Smrg if test ! -d "$my_tmpdir"; then 52940dd5a57Smrg # Failing that, at least try and use $RANDOM to avoid a race 53040dd5a57Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 53140dd5a57Smrg 53240dd5a57Smrg save_mktempdir_umask=`umask` 53340dd5a57Smrg umask 0077 53440dd5a57Smrg $MKDIR "$my_tmpdir" 53540dd5a57Smrg umask $save_mktempdir_umask 53640dd5a57Smrg fi 53740dd5a57Smrg 53840dd5a57Smrg # If we're not in dry-run mode, bomb out on failure 53940dd5a57Smrg test -d "$my_tmpdir" || \ 54040dd5a57Smrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 54140dd5a57Smrg fi 54240dd5a57Smrg 54340dd5a57Smrg $ECHO "$my_tmpdir" 54440dd5a57Smrg} 54540dd5a57Smrg 54640dd5a57Smrg 54740dd5a57Smrg# func_quote_for_eval arg 54840dd5a57Smrg# Aesthetically quote ARG to be evaled later. 54940dd5a57Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 55040dd5a57Smrg# is double-quoted, suitable for a subsequent eval, whereas 55140dd5a57Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 55240dd5a57Smrg# which are still active within double quotes backslashified. 55340dd5a57Smrgfunc_quote_for_eval () 55440dd5a57Smrg{ 55540dd5a57Smrg case $1 in 55640dd5a57Smrg *[\\\`\"\$]*) 55740dd5a57Smrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 55840dd5a57Smrg *) 55940dd5a57Smrg func_quote_for_eval_unquoted_result="$1" ;; 56040dd5a57Smrg esac 56140dd5a57Smrg 56240dd5a57Smrg case $func_quote_for_eval_unquoted_result in 56340dd5a57Smrg # Double-quote args containing shell metacharacters to delay 56440dd5a57Smrg # word splitting, command substitution and and variable 56540dd5a57Smrg # expansion for a subsequent eval. 56640dd5a57Smrg # Many Bourne shells cannot handle close brackets correctly 56740dd5a57Smrg # in scan sets, so we specify it separately. 56840dd5a57Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 56940dd5a57Smrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 57040dd5a57Smrg ;; 57140dd5a57Smrg *) 57240dd5a57Smrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 57340dd5a57Smrg esac 57440dd5a57Smrg} 57540dd5a57Smrg 57640dd5a57Smrg 57740dd5a57Smrg# func_quote_for_expand arg 57840dd5a57Smrg# Aesthetically quote ARG to be evaled later; same as above, 57940dd5a57Smrg# but do not quote variable references. 58040dd5a57Smrgfunc_quote_for_expand () 58140dd5a57Smrg{ 58240dd5a57Smrg case $1 in 58340dd5a57Smrg *[\\\`\"]*) 58440dd5a57Smrg my_arg=`$ECHO "$1" | $SED \ 58540dd5a57Smrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 58640dd5a57Smrg *) 58740dd5a57Smrg my_arg="$1" ;; 58840dd5a57Smrg esac 58940dd5a57Smrg 59040dd5a57Smrg case $my_arg in 59140dd5a57Smrg # Double-quote args containing shell metacharacters to delay 59240dd5a57Smrg # word splitting and command substitution for a subsequent eval. 59340dd5a57Smrg # Many Bourne shells cannot handle close brackets correctly 59440dd5a57Smrg # in scan sets, so we specify it separately. 59540dd5a57Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59640dd5a57Smrg my_arg="\"$my_arg\"" 59740dd5a57Smrg ;; 59840dd5a57Smrg esac 59940dd5a57Smrg 60040dd5a57Smrg func_quote_for_expand_result="$my_arg" 60140dd5a57Smrg} 60240dd5a57Smrg 60340dd5a57Smrg 60440dd5a57Smrg# func_show_eval cmd [fail_exp] 60540dd5a57Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 60640dd5a57Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 60740dd5a57Smrg# is given, then evaluate it. 60840dd5a57Smrgfunc_show_eval () 60940dd5a57Smrg{ 61040dd5a57Smrg my_cmd="$1" 61140dd5a57Smrg my_fail_exp="${2-:}" 61240dd5a57Smrg 61340dd5a57Smrg ${opt_silent-false} || { 61440dd5a57Smrg func_quote_for_expand "$my_cmd" 61540dd5a57Smrg eval "func_echo $func_quote_for_expand_result" 61640dd5a57Smrg } 61740dd5a57Smrg 61840dd5a57Smrg if ${opt_dry_run-false}; then :; else 61940dd5a57Smrg eval "$my_cmd" 62040dd5a57Smrg my_status=$? 62140dd5a57Smrg if test "$my_status" -eq 0; then :; else 62240dd5a57Smrg eval "(exit $my_status); $my_fail_exp" 62340dd5a57Smrg fi 62440dd5a57Smrg fi 62540dd5a57Smrg} 62640dd5a57Smrg 62740dd5a57Smrg 62840dd5a57Smrg# func_show_eval_locale cmd [fail_exp] 62940dd5a57Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 63040dd5a57Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 63140dd5a57Smrg# is given, then evaluate it. Use the saved locale for evaluation. 63240dd5a57Smrgfunc_show_eval_locale () 63340dd5a57Smrg{ 63440dd5a57Smrg my_cmd="$1" 63540dd5a57Smrg my_fail_exp="${2-:}" 63640dd5a57Smrg 63740dd5a57Smrg ${opt_silent-false} || { 63840dd5a57Smrg func_quote_for_expand "$my_cmd" 63940dd5a57Smrg eval "func_echo $func_quote_for_expand_result" 64040dd5a57Smrg } 64140dd5a57Smrg 64240dd5a57Smrg if ${opt_dry_run-false}; then :; else 64340dd5a57Smrg eval "$lt_user_locale 64440dd5a57Smrg $my_cmd" 64540dd5a57Smrg my_status=$? 64640dd5a57Smrg eval "$lt_safe_locale" 64740dd5a57Smrg if test "$my_status" -eq 0; then :; else 64840dd5a57Smrg eval "(exit $my_status); $my_fail_exp" 64940dd5a57Smrg fi 65040dd5a57Smrg fi 65140dd5a57Smrg} 65240dd5a57Smrg 65340dd5a57Smrg 65440dd5a57Smrg# func_version 65540dd5a57Smrg# Echo version message to standard output and exit. 65640dd5a57Smrgfunc_version () 65740dd5a57Smrg{ 65840dd5a57Smrg $SED -n '/(C)/!b go 65940dd5a57Smrg :more 66040dd5a57Smrg /\./!{ 66140dd5a57Smrg N 66240dd5a57Smrg s/\n# / / 66340dd5a57Smrg b more 66440dd5a57Smrg } 66540dd5a57Smrg :go 66640dd5a57Smrg /^# '$PROGRAM' (GNU /,/# warranty; / { 66740dd5a57Smrg s/^# // 66840dd5a57Smrg s/^# *$// 66940dd5a57Smrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 67040dd5a57Smrg p 67140dd5a57Smrg }' < "$progpath" 67240dd5a57Smrg exit $? 67340dd5a57Smrg} 67440dd5a57Smrg 67540dd5a57Smrg# func_usage 67640dd5a57Smrg# Echo short help message to standard output and exit. 67740dd5a57Smrgfunc_usage () 67840dd5a57Smrg{ 67940dd5a57Smrg $SED -n '/^# Usage:/,/^# *.*--help/ { 68040dd5a57Smrg s/^# // 68140dd5a57Smrg s/^# *$// 68240dd5a57Smrg s/\$progname/'$progname'/ 68340dd5a57Smrg p 68440dd5a57Smrg }' < "$progpath" 68540dd5a57Smrg echo 68640dd5a57Smrg $ECHO "run \`$progname --help | more' for full usage" 68740dd5a57Smrg exit $? 68840dd5a57Smrg} 68940dd5a57Smrg 69040dd5a57Smrg# func_help [NOEXIT] 69140dd5a57Smrg# Echo long help message to standard output and exit, 69240dd5a57Smrg# unless 'noexit' is passed as argument. 69340dd5a57Smrgfunc_help () 69440dd5a57Smrg{ 69540dd5a57Smrg $SED -n '/^# Usage:/,/# Report bugs to/ { 69640dd5a57Smrg s/^# // 69740dd5a57Smrg s/^# *$// 69840dd5a57Smrg s*\$progname*'$progname'* 69940dd5a57Smrg s*\$host*'"$host"'* 70040dd5a57Smrg s*\$SHELL*'"$SHELL"'* 70140dd5a57Smrg s*\$LTCC*'"$LTCC"'* 70240dd5a57Smrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 70340dd5a57Smrg s*\$LD*'"$LD"'* 70440dd5a57Smrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 70540dd5a57Smrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 70640dd5a57Smrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 70740dd5a57Smrg p 70840dd5a57Smrg }' < "$progpath" 70940dd5a57Smrg ret=$? 71040dd5a57Smrg if test -z "$1"; then 71140dd5a57Smrg exit $ret 71240dd5a57Smrg fi 71340dd5a57Smrg} 71440dd5a57Smrg 71540dd5a57Smrg# func_missing_arg argname 71640dd5a57Smrg# Echo program name prefixed message to standard error and set global 71740dd5a57Smrg# exit_cmd. 71840dd5a57Smrgfunc_missing_arg () 71940dd5a57Smrg{ 72040dd5a57Smrg func_error "missing argument for $1." 72140dd5a57Smrg exit_cmd=exit 72240dd5a57Smrg} 72340dd5a57Smrg 72440dd5a57Smrgexit_cmd=: 72540dd5a57Smrg 72640dd5a57Smrg 72740dd5a57Smrg 72840dd5a57Smrg 72940dd5a57Smrg 73040dd5a57Smrg 73140dd5a57Smrgmagic="%%%MAGIC variable%%%" 73240dd5a57Smrgmagic_exe="%%%MAGIC EXE variable%%%" 73340dd5a57Smrg 73440dd5a57Smrg# Global variables. 73540dd5a57Smrg# $mode is unset 73640dd5a57Smrgnonopt= 73740dd5a57Smrgexecute_dlfiles= 73840dd5a57Smrgpreserve_args= 73940dd5a57Smrglo2o="s/\\.lo\$/.${objext}/" 74040dd5a57Smrgo2lo="s/\\.${objext}\$/.lo/" 74140dd5a57Smrgextracted_archives= 74240dd5a57Smrgextracted_serial=0 74340dd5a57Smrg 74440dd5a57Smrgopt_dry_run=false 74540dd5a57Smrgopt_duplicate_deps=false 74640dd5a57Smrgopt_silent=false 74740dd5a57Smrgopt_debug=: 74840dd5a57Smrg 74940dd5a57Smrg# If this variable is set in any of the actions, the command in it 75040dd5a57Smrg# will be execed at the end. This prevents here-documents from being 75140dd5a57Smrg# left over by shells. 75240dd5a57Smrgexec_cmd= 75340dd5a57Smrg 75440dd5a57Smrg# func_fatal_configuration arg... 75540dd5a57Smrg# Echo program name prefixed message to standard error, followed by 75640dd5a57Smrg# a configuration failure hint, and exit. 75740dd5a57Smrgfunc_fatal_configuration () 75840dd5a57Smrg{ 75940dd5a57Smrg func_error ${1+"$@"} 76040dd5a57Smrg func_error "See the $PACKAGE documentation for more information." 76140dd5a57Smrg func_fatal_error "Fatal configuration error." 76240dd5a57Smrg} 76340dd5a57Smrg 76440dd5a57Smrg 76540dd5a57Smrg# func_config 76640dd5a57Smrg# Display the configuration for all the tags in this script. 76740dd5a57Smrgfunc_config () 76840dd5a57Smrg{ 76940dd5a57Smrg re_begincf='^# ### BEGIN LIBTOOL' 77040dd5a57Smrg re_endcf='^# ### END LIBTOOL' 77140dd5a57Smrg 77240dd5a57Smrg # Default configuration. 77340dd5a57Smrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 77440dd5a57Smrg 77540dd5a57Smrg # Now print the configurations for the tags. 77640dd5a57Smrg for tagname in $taglist; do 77740dd5a57Smrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 77840dd5a57Smrg done 77940dd5a57Smrg 78040dd5a57Smrg exit $? 78140dd5a57Smrg} 78240dd5a57Smrg 78340dd5a57Smrg# func_features 78440dd5a57Smrg# Display the features supported by this script. 78540dd5a57Smrgfunc_features () 78640dd5a57Smrg{ 78740dd5a57Smrg echo "host: $host" 78840dd5a57Smrg if test "$build_libtool_libs" = yes; then 78940dd5a57Smrg echo "enable shared libraries" 79040dd5a57Smrg else 79140dd5a57Smrg echo "disable shared libraries" 79240dd5a57Smrg fi 79340dd5a57Smrg if test "$build_old_libs" = yes; then 79440dd5a57Smrg echo "enable static libraries" 79540dd5a57Smrg else 79640dd5a57Smrg echo "disable static libraries" 79740dd5a57Smrg fi 79840dd5a57Smrg 79940dd5a57Smrg exit $? 80040dd5a57Smrg} 80140dd5a57Smrg 80240dd5a57Smrg# func_enable_tag tagname 80340dd5a57Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or 80440dd5a57Smrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 80540dd5a57Smrg# variable here. 80640dd5a57Smrgfunc_enable_tag () 80740dd5a57Smrg{ 80840dd5a57Smrg # Global variable: 80940dd5a57Smrg tagname="$1" 81040dd5a57Smrg 81140dd5a57Smrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 81240dd5a57Smrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 81340dd5a57Smrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 81440dd5a57Smrg 81540dd5a57Smrg # Validate tagname. 81640dd5a57Smrg case $tagname in 81740dd5a57Smrg *[!-_A-Za-z0-9,/]*) 81840dd5a57Smrg func_fatal_error "invalid tag name: $tagname" 81940dd5a57Smrg ;; 82040dd5a57Smrg esac 82140dd5a57Smrg 82240dd5a57Smrg # Don't test for the "default" C tag, as we know it's 82340dd5a57Smrg # there but not specially marked. 82440dd5a57Smrg case $tagname in 82540dd5a57Smrg CC) ;; 82640dd5a57Smrg *) 82740dd5a57Smrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 82840dd5a57Smrg taglist="$taglist $tagname" 82940dd5a57Smrg 83040dd5a57Smrg # Evaluate the configuration. Be careful to quote the path 83140dd5a57Smrg # and the sed script, to avoid splitting on whitespace, but 83240dd5a57Smrg # also don't use non-portable quotes within backquotes within 83340dd5a57Smrg # quotes we have to do it in 2 steps: 83440dd5a57Smrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 83540dd5a57Smrg eval "$extractedcf" 83640dd5a57Smrg else 83740dd5a57Smrg func_error "ignoring unknown tag $tagname" 83840dd5a57Smrg fi 83940dd5a57Smrg ;; 84040dd5a57Smrg esac 84140dd5a57Smrg} 84240dd5a57Smrg 84340dd5a57Smrg# Parse options once, thoroughly. This comes as soon as possible in 84440dd5a57Smrg# the script to make things like `libtool --version' happen quickly. 84540dd5a57Smrg{ 84640dd5a57Smrg 84740dd5a57Smrg # Shorthand for --mode=foo, only valid as the first argument 84840dd5a57Smrg case $1 in 84940dd5a57Smrg clean|clea|cle|cl) 85040dd5a57Smrg shift; set dummy --mode clean ${1+"$@"}; shift 85140dd5a57Smrg ;; 85240dd5a57Smrg compile|compil|compi|comp|com|co|c) 85340dd5a57Smrg shift; set dummy --mode compile ${1+"$@"}; shift 85440dd5a57Smrg ;; 85540dd5a57Smrg execute|execut|execu|exec|exe|ex|e) 85640dd5a57Smrg shift; set dummy --mode execute ${1+"$@"}; shift 85740dd5a57Smrg ;; 85840dd5a57Smrg finish|finis|fini|fin|fi|f) 85940dd5a57Smrg shift; set dummy --mode finish ${1+"$@"}; shift 86040dd5a57Smrg ;; 86140dd5a57Smrg install|instal|insta|inst|ins|in|i) 86240dd5a57Smrg shift; set dummy --mode install ${1+"$@"}; shift 86340dd5a57Smrg ;; 86440dd5a57Smrg link|lin|li|l) 86540dd5a57Smrg shift; set dummy --mode link ${1+"$@"}; shift 86640dd5a57Smrg ;; 86740dd5a57Smrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 86840dd5a57Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 86940dd5a57Smrg ;; 87040dd5a57Smrg esac 87140dd5a57Smrg 87240dd5a57Smrg # Parse non-mode specific arguments: 87340dd5a57Smrg while test "$#" -gt 0; do 87440dd5a57Smrg opt="$1" 87540dd5a57Smrg shift 87640dd5a57Smrg 87740dd5a57Smrg case $opt in 87840dd5a57Smrg --config) func_config ;; 87940dd5a57Smrg 88040dd5a57Smrg --debug) preserve_args="$preserve_args $opt" 88140dd5a57Smrg func_echo "enabling shell trace mode" 88240dd5a57Smrg opt_debug='set -x' 88340dd5a57Smrg $opt_debug 88440dd5a57Smrg ;; 88540dd5a57Smrg 88640dd5a57Smrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 88740dd5a57Smrg execute_dlfiles="$execute_dlfiles $1" 88840dd5a57Smrg shift 88940dd5a57Smrg ;; 89040dd5a57Smrg 89140dd5a57Smrg --dry-run | -n) opt_dry_run=: ;; 89240dd5a57Smrg --features) func_features ;; 89340dd5a57Smrg --finish) mode="finish" ;; 89440dd5a57Smrg 89540dd5a57Smrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 89640dd5a57Smrg case $1 in 89740dd5a57Smrg # Valid mode arguments: 89840dd5a57Smrg clean) ;; 89940dd5a57Smrg compile) ;; 90040dd5a57Smrg execute) ;; 90140dd5a57Smrg finish) ;; 90240dd5a57Smrg install) ;; 90340dd5a57Smrg link) ;; 90440dd5a57Smrg relink) ;; 90540dd5a57Smrg uninstall) ;; 90640dd5a57Smrg 90740dd5a57Smrg # Catch anything else as an error 90840dd5a57Smrg *) func_error "invalid argument for $opt" 90940dd5a57Smrg exit_cmd=exit 91040dd5a57Smrg break 91140dd5a57Smrg ;; 91240dd5a57Smrg esac 91340dd5a57Smrg 91440dd5a57Smrg mode="$1" 91540dd5a57Smrg shift 91640dd5a57Smrg ;; 91740dd5a57Smrg 91840dd5a57Smrg --preserve-dup-deps) 91940dd5a57Smrg opt_duplicate_deps=: ;; 92040dd5a57Smrg 92140dd5a57Smrg --quiet|--silent) preserve_args="$preserve_args $opt" 92240dd5a57Smrg opt_silent=: 92340dd5a57Smrg opt_verbose=false 92440dd5a57Smrg ;; 92540dd5a57Smrg 92640dd5a57Smrg --no-quiet|--no-silent) 92740dd5a57Smrg preserve_args="$preserve_args $opt" 92840dd5a57Smrg opt_silent=false 92940dd5a57Smrg ;; 93040dd5a57Smrg 93140dd5a57Smrg --verbose| -v) preserve_args="$preserve_args $opt" 93240dd5a57Smrg opt_silent=false 93340dd5a57Smrg opt_verbose=: 93440dd5a57Smrg ;; 93540dd5a57Smrg 93640dd5a57Smrg --no-verbose) preserve_args="$preserve_args $opt" 93740dd5a57Smrg opt_verbose=false 93840dd5a57Smrg ;; 93940dd5a57Smrg 94040dd5a57Smrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 94140dd5a57Smrg preserve_args="$preserve_args $opt $1" 94240dd5a57Smrg func_enable_tag "$1" # tagname is set here 94340dd5a57Smrg shift 94440dd5a57Smrg ;; 94540dd5a57Smrg 94640dd5a57Smrg # Separate optargs to long options: 94740dd5a57Smrg -dlopen=*|--mode=*|--tag=*) 94840dd5a57Smrg func_opt_split "$opt" 94940dd5a57Smrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 95040dd5a57Smrg shift 95140dd5a57Smrg ;; 95240dd5a57Smrg 95340dd5a57Smrg -\?|-h) func_usage ;; 95440dd5a57Smrg --help) opt_help=: ;; 95540dd5a57Smrg --help-all) opt_help=': help-all' ;; 95640dd5a57Smrg --version) func_version ;; 95740dd5a57Smrg 95840dd5a57Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 95940dd5a57Smrg 96040dd5a57Smrg *) nonopt="$opt" 96140dd5a57Smrg break 96240dd5a57Smrg ;; 96340dd5a57Smrg esac 96440dd5a57Smrg done 96540dd5a57Smrg 96640dd5a57Smrg 96740dd5a57Smrg case $host in 96840dd5a57Smrg *cygwin* | *mingw* | *pw32* | *cegcc*) 96940dd5a57Smrg # don't eliminate duplications in $postdeps and $predeps 97040dd5a57Smrg opt_duplicate_compiler_generated_deps=: 97140dd5a57Smrg ;; 97240dd5a57Smrg *) 97340dd5a57Smrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 97440dd5a57Smrg ;; 97540dd5a57Smrg esac 97640dd5a57Smrg 97740dd5a57Smrg # Having warned about all mis-specified options, bail out if 97840dd5a57Smrg # anything was wrong. 97940dd5a57Smrg $exit_cmd $EXIT_FAILURE 98040dd5a57Smrg} 98140dd5a57Smrg 98240dd5a57Smrg# func_check_version_match 98340dd5a57Smrg# Ensure that we are using m4 macros, and libtool script from the same 98440dd5a57Smrg# release of libtool. 98540dd5a57Smrgfunc_check_version_match () 98640dd5a57Smrg{ 98740dd5a57Smrg if test "$package_revision" != "$macro_revision"; then 98840dd5a57Smrg if test "$VERSION" != "$macro_version"; then 98940dd5a57Smrg if test -z "$macro_version"; then 99040dd5a57Smrg cat >&2 <<_LT_EOF 99140dd5a57Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99240dd5a57Smrg$progname: definition of this LT_INIT comes from an older release. 99340dd5a57Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 99440dd5a57Smrg$progname: and run autoconf again. 99540dd5a57Smrg_LT_EOF 99640dd5a57Smrg else 99740dd5a57Smrg cat >&2 <<_LT_EOF 99840dd5a57Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99940dd5a57Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 100040dd5a57Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 100140dd5a57Smrg$progname: and run autoconf again. 100240dd5a57Smrg_LT_EOF 100340dd5a57Smrg fi 100440dd5a57Smrg else 100540dd5a57Smrg cat >&2 <<_LT_EOF 100640dd5a57Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 100740dd5a57Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 100840dd5a57Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 100940dd5a57Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 101040dd5a57Smrg_LT_EOF 101140dd5a57Smrg fi 101240dd5a57Smrg 101340dd5a57Smrg exit $EXIT_MISMATCH 101440dd5a57Smrg fi 101540dd5a57Smrg} 101640dd5a57Smrg 101740dd5a57Smrg 101840dd5a57Smrg## ----------- ## 101940dd5a57Smrg## Main. ## 102040dd5a57Smrg## ----------- ## 102140dd5a57Smrg 102240dd5a57Smrg$opt_help || { 102340dd5a57Smrg # Sanity checks first: 102440dd5a57Smrg func_check_version_match 102540dd5a57Smrg 102640dd5a57Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 102740dd5a57Smrg func_fatal_configuration "not configured to build any kind of library" 102840dd5a57Smrg fi 102940dd5a57Smrg 103040dd5a57Smrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 103140dd5a57Smrg 103240dd5a57Smrg 103340dd5a57Smrg # Darwin sucks 103440dd5a57Smrg eval std_shrext=\"$shrext_cmds\" 103540dd5a57Smrg 103640dd5a57Smrg 103740dd5a57Smrg # Only execute mode is allowed to have -dlopen flags. 103840dd5a57Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 103940dd5a57Smrg func_error "unrecognized option \`-dlopen'" 104040dd5a57Smrg $ECHO "$help" 1>&2 104140dd5a57Smrg exit $EXIT_FAILURE 104240dd5a57Smrg fi 104340dd5a57Smrg 104440dd5a57Smrg # Change the help message to a mode-specific one. 104540dd5a57Smrg generic_help="$help" 104640dd5a57Smrg help="Try \`$progname --help --mode=$mode' for more information." 104740dd5a57Smrg} 104840dd5a57Smrg 104940dd5a57Smrg 105040dd5a57Smrg# func_lalib_p file 105140dd5a57Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 105240dd5a57Smrg# This function is only a basic sanity check; it will hardly flush out 105340dd5a57Smrg# determined imposters. 105440dd5a57Smrgfunc_lalib_p () 105540dd5a57Smrg{ 105640dd5a57Smrg test -f "$1" && 105740dd5a57Smrg $SED -e 4q "$1" 2>/dev/null \ 105840dd5a57Smrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 105940dd5a57Smrg} 106040dd5a57Smrg 106140dd5a57Smrg# func_lalib_unsafe_p file 106240dd5a57Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 106340dd5a57Smrg# This function implements the same check as func_lalib_p without 106440dd5a57Smrg# resorting to external programs. To this end, it redirects stdin and 106540dd5a57Smrg# closes it afterwards, without saving the original file descriptor. 106640dd5a57Smrg# As a safety measure, use it only where a negative result would be 106740dd5a57Smrg# fatal anyway. Works if `file' does not exist. 106840dd5a57Smrgfunc_lalib_unsafe_p () 106940dd5a57Smrg{ 107040dd5a57Smrg lalib_p=no 107140dd5a57Smrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 107240dd5a57Smrg for lalib_p_l in 1 2 3 4 107340dd5a57Smrg do 107440dd5a57Smrg read lalib_p_line 107540dd5a57Smrg case "$lalib_p_line" in 107640dd5a57Smrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 107740dd5a57Smrg esac 107840dd5a57Smrg done 107940dd5a57Smrg exec 0<&5 5<&- 108040dd5a57Smrg fi 108140dd5a57Smrg test "$lalib_p" = yes 108240dd5a57Smrg} 108340dd5a57Smrg 108440dd5a57Smrg# func_ltwrapper_script_p file 108540dd5a57Smrg# True iff FILE is a libtool wrapper script 108640dd5a57Smrg# This function is only a basic sanity check; it will hardly flush out 108740dd5a57Smrg# determined imposters. 108840dd5a57Smrgfunc_ltwrapper_script_p () 108940dd5a57Smrg{ 109040dd5a57Smrg func_lalib_p "$1" 109140dd5a57Smrg} 109240dd5a57Smrg 109340dd5a57Smrg# func_ltwrapper_executable_p file 109440dd5a57Smrg# True iff FILE is a libtool wrapper executable 109540dd5a57Smrg# This function is only a basic sanity check; it will hardly flush out 109640dd5a57Smrg# determined imposters. 109740dd5a57Smrgfunc_ltwrapper_executable_p () 109840dd5a57Smrg{ 109940dd5a57Smrg func_ltwrapper_exec_suffix= 110040dd5a57Smrg case $1 in 110140dd5a57Smrg *.exe) ;; 110240dd5a57Smrg *) func_ltwrapper_exec_suffix=.exe ;; 110340dd5a57Smrg esac 110440dd5a57Smrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 110540dd5a57Smrg} 110640dd5a57Smrg 110740dd5a57Smrg# func_ltwrapper_scriptname file 110840dd5a57Smrg# Assumes file is an ltwrapper_executable 110940dd5a57Smrg# uses $file to determine the appropriate filename for a 111040dd5a57Smrg# temporary ltwrapper_script. 111140dd5a57Smrgfunc_ltwrapper_scriptname () 111240dd5a57Smrg{ 111340dd5a57Smrg func_ltwrapper_scriptname_result="" 111440dd5a57Smrg if func_ltwrapper_executable_p "$1"; then 111540dd5a57Smrg func_dirname_and_basename "$1" "" "." 111640dd5a57Smrg func_stripname '' '.exe' "$func_basename_result" 111740dd5a57Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 111840dd5a57Smrg fi 111940dd5a57Smrg} 112040dd5a57Smrg 112140dd5a57Smrg# func_ltwrapper_p file 112240dd5a57Smrg# True iff FILE is a libtool wrapper script or wrapper executable 112340dd5a57Smrg# This function is only a basic sanity check; it will hardly flush out 112440dd5a57Smrg# determined imposters. 112540dd5a57Smrgfunc_ltwrapper_p () 112640dd5a57Smrg{ 112740dd5a57Smrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 112840dd5a57Smrg} 112940dd5a57Smrg 113040dd5a57Smrg 113140dd5a57Smrg# func_execute_cmds commands fail_cmd 113240dd5a57Smrg# Execute tilde-delimited COMMANDS. 113340dd5a57Smrg# If FAIL_CMD is given, eval that upon failure. 113440dd5a57Smrg# FAIL_CMD may read-access the current command in variable CMD! 113540dd5a57Smrgfunc_execute_cmds () 113640dd5a57Smrg{ 113740dd5a57Smrg $opt_debug 113840dd5a57Smrg save_ifs=$IFS; IFS='~' 113940dd5a57Smrg for cmd in $1; do 114040dd5a57Smrg IFS=$save_ifs 114140dd5a57Smrg eval cmd=\"$cmd\" 114240dd5a57Smrg func_show_eval "$cmd" "${2-:}" 114340dd5a57Smrg done 114440dd5a57Smrg IFS=$save_ifs 114540dd5a57Smrg} 114640dd5a57Smrg 114740dd5a57Smrg 114840dd5a57Smrg# func_source file 114940dd5a57Smrg# Source FILE, adding directory component if necessary. 115040dd5a57Smrg# Note that it is not necessary on cygwin/mingw to append a dot to 115140dd5a57Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 115240dd5a57Smrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 115340dd5a57Smrg# `FILE.' does not work on cygwin managed mounts. 115440dd5a57Smrgfunc_source () 115540dd5a57Smrg{ 115640dd5a57Smrg $opt_debug 115740dd5a57Smrg case $1 in 115840dd5a57Smrg */* | *\\*) . "$1" ;; 115940dd5a57Smrg *) . "./$1" ;; 116040dd5a57Smrg esac 116140dd5a57Smrg} 116240dd5a57Smrg 116340dd5a57Smrg 116440dd5a57Smrg# func_infer_tag arg 116540dd5a57Smrg# Infer tagged configuration to use if any are available and 116640dd5a57Smrg# if one wasn't chosen via the "--tag" command line option. 116740dd5a57Smrg# Only attempt this if the compiler in the base compile 116840dd5a57Smrg# command doesn't match the default compiler. 116940dd5a57Smrg# arg is usually of the form 'gcc ...' 117040dd5a57Smrgfunc_infer_tag () 117140dd5a57Smrg{ 117240dd5a57Smrg $opt_debug 117340dd5a57Smrg if test -n "$available_tags" && test -z "$tagname"; then 117440dd5a57Smrg CC_quoted= 117540dd5a57Smrg for arg in $CC; do 117640dd5a57Smrg func_quote_for_eval "$arg" 117740dd5a57Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 117840dd5a57Smrg done 117940dd5a57Smrg CC_expanded=`func_echo_all $CC` 118040dd5a57Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 118140dd5a57Smrg case $@ in 118240dd5a57Smrg # Blanks in the command may have been stripped by the calling shell, 118340dd5a57Smrg # but not from the CC environment variable when configure was run. 118440dd5a57Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 118540dd5a57Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 118640dd5a57Smrg # Blanks at the start of $base_compile will cause this to fail 118740dd5a57Smrg # if we don't check for them as well. 118840dd5a57Smrg *) 118940dd5a57Smrg for z in $available_tags; do 119040dd5a57Smrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 119140dd5a57Smrg # Evaluate the configuration. 119240dd5a57Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 119340dd5a57Smrg CC_quoted= 119440dd5a57Smrg for arg in $CC; do 119540dd5a57Smrg # Double-quote args containing other shell metacharacters. 119640dd5a57Smrg func_quote_for_eval "$arg" 119740dd5a57Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 119840dd5a57Smrg done 119940dd5a57Smrg CC_expanded=`func_echo_all $CC` 120040dd5a57Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 120140dd5a57Smrg case "$@ " in 120240dd5a57Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 120340dd5a57Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 120440dd5a57Smrg # The compiler in the base compile command matches 120540dd5a57Smrg # the one in the tagged configuration. 120640dd5a57Smrg # Assume this is the tagged configuration we want. 120740dd5a57Smrg tagname=$z 120840dd5a57Smrg break 120940dd5a57Smrg ;; 121040dd5a57Smrg esac 121140dd5a57Smrg fi 121240dd5a57Smrg done 121340dd5a57Smrg # If $tagname still isn't set, then no tagged configuration 121440dd5a57Smrg # was found and let the user know that the "--tag" command 121540dd5a57Smrg # line option must be used. 121640dd5a57Smrg if test -z "$tagname"; then 121740dd5a57Smrg func_echo "unable to infer tagged configuration" 121840dd5a57Smrg func_fatal_error "specify a tag with \`--tag'" 121940dd5a57Smrg# else 122040dd5a57Smrg# func_verbose "using $tagname tagged configuration" 122140dd5a57Smrg fi 122240dd5a57Smrg ;; 122340dd5a57Smrg esac 122440dd5a57Smrg fi 122540dd5a57Smrg} 122640dd5a57Smrg 122740dd5a57Smrg 122840dd5a57Smrg 122940dd5a57Smrg# func_write_libtool_object output_name pic_name nonpic_name 123040dd5a57Smrg# Create a libtool object file (analogous to a ".la" file), 123140dd5a57Smrg# but don't create it if we're doing a dry run. 123240dd5a57Smrgfunc_write_libtool_object () 123340dd5a57Smrg{ 123440dd5a57Smrg write_libobj=${1} 123540dd5a57Smrg if test "$build_libtool_libs" = yes; then 123640dd5a57Smrg write_lobj=\'${2}\' 123740dd5a57Smrg else 123840dd5a57Smrg write_lobj=none 123940dd5a57Smrg fi 124040dd5a57Smrg 124140dd5a57Smrg if test "$build_old_libs" = yes; then 124240dd5a57Smrg write_oldobj=\'${3}\' 124340dd5a57Smrg else 124440dd5a57Smrg write_oldobj=none 124540dd5a57Smrg fi 124640dd5a57Smrg 124740dd5a57Smrg $opt_dry_run || { 124840dd5a57Smrg cat >${write_libobj}T <<EOF 124940dd5a57Smrg# $write_libobj - a libtool object file 125040dd5a57Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 125140dd5a57Smrg# 125240dd5a57Smrg# Please DO NOT delete this file! 125340dd5a57Smrg# It is necessary for linking the library. 125440dd5a57Smrg 125540dd5a57Smrg# Name of the PIC object. 125640dd5a57Smrgpic_object=$write_lobj 125740dd5a57Smrg 125840dd5a57Smrg# Name of the non-PIC object 125940dd5a57Smrgnon_pic_object=$write_oldobj 126040dd5a57Smrg 126140dd5a57SmrgEOF 126240dd5a57Smrg $MV "${write_libobj}T" "${write_libobj}" 126340dd5a57Smrg } 126440dd5a57Smrg} 126540dd5a57Smrg 126640dd5a57Smrg# func_mode_compile arg... 126740dd5a57Smrgfunc_mode_compile () 126840dd5a57Smrg{ 126940dd5a57Smrg $opt_debug 127040dd5a57Smrg # Get the compilation command and the source file. 127140dd5a57Smrg base_compile= 127240dd5a57Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 127340dd5a57Smrg suppress_opt=yes 127440dd5a57Smrg suppress_output= 127540dd5a57Smrg arg_mode=normal 127640dd5a57Smrg libobj= 127740dd5a57Smrg later= 127840dd5a57Smrg pie_flag= 127940dd5a57Smrg 128040dd5a57Smrg for arg 128140dd5a57Smrg do 128240dd5a57Smrg case $arg_mode in 128340dd5a57Smrg arg ) 128440dd5a57Smrg # do not "continue". Instead, add this to base_compile 128540dd5a57Smrg lastarg="$arg" 128640dd5a57Smrg arg_mode=normal 128740dd5a57Smrg ;; 128840dd5a57Smrg 128940dd5a57Smrg target ) 129040dd5a57Smrg libobj="$arg" 129140dd5a57Smrg arg_mode=normal 129240dd5a57Smrg continue 129340dd5a57Smrg ;; 129440dd5a57Smrg 129540dd5a57Smrg normal ) 129640dd5a57Smrg # Accept any command-line options. 129740dd5a57Smrg case $arg in 129840dd5a57Smrg -o) 129940dd5a57Smrg test -n "$libobj" && \ 130040dd5a57Smrg func_fatal_error "you cannot specify \`-o' more than once" 130140dd5a57Smrg arg_mode=target 130240dd5a57Smrg continue 130340dd5a57Smrg ;; 130440dd5a57Smrg 130540dd5a57Smrg -pie | -fpie | -fPIE) 130640dd5a57Smrg pie_flag="$pie_flag $arg" 130740dd5a57Smrg continue 130840dd5a57Smrg ;; 130940dd5a57Smrg 131040dd5a57Smrg -shared | -static | -prefer-pic | -prefer-non-pic) 131140dd5a57Smrg later="$later $arg" 131240dd5a57Smrg continue 131340dd5a57Smrg ;; 131440dd5a57Smrg 131540dd5a57Smrg -no-suppress) 131640dd5a57Smrg suppress_opt=no 131740dd5a57Smrg continue 131840dd5a57Smrg ;; 131940dd5a57Smrg 132040dd5a57Smrg -Xcompiler) 132140dd5a57Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 132240dd5a57Smrg continue # The current "srcfile" will either be retained or 132340dd5a57Smrg ;; # replaced later. I would guess that would be a bug. 132440dd5a57Smrg 132540dd5a57Smrg -Wc,*) 132640dd5a57Smrg func_stripname '-Wc,' '' "$arg" 132740dd5a57Smrg args=$func_stripname_result 132840dd5a57Smrg lastarg= 132940dd5a57Smrg save_ifs="$IFS"; IFS=',' 133040dd5a57Smrg for arg in $args; do 133140dd5a57Smrg IFS="$save_ifs" 133240dd5a57Smrg func_quote_for_eval "$arg" 133340dd5a57Smrg lastarg="$lastarg $func_quote_for_eval_result" 133440dd5a57Smrg done 133540dd5a57Smrg IFS="$save_ifs" 133640dd5a57Smrg func_stripname ' ' '' "$lastarg" 133740dd5a57Smrg lastarg=$func_stripname_result 133840dd5a57Smrg 133940dd5a57Smrg # Add the arguments to base_compile. 134040dd5a57Smrg base_compile="$base_compile $lastarg" 134140dd5a57Smrg continue 134240dd5a57Smrg ;; 134340dd5a57Smrg 134440dd5a57Smrg *) 134540dd5a57Smrg # Accept the current argument as the source file. 134640dd5a57Smrg # The previous "srcfile" becomes the current argument. 134740dd5a57Smrg # 134840dd5a57Smrg lastarg="$srcfile" 134940dd5a57Smrg srcfile="$arg" 135040dd5a57Smrg ;; 135140dd5a57Smrg esac # case $arg 135240dd5a57Smrg ;; 135340dd5a57Smrg esac # case $arg_mode 135440dd5a57Smrg 135540dd5a57Smrg # Aesthetically quote the previous argument. 135640dd5a57Smrg func_quote_for_eval "$lastarg" 135740dd5a57Smrg base_compile="$base_compile $func_quote_for_eval_result" 135840dd5a57Smrg done # for arg 135940dd5a57Smrg 136040dd5a57Smrg case $arg_mode in 136140dd5a57Smrg arg) 136240dd5a57Smrg func_fatal_error "you must specify an argument for -Xcompile" 136340dd5a57Smrg ;; 136440dd5a57Smrg target) 136540dd5a57Smrg func_fatal_error "you must specify a target with \`-o'" 136640dd5a57Smrg ;; 136740dd5a57Smrg *) 136840dd5a57Smrg # Get the name of the library object. 136940dd5a57Smrg test -z "$libobj" && { 137040dd5a57Smrg func_basename "$srcfile" 137140dd5a57Smrg libobj="$func_basename_result" 137240dd5a57Smrg } 137340dd5a57Smrg ;; 137440dd5a57Smrg esac 137540dd5a57Smrg 137640dd5a57Smrg # Recognize several different file suffixes. 137740dd5a57Smrg # If the user specifies -o file.o, it is replaced with file.lo 137840dd5a57Smrg case $libobj in 137940dd5a57Smrg *.[cCFSifmso] | \ 138040dd5a57Smrg *.ada | *.adb | *.ads | *.asm | \ 138140dd5a57Smrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 138240dd5a57Smrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 138340dd5a57Smrg func_xform "$libobj" 138440dd5a57Smrg libobj=$func_xform_result 138540dd5a57Smrg ;; 138640dd5a57Smrg esac 138740dd5a57Smrg 138840dd5a57Smrg case $libobj in 138940dd5a57Smrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 139040dd5a57Smrg *) 139140dd5a57Smrg func_fatal_error "cannot determine name of library object from \`$libobj'" 139240dd5a57Smrg ;; 139340dd5a57Smrg esac 139440dd5a57Smrg 139540dd5a57Smrg func_infer_tag $base_compile 139640dd5a57Smrg 139740dd5a57Smrg for arg in $later; do 139840dd5a57Smrg case $arg in 139940dd5a57Smrg -shared) 140040dd5a57Smrg test "$build_libtool_libs" != yes && \ 140140dd5a57Smrg func_fatal_configuration "can not build a shared library" 140240dd5a57Smrg build_old_libs=no 140340dd5a57Smrg continue 140440dd5a57Smrg ;; 140540dd5a57Smrg 140640dd5a57Smrg -static) 140740dd5a57Smrg build_libtool_libs=no 140840dd5a57Smrg build_old_libs=yes 140940dd5a57Smrg continue 141040dd5a57Smrg ;; 141140dd5a57Smrg 141240dd5a57Smrg -prefer-pic) 141340dd5a57Smrg pic_mode=yes 141440dd5a57Smrg continue 141540dd5a57Smrg ;; 141640dd5a57Smrg 141740dd5a57Smrg -prefer-non-pic) 141840dd5a57Smrg pic_mode=no 141940dd5a57Smrg continue 142040dd5a57Smrg ;; 142140dd5a57Smrg esac 142240dd5a57Smrg done 142340dd5a57Smrg 142440dd5a57Smrg func_quote_for_eval "$libobj" 142540dd5a57Smrg test "X$libobj" != "X$func_quote_for_eval_result" \ 142640dd5a57Smrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 142740dd5a57Smrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 142840dd5a57Smrg func_dirname_and_basename "$obj" "/" "" 142940dd5a57Smrg objname="$func_basename_result" 143040dd5a57Smrg xdir="$func_dirname_result" 143140dd5a57Smrg lobj=${xdir}$objdir/$objname 143240dd5a57Smrg 143340dd5a57Smrg test -z "$base_compile" && \ 143440dd5a57Smrg func_fatal_help "you must specify a compilation command" 143540dd5a57Smrg 143640dd5a57Smrg # Delete any leftover library objects. 143740dd5a57Smrg if test "$build_old_libs" = yes; then 143840dd5a57Smrg removelist="$obj $lobj $libobj ${libobj}T" 143940dd5a57Smrg else 144040dd5a57Smrg removelist="$lobj $libobj ${libobj}T" 144140dd5a57Smrg fi 144240dd5a57Smrg 144340dd5a57Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 144440dd5a57Smrg case $host_os in 144540dd5a57Smrg cygwin* | mingw* | pw32* | os2* | cegcc*) 144640dd5a57Smrg pic_mode=default 144740dd5a57Smrg ;; 144840dd5a57Smrg esac 144940dd5a57Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 145040dd5a57Smrg # non-PIC code in shared libraries is not supported 145140dd5a57Smrg pic_mode=default 145240dd5a57Smrg fi 145340dd5a57Smrg 145440dd5a57Smrg # Calculate the filename of the output object if compiler does 145540dd5a57Smrg # not support -o with -c 145640dd5a57Smrg if test "$compiler_c_o" = no; then 145740dd5a57Smrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 145840dd5a57Smrg lockfile="$output_obj.lock" 145940dd5a57Smrg else 146040dd5a57Smrg output_obj= 146140dd5a57Smrg need_locks=no 146240dd5a57Smrg lockfile= 146340dd5a57Smrg fi 146440dd5a57Smrg 146540dd5a57Smrg # Lock this critical section if it is needed 146640dd5a57Smrg # We use this script file to make the link, it avoids creating a new file 146740dd5a57Smrg if test "$need_locks" = yes; then 146840dd5a57Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 146940dd5a57Smrg func_echo "Waiting for $lockfile to be removed" 147040dd5a57Smrg sleep 2 147140dd5a57Smrg done 147240dd5a57Smrg elif test "$need_locks" = warn; then 147340dd5a57Smrg if test -f "$lockfile"; then 147440dd5a57Smrg $ECHO "\ 147540dd5a57Smrg*** ERROR, $lockfile exists and contains: 147640dd5a57Smrg`cat $lockfile 2>/dev/null` 147740dd5a57Smrg 147840dd5a57SmrgThis indicates that another process is trying to use the same 147940dd5a57Smrgtemporary object file, and libtool could not work around it because 148040dd5a57Smrgyour compiler does not support \`-c' and \`-o' together. If you 148140dd5a57Smrgrepeat this compilation, it may succeed, by chance, but you had better 148240dd5a57Smrgavoid parallel builds (make -j) in this platform, or get a better 148340dd5a57Smrgcompiler." 148440dd5a57Smrg 148540dd5a57Smrg $opt_dry_run || $RM $removelist 148640dd5a57Smrg exit $EXIT_FAILURE 148740dd5a57Smrg fi 148840dd5a57Smrg removelist="$removelist $output_obj" 148940dd5a57Smrg $ECHO "$srcfile" > "$lockfile" 149040dd5a57Smrg fi 149140dd5a57Smrg 149240dd5a57Smrg $opt_dry_run || $RM $removelist 149340dd5a57Smrg removelist="$removelist $lockfile" 149440dd5a57Smrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 149540dd5a57Smrg 149640dd5a57Smrg if test -n "$fix_srcfile_path"; then 149740dd5a57Smrg eval srcfile=\"$fix_srcfile_path\" 149840dd5a57Smrg fi 149940dd5a57Smrg func_quote_for_eval "$srcfile" 150040dd5a57Smrg qsrcfile=$func_quote_for_eval_result 150140dd5a57Smrg 150240dd5a57Smrg # Only build a PIC object if we are building libtool libraries. 150340dd5a57Smrg if test "$build_libtool_libs" = yes; then 150440dd5a57Smrg # Without this assignment, base_compile gets emptied. 150540dd5a57Smrg fbsd_hideous_sh_bug=$base_compile 150640dd5a57Smrg 150740dd5a57Smrg if test "$pic_mode" != no; then 150840dd5a57Smrg command="$base_compile $qsrcfile $pic_flag" 150940dd5a57Smrg else 151040dd5a57Smrg # Don't build PIC code 151140dd5a57Smrg command="$base_compile $qsrcfile" 151240dd5a57Smrg fi 151340dd5a57Smrg 151440dd5a57Smrg func_mkdir_p "$xdir$objdir" 151540dd5a57Smrg 151640dd5a57Smrg if test -z "$output_obj"; then 151740dd5a57Smrg # Place PIC objects in $objdir 151840dd5a57Smrg command="$command -o $lobj" 151940dd5a57Smrg fi 152040dd5a57Smrg 152140dd5a57Smrg func_show_eval_locale "$command" \ 152240dd5a57Smrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 152340dd5a57Smrg 152440dd5a57Smrg if test "$need_locks" = warn && 152540dd5a57Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 152640dd5a57Smrg $ECHO "\ 152740dd5a57Smrg*** ERROR, $lockfile contains: 152840dd5a57Smrg`cat $lockfile 2>/dev/null` 152940dd5a57Smrg 153040dd5a57Smrgbut it should contain: 153140dd5a57Smrg$srcfile 153240dd5a57Smrg 153340dd5a57SmrgThis indicates that another process is trying to use the same 153440dd5a57Smrgtemporary object file, and libtool could not work around it because 153540dd5a57Smrgyour compiler does not support \`-c' and \`-o' together. If you 153640dd5a57Smrgrepeat this compilation, it may succeed, by chance, but you had better 153740dd5a57Smrgavoid parallel builds (make -j) in this platform, or get a better 153840dd5a57Smrgcompiler." 153940dd5a57Smrg 154040dd5a57Smrg $opt_dry_run || $RM $removelist 154140dd5a57Smrg exit $EXIT_FAILURE 154240dd5a57Smrg fi 154340dd5a57Smrg 154440dd5a57Smrg # Just move the object if needed, then go on to compile the next one 154540dd5a57Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 154640dd5a57Smrg func_show_eval '$MV "$output_obj" "$lobj"' \ 154740dd5a57Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 154840dd5a57Smrg fi 154940dd5a57Smrg 155040dd5a57Smrg # Allow error messages only from the first compilation. 155140dd5a57Smrg if test "$suppress_opt" = yes; then 155240dd5a57Smrg suppress_output=' >/dev/null 2>&1' 155340dd5a57Smrg fi 155440dd5a57Smrg fi 155540dd5a57Smrg 155640dd5a57Smrg # Only build a position-dependent object if we build old libraries. 155740dd5a57Smrg if test "$build_old_libs" = yes; then 155840dd5a57Smrg if test "$pic_mode" != yes; then 155940dd5a57Smrg # Don't build PIC code 156040dd5a57Smrg command="$base_compile $qsrcfile$pie_flag" 156140dd5a57Smrg else 156240dd5a57Smrg command="$base_compile $qsrcfile $pic_flag" 156340dd5a57Smrg fi 156440dd5a57Smrg if test "$compiler_c_o" = yes; then 156540dd5a57Smrg command="$command -o $obj" 156640dd5a57Smrg fi 156740dd5a57Smrg 156840dd5a57Smrg # Suppress compiler output if we already did a PIC compilation. 156940dd5a57Smrg command="$command$suppress_output" 157040dd5a57Smrg func_show_eval_locale "$command" \ 157140dd5a57Smrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 157240dd5a57Smrg 157340dd5a57Smrg if test "$need_locks" = warn && 157440dd5a57Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 157540dd5a57Smrg $ECHO "\ 157640dd5a57Smrg*** ERROR, $lockfile contains: 157740dd5a57Smrg`cat $lockfile 2>/dev/null` 157840dd5a57Smrg 157940dd5a57Smrgbut it should contain: 158040dd5a57Smrg$srcfile 158140dd5a57Smrg 158240dd5a57SmrgThis indicates that another process is trying to use the same 158340dd5a57Smrgtemporary object file, and libtool could not work around it because 158440dd5a57Smrgyour compiler does not support \`-c' and \`-o' together. If you 158540dd5a57Smrgrepeat this compilation, it may succeed, by chance, but you had better 158640dd5a57Smrgavoid parallel builds (make -j) in this platform, or get a better 158740dd5a57Smrgcompiler." 158840dd5a57Smrg 158940dd5a57Smrg $opt_dry_run || $RM $removelist 159040dd5a57Smrg exit $EXIT_FAILURE 159140dd5a57Smrg fi 159240dd5a57Smrg 159340dd5a57Smrg # Just move the object if needed 159440dd5a57Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 159540dd5a57Smrg func_show_eval '$MV "$output_obj" "$obj"' \ 159640dd5a57Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 159740dd5a57Smrg fi 159840dd5a57Smrg fi 159940dd5a57Smrg 160040dd5a57Smrg $opt_dry_run || { 160140dd5a57Smrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 160240dd5a57Smrg 160340dd5a57Smrg # Unlock the critical section if it was locked 160440dd5a57Smrg if test "$need_locks" != no; then 160540dd5a57Smrg removelist=$lockfile 160640dd5a57Smrg $RM "$lockfile" 160740dd5a57Smrg fi 160840dd5a57Smrg } 160940dd5a57Smrg 161040dd5a57Smrg exit $EXIT_SUCCESS 161140dd5a57Smrg} 161240dd5a57Smrg 161340dd5a57Smrg$opt_help || { 161440dd5a57Smrg test "$mode" = compile && func_mode_compile ${1+"$@"} 161540dd5a57Smrg} 161640dd5a57Smrg 161740dd5a57Smrgfunc_mode_help () 161840dd5a57Smrg{ 161940dd5a57Smrg # We need to display help for each of the modes. 162040dd5a57Smrg case $mode in 162140dd5a57Smrg "") 162240dd5a57Smrg # Generic help is extracted from the usage comments 162340dd5a57Smrg # at the start of this file. 162440dd5a57Smrg func_help 162540dd5a57Smrg ;; 162640dd5a57Smrg 162740dd5a57Smrg clean) 162840dd5a57Smrg $ECHO \ 162940dd5a57Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 163040dd5a57Smrg 163140dd5a57SmrgRemove files from the build directory. 163240dd5a57Smrg 163340dd5a57SmrgRM is the name of the program to use to delete files associated with each FILE 163440dd5a57Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 163540dd5a57Smrgto RM. 163640dd5a57Smrg 163740dd5a57SmrgIf FILE is a libtool library, object or program, all the files associated 163840dd5a57Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 163940dd5a57Smrg ;; 164040dd5a57Smrg 164140dd5a57Smrg compile) 164240dd5a57Smrg $ECHO \ 164340dd5a57Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 164440dd5a57Smrg 164540dd5a57SmrgCompile a source file into a libtool library object. 164640dd5a57Smrg 164740dd5a57SmrgThis mode accepts the following additional options: 164840dd5a57Smrg 164940dd5a57Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 165040dd5a57Smrg -no-suppress do not suppress compiler output for multiple passes 165140dd5a57Smrg -prefer-pic try to build PIC objects only 165240dd5a57Smrg -prefer-non-pic try to build non-PIC objects only 165340dd5a57Smrg -shared do not build a \`.o' file suitable for static linking 165440dd5a57Smrg -static only build a \`.o' file suitable for static linking 165540dd5a57Smrg -Wc,FLAG pass FLAG directly to the compiler 165640dd5a57Smrg 165740dd5a57SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 165840dd5a57Smrgfrom the given SOURCEFILE. 165940dd5a57Smrg 166040dd5a57SmrgThe output file name is determined by removing the directory component from 166140dd5a57SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 166240dd5a57Smrglibrary object suffix, \`.lo'." 166340dd5a57Smrg ;; 166440dd5a57Smrg 166540dd5a57Smrg execute) 166640dd5a57Smrg $ECHO \ 166740dd5a57Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 166840dd5a57Smrg 166940dd5a57SmrgAutomatically set library path, then run a program. 167040dd5a57Smrg 167140dd5a57SmrgThis mode accepts the following additional options: 167240dd5a57Smrg 167340dd5a57Smrg -dlopen FILE add the directory containing FILE to the library path 167440dd5a57Smrg 167540dd5a57SmrgThis mode sets the library path environment variable according to \`-dlopen' 167640dd5a57Smrgflags. 167740dd5a57Smrg 167840dd5a57SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 167940dd5a57Smrginto their corresponding uninstalled binary, and any of their required library 168040dd5a57Smrgdirectories are added to the library path. 168140dd5a57Smrg 168240dd5a57SmrgThen, COMMAND is executed, with ARGS as arguments." 168340dd5a57Smrg ;; 168440dd5a57Smrg 168540dd5a57Smrg finish) 168640dd5a57Smrg $ECHO \ 168740dd5a57Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 168840dd5a57Smrg 168940dd5a57SmrgComplete the installation of libtool libraries. 169040dd5a57Smrg 169140dd5a57SmrgEach LIBDIR is a directory that contains libtool libraries. 169240dd5a57Smrg 169340dd5a57SmrgThe commands that this mode executes may require superuser privileges. Use 169440dd5a57Smrgthe \`--dry-run' option if you just want to see what would be executed." 169540dd5a57Smrg ;; 169640dd5a57Smrg 169740dd5a57Smrg install) 169840dd5a57Smrg $ECHO \ 169940dd5a57Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 170040dd5a57Smrg 170140dd5a57SmrgInstall executables or libraries. 170240dd5a57Smrg 170340dd5a57SmrgINSTALL-COMMAND is the installation command. The first component should be 170440dd5a57Smrgeither the \`install' or \`cp' program. 170540dd5a57Smrg 170640dd5a57SmrgThe following components of INSTALL-COMMAND are treated specially: 170740dd5a57Smrg 170840dd5a57Smrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 170940dd5a57Smrg 171040dd5a57SmrgThe rest of the components are interpreted as arguments to that command (only 171140dd5a57SmrgBSD-compatible install options are recognized)." 171240dd5a57Smrg ;; 171340dd5a57Smrg 171440dd5a57Smrg link) 171540dd5a57Smrg $ECHO \ 171640dd5a57Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 171740dd5a57Smrg 171840dd5a57SmrgLink object files or libraries together to form another library, or to 171940dd5a57Smrgcreate an executable program. 172040dd5a57Smrg 172140dd5a57SmrgLINK-COMMAND is a command using the C compiler that you would use to create 172240dd5a57Smrga program from several object files. 172340dd5a57Smrg 172440dd5a57SmrgThe following components of LINK-COMMAND are treated specially: 172540dd5a57Smrg 172640dd5a57Smrg -all-static do not do any dynamic linking at all 172740dd5a57Smrg -avoid-version do not add a version suffix if possible 172840dd5a57Smrg -bindir BINDIR specify path to binaries directory (for systems where 172940dd5a57Smrg libraries must be found in the PATH setting at runtime) 173040dd5a57Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 173140dd5a57Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 173240dd5a57Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 173340dd5a57Smrg -export-symbols SYMFILE 173440dd5a57Smrg try to export only the symbols listed in SYMFILE 173540dd5a57Smrg -export-symbols-regex REGEX 173640dd5a57Smrg try to export only the symbols matching REGEX 173740dd5a57Smrg -LLIBDIR search LIBDIR for required installed libraries 173840dd5a57Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 173940dd5a57Smrg -module build a library that can dlopened 174040dd5a57Smrg -no-fast-install disable the fast-install mode 174140dd5a57Smrg -no-install link a not-installable executable 174240dd5a57Smrg -no-undefined declare that a library does not refer to external symbols 174340dd5a57Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 174440dd5a57Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 174540dd5a57Smrg -precious-files-regex REGEX 174640dd5a57Smrg don't remove output files matching REGEX 174740dd5a57Smrg -release RELEASE specify package release information 174840dd5a57Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 174940dd5a57Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 175040dd5a57Smrg -shared only do dynamic linking of libtool libraries 175140dd5a57Smrg -shrext SUFFIX override the standard shared library file extension 175240dd5a57Smrg -static do not do any dynamic linking of uninstalled libtool libraries 175340dd5a57Smrg -static-libtool-libs 175440dd5a57Smrg do not do any dynamic linking of libtool libraries 175540dd5a57Smrg -version-info CURRENT[:REVISION[:AGE]] 175640dd5a57Smrg specify library version info [each variable defaults to 0] 175740dd5a57Smrg -weak LIBNAME declare that the target provides the LIBNAME interface 175840dd5a57Smrg -Wc,FLAG 175940dd5a57Smrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 176040dd5a57Smrg -Wl,FLAG 176140dd5a57Smrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 176240dd5a57Smrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 176340dd5a57Smrg 176440dd5a57SmrgAll other options (arguments beginning with \`-') are ignored. 176540dd5a57Smrg 176640dd5a57SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 176740dd5a57Smrgtreated as uninstalled libtool libraries, other files are standard or library 176840dd5a57Smrgobject files. 176940dd5a57Smrg 177040dd5a57SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 177140dd5a57Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 177240dd5a57Smrgrequired, except when creating a convenience library. 177340dd5a57Smrg 177440dd5a57SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 177540dd5a57Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 177640dd5a57Smrg 177740dd5a57SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 177840dd5a57Smrgis created, otherwise an executable program is created." 177940dd5a57Smrg ;; 178040dd5a57Smrg 178140dd5a57Smrg uninstall) 178240dd5a57Smrg $ECHO \ 178340dd5a57Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 178440dd5a57Smrg 178540dd5a57SmrgRemove libraries from an installation directory. 178640dd5a57Smrg 178740dd5a57SmrgRM is the name of the program to use to delete files associated with each FILE 178840dd5a57Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 178940dd5a57Smrgto RM. 179040dd5a57Smrg 179140dd5a57SmrgIf FILE is a libtool library, all the files associated with it are deleted. 179240dd5a57SmrgOtherwise, only FILE itself is deleted using RM." 179340dd5a57Smrg ;; 179440dd5a57Smrg 179540dd5a57Smrg *) 179640dd5a57Smrg func_fatal_help "invalid operation mode \`$mode'" 179740dd5a57Smrg ;; 179840dd5a57Smrg esac 179940dd5a57Smrg 180040dd5a57Smrg echo 180140dd5a57Smrg $ECHO "Try \`$progname --help' for more information about other modes." 180240dd5a57Smrg} 180340dd5a57Smrg 180440dd5a57Smrg# Now that we've collected a possible --mode arg, show help if necessary 180540dd5a57Smrgif $opt_help; then 180640dd5a57Smrg if test "$opt_help" = :; then 180740dd5a57Smrg func_mode_help 180840dd5a57Smrg else 180940dd5a57Smrg { 181040dd5a57Smrg func_help noexit 181140dd5a57Smrg for mode in compile link execute install finish uninstall clean; do 181240dd5a57Smrg func_mode_help 181340dd5a57Smrg done 181440dd5a57Smrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 181540dd5a57Smrg { 181640dd5a57Smrg func_help noexit 181740dd5a57Smrg for mode in compile link execute install finish uninstall clean; do 181840dd5a57Smrg echo 181940dd5a57Smrg func_mode_help 182040dd5a57Smrg done 182140dd5a57Smrg } | 182240dd5a57Smrg sed '1d 182340dd5a57Smrg /^When reporting/,/^Report/{ 182440dd5a57Smrg H 182540dd5a57Smrg d 182640dd5a57Smrg } 182740dd5a57Smrg $x 182840dd5a57Smrg /information about other modes/d 182940dd5a57Smrg /more detailed .*MODE/d 183040dd5a57Smrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 183140dd5a57Smrg fi 183240dd5a57Smrg exit $? 183340dd5a57Smrgfi 183440dd5a57Smrg 183540dd5a57Smrg 183640dd5a57Smrg# func_mode_execute arg... 183740dd5a57Smrgfunc_mode_execute () 183840dd5a57Smrg{ 183940dd5a57Smrg $opt_debug 184040dd5a57Smrg # The first argument is the command name. 184140dd5a57Smrg cmd="$nonopt" 184240dd5a57Smrg test -z "$cmd" && \ 184340dd5a57Smrg func_fatal_help "you must specify a COMMAND" 184440dd5a57Smrg 184540dd5a57Smrg # Handle -dlopen flags immediately. 184640dd5a57Smrg for file in $execute_dlfiles; do 184740dd5a57Smrg test -f "$file" \ 184840dd5a57Smrg || func_fatal_help "\`$file' is not a file" 184940dd5a57Smrg 185040dd5a57Smrg dir= 185140dd5a57Smrg case $file in 185240dd5a57Smrg *.la) 185340dd5a57Smrg # Check to see that this really is a libtool archive. 185440dd5a57Smrg func_lalib_unsafe_p "$file" \ 185540dd5a57Smrg || func_fatal_help "\`$lib' is not a valid libtool archive" 185640dd5a57Smrg 185740dd5a57Smrg # Read the libtool library. 185840dd5a57Smrg dlname= 185940dd5a57Smrg library_names= 186040dd5a57Smrg func_source "$file" 186140dd5a57Smrg 186240dd5a57Smrg # Skip this library if it cannot be dlopened. 186340dd5a57Smrg if test -z "$dlname"; then 186440dd5a57Smrg # Warn if it was a shared library. 186540dd5a57Smrg test -n "$library_names" && \ 186640dd5a57Smrg func_warning "\`$file' was not linked with \`-export-dynamic'" 186740dd5a57Smrg continue 186840dd5a57Smrg fi 186940dd5a57Smrg 187040dd5a57Smrg func_dirname "$file" "" "." 187140dd5a57Smrg dir="$func_dirname_result" 187240dd5a57Smrg 187340dd5a57Smrg if test -f "$dir/$objdir/$dlname"; then 187440dd5a57Smrg dir="$dir/$objdir" 187540dd5a57Smrg else 187640dd5a57Smrg if test ! -f "$dir/$dlname"; then 187740dd5a57Smrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 187840dd5a57Smrg fi 187940dd5a57Smrg fi 188040dd5a57Smrg ;; 188140dd5a57Smrg 188240dd5a57Smrg *.lo) 188340dd5a57Smrg # Just add the directory containing the .lo file. 188440dd5a57Smrg func_dirname "$file" "" "." 188540dd5a57Smrg dir="$func_dirname_result" 188640dd5a57Smrg ;; 188740dd5a57Smrg 188840dd5a57Smrg *) 188940dd5a57Smrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 189040dd5a57Smrg continue 189140dd5a57Smrg ;; 189240dd5a57Smrg esac 189340dd5a57Smrg 189440dd5a57Smrg # Get the absolute pathname. 189540dd5a57Smrg absdir=`cd "$dir" && pwd` 189640dd5a57Smrg test -n "$absdir" && dir="$absdir" 189740dd5a57Smrg 189840dd5a57Smrg # Now add the directory to shlibpath_var. 189940dd5a57Smrg if eval "test -z \"\$$shlibpath_var\""; then 190040dd5a57Smrg eval "$shlibpath_var=\"\$dir\"" 190140dd5a57Smrg else 190240dd5a57Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 190340dd5a57Smrg fi 190440dd5a57Smrg done 190540dd5a57Smrg 190640dd5a57Smrg # This variable tells wrapper scripts just to set shlibpath_var 190740dd5a57Smrg # rather than running their programs. 190840dd5a57Smrg libtool_execute_magic="$magic" 190940dd5a57Smrg 191040dd5a57Smrg # Check if any of the arguments is a wrapper script. 191140dd5a57Smrg args= 191240dd5a57Smrg for file 191340dd5a57Smrg do 191440dd5a57Smrg case $file in 191540dd5a57Smrg -* | *.la | *.lo ) ;; 191640dd5a57Smrg *) 191740dd5a57Smrg # Do a test to see if this is really a libtool program. 191840dd5a57Smrg if func_ltwrapper_script_p "$file"; then 191940dd5a57Smrg func_source "$file" 192040dd5a57Smrg # Transform arg to wrapped name. 192140dd5a57Smrg file="$progdir/$program" 192240dd5a57Smrg elif func_ltwrapper_executable_p "$file"; then 192340dd5a57Smrg func_ltwrapper_scriptname "$file" 192440dd5a57Smrg func_source "$func_ltwrapper_scriptname_result" 192540dd5a57Smrg # Transform arg to wrapped name. 192640dd5a57Smrg file="$progdir/$program" 192740dd5a57Smrg fi 192840dd5a57Smrg ;; 192940dd5a57Smrg esac 193040dd5a57Smrg # Quote arguments (to preserve shell metacharacters). 193140dd5a57Smrg func_quote_for_eval "$file" 193240dd5a57Smrg args="$args $func_quote_for_eval_result" 193340dd5a57Smrg done 193440dd5a57Smrg 193540dd5a57Smrg if test "X$opt_dry_run" = Xfalse; then 193640dd5a57Smrg if test -n "$shlibpath_var"; then 193740dd5a57Smrg # Export the shlibpath_var. 193840dd5a57Smrg eval "export $shlibpath_var" 193940dd5a57Smrg fi 194040dd5a57Smrg 194140dd5a57Smrg # Restore saved environment variables 194240dd5a57Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 194340dd5a57Smrg do 194440dd5a57Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 194540dd5a57Smrg $lt_var=\$save_$lt_var; export $lt_var 194640dd5a57Smrg else 194740dd5a57Smrg $lt_unset $lt_var 194840dd5a57Smrg fi" 194940dd5a57Smrg done 195040dd5a57Smrg 195140dd5a57Smrg # Now prepare to actually exec the command. 195240dd5a57Smrg exec_cmd="\$cmd$args" 195340dd5a57Smrg else 195440dd5a57Smrg # Display what would be done. 195540dd5a57Smrg if test -n "$shlibpath_var"; then 195640dd5a57Smrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 195740dd5a57Smrg echo "export $shlibpath_var" 195840dd5a57Smrg fi 195940dd5a57Smrg $ECHO "$cmd$args" 196040dd5a57Smrg exit $EXIT_SUCCESS 196140dd5a57Smrg fi 196240dd5a57Smrg} 196340dd5a57Smrg 196440dd5a57Smrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 196540dd5a57Smrg 196640dd5a57Smrg 196740dd5a57Smrg# func_mode_finish arg... 196840dd5a57Smrgfunc_mode_finish () 196940dd5a57Smrg{ 197040dd5a57Smrg $opt_debug 197140dd5a57Smrg libdirs="$nonopt" 197240dd5a57Smrg admincmds= 197340dd5a57Smrg 197440dd5a57Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 197540dd5a57Smrg for dir 197640dd5a57Smrg do 197740dd5a57Smrg libdirs="$libdirs $dir" 197840dd5a57Smrg done 197940dd5a57Smrg 198040dd5a57Smrg for libdir in $libdirs; do 198140dd5a57Smrg if test -n "$finish_cmds"; then 198240dd5a57Smrg # Do each command in the finish commands. 198340dd5a57Smrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 198440dd5a57Smrg'"$cmd"'"' 198540dd5a57Smrg fi 198640dd5a57Smrg if test -n "$finish_eval"; then 198740dd5a57Smrg # Do the single finish_eval. 198840dd5a57Smrg eval cmds=\"$finish_eval\" 198940dd5a57Smrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 199040dd5a57Smrg $cmds" 199140dd5a57Smrg fi 199240dd5a57Smrg done 199340dd5a57Smrg fi 199440dd5a57Smrg 199540dd5a57Smrg # Exit here if they wanted silent mode. 199640dd5a57Smrg $opt_silent && exit $EXIT_SUCCESS 199740dd5a57Smrg 199840dd5a57Smrg echo "----------------------------------------------------------------------" 199940dd5a57Smrg echo "Libraries have been installed in:" 200040dd5a57Smrg for libdir in $libdirs; do 200140dd5a57Smrg $ECHO " $libdir" 200240dd5a57Smrg done 200340dd5a57Smrg echo 200440dd5a57Smrg echo "If you ever happen to want to link against installed libraries" 200540dd5a57Smrg echo "in a given directory, LIBDIR, you must either use libtool, and" 200640dd5a57Smrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 200740dd5a57Smrg echo "flag during linking and do at least one of the following:" 200840dd5a57Smrg if test -n "$shlibpath_var"; then 200940dd5a57Smrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 201040dd5a57Smrg echo " during execution" 201140dd5a57Smrg fi 201240dd5a57Smrg if test -n "$runpath_var"; then 201340dd5a57Smrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 201440dd5a57Smrg echo " during linking" 201540dd5a57Smrg fi 201640dd5a57Smrg if test -n "$hardcode_libdir_flag_spec"; then 201740dd5a57Smrg libdir=LIBDIR 201840dd5a57Smrg eval flag=\"$hardcode_libdir_flag_spec\" 201940dd5a57Smrg 202040dd5a57Smrg $ECHO " - use the \`$flag' linker flag" 202140dd5a57Smrg fi 202240dd5a57Smrg if test -n "$admincmds"; then 202340dd5a57Smrg $ECHO " - have your system administrator run these commands:$admincmds" 202440dd5a57Smrg fi 202540dd5a57Smrg if test -f /etc/ld.so.conf; then 202640dd5a57Smrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 202740dd5a57Smrg fi 202840dd5a57Smrg echo 202940dd5a57Smrg 203040dd5a57Smrg echo "See any operating system documentation about shared libraries for" 203140dd5a57Smrg case $host in 203240dd5a57Smrg solaris2.[6789]|solaris2.1[0-9]) 203340dd5a57Smrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 203440dd5a57Smrg echo "pages." 203540dd5a57Smrg ;; 203640dd5a57Smrg *) 203740dd5a57Smrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 203840dd5a57Smrg ;; 203940dd5a57Smrg esac 204040dd5a57Smrg echo "----------------------------------------------------------------------" 204140dd5a57Smrg exit $EXIT_SUCCESS 204240dd5a57Smrg} 204340dd5a57Smrg 204440dd5a57Smrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 204540dd5a57Smrg 204640dd5a57Smrg 204740dd5a57Smrg# func_mode_install arg... 204840dd5a57Smrgfunc_mode_install () 204940dd5a57Smrg{ 205040dd5a57Smrg $opt_debug 205140dd5a57Smrg # There may be an optional sh(1) argument at the beginning of 205240dd5a57Smrg # install_prog (especially on Windows NT). 205340dd5a57Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 205440dd5a57Smrg # Allow the use of GNU shtool's install command. 205540dd5a57Smrg case $nonopt in *shtool*) :;; *) false;; esac; then 205640dd5a57Smrg # Aesthetically quote it. 205740dd5a57Smrg func_quote_for_eval "$nonopt" 205840dd5a57Smrg install_prog="$func_quote_for_eval_result " 205940dd5a57Smrg arg=$1 206040dd5a57Smrg shift 206140dd5a57Smrg else 206240dd5a57Smrg install_prog= 206340dd5a57Smrg arg=$nonopt 206440dd5a57Smrg fi 206540dd5a57Smrg 206640dd5a57Smrg # The real first argument should be the name of the installation program. 206740dd5a57Smrg # Aesthetically quote it. 206840dd5a57Smrg func_quote_for_eval "$arg" 206940dd5a57Smrg install_prog="$install_prog$func_quote_for_eval_result" 207040dd5a57Smrg install_shared_prog=$install_prog 207140dd5a57Smrg case " $install_prog " in 207240dd5a57Smrg *[\\\ /]cp\ *) install_cp=: ;; 207340dd5a57Smrg *) install_cp=false ;; 207440dd5a57Smrg esac 207540dd5a57Smrg 207640dd5a57Smrg # We need to accept at least all the BSD install flags. 207740dd5a57Smrg dest= 207840dd5a57Smrg files= 207940dd5a57Smrg opts= 208040dd5a57Smrg prev= 208140dd5a57Smrg install_type= 208240dd5a57Smrg isdir=no 208340dd5a57Smrg stripme= 208440dd5a57Smrg no_mode=: 208540dd5a57Smrg for arg 208640dd5a57Smrg do 208740dd5a57Smrg arg2= 208840dd5a57Smrg if test -n "$dest"; then 208940dd5a57Smrg files="$files $dest" 209040dd5a57Smrg dest=$arg 209140dd5a57Smrg continue 209240dd5a57Smrg fi 209340dd5a57Smrg 209440dd5a57Smrg case $arg in 209540dd5a57Smrg -d) isdir=yes ;; 209640dd5a57Smrg -f) 209740dd5a57Smrg if $install_cp; then :; else 209840dd5a57Smrg prev=$arg 209940dd5a57Smrg fi 210040dd5a57Smrg ;; 210140dd5a57Smrg -g | -m | -o) 210240dd5a57Smrg prev=$arg 210340dd5a57Smrg ;; 210440dd5a57Smrg -s) 210540dd5a57Smrg stripme=" -s" 210640dd5a57Smrg continue 210740dd5a57Smrg ;; 210840dd5a57Smrg -*) 210940dd5a57Smrg ;; 211040dd5a57Smrg *) 211140dd5a57Smrg # If the previous option needed an argument, then skip it. 211240dd5a57Smrg if test -n "$prev"; then 211340dd5a57Smrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 211440dd5a57Smrg arg2=$install_override_mode 211540dd5a57Smrg no_mode=false 211640dd5a57Smrg fi 211740dd5a57Smrg prev= 211840dd5a57Smrg else 211940dd5a57Smrg dest=$arg 212040dd5a57Smrg continue 212140dd5a57Smrg fi 212240dd5a57Smrg ;; 212340dd5a57Smrg esac 212440dd5a57Smrg 212540dd5a57Smrg # Aesthetically quote the argument. 212640dd5a57Smrg func_quote_for_eval "$arg" 212740dd5a57Smrg install_prog="$install_prog $func_quote_for_eval_result" 212840dd5a57Smrg if test -n "$arg2"; then 212940dd5a57Smrg func_quote_for_eval "$arg2" 213040dd5a57Smrg fi 213140dd5a57Smrg install_shared_prog="$install_shared_prog $func_quote_for_eval_result" 213240dd5a57Smrg done 213340dd5a57Smrg 213440dd5a57Smrg test -z "$install_prog" && \ 213540dd5a57Smrg func_fatal_help "you must specify an install program" 213640dd5a57Smrg 213740dd5a57Smrg test -n "$prev" && \ 213840dd5a57Smrg func_fatal_help "the \`$prev' option requires an argument" 213940dd5a57Smrg 214040dd5a57Smrg if test -n "$install_override_mode" && $no_mode; then 214140dd5a57Smrg if $install_cp; then :; else 214240dd5a57Smrg func_quote_for_eval "$install_override_mode" 214340dd5a57Smrg install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" 214440dd5a57Smrg fi 214540dd5a57Smrg fi 214640dd5a57Smrg 214740dd5a57Smrg if test -z "$files"; then 214840dd5a57Smrg if test -z "$dest"; then 214940dd5a57Smrg func_fatal_help "no file or destination specified" 215040dd5a57Smrg else 215140dd5a57Smrg func_fatal_help "you must specify a destination" 215240dd5a57Smrg fi 215340dd5a57Smrg fi 215440dd5a57Smrg 215540dd5a57Smrg # Strip any trailing slash from the destination. 215640dd5a57Smrg func_stripname '' '/' "$dest" 215740dd5a57Smrg dest=$func_stripname_result 215840dd5a57Smrg 215940dd5a57Smrg # Check to see that the destination is a directory. 216040dd5a57Smrg test -d "$dest" && isdir=yes 216140dd5a57Smrg if test "$isdir" = yes; then 216240dd5a57Smrg destdir="$dest" 216340dd5a57Smrg destname= 216440dd5a57Smrg else 216540dd5a57Smrg func_dirname_and_basename "$dest" "" "." 216640dd5a57Smrg destdir="$func_dirname_result" 216740dd5a57Smrg destname="$func_basename_result" 216840dd5a57Smrg 216940dd5a57Smrg # Not a directory, so check to see that there is only one file specified. 217040dd5a57Smrg set dummy $files; shift 217140dd5a57Smrg test "$#" -gt 1 && \ 217240dd5a57Smrg func_fatal_help "\`$dest' is not a directory" 217340dd5a57Smrg fi 217440dd5a57Smrg case $destdir in 217540dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 217640dd5a57Smrg *) 217740dd5a57Smrg for file in $files; do 217840dd5a57Smrg case $file in 217940dd5a57Smrg *.lo) ;; 218040dd5a57Smrg *) 218140dd5a57Smrg func_fatal_help "\`$destdir' must be an absolute directory name" 218240dd5a57Smrg ;; 218340dd5a57Smrg esac 218440dd5a57Smrg done 218540dd5a57Smrg ;; 218640dd5a57Smrg esac 218740dd5a57Smrg 218840dd5a57Smrg # This variable tells wrapper scripts just to set variables rather 218940dd5a57Smrg # than running their programs. 219040dd5a57Smrg libtool_install_magic="$magic" 219140dd5a57Smrg 219240dd5a57Smrg staticlibs= 219340dd5a57Smrg future_libdirs= 219440dd5a57Smrg current_libdirs= 219540dd5a57Smrg for file in $files; do 219640dd5a57Smrg 219740dd5a57Smrg # Do each installation. 219840dd5a57Smrg case $file in 219940dd5a57Smrg *.$libext) 220040dd5a57Smrg # Do the static libraries later. 220140dd5a57Smrg staticlibs="$staticlibs $file" 220240dd5a57Smrg ;; 220340dd5a57Smrg 220440dd5a57Smrg *.la) 220540dd5a57Smrg # Check to see that this really is a libtool archive. 220640dd5a57Smrg func_lalib_unsafe_p "$file" \ 220740dd5a57Smrg || func_fatal_help "\`$file' is not a valid libtool archive" 220840dd5a57Smrg 220940dd5a57Smrg library_names= 221040dd5a57Smrg old_library= 221140dd5a57Smrg relink_command= 221240dd5a57Smrg func_source "$file" 221340dd5a57Smrg 221440dd5a57Smrg # Add the libdir to current_libdirs if it is the destination. 221540dd5a57Smrg if test "X$destdir" = "X$libdir"; then 221640dd5a57Smrg case "$current_libdirs " in 221740dd5a57Smrg *" $libdir "*) ;; 221840dd5a57Smrg *) current_libdirs="$current_libdirs $libdir" ;; 221940dd5a57Smrg esac 222040dd5a57Smrg else 222140dd5a57Smrg # Note the libdir as a future libdir. 222240dd5a57Smrg case "$future_libdirs " in 222340dd5a57Smrg *" $libdir "*) ;; 222440dd5a57Smrg *) future_libdirs="$future_libdirs $libdir" ;; 222540dd5a57Smrg esac 222640dd5a57Smrg fi 222740dd5a57Smrg 222840dd5a57Smrg func_dirname "$file" "/" "" 222940dd5a57Smrg dir="$func_dirname_result" 223040dd5a57Smrg dir="$dir$objdir" 223140dd5a57Smrg 223240dd5a57Smrg if test -n "$relink_command"; then 223340dd5a57Smrg # Determine the prefix the user has applied to our future dir. 223440dd5a57Smrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 223540dd5a57Smrg 223640dd5a57Smrg # Don't allow the user to place us outside of our expected 223740dd5a57Smrg # location b/c this prevents finding dependent libraries that 223840dd5a57Smrg # are installed to the same prefix. 223940dd5a57Smrg # At present, this check doesn't affect windows .dll's that 224040dd5a57Smrg # are installed into $libdir/../bin (currently, that works fine) 224140dd5a57Smrg # but it's something to keep an eye on. 224240dd5a57Smrg test "$inst_prefix_dir" = "$destdir" && \ 224340dd5a57Smrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 224440dd5a57Smrg 224540dd5a57Smrg if test -n "$inst_prefix_dir"; then 224640dd5a57Smrg # Stick the inst_prefix_dir data into the link command. 224740dd5a57Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 224840dd5a57Smrg else 224940dd5a57Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 225040dd5a57Smrg fi 225140dd5a57Smrg 225240dd5a57Smrg func_warning "relinking \`$file'" 225340dd5a57Smrg func_show_eval "$relink_command" \ 225440dd5a57Smrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 225540dd5a57Smrg fi 225640dd5a57Smrg 225740dd5a57Smrg # See the names of the shared library. 225840dd5a57Smrg set dummy $library_names; shift 225940dd5a57Smrg if test -n "$1"; then 226040dd5a57Smrg realname="$1" 226140dd5a57Smrg shift 226240dd5a57Smrg 226340dd5a57Smrg srcname="$realname" 226440dd5a57Smrg test -n "$relink_command" && srcname="$realname"T 226540dd5a57Smrg 226640dd5a57Smrg # Install the shared library and build the symlinks. 226740dd5a57Smrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 226840dd5a57Smrg 'exit $?' 226940dd5a57Smrg tstripme="$stripme" 227040dd5a57Smrg case $host_os in 227140dd5a57Smrg cygwin* | mingw* | pw32* | cegcc*) 227240dd5a57Smrg case $realname in 227340dd5a57Smrg *.dll.a) 227440dd5a57Smrg tstripme="" 227540dd5a57Smrg ;; 227640dd5a57Smrg esac 227740dd5a57Smrg ;; 227840dd5a57Smrg esac 227940dd5a57Smrg if test -n "$tstripme" && test -n "$striplib"; then 228040dd5a57Smrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 228140dd5a57Smrg fi 228240dd5a57Smrg 228340dd5a57Smrg if test "$#" -gt 0; then 228440dd5a57Smrg # Delete the old symlinks, and create new ones. 228540dd5a57Smrg # Try `ln -sf' first, because the `ln' binary might depend on 228640dd5a57Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 228740dd5a57Smrg # so we also need to try rm && ln -s. 228840dd5a57Smrg for linkname 228940dd5a57Smrg do 229040dd5a57Smrg test "$linkname" != "$realname" \ 229140dd5a57Smrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 229240dd5a57Smrg done 229340dd5a57Smrg fi 229440dd5a57Smrg 229540dd5a57Smrg # Do each command in the postinstall commands. 229640dd5a57Smrg lib="$destdir/$realname" 229740dd5a57Smrg func_execute_cmds "$postinstall_cmds" 'exit $?' 229840dd5a57Smrg fi 229940dd5a57Smrg 230040dd5a57Smrg # Install the pseudo-library for information purposes. 230140dd5a57Smrg func_basename "$file" 230240dd5a57Smrg name="$func_basename_result" 230340dd5a57Smrg instname="$dir/$name"i 230440dd5a57Smrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 230540dd5a57Smrg 230640dd5a57Smrg # Maybe install the static library, too. 230740dd5a57Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 230840dd5a57Smrg ;; 230940dd5a57Smrg 231040dd5a57Smrg *.lo) 231140dd5a57Smrg # Install (i.e. copy) a libtool object. 231240dd5a57Smrg 231340dd5a57Smrg # Figure out destination file name, if it wasn't already specified. 231440dd5a57Smrg if test -n "$destname"; then 231540dd5a57Smrg destfile="$destdir/$destname" 231640dd5a57Smrg else 231740dd5a57Smrg func_basename "$file" 231840dd5a57Smrg destfile="$func_basename_result" 231940dd5a57Smrg destfile="$destdir/$destfile" 232040dd5a57Smrg fi 232140dd5a57Smrg 232240dd5a57Smrg # Deduce the name of the destination old-style object file. 232340dd5a57Smrg case $destfile in 232440dd5a57Smrg *.lo) 232540dd5a57Smrg func_lo2o "$destfile" 232640dd5a57Smrg staticdest=$func_lo2o_result 232740dd5a57Smrg ;; 232840dd5a57Smrg *.$objext) 232940dd5a57Smrg staticdest="$destfile" 233040dd5a57Smrg destfile= 233140dd5a57Smrg ;; 233240dd5a57Smrg *) 233340dd5a57Smrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 233440dd5a57Smrg ;; 233540dd5a57Smrg esac 233640dd5a57Smrg 233740dd5a57Smrg # Install the libtool object if requested. 233840dd5a57Smrg test -n "$destfile" && \ 233940dd5a57Smrg func_show_eval "$install_prog $file $destfile" 'exit $?' 234040dd5a57Smrg 234140dd5a57Smrg # Install the old object if enabled. 234240dd5a57Smrg if test "$build_old_libs" = yes; then 234340dd5a57Smrg # Deduce the name of the old-style object file. 234440dd5a57Smrg func_lo2o "$file" 234540dd5a57Smrg staticobj=$func_lo2o_result 234640dd5a57Smrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 234740dd5a57Smrg fi 234840dd5a57Smrg exit $EXIT_SUCCESS 234940dd5a57Smrg ;; 235040dd5a57Smrg 235140dd5a57Smrg *) 235240dd5a57Smrg # Figure out destination file name, if it wasn't already specified. 235340dd5a57Smrg if test -n "$destname"; then 235440dd5a57Smrg destfile="$destdir/$destname" 235540dd5a57Smrg else 235640dd5a57Smrg func_basename "$file" 235740dd5a57Smrg destfile="$func_basename_result" 235840dd5a57Smrg destfile="$destdir/$destfile" 235940dd5a57Smrg fi 236040dd5a57Smrg 236140dd5a57Smrg # If the file is missing, and there is a .exe on the end, strip it 236240dd5a57Smrg # because it is most likely a libtool script we actually want to 236340dd5a57Smrg # install 236440dd5a57Smrg stripped_ext="" 236540dd5a57Smrg case $file in 236640dd5a57Smrg *.exe) 236740dd5a57Smrg if test ! -f "$file"; then 236840dd5a57Smrg func_stripname '' '.exe' "$file" 236940dd5a57Smrg file=$func_stripname_result 237040dd5a57Smrg stripped_ext=".exe" 237140dd5a57Smrg fi 237240dd5a57Smrg ;; 237340dd5a57Smrg esac 237440dd5a57Smrg 237540dd5a57Smrg # Do a test to see if this is really a libtool program. 237640dd5a57Smrg case $host in 237740dd5a57Smrg *cygwin* | *mingw*) 237840dd5a57Smrg if func_ltwrapper_executable_p "$file"; then 237940dd5a57Smrg func_ltwrapper_scriptname "$file" 238040dd5a57Smrg wrapper=$func_ltwrapper_scriptname_result 238140dd5a57Smrg else 238240dd5a57Smrg func_stripname '' '.exe' "$file" 238340dd5a57Smrg wrapper=$func_stripname_result 238440dd5a57Smrg fi 238540dd5a57Smrg ;; 238640dd5a57Smrg *) 238740dd5a57Smrg wrapper=$file 238840dd5a57Smrg ;; 238940dd5a57Smrg esac 239040dd5a57Smrg if func_ltwrapper_script_p "$wrapper"; then 239140dd5a57Smrg notinst_deplibs= 239240dd5a57Smrg relink_command= 239340dd5a57Smrg 239440dd5a57Smrg func_source "$wrapper" 239540dd5a57Smrg 239640dd5a57Smrg # Check the variables that should have been set. 239740dd5a57Smrg test -z "$generated_by_libtool_version" && \ 239840dd5a57Smrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 239940dd5a57Smrg 240040dd5a57Smrg finalize=yes 240140dd5a57Smrg for lib in $notinst_deplibs; do 240240dd5a57Smrg # Check to see that each library is installed. 240340dd5a57Smrg libdir= 240440dd5a57Smrg if test -f "$lib"; then 240540dd5a57Smrg func_source "$lib" 240640dd5a57Smrg fi 240740dd5a57Smrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 240840dd5a57Smrg if test -n "$libdir" && test ! -f "$libfile"; then 240940dd5a57Smrg func_warning "\`$lib' has not been installed in \`$libdir'" 241040dd5a57Smrg finalize=no 241140dd5a57Smrg fi 241240dd5a57Smrg done 241340dd5a57Smrg 241440dd5a57Smrg relink_command= 241540dd5a57Smrg func_source "$wrapper" 241640dd5a57Smrg 241740dd5a57Smrg outputname= 241840dd5a57Smrg if test "$fast_install" = no && test -n "$relink_command"; then 241940dd5a57Smrg $opt_dry_run || { 242040dd5a57Smrg if test "$finalize" = yes; then 242140dd5a57Smrg tmpdir=`func_mktempdir` 242240dd5a57Smrg func_basename "$file$stripped_ext" 242340dd5a57Smrg file="$func_basename_result" 242440dd5a57Smrg outputname="$tmpdir/$file" 242540dd5a57Smrg # Replace the output file specification. 242640dd5a57Smrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 242740dd5a57Smrg 242840dd5a57Smrg $opt_silent || { 242940dd5a57Smrg func_quote_for_expand "$relink_command" 243040dd5a57Smrg eval "func_echo $func_quote_for_expand_result" 243140dd5a57Smrg } 243240dd5a57Smrg if eval "$relink_command"; then : 243340dd5a57Smrg else 243440dd5a57Smrg func_error "error: relink \`$file' with the above command before installing it" 243540dd5a57Smrg $opt_dry_run || ${RM}r "$tmpdir" 243640dd5a57Smrg continue 243740dd5a57Smrg fi 243840dd5a57Smrg file="$outputname" 243940dd5a57Smrg else 244040dd5a57Smrg func_warning "cannot relink \`$file'" 244140dd5a57Smrg fi 244240dd5a57Smrg } 244340dd5a57Smrg else 244440dd5a57Smrg # Install the binary that we compiled earlier. 244540dd5a57Smrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 244640dd5a57Smrg fi 244740dd5a57Smrg fi 244840dd5a57Smrg 244940dd5a57Smrg # remove .exe since cygwin /usr/bin/install will append another 245040dd5a57Smrg # one anyway 245140dd5a57Smrg case $install_prog,$host in 245240dd5a57Smrg */usr/bin/install*,*cygwin*) 245340dd5a57Smrg case $file:$destfile in 245440dd5a57Smrg *.exe:*.exe) 245540dd5a57Smrg # this is ok 245640dd5a57Smrg ;; 245740dd5a57Smrg *.exe:*) 245840dd5a57Smrg destfile=$destfile.exe 245940dd5a57Smrg ;; 246040dd5a57Smrg *:*.exe) 246140dd5a57Smrg func_stripname '' '.exe' "$destfile" 246240dd5a57Smrg destfile=$func_stripname_result 246340dd5a57Smrg ;; 246440dd5a57Smrg esac 246540dd5a57Smrg ;; 246640dd5a57Smrg esac 246740dd5a57Smrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 246840dd5a57Smrg $opt_dry_run || if test -n "$outputname"; then 246940dd5a57Smrg ${RM}r "$tmpdir" 247040dd5a57Smrg fi 247140dd5a57Smrg ;; 247240dd5a57Smrg esac 247340dd5a57Smrg done 247440dd5a57Smrg 247540dd5a57Smrg for file in $staticlibs; do 247640dd5a57Smrg func_basename "$file" 247740dd5a57Smrg name="$func_basename_result" 247840dd5a57Smrg 247940dd5a57Smrg # Set up the ranlib parameters. 248040dd5a57Smrg oldlib="$destdir/$name" 248140dd5a57Smrg 248240dd5a57Smrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 248340dd5a57Smrg 248440dd5a57Smrg if test -n "$stripme" && test -n "$old_striplib"; then 248540dd5a57Smrg func_show_eval "$old_striplib $oldlib" 'exit $?' 248640dd5a57Smrg fi 248740dd5a57Smrg 248840dd5a57Smrg # Do each command in the postinstall commands. 248940dd5a57Smrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 249040dd5a57Smrg done 249140dd5a57Smrg 249240dd5a57Smrg test -n "$future_libdirs" && \ 249340dd5a57Smrg func_warning "remember to run \`$progname --finish$future_libdirs'" 249440dd5a57Smrg 249540dd5a57Smrg if test -n "$current_libdirs"; then 249640dd5a57Smrg # Maybe just do a dry run. 249740dd5a57Smrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 249840dd5a57Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 249940dd5a57Smrg else 250040dd5a57Smrg exit $EXIT_SUCCESS 250140dd5a57Smrg fi 250240dd5a57Smrg} 250340dd5a57Smrg 250440dd5a57Smrgtest "$mode" = install && func_mode_install ${1+"$@"} 250540dd5a57Smrg 250640dd5a57Smrg 250740dd5a57Smrg# func_generate_dlsyms outputname originator pic_p 250840dd5a57Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with 250940dd5a57Smrg# a dlpreopen symbol table. 251040dd5a57Smrgfunc_generate_dlsyms () 251140dd5a57Smrg{ 251240dd5a57Smrg $opt_debug 251340dd5a57Smrg my_outputname="$1" 251440dd5a57Smrg my_originator="$2" 251540dd5a57Smrg my_pic_p="${3-no}" 251640dd5a57Smrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 251740dd5a57Smrg my_dlsyms= 251840dd5a57Smrg 251940dd5a57Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 252040dd5a57Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 252140dd5a57Smrg my_dlsyms="${my_outputname}S.c" 252240dd5a57Smrg else 252340dd5a57Smrg func_error "not configured to extract global symbols from dlpreopened files" 252440dd5a57Smrg fi 252540dd5a57Smrg fi 252640dd5a57Smrg 252740dd5a57Smrg if test -n "$my_dlsyms"; then 252840dd5a57Smrg case $my_dlsyms in 252940dd5a57Smrg "") ;; 253040dd5a57Smrg *.c) 253140dd5a57Smrg # Discover the nlist of each of the dlfiles. 253240dd5a57Smrg nlist="$output_objdir/${my_outputname}.nm" 253340dd5a57Smrg 253440dd5a57Smrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 253540dd5a57Smrg 253640dd5a57Smrg # Parse the name list into a source file. 253740dd5a57Smrg func_verbose "creating $output_objdir/$my_dlsyms" 253840dd5a57Smrg 253940dd5a57Smrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 254040dd5a57Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 254140dd5a57Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 254240dd5a57Smrg 254340dd5a57Smrg#ifdef __cplusplus 254440dd5a57Smrgextern \"C\" { 254540dd5a57Smrg#endif 254640dd5a57Smrg 254740dd5a57Smrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 254840dd5a57Smrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 254940dd5a57Smrg#endif 255040dd5a57Smrg 255140dd5a57Smrg/* External symbol declarations for the compiler. */\ 255240dd5a57Smrg" 255340dd5a57Smrg 255440dd5a57Smrg if test "$dlself" = yes; then 255540dd5a57Smrg func_verbose "generating symbol list for \`$output'" 255640dd5a57Smrg 255740dd5a57Smrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 255840dd5a57Smrg 255940dd5a57Smrg # Add our own program objects to the symbol list. 256040dd5a57Smrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 256140dd5a57Smrg for progfile in $progfiles; do 256240dd5a57Smrg func_verbose "extracting global C symbols from \`$progfile'" 256340dd5a57Smrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 256440dd5a57Smrg done 256540dd5a57Smrg 256640dd5a57Smrg if test -n "$exclude_expsyms"; then 256740dd5a57Smrg $opt_dry_run || { 256840dd5a57Smrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 256940dd5a57Smrg eval '$MV "$nlist"T "$nlist"' 257040dd5a57Smrg } 257140dd5a57Smrg fi 257240dd5a57Smrg 257340dd5a57Smrg if test -n "$export_symbols_regex"; then 257440dd5a57Smrg $opt_dry_run || { 257540dd5a57Smrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 257640dd5a57Smrg eval '$MV "$nlist"T "$nlist"' 257740dd5a57Smrg } 257840dd5a57Smrg fi 257940dd5a57Smrg 258040dd5a57Smrg # Prepare the list of exported symbols 258140dd5a57Smrg if test -z "$export_symbols"; then 258240dd5a57Smrg export_symbols="$output_objdir/$outputname.exp" 258340dd5a57Smrg $opt_dry_run || { 258440dd5a57Smrg $RM $export_symbols 258540dd5a57Smrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 258640dd5a57Smrg case $host in 258740dd5a57Smrg *cygwin* | *mingw* | *cegcc* ) 258840dd5a57Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 258940dd5a57Smrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 259040dd5a57Smrg ;; 259140dd5a57Smrg esac 259240dd5a57Smrg } 259340dd5a57Smrg else 259440dd5a57Smrg $opt_dry_run || { 259540dd5a57Smrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 259640dd5a57Smrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 259740dd5a57Smrg eval '$MV "$nlist"T "$nlist"' 259840dd5a57Smrg case $host in 259940dd5a57Smrg *cygwin* | *mingw* | *cegcc* ) 260040dd5a57Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 260140dd5a57Smrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 260240dd5a57Smrg ;; 260340dd5a57Smrg esac 260440dd5a57Smrg } 260540dd5a57Smrg fi 260640dd5a57Smrg fi 260740dd5a57Smrg 260840dd5a57Smrg for dlprefile in $dlprefiles; do 260940dd5a57Smrg func_verbose "extracting global C symbols from \`$dlprefile'" 261040dd5a57Smrg func_basename "$dlprefile" 261140dd5a57Smrg name="$func_basename_result" 261240dd5a57Smrg $opt_dry_run || { 261340dd5a57Smrg eval '$ECHO ": $name " >> "$nlist"' 261440dd5a57Smrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 261540dd5a57Smrg } 261640dd5a57Smrg done 261740dd5a57Smrg 261840dd5a57Smrg $opt_dry_run || { 261940dd5a57Smrg # Make sure we have at least an empty file. 262040dd5a57Smrg test -f "$nlist" || : > "$nlist" 262140dd5a57Smrg 262240dd5a57Smrg if test -n "$exclude_expsyms"; then 262340dd5a57Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 262440dd5a57Smrg $MV "$nlist"T "$nlist" 262540dd5a57Smrg fi 262640dd5a57Smrg 262740dd5a57Smrg # Try sorting and uniquifying the output. 262840dd5a57Smrg if $GREP -v "^: " < "$nlist" | 262940dd5a57Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 263040dd5a57Smrg sort -k 3 263140dd5a57Smrg else 263240dd5a57Smrg sort +2 263340dd5a57Smrg fi | 263440dd5a57Smrg uniq > "$nlist"S; then 263540dd5a57Smrg : 263640dd5a57Smrg else 263740dd5a57Smrg $GREP -v "^: " < "$nlist" > "$nlist"S 263840dd5a57Smrg fi 263940dd5a57Smrg 264040dd5a57Smrg if test -f "$nlist"S; then 264140dd5a57Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 264240dd5a57Smrg else 264340dd5a57Smrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 264440dd5a57Smrg fi 264540dd5a57Smrg 264640dd5a57Smrg echo >> "$output_objdir/$my_dlsyms" "\ 264740dd5a57Smrg 264840dd5a57Smrg/* The mapping between symbol names and symbols. */ 264940dd5a57Smrgtypedef struct { 265040dd5a57Smrg const char *name; 265140dd5a57Smrg void *address; 265240dd5a57Smrg} lt_dlsymlist; 265340dd5a57Smrg" 265440dd5a57Smrg case $host in 265540dd5a57Smrg *cygwin* | *mingw* | *cegcc* ) 265640dd5a57Smrg echo >> "$output_objdir/$my_dlsyms" "\ 265740dd5a57Smrg/* DATA imports from DLLs on WIN32 con't be const, because 265840dd5a57Smrg runtime relocations are performed -- see ld's documentation 265940dd5a57Smrg on pseudo-relocs. */" 266040dd5a57Smrg lt_dlsym_const= ;; 266140dd5a57Smrg *osf5*) 266240dd5a57Smrg echo >> "$output_objdir/$my_dlsyms" "\ 266340dd5a57Smrg/* This system does not cope well with relocations in const data */" 266440dd5a57Smrg lt_dlsym_const= ;; 266540dd5a57Smrg *) 266640dd5a57Smrg lt_dlsym_const=const ;; 266740dd5a57Smrg esac 266840dd5a57Smrg 266940dd5a57Smrg echo >> "$output_objdir/$my_dlsyms" "\ 267040dd5a57Smrgextern $lt_dlsym_const lt_dlsymlist 267140dd5a57Smrglt_${my_prefix}_LTX_preloaded_symbols[]; 267240dd5a57Smrg$lt_dlsym_const lt_dlsymlist 267340dd5a57Smrglt_${my_prefix}_LTX_preloaded_symbols[] = 267440dd5a57Smrg{\ 267540dd5a57Smrg { \"$my_originator\", (void *) 0 }," 267640dd5a57Smrg 267740dd5a57Smrg case $need_lib_prefix in 267840dd5a57Smrg no) 267940dd5a57Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 268040dd5a57Smrg ;; 268140dd5a57Smrg *) 268240dd5a57Smrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 268340dd5a57Smrg ;; 268440dd5a57Smrg esac 268540dd5a57Smrg echo >> "$output_objdir/$my_dlsyms" "\ 268640dd5a57Smrg {0, (void *) 0} 268740dd5a57Smrg}; 268840dd5a57Smrg 268940dd5a57Smrg/* This works around a problem in FreeBSD linker */ 269040dd5a57Smrg#ifdef FREEBSD_WORKAROUND 269140dd5a57Smrgstatic const void *lt_preloaded_setup() { 269240dd5a57Smrg return lt_${my_prefix}_LTX_preloaded_symbols; 269340dd5a57Smrg} 269440dd5a57Smrg#endif 269540dd5a57Smrg 269640dd5a57Smrg#ifdef __cplusplus 269740dd5a57Smrg} 269840dd5a57Smrg#endif\ 269940dd5a57Smrg" 270040dd5a57Smrg } # !$opt_dry_run 270140dd5a57Smrg 270240dd5a57Smrg pic_flag_for_symtable= 270340dd5a57Smrg case "$compile_command " in 270440dd5a57Smrg *" -static "*) ;; 270540dd5a57Smrg *) 270640dd5a57Smrg case $host in 270740dd5a57Smrg # compiling the symbol table file with pic_flag works around 270840dd5a57Smrg # a FreeBSD bug that causes programs to crash when -lm is 270940dd5a57Smrg # linked before any other PIC object. But we must not use 271040dd5a57Smrg # pic_flag when linking with -static. The problem exists in 271140dd5a57Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 271240dd5a57Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 271340dd5a57Smrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 271440dd5a57Smrg *-*-hpux*) 271540dd5a57Smrg pic_flag_for_symtable=" $pic_flag" ;; 271640dd5a57Smrg *) 271740dd5a57Smrg if test "X$my_pic_p" != Xno; then 271840dd5a57Smrg pic_flag_for_symtable=" $pic_flag" 271940dd5a57Smrg fi 272040dd5a57Smrg ;; 272140dd5a57Smrg esac 272240dd5a57Smrg ;; 272340dd5a57Smrg esac 272440dd5a57Smrg symtab_cflags= 272540dd5a57Smrg for arg in $LTCFLAGS; do 272640dd5a57Smrg case $arg in 272740dd5a57Smrg -pie | -fpie | -fPIE) ;; 272840dd5a57Smrg *) symtab_cflags="$symtab_cflags $arg" ;; 272940dd5a57Smrg esac 273040dd5a57Smrg done 273140dd5a57Smrg 273240dd5a57Smrg # Now compile the dynamic symbol file. 273340dd5a57Smrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 273440dd5a57Smrg 273540dd5a57Smrg # Clean up the generated files. 273640dd5a57Smrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 273740dd5a57Smrg 273840dd5a57Smrg # Transform the symbol file into the correct name. 273940dd5a57Smrg symfileobj="$output_objdir/${my_outputname}S.$objext" 274040dd5a57Smrg case $host in 274140dd5a57Smrg *cygwin* | *mingw* | *cegcc* ) 274240dd5a57Smrg if test -f "$output_objdir/$my_outputname.def"; then 274340dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 274440dd5a57Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 274540dd5a57Smrg else 274640dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 274740dd5a57Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 274840dd5a57Smrg fi 274940dd5a57Smrg ;; 275040dd5a57Smrg *) 275140dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 275240dd5a57Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 275340dd5a57Smrg ;; 275440dd5a57Smrg esac 275540dd5a57Smrg ;; 275640dd5a57Smrg *) 275740dd5a57Smrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 275840dd5a57Smrg ;; 275940dd5a57Smrg esac 276040dd5a57Smrg else 276140dd5a57Smrg # We keep going just in case the user didn't refer to 276240dd5a57Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 276340dd5a57Smrg # really was required. 276440dd5a57Smrg 276540dd5a57Smrg # Nullify the symbol file. 276640dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 276740dd5a57Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 276840dd5a57Smrg fi 276940dd5a57Smrg} 277040dd5a57Smrg 277140dd5a57Smrg# func_win32_libid arg 277240dd5a57Smrg# return the library type of file 'arg' 277340dd5a57Smrg# 277440dd5a57Smrg# Need a lot of goo to handle *both* DLLs and import libs 277540dd5a57Smrg# Has to be a shell function in order to 'eat' the argument 277640dd5a57Smrg# that is supplied when $file_magic_command is called. 277740dd5a57Smrg# Despite the name, also deal with 64 bit binaries. 277840dd5a57Smrgfunc_win32_libid () 277940dd5a57Smrg{ 278040dd5a57Smrg $opt_debug 278140dd5a57Smrg win32_libid_type="unknown" 278240dd5a57Smrg win32_fileres=`file -L $1 2>/dev/null` 278340dd5a57Smrg case $win32_fileres in 278440dd5a57Smrg *ar\ archive\ import\ library*) # definitely import 278540dd5a57Smrg win32_libid_type="x86 archive import" 278640dd5a57Smrg ;; 278740dd5a57Smrg *ar\ archive*) # could be an import, or static 278840dd5a57Smrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 278940dd5a57Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 279040dd5a57Smrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 279140dd5a57Smrg win32_nmres=`eval $NM -f posix -A $1 | 279240dd5a57Smrg $SED -n -e ' 279340dd5a57Smrg 1,100{ 279440dd5a57Smrg / I /{ 279540dd5a57Smrg s,.*,import, 279640dd5a57Smrg p 279740dd5a57Smrg q 279840dd5a57Smrg } 279940dd5a57Smrg }'` 280040dd5a57Smrg case $win32_nmres in 280140dd5a57Smrg import*) win32_libid_type="x86 archive import";; 280240dd5a57Smrg *) win32_libid_type="x86 archive static";; 280340dd5a57Smrg esac 280440dd5a57Smrg fi 280540dd5a57Smrg ;; 280640dd5a57Smrg *DLL*) 280740dd5a57Smrg win32_libid_type="x86 DLL" 280840dd5a57Smrg ;; 280940dd5a57Smrg *executable*) # but shell scripts are "executable" too... 281040dd5a57Smrg case $win32_fileres in 281140dd5a57Smrg *MS\ Windows\ PE\ Intel*) 281240dd5a57Smrg win32_libid_type="x86 DLL" 281340dd5a57Smrg ;; 281440dd5a57Smrg esac 281540dd5a57Smrg ;; 281640dd5a57Smrg esac 281740dd5a57Smrg $ECHO "$win32_libid_type" 281840dd5a57Smrg} 281940dd5a57Smrg 282040dd5a57Smrg 282140dd5a57Smrg 282240dd5a57Smrg# func_extract_an_archive dir oldlib 282340dd5a57Smrgfunc_extract_an_archive () 282440dd5a57Smrg{ 282540dd5a57Smrg $opt_debug 282640dd5a57Smrg f_ex_an_ar_dir="$1"; shift 282740dd5a57Smrg f_ex_an_ar_oldlib="$1" 282840dd5a57Smrg if test "$lock_old_archive_extraction" = yes; then 282940dd5a57Smrg lockfile=$f_ex_an_ar_oldlib.lock 283040dd5a57Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 283140dd5a57Smrg func_echo "Waiting for $lockfile to be removed" 283240dd5a57Smrg sleep 2 283340dd5a57Smrg done 283440dd5a57Smrg fi 283540dd5a57Smrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 283640dd5a57Smrg 'stat=$?; rm -f "$lockfile"; exit $stat' 283740dd5a57Smrg if test "$lock_old_archive_extraction" = yes; then 283840dd5a57Smrg $opt_dry_run || rm -f "$lockfile" 283940dd5a57Smrg fi 284040dd5a57Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 284140dd5a57Smrg : 284240dd5a57Smrg else 284340dd5a57Smrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 284440dd5a57Smrg fi 284540dd5a57Smrg} 284640dd5a57Smrg 284740dd5a57Smrg 284840dd5a57Smrg# func_extract_archives gentop oldlib ... 284940dd5a57Smrgfunc_extract_archives () 285040dd5a57Smrg{ 285140dd5a57Smrg $opt_debug 285240dd5a57Smrg my_gentop="$1"; shift 285340dd5a57Smrg my_oldlibs=${1+"$@"} 285440dd5a57Smrg my_oldobjs="" 285540dd5a57Smrg my_xlib="" 285640dd5a57Smrg my_xabs="" 285740dd5a57Smrg my_xdir="" 285840dd5a57Smrg 285940dd5a57Smrg for my_xlib in $my_oldlibs; do 286040dd5a57Smrg # Extract the objects. 286140dd5a57Smrg case $my_xlib in 286240dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 286340dd5a57Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 286440dd5a57Smrg esac 286540dd5a57Smrg func_basename "$my_xlib" 286640dd5a57Smrg my_xlib="$func_basename_result" 286740dd5a57Smrg my_xlib_u=$my_xlib 286840dd5a57Smrg while :; do 286940dd5a57Smrg case " $extracted_archives " in 287040dd5a57Smrg *" $my_xlib_u "*) 287140dd5a57Smrg func_arith $extracted_serial + 1 287240dd5a57Smrg extracted_serial=$func_arith_result 287340dd5a57Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 287440dd5a57Smrg *) break ;; 287540dd5a57Smrg esac 287640dd5a57Smrg done 287740dd5a57Smrg extracted_archives="$extracted_archives $my_xlib_u" 287840dd5a57Smrg my_xdir="$my_gentop/$my_xlib_u" 287940dd5a57Smrg 288040dd5a57Smrg func_mkdir_p "$my_xdir" 288140dd5a57Smrg 288240dd5a57Smrg case $host in 288340dd5a57Smrg *-darwin*) 288440dd5a57Smrg func_verbose "Extracting $my_xabs" 288540dd5a57Smrg # Do not bother doing anything if just a dry run 288640dd5a57Smrg $opt_dry_run || { 288740dd5a57Smrg darwin_orig_dir=`pwd` 288840dd5a57Smrg cd $my_xdir || exit $? 288940dd5a57Smrg darwin_archive=$my_xabs 289040dd5a57Smrg darwin_curdir=`pwd` 289140dd5a57Smrg darwin_base_archive=`basename "$darwin_archive"` 289240dd5a57Smrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 289340dd5a57Smrg if test -n "$darwin_arches"; then 289440dd5a57Smrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 289540dd5a57Smrg darwin_arch= 289640dd5a57Smrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 289740dd5a57Smrg for darwin_arch in $darwin_arches ; do 289840dd5a57Smrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 289940dd5a57Smrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 290040dd5a57Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 290140dd5a57Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 290240dd5a57Smrg cd "$darwin_curdir" 290340dd5a57Smrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 290440dd5a57Smrg done # $darwin_arches 290540dd5a57Smrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 290640dd5a57Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 290740dd5a57Smrg darwin_file= 290840dd5a57Smrg darwin_files= 290940dd5a57Smrg for darwin_file in $darwin_filelist; do 291040dd5a57Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 291140dd5a57Smrg $LIPO -create -output "$darwin_file" $darwin_files 291240dd5a57Smrg done # $darwin_filelist 291340dd5a57Smrg $RM -rf unfat-$$ 291440dd5a57Smrg cd "$darwin_orig_dir" 291540dd5a57Smrg else 291640dd5a57Smrg cd $darwin_orig_dir 291740dd5a57Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 291840dd5a57Smrg fi # $darwin_arches 291940dd5a57Smrg } # !$opt_dry_run 292040dd5a57Smrg ;; 292140dd5a57Smrg *) 292240dd5a57Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 292340dd5a57Smrg ;; 292440dd5a57Smrg esac 292540dd5a57Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 292640dd5a57Smrg done 292740dd5a57Smrg 292840dd5a57Smrg func_extract_archives_result="$my_oldobjs" 292940dd5a57Smrg} 293040dd5a57Smrg 293140dd5a57Smrg 293240dd5a57Smrg# func_emit_wrapper [arg=no] 293340dd5a57Smrg# 293440dd5a57Smrg# Emit a libtool wrapper script on stdout. 293540dd5a57Smrg# Don't directly open a file because we may want to 293640dd5a57Smrg# incorporate the script contents within a cygwin/mingw 293740dd5a57Smrg# wrapper executable. Must ONLY be called from within 293840dd5a57Smrg# func_mode_link because it depends on a number of variables 293940dd5a57Smrg# set therein. 294040dd5a57Smrg# 294140dd5a57Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 294240dd5a57Smrg# variable will take. If 'yes', then the emitted script 294340dd5a57Smrg# will assume that the directory in which it is stored is 294440dd5a57Smrg# the $objdir directory. This is a cygwin/mingw-specific 294540dd5a57Smrg# behavior. 294640dd5a57Smrgfunc_emit_wrapper () 294740dd5a57Smrg{ 294840dd5a57Smrg func_emit_wrapper_arg1=${1-no} 294940dd5a57Smrg 295040dd5a57Smrg $ECHO "\ 295140dd5a57Smrg#! $SHELL 295240dd5a57Smrg 295340dd5a57Smrg# $output - temporary wrapper script for $objdir/$outputname 295440dd5a57Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 295540dd5a57Smrg# 295640dd5a57Smrg# The $output program cannot be directly executed until all the libtool 295740dd5a57Smrg# libraries that it depends on are installed. 295840dd5a57Smrg# 295940dd5a57Smrg# This wrapper script should never be moved out of the build directory. 296040dd5a57Smrg# If it is, it will not operate correctly. 296140dd5a57Smrg 296240dd5a57Smrg# Sed substitution that helps us do robust quoting. It backslashifies 296340dd5a57Smrg# metacharacters that are still active within double-quoted strings. 296440dd5a57Smrgsed_quote_subst='$sed_quote_subst' 296540dd5a57Smrg 296640dd5a57Smrg# Be Bourne compatible 296740dd5a57Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 296840dd5a57Smrg emulate sh 296940dd5a57Smrg NULLCMD=: 297040dd5a57Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 297140dd5a57Smrg # is contrary to our usage. Disable this feature. 297240dd5a57Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 297340dd5a57Smrg setopt NO_GLOB_SUBST 297440dd5a57Smrgelse 297540dd5a57Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 297640dd5a57Smrgfi 297740dd5a57SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 297840dd5a57SmrgDUALCASE=1; export DUALCASE # for MKS sh 297940dd5a57Smrg 298040dd5a57Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 298140dd5a57Smrg# if CDPATH is set. 298240dd5a57Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 298340dd5a57Smrg 298440dd5a57Smrgrelink_command=\"$relink_command\" 298540dd5a57Smrg 298640dd5a57Smrg# This environment variable determines our operation mode. 298740dd5a57Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 298840dd5a57Smrg # install mode needs the following variables: 298940dd5a57Smrg generated_by_libtool_version='$macro_version' 299040dd5a57Smrg notinst_deplibs='$notinst_deplibs' 299140dd5a57Smrgelse 299240dd5a57Smrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 299340dd5a57Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 299440dd5a57Smrg file=\"\$0\"" 299540dd5a57Smrg 299640dd5a57Smrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 299740dd5a57Smrg $ECHO "\ 299840dd5a57Smrg 299940dd5a57Smrg# A function that is used when there is no print builtin or printf. 300040dd5a57Smrgfunc_fallback_echo () 300140dd5a57Smrg{ 300240dd5a57Smrg eval 'cat <<_LTECHO_EOF 300340dd5a57Smrg\$1 300440dd5a57Smrg_LTECHO_EOF' 300540dd5a57Smrg} 300640dd5a57Smrg ECHO=\"$qECHO\" 300740dd5a57Smrg fi 300840dd5a57Smrg 300940dd5a57Smrg# Very basic option parsing. These options are (a) specific to 301040dd5a57Smrg# the libtool wrapper, (b) are identical between the wrapper 301140dd5a57Smrg# /script/ and the wrapper /executable/ which is used only on 301240dd5a57Smrg# windows platforms, and (c) all begin with the string "--lt-" 301340dd5a57Smrg# (application programs are unlikely to have options which match 301440dd5a57Smrg# this pattern). 301540dd5a57Smrg# 301640dd5a57Smrg# There are only two supported options: --lt-debug and 301740dd5a57Smrg# --lt-dump-script. There is, deliberately, no --lt-help. 301840dd5a57Smrg# 301940dd5a57Smrg# The first argument to this parsing function should be the 302040dd5a57Smrg# script's $0 value, followed by "$@". 302140dd5a57Smrglt_option_debug= 302240dd5a57Smrgfunc_parse_lt_options () 302340dd5a57Smrg{ 302440dd5a57Smrg lt_script_arg0=\$0 302540dd5a57Smrg shift 302640dd5a57Smrg for lt_opt 302740dd5a57Smrg do 302840dd5a57Smrg case \"\$lt_opt\" in 302940dd5a57Smrg --lt-debug) lt_option_debug=1 ;; 303040dd5a57Smrg --lt-dump-script) 303140dd5a57Smrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 303240dd5a57Smrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 303340dd5a57Smrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 303440dd5a57Smrg cat \"\$lt_dump_D/\$lt_dump_F\" 303540dd5a57Smrg exit 0 303640dd5a57Smrg ;; 303740dd5a57Smrg --lt-*) 303840dd5a57Smrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 303940dd5a57Smrg exit 1 304040dd5a57Smrg ;; 304140dd5a57Smrg esac 304240dd5a57Smrg done 304340dd5a57Smrg 304440dd5a57Smrg # Print the debug banner immediately: 304540dd5a57Smrg if test -n \"\$lt_option_debug\"; then 304640dd5a57Smrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 304740dd5a57Smrg fi 304840dd5a57Smrg} 304940dd5a57Smrg 305040dd5a57Smrg# Used when --lt-debug. Prints its arguments to stdout 305140dd5a57Smrg# (redirection is the responsibility of the caller) 305240dd5a57Smrgfunc_lt_dump_args () 305340dd5a57Smrg{ 305440dd5a57Smrg lt_dump_args_N=1; 305540dd5a57Smrg for lt_arg 305640dd5a57Smrg do 305740dd5a57Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 305840dd5a57Smrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 305940dd5a57Smrg done 306040dd5a57Smrg} 306140dd5a57Smrg 306240dd5a57Smrg# Core function for launching the target application 306340dd5a57Smrgfunc_exec_program_core () 306440dd5a57Smrg{ 306540dd5a57Smrg" 306640dd5a57Smrg case $host in 306740dd5a57Smrg # Backslashes separate directories on plain windows 306840dd5a57Smrg *-*-mingw | *-*-os2* | *-cegcc*) 306940dd5a57Smrg $ECHO "\ 307040dd5a57Smrg if test -n \"\$lt_option_debug\"; then 307140dd5a57Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 307240dd5a57Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 307340dd5a57Smrg fi 307440dd5a57Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 307540dd5a57Smrg" 307640dd5a57Smrg ;; 307740dd5a57Smrg 307840dd5a57Smrg *) 307940dd5a57Smrg $ECHO "\ 308040dd5a57Smrg if test -n \"\$lt_option_debug\"; then 308140dd5a57Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 308240dd5a57Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 308340dd5a57Smrg fi 308440dd5a57Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 308540dd5a57Smrg" 308640dd5a57Smrg ;; 308740dd5a57Smrg esac 308840dd5a57Smrg $ECHO "\ 308940dd5a57Smrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 309040dd5a57Smrg exit 1 309140dd5a57Smrg} 309240dd5a57Smrg 309340dd5a57Smrg# A function to encapsulate launching the target application 309440dd5a57Smrg# Strips options in the --lt-* namespace from \$@ and 309540dd5a57Smrg# launches target application with the remaining arguments. 309640dd5a57Smrgfunc_exec_program () 309740dd5a57Smrg{ 309840dd5a57Smrg for lt_wr_arg 309940dd5a57Smrg do 310040dd5a57Smrg case \$lt_wr_arg in 310140dd5a57Smrg --lt-*) ;; 310240dd5a57Smrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 310340dd5a57Smrg esac 310440dd5a57Smrg shift 310540dd5a57Smrg done 310640dd5a57Smrg func_exec_program_core \${1+\"\$@\"} 310740dd5a57Smrg} 310840dd5a57Smrg 310940dd5a57Smrg # Parse options 311040dd5a57Smrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 311140dd5a57Smrg 311240dd5a57Smrg # Find the directory that this script lives in. 311340dd5a57Smrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 311440dd5a57Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 311540dd5a57Smrg 311640dd5a57Smrg # Follow symbolic links until we get to the real thisdir. 311740dd5a57Smrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 311840dd5a57Smrg while test -n \"\$file\"; do 311940dd5a57Smrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 312040dd5a57Smrg 312140dd5a57Smrg # If there was a directory component, then change thisdir. 312240dd5a57Smrg if test \"x\$destdir\" != \"x\$file\"; then 312340dd5a57Smrg case \"\$destdir\" in 312440dd5a57Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 312540dd5a57Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 312640dd5a57Smrg esac 312740dd5a57Smrg fi 312840dd5a57Smrg 312940dd5a57Smrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 313040dd5a57Smrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 313140dd5a57Smrg done 313240dd5a57Smrg 313340dd5a57Smrg # Usually 'no', except on cygwin/mingw when embedded into 313440dd5a57Smrg # the cwrapper. 313540dd5a57Smrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 313640dd5a57Smrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 313740dd5a57Smrg # special case for '.' 313840dd5a57Smrg if test \"\$thisdir\" = \".\"; then 313940dd5a57Smrg thisdir=\`pwd\` 314040dd5a57Smrg fi 314140dd5a57Smrg # remove .libs from thisdir 314240dd5a57Smrg case \"\$thisdir\" in 314340dd5a57Smrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 314440dd5a57Smrg $objdir ) thisdir=. ;; 314540dd5a57Smrg esac 314640dd5a57Smrg fi 314740dd5a57Smrg 314840dd5a57Smrg # Try to get the absolute directory name. 314940dd5a57Smrg absdir=\`cd \"\$thisdir\" && pwd\` 315040dd5a57Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 315140dd5a57Smrg" 315240dd5a57Smrg 315340dd5a57Smrg if test "$fast_install" = yes; then 315440dd5a57Smrg $ECHO "\ 315540dd5a57Smrg program=lt-'$outputname'$exeext 315640dd5a57Smrg progdir=\"\$thisdir/$objdir\" 315740dd5a57Smrg 315840dd5a57Smrg if test ! -f \"\$progdir/\$program\" || 315940dd5a57Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 316040dd5a57Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 316140dd5a57Smrg 316240dd5a57Smrg file=\"\$\$-\$program\" 316340dd5a57Smrg 316440dd5a57Smrg if test ! -d \"\$progdir\"; then 316540dd5a57Smrg $MKDIR \"\$progdir\" 316640dd5a57Smrg else 316740dd5a57Smrg $RM \"\$progdir/\$file\" 316840dd5a57Smrg fi" 316940dd5a57Smrg 317040dd5a57Smrg $ECHO "\ 317140dd5a57Smrg 317240dd5a57Smrg # relink executable if necessary 317340dd5a57Smrg if test -n \"\$relink_command\"; then 317440dd5a57Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 317540dd5a57Smrg else 317640dd5a57Smrg $ECHO \"\$relink_command_output\" >&2 317740dd5a57Smrg $RM \"\$progdir/\$file\" 317840dd5a57Smrg exit 1 317940dd5a57Smrg fi 318040dd5a57Smrg fi 318140dd5a57Smrg 318240dd5a57Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 318340dd5a57Smrg { $RM \"\$progdir/\$program\"; 318440dd5a57Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 318540dd5a57Smrg $RM \"\$progdir/\$file\" 318640dd5a57Smrg fi" 318740dd5a57Smrg else 318840dd5a57Smrg $ECHO "\ 318940dd5a57Smrg program='$outputname' 319040dd5a57Smrg progdir=\"\$thisdir/$objdir\" 319140dd5a57Smrg" 319240dd5a57Smrg fi 319340dd5a57Smrg 319440dd5a57Smrg $ECHO "\ 319540dd5a57Smrg 319640dd5a57Smrg if test -f \"\$progdir/\$program\"; then" 319740dd5a57Smrg 319840dd5a57Smrg # Export our shlibpath_var if we have one. 319940dd5a57Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 320040dd5a57Smrg $ECHO "\ 320140dd5a57Smrg # Add our own library path to $shlibpath_var 320240dd5a57Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 320340dd5a57Smrg 320440dd5a57Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 320540dd5a57Smrg # The second colon is a workaround for a bug in BeOS R4 sed 320640dd5a57Smrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 320740dd5a57Smrg 320840dd5a57Smrg export $shlibpath_var 320940dd5a57Smrg" 321040dd5a57Smrg fi 321140dd5a57Smrg 321240dd5a57Smrg # fixup the dll searchpath if we need to. 321340dd5a57Smrg if test -n "$dllsearchpath"; then 321440dd5a57Smrg $ECHO "\ 321540dd5a57Smrg # Add the dll search path components to the executable PATH 321640dd5a57Smrg PATH=$dllsearchpath:\$PATH 321740dd5a57Smrg" 321840dd5a57Smrg fi 321940dd5a57Smrg 322040dd5a57Smrg $ECHO "\ 322140dd5a57Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 322240dd5a57Smrg # Run the actual program with our arguments. 322340dd5a57Smrg func_exec_program \${1+\"\$@\"} 322440dd5a57Smrg fi 322540dd5a57Smrg else 322640dd5a57Smrg # The program doesn't exist. 322740dd5a57Smrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 322840dd5a57Smrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 322940dd5a57Smrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 323040dd5a57Smrg exit 1 323140dd5a57Smrg fi 323240dd5a57Smrgfi\ 323340dd5a57Smrg" 323440dd5a57Smrg} 323540dd5a57Smrg 323640dd5a57Smrg 323740dd5a57Smrg# func_to_host_path arg 323840dd5a57Smrg# 323940dd5a57Smrg# Convert paths to host format when used with build tools. 324040dd5a57Smrg# Intended for use with "native" mingw (where libtool itself 324140dd5a57Smrg# is running under the msys shell), or in the following cross- 324240dd5a57Smrg# build environments: 324340dd5a57Smrg# $build $host 324440dd5a57Smrg# mingw (msys) mingw [e.g. native] 324540dd5a57Smrg# cygwin mingw 324640dd5a57Smrg# *nix + wine mingw 324740dd5a57Smrg# where wine is equipped with the `winepath' executable. 324840dd5a57Smrg# In the native mingw case, the (msys) shell automatically 324940dd5a57Smrg# converts paths for any non-msys applications it launches, 325040dd5a57Smrg# but that facility isn't available from inside the cwrapper. 325140dd5a57Smrg# Similar accommodations are necessary for $host mingw and 325240dd5a57Smrg# $build cygwin. Calling this function does no harm for other 325340dd5a57Smrg# $host/$build combinations not listed above. 325440dd5a57Smrg# 325540dd5a57Smrg# ARG is the path (on $build) that should be converted to 325640dd5a57Smrg# the proper representation for $host. The result is stored 325740dd5a57Smrg# in $func_to_host_path_result. 325840dd5a57Smrgfunc_to_host_path () 325940dd5a57Smrg{ 326040dd5a57Smrg func_to_host_path_result="$1" 326140dd5a57Smrg if test -n "$1"; then 326240dd5a57Smrg case $host in 326340dd5a57Smrg *mingw* ) 326440dd5a57Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 326540dd5a57Smrg case $build in 326640dd5a57Smrg *mingw* ) # actually, msys 326740dd5a57Smrg # awkward: cmd appends spaces to result 326840dd5a57Smrg func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | 326940dd5a57Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 327040dd5a57Smrg ;; 327140dd5a57Smrg *cygwin* ) 327240dd5a57Smrg func_to_host_path_result=`cygpath -w "$1" | 327340dd5a57Smrg $SED -e "$lt_sed_naive_backslashify"` 327440dd5a57Smrg ;; 327540dd5a57Smrg * ) 327640dd5a57Smrg # Unfortunately, winepath does not exit with a non-zero 327740dd5a57Smrg # error code, so we are forced to check the contents of 327840dd5a57Smrg # stdout. On the other hand, if the command is not 327940dd5a57Smrg # found, the shell will set an exit code of 127 and print 328040dd5a57Smrg # *an error message* to stdout. So we must check for both 328140dd5a57Smrg # error code of zero AND non-empty stdout, which explains 328240dd5a57Smrg # the odd construction: 328340dd5a57Smrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 328440dd5a57Smrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 328540dd5a57Smrg func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | 328640dd5a57Smrg $SED -e "$lt_sed_naive_backslashify"` 328740dd5a57Smrg else 328840dd5a57Smrg # Allow warning below. 328940dd5a57Smrg func_to_host_path_result= 329040dd5a57Smrg fi 329140dd5a57Smrg ;; 329240dd5a57Smrg esac 329340dd5a57Smrg if test -z "$func_to_host_path_result" ; then 329440dd5a57Smrg func_error "Could not determine host path corresponding to" 329540dd5a57Smrg func_error " \`$1'" 329640dd5a57Smrg func_error "Continuing, but uninstalled executables may not work." 329740dd5a57Smrg # Fallback: 329840dd5a57Smrg func_to_host_path_result="$1" 329940dd5a57Smrg fi 330040dd5a57Smrg ;; 330140dd5a57Smrg esac 330240dd5a57Smrg fi 330340dd5a57Smrg} 330440dd5a57Smrg# end: func_to_host_path 330540dd5a57Smrg 330640dd5a57Smrg# func_to_host_pathlist arg 330740dd5a57Smrg# 330840dd5a57Smrg# Convert pathlists to host format when used with build tools. 330940dd5a57Smrg# See func_to_host_path(), above. This function supports the 331040dd5a57Smrg# following $build/$host combinations (but does no harm for 331140dd5a57Smrg# combinations not listed here): 331240dd5a57Smrg# $build $host 331340dd5a57Smrg# mingw (msys) mingw [e.g. native] 331440dd5a57Smrg# cygwin mingw 331540dd5a57Smrg# *nix + wine mingw 331640dd5a57Smrg# 331740dd5a57Smrg# Path separators are also converted from $build format to 331840dd5a57Smrg# $host format. If ARG begins or ends with a path separator 331940dd5a57Smrg# character, it is preserved (but converted to $host format) 332040dd5a57Smrg# on output. 332140dd5a57Smrg# 332240dd5a57Smrg# ARG is a pathlist (on $build) that should be converted to 332340dd5a57Smrg# the proper representation on $host. The result is stored 332440dd5a57Smrg# in $func_to_host_pathlist_result. 332540dd5a57Smrgfunc_to_host_pathlist () 332640dd5a57Smrg{ 332740dd5a57Smrg func_to_host_pathlist_result="$1" 332840dd5a57Smrg if test -n "$1"; then 332940dd5a57Smrg case $host in 333040dd5a57Smrg *mingw* ) 333140dd5a57Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 333240dd5a57Smrg # Remove leading and trailing path separator characters from 333340dd5a57Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 333440dd5a57Smrg # into '.;' and ';.', and winepath ignores them completely. 333540dd5a57Smrg func_stripname : : "$1" 333640dd5a57Smrg func_to_host_pathlist_tmp1=$func_stripname_result 333740dd5a57Smrg case $build in 333840dd5a57Smrg *mingw* ) # Actually, msys. 333940dd5a57Smrg # Awkward: cmd appends spaces to result. 334040dd5a57Smrg func_to_host_pathlist_result=` 334140dd5a57Smrg ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | 334240dd5a57Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 334340dd5a57Smrg ;; 334440dd5a57Smrg *cygwin* ) 334540dd5a57Smrg func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | 334640dd5a57Smrg $SED -e "$lt_sed_naive_backslashify"` 334740dd5a57Smrg ;; 334840dd5a57Smrg * ) 334940dd5a57Smrg # unfortunately, winepath doesn't convert pathlists 335040dd5a57Smrg func_to_host_pathlist_result="" 335140dd5a57Smrg func_to_host_pathlist_oldIFS=$IFS 335240dd5a57Smrg IFS=: 335340dd5a57Smrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 335440dd5a57Smrg IFS=$func_to_host_pathlist_oldIFS 335540dd5a57Smrg if test -n "$func_to_host_pathlist_f" ; then 335640dd5a57Smrg func_to_host_path "$func_to_host_pathlist_f" 335740dd5a57Smrg if test -n "$func_to_host_path_result" ; then 335840dd5a57Smrg if test -z "$func_to_host_pathlist_result" ; then 335940dd5a57Smrg func_to_host_pathlist_result="$func_to_host_path_result" 336040dd5a57Smrg else 336140dd5a57Smrg func_append func_to_host_pathlist_result ";$func_to_host_path_result" 336240dd5a57Smrg fi 336340dd5a57Smrg fi 336440dd5a57Smrg fi 336540dd5a57Smrg done 336640dd5a57Smrg IFS=$func_to_host_pathlist_oldIFS 336740dd5a57Smrg ;; 336840dd5a57Smrg esac 336940dd5a57Smrg if test -z "$func_to_host_pathlist_result"; then 337040dd5a57Smrg func_error "Could not determine the host path(s) corresponding to" 337140dd5a57Smrg func_error " \`$1'" 337240dd5a57Smrg func_error "Continuing, but uninstalled executables may not work." 337340dd5a57Smrg # Fallback. This may break if $1 contains DOS-style drive 337440dd5a57Smrg # specifications. The fix is not to complicate the expression 337540dd5a57Smrg # below, but for the user to provide a working wine installation 337640dd5a57Smrg # with winepath so that path translation in the cross-to-mingw 337740dd5a57Smrg # case works properly. 337840dd5a57Smrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 337940dd5a57Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 338040dd5a57Smrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 338140dd5a57Smrg fi 338240dd5a57Smrg # Now, add the leading and trailing path separators back 338340dd5a57Smrg case "$1" in 338440dd5a57Smrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 338540dd5a57Smrg ;; 338640dd5a57Smrg esac 338740dd5a57Smrg case "$1" in 338840dd5a57Smrg *: ) func_append func_to_host_pathlist_result ";" 338940dd5a57Smrg ;; 339040dd5a57Smrg esac 339140dd5a57Smrg ;; 339240dd5a57Smrg esac 339340dd5a57Smrg fi 339440dd5a57Smrg} 339540dd5a57Smrg# end: func_to_host_pathlist 339640dd5a57Smrg 339740dd5a57Smrg# func_emit_cwrapperexe_src 339840dd5a57Smrg# emit the source code for a wrapper executable on stdout 339940dd5a57Smrg# Must ONLY be called from within func_mode_link because 340040dd5a57Smrg# it depends on a number of variable set therein. 340140dd5a57Smrgfunc_emit_cwrapperexe_src () 340240dd5a57Smrg{ 340340dd5a57Smrg cat <<EOF 340440dd5a57Smrg 340540dd5a57Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 340640dd5a57Smrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 340740dd5a57Smrg 340840dd5a57Smrg The $output program cannot be directly executed until all the libtool 340940dd5a57Smrg libraries that it depends on are installed. 341040dd5a57Smrg 341140dd5a57Smrg This wrapper executable should never be moved out of the build directory. 341240dd5a57Smrg If it is, it will not operate correctly. 341340dd5a57Smrg*/ 341440dd5a57SmrgEOF 341540dd5a57Smrg cat <<"EOF" 341640dd5a57Smrg#ifdef _MSC_VER 341740dd5a57Smrg# define _CRT_SECURE_NO_DEPRECATE 1 341840dd5a57Smrg#endif 341940dd5a57Smrg#include <stdio.h> 342040dd5a57Smrg#include <stdlib.h> 342140dd5a57Smrg#ifdef _MSC_VER 342240dd5a57Smrg# include <direct.h> 342340dd5a57Smrg# include <process.h> 342440dd5a57Smrg# include <io.h> 342540dd5a57Smrg#else 342640dd5a57Smrg# include <unistd.h> 342740dd5a57Smrg# include <stdint.h> 342840dd5a57Smrg# ifdef __CYGWIN__ 342940dd5a57Smrg# include <io.h> 343040dd5a57Smrg# endif 343140dd5a57Smrg#endif 343240dd5a57Smrg#include <malloc.h> 343340dd5a57Smrg#include <stdarg.h> 343440dd5a57Smrg#include <assert.h> 343540dd5a57Smrg#include <string.h> 343640dd5a57Smrg#include <ctype.h> 343740dd5a57Smrg#include <errno.h> 343840dd5a57Smrg#include <fcntl.h> 343940dd5a57Smrg#include <sys/stat.h> 344040dd5a57Smrg 344140dd5a57Smrg/* declarations of non-ANSI functions */ 344240dd5a57Smrg#if defined(__MINGW32__) 344340dd5a57Smrg# ifdef __STRICT_ANSI__ 344440dd5a57Smrgint _putenv (const char *); 344540dd5a57Smrg# endif 344640dd5a57Smrg#elif defined(__CYGWIN__) 344740dd5a57Smrg# ifdef __STRICT_ANSI__ 344840dd5a57Smrgchar *realpath (const char *, char *); 344940dd5a57Smrgint putenv (char *); 345040dd5a57Smrgint setenv (const char *, const char *, int); 345140dd5a57Smrg# endif 345240dd5a57Smrg/* #elif defined (other platforms) ... */ 345340dd5a57Smrg#endif 345440dd5a57Smrg 345540dd5a57Smrg/* portability defines, excluding path handling macros */ 345640dd5a57Smrg#if defined(_MSC_VER) 345740dd5a57Smrg# define setmode _setmode 345840dd5a57Smrg# define stat _stat 345940dd5a57Smrg# define chmod _chmod 346040dd5a57Smrg# define getcwd _getcwd 346140dd5a57Smrg# define putenv _putenv 346240dd5a57Smrg# define S_IXUSR _S_IEXEC 346340dd5a57Smrg# ifndef _INTPTR_T_DEFINED 346440dd5a57Smrg# define _INTPTR_T_DEFINED 346540dd5a57Smrg# define intptr_t int 346640dd5a57Smrg# endif 346740dd5a57Smrg#elif defined(__MINGW32__) 346840dd5a57Smrg# define setmode _setmode 346940dd5a57Smrg# define stat _stat 347040dd5a57Smrg# define chmod _chmod 347140dd5a57Smrg# define getcwd _getcwd 347240dd5a57Smrg# define putenv _putenv 347340dd5a57Smrg#elif defined(__CYGWIN__) 347440dd5a57Smrg# define HAVE_SETENV 347540dd5a57Smrg# define FOPEN_WB "wb" 347640dd5a57Smrg/* #elif defined (other platforms) ... */ 347740dd5a57Smrg#endif 347840dd5a57Smrg 347940dd5a57Smrg#if defined(PATH_MAX) 348040dd5a57Smrg# define LT_PATHMAX PATH_MAX 348140dd5a57Smrg#elif defined(MAXPATHLEN) 348240dd5a57Smrg# define LT_PATHMAX MAXPATHLEN 348340dd5a57Smrg#else 348440dd5a57Smrg# define LT_PATHMAX 1024 348540dd5a57Smrg#endif 348640dd5a57Smrg 348740dd5a57Smrg#ifndef S_IXOTH 348840dd5a57Smrg# define S_IXOTH 0 348940dd5a57Smrg#endif 349040dd5a57Smrg#ifndef S_IXGRP 349140dd5a57Smrg# define S_IXGRP 0 349240dd5a57Smrg#endif 349340dd5a57Smrg 349440dd5a57Smrg/* path handling portability macros */ 349540dd5a57Smrg#ifndef DIR_SEPARATOR 349640dd5a57Smrg# define DIR_SEPARATOR '/' 349740dd5a57Smrg# define PATH_SEPARATOR ':' 349840dd5a57Smrg#endif 349940dd5a57Smrg 350040dd5a57Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 350140dd5a57Smrg defined (__OS2__) 350240dd5a57Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 350340dd5a57Smrg# define FOPEN_WB "wb" 350440dd5a57Smrg# ifndef DIR_SEPARATOR_2 350540dd5a57Smrg# define DIR_SEPARATOR_2 '\\' 350640dd5a57Smrg# endif 350740dd5a57Smrg# ifndef PATH_SEPARATOR_2 350840dd5a57Smrg# define PATH_SEPARATOR_2 ';' 350940dd5a57Smrg# endif 351040dd5a57Smrg#endif 351140dd5a57Smrg 351240dd5a57Smrg#ifndef DIR_SEPARATOR_2 351340dd5a57Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 351440dd5a57Smrg#else /* DIR_SEPARATOR_2 */ 351540dd5a57Smrg# define IS_DIR_SEPARATOR(ch) \ 351640dd5a57Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 351740dd5a57Smrg#endif /* DIR_SEPARATOR_2 */ 351840dd5a57Smrg 351940dd5a57Smrg#ifndef PATH_SEPARATOR_2 352040dd5a57Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 352140dd5a57Smrg#else /* PATH_SEPARATOR_2 */ 352240dd5a57Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 352340dd5a57Smrg#endif /* PATH_SEPARATOR_2 */ 352440dd5a57Smrg 352540dd5a57Smrg#ifndef FOPEN_WB 352640dd5a57Smrg# define FOPEN_WB "w" 352740dd5a57Smrg#endif 352840dd5a57Smrg#ifndef _O_BINARY 352940dd5a57Smrg# define _O_BINARY 0 353040dd5a57Smrg#endif 353140dd5a57Smrg 353240dd5a57Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 353340dd5a57Smrg#define XFREE(stale) do { \ 353440dd5a57Smrg if (stale) { free ((void *) stale); stale = 0; } \ 353540dd5a57Smrg} while (0) 353640dd5a57Smrg 353740dd5a57Smrg#if defined(LT_DEBUGWRAPPER) 353840dd5a57Smrgstatic int lt_debug = 1; 353940dd5a57Smrg#else 354040dd5a57Smrgstatic int lt_debug = 0; 354140dd5a57Smrg#endif 354240dd5a57Smrg 354340dd5a57Smrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 354440dd5a57Smrg 354540dd5a57Smrgvoid *xmalloc (size_t num); 354640dd5a57Smrgchar *xstrdup (const char *string); 354740dd5a57Smrgconst char *base_name (const char *name); 354840dd5a57Smrgchar *find_executable (const char *wrapper); 354940dd5a57Smrgchar *chase_symlinks (const char *pathspec); 355040dd5a57Smrgint make_executable (const char *path); 355140dd5a57Smrgint check_executable (const char *path); 355240dd5a57Smrgchar *strendzap (char *str, const char *pat); 355340dd5a57Smrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 355440dd5a57Smrgvoid lt_fatal (const char *file, int line, const char *message, ...); 355540dd5a57Smrgstatic const char *nonnull (const char *s); 355640dd5a57Smrgstatic const char *nonempty (const char *s); 355740dd5a57Smrgvoid lt_setenv (const char *name, const char *value); 355840dd5a57Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 355940dd5a57Smrgvoid lt_update_exe_path (const char *name, const char *value); 356040dd5a57Smrgvoid lt_update_lib_path (const char *name, const char *value); 356140dd5a57Smrgchar **prepare_spawn (char **argv); 356240dd5a57Smrgvoid lt_dump_script (FILE *f); 356340dd5a57SmrgEOF 356440dd5a57Smrg 356540dd5a57Smrg cat <<EOF 356640dd5a57Smrgconst char * MAGIC_EXE = "$magic_exe"; 356740dd5a57Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 356840dd5a57SmrgEOF 356940dd5a57Smrg 357040dd5a57Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 357140dd5a57Smrg func_to_host_pathlist "$temp_rpath" 357240dd5a57Smrg cat <<EOF 357340dd5a57Smrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 357440dd5a57SmrgEOF 357540dd5a57Smrg else 357640dd5a57Smrg cat <<"EOF" 357740dd5a57Smrgconst char * LIB_PATH_VALUE = ""; 357840dd5a57SmrgEOF 357940dd5a57Smrg fi 358040dd5a57Smrg 358140dd5a57Smrg if test -n "$dllsearchpath"; then 358240dd5a57Smrg func_to_host_pathlist "$dllsearchpath:" 358340dd5a57Smrg cat <<EOF 358440dd5a57Smrgconst char * EXE_PATH_VARNAME = "PATH"; 358540dd5a57Smrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 358640dd5a57SmrgEOF 358740dd5a57Smrg else 358840dd5a57Smrg cat <<"EOF" 358940dd5a57Smrgconst char * EXE_PATH_VARNAME = ""; 359040dd5a57Smrgconst char * EXE_PATH_VALUE = ""; 359140dd5a57SmrgEOF 359240dd5a57Smrg fi 359340dd5a57Smrg 359440dd5a57Smrg if test "$fast_install" = yes; then 359540dd5a57Smrg cat <<EOF 359640dd5a57Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 359740dd5a57SmrgEOF 359840dd5a57Smrg else 359940dd5a57Smrg cat <<EOF 360040dd5a57Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 360140dd5a57SmrgEOF 360240dd5a57Smrg fi 360340dd5a57Smrg 360440dd5a57Smrg 360540dd5a57Smrg cat <<"EOF" 360640dd5a57Smrg 360740dd5a57Smrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 360840dd5a57Smrg 360940dd5a57Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 361040dd5a57Smrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 361140dd5a57Smrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 361240dd5a57Smrg 361340dd5a57Smrgint 361440dd5a57Smrgmain (int argc, char *argv[]) 361540dd5a57Smrg{ 361640dd5a57Smrg char **newargz; 361740dd5a57Smrg int newargc; 361840dd5a57Smrg char *tmp_pathspec; 361940dd5a57Smrg char *actual_cwrapper_path; 362040dd5a57Smrg char *actual_cwrapper_name; 362140dd5a57Smrg char *target_name; 362240dd5a57Smrg char *lt_argv_zero; 362340dd5a57Smrg intptr_t rval = 127; 362440dd5a57Smrg 362540dd5a57Smrg int i; 362640dd5a57Smrg 362740dd5a57Smrg program_name = (char *) xstrdup (base_name (argv[0])); 362840dd5a57Smrg newargz = XMALLOC (char *, argc + 1); 362940dd5a57Smrg 363040dd5a57Smrg /* very simple arg parsing; don't want to rely on getopt 363140dd5a57Smrg * also, copy all non cwrapper options to newargz, except 363240dd5a57Smrg * argz[0], which is handled differently 363340dd5a57Smrg */ 363440dd5a57Smrg newargc=0; 363540dd5a57Smrg for (i = 1; i < argc; i++) 363640dd5a57Smrg { 363740dd5a57Smrg if (strcmp (argv[i], dumpscript_opt) == 0) 363840dd5a57Smrg { 363940dd5a57SmrgEOF 364040dd5a57Smrg case "$host" in 364140dd5a57Smrg *mingw* | *cygwin* ) 364240dd5a57Smrg # make stdout use "unix" line endings 364340dd5a57Smrg echo " setmode(1,_O_BINARY);" 364440dd5a57Smrg ;; 364540dd5a57Smrg esac 364640dd5a57Smrg 364740dd5a57Smrg cat <<"EOF" 364840dd5a57Smrg lt_dump_script (stdout); 364940dd5a57Smrg return 0; 365040dd5a57Smrg } 365140dd5a57Smrg if (strcmp (argv[i], debug_opt) == 0) 365240dd5a57Smrg { 365340dd5a57Smrg lt_debug = 1; 365440dd5a57Smrg continue; 365540dd5a57Smrg } 365640dd5a57Smrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 365740dd5a57Smrg { 365840dd5a57Smrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 365940dd5a57Smrg namespace, but it is not one of the ones we know about and 366040dd5a57Smrg have already dealt with, above (inluding dump-script), then 366140dd5a57Smrg report an error. Otherwise, targets might begin to believe 366240dd5a57Smrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 366340dd5a57Smrg namespace. The first time any user complains about this, we'll 366440dd5a57Smrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 366540dd5a57Smrg or a configure.ac-settable value. 366640dd5a57Smrg */ 366740dd5a57Smrg lt_fatal (__FILE__, __LINE__, 366840dd5a57Smrg "unrecognized %s option: '%s'", 366940dd5a57Smrg ltwrapper_option_prefix, argv[i]); 367040dd5a57Smrg } 367140dd5a57Smrg /* otherwise ... */ 367240dd5a57Smrg newargz[++newargc] = xstrdup (argv[i]); 367340dd5a57Smrg } 367440dd5a57Smrg newargz[++newargc] = NULL; 367540dd5a57Smrg 367640dd5a57SmrgEOF 367740dd5a57Smrg cat <<EOF 367840dd5a57Smrg /* The GNU banner must be the first non-error debug message */ 367940dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 368040dd5a57SmrgEOF 368140dd5a57Smrg cat <<"EOF" 368240dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 368340dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 368440dd5a57Smrg 368540dd5a57Smrg tmp_pathspec = find_executable (argv[0]); 368640dd5a57Smrg if (tmp_pathspec == NULL) 368740dd5a57Smrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 368840dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 368940dd5a57Smrg "(main) found exe (before symlink chase) at: %s\n", 369040dd5a57Smrg tmp_pathspec); 369140dd5a57Smrg 369240dd5a57Smrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 369340dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 369440dd5a57Smrg "(main) found exe (after symlink chase) at: %s\n", 369540dd5a57Smrg actual_cwrapper_path); 369640dd5a57Smrg XFREE (tmp_pathspec); 369740dd5a57Smrg 369840dd5a57Smrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 369940dd5a57Smrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 370040dd5a57Smrg 370140dd5a57Smrg /* wrapper name transforms */ 370240dd5a57Smrg strendzap (actual_cwrapper_name, ".exe"); 370340dd5a57Smrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 370440dd5a57Smrg XFREE (actual_cwrapper_name); 370540dd5a57Smrg actual_cwrapper_name = tmp_pathspec; 370640dd5a57Smrg tmp_pathspec = 0; 370740dd5a57Smrg 370840dd5a57Smrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 370940dd5a57Smrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 371040dd5a57Smrg strendzap (target_name, ".exe"); 371140dd5a57Smrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 371240dd5a57Smrg XFREE (target_name); 371340dd5a57Smrg target_name = tmp_pathspec; 371440dd5a57Smrg tmp_pathspec = 0; 371540dd5a57Smrg 371640dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 371740dd5a57Smrg "(main) libtool target name: %s\n", 371840dd5a57Smrg target_name); 371940dd5a57SmrgEOF 372040dd5a57Smrg 372140dd5a57Smrg cat <<EOF 372240dd5a57Smrg newargz[0] = 372340dd5a57Smrg XMALLOC (char, (strlen (actual_cwrapper_path) + 372440dd5a57Smrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 372540dd5a57Smrg strcpy (newargz[0], actual_cwrapper_path); 372640dd5a57Smrg strcat (newargz[0], "$objdir"); 372740dd5a57Smrg strcat (newargz[0], "/"); 372840dd5a57SmrgEOF 372940dd5a57Smrg 373040dd5a57Smrg cat <<"EOF" 373140dd5a57Smrg /* stop here, and copy so we don't have to do this twice */ 373240dd5a57Smrg tmp_pathspec = xstrdup (newargz[0]); 373340dd5a57Smrg 373440dd5a57Smrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 373540dd5a57Smrg strcat (newargz[0], actual_cwrapper_name); 373640dd5a57Smrg 373740dd5a57Smrg /* DO want the lt- prefix here if it exists, so use target_name */ 373840dd5a57Smrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 373940dd5a57Smrg XFREE (tmp_pathspec); 374040dd5a57Smrg tmp_pathspec = NULL; 374140dd5a57SmrgEOF 374240dd5a57Smrg 374340dd5a57Smrg case $host_os in 374440dd5a57Smrg mingw*) 374540dd5a57Smrg cat <<"EOF" 374640dd5a57Smrg { 374740dd5a57Smrg char* p; 374840dd5a57Smrg while ((p = strchr (newargz[0], '\\')) != NULL) 374940dd5a57Smrg { 375040dd5a57Smrg *p = '/'; 375140dd5a57Smrg } 375240dd5a57Smrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 375340dd5a57Smrg { 375440dd5a57Smrg *p = '/'; 375540dd5a57Smrg } 375640dd5a57Smrg } 375740dd5a57SmrgEOF 375840dd5a57Smrg ;; 375940dd5a57Smrg esac 376040dd5a57Smrg 376140dd5a57Smrg cat <<"EOF" 376240dd5a57Smrg XFREE (target_name); 376340dd5a57Smrg XFREE (actual_cwrapper_path); 376440dd5a57Smrg XFREE (actual_cwrapper_name); 376540dd5a57Smrg 376640dd5a57Smrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 376740dd5a57Smrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 376840dd5a57Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 376940dd5a57Smrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 377040dd5a57Smrg 377140dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 377240dd5a57Smrg nonnull (lt_argv_zero)); 377340dd5a57Smrg for (i = 0; i < newargc; i++) 377440dd5a57Smrg { 377540dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 377640dd5a57Smrg i, nonnull (newargz[i])); 377740dd5a57Smrg } 377840dd5a57Smrg 377940dd5a57SmrgEOF 378040dd5a57Smrg 378140dd5a57Smrg case $host_os in 378240dd5a57Smrg mingw*) 378340dd5a57Smrg cat <<"EOF" 378440dd5a57Smrg /* execv doesn't actually work on mingw as expected on unix */ 378540dd5a57Smrg newargz = prepare_spawn (newargz); 378640dd5a57Smrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 378740dd5a57Smrg if (rval == -1) 378840dd5a57Smrg { 378940dd5a57Smrg /* failed to start process */ 379040dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 379140dd5a57Smrg "(main) failed to launch target \"%s\": %s\n", 379240dd5a57Smrg lt_argv_zero, nonnull (strerror (errno))); 379340dd5a57Smrg return 127; 379440dd5a57Smrg } 379540dd5a57Smrg return rval; 379640dd5a57SmrgEOF 379740dd5a57Smrg ;; 379840dd5a57Smrg *) 379940dd5a57Smrg cat <<"EOF" 380040dd5a57Smrg execv (lt_argv_zero, newargz); 380140dd5a57Smrg return rval; /* =127, but avoids unused variable warning */ 380240dd5a57SmrgEOF 380340dd5a57Smrg ;; 380440dd5a57Smrg esac 380540dd5a57Smrg 380640dd5a57Smrg cat <<"EOF" 380740dd5a57Smrg} 380840dd5a57Smrg 380940dd5a57Smrgvoid * 381040dd5a57Smrgxmalloc (size_t num) 381140dd5a57Smrg{ 381240dd5a57Smrg void *p = (void *) malloc (num); 381340dd5a57Smrg if (!p) 381440dd5a57Smrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 381540dd5a57Smrg 381640dd5a57Smrg return p; 381740dd5a57Smrg} 381840dd5a57Smrg 381940dd5a57Smrgchar * 382040dd5a57Smrgxstrdup (const char *string) 382140dd5a57Smrg{ 382240dd5a57Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 382340dd5a57Smrg string) : NULL; 382440dd5a57Smrg} 382540dd5a57Smrg 382640dd5a57Smrgconst char * 382740dd5a57Smrgbase_name (const char *name) 382840dd5a57Smrg{ 382940dd5a57Smrg const char *base; 383040dd5a57Smrg 383140dd5a57Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 383240dd5a57Smrg /* Skip over the disk name in MSDOS pathnames. */ 383340dd5a57Smrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 383440dd5a57Smrg name += 2; 383540dd5a57Smrg#endif 383640dd5a57Smrg 383740dd5a57Smrg for (base = name; *name; name++) 383840dd5a57Smrg if (IS_DIR_SEPARATOR (*name)) 383940dd5a57Smrg base = name + 1; 384040dd5a57Smrg return base; 384140dd5a57Smrg} 384240dd5a57Smrg 384340dd5a57Smrgint 384440dd5a57Smrgcheck_executable (const char *path) 384540dd5a57Smrg{ 384640dd5a57Smrg struct stat st; 384740dd5a57Smrg 384840dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 384940dd5a57Smrg nonempty (path)); 385040dd5a57Smrg if ((!path) || (!*path)) 385140dd5a57Smrg return 0; 385240dd5a57Smrg 385340dd5a57Smrg if ((stat (path, &st) >= 0) 385440dd5a57Smrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 385540dd5a57Smrg return 1; 385640dd5a57Smrg else 385740dd5a57Smrg return 0; 385840dd5a57Smrg} 385940dd5a57Smrg 386040dd5a57Smrgint 386140dd5a57Smrgmake_executable (const char *path) 386240dd5a57Smrg{ 386340dd5a57Smrg int rval = 0; 386440dd5a57Smrg struct stat st; 386540dd5a57Smrg 386640dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 386740dd5a57Smrg nonempty (path)); 386840dd5a57Smrg if ((!path) || (!*path)) 386940dd5a57Smrg return 0; 387040dd5a57Smrg 387140dd5a57Smrg if (stat (path, &st) >= 0) 387240dd5a57Smrg { 387340dd5a57Smrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 387440dd5a57Smrg } 387540dd5a57Smrg return rval; 387640dd5a57Smrg} 387740dd5a57Smrg 387840dd5a57Smrg/* Searches for the full path of the wrapper. Returns 387940dd5a57Smrg newly allocated full path name if found, NULL otherwise 388040dd5a57Smrg Does not chase symlinks, even on platforms that support them. 388140dd5a57Smrg*/ 388240dd5a57Smrgchar * 388340dd5a57Smrgfind_executable (const char *wrapper) 388440dd5a57Smrg{ 388540dd5a57Smrg int has_slash = 0; 388640dd5a57Smrg const char *p; 388740dd5a57Smrg const char *p_next; 388840dd5a57Smrg /* static buffer for getcwd */ 388940dd5a57Smrg char tmp[LT_PATHMAX + 1]; 389040dd5a57Smrg int tmp_len; 389140dd5a57Smrg char *concat_name; 389240dd5a57Smrg 389340dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 389440dd5a57Smrg nonempty (wrapper)); 389540dd5a57Smrg 389640dd5a57Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 389740dd5a57Smrg return NULL; 389840dd5a57Smrg 389940dd5a57Smrg /* Absolute path? */ 390040dd5a57Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 390140dd5a57Smrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 390240dd5a57Smrg { 390340dd5a57Smrg concat_name = xstrdup (wrapper); 390440dd5a57Smrg if (check_executable (concat_name)) 390540dd5a57Smrg return concat_name; 390640dd5a57Smrg XFREE (concat_name); 390740dd5a57Smrg } 390840dd5a57Smrg else 390940dd5a57Smrg { 391040dd5a57Smrg#endif 391140dd5a57Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 391240dd5a57Smrg { 391340dd5a57Smrg concat_name = xstrdup (wrapper); 391440dd5a57Smrg if (check_executable (concat_name)) 391540dd5a57Smrg return concat_name; 391640dd5a57Smrg XFREE (concat_name); 391740dd5a57Smrg } 391840dd5a57Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 391940dd5a57Smrg } 392040dd5a57Smrg#endif 392140dd5a57Smrg 392240dd5a57Smrg for (p = wrapper; *p; p++) 392340dd5a57Smrg if (*p == '/') 392440dd5a57Smrg { 392540dd5a57Smrg has_slash = 1; 392640dd5a57Smrg break; 392740dd5a57Smrg } 392840dd5a57Smrg if (!has_slash) 392940dd5a57Smrg { 393040dd5a57Smrg /* no slashes; search PATH */ 393140dd5a57Smrg const char *path = getenv ("PATH"); 393240dd5a57Smrg if (path != NULL) 393340dd5a57Smrg { 393440dd5a57Smrg for (p = path; *p; p = p_next) 393540dd5a57Smrg { 393640dd5a57Smrg const char *q; 393740dd5a57Smrg size_t p_len; 393840dd5a57Smrg for (q = p; *q; q++) 393940dd5a57Smrg if (IS_PATH_SEPARATOR (*q)) 394040dd5a57Smrg break; 394140dd5a57Smrg p_len = q - p; 394240dd5a57Smrg p_next = (*q == '\0' ? q : q + 1); 394340dd5a57Smrg if (p_len == 0) 394440dd5a57Smrg { 394540dd5a57Smrg /* empty path: current directory */ 394640dd5a57Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 394740dd5a57Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 394840dd5a57Smrg nonnull (strerror (errno))); 394940dd5a57Smrg tmp_len = strlen (tmp); 395040dd5a57Smrg concat_name = 395140dd5a57Smrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 395240dd5a57Smrg memcpy (concat_name, tmp, tmp_len); 395340dd5a57Smrg concat_name[tmp_len] = '/'; 395440dd5a57Smrg strcpy (concat_name + tmp_len + 1, wrapper); 395540dd5a57Smrg } 395640dd5a57Smrg else 395740dd5a57Smrg { 395840dd5a57Smrg concat_name = 395940dd5a57Smrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 396040dd5a57Smrg memcpy (concat_name, p, p_len); 396140dd5a57Smrg concat_name[p_len] = '/'; 396240dd5a57Smrg strcpy (concat_name + p_len + 1, wrapper); 396340dd5a57Smrg } 396440dd5a57Smrg if (check_executable (concat_name)) 396540dd5a57Smrg return concat_name; 396640dd5a57Smrg XFREE (concat_name); 396740dd5a57Smrg } 396840dd5a57Smrg } 396940dd5a57Smrg /* not found in PATH; assume curdir */ 397040dd5a57Smrg } 397140dd5a57Smrg /* Relative path | not found in path: prepend cwd */ 397240dd5a57Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 397340dd5a57Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 397440dd5a57Smrg nonnull (strerror (errno))); 397540dd5a57Smrg tmp_len = strlen (tmp); 397640dd5a57Smrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 397740dd5a57Smrg memcpy (concat_name, tmp, tmp_len); 397840dd5a57Smrg concat_name[tmp_len] = '/'; 397940dd5a57Smrg strcpy (concat_name + tmp_len + 1, wrapper); 398040dd5a57Smrg 398140dd5a57Smrg if (check_executable (concat_name)) 398240dd5a57Smrg return concat_name; 398340dd5a57Smrg XFREE (concat_name); 398440dd5a57Smrg return NULL; 398540dd5a57Smrg} 398640dd5a57Smrg 398740dd5a57Smrgchar * 398840dd5a57Smrgchase_symlinks (const char *pathspec) 398940dd5a57Smrg{ 399040dd5a57Smrg#ifndef S_ISLNK 399140dd5a57Smrg return xstrdup (pathspec); 399240dd5a57Smrg#else 399340dd5a57Smrg char buf[LT_PATHMAX]; 399440dd5a57Smrg struct stat s; 399540dd5a57Smrg char *tmp_pathspec = xstrdup (pathspec); 399640dd5a57Smrg char *p; 399740dd5a57Smrg int has_symlinks = 0; 399840dd5a57Smrg while (strlen (tmp_pathspec) && !has_symlinks) 399940dd5a57Smrg { 400040dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 400140dd5a57Smrg "checking path component for symlinks: %s\n", 400240dd5a57Smrg tmp_pathspec); 400340dd5a57Smrg if (lstat (tmp_pathspec, &s) == 0) 400440dd5a57Smrg { 400540dd5a57Smrg if (S_ISLNK (s.st_mode) != 0) 400640dd5a57Smrg { 400740dd5a57Smrg has_symlinks = 1; 400840dd5a57Smrg break; 400940dd5a57Smrg } 401040dd5a57Smrg 401140dd5a57Smrg /* search backwards for last DIR_SEPARATOR */ 401240dd5a57Smrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 401340dd5a57Smrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401440dd5a57Smrg p--; 401540dd5a57Smrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401640dd5a57Smrg { 401740dd5a57Smrg /* no more DIR_SEPARATORS left */ 401840dd5a57Smrg break; 401940dd5a57Smrg } 402040dd5a57Smrg *p = '\0'; 402140dd5a57Smrg } 402240dd5a57Smrg else 402340dd5a57Smrg { 402440dd5a57Smrg lt_fatal (__FILE__, __LINE__, 402540dd5a57Smrg "error accessing file \"%s\": %s", 402640dd5a57Smrg tmp_pathspec, nonnull (strerror (errno))); 402740dd5a57Smrg } 402840dd5a57Smrg } 402940dd5a57Smrg XFREE (tmp_pathspec); 403040dd5a57Smrg 403140dd5a57Smrg if (!has_symlinks) 403240dd5a57Smrg { 403340dd5a57Smrg return xstrdup (pathspec); 403440dd5a57Smrg } 403540dd5a57Smrg 403640dd5a57Smrg tmp_pathspec = realpath (pathspec, buf); 403740dd5a57Smrg if (tmp_pathspec == 0) 403840dd5a57Smrg { 403940dd5a57Smrg lt_fatal (__FILE__, __LINE__, 404040dd5a57Smrg "could not follow symlinks for %s", pathspec); 404140dd5a57Smrg } 404240dd5a57Smrg return xstrdup (tmp_pathspec); 404340dd5a57Smrg#endif 404440dd5a57Smrg} 404540dd5a57Smrg 404640dd5a57Smrgchar * 404740dd5a57Smrgstrendzap (char *str, const char *pat) 404840dd5a57Smrg{ 404940dd5a57Smrg size_t len, patlen; 405040dd5a57Smrg 405140dd5a57Smrg assert (str != NULL); 405240dd5a57Smrg assert (pat != NULL); 405340dd5a57Smrg 405440dd5a57Smrg len = strlen (str); 405540dd5a57Smrg patlen = strlen (pat); 405640dd5a57Smrg 405740dd5a57Smrg if (patlen <= len) 405840dd5a57Smrg { 405940dd5a57Smrg str += len - patlen; 406040dd5a57Smrg if (strcmp (str, pat) == 0) 406140dd5a57Smrg *str = '\0'; 406240dd5a57Smrg } 406340dd5a57Smrg return str; 406440dd5a57Smrg} 406540dd5a57Smrg 406640dd5a57Smrgvoid 406740dd5a57Smrglt_debugprintf (const char *file, int line, const char *fmt, ...) 406840dd5a57Smrg{ 406940dd5a57Smrg va_list args; 407040dd5a57Smrg if (lt_debug) 407140dd5a57Smrg { 407240dd5a57Smrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 407340dd5a57Smrg va_start (args, fmt); 407440dd5a57Smrg (void) vfprintf (stderr, fmt, args); 407540dd5a57Smrg va_end (args); 407640dd5a57Smrg } 407740dd5a57Smrg} 407840dd5a57Smrg 407940dd5a57Smrgstatic void 408040dd5a57Smrglt_error_core (int exit_status, const char *file, 408140dd5a57Smrg int line, const char *mode, 408240dd5a57Smrg const char *message, va_list ap) 408340dd5a57Smrg{ 408440dd5a57Smrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 408540dd5a57Smrg vfprintf (stderr, message, ap); 408640dd5a57Smrg fprintf (stderr, ".\n"); 408740dd5a57Smrg 408840dd5a57Smrg if (exit_status >= 0) 408940dd5a57Smrg exit (exit_status); 409040dd5a57Smrg} 409140dd5a57Smrg 409240dd5a57Smrgvoid 409340dd5a57Smrglt_fatal (const char *file, int line, const char *message, ...) 409440dd5a57Smrg{ 409540dd5a57Smrg va_list ap; 409640dd5a57Smrg va_start (ap, message); 409740dd5a57Smrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 409840dd5a57Smrg va_end (ap); 409940dd5a57Smrg} 410040dd5a57Smrg 410140dd5a57Smrgstatic const char * 410240dd5a57Smrgnonnull (const char *s) 410340dd5a57Smrg{ 410440dd5a57Smrg return s ? s : "(null)"; 410540dd5a57Smrg} 410640dd5a57Smrg 410740dd5a57Smrgstatic const char * 410840dd5a57Smrgnonempty (const char *s) 410940dd5a57Smrg{ 411040dd5a57Smrg return (s && !*s) ? "(empty)" : nonnull (s); 411140dd5a57Smrg} 411240dd5a57Smrg 411340dd5a57Smrgvoid 411440dd5a57Smrglt_setenv (const char *name, const char *value) 411540dd5a57Smrg{ 411640dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 411740dd5a57Smrg "(lt_setenv) setting '%s' to '%s'\n", 411840dd5a57Smrg nonnull (name), nonnull (value)); 411940dd5a57Smrg { 412040dd5a57Smrg#ifdef HAVE_SETENV 412140dd5a57Smrg /* always make a copy, for consistency with !HAVE_SETENV */ 412240dd5a57Smrg char *str = xstrdup (value); 412340dd5a57Smrg setenv (name, str, 1); 412440dd5a57Smrg#else 412540dd5a57Smrg int len = strlen (name) + 1 + strlen (value) + 1; 412640dd5a57Smrg char *str = XMALLOC (char, len); 412740dd5a57Smrg sprintf (str, "%s=%s", name, value); 412840dd5a57Smrg if (putenv (str) != EXIT_SUCCESS) 412940dd5a57Smrg { 413040dd5a57Smrg XFREE (str); 413140dd5a57Smrg } 413240dd5a57Smrg#endif 413340dd5a57Smrg } 413440dd5a57Smrg} 413540dd5a57Smrg 413640dd5a57Smrgchar * 413740dd5a57Smrglt_extend_str (const char *orig_value, const char *add, int to_end) 413840dd5a57Smrg{ 413940dd5a57Smrg char *new_value; 414040dd5a57Smrg if (orig_value && *orig_value) 414140dd5a57Smrg { 414240dd5a57Smrg int orig_value_len = strlen (orig_value); 414340dd5a57Smrg int add_len = strlen (add); 414440dd5a57Smrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 414540dd5a57Smrg if (to_end) 414640dd5a57Smrg { 414740dd5a57Smrg strcpy (new_value, orig_value); 414840dd5a57Smrg strcpy (new_value + orig_value_len, add); 414940dd5a57Smrg } 415040dd5a57Smrg else 415140dd5a57Smrg { 415240dd5a57Smrg strcpy (new_value, add); 415340dd5a57Smrg strcpy (new_value + add_len, orig_value); 415440dd5a57Smrg } 415540dd5a57Smrg } 415640dd5a57Smrg else 415740dd5a57Smrg { 415840dd5a57Smrg new_value = xstrdup (add); 415940dd5a57Smrg } 416040dd5a57Smrg return new_value; 416140dd5a57Smrg} 416240dd5a57Smrg 416340dd5a57Smrgvoid 416440dd5a57Smrglt_update_exe_path (const char *name, const char *value) 416540dd5a57Smrg{ 416640dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 416740dd5a57Smrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 416840dd5a57Smrg nonnull (name), nonnull (value)); 416940dd5a57Smrg 417040dd5a57Smrg if (name && *name && value && *value) 417140dd5a57Smrg { 417240dd5a57Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 417340dd5a57Smrg /* some systems can't cope with a ':'-terminated path #' */ 417440dd5a57Smrg int len = strlen (new_value); 417540dd5a57Smrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 417640dd5a57Smrg { 417740dd5a57Smrg new_value[len-1] = '\0'; 417840dd5a57Smrg } 417940dd5a57Smrg lt_setenv (name, new_value); 418040dd5a57Smrg XFREE (new_value); 418140dd5a57Smrg } 418240dd5a57Smrg} 418340dd5a57Smrg 418440dd5a57Smrgvoid 418540dd5a57Smrglt_update_lib_path (const char *name, const char *value) 418640dd5a57Smrg{ 418740dd5a57Smrg lt_debugprintf (__FILE__, __LINE__, 418840dd5a57Smrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 418940dd5a57Smrg nonnull (name), nonnull (value)); 419040dd5a57Smrg 419140dd5a57Smrg if (name && *name && value && *value) 419240dd5a57Smrg { 419340dd5a57Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 419440dd5a57Smrg lt_setenv (name, new_value); 419540dd5a57Smrg XFREE (new_value); 419640dd5a57Smrg } 419740dd5a57Smrg} 419840dd5a57Smrg 419940dd5a57SmrgEOF 420040dd5a57Smrg case $host_os in 420140dd5a57Smrg mingw*) 420240dd5a57Smrg cat <<"EOF" 420340dd5a57Smrg 420440dd5a57Smrg/* Prepares an argument vector before calling spawn(). 420540dd5a57Smrg Note that spawn() does not by itself call the command interpreter 420640dd5a57Smrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 420740dd5a57Smrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 420840dd5a57Smrg GetVersionEx(&v); 420940dd5a57Smrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 421040dd5a57Smrg }) ? "cmd.exe" : "command.com"). 421140dd5a57Smrg Instead it simply concatenates the arguments, separated by ' ', and calls 421240dd5a57Smrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 421340dd5a57Smrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 421440dd5a57Smrg special way: 421540dd5a57Smrg - Space and tab are interpreted as delimiters. They are not treated as 421640dd5a57Smrg delimiters if they are surrounded by double quotes: "...". 421740dd5a57Smrg - Unescaped double quotes are removed from the input. Their only effect is 421840dd5a57Smrg that within double quotes, space and tab are treated like normal 421940dd5a57Smrg characters. 422040dd5a57Smrg - Backslashes not followed by double quotes are not special. 422140dd5a57Smrg - But 2*n+1 backslashes followed by a double quote become 422240dd5a57Smrg n backslashes followed by a double quote (n >= 0): 422340dd5a57Smrg \" -> " 422440dd5a57Smrg \\\" -> \" 422540dd5a57Smrg \\\\\" -> \\" 422640dd5a57Smrg */ 422740dd5a57Smrg#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" 422840dd5a57Smrg#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" 422940dd5a57Smrgchar ** 423040dd5a57Smrgprepare_spawn (char **argv) 423140dd5a57Smrg{ 423240dd5a57Smrg size_t argc; 423340dd5a57Smrg char **new_argv; 423440dd5a57Smrg size_t i; 423540dd5a57Smrg 423640dd5a57Smrg /* Count number of arguments. */ 423740dd5a57Smrg for (argc = 0; argv[argc] != NULL; argc++) 423840dd5a57Smrg ; 423940dd5a57Smrg 424040dd5a57Smrg /* Allocate new argument vector. */ 424140dd5a57Smrg new_argv = XMALLOC (char *, argc + 1); 424240dd5a57Smrg 424340dd5a57Smrg /* Put quoted arguments into the new argument vector. */ 424440dd5a57Smrg for (i = 0; i < argc; i++) 424540dd5a57Smrg { 424640dd5a57Smrg const char *string = argv[i]; 424740dd5a57Smrg 424840dd5a57Smrg if (string[0] == '\0') 424940dd5a57Smrg new_argv[i] = xstrdup ("\"\""); 425040dd5a57Smrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 425140dd5a57Smrg { 425240dd5a57Smrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 425340dd5a57Smrg size_t length; 425440dd5a57Smrg unsigned int backslashes; 425540dd5a57Smrg const char *s; 425640dd5a57Smrg char *quoted_string; 425740dd5a57Smrg char *p; 425840dd5a57Smrg 425940dd5a57Smrg length = 0; 426040dd5a57Smrg backslashes = 0; 426140dd5a57Smrg if (quote_around) 426240dd5a57Smrg length++; 426340dd5a57Smrg for (s = string; *s != '\0'; s++) 426440dd5a57Smrg { 426540dd5a57Smrg char c = *s; 426640dd5a57Smrg if (c == '"') 426740dd5a57Smrg length += backslashes + 1; 426840dd5a57Smrg length++; 426940dd5a57Smrg if (c == '\\') 427040dd5a57Smrg backslashes++; 427140dd5a57Smrg else 427240dd5a57Smrg backslashes = 0; 427340dd5a57Smrg } 427440dd5a57Smrg if (quote_around) 427540dd5a57Smrg length += backslashes + 1; 427640dd5a57Smrg 427740dd5a57Smrg quoted_string = XMALLOC (char, length + 1); 427840dd5a57Smrg 427940dd5a57Smrg p = quoted_string; 428040dd5a57Smrg backslashes = 0; 428140dd5a57Smrg if (quote_around) 428240dd5a57Smrg *p++ = '"'; 428340dd5a57Smrg for (s = string; *s != '\0'; s++) 428440dd5a57Smrg { 428540dd5a57Smrg char c = *s; 428640dd5a57Smrg if (c == '"') 428740dd5a57Smrg { 428840dd5a57Smrg unsigned int j; 428940dd5a57Smrg for (j = backslashes + 1; j > 0; j--) 429040dd5a57Smrg *p++ = '\\'; 429140dd5a57Smrg } 429240dd5a57Smrg *p++ = c; 429340dd5a57Smrg if (c == '\\') 429440dd5a57Smrg backslashes++; 429540dd5a57Smrg else 429640dd5a57Smrg backslashes = 0; 429740dd5a57Smrg } 429840dd5a57Smrg if (quote_around) 429940dd5a57Smrg { 430040dd5a57Smrg unsigned int j; 430140dd5a57Smrg for (j = backslashes; j > 0; j--) 430240dd5a57Smrg *p++ = '\\'; 430340dd5a57Smrg *p++ = '"'; 430440dd5a57Smrg } 430540dd5a57Smrg *p = '\0'; 430640dd5a57Smrg 430740dd5a57Smrg new_argv[i] = quoted_string; 430840dd5a57Smrg } 430940dd5a57Smrg else 431040dd5a57Smrg new_argv[i] = (char *) string; 431140dd5a57Smrg } 431240dd5a57Smrg new_argv[argc] = NULL; 431340dd5a57Smrg 431440dd5a57Smrg return new_argv; 431540dd5a57Smrg} 431640dd5a57SmrgEOF 431740dd5a57Smrg ;; 431840dd5a57Smrg esac 431940dd5a57Smrg 432040dd5a57Smrg cat <<"EOF" 432140dd5a57Smrgvoid lt_dump_script (FILE* f) 432240dd5a57Smrg{ 432340dd5a57SmrgEOF 432440dd5a57Smrg func_emit_wrapper yes | 432540dd5a57Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 432640dd5a57Smrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 432740dd5a57Smrg 432840dd5a57Smrg cat <<"EOF" 432940dd5a57Smrg} 433040dd5a57SmrgEOF 433140dd5a57Smrg} 433240dd5a57Smrg# end: func_emit_cwrapperexe_src 433340dd5a57Smrg 433440dd5a57Smrg# func_win32_import_lib_p ARG 433540dd5a57Smrg# True if ARG is an import lib, as indicated by $file_magic_cmd 433640dd5a57Smrgfunc_win32_import_lib_p () 433740dd5a57Smrg{ 433840dd5a57Smrg $opt_debug 433940dd5a57Smrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 434040dd5a57Smrg *import*) : ;; 434140dd5a57Smrg *) false ;; 434240dd5a57Smrg esac 434340dd5a57Smrg} 434440dd5a57Smrg 434540dd5a57Smrg# func_mode_link arg... 434640dd5a57Smrgfunc_mode_link () 434740dd5a57Smrg{ 434840dd5a57Smrg $opt_debug 434940dd5a57Smrg case $host in 435040dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 435140dd5a57Smrg # It is impossible to link a dll without this setting, and 435240dd5a57Smrg # we shouldn't force the makefile maintainer to figure out 435340dd5a57Smrg # which system we are compiling for in order to pass an extra 435440dd5a57Smrg # flag for every libtool invocation. 435540dd5a57Smrg # allow_undefined=no 435640dd5a57Smrg 435740dd5a57Smrg # FIXME: Unfortunately, there are problems with the above when trying 435840dd5a57Smrg # to make a dll which has undefined symbols, in which case not 435940dd5a57Smrg # even a static library is built. For now, we need to specify 436040dd5a57Smrg # -no-undefined on the libtool link line when we can be certain 436140dd5a57Smrg # that all symbols are satisfied, otherwise we get a static library. 436240dd5a57Smrg allow_undefined=yes 436340dd5a57Smrg ;; 436440dd5a57Smrg *) 436540dd5a57Smrg allow_undefined=yes 436640dd5a57Smrg ;; 436740dd5a57Smrg esac 436840dd5a57Smrg libtool_args=$nonopt 436940dd5a57Smrg base_compile="$nonopt $@" 437040dd5a57Smrg compile_command=$nonopt 437140dd5a57Smrg finalize_command=$nonopt 437240dd5a57Smrg 437340dd5a57Smrg compile_rpath= 437440dd5a57Smrg finalize_rpath= 437540dd5a57Smrg compile_shlibpath= 437640dd5a57Smrg finalize_shlibpath= 437740dd5a57Smrg convenience= 437840dd5a57Smrg old_convenience= 437940dd5a57Smrg deplibs= 438040dd5a57Smrg old_deplibs= 438140dd5a57Smrg compiler_flags= 438240dd5a57Smrg linker_flags= 438340dd5a57Smrg dllsearchpath= 438440dd5a57Smrg lib_search_path=`pwd` 438540dd5a57Smrg inst_prefix_dir= 438640dd5a57Smrg new_inherited_linker_flags= 438740dd5a57Smrg 438840dd5a57Smrg avoid_version=no 438940dd5a57Smrg bindir= 439040dd5a57Smrg dlfiles= 439140dd5a57Smrg dlprefiles= 439240dd5a57Smrg dlself=no 439340dd5a57Smrg export_dynamic=no 439440dd5a57Smrg export_symbols= 439540dd5a57Smrg export_symbols_regex= 439640dd5a57Smrg generated= 439740dd5a57Smrg libobjs= 439840dd5a57Smrg ltlibs= 439940dd5a57Smrg module=no 440040dd5a57Smrg no_install=no 440140dd5a57Smrg objs= 440240dd5a57Smrg non_pic_objects= 440340dd5a57Smrg precious_files_regex= 440440dd5a57Smrg prefer_static_libs=no 440540dd5a57Smrg preload=no 440640dd5a57Smrg prev= 440740dd5a57Smrg prevarg= 440840dd5a57Smrg release= 440940dd5a57Smrg rpath= 441040dd5a57Smrg xrpath= 441140dd5a57Smrg perm_rpath= 441240dd5a57Smrg temp_rpath= 441340dd5a57Smrg thread_safe=no 441440dd5a57Smrg vinfo= 441540dd5a57Smrg vinfo_number=no 441640dd5a57Smrg weak_libs= 441740dd5a57Smrg single_module="${wl}-single_module" 441840dd5a57Smrg func_infer_tag $base_compile 441940dd5a57Smrg 442040dd5a57Smrg # We need to know -static, to get the right output filenames. 442140dd5a57Smrg for arg 442240dd5a57Smrg do 442340dd5a57Smrg case $arg in 442440dd5a57Smrg -shared) 442540dd5a57Smrg test "$build_libtool_libs" != yes && \ 442640dd5a57Smrg func_fatal_configuration "can not build a shared library" 442740dd5a57Smrg build_old_libs=no 442840dd5a57Smrg break 442940dd5a57Smrg ;; 443040dd5a57Smrg -all-static | -static | -static-libtool-libs) 443140dd5a57Smrg case $arg in 443240dd5a57Smrg -all-static) 443340dd5a57Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 443440dd5a57Smrg func_warning "complete static linking is impossible in this configuration" 443540dd5a57Smrg fi 443640dd5a57Smrg if test -n "$link_static_flag"; then 443740dd5a57Smrg dlopen_self=$dlopen_self_static 443840dd5a57Smrg fi 443940dd5a57Smrg prefer_static_libs=yes 444040dd5a57Smrg ;; 444140dd5a57Smrg -static) 444240dd5a57Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444340dd5a57Smrg dlopen_self=$dlopen_self_static 444440dd5a57Smrg fi 444540dd5a57Smrg prefer_static_libs=built 444640dd5a57Smrg ;; 444740dd5a57Smrg -static-libtool-libs) 444840dd5a57Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444940dd5a57Smrg dlopen_self=$dlopen_self_static 445040dd5a57Smrg fi 445140dd5a57Smrg prefer_static_libs=yes 445240dd5a57Smrg ;; 445340dd5a57Smrg esac 445440dd5a57Smrg build_libtool_libs=no 445540dd5a57Smrg build_old_libs=yes 445640dd5a57Smrg break 445740dd5a57Smrg ;; 445840dd5a57Smrg esac 445940dd5a57Smrg done 446040dd5a57Smrg 446140dd5a57Smrg # See if our shared archives depend on static archives. 446240dd5a57Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 446340dd5a57Smrg 446440dd5a57Smrg # Go through the arguments, transforming them on the way. 446540dd5a57Smrg while test "$#" -gt 0; do 446640dd5a57Smrg arg="$1" 446740dd5a57Smrg shift 446840dd5a57Smrg func_quote_for_eval "$arg" 446940dd5a57Smrg qarg=$func_quote_for_eval_unquoted_result 447040dd5a57Smrg func_append libtool_args " $func_quote_for_eval_result" 447140dd5a57Smrg 447240dd5a57Smrg # If the previous option needs an argument, assign it. 447340dd5a57Smrg if test -n "$prev"; then 447440dd5a57Smrg case $prev in 447540dd5a57Smrg output) 447640dd5a57Smrg func_append compile_command " @OUTPUT@" 447740dd5a57Smrg func_append finalize_command " @OUTPUT@" 447840dd5a57Smrg ;; 447940dd5a57Smrg esac 448040dd5a57Smrg 448140dd5a57Smrg case $prev in 448240dd5a57Smrg bindir) 448340dd5a57Smrg bindir="$arg" 448440dd5a57Smrg prev= 448540dd5a57Smrg continue 448640dd5a57Smrg ;; 448740dd5a57Smrg dlfiles|dlprefiles) 448840dd5a57Smrg if test "$preload" = no; then 448940dd5a57Smrg # Add the symbol object into the linking commands. 449040dd5a57Smrg func_append compile_command " @SYMFILE@" 449140dd5a57Smrg func_append finalize_command " @SYMFILE@" 449240dd5a57Smrg preload=yes 449340dd5a57Smrg fi 449440dd5a57Smrg case $arg in 449540dd5a57Smrg *.la | *.lo) ;; # We handle these cases below. 449640dd5a57Smrg force) 449740dd5a57Smrg if test "$dlself" = no; then 449840dd5a57Smrg dlself=needless 449940dd5a57Smrg export_dynamic=yes 450040dd5a57Smrg fi 450140dd5a57Smrg prev= 450240dd5a57Smrg continue 450340dd5a57Smrg ;; 450440dd5a57Smrg self) 450540dd5a57Smrg if test "$prev" = dlprefiles; then 450640dd5a57Smrg dlself=yes 450740dd5a57Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 450840dd5a57Smrg dlself=yes 450940dd5a57Smrg else 451040dd5a57Smrg dlself=needless 451140dd5a57Smrg export_dynamic=yes 451240dd5a57Smrg fi 451340dd5a57Smrg prev= 451440dd5a57Smrg continue 451540dd5a57Smrg ;; 451640dd5a57Smrg *) 451740dd5a57Smrg if test "$prev" = dlfiles; then 451840dd5a57Smrg dlfiles="$dlfiles $arg" 451940dd5a57Smrg else 452040dd5a57Smrg dlprefiles="$dlprefiles $arg" 452140dd5a57Smrg fi 452240dd5a57Smrg prev= 452340dd5a57Smrg continue 452440dd5a57Smrg ;; 452540dd5a57Smrg esac 452640dd5a57Smrg ;; 452740dd5a57Smrg expsyms) 452840dd5a57Smrg export_symbols="$arg" 452940dd5a57Smrg test -f "$arg" \ 453040dd5a57Smrg || func_fatal_error "symbol file \`$arg' does not exist" 453140dd5a57Smrg prev= 453240dd5a57Smrg continue 453340dd5a57Smrg ;; 453440dd5a57Smrg expsyms_regex) 453540dd5a57Smrg export_symbols_regex="$arg" 453640dd5a57Smrg prev= 453740dd5a57Smrg continue 453840dd5a57Smrg ;; 453940dd5a57Smrg framework) 454040dd5a57Smrg case $host in 454140dd5a57Smrg *-*-darwin*) 454240dd5a57Smrg case "$deplibs " in 454340dd5a57Smrg *" $qarg.ltframework "*) ;; 454440dd5a57Smrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 454540dd5a57Smrg ;; 454640dd5a57Smrg esac 454740dd5a57Smrg ;; 454840dd5a57Smrg esac 454940dd5a57Smrg prev= 455040dd5a57Smrg continue 455140dd5a57Smrg ;; 455240dd5a57Smrg inst_prefix) 455340dd5a57Smrg inst_prefix_dir="$arg" 455440dd5a57Smrg prev= 455540dd5a57Smrg continue 455640dd5a57Smrg ;; 455740dd5a57Smrg objectlist) 455840dd5a57Smrg if test -f "$arg"; then 455940dd5a57Smrg save_arg=$arg 456040dd5a57Smrg moreargs= 456140dd5a57Smrg for fil in `cat "$save_arg"` 456240dd5a57Smrg do 456340dd5a57Smrg# moreargs="$moreargs $fil" 456440dd5a57Smrg arg=$fil 456540dd5a57Smrg # A libtool-controlled object. 456640dd5a57Smrg 456740dd5a57Smrg # Check to see that this really is a libtool object. 456840dd5a57Smrg if func_lalib_unsafe_p "$arg"; then 456940dd5a57Smrg pic_object= 457040dd5a57Smrg non_pic_object= 457140dd5a57Smrg 457240dd5a57Smrg # Read the .lo file 457340dd5a57Smrg func_source "$arg" 457440dd5a57Smrg 457540dd5a57Smrg if test -z "$pic_object" || 457640dd5a57Smrg test -z "$non_pic_object" || 457740dd5a57Smrg test "$pic_object" = none && 457840dd5a57Smrg test "$non_pic_object" = none; then 457940dd5a57Smrg func_fatal_error "cannot find name of object for \`$arg'" 458040dd5a57Smrg fi 458140dd5a57Smrg 458240dd5a57Smrg # Extract subdirectory from the argument. 458340dd5a57Smrg func_dirname "$arg" "/" "" 458440dd5a57Smrg xdir="$func_dirname_result" 458540dd5a57Smrg 458640dd5a57Smrg if test "$pic_object" != none; then 458740dd5a57Smrg # Prepend the subdirectory the object is found in. 458840dd5a57Smrg pic_object="$xdir$pic_object" 458940dd5a57Smrg 459040dd5a57Smrg if test "$prev" = dlfiles; then 459140dd5a57Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 459240dd5a57Smrg dlfiles="$dlfiles $pic_object" 459340dd5a57Smrg prev= 459440dd5a57Smrg continue 459540dd5a57Smrg else 459640dd5a57Smrg # If libtool objects are unsupported, then we need to preload. 459740dd5a57Smrg prev=dlprefiles 459840dd5a57Smrg fi 459940dd5a57Smrg fi 460040dd5a57Smrg 460140dd5a57Smrg # CHECK ME: I think I busted this. -Ossama 460240dd5a57Smrg if test "$prev" = dlprefiles; then 460340dd5a57Smrg # Preload the old-style object. 460440dd5a57Smrg dlprefiles="$dlprefiles $pic_object" 460540dd5a57Smrg prev= 460640dd5a57Smrg fi 460740dd5a57Smrg 460840dd5a57Smrg # A PIC object. 460940dd5a57Smrg func_append libobjs " $pic_object" 461040dd5a57Smrg arg="$pic_object" 461140dd5a57Smrg fi 461240dd5a57Smrg 461340dd5a57Smrg # Non-PIC object. 461440dd5a57Smrg if test "$non_pic_object" != none; then 461540dd5a57Smrg # Prepend the subdirectory the object is found in. 461640dd5a57Smrg non_pic_object="$xdir$non_pic_object" 461740dd5a57Smrg 461840dd5a57Smrg # A standard non-PIC object 461940dd5a57Smrg func_append non_pic_objects " $non_pic_object" 462040dd5a57Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 462140dd5a57Smrg arg="$non_pic_object" 462240dd5a57Smrg fi 462340dd5a57Smrg else 462440dd5a57Smrg # If the PIC object exists, use it instead. 462540dd5a57Smrg # $xdir was prepended to $pic_object above. 462640dd5a57Smrg non_pic_object="$pic_object" 462740dd5a57Smrg func_append non_pic_objects " $non_pic_object" 462840dd5a57Smrg fi 462940dd5a57Smrg else 463040dd5a57Smrg # Only an error if not doing a dry-run. 463140dd5a57Smrg if $opt_dry_run; then 463240dd5a57Smrg # Extract subdirectory from the argument. 463340dd5a57Smrg func_dirname "$arg" "/" "" 463440dd5a57Smrg xdir="$func_dirname_result" 463540dd5a57Smrg 463640dd5a57Smrg func_lo2o "$arg" 463740dd5a57Smrg pic_object=$xdir$objdir/$func_lo2o_result 463840dd5a57Smrg non_pic_object=$xdir$func_lo2o_result 463940dd5a57Smrg func_append libobjs " $pic_object" 464040dd5a57Smrg func_append non_pic_objects " $non_pic_object" 464140dd5a57Smrg else 464240dd5a57Smrg func_fatal_error "\`$arg' is not a valid libtool object" 464340dd5a57Smrg fi 464440dd5a57Smrg fi 464540dd5a57Smrg done 464640dd5a57Smrg else 464740dd5a57Smrg func_fatal_error "link input file \`$arg' does not exist" 464840dd5a57Smrg fi 464940dd5a57Smrg arg=$save_arg 465040dd5a57Smrg prev= 465140dd5a57Smrg continue 465240dd5a57Smrg ;; 465340dd5a57Smrg precious_regex) 465440dd5a57Smrg precious_files_regex="$arg" 465540dd5a57Smrg prev= 465640dd5a57Smrg continue 465740dd5a57Smrg ;; 465840dd5a57Smrg release) 465940dd5a57Smrg release="-$arg" 466040dd5a57Smrg prev= 466140dd5a57Smrg continue 466240dd5a57Smrg ;; 466340dd5a57Smrg rpath | xrpath) 466440dd5a57Smrg # We need an absolute path. 466540dd5a57Smrg case $arg in 466640dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 466740dd5a57Smrg *) 466840dd5a57Smrg func_fatal_error "only absolute run-paths are allowed" 466940dd5a57Smrg ;; 467040dd5a57Smrg esac 467140dd5a57Smrg if test "$prev" = rpath; then 467240dd5a57Smrg case "$rpath " in 467340dd5a57Smrg *" $arg "*) ;; 467440dd5a57Smrg *) rpath="$rpath $arg" ;; 467540dd5a57Smrg esac 467640dd5a57Smrg else 467740dd5a57Smrg case "$xrpath " in 467840dd5a57Smrg *" $arg "*) ;; 467940dd5a57Smrg *) xrpath="$xrpath $arg" ;; 468040dd5a57Smrg esac 468140dd5a57Smrg fi 468240dd5a57Smrg prev= 468340dd5a57Smrg continue 468440dd5a57Smrg ;; 468540dd5a57Smrg shrext) 468640dd5a57Smrg shrext_cmds="$arg" 468740dd5a57Smrg prev= 468840dd5a57Smrg continue 468940dd5a57Smrg ;; 469040dd5a57Smrg weak) 469140dd5a57Smrg weak_libs="$weak_libs $arg" 469240dd5a57Smrg prev= 469340dd5a57Smrg continue 469440dd5a57Smrg ;; 469540dd5a57Smrg xcclinker) 469640dd5a57Smrg linker_flags="$linker_flags $qarg" 469740dd5a57Smrg compiler_flags="$compiler_flags $qarg" 469840dd5a57Smrg prev= 469940dd5a57Smrg func_append compile_command " $qarg" 470040dd5a57Smrg func_append finalize_command " $qarg" 470140dd5a57Smrg continue 470240dd5a57Smrg ;; 470340dd5a57Smrg xcompiler) 470440dd5a57Smrg compiler_flags="$compiler_flags $qarg" 470540dd5a57Smrg prev= 470640dd5a57Smrg func_append compile_command " $qarg" 470740dd5a57Smrg func_append finalize_command " $qarg" 470840dd5a57Smrg continue 470940dd5a57Smrg ;; 471040dd5a57Smrg xlinker) 471140dd5a57Smrg linker_flags="$linker_flags $qarg" 471240dd5a57Smrg compiler_flags="$compiler_flags $wl$qarg" 471340dd5a57Smrg prev= 471440dd5a57Smrg func_append compile_command " $wl$qarg" 471540dd5a57Smrg func_append finalize_command " $wl$qarg" 471640dd5a57Smrg continue 471740dd5a57Smrg ;; 471840dd5a57Smrg *) 471940dd5a57Smrg eval "$prev=\"\$arg\"" 472040dd5a57Smrg prev= 472140dd5a57Smrg continue 472240dd5a57Smrg ;; 472340dd5a57Smrg esac 472440dd5a57Smrg fi # test -n "$prev" 472540dd5a57Smrg 472640dd5a57Smrg prevarg="$arg" 472740dd5a57Smrg 472840dd5a57Smrg case $arg in 472940dd5a57Smrg -all-static) 473040dd5a57Smrg if test -n "$link_static_flag"; then 473140dd5a57Smrg # See comment for -static flag below, for more details. 473240dd5a57Smrg func_append compile_command " $link_static_flag" 473340dd5a57Smrg func_append finalize_command " $link_static_flag" 473440dd5a57Smrg fi 473540dd5a57Smrg continue 473640dd5a57Smrg ;; 473740dd5a57Smrg 473840dd5a57Smrg -allow-undefined) 473940dd5a57Smrg # FIXME: remove this flag sometime in the future. 474040dd5a57Smrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 474140dd5a57Smrg ;; 474240dd5a57Smrg 474340dd5a57Smrg -avoid-version) 474440dd5a57Smrg avoid_version=yes 474540dd5a57Smrg continue 474640dd5a57Smrg ;; 474740dd5a57Smrg 474840dd5a57Smrg -bindir) 474940dd5a57Smrg prev=bindir 475040dd5a57Smrg continue 475140dd5a57Smrg ;; 475240dd5a57Smrg 475340dd5a57Smrg -dlopen) 475440dd5a57Smrg prev=dlfiles 475540dd5a57Smrg continue 475640dd5a57Smrg ;; 475740dd5a57Smrg 475840dd5a57Smrg -dlpreopen) 475940dd5a57Smrg prev=dlprefiles 476040dd5a57Smrg continue 476140dd5a57Smrg ;; 476240dd5a57Smrg 476340dd5a57Smrg -export-dynamic) 476440dd5a57Smrg export_dynamic=yes 476540dd5a57Smrg continue 476640dd5a57Smrg ;; 476740dd5a57Smrg 476840dd5a57Smrg -export-symbols | -export-symbols-regex) 476940dd5a57Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 477040dd5a57Smrg func_fatal_error "more than one -exported-symbols argument is not allowed" 477140dd5a57Smrg fi 477240dd5a57Smrg if test "X$arg" = "X-export-symbols"; then 477340dd5a57Smrg prev=expsyms 477440dd5a57Smrg else 477540dd5a57Smrg prev=expsyms_regex 477640dd5a57Smrg fi 477740dd5a57Smrg continue 477840dd5a57Smrg ;; 477940dd5a57Smrg 478040dd5a57Smrg -framework) 478140dd5a57Smrg prev=framework 478240dd5a57Smrg continue 478340dd5a57Smrg ;; 478440dd5a57Smrg 478540dd5a57Smrg -inst-prefix-dir) 478640dd5a57Smrg prev=inst_prefix 478740dd5a57Smrg continue 478840dd5a57Smrg ;; 478940dd5a57Smrg 479040dd5a57Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 479140dd5a57Smrg # so, if we see these flags be careful not to treat them like -L 479240dd5a57Smrg -L[A-Z][A-Z]*:*) 479340dd5a57Smrg case $with_gcc/$host in 479440dd5a57Smrg no/*-*-irix* | /*-*-irix*) 479540dd5a57Smrg func_append compile_command " $arg" 479640dd5a57Smrg func_append finalize_command " $arg" 479740dd5a57Smrg ;; 479840dd5a57Smrg esac 479940dd5a57Smrg continue 480040dd5a57Smrg ;; 480140dd5a57Smrg 480240dd5a57Smrg -L*) 480340dd5a57Smrg func_stripname '-L' '' "$arg" 480440dd5a57Smrg dir=$func_stripname_result 480540dd5a57Smrg if test -z "$dir"; then 480640dd5a57Smrg if test "$#" -gt 0; then 480740dd5a57Smrg func_fatal_error "require no space between \`-L' and \`$1'" 480840dd5a57Smrg else 480940dd5a57Smrg func_fatal_error "need path for \`-L' option" 481040dd5a57Smrg fi 481140dd5a57Smrg fi 481240dd5a57Smrg # We need an absolute path. 481340dd5a57Smrg case $dir in 481440dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 481540dd5a57Smrg *) 481640dd5a57Smrg absdir=`cd "$dir" && pwd` 481740dd5a57Smrg test -z "$absdir" && \ 481840dd5a57Smrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 481940dd5a57Smrg dir="$absdir" 482040dd5a57Smrg ;; 482140dd5a57Smrg esac 482240dd5a57Smrg case "$deplibs " in 482340dd5a57Smrg *" -L$dir "*) ;; 482440dd5a57Smrg *) 482540dd5a57Smrg deplibs="$deplibs -L$dir" 482640dd5a57Smrg lib_search_path="$lib_search_path $dir" 482740dd5a57Smrg ;; 482840dd5a57Smrg esac 482940dd5a57Smrg case $host in 483040dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 483140dd5a57Smrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 483240dd5a57Smrg case :$dllsearchpath: in 483340dd5a57Smrg *":$dir:"*) ;; 483440dd5a57Smrg ::) dllsearchpath=$dir;; 483540dd5a57Smrg *) dllsearchpath="$dllsearchpath:$dir";; 483640dd5a57Smrg esac 483740dd5a57Smrg case :$dllsearchpath: in 483840dd5a57Smrg *":$testbindir:"*) ;; 483940dd5a57Smrg ::) dllsearchpath=$testbindir;; 484040dd5a57Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 484140dd5a57Smrg esac 484240dd5a57Smrg ;; 484340dd5a57Smrg esac 484440dd5a57Smrg continue 484540dd5a57Smrg ;; 484640dd5a57Smrg 484740dd5a57Smrg -l*) 484840dd5a57Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 484940dd5a57Smrg case $host in 485040dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 485140dd5a57Smrg # These systems don't actually have a C or math library (as such) 485240dd5a57Smrg continue 485340dd5a57Smrg ;; 485440dd5a57Smrg *-*-os2*) 485540dd5a57Smrg # These systems don't actually have a C library (as such) 485640dd5a57Smrg test "X$arg" = "X-lc" && continue 485740dd5a57Smrg ;; 485840dd5a57Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 485940dd5a57Smrg # Do not include libc due to us having libc/libc_r. 486040dd5a57Smrg test "X$arg" = "X-lc" && continue 486140dd5a57Smrg ;; 486240dd5a57Smrg *-*-rhapsody* | *-*-darwin1.[012]) 486340dd5a57Smrg # Rhapsody C and math libraries are in the System framework 486440dd5a57Smrg deplibs="$deplibs System.ltframework" 486540dd5a57Smrg continue 486640dd5a57Smrg ;; 486740dd5a57Smrg *-*-sco3.2v5* | *-*-sco5v6*) 486840dd5a57Smrg # Causes problems with __ctype 486940dd5a57Smrg test "X$arg" = "X-lc" && continue 487040dd5a57Smrg ;; 487140dd5a57Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 487240dd5a57Smrg # Compiler inserts libc in the correct place for threads to work 487340dd5a57Smrg test "X$arg" = "X-lc" && continue 487440dd5a57Smrg ;; 487540dd5a57Smrg esac 487640dd5a57Smrg elif test "X$arg" = "X-lc_r"; then 487740dd5a57Smrg case $host in 487840dd5a57Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 487940dd5a57Smrg # Do not include libc_r directly, use -pthread flag. 488040dd5a57Smrg continue 488140dd5a57Smrg ;; 488240dd5a57Smrg esac 488340dd5a57Smrg fi 488440dd5a57Smrg deplibs="$deplibs $arg" 488540dd5a57Smrg continue 488640dd5a57Smrg ;; 488740dd5a57Smrg 488840dd5a57Smrg -module) 488940dd5a57Smrg module=yes 489040dd5a57Smrg continue 489140dd5a57Smrg ;; 489240dd5a57Smrg 489340dd5a57Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 489440dd5a57Smrg # classes, name mangling, and exception handling. 489540dd5a57Smrg # Darwin uses the -arch flag to determine output architecture. 489640dd5a57Smrg -model|-arch|-isysroot) 489740dd5a57Smrg compiler_flags="$compiler_flags $arg" 489840dd5a57Smrg func_append compile_command " $arg" 489940dd5a57Smrg func_append finalize_command " $arg" 490040dd5a57Smrg prev=xcompiler 490140dd5a57Smrg continue 490240dd5a57Smrg ;; 490340dd5a57Smrg 490440dd5a57Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 490540dd5a57Smrg compiler_flags="$compiler_flags $arg" 490640dd5a57Smrg func_append compile_command " $arg" 490740dd5a57Smrg func_append finalize_command " $arg" 490840dd5a57Smrg case "$new_inherited_linker_flags " in 490940dd5a57Smrg *" $arg "*) ;; 491040dd5a57Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 491140dd5a57Smrg esac 491240dd5a57Smrg continue 491340dd5a57Smrg ;; 491440dd5a57Smrg 491540dd5a57Smrg -multi_module) 491640dd5a57Smrg single_module="${wl}-multi_module" 491740dd5a57Smrg continue 491840dd5a57Smrg ;; 491940dd5a57Smrg 492040dd5a57Smrg -no-fast-install) 492140dd5a57Smrg fast_install=no 492240dd5a57Smrg continue 492340dd5a57Smrg ;; 492440dd5a57Smrg 492540dd5a57Smrg -no-install) 492640dd5a57Smrg case $host in 492740dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 492840dd5a57Smrg # The PATH hackery in wrapper scripts is required on Windows 492940dd5a57Smrg # and Darwin in order for the loader to find any dlls it needs. 493040dd5a57Smrg func_warning "\`-no-install' is ignored for $host" 493140dd5a57Smrg func_warning "assuming \`-no-fast-install' instead" 493240dd5a57Smrg fast_install=no 493340dd5a57Smrg ;; 493440dd5a57Smrg *) no_install=yes ;; 493540dd5a57Smrg esac 493640dd5a57Smrg continue 493740dd5a57Smrg ;; 493840dd5a57Smrg 493940dd5a57Smrg -no-undefined) 494040dd5a57Smrg allow_undefined=no 494140dd5a57Smrg continue 494240dd5a57Smrg ;; 494340dd5a57Smrg 494440dd5a57Smrg -objectlist) 494540dd5a57Smrg prev=objectlist 494640dd5a57Smrg continue 494740dd5a57Smrg ;; 494840dd5a57Smrg 494940dd5a57Smrg -o) prev=output ;; 495040dd5a57Smrg 495140dd5a57Smrg -precious-files-regex) 495240dd5a57Smrg prev=precious_regex 495340dd5a57Smrg continue 495440dd5a57Smrg ;; 495540dd5a57Smrg 495640dd5a57Smrg -release) 495740dd5a57Smrg prev=release 495840dd5a57Smrg continue 495940dd5a57Smrg ;; 496040dd5a57Smrg 496140dd5a57Smrg -rpath) 496240dd5a57Smrg prev=rpath 496340dd5a57Smrg continue 496440dd5a57Smrg ;; 496540dd5a57Smrg 496640dd5a57Smrg -R) 496740dd5a57Smrg prev=xrpath 496840dd5a57Smrg continue 496940dd5a57Smrg ;; 497040dd5a57Smrg 497140dd5a57Smrg -R*) 497240dd5a57Smrg func_stripname '-R' '' "$arg" 497340dd5a57Smrg dir=$func_stripname_result 497440dd5a57Smrg # We need an absolute path. 497540dd5a57Smrg case $dir in 497640dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 497740dd5a57Smrg *) 497840dd5a57Smrg func_fatal_error "only absolute run-paths are allowed" 497940dd5a57Smrg ;; 498040dd5a57Smrg esac 498140dd5a57Smrg case "$xrpath " in 498240dd5a57Smrg *" $dir "*) ;; 498340dd5a57Smrg *) xrpath="$xrpath $dir" ;; 498440dd5a57Smrg esac 498540dd5a57Smrg continue 498640dd5a57Smrg ;; 498740dd5a57Smrg 498840dd5a57Smrg -shared) 498940dd5a57Smrg # The effects of -shared are defined in a previous loop. 499040dd5a57Smrg continue 499140dd5a57Smrg ;; 499240dd5a57Smrg 499340dd5a57Smrg -shrext) 499440dd5a57Smrg prev=shrext 499540dd5a57Smrg continue 499640dd5a57Smrg ;; 499740dd5a57Smrg 499840dd5a57Smrg -static | -static-libtool-libs) 499940dd5a57Smrg # The effects of -static are defined in a previous loop. 500040dd5a57Smrg # We used to do the same as -all-static on platforms that 500140dd5a57Smrg # didn't have a PIC flag, but the assumption that the effects 500240dd5a57Smrg # would be equivalent was wrong. It would break on at least 500340dd5a57Smrg # Digital Unix and AIX. 500440dd5a57Smrg continue 500540dd5a57Smrg ;; 500640dd5a57Smrg 500740dd5a57Smrg -thread-safe) 500840dd5a57Smrg thread_safe=yes 500940dd5a57Smrg continue 501040dd5a57Smrg ;; 501140dd5a57Smrg 501240dd5a57Smrg -version-info) 501340dd5a57Smrg prev=vinfo 501440dd5a57Smrg continue 501540dd5a57Smrg ;; 501640dd5a57Smrg 501740dd5a57Smrg -version-number) 501840dd5a57Smrg prev=vinfo 501940dd5a57Smrg vinfo_number=yes 502040dd5a57Smrg continue 502140dd5a57Smrg ;; 502240dd5a57Smrg 502340dd5a57Smrg -weak) 502440dd5a57Smrg prev=weak 502540dd5a57Smrg continue 502640dd5a57Smrg ;; 502740dd5a57Smrg 502840dd5a57Smrg -Wc,*) 502940dd5a57Smrg func_stripname '-Wc,' '' "$arg" 503040dd5a57Smrg args=$func_stripname_result 503140dd5a57Smrg arg= 503240dd5a57Smrg save_ifs="$IFS"; IFS=',' 503340dd5a57Smrg for flag in $args; do 503440dd5a57Smrg IFS="$save_ifs" 503540dd5a57Smrg func_quote_for_eval "$flag" 503640dd5a57Smrg arg="$arg $func_quote_for_eval_result" 503740dd5a57Smrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 503840dd5a57Smrg done 503940dd5a57Smrg IFS="$save_ifs" 504040dd5a57Smrg func_stripname ' ' '' "$arg" 504140dd5a57Smrg arg=$func_stripname_result 504240dd5a57Smrg ;; 504340dd5a57Smrg 504440dd5a57Smrg -Wl,*) 504540dd5a57Smrg func_stripname '-Wl,' '' "$arg" 504640dd5a57Smrg args=$func_stripname_result 504740dd5a57Smrg arg= 504840dd5a57Smrg save_ifs="$IFS"; IFS=',' 504940dd5a57Smrg for flag in $args; do 505040dd5a57Smrg IFS="$save_ifs" 505140dd5a57Smrg func_quote_for_eval "$flag" 505240dd5a57Smrg arg="$arg $wl$func_quote_for_eval_result" 505340dd5a57Smrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 505440dd5a57Smrg linker_flags="$linker_flags $func_quote_for_eval_result" 505540dd5a57Smrg done 505640dd5a57Smrg IFS="$save_ifs" 505740dd5a57Smrg func_stripname ' ' '' "$arg" 505840dd5a57Smrg arg=$func_stripname_result 505940dd5a57Smrg ;; 506040dd5a57Smrg 506140dd5a57Smrg -Xcompiler) 506240dd5a57Smrg prev=xcompiler 506340dd5a57Smrg continue 506440dd5a57Smrg ;; 506540dd5a57Smrg 506640dd5a57Smrg -Xlinker) 506740dd5a57Smrg prev=xlinker 506840dd5a57Smrg continue 506940dd5a57Smrg ;; 507040dd5a57Smrg 507140dd5a57Smrg -XCClinker) 507240dd5a57Smrg prev=xcclinker 507340dd5a57Smrg continue 507440dd5a57Smrg ;; 507540dd5a57Smrg 507640dd5a57Smrg # -msg_* for osf cc 507740dd5a57Smrg -msg_*) 507840dd5a57Smrg func_quote_for_eval "$arg" 507940dd5a57Smrg arg="$func_quote_for_eval_result" 508040dd5a57Smrg ;; 508140dd5a57Smrg 508240dd5a57Smrg # Flags to be passed through unchanged, with rationale: 508340dd5a57Smrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 508440dd5a57Smrg # -r[0-9][0-9]* specify processor for the SGI compiler 508540dd5a57Smrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 508640dd5a57Smrg # +DA*, +DD* enable 64-bit mode for the HP compiler 508740dd5a57Smrg # -q* compiler args for the IBM compiler 508840dd5a57Smrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 508940dd5a57Smrg # -F/path path to uninstalled frameworks, gcc on darwin 509040dd5a57Smrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 509140dd5a57Smrg # @file GCC response files 509240dd5a57Smrg # -tp=* Portland pgcc target processor selection 509340dd5a57Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 509440dd5a57Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) 509540dd5a57Smrg func_quote_for_eval "$arg" 509640dd5a57Smrg arg="$func_quote_for_eval_result" 509740dd5a57Smrg func_append compile_command " $arg" 509840dd5a57Smrg func_append finalize_command " $arg" 509940dd5a57Smrg compiler_flags="$compiler_flags $arg" 510040dd5a57Smrg continue 510140dd5a57Smrg ;; 510240dd5a57Smrg 510340dd5a57Smrg # Some other compiler flag. 510440dd5a57Smrg -* | +*) 510540dd5a57Smrg func_quote_for_eval "$arg" 510640dd5a57Smrg arg="$func_quote_for_eval_result" 510740dd5a57Smrg ;; 510840dd5a57Smrg 510940dd5a57Smrg *.$objext) 511040dd5a57Smrg # A standard object. 511140dd5a57Smrg objs="$objs $arg" 511240dd5a57Smrg ;; 511340dd5a57Smrg 511440dd5a57Smrg *.lo) 511540dd5a57Smrg # A libtool-controlled object. 511640dd5a57Smrg 511740dd5a57Smrg # Check to see that this really is a libtool object. 511840dd5a57Smrg if func_lalib_unsafe_p "$arg"; then 511940dd5a57Smrg pic_object= 512040dd5a57Smrg non_pic_object= 512140dd5a57Smrg 512240dd5a57Smrg # Read the .lo file 512340dd5a57Smrg func_source "$arg" 512440dd5a57Smrg 512540dd5a57Smrg if test -z "$pic_object" || 512640dd5a57Smrg test -z "$non_pic_object" || 512740dd5a57Smrg test "$pic_object" = none && 512840dd5a57Smrg test "$non_pic_object" = none; then 512940dd5a57Smrg func_fatal_error "cannot find name of object for \`$arg'" 513040dd5a57Smrg fi 513140dd5a57Smrg 513240dd5a57Smrg # Extract subdirectory from the argument. 513340dd5a57Smrg func_dirname "$arg" "/" "" 513440dd5a57Smrg xdir="$func_dirname_result" 513540dd5a57Smrg 513640dd5a57Smrg if test "$pic_object" != none; then 513740dd5a57Smrg # Prepend the subdirectory the object is found in. 513840dd5a57Smrg pic_object="$xdir$pic_object" 513940dd5a57Smrg 514040dd5a57Smrg if test "$prev" = dlfiles; then 514140dd5a57Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 514240dd5a57Smrg dlfiles="$dlfiles $pic_object" 514340dd5a57Smrg prev= 514440dd5a57Smrg continue 514540dd5a57Smrg else 514640dd5a57Smrg # If libtool objects are unsupported, then we need to preload. 514740dd5a57Smrg prev=dlprefiles 514840dd5a57Smrg fi 514940dd5a57Smrg fi 515040dd5a57Smrg 515140dd5a57Smrg # CHECK ME: I think I busted this. -Ossama 515240dd5a57Smrg if test "$prev" = dlprefiles; then 515340dd5a57Smrg # Preload the old-style object. 515440dd5a57Smrg dlprefiles="$dlprefiles $pic_object" 515540dd5a57Smrg prev= 515640dd5a57Smrg fi 515740dd5a57Smrg 515840dd5a57Smrg # A PIC object. 515940dd5a57Smrg func_append libobjs " $pic_object" 516040dd5a57Smrg arg="$pic_object" 516140dd5a57Smrg fi 516240dd5a57Smrg 516340dd5a57Smrg # Non-PIC object. 516440dd5a57Smrg if test "$non_pic_object" != none; then 516540dd5a57Smrg # Prepend the subdirectory the object is found in. 516640dd5a57Smrg non_pic_object="$xdir$non_pic_object" 516740dd5a57Smrg 516840dd5a57Smrg # A standard non-PIC object 516940dd5a57Smrg func_append non_pic_objects " $non_pic_object" 517040dd5a57Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 517140dd5a57Smrg arg="$non_pic_object" 517240dd5a57Smrg fi 517340dd5a57Smrg else 517440dd5a57Smrg # If the PIC object exists, use it instead. 517540dd5a57Smrg # $xdir was prepended to $pic_object above. 517640dd5a57Smrg non_pic_object="$pic_object" 517740dd5a57Smrg func_append non_pic_objects " $non_pic_object" 517840dd5a57Smrg fi 517940dd5a57Smrg else 518040dd5a57Smrg # Only an error if not doing a dry-run. 518140dd5a57Smrg if $opt_dry_run; then 518240dd5a57Smrg # Extract subdirectory from the argument. 518340dd5a57Smrg func_dirname "$arg" "/" "" 518440dd5a57Smrg xdir="$func_dirname_result" 518540dd5a57Smrg 518640dd5a57Smrg func_lo2o "$arg" 518740dd5a57Smrg pic_object=$xdir$objdir/$func_lo2o_result 518840dd5a57Smrg non_pic_object=$xdir$func_lo2o_result 518940dd5a57Smrg func_append libobjs " $pic_object" 519040dd5a57Smrg func_append non_pic_objects " $non_pic_object" 519140dd5a57Smrg else 519240dd5a57Smrg func_fatal_error "\`$arg' is not a valid libtool object" 519340dd5a57Smrg fi 519440dd5a57Smrg fi 519540dd5a57Smrg ;; 519640dd5a57Smrg 519740dd5a57Smrg *.$libext) 519840dd5a57Smrg # An archive. 519940dd5a57Smrg deplibs="$deplibs $arg" 520040dd5a57Smrg old_deplibs="$old_deplibs $arg" 520140dd5a57Smrg continue 520240dd5a57Smrg ;; 520340dd5a57Smrg 520440dd5a57Smrg *.la) 520540dd5a57Smrg # A libtool-controlled library. 520640dd5a57Smrg 520740dd5a57Smrg if test "$prev" = dlfiles; then 520840dd5a57Smrg # This library was specified with -dlopen. 520940dd5a57Smrg dlfiles="$dlfiles $arg" 521040dd5a57Smrg prev= 521140dd5a57Smrg elif test "$prev" = dlprefiles; then 521240dd5a57Smrg # The library was specified with -dlpreopen. 521340dd5a57Smrg dlprefiles="$dlprefiles $arg" 521440dd5a57Smrg prev= 521540dd5a57Smrg else 521640dd5a57Smrg deplibs="$deplibs $arg" 521740dd5a57Smrg fi 521840dd5a57Smrg continue 521940dd5a57Smrg ;; 522040dd5a57Smrg 522140dd5a57Smrg # Some other compiler argument. 522240dd5a57Smrg *) 522340dd5a57Smrg # Unknown arguments in both finalize_command and compile_command need 522440dd5a57Smrg # to be aesthetically quoted because they are evaled later. 522540dd5a57Smrg func_quote_for_eval "$arg" 522640dd5a57Smrg arg="$func_quote_for_eval_result" 522740dd5a57Smrg ;; 522840dd5a57Smrg esac # arg 522940dd5a57Smrg 523040dd5a57Smrg # Now actually substitute the argument into the commands. 523140dd5a57Smrg if test -n "$arg"; then 523240dd5a57Smrg func_append compile_command " $arg" 523340dd5a57Smrg func_append finalize_command " $arg" 523440dd5a57Smrg fi 523540dd5a57Smrg done # argument parsing loop 523640dd5a57Smrg 523740dd5a57Smrg test -n "$prev" && \ 523840dd5a57Smrg func_fatal_help "the \`$prevarg' option requires an argument" 523940dd5a57Smrg 524040dd5a57Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 524140dd5a57Smrg eval arg=\"$export_dynamic_flag_spec\" 524240dd5a57Smrg func_append compile_command " $arg" 524340dd5a57Smrg func_append finalize_command " $arg" 524440dd5a57Smrg fi 524540dd5a57Smrg 524640dd5a57Smrg oldlibs= 524740dd5a57Smrg # calculate the name of the file, without its directory 524840dd5a57Smrg func_basename "$output" 524940dd5a57Smrg outputname="$func_basename_result" 525040dd5a57Smrg libobjs_save="$libobjs" 525140dd5a57Smrg 525240dd5a57Smrg if test -n "$shlibpath_var"; then 525340dd5a57Smrg # get the directories listed in $shlibpath_var 525440dd5a57Smrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 525540dd5a57Smrg else 525640dd5a57Smrg shlib_search_path= 525740dd5a57Smrg fi 525840dd5a57Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 525940dd5a57Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 526040dd5a57Smrg 526140dd5a57Smrg func_dirname "$output" "/" "" 526240dd5a57Smrg output_objdir="$func_dirname_result$objdir" 526340dd5a57Smrg # Create the object directory. 526440dd5a57Smrg func_mkdir_p "$output_objdir" 526540dd5a57Smrg 526640dd5a57Smrg # Determine the type of output 526740dd5a57Smrg case $output in 526840dd5a57Smrg "") 526940dd5a57Smrg func_fatal_help "you must specify an output file" 527040dd5a57Smrg ;; 527140dd5a57Smrg *.$libext) linkmode=oldlib ;; 527240dd5a57Smrg *.lo | *.$objext) linkmode=obj ;; 527340dd5a57Smrg *.la) linkmode=lib ;; 527440dd5a57Smrg *) linkmode=prog ;; # Anything else should be a program. 527540dd5a57Smrg esac 527640dd5a57Smrg 527740dd5a57Smrg specialdeplibs= 527840dd5a57Smrg 527940dd5a57Smrg libs= 528040dd5a57Smrg # Find all interdependent deplibs by searching for libraries 528140dd5a57Smrg # that are linked more than once (e.g. -la -lb -la) 528240dd5a57Smrg for deplib in $deplibs; do 528340dd5a57Smrg if $opt_duplicate_deps ; then 528440dd5a57Smrg case "$libs " in 528540dd5a57Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 528640dd5a57Smrg esac 528740dd5a57Smrg fi 528840dd5a57Smrg libs="$libs $deplib" 528940dd5a57Smrg done 529040dd5a57Smrg 529140dd5a57Smrg if test "$linkmode" = lib; then 529240dd5a57Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 529340dd5a57Smrg 529440dd5a57Smrg # Compute libraries that are listed more than once in $predeps 529540dd5a57Smrg # $postdeps and mark them as special (i.e., whose duplicates are 529640dd5a57Smrg # not to be eliminated). 529740dd5a57Smrg pre_post_deps= 529840dd5a57Smrg if $opt_duplicate_compiler_generated_deps; then 529940dd5a57Smrg for pre_post_dep in $predeps $postdeps; do 530040dd5a57Smrg case "$pre_post_deps " in 530140dd5a57Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 530240dd5a57Smrg esac 530340dd5a57Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 530440dd5a57Smrg done 530540dd5a57Smrg fi 530640dd5a57Smrg pre_post_deps= 530740dd5a57Smrg fi 530840dd5a57Smrg 530940dd5a57Smrg deplibs= 531040dd5a57Smrg newdependency_libs= 531140dd5a57Smrg newlib_search_path= 531240dd5a57Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 531340dd5a57Smrg notinst_deplibs= # not-installed libtool libraries 531440dd5a57Smrg notinst_path= # paths that contain not-installed libtool libraries 531540dd5a57Smrg 531640dd5a57Smrg case $linkmode in 531740dd5a57Smrg lib) 531840dd5a57Smrg passes="conv dlpreopen link" 531940dd5a57Smrg for file in $dlfiles $dlprefiles; do 532040dd5a57Smrg case $file in 532140dd5a57Smrg *.la) ;; 532240dd5a57Smrg *) 532340dd5a57Smrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 532440dd5a57Smrg ;; 532540dd5a57Smrg esac 532640dd5a57Smrg done 532740dd5a57Smrg ;; 532840dd5a57Smrg prog) 532940dd5a57Smrg compile_deplibs= 533040dd5a57Smrg finalize_deplibs= 533140dd5a57Smrg alldeplibs=no 533240dd5a57Smrg newdlfiles= 533340dd5a57Smrg newdlprefiles= 533440dd5a57Smrg passes="conv scan dlopen dlpreopen link" 533540dd5a57Smrg ;; 533640dd5a57Smrg *) passes="conv" 533740dd5a57Smrg ;; 533840dd5a57Smrg esac 533940dd5a57Smrg 534040dd5a57Smrg for pass in $passes; do 534140dd5a57Smrg # The preopen pass in lib mode reverses $deplibs; put it back here 534240dd5a57Smrg # so that -L comes before libs that need it for instance... 534340dd5a57Smrg if test "$linkmode,$pass" = "lib,link"; then 534440dd5a57Smrg ## FIXME: Find the place where the list is rebuilt in the wrong 534540dd5a57Smrg ## order, and fix it there properly 534640dd5a57Smrg tmp_deplibs= 534740dd5a57Smrg for deplib in $deplibs; do 534840dd5a57Smrg tmp_deplibs="$deplib $tmp_deplibs" 534940dd5a57Smrg done 535040dd5a57Smrg deplibs="$tmp_deplibs" 535140dd5a57Smrg fi 535240dd5a57Smrg 535340dd5a57Smrg if test "$linkmode,$pass" = "lib,link" || 535440dd5a57Smrg test "$linkmode,$pass" = "prog,scan"; then 535540dd5a57Smrg libs="$deplibs" 535640dd5a57Smrg deplibs= 535740dd5a57Smrg fi 535840dd5a57Smrg if test "$linkmode" = prog; then 535940dd5a57Smrg case $pass in 536040dd5a57Smrg dlopen) libs="$dlfiles" ;; 536140dd5a57Smrg dlpreopen) libs="$dlprefiles" ;; 536240dd5a57Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 536340dd5a57Smrg esac 536440dd5a57Smrg fi 536540dd5a57Smrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 536640dd5a57Smrg # Collect and forward deplibs of preopened libtool libs 536740dd5a57Smrg for lib in $dlprefiles; do 536840dd5a57Smrg # Ignore non-libtool-libs 536940dd5a57Smrg dependency_libs= 537040dd5a57Smrg case $lib in 537140dd5a57Smrg *.la) func_source "$lib" ;; 537240dd5a57Smrg esac 537340dd5a57Smrg 537440dd5a57Smrg # Collect preopened libtool deplibs, except any this library 537540dd5a57Smrg # has declared as weak libs 537640dd5a57Smrg for deplib in $dependency_libs; do 537740dd5a57Smrg func_basename "$deplib" 537840dd5a57Smrg deplib_base=$func_basename_result 537940dd5a57Smrg case " $weak_libs " in 538040dd5a57Smrg *" $deplib_base "*) ;; 538140dd5a57Smrg *) deplibs="$deplibs $deplib" ;; 538240dd5a57Smrg esac 538340dd5a57Smrg done 538440dd5a57Smrg done 538540dd5a57Smrg libs="$dlprefiles" 538640dd5a57Smrg fi 538740dd5a57Smrg if test "$pass" = dlopen; then 538840dd5a57Smrg # Collect dlpreopened libraries 538940dd5a57Smrg save_deplibs="$deplibs" 539040dd5a57Smrg deplibs= 539140dd5a57Smrg fi 539240dd5a57Smrg 539340dd5a57Smrg for deplib in $libs; do 539440dd5a57Smrg lib= 539540dd5a57Smrg found=no 539640dd5a57Smrg case $deplib in 539740dd5a57Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 539840dd5a57Smrg if test "$linkmode,$pass" = "prog,link"; then 539940dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 540040dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 540140dd5a57Smrg else 540240dd5a57Smrg compiler_flags="$compiler_flags $deplib" 540340dd5a57Smrg if test "$linkmode" = lib ; then 540440dd5a57Smrg case "$new_inherited_linker_flags " in 540540dd5a57Smrg *" $deplib "*) ;; 540640dd5a57Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 540740dd5a57Smrg esac 540840dd5a57Smrg fi 540940dd5a57Smrg fi 541040dd5a57Smrg continue 541140dd5a57Smrg ;; 541240dd5a57Smrg -l*) 541340dd5a57Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 541440dd5a57Smrg func_warning "\`-l' is ignored for archives/objects" 541540dd5a57Smrg continue 541640dd5a57Smrg fi 541740dd5a57Smrg func_stripname '-l' '' "$deplib" 541840dd5a57Smrg name=$func_stripname_result 541940dd5a57Smrg if test "$linkmode" = lib; then 542040dd5a57Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 542140dd5a57Smrg else 542240dd5a57Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 542340dd5a57Smrg fi 542440dd5a57Smrg for searchdir in $searchdirs; do 542540dd5a57Smrg for search_ext in .la $std_shrext .so .a; do 542640dd5a57Smrg # Search the libtool library 542740dd5a57Smrg lib="$searchdir/lib${name}${search_ext}" 542840dd5a57Smrg if test -f "$lib"; then 542940dd5a57Smrg if test "$search_ext" = ".la"; then 543040dd5a57Smrg found=yes 543140dd5a57Smrg else 543240dd5a57Smrg found=no 543340dd5a57Smrg fi 543440dd5a57Smrg break 2 543540dd5a57Smrg fi 543640dd5a57Smrg done 543740dd5a57Smrg done 543840dd5a57Smrg if test "$found" != yes; then 543940dd5a57Smrg # deplib doesn't seem to be a libtool library 544040dd5a57Smrg if test "$linkmode,$pass" = "prog,link"; then 544140dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 544240dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 544340dd5a57Smrg else 544440dd5a57Smrg deplibs="$deplib $deplibs" 544540dd5a57Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 544640dd5a57Smrg fi 544740dd5a57Smrg continue 544840dd5a57Smrg else # deplib is a libtool library 544940dd5a57Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 545040dd5a57Smrg # We need to do some special things here, and not later. 545140dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 545240dd5a57Smrg case " $predeps $postdeps " in 545340dd5a57Smrg *" $deplib "*) 545440dd5a57Smrg if func_lalib_p "$lib"; then 545540dd5a57Smrg library_names= 545640dd5a57Smrg old_library= 545740dd5a57Smrg func_source "$lib" 545840dd5a57Smrg for l in $old_library $library_names; do 545940dd5a57Smrg ll="$l" 546040dd5a57Smrg done 546140dd5a57Smrg if test "X$ll" = "X$old_library" ; then # only static version available 546240dd5a57Smrg found=no 546340dd5a57Smrg func_dirname "$lib" "" "." 546440dd5a57Smrg ladir="$func_dirname_result" 546540dd5a57Smrg lib=$ladir/$old_library 546640dd5a57Smrg if test "$linkmode,$pass" = "prog,link"; then 546740dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 546840dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 546940dd5a57Smrg else 547040dd5a57Smrg deplibs="$deplib $deplibs" 547140dd5a57Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 547240dd5a57Smrg fi 547340dd5a57Smrg continue 547440dd5a57Smrg fi 547540dd5a57Smrg fi 547640dd5a57Smrg ;; 547740dd5a57Smrg *) ;; 547840dd5a57Smrg esac 547940dd5a57Smrg fi 548040dd5a57Smrg fi 548140dd5a57Smrg ;; # -l 548240dd5a57Smrg *.ltframework) 548340dd5a57Smrg if test "$linkmode,$pass" = "prog,link"; then 548440dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 548540dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 548640dd5a57Smrg else 548740dd5a57Smrg deplibs="$deplib $deplibs" 548840dd5a57Smrg if test "$linkmode" = lib ; then 548940dd5a57Smrg case "$new_inherited_linker_flags " in 549040dd5a57Smrg *" $deplib "*) ;; 549140dd5a57Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 549240dd5a57Smrg esac 549340dd5a57Smrg fi 549440dd5a57Smrg fi 549540dd5a57Smrg continue 549640dd5a57Smrg ;; 549740dd5a57Smrg -L*) 549840dd5a57Smrg case $linkmode in 549940dd5a57Smrg lib) 550040dd5a57Smrg deplibs="$deplib $deplibs" 550140dd5a57Smrg test "$pass" = conv && continue 550240dd5a57Smrg newdependency_libs="$deplib $newdependency_libs" 550340dd5a57Smrg func_stripname '-L' '' "$deplib" 550440dd5a57Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 550540dd5a57Smrg ;; 550640dd5a57Smrg prog) 550740dd5a57Smrg if test "$pass" = conv; then 550840dd5a57Smrg deplibs="$deplib $deplibs" 550940dd5a57Smrg continue 551040dd5a57Smrg fi 551140dd5a57Smrg if test "$pass" = scan; then 551240dd5a57Smrg deplibs="$deplib $deplibs" 551340dd5a57Smrg else 551440dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 551540dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 551640dd5a57Smrg fi 551740dd5a57Smrg func_stripname '-L' '' "$deplib" 551840dd5a57Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 551940dd5a57Smrg ;; 552040dd5a57Smrg *) 552140dd5a57Smrg func_warning "\`-L' is ignored for archives/objects" 552240dd5a57Smrg ;; 552340dd5a57Smrg esac # linkmode 552440dd5a57Smrg continue 552540dd5a57Smrg ;; # -L 552640dd5a57Smrg -R*) 552740dd5a57Smrg if test "$pass" = link; then 552840dd5a57Smrg func_stripname '-R' '' "$deplib" 552940dd5a57Smrg dir=$func_stripname_result 553040dd5a57Smrg # Make sure the xrpath contains only unique directories. 553140dd5a57Smrg case "$xrpath " in 553240dd5a57Smrg *" $dir "*) ;; 553340dd5a57Smrg *) xrpath="$xrpath $dir" ;; 553440dd5a57Smrg esac 553540dd5a57Smrg fi 553640dd5a57Smrg deplibs="$deplib $deplibs" 553740dd5a57Smrg continue 553840dd5a57Smrg ;; 553940dd5a57Smrg *.la) lib="$deplib" ;; 554040dd5a57Smrg *.$libext) 554140dd5a57Smrg if test "$pass" = conv; then 554240dd5a57Smrg deplibs="$deplib $deplibs" 554340dd5a57Smrg continue 554440dd5a57Smrg fi 554540dd5a57Smrg case $linkmode in 554640dd5a57Smrg lib) 554740dd5a57Smrg # Linking convenience modules into shared libraries is allowed, 554840dd5a57Smrg # but linking other static libraries is non-portable. 554940dd5a57Smrg case " $dlpreconveniencelibs " in 555040dd5a57Smrg *" $deplib "*) ;; 555140dd5a57Smrg *) 555240dd5a57Smrg valid_a_lib=no 555340dd5a57Smrg case $deplibs_check_method in 555440dd5a57Smrg match_pattern*) 555540dd5a57Smrg set dummy $deplibs_check_method; shift 555640dd5a57Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 555740dd5a57Smrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 555840dd5a57Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 555940dd5a57Smrg valid_a_lib=yes 556040dd5a57Smrg fi 556140dd5a57Smrg ;; 556240dd5a57Smrg pass_all) 556340dd5a57Smrg valid_a_lib=yes 556440dd5a57Smrg ;; 556540dd5a57Smrg esac 556640dd5a57Smrg if test "$valid_a_lib" != yes; then 556740dd5a57Smrg echo 556840dd5a57Smrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 556940dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 557040dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 557140dd5a57Smrg echo "*** shared version of the library, which you do not appear to have" 557240dd5a57Smrg echo "*** because the file extensions .$libext of this argument makes me believe" 557340dd5a57Smrg echo "*** that it is just a static archive that I should not use here." 557440dd5a57Smrg else 557540dd5a57Smrg echo 557640dd5a57Smrg $ECHO "*** Warning: Linking the shared library $output against the" 557740dd5a57Smrg $ECHO "*** static library $deplib is not portable!" 557840dd5a57Smrg deplibs="$deplib $deplibs" 557940dd5a57Smrg fi 558040dd5a57Smrg ;; 558140dd5a57Smrg esac 558240dd5a57Smrg continue 558340dd5a57Smrg ;; 558440dd5a57Smrg prog) 558540dd5a57Smrg if test "$pass" != link; then 558640dd5a57Smrg deplibs="$deplib $deplibs" 558740dd5a57Smrg else 558840dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 558940dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 559040dd5a57Smrg fi 559140dd5a57Smrg continue 559240dd5a57Smrg ;; 559340dd5a57Smrg esac # linkmode 559440dd5a57Smrg ;; # *.$libext 559540dd5a57Smrg *.lo | *.$objext) 559640dd5a57Smrg if test "$pass" = conv; then 559740dd5a57Smrg deplibs="$deplib $deplibs" 559840dd5a57Smrg elif test "$linkmode" = prog; then 559940dd5a57Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 560040dd5a57Smrg # If there is no dlopen support or we're linking statically, 560140dd5a57Smrg # we need to preload. 560240dd5a57Smrg newdlprefiles="$newdlprefiles $deplib" 560340dd5a57Smrg compile_deplibs="$deplib $compile_deplibs" 560440dd5a57Smrg finalize_deplibs="$deplib $finalize_deplibs" 560540dd5a57Smrg else 560640dd5a57Smrg newdlfiles="$newdlfiles $deplib" 560740dd5a57Smrg fi 560840dd5a57Smrg fi 560940dd5a57Smrg continue 561040dd5a57Smrg ;; 561140dd5a57Smrg %DEPLIBS%) 561240dd5a57Smrg alldeplibs=yes 561340dd5a57Smrg continue 561440dd5a57Smrg ;; 561540dd5a57Smrg esac # case $deplib 561640dd5a57Smrg 561740dd5a57Smrg if test "$found" = yes || test -f "$lib"; then : 561840dd5a57Smrg else 561940dd5a57Smrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 562040dd5a57Smrg fi 562140dd5a57Smrg 562240dd5a57Smrg # Check to see that this really is a libtool archive. 562340dd5a57Smrg func_lalib_unsafe_p "$lib" \ 562440dd5a57Smrg || func_fatal_error "\`$lib' is not a valid libtool archive" 562540dd5a57Smrg 562640dd5a57Smrg func_dirname "$lib" "" "." 562740dd5a57Smrg ladir="$func_dirname_result" 562840dd5a57Smrg 562940dd5a57Smrg dlname= 563040dd5a57Smrg dlopen= 563140dd5a57Smrg dlpreopen= 563240dd5a57Smrg libdir= 563340dd5a57Smrg library_names= 563440dd5a57Smrg old_library= 563540dd5a57Smrg inherited_linker_flags= 563640dd5a57Smrg # If the library was installed with an old release of libtool, 563740dd5a57Smrg # it will not redefine variables installed, or shouldnotlink 563840dd5a57Smrg installed=yes 563940dd5a57Smrg shouldnotlink=no 564040dd5a57Smrg avoidtemprpath= 564140dd5a57Smrg 564240dd5a57Smrg 564340dd5a57Smrg # Read the .la file 564440dd5a57Smrg func_source "$lib" 564540dd5a57Smrg 564640dd5a57Smrg # Convert "-framework foo" to "foo.ltframework" 564740dd5a57Smrg if test -n "$inherited_linker_flags"; then 564840dd5a57Smrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 564940dd5a57Smrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 565040dd5a57Smrg case " $new_inherited_linker_flags " in 565140dd5a57Smrg *" $tmp_inherited_linker_flag "*) ;; 565240dd5a57Smrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 565340dd5a57Smrg esac 565440dd5a57Smrg done 565540dd5a57Smrg fi 565640dd5a57Smrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 565740dd5a57Smrg if test "$linkmode,$pass" = "lib,link" || 565840dd5a57Smrg test "$linkmode,$pass" = "prog,scan" || 565940dd5a57Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 566040dd5a57Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 566140dd5a57Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 566240dd5a57Smrg fi 566340dd5a57Smrg 566440dd5a57Smrg if test "$pass" = conv; then 566540dd5a57Smrg # Only check for convenience libraries 566640dd5a57Smrg deplibs="$lib $deplibs" 566740dd5a57Smrg if test -z "$libdir"; then 566840dd5a57Smrg if test -z "$old_library"; then 566940dd5a57Smrg func_fatal_error "cannot find name of link library for \`$lib'" 567040dd5a57Smrg fi 567140dd5a57Smrg # It is a libtool convenience library, so add in its objects. 567240dd5a57Smrg convenience="$convenience $ladir/$objdir/$old_library" 567340dd5a57Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 567440dd5a57Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 567540dd5a57Smrg func_fatal_error "\`$lib' is not a convenience library" 567640dd5a57Smrg fi 567740dd5a57Smrg tmp_libs= 567840dd5a57Smrg for deplib in $dependency_libs; do 567940dd5a57Smrg deplibs="$deplib $deplibs" 568040dd5a57Smrg if $opt_duplicate_deps ; then 568140dd5a57Smrg case "$tmp_libs " in 568240dd5a57Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 568340dd5a57Smrg esac 568440dd5a57Smrg fi 568540dd5a57Smrg tmp_libs="$tmp_libs $deplib" 568640dd5a57Smrg done 568740dd5a57Smrg continue 568840dd5a57Smrg fi # $pass = conv 568940dd5a57Smrg 569040dd5a57Smrg 569140dd5a57Smrg # Get the name of the library we link against. 569240dd5a57Smrg linklib= 569340dd5a57Smrg for l in $old_library $library_names; do 569440dd5a57Smrg linklib="$l" 569540dd5a57Smrg done 569640dd5a57Smrg if test -z "$linklib"; then 569740dd5a57Smrg func_fatal_error "cannot find name of link library for \`$lib'" 569840dd5a57Smrg fi 569940dd5a57Smrg 570040dd5a57Smrg # This library was specified with -dlopen. 570140dd5a57Smrg if test "$pass" = dlopen; then 570240dd5a57Smrg if test -z "$libdir"; then 570340dd5a57Smrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 570440dd5a57Smrg fi 570540dd5a57Smrg if test -z "$dlname" || 570640dd5a57Smrg test "$dlopen_support" != yes || 570740dd5a57Smrg test "$build_libtool_libs" = no; then 570840dd5a57Smrg # If there is no dlname, no dlopen support or we're linking 570940dd5a57Smrg # statically, we need to preload. We also need to preload any 571040dd5a57Smrg # dependent libraries so libltdl's deplib preloader doesn't 571140dd5a57Smrg # bomb out in the load deplibs phase. 571240dd5a57Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 571340dd5a57Smrg else 571440dd5a57Smrg newdlfiles="$newdlfiles $lib" 571540dd5a57Smrg fi 571640dd5a57Smrg continue 571740dd5a57Smrg fi # $pass = dlopen 571840dd5a57Smrg 571940dd5a57Smrg # We need an absolute path. 572040dd5a57Smrg case $ladir in 572140dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 572240dd5a57Smrg *) 572340dd5a57Smrg abs_ladir=`cd "$ladir" && pwd` 572440dd5a57Smrg if test -z "$abs_ladir"; then 572540dd5a57Smrg func_warning "cannot determine absolute directory name of \`$ladir'" 572640dd5a57Smrg func_warning "passing it literally to the linker, although it might fail" 572740dd5a57Smrg abs_ladir="$ladir" 572840dd5a57Smrg fi 572940dd5a57Smrg ;; 573040dd5a57Smrg esac 573140dd5a57Smrg func_basename "$lib" 573240dd5a57Smrg laname="$func_basename_result" 573340dd5a57Smrg 573440dd5a57Smrg # Find the relevant object directory and library name. 573540dd5a57Smrg if test "X$installed" = Xyes; then 573640dd5a57Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 573740dd5a57Smrg func_warning "library \`$lib' was moved." 573840dd5a57Smrg dir="$ladir" 573940dd5a57Smrg absdir="$abs_ladir" 574040dd5a57Smrg libdir="$abs_ladir" 574140dd5a57Smrg else 574240dd5a57Smrg dir="$libdir" 574340dd5a57Smrg absdir="$libdir" 574440dd5a57Smrg fi 574540dd5a57Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 574640dd5a57Smrg else 574740dd5a57Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 574840dd5a57Smrg dir="$ladir" 574940dd5a57Smrg absdir="$abs_ladir" 575040dd5a57Smrg # Remove this search path later 575140dd5a57Smrg notinst_path="$notinst_path $abs_ladir" 575240dd5a57Smrg else 575340dd5a57Smrg dir="$ladir/$objdir" 575440dd5a57Smrg absdir="$abs_ladir/$objdir" 575540dd5a57Smrg # Remove this search path later 575640dd5a57Smrg notinst_path="$notinst_path $abs_ladir" 575740dd5a57Smrg fi 575840dd5a57Smrg fi # $installed = yes 575940dd5a57Smrg func_stripname 'lib' '.la' "$laname" 576040dd5a57Smrg name=$func_stripname_result 576140dd5a57Smrg 576240dd5a57Smrg # This library was specified with -dlpreopen. 576340dd5a57Smrg if test "$pass" = dlpreopen; then 576440dd5a57Smrg if test -z "$libdir" && test "$linkmode" = prog; then 576540dd5a57Smrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 576640dd5a57Smrg fi 576740dd5a57Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 576840dd5a57Smrg # are required to link). 576940dd5a57Smrg if test -n "$old_library"; then 577040dd5a57Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 577140dd5a57Smrg # Keep a list of preopened convenience libraries to check 577240dd5a57Smrg # that they are being used correctly in the link pass. 577340dd5a57Smrg test -z "$libdir" && \ 577440dd5a57Smrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 577540dd5a57Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 577640dd5a57Smrg elif test -n "$dlname"; then 577740dd5a57Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 577840dd5a57Smrg else 577940dd5a57Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 578040dd5a57Smrg fi 578140dd5a57Smrg fi # $pass = dlpreopen 578240dd5a57Smrg 578340dd5a57Smrg if test -z "$libdir"; then 578440dd5a57Smrg # Link the convenience library 578540dd5a57Smrg if test "$linkmode" = lib; then 578640dd5a57Smrg deplibs="$dir/$old_library $deplibs" 578740dd5a57Smrg elif test "$linkmode,$pass" = "prog,link"; then 578840dd5a57Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 578940dd5a57Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 579040dd5a57Smrg else 579140dd5a57Smrg deplibs="$lib $deplibs" # used for prog,scan pass 579240dd5a57Smrg fi 579340dd5a57Smrg continue 579440dd5a57Smrg fi 579540dd5a57Smrg 579640dd5a57Smrg 579740dd5a57Smrg if test "$linkmode" = prog && test "$pass" != link; then 579840dd5a57Smrg newlib_search_path="$newlib_search_path $ladir" 579940dd5a57Smrg deplibs="$lib $deplibs" 580040dd5a57Smrg 580140dd5a57Smrg linkalldeplibs=no 580240dd5a57Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 580340dd5a57Smrg test "$build_libtool_libs" = no; then 580440dd5a57Smrg linkalldeplibs=yes 580540dd5a57Smrg fi 580640dd5a57Smrg 580740dd5a57Smrg tmp_libs= 580840dd5a57Smrg for deplib in $dependency_libs; do 580940dd5a57Smrg case $deplib in 581040dd5a57Smrg -L*) func_stripname '-L' '' "$deplib" 581140dd5a57Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 581240dd5a57Smrg ;; 581340dd5a57Smrg esac 581440dd5a57Smrg # Need to link against all dependency_libs? 581540dd5a57Smrg if test "$linkalldeplibs" = yes; then 581640dd5a57Smrg deplibs="$deplib $deplibs" 581740dd5a57Smrg else 581840dd5a57Smrg # Need to hardcode shared library paths 581940dd5a57Smrg # or/and link against static libraries 582040dd5a57Smrg newdependency_libs="$deplib $newdependency_libs" 582140dd5a57Smrg fi 582240dd5a57Smrg if $opt_duplicate_deps ; then 582340dd5a57Smrg case "$tmp_libs " in 582440dd5a57Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 582540dd5a57Smrg esac 582640dd5a57Smrg fi 582740dd5a57Smrg tmp_libs="$tmp_libs $deplib" 582840dd5a57Smrg done # for deplib 582940dd5a57Smrg continue 583040dd5a57Smrg fi # $linkmode = prog... 583140dd5a57Smrg 583240dd5a57Smrg if test "$linkmode,$pass" = "prog,link"; then 583340dd5a57Smrg if test -n "$library_names" && 583440dd5a57Smrg { { test "$prefer_static_libs" = no || 583540dd5a57Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 583640dd5a57Smrg test -z "$old_library"; }; then 583740dd5a57Smrg # We need to hardcode the library path 583840dd5a57Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 583940dd5a57Smrg # Make sure the rpath contains only unique directories. 584040dd5a57Smrg case "$temp_rpath:" in 584140dd5a57Smrg *"$absdir:"*) ;; 584240dd5a57Smrg *) temp_rpath="$temp_rpath$absdir:" ;; 584340dd5a57Smrg esac 584440dd5a57Smrg fi 584540dd5a57Smrg 584640dd5a57Smrg # Hardcode the library path. 584740dd5a57Smrg # Skip directories that are in the system default run-time 584840dd5a57Smrg # search path. 584940dd5a57Smrg case " $sys_lib_dlsearch_path " in 585040dd5a57Smrg *" $absdir "*) ;; 585140dd5a57Smrg *) 585240dd5a57Smrg case "$compile_rpath " in 585340dd5a57Smrg *" $absdir "*) ;; 585440dd5a57Smrg *) compile_rpath="$compile_rpath $absdir" 585540dd5a57Smrg esac 585640dd5a57Smrg ;; 585740dd5a57Smrg esac 585840dd5a57Smrg case " $sys_lib_dlsearch_path " in 585940dd5a57Smrg *" $libdir "*) ;; 586040dd5a57Smrg *) 586140dd5a57Smrg case "$finalize_rpath " in 586240dd5a57Smrg *" $libdir "*) ;; 586340dd5a57Smrg *) finalize_rpath="$finalize_rpath $libdir" 586440dd5a57Smrg esac 586540dd5a57Smrg ;; 586640dd5a57Smrg esac 586740dd5a57Smrg fi # $linkmode,$pass = prog,link... 586840dd5a57Smrg 586940dd5a57Smrg if test "$alldeplibs" = yes && 587040dd5a57Smrg { test "$deplibs_check_method" = pass_all || 587140dd5a57Smrg { test "$build_libtool_libs" = yes && 587240dd5a57Smrg test -n "$library_names"; }; }; then 587340dd5a57Smrg # We only need to search for static libraries 587440dd5a57Smrg continue 587540dd5a57Smrg fi 587640dd5a57Smrg fi 587740dd5a57Smrg 587840dd5a57Smrg link_static=no # Whether the deplib will be linked statically 587940dd5a57Smrg use_static_libs=$prefer_static_libs 588040dd5a57Smrg if test "$use_static_libs" = built && test "$installed" = yes; then 588140dd5a57Smrg use_static_libs=no 588240dd5a57Smrg fi 588340dd5a57Smrg if test -n "$library_names" && 588440dd5a57Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 588540dd5a57Smrg case $host in 588640dd5a57Smrg *cygwin* | *mingw* | *cegcc*) 588740dd5a57Smrg # No point in relinking DLLs because paths are not encoded 588840dd5a57Smrg notinst_deplibs="$notinst_deplibs $lib" 588940dd5a57Smrg need_relink=no 589040dd5a57Smrg ;; 589140dd5a57Smrg *) 589240dd5a57Smrg if test "$installed" = no; then 589340dd5a57Smrg notinst_deplibs="$notinst_deplibs $lib" 589440dd5a57Smrg need_relink=yes 589540dd5a57Smrg fi 589640dd5a57Smrg ;; 589740dd5a57Smrg esac 589840dd5a57Smrg # This is a shared library 589940dd5a57Smrg 590040dd5a57Smrg # Warn about portability, can't link against -module's on some 590140dd5a57Smrg # systems (darwin). Don't bleat about dlopened modules though! 590240dd5a57Smrg dlopenmodule="" 590340dd5a57Smrg for dlpremoduletest in $dlprefiles; do 590440dd5a57Smrg if test "X$dlpremoduletest" = "X$lib"; then 590540dd5a57Smrg dlopenmodule="$dlpremoduletest" 590640dd5a57Smrg break 590740dd5a57Smrg fi 590840dd5a57Smrg done 590940dd5a57Smrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 591040dd5a57Smrg echo 591140dd5a57Smrg if test "$linkmode" = prog; then 591240dd5a57Smrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 591340dd5a57Smrg else 591440dd5a57Smrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 591540dd5a57Smrg fi 591640dd5a57Smrg $ECHO "*** $linklib is not portable!" 591740dd5a57Smrg fi 591840dd5a57Smrg if test "$linkmode" = lib && 591940dd5a57Smrg test "$hardcode_into_libs" = yes; then 592040dd5a57Smrg # Hardcode the library path. 592140dd5a57Smrg # Skip directories that are in the system default run-time 592240dd5a57Smrg # search path. 592340dd5a57Smrg case " $sys_lib_dlsearch_path " in 592440dd5a57Smrg *" $absdir "*) ;; 592540dd5a57Smrg *) 592640dd5a57Smrg case "$compile_rpath " in 592740dd5a57Smrg *" $absdir "*) ;; 592840dd5a57Smrg *) compile_rpath="$compile_rpath $absdir" 592940dd5a57Smrg esac 593040dd5a57Smrg ;; 593140dd5a57Smrg esac 593240dd5a57Smrg case " $sys_lib_dlsearch_path " in 593340dd5a57Smrg *" $libdir "*) ;; 593440dd5a57Smrg *) 593540dd5a57Smrg case "$finalize_rpath " in 593640dd5a57Smrg *" $libdir "*) ;; 593740dd5a57Smrg *) finalize_rpath="$finalize_rpath $libdir" 593840dd5a57Smrg esac 593940dd5a57Smrg ;; 594040dd5a57Smrg esac 594140dd5a57Smrg fi 594240dd5a57Smrg 594340dd5a57Smrg if test -n "$old_archive_from_expsyms_cmds"; then 594440dd5a57Smrg # figure out the soname 594540dd5a57Smrg set dummy $library_names 594640dd5a57Smrg shift 594740dd5a57Smrg realname="$1" 594840dd5a57Smrg shift 594940dd5a57Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 595040dd5a57Smrg # use dlname if we got it. it's perfectly good, no? 595140dd5a57Smrg if test -n "$dlname"; then 595240dd5a57Smrg soname="$dlname" 595340dd5a57Smrg elif test -n "$soname_spec"; then 595440dd5a57Smrg # bleh windows 595540dd5a57Smrg case $host in 595640dd5a57Smrg *cygwin* | mingw* | *cegcc*) 595740dd5a57Smrg func_arith $current - $age 595840dd5a57Smrg major=$func_arith_result 595940dd5a57Smrg versuffix="-$major" 596040dd5a57Smrg ;; 596140dd5a57Smrg esac 596240dd5a57Smrg eval soname=\"$soname_spec\" 596340dd5a57Smrg else 596440dd5a57Smrg soname="$realname" 596540dd5a57Smrg fi 596640dd5a57Smrg 596740dd5a57Smrg # Make a new name for the extract_expsyms_cmds to use 596840dd5a57Smrg soroot="$soname" 596940dd5a57Smrg func_basename "$soroot" 597040dd5a57Smrg soname="$func_basename_result" 597140dd5a57Smrg func_stripname 'lib' '.dll' "$soname" 597240dd5a57Smrg newlib=libimp-$func_stripname_result.a 597340dd5a57Smrg 597440dd5a57Smrg # If the library has no export list, then create one now 597540dd5a57Smrg if test -f "$output_objdir/$soname-def"; then : 597640dd5a57Smrg else 597740dd5a57Smrg func_verbose "extracting exported symbol list from \`$soname'" 597840dd5a57Smrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 597940dd5a57Smrg fi 598040dd5a57Smrg 598140dd5a57Smrg # Create $newlib 598240dd5a57Smrg if test -f "$output_objdir/$newlib"; then :; else 598340dd5a57Smrg func_verbose "generating import library for \`$soname'" 598440dd5a57Smrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 598540dd5a57Smrg fi 598640dd5a57Smrg # make sure the library variables are pointing to the new library 598740dd5a57Smrg dir=$output_objdir 598840dd5a57Smrg linklib=$newlib 598940dd5a57Smrg fi # test -n "$old_archive_from_expsyms_cmds" 599040dd5a57Smrg 599140dd5a57Smrg if test "$linkmode" = prog || test "$mode" != relink; then 599240dd5a57Smrg add_shlibpath= 599340dd5a57Smrg add_dir= 599440dd5a57Smrg add= 599540dd5a57Smrg lib_linked=yes 599640dd5a57Smrg case $hardcode_action in 599740dd5a57Smrg immediate | unsupported) 599840dd5a57Smrg if test "$hardcode_direct" = no; then 599940dd5a57Smrg add="$dir/$linklib" 600040dd5a57Smrg case $host in 600140dd5a57Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 600240dd5a57Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 600340dd5a57Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 600440dd5a57Smrg *-*-unixware7*) add_dir="-L$dir" ;; 600540dd5a57Smrg *-*-darwin* ) 600640dd5a57Smrg # if the lib is a (non-dlopened) module then we can not 600740dd5a57Smrg # link against it, someone is ignoring the earlier warnings 600840dd5a57Smrg if /usr/bin/file -L $add 2> /dev/null | 600940dd5a57Smrg $GREP ": [^:]* bundle" >/dev/null ; then 601040dd5a57Smrg if test "X$dlopenmodule" != "X$lib"; then 601140dd5a57Smrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 601240dd5a57Smrg if test -z "$old_library" ; then 601340dd5a57Smrg echo 601440dd5a57Smrg echo "*** And there doesn't seem to be a static archive available" 601540dd5a57Smrg echo "*** The link will probably fail, sorry" 601640dd5a57Smrg else 601740dd5a57Smrg add="$dir/$old_library" 601840dd5a57Smrg fi 601940dd5a57Smrg elif test -n "$old_library"; then 602040dd5a57Smrg add="$dir/$old_library" 602140dd5a57Smrg fi 602240dd5a57Smrg fi 602340dd5a57Smrg esac 602440dd5a57Smrg elif test "$hardcode_minus_L" = no; then 602540dd5a57Smrg case $host in 602640dd5a57Smrg *-*-sunos*) add_shlibpath="$dir" ;; 602740dd5a57Smrg esac 602840dd5a57Smrg add_dir="-L$dir" 602940dd5a57Smrg add="-l$name" 603040dd5a57Smrg elif test "$hardcode_shlibpath_var" = no; then 603140dd5a57Smrg add_shlibpath="$dir" 603240dd5a57Smrg add="-l$name" 603340dd5a57Smrg else 603440dd5a57Smrg lib_linked=no 603540dd5a57Smrg fi 603640dd5a57Smrg ;; 603740dd5a57Smrg relink) 603840dd5a57Smrg if test "$hardcode_direct" = yes && 603940dd5a57Smrg test "$hardcode_direct_absolute" = no; then 604040dd5a57Smrg add="$dir/$linklib" 604140dd5a57Smrg elif test "$hardcode_minus_L" = yes; then 604240dd5a57Smrg add_dir="-L$dir" 604340dd5a57Smrg # Try looking first in the location we're being installed to. 604440dd5a57Smrg if test -n "$inst_prefix_dir"; then 604540dd5a57Smrg case $libdir in 604640dd5a57Smrg [\\/]*) 604740dd5a57Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 604840dd5a57Smrg ;; 604940dd5a57Smrg esac 605040dd5a57Smrg fi 605140dd5a57Smrg add="-l$name" 605240dd5a57Smrg elif test "$hardcode_shlibpath_var" = yes; then 605340dd5a57Smrg add_shlibpath="$dir" 605440dd5a57Smrg add="-l$name" 605540dd5a57Smrg else 605640dd5a57Smrg lib_linked=no 605740dd5a57Smrg fi 605840dd5a57Smrg ;; 605940dd5a57Smrg *) lib_linked=no ;; 606040dd5a57Smrg esac 606140dd5a57Smrg 606240dd5a57Smrg if test "$lib_linked" != yes; then 606340dd5a57Smrg func_fatal_configuration "unsupported hardcode properties" 606440dd5a57Smrg fi 606540dd5a57Smrg 606640dd5a57Smrg if test -n "$add_shlibpath"; then 606740dd5a57Smrg case :$compile_shlibpath: in 606840dd5a57Smrg *":$add_shlibpath:"*) ;; 606940dd5a57Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 607040dd5a57Smrg esac 607140dd5a57Smrg fi 607240dd5a57Smrg if test "$linkmode" = prog; then 607340dd5a57Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 607440dd5a57Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 607540dd5a57Smrg else 607640dd5a57Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 607740dd5a57Smrg test -n "$add" && deplibs="$add $deplibs" 607840dd5a57Smrg if test "$hardcode_direct" != yes && 607940dd5a57Smrg test "$hardcode_minus_L" != yes && 608040dd5a57Smrg test "$hardcode_shlibpath_var" = yes; then 608140dd5a57Smrg case :$finalize_shlibpath: in 608240dd5a57Smrg *":$libdir:"*) ;; 608340dd5a57Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 608440dd5a57Smrg esac 608540dd5a57Smrg fi 608640dd5a57Smrg fi 608740dd5a57Smrg fi 608840dd5a57Smrg 608940dd5a57Smrg if test "$linkmode" = prog || test "$mode" = relink; then 609040dd5a57Smrg add_shlibpath= 609140dd5a57Smrg add_dir= 609240dd5a57Smrg add= 609340dd5a57Smrg # Finalize command for both is simple: just hardcode it. 609440dd5a57Smrg if test "$hardcode_direct" = yes && 609540dd5a57Smrg test "$hardcode_direct_absolute" = no; then 609640dd5a57Smrg add="$libdir/$linklib" 609740dd5a57Smrg elif test "$hardcode_minus_L" = yes; then 609840dd5a57Smrg add_dir="-L$libdir" 609940dd5a57Smrg add="-l$name" 610040dd5a57Smrg elif test "$hardcode_shlibpath_var" = yes; then 610140dd5a57Smrg case :$finalize_shlibpath: in 610240dd5a57Smrg *":$libdir:"*) ;; 610340dd5a57Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 610440dd5a57Smrg esac 610540dd5a57Smrg add="-l$name" 610640dd5a57Smrg elif test "$hardcode_automatic" = yes; then 610740dd5a57Smrg if test -n "$inst_prefix_dir" && 610840dd5a57Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 610940dd5a57Smrg add="$inst_prefix_dir$libdir/$linklib" 611040dd5a57Smrg else 611140dd5a57Smrg add="$libdir/$linklib" 611240dd5a57Smrg fi 611340dd5a57Smrg else 611440dd5a57Smrg # We cannot seem to hardcode it, guess we'll fake it. 611540dd5a57Smrg add_dir="-L$libdir" 611640dd5a57Smrg # Try looking first in the location we're being installed to. 611740dd5a57Smrg if test -n "$inst_prefix_dir"; then 611840dd5a57Smrg case $libdir in 611940dd5a57Smrg [\\/]*) 612040dd5a57Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 612140dd5a57Smrg ;; 612240dd5a57Smrg esac 612340dd5a57Smrg fi 612440dd5a57Smrg add="-l$name" 612540dd5a57Smrg fi 612640dd5a57Smrg 612740dd5a57Smrg if test "$linkmode" = prog; then 612840dd5a57Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 612940dd5a57Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 613040dd5a57Smrg else 613140dd5a57Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 613240dd5a57Smrg test -n "$add" && deplibs="$add $deplibs" 613340dd5a57Smrg fi 613440dd5a57Smrg fi 613540dd5a57Smrg elif test "$linkmode" = prog; then 613640dd5a57Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 613740dd5a57Smrg # is not unsupported. This is valid on all known static and 613840dd5a57Smrg # shared platforms. 613940dd5a57Smrg if test "$hardcode_direct" != unsupported; then 614040dd5a57Smrg test -n "$old_library" && linklib="$old_library" 614140dd5a57Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 614240dd5a57Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 614340dd5a57Smrg else 614440dd5a57Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 614540dd5a57Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 614640dd5a57Smrg fi 614740dd5a57Smrg elif test "$build_libtool_libs" = yes; then 614840dd5a57Smrg # Not a shared library 614940dd5a57Smrg if test "$deplibs_check_method" != pass_all; then 615040dd5a57Smrg # We're trying link a shared library against a static one 615140dd5a57Smrg # but the system doesn't support it. 615240dd5a57Smrg 615340dd5a57Smrg # Just print a warning and add the library to dependency_libs so 615440dd5a57Smrg # that the program can be linked against the static library. 615540dd5a57Smrg echo 615640dd5a57Smrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 615740dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 615840dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 615940dd5a57Smrg echo "*** shared version of the library, which you do not appear to have." 616040dd5a57Smrg if test "$module" = yes; then 616140dd5a57Smrg echo "*** But as you try to build a module library, libtool will still create " 616240dd5a57Smrg echo "*** a static module, that should work as long as the dlopening application" 616340dd5a57Smrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 616440dd5a57Smrg if test -z "$global_symbol_pipe"; then 616540dd5a57Smrg echo 616640dd5a57Smrg echo "*** However, this would only work if libtool was able to extract symbol" 616740dd5a57Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 616840dd5a57Smrg echo "*** not find such a program. So, this module is probably useless." 616940dd5a57Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 617040dd5a57Smrg fi 617140dd5a57Smrg if test "$build_old_libs" = no; then 617240dd5a57Smrg build_libtool_libs=module 617340dd5a57Smrg build_old_libs=yes 617440dd5a57Smrg else 617540dd5a57Smrg build_libtool_libs=no 617640dd5a57Smrg fi 617740dd5a57Smrg fi 617840dd5a57Smrg else 617940dd5a57Smrg deplibs="$dir/$old_library $deplibs" 618040dd5a57Smrg link_static=yes 618140dd5a57Smrg fi 618240dd5a57Smrg fi # link shared/static library? 618340dd5a57Smrg 618440dd5a57Smrg if test "$linkmode" = lib; then 618540dd5a57Smrg if test -n "$dependency_libs" && 618640dd5a57Smrg { test "$hardcode_into_libs" != yes || 618740dd5a57Smrg test "$build_old_libs" = yes || 618840dd5a57Smrg test "$link_static" = yes; }; then 618940dd5a57Smrg # Extract -R from dependency_libs 619040dd5a57Smrg temp_deplibs= 619140dd5a57Smrg for libdir in $dependency_libs; do 619240dd5a57Smrg case $libdir in 619340dd5a57Smrg -R*) func_stripname '-R' '' "$libdir" 619440dd5a57Smrg temp_xrpath=$func_stripname_result 619540dd5a57Smrg case " $xrpath " in 619640dd5a57Smrg *" $temp_xrpath "*) ;; 619740dd5a57Smrg *) xrpath="$xrpath $temp_xrpath";; 619840dd5a57Smrg esac;; 619940dd5a57Smrg *) temp_deplibs="$temp_deplibs $libdir";; 620040dd5a57Smrg esac 620140dd5a57Smrg done 620240dd5a57Smrg dependency_libs="$temp_deplibs" 620340dd5a57Smrg fi 620440dd5a57Smrg 620540dd5a57Smrg newlib_search_path="$newlib_search_path $absdir" 620640dd5a57Smrg # Link against this library 620740dd5a57Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 620840dd5a57Smrg # ... and its dependency_libs 620940dd5a57Smrg tmp_libs= 621040dd5a57Smrg for deplib in $dependency_libs; do 621140dd5a57Smrg newdependency_libs="$deplib $newdependency_libs" 621240dd5a57Smrg if $opt_duplicate_deps ; then 621340dd5a57Smrg case "$tmp_libs " in 621440dd5a57Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 621540dd5a57Smrg esac 621640dd5a57Smrg fi 621740dd5a57Smrg tmp_libs="$tmp_libs $deplib" 621840dd5a57Smrg done 621940dd5a57Smrg 622040dd5a57Smrg if test "$link_all_deplibs" != no; then 622140dd5a57Smrg # Add the search paths of all dependency libraries 622240dd5a57Smrg for deplib in $dependency_libs; do 622340dd5a57Smrg path= 622440dd5a57Smrg case $deplib in 622540dd5a57Smrg -L*) path="$deplib" ;; 622640dd5a57Smrg *.la) 622740dd5a57Smrg func_dirname "$deplib" "" "." 622840dd5a57Smrg dir="$func_dirname_result" 622940dd5a57Smrg # We need an absolute path. 623040dd5a57Smrg case $dir in 623140dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 623240dd5a57Smrg *) 623340dd5a57Smrg absdir=`cd "$dir" && pwd` 623440dd5a57Smrg if test -z "$absdir"; then 623540dd5a57Smrg func_warning "cannot determine absolute directory name of \`$dir'" 623640dd5a57Smrg absdir="$dir" 623740dd5a57Smrg fi 623840dd5a57Smrg ;; 623940dd5a57Smrg esac 624040dd5a57Smrg if $GREP "^installed=no" $deplib > /dev/null; then 624140dd5a57Smrg case $host in 624240dd5a57Smrg *-*-darwin*) 624340dd5a57Smrg depdepl= 624440dd5a57Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 624540dd5a57Smrg if test -n "$deplibrary_names" ; then 624640dd5a57Smrg for tmp in $deplibrary_names ; do 624740dd5a57Smrg depdepl=$tmp 624840dd5a57Smrg done 624940dd5a57Smrg if test -f "$absdir/$objdir/$depdepl" ; then 625040dd5a57Smrg depdepl="$absdir/$objdir/$depdepl" 625140dd5a57Smrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625240dd5a57Smrg if test -z "$darwin_install_name"; then 625340dd5a57Smrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625440dd5a57Smrg fi 625540dd5a57Smrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 625640dd5a57Smrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 625740dd5a57Smrg path= 625840dd5a57Smrg fi 625940dd5a57Smrg fi 626040dd5a57Smrg ;; 626140dd5a57Smrg *) 626240dd5a57Smrg path="-L$absdir/$objdir" 626340dd5a57Smrg ;; 626440dd5a57Smrg esac 626540dd5a57Smrg else 626640dd5a57Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 626740dd5a57Smrg test -z "$libdir" && \ 626840dd5a57Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 626940dd5a57Smrg test "$absdir" != "$libdir" && \ 627040dd5a57Smrg func_warning "\`$deplib' seems to be moved" 627140dd5a57Smrg 627240dd5a57Smrg path="-L$absdir" 627340dd5a57Smrg fi 627440dd5a57Smrg ;; 627540dd5a57Smrg esac 627640dd5a57Smrg case " $deplibs " in 627740dd5a57Smrg *" $path "*) ;; 627840dd5a57Smrg *) deplibs="$path $deplibs" ;; 627940dd5a57Smrg esac 628040dd5a57Smrg done 628140dd5a57Smrg fi # link_all_deplibs != no 628240dd5a57Smrg fi # linkmode = lib 628340dd5a57Smrg done # for deplib in $libs 628440dd5a57Smrg if test "$pass" = link; then 628540dd5a57Smrg if test "$linkmode" = "prog"; then 628640dd5a57Smrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 628740dd5a57Smrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 628840dd5a57Smrg else 628940dd5a57Smrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 629040dd5a57Smrg fi 629140dd5a57Smrg fi 629240dd5a57Smrg dependency_libs="$newdependency_libs" 629340dd5a57Smrg if test "$pass" = dlpreopen; then 629440dd5a57Smrg # Link the dlpreopened libraries before other libraries 629540dd5a57Smrg for deplib in $save_deplibs; do 629640dd5a57Smrg deplibs="$deplib $deplibs" 629740dd5a57Smrg done 629840dd5a57Smrg fi 629940dd5a57Smrg if test "$pass" != dlopen; then 630040dd5a57Smrg if test "$pass" != conv; then 630140dd5a57Smrg # Make sure lib_search_path contains only unique directories. 630240dd5a57Smrg lib_search_path= 630340dd5a57Smrg for dir in $newlib_search_path; do 630440dd5a57Smrg case "$lib_search_path " in 630540dd5a57Smrg *" $dir "*) ;; 630640dd5a57Smrg *) lib_search_path="$lib_search_path $dir" ;; 630740dd5a57Smrg esac 630840dd5a57Smrg done 630940dd5a57Smrg newlib_search_path= 631040dd5a57Smrg fi 631140dd5a57Smrg 631240dd5a57Smrg if test "$linkmode,$pass" != "prog,link"; then 631340dd5a57Smrg vars="deplibs" 631440dd5a57Smrg else 631540dd5a57Smrg vars="compile_deplibs finalize_deplibs" 631640dd5a57Smrg fi 631740dd5a57Smrg for var in $vars dependency_libs; do 631840dd5a57Smrg # Add libraries to $var in reverse order 631940dd5a57Smrg eval tmp_libs=\"\$$var\" 632040dd5a57Smrg new_libs= 632140dd5a57Smrg for deplib in $tmp_libs; do 632240dd5a57Smrg # FIXME: Pedantically, this is the right thing to do, so 632340dd5a57Smrg # that some nasty dependency loop isn't accidentally 632440dd5a57Smrg # broken: 632540dd5a57Smrg #new_libs="$deplib $new_libs" 632640dd5a57Smrg # Pragmatically, this seems to cause very few problems in 632740dd5a57Smrg # practice: 632840dd5a57Smrg case $deplib in 632940dd5a57Smrg -L*) new_libs="$deplib $new_libs" ;; 633040dd5a57Smrg -R*) ;; 633140dd5a57Smrg *) 633240dd5a57Smrg # And here is the reason: when a library appears more 633340dd5a57Smrg # than once as an explicit dependence of a library, or 633440dd5a57Smrg # is implicitly linked in more than once by the 633540dd5a57Smrg # compiler, it is considered special, and multiple 633640dd5a57Smrg # occurrences thereof are not removed. Compare this 633740dd5a57Smrg # with having the same library being listed as a 633840dd5a57Smrg # dependency of multiple other libraries: in this case, 633940dd5a57Smrg # we know (pedantically, we assume) the library does not 634040dd5a57Smrg # need to be listed more than once, so we keep only the 634140dd5a57Smrg # last copy. This is not always right, but it is rare 634240dd5a57Smrg # enough that we require users that really mean to play 634340dd5a57Smrg # such unportable linking tricks to link the library 634440dd5a57Smrg # using -Wl,-lname, so that libtool does not consider it 634540dd5a57Smrg # for duplicate removal. 634640dd5a57Smrg case " $specialdeplibs " in 634740dd5a57Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 634840dd5a57Smrg *) 634940dd5a57Smrg case " $new_libs " in 635040dd5a57Smrg *" $deplib "*) ;; 635140dd5a57Smrg *) new_libs="$deplib $new_libs" ;; 635240dd5a57Smrg esac 635340dd5a57Smrg ;; 635440dd5a57Smrg esac 635540dd5a57Smrg ;; 635640dd5a57Smrg esac 635740dd5a57Smrg done 635840dd5a57Smrg tmp_libs= 635940dd5a57Smrg for deplib in $new_libs; do 636040dd5a57Smrg case $deplib in 636140dd5a57Smrg -L*) 636240dd5a57Smrg case " $tmp_libs " in 636340dd5a57Smrg *" $deplib "*) ;; 636440dd5a57Smrg *) tmp_libs="$tmp_libs $deplib" ;; 636540dd5a57Smrg esac 636640dd5a57Smrg ;; 636740dd5a57Smrg *) tmp_libs="$tmp_libs $deplib" ;; 636840dd5a57Smrg esac 636940dd5a57Smrg done 637040dd5a57Smrg eval $var=\"$tmp_libs\" 637140dd5a57Smrg done # for var 637240dd5a57Smrg fi 637340dd5a57Smrg # Last step: remove runtime libs from dependency_libs 637440dd5a57Smrg # (they stay in deplibs) 637540dd5a57Smrg tmp_libs= 637640dd5a57Smrg for i in $dependency_libs ; do 637740dd5a57Smrg case " $predeps $postdeps $compiler_lib_search_path " in 637840dd5a57Smrg *" $i "*) 637940dd5a57Smrg i="" 638040dd5a57Smrg ;; 638140dd5a57Smrg esac 638240dd5a57Smrg if test -n "$i" ; then 638340dd5a57Smrg tmp_libs="$tmp_libs $i" 638440dd5a57Smrg fi 638540dd5a57Smrg done 638640dd5a57Smrg dependency_libs=$tmp_libs 638740dd5a57Smrg done # for pass 638840dd5a57Smrg if test "$linkmode" = prog; then 638940dd5a57Smrg dlfiles="$newdlfiles" 639040dd5a57Smrg fi 639140dd5a57Smrg if test "$linkmode" = prog || test "$linkmode" = lib; then 639240dd5a57Smrg dlprefiles="$newdlprefiles" 639340dd5a57Smrg fi 639440dd5a57Smrg 639540dd5a57Smrg case $linkmode in 639640dd5a57Smrg oldlib) 639740dd5a57Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 639840dd5a57Smrg func_warning "\`-dlopen' is ignored for archives" 639940dd5a57Smrg fi 640040dd5a57Smrg 640140dd5a57Smrg case " $deplibs" in 640240dd5a57Smrg *\ -l* | *\ -L*) 640340dd5a57Smrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 640440dd5a57Smrg esac 640540dd5a57Smrg 640640dd5a57Smrg test -n "$rpath" && \ 640740dd5a57Smrg func_warning "\`-rpath' is ignored for archives" 640840dd5a57Smrg 640940dd5a57Smrg test -n "$xrpath" && \ 641040dd5a57Smrg func_warning "\`-R' is ignored for archives" 641140dd5a57Smrg 641240dd5a57Smrg test -n "$vinfo" && \ 641340dd5a57Smrg func_warning "\`-version-info/-version-number' is ignored for archives" 641440dd5a57Smrg 641540dd5a57Smrg test -n "$release" && \ 641640dd5a57Smrg func_warning "\`-release' is ignored for archives" 641740dd5a57Smrg 641840dd5a57Smrg test -n "$export_symbols$export_symbols_regex" && \ 641940dd5a57Smrg func_warning "\`-export-symbols' is ignored for archives" 642040dd5a57Smrg 642140dd5a57Smrg # Now set the variables for building old libraries. 642240dd5a57Smrg build_libtool_libs=no 642340dd5a57Smrg oldlibs="$output" 642440dd5a57Smrg objs="$objs$old_deplibs" 642540dd5a57Smrg ;; 642640dd5a57Smrg 642740dd5a57Smrg lib) 642840dd5a57Smrg # Make sure we only generate libraries of the form `libNAME.la'. 642940dd5a57Smrg case $outputname in 643040dd5a57Smrg lib*) 643140dd5a57Smrg func_stripname 'lib' '.la' "$outputname" 643240dd5a57Smrg name=$func_stripname_result 643340dd5a57Smrg eval shared_ext=\"$shrext_cmds\" 643440dd5a57Smrg eval libname=\"$libname_spec\" 643540dd5a57Smrg ;; 643640dd5a57Smrg *) 643740dd5a57Smrg test "$module" = no && \ 643840dd5a57Smrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 643940dd5a57Smrg 644040dd5a57Smrg if test "$need_lib_prefix" != no; then 644140dd5a57Smrg # Add the "lib" prefix for modules if required 644240dd5a57Smrg func_stripname '' '.la' "$outputname" 644340dd5a57Smrg name=$func_stripname_result 644440dd5a57Smrg eval shared_ext=\"$shrext_cmds\" 644540dd5a57Smrg eval libname=\"$libname_spec\" 644640dd5a57Smrg else 644740dd5a57Smrg func_stripname '' '.la' "$outputname" 644840dd5a57Smrg libname=$func_stripname_result 644940dd5a57Smrg fi 645040dd5a57Smrg ;; 645140dd5a57Smrg esac 645240dd5a57Smrg 645340dd5a57Smrg if test -n "$objs"; then 645440dd5a57Smrg if test "$deplibs_check_method" != pass_all; then 645540dd5a57Smrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 645640dd5a57Smrg else 645740dd5a57Smrg echo 645840dd5a57Smrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 645940dd5a57Smrg $ECHO "*** objects $objs is not portable!" 646040dd5a57Smrg libobjs="$libobjs $objs" 646140dd5a57Smrg fi 646240dd5a57Smrg fi 646340dd5a57Smrg 646440dd5a57Smrg test "$dlself" != no && \ 646540dd5a57Smrg func_warning "\`-dlopen self' is ignored for libtool libraries" 646640dd5a57Smrg 646740dd5a57Smrg set dummy $rpath 646840dd5a57Smrg shift 646940dd5a57Smrg test "$#" -gt 1 && \ 647040dd5a57Smrg func_warning "ignoring multiple \`-rpath's for a libtool library" 647140dd5a57Smrg 647240dd5a57Smrg install_libdir="$1" 647340dd5a57Smrg 647440dd5a57Smrg oldlibs= 647540dd5a57Smrg if test -z "$rpath"; then 647640dd5a57Smrg if test "$build_libtool_libs" = yes; then 647740dd5a57Smrg # Building a libtool convenience library. 647840dd5a57Smrg # Some compilers have problems with a `.al' extension so 647940dd5a57Smrg # convenience libraries should have the same extension an 648040dd5a57Smrg # archive normally would. 648140dd5a57Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 648240dd5a57Smrg build_libtool_libs=convenience 648340dd5a57Smrg build_old_libs=yes 648440dd5a57Smrg fi 648540dd5a57Smrg 648640dd5a57Smrg test -n "$vinfo" && \ 648740dd5a57Smrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 648840dd5a57Smrg 648940dd5a57Smrg test -n "$release" && \ 649040dd5a57Smrg func_warning "\`-release' is ignored for convenience libraries" 649140dd5a57Smrg else 649240dd5a57Smrg 649340dd5a57Smrg # Parse the version information argument. 649440dd5a57Smrg save_ifs="$IFS"; IFS=':' 649540dd5a57Smrg set dummy $vinfo 0 0 0 649640dd5a57Smrg shift 649740dd5a57Smrg IFS="$save_ifs" 649840dd5a57Smrg 649940dd5a57Smrg test -n "$7" && \ 650040dd5a57Smrg func_fatal_help "too many parameters to \`-version-info'" 650140dd5a57Smrg 650240dd5a57Smrg # convert absolute version numbers to libtool ages 650340dd5a57Smrg # this retains compatibility with .la files and attempts 650440dd5a57Smrg # to make the code below a bit more comprehensible 650540dd5a57Smrg 650640dd5a57Smrg case $vinfo_number in 650740dd5a57Smrg yes) 650840dd5a57Smrg number_major="$1" 650940dd5a57Smrg number_minor="$2" 651040dd5a57Smrg number_revision="$3" 651140dd5a57Smrg # 651240dd5a57Smrg # There are really only two kinds -- those that 651340dd5a57Smrg # use the current revision as the major version 651440dd5a57Smrg # and those that subtract age and use age as 651540dd5a57Smrg # a minor version. But, then there is irix 651640dd5a57Smrg # which has an extra 1 added just for fun 651740dd5a57Smrg # 651840dd5a57Smrg case $version_type in 651940dd5a57Smrg darwin|linux|osf|windows|none) 652040dd5a57Smrg func_arith $number_major + $number_minor 652140dd5a57Smrg current=$func_arith_result 652240dd5a57Smrg age="$number_minor" 652340dd5a57Smrg revision="$number_revision" 652440dd5a57Smrg ;; 652540dd5a57Smrg freebsd-aout|freebsd-elf|qnx|sunos) 652640dd5a57Smrg current="$number_major" 652740dd5a57Smrg revision="$number_minor" 652840dd5a57Smrg age="0" 652940dd5a57Smrg ;; 653040dd5a57Smrg irix|nonstopux) 653140dd5a57Smrg func_arith $number_major + $number_minor 653240dd5a57Smrg current=$func_arith_result 653340dd5a57Smrg age="$number_minor" 653440dd5a57Smrg revision="$number_minor" 653540dd5a57Smrg lt_irix_increment=no 653640dd5a57Smrg ;; 653740dd5a57Smrg esac 653840dd5a57Smrg ;; 653940dd5a57Smrg no) 654040dd5a57Smrg current="$1" 654140dd5a57Smrg revision="$2" 654240dd5a57Smrg age="$3" 654340dd5a57Smrg ;; 654440dd5a57Smrg esac 654540dd5a57Smrg 654640dd5a57Smrg # Check that each of the things are valid numbers. 654740dd5a57Smrg case $current in 654840dd5a57Smrg 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]) ;; 654940dd5a57Smrg *) 655040dd5a57Smrg func_error "CURRENT \`$current' must be a nonnegative integer" 655140dd5a57Smrg func_fatal_error "\`$vinfo' is not valid version information" 655240dd5a57Smrg ;; 655340dd5a57Smrg esac 655440dd5a57Smrg 655540dd5a57Smrg case $revision in 655640dd5a57Smrg 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]) ;; 655740dd5a57Smrg *) 655840dd5a57Smrg func_error "REVISION \`$revision' must be a nonnegative integer" 655940dd5a57Smrg func_fatal_error "\`$vinfo' is not valid version information" 656040dd5a57Smrg ;; 656140dd5a57Smrg esac 656240dd5a57Smrg 656340dd5a57Smrg case $age in 656440dd5a57Smrg 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]) ;; 656540dd5a57Smrg *) 656640dd5a57Smrg func_error "AGE \`$age' must be a nonnegative integer" 656740dd5a57Smrg func_fatal_error "\`$vinfo' is not valid version information" 656840dd5a57Smrg ;; 656940dd5a57Smrg esac 657040dd5a57Smrg 657140dd5a57Smrg if test "$age" -gt "$current"; then 657240dd5a57Smrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 657340dd5a57Smrg func_fatal_error "\`$vinfo' is not valid version information" 657440dd5a57Smrg fi 657540dd5a57Smrg 657640dd5a57Smrg # Calculate the version variables. 657740dd5a57Smrg major= 657840dd5a57Smrg versuffix= 657940dd5a57Smrg verstring= 658040dd5a57Smrg case $version_type in 658140dd5a57Smrg none) ;; 658240dd5a57Smrg 658340dd5a57Smrg darwin) 658440dd5a57Smrg # Like Linux, but with the current version available in 658540dd5a57Smrg # verstring for coding it into the library header 658640dd5a57Smrg func_arith $current - $age 658740dd5a57Smrg major=.$func_arith_result 658840dd5a57Smrg versuffix="$major.$age.$revision" 658940dd5a57Smrg # Darwin ld doesn't like 0 for these options... 659040dd5a57Smrg func_arith $current + 1 659140dd5a57Smrg minor_current=$func_arith_result 659240dd5a57Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 659340dd5a57Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 659440dd5a57Smrg ;; 659540dd5a57Smrg 659640dd5a57Smrg freebsd-aout) 659740dd5a57Smrg major=".$current" 659840dd5a57Smrg versuffix=".$current.$revision"; 659940dd5a57Smrg ;; 660040dd5a57Smrg 660140dd5a57Smrg freebsd-elf) 660240dd5a57Smrg major=".$current" 660340dd5a57Smrg versuffix=".$current" 660440dd5a57Smrg ;; 660540dd5a57Smrg 660640dd5a57Smrg irix | nonstopux) 660740dd5a57Smrg if test "X$lt_irix_increment" = "Xno"; then 660840dd5a57Smrg func_arith $current - $age 660940dd5a57Smrg else 661040dd5a57Smrg func_arith $current - $age + 1 661140dd5a57Smrg fi 661240dd5a57Smrg major=$func_arith_result 661340dd5a57Smrg 661440dd5a57Smrg case $version_type in 661540dd5a57Smrg nonstopux) verstring_prefix=nonstopux ;; 661640dd5a57Smrg *) verstring_prefix=sgi ;; 661740dd5a57Smrg esac 661840dd5a57Smrg verstring="$verstring_prefix$major.$revision" 661940dd5a57Smrg 662040dd5a57Smrg # Add in all the interfaces that we are compatible with. 662140dd5a57Smrg loop=$revision 662240dd5a57Smrg while test "$loop" -ne 0; do 662340dd5a57Smrg func_arith $revision - $loop 662440dd5a57Smrg iface=$func_arith_result 662540dd5a57Smrg func_arith $loop - 1 662640dd5a57Smrg loop=$func_arith_result 662740dd5a57Smrg verstring="$verstring_prefix$major.$iface:$verstring" 662840dd5a57Smrg done 662940dd5a57Smrg 663040dd5a57Smrg # Before this point, $major must not contain `.'. 663140dd5a57Smrg major=.$major 663240dd5a57Smrg versuffix="$major.$revision" 663340dd5a57Smrg ;; 663440dd5a57Smrg 663540dd5a57Smrg linux) 663640dd5a57Smrg func_arith $current - $age 663740dd5a57Smrg major=.$func_arith_result 663840dd5a57Smrg versuffix="$major.$age.$revision" 663940dd5a57Smrg ;; 664040dd5a57Smrg 664140dd5a57Smrg osf) 664240dd5a57Smrg func_arith $current - $age 664340dd5a57Smrg major=.$func_arith_result 664440dd5a57Smrg versuffix=".$current.$age.$revision" 664540dd5a57Smrg verstring="$current.$age.$revision" 664640dd5a57Smrg 664740dd5a57Smrg # Add in all the interfaces that we are compatible with. 664840dd5a57Smrg loop=$age 664940dd5a57Smrg while test "$loop" -ne 0; do 665040dd5a57Smrg func_arith $current - $loop 665140dd5a57Smrg iface=$func_arith_result 665240dd5a57Smrg func_arith $loop - 1 665340dd5a57Smrg loop=$func_arith_result 665440dd5a57Smrg verstring="$verstring:${iface}.0" 665540dd5a57Smrg done 665640dd5a57Smrg 665740dd5a57Smrg # Make executables depend on our current version. 665840dd5a57Smrg verstring="$verstring:${current}.0" 665940dd5a57Smrg ;; 666040dd5a57Smrg 666140dd5a57Smrg qnx) 666240dd5a57Smrg major=".$current" 666340dd5a57Smrg versuffix=".$current" 666440dd5a57Smrg ;; 666540dd5a57Smrg 666640dd5a57Smrg sunos) 666740dd5a57Smrg major=".$current" 666840dd5a57Smrg versuffix=".$current.$revision" 666940dd5a57Smrg ;; 667040dd5a57Smrg 667140dd5a57Smrg windows) 667240dd5a57Smrg # Use '-' rather than '.', since we only want one 667340dd5a57Smrg # extension on DOS 8.3 filesystems. 667440dd5a57Smrg func_arith $current - $age 667540dd5a57Smrg major=$func_arith_result 667640dd5a57Smrg versuffix="-$major" 667740dd5a57Smrg ;; 667840dd5a57Smrg 667940dd5a57Smrg *) 668040dd5a57Smrg func_fatal_configuration "unknown library version type \`$version_type'" 668140dd5a57Smrg ;; 668240dd5a57Smrg esac 668340dd5a57Smrg 668440dd5a57Smrg # Clear the version info if we defaulted, and they specified a release. 668540dd5a57Smrg if test -z "$vinfo" && test -n "$release"; then 668640dd5a57Smrg major= 668740dd5a57Smrg case $version_type in 668840dd5a57Smrg darwin) 668940dd5a57Smrg # we can't check for "0.0" in archive_cmds due to quoting 669040dd5a57Smrg # problems, so we reset it completely 669140dd5a57Smrg verstring= 669240dd5a57Smrg ;; 669340dd5a57Smrg *) 669440dd5a57Smrg verstring="0.0" 669540dd5a57Smrg ;; 669640dd5a57Smrg esac 669740dd5a57Smrg if test "$need_version" = no; then 669840dd5a57Smrg versuffix= 669940dd5a57Smrg else 670040dd5a57Smrg versuffix=".0.0" 670140dd5a57Smrg fi 670240dd5a57Smrg fi 670340dd5a57Smrg 670440dd5a57Smrg # Remove version info from name if versioning should be avoided 670540dd5a57Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 670640dd5a57Smrg major= 670740dd5a57Smrg versuffix= 670840dd5a57Smrg verstring="" 670940dd5a57Smrg fi 671040dd5a57Smrg 671140dd5a57Smrg # Check to see if the archive will have undefined symbols. 671240dd5a57Smrg if test "$allow_undefined" = yes; then 671340dd5a57Smrg if test "$allow_undefined_flag" = unsupported; then 671440dd5a57Smrg func_warning "undefined symbols not allowed in $host shared libraries" 671540dd5a57Smrg build_libtool_libs=no 671640dd5a57Smrg build_old_libs=yes 671740dd5a57Smrg fi 671840dd5a57Smrg else 671940dd5a57Smrg # Don't allow undefined symbols. 672040dd5a57Smrg allow_undefined_flag="$no_undefined_flag" 672140dd5a57Smrg fi 672240dd5a57Smrg 672340dd5a57Smrg fi 672440dd5a57Smrg 672540dd5a57Smrg func_generate_dlsyms "$libname" "$libname" "yes" 672640dd5a57Smrg libobjs="$libobjs $symfileobj" 672740dd5a57Smrg test "X$libobjs" = "X " && libobjs= 672840dd5a57Smrg 672940dd5a57Smrg if test "$mode" != relink; then 673040dd5a57Smrg # Remove our outputs, but don't remove object files since they 673140dd5a57Smrg # may have been created when compiling PIC objects. 673240dd5a57Smrg removelist= 673340dd5a57Smrg tempremovelist=`$ECHO "$output_objdir/*"` 673440dd5a57Smrg for p in $tempremovelist; do 673540dd5a57Smrg case $p in 673640dd5a57Smrg *.$objext | *.gcno) 673740dd5a57Smrg ;; 673840dd5a57Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 673940dd5a57Smrg if test "X$precious_files_regex" != "X"; then 674040dd5a57Smrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 674140dd5a57Smrg then 674240dd5a57Smrg continue 674340dd5a57Smrg fi 674440dd5a57Smrg fi 674540dd5a57Smrg removelist="$removelist $p" 674640dd5a57Smrg ;; 674740dd5a57Smrg *) ;; 674840dd5a57Smrg esac 674940dd5a57Smrg done 675040dd5a57Smrg test -n "$removelist" && \ 675140dd5a57Smrg func_show_eval "${RM}r \$removelist" 675240dd5a57Smrg fi 675340dd5a57Smrg 675440dd5a57Smrg # Now set the variables for building old libraries. 675540dd5a57Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 675640dd5a57Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 675740dd5a57Smrg 675840dd5a57Smrg # Transform .lo files to .o files. 675940dd5a57Smrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 676040dd5a57Smrg fi 676140dd5a57Smrg 676240dd5a57Smrg # Eliminate all temporary directories. 676340dd5a57Smrg #for path in $notinst_path; do 676440dd5a57Smrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 676540dd5a57Smrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 676640dd5a57Smrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 676740dd5a57Smrg #done 676840dd5a57Smrg 676940dd5a57Smrg if test -n "$xrpath"; then 677040dd5a57Smrg # If the user specified any rpath flags, then add them. 677140dd5a57Smrg temp_xrpath= 677240dd5a57Smrg for libdir in $xrpath; do 677340dd5a57Smrg temp_xrpath="$temp_xrpath -R$libdir" 677440dd5a57Smrg case "$finalize_rpath " in 677540dd5a57Smrg *" $libdir "*) ;; 677640dd5a57Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 677740dd5a57Smrg esac 677840dd5a57Smrg done 677940dd5a57Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 678040dd5a57Smrg dependency_libs="$temp_xrpath $dependency_libs" 678140dd5a57Smrg fi 678240dd5a57Smrg fi 678340dd5a57Smrg 678440dd5a57Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 678540dd5a57Smrg old_dlfiles="$dlfiles" 678640dd5a57Smrg dlfiles= 678740dd5a57Smrg for lib in $old_dlfiles; do 678840dd5a57Smrg case " $dlprefiles $dlfiles " in 678940dd5a57Smrg *" $lib "*) ;; 679040dd5a57Smrg *) dlfiles="$dlfiles $lib" ;; 679140dd5a57Smrg esac 679240dd5a57Smrg done 679340dd5a57Smrg 679440dd5a57Smrg # Make sure dlprefiles contains only unique files 679540dd5a57Smrg old_dlprefiles="$dlprefiles" 679640dd5a57Smrg dlprefiles= 679740dd5a57Smrg for lib in $old_dlprefiles; do 679840dd5a57Smrg case "$dlprefiles " in 679940dd5a57Smrg *" $lib "*) ;; 680040dd5a57Smrg *) dlprefiles="$dlprefiles $lib" ;; 680140dd5a57Smrg esac 680240dd5a57Smrg done 680340dd5a57Smrg 680440dd5a57Smrg if test "$build_libtool_libs" = yes; then 680540dd5a57Smrg if test -n "$rpath"; then 680640dd5a57Smrg case $host in 680740dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 680840dd5a57Smrg # these systems don't actually have a c library (as such)! 680940dd5a57Smrg ;; 681040dd5a57Smrg *-*-rhapsody* | *-*-darwin1.[012]) 681140dd5a57Smrg # Rhapsody C library is in the System framework 681240dd5a57Smrg deplibs="$deplibs System.ltframework" 681340dd5a57Smrg ;; 681440dd5a57Smrg *-*-netbsd*) 681540dd5a57Smrg # Don't link with libc until the a.out ld.so is fixed. 681640dd5a57Smrg ;; 681740dd5a57Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 681840dd5a57Smrg # Do not include libc due to us having libc/libc_r. 681940dd5a57Smrg ;; 682040dd5a57Smrg *-*-sco3.2v5* | *-*-sco5v6*) 682140dd5a57Smrg # Causes problems with __ctype 682240dd5a57Smrg ;; 682340dd5a57Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 682440dd5a57Smrg # Compiler inserts libc in the correct place for threads to work 682540dd5a57Smrg ;; 682640dd5a57Smrg *) 682740dd5a57Smrg # Add libc to deplibs on all other systems if necessary. 682840dd5a57Smrg if test "$build_libtool_need_lc" = "yes"; then 682940dd5a57Smrg deplibs="$deplibs -lc" 683040dd5a57Smrg fi 683140dd5a57Smrg ;; 683240dd5a57Smrg esac 683340dd5a57Smrg fi 683440dd5a57Smrg 683540dd5a57Smrg # Transform deplibs into only deplibs that can be linked in shared. 683640dd5a57Smrg name_save=$name 683740dd5a57Smrg libname_save=$libname 683840dd5a57Smrg release_save=$release 683940dd5a57Smrg versuffix_save=$versuffix 684040dd5a57Smrg major_save=$major 684140dd5a57Smrg # I'm not sure if I'm treating the release correctly. I think 684240dd5a57Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 684340dd5a57Smrg # add it in twice. Is that correct? 684440dd5a57Smrg release="" 684540dd5a57Smrg versuffix="" 684640dd5a57Smrg major="" 684740dd5a57Smrg newdeplibs= 684840dd5a57Smrg droppeddeps=no 684940dd5a57Smrg case $deplibs_check_method in 685040dd5a57Smrg pass_all) 685140dd5a57Smrg # Don't check for shared/static. Everything works. 685240dd5a57Smrg # This might be a little naive. We might want to check 685340dd5a57Smrg # whether the library exists or not. But this is on 685440dd5a57Smrg # osf3 & osf4 and I'm not really sure... Just 685540dd5a57Smrg # implementing what was already the behavior. 685640dd5a57Smrg newdeplibs=$deplibs 685740dd5a57Smrg ;; 685840dd5a57Smrg test_compile) 685940dd5a57Smrg # This code stresses the "libraries are programs" paradigm to its 686040dd5a57Smrg # limits. Maybe even breaks it. We compile a program, linking it 686140dd5a57Smrg # against the deplibs as a proxy for the library. Then we can check 686240dd5a57Smrg # whether they linked in statically or dynamically with ldd. 686340dd5a57Smrg $opt_dry_run || $RM conftest.c 686440dd5a57Smrg cat > conftest.c <<EOF 686540dd5a57Smrg int main() { return 0; } 686640dd5a57SmrgEOF 686740dd5a57Smrg $opt_dry_run || $RM conftest 686840dd5a57Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 686940dd5a57Smrg ldd_output=`ldd conftest` 687040dd5a57Smrg for i in $deplibs; do 687140dd5a57Smrg case $i in 687240dd5a57Smrg -l*) 687340dd5a57Smrg func_stripname -l '' "$i" 687440dd5a57Smrg name=$func_stripname_result 687540dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 687640dd5a57Smrg case " $predeps $postdeps " in 687740dd5a57Smrg *" $i "*) 687840dd5a57Smrg newdeplibs="$newdeplibs $i" 687940dd5a57Smrg i="" 688040dd5a57Smrg ;; 688140dd5a57Smrg esac 688240dd5a57Smrg fi 688340dd5a57Smrg if test -n "$i" ; then 688440dd5a57Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 688540dd5a57Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 688640dd5a57Smrg set dummy $deplib_matches; shift 688740dd5a57Smrg deplib_match=$1 688840dd5a57Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 688940dd5a57Smrg newdeplibs="$newdeplibs $i" 689040dd5a57Smrg else 689140dd5a57Smrg droppeddeps=yes 689240dd5a57Smrg echo 689340dd5a57Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 689440dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 689540dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 689640dd5a57Smrg echo "*** shared version of the library, which I believe you do not have" 689740dd5a57Smrg echo "*** because a test_compile did reveal that the linker did not use it for" 689840dd5a57Smrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 689940dd5a57Smrg fi 690040dd5a57Smrg fi 690140dd5a57Smrg ;; 690240dd5a57Smrg *) 690340dd5a57Smrg newdeplibs="$newdeplibs $i" 690440dd5a57Smrg ;; 690540dd5a57Smrg esac 690640dd5a57Smrg done 690740dd5a57Smrg else 690840dd5a57Smrg # Error occurred in the first compile. Let's try to salvage 690940dd5a57Smrg # the situation: Compile a separate program for each library. 691040dd5a57Smrg for i in $deplibs; do 691140dd5a57Smrg case $i in 691240dd5a57Smrg -l*) 691340dd5a57Smrg func_stripname -l '' "$i" 691440dd5a57Smrg name=$func_stripname_result 691540dd5a57Smrg $opt_dry_run || $RM conftest 691640dd5a57Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 691740dd5a57Smrg ldd_output=`ldd conftest` 691840dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 691940dd5a57Smrg case " $predeps $postdeps " in 692040dd5a57Smrg *" $i "*) 692140dd5a57Smrg newdeplibs="$newdeplibs $i" 692240dd5a57Smrg i="" 692340dd5a57Smrg ;; 692440dd5a57Smrg esac 692540dd5a57Smrg fi 692640dd5a57Smrg if test -n "$i" ; then 692740dd5a57Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 692840dd5a57Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 692940dd5a57Smrg set dummy $deplib_matches; shift 693040dd5a57Smrg deplib_match=$1 693140dd5a57Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 693240dd5a57Smrg newdeplibs="$newdeplibs $i" 693340dd5a57Smrg else 693440dd5a57Smrg droppeddeps=yes 693540dd5a57Smrg echo 693640dd5a57Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 693740dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 693840dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 693940dd5a57Smrg echo "*** shared version of the library, which you do not appear to have" 694040dd5a57Smrg echo "*** because a test_compile did reveal that the linker did not use this one" 694140dd5a57Smrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 694240dd5a57Smrg fi 694340dd5a57Smrg fi 694440dd5a57Smrg else 694540dd5a57Smrg droppeddeps=yes 694640dd5a57Smrg echo 694740dd5a57Smrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 694840dd5a57Smrg echo "*** make it link in! You will probably need to install it or some" 694940dd5a57Smrg echo "*** library that it depends on before this library will be fully" 695040dd5a57Smrg echo "*** functional. Installing it before continuing would be even better." 695140dd5a57Smrg fi 695240dd5a57Smrg ;; 695340dd5a57Smrg *) 695440dd5a57Smrg newdeplibs="$newdeplibs $i" 695540dd5a57Smrg ;; 695640dd5a57Smrg esac 695740dd5a57Smrg done 695840dd5a57Smrg fi 695940dd5a57Smrg ;; 696040dd5a57Smrg file_magic*) 696140dd5a57Smrg set dummy $deplibs_check_method; shift 696240dd5a57Smrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 696340dd5a57Smrg for a_deplib in $deplibs; do 696440dd5a57Smrg case $a_deplib in 696540dd5a57Smrg -l*) 696640dd5a57Smrg func_stripname -l '' "$a_deplib" 696740dd5a57Smrg name=$func_stripname_result 696840dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 696940dd5a57Smrg case " $predeps $postdeps " in 697040dd5a57Smrg *" $a_deplib "*) 697140dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 697240dd5a57Smrg a_deplib="" 697340dd5a57Smrg ;; 697440dd5a57Smrg esac 697540dd5a57Smrg fi 697640dd5a57Smrg if test -n "$a_deplib" ; then 697740dd5a57Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 697840dd5a57Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 697940dd5a57Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 698040dd5a57Smrg for potent_lib in $potential_libs; do 698140dd5a57Smrg # Follow soft links. 698240dd5a57Smrg if ls -lLd "$potent_lib" 2>/dev/null | 698340dd5a57Smrg $GREP " -> " >/dev/null; then 698440dd5a57Smrg continue 698540dd5a57Smrg fi 698640dd5a57Smrg # The statement above tries to avoid entering an 698740dd5a57Smrg # endless loop below, in case of cyclic links. 698840dd5a57Smrg # We might still enter an endless loop, since a link 698940dd5a57Smrg # loop can be closed while we follow links, 699040dd5a57Smrg # but so what? 699140dd5a57Smrg potlib="$potent_lib" 699240dd5a57Smrg while test -h "$potlib" 2>/dev/null; do 699340dd5a57Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 699440dd5a57Smrg case $potliblink in 699540dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 699640dd5a57Smrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 699740dd5a57Smrg esac 699840dd5a57Smrg done 699940dd5a57Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 700040dd5a57Smrg $SED -e 10q | 700140dd5a57Smrg $EGREP "$file_magic_regex" > /dev/null; then 700240dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 700340dd5a57Smrg a_deplib="" 700440dd5a57Smrg break 2 700540dd5a57Smrg fi 700640dd5a57Smrg done 700740dd5a57Smrg done 700840dd5a57Smrg fi 700940dd5a57Smrg if test -n "$a_deplib" ; then 701040dd5a57Smrg droppeddeps=yes 701140dd5a57Smrg echo 701240dd5a57Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 701340dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 701440dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 701540dd5a57Smrg echo "*** shared version of the library, which you do not appear to have" 701640dd5a57Smrg echo "*** because I did check the linker path looking for a file starting" 701740dd5a57Smrg if test -z "$potlib" ; then 701840dd5a57Smrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 701940dd5a57Smrg else 702040dd5a57Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 702140dd5a57Smrg $ECHO "*** using a file magic. Last file checked: $potlib" 702240dd5a57Smrg fi 702340dd5a57Smrg fi 702440dd5a57Smrg ;; 702540dd5a57Smrg *) 702640dd5a57Smrg # Add a -L argument. 702740dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 702840dd5a57Smrg ;; 702940dd5a57Smrg esac 703040dd5a57Smrg done # Gone through all deplibs. 703140dd5a57Smrg ;; 703240dd5a57Smrg match_pattern*) 703340dd5a57Smrg set dummy $deplibs_check_method; shift 703440dd5a57Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 703540dd5a57Smrg for a_deplib in $deplibs; do 703640dd5a57Smrg case $a_deplib in 703740dd5a57Smrg -l*) 703840dd5a57Smrg func_stripname -l '' "$a_deplib" 703940dd5a57Smrg name=$func_stripname_result 704040dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 704140dd5a57Smrg case " $predeps $postdeps " in 704240dd5a57Smrg *" $a_deplib "*) 704340dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 704440dd5a57Smrg a_deplib="" 704540dd5a57Smrg ;; 704640dd5a57Smrg esac 704740dd5a57Smrg fi 704840dd5a57Smrg if test -n "$a_deplib" ; then 704940dd5a57Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 705040dd5a57Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 705140dd5a57Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 705240dd5a57Smrg for potent_lib in $potential_libs; do 705340dd5a57Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 705440dd5a57Smrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 705540dd5a57Smrg $EGREP "$match_pattern_regex" > /dev/null; then 705640dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 705740dd5a57Smrg a_deplib="" 705840dd5a57Smrg break 2 705940dd5a57Smrg fi 706040dd5a57Smrg done 706140dd5a57Smrg done 706240dd5a57Smrg fi 706340dd5a57Smrg if test -n "$a_deplib" ; then 706440dd5a57Smrg droppeddeps=yes 706540dd5a57Smrg echo 706640dd5a57Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 706740dd5a57Smrg echo "*** I have the capability to make that library automatically link in when" 706840dd5a57Smrg echo "*** you link to this library. But I can only do this if you have a" 706940dd5a57Smrg echo "*** shared version of the library, which you do not appear to have" 707040dd5a57Smrg echo "*** because I did check the linker path looking for a file starting" 707140dd5a57Smrg if test -z "$potlib" ; then 707240dd5a57Smrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 707340dd5a57Smrg else 707440dd5a57Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 707540dd5a57Smrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 707640dd5a57Smrg fi 707740dd5a57Smrg fi 707840dd5a57Smrg ;; 707940dd5a57Smrg *) 708040dd5a57Smrg # Add a -L argument. 708140dd5a57Smrg newdeplibs="$newdeplibs $a_deplib" 708240dd5a57Smrg ;; 708340dd5a57Smrg esac 708440dd5a57Smrg done # Gone through all deplibs. 708540dd5a57Smrg ;; 708640dd5a57Smrg none | unknown | *) 708740dd5a57Smrg newdeplibs="" 708840dd5a57Smrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 708940dd5a57Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 709040dd5a57Smrg for i in $predeps $postdeps ; do 709140dd5a57Smrg # can't use Xsed below, because $i might contain '/' 709240dd5a57Smrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 709340dd5a57Smrg done 709440dd5a57Smrg fi 709540dd5a57Smrg case $tmp_deplibs in 709640dd5a57Smrg *[!\ \ ]*) 709740dd5a57Smrg echo 709840dd5a57Smrg if test "X$deplibs_check_method" = "Xnone"; then 709940dd5a57Smrg echo "*** Warning: inter-library dependencies are not supported in this platform." 710040dd5a57Smrg else 710140dd5a57Smrg echo "*** Warning: inter-library dependencies are not known to be supported." 710240dd5a57Smrg fi 710340dd5a57Smrg echo "*** All declared inter-library dependencies are being dropped." 710440dd5a57Smrg droppeddeps=yes 710540dd5a57Smrg ;; 710640dd5a57Smrg esac 710740dd5a57Smrg ;; 710840dd5a57Smrg esac 710940dd5a57Smrg versuffix=$versuffix_save 711040dd5a57Smrg major=$major_save 711140dd5a57Smrg release=$release_save 711240dd5a57Smrg libname=$libname_save 711340dd5a57Smrg name=$name_save 711440dd5a57Smrg 711540dd5a57Smrg case $host in 711640dd5a57Smrg *-*-rhapsody* | *-*-darwin1.[012]) 711740dd5a57Smrg # On Rhapsody replace the C library with the System framework 711840dd5a57Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 711940dd5a57Smrg ;; 712040dd5a57Smrg esac 712140dd5a57Smrg 712240dd5a57Smrg if test "$droppeddeps" = yes; then 712340dd5a57Smrg if test "$module" = yes; then 712440dd5a57Smrg echo 712540dd5a57Smrg echo "*** Warning: libtool could not satisfy all declared inter-library" 712640dd5a57Smrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 712740dd5a57Smrg echo "*** a static module, that should work as long as the dlopening" 712840dd5a57Smrg echo "*** application is linked with the -dlopen flag." 712940dd5a57Smrg if test -z "$global_symbol_pipe"; then 713040dd5a57Smrg echo 713140dd5a57Smrg echo "*** However, this would only work if libtool was able to extract symbol" 713240dd5a57Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 713340dd5a57Smrg echo "*** not find such a program. So, this module is probably useless." 713440dd5a57Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 713540dd5a57Smrg fi 713640dd5a57Smrg if test "$build_old_libs" = no; then 713740dd5a57Smrg oldlibs="$output_objdir/$libname.$libext" 713840dd5a57Smrg build_libtool_libs=module 713940dd5a57Smrg build_old_libs=yes 714040dd5a57Smrg else 714140dd5a57Smrg build_libtool_libs=no 714240dd5a57Smrg fi 714340dd5a57Smrg else 714440dd5a57Smrg echo "*** The inter-library dependencies that have been dropped here will be" 714540dd5a57Smrg echo "*** automatically added whenever a program is linked with this library" 714640dd5a57Smrg echo "*** or is declared to -dlopen it." 714740dd5a57Smrg 714840dd5a57Smrg if test "$allow_undefined" = no; then 714940dd5a57Smrg echo 715040dd5a57Smrg echo "*** Since this library must not contain undefined symbols," 715140dd5a57Smrg echo "*** because either the platform does not support them or" 715240dd5a57Smrg echo "*** it was explicitly requested with -no-undefined," 715340dd5a57Smrg echo "*** libtool will only create a static version of it." 715440dd5a57Smrg if test "$build_old_libs" = no; then 715540dd5a57Smrg oldlibs="$output_objdir/$libname.$libext" 715640dd5a57Smrg build_libtool_libs=module 715740dd5a57Smrg build_old_libs=yes 715840dd5a57Smrg else 715940dd5a57Smrg build_libtool_libs=no 716040dd5a57Smrg fi 716140dd5a57Smrg fi 716240dd5a57Smrg fi 716340dd5a57Smrg fi 716440dd5a57Smrg # Done checking deplibs! 716540dd5a57Smrg deplibs=$newdeplibs 716640dd5a57Smrg fi 716740dd5a57Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 716840dd5a57Smrg case $host in 716940dd5a57Smrg *-*-darwin*) 717040dd5a57Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717140dd5a57Smrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717240dd5a57Smrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717340dd5a57Smrg ;; 717440dd5a57Smrg esac 717540dd5a57Smrg 717640dd5a57Smrg # move library search paths that coincide with paths to not yet 717740dd5a57Smrg # installed libraries to the beginning of the library search list 717840dd5a57Smrg new_libs= 717940dd5a57Smrg for path in $notinst_path; do 718040dd5a57Smrg case " $new_libs " in 718140dd5a57Smrg *" -L$path/$objdir "*) ;; 718240dd5a57Smrg *) 718340dd5a57Smrg case " $deplibs " in 718440dd5a57Smrg *" -L$path/$objdir "*) 718540dd5a57Smrg new_libs="$new_libs -L$path/$objdir" ;; 718640dd5a57Smrg esac 718740dd5a57Smrg ;; 718840dd5a57Smrg esac 718940dd5a57Smrg done 719040dd5a57Smrg for deplib in $deplibs; do 719140dd5a57Smrg case $deplib in 719240dd5a57Smrg -L*) 719340dd5a57Smrg case " $new_libs " in 719440dd5a57Smrg *" $deplib "*) ;; 719540dd5a57Smrg *) new_libs="$new_libs $deplib" ;; 719640dd5a57Smrg esac 719740dd5a57Smrg ;; 719840dd5a57Smrg *) new_libs="$new_libs $deplib" ;; 719940dd5a57Smrg esac 720040dd5a57Smrg done 720140dd5a57Smrg deplibs="$new_libs" 720240dd5a57Smrg 720340dd5a57Smrg # All the library-specific variables (install_libdir is set above). 720440dd5a57Smrg library_names= 720540dd5a57Smrg old_library= 720640dd5a57Smrg dlname= 720740dd5a57Smrg 720840dd5a57Smrg # Test again, we may have decided not to build it any more 720940dd5a57Smrg if test "$build_libtool_libs" = yes; then 721040dd5a57Smrg if test "$hardcode_into_libs" = yes; then 721140dd5a57Smrg # Hardcode the library paths 721240dd5a57Smrg hardcode_libdirs= 721340dd5a57Smrg dep_rpath= 721440dd5a57Smrg rpath="$finalize_rpath" 721540dd5a57Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 721640dd5a57Smrg for libdir in $rpath; do 721740dd5a57Smrg if test -n "$hardcode_libdir_flag_spec"; then 721840dd5a57Smrg if test -n "$hardcode_libdir_separator"; then 721940dd5a57Smrg if test -z "$hardcode_libdirs"; then 722040dd5a57Smrg hardcode_libdirs="$libdir" 722140dd5a57Smrg else 722240dd5a57Smrg # Just accumulate the unique libdirs. 722340dd5a57Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 722440dd5a57Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 722540dd5a57Smrg ;; 722640dd5a57Smrg *) 722740dd5a57Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 722840dd5a57Smrg ;; 722940dd5a57Smrg esac 723040dd5a57Smrg fi 723140dd5a57Smrg else 723240dd5a57Smrg eval flag=\"$hardcode_libdir_flag_spec\" 723340dd5a57Smrg dep_rpath="$dep_rpath $flag" 723440dd5a57Smrg fi 723540dd5a57Smrg elif test -n "$runpath_var"; then 723640dd5a57Smrg case "$perm_rpath " in 723740dd5a57Smrg *" $libdir "*) ;; 723840dd5a57Smrg *) perm_rpath="$perm_rpath $libdir" ;; 723940dd5a57Smrg esac 724040dd5a57Smrg fi 724140dd5a57Smrg done 724240dd5a57Smrg # Substitute the hardcoded libdirs into the rpath. 724340dd5a57Smrg if test -n "$hardcode_libdir_separator" && 724440dd5a57Smrg test -n "$hardcode_libdirs"; then 724540dd5a57Smrg libdir="$hardcode_libdirs" 724640dd5a57Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 724740dd5a57Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 724840dd5a57Smrg else 724940dd5a57Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 725040dd5a57Smrg fi 725140dd5a57Smrg fi 725240dd5a57Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 725340dd5a57Smrg # We should set the runpath_var. 725440dd5a57Smrg rpath= 725540dd5a57Smrg for dir in $perm_rpath; do 725640dd5a57Smrg rpath="$rpath$dir:" 725740dd5a57Smrg done 725840dd5a57Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 725940dd5a57Smrg fi 726040dd5a57Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 726140dd5a57Smrg fi 726240dd5a57Smrg 726340dd5a57Smrg shlibpath="$finalize_shlibpath" 726440dd5a57Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 726540dd5a57Smrg if test -n "$shlibpath"; then 726640dd5a57Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 726740dd5a57Smrg fi 726840dd5a57Smrg 726940dd5a57Smrg # Get the real and link names of the library. 727040dd5a57Smrg eval shared_ext=\"$shrext_cmds\" 727140dd5a57Smrg eval library_names=\"$library_names_spec\" 727240dd5a57Smrg set dummy $library_names 727340dd5a57Smrg shift 727440dd5a57Smrg realname="$1" 727540dd5a57Smrg shift 727640dd5a57Smrg 727740dd5a57Smrg if test -n "$soname_spec"; then 727840dd5a57Smrg eval soname=\"$soname_spec\" 727940dd5a57Smrg else 728040dd5a57Smrg soname="$realname" 728140dd5a57Smrg fi 728240dd5a57Smrg if test -z "$dlname"; then 728340dd5a57Smrg dlname=$soname 728440dd5a57Smrg fi 728540dd5a57Smrg 728640dd5a57Smrg lib="$output_objdir/$realname" 728740dd5a57Smrg linknames= 728840dd5a57Smrg for link 728940dd5a57Smrg do 729040dd5a57Smrg linknames="$linknames $link" 729140dd5a57Smrg done 729240dd5a57Smrg 729340dd5a57Smrg # Use standard objects if they are pic 729440dd5a57Smrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 729540dd5a57Smrg test "X$libobjs" = "X " && libobjs= 729640dd5a57Smrg 729740dd5a57Smrg delfiles= 729840dd5a57Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 729940dd5a57Smrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 730040dd5a57Smrg export_symbols="$output_objdir/$libname.uexp" 730140dd5a57Smrg delfiles="$delfiles $export_symbols" 730240dd5a57Smrg fi 730340dd5a57Smrg 730440dd5a57Smrg orig_export_symbols= 730540dd5a57Smrg case $host_os in 730640dd5a57Smrg cygwin* | mingw* | cegcc*) 730740dd5a57Smrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 730840dd5a57Smrg # exporting using user supplied symfile 730940dd5a57Smrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 731040dd5a57Smrg # and it's NOT already a .def file. Must figure out 731140dd5a57Smrg # which of the given symbols are data symbols and tag 731240dd5a57Smrg # them as such. So, trigger use of export_symbols_cmds. 731340dd5a57Smrg # export_symbols gets reassigned inside the "prepare 731440dd5a57Smrg # the list of exported symbols" if statement, so the 731540dd5a57Smrg # include_expsyms logic still works. 731640dd5a57Smrg orig_export_symbols="$export_symbols" 731740dd5a57Smrg export_symbols= 731840dd5a57Smrg always_export_symbols=yes 731940dd5a57Smrg fi 732040dd5a57Smrg fi 732140dd5a57Smrg ;; 732240dd5a57Smrg esac 732340dd5a57Smrg 732440dd5a57Smrg # Prepare the list of exported symbols 732540dd5a57Smrg if test -z "$export_symbols"; then 732640dd5a57Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 732740dd5a57Smrg func_verbose "generating symbol list for \`$libname.la'" 732840dd5a57Smrg export_symbols="$output_objdir/$libname.exp" 732940dd5a57Smrg $opt_dry_run || $RM $export_symbols 733040dd5a57Smrg cmds=$export_symbols_cmds 733140dd5a57Smrg save_ifs="$IFS"; IFS='~' 733240dd5a57Smrg for cmd in $cmds; do 733340dd5a57Smrg IFS="$save_ifs" 733440dd5a57Smrg eval cmd=\"$cmd\" 733540dd5a57Smrg func_len " $cmd" 733640dd5a57Smrg len=$func_len_result 733740dd5a57Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 733840dd5a57Smrg func_show_eval "$cmd" 'exit $?' 733940dd5a57Smrg skipped_export=false 734040dd5a57Smrg else 734140dd5a57Smrg # The command line is too long to execute in one step. 734240dd5a57Smrg func_verbose "using reloadable object file for export list..." 734340dd5a57Smrg skipped_export=: 734440dd5a57Smrg # Break out early, otherwise skipped_export may be 734540dd5a57Smrg # set to false by a later but shorter cmd. 734640dd5a57Smrg break 734740dd5a57Smrg fi 734840dd5a57Smrg done 734940dd5a57Smrg IFS="$save_ifs" 735040dd5a57Smrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 735140dd5a57Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 735240dd5a57Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 735340dd5a57Smrg fi 735440dd5a57Smrg fi 735540dd5a57Smrg fi 735640dd5a57Smrg 735740dd5a57Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 735840dd5a57Smrg tmp_export_symbols="$export_symbols" 735940dd5a57Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 736040dd5a57Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 736140dd5a57Smrg fi 736240dd5a57Smrg 736340dd5a57Smrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 736440dd5a57Smrg # The given exports_symbols file has to be filtered, so filter it. 736540dd5a57Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 736640dd5a57Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 736740dd5a57Smrg # 's' commands which not all seds can handle. GNU sed should be fine 736840dd5a57Smrg # though. Also, the filter scales superlinearly with the number of 736940dd5a57Smrg # global variables. join(1) would be nice here, but unfortunately 737040dd5a57Smrg # isn't a blessed tool. 737140dd5a57Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 737240dd5a57Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 737340dd5a57Smrg export_symbols=$output_objdir/$libname.def 737440dd5a57Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 737540dd5a57Smrg fi 737640dd5a57Smrg 737740dd5a57Smrg tmp_deplibs= 737840dd5a57Smrg for test_deplib in $deplibs; do 737940dd5a57Smrg case " $convenience " in 738040dd5a57Smrg *" $test_deplib "*) ;; 738140dd5a57Smrg *) 738240dd5a57Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 738340dd5a57Smrg ;; 738440dd5a57Smrg esac 738540dd5a57Smrg done 738640dd5a57Smrg deplibs="$tmp_deplibs" 738740dd5a57Smrg 738840dd5a57Smrg if test -n "$convenience"; then 738940dd5a57Smrg if test -n "$whole_archive_flag_spec" && 739040dd5a57Smrg test "$compiler_needs_object" = yes && 739140dd5a57Smrg test -z "$libobjs"; then 739240dd5a57Smrg # extract the archives, so we have objects to list. 739340dd5a57Smrg # TODO: could optimize this to just extract one archive. 739440dd5a57Smrg whole_archive_flag_spec= 739540dd5a57Smrg fi 739640dd5a57Smrg if test -n "$whole_archive_flag_spec"; then 739740dd5a57Smrg save_libobjs=$libobjs 739840dd5a57Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 739940dd5a57Smrg test "X$libobjs" = "X " && libobjs= 740040dd5a57Smrg else 740140dd5a57Smrg gentop="$output_objdir/${outputname}x" 740240dd5a57Smrg generated="$generated $gentop" 740340dd5a57Smrg 740440dd5a57Smrg func_extract_archives $gentop $convenience 740540dd5a57Smrg libobjs="$libobjs $func_extract_archives_result" 740640dd5a57Smrg test "X$libobjs" = "X " && libobjs= 740740dd5a57Smrg fi 740840dd5a57Smrg fi 740940dd5a57Smrg 741040dd5a57Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 741140dd5a57Smrg eval flag=\"$thread_safe_flag_spec\" 741240dd5a57Smrg linker_flags="$linker_flags $flag" 741340dd5a57Smrg fi 741440dd5a57Smrg 741540dd5a57Smrg # Make a backup of the uninstalled library when relinking 741640dd5a57Smrg if test "$mode" = relink; then 741740dd5a57Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 741840dd5a57Smrg fi 741940dd5a57Smrg 742040dd5a57Smrg # Do each of the archive commands. 742140dd5a57Smrg if test "$module" = yes && test -n "$module_cmds" ; then 742240dd5a57Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 742340dd5a57Smrg eval test_cmds=\"$module_expsym_cmds\" 742440dd5a57Smrg cmds=$module_expsym_cmds 742540dd5a57Smrg else 742640dd5a57Smrg eval test_cmds=\"$module_cmds\" 742740dd5a57Smrg cmds=$module_cmds 742840dd5a57Smrg fi 742940dd5a57Smrg else 743040dd5a57Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 743140dd5a57Smrg eval test_cmds=\"$archive_expsym_cmds\" 743240dd5a57Smrg cmds=$archive_expsym_cmds 743340dd5a57Smrg else 743440dd5a57Smrg eval test_cmds=\"$archive_cmds\" 743540dd5a57Smrg cmds=$archive_cmds 743640dd5a57Smrg fi 743740dd5a57Smrg fi 743840dd5a57Smrg 743940dd5a57Smrg if test "X$skipped_export" != "X:" && 744040dd5a57Smrg func_len " $test_cmds" && 744140dd5a57Smrg len=$func_len_result && 744240dd5a57Smrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 744340dd5a57Smrg : 744440dd5a57Smrg else 744540dd5a57Smrg # The command line is too long to link in one step, link piecewise 744640dd5a57Smrg # or, if using GNU ld and skipped_export is not :, use a linker 744740dd5a57Smrg # script. 744840dd5a57Smrg 744940dd5a57Smrg # Save the value of $output and $libobjs because we want to 745040dd5a57Smrg # use them later. If we have whole_archive_flag_spec, we 745140dd5a57Smrg # want to use save_libobjs as it was before 745240dd5a57Smrg # whole_archive_flag_spec was expanded, because we can't 745340dd5a57Smrg # assume the linker understands whole_archive_flag_spec. 745440dd5a57Smrg # This may have to be revisited, in case too many 745540dd5a57Smrg # convenience libraries get linked in and end up exceeding 745640dd5a57Smrg # the spec. 745740dd5a57Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 745840dd5a57Smrg save_libobjs=$libobjs 745940dd5a57Smrg fi 746040dd5a57Smrg save_output=$output 746140dd5a57Smrg func_basename "$output" 746240dd5a57Smrg output_la=$func_basename_result 746340dd5a57Smrg 746440dd5a57Smrg # Clear the reloadable object creation command queue and 746540dd5a57Smrg # initialize k to one. 746640dd5a57Smrg test_cmds= 746740dd5a57Smrg concat_cmds= 746840dd5a57Smrg objlist= 746940dd5a57Smrg last_robj= 747040dd5a57Smrg k=1 747140dd5a57Smrg 747240dd5a57Smrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 747340dd5a57Smrg output=${output_objdir}/${output_la}.lnkscript 747440dd5a57Smrg func_verbose "creating GNU ld script: $output" 747540dd5a57Smrg echo 'INPUT (' > $output 747640dd5a57Smrg for obj in $save_libobjs 747740dd5a57Smrg do 747840dd5a57Smrg $ECHO "$obj" >> $output 747940dd5a57Smrg done 748040dd5a57Smrg echo ')' >> $output 748140dd5a57Smrg delfiles="$delfiles $output" 748240dd5a57Smrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 748340dd5a57Smrg output=${output_objdir}/${output_la}.lnk 748440dd5a57Smrg func_verbose "creating linker input file list: $output" 748540dd5a57Smrg : > $output 748640dd5a57Smrg set x $save_libobjs 748740dd5a57Smrg shift 748840dd5a57Smrg firstobj= 748940dd5a57Smrg if test "$compiler_needs_object" = yes; then 749040dd5a57Smrg firstobj="$1 " 749140dd5a57Smrg shift 749240dd5a57Smrg fi 749340dd5a57Smrg for obj 749440dd5a57Smrg do 749540dd5a57Smrg $ECHO "$obj" >> $output 749640dd5a57Smrg done 749740dd5a57Smrg delfiles="$delfiles $output" 749840dd5a57Smrg output=$firstobj\"$file_list_spec$output\" 749940dd5a57Smrg else 750040dd5a57Smrg if test -n "$save_libobjs"; then 750140dd5a57Smrg func_verbose "creating reloadable object files..." 750240dd5a57Smrg output=$output_objdir/$output_la-${k}.$objext 750340dd5a57Smrg eval test_cmds=\"$reload_cmds\" 750440dd5a57Smrg func_len " $test_cmds" 750540dd5a57Smrg len0=$func_len_result 750640dd5a57Smrg len=$len0 750740dd5a57Smrg 750840dd5a57Smrg # Loop over the list of objects to be linked. 750940dd5a57Smrg for obj in $save_libobjs 751040dd5a57Smrg do 751140dd5a57Smrg func_len " $obj" 751240dd5a57Smrg func_arith $len + $func_len_result 751340dd5a57Smrg len=$func_arith_result 751440dd5a57Smrg if test "X$objlist" = X || 751540dd5a57Smrg test "$len" -lt "$max_cmd_len"; then 751640dd5a57Smrg func_append objlist " $obj" 751740dd5a57Smrg else 751840dd5a57Smrg # The command $test_cmds is almost too long, add a 751940dd5a57Smrg # command to the queue. 752040dd5a57Smrg if test "$k" -eq 1 ; then 752140dd5a57Smrg # The first file doesn't have a previous command to add. 752240dd5a57Smrg reload_objs=$objlist 752340dd5a57Smrg eval concat_cmds=\"$reload_cmds\" 752440dd5a57Smrg else 752540dd5a57Smrg # All subsequent reloadable object files will link in 752640dd5a57Smrg # the last one created. 752740dd5a57Smrg reload_objs="$objlist $last_robj" 752840dd5a57Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 752940dd5a57Smrg fi 753040dd5a57Smrg last_robj=$output_objdir/$output_la-${k}.$objext 753140dd5a57Smrg func_arith $k + 1 753240dd5a57Smrg k=$func_arith_result 753340dd5a57Smrg output=$output_objdir/$output_la-${k}.$objext 753440dd5a57Smrg objlist=" $obj" 753540dd5a57Smrg func_len " $last_robj" 753640dd5a57Smrg func_arith $len0 + $func_len_result 753740dd5a57Smrg len=$func_arith_result 753840dd5a57Smrg fi 753940dd5a57Smrg done 754040dd5a57Smrg # Handle the remaining objects by creating one last 754140dd5a57Smrg # reloadable object file. All subsequent reloadable object 754240dd5a57Smrg # files will link in the last one created. 754340dd5a57Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 754440dd5a57Smrg reload_objs="$objlist $last_robj" 754540dd5a57Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 754640dd5a57Smrg if test -n "$last_robj"; then 754740dd5a57Smrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 754840dd5a57Smrg fi 754940dd5a57Smrg delfiles="$delfiles $output" 755040dd5a57Smrg 755140dd5a57Smrg else 755240dd5a57Smrg output= 755340dd5a57Smrg fi 755440dd5a57Smrg 755540dd5a57Smrg if ${skipped_export-false}; then 755640dd5a57Smrg func_verbose "generating symbol list for \`$libname.la'" 755740dd5a57Smrg export_symbols="$output_objdir/$libname.exp" 755840dd5a57Smrg $opt_dry_run || $RM $export_symbols 755940dd5a57Smrg libobjs=$output 756040dd5a57Smrg # Append the command to create the export file. 756140dd5a57Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 756240dd5a57Smrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 756340dd5a57Smrg if test -n "$last_robj"; then 756440dd5a57Smrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 756540dd5a57Smrg fi 756640dd5a57Smrg fi 756740dd5a57Smrg 756840dd5a57Smrg test -n "$save_libobjs" && 756940dd5a57Smrg func_verbose "creating a temporary reloadable object file: $output" 757040dd5a57Smrg 757140dd5a57Smrg # Loop through the commands generated above and execute them. 757240dd5a57Smrg save_ifs="$IFS"; IFS='~' 757340dd5a57Smrg for cmd in $concat_cmds; do 757440dd5a57Smrg IFS="$save_ifs" 757540dd5a57Smrg $opt_silent || { 757640dd5a57Smrg func_quote_for_expand "$cmd" 757740dd5a57Smrg eval "func_echo $func_quote_for_expand_result" 757840dd5a57Smrg } 757940dd5a57Smrg $opt_dry_run || eval "$cmd" || { 758040dd5a57Smrg lt_exit=$? 758140dd5a57Smrg 758240dd5a57Smrg # Restore the uninstalled library and exit 758340dd5a57Smrg if test "$mode" = relink; then 758440dd5a57Smrg ( cd "$output_objdir" && \ 758540dd5a57Smrg $RM "${realname}T" && \ 758640dd5a57Smrg $MV "${realname}U" "$realname" ) 758740dd5a57Smrg fi 758840dd5a57Smrg 758940dd5a57Smrg exit $lt_exit 759040dd5a57Smrg } 759140dd5a57Smrg done 759240dd5a57Smrg IFS="$save_ifs" 759340dd5a57Smrg 759440dd5a57Smrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 759540dd5a57Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 759640dd5a57Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 759740dd5a57Smrg fi 759840dd5a57Smrg fi 759940dd5a57Smrg 760040dd5a57Smrg if ${skipped_export-false}; then 760140dd5a57Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 760240dd5a57Smrg tmp_export_symbols="$export_symbols" 760340dd5a57Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 760440dd5a57Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 760540dd5a57Smrg fi 760640dd5a57Smrg 760740dd5a57Smrg if test -n "$orig_export_symbols"; then 760840dd5a57Smrg # The given exports_symbols file has to be filtered, so filter it. 760940dd5a57Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 761040dd5a57Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 761140dd5a57Smrg # 's' commands which not all seds can handle. GNU sed should be fine 761240dd5a57Smrg # though. Also, the filter scales superlinearly with the number of 761340dd5a57Smrg # global variables. join(1) would be nice here, but unfortunately 761440dd5a57Smrg # isn't a blessed tool. 761540dd5a57Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 761640dd5a57Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 761740dd5a57Smrg export_symbols=$output_objdir/$libname.def 761840dd5a57Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 761940dd5a57Smrg fi 762040dd5a57Smrg fi 762140dd5a57Smrg 762240dd5a57Smrg libobjs=$output 762340dd5a57Smrg # Restore the value of output. 762440dd5a57Smrg output=$save_output 762540dd5a57Smrg 762640dd5a57Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 762740dd5a57Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 762840dd5a57Smrg test "X$libobjs" = "X " && libobjs= 762940dd5a57Smrg fi 763040dd5a57Smrg # Expand the library linking commands again to reset the 763140dd5a57Smrg # value of $libobjs for piecewise linking. 763240dd5a57Smrg 763340dd5a57Smrg # Do each of the archive commands. 763440dd5a57Smrg if test "$module" = yes && test -n "$module_cmds" ; then 763540dd5a57Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 763640dd5a57Smrg cmds=$module_expsym_cmds 763740dd5a57Smrg else 763840dd5a57Smrg cmds=$module_cmds 763940dd5a57Smrg fi 764040dd5a57Smrg else 764140dd5a57Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 764240dd5a57Smrg cmds=$archive_expsym_cmds 764340dd5a57Smrg else 764440dd5a57Smrg cmds=$archive_cmds 764540dd5a57Smrg fi 764640dd5a57Smrg fi 764740dd5a57Smrg fi 764840dd5a57Smrg 764940dd5a57Smrg if test -n "$delfiles"; then 765040dd5a57Smrg # Append the command to remove temporary files to $cmds. 765140dd5a57Smrg eval cmds=\"\$cmds~\$RM $delfiles\" 765240dd5a57Smrg fi 765340dd5a57Smrg 765440dd5a57Smrg # Add any objects from preloaded convenience libraries 765540dd5a57Smrg if test -n "$dlprefiles"; then 765640dd5a57Smrg gentop="$output_objdir/${outputname}x" 765740dd5a57Smrg generated="$generated $gentop" 765840dd5a57Smrg 765940dd5a57Smrg func_extract_archives $gentop $dlprefiles 766040dd5a57Smrg libobjs="$libobjs $func_extract_archives_result" 766140dd5a57Smrg test "X$libobjs" = "X " && libobjs= 766240dd5a57Smrg fi 766340dd5a57Smrg 766440dd5a57Smrg save_ifs="$IFS"; IFS='~' 766540dd5a57Smrg for cmd in $cmds; do 766640dd5a57Smrg IFS="$save_ifs" 766740dd5a57Smrg eval cmd=\"$cmd\" 766840dd5a57Smrg $opt_silent || { 766940dd5a57Smrg func_quote_for_expand "$cmd" 767040dd5a57Smrg eval "func_echo $func_quote_for_expand_result" 767140dd5a57Smrg } 767240dd5a57Smrg $opt_dry_run || eval "$cmd" || { 767340dd5a57Smrg lt_exit=$? 767440dd5a57Smrg 767540dd5a57Smrg # Restore the uninstalled library and exit 767640dd5a57Smrg if test "$mode" = relink; then 767740dd5a57Smrg ( cd "$output_objdir" && \ 767840dd5a57Smrg $RM "${realname}T" && \ 767940dd5a57Smrg $MV "${realname}U" "$realname" ) 768040dd5a57Smrg fi 768140dd5a57Smrg 768240dd5a57Smrg exit $lt_exit 768340dd5a57Smrg } 768440dd5a57Smrg done 768540dd5a57Smrg IFS="$save_ifs" 768640dd5a57Smrg 768740dd5a57Smrg # Restore the uninstalled library and exit 768840dd5a57Smrg if test "$mode" = relink; then 768940dd5a57Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 769040dd5a57Smrg 769140dd5a57Smrg if test -n "$convenience"; then 769240dd5a57Smrg if test -z "$whole_archive_flag_spec"; then 769340dd5a57Smrg func_show_eval '${RM}r "$gentop"' 769440dd5a57Smrg fi 769540dd5a57Smrg fi 769640dd5a57Smrg 769740dd5a57Smrg exit $EXIT_SUCCESS 769840dd5a57Smrg fi 769940dd5a57Smrg 770040dd5a57Smrg # Create links to the real library. 770140dd5a57Smrg for linkname in $linknames; do 770240dd5a57Smrg if test "$realname" != "$linkname"; then 770340dd5a57Smrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 770440dd5a57Smrg fi 770540dd5a57Smrg done 770640dd5a57Smrg 770740dd5a57Smrg # If -module or -export-dynamic was specified, set the dlname. 770840dd5a57Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 770940dd5a57Smrg # On all known operating systems, these are identical. 771040dd5a57Smrg dlname="$soname" 771140dd5a57Smrg fi 771240dd5a57Smrg fi 771340dd5a57Smrg ;; 771440dd5a57Smrg 771540dd5a57Smrg obj) 771640dd5a57Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 771740dd5a57Smrg func_warning "\`-dlopen' is ignored for objects" 771840dd5a57Smrg fi 771940dd5a57Smrg 772040dd5a57Smrg case " $deplibs" in 772140dd5a57Smrg *\ -l* | *\ -L*) 772240dd5a57Smrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 772340dd5a57Smrg esac 772440dd5a57Smrg 772540dd5a57Smrg test -n "$rpath" && \ 772640dd5a57Smrg func_warning "\`-rpath' is ignored for objects" 772740dd5a57Smrg 772840dd5a57Smrg test -n "$xrpath" && \ 772940dd5a57Smrg func_warning "\`-R' is ignored for objects" 773040dd5a57Smrg 773140dd5a57Smrg test -n "$vinfo" && \ 773240dd5a57Smrg func_warning "\`-version-info' is ignored for objects" 773340dd5a57Smrg 773440dd5a57Smrg test -n "$release" && \ 773540dd5a57Smrg func_warning "\`-release' is ignored for objects" 773640dd5a57Smrg 773740dd5a57Smrg case $output in 773840dd5a57Smrg *.lo) 773940dd5a57Smrg test -n "$objs$old_deplibs" && \ 774040dd5a57Smrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 774140dd5a57Smrg 774240dd5a57Smrg libobj=$output 774340dd5a57Smrg func_lo2o "$libobj" 774440dd5a57Smrg obj=$func_lo2o_result 774540dd5a57Smrg ;; 774640dd5a57Smrg *) 774740dd5a57Smrg libobj= 774840dd5a57Smrg obj="$output" 774940dd5a57Smrg ;; 775040dd5a57Smrg esac 775140dd5a57Smrg 775240dd5a57Smrg # Delete the old objects. 775340dd5a57Smrg $opt_dry_run || $RM $obj $libobj 775440dd5a57Smrg 775540dd5a57Smrg # Objects from convenience libraries. This assumes 775640dd5a57Smrg # single-version convenience libraries. Whenever we create 775740dd5a57Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 775840dd5a57Smrg # the extraction. 775940dd5a57Smrg reload_conv_objs= 776040dd5a57Smrg gentop= 776140dd5a57Smrg # reload_cmds runs $LD directly, so let us get rid of 776240dd5a57Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 776340dd5a57Smrg # turning comma into space.. 776440dd5a57Smrg wl= 776540dd5a57Smrg 776640dd5a57Smrg if test -n "$convenience"; then 776740dd5a57Smrg if test -n "$whole_archive_flag_spec"; then 776840dd5a57Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 776940dd5a57Smrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 777040dd5a57Smrg else 777140dd5a57Smrg gentop="$output_objdir/${obj}x" 777240dd5a57Smrg generated="$generated $gentop" 777340dd5a57Smrg 777440dd5a57Smrg func_extract_archives $gentop $convenience 777540dd5a57Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 777640dd5a57Smrg fi 777740dd5a57Smrg fi 777840dd5a57Smrg 777940dd5a57Smrg # Create the old-style object. 778040dd5a57Smrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 778140dd5a57Smrg 778240dd5a57Smrg output="$obj" 778340dd5a57Smrg func_execute_cmds "$reload_cmds" 'exit $?' 778440dd5a57Smrg 778540dd5a57Smrg # Exit if we aren't doing a library object file. 778640dd5a57Smrg if test -z "$libobj"; then 778740dd5a57Smrg if test -n "$gentop"; then 778840dd5a57Smrg func_show_eval '${RM}r "$gentop"' 778940dd5a57Smrg fi 779040dd5a57Smrg 779140dd5a57Smrg exit $EXIT_SUCCESS 779240dd5a57Smrg fi 779340dd5a57Smrg 779440dd5a57Smrg if test "$build_libtool_libs" != yes; then 779540dd5a57Smrg if test -n "$gentop"; then 779640dd5a57Smrg func_show_eval '${RM}r "$gentop"' 779740dd5a57Smrg fi 779840dd5a57Smrg 779940dd5a57Smrg # Create an invalid libtool object if no PIC, so that we don't 780040dd5a57Smrg # accidentally link it into a program. 780140dd5a57Smrg # $show "echo timestamp > $libobj" 780240dd5a57Smrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 780340dd5a57Smrg exit $EXIT_SUCCESS 780440dd5a57Smrg fi 780540dd5a57Smrg 780640dd5a57Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 780740dd5a57Smrg # Only do commands if we really have different PIC objects. 780840dd5a57Smrg reload_objs="$libobjs $reload_conv_objs" 780940dd5a57Smrg output="$libobj" 781040dd5a57Smrg func_execute_cmds "$reload_cmds" 'exit $?' 781140dd5a57Smrg fi 781240dd5a57Smrg 781340dd5a57Smrg if test -n "$gentop"; then 781440dd5a57Smrg func_show_eval '${RM}r "$gentop"' 781540dd5a57Smrg fi 781640dd5a57Smrg 781740dd5a57Smrg exit $EXIT_SUCCESS 781840dd5a57Smrg ;; 781940dd5a57Smrg 782040dd5a57Smrg prog) 782140dd5a57Smrg case $host in 782240dd5a57Smrg *cygwin*) func_stripname '' '.exe' "$output" 782340dd5a57Smrg output=$func_stripname_result.exe;; 782440dd5a57Smrg esac 782540dd5a57Smrg test -n "$vinfo" && \ 782640dd5a57Smrg func_warning "\`-version-info' is ignored for programs" 782740dd5a57Smrg 782840dd5a57Smrg test -n "$release" && \ 782940dd5a57Smrg func_warning "\`-release' is ignored for programs" 783040dd5a57Smrg 783140dd5a57Smrg test "$preload" = yes \ 783240dd5a57Smrg && test "$dlopen_support" = unknown \ 783340dd5a57Smrg && test "$dlopen_self" = unknown \ 783440dd5a57Smrg && test "$dlopen_self_static" = unknown && \ 783540dd5a57Smrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 783640dd5a57Smrg 783740dd5a57Smrg case $host in 783840dd5a57Smrg *-*-rhapsody* | *-*-darwin1.[012]) 783940dd5a57Smrg # On Rhapsody replace the C library is the System framework 784040dd5a57Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 784140dd5a57Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 784240dd5a57Smrg ;; 784340dd5a57Smrg esac 784440dd5a57Smrg 784540dd5a57Smrg case $host in 784640dd5a57Smrg *-*-darwin*) 784740dd5a57Smrg # Don't allow lazy linking, it breaks C++ global constructors 784840dd5a57Smrg # But is supposedly fixed on 10.4 or later (yay!). 784940dd5a57Smrg if test "$tagname" = CXX ; then 785040dd5a57Smrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 785140dd5a57Smrg 10.[0123]) 785240dd5a57Smrg compile_command="$compile_command ${wl}-bind_at_load" 785340dd5a57Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 785440dd5a57Smrg ;; 785540dd5a57Smrg esac 785640dd5a57Smrg fi 785740dd5a57Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 785840dd5a57Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 785940dd5a57Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 786040dd5a57Smrg ;; 786140dd5a57Smrg esac 786240dd5a57Smrg 786340dd5a57Smrg 786440dd5a57Smrg # move library search paths that coincide with paths to not yet 786540dd5a57Smrg # installed libraries to the beginning of the library search list 786640dd5a57Smrg new_libs= 786740dd5a57Smrg for path in $notinst_path; do 786840dd5a57Smrg case " $new_libs " in 786940dd5a57Smrg *" -L$path/$objdir "*) ;; 787040dd5a57Smrg *) 787140dd5a57Smrg case " $compile_deplibs " in 787240dd5a57Smrg *" -L$path/$objdir "*) 787340dd5a57Smrg new_libs="$new_libs -L$path/$objdir" ;; 787440dd5a57Smrg esac 787540dd5a57Smrg ;; 787640dd5a57Smrg esac 787740dd5a57Smrg done 787840dd5a57Smrg for deplib in $compile_deplibs; do 787940dd5a57Smrg case $deplib in 788040dd5a57Smrg -L*) 788140dd5a57Smrg case " $new_libs " in 788240dd5a57Smrg *" $deplib "*) ;; 788340dd5a57Smrg *) new_libs="$new_libs $deplib" ;; 788440dd5a57Smrg esac 788540dd5a57Smrg ;; 788640dd5a57Smrg *) new_libs="$new_libs $deplib" ;; 788740dd5a57Smrg esac 788840dd5a57Smrg done 788940dd5a57Smrg compile_deplibs="$new_libs" 789040dd5a57Smrg 789140dd5a57Smrg 789240dd5a57Smrg compile_command="$compile_command $compile_deplibs" 789340dd5a57Smrg finalize_command="$finalize_command $finalize_deplibs" 789440dd5a57Smrg 789540dd5a57Smrg if test -n "$rpath$xrpath"; then 789640dd5a57Smrg # If the user specified any rpath flags, then add them. 789740dd5a57Smrg for libdir in $rpath $xrpath; do 789840dd5a57Smrg # This is the magic to use -rpath. 789940dd5a57Smrg case "$finalize_rpath " in 790040dd5a57Smrg *" $libdir "*) ;; 790140dd5a57Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 790240dd5a57Smrg esac 790340dd5a57Smrg done 790440dd5a57Smrg fi 790540dd5a57Smrg 790640dd5a57Smrg # Now hardcode the library paths 790740dd5a57Smrg rpath= 790840dd5a57Smrg hardcode_libdirs= 790940dd5a57Smrg for libdir in $compile_rpath $finalize_rpath; do 791040dd5a57Smrg if test -n "$hardcode_libdir_flag_spec"; then 791140dd5a57Smrg if test -n "$hardcode_libdir_separator"; then 791240dd5a57Smrg if test -z "$hardcode_libdirs"; then 791340dd5a57Smrg hardcode_libdirs="$libdir" 791440dd5a57Smrg else 791540dd5a57Smrg # Just accumulate the unique libdirs. 791640dd5a57Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 791740dd5a57Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 791840dd5a57Smrg ;; 791940dd5a57Smrg *) 792040dd5a57Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 792140dd5a57Smrg ;; 792240dd5a57Smrg esac 792340dd5a57Smrg fi 792440dd5a57Smrg else 792540dd5a57Smrg eval flag=\"$hardcode_libdir_flag_spec\" 792640dd5a57Smrg rpath="$rpath $flag" 792740dd5a57Smrg fi 792840dd5a57Smrg elif test -n "$runpath_var"; then 792940dd5a57Smrg case "$perm_rpath " in 793040dd5a57Smrg *" $libdir "*) ;; 793140dd5a57Smrg *) perm_rpath="$perm_rpath $libdir" ;; 793240dd5a57Smrg esac 793340dd5a57Smrg fi 793440dd5a57Smrg case $host in 793540dd5a57Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 793640dd5a57Smrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 793740dd5a57Smrg case :$dllsearchpath: in 793840dd5a57Smrg *":$libdir:"*) ;; 793940dd5a57Smrg ::) dllsearchpath=$libdir;; 794040dd5a57Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 794140dd5a57Smrg esac 794240dd5a57Smrg case :$dllsearchpath: in 794340dd5a57Smrg *":$testbindir:"*) ;; 794440dd5a57Smrg ::) dllsearchpath=$testbindir;; 794540dd5a57Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 794640dd5a57Smrg esac 794740dd5a57Smrg ;; 794840dd5a57Smrg esac 794940dd5a57Smrg done 795040dd5a57Smrg # Substitute the hardcoded libdirs into the rpath. 795140dd5a57Smrg if test -n "$hardcode_libdir_separator" && 795240dd5a57Smrg test -n "$hardcode_libdirs"; then 795340dd5a57Smrg libdir="$hardcode_libdirs" 795440dd5a57Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 795540dd5a57Smrg fi 795640dd5a57Smrg compile_rpath="$rpath" 795740dd5a57Smrg 795840dd5a57Smrg rpath= 795940dd5a57Smrg hardcode_libdirs= 796040dd5a57Smrg for libdir in $finalize_rpath; do 796140dd5a57Smrg if test -n "$hardcode_libdir_flag_spec"; then 796240dd5a57Smrg if test -n "$hardcode_libdir_separator"; then 796340dd5a57Smrg if test -z "$hardcode_libdirs"; then 796440dd5a57Smrg hardcode_libdirs="$libdir" 796540dd5a57Smrg else 796640dd5a57Smrg # Just accumulate the unique libdirs. 796740dd5a57Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 796840dd5a57Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 796940dd5a57Smrg ;; 797040dd5a57Smrg *) 797140dd5a57Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 797240dd5a57Smrg ;; 797340dd5a57Smrg esac 797440dd5a57Smrg fi 797540dd5a57Smrg else 797640dd5a57Smrg eval flag=\"$hardcode_libdir_flag_spec\" 797740dd5a57Smrg rpath="$rpath $flag" 797840dd5a57Smrg fi 797940dd5a57Smrg elif test -n "$runpath_var"; then 798040dd5a57Smrg case "$finalize_perm_rpath " in 798140dd5a57Smrg *" $libdir "*) ;; 798240dd5a57Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 798340dd5a57Smrg esac 798440dd5a57Smrg fi 798540dd5a57Smrg done 798640dd5a57Smrg # Substitute the hardcoded libdirs into the rpath. 798740dd5a57Smrg if test -n "$hardcode_libdir_separator" && 798840dd5a57Smrg test -n "$hardcode_libdirs"; then 798940dd5a57Smrg libdir="$hardcode_libdirs" 799040dd5a57Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 799140dd5a57Smrg fi 799240dd5a57Smrg finalize_rpath="$rpath" 799340dd5a57Smrg 799440dd5a57Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 799540dd5a57Smrg # Transform all the library objects into standard objects. 799640dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 799740dd5a57Smrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 799840dd5a57Smrg fi 799940dd5a57Smrg 800040dd5a57Smrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 800140dd5a57Smrg 800240dd5a57Smrg # template prelinking step 800340dd5a57Smrg if test -n "$prelink_cmds"; then 800440dd5a57Smrg func_execute_cmds "$prelink_cmds" 'exit $?' 800540dd5a57Smrg fi 800640dd5a57Smrg 800740dd5a57Smrg wrappers_required=yes 800840dd5a57Smrg case $host in 800940dd5a57Smrg *cegcc* | *mingw32ce*) 801040dd5a57Smrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 801140dd5a57Smrg wrappers_required=no 801240dd5a57Smrg ;; 801340dd5a57Smrg *cygwin* | *mingw* ) 801440dd5a57Smrg if test "$build_libtool_libs" != yes; then 801540dd5a57Smrg wrappers_required=no 801640dd5a57Smrg fi 801740dd5a57Smrg ;; 801840dd5a57Smrg *) 801940dd5a57Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 802040dd5a57Smrg wrappers_required=no 802140dd5a57Smrg fi 802240dd5a57Smrg ;; 802340dd5a57Smrg esac 802440dd5a57Smrg if test "$wrappers_required" = no; then 802540dd5a57Smrg # Replace the output file specification. 802640dd5a57Smrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 802740dd5a57Smrg link_command="$compile_command$compile_rpath" 802840dd5a57Smrg 802940dd5a57Smrg # We have no uninstalled library dependencies, so finalize right now. 803040dd5a57Smrg exit_status=0 803140dd5a57Smrg func_show_eval "$link_command" 'exit_status=$?' 803240dd5a57Smrg 803340dd5a57Smrg # Delete the generated files. 803440dd5a57Smrg if test -f "$output_objdir/${outputname}S.${objext}"; then 803540dd5a57Smrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 803640dd5a57Smrg fi 803740dd5a57Smrg 803840dd5a57Smrg exit $exit_status 803940dd5a57Smrg fi 804040dd5a57Smrg 804140dd5a57Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 804240dd5a57Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 804340dd5a57Smrg fi 804440dd5a57Smrg if test -n "$finalize_shlibpath"; then 804540dd5a57Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 804640dd5a57Smrg fi 804740dd5a57Smrg 804840dd5a57Smrg compile_var= 804940dd5a57Smrg finalize_var= 805040dd5a57Smrg if test -n "$runpath_var"; then 805140dd5a57Smrg if test -n "$perm_rpath"; then 805240dd5a57Smrg # We should set the runpath_var. 805340dd5a57Smrg rpath= 805440dd5a57Smrg for dir in $perm_rpath; do 805540dd5a57Smrg rpath="$rpath$dir:" 805640dd5a57Smrg done 805740dd5a57Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 805840dd5a57Smrg fi 805940dd5a57Smrg if test -n "$finalize_perm_rpath"; then 806040dd5a57Smrg # We should set the runpath_var. 806140dd5a57Smrg rpath= 806240dd5a57Smrg for dir in $finalize_perm_rpath; do 806340dd5a57Smrg rpath="$rpath$dir:" 806440dd5a57Smrg done 806540dd5a57Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 806640dd5a57Smrg fi 806740dd5a57Smrg fi 806840dd5a57Smrg 806940dd5a57Smrg if test "$no_install" = yes; then 807040dd5a57Smrg # We don't need to create a wrapper script. 807140dd5a57Smrg link_command="$compile_var$compile_command$compile_rpath" 807240dd5a57Smrg # Replace the output file specification. 807340dd5a57Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 807440dd5a57Smrg # Delete the old output file. 807540dd5a57Smrg $opt_dry_run || $RM $output 807640dd5a57Smrg # Link the executable and exit 807740dd5a57Smrg func_show_eval "$link_command" 'exit $?' 807840dd5a57Smrg exit $EXIT_SUCCESS 807940dd5a57Smrg fi 808040dd5a57Smrg 808140dd5a57Smrg if test "$hardcode_action" = relink; then 808240dd5a57Smrg # Fast installation is not supported 808340dd5a57Smrg link_command="$compile_var$compile_command$compile_rpath" 808440dd5a57Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 808540dd5a57Smrg 808640dd5a57Smrg func_warning "this platform does not like uninstalled shared libraries" 808740dd5a57Smrg func_warning "\`$output' will be relinked during installation" 808840dd5a57Smrg else 808940dd5a57Smrg if test "$fast_install" != no; then 809040dd5a57Smrg link_command="$finalize_var$compile_command$finalize_rpath" 809140dd5a57Smrg if test "$fast_install" = yes; then 809240dd5a57Smrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 809340dd5a57Smrg else 809440dd5a57Smrg # fast_install is set to needless 809540dd5a57Smrg relink_command= 809640dd5a57Smrg fi 809740dd5a57Smrg else 809840dd5a57Smrg link_command="$compile_var$compile_command$compile_rpath" 809940dd5a57Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 810040dd5a57Smrg fi 810140dd5a57Smrg fi 810240dd5a57Smrg 810340dd5a57Smrg # Replace the output file specification. 810440dd5a57Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 810540dd5a57Smrg 810640dd5a57Smrg # Delete the old output files. 810740dd5a57Smrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 810840dd5a57Smrg 810940dd5a57Smrg func_show_eval "$link_command" 'exit $?' 811040dd5a57Smrg 811140dd5a57Smrg # Now create the wrapper script. 811240dd5a57Smrg func_verbose "creating $output" 811340dd5a57Smrg 811440dd5a57Smrg # Quote the relink command for shipping. 811540dd5a57Smrg if test -n "$relink_command"; then 811640dd5a57Smrg # Preserve any variables that may affect compiler behavior 811740dd5a57Smrg for var in $variables_saved_for_relink; do 811840dd5a57Smrg if eval test -z \"\${$var+set}\"; then 811940dd5a57Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 812040dd5a57Smrg elif eval var_value=\$$var; test -z "$var_value"; then 812140dd5a57Smrg relink_command="$var=; export $var; $relink_command" 812240dd5a57Smrg else 812340dd5a57Smrg func_quote_for_eval "$var_value" 812440dd5a57Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 812540dd5a57Smrg fi 812640dd5a57Smrg done 812740dd5a57Smrg relink_command="(cd `pwd`; $relink_command)" 812840dd5a57Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 812940dd5a57Smrg fi 813040dd5a57Smrg 813140dd5a57Smrg # Only actually do things if not in dry run mode. 813240dd5a57Smrg $opt_dry_run || { 813340dd5a57Smrg # win32 will think the script is a binary if it has 813440dd5a57Smrg # a .exe suffix, so we strip it off here. 813540dd5a57Smrg case $output in 813640dd5a57Smrg *.exe) func_stripname '' '.exe' "$output" 813740dd5a57Smrg output=$func_stripname_result ;; 813840dd5a57Smrg esac 813940dd5a57Smrg # test for cygwin because mv fails w/o .exe extensions 814040dd5a57Smrg case $host in 814140dd5a57Smrg *cygwin*) 814240dd5a57Smrg exeext=.exe 814340dd5a57Smrg func_stripname '' '.exe' "$outputname" 814440dd5a57Smrg outputname=$func_stripname_result ;; 814540dd5a57Smrg *) exeext= ;; 814640dd5a57Smrg esac 814740dd5a57Smrg case $host in 814840dd5a57Smrg *cygwin* | *mingw* ) 814940dd5a57Smrg func_dirname_and_basename "$output" "" "." 815040dd5a57Smrg output_name=$func_basename_result 815140dd5a57Smrg output_path=$func_dirname_result 815240dd5a57Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 815340dd5a57Smrg cwrapper="$output_path/$output_name.exe" 815440dd5a57Smrg $RM $cwrappersource $cwrapper 815540dd5a57Smrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 815640dd5a57Smrg 815740dd5a57Smrg func_emit_cwrapperexe_src > $cwrappersource 815840dd5a57Smrg 815940dd5a57Smrg # The wrapper executable is built using the $host compiler, 816040dd5a57Smrg # because it contains $host paths and files. If cross- 816140dd5a57Smrg # compiling, it, like the target executable, must be 816240dd5a57Smrg # executed on the $host or under an emulation environment. 816340dd5a57Smrg $opt_dry_run || { 816440dd5a57Smrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 816540dd5a57Smrg $STRIP $cwrapper 816640dd5a57Smrg } 816740dd5a57Smrg 816840dd5a57Smrg # Now, create the wrapper script for func_source use: 816940dd5a57Smrg func_ltwrapper_scriptname $cwrapper 817040dd5a57Smrg $RM $func_ltwrapper_scriptname_result 817140dd5a57Smrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 817240dd5a57Smrg $opt_dry_run || { 817340dd5a57Smrg # note: this script will not be executed, so do not chmod. 817440dd5a57Smrg if test "x$build" = "x$host" ; then 817540dd5a57Smrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 817640dd5a57Smrg else 817740dd5a57Smrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 817840dd5a57Smrg fi 817940dd5a57Smrg } 818040dd5a57Smrg ;; 818140dd5a57Smrg * ) 818240dd5a57Smrg $RM $output 818340dd5a57Smrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 818440dd5a57Smrg 818540dd5a57Smrg func_emit_wrapper no > $output 818640dd5a57Smrg chmod +x $output 818740dd5a57Smrg ;; 818840dd5a57Smrg esac 818940dd5a57Smrg } 819040dd5a57Smrg exit $EXIT_SUCCESS 819140dd5a57Smrg ;; 819240dd5a57Smrg esac 819340dd5a57Smrg 819440dd5a57Smrg # See if we need to build an old-fashioned archive. 819540dd5a57Smrg for oldlib in $oldlibs; do 819640dd5a57Smrg 819740dd5a57Smrg if test "$build_libtool_libs" = convenience; then 819840dd5a57Smrg oldobjs="$libobjs_save $symfileobj" 819940dd5a57Smrg addlibs="$convenience" 820040dd5a57Smrg build_libtool_libs=no 820140dd5a57Smrg else 820240dd5a57Smrg if test "$build_libtool_libs" = module; then 820340dd5a57Smrg oldobjs="$libobjs_save" 820440dd5a57Smrg build_libtool_libs=no 820540dd5a57Smrg else 820640dd5a57Smrg oldobjs="$old_deplibs $non_pic_objects" 820740dd5a57Smrg if test "$preload" = yes && test -f "$symfileobj"; then 820840dd5a57Smrg oldobjs="$oldobjs $symfileobj" 820940dd5a57Smrg fi 821040dd5a57Smrg fi 821140dd5a57Smrg addlibs="$old_convenience" 821240dd5a57Smrg fi 821340dd5a57Smrg 821440dd5a57Smrg if test -n "$addlibs"; then 821540dd5a57Smrg gentop="$output_objdir/${outputname}x" 821640dd5a57Smrg generated="$generated $gentop" 821740dd5a57Smrg 821840dd5a57Smrg func_extract_archives $gentop $addlibs 821940dd5a57Smrg oldobjs="$oldobjs $func_extract_archives_result" 822040dd5a57Smrg fi 822140dd5a57Smrg 822240dd5a57Smrg # Do each command in the archive commands. 822340dd5a57Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 822440dd5a57Smrg cmds=$old_archive_from_new_cmds 822540dd5a57Smrg else 822640dd5a57Smrg 822740dd5a57Smrg # Add any objects from preloaded convenience libraries 822840dd5a57Smrg if test -n "$dlprefiles"; then 822940dd5a57Smrg gentop="$output_objdir/${outputname}x" 823040dd5a57Smrg generated="$generated $gentop" 823140dd5a57Smrg 823240dd5a57Smrg func_extract_archives $gentop $dlprefiles 823340dd5a57Smrg oldobjs="$oldobjs $func_extract_archives_result" 823440dd5a57Smrg fi 823540dd5a57Smrg 823640dd5a57Smrg # POSIX demands no paths to be encoded in archives. We have 823740dd5a57Smrg # to avoid creating archives with duplicate basenames if we 823840dd5a57Smrg # might have to extract them afterwards, e.g., when creating a 823940dd5a57Smrg # static archive out of a convenience library, or when linking 824040dd5a57Smrg # the entirety of a libtool archive into another (currently 824140dd5a57Smrg # not supported by libtool). 824240dd5a57Smrg if (for obj in $oldobjs 824340dd5a57Smrg do 824440dd5a57Smrg func_basename "$obj" 824540dd5a57Smrg $ECHO "$func_basename_result" 824640dd5a57Smrg done | sort | sort -uc >/dev/null 2>&1); then 824740dd5a57Smrg : 824840dd5a57Smrg else 824940dd5a57Smrg echo "copying selected object files to avoid basename conflicts..." 825040dd5a57Smrg gentop="$output_objdir/${outputname}x" 825140dd5a57Smrg generated="$generated $gentop" 825240dd5a57Smrg func_mkdir_p "$gentop" 825340dd5a57Smrg save_oldobjs=$oldobjs 825440dd5a57Smrg oldobjs= 825540dd5a57Smrg counter=1 825640dd5a57Smrg for obj in $save_oldobjs 825740dd5a57Smrg do 825840dd5a57Smrg func_basename "$obj" 825940dd5a57Smrg objbase="$func_basename_result" 826040dd5a57Smrg case " $oldobjs " in 826140dd5a57Smrg " ") oldobjs=$obj ;; 826240dd5a57Smrg *[\ /]"$objbase "*) 826340dd5a57Smrg while :; do 826440dd5a57Smrg # Make sure we don't pick an alternate name that also 826540dd5a57Smrg # overlaps. 826640dd5a57Smrg newobj=lt$counter-$objbase 826740dd5a57Smrg func_arith $counter + 1 826840dd5a57Smrg counter=$func_arith_result 826940dd5a57Smrg case " $oldobjs " in 827040dd5a57Smrg *[\ /]"$newobj "*) ;; 827140dd5a57Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 827240dd5a57Smrg esac 827340dd5a57Smrg done 827440dd5a57Smrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 827540dd5a57Smrg oldobjs="$oldobjs $gentop/$newobj" 827640dd5a57Smrg ;; 827740dd5a57Smrg *) oldobjs="$oldobjs $obj" ;; 827840dd5a57Smrg esac 827940dd5a57Smrg done 828040dd5a57Smrg fi 828140dd5a57Smrg eval cmds=\"$old_archive_cmds\" 828240dd5a57Smrg 828340dd5a57Smrg func_len " $cmds" 828440dd5a57Smrg len=$func_len_result 828540dd5a57Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 828640dd5a57Smrg cmds=$old_archive_cmds 828740dd5a57Smrg else 828840dd5a57Smrg # the command line is too long to link in one step, link in parts 828940dd5a57Smrg func_verbose "using piecewise archive linking..." 829040dd5a57Smrg save_RANLIB=$RANLIB 829140dd5a57Smrg RANLIB=: 829240dd5a57Smrg objlist= 829340dd5a57Smrg concat_cmds= 829440dd5a57Smrg save_oldobjs=$oldobjs 829540dd5a57Smrg oldobjs= 829640dd5a57Smrg # Is there a better way of finding the last object in the list? 829740dd5a57Smrg for obj in $save_oldobjs 829840dd5a57Smrg do 829940dd5a57Smrg last_oldobj=$obj 830040dd5a57Smrg done 830140dd5a57Smrg eval test_cmds=\"$old_archive_cmds\" 830240dd5a57Smrg func_len " $test_cmds" 830340dd5a57Smrg len0=$func_len_result 830440dd5a57Smrg len=$len0 830540dd5a57Smrg for obj in $save_oldobjs 830640dd5a57Smrg do 830740dd5a57Smrg func_len " $obj" 830840dd5a57Smrg func_arith $len + $func_len_result 830940dd5a57Smrg len=$func_arith_result 831040dd5a57Smrg func_append objlist " $obj" 831140dd5a57Smrg if test "$len" -lt "$max_cmd_len"; then 831240dd5a57Smrg : 831340dd5a57Smrg else 831440dd5a57Smrg # the above command should be used before it gets too long 831540dd5a57Smrg oldobjs=$objlist 831640dd5a57Smrg if test "$obj" = "$last_oldobj" ; then 831740dd5a57Smrg RANLIB=$save_RANLIB 831840dd5a57Smrg fi 831940dd5a57Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 832040dd5a57Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 832140dd5a57Smrg objlist= 832240dd5a57Smrg len=$len0 832340dd5a57Smrg fi 832440dd5a57Smrg done 832540dd5a57Smrg RANLIB=$save_RANLIB 832640dd5a57Smrg oldobjs=$objlist 832740dd5a57Smrg if test "X$oldobjs" = "X" ; then 832840dd5a57Smrg eval cmds=\"\$concat_cmds\" 832940dd5a57Smrg else 833040dd5a57Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 833140dd5a57Smrg fi 833240dd5a57Smrg fi 833340dd5a57Smrg fi 833440dd5a57Smrg func_execute_cmds "$cmds" 'exit $?' 833540dd5a57Smrg done 833640dd5a57Smrg 833740dd5a57Smrg test -n "$generated" && \ 833840dd5a57Smrg func_show_eval "${RM}r$generated" 833940dd5a57Smrg 834040dd5a57Smrg # Now create the libtool archive. 834140dd5a57Smrg case $output in 834240dd5a57Smrg *.la) 834340dd5a57Smrg old_library= 834440dd5a57Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 834540dd5a57Smrg func_verbose "creating $output" 834640dd5a57Smrg 834740dd5a57Smrg # Preserve any variables that may affect compiler behavior 834840dd5a57Smrg for var in $variables_saved_for_relink; do 834940dd5a57Smrg if eval test -z \"\${$var+set}\"; then 835040dd5a57Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 835140dd5a57Smrg elif eval var_value=\$$var; test -z "$var_value"; then 835240dd5a57Smrg relink_command="$var=; export $var; $relink_command" 835340dd5a57Smrg else 835440dd5a57Smrg func_quote_for_eval "$var_value" 835540dd5a57Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 835640dd5a57Smrg fi 835740dd5a57Smrg done 835840dd5a57Smrg # Quote the link command for shipping. 835940dd5a57Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 836040dd5a57Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 836140dd5a57Smrg if test "$hardcode_automatic" = yes ; then 836240dd5a57Smrg relink_command= 836340dd5a57Smrg fi 836440dd5a57Smrg 836540dd5a57Smrg # Only create the output if not a dry run. 836640dd5a57Smrg $opt_dry_run || { 836740dd5a57Smrg for installed in no yes; do 836840dd5a57Smrg if test "$installed" = yes; then 836940dd5a57Smrg if test -z "$install_libdir"; then 837040dd5a57Smrg break 837140dd5a57Smrg fi 837240dd5a57Smrg output="$output_objdir/$outputname"i 837340dd5a57Smrg # Replace all uninstalled libtool libraries with the installed ones 837440dd5a57Smrg newdependency_libs= 837540dd5a57Smrg for deplib in $dependency_libs; do 837640dd5a57Smrg case $deplib in 837740dd5a57Smrg *.la) 837840dd5a57Smrg func_basename "$deplib" 837940dd5a57Smrg name="$func_basename_result" 838040dd5a57Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 838140dd5a57Smrg test -z "$libdir" && \ 838240dd5a57Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 838340dd5a57Smrg newdependency_libs="$newdependency_libs $libdir/$name" 838440dd5a57Smrg ;; 838540dd5a57Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 838640dd5a57Smrg esac 838740dd5a57Smrg done 838840dd5a57Smrg dependency_libs="$newdependency_libs" 838940dd5a57Smrg newdlfiles= 839040dd5a57Smrg 839140dd5a57Smrg for lib in $dlfiles; do 839240dd5a57Smrg case $lib in 839340dd5a57Smrg *.la) 839440dd5a57Smrg func_basename "$lib" 839540dd5a57Smrg name="$func_basename_result" 839640dd5a57Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 839740dd5a57Smrg test -z "$libdir" && \ 839840dd5a57Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 839940dd5a57Smrg newdlfiles="$newdlfiles $libdir/$name" 840040dd5a57Smrg ;; 840140dd5a57Smrg *) newdlfiles="$newdlfiles $lib" ;; 840240dd5a57Smrg esac 840340dd5a57Smrg done 840440dd5a57Smrg dlfiles="$newdlfiles" 840540dd5a57Smrg newdlprefiles= 840640dd5a57Smrg for lib in $dlprefiles; do 840740dd5a57Smrg case $lib in 840840dd5a57Smrg *.la) 840940dd5a57Smrg # Only pass preopened files to the pseudo-archive (for 841040dd5a57Smrg # eventual linking with the app. that links it) if we 841140dd5a57Smrg # didn't already link the preopened objects directly into 841240dd5a57Smrg # the library: 841340dd5a57Smrg func_basename "$lib" 841440dd5a57Smrg name="$func_basename_result" 841540dd5a57Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 841640dd5a57Smrg test -z "$libdir" && \ 841740dd5a57Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 841840dd5a57Smrg newdlprefiles="$newdlprefiles $libdir/$name" 841940dd5a57Smrg ;; 842040dd5a57Smrg esac 842140dd5a57Smrg done 842240dd5a57Smrg dlprefiles="$newdlprefiles" 842340dd5a57Smrg else 842440dd5a57Smrg newdlfiles= 842540dd5a57Smrg for lib in $dlfiles; do 842640dd5a57Smrg case $lib in 842740dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 842840dd5a57Smrg *) abs=`pwd`"/$lib" ;; 842940dd5a57Smrg esac 843040dd5a57Smrg newdlfiles="$newdlfiles $abs" 843140dd5a57Smrg done 843240dd5a57Smrg dlfiles="$newdlfiles" 843340dd5a57Smrg newdlprefiles= 843440dd5a57Smrg for lib in $dlprefiles; do 843540dd5a57Smrg case $lib in 843640dd5a57Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 843740dd5a57Smrg *) abs=`pwd`"/$lib" ;; 843840dd5a57Smrg esac 843940dd5a57Smrg newdlprefiles="$newdlprefiles $abs" 844040dd5a57Smrg done 844140dd5a57Smrg dlprefiles="$newdlprefiles" 844240dd5a57Smrg fi 844340dd5a57Smrg $RM $output 844440dd5a57Smrg # place dlname in correct position for cygwin 844540dd5a57Smrg # In fact, it would be nice if we could use this code for all target 844640dd5a57Smrg # systems that can't hard-code library paths into their executables 844740dd5a57Smrg # and that have no shared library path variable independent of PATH, 844840dd5a57Smrg # but it turns out we can't easily determine that from inspecting 844940dd5a57Smrg # libtool variables, so we have to hard-code the OSs to which it 845040dd5a57Smrg # applies here; at the moment, that means platforms that use the PE 845140dd5a57Smrg # object format with DLL files. See the long comment at the top of 845240dd5a57Smrg # tests/bindir.at for full details. 845340dd5a57Smrg tdlname=$dlname 845440dd5a57Smrg case $host,$output,$installed,$module,$dlname in 845540dd5a57Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 845640dd5a57Smrg # If a -bindir argument was supplied, place the dll there. 845740dd5a57Smrg if test "x$bindir" != x ; 845840dd5a57Smrg then 845940dd5a57Smrg func_relative_path "$install_libdir" "$bindir" 846040dd5a57Smrg tdlname=$func_relative_path_result$dlname 846140dd5a57Smrg else 846240dd5a57Smrg # Otherwise fall back on heuristic. 846340dd5a57Smrg tdlname=../bin/$dlname 846440dd5a57Smrg fi 846540dd5a57Smrg ;; 846640dd5a57Smrg esac 846740dd5a57Smrg $ECHO > $output "\ 846840dd5a57Smrg# $outputname - a libtool library file 846940dd5a57Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 847040dd5a57Smrg# 847140dd5a57Smrg# Please DO NOT delete this file! 847240dd5a57Smrg# It is necessary for linking the library. 847340dd5a57Smrg 847440dd5a57Smrg# The name that we can dlopen(3). 847540dd5a57Smrgdlname='$tdlname' 847640dd5a57Smrg 847740dd5a57Smrg# Names of this library. 847840dd5a57Smrglibrary_names='$library_names' 847940dd5a57Smrg 848040dd5a57Smrg# The name of the static archive. 848140dd5a57Smrgold_library='$old_library' 848240dd5a57Smrg 848340dd5a57Smrg# Linker flags that can not go in dependency_libs. 848440dd5a57Smrginherited_linker_flags='$new_inherited_linker_flags' 848540dd5a57Smrg 848640dd5a57Smrg# Libraries that this one depends upon. 848740dd5a57Smrgdependency_libs='$dependency_libs' 848840dd5a57Smrg 848940dd5a57Smrg# Names of additional weak libraries provided by this library 849040dd5a57Smrgweak_library_names='$weak_libs' 849140dd5a57Smrg 849240dd5a57Smrg# Version information for $libname. 849340dd5a57Smrgcurrent=$current 849440dd5a57Smrgage=$age 849540dd5a57Smrgrevision=$revision 849640dd5a57Smrg 849740dd5a57Smrg# Is this an already installed library? 849840dd5a57Smrginstalled=$installed 849940dd5a57Smrg 850040dd5a57Smrg# Should we warn about portability when linking against -modules? 850140dd5a57Smrgshouldnotlink=$module 850240dd5a57Smrg 850340dd5a57Smrg# Files to dlopen/dlpreopen 850440dd5a57Smrgdlopen='$dlfiles' 850540dd5a57Smrgdlpreopen='$dlprefiles' 850640dd5a57Smrg 850740dd5a57Smrg# Directory that this library needs to be installed in: 850840dd5a57Smrglibdir='$install_libdir'" 850940dd5a57Smrg if test "$installed" = no && test "$need_relink" = yes; then 851040dd5a57Smrg $ECHO >> $output "\ 851140dd5a57Smrgrelink_command=\"$relink_command\"" 851240dd5a57Smrg fi 851340dd5a57Smrg done 851440dd5a57Smrg } 851540dd5a57Smrg 851640dd5a57Smrg # Do a symbolic link so that the libtool archive can be found in 851740dd5a57Smrg # LD_LIBRARY_PATH before the program is installed. 851840dd5a57Smrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 851940dd5a57Smrg ;; 852040dd5a57Smrg esac 852140dd5a57Smrg exit $EXIT_SUCCESS 852240dd5a57Smrg} 852340dd5a57Smrg 852440dd5a57Smrg{ test "$mode" = link || test "$mode" = relink; } && 852540dd5a57Smrg func_mode_link ${1+"$@"} 852640dd5a57Smrg 852740dd5a57Smrg 852840dd5a57Smrg# func_mode_uninstall arg... 852940dd5a57Smrgfunc_mode_uninstall () 853040dd5a57Smrg{ 853140dd5a57Smrg $opt_debug 853240dd5a57Smrg RM="$nonopt" 853340dd5a57Smrg files= 853440dd5a57Smrg rmforce= 853540dd5a57Smrg exit_status=0 853640dd5a57Smrg 853740dd5a57Smrg # This variable tells wrapper scripts just to set variables rather 853840dd5a57Smrg # than running their programs. 853940dd5a57Smrg libtool_install_magic="$magic" 854040dd5a57Smrg 854140dd5a57Smrg for arg 854240dd5a57Smrg do 854340dd5a57Smrg case $arg in 854440dd5a57Smrg -f) RM="$RM $arg"; rmforce=yes ;; 854540dd5a57Smrg -*) RM="$RM $arg" ;; 854640dd5a57Smrg *) files="$files $arg" ;; 854740dd5a57Smrg esac 854840dd5a57Smrg done 854940dd5a57Smrg 855040dd5a57Smrg test -z "$RM" && \ 855140dd5a57Smrg func_fatal_help "you must specify an RM program" 855240dd5a57Smrg 855340dd5a57Smrg rmdirs= 855440dd5a57Smrg 855540dd5a57Smrg origobjdir="$objdir" 855640dd5a57Smrg for file in $files; do 855740dd5a57Smrg func_dirname "$file" "" "." 855840dd5a57Smrg dir="$func_dirname_result" 855940dd5a57Smrg if test "X$dir" = X.; then 856040dd5a57Smrg objdir="$origobjdir" 856140dd5a57Smrg else 856240dd5a57Smrg objdir="$dir/$origobjdir" 856340dd5a57Smrg fi 856440dd5a57Smrg func_basename "$file" 856540dd5a57Smrg name="$func_basename_result" 856640dd5a57Smrg test "$mode" = uninstall && objdir="$dir" 856740dd5a57Smrg 856840dd5a57Smrg # Remember objdir for removal later, being careful to avoid duplicates 856940dd5a57Smrg if test "$mode" = clean; then 857040dd5a57Smrg case " $rmdirs " in 857140dd5a57Smrg *" $objdir "*) ;; 857240dd5a57Smrg *) rmdirs="$rmdirs $objdir" ;; 857340dd5a57Smrg esac 857440dd5a57Smrg fi 857540dd5a57Smrg 857640dd5a57Smrg # Don't error if the file doesn't exist and rm -f was used. 857740dd5a57Smrg if { test -L "$file"; } >/dev/null 2>&1 || 857840dd5a57Smrg { test -h "$file"; } >/dev/null 2>&1 || 857940dd5a57Smrg test -f "$file"; then 858040dd5a57Smrg : 858140dd5a57Smrg elif test -d "$file"; then 858240dd5a57Smrg exit_status=1 858340dd5a57Smrg continue 858440dd5a57Smrg elif test "$rmforce" = yes; then 858540dd5a57Smrg continue 858640dd5a57Smrg fi 858740dd5a57Smrg 858840dd5a57Smrg rmfiles="$file" 858940dd5a57Smrg 859040dd5a57Smrg case $name in 859140dd5a57Smrg *.la) 859240dd5a57Smrg # Possibly a libtool archive, so verify it. 859340dd5a57Smrg if func_lalib_p "$file"; then 859440dd5a57Smrg func_source $dir/$name 859540dd5a57Smrg 859640dd5a57Smrg # Delete the libtool libraries and symlinks. 859740dd5a57Smrg for n in $library_names; do 859840dd5a57Smrg rmfiles="$rmfiles $objdir/$n" 859940dd5a57Smrg done 860040dd5a57Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 860140dd5a57Smrg 860240dd5a57Smrg case "$mode" in 860340dd5a57Smrg clean) 860440dd5a57Smrg case " $library_names " in 860540dd5a57Smrg # " " in the beginning catches empty $dlname 860640dd5a57Smrg *" $dlname "*) ;; 860740dd5a57Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 860840dd5a57Smrg esac 860940dd5a57Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 861040dd5a57Smrg ;; 861140dd5a57Smrg uninstall) 861240dd5a57Smrg if test -n "$library_names"; then 861340dd5a57Smrg # Do each command in the postuninstall commands. 861440dd5a57Smrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 861540dd5a57Smrg fi 861640dd5a57Smrg 861740dd5a57Smrg if test -n "$old_library"; then 861840dd5a57Smrg # Do each command in the old_postuninstall commands. 861940dd5a57Smrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 862040dd5a57Smrg fi 862140dd5a57Smrg # FIXME: should reinstall the best remaining shared library. 862240dd5a57Smrg ;; 862340dd5a57Smrg esac 862440dd5a57Smrg fi 862540dd5a57Smrg ;; 862640dd5a57Smrg 862740dd5a57Smrg *.lo) 862840dd5a57Smrg # Possibly a libtool object, so verify it. 862940dd5a57Smrg if func_lalib_p "$file"; then 863040dd5a57Smrg 863140dd5a57Smrg # Read the .lo file 863240dd5a57Smrg func_source $dir/$name 863340dd5a57Smrg 863440dd5a57Smrg # Add PIC object to the list of files to remove. 863540dd5a57Smrg if test -n "$pic_object" && 863640dd5a57Smrg test "$pic_object" != none; then 863740dd5a57Smrg rmfiles="$rmfiles $dir/$pic_object" 863840dd5a57Smrg fi 863940dd5a57Smrg 864040dd5a57Smrg # Add non-PIC object to the list of files to remove. 864140dd5a57Smrg if test -n "$non_pic_object" && 864240dd5a57Smrg test "$non_pic_object" != none; then 864340dd5a57Smrg rmfiles="$rmfiles $dir/$non_pic_object" 864440dd5a57Smrg fi 864540dd5a57Smrg fi 864640dd5a57Smrg ;; 864740dd5a57Smrg 864840dd5a57Smrg *) 864940dd5a57Smrg if test "$mode" = clean ; then 865040dd5a57Smrg noexename=$name 865140dd5a57Smrg case $file in 865240dd5a57Smrg *.exe) 865340dd5a57Smrg func_stripname '' '.exe' "$file" 865440dd5a57Smrg file=$func_stripname_result 865540dd5a57Smrg func_stripname '' '.exe' "$name" 865640dd5a57Smrg noexename=$func_stripname_result 865740dd5a57Smrg # $file with .exe has already been added to rmfiles, 865840dd5a57Smrg # add $file without .exe 865940dd5a57Smrg rmfiles="$rmfiles $file" 866040dd5a57Smrg ;; 866140dd5a57Smrg esac 866240dd5a57Smrg # Do a test to see if this is a libtool program. 866340dd5a57Smrg if func_ltwrapper_p "$file"; then 866440dd5a57Smrg if func_ltwrapper_executable_p "$file"; then 866540dd5a57Smrg func_ltwrapper_scriptname "$file" 866640dd5a57Smrg relink_command= 866740dd5a57Smrg func_source $func_ltwrapper_scriptname_result 866840dd5a57Smrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 866940dd5a57Smrg else 867040dd5a57Smrg relink_command= 867140dd5a57Smrg func_source $dir/$noexename 867240dd5a57Smrg fi 867340dd5a57Smrg 867440dd5a57Smrg # note $name still contains .exe if it was in $file originally 867540dd5a57Smrg # as does the version of $file that was added into $rmfiles 867640dd5a57Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 867740dd5a57Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 867840dd5a57Smrg rmfiles="$rmfiles $objdir/lt-$name" 867940dd5a57Smrg fi 868040dd5a57Smrg if test "X$noexename" != "X$name" ; then 868140dd5a57Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 868240dd5a57Smrg fi 868340dd5a57Smrg fi 868440dd5a57Smrg fi 868540dd5a57Smrg ;; 868640dd5a57Smrg esac 868740dd5a57Smrg func_show_eval "$RM $rmfiles" 'exit_status=1' 868840dd5a57Smrg done 868940dd5a57Smrg objdir="$origobjdir" 869040dd5a57Smrg 869140dd5a57Smrg # Try to remove the ${objdir}s in the directories where we deleted files 869240dd5a57Smrg for dir in $rmdirs; do 869340dd5a57Smrg if test -d "$dir"; then 869440dd5a57Smrg func_show_eval "rmdir $dir >/dev/null 2>&1" 869540dd5a57Smrg fi 869640dd5a57Smrg done 869740dd5a57Smrg 869840dd5a57Smrg exit $exit_status 869940dd5a57Smrg} 870040dd5a57Smrg 870140dd5a57Smrg{ test "$mode" = uninstall || test "$mode" = clean; } && 870240dd5a57Smrg func_mode_uninstall ${1+"$@"} 870340dd5a57Smrg 870440dd5a57Smrgtest -z "$mode" && { 870540dd5a57Smrg help="$generic_help" 870640dd5a57Smrg func_fatal_help "you must specify a MODE" 870740dd5a57Smrg} 870840dd5a57Smrg 870940dd5a57Smrgtest -z "$exec_cmd" && \ 871040dd5a57Smrg func_fatal_help "invalid operation mode \`$mode'" 871140dd5a57Smrg 871240dd5a57Smrgif test -n "$exec_cmd"; then 871340dd5a57Smrg eval exec "$exec_cmd" 871440dd5a57Smrg exit $EXIT_FAILURE 871540dd5a57Smrgfi 871640dd5a57Smrg 871740dd5a57Smrgexit $exit_status 871840dd5a57Smrg 871940dd5a57Smrg 872040dd5a57Smrg# The TAGs below are defined such that we never get into a situation 872140dd5a57Smrg# in which we disable both kinds of libraries. Given conflicting 872240dd5a57Smrg# choices, we go for a static library, that is the most portable, 872340dd5a57Smrg# since we can't tell whether shared libraries were disabled because 872440dd5a57Smrg# the user asked for that or because the platform doesn't support 872540dd5a57Smrg# them. This is particularly important on AIX, because we don't 872640dd5a57Smrg# support having both static and shared libraries enabled at the same 872740dd5a57Smrg# time on that platform, so we default to a shared-only configuration. 872840dd5a57Smrg# If a disable-shared tag is given, we'll fallback to a static-only 872940dd5a57Smrg# configuration. But we'll never go from static-only to shared-only. 873040dd5a57Smrg 873140dd5a57Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 873240dd5a57Smrgbuild_libtool_libs=no 873340dd5a57Smrgbuild_old_libs=yes 873440dd5a57Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 873540dd5a57Smrg 873640dd5a57Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 873740dd5a57Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 873840dd5a57Smrg# ### END LIBTOOL TAG CONFIG: disable-static 873940dd5a57Smrg 874040dd5a57Smrg# Local Variables: 874140dd5a57Smrg# mode:shell-script 874240dd5a57Smrg# sh-indentation:2 874340dd5a57Smrg# End: 874440dd5a57Smrg# vi:sw=2 874540dd5a57Smrg 8746