ltmain.sh revision b425557e
134977a2fSmrg# Generated from ltmain.m4sh. 234977a2fSmrg 3b425557eSmrg# libtool (GNU libtool) 2.2.10 434977a2fSmrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 534977a2fSmrg 6b425557eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 7b425557eSmrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 834977a2fSmrg# This is free software; see the source for copying conditions. There is NO 934977a2fSmrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1034977a2fSmrg 1134977a2fSmrg# GNU Libtool is free software; you can redistribute it and/or modify 12ee3138f1Smrg# it under the terms of the GNU General Public License as published by 13ee3138f1Smrg# the Free Software Foundation; either version 2 of the License, or 14ee3138f1Smrg# (at your option) any later version. 15ee3138f1Smrg# 1634977a2fSmrg# As a special exception to the GNU General Public License, 1734977a2fSmrg# if you distribute this file as part of a program or library that 1834977a2fSmrg# is built using GNU Libtool, you may include this file under the 1934977a2fSmrg# same distribution terms that you use for the rest of that program. 2034977a2fSmrg# 2134977a2fSmrg# GNU Libtool is distributed in the hope that it will be useful, but 22ee3138f1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 23ee3138f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24ee3138f1Smrg# General Public License for more details. 25ee3138f1Smrg# 26ee3138f1Smrg# You should have received a copy of the GNU General Public License 2734977a2fSmrg# along with GNU Libtool; see the file COPYING. If not, a copy 2834977a2fSmrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 2934977a2fSmrg# or obtained by writing to the Free Software Foundation, Inc., 3034977a2fSmrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 3179a8a9c6Smrg 3234977a2fSmrg# Usage: $progname [OPTION]... [MODE-ARG]... 3334977a2fSmrg# 3434977a2fSmrg# Provide generalized library-building support services. 3534977a2fSmrg# 36b425557eSmrg# --config show all configuration variables 37b425557eSmrg# --debug enable verbose shell tracing 38b425557eSmrg# -n, --dry-run display commands without modifying any files 39b425557eSmrg# --features display basic configuration information and exit 40b425557eSmrg# --mode=MODE use operation mode MODE 41b425557eSmrg# --preserve-dup-deps don't remove duplicate dependency libraries 42b425557eSmrg# --quiet, --silent don't print informational messages 43b425557eSmrg# --no-quiet, --no-silent 44b425557eSmrg# print informational messages (default) 45b425557eSmrg# --tag=TAG use configuration variables from tag TAG 46b425557eSmrg# -v, --verbose print more informational messages than default 47b425557eSmrg# --no-verbose don't print the extra informational messages 48b425557eSmrg# --version print version information 49b425557eSmrg# -h, --help, --help-all print short, long, or detailed help message 5034977a2fSmrg# 5134977a2fSmrg# MODE must be one of the following: 5234977a2fSmrg# 53b425557eSmrg# clean remove files from the build directory 54b425557eSmrg# compile compile a source file into a libtool object 55b425557eSmrg# execute automatically set library path, then run a program 56b425557eSmrg# finish complete the installation of libtool libraries 57b425557eSmrg# install install libraries or executables 58b425557eSmrg# link create a library or an executable 59b425557eSmrg# uninstall remove libraries from an installed directory 6034977a2fSmrg# 61b425557eSmrg# MODE-ARGS vary depending on the MODE. When passed as first option, 62b425557eSmrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 6334977a2fSmrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 6434977a2fSmrg# 6534977a2fSmrg# When reporting a bug, please describe a test case to reproduce it and 6634977a2fSmrg# include the following information: 6734977a2fSmrg# 68b425557eSmrg# host-triplet: $host 69b425557eSmrg# shell: $SHELL 70b425557eSmrg# compiler: $LTCC 71b425557eSmrg# compiler flags: $LTCFLAGS 72b425557eSmrg# linker: $LD (gnu? $with_gnu_ld) 73b425557eSmrg# $progname: (GNU libtool) 2.2.10 74b425557eSmrg# automake: $automake_version 75b425557eSmrg# autoconf: $autoconf_version 7634977a2fSmrg# 7734977a2fSmrg# Report bugs to <bug-libtool@gnu.org>. 78ee3138f1Smrg 79b425557eSmrgPROGRAM=libtool 80ee3138f1SmrgPACKAGE=libtool 81b425557eSmrgVERSION=2.2.10 8234977a2fSmrgTIMESTAMP="" 83b425557eSmrgpackage_revision=1.3175 84ee3138f1Smrg 8534977a2fSmrg# Be Bourne compatible 86ee3138f1Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 87ee3138f1Smrg emulate sh 88ee3138f1Smrg NULLCMD=: 89ee3138f1Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 90ee3138f1Smrg # is contrary to our usage. Disable this feature. 91ee3138f1Smrg alias -g '${1+"$@"}'='"$@"' 92ee3138f1Smrg setopt NO_GLOB_SUBST 93ee3138f1Smrgelse 94ee3138f1Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 95ee3138f1Smrgfi 96ee3138f1SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 97ee3138f1SmrgDUALCASE=1; export DUALCASE # for MKS sh 98ee3138f1Smrg 99b425557eSmrg# A function that is used when there is no print builtin or printf. 100b425557eSmrgfunc_fallback_echo () 101b425557eSmrg{ 102b425557eSmrg eval 'cat <<_LTECHO_EOF 103b425557eSmrg$1 104b425557eSmrg_LTECHO_EOF' 105b425557eSmrg} 106b425557eSmrg 10734977a2fSmrg# NLS nuisances: We save the old values to restore during execute mode. 10834977a2fSmrglt_user_locale= 10934977a2fSmrglt_safe_locale= 11079a8a9c6Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 111ee3138f1Smrgdo 112ee3138f1Smrg eval "if test \"\${$lt_var+set}\" = set; then 11334977a2fSmrg save_$lt_var=\$$lt_var 11434977a2fSmrg $lt_var=C 115ee3138f1Smrg export $lt_var 11634977a2fSmrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 11734977a2fSmrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 118ee3138f1Smrg fi" 119ee3138f1Smrgdone 120b425557eSmrgLC_ALL=C 121b425557eSmrgLANGUAGE=C 122b425557eSmrgexport LANGUAGE LC_ALL 123ee3138f1Smrg 12434977a2fSmrg$lt_unset CDPATH 12534977a2fSmrg 12634977a2fSmrg 127b425557eSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 128b425557eSmrg# is ksh but when the shell is invoked as "sh" and the current value of 129b425557eSmrg# the _XPG environment variable is not equal to 1 (one), the special 130b425557eSmrg# positional parameter $0, within a function call, is the name of the 131b425557eSmrg# function. 132b425557eSmrgprogpath="$0" 13334977a2fSmrg 13434977a2fSmrg 13534977a2fSmrg 13634977a2fSmrg: ${CP="cp -f"} 137b425557eSmrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 138b425557eSmrg: ${EGREP="grep -E"} 139b425557eSmrg: ${FGREP="grep -F"} 140b425557eSmrg: ${GREP="grep"} 14134977a2fSmrg: ${LN_S="ln -s"} 14234977a2fSmrg: ${MAKE="make"} 14334977a2fSmrg: ${MKDIR="mkdir"} 14434977a2fSmrg: ${MV="mv -f"} 14534977a2fSmrg: ${RM="rm -f"} 146b425557eSmrg: ${SED="sed"} 14734977a2fSmrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 14834977a2fSmrg: ${Xsed="$SED -e 1s/^X//"} 14934977a2fSmrg 15034977a2fSmrg# Global variables: 15134977a2fSmrgEXIT_SUCCESS=0 15234977a2fSmrgEXIT_FAILURE=1 15334977a2fSmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 15434977a2fSmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 15534977a2fSmrg 15634977a2fSmrgexit_status=$EXIT_SUCCESS 15779a8a9c6Smrg 158ee3138f1Smrg# Make sure IFS has a sensible default 159ee3138f1Smrglt_nl=' 160ee3138f1Smrg' 161ee3138f1SmrgIFS=" $lt_nl" 162ee3138f1Smrg 16334977a2fSmrgdirname="s,/[^/]*$,," 16434977a2fSmrgbasename="s,^.*/,," 16534977a2fSmrg 16634977a2fSmrg# func_dirname_and_basename file append nondir_replacement 16734977a2fSmrg# perform func_basename and func_dirname in a single function 16834977a2fSmrg# call: 16934977a2fSmrg# dirname: Compute the dirname of FILE. If nonempty, 17034977a2fSmrg# add APPEND to the result, otherwise set result 17134977a2fSmrg# to NONDIR_REPLACEMENT. 17234977a2fSmrg# value returned in "$func_dirname_result" 17334977a2fSmrg# basename: Compute filename of FILE. 17434977a2fSmrg# value retuned in "$func_basename_result" 17534977a2fSmrg# Implementation must be kept synchronized with func_dirname 17634977a2fSmrg# and func_basename. For efficiency, we do not delegate to 17734977a2fSmrg# those functions but instead duplicate the functionality here. 17834977a2fSmrgfunc_dirname_and_basename () 17934977a2fSmrg{ 18034977a2fSmrg # Extract subdirectory from the argument. 181b425557eSmrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 18234977a2fSmrg if test "X$func_dirname_result" = "X${1}"; then 18334977a2fSmrg func_dirname_result="${3}" 18434977a2fSmrg else 18534977a2fSmrg func_dirname_result="$func_dirname_result${2}" 18634977a2fSmrg fi 187b425557eSmrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 18834977a2fSmrg} 189ee3138f1Smrg 19034977a2fSmrg# Generated shell functions inserted here. 19134977a2fSmrg 192b425557eSmrg# These SED scripts presuppose an absolute path with a trailing slash. 193b425557eSmrgpathcar='s,^/\([^/]*\).*$,\1,' 194b425557eSmrgpathcdr='s,^/[^/]*,,' 195b425557eSmrgremovedotparts=':dotsl 196b425557eSmrg s@/\./@/@g 197b425557eSmrg t dotsl 198b425557eSmrg s,/\.$,/,' 199b425557eSmrgcollapseslashes='s@/\{1,\}@/@g' 200b425557eSmrgfinalslash='s,/*$,/,' 201b425557eSmrg 202b425557eSmrg# func_normal_abspath PATH 203b425557eSmrg# Remove doubled-up and trailing slashes, "." path components, 204b425557eSmrg# and cancel out any ".." path components in PATH after making 205b425557eSmrg# it an absolute path. 206b425557eSmrg# value returned in "$func_normal_abspath_result" 207b425557eSmrgfunc_normal_abspath () 208b425557eSmrg{ 209b425557eSmrg # Start from root dir and reassemble the path. 210b425557eSmrg func_normal_abspath_result= 211b425557eSmrg func_normal_abspath_tpath=$1 212b425557eSmrg func_normal_abspath_altnamespace= 213b425557eSmrg case $func_normal_abspath_tpath in 214b425557eSmrg "") 215b425557eSmrg # Empty path, that just means $cwd. 216b425557eSmrg func_stripname '' '/' "`pwd`" 217b425557eSmrg func_normal_abspath_result=$func_stripname_result 218b425557eSmrg return 219b425557eSmrg ;; 220b425557eSmrg # The next three entries are used to spot a run of precisely 221b425557eSmrg # two leading slashes without using negated character classes; 222b425557eSmrg # we take advantage of case's first-match behaviour. 223b425557eSmrg ///*) 224b425557eSmrg # Unusual form of absolute path, do nothing. 225b425557eSmrg ;; 226b425557eSmrg //*) 227b425557eSmrg # Not necessarily an ordinary path; POSIX reserves leading '//' 228b425557eSmrg # and for example Cygwin uses it to access remote file shares 229b425557eSmrg # over CIFS/SMB, so we conserve a leading double slash if found. 230b425557eSmrg func_normal_abspath_altnamespace=/ 231b425557eSmrg ;; 232b425557eSmrg /*) 233b425557eSmrg # Absolute path, do nothing. 234b425557eSmrg ;; 235b425557eSmrg *) 236b425557eSmrg # Relative path, prepend $cwd. 237b425557eSmrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 238b425557eSmrg ;; 239b425557eSmrg esac 240b425557eSmrg # Cancel out all the simple stuff to save iterations. We also want 241b425557eSmrg # the path to end with a slash for ease of parsing, so make sure 242b425557eSmrg # there is one (and only one) here. 243b425557eSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 244b425557eSmrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 245b425557eSmrg while :; do 246b425557eSmrg # Processed it all yet? 247b425557eSmrg if test "$func_normal_abspath_tpath" = / ; then 248b425557eSmrg # If we ascended to the root using ".." the result may be empty now. 249b425557eSmrg if test -z "$func_normal_abspath_result" ; then 250b425557eSmrg func_normal_abspath_result=/ 251b425557eSmrg fi 252b425557eSmrg break 253b425557eSmrg fi 254b425557eSmrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 255b425557eSmrg -e "$pathcar"` 256b425557eSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 257b425557eSmrg -e "$pathcdr"` 258b425557eSmrg # Figure out what to do with it 259b425557eSmrg case $func_normal_abspath_tcomponent in 260b425557eSmrg "") 261b425557eSmrg # Trailing empty path component, ignore it. 262b425557eSmrg ;; 263b425557eSmrg ..) 264b425557eSmrg # Parent dir; strip last assembled component from result. 265b425557eSmrg func_dirname "$func_normal_abspath_result" 266b425557eSmrg func_normal_abspath_result=$func_dirname_result 267b425557eSmrg ;; 268b425557eSmrg *) 269b425557eSmrg # Actual path component, append it. 270b425557eSmrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 271b425557eSmrg ;; 272b425557eSmrg esac 273b425557eSmrg done 274b425557eSmrg # Restore leading double-slash if one was found on entry. 275b425557eSmrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 276b425557eSmrg} 277b425557eSmrg 278b425557eSmrg# func_relative_path SRCDIR DSTDIR 279b425557eSmrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 280b425557eSmrg# slash if non-empty, suitable for immediately appending a filename 281b425557eSmrg# without needing to append a separator. 282b425557eSmrg# value returned in "$func_relative_path_result" 283b425557eSmrgfunc_relative_path () 284b425557eSmrg{ 285b425557eSmrg func_relative_path_result= 286b425557eSmrg func_normal_abspath "$1" 287b425557eSmrg func_relative_path_tlibdir=$func_normal_abspath_result 288b425557eSmrg func_normal_abspath "$2" 289b425557eSmrg func_relative_path_tbindir=$func_normal_abspath_result 290b425557eSmrg 291b425557eSmrg # Ascend the tree starting from libdir 292b425557eSmrg while :; do 293b425557eSmrg # check if we have found a prefix of bindir 294b425557eSmrg case $func_relative_path_tbindir in 295b425557eSmrg $func_relative_path_tlibdir) 296b425557eSmrg # found an exact match 297b425557eSmrg func_relative_path_tcancelled= 298b425557eSmrg break 299b425557eSmrg ;; 300b425557eSmrg $func_relative_path_tlibdir*) 301b425557eSmrg # found a matching prefix 302b425557eSmrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 303b425557eSmrg func_relative_path_tcancelled=$func_stripname_result 304b425557eSmrg if test -z "$func_relative_path_result"; then 305b425557eSmrg func_relative_path_result=. 306b425557eSmrg fi 307b425557eSmrg break 308b425557eSmrg ;; 309b425557eSmrg *) 310b425557eSmrg func_dirname $func_relative_path_tlibdir 311b425557eSmrg func_relative_path_tlibdir=${func_dirname_result} 312b425557eSmrg if test "x$func_relative_path_tlibdir" = x ; then 313b425557eSmrg # Have to descend all the way to the root! 314b425557eSmrg func_relative_path_result=../$func_relative_path_result 315b425557eSmrg func_relative_path_tcancelled=$func_relative_path_tbindir 316b425557eSmrg break 317b425557eSmrg fi 318b425557eSmrg func_relative_path_result=../$func_relative_path_result 319b425557eSmrg ;; 320b425557eSmrg esac 321b425557eSmrg done 322b425557eSmrg 323b425557eSmrg # Now calculate path; take care to avoid doubling-up slashes. 324b425557eSmrg func_stripname '' '/' "$func_relative_path_result" 325b425557eSmrg func_relative_path_result=$func_stripname_result 326b425557eSmrg func_stripname '/' '/' "$func_relative_path_tcancelled" 327b425557eSmrg if test "x$func_stripname_result" != x ; then 328b425557eSmrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 329b425557eSmrg fi 330b425557eSmrg 331b425557eSmrg # Normalisation. If bindir is libdir, return empty string, 332b425557eSmrg # else relative path ending with a slash; either way, target 333b425557eSmrg # file name can be directly appended. 334b425557eSmrg if test ! -z "$func_relative_path_result"; then 335b425557eSmrg func_stripname './' '' "$func_relative_path_result/" 336b425557eSmrg func_relative_path_result=$func_stripname_result 337b425557eSmrg fi 338b425557eSmrg} 33934977a2fSmrg 34034977a2fSmrg# The name of this program: 34134977a2fSmrgfunc_dirname_and_basename "$progpath" 34234977a2fSmrgprogname=$func_basename_result 34334977a2fSmrg 34434977a2fSmrg# Make sure we have an absolute path for reexecution: 34534977a2fSmrgcase $progpath in 34634977a2fSmrg [\\/]*|[A-Za-z]:\\*) ;; 34734977a2fSmrg *[\\/]*) 34834977a2fSmrg progdir=$func_dirname_result 34934977a2fSmrg progdir=`cd "$progdir" && pwd` 35034977a2fSmrg progpath="$progdir/$progname" 35134977a2fSmrg ;; 35234977a2fSmrg *) 35334977a2fSmrg save_IFS="$IFS" 35434977a2fSmrg IFS=: 35534977a2fSmrg for progdir in $PATH; do 35634977a2fSmrg IFS="$save_IFS" 35734977a2fSmrg test -x "$progdir/$progname" && break 35834977a2fSmrg done 35934977a2fSmrg IFS="$save_IFS" 36034977a2fSmrg test -n "$progdir" || progdir=`pwd` 36134977a2fSmrg progpath="$progdir/$progname" 36234977a2fSmrg ;; 36334977a2fSmrgesac 36434977a2fSmrg 36534977a2fSmrg# Sed substitution that helps us do robust quoting. It backslashifies 36634977a2fSmrg# metacharacters that are still active within double-quoted strings. 36734977a2fSmrgXsed="${SED}"' -e 1s/^X//' 36834977a2fSmrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 36934977a2fSmrg 37034977a2fSmrg# Same as above, but do not quote variable references. 37134977a2fSmrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 37234977a2fSmrg 37334977a2fSmrg# Re-`\' parameter expansions in output of double_quote_subst that were 37434977a2fSmrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 37534977a2fSmrg# in input to double_quote_subst, that '$' was protected from expansion. 37634977a2fSmrg# Since each input `\' is now two `\'s, look for any number of runs of 37734977a2fSmrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 37834977a2fSmrgbs='\\' 37934977a2fSmrgbs2='\\\\' 38034977a2fSmrgbs4='\\\\\\\\' 38134977a2fSmrgdollar='\$' 38234977a2fSmrgsed_double_backslash="\ 38334977a2fSmrg s/$bs4/&\\ 38434977a2fSmrg/g 38534977a2fSmrg s/^$bs2$dollar/$bs&/ 38634977a2fSmrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 38734977a2fSmrg s/\n//g" 38834977a2fSmrg 38934977a2fSmrg# Standard options: 39034977a2fSmrgopt_dry_run=false 39134977a2fSmrgopt_help=false 39234977a2fSmrgopt_quiet=false 39334977a2fSmrgopt_verbose=false 39434977a2fSmrgopt_warning=: 39534977a2fSmrg 39634977a2fSmrg# func_echo arg... 39734977a2fSmrg# Echo program name prefixed message, along with the current mode 39834977a2fSmrg# name if it has been set yet. 39934977a2fSmrgfunc_echo () 40034977a2fSmrg{ 40134977a2fSmrg $ECHO "$progname${mode+: }$mode: $*" 40234977a2fSmrg} 40334977a2fSmrg 40434977a2fSmrg# func_verbose arg... 40534977a2fSmrg# Echo program name prefixed message in verbose mode only. 40634977a2fSmrgfunc_verbose () 40734977a2fSmrg{ 40834977a2fSmrg $opt_verbose && func_echo ${1+"$@"} 40934977a2fSmrg 41034977a2fSmrg # A bug in bash halts the script if the last line of a function 41134977a2fSmrg # fails when set -e is in force, so we need another command to 41234977a2fSmrg # work around that: 41334977a2fSmrg : 41434977a2fSmrg} 41534977a2fSmrg 416b425557eSmrg# func_echo_all arg... 417b425557eSmrg# Invoke $ECHO with all args, space-separated. 418b425557eSmrgfunc_echo_all () 419b425557eSmrg{ 420b425557eSmrg $ECHO "$*" 421b425557eSmrg} 422b425557eSmrg 42334977a2fSmrg# func_error arg... 42434977a2fSmrg# Echo program name prefixed message to standard error. 42534977a2fSmrgfunc_error () 42634977a2fSmrg{ 42734977a2fSmrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 42834977a2fSmrg} 42934977a2fSmrg 43034977a2fSmrg# func_warning arg... 43134977a2fSmrg# Echo program name prefixed warning message to standard error. 43234977a2fSmrgfunc_warning () 43334977a2fSmrg{ 43434977a2fSmrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 43534977a2fSmrg 43634977a2fSmrg # bash bug again: 43734977a2fSmrg : 43834977a2fSmrg} 43934977a2fSmrg 44034977a2fSmrg# func_fatal_error arg... 44134977a2fSmrg# Echo program name prefixed message to standard error, and exit. 44234977a2fSmrgfunc_fatal_error () 44334977a2fSmrg{ 44434977a2fSmrg func_error ${1+"$@"} 44534977a2fSmrg exit $EXIT_FAILURE 44634977a2fSmrg} 44734977a2fSmrg 44834977a2fSmrg# func_fatal_help arg... 44934977a2fSmrg# Echo program name prefixed message to standard error, followed by 45034977a2fSmrg# a help hint, and exit. 45134977a2fSmrgfunc_fatal_help () 45234977a2fSmrg{ 45334977a2fSmrg func_error ${1+"$@"} 45434977a2fSmrg func_fatal_error "$help" 45534977a2fSmrg} 45634977a2fSmrghelp="Try \`$progname --help' for more information." ## default 45734977a2fSmrg 45834977a2fSmrg 45934977a2fSmrg# func_grep expression filename 46034977a2fSmrg# Check whether EXPRESSION matches any line of FILENAME, without output. 46134977a2fSmrgfunc_grep () 46234977a2fSmrg{ 46334977a2fSmrg $GREP "$1" "$2" >/dev/null 2>&1 46434977a2fSmrg} 46534977a2fSmrg 46634977a2fSmrg 46734977a2fSmrg# func_mkdir_p directory-path 46834977a2fSmrg# Make sure the entire path to DIRECTORY-PATH is available. 46934977a2fSmrgfunc_mkdir_p () 47034977a2fSmrg{ 47134977a2fSmrg my_directory_path="$1" 47234977a2fSmrg my_dir_list= 47334977a2fSmrg 47434977a2fSmrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 47534977a2fSmrg 47634977a2fSmrg # Protect directory names starting with `-' 47734977a2fSmrg case $my_directory_path in 47834977a2fSmrg -*) my_directory_path="./$my_directory_path" ;; 47934977a2fSmrg esac 48034977a2fSmrg 48134977a2fSmrg # While some portion of DIR does not yet exist... 48234977a2fSmrg while test ! -d "$my_directory_path"; do 48334977a2fSmrg # ...make a list in topmost first order. Use a colon delimited 48434977a2fSmrg # list incase some portion of path contains whitespace. 48534977a2fSmrg my_dir_list="$my_directory_path:$my_dir_list" 48634977a2fSmrg 48734977a2fSmrg # If the last portion added has no slash in it, the list is done 48834977a2fSmrg case $my_directory_path in */*) ;; *) break ;; esac 48934977a2fSmrg 49034977a2fSmrg # ...otherwise throw away the child directory and loop 491b425557eSmrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 49234977a2fSmrg done 493b425557eSmrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 49434977a2fSmrg 49534977a2fSmrg save_mkdir_p_IFS="$IFS"; IFS=':' 49634977a2fSmrg for my_dir in $my_dir_list; do 49734977a2fSmrg IFS="$save_mkdir_p_IFS" 49834977a2fSmrg # mkdir can fail with a `File exist' error if two processes 49934977a2fSmrg # try to create one of the directories concurrently. Don't 50034977a2fSmrg # stop in that case! 50134977a2fSmrg $MKDIR "$my_dir" 2>/dev/null || : 50234977a2fSmrg done 50334977a2fSmrg IFS="$save_mkdir_p_IFS" 50434977a2fSmrg 50534977a2fSmrg # Bail out if we (or some other process) failed to create a directory. 50634977a2fSmrg test -d "$my_directory_path" || \ 50734977a2fSmrg func_fatal_error "Failed to create \`$1'" 50834977a2fSmrg fi 50934977a2fSmrg} 510ee3138f1Smrg 511ee3138f1Smrg 512ee3138f1Smrg# func_mktempdir [string] 513ee3138f1Smrg# Make a temporary directory that won't clash with other running 514ee3138f1Smrg# libtool processes, and avoids race conditions if possible. If 515ee3138f1Smrg# given, STRING is the basename for that directory. 516ee3138f1Smrgfunc_mktempdir () 517ee3138f1Smrg{ 518ee3138f1Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 519ee3138f1Smrg 52034977a2fSmrg if test "$opt_dry_run" = ":"; then 521ee3138f1Smrg # Return a directory name, but don't create it in dry-run mode 522ee3138f1Smrg my_tmpdir="${my_template}-$$" 523ee3138f1Smrg else 524ee3138f1Smrg 525ee3138f1Smrg # If mktemp works, use that first and foremost 526ee3138f1Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 527ee3138f1Smrg 528ee3138f1Smrg if test ! -d "$my_tmpdir"; then 52934977a2fSmrg # Failing that, at least try and use $RANDOM to avoid a race 53034977a2fSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 531ee3138f1Smrg 53234977a2fSmrg save_mktempdir_umask=`umask` 53334977a2fSmrg umask 0077 53434977a2fSmrg $MKDIR "$my_tmpdir" 53534977a2fSmrg umask $save_mktempdir_umask 536ee3138f1Smrg fi 537ee3138f1Smrg 538ee3138f1Smrg # If we're not in dry-run mode, bomb out on failure 53934977a2fSmrg test -d "$my_tmpdir" || \ 54034977a2fSmrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 541ee3138f1Smrg fi 542ee3138f1Smrg 543b425557eSmrg $ECHO "$my_tmpdir" 544ee3138f1Smrg} 545ee3138f1Smrg 546ee3138f1Smrg 54734977a2fSmrg# func_quote_for_eval arg 54834977a2fSmrg# Aesthetically quote ARG to be evaled later. 54934977a2fSmrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 55034977a2fSmrg# is double-quoted, suitable for a subsequent eval, whereas 55134977a2fSmrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 55234977a2fSmrg# which are still active within double quotes backslashified. 55334977a2fSmrgfunc_quote_for_eval () 554ee3138f1Smrg{ 55534977a2fSmrg case $1 in 55634977a2fSmrg *[\\\`\"\$]*) 557b425557eSmrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 55834977a2fSmrg *) 55934977a2fSmrg func_quote_for_eval_unquoted_result="$1" ;; 56034977a2fSmrg esac 56134977a2fSmrg 56234977a2fSmrg case $func_quote_for_eval_unquoted_result in 56334977a2fSmrg # Double-quote args containing shell metacharacters to delay 56434977a2fSmrg # word splitting, command substitution and and variable 56534977a2fSmrg # expansion for a subsequent eval. 56634977a2fSmrg # Many Bourne shells cannot handle close brackets correctly 56734977a2fSmrg # in scan sets, so we specify it separately. 56834977a2fSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 56934977a2fSmrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 57034977a2fSmrg ;; 57134977a2fSmrg *) 57234977a2fSmrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 573ee3138f1Smrg esac 574ee3138f1Smrg} 575ee3138f1Smrg 576ee3138f1Smrg 57734977a2fSmrg# func_quote_for_expand arg 57834977a2fSmrg# Aesthetically quote ARG to be evaled later; same as above, 57934977a2fSmrg# but do not quote variable references. 58034977a2fSmrgfunc_quote_for_expand () 581ee3138f1Smrg{ 58234977a2fSmrg case $1 in 58334977a2fSmrg *[\\\`\"]*) 584b425557eSmrg my_arg=`$ECHO "$1" | $SED \ 58534977a2fSmrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 586ee3138f1Smrg *) 58734977a2fSmrg my_arg="$1" ;; 58834977a2fSmrg esac 58934977a2fSmrg 59034977a2fSmrg case $my_arg in 59134977a2fSmrg # Double-quote args containing shell metacharacters to delay 59234977a2fSmrg # word splitting and command substitution for a subsequent eval. 59334977a2fSmrg # Many Bourne shells cannot handle close brackets correctly 59434977a2fSmrg # in scan sets, so we specify it separately. 59534977a2fSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59634977a2fSmrg my_arg="\"$my_arg\"" 59734977a2fSmrg ;; 59834977a2fSmrg esac 59934977a2fSmrg 60034977a2fSmrg func_quote_for_expand_result="$my_arg" 601ee3138f1Smrg} 602ee3138f1Smrg 603ee3138f1Smrg 60434977a2fSmrg# func_show_eval cmd [fail_exp] 60534977a2fSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 60634977a2fSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 60734977a2fSmrg# is given, then evaluate it. 60834977a2fSmrgfunc_show_eval () 609ee3138f1Smrg{ 61034977a2fSmrg my_cmd="$1" 61134977a2fSmrg my_fail_exp="${2-:}" 612ee3138f1Smrg 61334977a2fSmrg ${opt_silent-false} || { 61434977a2fSmrg func_quote_for_expand "$my_cmd" 61534977a2fSmrg eval "func_echo $func_quote_for_expand_result" 61634977a2fSmrg } 61734977a2fSmrg 61834977a2fSmrg if ${opt_dry_run-false}; then :; else 61934977a2fSmrg eval "$my_cmd" 62034977a2fSmrg my_status=$? 62134977a2fSmrg if test "$my_status" -eq 0; then :; else 62234977a2fSmrg eval "(exit $my_status); $my_fail_exp" 62334977a2fSmrg fi 624ee3138f1Smrg fi 625ee3138f1Smrg} 626ee3138f1Smrg 62734977a2fSmrg 62834977a2fSmrg# func_show_eval_locale cmd [fail_exp] 62934977a2fSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 63034977a2fSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 63134977a2fSmrg# is given, then evaluate it. Use the saved locale for evaluation. 63234977a2fSmrgfunc_show_eval_locale () 633ee3138f1Smrg{ 63434977a2fSmrg my_cmd="$1" 63534977a2fSmrg my_fail_exp="${2-:}" 63634977a2fSmrg 63734977a2fSmrg ${opt_silent-false} || { 63834977a2fSmrg func_quote_for_expand "$my_cmd" 63934977a2fSmrg eval "func_echo $func_quote_for_expand_result" 64034977a2fSmrg } 64134977a2fSmrg 64234977a2fSmrg if ${opt_dry_run-false}; then :; else 64334977a2fSmrg eval "$lt_user_locale 64434977a2fSmrg $my_cmd" 64534977a2fSmrg my_status=$? 64634977a2fSmrg eval "$lt_safe_locale" 64734977a2fSmrg if test "$my_status" -eq 0; then :; else 64834977a2fSmrg eval "(exit $my_status); $my_fail_exp" 64934977a2fSmrg fi 650ee3138f1Smrg fi 65134977a2fSmrg} 652ee3138f1Smrg 653ee3138f1Smrg 65434977a2fSmrg# func_version 65534977a2fSmrg# Echo version message to standard output and exit. 65634977a2fSmrgfunc_version () 65734977a2fSmrg{ 658b425557eSmrg $SED -n '/(C)/!b go 659b425557eSmrg :more 660b425557eSmrg /\./!{ 661b425557eSmrg N 662b425557eSmrg s/\n# / / 663b425557eSmrg b more 664b425557eSmrg } 665b425557eSmrg :go 666b425557eSmrg /^# '$PROGRAM' (GNU /,/# warranty; / { 66734977a2fSmrg s/^# // 66834977a2fSmrg s/^# *$// 66934977a2fSmrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 67034977a2fSmrg p 67134977a2fSmrg }' < "$progpath" 67234977a2fSmrg exit $? 673ee3138f1Smrg} 674ee3138f1Smrg 67534977a2fSmrg# func_usage 67634977a2fSmrg# Echo short help message to standard output and exit. 67734977a2fSmrgfunc_usage () 67834977a2fSmrg{ 679b425557eSmrg $SED -n '/^# Usage:/,/^# *.*--help/ { 68034977a2fSmrg s/^# // 68134977a2fSmrg s/^# *$// 68234977a2fSmrg s/\$progname/'$progname'/ 68334977a2fSmrg p 68434977a2fSmrg }' < "$progpath" 685b425557eSmrg echo 68634977a2fSmrg $ECHO "run \`$progname --help | more' for full usage" 68734977a2fSmrg exit $? 68834977a2fSmrg} 689ee3138f1Smrg 690b425557eSmrg# func_help [NOEXIT] 691b425557eSmrg# Echo long help message to standard output and exit, 692b425557eSmrg# unless 'noexit' is passed as argument. 69334977a2fSmrgfunc_help () 69434977a2fSmrg{ 69534977a2fSmrg $SED -n '/^# Usage:/,/# Report bugs to/ { 69634977a2fSmrg s/^# // 69734977a2fSmrg s/^# *$// 69834977a2fSmrg s*\$progname*'$progname'* 69934977a2fSmrg s*\$host*'"$host"'* 70034977a2fSmrg s*\$SHELL*'"$SHELL"'* 70134977a2fSmrg s*\$LTCC*'"$LTCC"'* 70234977a2fSmrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 70334977a2fSmrg s*\$LD*'"$LD"'* 70434977a2fSmrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 70534977a2fSmrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 70634977a2fSmrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 70734977a2fSmrg p 70834977a2fSmrg }' < "$progpath" 709b425557eSmrg ret=$? 710b425557eSmrg if test -z "$1"; then 711b425557eSmrg exit $ret 712b425557eSmrg fi 71334977a2fSmrg} 714ee3138f1Smrg 71534977a2fSmrg# func_missing_arg argname 71634977a2fSmrg# Echo program name prefixed message to standard error and set global 71734977a2fSmrg# exit_cmd. 71834977a2fSmrgfunc_missing_arg () 71934977a2fSmrg{ 720b425557eSmrg func_error "missing argument for $1." 72134977a2fSmrg exit_cmd=exit 72234977a2fSmrg} 72334977a2fSmrg 72434977a2fSmrgexit_cmd=: 72534977a2fSmrg 72634977a2fSmrg 72734977a2fSmrg 72834977a2fSmrg 72934977a2fSmrg 730ee3138f1Smrg 73134977a2fSmrgmagic="%%%MAGIC variable%%%" 73234977a2fSmrgmagic_exe="%%%MAGIC EXE variable%%%" 733ee3138f1Smrg 73434977a2fSmrg# Global variables. 73534977a2fSmrg# $mode is unset 73634977a2fSmrgnonopt= 73734977a2fSmrgexecute_dlfiles= 73834977a2fSmrgpreserve_args= 73934977a2fSmrglo2o="s/\\.lo\$/.${objext}/" 74034977a2fSmrgo2lo="s/\\.${objext}\$/.lo/" 74134977a2fSmrgextracted_archives= 74234977a2fSmrgextracted_serial=0 743ee3138f1Smrg 74434977a2fSmrgopt_dry_run=false 74534977a2fSmrgopt_duplicate_deps=false 74634977a2fSmrgopt_silent=false 74734977a2fSmrgopt_debug=: 748ee3138f1Smrg 74934977a2fSmrg# If this variable is set in any of the actions, the command in it 75034977a2fSmrg# will be execed at the end. This prevents here-documents from being 75134977a2fSmrg# left over by shells. 75234977a2fSmrgexec_cmd= 75334977a2fSmrg 75434977a2fSmrg# func_fatal_configuration arg... 75534977a2fSmrg# Echo program name prefixed message to standard error, followed by 75634977a2fSmrg# a configuration failure hint, and exit. 75734977a2fSmrgfunc_fatal_configuration () 75834977a2fSmrg{ 75934977a2fSmrg func_error ${1+"$@"} 76034977a2fSmrg func_error "See the $PACKAGE documentation for more information." 76134977a2fSmrg func_fatal_error "Fatal configuration error." 76234977a2fSmrg} 763ee3138f1Smrg 764ee3138f1Smrg 76534977a2fSmrg# func_config 76634977a2fSmrg# Display the configuration for all the tags in this script. 76734977a2fSmrgfunc_config () 76834977a2fSmrg{ 76934977a2fSmrg re_begincf='^# ### BEGIN LIBTOOL' 77034977a2fSmrg re_endcf='^# ### END LIBTOOL' 77134977a2fSmrg 77234977a2fSmrg # Default configuration. 77334977a2fSmrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 774ee3138f1Smrg 775ee3138f1Smrg # Now print the configurations for the tags. 776ee3138f1Smrg for tagname in $taglist; do 77734977a2fSmrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 778ee3138f1Smrg done 779ee3138f1Smrg 78034977a2fSmrg exit $? 78134977a2fSmrg} 782ee3138f1Smrg 78334977a2fSmrg# func_features 78434977a2fSmrg# Display the features supported by this script. 78534977a2fSmrgfunc_features () 78634977a2fSmrg{ 787b425557eSmrg echo "host: $host" 788ee3138f1Smrg if test "$build_libtool_libs" = yes; then 789b425557eSmrg echo "enable shared libraries" 790ee3138f1Smrg else 791b425557eSmrg echo "disable shared libraries" 792ee3138f1Smrg fi 793ee3138f1Smrg if test "$build_old_libs" = yes; then 794b425557eSmrg echo "enable static libraries" 795ee3138f1Smrg else 796b425557eSmrg echo "disable static libraries" 797ee3138f1Smrg fi 79834977a2fSmrg 799ee3138f1Smrg exit $? 80034977a2fSmrg} 801ee3138f1Smrg 80234977a2fSmrg# func_enable_tag tagname 80334977a2fSmrg# Verify that TAGNAME is valid, and either flag an error and exit, or 80434977a2fSmrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 80534977a2fSmrg# variable here. 80634977a2fSmrgfunc_enable_tag () 80734977a2fSmrg{ 80834977a2fSmrg # Global variable: 80934977a2fSmrg tagname="$1" 810ee3138f1Smrg 81134977a2fSmrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 81234977a2fSmrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 81334977a2fSmrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 814ee3138f1Smrg 81534977a2fSmrg # Validate tagname. 81634977a2fSmrg case $tagname in 81734977a2fSmrg *[!-_A-Za-z0-9,/]*) 81834977a2fSmrg func_fatal_error "invalid tag name: $tagname" 81934977a2fSmrg ;; 82034977a2fSmrg esac 821ee3138f1Smrg 82234977a2fSmrg # Don't test for the "default" C tag, as we know it's 82334977a2fSmrg # there but not specially marked. 82434977a2fSmrg case $tagname in 82534977a2fSmrg CC) ;; 82634977a2fSmrg *) 82734977a2fSmrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 82834977a2fSmrg taglist="$taglist $tagname" 82934977a2fSmrg 83034977a2fSmrg # Evaluate the configuration. Be careful to quote the path 83134977a2fSmrg # and the sed script, to avoid splitting on whitespace, but 83234977a2fSmrg # also don't use non-portable quotes within backquotes within 83334977a2fSmrg # quotes we have to do it in 2 steps: 83434977a2fSmrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 83534977a2fSmrg eval "$extractedcf" 83634977a2fSmrg else 83734977a2fSmrg func_error "ignoring unknown tag $tagname" 83834977a2fSmrg fi 83934977a2fSmrg ;; 84034977a2fSmrg esac 84134977a2fSmrg} 84234977a2fSmrg 84334977a2fSmrg# Parse options once, thoroughly. This comes as soon as possible in 84434977a2fSmrg# the script to make things like `libtool --version' happen quickly. 84534977a2fSmrg{ 846ee3138f1Smrg 84734977a2fSmrg # Shorthand for --mode=foo, only valid as the first argument 84834977a2fSmrg case $1 in 84934977a2fSmrg clean|clea|cle|cl) 85034977a2fSmrg shift; set dummy --mode clean ${1+"$@"}; shift 851ee3138f1Smrg ;; 85234977a2fSmrg compile|compil|compi|comp|com|co|c) 85334977a2fSmrg shift; set dummy --mode compile ${1+"$@"}; shift 854ee3138f1Smrg ;; 85534977a2fSmrg execute|execut|execu|exec|exe|ex|e) 85634977a2fSmrg shift; set dummy --mode execute ${1+"$@"}; shift 857ee3138f1Smrg ;; 85834977a2fSmrg finish|finis|fini|fin|fi|f) 85934977a2fSmrg shift; set dummy --mode finish ${1+"$@"}; shift 860ee3138f1Smrg ;; 86134977a2fSmrg install|instal|insta|inst|ins|in|i) 86234977a2fSmrg shift; set dummy --mode install ${1+"$@"}; shift 86334977a2fSmrg ;; 86434977a2fSmrg link|lin|li|l) 86534977a2fSmrg shift; set dummy --mode link ${1+"$@"}; shift 86634977a2fSmrg ;; 86734977a2fSmrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 86834977a2fSmrg shift; set dummy --mode uninstall ${1+"$@"}; shift 869ee3138f1Smrg ;; 870ee3138f1Smrg esac 871ee3138f1Smrg 87234977a2fSmrg # Parse non-mode specific arguments: 87334977a2fSmrg while test "$#" -gt 0; do 87434977a2fSmrg opt="$1" 87534977a2fSmrg shift 876ee3138f1Smrg 87734977a2fSmrg case $opt in 87834977a2fSmrg --config) func_config ;; 879ee3138f1Smrg 88034977a2fSmrg --debug) preserve_args="$preserve_args $opt" 88134977a2fSmrg func_echo "enabling shell trace mode" 88234977a2fSmrg opt_debug='set -x' 88334977a2fSmrg $opt_debug 88434977a2fSmrg ;; 88534977a2fSmrg 88634977a2fSmrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 88734977a2fSmrg execute_dlfiles="$execute_dlfiles $1" 88834977a2fSmrg shift 88934977a2fSmrg ;; 890ee3138f1Smrg 89134977a2fSmrg --dry-run | -n) opt_dry_run=: ;; 89234977a2fSmrg --features) func_features ;; 89334977a2fSmrg --finish) mode="finish" ;; 89434977a2fSmrg 89534977a2fSmrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 89634977a2fSmrg case $1 in 89734977a2fSmrg # Valid mode arguments: 89834977a2fSmrg clean) ;; 89934977a2fSmrg compile) ;; 90034977a2fSmrg execute) ;; 90134977a2fSmrg finish) ;; 90234977a2fSmrg install) ;; 90334977a2fSmrg link) ;; 90434977a2fSmrg relink) ;; 90534977a2fSmrg uninstall) ;; 90634977a2fSmrg 90734977a2fSmrg # Catch anything else as an error 90834977a2fSmrg *) func_error "invalid argument for $opt" 90934977a2fSmrg exit_cmd=exit 91034977a2fSmrg break 91134977a2fSmrg ;; 91234977a2fSmrg esac 91334977a2fSmrg 91434977a2fSmrg mode="$1" 91534977a2fSmrg shift 91634977a2fSmrg ;; 917ee3138f1Smrg 91834977a2fSmrg --preserve-dup-deps) 91934977a2fSmrg opt_duplicate_deps=: ;; 92034977a2fSmrg 92134977a2fSmrg --quiet|--silent) preserve_args="$preserve_args $opt" 92234977a2fSmrg opt_silent=: 923b425557eSmrg opt_verbose=false 924b425557eSmrg ;; 925b425557eSmrg 926b425557eSmrg --no-quiet|--no-silent) 927b425557eSmrg preserve_args="$preserve_args $opt" 928b425557eSmrg opt_silent=false 92934977a2fSmrg ;; 93034977a2fSmrg 93134977a2fSmrg --verbose| -v) preserve_args="$preserve_args $opt" 93234977a2fSmrg opt_silent=false 933b425557eSmrg opt_verbose=: 934b425557eSmrg ;; 935b425557eSmrg 936b425557eSmrg --no-verbose) preserve_args="$preserve_args $opt" 937b425557eSmrg opt_verbose=false 93834977a2fSmrg ;; 93934977a2fSmrg 94034977a2fSmrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 94134977a2fSmrg preserve_args="$preserve_args $opt $1" 94234977a2fSmrg func_enable_tag "$1" # tagname is set here 94334977a2fSmrg shift 94434977a2fSmrg ;; 94534977a2fSmrg 94634977a2fSmrg # Separate optargs to long options: 94734977a2fSmrg -dlopen=*|--mode=*|--tag=*) 94834977a2fSmrg func_opt_split "$opt" 94934977a2fSmrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 95034977a2fSmrg shift 95134977a2fSmrg ;; 95234977a2fSmrg 95334977a2fSmrg -\?|-h) func_usage ;; 95434977a2fSmrg --help) opt_help=: ;; 955b425557eSmrg --help-all) opt_help=': help-all' ;; 95634977a2fSmrg --version) func_version ;; 95734977a2fSmrg 95834977a2fSmrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 95934977a2fSmrg 96034977a2fSmrg *) nonopt="$opt" 96134977a2fSmrg break 96234977a2fSmrg ;; 96334977a2fSmrg esac 96434977a2fSmrg done 96534977a2fSmrg 96634977a2fSmrg 96734977a2fSmrg case $host in 96834977a2fSmrg *cygwin* | *mingw* | *pw32* | *cegcc*) 96934977a2fSmrg # don't eliminate duplications in $postdeps and $predeps 97034977a2fSmrg opt_duplicate_compiler_generated_deps=: 971ee3138f1Smrg ;; 972ee3138f1Smrg *) 97334977a2fSmrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 97434977a2fSmrg ;; 97534977a2fSmrg esac 976ee3138f1Smrg 97734977a2fSmrg # Having warned about all mis-specified options, bail out if 97834977a2fSmrg # anything was wrong. 97934977a2fSmrg $exit_cmd $EXIT_FAILURE 98034977a2fSmrg} 98134977a2fSmrg 98234977a2fSmrg# func_check_version_match 98334977a2fSmrg# Ensure that we are using m4 macros, and libtool script from the same 98434977a2fSmrg# release of libtool. 98534977a2fSmrgfunc_check_version_match () 98634977a2fSmrg{ 98734977a2fSmrg if test "$package_revision" != "$macro_revision"; then 98834977a2fSmrg if test "$VERSION" != "$macro_version"; then 98934977a2fSmrg if test -z "$macro_version"; then 99034977a2fSmrg cat >&2 <<_LT_EOF 99134977a2fSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99234977a2fSmrg$progname: definition of this LT_INIT comes from an older release. 99334977a2fSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 99434977a2fSmrg$progname: and run autoconf again. 99534977a2fSmrg_LT_EOF 99634977a2fSmrg else 99734977a2fSmrg cat >&2 <<_LT_EOF 99834977a2fSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 99934977a2fSmrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 100034977a2fSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 100134977a2fSmrg$progname: and run autoconf again. 100234977a2fSmrg_LT_EOF 1003ee3138f1Smrg fi 100434977a2fSmrg else 100534977a2fSmrg cat >&2 <<_LT_EOF 100634977a2fSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 100734977a2fSmrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 100834977a2fSmrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 100934977a2fSmrg$progname: of $PACKAGE $VERSION and run autoconf again. 101034977a2fSmrg_LT_EOF 101134977a2fSmrg fi 101234977a2fSmrg 101334977a2fSmrg exit $EXIT_MISMATCH 1014ee3138f1Smrg fi 101534977a2fSmrg} 101634977a2fSmrg 101734977a2fSmrg 101834977a2fSmrg## ----------- ## 101934977a2fSmrg## Main. ## 102034977a2fSmrg## ----------- ## 102134977a2fSmrg 102234977a2fSmrg$opt_help || { 102334977a2fSmrg # Sanity checks first: 102434977a2fSmrg func_check_version_match 102534977a2fSmrg 102634977a2fSmrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 102734977a2fSmrg func_fatal_configuration "not configured to build any kind of library" 102834977a2fSmrg fi 102934977a2fSmrg 103034977a2fSmrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 103134977a2fSmrg 103234977a2fSmrg 103334977a2fSmrg # Darwin sucks 103434977a2fSmrg eval std_shrext=\"$shrext_cmds\" 103534977a2fSmrg 1036ee3138f1Smrg 1037ee3138f1Smrg # Only execute mode is allowed to have -dlopen flags. 1038ee3138f1Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 103934977a2fSmrg func_error "unrecognized option \`-dlopen'" 104034977a2fSmrg $ECHO "$help" 1>&2 1041ee3138f1Smrg exit $EXIT_FAILURE 1042ee3138f1Smrg fi 1043ee3138f1Smrg 1044ee3138f1Smrg # Change the help message to a mode-specific one. 1045ee3138f1Smrg generic_help="$help" 104634977a2fSmrg help="Try \`$progname --help --mode=$mode' for more information." 104734977a2fSmrg} 1048ee3138f1Smrg 1049ee3138f1Smrg 105034977a2fSmrg# func_lalib_p file 105134977a2fSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 105234977a2fSmrg# This function is only a basic sanity check; it will hardly flush out 105334977a2fSmrg# determined imposters. 105434977a2fSmrgfunc_lalib_p () 105534977a2fSmrg{ 105634977a2fSmrg test -f "$1" && 105734977a2fSmrg $SED -e 4q "$1" 2>/dev/null \ 105834977a2fSmrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 105934977a2fSmrg} 1060ee3138f1Smrg 106134977a2fSmrg# func_lalib_unsafe_p file 106234977a2fSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 106334977a2fSmrg# This function implements the same check as func_lalib_p without 106434977a2fSmrg# resorting to external programs. To this end, it redirects stdin and 106534977a2fSmrg# closes it afterwards, without saving the original file descriptor. 106634977a2fSmrg# As a safety measure, use it only where a negative result would be 106734977a2fSmrg# fatal anyway. Works if `file' does not exist. 106834977a2fSmrgfunc_lalib_unsafe_p () 106934977a2fSmrg{ 107034977a2fSmrg lalib_p=no 107134977a2fSmrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 107234977a2fSmrg for lalib_p_l in 1 2 3 4 107334977a2fSmrg do 107434977a2fSmrg read lalib_p_line 107534977a2fSmrg case "$lalib_p_line" in 107634977a2fSmrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 107734977a2fSmrg esac 107834977a2fSmrg done 107934977a2fSmrg exec 0<&5 5<&- 108034977a2fSmrg fi 108134977a2fSmrg test "$lalib_p" = yes 108234977a2fSmrg} 1083ee3138f1Smrg 108434977a2fSmrg# func_ltwrapper_script_p file 108534977a2fSmrg# True iff FILE is a libtool wrapper script 108634977a2fSmrg# This function is only a basic sanity check; it will hardly flush out 108734977a2fSmrg# determined imposters. 108834977a2fSmrgfunc_ltwrapper_script_p () 108934977a2fSmrg{ 109034977a2fSmrg func_lalib_p "$1" 109134977a2fSmrg} 1092ee3138f1Smrg 109334977a2fSmrg# func_ltwrapper_executable_p file 109434977a2fSmrg# True iff FILE is a libtool wrapper executable 109534977a2fSmrg# This function is only a basic sanity check; it will hardly flush out 109634977a2fSmrg# determined imposters. 109734977a2fSmrgfunc_ltwrapper_executable_p () 109834977a2fSmrg{ 109934977a2fSmrg func_ltwrapper_exec_suffix= 110034977a2fSmrg case $1 in 110134977a2fSmrg *.exe) ;; 110234977a2fSmrg *) func_ltwrapper_exec_suffix=.exe ;; 110334977a2fSmrg esac 110434977a2fSmrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 110534977a2fSmrg} 110634977a2fSmrg 110734977a2fSmrg# func_ltwrapper_scriptname file 110834977a2fSmrg# Assumes file is an ltwrapper_executable 110934977a2fSmrg# uses $file to determine the appropriate filename for a 111034977a2fSmrg# temporary ltwrapper_script. 111134977a2fSmrgfunc_ltwrapper_scriptname () 111234977a2fSmrg{ 111334977a2fSmrg func_ltwrapper_scriptname_result="" 111434977a2fSmrg if func_ltwrapper_executable_p "$1"; then 111534977a2fSmrg func_dirname_and_basename "$1" "" "." 111634977a2fSmrg func_stripname '' '.exe' "$func_basename_result" 111734977a2fSmrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 111834977a2fSmrg fi 111934977a2fSmrg} 112034977a2fSmrg 112134977a2fSmrg# func_ltwrapper_p file 112234977a2fSmrg# True iff FILE is a libtool wrapper script or wrapper executable 112334977a2fSmrg# This function is only a basic sanity check; it will hardly flush out 112434977a2fSmrg# determined imposters. 112534977a2fSmrgfunc_ltwrapper_p () 112634977a2fSmrg{ 112734977a2fSmrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 112834977a2fSmrg} 112934977a2fSmrg 113034977a2fSmrg 113134977a2fSmrg# func_execute_cmds commands fail_cmd 113234977a2fSmrg# Execute tilde-delimited COMMANDS. 113334977a2fSmrg# If FAIL_CMD is given, eval that upon failure. 113434977a2fSmrg# FAIL_CMD may read-access the current command in variable CMD! 113534977a2fSmrgfunc_execute_cmds () 113634977a2fSmrg{ 113734977a2fSmrg $opt_debug 113834977a2fSmrg save_ifs=$IFS; IFS='~' 113934977a2fSmrg for cmd in $1; do 114034977a2fSmrg IFS=$save_ifs 114134977a2fSmrg eval cmd=\"$cmd\" 114234977a2fSmrg func_show_eval "$cmd" "${2-:}" 114334977a2fSmrg done 114434977a2fSmrg IFS=$save_ifs 114534977a2fSmrg} 114634977a2fSmrg 114734977a2fSmrg 114834977a2fSmrg# func_source file 114934977a2fSmrg# Source FILE, adding directory component if necessary. 115034977a2fSmrg# Note that it is not necessary on cygwin/mingw to append a dot to 115134977a2fSmrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 115234977a2fSmrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 115334977a2fSmrg# `FILE.' does not work on cygwin managed mounts. 115434977a2fSmrgfunc_source () 115534977a2fSmrg{ 115634977a2fSmrg $opt_debug 115734977a2fSmrg case $1 in 115834977a2fSmrg */* | *\\*) . "$1" ;; 115934977a2fSmrg *) . "./$1" ;; 116034977a2fSmrg esac 116134977a2fSmrg} 116234977a2fSmrg 116334977a2fSmrg 116434977a2fSmrg# func_infer_tag arg 116534977a2fSmrg# Infer tagged configuration to use if any are available and 116634977a2fSmrg# if one wasn't chosen via the "--tag" command line option. 116734977a2fSmrg# Only attempt this if the compiler in the base compile 116834977a2fSmrg# command doesn't match the default compiler. 116934977a2fSmrg# arg is usually of the form 'gcc ...' 117034977a2fSmrgfunc_infer_tag () 117134977a2fSmrg{ 117234977a2fSmrg $opt_debug 117334977a2fSmrg if test -n "$available_tags" && test -z "$tagname"; then 117434977a2fSmrg CC_quoted= 117534977a2fSmrg for arg in $CC; do 117634977a2fSmrg func_quote_for_eval "$arg" 117734977a2fSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 117834977a2fSmrg done 1179b425557eSmrg CC_expanded=`func_echo_all $CC` 1180b425557eSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 118134977a2fSmrg case $@ in 118234977a2fSmrg # Blanks in the command may have been stripped by the calling shell, 118334977a2fSmrg # but not from the CC environment variable when configure was run. 1184b425557eSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1185b425557eSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 118634977a2fSmrg # Blanks at the start of $base_compile will cause this to fail 118734977a2fSmrg # if we don't check for them as well. 118834977a2fSmrg *) 118934977a2fSmrg for z in $available_tags; do 119034977a2fSmrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 119134977a2fSmrg # Evaluate the configuration. 119234977a2fSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 119334977a2fSmrg CC_quoted= 119434977a2fSmrg for arg in $CC; do 119534977a2fSmrg # Double-quote args containing other shell metacharacters. 119634977a2fSmrg func_quote_for_eval "$arg" 119734977a2fSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 119834977a2fSmrg done 1199b425557eSmrg CC_expanded=`func_echo_all $CC` 1200b425557eSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 120134977a2fSmrg case "$@ " in 1202b425557eSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1203b425557eSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 120434977a2fSmrg # The compiler in the base compile command matches 120534977a2fSmrg # the one in the tagged configuration. 120634977a2fSmrg # Assume this is the tagged configuration we want. 120734977a2fSmrg tagname=$z 120834977a2fSmrg break 120934977a2fSmrg ;; 121034977a2fSmrg esac 121134977a2fSmrg fi 121234977a2fSmrg done 121334977a2fSmrg # If $tagname still isn't set, then no tagged configuration 121434977a2fSmrg # was found and let the user know that the "--tag" command 121534977a2fSmrg # line option must be used. 121634977a2fSmrg if test -z "$tagname"; then 121734977a2fSmrg func_echo "unable to infer tagged configuration" 121834977a2fSmrg func_fatal_error "specify a tag with \`--tag'" 121934977a2fSmrg# else 122034977a2fSmrg# func_verbose "using $tagname tagged configuration" 122134977a2fSmrg fi 122234977a2fSmrg ;; 122334977a2fSmrg esac 122434977a2fSmrg fi 122534977a2fSmrg} 122634977a2fSmrg 122734977a2fSmrg 122834977a2fSmrg 122934977a2fSmrg# func_write_libtool_object output_name pic_name nonpic_name 123034977a2fSmrg# Create a libtool object file (analogous to a ".la" file), 123134977a2fSmrg# but don't create it if we're doing a dry run. 123234977a2fSmrgfunc_write_libtool_object () 123334977a2fSmrg{ 123434977a2fSmrg write_libobj=${1} 123534977a2fSmrg if test "$build_libtool_libs" = yes; then 123634977a2fSmrg write_lobj=\'${2}\' 123734977a2fSmrg else 123834977a2fSmrg write_lobj=none 123934977a2fSmrg fi 124034977a2fSmrg 124134977a2fSmrg if test "$build_old_libs" = yes; then 124234977a2fSmrg write_oldobj=\'${3}\' 124334977a2fSmrg else 124434977a2fSmrg write_oldobj=none 124534977a2fSmrg fi 124634977a2fSmrg 124734977a2fSmrg $opt_dry_run || { 124834977a2fSmrg cat >${write_libobj}T <<EOF 124934977a2fSmrg# $write_libobj - a libtool object file 125034977a2fSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 125134977a2fSmrg# 125234977a2fSmrg# Please DO NOT delete this file! 125334977a2fSmrg# It is necessary for linking the library. 125434977a2fSmrg 125534977a2fSmrg# Name of the PIC object. 125634977a2fSmrgpic_object=$write_lobj 125734977a2fSmrg 125834977a2fSmrg# Name of the non-PIC object 125934977a2fSmrgnon_pic_object=$write_oldobj 126034977a2fSmrg 126134977a2fSmrgEOF 126234977a2fSmrg $MV "${write_libobj}T" "${write_libobj}" 126334977a2fSmrg } 126434977a2fSmrg} 126534977a2fSmrg 126634977a2fSmrg# func_mode_compile arg... 126734977a2fSmrgfunc_mode_compile () 126834977a2fSmrg{ 126934977a2fSmrg $opt_debug 127034977a2fSmrg # Get the compilation command and the source file. 127134977a2fSmrg base_compile= 127234977a2fSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 127334977a2fSmrg suppress_opt=yes 127434977a2fSmrg suppress_output= 127534977a2fSmrg arg_mode=normal 127634977a2fSmrg libobj= 127734977a2fSmrg later= 127834977a2fSmrg pie_flag= 127934977a2fSmrg 128034977a2fSmrg for arg 128134977a2fSmrg do 128234977a2fSmrg case $arg_mode in 128334977a2fSmrg arg ) 128434977a2fSmrg # do not "continue". Instead, add this to base_compile 128534977a2fSmrg lastarg="$arg" 128634977a2fSmrg arg_mode=normal 128734977a2fSmrg ;; 128834977a2fSmrg 128934977a2fSmrg target ) 129034977a2fSmrg libobj="$arg" 129134977a2fSmrg arg_mode=normal 129234977a2fSmrg continue 129334977a2fSmrg ;; 129434977a2fSmrg 129534977a2fSmrg normal ) 129634977a2fSmrg # Accept any command-line options. 129734977a2fSmrg case $arg in 129834977a2fSmrg -o) 129934977a2fSmrg test -n "$libobj" && \ 130034977a2fSmrg func_fatal_error "you cannot specify \`-o' more than once" 130134977a2fSmrg arg_mode=target 130234977a2fSmrg continue 130334977a2fSmrg ;; 130434977a2fSmrg 130534977a2fSmrg -pie | -fpie | -fPIE) 130634977a2fSmrg pie_flag="$pie_flag $arg" 130734977a2fSmrg continue 130834977a2fSmrg ;; 130934977a2fSmrg 131034977a2fSmrg -shared | -static | -prefer-pic | -prefer-non-pic) 131134977a2fSmrg later="$later $arg" 131234977a2fSmrg continue 131334977a2fSmrg ;; 1314ee3138f1Smrg 1315ee3138f1Smrg -no-suppress) 1316ee3138f1Smrg suppress_opt=no 1317ee3138f1Smrg continue 1318ee3138f1Smrg ;; 1319ee3138f1Smrg 1320ee3138f1Smrg -Xcompiler) 1321ee3138f1Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 1322ee3138f1Smrg continue # The current "srcfile" will either be retained or 1323ee3138f1Smrg ;; # replaced later. I would guess that would be a bug. 1324ee3138f1Smrg 1325ee3138f1Smrg -Wc,*) 132634977a2fSmrg func_stripname '-Wc,' '' "$arg" 132734977a2fSmrg args=$func_stripname_result 1328ee3138f1Smrg lastarg= 1329ee3138f1Smrg save_ifs="$IFS"; IFS=',' 133034977a2fSmrg for arg in $args; do 1331ee3138f1Smrg IFS="$save_ifs" 133234977a2fSmrg func_quote_for_eval "$arg" 133334977a2fSmrg lastarg="$lastarg $func_quote_for_eval_result" 1334ee3138f1Smrg done 1335ee3138f1Smrg IFS="$save_ifs" 133634977a2fSmrg func_stripname ' ' '' "$lastarg" 133734977a2fSmrg lastarg=$func_stripname_result 1338ee3138f1Smrg 1339ee3138f1Smrg # Add the arguments to base_compile. 1340ee3138f1Smrg base_compile="$base_compile $lastarg" 1341ee3138f1Smrg continue 1342ee3138f1Smrg ;; 1343ee3138f1Smrg 134434977a2fSmrg *) 1345ee3138f1Smrg # Accept the current argument as the source file. 1346ee3138f1Smrg # The previous "srcfile" becomes the current argument. 1347ee3138f1Smrg # 1348ee3138f1Smrg lastarg="$srcfile" 1349ee3138f1Smrg srcfile="$arg" 1350ee3138f1Smrg ;; 1351ee3138f1Smrg esac # case $arg 1352ee3138f1Smrg ;; 1353ee3138f1Smrg esac # case $arg_mode 1354ee3138f1Smrg 1355ee3138f1Smrg # Aesthetically quote the previous argument. 135634977a2fSmrg func_quote_for_eval "$lastarg" 135734977a2fSmrg base_compile="$base_compile $func_quote_for_eval_result" 1358ee3138f1Smrg done # for arg 1359ee3138f1Smrg 1360ee3138f1Smrg case $arg_mode in 1361ee3138f1Smrg arg) 136234977a2fSmrg func_fatal_error "you must specify an argument for -Xcompile" 1363ee3138f1Smrg ;; 1364ee3138f1Smrg target) 136534977a2fSmrg func_fatal_error "you must specify a target with \`-o'" 1366ee3138f1Smrg ;; 1367ee3138f1Smrg *) 1368ee3138f1Smrg # Get the name of the library object. 136934977a2fSmrg test -z "$libobj" && { 137034977a2fSmrg func_basename "$srcfile" 137134977a2fSmrg libobj="$func_basename_result" 137234977a2fSmrg } 1373ee3138f1Smrg ;; 1374ee3138f1Smrg esac 1375ee3138f1Smrg 1376ee3138f1Smrg # Recognize several different file suffixes. 1377ee3138f1Smrg # If the user specifies -o file.o, it is replaced with file.lo 1378ee3138f1Smrg case $libobj in 137934977a2fSmrg *.[cCFSifmso] | \ 138034977a2fSmrg *.ada | *.adb | *.ads | *.asm | \ 138134977a2fSmrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 1382b425557eSmrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 138334977a2fSmrg func_xform "$libobj" 138434977a2fSmrg libobj=$func_xform_result 138534977a2fSmrg ;; 1386ee3138f1Smrg esac 1387ee3138f1Smrg 1388ee3138f1Smrg case $libobj in 138934977a2fSmrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1390ee3138f1Smrg *) 139134977a2fSmrg func_fatal_error "cannot determine name of library object from \`$libobj'" 1392ee3138f1Smrg ;; 1393ee3138f1Smrg esac 1394ee3138f1Smrg 1395ee3138f1Smrg func_infer_tag $base_compile 1396ee3138f1Smrg 1397ee3138f1Smrg for arg in $later; do 1398ee3138f1Smrg case $arg in 139934977a2fSmrg -shared) 140034977a2fSmrg test "$build_libtool_libs" != yes && \ 140134977a2fSmrg func_fatal_configuration "can not build a shared library" 140234977a2fSmrg build_old_libs=no 140334977a2fSmrg continue 140434977a2fSmrg ;; 140534977a2fSmrg 1406ee3138f1Smrg -static) 140734977a2fSmrg build_libtool_libs=no 1408ee3138f1Smrg build_old_libs=yes 1409ee3138f1Smrg continue 1410ee3138f1Smrg ;; 1411ee3138f1Smrg 1412ee3138f1Smrg -prefer-pic) 1413ee3138f1Smrg pic_mode=yes 1414ee3138f1Smrg continue 1415ee3138f1Smrg ;; 1416ee3138f1Smrg 1417ee3138f1Smrg -prefer-non-pic) 1418ee3138f1Smrg pic_mode=no 1419ee3138f1Smrg continue 1420ee3138f1Smrg ;; 1421ee3138f1Smrg esac 1422ee3138f1Smrg done 1423ee3138f1Smrg 142434977a2fSmrg func_quote_for_eval "$libobj" 142534977a2fSmrg test "X$libobj" != "X$func_quote_for_eval_result" \ 142634977a2fSmrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 142734977a2fSmrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 142834977a2fSmrg func_dirname_and_basename "$obj" "/" "" 142934977a2fSmrg objname="$func_basename_result" 143034977a2fSmrg xdir="$func_dirname_result" 1431ee3138f1Smrg lobj=${xdir}$objdir/$objname 1432ee3138f1Smrg 143334977a2fSmrg test -z "$base_compile" && \ 143434977a2fSmrg func_fatal_help "you must specify a compilation command" 1435ee3138f1Smrg 1436ee3138f1Smrg # Delete any leftover library objects. 1437ee3138f1Smrg if test "$build_old_libs" = yes; then 1438ee3138f1Smrg removelist="$obj $lobj $libobj ${libobj}T" 1439ee3138f1Smrg else 1440ee3138f1Smrg removelist="$lobj $libobj ${libobj}T" 1441ee3138f1Smrg fi 1442ee3138f1Smrg 1443ee3138f1Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 1444ee3138f1Smrg case $host_os in 144534977a2fSmrg cygwin* | mingw* | pw32* | os2* | cegcc*) 1446ee3138f1Smrg pic_mode=default 1447ee3138f1Smrg ;; 1448ee3138f1Smrg esac 1449ee3138f1Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1450ee3138f1Smrg # non-PIC code in shared libraries is not supported 1451ee3138f1Smrg pic_mode=default 1452ee3138f1Smrg fi 1453ee3138f1Smrg 1454ee3138f1Smrg # Calculate the filename of the output object if compiler does 1455ee3138f1Smrg # not support -o with -c 1456ee3138f1Smrg if test "$compiler_c_o" = no; then 1457b425557eSmrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 1458ee3138f1Smrg lockfile="$output_obj.lock" 1459ee3138f1Smrg else 1460ee3138f1Smrg output_obj= 1461ee3138f1Smrg need_locks=no 1462ee3138f1Smrg lockfile= 1463ee3138f1Smrg fi 1464ee3138f1Smrg 1465ee3138f1Smrg # Lock this critical section if it is needed 1466ee3138f1Smrg # We use this script file to make the link, it avoids creating a new file 1467ee3138f1Smrg if test "$need_locks" = yes; then 146834977a2fSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 146934977a2fSmrg func_echo "Waiting for $lockfile to be removed" 1470ee3138f1Smrg sleep 2 1471ee3138f1Smrg done 1472ee3138f1Smrg elif test "$need_locks" = warn; then 1473ee3138f1Smrg if test -f "$lockfile"; then 147434977a2fSmrg $ECHO "\ 1475ee3138f1Smrg*** ERROR, $lockfile exists and contains: 1476ee3138f1Smrg`cat $lockfile 2>/dev/null` 1477ee3138f1Smrg 1478ee3138f1SmrgThis indicates that another process is trying to use the same 1479ee3138f1Smrgtemporary object file, and libtool could not work around it because 1480ee3138f1Smrgyour compiler does not support \`-c' and \`-o' together. If you 1481ee3138f1Smrgrepeat this compilation, it may succeed, by chance, but you had better 1482ee3138f1Smrgavoid parallel builds (make -j) in this platform, or get a better 1483ee3138f1Smrgcompiler." 1484ee3138f1Smrg 148534977a2fSmrg $opt_dry_run || $RM $removelist 1486ee3138f1Smrg exit $EXIT_FAILURE 1487ee3138f1Smrg fi 148834977a2fSmrg removelist="$removelist $output_obj" 148934977a2fSmrg $ECHO "$srcfile" > "$lockfile" 1490ee3138f1Smrg fi 1491ee3138f1Smrg 149234977a2fSmrg $opt_dry_run || $RM $removelist 149334977a2fSmrg removelist="$removelist $lockfile" 149434977a2fSmrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 149534977a2fSmrg 1496ee3138f1Smrg if test -n "$fix_srcfile_path"; then 1497ee3138f1Smrg eval srcfile=\"$fix_srcfile_path\" 1498ee3138f1Smrg fi 149934977a2fSmrg func_quote_for_eval "$srcfile" 150034977a2fSmrg qsrcfile=$func_quote_for_eval_result 1501ee3138f1Smrg 1502ee3138f1Smrg # Only build a PIC object if we are building libtool libraries. 1503ee3138f1Smrg if test "$build_libtool_libs" = yes; then 1504ee3138f1Smrg # Without this assignment, base_compile gets emptied. 1505ee3138f1Smrg fbsd_hideous_sh_bug=$base_compile 1506ee3138f1Smrg 1507ee3138f1Smrg if test "$pic_mode" != no; then 1508ee3138f1Smrg command="$base_compile $qsrcfile $pic_flag" 1509ee3138f1Smrg else 1510ee3138f1Smrg # Don't build PIC code 1511ee3138f1Smrg command="$base_compile $qsrcfile" 1512ee3138f1Smrg fi 1513ee3138f1Smrg 151434977a2fSmrg func_mkdir_p "$xdir$objdir" 1515ee3138f1Smrg 1516ee3138f1Smrg if test -z "$output_obj"; then 1517ee3138f1Smrg # Place PIC objects in $objdir 1518ee3138f1Smrg command="$command -o $lobj" 1519ee3138f1Smrg fi 1520ee3138f1Smrg 152134977a2fSmrg func_show_eval_locale "$command" \ 152234977a2fSmrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1523ee3138f1Smrg 1524ee3138f1Smrg if test "$need_locks" = warn && 1525ee3138f1Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 152634977a2fSmrg $ECHO "\ 1527ee3138f1Smrg*** ERROR, $lockfile contains: 1528ee3138f1Smrg`cat $lockfile 2>/dev/null` 1529ee3138f1Smrg 1530ee3138f1Smrgbut it should contain: 1531ee3138f1Smrg$srcfile 1532ee3138f1Smrg 1533ee3138f1SmrgThis indicates that another process is trying to use the same 1534ee3138f1Smrgtemporary object file, and libtool could not work around it because 1535ee3138f1Smrgyour compiler does not support \`-c' and \`-o' together. If you 1536ee3138f1Smrgrepeat this compilation, it may succeed, by chance, but you had better 1537ee3138f1Smrgavoid parallel builds (make -j) in this platform, or get a better 1538ee3138f1Smrgcompiler." 1539ee3138f1Smrg 154034977a2fSmrg $opt_dry_run || $RM $removelist 1541ee3138f1Smrg exit $EXIT_FAILURE 1542ee3138f1Smrg fi 1543ee3138f1Smrg 1544ee3138f1Smrg # Just move the object if needed, then go on to compile the next one 1545ee3138f1Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 154634977a2fSmrg func_show_eval '$MV "$output_obj" "$lobj"' \ 154734977a2fSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1548ee3138f1Smrg fi 1549ee3138f1Smrg 1550ee3138f1Smrg # Allow error messages only from the first compilation. 1551ee3138f1Smrg if test "$suppress_opt" = yes; then 155234977a2fSmrg suppress_output=' >/dev/null 2>&1' 1553ee3138f1Smrg fi 1554ee3138f1Smrg fi 1555ee3138f1Smrg 1556ee3138f1Smrg # Only build a position-dependent object if we build old libraries. 1557ee3138f1Smrg if test "$build_old_libs" = yes; then 1558ee3138f1Smrg if test "$pic_mode" != yes; then 1559ee3138f1Smrg # Don't build PIC code 156034977a2fSmrg command="$base_compile $qsrcfile$pie_flag" 1561ee3138f1Smrg else 1562ee3138f1Smrg command="$base_compile $qsrcfile $pic_flag" 1563ee3138f1Smrg fi 1564ee3138f1Smrg if test "$compiler_c_o" = yes; then 1565ee3138f1Smrg command="$command -o $obj" 1566ee3138f1Smrg fi 1567ee3138f1Smrg 1568ee3138f1Smrg # Suppress compiler output if we already did a PIC compilation. 1569ee3138f1Smrg command="$command$suppress_output" 157034977a2fSmrg func_show_eval_locale "$command" \ 157134977a2fSmrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1572ee3138f1Smrg 1573ee3138f1Smrg if test "$need_locks" = warn && 1574ee3138f1Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 157534977a2fSmrg $ECHO "\ 1576ee3138f1Smrg*** ERROR, $lockfile contains: 1577ee3138f1Smrg`cat $lockfile 2>/dev/null` 1578ee3138f1Smrg 1579ee3138f1Smrgbut it should contain: 1580ee3138f1Smrg$srcfile 1581ee3138f1Smrg 1582ee3138f1SmrgThis indicates that another process is trying to use the same 1583ee3138f1Smrgtemporary object file, and libtool could not work around it because 1584ee3138f1Smrgyour compiler does not support \`-c' and \`-o' together. If you 1585ee3138f1Smrgrepeat this compilation, it may succeed, by chance, but you had better 1586ee3138f1Smrgavoid parallel builds (make -j) in this platform, or get a better 1587ee3138f1Smrgcompiler." 1588ee3138f1Smrg 158934977a2fSmrg $opt_dry_run || $RM $removelist 1590ee3138f1Smrg exit $EXIT_FAILURE 1591ee3138f1Smrg fi 1592ee3138f1Smrg 1593ee3138f1Smrg # Just move the object if needed 1594ee3138f1Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 159534977a2fSmrg func_show_eval '$MV "$output_obj" "$obj"' \ 159634977a2fSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1597ee3138f1Smrg fi 1598ee3138f1Smrg fi 1599ee3138f1Smrg 160034977a2fSmrg $opt_dry_run || { 160134977a2fSmrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1602ee3138f1Smrg 160334977a2fSmrg # Unlock the critical section if it was locked 160434977a2fSmrg if test "$need_locks" != no; then 160534977a2fSmrg removelist=$lockfile 160634977a2fSmrg $RM "$lockfile" 160734977a2fSmrg fi 160834977a2fSmrg } 1609ee3138f1Smrg 1610ee3138f1Smrg exit $EXIT_SUCCESS 161134977a2fSmrg} 1612ee3138f1Smrg 161334977a2fSmrg$opt_help || { 1614b425557eSmrg test "$mode" = compile && func_mode_compile ${1+"$@"} 161534977a2fSmrg} 1616ee3138f1Smrg 161734977a2fSmrgfunc_mode_help () 161834977a2fSmrg{ 161934977a2fSmrg # We need to display help for each of the modes. 162034977a2fSmrg case $mode in 162134977a2fSmrg "") 162234977a2fSmrg # Generic help is extracted from the usage comments 162334977a2fSmrg # at the start of this file. 162434977a2fSmrg func_help 162534977a2fSmrg ;; 1626ee3138f1Smrg 162734977a2fSmrg clean) 162834977a2fSmrg $ECHO \ 162934977a2fSmrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1630ee3138f1Smrg 163134977a2fSmrgRemove files from the build directory. 1632ee3138f1Smrg 163334977a2fSmrgRM is the name of the program to use to delete files associated with each FILE 163434977a2fSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 163534977a2fSmrgto RM. 1636ee3138f1Smrg 163734977a2fSmrgIf FILE is a libtool library, object or program, all the files associated 163834977a2fSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 163934977a2fSmrg ;; 1640ee3138f1Smrg 164134977a2fSmrg compile) 164234977a2fSmrg $ECHO \ 164334977a2fSmrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1644ee3138f1Smrg 164534977a2fSmrgCompile a source file into a libtool library object. 1646ee3138f1Smrg 164734977a2fSmrgThis mode accepts the following additional options: 1648ee3138f1Smrg 164934977a2fSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 165034977a2fSmrg -no-suppress do not suppress compiler output for multiple passes 1651b425557eSmrg -prefer-pic try to build PIC objects only 1652b425557eSmrg -prefer-non-pic try to build non-PIC objects only 165334977a2fSmrg -shared do not build a \`.o' file suitable for static linking 165434977a2fSmrg -static only build a \`.o' file suitable for static linking 1655b425557eSmrg -Wc,FLAG pass FLAG directly to the compiler 1656ee3138f1Smrg 165734977a2fSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 165834977a2fSmrgfrom the given SOURCEFILE. 1659ee3138f1Smrg 166034977a2fSmrgThe output file name is determined by removing the directory component from 166134977a2fSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 166234977a2fSmrglibrary object suffix, \`.lo'." 166334977a2fSmrg ;; 1664ee3138f1Smrg 166534977a2fSmrg execute) 166634977a2fSmrg $ECHO \ 166734977a2fSmrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1668ee3138f1Smrg 166934977a2fSmrgAutomatically set library path, then run a program. 1670ee3138f1Smrg 167134977a2fSmrgThis mode accepts the following additional options: 1672ee3138f1Smrg 167334977a2fSmrg -dlopen FILE add the directory containing FILE to the library path 1674ee3138f1Smrg 167534977a2fSmrgThis mode sets the library path environment variable according to \`-dlopen' 167634977a2fSmrgflags. 1677ee3138f1Smrg 167834977a2fSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 167934977a2fSmrginto their corresponding uninstalled binary, and any of their required library 168034977a2fSmrgdirectories are added to the library path. 1681ee3138f1Smrg 168234977a2fSmrgThen, COMMAND is executed, with ARGS as arguments." 168334977a2fSmrg ;; 1684ee3138f1Smrg 168534977a2fSmrg finish) 168634977a2fSmrg $ECHO \ 168734977a2fSmrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1688ee3138f1Smrg 168934977a2fSmrgComplete the installation of libtool libraries. 1690ee3138f1Smrg 169134977a2fSmrgEach LIBDIR is a directory that contains libtool libraries. 1692ee3138f1Smrg 169334977a2fSmrgThe commands that this mode executes may require superuser privileges. Use 169434977a2fSmrgthe \`--dry-run' option if you just want to see what would be executed." 169534977a2fSmrg ;; 1696ee3138f1Smrg 169734977a2fSmrg install) 169834977a2fSmrg $ECHO \ 169934977a2fSmrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1700ee3138f1Smrg 170134977a2fSmrgInstall executables or libraries. 1702ee3138f1Smrg 170334977a2fSmrgINSTALL-COMMAND is the installation command. The first component should be 170434977a2fSmrgeither the \`install' or \`cp' program. 1705ee3138f1Smrg 170634977a2fSmrgThe following components of INSTALL-COMMAND are treated specially: 1707ee3138f1Smrg 1708b425557eSmrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1709ee3138f1Smrg 171034977a2fSmrgThe rest of the components are interpreted as arguments to that command (only 171134977a2fSmrgBSD-compatible install options are recognized)." 171234977a2fSmrg ;; 1713ee3138f1Smrg 171434977a2fSmrg link) 171534977a2fSmrg $ECHO \ 171634977a2fSmrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1717ee3138f1Smrg 171834977a2fSmrgLink object files or libraries together to form another library, or to 171934977a2fSmrgcreate an executable program. 1720ee3138f1Smrg 172134977a2fSmrgLINK-COMMAND is a command using the C compiler that you would use to create 172234977a2fSmrga program from several object files. 1723ee3138f1Smrg 172434977a2fSmrgThe following components of LINK-COMMAND are treated specially: 1725ee3138f1Smrg 172634977a2fSmrg -all-static do not do any dynamic linking at all 172734977a2fSmrg -avoid-version do not add a version suffix if possible 1728b425557eSmrg -bindir BINDIR specify path to binaries directory (for systems where 1729b425557eSmrg libraries must be found in the PATH setting at runtime) 173034977a2fSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 173134977a2fSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 173234977a2fSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 173334977a2fSmrg -export-symbols SYMFILE 173434977a2fSmrg try to export only the symbols listed in SYMFILE 173534977a2fSmrg -export-symbols-regex REGEX 173634977a2fSmrg try to export only the symbols matching REGEX 173734977a2fSmrg -LLIBDIR search LIBDIR for required installed libraries 173834977a2fSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 173934977a2fSmrg -module build a library that can dlopened 174034977a2fSmrg -no-fast-install disable the fast-install mode 174134977a2fSmrg -no-install link a not-installable executable 174234977a2fSmrg -no-undefined declare that a library does not refer to external symbols 174334977a2fSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 174434977a2fSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 174534977a2fSmrg -precious-files-regex REGEX 174634977a2fSmrg don't remove output files matching REGEX 174734977a2fSmrg -release RELEASE specify package release information 174834977a2fSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 174934977a2fSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 175034977a2fSmrg -shared only do dynamic linking of libtool libraries 175134977a2fSmrg -shrext SUFFIX override the standard shared library file extension 175234977a2fSmrg -static do not do any dynamic linking of uninstalled libtool libraries 175334977a2fSmrg -static-libtool-libs 175434977a2fSmrg do not do any dynamic linking of libtool libraries 175534977a2fSmrg -version-info CURRENT[:REVISION[:AGE]] 175634977a2fSmrg specify library version info [each variable defaults to 0] 175734977a2fSmrg -weak LIBNAME declare that the target provides the LIBNAME interface 1758b425557eSmrg -Wc,FLAG 1759b425557eSmrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 1760b425557eSmrg -Wl,FLAG 1761b425557eSmrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 1762b425557eSmrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 1763ee3138f1Smrg 176434977a2fSmrgAll other options (arguments beginning with \`-') are ignored. 1765ee3138f1Smrg 176634977a2fSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 176734977a2fSmrgtreated as uninstalled libtool libraries, other files are standard or library 176834977a2fSmrgobject files. 176979a8a9c6Smrg 177034977a2fSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 177134977a2fSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 177234977a2fSmrgrequired, except when creating a convenience library. 1773ee3138f1Smrg 177434977a2fSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 177534977a2fSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 1776ee3138f1Smrg 177734977a2fSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 177834977a2fSmrgis created, otherwise an executable program is created." 1779ee3138f1Smrg ;; 1780ee3138f1Smrg 178134977a2fSmrg uninstall) 178234977a2fSmrg $ECHO \ 178334977a2fSmrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1784ee3138f1Smrg 178534977a2fSmrgRemove libraries from an installation directory. 1786ee3138f1Smrg 178734977a2fSmrgRM is the name of the program to use to delete files associated with each FILE 178834977a2fSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 178934977a2fSmrgto RM. 1790ee3138f1Smrg 179134977a2fSmrgIf FILE is a libtool library, all the files associated with it are deleted. 179234977a2fSmrgOtherwise, only FILE itself is deleted using RM." 179334977a2fSmrg ;; 1794ee3138f1Smrg 179534977a2fSmrg *) 179634977a2fSmrg func_fatal_help "invalid operation mode \`$mode'" 179734977a2fSmrg ;; 179834977a2fSmrg esac 1799ee3138f1Smrg 1800b425557eSmrg echo 180134977a2fSmrg $ECHO "Try \`$progname --help' for more information about other modes." 180234977a2fSmrg} 1803ee3138f1Smrg 1804b425557eSmrg# Now that we've collected a possible --mode arg, show help if necessary 1805b425557eSmrgif $opt_help; then 1806b425557eSmrg if test "$opt_help" = :; then 1807b425557eSmrg func_mode_help 1808b425557eSmrg else 1809b425557eSmrg { 1810b425557eSmrg func_help noexit 1811b425557eSmrg for mode in compile link execute install finish uninstall clean; do 1812b425557eSmrg func_mode_help 1813b425557eSmrg done 1814b425557eSmrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 1815b425557eSmrg { 1816b425557eSmrg func_help noexit 1817b425557eSmrg for mode in compile link execute install finish uninstall clean; do 1818b425557eSmrg echo 1819b425557eSmrg func_mode_help 1820b425557eSmrg done 1821b425557eSmrg } | 1822b425557eSmrg sed '1d 1823b425557eSmrg /^When reporting/,/^Report/{ 1824b425557eSmrg H 1825b425557eSmrg d 1826b425557eSmrg } 1827b425557eSmrg $x 1828b425557eSmrg /information about other modes/d 1829b425557eSmrg /more detailed .*MODE/d 1830b425557eSmrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 1831b425557eSmrg fi 1832b425557eSmrg exit $? 1833b425557eSmrgfi 1834ee3138f1Smrg 1835ee3138f1Smrg 183634977a2fSmrg# func_mode_execute arg... 183734977a2fSmrgfunc_mode_execute () 183834977a2fSmrg{ 183934977a2fSmrg $opt_debug 184034977a2fSmrg # The first argument is the command name. 184134977a2fSmrg cmd="$nonopt" 184234977a2fSmrg test -z "$cmd" && \ 184334977a2fSmrg func_fatal_help "you must specify a COMMAND" 1844ee3138f1Smrg 184534977a2fSmrg # Handle -dlopen flags immediately. 184634977a2fSmrg for file in $execute_dlfiles; do 184734977a2fSmrg test -f "$file" \ 184834977a2fSmrg || func_fatal_help "\`$file' is not a file" 1849ee3138f1Smrg 185034977a2fSmrg dir= 185134977a2fSmrg case $file in 185234977a2fSmrg *.la) 185334977a2fSmrg # Check to see that this really is a libtool archive. 185434977a2fSmrg func_lalib_unsafe_p "$file" \ 185534977a2fSmrg || func_fatal_help "\`$lib' is not a valid libtool archive" 1856ee3138f1Smrg 185734977a2fSmrg # Read the libtool library. 185834977a2fSmrg dlname= 185934977a2fSmrg library_names= 186034977a2fSmrg func_source "$file" 1861ee3138f1Smrg 186234977a2fSmrg # Skip this library if it cannot be dlopened. 186334977a2fSmrg if test -z "$dlname"; then 186434977a2fSmrg # Warn if it was a shared library. 186534977a2fSmrg test -n "$library_names" && \ 186634977a2fSmrg func_warning "\`$file' was not linked with \`-export-dynamic'" 186734977a2fSmrg continue 186834977a2fSmrg fi 1869ee3138f1Smrg 187034977a2fSmrg func_dirname "$file" "" "." 187134977a2fSmrg dir="$func_dirname_result" 1872ee3138f1Smrg 187334977a2fSmrg if test -f "$dir/$objdir/$dlname"; then 187434977a2fSmrg dir="$dir/$objdir" 187534977a2fSmrg else 187634977a2fSmrg if test ! -f "$dir/$dlname"; then 187734977a2fSmrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 187834977a2fSmrg fi 187934977a2fSmrg fi 1880ee3138f1Smrg ;; 1881ee3138f1Smrg 188234977a2fSmrg *.lo) 188334977a2fSmrg # Just add the directory containing the .lo file. 188434977a2fSmrg func_dirname "$file" "" "." 188534977a2fSmrg dir="$func_dirname_result" 1886ee3138f1Smrg ;; 1887ee3138f1Smrg 188834977a2fSmrg *) 188934977a2fSmrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1890ee3138f1Smrg continue 1891ee3138f1Smrg ;; 189234977a2fSmrg esac 1893ee3138f1Smrg 189434977a2fSmrg # Get the absolute pathname. 189534977a2fSmrg absdir=`cd "$dir" && pwd` 189634977a2fSmrg test -n "$absdir" && dir="$absdir" 1897ee3138f1Smrg 189834977a2fSmrg # Now add the directory to shlibpath_var. 189934977a2fSmrg if eval "test -z \"\$$shlibpath_var\""; then 190034977a2fSmrg eval "$shlibpath_var=\"\$dir\"" 190134977a2fSmrg else 190234977a2fSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 190334977a2fSmrg fi 190434977a2fSmrg done 1905ee3138f1Smrg 190634977a2fSmrg # This variable tells wrapper scripts just to set shlibpath_var 190734977a2fSmrg # rather than running their programs. 190834977a2fSmrg libtool_execute_magic="$magic" 1909ee3138f1Smrg 191034977a2fSmrg # Check if any of the arguments is a wrapper script. 191134977a2fSmrg args= 191234977a2fSmrg for file 191334977a2fSmrg do 191434977a2fSmrg case $file in 1915b425557eSmrg -* | *.la | *.lo ) ;; 191634977a2fSmrg *) 191734977a2fSmrg # Do a test to see if this is really a libtool program. 191834977a2fSmrg if func_ltwrapper_script_p "$file"; then 191934977a2fSmrg func_source "$file" 192034977a2fSmrg # Transform arg to wrapped name. 192134977a2fSmrg file="$progdir/$program" 192234977a2fSmrg elif func_ltwrapper_executable_p "$file"; then 192334977a2fSmrg func_ltwrapper_scriptname "$file" 192434977a2fSmrg func_source "$func_ltwrapper_scriptname_result" 192534977a2fSmrg # Transform arg to wrapped name. 192634977a2fSmrg file="$progdir/$program" 192734977a2fSmrg fi 192834977a2fSmrg ;; 192934977a2fSmrg esac 193034977a2fSmrg # Quote arguments (to preserve shell metacharacters). 193134977a2fSmrg func_quote_for_eval "$file" 193234977a2fSmrg args="$args $func_quote_for_eval_result" 193334977a2fSmrg done 1934ee3138f1Smrg 193534977a2fSmrg if test "X$opt_dry_run" = Xfalse; then 193634977a2fSmrg if test -n "$shlibpath_var"; then 193734977a2fSmrg # Export the shlibpath_var. 193834977a2fSmrg eval "export $shlibpath_var" 193934977a2fSmrg fi 1940ee3138f1Smrg 194134977a2fSmrg # Restore saved environment variables 194234977a2fSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 194334977a2fSmrg do 194434977a2fSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 194534977a2fSmrg $lt_var=\$save_$lt_var; export $lt_var 1946ee3138f1Smrg else 194734977a2fSmrg $lt_unset $lt_var 194834977a2fSmrg fi" 194934977a2fSmrg done 1950ee3138f1Smrg 195134977a2fSmrg # Now prepare to actually exec the command. 195234977a2fSmrg exec_cmd="\$cmd$args" 195334977a2fSmrg else 195434977a2fSmrg # Display what would be done. 195534977a2fSmrg if test -n "$shlibpath_var"; then 195634977a2fSmrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 1957b425557eSmrg echo "export $shlibpath_var" 195834977a2fSmrg fi 195934977a2fSmrg $ECHO "$cmd$args" 196034977a2fSmrg exit $EXIT_SUCCESS 196134977a2fSmrg fi 196234977a2fSmrg} 1963ee3138f1Smrg 196434977a2fSmrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 1965ee3138f1Smrg 1966ee3138f1Smrg 196734977a2fSmrg# func_mode_finish arg... 196834977a2fSmrgfunc_mode_finish () 196934977a2fSmrg{ 197034977a2fSmrg $opt_debug 197134977a2fSmrg libdirs="$nonopt" 197234977a2fSmrg admincmds= 1973ee3138f1Smrg 197434977a2fSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 197534977a2fSmrg for dir 197634977a2fSmrg do 197734977a2fSmrg libdirs="$libdirs $dir" 197834977a2fSmrg done 1979ee3138f1Smrg 198034977a2fSmrg for libdir in $libdirs; do 198134977a2fSmrg if test -n "$finish_cmds"; then 198234977a2fSmrg # Do each command in the finish commands. 198334977a2fSmrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 198434977a2fSmrg'"$cmd"'"' 1985ee3138f1Smrg fi 198634977a2fSmrg if test -n "$finish_eval"; then 198734977a2fSmrg # Do the single finish_eval. 198834977a2fSmrg eval cmds=\"$finish_eval\" 198934977a2fSmrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 199034977a2fSmrg $cmds" 199134977a2fSmrg fi 199234977a2fSmrg done 199334977a2fSmrg fi 1994ee3138f1Smrg 199534977a2fSmrg # Exit here if they wanted silent mode. 199634977a2fSmrg $opt_silent && exit $EXIT_SUCCESS 1997ee3138f1Smrg 1998b425557eSmrg echo "----------------------------------------------------------------------" 1999b425557eSmrg echo "Libraries have been installed in:" 200034977a2fSmrg for libdir in $libdirs; do 200134977a2fSmrg $ECHO " $libdir" 200234977a2fSmrg done 2003b425557eSmrg echo 2004b425557eSmrg echo "If you ever happen to want to link against installed libraries" 2005b425557eSmrg echo "in a given directory, LIBDIR, you must either use libtool, and" 2006b425557eSmrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 2007b425557eSmrg echo "flag during linking and do at least one of the following:" 200834977a2fSmrg if test -n "$shlibpath_var"; then 2009b425557eSmrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 2010b425557eSmrg echo " during execution" 201134977a2fSmrg fi 201234977a2fSmrg if test -n "$runpath_var"; then 2013b425557eSmrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 2014b425557eSmrg echo " during linking" 201534977a2fSmrg fi 201634977a2fSmrg if test -n "$hardcode_libdir_flag_spec"; then 201734977a2fSmrg libdir=LIBDIR 201834977a2fSmrg eval flag=\"$hardcode_libdir_flag_spec\" 2019ee3138f1Smrg 202034977a2fSmrg $ECHO " - use the \`$flag' linker flag" 202134977a2fSmrg fi 202234977a2fSmrg if test -n "$admincmds"; then 202334977a2fSmrg $ECHO " - have your system administrator run these commands:$admincmds" 202434977a2fSmrg fi 202534977a2fSmrg if test -f /etc/ld.so.conf; then 2026b425557eSmrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 202734977a2fSmrg fi 2028b425557eSmrg echo 202934977a2fSmrg 2030b425557eSmrg echo "See any operating system documentation about shared libraries for" 203134977a2fSmrg case $host in 203234977a2fSmrg solaris2.[6789]|solaris2.1[0-9]) 2033b425557eSmrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2034b425557eSmrg echo "pages." 2035ee3138f1Smrg ;; 203634977a2fSmrg *) 2037b425557eSmrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 203834977a2fSmrg ;; 203934977a2fSmrg esac 2040b425557eSmrg echo "----------------------------------------------------------------------" 204134977a2fSmrg exit $EXIT_SUCCESS 204234977a2fSmrg} 2043ee3138f1Smrg 204434977a2fSmrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 2045ee3138f1Smrg 204679a8a9c6Smrg 204734977a2fSmrg# func_mode_install arg... 204834977a2fSmrgfunc_mode_install () 204934977a2fSmrg{ 205034977a2fSmrg $opt_debug 205134977a2fSmrg # There may be an optional sh(1) argument at the beginning of 205234977a2fSmrg # install_prog (especially on Windows NT). 205334977a2fSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 205434977a2fSmrg # Allow the use of GNU shtool's install command. 2055b425557eSmrg case $nonopt in *shtool*) :;; *) false;; esac; then 205634977a2fSmrg # Aesthetically quote it. 205734977a2fSmrg func_quote_for_eval "$nonopt" 205834977a2fSmrg install_prog="$func_quote_for_eval_result " 205934977a2fSmrg arg=$1 206034977a2fSmrg shift 206134977a2fSmrg else 206234977a2fSmrg install_prog= 206334977a2fSmrg arg=$nonopt 2064ee3138f1Smrg fi 2065ee3138f1Smrg 206634977a2fSmrg # The real first argument should be the name of the installation program. 206734977a2fSmrg # Aesthetically quote it. 206834977a2fSmrg func_quote_for_eval "$arg" 206934977a2fSmrg install_prog="$install_prog$func_quote_for_eval_result" 2070b425557eSmrg install_shared_prog=$install_prog 2071b425557eSmrg case " $install_prog " in 2072b425557eSmrg *[\\\ /]cp\ *) install_cp=: ;; 2073b425557eSmrg *) install_cp=false ;; 2074b425557eSmrg esac 2075ee3138f1Smrg 207634977a2fSmrg # We need to accept at least all the BSD install flags. 207734977a2fSmrg dest= 207834977a2fSmrg files= 207934977a2fSmrg opts= 208034977a2fSmrg prev= 208134977a2fSmrg install_type= 208234977a2fSmrg isdir=no 208334977a2fSmrg stripme= 2084b425557eSmrg no_mode=: 208534977a2fSmrg for arg 208634977a2fSmrg do 2087b425557eSmrg arg2= 208834977a2fSmrg if test -n "$dest"; then 208934977a2fSmrg files="$files $dest" 209034977a2fSmrg dest=$arg 209134977a2fSmrg continue 209234977a2fSmrg fi 2093ee3138f1Smrg 209434977a2fSmrg case $arg in 209534977a2fSmrg -d) isdir=yes ;; 209634977a2fSmrg -f) 2097b425557eSmrg if $install_cp; then :; else 2098b425557eSmrg prev=$arg 2099b425557eSmrg fi 210034977a2fSmrg ;; 210134977a2fSmrg -g | -m | -o) 210234977a2fSmrg prev=$arg 210334977a2fSmrg ;; 210434977a2fSmrg -s) 210534977a2fSmrg stripme=" -s" 210634977a2fSmrg continue 210734977a2fSmrg ;; 210834977a2fSmrg -*) 210934977a2fSmrg ;; 211034977a2fSmrg *) 211134977a2fSmrg # If the previous option needed an argument, then skip it. 211234977a2fSmrg if test -n "$prev"; then 2113b425557eSmrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 2114b425557eSmrg arg2=$install_override_mode 2115b425557eSmrg no_mode=false 2116b425557eSmrg fi 211734977a2fSmrg prev= 211834977a2fSmrg else 211934977a2fSmrg dest=$arg 212034977a2fSmrg continue 212134977a2fSmrg fi 212234977a2fSmrg ;; 212334977a2fSmrg esac 2124ee3138f1Smrg 212534977a2fSmrg # Aesthetically quote the argument. 212634977a2fSmrg func_quote_for_eval "$arg" 212734977a2fSmrg install_prog="$install_prog $func_quote_for_eval_result" 2128b425557eSmrg if test -n "$arg2"; then 2129b425557eSmrg func_quote_for_eval "$arg2" 2130b425557eSmrg fi 2131b425557eSmrg install_shared_prog="$install_shared_prog $func_quote_for_eval_result" 213234977a2fSmrg done 213334977a2fSmrg 213434977a2fSmrg test -z "$install_prog" && \ 213534977a2fSmrg func_fatal_help "you must specify an install program" 213634977a2fSmrg 213734977a2fSmrg test -n "$prev" && \ 213834977a2fSmrg func_fatal_help "the \`$prev' option requires an argument" 213934977a2fSmrg 2140b425557eSmrg if test -n "$install_override_mode" && $no_mode; then 2141b425557eSmrg if $install_cp; then :; else 2142b425557eSmrg func_quote_for_eval "$install_override_mode" 2143b425557eSmrg install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" 2144b425557eSmrg fi 2145b425557eSmrg fi 2146b425557eSmrg 214734977a2fSmrg if test -z "$files"; then 214834977a2fSmrg if test -z "$dest"; then 214934977a2fSmrg func_fatal_help "no file or destination specified" 215034977a2fSmrg else 215134977a2fSmrg func_fatal_help "you must specify a destination" 2152ee3138f1Smrg fi 2153ee3138f1Smrg fi 2154ee3138f1Smrg 215534977a2fSmrg # Strip any trailing slash from the destination. 215634977a2fSmrg func_stripname '' '/' "$dest" 215734977a2fSmrg dest=$func_stripname_result 2158ee3138f1Smrg 215934977a2fSmrg # Check to see that the destination is a directory. 216034977a2fSmrg test -d "$dest" && isdir=yes 216134977a2fSmrg if test "$isdir" = yes; then 216234977a2fSmrg destdir="$dest" 216334977a2fSmrg destname= 216434977a2fSmrg else 216534977a2fSmrg func_dirname_and_basename "$dest" "" "." 216634977a2fSmrg destdir="$func_dirname_result" 216734977a2fSmrg destname="$func_basename_result" 216834977a2fSmrg 216934977a2fSmrg # Not a directory, so check to see that there is only one file specified. 217034977a2fSmrg set dummy $files; shift 217134977a2fSmrg test "$#" -gt 1 && \ 217234977a2fSmrg func_fatal_help "\`$dest' is not a directory" 217334977a2fSmrg fi 217434977a2fSmrg case $destdir in 217534977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 2176ee3138f1Smrg *) 217734977a2fSmrg for file in $files; do 217834977a2fSmrg case $file in 217934977a2fSmrg *.lo) ;; 218034977a2fSmrg *) 218134977a2fSmrg func_fatal_help "\`$destdir' must be an absolute directory name" 218234977a2fSmrg ;; 218334977a2fSmrg esac 218434977a2fSmrg done 2185ee3138f1Smrg ;; 2186ee3138f1Smrg esac 2187ee3138f1Smrg 218834977a2fSmrg # This variable tells wrapper scripts just to set variables rather 218934977a2fSmrg # than running their programs. 219034977a2fSmrg libtool_install_magic="$magic" 2191ee3138f1Smrg 219234977a2fSmrg staticlibs= 219334977a2fSmrg future_libdirs= 219434977a2fSmrg current_libdirs= 219534977a2fSmrg for file in $files; do 2196ee3138f1Smrg 219734977a2fSmrg # Do each installation. 219834977a2fSmrg case $file in 219934977a2fSmrg *.$libext) 220034977a2fSmrg # Do the static libraries later. 220134977a2fSmrg staticlibs="$staticlibs $file" 220234977a2fSmrg ;; 220334977a2fSmrg 220434977a2fSmrg *.la) 220534977a2fSmrg # Check to see that this really is a libtool archive. 220634977a2fSmrg func_lalib_unsafe_p "$file" \ 220734977a2fSmrg || func_fatal_help "\`$file' is not a valid libtool archive" 220834977a2fSmrg 220934977a2fSmrg library_names= 221034977a2fSmrg old_library= 221134977a2fSmrg relink_command= 221234977a2fSmrg func_source "$file" 221334977a2fSmrg 221434977a2fSmrg # Add the libdir to current_libdirs if it is the destination. 221534977a2fSmrg if test "X$destdir" = "X$libdir"; then 221634977a2fSmrg case "$current_libdirs " in 221734977a2fSmrg *" $libdir "*) ;; 221834977a2fSmrg *) current_libdirs="$current_libdirs $libdir" ;; 2219ee3138f1Smrg esac 222034977a2fSmrg else 222134977a2fSmrg # Note the libdir as a future libdir. 222234977a2fSmrg case "$future_libdirs " in 222334977a2fSmrg *" $libdir "*) ;; 222434977a2fSmrg *) future_libdirs="$future_libdirs $libdir" ;; 222534977a2fSmrg esac 222634977a2fSmrg fi 2227ee3138f1Smrg 222834977a2fSmrg func_dirname "$file" "/" "" 222934977a2fSmrg dir="$func_dirname_result" 223034977a2fSmrg dir="$dir$objdir" 223134977a2fSmrg 223234977a2fSmrg if test -n "$relink_command"; then 223334977a2fSmrg # Determine the prefix the user has applied to our future dir. 2234b425557eSmrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 223534977a2fSmrg 223634977a2fSmrg # Don't allow the user to place us outside of our expected 223734977a2fSmrg # location b/c this prevents finding dependent libraries that 223834977a2fSmrg # are installed to the same prefix. 223934977a2fSmrg # At present, this check doesn't affect windows .dll's that 224034977a2fSmrg # are installed into $libdir/../bin (currently, that works fine) 224134977a2fSmrg # but it's something to keep an eye on. 224234977a2fSmrg test "$inst_prefix_dir" = "$destdir" && \ 224334977a2fSmrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 224434977a2fSmrg 224534977a2fSmrg if test -n "$inst_prefix_dir"; then 224634977a2fSmrg # Stick the inst_prefix_dir data into the link command. 2247b425557eSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 224834977a2fSmrg else 2249b425557eSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 225034977a2fSmrg fi 225134977a2fSmrg 225234977a2fSmrg func_warning "relinking \`$file'" 225334977a2fSmrg func_show_eval "$relink_command" \ 225434977a2fSmrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 225534977a2fSmrg fi 225634977a2fSmrg 225734977a2fSmrg # See the names of the shared library. 225834977a2fSmrg set dummy $library_names; shift 225934977a2fSmrg if test -n "$1"; then 226034977a2fSmrg realname="$1" 226134977a2fSmrg shift 226234977a2fSmrg 226334977a2fSmrg srcname="$realname" 226434977a2fSmrg test -n "$relink_command" && srcname="$realname"T 226534977a2fSmrg 226634977a2fSmrg # Install the shared library and build the symlinks. 2267b425557eSmrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 226834977a2fSmrg 'exit $?' 226934977a2fSmrg tstripme="$stripme" 227034977a2fSmrg case $host_os in 227134977a2fSmrg cygwin* | mingw* | pw32* | cegcc*) 227234977a2fSmrg case $realname in 227334977a2fSmrg *.dll.a) 227434977a2fSmrg tstripme="" 227534977a2fSmrg ;; 227634977a2fSmrg esac 2277ee3138f1Smrg ;; 2278ee3138f1Smrg esac 227934977a2fSmrg if test -n "$tstripme" && test -n "$striplib"; then 228034977a2fSmrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 228179a8a9c6Smrg fi 228234977a2fSmrg 228334977a2fSmrg if test "$#" -gt 0; then 228434977a2fSmrg # Delete the old symlinks, and create new ones. 228534977a2fSmrg # Try `ln -sf' first, because the `ln' binary might depend on 228634977a2fSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 228734977a2fSmrg # so we also need to try rm && ln -s. 228834977a2fSmrg for linkname 228934977a2fSmrg do 229034977a2fSmrg test "$linkname" != "$realname" \ 229134977a2fSmrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2292ee3138f1Smrg done 2293ee3138f1Smrg fi 2294ee3138f1Smrg 229534977a2fSmrg # Do each command in the postinstall commands. 229634977a2fSmrg lib="$destdir/$realname" 229734977a2fSmrg func_execute_cmds "$postinstall_cmds" 'exit $?' 2298ee3138f1Smrg fi 2299ee3138f1Smrg 230034977a2fSmrg # Install the pseudo-library for information purposes. 230134977a2fSmrg func_basename "$file" 230234977a2fSmrg name="$func_basename_result" 230334977a2fSmrg instname="$dir/$name"i 230434977a2fSmrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2305ee3138f1Smrg 230634977a2fSmrg # Maybe install the static library, too. 230734977a2fSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 230834977a2fSmrg ;; 2309ee3138f1Smrg 231034977a2fSmrg *.lo) 231134977a2fSmrg # Install (i.e. copy) a libtool object. 2312ee3138f1Smrg 231334977a2fSmrg # Figure out destination file name, if it wasn't already specified. 231434977a2fSmrg if test -n "$destname"; then 231534977a2fSmrg destfile="$destdir/$destname" 231634977a2fSmrg else 231734977a2fSmrg func_basename "$file" 231834977a2fSmrg destfile="$func_basename_result" 231934977a2fSmrg destfile="$destdir/$destfile" 232034977a2fSmrg fi 232134977a2fSmrg 232234977a2fSmrg # Deduce the name of the destination old-style object file. 232334977a2fSmrg case $destfile in 232434977a2fSmrg *.lo) 232534977a2fSmrg func_lo2o "$destfile" 232634977a2fSmrg staticdest=$func_lo2o_result 232734977a2fSmrg ;; 232834977a2fSmrg *.$objext) 232934977a2fSmrg staticdest="$destfile" 233034977a2fSmrg destfile= 233134977a2fSmrg ;; 233234977a2fSmrg *) 233334977a2fSmrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 233434977a2fSmrg ;; 2335ee3138f1Smrg esac 2336ee3138f1Smrg 233734977a2fSmrg # Install the libtool object if requested. 233834977a2fSmrg test -n "$destfile" && \ 233934977a2fSmrg func_show_eval "$install_prog $file $destfile" 'exit $?' 234034977a2fSmrg 234134977a2fSmrg # Install the old object if enabled. 234234977a2fSmrg if test "$build_old_libs" = yes; then 234334977a2fSmrg # Deduce the name of the old-style object file. 234434977a2fSmrg func_lo2o "$file" 234534977a2fSmrg staticobj=$func_lo2o_result 234634977a2fSmrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2347ee3138f1Smrg fi 234834977a2fSmrg exit $EXIT_SUCCESS 234934977a2fSmrg ;; 2350ee3138f1Smrg 235134977a2fSmrg *) 235234977a2fSmrg # Figure out destination file name, if it wasn't already specified. 235334977a2fSmrg if test -n "$destname"; then 235434977a2fSmrg destfile="$destdir/$destname" 235534977a2fSmrg else 235634977a2fSmrg func_basename "$file" 235734977a2fSmrg destfile="$func_basename_result" 235834977a2fSmrg destfile="$destdir/$destfile" 235934977a2fSmrg fi 2360ee3138f1Smrg 236134977a2fSmrg # If the file is missing, and there is a .exe on the end, strip it 236234977a2fSmrg # because it is most likely a libtool script we actually want to 236334977a2fSmrg # install 236434977a2fSmrg stripped_ext="" 236534977a2fSmrg case $file in 236634977a2fSmrg *.exe) 236734977a2fSmrg if test ! -f "$file"; then 236834977a2fSmrg func_stripname '' '.exe' "$file" 236934977a2fSmrg file=$func_stripname_result 237034977a2fSmrg stripped_ext=".exe" 237134977a2fSmrg fi 237234977a2fSmrg ;; 237334977a2fSmrg esac 2374ee3138f1Smrg 237534977a2fSmrg # Do a test to see if this is really a libtool program. 237634977a2fSmrg case $host in 237734977a2fSmrg *cygwin* | *mingw*) 237834977a2fSmrg if func_ltwrapper_executable_p "$file"; then 237934977a2fSmrg func_ltwrapper_scriptname "$file" 238034977a2fSmrg wrapper=$func_ltwrapper_scriptname_result 238134977a2fSmrg else 238234977a2fSmrg func_stripname '' '.exe' "$file" 238334977a2fSmrg wrapper=$func_stripname_result 238434977a2fSmrg fi 238534977a2fSmrg ;; 238634977a2fSmrg *) 238734977a2fSmrg wrapper=$file 238834977a2fSmrg ;; 238934977a2fSmrg esac 239034977a2fSmrg if func_ltwrapper_script_p "$wrapper"; then 239134977a2fSmrg notinst_deplibs= 239234977a2fSmrg relink_command= 2393ee3138f1Smrg 239434977a2fSmrg func_source "$wrapper" 239534977a2fSmrg 239634977a2fSmrg # Check the variables that should have been set. 239734977a2fSmrg test -z "$generated_by_libtool_version" && \ 239834977a2fSmrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 239934977a2fSmrg 240034977a2fSmrg finalize=yes 240134977a2fSmrg for lib in $notinst_deplibs; do 240234977a2fSmrg # Check to see that each library is installed. 240334977a2fSmrg libdir= 240434977a2fSmrg if test -f "$lib"; then 240534977a2fSmrg func_source "$lib" 240634977a2fSmrg fi 2407b425557eSmrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 240834977a2fSmrg if test -n "$libdir" && test ! -f "$libfile"; then 240934977a2fSmrg func_warning "\`$lib' has not been installed in \`$libdir'" 241034977a2fSmrg finalize=no 241134977a2fSmrg fi 241234977a2fSmrg done 241334977a2fSmrg 241434977a2fSmrg relink_command= 241534977a2fSmrg func_source "$wrapper" 241634977a2fSmrg 241734977a2fSmrg outputname= 241834977a2fSmrg if test "$fast_install" = no && test -n "$relink_command"; then 241934977a2fSmrg $opt_dry_run || { 242034977a2fSmrg if test "$finalize" = yes; then 242134977a2fSmrg tmpdir=`func_mktempdir` 242234977a2fSmrg func_basename "$file$stripped_ext" 242334977a2fSmrg file="$func_basename_result" 242434977a2fSmrg outputname="$tmpdir/$file" 242534977a2fSmrg # Replace the output file specification. 2426b425557eSmrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 242734977a2fSmrg 242834977a2fSmrg $opt_silent || { 242934977a2fSmrg func_quote_for_expand "$relink_command" 243034977a2fSmrg eval "func_echo $func_quote_for_expand_result" 243134977a2fSmrg } 243234977a2fSmrg if eval "$relink_command"; then : 243334977a2fSmrg else 243434977a2fSmrg func_error "error: relink \`$file' with the above command before installing it" 243534977a2fSmrg $opt_dry_run || ${RM}r "$tmpdir" 243634977a2fSmrg continue 243734977a2fSmrg fi 243834977a2fSmrg file="$outputname" 243934977a2fSmrg else 244034977a2fSmrg func_warning "cannot relink \`$file'" 244134977a2fSmrg fi 244234977a2fSmrg } 2443ee3138f1Smrg else 244434977a2fSmrg # Install the binary that we compiled earlier. 2445b425557eSmrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 2446ee3138f1Smrg fi 244734977a2fSmrg fi 2448ee3138f1Smrg 244934977a2fSmrg # remove .exe since cygwin /usr/bin/install will append another 245034977a2fSmrg # one anyway 245134977a2fSmrg case $install_prog,$host in 245234977a2fSmrg */usr/bin/install*,*cygwin*) 245334977a2fSmrg case $file:$destfile in 245434977a2fSmrg *.exe:*.exe) 245534977a2fSmrg # this is ok 245634977a2fSmrg ;; 245734977a2fSmrg *.exe:*) 245834977a2fSmrg destfile=$destfile.exe 245934977a2fSmrg ;; 246034977a2fSmrg *:*.exe) 246134977a2fSmrg func_stripname '' '.exe' "$destfile" 246234977a2fSmrg destfile=$func_stripname_result 246334977a2fSmrg ;; 246434977a2fSmrg esac 2465ee3138f1Smrg ;; 2466ee3138f1Smrg esac 246734977a2fSmrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 246834977a2fSmrg $opt_dry_run || if test -n "$outputname"; then 246934977a2fSmrg ${RM}r "$tmpdir" 247034977a2fSmrg fi 247134977a2fSmrg ;; 247234977a2fSmrg esac 247334977a2fSmrg done 2474ee3138f1Smrg 247534977a2fSmrg for file in $staticlibs; do 247634977a2fSmrg func_basename "$file" 247734977a2fSmrg name="$func_basename_result" 247834977a2fSmrg 247934977a2fSmrg # Set up the ranlib parameters. 248034977a2fSmrg oldlib="$destdir/$name" 248134977a2fSmrg 248234977a2fSmrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 248334977a2fSmrg 248434977a2fSmrg if test -n "$stripme" && test -n "$old_striplib"; then 248534977a2fSmrg func_show_eval "$old_striplib $oldlib" 'exit $?' 248634977a2fSmrg fi 248734977a2fSmrg 248834977a2fSmrg # Do each command in the postinstall commands. 248934977a2fSmrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 249034977a2fSmrg done 249134977a2fSmrg 249234977a2fSmrg test -n "$future_libdirs" && \ 249334977a2fSmrg func_warning "remember to run \`$progname --finish$future_libdirs'" 249434977a2fSmrg 249534977a2fSmrg if test -n "$current_libdirs"; then 249634977a2fSmrg # Maybe just do a dry run. 249734977a2fSmrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 249834977a2fSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 249934977a2fSmrg else 250034977a2fSmrg exit $EXIT_SUCCESS 250134977a2fSmrg fi 250234977a2fSmrg} 250334977a2fSmrg 250434977a2fSmrgtest "$mode" = install && func_mode_install ${1+"$@"} 250534977a2fSmrg 250634977a2fSmrg 250734977a2fSmrg# func_generate_dlsyms outputname originator pic_p 250834977a2fSmrg# Extract symbols from dlprefiles and create ${outputname}S.o with 250934977a2fSmrg# a dlpreopen symbol table. 251034977a2fSmrgfunc_generate_dlsyms () 251134977a2fSmrg{ 251234977a2fSmrg $opt_debug 251334977a2fSmrg my_outputname="$1" 251434977a2fSmrg my_originator="$2" 251534977a2fSmrg my_pic_p="${3-no}" 251634977a2fSmrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 251734977a2fSmrg my_dlsyms= 251834977a2fSmrg 251934977a2fSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 252034977a2fSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 252134977a2fSmrg my_dlsyms="${my_outputname}S.c" 252234977a2fSmrg else 252334977a2fSmrg func_error "not configured to extract global symbols from dlpreopened files" 252434977a2fSmrg fi 252534977a2fSmrg fi 252634977a2fSmrg 252734977a2fSmrg if test -n "$my_dlsyms"; then 252834977a2fSmrg case $my_dlsyms in 252934977a2fSmrg "") ;; 253034977a2fSmrg *.c) 253134977a2fSmrg # Discover the nlist of each of the dlfiles. 253234977a2fSmrg nlist="$output_objdir/${my_outputname}.nm" 253334977a2fSmrg 253434977a2fSmrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 253534977a2fSmrg 253634977a2fSmrg # Parse the name list into a source file. 253734977a2fSmrg func_verbose "creating $output_objdir/$my_dlsyms" 253834977a2fSmrg 253934977a2fSmrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 254034977a2fSmrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 254134977a2fSmrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 254234977a2fSmrg 254334977a2fSmrg#ifdef __cplusplus 254434977a2fSmrgextern \"C\" { 254534977a2fSmrg#endif 254634977a2fSmrg 2547b425557eSmrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 2548b425557eSmrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 2549b425557eSmrg#endif 2550b425557eSmrg 255134977a2fSmrg/* External symbol declarations for the compiler. */\ 255234977a2fSmrg" 255334977a2fSmrg 255434977a2fSmrg if test "$dlself" = yes; then 255534977a2fSmrg func_verbose "generating symbol list for \`$output'" 255634977a2fSmrg 255734977a2fSmrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 255834977a2fSmrg 255934977a2fSmrg # Add our own program objects to the symbol list. 2560b425557eSmrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 256134977a2fSmrg for progfile in $progfiles; do 256234977a2fSmrg func_verbose "extracting global C symbols from \`$progfile'" 256334977a2fSmrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 256434977a2fSmrg done 256534977a2fSmrg 256634977a2fSmrg if test -n "$exclude_expsyms"; then 256734977a2fSmrg $opt_dry_run || { 256834977a2fSmrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 256934977a2fSmrg eval '$MV "$nlist"T "$nlist"' 257034977a2fSmrg } 2571ee3138f1Smrg fi 257234977a2fSmrg 257334977a2fSmrg if test -n "$export_symbols_regex"; then 257434977a2fSmrg $opt_dry_run || { 257534977a2fSmrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 257634977a2fSmrg eval '$MV "$nlist"T "$nlist"' 257734977a2fSmrg } 257834977a2fSmrg fi 257934977a2fSmrg 258034977a2fSmrg # Prepare the list of exported symbols 258134977a2fSmrg if test -z "$export_symbols"; then 258234977a2fSmrg export_symbols="$output_objdir/$outputname.exp" 258334977a2fSmrg $opt_dry_run || { 258434977a2fSmrg $RM $export_symbols 258534977a2fSmrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 258634977a2fSmrg case $host in 258734977a2fSmrg *cygwin* | *mingw* | *cegcc* ) 258834977a2fSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 258934977a2fSmrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 259034977a2fSmrg ;; 259134977a2fSmrg esac 259234977a2fSmrg } 2593ee3138f1Smrg else 259434977a2fSmrg $opt_dry_run || { 259534977a2fSmrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 259634977a2fSmrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 259734977a2fSmrg eval '$MV "$nlist"T "$nlist"' 259834977a2fSmrg case $host in 2599b425557eSmrg *cygwin* | *mingw* | *cegcc* ) 260034977a2fSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 260134977a2fSmrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 260234977a2fSmrg ;; 260334977a2fSmrg esac 260434977a2fSmrg } 2605ee3138f1Smrg fi 260634977a2fSmrg fi 2607ee3138f1Smrg 260834977a2fSmrg for dlprefile in $dlprefiles; do 260934977a2fSmrg func_verbose "extracting global C symbols from \`$dlprefile'" 261034977a2fSmrg func_basename "$dlprefile" 261134977a2fSmrg name="$func_basename_result" 261234977a2fSmrg $opt_dry_run || { 261334977a2fSmrg eval '$ECHO ": $name " >> "$nlist"' 261434977a2fSmrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 261534977a2fSmrg } 261634977a2fSmrg done 261734977a2fSmrg 261834977a2fSmrg $opt_dry_run || { 261934977a2fSmrg # Make sure we have at least an empty file. 262034977a2fSmrg test -f "$nlist" || : > "$nlist" 262134977a2fSmrg 262234977a2fSmrg if test -n "$exclude_expsyms"; then 262334977a2fSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 262434977a2fSmrg $MV "$nlist"T "$nlist" 2625ee3138f1Smrg fi 262634977a2fSmrg 262734977a2fSmrg # Try sorting and uniquifying the output. 262834977a2fSmrg if $GREP -v "^: " < "$nlist" | 262934977a2fSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 263034977a2fSmrg sort -k 3 263134977a2fSmrg else 263234977a2fSmrg sort +2 263334977a2fSmrg fi | 263434977a2fSmrg uniq > "$nlist"S; then 263534977a2fSmrg : 2636ee3138f1Smrg else 263734977a2fSmrg $GREP -v "^: " < "$nlist" > "$nlist"S 2638ee3138f1Smrg fi 2639ee3138f1Smrg 264034977a2fSmrg if test -f "$nlist"S; then 264134977a2fSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2642ee3138f1Smrg else 2643b425557eSmrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 2644ee3138f1Smrg fi 2645ee3138f1Smrg 2646b425557eSmrg echo >> "$output_objdir/$my_dlsyms" "\ 2647ee3138f1Smrg 264834977a2fSmrg/* The mapping between symbol names and symbols. */ 264934977a2fSmrgtypedef struct { 265034977a2fSmrg const char *name; 265134977a2fSmrg void *address; 265234977a2fSmrg} lt_dlsymlist; 265334977a2fSmrg" 265434977a2fSmrg case $host in 265534977a2fSmrg *cygwin* | *mingw* | *cegcc* ) 2656b425557eSmrg echo >> "$output_objdir/$my_dlsyms" "\ 265734977a2fSmrg/* DATA imports from DLLs on WIN32 con't be const, because 265834977a2fSmrg runtime relocations are performed -- see ld's documentation 265934977a2fSmrg on pseudo-relocs. */" 266034977a2fSmrg lt_dlsym_const= ;; 266134977a2fSmrg *osf5*) 266234977a2fSmrg echo >> "$output_objdir/$my_dlsyms" "\ 266334977a2fSmrg/* This system does not cope well with relocations in const data */" 266434977a2fSmrg lt_dlsym_const= ;; 266534977a2fSmrg *) 266634977a2fSmrg lt_dlsym_const=const ;; 266734977a2fSmrg esac 2668ee3138f1Smrg 2669b425557eSmrg echo >> "$output_objdir/$my_dlsyms" "\ 267034977a2fSmrgextern $lt_dlsym_const lt_dlsymlist 267134977a2fSmrglt_${my_prefix}_LTX_preloaded_symbols[]; 267234977a2fSmrg$lt_dlsym_const lt_dlsymlist 267334977a2fSmrglt_${my_prefix}_LTX_preloaded_symbols[] = 267434977a2fSmrg{\ 267534977a2fSmrg { \"$my_originator\", (void *) 0 }," 2676ee3138f1Smrg 267734977a2fSmrg case $need_lib_prefix in 267834977a2fSmrg no) 267934977a2fSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 268034977a2fSmrg ;; 268134977a2fSmrg *) 268234977a2fSmrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 268334977a2fSmrg ;; 268434977a2fSmrg esac 2685b425557eSmrg echo >> "$output_objdir/$my_dlsyms" "\ 268634977a2fSmrg {0, (void *) 0} 268734977a2fSmrg}; 2688ee3138f1Smrg 268934977a2fSmrg/* This works around a problem in FreeBSD linker */ 269034977a2fSmrg#ifdef FREEBSD_WORKAROUND 269134977a2fSmrgstatic const void *lt_preloaded_setup() { 269234977a2fSmrg return lt_${my_prefix}_LTX_preloaded_symbols; 269334977a2fSmrg} 269434977a2fSmrg#endif 269534977a2fSmrg 269634977a2fSmrg#ifdef __cplusplus 269734977a2fSmrg} 269834977a2fSmrg#endif\ 269934977a2fSmrg" 270034977a2fSmrg } # !$opt_dry_run 270134977a2fSmrg 270234977a2fSmrg pic_flag_for_symtable= 270334977a2fSmrg case "$compile_command " in 270434977a2fSmrg *" -static "*) ;; 270534977a2fSmrg *) 270634977a2fSmrg case $host in 270734977a2fSmrg # compiling the symbol table file with pic_flag works around 270834977a2fSmrg # a FreeBSD bug that causes programs to crash when -lm is 270934977a2fSmrg # linked before any other PIC object. But we must not use 271034977a2fSmrg # pic_flag when linking with -static. The problem exists in 271134977a2fSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 271234977a2fSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 271334977a2fSmrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 271434977a2fSmrg *-*-hpux*) 271534977a2fSmrg pic_flag_for_symtable=" $pic_flag" ;; 271634977a2fSmrg *) 271734977a2fSmrg if test "X$my_pic_p" != Xno; then 271834977a2fSmrg pic_flag_for_symtable=" $pic_flag" 2719ee3138f1Smrg fi 272034977a2fSmrg ;; 272134977a2fSmrg esac 272234977a2fSmrg ;; 272334977a2fSmrg esac 272434977a2fSmrg symtab_cflags= 272534977a2fSmrg for arg in $LTCFLAGS; do 272634977a2fSmrg case $arg in 272734977a2fSmrg -pie | -fpie | -fPIE) ;; 272834977a2fSmrg *) symtab_cflags="$symtab_cflags $arg" ;; 272934977a2fSmrg esac 273034977a2fSmrg done 2731ee3138f1Smrg 273234977a2fSmrg # Now compile the dynamic symbol file. 273334977a2fSmrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2734ee3138f1Smrg 273534977a2fSmrg # Clean up the generated files. 273634977a2fSmrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2737ee3138f1Smrg 273834977a2fSmrg # Transform the symbol file into the correct name. 273934977a2fSmrg symfileobj="$output_objdir/${my_outputname}S.$objext" 274034977a2fSmrg case $host in 274134977a2fSmrg *cygwin* | *mingw* | *cegcc* ) 274234977a2fSmrg if test -f "$output_objdir/$my_outputname.def"; then 2743b425557eSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2744b425557eSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 274534977a2fSmrg else 2746b425557eSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 2747b425557eSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 2748ee3138f1Smrg fi 274934977a2fSmrg ;; 275034977a2fSmrg *) 2751b425557eSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 2752b425557eSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 275334977a2fSmrg ;; 275434977a2fSmrg esac 275534977a2fSmrg ;; 275634977a2fSmrg *) 275734977a2fSmrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 275834977a2fSmrg ;; 275934977a2fSmrg esac 276034977a2fSmrg else 276134977a2fSmrg # We keep going just in case the user didn't refer to 276234977a2fSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 276334977a2fSmrg # really was required. 2764ee3138f1Smrg 276534977a2fSmrg # Nullify the symbol file. 2766b425557eSmrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 2767b425557eSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 276834977a2fSmrg fi 276934977a2fSmrg} 2770ee3138f1Smrg 277134977a2fSmrg# func_win32_libid arg 277234977a2fSmrg# return the library type of file 'arg' 277334977a2fSmrg# 277434977a2fSmrg# Need a lot of goo to handle *both* DLLs and import libs 277534977a2fSmrg# Has to be a shell function in order to 'eat' the argument 277634977a2fSmrg# that is supplied when $file_magic_command is called. 2777b425557eSmrg# Despite the name, also deal with 64 bit binaries. 277834977a2fSmrgfunc_win32_libid () 277934977a2fSmrg{ 278034977a2fSmrg $opt_debug 278134977a2fSmrg win32_libid_type="unknown" 278234977a2fSmrg win32_fileres=`file -L $1 2>/dev/null` 278334977a2fSmrg case $win32_fileres in 278434977a2fSmrg *ar\ archive\ import\ library*) # definitely import 278534977a2fSmrg win32_libid_type="x86 archive import" 278634977a2fSmrg ;; 278734977a2fSmrg *ar\ archive*) # could be an import, or static 2788b425557eSmrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 278934977a2fSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 2790b425557eSmrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 279134977a2fSmrg win32_nmres=`eval $NM -f posix -A $1 | 279234977a2fSmrg $SED -n -e ' 279334977a2fSmrg 1,100{ 279434977a2fSmrg / I /{ 279534977a2fSmrg s,.*,import, 279634977a2fSmrg p 279734977a2fSmrg q 279834977a2fSmrg } 279934977a2fSmrg }'` 280034977a2fSmrg case $win32_nmres in 280134977a2fSmrg import*) win32_libid_type="x86 archive import";; 280234977a2fSmrg *) win32_libid_type="x86 archive static";; 280334977a2fSmrg esac 280434977a2fSmrg fi 280534977a2fSmrg ;; 280634977a2fSmrg *DLL*) 280734977a2fSmrg win32_libid_type="x86 DLL" 280834977a2fSmrg ;; 280934977a2fSmrg *executable*) # but shell scripts are "executable" too... 281034977a2fSmrg case $win32_fileres in 281134977a2fSmrg *MS\ Windows\ PE\ Intel*) 281234977a2fSmrg win32_libid_type="x86 DLL" 281334977a2fSmrg ;; 281434977a2fSmrg esac 281534977a2fSmrg ;; 281634977a2fSmrg esac 281734977a2fSmrg $ECHO "$win32_libid_type" 281834977a2fSmrg} 2819ee3138f1Smrg 2820ee3138f1Smrg 2821ee3138f1Smrg 282234977a2fSmrg# func_extract_an_archive dir oldlib 282334977a2fSmrgfunc_extract_an_archive () 282434977a2fSmrg{ 282534977a2fSmrg $opt_debug 282634977a2fSmrg f_ex_an_ar_dir="$1"; shift 282734977a2fSmrg f_ex_an_ar_oldlib="$1" 2828b425557eSmrg if test "$lock_old_archive_extraction" = yes; then 2829b425557eSmrg lockfile=$f_ex_an_ar_oldlib.lock 2830b425557eSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2831b425557eSmrg func_echo "Waiting for $lockfile to be removed" 2832b425557eSmrg sleep 2 2833b425557eSmrg done 2834b425557eSmrg fi 2835b425557eSmrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 2836b425557eSmrg 'stat=$?; rm -f "$lockfile"; exit $stat' 2837b425557eSmrg if test "$lock_old_archive_extraction" = yes; then 2838b425557eSmrg $opt_dry_run || rm -f "$lockfile" 2839b425557eSmrg fi 284034977a2fSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 284134977a2fSmrg : 284234977a2fSmrg else 284334977a2fSmrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 284434977a2fSmrg fi 284534977a2fSmrg} 2846ee3138f1Smrg 2847ee3138f1Smrg 284834977a2fSmrg# func_extract_archives gentop oldlib ... 284934977a2fSmrgfunc_extract_archives () 285034977a2fSmrg{ 285134977a2fSmrg $opt_debug 285234977a2fSmrg my_gentop="$1"; shift 285334977a2fSmrg my_oldlibs=${1+"$@"} 285434977a2fSmrg my_oldobjs="" 285534977a2fSmrg my_xlib="" 285634977a2fSmrg my_xabs="" 285734977a2fSmrg my_xdir="" 2858ee3138f1Smrg 285934977a2fSmrg for my_xlib in $my_oldlibs; do 286034977a2fSmrg # Extract the objects. 286134977a2fSmrg case $my_xlib in 286234977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 286334977a2fSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 286434977a2fSmrg esac 286534977a2fSmrg func_basename "$my_xlib" 286634977a2fSmrg my_xlib="$func_basename_result" 286734977a2fSmrg my_xlib_u=$my_xlib 286834977a2fSmrg while :; do 286934977a2fSmrg case " $extracted_archives " in 287034977a2fSmrg *" $my_xlib_u "*) 287134977a2fSmrg func_arith $extracted_serial + 1 287234977a2fSmrg extracted_serial=$func_arith_result 287334977a2fSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 287434977a2fSmrg *) break ;; 287534977a2fSmrg esac 287634977a2fSmrg done 287734977a2fSmrg extracted_archives="$extracted_archives $my_xlib_u" 287834977a2fSmrg my_xdir="$my_gentop/$my_xlib_u" 2879ee3138f1Smrg 288034977a2fSmrg func_mkdir_p "$my_xdir" 2881ee3138f1Smrg 288234977a2fSmrg case $host in 288334977a2fSmrg *-darwin*) 288434977a2fSmrg func_verbose "Extracting $my_xabs" 288534977a2fSmrg # Do not bother doing anything if just a dry run 288634977a2fSmrg $opt_dry_run || { 288734977a2fSmrg darwin_orig_dir=`pwd` 288834977a2fSmrg cd $my_xdir || exit $? 288934977a2fSmrg darwin_archive=$my_xabs 289034977a2fSmrg darwin_curdir=`pwd` 289134977a2fSmrg darwin_base_archive=`basename "$darwin_archive"` 289234977a2fSmrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 289334977a2fSmrg if test -n "$darwin_arches"; then 289434977a2fSmrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 289534977a2fSmrg darwin_arch= 289634977a2fSmrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 289734977a2fSmrg for darwin_arch in $darwin_arches ; do 289834977a2fSmrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 289934977a2fSmrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 290034977a2fSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 290134977a2fSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 290234977a2fSmrg cd "$darwin_curdir" 290334977a2fSmrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 290434977a2fSmrg done # $darwin_arches 290534977a2fSmrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 290634977a2fSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 290734977a2fSmrg darwin_file= 290834977a2fSmrg darwin_files= 290934977a2fSmrg for darwin_file in $darwin_filelist; do 2910b425557eSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 291134977a2fSmrg $LIPO -create -output "$darwin_file" $darwin_files 291234977a2fSmrg done # $darwin_filelist 291334977a2fSmrg $RM -rf unfat-$$ 291434977a2fSmrg cd "$darwin_orig_dir" 2915ee3138f1Smrg else 291634977a2fSmrg cd $darwin_orig_dir 291734977a2fSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 291834977a2fSmrg fi # $darwin_arches 291934977a2fSmrg } # !$opt_dry_run 292034977a2fSmrg ;; 292134977a2fSmrg *) 292234977a2fSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 292334977a2fSmrg ;; 292434977a2fSmrg esac 2925b425557eSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 292634977a2fSmrg done 2927ee3138f1Smrg 292834977a2fSmrg func_extract_archives_result="$my_oldobjs" 292934977a2fSmrg} 2930ee3138f1Smrg 2931ee3138f1Smrg 2932b425557eSmrg# func_emit_wrapper [arg=no] 2933b425557eSmrg# 2934b425557eSmrg# Emit a libtool wrapper script on stdout. 2935b425557eSmrg# Don't directly open a file because we may want to 2936b425557eSmrg# incorporate the script contents within a cygwin/mingw 2937b425557eSmrg# wrapper executable. Must ONLY be called from within 2938b425557eSmrg# func_mode_link because it depends on a number of variables 2939b425557eSmrg# set therein. 294034977a2fSmrg# 2941b425557eSmrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 2942b425557eSmrg# variable will take. If 'yes', then the emitted script 2943b425557eSmrg# will assume that the directory in which it is stored is 2944b425557eSmrg# the $objdir directory. This is a cygwin/mingw-specific 2945b425557eSmrg# behavior. 2946b425557eSmrgfunc_emit_wrapper () 294734977a2fSmrg{ 2948b425557eSmrg func_emit_wrapper_arg1=${1-no} 2949ee3138f1Smrg 295034977a2fSmrg $ECHO "\ 295134977a2fSmrg#! $SHELL 2952ee3138f1Smrg 295334977a2fSmrg# $output - temporary wrapper script for $objdir/$outputname 295434977a2fSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 295534977a2fSmrg# 295634977a2fSmrg# The $output program cannot be directly executed until all the libtool 295734977a2fSmrg# libraries that it depends on are installed. 295834977a2fSmrg# 295934977a2fSmrg# This wrapper script should never be moved out of the build directory. 296034977a2fSmrg# If it is, it will not operate correctly. 2961ee3138f1Smrg 296234977a2fSmrg# Sed substitution that helps us do robust quoting. It backslashifies 296334977a2fSmrg# metacharacters that are still active within double-quoted strings. 296434977a2fSmrgsed_quote_subst='$sed_quote_subst' 2965ee3138f1Smrg 296634977a2fSmrg# Be Bourne compatible 296734977a2fSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 296834977a2fSmrg emulate sh 296934977a2fSmrg NULLCMD=: 297034977a2fSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 297134977a2fSmrg # is contrary to our usage. Disable this feature. 297234977a2fSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 297334977a2fSmrg setopt NO_GLOB_SUBST 297434977a2fSmrgelse 297534977a2fSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 297634977a2fSmrgfi 297734977a2fSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 297834977a2fSmrgDUALCASE=1; export DUALCASE # for MKS sh 2979ee3138f1Smrg 298034977a2fSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 298134977a2fSmrg# if CDPATH is set. 298234977a2fSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2983ee3138f1Smrg 298434977a2fSmrgrelink_command=\"$relink_command\" 2985ee3138f1Smrg 298634977a2fSmrg# This environment variable determines our operation mode. 298734977a2fSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 298834977a2fSmrg # install mode needs the following variables: 298934977a2fSmrg generated_by_libtool_version='$macro_version' 299034977a2fSmrg notinst_deplibs='$notinst_deplibs' 299134977a2fSmrgelse 299234977a2fSmrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 299334977a2fSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 2994b425557eSmrg file=\"\$0\"" 2995b425557eSmrg 2996b425557eSmrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 2997b425557eSmrg $ECHO "\ 2998b425557eSmrg 2999b425557eSmrg# A function that is used when there is no print builtin or printf. 3000b425557eSmrgfunc_fallback_echo () 3001b425557eSmrg{ 3002b425557eSmrg eval 'cat <<_LTECHO_EOF 3003b425557eSmrg\$1 3004b425557eSmrg_LTECHO_EOF' 3005b425557eSmrg} 3006b425557eSmrg ECHO=\"$qECHO\" 3007b425557eSmrg fi 3008b425557eSmrg 3009b425557eSmrg# Very basic option parsing. These options are (a) specific to 3010b425557eSmrg# the libtool wrapper, (b) are identical between the wrapper 3011b425557eSmrg# /script/ and the wrapper /executable/ which is used only on 3012b425557eSmrg# windows platforms, and (c) all begin with the string "--lt-" 3013b425557eSmrg# (application programs are unlikely to have options which match 3014b425557eSmrg# this pattern). 3015b425557eSmrg# 3016b425557eSmrg# There are only two supported options: --lt-debug and 3017b425557eSmrg# --lt-dump-script. There is, deliberately, no --lt-help. 3018b425557eSmrg# 3019b425557eSmrg# The first argument to this parsing function should be the 3020b425557eSmrg# script's $0 value, followed by "$@". 3021b425557eSmrglt_option_debug= 3022b425557eSmrgfunc_parse_lt_options () 3023b425557eSmrg{ 3024b425557eSmrg lt_script_arg0=\$0 3025b425557eSmrg shift 3026b425557eSmrg for lt_opt 3027b425557eSmrg do 3028b425557eSmrg case \"\$lt_opt\" in 3029b425557eSmrg --lt-debug) lt_option_debug=1 ;; 3030b425557eSmrg --lt-dump-script) 3031b425557eSmrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3032b425557eSmrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3033b425557eSmrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3034b425557eSmrg cat \"\$lt_dump_D/\$lt_dump_F\" 3035b425557eSmrg exit 0 3036b425557eSmrg ;; 3037b425557eSmrg --lt-*) 3038b425557eSmrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3039b425557eSmrg exit 1 3040b425557eSmrg ;; 3041b425557eSmrg esac 3042b425557eSmrg done 3043b425557eSmrg 3044b425557eSmrg # Print the debug banner immediately: 3045b425557eSmrg if test -n \"\$lt_option_debug\"; then 3046b425557eSmrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3047b425557eSmrg fi 3048b425557eSmrg} 3049b425557eSmrg 3050b425557eSmrg# Used when --lt-debug. Prints its arguments to stdout 3051b425557eSmrg# (redirection is the responsibility of the caller) 3052b425557eSmrgfunc_lt_dump_args () 3053b425557eSmrg{ 3054b425557eSmrg lt_dump_args_N=1; 3055b425557eSmrg for lt_arg 3056b425557eSmrg do 3057b425557eSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3058b425557eSmrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3059b425557eSmrg done 3060b425557eSmrg} 3061b425557eSmrg 3062b425557eSmrg# Core function for launching the target application 3063b425557eSmrgfunc_exec_program_core () 3064b425557eSmrg{ 306534977a2fSmrg" 3066b425557eSmrg case $host in 3067b425557eSmrg # Backslashes separate directories on plain windows 3068b425557eSmrg *-*-mingw | *-*-os2* | *-cegcc*) 3069b425557eSmrg $ECHO "\ 3070b425557eSmrg if test -n \"\$lt_option_debug\"; then 3071b425557eSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3072b425557eSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3073b425557eSmrg fi 3074b425557eSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3075b425557eSmrg" 3076b425557eSmrg ;; 3077b425557eSmrg 3078b425557eSmrg *) 3079b425557eSmrg $ECHO "\ 3080b425557eSmrg if test -n \"\$lt_option_debug\"; then 3081b425557eSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3082b425557eSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3083b425557eSmrg fi 3084b425557eSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 3085b425557eSmrg" 3086b425557eSmrg ;; 3087b425557eSmrg esac 3088b425557eSmrg $ECHO "\ 3089b425557eSmrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3090b425557eSmrg exit 1 3091b425557eSmrg} 3092b425557eSmrg 3093b425557eSmrg# A function to encapsulate launching the target application 3094b425557eSmrg# Strips options in the --lt-* namespace from \$@ and 3095b425557eSmrg# launches target application with the remaining arguments. 3096b425557eSmrgfunc_exec_program () 3097b425557eSmrg{ 3098b425557eSmrg for lt_wr_arg 3099b425557eSmrg do 3100b425557eSmrg case \$lt_wr_arg in 3101b425557eSmrg --lt-*) ;; 3102b425557eSmrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3103b425557eSmrg esac 3104b425557eSmrg shift 3105b425557eSmrg done 3106b425557eSmrg func_exec_program_core \${1+\"\$@\"} 3107b425557eSmrg} 3108b425557eSmrg 3109b425557eSmrg # Parse options 3110b425557eSmrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3111ee3138f1Smrg 311234977a2fSmrg # Find the directory that this script lives in. 3113b425557eSmrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 311434977a2fSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 3115ee3138f1Smrg 311634977a2fSmrg # Follow symbolic links until we get to the real thisdir. 3117b425557eSmrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 311834977a2fSmrg while test -n \"\$file\"; do 3119b425557eSmrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 3120ee3138f1Smrg 312134977a2fSmrg # If there was a directory component, then change thisdir. 312234977a2fSmrg if test \"x\$destdir\" != \"x\$file\"; then 312334977a2fSmrg case \"\$destdir\" in 312434977a2fSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 312534977a2fSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 3126ee3138f1Smrg esac 312734977a2fSmrg fi 3128ee3138f1Smrg 3129b425557eSmrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 3130b425557eSmrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 313134977a2fSmrg done 3132ee3138f1Smrg 313334977a2fSmrg # Usually 'no', except on cygwin/mingw when embedded into 313434977a2fSmrg # the cwrapper. 3135b425557eSmrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 313634977a2fSmrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 313734977a2fSmrg # special case for '.' 313834977a2fSmrg if test \"\$thisdir\" = \".\"; then 313934977a2fSmrg thisdir=\`pwd\` 314034977a2fSmrg fi 314134977a2fSmrg # remove .libs from thisdir 314234977a2fSmrg case \"\$thisdir\" in 3143b425557eSmrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 314434977a2fSmrg $objdir ) thisdir=. ;; 314534977a2fSmrg esac 314634977a2fSmrg fi 314734977a2fSmrg 314834977a2fSmrg # Try to get the absolute directory name. 314934977a2fSmrg absdir=\`cd \"\$thisdir\" && pwd\` 315034977a2fSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 315134977a2fSmrg" 315234977a2fSmrg 315334977a2fSmrg if test "$fast_install" = yes; then 315434977a2fSmrg $ECHO "\ 315534977a2fSmrg program=lt-'$outputname'$exeext 315634977a2fSmrg progdir=\"\$thisdir/$objdir\" 315734977a2fSmrg 315834977a2fSmrg if test ! -f \"\$progdir/\$program\" || 315934977a2fSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 316034977a2fSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 316134977a2fSmrg 316234977a2fSmrg file=\"\$\$-\$program\" 316334977a2fSmrg 316434977a2fSmrg if test ! -d \"\$progdir\"; then 316534977a2fSmrg $MKDIR \"\$progdir\" 316634977a2fSmrg else 316734977a2fSmrg $RM \"\$progdir/\$file\" 316834977a2fSmrg fi" 316934977a2fSmrg 317034977a2fSmrg $ECHO "\ 317134977a2fSmrg 317234977a2fSmrg # relink executable if necessary 317334977a2fSmrg if test -n \"\$relink_command\"; then 317434977a2fSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 317534977a2fSmrg else 317634977a2fSmrg $ECHO \"\$relink_command_output\" >&2 317734977a2fSmrg $RM \"\$progdir/\$file\" 317834977a2fSmrg exit 1 3179ee3138f1Smrg fi 318034977a2fSmrg fi 3181ee3138f1Smrg 318234977a2fSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 318334977a2fSmrg { $RM \"\$progdir/\$program\"; 318434977a2fSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 318534977a2fSmrg $RM \"\$progdir/\$file\" 318634977a2fSmrg fi" 318734977a2fSmrg else 318834977a2fSmrg $ECHO "\ 318934977a2fSmrg program='$outputname' 319034977a2fSmrg progdir=\"\$thisdir/$objdir\" 319134977a2fSmrg" 3192ee3138f1Smrg fi 3193ee3138f1Smrg 319434977a2fSmrg $ECHO "\ 3195ee3138f1Smrg 319634977a2fSmrg if test -f \"\$progdir/\$program\"; then" 3197ee3138f1Smrg 319834977a2fSmrg # Export our shlibpath_var if we have one. 319934977a2fSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 320034977a2fSmrg $ECHO "\ 320134977a2fSmrg # Add our own library path to $shlibpath_var 320234977a2fSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 3203ee3138f1Smrg 320434977a2fSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 320534977a2fSmrg # The second colon is a workaround for a bug in BeOS R4 sed 3206b425557eSmrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 320734977a2fSmrg 320834977a2fSmrg export $shlibpath_var 320934977a2fSmrg" 3210ee3138f1Smrg fi 3211ee3138f1Smrg 321234977a2fSmrg # fixup the dll searchpath if we need to. 321334977a2fSmrg if test -n "$dllsearchpath"; then 321434977a2fSmrg $ECHO "\ 321534977a2fSmrg # Add the dll search path components to the executable PATH 321634977a2fSmrg PATH=$dllsearchpath:\$PATH 321734977a2fSmrg" 321834977a2fSmrg fi 3219ee3138f1Smrg 322034977a2fSmrg $ECHO "\ 322134977a2fSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 322234977a2fSmrg # Run the actual program with our arguments. 3223b425557eSmrg func_exec_program \${1+\"\$@\"} 322434977a2fSmrg fi 322534977a2fSmrg else 322634977a2fSmrg # The program doesn't exist. 322734977a2fSmrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 322834977a2fSmrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 3229b425557eSmrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 323034977a2fSmrg exit 1 323134977a2fSmrg fi 323234977a2fSmrgfi\ 323334977a2fSmrg" 323434977a2fSmrg} 3235ee3138f1Smrg 3236ee3138f1Smrg 323734977a2fSmrg# func_to_host_path arg 323834977a2fSmrg# 323934977a2fSmrg# Convert paths to host format when used with build tools. 324034977a2fSmrg# Intended for use with "native" mingw (where libtool itself 324134977a2fSmrg# is running under the msys shell), or in the following cross- 324234977a2fSmrg# build environments: 324334977a2fSmrg# $build $host 324434977a2fSmrg# mingw (msys) mingw [e.g. native] 324534977a2fSmrg# cygwin mingw 324634977a2fSmrg# *nix + wine mingw 324734977a2fSmrg# where wine is equipped with the `winepath' executable. 324834977a2fSmrg# In the native mingw case, the (msys) shell automatically 324934977a2fSmrg# converts paths for any non-msys applications it launches, 325034977a2fSmrg# but that facility isn't available from inside the cwrapper. 325134977a2fSmrg# Similar accommodations are necessary for $host mingw and 325234977a2fSmrg# $build cygwin. Calling this function does no harm for other 325334977a2fSmrg# $host/$build combinations not listed above. 325434977a2fSmrg# 325534977a2fSmrg# ARG is the path (on $build) that should be converted to 325634977a2fSmrg# the proper representation for $host. The result is stored 325734977a2fSmrg# in $func_to_host_path_result. 325834977a2fSmrgfunc_to_host_path () 325934977a2fSmrg{ 326034977a2fSmrg func_to_host_path_result="$1" 3261b425557eSmrg if test -n "$1"; then 326234977a2fSmrg case $host in 326334977a2fSmrg *mingw* ) 326434977a2fSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 326534977a2fSmrg case $build in 326634977a2fSmrg *mingw* ) # actually, msys 326734977a2fSmrg # awkward: cmd appends spaces to result 3268b425557eSmrg func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | 3269b425557eSmrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 327034977a2fSmrg ;; 327134977a2fSmrg *cygwin* ) 3272b425557eSmrg func_to_host_path_result=`cygpath -w "$1" | 3273b425557eSmrg $SED -e "$lt_sed_naive_backslashify"` 327434977a2fSmrg ;; 327534977a2fSmrg * ) 327634977a2fSmrg # Unfortunately, winepath does not exit with a non-zero 327734977a2fSmrg # error code, so we are forced to check the contents of 327834977a2fSmrg # stdout. On the other hand, if the command is not 327934977a2fSmrg # found, the shell will set an exit code of 127 and print 328034977a2fSmrg # *an error message* to stdout. So we must check for both 328134977a2fSmrg # error code of zero AND non-empty stdout, which explains 328234977a2fSmrg # the odd construction: 328334977a2fSmrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 328434977a2fSmrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 3285b425557eSmrg func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | 328634977a2fSmrg $SED -e "$lt_sed_naive_backslashify"` 328734977a2fSmrg else 328834977a2fSmrg # Allow warning below. 3289b425557eSmrg func_to_host_path_result= 329034977a2fSmrg fi 329134977a2fSmrg ;; 329234977a2fSmrg esac 329334977a2fSmrg if test -z "$func_to_host_path_result" ; then 329434977a2fSmrg func_error "Could not determine host path corresponding to" 3295b425557eSmrg func_error " \`$1'" 329634977a2fSmrg func_error "Continuing, but uninstalled executables may not work." 329734977a2fSmrg # Fallback: 329834977a2fSmrg func_to_host_path_result="$1" 329934977a2fSmrg fi 330034977a2fSmrg ;; 330134977a2fSmrg esac 330234977a2fSmrg fi 330334977a2fSmrg} 330434977a2fSmrg# end: func_to_host_path 3305ee3138f1Smrg 330634977a2fSmrg# func_to_host_pathlist arg 330734977a2fSmrg# 330834977a2fSmrg# Convert pathlists to host format when used with build tools. 330934977a2fSmrg# See func_to_host_path(), above. This function supports the 331034977a2fSmrg# following $build/$host combinations (but does no harm for 331134977a2fSmrg# combinations not listed here): 331234977a2fSmrg# $build $host 331334977a2fSmrg# mingw (msys) mingw [e.g. native] 331434977a2fSmrg# cygwin mingw 331534977a2fSmrg# *nix + wine mingw 331634977a2fSmrg# 331734977a2fSmrg# Path separators are also converted from $build format to 331834977a2fSmrg# $host format. If ARG begins or ends with a path separator 331934977a2fSmrg# character, it is preserved (but converted to $host format) 332034977a2fSmrg# on output. 332134977a2fSmrg# 332234977a2fSmrg# ARG is a pathlist (on $build) that should be converted to 332334977a2fSmrg# the proper representation on $host. The result is stored 332434977a2fSmrg# in $func_to_host_pathlist_result. 332534977a2fSmrgfunc_to_host_pathlist () 332634977a2fSmrg{ 332734977a2fSmrg func_to_host_pathlist_result="$1" 3328b425557eSmrg if test -n "$1"; then 332934977a2fSmrg case $host in 333034977a2fSmrg *mingw* ) 333134977a2fSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 333234977a2fSmrg # Remove leading and trailing path separator characters from 333334977a2fSmrg # ARG. msys behavior is inconsistent here, cygpath turns them 333434977a2fSmrg # into '.;' and ';.', and winepath ignores them completely. 3335b425557eSmrg func_stripname : : "$1" 3336b425557eSmrg func_to_host_pathlist_tmp1=$func_stripname_result 333734977a2fSmrg case $build in 333834977a2fSmrg *mingw* ) # Actually, msys. 333934977a2fSmrg # Awkward: cmd appends spaces to result. 3340b425557eSmrg func_to_host_pathlist_result=` 3341b425557eSmrg ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | 3342b425557eSmrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 334334977a2fSmrg ;; 334434977a2fSmrg *cygwin* ) 3345b425557eSmrg func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | 334634977a2fSmrg $SED -e "$lt_sed_naive_backslashify"` 334734977a2fSmrg ;; 334834977a2fSmrg * ) 334934977a2fSmrg # unfortunately, winepath doesn't convert pathlists 335034977a2fSmrg func_to_host_pathlist_result="" 335134977a2fSmrg func_to_host_pathlist_oldIFS=$IFS 335234977a2fSmrg IFS=: 335334977a2fSmrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 335434977a2fSmrg IFS=$func_to_host_pathlist_oldIFS 335534977a2fSmrg if test -n "$func_to_host_pathlist_f" ; then 335634977a2fSmrg func_to_host_path "$func_to_host_pathlist_f" 335734977a2fSmrg if test -n "$func_to_host_path_result" ; then 335834977a2fSmrg if test -z "$func_to_host_pathlist_result" ; then 335934977a2fSmrg func_to_host_pathlist_result="$func_to_host_path_result" 336034977a2fSmrg else 3361b425557eSmrg func_append func_to_host_pathlist_result ";$func_to_host_path_result" 336234977a2fSmrg fi 336334977a2fSmrg fi 336434977a2fSmrg fi 336534977a2fSmrg done 336634977a2fSmrg IFS=$func_to_host_pathlist_oldIFS 336734977a2fSmrg ;; 336834977a2fSmrg esac 3369b425557eSmrg if test -z "$func_to_host_pathlist_result"; then 337034977a2fSmrg func_error "Could not determine the host path(s) corresponding to" 3371b425557eSmrg func_error " \`$1'" 337234977a2fSmrg func_error "Continuing, but uninstalled executables may not work." 337334977a2fSmrg # Fallback. This may break if $1 contains DOS-style drive 337434977a2fSmrg # specifications. The fix is not to complicate the expression 337534977a2fSmrg # below, but for the user to provide a working wine installation 337634977a2fSmrg # with winepath so that path translation in the cross-to-mingw 337734977a2fSmrg # case works properly. 337834977a2fSmrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 337934977a2fSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 338034977a2fSmrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 338134977a2fSmrg fi 338234977a2fSmrg # Now, add the leading and trailing path separators back 338334977a2fSmrg case "$1" in 338434977a2fSmrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 338534977a2fSmrg ;; 338634977a2fSmrg esac 338734977a2fSmrg case "$1" in 3388b425557eSmrg *: ) func_append func_to_host_pathlist_result ";" 338934977a2fSmrg ;; 339034977a2fSmrg esac 339134977a2fSmrg ;; 339234977a2fSmrg esac 339334977a2fSmrg fi 339434977a2fSmrg} 339534977a2fSmrg# end: func_to_host_pathlist 3396ee3138f1Smrg 339734977a2fSmrg# func_emit_cwrapperexe_src 339834977a2fSmrg# emit the source code for a wrapper executable on stdout 339934977a2fSmrg# Must ONLY be called from within func_mode_link because 340034977a2fSmrg# it depends on a number of variable set therein. 340134977a2fSmrgfunc_emit_cwrapperexe_src () 340234977a2fSmrg{ 340334977a2fSmrg cat <<EOF 3404ee3138f1Smrg 340534977a2fSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 340634977a2fSmrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3407ee3138f1Smrg 340834977a2fSmrg The $output program cannot be directly executed until all the libtool 340934977a2fSmrg libraries that it depends on are installed. 3410ee3138f1Smrg 341134977a2fSmrg This wrapper executable should never be moved out of the build directory. 341234977a2fSmrg If it is, it will not operate correctly. 341334977a2fSmrg*/ 341434977a2fSmrgEOF 341534977a2fSmrg cat <<"EOF" 3416b425557eSmrg#ifdef _MSC_VER 3417b425557eSmrg# define _CRT_SECURE_NO_DEPRECATE 1 3418b425557eSmrg#endif 341934977a2fSmrg#include <stdio.h> 342034977a2fSmrg#include <stdlib.h> 342134977a2fSmrg#ifdef _MSC_VER 342234977a2fSmrg# include <direct.h> 342334977a2fSmrg# include <process.h> 342434977a2fSmrg# include <io.h> 342534977a2fSmrg#else 342634977a2fSmrg# include <unistd.h> 342734977a2fSmrg# include <stdint.h> 342834977a2fSmrg# ifdef __CYGWIN__ 342934977a2fSmrg# include <io.h> 343034977a2fSmrg# endif 343134977a2fSmrg#endif 343234977a2fSmrg#include <malloc.h> 343334977a2fSmrg#include <stdarg.h> 343434977a2fSmrg#include <assert.h> 343534977a2fSmrg#include <string.h> 343634977a2fSmrg#include <ctype.h> 343734977a2fSmrg#include <errno.h> 343834977a2fSmrg#include <fcntl.h> 343934977a2fSmrg#include <sys/stat.h> 3440ee3138f1Smrg 3441b425557eSmrg/* declarations of non-ANSI functions */ 3442b425557eSmrg#if defined(__MINGW32__) 3443b425557eSmrg# ifdef __STRICT_ANSI__ 3444b425557eSmrgint _putenv (const char *); 3445b425557eSmrg# endif 3446b425557eSmrg#elif defined(__CYGWIN__) 3447b425557eSmrg# ifdef __STRICT_ANSI__ 3448b425557eSmrgchar *realpath (const char *, char *); 3449b425557eSmrgint putenv (char *); 3450b425557eSmrgint setenv (const char *, const char *, int); 3451b425557eSmrg# endif 3452b425557eSmrg/* #elif defined (other platforms) ... */ 3453b425557eSmrg#endif 3454b425557eSmrg 3455b425557eSmrg/* portability defines, excluding path handling macros */ 3456b425557eSmrg#if defined(_MSC_VER) 3457b425557eSmrg# define setmode _setmode 3458b425557eSmrg# define stat _stat 3459b425557eSmrg# define chmod _chmod 3460b425557eSmrg# define getcwd _getcwd 3461b425557eSmrg# define putenv _putenv 3462b425557eSmrg# define S_IXUSR _S_IEXEC 3463b425557eSmrg# ifndef _INTPTR_T_DEFINED 3464b425557eSmrg# define _INTPTR_T_DEFINED 3465b425557eSmrg# define intptr_t int 3466b425557eSmrg# endif 3467b425557eSmrg#elif defined(__MINGW32__) 3468b425557eSmrg# define setmode _setmode 3469b425557eSmrg# define stat _stat 3470b425557eSmrg# define chmod _chmod 3471b425557eSmrg# define getcwd _getcwd 3472b425557eSmrg# define putenv _putenv 3473b425557eSmrg#elif defined(__CYGWIN__) 3474b425557eSmrg# define HAVE_SETENV 3475b425557eSmrg# define FOPEN_WB "wb" 3476b425557eSmrg/* #elif defined (other platforms) ... */ 3477b425557eSmrg#endif 3478b425557eSmrg 347934977a2fSmrg#if defined(PATH_MAX) 348034977a2fSmrg# define LT_PATHMAX PATH_MAX 348134977a2fSmrg#elif defined(MAXPATHLEN) 348234977a2fSmrg# define LT_PATHMAX MAXPATHLEN 348334977a2fSmrg#else 348434977a2fSmrg# define LT_PATHMAX 1024 348534977a2fSmrg#endif 3486ee3138f1Smrg 348734977a2fSmrg#ifndef S_IXOTH 348834977a2fSmrg# define S_IXOTH 0 348934977a2fSmrg#endif 349034977a2fSmrg#ifndef S_IXGRP 349134977a2fSmrg# define S_IXGRP 0 349234977a2fSmrg#endif 3493ee3138f1Smrg 3494b425557eSmrg/* path handling portability macros */ 349534977a2fSmrg#ifndef DIR_SEPARATOR 349634977a2fSmrg# define DIR_SEPARATOR '/' 349734977a2fSmrg# define PATH_SEPARATOR ':' 349834977a2fSmrg#endif 3499ee3138f1Smrg 350034977a2fSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 350134977a2fSmrg defined (__OS2__) 350234977a2fSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 350334977a2fSmrg# define FOPEN_WB "wb" 350434977a2fSmrg# ifndef DIR_SEPARATOR_2 350534977a2fSmrg# define DIR_SEPARATOR_2 '\\' 350634977a2fSmrg# endif 350734977a2fSmrg# ifndef PATH_SEPARATOR_2 350834977a2fSmrg# define PATH_SEPARATOR_2 ';' 350934977a2fSmrg# endif 351034977a2fSmrg#endif 3511ee3138f1Smrg 351234977a2fSmrg#ifndef DIR_SEPARATOR_2 351334977a2fSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 351434977a2fSmrg#else /* DIR_SEPARATOR_2 */ 351534977a2fSmrg# define IS_DIR_SEPARATOR(ch) \ 351634977a2fSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 351734977a2fSmrg#endif /* DIR_SEPARATOR_2 */ 3518ee3138f1Smrg 351934977a2fSmrg#ifndef PATH_SEPARATOR_2 352034977a2fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 352134977a2fSmrg#else /* PATH_SEPARATOR_2 */ 352234977a2fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 352334977a2fSmrg#endif /* PATH_SEPARATOR_2 */ 3524ee3138f1Smrg 352534977a2fSmrg#ifndef FOPEN_WB 352634977a2fSmrg# define FOPEN_WB "w" 352734977a2fSmrg#endif 352834977a2fSmrg#ifndef _O_BINARY 352934977a2fSmrg# define _O_BINARY 0 353034977a2fSmrg#endif 3531ee3138f1Smrg 353234977a2fSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 353334977a2fSmrg#define XFREE(stale) do { \ 353434977a2fSmrg if (stale) { free ((void *) stale); stale = 0; } \ 353534977a2fSmrg} while (0) 3536ee3138f1Smrg 3537b425557eSmrg#if defined(LT_DEBUGWRAPPER) 3538b425557eSmrgstatic int lt_debug = 1; 353934977a2fSmrg#else 3540b425557eSmrgstatic int lt_debug = 0; 354134977a2fSmrg#endif 3542ee3138f1Smrg 3543b425557eSmrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 3544ee3138f1Smrg 354534977a2fSmrgvoid *xmalloc (size_t num); 354634977a2fSmrgchar *xstrdup (const char *string); 354734977a2fSmrgconst char *base_name (const char *name); 354834977a2fSmrgchar *find_executable (const char *wrapper); 354934977a2fSmrgchar *chase_symlinks (const char *pathspec); 355034977a2fSmrgint make_executable (const char *path); 355134977a2fSmrgint check_executable (const char *path); 355234977a2fSmrgchar *strendzap (char *str, const char *pat); 3553b425557eSmrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 3554b425557eSmrgvoid lt_fatal (const char *file, int line, const char *message, ...); 3555b425557eSmrgstatic const char *nonnull (const char *s); 3556b425557eSmrgstatic const char *nonempty (const char *s); 355734977a2fSmrgvoid lt_setenv (const char *name, const char *value); 355834977a2fSmrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 355934977a2fSmrgvoid lt_update_exe_path (const char *name, const char *value); 356034977a2fSmrgvoid lt_update_lib_path (const char *name, const char *value); 3561b425557eSmrgchar **prepare_spawn (char **argv); 3562b425557eSmrgvoid lt_dump_script (FILE *f); 356334977a2fSmrgEOF 356434977a2fSmrg 356534977a2fSmrg cat <<EOF 356634977a2fSmrgconst char * MAGIC_EXE = "$magic_exe"; 356734977a2fSmrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 356834977a2fSmrgEOF 3569ee3138f1Smrg 357034977a2fSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 357134977a2fSmrg func_to_host_pathlist "$temp_rpath" 357234977a2fSmrg cat <<EOF 357334977a2fSmrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 357434977a2fSmrgEOF 357534977a2fSmrg else 357634977a2fSmrg cat <<"EOF" 357734977a2fSmrgconst char * LIB_PATH_VALUE = ""; 357834977a2fSmrgEOF 3579ee3138f1Smrg fi 3580ee3138f1Smrg 358134977a2fSmrg if test -n "$dllsearchpath"; then 358234977a2fSmrg func_to_host_pathlist "$dllsearchpath:" 358334977a2fSmrg cat <<EOF 358434977a2fSmrgconst char * EXE_PATH_VARNAME = "PATH"; 358534977a2fSmrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 3586ee3138f1SmrgEOF 3587ee3138f1Smrg else 358834977a2fSmrg cat <<"EOF" 358934977a2fSmrgconst char * EXE_PATH_VARNAME = ""; 359034977a2fSmrgconst char * EXE_PATH_VALUE = ""; 359134977a2fSmrgEOF 3592ee3138f1Smrg fi 359334977a2fSmrg 359434977a2fSmrg if test "$fast_install" = yes; then 359534977a2fSmrg cat <<EOF 359634977a2fSmrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 359734977a2fSmrgEOF 3598ee3138f1Smrg else 359934977a2fSmrg cat <<EOF 360034977a2fSmrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 360134977a2fSmrgEOF 3602ee3138f1Smrg fi 3603ee3138f1Smrg 3604ee3138f1Smrg 360534977a2fSmrg cat <<"EOF" 3606ee3138f1Smrg 360734977a2fSmrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 3608ee3138f1Smrg 360934977a2fSmrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 361034977a2fSmrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 3611b425557eSmrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 3612ee3138f1Smrg 361334977a2fSmrgint 361434977a2fSmrgmain (int argc, char *argv[]) 361534977a2fSmrg{ 361634977a2fSmrg char **newargz; 361734977a2fSmrg int newargc; 361834977a2fSmrg char *tmp_pathspec; 361934977a2fSmrg char *actual_cwrapper_path; 362034977a2fSmrg char *actual_cwrapper_name; 362134977a2fSmrg char *target_name; 362234977a2fSmrg char *lt_argv_zero; 362334977a2fSmrg intptr_t rval = 127; 3624ee3138f1Smrg 362534977a2fSmrg int i; 3626ee3138f1Smrg 362734977a2fSmrg program_name = (char *) xstrdup (base_name (argv[0])); 3628b425557eSmrg newargz = XMALLOC (char *, argc + 1); 3629ee3138f1Smrg 3630b425557eSmrg /* very simple arg parsing; don't want to rely on getopt 3631b425557eSmrg * also, copy all non cwrapper options to newargz, except 3632b425557eSmrg * argz[0], which is handled differently 3633b425557eSmrg */ 3634b425557eSmrg newargc=0; 363534977a2fSmrg for (i = 1; i < argc; i++) 363634977a2fSmrg { 363734977a2fSmrg if (strcmp (argv[i], dumpscript_opt) == 0) 363834977a2fSmrg { 363934977a2fSmrgEOF 364034977a2fSmrg case "$host" in 364134977a2fSmrg *mingw* | *cygwin* ) 364234977a2fSmrg # make stdout use "unix" line endings 364334977a2fSmrg echo " setmode(1,_O_BINARY);" 364434977a2fSmrg ;; 364534977a2fSmrg esac 3646ee3138f1Smrg 364734977a2fSmrg cat <<"EOF" 3648b425557eSmrg lt_dump_script (stdout); 364934977a2fSmrg return 0; 365034977a2fSmrg } 3651b425557eSmrg if (strcmp (argv[i], debug_opt) == 0) 3652b425557eSmrg { 3653b425557eSmrg lt_debug = 1; 3654b425557eSmrg continue; 3655b425557eSmrg } 3656b425557eSmrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 3657b425557eSmrg { 3658b425557eSmrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 3659b425557eSmrg namespace, but it is not one of the ones we know about and 3660b425557eSmrg have already dealt with, above (inluding dump-script), then 3661b425557eSmrg report an error. Otherwise, targets might begin to believe 3662b425557eSmrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 3663b425557eSmrg namespace. The first time any user complains about this, we'll 3664b425557eSmrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 3665b425557eSmrg or a configure.ac-settable value. 3666b425557eSmrg */ 3667b425557eSmrg lt_fatal (__FILE__, __LINE__, 3668b425557eSmrg "unrecognized %s option: '%s'", 3669b425557eSmrg ltwrapper_option_prefix, argv[i]); 3670b425557eSmrg } 3671b425557eSmrg /* otherwise ... */ 3672b425557eSmrg newargz[++newargc] = xstrdup (argv[i]); 367334977a2fSmrg } 3674b425557eSmrg newargz[++newargc] = NULL; 3675b425557eSmrg 3676b425557eSmrgEOF 3677b425557eSmrg cat <<EOF 3678b425557eSmrg /* The GNU banner must be the first non-error debug message */ 3679b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 3680b425557eSmrgEOF 3681b425557eSmrg cat <<"EOF" 3682b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 3683b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 3684ee3138f1Smrg 368534977a2fSmrg tmp_pathspec = find_executable (argv[0]); 368634977a2fSmrg if (tmp_pathspec == NULL) 3687b425557eSmrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 3688b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 3689b425557eSmrg "(main) found exe (before symlink chase) at: %s\n", 3690b425557eSmrg tmp_pathspec); 369134977a2fSmrg 369234977a2fSmrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 3693b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 3694b425557eSmrg "(main) found exe (after symlink chase) at: %s\n", 3695b425557eSmrg actual_cwrapper_path); 369634977a2fSmrg XFREE (tmp_pathspec); 369734977a2fSmrg 3698b425557eSmrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 369934977a2fSmrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 370034977a2fSmrg 370134977a2fSmrg /* wrapper name transforms */ 370234977a2fSmrg strendzap (actual_cwrapper_name, ".exe"); 370334977a2fSmrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 370434977a2fSmrg XFREE (actual_cwrapper_name); 370534977a2fSmrg actual_cwrapper_name = tmp_pathspec; 370634977a2fSmrg tmp_pathspec = 0; 370734977a2fSmrg 370834977a2fSmrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 370934977a2fSmrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 371034977a2fSmrg strendzap (target_name, ".exe"); 371134977a2fSmrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 371234977a2fSmrg XFREE (target_name); 371334977a2fSmrg target_name = tmp_pathspec; 371434977a2fSmrg tmp_pathspec = 0; 371534977a2fSmrg 3716b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 3717b425557eSmrg "(main) libtool target name: %s\n", 3718b425557eSmrg target_name); 371934977a2fSmrgEOF 3720ee3138f1Smrg 372134977a2fSmrg cat <<EOF 372234977a2fSmrg newargz[0] = 372334977a2fSmrg XMALLOC (char, (strlen (actual_cwrapper_path) + 372434977a2fSmrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 372534977a2fSmrg strcpy (newargz[0], actual_cwrapper_path); 372634977a2fSmrg strcat (newargz[0], "$objdir"); 372734977a2fSmrg strcat (newargz[0], "/"); 372834977a2fSmrgEOF 3729ee3138f1Smrg 373034977a2fSmrg cat <<"EOF" 373134977a2fSmrg /* stop here, and copy so we don't have to do this twice */ 373234977a2fSmrg tmp_pathspec = xstrdup (newargz[0]); 3733ee3138f1Smrg 373434977a2fSmrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 373534977a2fSmrg strcat (newargz[0], actual_cwrapper_name); 3736ee3138f1Smrg 373734977a2fSmrg /* DO want the lt- prefix here if it exists, so use target_name */ 373834977a2fSmrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 373934977a2fSmrg XFREE (tmp_pathspec); 374034977a2fSmrg tmp_pathspec = NULL; 374134977a2fSmrgEOF 3742ee3138f1Smrg 374334977a2fSmrg case $host_os in 374434977a2fSmrg mingw*) 374534977a2fSmrg cat <<"EOF" 374634977a2fSmrg { 374734977a2fSmrg char* p; 374834977a2fSmrg while ((p = strchr (newargz[0], '\\')) != NULL) 374934977a2fSmrg { 375034977a2fSmrg *p = '/'; 375134977a2fSmrg } 375234977a2fSmrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 375334977a2fSmrg { 375434977a2fSmrg *p = '/'; 375534977a2fSmrg } 375634977a2fSmrg } 375734977a2fSmrgEOF 375834977a2fSmrg ;; 375934977a2fSmrg esac 3760ee3138f1Smrg 376134977a2fSmrg cat <<"EOF" 376234977a2fSmrg XFREE (target_name); 376334977a2fSmrg XFREE (actual_cwrapper_path); 376434977a2fSmrg XFREE (actual_cwrapper_name); 3765ee3138f1Smrg 376634977a2fSmrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 376734977a2fSmrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 376834977a2fSmrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 376934977a2fSmrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3770ee3138f1Smrg 3771b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 3772b425557eSmrg nonnull (lt_argv_zero)); 377334977a2fSmrg for (i = 0; i < newargc; i++) 377434977a2fSmrg { 3775b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 3776b425557eSmrg i, nonnull (newargz[i])); 377734977a2fSmrg } 3778ee3138f1Smrg 377934977a2fSmrgEOF 3780ee3138f1Smrg 378134977a2fSmrg case $host_os in 378234977a2fSmrg mingw*) 378334977a2fSmrg cat <<"EOF" 378434977a2fSmrg /* execv doesn't actually work on mingw as expected on unix */ 3785b425557eSmrg newargz = prepare_spawn (newargz); 378634977a2fSmrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 378734977a2fSmrg if (rval == -1) 378834977a2fSmrg { 378934977a2fSmrg /* failed to start process */ 3790b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 3791b425557eSmrg "(main) failed to launch target \"%s\": %s\n", 3792b425557eSmrg lt_argv_zero, nonnull (strerror (errno))); 379334977a2fSmrg return 127; 379434977a2fSmrg } 379534977a2fSmrg return rval; 379634977a2fSmrgEOF 379734977a2fSmrg ;; 379834977a2fSmrg *) 379934977a2fSmrg cat <<"EOF" 380034977a2fSmrg execv (lt_argv_zero, newargz); 380134977a2fSmrg return rval; /* =127, but avoids unused variable warning */ 380234977a2fSmrgEOF 380334977a2fSmrg ;; 380434977a2fSmrg esac 3805ee3138f1Smrg 380634977a2fSmrg cat <<"EOF" 380734977a2fSmrg} 3808ee3138f1Smrg 380934977a2fSmrgvoid * 381034977a2fSmrgxmalloc (size_t num) 381134977a2fSmrg{ 381234977a2fSmrg void *p = (void *) malloc (num); 381334977a2fSmrg if (!p) 3814b425557eSmrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 3815ee3138f1Smrg 381634977a2fSmrg return p; 381734977a2fSmrg} 3818ee3138f1Smrg 381934977a2fSmrgchar * 382034977a2fSmrgxstrdup (const char *string) 382134977a2fSmrg{ 382234977a2fSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 382334977a2fSmrg string) : NULL; 382434977a2fSmrg} 3825ee3138f1Smrg 382634977a2fSmrgconst char * 382734977a2fSmrgbase_name (const char *name) 382834977a2fSmrg{ 382934977a2fSmrg const char *base; 3830ee3138f1Smrg 383134977a2fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 383234977a2fSmrg /* Skip over the disk name in MSDOS pathnames. */ 383334977a2fSmrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 383434977a2fSmrg name += 2; 383534977a2fSmrg#endif 3836ee3138f1Smrg 383734977a2fSmrg for (base = name; *name; name++) 383834977a2fSmrg if (IS_DIR_SEPARATOR (*name)) 383934977a2fSmrg base = name + 1; 384034977a2fSmrg return base; 384134977a2fSmrg} 3842ee3138f1Smrg 384334977a2fSmrgint 384434977a2fSmrgcheck_executable (const char *path) 384534977a2fSmrg{ 384634977a2fSmrg struct stat st; 3847ee3138f1Smrg 3848b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 3849b425557eSmrg nonempty (path)); 385034977a2fSmrg if ((!path) || (!*path)) 385134977a2fSmrg return 0; 3852ee3138f1Smrg 385334977a2fSmrg if ((stat (path, &st) >= 0) 385434977a2fSmrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 385534977a2fSmrg return 1; 385634977a2fSmrg else 385734977a2fSmrg return 0; 385834977a2fSmrg} 3859ee3138f1Smrg 386034977a2fSmrgint 386134977a2fSmrgmake_executable (const char *path) 386234977a2fSmrg{ 386334977a2fSmrg int rval = 0; 386434977a2fSmrg struct stat st; 3865ee3138f1Smrg 3866b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 3867b425557eSmrg nonempty (path)); 386834977a2fSmrg if ((!path) || (!*path)) 386934977a2fSmrg return 0; 3870ee3138f1Smrg 387134977a2fSmrg if (stat (path, &st) >= 0) 387234977a2fSmrg { 387334977a2fSmrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 387434977a2fSmrg } 387534977a2fSmrg return rval; 387634977a2fSmrg} 3877ee3138f1Smrg 387834977a2fSmrg/* Searches for the full path of the wrapper. Returns 387934977a2fSmrg newly allocated full path name if found, NULL otherwise 388034977a2fSmrg Does not chase symlinks, even on platforms that support them. 388134977a2fSmrg*/ 388234977a2fSmrgchar * 388334977a2fSmrgfind_executable (const char *wrapper) 388434977a2fSmrg{ 388534977a2fSmrg int has_slash = 0; 388634977a2fSmrg const char *p; 388734977a2fSmrg const char *p_next; 388834977a2fSmrg /* static buffer for getcwd */ 388934977a2fSmrg char tmp[LT_PATHMAX + 1]; 389034977a2fSmrg int tmp_len; 389134977a2fSmrg char *concat_name; 3892ee3138f1Smrg 3893b425557eSmrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 3894b425557eSmrg nonempty (wrapper)); 3895ee3138f1Smrg 389634977a2fSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 389734977a2fSmrg return NULL; 3898ee3138f1Smrg 389934977a2fSmrg /* Absolute path? */ 390034977a2fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 390134977a2fSmrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 390234977a2fSmrg { 390334977a2fSmrg concat_name = xstrdup (wrapper); 390434977a2fSmrg if (check_executable (concat_name)) 390534977a2fSmrg return concat_name; 390634977a2fSmrg XFREE (concat_name); 390734977a2fSmrg } 390834977a2fSmrg else 390934977a2fSmrg { 391034977a2fSmrg#endif 391134977a2fSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 391234977a2fSmrg { 391334977a2fSmrg concat_name = xstrdup (wrapper); 391434977a2fSmrg if (check_executable (concat_name)) 391534977a2fSmrg return concat_name; 391634977a2fSmrg XFREE (concat_name); 391734977a2fSmrg } 391834977a2fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 391934977a2fSmrg } 392034977a2fSmrg#endif 3921ee3138f1Smrg 392234977a2fSmrg for (p = wrapper; *p; p++) 392334977a2fSmrg if (*p == '/') 392434977a2fSmrg { 392534977a2fSmrg has_slash = 1; 392634977a2fSmrg break; 392734977a2fSmrg } 392834977a2fSmrg if (!has_slash) 392934977a2fSmrg { 393034977a2fSmrg /* no slashes; search PATH */ 393134977a2fSmrg const char *path = getenv ("PATH"); 393234977a2fSmrg if (path != NULL) 393334977a2fSmrg { 393434977a2fSmrg for (p = path; *p; p = p_next) 393534977a2fSmrg { 393634977a2fSmrg const char *q; 393734977a2fSmrg size_t p_len; 393834977a2fSmrg for (q = p; *q; q++) 393934977a2fSmrg if (IS_PATH_SEPARATOR (*q)) 394034977a2fSmrg break; 394134977a2fSmrg p_len = q - p; 394234977a2fSmrg p_next = (*q == '\0' ? q : q + 1); 394334977a2fSmrg if (p_len == 0) 394434977a2fSmrg { 394534977a2fSmrg /* empty path: current directory */ 394634977a2fSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 3947b425557eSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 3948b425557eSmrg nonnull (strerror (errno))); 394934977a2fSmrg tmp_len = strlen (tmp); 395034977a2fSmrg concat_name = 395134977a2fSmrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 395234977a2fSmrg memcpy (concat_name, tmp, tmp_len); 395334977a2fSmrg concat_name[tmp_len] = '/'; 395434977a2fSmrg strcpy (concat_name + tmp_len + 1, wrapper); 395534977a2fSmrg } 395634977a2fSmrg else 395734977a2fSmrg { 395834977a2fSmrg concat_name = 395934977a2fSmrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 396034977a2fSmrg memcpy (concat_name, p, p_len); 396134977a2fSmrg concat_name[p_len] = '/'; 396234977a2fSmrg strcpy (concat_name + p_len + 1, wrapper); 396334977a2fSmrg } 396434977a2fSmrg if (check_executable (concat_name)) 396534977a2fSmrg return concat_name; 396634977a2fSmrg XFREE (concat_name); 396734977a2fSmrg } 396834977a2fSmrg } 396934977a2fSmrg /* not found in PATH; assume curdir */ 397034977a2fSmrg } 397134977a2fSmrg /* Relative path | not found in path: prepend cwd */ 397234977a2fSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 3973b425557eSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 3974b425557eSmrg nonnull (strerror (errno))); 397534977a2fSmrg tmp_len = strlen (tmp); 397634977a2fSmrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 397734977a2fSmrg memcpy (concat_name, tmp, tmp_len); 397834977a2fSmrg concat_name[tmp_len] = '/'; 397934977a2fSmrg strcpy (concat_name + tmp_len + 1, wrapper); 3980ee3138f1Smrg 398134977a2fSmrg if (check_executable (concat_name)) 398234977a2fSmrg return concat_name; 398334977a2fSmrg XFREE (concat_name); 398434977a2fSmrg return NULL; 398534977a2fSmrg} 3986ee3138f1Smrg 398734977a2fSmrgchar * 398834977a2fSmrgchase_symlinks (const char *pathspec) 398934977a2fSmrg{ 399034977a2fSmrg#ifndef S_ISLNK 399134977a2fSmrg return xstrdup (pathspec); 399234977a2fSmrg#else 399334977a2fSmrg char buf[LT_PATHMAX]; 399434977a2fSmrg struct stat s; 399534977a2fSmrg char *tmp_pathspec = xstrdup (pathspec); 399634977a2fSmrg char *p; 399734977a2fSmrg int has_symlinks = 0; 399834977a2fSmrg while (strlen (tmp_pathspec) && !has_symlinks) 399934977a2fSmrg { 4000b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 4001b425557eSmrg "checking path component for symlinks: %s\n", 4002b425557eSmrg tmp_pathspec); 400334977a2fSmrg if (lstat (tmp_pathspec, &s) == 0) 400434977a2fSmrg { 400534977a2fSmrg if (S_ISLNK (s.st_mode) != 0) 400634977a2fSmrg { 400734977a2fSmrg has_symlinks = 1; 400834977a2fSmrg break; 400934977a2fSmrg } 4010ee3138f1Smrg 401134977a2fSmrg /* search backwards for last DIR_SEPARATOR */ 401234977a2fSmrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 401334977a2fSmrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401434977a2fSmrg p--; 401534977a2fSmrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 401634977a2fSmrg { 401734977a2fSmrg /* no more DIR_SEPARATORS left */ 401834977a2fSmrg break; 401934977a2fSmrg } 402034977a2fSmrg *p = '\0'; 402134977a2fSmrg } 402234977a2fSmrg else 402334977a2fSmrg { 4024b425557eSmrg lt_fatal (__FILE__, __LINE__, 4025b425557eSmrg "error accessing file \"%s\": %s", 4026b425557eSmrg tmp_pathspec, nonnull (strerror (errno))); 402734977a2fSmrg } 402834977a2fSmrg } 402934977a2fSmrg XFREE (tmp_pathspec); 4030ee3138f1Smrg 403134977a2fSmrg if (!has_symlinks) 403234977a2fSmrg { 403334977a2fSmrg return xstrdup (pathspec); 403434977a2fSmrg } 4035ee3138f1Smrg 403634977a2fSmrg tmp_pathspec = realpath (pathspec, buf); 403734977a2fSmrg if (tmp_pathspec == 0) 403834977a2fSmrg { 4039b425557eSmrg lt_fatal (__FILE__, __LINE__, 4040b425557eSmrg "could not follow symlinks for %s", pathspec); 404134977a2fSmrg } 404234977a2fSmrg return xstrdup (tmp_pathspec); 404334977a2fSmrg#endif 404434977a2fSmrg} 4045ee3138f1Smrg 404634977a2fSmrgchar * 404734977a2fSmrgstrendzap (char *str, const char *pat) 404834977a2fSmrg{ 404934977a2fSmrg size_t len, patlen; 4050ee3138f1Smrg 405134977a2fSmrg assert (str != NULL); 405234977a2fSmrg assert (pat != NULL); 4053ee3138f1Smrg 405434977a2fSmrg len = strlen (str); 405534977a2fSmrg patlen = strlen (pat); 4056ee3138f1Smrg 405734977a2fSmrg if (patlen <= len) 405834977a2fSmrg { 405934977a2fSmrg str += len - patlen; 406034977a2fSmrg if (strcmp (str, pat) == 0) 406134977a2fSmrg *str = '\0'; 406234977a2fSmrg } 406334977a2fSmrg return str; 406434977a2fSmrg} 4065ee3138f1Smrg 4066b425557eSmrgvoid 4067b425557eSmrglt_debugprintf (const char *file, int line, const char *fmt, ...) 4068b425557eSmrg{ 4069b425557eSmrg va_list args; 4070b425557eSmrg if (lt_debug) 4071b425557eSmrg { 4072b425557eSmrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4073b425557eSmrg va_start (args, fmt); 4074b425557eSmrg (void) vfprintf (stderr, fmt, args); 4075b425557eSmrg va_end (args); 4076b425557eSmrg } 4077b425557eSmrg} 4078b425557eSmrg 407934977a2fSmrgstatic void 4080b425557eSmrglt_error_core (int exit_status, const char *file, 4081b425557eSmrg int line, const char *mode, 408234977a2fSmrg const char *message, va_list ap) 408334977a2fSmrg{ 4084b425557eSmrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 408534977a2fSmrg vfprintf (stderr, message, ap); 408634977a2fSmrg fprintf (stderr, ".\n"); 4087ee3138f1Smrg 408834977a2fSmrg if (exit_status >= 0) 408934977a2fSmrg exit (exit_status); 409034977a2fSmrg} 4091ee3138f1Smrg 409234977a2fSmrgvoid 4093b425557eSmrglt_fatal (const char *file, int line, const char *message, ...) 409434977a2fSmrg{ 409534977a2fSmrg va_list ap; 409634977a2fSmrg va_start (ap, message); 4097b425557eSmrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 409834977a2fSmrg va_end (ap); 409934977a2fSmrg} 4100ee3138f1Smrg 4101b425557eSmrgstatic const char * 4102b425557eSmrgnonnull (const char *s) 4103b425557eSmrg{ 4104b425557eSmrg return s ? s : "(null)"; 4105b425557eSmrg} 4106b425557eSmrg 4107b425557eSmrgstatic const char * 4108b425557eSmrgnonempty (const char *s) 4109b425557eSmrg{ 4110b425557eSmrg return (s && !*s) ? "(empty)" : nonnull (s); 4111b425557eSmrg} 4112b425557eSmrg 411334977a2fSmrgvoid 411434977a2fSmrglt_setenv (const char *name, const char *value) 411534977a2fSmrg{ 4116b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 4117b425557eSmrg "(lt_setenv) setting '%s' to '%s'\n", 4118b425557eSmrg nonnull (name), nonnull (value)); 411934977a2fSmrg { 412034977a2fSmrg#ifdef HAVE_SETENV 412134977a2fSmrg /* always make a copy, for consistency with !HAVE_SETENV */ 412234977a2fSmrg char *str = xstrdup (value); 412334977a2fSmrg setenv (name, str, 1); 412434977a2fSmrg#else 412534977a2fSmrg int len = strlen (name) + 1 + strlen (value) + 1; 412634977a2fSmrg char *str = XMALLOC (char, len); 412734977a2fSmrg sprintf (str, "%s=%s", name, value); 412834977a2fSmrg if (putenv (str) != EXIT_SUCCESS) 412934977a2fSmrg { 413034977a2fSmrg XFREE (str); 413134977a2fSmrg } 413234977a2fSmrg#endif 413334977a2fSmrg } 413434977a2fSmrg} 4135ee3138f1Smrg 413634977a2fSmrgchar * 413734977a2fSmrglt_extend_str (const char *orig_value, const char *add, int to_end) 413834977a2fSmrg{ 413934977a2fSmrg char *new_value; 414034977a2fSmrg if (orig_value && *orig_value) 414134977a2fSmrg { 414234977a2fSmrg int orig_value_len = strlen (orig_value); 414334977a2fSmrg int add_len = strlen (add); 414434977a2fSmrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 414534977a2fSmrg if (to_end) 414634977a2fSmrg { 414734977a2fSmrg strcpy (new_value, orig_value); 414834977a2fSmrg strcpy (new_value + orig_value_len, add); 414934977a2fSmrg } 415034977a2fSmrg else 415134977a2fSmrg { 415234977a2fSmrg strcpy (new_value, add); 415334977a2fSmrg strcpy (new_value + add_len, orig_value); 415434977a2fSmrg } 415534977a2fSmrg } 415634977a2fSmrg else 415734977a2fSmrg { 415834977a2fSmrg new_value = xstrdup (add); 415934977a2fSmrg } 416034977a2fSmrg return new_value; 416134977a2fSmrg} 4162ee3138f1Smrg 416334977a2fSmrgvoid 416434977a2fSmrglt_update_exe_path (const char *name, const char *value) 416534977a2fSmrg{ 4166b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 4167b425557eSmrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4168b425557eSmrg nonnull (name), nonnull (value)); 4169ee3138f1Smrg 417034977a2fSmrg if (name && *name && value && *value) 417134977a2fSmrg { 417234977a2fSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 417334977a2fSmrg /* some systems can't cope with a ':'-terminated path #' */ 417434977a2fSmrg int len = strlen (new_value); 417534977a2fSmrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 417634977a2fSmrg { 417734977a2fSmrg new_value[len-1] = '\0'; 417834977a2fSmrg } 417934977a2fSmrg lt_setenv (name, new_value); 418034977a2fSmrg XFREE (new_value); 418134977a2fSmrg } 418234977a2fSmrg} 4183ee3138f1Smrg 418434977a2fSmrgvoid 418534977a2fSmrglt_update_lib_path (const char *name, const char *value) 418634977a2fSmrg{ 4187b425557eSmrg lt_debugprintf (__FILE__, __LINE__, 4188b425557eSmrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4189b425557eSmrg nonnull (name), nonnull (value)); 4190ee3138f1Smrg 419134977a2fSmrg if (name && *name && value && *value) 419234977a2fSmrg { 419334977a2fSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 419434977a2fSmrg lt_setenv (name, new_value); 419534977a2fSmrg XFREE (new_value); 419634977a2fSmrg } 419734977a2fSmrg} 4198ee3138f1Smrg 4199b425557eSmrgEOF 4200b425557eSmrg case $host_os in 4201b425557eSmrg mingw*) 4202b425557eSmrg cat <<"EOF" 4203b425557eSmrg 4204b425557eSmrg/* Prepares an argument vector before calling spawn(). 4205b425557eSmrg Note that spawn() does not by itself call the command interpreter 4206b425557eSmrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4207b425557eSmrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4208b425557eSmrg GetVersionEx(&v); 4209b425557eSmrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4210b425557eSmrg }) ? "cmd.exe" : "command.com"). 4211b425557eSmrg Instead it simply concatenates the arguments, separated by ' ', and calls 4212b425557eSmrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4213b425557eSmrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4214b425557eSmrg special way: 4215b425557eSmrg - Space and tab are interpreted as delimiters. They are not treated as 4216b425557eSmrg delimiters if they are surrounded by double quotes: "...". 4217b425557eSmrg - Unescaped double quotes are removed from the input. Their only effect is 4218b425557eSmrg that within double quotes, space and tab are treated like normal 4219b425557eSmrg characters. 4220b425557eSmrg - Backslashes not followed by double quotes are not special. 4221b425557eSmrg - But 2*n+1 backslashes followed by a double quote become 4222b425557eSmrg n backslashes followed by a double quote (n >= 0): 4223b425557eSmrg \" -> " 4224b425557eSmrg \\\" -> \" 4225b425557eSmrg \\\\\" -> \\" 4226b425557eSmrg */ 4227b425557eSmrg#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" 4228b425557eSmrg#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" 4229b425557eSmrgchar ** 4230b425557eSmrgprepare_spawn (char **argv) 4231b425557eSmrg{ 4232b425557eSmrg size_t argc; 4233b425557eSmrg char **new_argv; 4234b425557eSmrg size_t i; 4235b425557eSmrg 4236b425557eSmrg /* Count number of arguments. */ 4237b425557eSmrg for (argc = 0; argv[argc] != NULL; argc++) 4238b425557eSmrg ; 4239b425557eSmrg 4240b425557eSmrg /* Allocate new argument vector. */ 4241b425557eSmrg new_argv = XMALLOC (char *, argc + 1); 4242b425557eSmrg 4243b425557eSmrg /* Put quoted arguments into the new argument vector. */ 4244b425557eSmrg for (i = 0; i < argc; i++) 4245b425557eSmrg { 4246b425557eSmrg const char *string = argv[i]; 4247b425557eSmrg 4248b425557eSmrg if (string[0] == '\0') 4249b425557eSmrg new_argv[i] = xstrdup ("\"\""); 4250b425557eSmrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4251b425557eSmrg { 4252b425557eSmrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4253b425557eSmrg size_t length; 4254b425557eSmrg unsigned int backslashes; 4255b425557eSmrg const char *s; 4256b425557eSmrg char *quoted_string; 4257b425557eSmrg char *p; 4258b425557eSmrg 4259b425557eSmrg length = 0; 4260b425557eSmrg backslashes = 0; 4261b425557eSmrg if (quote_around) 4262b425557eSmrg length++; 4263b425557eSmrg for (s = string; *s != '\0'; s++) 4264b425557eSmrg { 4265b425557eSmrg char c = *s; 4266b425557eSmrg if (c == '"') 4267b425557eSmrg length += backslashes + 1; 4268b425557eSmrg length++; 4269b425557eSmrg if (c == '\\') 4270b425557eSmrg backslashes++; 4271b425557eSmrg else 4272b425557eSmrg backslashes = 0; 4273b425557eSmrg } 4274b425557eSmrg if (quote_around) 4275b425557eSmrg length += backslashes + 1; 4276b425557eSmrg 4277b425557eSmrg quoted_string = XMALLOC (char, length + 1); 4278b425557eSmrg 4279b425557eSmrg p = quoted_string; 4280b425557eSmrg backslashes = 0; 4281b425557eSmrg if (quote_around) 4282b425557eSmrg *p++ = '"'; 4283b425557eSmrg for (s = string; *s != '\0'; s++) 4284b425557eSmrg { 4285b425557eSmrg char c = *s; 4286b425557eSmrg if (c == '"') 4287b425557eSmrg { 4288b425557eSmrg unsigned int j; 4289b425557eSmrg for (j = backslashes + 1; j > 0; j--) 4290b425557eSmrg *p++ = '\\'; 4291b425557eSmrg } 4292b425557eSmrg *p++ = c; 4293b425557eSmrg if (c == '\\') 4294b425557eSmrg backslashes++; 4295b425557eSmrg else 4296b425557eSmrg backslashes = 0; 4297b425557eSmrg } 4298b425557eSmrg if (quote_around) 4299b425557eSmrg { 4300b425557eSmrg unsigned int j; 4301b425557eSmrg for (j = backslashes; j > 0; j--) 4302b425557eSmrg *p++ = '\\'; 4303b425557eSmrg *p++ = '"'; 4304b425557eSmrg } 4305b425557eSmrg *p = '\0'; 4306b425557eSmrg 4307b425557eSmrg new_argv[i] = quoted_string; 4308b425557eSmrg } 4309b425557eSmrg else 4310b425557eSmrg new_argv[i] = (char *) string; 4311b425557eSmrg } 4312b425557eSmrg new_argv[argc] = NULL; 4313b425557eSmrg 4314b425557eSmrg return new_argv; 4315b425557eSmrg} 4316b425557eSmrgEOF 4317b425557eSmrg ;; 4318b425557eSmrg esac 4319b425557eSmrg 4320b425557eSmrg cat <<"EOF" 4321b425557eSmrgvoid lt_dump_script (FILE* f) 4322b425557eSmrg{ 4323b425557eSmrgEOF 4324b425557eSmrg func_emit_wrapper yes | 4325b425557eSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 4326b425557eSmrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 4327ee3138f1Smrg 4328b425557eSmrg cat <<"EOF" 4329b425557eSmrg} 433034977a2fSmrgEOF 433134977a2fSmrg} 433234977a2fSmrg# end: func_emit_cwrapperexe_src 4333ee3138f1Smrg 4334b425557eSmrg# func_win32_import_lib_p ARG 4335b425557eSmrg# True if ARG is an import lib, as indicated by $file_magic_cmd 4336b425557eSmrgfunc_win32_import_lib_p () 4337b425557eSmrg{ 4338b425557eSmrg $opt_debug 4339b425557eSmrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 4340b425557eSmrg *import*) : ;; 4341b425557eSmrg *) false ;; 4342b425557eSmrg esac 4343b425557eSmrg} 4344b425557eSmrg 434534977a2fSmrg# func_mode_link arg... 434634977a2fSmrgfunc_mode_link () 434734977a2fSmrg{ 434834977a2fSmrg $opt_debug 434934977a2fSmrg case $host in 435034977a2fSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 435134977a2fSmrg # It is impossible to link a dll without this setting, and 435234977a2fSmrg # we shouldn't force the makefile maintainer to figure out 435334977a2fSmrg # which system we are compiling for in order to pass an extra 435434977a2fSmrg # flag for every libtool invocation. 435534977a2fSmrg # allow_undefined=no 4356ee3138f1Smrg 435734977a2fSmrg # FIXME: Unfortunately, there are problems with the above when trying 435834977a2fSmrg # to make a dll which has undefined symbols, in which case not 435934977a2fSmrg # even a static library is built. For now, we need to specify 436034977a2fSmrg # -no-undefined on the libtool link line when we can be certain 436134977a2fSmrg # that all symbols are satisfied, otherwise we get a static library. 436234977a2fSmrg allow_undefined=yes 436334977a2fSmrg ;; 436434977a2fSmrg *) 436534977a2fSmrg allow_undefined=yes 436634977a2fSmrg ;; 436734977a2fSmrg esac 436834977a2fSmrg libtool_args=$nonopt 436934977a2fSmrg base_compile="$nonopt $@" 437034977a2fSmrg compile_command=$nonopt 437134977a2fSmrg finalize_command=$nonopt 4372ee3138f1Smrg 437334977a2fSmrg compile_rpath= 437434977a2fSmrg finalize_rpath= 437534977a2fSmrg compile_shlibpath= 437634977a2fSmrg finalize_shlibpath= 437734977a2fSmrg convenience= 437834977a2fSmrg old_convenience= 437934977a2fSmrg deplibs= 438034977a2fSmrg old_deplibs= 438134977a2fSmrg compiler_flags= 438234977a2fSmrg linker_flags= 438334977a2fSmrg dllsearchpath= 438434977a2fSmrg lib_search_path=`pwd` 438534977a2fSmrg inst_prefix_dir= 438634977a2fSmrg new_inherited_linker_flags= 4387ee3138f1Smrg 438834977a2fSmrg avoid_version=no 4389b425557eSmrg bindir= 439034977a2fSmrg dlfiles= 439134977a2fSmrg dlprefiles= 439234977a2fSmrg dlself=no 439334977a2fSmrg export_dynamic=no 439434977a2fSmrg export_symbols= 439534977a2fSmrg export_symbols_regex= 439634977a2fSmrg generated= 439734977a2fSmrg libobjs= 439834977a2fSmrg ltlibs= 439934977a2fSmrg module=no 440034977a2fSmrg no_install=no 440134977a2fSmrg objs= 440234977a2fSmrg non_pic_objects= 440334977a2fSmrg precious_files_regex= 440434977a2fSmrg prefer_static_libs=no 440534977a2fSmrg preload=no 440634977a2fSmrg prev= 440734977a2fSmrg prevarg= 440834977a2fSmrg release= 440934977a2fSmrg rpath= 441034977a2fSmrg xrpath= 441134977a2fSmrg perm_rpath= 441234977a2fSmrg temp_rpath= 441334977a2fSmrg thread_safe=no 441434977a2fSmrg vinfo= 441534977a2fSmrg vinfo_number=no 441634977a2fSmrg weak_libs= 441734977a2fSmrg single_module="${wl}-single_module" 441834977a2fSmrg func_infer_tag $base_compile 4419ee3138f1Smrg 442034977a2fSmrg # We need to know -static, to get the right output filenames. 442134977a2fSmrg for arg 442234977a2fSmrg do 442334977a2fSmrg case $arg in 442434977a2fSmrg -shared) 442534977a2fSmrg test "$build_libtool_libs" != yes && \ 442634977a2fSmrg func_fatal_configuration "can not build a shared library" 442734977a2fSmrg build_old_libs=no 442834977a2fSmrg break 442934977a2fSmrg ;; 443034977a2fSmrg -all-static | -static | -static-libtool-libs) 443134977a2fSmrg case $arg in 443234977a2fSmrg -all-static) 443334977a2fSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 443434977a2fSmrg func_warning "complete static linking is impossible in this configuration" 443534977a2fSmrg fi 443634977a2fSmrg if test -n "$link_static_flag"; then 443734977a2fSmrg dlopen_self=$dlopen_self_static 443834977a2fSmrg fi 443934977a2fSmrg prefer_static_libs=yes 444034977a2fSmrg ;; 444134977a2fSmrg -static) 444234977a2fSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444334977a2fSmrg dlopen_self=$dlopen_self_static 444434977a2fSmrg fi 444534977a2fSmrg prefer_static_libs=built 444634977a2fSmrg ;; 444734977a2fSmrg -static-libtool-libs) 444834977a2fSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 444934977a2fSmrg dlopen_self=$dlopen_self_static 445034977a2fSmrg fi 445134977a2fSmrg prefer_static_libs=yes 445234977a2fSmrg ;; 445334977a2fSmrg esac 445434977a2fSmrg build_libtool_libs=no 445534977a2fSmrg build_old_libs=yes 445634977a2fSmrg break 445734977a2fSmrg ;; 445834977a2fSmrg esac 445934977a2fSmrg done 4460ee3138f1Smrg 446134977a2fSmrg # See if our shared archives depend on static archives. 446234977a2fSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4463ee3138f1Smrg 446434977a2fSmrg # Go through the arguments, transforming them on the way. 446534977a2fSmrg while test "$#" -gt 0; do 446634977a2fSmrg arg="$1" 446734977a2fSmrg shift 446834977a2fSmrg func_quote_for_eval "$arg" 446934977a2fSmrg qarg=$func_quote_for_eval_unquoted_result 447034977a2fSmrg func_append libtool_args " $func_quote_for_eval_result" 4471ee3138f1Smrg 447234977a2fSmrg # If the previous option needs an argument, assign it. 447334977a2fSmrg if test -n "$prev"; then 447434977a2fSmrg case $prev in 447534977a2fSmrg output) 447634977a2fSmrg func_append compile_command " @OUTPUT@" 447734977a2fSmrg func_append finalize_command " @OUTPUT@" 447834977a2fSmrg ;; 447934977a2fSmrg esac 4480ee3138f1Smrg 448134977a2fSmrg case $prev in 4482b425557eSmrg bindir) 4483b425557eSmrg bindir="$arg" 4484b425557eSmrg prev= 4485b425557eSmrg continue 4486b425557eSmrg ;; 448734977a2fSmrg dlfiles|dlprefiles) 448834977a2fSmrg if test "$preload" = no; then 448934977a2fSmrg # Add the symbol object into the linking commands. 449034977a2fSmrg func_append compile_command " @SYMFILE@" 449134977a2fSmrg func_append finalize_command " @SYMFILE@" 449234977a2fSmrg preload=yes 4493ee3138f1Smrg fi 449434977a2fSmrg case $arg in 449534977a2fSmrg *.la | *.lo) ;; # We handle these cases below. 449634977a2fSmrg force) 449734977a2fSmrg if test "$dlself" = no; then 449834977a2fSmrg dlself=needless 449934977a2fSmrg export_dynamic=yes 450034977a2fSmrg fi 450134977a2fSmrg prev= 450234977a2fSmrg continue 450334977a2fSmrg ;; 450434977a2fSmrg self) 450534977a2fSmrg if test "$prev" = dlprefiles; then 450634977a2fSmrg dlself=yes 450734977a2fSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 450834977a2fSmrg dlself=yes 450934977a2fSmrg else 451034977a2fSmrg dlself=needless 451134977a2fSmrg export_dynamic=yes 451234977a2fSmrg fi 451334977a2fSmrg prev= 451434977a2fSmrg continue 451534977a2fSmrg ;; 451634977a2fSmrg *) 451734977a2fSmrg if test "$prev" = dlfiles; then 451834977a2fSmrg dlfiles="$dlfiles $arg" 451934977a2fSmrg else 452034977a2fSmrg dlprefiles="$dlprefiles $arg" 452134977a2fSmrg fi 452234977a2fSmrg prev= 452334977a2fSmrg continue 452434977a2fSmrg ;; 452534977a2fSmrg esac 452634977a2fSmrg ;; 452734977a2fSmrg expsyms) 452834977a2fSmrg export_symbols="$arg" 452934977a2fSmrg test -f "$arg" \ 453034977a2fSmrg || func_fatal_error "symbol file \`$arg' does not exist" 453134977a2fSmrg prev= 453234977a2fSmrg continue 453334977a2fSmrg ;; 453434977a2fSmrg expsyms_regex) 453534977a2fSmrg export_symbols_regex="$arg" 453634977a2fSmrg prev= 453734977a2fSmrg continue 453834977a2fSmrg ;; 453934977a2fSmrg framework) 4540ee3138f1Smrg case $host in 454134977a2fSmrg *-*-darwin*) 454234977a2fSmrg case "$deplibs " in 454334977a2fSmrg *" $qarg.ltframework "*) ;; 454434977a2fSmrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 454534977a2fSmrg ;; 454634977a2fSmrg esac 454734977a2fSmrg ;; 4548ee3138f1Smrg esac 454934977a2fSmrg prev= 455034977a2fSmrg continue 4551ee3138f1Smrg ;; 455234977a2fSmrg inst_prefix) 455334977a2fSmrg inst_prefix_dir="$arg" 455434977a2fSmrg prev= 455534977a2fSmrg continue 4556ee3138f1Smrg ;; 455734977a2fSmrg objectlist) 455834977a2fSmrg if test -f "$arg"; then 455934977a2fSmrg save_arg=$arg 456034977a2fSmrg moreargs= 456134977a2fSmrg for fil in `cat "$save_arg"` 456234977a2fSmrg do 456334977a2fSmrg# moreargs="$moreargs $fil" 456434977a2fSmrg arg=$fil 456534977a2fSmrg # A libtool-controlled object. 4566ee3138f1Smrg 456734977a2fSmrg # Check to see that this really is a libtool object. 456834977a2fSmrg if func_lalib_unsafe_p "$arg"; then 456934977a2fSmrg pic_object= 457034977a2fSmrg non_pic_object= 4571ee3138f1Smrg 457234977a2fSmrg # Read the .lo file 457334977a2fSmrg func_source "$arg" 4574ee3138f1Smrg 457534977a2fSmrg if test -z "$pic_object" || 457634977a2fSmrg test -z "$non_pic_object" || 457734977a2fSmrg test "$pic_object" = none && 457834977a2fSmrg test "$non_pic_object" = none; then 457934977a2fSmrg func_fatal_error "cannot find name of object for \`$arg'" 458034977a2fSmrg fi 4581ee3138f1Smrg 458234977a2fSmrg # Extract subdirectory from the argument. 458334977a2fSmrg func_dirname "$arg" "/" "" 458434977a2fSmrg xdir="$func_dirname_result" 4585ee3138f1Smrg 458634977a2fSmrg if test "$pic_object" != none; then 458734977a2fSmrg # Prepend the subdirectory the object is found in. 458834977a2fSmrg pic_object="$xdir$pic_object" 4589ee3138f1Smrg 459034977a2fSmrg if test "$prev" = dlfiles; then 459134977a2fSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 459234977a2fSmrg dlfiles="$dlfiles $pic_object" 459334977a2fSmrg prev= 459434977a2fSmrg continue 459534977a2fSmrg else 459634977a2fSmrg # If libtool objects are unsupported, then we need to preload. 459734977a2fSmrg prev=dlprefiles 459834977a2fSmrg fi 459934977a2fSmrg fi 4600ee3138f1Smrg 460134977a2fSmrg # CHECK ME: I think I busted this. -Ossama 460234977a2fSmrg if test "$prev" = dlprefiles; then 460334977a2fSmrg # Preload the old-style object. 460434977a2fSmrg dlprefiles="$dlprefiles $pic_object" 460534977a2fSmrg prev= 460634977a2fSmrg fi 4607ee3138f1Smrg 460834977a2fSmrg # A PIC object. 460934977a2fSmrg func_append libobjs " $pic_object" 461034977a2fSmrg arg="$pic_object" 461134977a2fSmrg fi 4612ee3138f1Smrg 461334977a2fSmrg # Non-PIC object. 461434977a2fSmrg if test "$non_pic_object" != none; then 461534977a2fSmrg # Prepend the subdirectory the object is found in. 461634977a2fSmrg non_pic_object="$xdir$non_pic_object" 461734977a2fSmrg 461834977a2fSmrg # A standard non-PIC object 461934977a2fSmrg func_append non_pic_objects " $non_pic_object" 462034977a2fSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 462134977a2fSmrg arg="$non_pic_object" 462234977a2fSmrg fi 462334977a2fSmrg else 462434977a2fSmrg # If the PIC object exists, use it instead. 462534977a2fSmrg # $xdir was prepended to $pic_object above. 462634977a2fSmrg non_pic_object="$pic_object" 462734977a2fSmrg func_append non_pic_objects " $non_pic_object" 462834977a2fSmrg fi 462934977a2fSmrg else 463034977a2fSmrg # Only an error if not doing a dry-run. 463134977a2fSmrg if $opt_dry_run; then 463234977a2fSmrg # Extract subdirectory from the argument. 463334977a2fSmrg func_dirname "$arg" "/" "" 463434977a2fSmrg xdir="$func_dirname_result" 463534977a2fSmrg 463634977a2fSmrg func_lo2o "$arg" 463734977a2fSmrg pic_object=$xdir$objdir/$func_lo2o_result 463834977a2fSmrg non_pic_object=$xdir$func_lo2o_result 463934977a2fSmrg func_append libobjs " $pic_object" 464034977a2fSmrg func_append non_pic_objects " $non_pic_object" 464134977a2fSmrg else 464234977a2fSmrg func_fatal_error "\`$arg' is not a valid libtool object" 464334977a2fSmrg fi 464434977a2fSmrg fi 464534977a2fSmrg done 4646ee3138f1Smrg else 464734977a2fSmrg func_fatal_error "link input file \`$arg' does not exist" 4648ee3138f1Smrg fi 464934977a2fSmrg arg=$save_arg 465034977a2fSmrg prev= 465134977a2fSmrg continue 465234977a2fSmrg ;; 465334977a2fSmrg precious_regex) 465434977a2fSmrg precious_files_regex="$arg" 465534977a2fSmrg prev= 465634977a2fSmrg continue 465734977a2fSmrg ;; 465834977a2fSmrg release) 465934977a2fSmrg release="-$arg" 466034977a2fSmrg prev= 466134977a2fSmrg continue 466234977a2fSmrg ;; 466334977a2fSmrg rpath | xrpath) 466434977a2fSmrg # We need an absolute path. 466534977a2fSmrg case $arg in 466634977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 466734977a2fSmrg *) 466834977a2fSmrg func_fatal_error "only absolute run-paths are allowed" 466934977a2fSmrg ;; 467034977a2fSmrg esac 467134977a2fSmrg if test "$prev" = rpath; then 467234977a2fSmrg case "$rpath " in 467334977a2fSmrg *" $arg "*) ;; 467434977a2fSmrg *) rpath="$rpath $arg" ;; 467534977a2fSmrg esac 4676ee3138f1Smrg else 467734977a2fSmrg case "$xrpath " in 467834977a2fSmrg *" $arg "*) ;; 467934977a2fSmrg *) xrpath="$xrpath $arg" ;; 468034977a2fSmrg esac 4681ee3138f1Smrg fi 468234977a2fSmrg prev= 468334977a2fSmrg continue 468434977a2fSmrg ;; 468534977a2fSmrg shrext) 468634977a2fSmrg shrext_cmds="$arg" 468734977a2fSmrg prev= 468834977a2fSmrg continue 468934977a2fSmrg ;; 469034977a2fSmrg weak) 469134977a2fSmrg weak_libs="$weak_libs $arg" 469234977a2fSmrg prev= 469334977a2fSmrg continue 469434977a2fSmrg ;; 469534977a2fSmrg xcclinker) 469634977a2fSmrg linker_flags="$linker_flags $qarg" 469734977a2fSmrg compiler_flags="$compiler_flags $qarg" 469834977a2fSmrg prev= 469934977a2fSmrg func_append compile_command " $qarg" 470034977a2fSmrg func_append finalize_command " $qarg" 470134977a2fSmrg continue 470234977a2fSmrg ;; 470334977a2fSmrg xcompiler) 470434977a2fSmrg compiler_flags="$compiler_flags $qarg" 470534977a2fSmrg prev= 470634977a2fSmrg func_append compile_command " $qarg" 470734977a2fSmrg func_append finalize_command " $qarg" 470834977a2fSmrg continue 470934977a2fSmrg ;; 471034977a2fSmrg xlinker) 471134977a2fSmrg linker_flags="$linker_flags $qarg" 471234977a2fSmrg compiler_flags="$compiler_flags $wl$qarg" 471334977a2fSmrg prev= 471434977a2fSmrg func_append compile_command " $wl$qarg" 471534977a2fSmrg func_append finalize_command " $wl$qarg" 471634977a2fSmrg continue 471734977a2fSmrg ;; 471834977a2fSmrg *) 471934977a2fSmrg eval "$prev=\"\$arg\"" 472034977a2fSmrg prev= 472134977a2fSmrg continue 472234977a2fSmrg ;; 4723ee3138f1Smrg esac 472434977a2fSmrg fi # test -n "$prev" 4725ee3138f1Smrg 472634977a2fSmrg prevarg="$arg" 4727ee3138f1Smrg 472834977a2fSmrg case $arg in 472934977a2fSmrg -all-static) 473034977a2fSmrg if test -n "$link_static_flag"; then 473134977a2fSmrg # See comment for -static flag below, for more details. 473234977a2fSmrg func_append compile_command " $link_static_flag" 473334977a2fSmrg func_append finalize_command " $link_static_flag" 473434977a2fSmrg fi 473534977a2fSmrg continue 473634977a2fSmrg ;; 4737ee3138f1Smrg 473834977a2fSmrg -allow-undefined) 473934977a2fSmrg # FIXME: remove this flag sometime in the future. 474034977a2fSmrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 474134977a2fSmrg ;; 4742ee3138f1Smrg 474334977a2fSmrg -avoid-version) 474434977a2fSmrg avoid_version=yes 474534977a2fSmrg continue 474634977a2fSmrg ;; 4747ee3138f1Smrg 4748b425557eSmrg -bindir) 4749b425557eSmrg prev=bindir 4750b425557eSmrg continue 4751b425557eSmrg ;; 4752b425557eSmrg 475334977a2fSmrg -dlopen) 475434977a2fSmrg prev=dlfiles 475534977a2fSmrg continue 475634977a2fSmrg ;; 4757ee3138f1Smrg 475834977a2fSmrg -dlpreopen) 475934977a2fSmrg prev=dlprefiles 476034977a2fSmrg continue 476134977a2fSmrg ;; 4762ee3138f1Smrg 476334977a2fSmrg -export-dynamic) 476434977a2fSmrg export_dynamic=yes 476534977a2fSmrg continue 476634977a2fSmrg ;; 4767ee3138f1Smrg 476834977a2fSmrg -export-symbols | -export-symbols-regex) 476934977a2fSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 477034977a2fSmrg func_fatal_error "more than one -exported-symbols argument is not allowed" 477134977a2fSmrg fi 477234977a2fSmrg if test "X$arg" = "X-export-symbols"; then 477334977a2fSmrg prev=expsyms 477434977a2fSmrg else 477534977a2fSmrg prev=expsyms_regex 477634977a2fSmrg fi 477734977a2fSmrg continue 477834977a2fSmrg ;; 4779ee3138f1Smrg 478034977a2fSmrg -framework) 478134977a2fSmrg prev=framework 478234977a2fSmrg continue 478334977a2fSmrg ;; 4784ee3138f1Smrg 478534977a2fSmrg -inst-prefix-dir) 478634977a2fSmrg prev=inst_prefix 478734977a2fSmrg continue 478834977a2fSmrg ;; 4789ee3138f1Smrg 479034977a2fSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 479134977a2fSmrg # so, if we see these flags be careful not to treat them like -L 479234977a2fSmrg -L[A-Z][A-Z]*:*) 479334977a2fSmrg case $with_gcc/$host in 479434977a2fSmrg no/*-*-irix* | /*-*-irix*) 479534977a2fSmrg func_append compile_command " $arg" 479634977a2fSmrg func_append finalize_command " $arg" 479734977a2fSmrg ;; 479834977a2fSmrg esac 479934977a2fSmrg continue 480034977a2fSmrg ;; 4801ee3138f1Smrg 480234977a2fSmrg -L*) 480334977a2fSmrg func_stripname '-L' '' "$arg" 480434977a2fSmrg dir=$func_stripname_result 480534977a2fSmrg if test -z "$dir"; then 480634977a2fSmrg if test "$#" -gt 0; then 480734977a2fSmrg func_fatal_error "require no space between \`-L' and \`$1'" 480834977a2fSmrg else 480934977a2fSmrg func_fatal_error "need path for \`-L' option" 481034977a2fSmrg fi 481134977a2fSmrg fi 481234977a2fSmrg # We need an absolute path. 481334977a2fSmrg case $dir in 481434977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 481534977a2fSmrg *) 481634977a2fSmrg absdir=`cd "$dir" && pwd` 481734977a2fSmrg test -z "$absdir" && \ 481834977a2fSmrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 481934977a2fSmrg dir="$absdir" 482034977a2fSmrg ;; 482134977a2fSmrg esac 482234977a2fSmrg case "$deplibs " in 482334977a2fSmrg *" -L$dir "*) ;; 482434977a2fSmrg *) 482534977a2fSmrg deplibs="$deplibs -L$dir" 482634977a2fSmrg lib_search_path="$lib_search_path $dir" 482734977a2fSmrg ;; 482834977a2fSmrg esac 482934977a2fSmrg case $host in 483034977a2fSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4831b425557eSmrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 483234977a2fSmrg case :$dllsearchpath: in 483334977a2fSmrg *":$dir:"*) ;; 483434977a2fSmrg ::) dllsearchpath=$dir;; 483534977a2fSmrg *) dllsearchpath="$dllsearchpath:$dir";; 483634977a2fSmrg esac 483734977a2fSmrg case :$dllsearchpath: in 483834977a2fSmrg *":$testbindir:"*) ;; 483934977a2fSmrg ::) dllsearchpath=$testbindir;; 484034977a2fSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 484134977a2fSmrg esac 484234977a2fSmrg ;; 484334977a2fSmrg esac 484434977a2fSmrg continue 484534977a2fSmrg ;; 4846ee3138f1Smrg 484734977a2fSmrg -l*) 484834977a2fSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 484934977a2fSmrg case $host in 4850b425557eSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 485134977a2fSmrg # These systems don't actually have a C or math library (as such) 485234977a2fSmrg continue 485334977a2fSmrg ;; 485434977a2fSmrg *-*-os2*) 485534977a2fSmrg # These systems don't actually have a C library (as such) 485634977a2fSmrg test "X$arg" = "X-lc" && continue 485734977a2fSmrg ;; 485834977a2fSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 485934977a2fSmrg # Do not include libc due to us having libc/libc_r. 486034977a2fSmrg test "X$arg" = "X-lc" && continue 486134977a2fSmrg ;; 486234977a2fSmrg *-*-rhapsody* | *-*-darwin1.[012]) 486334977a2fSmrg # Rhapsody C and math libraries are in the System framework 486434977a2fSmrg deplibs="$deplibs System.ltframework" 486534977a2fSmrg continue 486634977a2fSmrg ;; 486734977a2fSmrg *-*-sco3.2v5* | *-*-sco5v6*) 486834977a2fSmrg # Causes problems with __ctype 486934977a2fSmrg test "X$arg" = "X-lc" && continue 487034977a2fSmrg ;; 487134977a2fSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 487234977a2fSmrg # Compiler inserts libc in the correct place for threads to work 487334977a2fSmrg test "X$arg" = "X-lc" && continue 487434977a2fSmrg ;; 487534977a2fSmrg esac 487634977a2fSmrg elif test "X$arg" = "X-lc_r"; then 487734977a2fSmrg case $host in 487834977a2fSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 487934977a2fSmrg # Do not include libc_r directly, use -pthread flag. 488034977a2fSmrg continue 488134977a2fSmrg ;; 488234977a2fSmrg esac 488334977a2fSmrg fi 488434977a2fSmrg deplibs="$deplibs $arg" 488534977a2fSmrg continue 488634977a2fSmrg ;; 4887ee3138f1Smrg 488834977a2fSmrg -module) 488934977a2fSmrg module=yes 489034977a2fSmrg continue 489134977a2fSmrg ;; 4892ee3138f1Smrg 489334977a2fSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 489434977a2fSmrg # classes, name mangling, and exception handling. 489534977a2fSmrg # Darwin uses the -arch flag to determine output architecture. 489634977a2fSmrg -model|-arch|-isysroot) 489734977a2fSmrg compiler_flags="$compiler_flags $arg" 489834977a2fSmrg func_append compile_command " $arg" 489934977a2fSmrg func_append finalize_command " $arg" 490034977a2fSmrg prev=xcompiler 490134977a2fSmrg continue 490234977a2fSmrg ;; 4903ee3138f1Smrg 490434977a2fSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 490534977a2fSmrg compiler_flags="$compiler_flags $arg" 490634977a2fSmrg func_append compile_command " $arg" 490734977a2fSmrg func_append finalize_command " $arg" 490834977a2fSmrg case "$new_inherited_linker_flags " in 490934977a2fSmrg *" $arg "*) ;; 491034977a2fSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 491134977a2fSmrg esac 491234977a2fSmrg continue 491334977a2fSmrg ;; 4914ee3138f1Smrg 491534977a2fSmrg -multi_module) 491634977a2fSmrg single_module="${wl}-multi_module" 491734977a2fSmrg continue 491834977a2fSmrg ;; 4919ee3138f1Smrg 492034977a2fSmrg -no-fast-install) 492134977a2fSmrg fast_install=no 492234977a2fSmrg continue 492334977a2fSmrg ;; 4924ee3138f1Smrg 492534977a2fSmrg -no-install) 492634977a2fSmrg case $host in 492734977a2fSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 492834977a2fSmrg # The PATH hackery in wrapper scripts is required on Windows 492934977a2fSmrg # and Darwin in order for the loader to find any dlls it needs. 493034977a2fSmrg func_warning "\`-no-install' is ignored for $host" 493134977a2fSmrg func_warning "assuming \`-no-fast-install' instead" 493234977a2fSmrg fast_install=no 493334977a2fSmrg ;; 493434977a2fSmrg *) no_install=yes ;; 493534977a2fSmrg esac 493634977a2fSmrg continue 493734977a2fSmrg ;; 4938ee3138f1Smrg 493934977a2fSmrg -no-undefined) 494034977a2fSmrg allow_undefined=no 494134977a2fSmrg continue 494234977a2fSmrg ;; 4943ee3138f1Smrg 494434977a2fSmrg -objectlist) 494534977a2fSmrg prev=objectlist 494634977a2fSmrg continue 494734977a2fSmrg ;; 4948ee3138f1Smrg 494934977a2fSmrg -o) prev=output ;; 4950ee3138f1Smrg 495134977a2fSmrg -precious-files-regex) 495234977a2fSmrg prev=precious_regex 495334977a2fSmrg continue 495434977a2fSmrg ;; 4955ee3138f1Smrg 495634977a2fSmrg -release) 495734977a2fSmrg prev=release 495834977a2fSmrg continue 495934977a2fSmrg ;; 4960ee3138f1Smrg 496134977a2fSmrg -rpath) 496234977a2fSmrg prev=rpath 496334977a2fSmrg continue 496434977a2fSmrg ;; 4965ee3138f1Smrg 496634977a2fSmrg -R) 496734977a2fSmrg prev=xrpath 496834977a2fSmrg continue 496934977a2fSmrg ;; 4970ee3138f1Smrg 497134977a2fSmrg -R*) 497234977a2fSmrg func_stripname '-R' '' "$arg" 497334977a2fSmrg dir=$func_stripname_result 497434977a2fSmrg # We need an absolute path. 497534977a2fSmrg case $dir in 497634977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 497734977a2fSmrg *) 497834977a2fSmrg func_fatal_error "only absolute run-paths are allowed" 497934977a2fSmrg ;; 498034977a2fSmrg esac 498134977a2fSmrg case "$xrpath " in 498234977a2fSmrg *" $dir "*) ;; 498334977a2fSmrg *) xrpath="$xrpath $dir" ;; 498434977a2fSmrg esac 498534977a2fSmrg continue 498634977a2fSmrg ;; 4987ee3138f1Smrg 498834977a2fSmrg -shared) 498934977a2fSmrg # The effects of -shared are defined in a previous loop. 499034977a2fSmrg continue 499134977a2fSmrg ;; 4992ee3138f1Smrg 499334977a2fSmrg -shrext) 499434977a2fSmrg prev=shrext 499534977a2fSmrg continue 499634977a2fSmrg ;; 4997ee3138f1Smrg 499834977a2fSmrg -static | -static-libtool-libs) 499934977a2fSmrg # The effects of -static are defined in a previous loop. 500034977a2fSmrg # We used to do the same as -all-static on platforms that 500134977a2fSmrg # didn't have a PIC flag, but the assumption that the effects 500234977a2fSmrg # would be equivalent was wrong. It would break on at least 500334977a2fSmrg # Digital Unix and AIX. 500434977a2fSmrg continue 500534977a2fSmrg ;; 5006ee3138f1Smrg 500734977a2fSmrg -thread-safe) 500834977a2fSmrg thread_safe=yes 500934977a2fSmrg continue 501034977a2fSmrg ;; 5011ee3138f1Smrg 501234977a2fSmrg -version-info) 501334977a2fSmrg prev=vinfo 501434977a2fSmrg continue 501534977a2fSmrg ;; 5016ee3138f1Smrg 501734977a2fSmrg -version-number) 501834977a2fSmrg prev=vinfo 501934977a2fSmrg vinfo_number=yes 502034977a2fSmrg continue 502134977a2fSmrg ;; 5022ee3138f1Smrg 502334977a2fSmrg -weak) 502434977a2fSmrg prev=weak 502534977a2fSmrg continue 502634977a2fSmrg ;; 5027ee3138f1Smrg 502834977a2fSmrg -Wc,*) 502934977a2fSmrg func_stripname '-Wc,' '' "$arg" 503034977a2fSmrg args=$func_stripname_result 503134977a2fSmrg arg= 503234977a2fSmrg save_ifs="$IFS"; IFS=',' 503334977a2fSmrg for flag in $args; do 503434977a2fSmrg IFS="$save_ifs" 503534977a2fSmrg func_quote_for_eval "$flag" 5036b425557eSmrg arg="$arg $func_quote_for_eval_result" 503734977a2fSmrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 503834977a2fSmrg done 503934977a2fSmrg IFS="$save_ifs" 504034977a2fSmrg func_stripname ' ' '' "$arg" 504134977a2fSmrg arg=$func_stripname_result 504234977a2fSmrg ;; 5043ee3138f1Smrg 504434977a2fSmrg -Wl,*) 504534977a2fSmrg func_stripname '-Wl,' '' "$arg" 504634977a2fSmrg args=$func_stripname_result 504734977a2fSmrg arg= 504834977a2fSmrg save_ifs="$IFS"; IFS=',' 504934977a2fSmrg for flag in $args; do 505034977a2fSmrg IFS="$save_ifs" 505134977a2fSmrg func_quote_for_eval "$flag" 505234977a2fSmrg arg="$arg $wl$func_quote_for_eval_result" 505334977a2fSmrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 505434977a2fSmrg linker_flags="$linker_flags $func_quote_for_eval_result" 505534977a2fSmrg done 505634977a2fSmrg IFS="$save_ifs" 505734977a2fSmrg func_stripname ' ' '' "$arg" 505834977a2fSmrg arg=$func_stripname_result 505934977a2fSmrg ;; 5060ee3138f1Smrg 506134977a2fSmrg -Xcompiler) 506234977a2fSmrg prev=xcompiler 506334977a2fSmrg continue 506434977a2fSmrg ;; 5065ee3138f1Smrg 506634977a2fSmrg -Xlinker) 506734977a2fSmrg prev=xlinker 506834977a2fSmrg continue 506934977a2fSmrg ;; 5070ee3138f1Smrg 507134977a2fSmrg -XCClinker) 507234977a2fSmrg prev=xcclinker 507334977a2fSmrg continue 507434977a2fSmrg ;; 5075ee3138f1Smrg 507634977a2fSmrg # -msg_* for osf cc 507734977a2fSmrg -msg_*) 507834977a2fSmrg func_quote_for_eval "$arg" 507934977a2fSmrg arg="$func_quote_for_eval_result" 508034977a2fSmrg ;; 5081ee3138f1Smrg 5082b425557eSmrg # Flags to be passed through unchanged, with rationale: 5083b425557eSmrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5084b425557eSmrg # -r[0-9][0-9]* specify processor for the SGI compiler 5085b425557eSmrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5086b425557eSmrg # +DA*, +DD* enable 64-bit mode for the HP compiler 5087b425557eSmrg # -q* compiler args for the IBM compiler 5088b425557eSmrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5089b425557eSmrg # -F/path path to uninstalled frameworks, gcc on darwin 5090b425557eSmrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5091b425557eSmrg # @file GCC response files 5092b425557eSmrg # -tp=* Portland pgcc target processor selection 509334977a2fSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 5094b425557eSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) 509534977a2fSmrg func_quote_for_eval "$arg" 509634977a2fSmrg arg="$func_quote_for_eval_result" 509734977a2fSmrg func_append compile_command " $arg" 509834977a2fSmrg func_append finalize_command " $arg" 509934977a2fSmrg compiler_flags="$compiler_flags $arg" 510034977a2fSmrg continue 510134977a2fSmrg ;; 5102ee3138f1Smrg 510334977a2fSmrg # Some other compiler flag. 510434977a2fSmrg -* | +*) 510534977a2fSmrg func_quote_for_eval "$arg" 510634977a2fSmrg arg="$func_quote_for_eval_result" 510734977a2fSmrg ;; 5108ee3138f1Smrg 510934977a2fSmrg *.$objext) 511034977a2fSmrg # A standard object. 511134977a2fSmrg objs="$objs $arg" 511234977a2fSmrg ;; 5113ee3138f1Smrg 511434977a2fSmrg *.lo) 511534977a2fSmrg # A libtool-controlled object. 5116ee3138f1Smrg 511734977a2fSmrg # Check to see that this really is a libtool object. 511834977a2fSmrg if func_lalib_unsafe_p "$arg"; then 511934977a2fSmrg pic_object= 512034977a2fSmrg non_pic_object= 5121ee3138f1Smrg 512234977a2fSmrg # Read the .lo file 512334977a2fSmrg func_source "$arg" 5124ee3138f1Smrg 512534977a2fSmrg if test -z "$pic_object" || 512634977a2fSmrg test -z "$non_pic_object" || 512734977a2fSmrg test "$pic_object" = none && 512834977a2fSmrg test "$non_pic_object" = none; then 512934977a2fSmrg func_fatal_error "cannot find name of object for \`$arg'" 513034977a2fSmrg fi 5131ee3138f1Smrg 513234977a2fSmrg # Extract subdirectory from the argument. 513334977a2fSmrg func_dirname "$arg" "/" "" 513434977a2fSmrg xdir="$func_dirname_result" 5135ee3138f1Smrg 513634977a2fSmrg if test "$pic_object" != none; then 513734977a2fSmrg # Prepend the subdirectory the object is found in. 513834977a2fSmrg pic_object="$xdir$pic_object" 5139ee3138f1Smrg 514034977a2fSmrg if test "$prev" = dlfiles; then 514134977a2fSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 514234977a2fSmrg dlfiles="$dlfiles $pic_object" 514334977a2fSmrg prev= 514434977a2fSmrg continue 514534977a2fSmrg else 514634977a2fSmrg # If libtool objects are unsupported, then we need to preload. 514734977a2fSmrg prev=dlprefiles 514834977a2fSmrg fi 514934977a2fSmrg fi 5150ee3138f1Smrg 515134977a2fSmrg # CHECK ME: I think I busted this. -Ossama 515234977a2fSmrg if test "$prev" = dlprefiles; then 515334977a2fSmrg # Preload the old-style object. 515434977a2fSmrg dlprefiles="$dlprefiles $pic_object" 515534977a2fSmrg prev= 515634977a2fSmrg fi 5157ee3138f1Smrg 515834977a2fSmrg # A PIC object. 515934977a2fSmrg func_append libobjs " $pic_object" 516034977a2fSmrg arg="$pic_object" 516134977a2fSmrg fi 5162ee3138f1Smrg 516334977a2fSmrg # Non-PIC object. 516434977a2fSmrg if test "$non_pic_object" != none; then 516534977a2fSmrg # Prepend the subdirectory the object is found in. 516634977a2fSmrg non_pic_object="$xdir$non_pic_object" 5167ee3138f1Smrg 516834977a2fSmrg # A standard non-PIC object 516934977a2fSmrg func_append non_pic_objects " $non_pic_object" 517034977a2fSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 517134977a2fSmrg arg="$non_pic_object" 517234977a2fSmrg fi 517334977a2fSmrg else 517434977a2fSmrg # If the PIC object exists, use it instead. 517534977a2fSmrg # $xdir was prepended to $pic_object above. 517634977a2fSmrg non_pic_object="$pic_object" 517734977a2fSmrg func_append non_pic_objects " $non_pic_object" 517834977a2fSmrg fi 517934977a2fSmrg else 518034977a2fSmrg # Only an error if not doing a dry-run. 518134977a2fSmrg if $opt_dry_run; then 518234977a2fSmrg # Extract subdirectory from the argument. 518334977a2fSmrg func_dirname "$arg" "/" "" 518434977a2fSmrg xdir="$func_dirname_result" 518534977a2fSmrg 518634977a2fSmrg func_lo2o "$arg" 518734977a2fSmrg pic_object=$xdir$objdir/$func_lo2o_result 518834977a2fSmrg non_pic_object=$xdir$func_lo2o_result 518934977a2fSmrg func_append libobjs " $pic_object" 519034977a2fSmrg func_append non_pic_objects " $non_pic_object" 519134977a2fSmrg else 519234977a2fSmrg func_fatal_error "\`$arg' is not a valid libtool object" 519334977a2fSmrg fi 519434977a2fSmrg fi 519534977a2fSmrg ;; 519634977a2fSmrg 519734977a2fSmrg *.$libext) 519834977a2fSmrg # An archive. 519934977a2fSmrg deplibs="$deplibs $arg" 520034977a2fSmrg old_deplibs="$old_deplibs $arg" 520134977a2fSmrg continue 520234977a2fSmrg ;; 520334977a2fSmrg 520434977a2fSmrg *.la) 520534977a2fSmrg # A libtool-controlled library. 520634977a2fSmrg 520734977a2fSmrg if test "$prev" = dlfiles; then 520834977a2fSmrg # This library was specified with -dlopen. 520934977a2fSmrg dlfiles="$dlfiles $arg" 521034977a2fSmrg prev= 521134977a2fSmrg elif test "$prev" = dlprefiles; then 521234977a2fSmrg # The library was specified with -dlpreopen. 521334977a2fSmrg dlprefiles="$dlprefiles $arg" 521434977a2fSmrg prev= 521534977a2fSmrg else 521634977a2fSmrg deplibs="$deplibs $arg" 521734977a2fSmrg fi 521834977a2fSmrg continue 521934977a2fSmrg ;; 522034977a2fSmrg 522134977a2fSmrg # Some other compiler argument. 522234977a2fSmrg *) 522334977a2fSmrg # Unknown arguments in both finalize_command and compile_command need 522434977a2fSmrg # to be aesthetically quoted because they are evaled later. 522534977a2fSmrg func_quote_for_eval "$arg" 522634977a2fSmrg arg="$func_quote_for_eval_result" 522734977a2fSmrg ;; 522834977a2fSmrg esac # arg 522934977a2fSmrg 523034977a2fSmrg # Now actually substitute the argument into the commands. 523134977a2fSmrg if test -n "$arg"; then 523234977a2fSmrg func_append compile_command " $arg" 523334977a2fSmrg func_append finalize_command " $arg" 523434977a2fSmrg fi 523534977a2fSmrg done # argument parsing loop 523634977a2fSmrg 523734977a2fSmrg test -n "$prev" && \ 523834977a2fSmrg func_fatal_help "the \`$prevarg' option requires an argument" 523934977a2fSmrg 524034977a2fSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 524134977a2fSmrg eval arg=\"$export_dynamic_flag_spec\" 524234977a2fSmrg func_append compile_command " $arg" 524334977a2fSmrg func_append finalize_command " $arg" 524434977a2fSmrg fi 524534977a2fSmrg 524634977a2fSmrg oldlibs= 524734977a2fSmrg # calculate the name of the file, without its directory 524834977a2fSmrg func_basename "$output" 524934977a2fSmrg outputname="$func_basename_result" 525034977a2fSmrg libobjs_save="$libobjs" 525134977a2fSmrg 525234977a2fSmrg if test -n "$shlibpath_var"; then 525334977a2fSmrg # get the directories listed in $shlibpath_var 5254b425557eSmrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 525534977a2fSmrg else 525634977a2fSmrg shlib_search_path= 525734977a2fSmrg fi 525834977a2fSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 525934977a2fSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 526034977a2fSmrg 526134977a2fSmrg func_dirname "$output" "/" "" 526234977a2fSmrg output_objdir="$func_dirname_result$objdir" 526334977a2fSmrg # Create the object directory. 526434977a2fSmrg func_mkdir_p "$output_objdir" 526534977a2fSmrg 526634977a2fSmrg # Determine the type of output 526734977a2fSmrg case $output in 526834977a2fSmrg "") 526934977a2fSmrg func_fatal_help "you must specify an output file" 527034977a2fSmrg ;; 527134977a2fSmrg *.$libext) linkmode=oldlib ;; 527234977a2fSmrg *.lo | *.$objext) linkmode=obj ;; 527334977a2fSmrg *.la) linkmode=lib ;; 527434977a2fSmrg *) linkmode=prog ;; # Anything else should be a program. 527534977a2fSmrg esac 527634977a2fSmrg 527734977a2fSmrg specialdeplibs= 527834977a2fSmrg 527934977a2fSmrg libs= 528034977a2fSmrg # Find all interdependent deplibs by searching for libraries 528134977a2fSmrg # that are linked more than once (e.g. -la -lb -la) 528234977a2fSmrg for deplib in $deplibs; do 528334977a2fSmrg if $opt_duplicate_deps ; then 528434977a2fSmrg case "$libs " in 528534977a2fSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 528634977a2fSmrg esac 528734977a2fSmrg fi 528834977a2fSmrg libs="$libs $deplib" 528934977a2fSmrg done 529034977a2fSmrg 529134977a2fSmrg if test "$linkmode" = lib; then 529234977a2fSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 529334977a2fSmrg 529434977a2fSmrg # Compute libraries that are listed more than once in $predeps 529534977a2fSmrg # $postdeps and mark them as special (i.e., whose duplicates are 529634977a2fSmrg # not to be eliminated). 529734977a2fSmrg pre_post_deps= 529834977a2fSmrg if $opt_duplicate_compiler_generated_deps; then 529934977a2fSmrg for pre_post_dep in $predeps $postdeps; do 530034977a2fSmrg case "$pre_post_deps " in 530134977a2fSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 530234977a2fSmrg esac 530334977a2fSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 530434977a2fSmrg done 530534977a2fSmrg fi 530634977a2fSmrg pre_post_deps= 530734977a2fSmrg fi 530834977a2fSmrg 530934977a2fSmrg deplibs= 531034977a2fSmrg newdependency_libs= 531134977a2fSmrg newlib_search_path= 531234977a2fSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 531334977a2fSmrg notinst_deplibs= # not-installed libtool libraries 531434977a2fSmrg notinst_path= # paths that contain not-installed libtool libraries 531534977a2fSmrg 531634977a2fSmrg case $linkmode in 531734977a2fSmrg lib) 531834977a2fSmrg passes="conv dlpreopen link" 531934977a2fSmrg for file in $dlfiles $dlprefiles; do 532034977a2fSmrg case $file in 532134977a2fSmrg *.la) ;; 532234977a2fSmrg *) 532334977a2fSmrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 532434977a2fSmrg ;; 532534977a2fSmrg esac 532634977a2fSmrg done 532734977a2fSmrg ;; 532834977a2fSmrg prog) 532934977a2fSmrg compile_deplibs= 533034977a2fSmrg finalize_deplibs= 533134977a2fSmrg alldeplibs=no 533234977a2fSmrg newdlfiles= 533334977a2fSmrg newdlprefiles= 533434977a2fSmrg passes="conv scan dlopen dlpreopen link" 533534977a2fSmrg ;; 533634977a2fSmrg *) passes="conv" 533734977a2fSmrg ;; 533834977a2fSmrg esac 533934977a2fSmrg 534034977a2fSmrg for pass in $passes; do 534134977a2fSmrg # The preopen pass in lib mode reverses $deplibs; put it back here 534234977a2fSmrg # so that -L comes before libs that need it for instance... 534334977a2fSmrg if test "$linkmode,$pass" = "lib,link"; then 534434977a2fSmrg ## FIXME: Find the place where the list is rebuilt in the wrong 534534977a2fSmrg ## order, and fix it there properly 534634977a2fSmrg tmp_deplibs= 534734977a2fSmrg for deplib in $deplibs; do 534834977a2fSmrg tmp_deplibs="$deplib $tmp_deplibs" 534934977a2fSmrg done 535034977a2fSmrg deplibs="$tmp_deplibs" 535134977a2fSmrg fi 535234977a2fSmrg 535334977a2fSmrg if test "$linkmode,$pass" = "lib,link" || 535434977a2fSmrg test "$linkmode,$pass" = "prog,scan"; then 535534977a2fSmrg libs="$deplibs" 535634977a2fSmrg deplibs= 535734977a2fSmrg fi 535834977a2fSmrg if test "$linkmode" = prog; then 535934977a2fSmrg case $pass in 536034977a2fSmrg dlopen) libs="$dlfiles" ;; 536134977a2fSmrg dlpreopen) libs="$dlprefiles" ;; 536234977a2fSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 536334977a2fSmrg esac 536434977a2fSmrg fi 536534977a2fSmrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 536634977a2fSmrg # Collect and forward deplibs of preopened libtool libs 536734977a2fSmrg for lib in $dlprefiles; do 536834977a2fSmrg # Ignore non-libtool-libs 536934977a2fSmrg dependency_libs= 537034977a2fSmrg case $lib in 537134977a2fSmrg *.la) func_source "$lib" ;; 537234977a2fSmrg esac 537334977a2fSmrg 537434977a2fSmrg # Collect preopened libtool deplibs, except any this library 537534977a2fSmrg # has declared as weak libs 537634977a2fSmrg for deplib in $dependency_libs; do 5377b425557eSmrg func_basename "$deplib" 5378b425557eSmrg deplib_base=$func_basename_result 537934977a2fSmrg case " $weak_libs " in 538034977a2fSmrg *" $deplib_base "*) ;; 538134977a2fSmrg *) deplibs="$deplibs $deplib" ;; 538234977a2fSmrg esac 538334977a2fSmrg done 538434977a2fSmrg done 538534977a2fSmrg libs="$dlprefiles" 538634977a2fSmrg fi 538734977a2fSmrg if test "$pass" = dlopen; then 538834977a2fSmrg # Collect dlpreopened libraries 538934977a2fSmrg save_deplibs="$deplibs" 539034977a2fSmrg deplibs= 539134977a2fSmrg fi 539234977a2fSmrg 539334977a2fSmrg for deplib in $libs; do 539434977a2fSmrg lib= 539534977a2fSmrg found=no 539634977a2fSmrg case $deplib in 539734977a2fSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 539834977a2fSmrg if test "$linkmode,$pass" = "prog,link"; then 539934977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 540034977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 540134977a2fSmrg else 540234977a2fSmrg compiler_flags="$compiler_flags $deplib" 540334977a2fSmrg if test "$linkmode" = lib ; then 540434977a2fSmrg case "$new_inherited_linker_flags " in 540534977a2fSmrg *" $deplib "*) ;; 540634977a2fSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 540734977a2fSmrg esac 540834977a2fSmrg fi 540934977a2fSmrg fi 541034977a2fSmrg continue 541134977a2fSmrg ;; 541234977a2fSmrg -l*) 541334977a2fSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 541434977a2fSmrg func_warning "\`-l' is ignored for archives/objects" 541534977a2fSmrg continue 541634977a2fSmrg fi 541734977a2fSmrg func_stripname '-l' '' "$deplib" 541834977a2fSmrg name=$func_stripname_result 541934977a2fSmrg if test "$linkmode" = lib; then 542034977a2fSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 542134977a2fSmrg else 542234977a2fSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 542334977a2fSmrg fi 542434977a2fSmrg for searchdir in $searchdirs; do 542534977a2fSmrg for search_ext in .la $std_shrext .so .a; do 542634977a2fSmrg # Search the libtool library 542734977a2fSmrg lib="$searchdir/lib${name}${search_ext}" 542834977a2fSmrg if test -f "$lib"; then 542934977a2fSmrg if test "$search_ext" = ".la"; then 543034977a2fSmrg found=yes 543134977a2fSmrg else 543234977a2fSmrg found=no 543334977a2fSmrg fi 543434977a2fSmrg break 2 543534977a2fSmrg fi 543634977a2fSmrg done 543734977a2fSmrg done 543834977a2fSmrg if test "$found" != yes; then 543934977a2fSmrg # deplib doesn't seem to be a libtool library 544034977a2fSmrg if test "$linkmode,$pass" = "prog,link"; then 544134977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 544234977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 544334977a2fSmrg else 544434977a2fSmrg deplibs="$deplib $deplibs" 544534977a2fSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 544634977a2fSmrg fi 544734977a2fSmrg continue 544834977a2fSmrg else # deplib is a libtool library 544934977a2fSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 545034977a2fSmrg # We need to do some special things here, and not later. 545134977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 545234977a2fSmrg case " $predeps $postdeps " in 545334977a2fSmrg *" $deplib "*) 545434977a2fSmrg if func_lalib_p "$lib"; then 545534977a2fSmrg library_names= 545634977a2fSmrg old_library= 545734977a2fSmrg func_source "$lib" 545834977a2fSmrg for l in $old_library $library_names; do 545934977a2fSmrg ll="$l" 546034977a2fSmrg done 546134977a2fSmrg if test "X$ll" = "X$old_library" ; then # only static version available 546234977a2fSmrg found=no 546334977a2fSmrg func_dirname "$lib" "" "." 546434977a2fSmrg ladir="$func_dirname_result" 546534977a2fSmrg lib=$ladir/$old_library 546634977a2fSmrg if test "$linkmode,$pass" = "prog,link"; then 546734977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 546834977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 546934977a2fSmrg else 547034977a2fSmrg deplibs="$deplib $deplibs" 547134977a2fSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 547234977a2fSmrg fi 547334977a2fSmrg continue 547434977a2fSmrg fi 547534977a2fSmrg fi 547634977a2fSmrg ;; 547734977a2fSmrg *) ;; 547834977a2fSmrg esac 547934977a2fSmrg fi 548034977a2fSmrg fi 548134977a2fSmrg ;; # -l 548234977a2fSmrg *.ltframework) 548334977a2fSmrg if test "$linkmode,$pass" = "prog,link"; then 548434977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 548534977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 548634977a2fSmrg else 548734977a2fSmrg deplibs="$deplib $deplibs" 548834977a2fSmrg if test "$linkmode" = lib ; then 548934977a2fSmrg case "$new_inherited_linker_flags " in 549034977a2fSmrg *" $deplib "*) ;; 549134977a2fSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 549234977a2fSmrg esac 549334977a2fSmrg fi 549434977a2fSmrg fi 549534977a2fSmrg continue 549634977a2fSmrg ;; 549734977a2fSmrg -L*) 549834977a2fSmrg case $linkmode in 549934977a2fSmrg lib) 550034977a2fSmrg deplibs="$deplib $deplibs" 550134977a2fSmrg test "$pass" = conv && continue 550234977a2fSmrg newdependency_libs="$deplib $newdependency_libs" 550334977a2fSmrg func_stripname '-L' '' "$deplib" 550434977a2fSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 550534977a2fSmrg ;; 550634977a2fSmrg prog) 550734977a2fSmrg if test "$pass" = conv; then 550834977a2fSmrg deplibs="$deplib $deplibs" 550934977a2fSmrg continue 551034977a2fSmrg fi 551134977a2fSmrg if test "$pass" = scan; then 551234977a2fSmrg deplibs="$deplib $deplibs" 551334977a2fSmrg else 551434977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 551534977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 551634977a2fSmrg fi 551734977a2fSmrg func_stripname '-L' '' "$deplib" 551834977a2fSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 551934977a2fSmrg ;; 552034977a2fSmrg *) 552134977a2fSmrg func_warning "\`-L' is ignored for archives/objects" 552234977a2fSmrg ;; 552334977a2fSmrg esac # linkmode 552434977a2fSmrg continue 552534977a2fSmrg ;; # -L 552634977a2fSmrg -R*) 552734977a2fSmrg if test "$pass" = link; then 552834977a2fSmrg func_stripname '-R' '' "$deplib" 552934977a2fSmrg dir=$func_stripname_result 553034977a2fSmrg # Make sure the xrpath contains only unique directories. 553134977a2fSmrg case "$xrpath " in 553234977a2fSmrg *" $dir "*) ;; 553334977a2fSmrg *) xrpath="$xrpath $dir" ;; 553434977a2fSmrg esac 553534977a2fSmrg fi 553634977a2fSmrg deplibs="$deplib $deplibs" 553734977a2fSmrg continue 553834977a2fSmrg ;; 553934977a2fSmrg *.la) lib="$deplib" ;; 554034977a2fSmrg *.$libext) 554134977a2fSmrg if test "$pass" = conv; then 554234977a2fSmrg deplibs="$deplib $deplibs" 554334977a2fSmrg continue 554434977a2fSmrg fi 554534977a2fSmrg case $linkmode in 554634977a2fSmrg lib) 554734977a2fSmrg # Linking convenience modules into shared libraries is allowed, 554834977a2fSmrg # but linking other static libraries is non-portable. 554934977a2fSmrg case " $dlpreconveniencelibs " in 555034977a2fSmrg *" $deplib "*) ;; 555134977a2fSmrg *) 555234977a2fSmrg valid_a_lib=no 555334977a2fSmrg case $deplibs_check_method in 555434977a2fSmrg match_pattern*) 555534977a2fSmrg set dummy $deplibs_check_method; shift 555634977a2fSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 5557b425557eSmrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 555834977a2fSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 555934977a2fSmrg valid_a_lib=yes 556034977a2fSmrg fi 556134977a2fSmrg ;; 556234977a2fSmrg pass_all) 556334977a2fSmrg valid_a_lib=yes 556434977a2fSmrg ;; 556534977a2fSmrg esac 556634977a2fSmrg if test "$valid_a_lib" != yes; then 5567b425557eSmrg echo 556834977a2fSmrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 5569b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 5570b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 5571b425557eSmrg echo "*** shared version of the library, which you do not appear to have" 5572b425557eSmrg echo "*** because the file extensions .$libext of this argument makes me believe" 5573b425557eSmrg echo "*** that it is just a static archive that I should not use here." 557434977a2fSmrg else 5575b425557eSmrg echo 557634977a2fSmrg $ECHO "*** Warning: Linking the shared library $output against the" 557734977a2fSmrg $ECHO "*** static library $deplib is not portable!" 557834977a2fSmrg deplibs="$deplib $deplibs" 557934977a2fSmrg fi 558034977a2fSmrg ;; 558134977a2fSmrg esac 558234977a2fSmrg continue 558334977a2fSmrg ;; 558434977a2fSmrg prog) 558534977a2fSmrg if test "$pass" != link; then 558634977a2fSmrg deplibs="$deplib $deplibs" 558734977a2fSmrg else 558834977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 558934977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 559034977a2fSmrg fi 559134977a2fSmrg continue 559234977a2fSmrg ;; 559334977a2fSmrg esac # linkmode 559434977a2fSmrg ;; # *.$libext 559534977a2fSmrg *.lo | *.$objext) 559634977a2fSmrg if test "$pass" = conv; then 559734977a2fSmrg deplibs="$deplib $deplibs" 559834977a2fSmrg elif test "$linkmode" = prog; then 559934977a2fSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 560034977a2fSmrg # If there is no dlopen support or we're linking statically, 560134977a2fSmrg # we need to preload. 560234977a2fSmrg newdlprefiles="$newdlprefiles $deplib" 560334977a2fSmrg compile_deplibs="$deplib $compile_deplibs" 560434977a2fSmrg finalize_deplibs="$deplib $finalize_deplibs" 560534977a2fSmrg else 560634977a2fSmrg newdlfiles="$newdlfiles $deplib" 560734977a2fSmrg fi 560834977a2fSmrg fi 560934977a2fSmrg continue 561034977a2fSmrg ;; 561134977a2fSmrg %DEPLIBS%) 561234977a2fSmrg alldeplibs=yes 561334977a2fSmrg continue 561434977a2fSmrg ;; 561534977a2fSmrg esac # case $deplib 561634977a2fSmrg 561734977a2fSmrg if test "$found" = yes || test -f "$lib"; then : 561834977a2fSmrg else 561934977a2fSmrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 562034977a2fSmrg fi 562134977a2fSmrg 562234977a2fSmrg # Check to see that this really is a libtool archive. 562334977a2fSmrg func_lalib_unsafe_p "$lib" \ 562434977a2fSmrg || func_fatal_error "\`$lib' is not a valid libtool archive" 562534977a2fSmrg 562634977a2fSmrg func_dirname "$lib" "" "." 562734977a2fSmrg ladir="$func_dirname_result" 562834977a2fSmrg 562934977a2fSmrg dlname= 563034977a2fSmrg dlopen= 563134977a2fSmrg dlpreopen= 563234977a2fSmrg libdir= 563334977a2fSmrg library_names= 563434977a2fSmrg old_library= 563534977a2fSmrg inherited_linker_flags= 563634977a2fSmrg # If the library was installed with an old release of libtool, 563734977a2fSmrg # it will not redefine variables installed, or shouldnotlink 563834977a2fSmrg installed=yes 563934977a2fSmrg shouldnotlink=no 564034977a2fSmrg avoidtemprpath= 564134977a2fSmrg 564234977a2fSmrg 564334977a2fSmrg # Read the .la file 564434977a2fSmrg func_source "$lib" 564534977a2fSmrg 564634977a2fSmrg # Convert "-framework foo" to "foo.ltframework" 564734977a2fSmrg if test -n "$inherited_linker_flags"; then 5648b425557eSmrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 564934977a2fSmrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 565034977a2fSmrg case " $new_inherited_linker_flags " in 565134977a2fSmrg *" $tmp_inherited_linker_flag "*) ;; 565234977a2fSmrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 565334977a2fSmrg esac 565434977a2fSmrg done 565534977a2fSmrg fi 5656b425557eSmrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 565734977a2fSmrg if test "$linkmode,$pass" = "lib,link" || 565834977a2fSmrg test "$linkmode,$pass" = "prog,scan" || 565934977a2fSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 566034977a2fSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 566134977a2fSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 566234977a2fSmrg fi 566334977a2fSmrg 566434977a2fSmrg if test "$pass" = conv; then 566534977a2fSmrg # Only check for convenience libraries 566634977a2fSmrg deplibs="$lib $deplibs" 566734977a2fSmrg if test -z "$libdir"; then 566834977a2fSmrg if test -z "$old_library"; then 566934977a2fSmrg func_fatal_error "cannot find name of link library for \`$lib'" 567034977a2fSmrg fi 567134977a2fSmrg # It is a libtool convenience library, so add in its objects. 567234977a2fSmrg convenience="$convenience $ladir/$objdir/$old_library" 567334977a2fSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 567434977a2fSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 567534977a2fSmrg func_fatal_error "\`$lib' is not a convenience library" 567634977a2fSmrg fi 567734977a2fSmrg tmp_libs= 567834977a2fSmrg for deplib in $dependency_libs; do 567934977a2fSmrg deplibs="$deplib $deplibs" 568034977a2fSmrg if $opt_duplicate_deps ; then 568134977a2fSmrg case "$tmp_libs " in 568234977a2fSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 568334977a2fSmrg esac 568434977a2fSmrg fi 568534977a2fSmrg tmp_libs="$tmp_libs $deplib" 568634977a2fSmrg done 568734977a2fSmrg continue 568834977a2fSmrg fi # $pass = conv 568934977a2fSmrg 569034977a2fSmrg 569134977a2fSmrg # Get the name of the library we link against. 569234977a2fSmrg linklib= 569334977a2fSmrg for l in $old_library $library_names; do 569434977a2fSmrg linklib="$l" 569534977a2fSmrg done 569634977a2fSmrg if test -z "$linklib"; then 569734977a2fSmrg func_fatal_error "cannot find name of link library for \`$lib'" 569834977a2fSmrg fi 569934977a2fSmrg 570034977a2fSmrg # This library was specified with -dlopen. 570134977a2fSmrg if test "$pass" = dlopen; then 570234977a2fSmrg if test -z "$libdir"; then 570334977a2fSmrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 570434977a2fSmrg fi 570534977a2fSmrg if test -z "$dlname" || 570634977a2fSmrg test "$dlopen_support" != yes || 570734977a2fSmrg test "$build_libtool_libs" = no; then 570834977a2fSmrg # If there is no dlname, no dlopen support or we're linking 570934977a2fSmrg # statically, we need to preload. We also need to preload any 571034977a2fSmrg # dependent libraries so libltdl's deplib preloader doesn't 571134977a2fSmrg # bomb out in the load deplibs phase. 571234977a2fSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 571334977a2fSmrg else 571434977a2fSmrg newdlfiles="$newdlfiles $lib" 571534977a2fSmrg fi 571634977a2fSmrg continue 571734977a2fSmrg fi # $pass = dlopen 571834977a2fSmrg 571934977a2fSmrg # We need an absolute path. 572034977a2fSmrg case $ladir in 572134977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 572234977a2fSmrg *) 572334977a2fSmrg abs_ladir=`cd "$ladir" && pwd` 572434977a2fSmrg if test -z "$abs_ladir"; then 572534977a2fSmrg func_warning "cannot determine absolute directory name of \`$ladir'" 572634977a2fSmrg func_warning "passing it literally to the linker, although it might fail" 572734977a2fSmrg abs_ladir="$ladir" 572834977a2fSmrg fi 572934977a2fSmrg ;; 573034977a2fSmrg esac 573134977a2fSmrg func_basename "$lib" 573234977a2fSmrg laname="$func_basename_result" 573334977a2fSmrg 573434977a2fSmrg # Find the relevant object directory and library name. 573534977a2fSmrg if test "X$installed" = Xyes; then 573634977a2fSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 573734977a2fSmrg func_warning "library \`$lib' was moved." 573834977a2fSmrg dir="$ladir" 573934977a2fSmrg absdir="$abs_ladir" 574034977a2fSmrg libdir="$abs_ladir" 574134977a2fSmrg else 574234977a2fSmrg dir="$libdir" 574334977a2fSmrg absdir="$libdir" 574434977a2fSmrg fi 574534977a2fSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 574634977a2fSmrg else 574734977a2fSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 574834977a2fSmrg dir="$ladir" 574934977a2fSmrg absdir="$abs_ladir" 575034977a2fSmrg # Remove this search path later 575134977a2fSmrg notinst_path="$notinst_path $abs_ladir" 575234977a2fSmrg else 575334977a2fSmrg dir="$ladir/$objdir" 575434977a2fSmrg absdir="$abs_ladir/$objdir" 575534977a2fSmrg # Remove this search path later 575634977a2fSmrg notinst_path="$notinst_path $abs_ladir" 575734977a2fSmrg fi 575834977a2fSmrg fi # $installed = yes 575934977a2fSmrg func_stripname 'lib' '.la' "$laname" 576034977a2fSmrg name=$func_stripname_result 576134977a2fSmrg 576234977a2fSmrg # This library was specified with -dlpreopen. 576334977a2fSmrg if test "$pass" = dlpreopen; then 576434977a2fSmrg if test -z "$libdir" && test "$linkmode" = prog; then 576534977a2fSmrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 576634977a2fSmrg fi 576734977a2fSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 576834977a2fSmrg # are required to link). 576934977a2fSmrg if test -n "$old_library"; then 577034977a2fSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 577134977a2fSmrg # Keep a list of preopened convenience libraries to check 577234977a2fSmrg # that they are being used correctly in the link pass. 577334977a2fSmrg test -z "$libdir" && \ 577434977a2fSmrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 577534977a2fSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 577634977a2fSmrg elif test -n "$dlname"; then 577734977a2fSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 577834977a2fSmrg else 577934977a2fSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 578034977a2fSmrg fi 578134977a2fSmrg fi # $pass = dlpreopen 578234977a2fSmrg 578334977a2fSmrg if test -z "$libdir"; then 578434977a2fSmrg # Link the convenience library 578534977a2fSmrg if test "$linkmode" = lib; then 578634977a2fSmrg deplibs="$dir/$old_library $deplibs" 578734977a2fSmrg elif test "$linkmode,$pass" = "prog,link"; then 578834977a2fSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 578934977a2fSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 579034977a2fSmrg else 579134977a2fSmrg deplibs="$lib $deplibs" # used for prog,scan pass 579234977a2fSmrg fi 579334977a2fSmrg continue 579434977a2fSmrg fi 579534977a2fSmrg 579634977a2fSmrg 579734977a2fSmrg if test "$linkmode" = prog && test "$pass" != link; then 579834977a2fSmrg newlib_search_path="$newlib_search_path $ladir" 579934977a2fSmrg deplibs="$lib $deplibs" 580034977a2fSmrg 580134977a2fSmrg linkalldeplibs=no 580234977a2fSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 580334977a2fSmrg test "$build_libtool_libs" = no; then 580434977a2fSmrg linkalldeplibs=yes 580534977a2fSmrg fi 580634977a2fSmrg 580734977a2fSmrg tmp_libs= 580834977a2fSmrg for deplib in $dependency_libs; do 580934977a2fSmrg case $deplib in 581034977a2fSmrg -L*) func_stripname '-L' '' "$deplib" 581134977a2fSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 581234977a2fSmrg ;; 581334977a2fSmrg esac 581434977a2fSmrg # Need to link against all dependency_libs? 581534977a2fSmrg if test "$linkalldeplibs" = yes; then 581634977a2fSmrg deplibs="$deplib $deplibs" 581734977a2fSmrg else 581834977a2fSmrg # Need to hardcode shared library paths 581934977a2fSmrg # or/and link against static libraries 582034977a2fSmrg newdependency_libs="$deplib $newdependency_libs" 582134977a2fSmrg fi 582234977a2fSmrg if $opt_duplicate_deps ; then 582334977a2fSmrg case "$tmp_libs " in 582434977a2fSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 582534977a2fSmrg esac 582634977a2fSmrg fi 582734977a2fSmrg tmp_libs="$tmp_libs $deplib" 582834977a2fSmrg done # for deplib 582934977a2fSmrg continue 583034977a2fSmrg fi # $linkmode = prog... 583134977a2fSmrg 583234977a2fSmrg if test "$linkmode,$pass" = "prog,link"; then 583334977a2fSmrg if test -n "$library_names" && 583434977a2fSmrg { { test "$prefer_static_libs" = no || 583534977a2fSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 583634977a2fSmrg test -z "$old_library"; }; then 583734977a2fSmrg # We need to hardcode the library path 583834977a2fSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 583934977a2fSmrg # Make sure the rpath contains only unique directories. 584034977a2fSmrg case "$temp_rpath:" in 584134977a2fSmrg *"$absdir:"*) ;; 584234977a2fSmrg *) temp_rpath="$temp_rpath$absdir:" ;; 584334977a2fSmrg esac 584434977a2fSmrg fi 584534977a2fSmrg 584634977a2fSmrg # Hardcode the library path. 584734977a2fSmrg # Skip directories that are in the system default run-time 584834977a2fSmrg # search path. 584934977a2fSmrg case " $sys_lib_dlsearch_path " in 585034977a2fSmrg *" $absdir "*) ;; 585134977a2fSmrg *) 585234977a2fSmrg case "$compile_rpath " in 585334977a2fSmrg *" $absdir "*) ;; 585434977a2fSmrg *) compile_rpath="$compile_rpath $absdir" 585534977a2fSmrg esac 585634977a2fSmrg ;; 585734977a2fSmrg esac 585834977a2fSmrg case " $sys_lib_dlsearch_path " in 585934977a2fSmrg *" $libdir "*) ;; 586034977a2fSmrg *) 586134977a2fSmrg case "$finalize_rpath " in 586234977a2fSmrg *" $libdir "*) ;; 586334977a2fSmrg *) finalize_rpath="$finalize_rpath $libdir" 586434977a2fSmrg esac 586534977a2fSmrg ;; 586634977a2fSmrg esac 586734977a2fSmrg fi # $linkmode,$pass = prog,link... 586834977a2fSmrg 586934977a2fSmrg if test "$alldeplibs" = yes && 587034977a2fSmrg { test "$deplibs_check_method" = pass_all || 587134977a2fSmrg { test "$build_libtool_libs" = yes && 587234977a2fSmrg test -n "$library_names"; }; }; then 587334977a2fSmrg # We only need to search for static libraries 587434977a2fSmrg continue 587534977a2fSmrg fi 587634977a2fSmrg fi 587734977a2fSmrg 587834977a2fSmrg link_static=no # Whether the deplib will be linked statically 587934977a2fSmrg use_static_libs=$prefer_static_libs 588034977a2fSmrg if test "$use_static_libs" = built && test "$installed" = yes; then 588134977a2fSmrg use_static_libs=no 588234977a2fSmrg fi 588334977a2fSmrg if test -n "$library_names" && 588434977a2fSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 588534977a2fSmrg case $host in 588634977a2fSmrg *cygwin* | *mingw* | *cegcc*) 588734977a2fSmrg # No point in relinking DLLs because paths are not encoded 588834977a2fSmrg notinst_deplibs="$notinst_deplibs $lib" 588934977a2fSmrg need_relink=no 589034977a2fSmrg ;; 589134977a2fSmrg *) 589234977a2fSmrg if test "$installed" = no; then 589334977a2fSmrg notinst_deplibs="$notinst_deplibs $lib" 589434977a2fSmrg need_relink=yes 589534977a2fSmrg fi 589634977a2fSmrg ;; 589734977a2fSmrg esac 589834977a2fSmrg # This is a shared library 589934977a2fSmrg 590034977a2fSmrg # Warn about portability, can't link against -module's on some 590134977a2fSmrg # systems (darwin). Don't bleat about dlopened modules though! 590234977a2fSmrg dlopenmodule="" 590334977a2fSmrg for dlpremoduletest in $dlprefiles; do 590434977a2fSmrg if test "X$dlpremoduletest" = "X$lib"; then 590534977a2fSmrg dlopenmodule="$dlpremoduletest" 590634977a2fSmrg break 590734977a2fSmrg fi 590834977a2fSmrg done 590934977a2fSmrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 5910b425557eSmrg echo 591134977a2fSmrg if test "$linkmode" = prog; then 591234977a2fSmrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 591334977a2fSmrg else 591434977a2fSmrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 591534977a2fSmrg fi 591634977a2fSmrg $ECHO "*** $linklib is not portable!" 591734977a2fSmrg fi 591834977a2fSmrg if test "$linkmode" = lib && 591934977a2fSmrg test "$hardcode_into_libs" = yes; then 592034977a2fSmrg # Hardcode the library path. 592134977a2fSmrg # Skip directories that are in the system default run-time 592234977a2fSmrg # search path. 592334977a2fSmrg case " $sys_lib_dlsearch_path " in 592434977a2fSmrg *" $absdir "*) ;; 592534977a2fSmrg *) 592634977a2fSmrg case "$compile_rpath " in 592734977a2fSmrg *" $absdir "*) ;; 592834977a2fSmrg *) compile_rpath="$compile_rpath $absdir" 592934977a2fSmrg esac 593034977a2fSmrg ;; 593134977a2fSmrg esac 593234977a2fSmrg case " $sys_lib_dlsearch_path " in 593334977a2fSmrg *" $libdir "*) ;; 593434977a2fSmrg *) 593534977a2fSmrg case "$finalize_rpath " in 593634977a2fSmrg *" $libdir "*) ;; 593734977a2fSmrg *) finalize_rpath="$finalize_rpath $libdir" 593834977a2fSmrg esac 593934977a2fSmrg ;; 594034977a2fSmrg esac 594134977a2fSmrg fi 594234977a2fSmrg 594334977a2fSmrg if test -n "$old_archive_from_expsyms_cmds"; then 594434977a2fSmrg # figure out the soname 594534977a2fSmrg set dummy $library_names 594634977a2fSmrg shift 594734977a2fSmrg realname="$1" 594834977a2fSmrg shift 594934977a2fSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 595034977a2fSmrg # use dlname if we got it. it's perfectly good, no? 595134977a2fSmrg if test -n "$dlname"; then 595234977a2fSmrg soname="$dlname" 595334977a2fSmrg elif test -n "$soname_spec"; then 595434977a2fSmrg # bleh windows 595534977a2fSmrg case $host in 595634977a2fSmrg *cygwin* | mingw* | *cegcc*) 595734977a2fSmrg func_arith $current - $age 595834977a2fSmrg major=$func_arith_result 595934977a2fSmrg versuffix="-$major" 596034977a2fSmrg ;; 596134977a2fSmrg esac 596234977a2fSmrg eval soname=\"$soname_spec\" 596334977a2fSmrg else 596434977a2fSmrg soname="$realname" 596534977a2fSmrg fi 596634977a2fSmrg 596734977a2fSmrg # Make a new name for the extract_expsyms_cmds to use 596834977a2fSmrg soroot="$soname" 596934977a2fSmrg func_basename "$soroot" 597034977a2fSmrg soname="$func_basename_result" 597134977a2fSmrg func_stripname 'lib' '.dll' "$soname" 597234977a2fSmrg newlib=libimp-$func_stripname_result.a 597334977a2fSmrg 597434977a2fSmrg # If the library has no export list, then create one now 597534977a2fSmrg if test -f "$output_objdir/$soname-def"; then : 597634977a2fSmrg else 597734977a2fSmrg func_verbose "extracting exported symbol list from \`$soname'" 597834977a2fSmrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 597934977a2fSmrg fi 598034977a2fSmrg 598134977a2fSmrg # Create $newlib 598234977a2fSmrg if test -f "$output_objdir/$newlib"; then :; else 598334977a2fSmrg func_verbose "generating import library for \`$soname'" 598434977a2fSmrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 598534977a2fSmrg fi 598634977a2fSmrg # make sure the library variables are pointing to the new library 598734977a2fSmrg dir=$output_objdir 598834977a2fSmrg linklib=$newlib 598934977a2fSmrg fi # test -n "$old_archive_from_expsyms_cmds" 599034977a2fSmrg 599134977a2fSmrg if test "$linkmode" = prog || test "$mode" != relink; then 599234977a2fSmrg add_shlibpath= 599334977a2fSmrg add_dir= 599434977a2fSmrg add= 599534977a2fSmrg lib_linked=yes 599634977a2fSmrg case $hardcode_action in 599734977a2fSmrg immediate | unsupported) 599834977a2fSmrg if test "$hardcode_direct" = no; then 599934977a2fSmrg add="$dir/$linklib" 600034977a2fSmrg case $host in 600134977a2fSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 600234977a2fSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 600334977a2fSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 600434977a2fSmrg *-*-unixware7*) add_dir="-L$dir" ;; 600534977a2fSmrg *-*-darwin* ) 600634977a2fSmrg # if the lib is a (non-dlopened) module then we can not 600734977a2fSmrg # link against it, someone is ignoring the earlier warnings 600834977a2fSmrg if /usr/bin/file -L $add 2> /dev/null | 600934977a2fSmrg $GREP ": [^:]* bundle" >/dev/null ; then 601034977a2fSmrg if test "X$dlopenmodule" != "X$lib"; then 601134977a2fSmrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 601234977a2fSmrg if test -z "$old_library" ; then 6013b425557eSmrg echo 6014b425557eSmrg echo "*** And there doesn't seem to be a static archive available" 6015b425557eSmrg echo "*** The link will probably fail, sorry" 601634977a2fSmrg else 601734977a2fSmrg add="$dir/$old_library" 601834977a2fSmrg fi 601934977a2fSmrg elif test -n "$old_library"; then 602034977a2fSmrg add="$dir/$old_library" 602134977a2fSmrg fi 602234977a2fSmrg fi 602334977a2fSmrg esac 602434977a2fSmrg elif test "$hardcode_minus_L" = no; then 602534977a2fSmrg case $host in 602634977a2fSmrg *-*-sunos*) add_shlibpath="$dir" ;; 602734977a2fSmrg esac 602834977a2fSmrg add_dir="-L$dir" 602934977a2fSmrg add="-l$name" 603034977a2fSmrg elif test "$hardcode_shlibpath_var" = no; then 603134977a2fSmrg add_shlibpath="$dir" 603234977a2fSmrg add="-l$name" 603334977a2fSmrg else 603434977a2fSmrg lib_linked=no 603534977a2fSmrg fi 603634977a2fSmrg ;; 603734977a2fSmrg relink) 603834977a2fSmrg if test "$hardcode_direct" = yes && 603934977a2fSmrg test "$hardcode_direct_absolute" = no; then 604034977a2fSmrg add="$dir/$linklib" 604134977a2fSmrg elif test "$hardcode_minus_L" = yes; then 604234977a2fSmrg add_dir="-L$dir" 604334977a2fSmrg # Try looking first in the location we're being installed to. 604434977a2fSmrg if test -n "$inst_prefix_dir"; then 604534977a2fSmrg case $libdir in 604634977a2fSmrg [\\/]*) 604734977a2fSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 604834977a2fSmrg ;; 604934977a2fSmrg esac 605034977a2fSmrg fi 605134977a2fSmrg add="-l$name" 605234977a2fSmrg elif test "$hardcode_shlibpath_var" = yes; then 605334977a2fSmrg add_shlibpath="$dir" 605434977a2fSmrg add="-l$name" 605534977a2fSmrg else 605634977a2fSmrg lib_linked=no 605734977a2fSmrg fi 605834977a2fSmrg ;; 605934977a2fSmrg *) lib_linked=no ;; 606034977a2fSmrg esac 606134977a2fSmrg 606234977a2fSmrg if test "$lib_linked" != yes; then 606334977a2fSmrg func_fatal_configuration "unsupported hardcode properties" 606434977a2fSmrg fi 606534977a2fSmrg 606634977a2fSmrg if test -n "$add_shlibpath"; then 606734977a2fSmrg case :$compile_shlibpath: in 606834977a2fSmrg *":$add_shlibpath:"*) ;; 606934977a2fSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 607034977a2fSmrg esac 607134977a2fSmrg fi 607234977a2fSmrg if test "$linkmode" = prog; then 607334977a2fSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 607434977a2fSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 607534977a2fSmrg else 607634977a2fSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 607734977a2fSmrg test -n "$add" && deplibs="$add $deplibs" 607834977a2fSmrg if test "$hardcode_direct" != yes && 607934977a2fSmrg test "$hardcode_minus_L" != yes && 608034977a2fSmrg test "$hardcode_shlibpath_var" = yes; then 608134977a2fSmrg case :$finalize_shlibpath: in 608234977a2fSmrg *":$libdir:"*) ;; 608334977a2fSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 608434977a2fSmrg esac 608534977a2fSmrg fi 608634977a2fSmrg fi 608734977a2fSmrg fi 608834977a2fSmrg 608934977a2fSmrg if test "$linkmode" = prog || test "$mode" = relink; then 609034977a2fSmrg add_shlibpath= 609134977a2fSmrg add_dir= 609234977a2fSmrg add= 609334977a2fSmrg # Finalize command for both is simple: just hardcode it. 609434977a2fSmrg if test "$hardcode_direct" = yes && 609534977a2fSmrg test "$hardcode_direct_absolute" = no; then 609634977a2fSmrg add="$libdir/$linklib" 609734977a2fSmrg elif test "$hardcode_minus_L" = yes; then 609834977a2fSmrg add_dir="-L$libdir" 609934977a2fSmrg add="-l$name" 610034977a2fSmrg elif test "$hardcode_shlibpath_var" = yes; then 610134977a2fSmrg case :$finalize_shlibpath: in 610234977a2fSmrg *":$libdir:"*) ;; 610334977a2fSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 610434977a2fSmrg esac 610534977a2fSmrg add="-l$name" 610634977a2fSmrg elif test "$hardcode_automatic" = yes; then 610734977a2fSmrg if test -n "$inst_prefix_dir" && 610834977a2fSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 610934977a2fSmrg add="$inst_prefix_dir$libdir/$linklib" 611034977a2fSmrg else 611134977a2fSmrg add="$libdir/$linklib" 611234977a2fSmrg fi 611334977a2fSmrg else 611434977a2fSmrg # We cannot seem to hardcode it, guess we'll fake it. 611534977a2fSmrg add_dir="-L$libdir" 611634977a2fSmrg # Try looking first in the location we're being installed to. 611734977a2fSmrg if test -n "$inst_prefix_dir"; then 611834977a2fSmrg case $libdir in 611934977a2fSmrg [\\/]*) 612034977a2fSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 612134977a2fSmrg ;; 612234977a2fSmrg esac 612334977a2fSmrg fi 612434977a2fSmrg add="-l$name" 612534977a2fSmrg fi 612634977a2fSmrg 612734977a2fSmrg if test "$linkmode" = prog; then 612834977a2fSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 612934977a2fSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 613034977a2fSmrg else 613134977a2fSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 613234977a2fSmrg test -n "$add" && deplibs="$add $deplibs" 613334977a2fSmrg fi 613434977a2fSmrg fi 613534977a2fSmrg elif test "$linkmode" = prog; then 613634977a2fSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 613734977a2fSmrg # is not unsupported. This is valid on all known static and 613834977a2fSmrg # shared platforms. 613934977a2fSmrg if test "$hardcode_direct" != unsupported; then 614034977a2fSmrg test -n "$old_library" && linklib="$old_library" 614134977a2fSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 614234977a2fSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 614334977a2fSmrg else 614434977a2fSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 614534977a2fSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 614634977a2fSmrg fi 614734977a2fSmrg elif test "$build_libtool_libs" = yes; then 614834977a2fSmrg # Not a shared library 614934977a2fSmrg if test "$deplibs_check_method" != pass_all; then 615034977a2fSmrg # We're trying link a shared library against a static one 615134977a2fSmrg # but the system doesn't support it. 615234977a2fSmrg 615334977a2fSmrg # Just print a warning and add the library to dependency_libs so 615434977a2fSmrg # that the program can be linked against the static library. 6155b425557eSmrg echo 615634977a2fSmrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 6157b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 6158b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 6159b425557eSmrg echo "*** shared version of the library, which you do not appear to have." 616034977a2fSmrg if test "$module" = yes; then 6161b425557eSmrg echo "*** But as you try to build a module library, libtool will still create " 6162b425557eSmrg echo "*** a static module, that should work as long as the dlopening application" 6163b425557eSmrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 616434977a2fSmrg if test -z "$global_symbol_pipe"; then 6165b425557eSmrg echo 6166b425557eSmrg echo "*** However, this would only work if libtool was able to extract symbol" 6167b425557eSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6168b425557eSmrg echo "*** not find such a program. So, this module is probably useless." 6169b425557eSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 617034977a2fSmrg fi 617134977a2fSmrg if test "$build_old_libs" = no; then 617234977a2fSmrg build_libtool_libs=module 617334977a2fSmrg build_old_libs=yes 617434977a2fSmrg else 617534977a2fSmrg build_libtool_libs=no 617634977a2fSmrg fi 617734977a2fSmrg fi 617834977a2fSmrg else 617934977a2fSmrg deplibs="$dir/$old_library $deplibs" 618034977a2fSmrg link_static=yes 618134977a2fSmrg fi 618234977a2fSmrg fi # link shared/static library? 618334977a2fSmrg 618434977a2fSmrg if test "$linkmode" = lib; then 618534977a2fSmrg if test -n "$dependency_libs" && 618634977a2fSmrg { test "$hardcode_into_libs" != yes || 618734977a2fSmrg test "$build_old_libs" = yes || 618834977a2fSmrg test "$link_static" = yes; }; then 618934977a2fSmrg # Extract -R from dependency_libs 619034977a2fSmrg temp_deplibs= 619134977a2fSmrg for libdir in $dependency_libs; do 619234977a2fSmrg case $libdir in 619334977a2fSmrg -R*) func_stripname '-R' '' "$libdir" 619434977a2fSmrg temp_xrpath=$func_stripname_result 619534977a2fSmrg case " $xrpath " in 619634977a2fSmrg *" $temp_xrpath "*) ;; 619734977a2fSmrg *) xrpath="$xrpath $temp_xrpath";; 619834977a2fSmrg esac;; 619934977a2fSmrg *) temp_deplibs="$temp_deplibs $libdir";; 620034977a2fSmrg esac 620134977a2fSmrg done 620234977a2fSmrg dependency_libs="$temp_deplibs" 620334977a2fSmrg fi 620434977a2fSmrg 620534977a2fSmrg newlib_search_path="$newlib_search_path $absdir" 620634977a2fSmrg # Link against this library 620734977a2fSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 620834977a2fSmrg # ... and its dependency_libs 620934977a2fSmrg tmp_libs= 621034977a2fSmrg for deplib in $dependency_libs; do 621134977a2fSmrg newdependency_libs="$deplib $newdependency_libs" 621234977a2fSmrg if $opt_duplicate_deps ; then 621334977a2fSmrg case "$tmp_libs " in 621434977a2fSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 621534977a2fSmrg esac 621634977a2fSmrg fi 621734977a2fSmrg tmp_libs="$tmp_libs $deplib" 621834977a2fSmrg done 621934977a2fSmrg 622034977a2fSmrg if test "$link_all_deplibs" != no; then 622134977a2fSmrg # Add the search paths of all dependency libraries 622234977a2fSmrg for deplib in $dependency_libs; do 6223b425557eSmrg path= 622434977a2fSmrg case $deplib in 622534977a2fSmrg -L*) path="$deplib" ;; 622634977a2fSmrg *.la) 622734977a2fSmrg func_dirname "$deplib" "" "." 622834977a2fSmrg dir="$func_dirname_result" 622934977a2fSmrg # We need an absolute path. 623034977a2fSmrg case $dir in 623134977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 623234977a2fSmrg *) 623334977a2fSmrg absdir=`cd "$dir" && pwd` 623434977a2fSmrg if test -z "$absdir"; then 623534977a2fSmrg func_warning "cannot determine absolute directory name of \`$dir'" 623634977a2fSmrg absdir="$dir" 623734977a2fSmrg fi 623834977a2fSmrg ;; 623934977a2fSmrg esac 624034977a2fSmrg if $GREP "^installed=no" $deplib > /dev/null; then 624134977a2fSmrg case $host in 624234977a2fSmrg *-*-darwin*) 624334977a2fSmrg depdepl= 624434977a2fSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 624534977a2fSmrg if test -n "$deplibrary_names" ; then 624634977a2fSmrg for tmp in $deplibrary_names ; do 624734977a2fSmrg depdepl=$tmp 624834977a2fSmrg done 624934977a2fSmrg if test -f "$absdir/$objdir/$depdepl" ; then 625034977a2fSmrg depdepl="$absdir/$objdir/$depdepl" 625134977a2fSmrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625234977a2fSmrg if test -z "$darwin_install_name"; then 625334977a2fSmrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 625434977a2fSmrg fi 625534977a2fSmrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 625634977a2fSmrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 625734977a2fSmrg path= 625834977a2fSmrg fi 625934977a2fSmrg fi 626034977a2fSmrg ;; 626134977a2fSmrg *) 626234977a2fSmrg path="-L$absdir/$objdir" 626334977a2fSmrg ;; 626434977a2fSmrg esac 626534977a2fSmrg else 626634977a2fSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 626734977a2fSmrg test -z "$libdir" && \ 626834977a2fSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 626934977a2fSmrg test "$absdir" != "$libdir" && \ 627034977a2fSmrg func_warning "\`$deplib' seems to be moved" 627134977a2fSmrg 627234977a2fSmrg path="-L$absdir" 627334977a2fSmrg fi 627434977a2fSmrg ;; 627534977a2fSmrg esac 627634977a2fSmrg case " $deplibs " in 627734977a2fSmrg *" $path "*) ;; 627834977a2fSmrg *) deplibs="$path $deplibs" ;; 627934977a2fSmrg esac 628034977a2fSmrg done 628134977a2fSmrg fi # link_all_deplibs != no 628234977a2fSmrg fi # linkmode = lib 628334977a2fSmrg done # for deplib in $libs 628434977a2fSmrg if test "$pass" = link; then 628534977a2fSmrg if test "$linkmode" = "prog"; then 628634977a2fSmrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 628734977a2fSmrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 628834977a2fSmrg else 6289b425557eSmrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 629034977a2fSmrg fi 629134977a2fSmrg fi 629234977a2fSmrg dependency_libs="$newdependency_libs" 629334977a2fSmrg if test "$pass" = dlpreopen; then 629434977a2fSmrg # Link the dlpreopened libraries before other libraries 629534977a2fSmrg for deplib in $save_deplibs; do 629634977a2fSmrg deplibs="$deplib $deplibs" 629734977a2fSmrg done 629834977a2fSmrg fi 629934977a2fSmrg if test "$pass" != dlopen; then 630034977a2fSmrg if test "$pass" != conv; then 630134977a2fSmrg # Make sure lib_search_path contains only unique directories. 630234977a2fSmrg lib_search_path= 630334977a2fSmrg for dir in $newlib_search_path; do 630434977a2fSmrg case "$lib_search_path " in 630534977a2fSmrg *" $dir "*) ;; 630634977a2fSmrg *) lib_search_path="$lib_search_path $dir" ;; 630734977a2fSmrg esac 630834977a2fSmrg done 630934977a2fSmrg newlib_search_path= 631034977a2fSmrg fi 631134977a2fSmrg 631234977a2fSmrg if test "$linkmode,$pass" != "prog,link"; then 631334977a2fSmrg vars="deplibs" 631434977a2fSmrg else 631534977a2fSmrg vars="compile_deplibs finalize_deplibs" 631634977a2fSmrg fi 631734977a2fSmrg for var in $vars dependency_libs; do 631834977a2fSmrg # Add libraries to $var in reverse order 631934977a2fSmrg eval tmp_libs=\"\$$var\" 632034977a2fSmrg new_libs= 632134977a2fSmrg for deplib in $tmp_libs; do 632234977a2fSmrg # FIXME: Pedantically, this is the right thing to do, so 632334977a2fSmrg # that some nasty dependency loop isn't accidentally 632434977a2fSmrg # broken: 632534977a2fSmrg #new_libs="$deplib $new_libs" 632634977a2fSmrg # Pragmatically, this seems to cause very few problems in 632734977a2fSmrg # practice: 632834977a2fSmrg case $deplib in 632934977a2fSmrg -L*) new_libs="$deplib $new_libs" ;; 633034977a2fSmrg -R*) ;; 633134977a2fSmrg *) 633234977a2fSmrg # And here is the reason: when a library appears more 633334977a2fSmrg # than once as an explicit dependence of a library, or 633434977a2fSmrg # is implicitly linked in more than once by the 633534977a2fSmrg # compiler, it is considered special, and multiple 633634977a2fSmrg # occurrences thereof are not removed. Compare this 633734977a2fSmrg # with having the same library being listed as a 633834977a2fSmrg # dependency of multiple other libraries: in this case, 633934977a2fSmrg # we know (pedantically, we assume) the library does not 634034977a2fSmrg # need to be listed more than once, so we keep only the 634134977a2fSmrg # last copy. This is not always right, but it is rare 634234977a2fSmrg # enough that we require users that really mean to play 634334977a2fSmrg # such unportable linking tricks to link the library 634434977a2fSmrg # using -Wl,-lname, so that libtool does not consider it 634534977a2fSmrg # for duplicate removal. 634634977a2fSmrg case " $specialdeplibs " in 634734977a2fSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 634834977a2fSmrg *) 634934977a2fSmrg case " $new_libs " in 635034977a2fSmrg *" $deplib "*) ;; 635134977a2fSmrg *) new_libs="$deplib $new_libs" ;; 635234977a2fSmrg esac 635334977a2fSmrg ;; 635434977a2fSmrg esac 635534977a2fSmrg ;; 635634977a2fSmrg esac 635734977a2fSmrg done 635834977a2fSmrg tmp_libs= 635934977a2fSmrg for deplib in $new_libs; do 636034977a2fSmrg case $deplib in 636134977a2fSmrg -L*) 636234977a2fSmrg case " $tmp_libs " in 636334977a2fSmrg *" $deplib "*) ;; 636434977a2fSmrg *) tmp_libs="$tmp_libs $deplib" ;; 636534977a2fSmrg esac 636634977a2fSmrg ;; 636734977a2fSmrg *) tmp_libs="$tmp_libs $deplib" ;; 636834977a2fSmrg esac 636934977a2fSmrg done 637034977a2fSmrg eval $var=\"$tmp_libs\" 637134977a2fSmrg done # for var 637234977a2fSmrg fi 637334977a2fSmrg # Last step: remove runtime libs from dependency_libs 637434977a2fSmrg # (they stay in deplibs) 637534977a2fSmrg tmp_libs= 637634977a2fSmrg for i in $dependency_libs ; do 637734977a2fSmrg case " $predeps $postdeps $compiler_lib_search_path " in 637834977a2fSmrg *" $i "*) 637934977a2fSmrg i="" 638034977a2fSmrg ;; 638134977a2fSmrg esac 638234977a2fSmrg if test -n "$i" ; then 638334977a2fSmrg tmp_libs="$tmp_libs $i" 638434977a2fSmrg fi 638534977a2fSmrg done 638634977a2fSmrg dependency_libs=$tmp_libs 638734977a2fSmrg done # for pass 638834977a2fSmrg if test "$linkmode" = prog; then 638934977a2fSmrg dlfiles="$newdlfiles" 639034977a2fSmrg fi 639134977a2fSmrg if test "$linkmode" = prog || test "$linkmode" = lib; then 639234977a2fSmrg dlprefiles="$newdlprefiles" 639334977a2fSmrg fi 639434977a2fSmrg 639534977a2fSmrg case $linkmode in 639634977a2fSmrg oldlib) 639734977a2fSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 639834977a2fSmrg func_warning "\`-dlopen' is ignored for archives" 639934977a2fSmrg fi 640034977a2fSmrg 640134977a2fSmrg case " $deplibs" in 640234977a2fSmrg *\ -l* | *\ -L*) 640334977a2fSmrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 640434977a2fSmrg esac 640534977a2fSmrg 640634977a2fSmrg test -n "$rpath" && \ 640734977a2fSmrg func_warning "\`-rpath' is ignored for archives" 640834977a2fSmrg 640934977a2fSmrg test -n "$xrpath" && \ 641034977a2fSmrg func_warning "\`-R' is ignored for archives" 641134977a2fSmrg 641234977a2fSmrg test -n "$vinfo" && \ 641334977a2fSmrg func_warning "\`-version-info/-version-number' is ignored for archives" 641434977a2fSmrg 641534977a2fSmrg test -n "$release" && \ 641634977a2fSmrg func_warning "\`-release' is ignored for archives" 641734977a2fSmrg 641834977a2fSmrg test -n "$export_symbols$export_symbols_regex" && \ 641934977a2fSmrg func_warning "\`-export-symbols' is ignored for archives" 642034977a2fSmrg 642134977a2fSmrg # Now set the variables for building old libraries. 642234977a2fSmrg build_libtool_libs=no 642334977a2fSmrg oldlibs="$output" 642434977a2fSmrg objs="$objs$old_deplibs" 642534977a2fSmrg ;; 642634977a2fSmrg 642734977a2fSmrg lib) 642834977a2fSmrg # Make sure we only generate libraries of the form `libNAME.la'. 642934977a2fSmrg case $outputname in 643034977a2fSmrg lib*) 643134977a2fSmrg func_stripname 'lib' '.la' "$outputname" 643234977a2fSmrg name=$func_stripname_result 643334977a2fSmrg eval shared_ext=\"$shrext_cmds\" 643434977a2fSmrg eval libname=\"$libname_spec\" 643534977a2fSmrg ;; 643634977a2fSmrg *) 643734977a2fSmrg test "$module" = no && \ 643834977a2fSmrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 643934977a2fSmrg 644034977a2fSmrg if test "$need_lib_prefix" != no; then 644134977a2fSmrg # Add the "lib" prefix for modules if required 644234977a2fSmrg func_stripname '' '.la' "$outputname" 644334977a2fSmrg name=$func_stripname_result 644434977a2fSmrg eval shared_ext=\"$shrext_cmds\" 644534977a2fSmrg eval libname=\"$libname_spec\" 644634977a2fSmrg else 644734977a2fSmrg func_stripname '' '.la' "$outputname" 644834977a2fSmrg libname=$func_stripname_result 644934977a2fSmrg fi 645034977a2fSmrg ;; 645134977a2fSmrg esac 645234977a2fSmrg 645334977a2fSmrg if test -n "$objs"; then 645434977a2fSmrg if test "$deplibs_check_method" != pass_all; then 645534977a2fSmrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 645634977a2fSmrg else 6457b425557eSmrg echo 645834977a2fSmrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 645934977a2fSmrg $ECHO "*** objects $objs is not portable!" 646034977a2fSmrg libobjs="$libobjs $objs" 646134977a2fSmrg fi 646234977a2fSmrg fi 646334977a2fSmrg 646434977a2fSmrg test "$dlself" != no && \ 646534977a2fSmrg func_warning "\`-dlopen self' is ignored for libtool libraries" 646634977a2fSmrg 646734977a2fSmrg set dummy $rpath 646834977a2fSmrg shift 646934977a2fSmrg test "$#" -gt 1 && \ 647034977a2fSmrg func_warning "ignoring multiple \`-rpath's for a libtool library" 647134977a2fSmrg 647234977a2fSmrg install_libdir="$1" 647334977a2fSmrg 647434977a2fSmrg oldlibs= 647534977a2fSmrg if test -z "$rpath"; then 647634977a2fSmrg if test "$build_libtool_libs" = yes; then 647734977a2fSmrg # Building a libtool convenience library. 647834977a2fSmrg # Some compilers have problems with a `.al' extension so 647934977a2fSmrg # convenience libraries should have the same extension an 648034977a2fSmrg # archive normally would. 648134977a2fSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 648234977a2fSmrg build_libtool_libs=convenience 648334977a2fSmrg build_old_libs=yes 648434977a2fSmrg fi 648534977a2fSmrg 648634977a2fSmrg test -n "$vinfo" && \ 648734977a2fSmrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 648834977a2fSmrg 648934977a2fSmrg test -n "$release" && \ 649034977a2fSmrg func_warning "\`-release' is ignored for convenience libraries" 649134977a2fSmrg else 649234977a2fSmrg 649334977a2fSmrg # Parse the version information argument. 649434977a2fSmrg save_ifs="$IFS"; IFS=':' 649534977a2fSmrg set dummy $vinfo 0 0 0 649634977a2fSmrg shift 649734977a2fSmrg IFS="$save_ifs" 649834977a2fSmrg 649934977a2fSmrg test -n "$7" && \ 650034977a2fSmrg func_fatal_help "too many parameters to \`-version-info'" 650134977a2fSmrg 650234977a2fSmrg # convert absolute version numbers to libtool ages 650334977a2fSmrg # this retains compatibility with .la files and attempts 650434977a2fSmrg # to make the code below a bit more comprehensible 650534977a2fSmrg 650634977a2fSmrg case $vinfo_number in 650734977a2fSmrg yes) 650834977a2fSmrg number_major="$1" 650934977a2fSmrg number_minor="$2" 651034977a2fSmrg number_revision="$3" 651134977a2fSmrg # 651234977a2fSmrg # There are really only two kinds -- those that 651334977a2fSmrg # use the current revision as the major version 651434977a2fSmrg # and those that subtract age and use age as 651534977a2fSmrg # a minor version. But, then there is irix 651634977a2fSmrg # which has an extra 1 added just for fun 651734977a2fSmrg # 651834977a2fSmrg case $version_type in 651934977a2fSmrg darwin|linux|osf|windows|none) 652034977a2fSmrg func_arith $number_major + $number_minor 652134977a2fSmrg current=$func_arith_result 652234977a2fSmrg age="$number_minor" 652334977a2fSmrg revision="$number_revision" 652434977a2fSmrg ;; 6525b425557eSmrg freebsd-aout|freebsd-elf|qnx|sunos) 652634977a2fSmrg current="$number_major" 652734977a2fSmrg revision="$number_minor" 652834977a2fSmrg age="0" 652934977a2fSmrg ;; 653034977a2fSmrg irix|nonstopux) 653134977a2fSmrg func_arith $number_major + $number_minor 653234977a2fSmrg current=$func_arith_result 653334977a2fSmrg age="$number_minor" 653434977a2fSmrg revision="$number_minor" 653534977a2fSmrg lt_irix_increment=no 653634977a2fSmrg ;; 653734977a2fSmrg esac 653834977a2fSmrg ;; 653934977a2fSmrg no) 654034977a2fSmrg current="$1" 654134977a2fSmrg revision="$2" 654234977a2fSmrg age="$3" 654334977a2fSmrg ;; 654434977a2fSmrg esac 654534977a2fSmrg 654634977a2fSmrg # Check that each of the things are valid numbers. 654734977a2fSmrg case $current in 654834977a2fSmrg 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]) ;; 654934977a2fSmrg *) 655034977a2fSmrg func_error "CURRENT \`$current' must be a nonnegative integer" 655134977a2fSmrg func_fatal_error "\`$vinfo' is not valid version information" 655234977a2fSmrg ;; 655334977a2fSmrg esac 655434977a2fSmrg 655534977a2fSmrg case $revision in 655634977a2fSmrg 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]) ;; 655734977a2fSmrg *) 655834977a2fSmrg func_error "REVISION \`$revision' must be a nonnegative integer" 655934977a2fSmrg func_fatal_error "\`$vinfo' is not valid version information" 656034977a2fSmrg ;; 656134977a2fSmrg esac 656234977a2fSmrg 656334977a2fSmrg case $age in 656434977a2fSmrg 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]) ;; 656534977a2fSmrg *) 656634977a2fSmrg func_error "AGE \`$age' must be a nonnegative integer" 656734977a2fSmrg func_fatal_error "\`$vinfo' is not valid version information" 656834977a2fSmrg ;; 656934977a2fSmrg esac 657034977a2fSmrg 657134977a2fSmrg if test "$age" -gt "$current"; then 657234977a2fSmrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 657334977a2fSmrg func_fatal_error "\`$vinfo' is not valid version information" 657434977a2fSmrg fi 657534977a2fSmrg 657634977a2fSmrg # Calculate the version variables. 657734977a2fSmrg major= 657834977a2fSmrg versuffix= 657934977a2fSmrg verstring= 658034977a2fSmrg case $version_type in 658134977a2fSmrg none) ;; 658234977a2fSmrg 658334977a2fSmrg darwin) 658434977a2fSmrg # Like Linux, but with the current version available in 658534977a2fSmrg # verstring for coding it into the library header 658634977a2fSmrg func_arith $current - $age 658734977a2fSmrg major=.$func_arith_result 658834977a2fSmrg versuffix="$major.$age.$revision" 658934977a2fSmrg # Darwin ld doesn't like 0 for these options... 659034977a2fSmrg func_arith $current + 1 659134977a2fSmrg minor_current=$func_arith_result 659234977a2fSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 659334977a2fSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 659434977a2fSmrg ;; 659534977a2fSmrg 659634977a2fSmrg freebsd-aout) 659734977a2fSmrg major=".$current" 659834977a2fSmrg versuffix=".$current.$revision"; 659934977a2fSmrg ;; 660034977a2fSmrg 660134977a2fSmrg freebsd-elf) 660234977a2fSmrg major=".$current" 660334977a2fSmrg versuffix=".$current" 660434977a2fSmrg ;; 660534977a2fSmrg 660634977a2fSmrg irix | nonstopux) 660734977a2fSmrg if test "X$lt_irix_increment" = "Xno"; then 660834977a2fSmrg func_arith $current - $age 660934977a2fSmrg else 661034977a2fSmrg func_arith $current - $age + 1 661134977a2fSmrg fi 661234977a2fSmrg major=$func_arith_result 661334977a2fSmrg 661434977a2fSmrg case $version_type in 661534977a2fSmrg nonstopux) verstring_prefix=nonstopux ;; 661634977a2fSmrg *) verstring_prefix=sgi ;; 661734977a2fSmrg esac 661834977a2fSmrg verstring="$verstring_prefix$major.$revision" 661934977a2fSmrg 662034977a2fSmrg # Add in all the interfaces that we are compatible with. 662134977a2fSmrg loop=$revision 662234977a2fSmrg while test "$loop" -ne 0; do 662334977a2fSmrg func_arith $revision - $loop 662434977a2fSmrg iface=$func_arith_result 662534977a2fSmrg func_arith $loop - 1 662634977a2fSmrg loop=$func_arith_result 662734977a2fSmrg verstring="$verstring_prefix$major.$iface:$verstring" 662834977a2fSmrg done 662934977a2fSmrg 663034977a2fSmrg # Before this point, $major must not contain `.'. 663134977a2fSmrg major=.$major 663234977a2fSmrg versuffix="$major.$revision" 663334977a2fSmrg ;; 663434977a2fSmrg 663534977a2fSmrg linux) 663634977a2fSmrg func_arith $current - $age 663734977a2fSmrg major=.$func_arith_result 663834977a2fSmrg versuffix="$major.$age.$revision" 663934977a2fSmrg ;; 664034977a2fSmrg 664134977a2fSmrg osf) 664234977a2fSmrg func_arith $current - $age 664334977a2fSmrg major=.$func_arith_result 664434977a2fSmrg versuffix=".$current.$age.$revision" 664534977a2fSmrg verstring="$current.$age.$revision" 664634977a2fSmrg 664734977a2fSmrg # Add in all the interfaces that we are compatible with. 664834977a2fSmrg loop=$age 664934977a2fSmrg while test "$loop" -ne 0; do 665034977a2fSmrg func_arith $current - $loop 665134977a2fSmrg iface=$func_arith_result 665234977a2fSmrg func_arith $loop - 1 665334977a2fSmrg loop=$func_arith_result 665434977a2fSmrg verstring="$verstring:${iface}.0" 665534977a2fSmrg done 665634977a2fSmrg 665734977a2fSmrg # Make executables depend on our current version. 665834977a2fSmrg verstring="$verstring:${current}.0" 665934977a2fSmrg ;; 666034977a2fSmrg 666134977a2fSmrg qnx) 666234977a2fSmrg major=".$current" 666334977a2fSmrg versuffix=".$current" 666434977a2fSmrg ;; 666534977a2fSmrg 666634977a2fSmrg sunos) 666734977a2fSmrg major=".$current" 666834977a2fSmrg versuffix=".$current.$revision" 666934977a2fSmrg ;; 667034977a2fSmrg 667134977a2fSmrg windows) 667234977a2fSmrg # Use '-' rather than '.', since we only want one 667334977a2fSmrg # extension on DOS 8.3 filesystems. 667434977a2fSmrg func_arith $current - $age 667534977a2fSmrg major=$func_arith_result 667634977a2fSmrg versuffix="-$major" 667734977a2fSmrg ;; 667834977a2fSmrg 667934977a2fSmrg *) 668034977a2fSmrg func_fatal_configuration "unknown library version type \`$version_type'" 668134977a2fSmrg ;; 668234977a2fSmrg esac 668334977a2fSmrg 668434977a2fSmrg # Clear the version info if we defaulted, and they specified a release. 668534977a2fSmrg if test -z "$vinfo" && test -n "$release"; then 668634977a2fSmrg major= 668734977a2fSmrg case $version_type in 668834977a2fSmrg darwin) 668934977a2fSmrg # we can't check for "0.0" in archive_cmds due to quoting 669034977a2fSmrg # problems, so we reset it completely 669134977a2fSmrg verstring= 669234977a2fSmrg ;; 669334977a2fSmrg *) 669434977a2fSmrg verstring="0.0" 669534977a2fSmrg ;; 669634977a2fSmrg esac 669734977a2fSmrg if test "$need_version" = no; then 669834977a2fSmrg versuffix= 669934977a2fSmrg else 670034977a2fSmrg versuffix=".0.0" 670134977a2fSmrg fi 670234977a2fSmrg fi 670334977a2fSmrg 670434977a2fSmrg # Remove version info from name if versioning should be avoided 670534977a2fSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 670634977a2fSmrg major= 670734977a2fSmrg versuffix= 670834977a2fSmrg verstring="" 670934977a2fSmrg fi 671034977a2fSmrg 671134977a2fSmrg # Check to see if the archive will have undefined symbols. 671234977a2fSmrg if test "$allow_undefined" = yes; then 671334977a2fSmrg if test "$allow_undefined_flag" = unsupported; then 671434977a2fSmrg func_warning "undefined symbols not allowed in $host shared libraries" 671534977a2fSmrg build_libtool_libs=no 671634977a2fSmrg build_old_libs=yes 671734977a2fSmrg fi 671834977a2fSmrg else 671934977a2fSmrg # Don't allow undefined symbols. 672034977a2fSmrg allow_undefined_flag="$no_undefined_flag" 672134977a2fSmrg fi 672234977a2fSmrg 672334977a2fSmrg fi 672434977a2fSmrg 672534977a2fSmrg func_generate_dlsyms "$libname" "$libname" "yes" 672634977a2fSmrg libobjs="$libobjs $symfileobj" 672734977a2fSmrg test "X$libobjs" = "X " && libobjs= 672834977a2fSmrg 672934977a2fSmrg if test "$mode" != relink; then 673034977a2fSmrg # Remove our outputs, but don't remove object files since they 673134977a2fSmrg # may have been created when compiling PIC objects. 673234977a2fSmrg removelist= 673334977a2fSmrg tempremovelist=`$ECHO "$output_objdir/*"` 673434977a2fSmrg for p in $tempremovelist; do 673534977a2fSmrg case $p in 673634977a2fSmrg *.$objext | *.gcno) 673734977a2fSmrg ;; 673834977a2fSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 673934977a2fSmrg if test "X$precious_files_regex" != "X"; then 674034977a2fSmrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 674134977a2fSmrg then 674234977a2fSmrg continue 674334977a2fSmrg fi 674434977a2fSmrg fi 674534977a2fSmrg removelist="$removelist $p" 674634977a2fSmrg ;; 674734977a2fSmrg *) ;; 674834977a2fSmrg esac 674934977a2fSmrg done 675034977a2fSmrg test -n "$removelist" && \ 675134977a2fSmrg func_show_eval "${RM}r \$removelist" 675234977a2fSmrg fi 675334977a2fSmrg 675434977a2fSmrg # Now set the variables for building old libraries. 675534977a2fSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 675634977a2fSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 675734977a2fSmrg 675834977a2fSmrg # Transform .lo files to .o files. 6759b425557eSmrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 676034977a2fSmrg fi 676134977a2fSmrg 676234977a2fSmrg # Eliminate all temporary directories. 676334977a2fSmrg #for path in $notinst_path; do 6764b425557eSmrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 6765b425557eSmrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 6766b425557eSmrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 676734977a2fSmrg #done 676834977a2fSmrg 676934977a2fSmrg if test -n "$xrpath"; then 677034977a2fSmrg # If the user specified any rpath flags, then add them. 677134977a2fSmrg temp_xrpath= 677234977a2fSmrg for libdir in $xrpath; do 677334977a2fSmrg temp_xrpath="$temp_xrpath -R$libdir" 677434977a2fSmrg case "$finalize_rpath " in 677534977a2fSmrg *" $libdir "*) ;; 677634977a2fSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 677734977a2fSmrg esac 677834977a2fSmrg done 677934977a2fSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 678034977a2fSmrg dependency_libs="$temp_xrpath $dependency_libs" 678134977a2fSmrg fi 678234977a2fSmrg fi 678334977a2fSmrg 678434977a2fSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 678534977a2fSmrg old_dlfiles="$dlfiles" 678634977a2fSmrg dlfiles= 678734977a2fSmrg for lib in $old_dlfiles; do 678834977a2fSmrg case " $dlprefiles $dlfiles " in 678934977a2fSmrg *" $lib "*) ;; 679034977a2fSmrg *) dlfiles="$dlfiles $lib" ;; 679134977a2fSmrg esac 679234977a2fSmrg done 679334977a2fSmrg 679434977a2fSmrg # Make sure dlprefiles contains only unique files 679534977a2fSmrg old_dlprefiles="$dlprefiles" 679634977a2fSmrg dlprefiles= 679734977a2fSmrg for lib in $old_dlprefiles; do 679834977a2fSmrg case "$dlprefiles " in 679934977a2fSmrg *" $lib "*) ;; 680034977a2fSmrg *) dlprefiles="$dlprefiles $lib" ;; 680134977a2fSmrg esac 680234977a2fSmrg done 680334977a2fSmrg 680434977a2fSmrg if test "$build_libtool_libs" = yes; then 680534977a2fSmrg if test -n "$rpath"; then 680634977a2fSmrg case $host in 6807b425557eSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 680834977a2fSmrg # these systems don't actually have a c library (as such)! 680934977a2fSmrg ;; 681034977a2fSmrg *-*-rhapsody* | *-*-darwin1.[012]) 681134977a2fSmrg # Rhapsody C library is in the System framework 681234977a2fSmrg deplibs="$deplibs System.ltframework" 681334977a2fSmrg ;; 681434977a2fSmrg *-*-netbsd*) 681534977a2fSmrg # Don't link with libc until the a.out ld.so is fixed. 681634977a2fSmrg ;; 681734977a2fSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 681834977a2fSmrg # Do not include libc due to us having libc/libc_r. 681934977a2fSmrg ;; 682034977a2fSmrg *-*-sco3.2v5* | *-*-sco5v6*) 682134977a2fSmrg # Causes problems with __ctype 682234977a2fSmrg ;; 682334977a2fSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 682434977a2fSmrg # Compiler inserts libc in the correct place for threads to work 682534977a2fSmrg ;; 682634977a2fSmrg *) 682734977a2fSmrg # Add libc to deplibs on all other systems if necessary. 682834977a2fSmrg if test "$build_libtool_need_lc" = "yes"; then 682934977a2fSmrg deplibs="$deplibs -lc" 683034977a2fSmrg fi 683134977a2fSmrg ;; 683234977a2fSmrg esac 683334977a2fSmrg fi 683434977a2fSmrg 683534977a2fSmrg # Transform deplibs into only deplibs that can be linked in shared. 683634977a2fSmrg name_save=$name 683734977a2fSmrg libname_save=$libname 683834977a2fSmrg release_save=$release 683934977a2fSmrg versuffix_save=$versuffix 684034977a2fSmrg major_save=$major 684134977a2fSmrg # I'm not sure if I'm treating the release correctly. I think 684234977a2fSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 684334977a2fSmrg # add it in twice. Is that correct? 684434977a2fSmrg release="" 684534977a2fSmrg versuffix="" 684634977a2fSmrg major="" 684734977a2fSmrg newdeplibs= 684834977a2fSmrg droppeddeps=no 684934977a2fSmrg case $deplibs_check_method in 685034977a2fSmrg pass_all) 685134977a2fSmrg # Don't check for shared/static. Everything works. 685234977a2fSmrg # This might be a little naive. We might want to check 685334977a2fSmrg # whether the library exists or not. But this is on 685434977a2fSmrg # osf3 & osf4 and I'm not really sure... Just 685534977a2fSmrg # implementing what was already the behavior. 685634977a2fSmrg newdeplibs=$deplibs 685734977a2fSmrg ;; 685834977a2fSmrg test_compile) 685934977a2fSmrg # This code stresses the "libraries are programs" paradigm to its 686034977a2fSmrg # limits. Maybe even breaks it. We compile a program, linking it 686134977a2fSmrg # against the deplibs as a proxy for the library. Then we can check 686234977a2fSmrg # whether they linked in statically or dynamically with ldd. 686334977a2fSmrg $opt_dry_run || $RM conftest.c 686434977a2fSmrg cat > conftest.c <<EOF 686534977a2fSmrg int main() { return 0; } 686634977a2fSmrgEOF 686734977a2fSmrg $opt_dry_run || $RM conftest 686834977a2fSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 686934977a2fSmrg ldd_output=`ldd conftest` 687034977a2fSmrg for i in $deplibs; do 687134977a2fSmrg case $i in 687234977a2fSmrg -l*) 687334977a2fSmrg func_stripname -l '' "$i" 687434977a2fSmrg name=$func_stripname_result 687534977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 687634977a2fSmrg case " $predeps $postdeps " in 687734977a2fSmrg *" $i "*) 687834977a2fSmrg newdeplibs="$newdeplibs $i" 687934977a2fSmrg i="" 688034977a2fSmrg ;; 688134977a2fSmrg esac 688234977a2fSmrg fi 688334977a2fSmrg if test -n "$i" ; then 688434977a2fSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 688534977a2fSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 688634977a2fSmrg set dummy $deplib_matches; shift 688734977a2fSmrg deplib_match=$1 688834977a2fSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 688934977a2fSmrg newdeplibs="$newdeplibs $i" 689034977a2fSmrg else 689134977a2fSmrg droppeddeps=yes 6892b425557eSmrg echo 689334977a2fSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6894b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 6895b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 6896b425557eSmrg echo "*** shared version of the library, which I believe you do not have" 6897b425557eSmrg echo "*** because a test_compile did reveal that the linker did not use it for" 6898b425557eSmrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 689934977a2fSmrg fi 690034977a2fSmrg fi 690134977a2fSmrg ;; 690234977a2fSmrg *) 690334977a2fSmrg newdeplibs="$newdeplibs $i" 690434977a2fSmrg ;; 690534977a2fSmrg esac 690634977a2fSmrg done 690734977a2fSmrg else 690834977a2fSmrg # Error occurred in the first compile. Let's try to salvage 690934977a2fSmrg # the situation: Compile a separate program for each library. 691034977a2fSmrg for i in $deplibs; do 691134977a2fSmrg case $i in 691234977a2fSmrg -l*) 691334977a2fSmrg func_stripname -l '' "$i" 691434977a2fSmrg name=$func_stripname_result 691534977a2fSmrg $opt_dry_run || $RM conftest 691634977a2fSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 691734977a2fSmrg ldd_output=`ldd conftest` 691834977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 691934977a2fSmrg case " $predeps $postdeps " in 692034977a2fSmrg *" $i "*) 692134977a2fSmrg newdeplibs="$newdeplibs $i" 692234977a2fSmrg i="" 692334977a2fSmrg ;; 692434977a2fSmrg esac 692534977a2fSmrg fi 692634977a2fSmrg if test -n "$i" ; then 692734977a2fSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 692834977a2fSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 692934977a2fSmrg set dummy $deplib_matches; shift 693034977a2fSmrg deplib_match=$1 693134977a2fSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 693234977a2fSmrg newdeplibs="$newdeplibs $i" 693334977a2fSmrg else 693434977a2fSmrg droppeddeps=yes 6935b425557eSmrg echo 693634977a2fSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6937b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 6938b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 6939b425557eSmrg echo "*** shared version of the library, which you do not appear to have" 6940b425557eSmrg echo "*** because a test_compile did reveal that the linker did not use this one" 6941b425557eSmrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 694234977a2fSmrg fi 694334977a2fSmrg fi 694434977a2fSmrg else 694534977a2fSmrg droppeddeps=yes 6946b425557eSmrg echo 694734977a2fSmrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 6948b425557eSmrg echo "*** make it link in! You will probably need to install it or some" 6949b425557eSmrg echo "*** library that it depends on before this library will be fully" 6950b425557eSmrg echo "*** functional. Installing it before continuing would be even better." 695134977a2fSmrg fi 695234977a2fSmrg ;; 695334977a2fSmrg *) 695434977a2fSmrg newdeplibs="$newdeplibs $i" 695534977a2fSmrg ;; 695634977a2fSmrg esac 695734977a2fSmrg done 695834977a2fSmrg fi 695934977a2fSmrg ;; 696034977a2fSmrg file_magic*) 696134977a2fSmrg set dummy $deplibs_check_method; shift 696234977a2fSmrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 696334977a2fSmrg for a_deplib in $deplibs; do 696434977a2fSmrg case $a_deplib in 696534977a2fSmrg -l*) 696634977a2fSmrg func_stripname -l '' "$a_deplib" 696734977a2fSmrg name=$func_stripname_result 696834977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 696934977a2fSmrg case " $predeps $postdeps " in 697034977a2fSmrg *" $a_deplib "*) 697134977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 697234977a2fSmrg a_deplib="" 697334977a2fSmrg ;; 697434977a2fSmrg esac 697534977a2fSmrg fi 697634977a2fSmrg if test -n "$a_deplib" ; then 697734977a2fSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 697834977a2fSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 697934977a2fSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 698034977a2fSmrg for potent_lib in $potential_libs; do 698134977a2fSmrg # Follow soft links. 698234977a2fSmrg if ls -lLd "$potent_lib" 2>/dev/null | 698334977a2fSmrg $GREP " -> " >/dev/null; then 698434977a2fSmrg continue 698534977a2fSmrg fi 698634977a2fSmrg # The statement above tries to avoid entering an 698734977a2fSmrg # endless loop below, in case of cyclic links. 698834977a2fSmrg # We might still enter an endless loop, since a link 698934977a2fSmrg # loop can be closed while we follow links, 699034977a2fSmrg # but so what? 699134977a2fSmrg potlib="$potent_lib" 699234977a2fSmrg while test -h "$potlib" 2>/dev/null; do 699334977a2fSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 699434977a2fSmrg case $potliblink in 699534977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 6996b425557eSmrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 699734977a2fSmrg esac 699834977a2fSmrg done 699934977a2fSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 700034977a2fSmrg $SED -e 10q | 700134977a2fSmrg $EGREP "$file_magic_regex" > /dev/null; then 700234977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 700334977a2fSmrg a_deplib="" 700434977a2fSmrg break 2 700534977a2fSmrg fi 700634977a2fSmrg done 700734977a2fSmrg done 700834977a2fSmrg fi 700934977a2fSmrg if test -n "$a_deplib" ; then 701034977a2fSmrg droppeddeps=yes 7011b425557eSmrg echo 701234977a2fSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7013b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 7014b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 7015b425557eSmrg echo "*** shared version of the library, which you do not appear to have" 7016b425557eSmrg echo "*** because I did check the linker path looking for a file starting" 701734977a2fSmrg if test -z "$potlib" ; then 701834977a2fSmrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 701934977a2fSmrg else 702034977a2fSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 702134977a2fSmrg $ECHO "*** using a file magic. Last file checked: $potlib" 702234977a2fSmrg fi 702334977a2fSmrg fi 702434977a2fSmrg ;; 702534977a2fSmrg *) 702634977a2fSmrg # Add a -L argument. 702734977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 702834977a2fSmrg ;; 702934977a2fSmrg esac 703034977a2fSmrg done # Gone through all deplibs. 703134977a2fSmrg ;; 703234977a2fSmrg match_pattern*) 703334977a2fSmrg set dummy $deplibs_check_method; shift 703434977a2fSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 703534977a2fSmrg for a_deplib in $deplibs; do 703634977a2fSmrg case $a_deplib in 703734977a2fSmrg -l*) 703834977a2fSmrg func_stripname -l '' "$a_deplib" 703934977a2fSmrg name=$func_stripname_result 704034977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 704134977a2fSmrg case " $predeps $postdeps " in 704234977a2fSmrg *" $a_deplib "*) 704334977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 704434977a2fSmrg a_deplib="" 704534977a2fSmrg ;; 704634977a2fSmrg esac 704734977a2fSmrg fi 704834977a2fSmrg if test -n "$a_deplib" ; then 704934977a2fSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 705034977a2fSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 705134977a2fSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 705234977a2fSmrg for potent_lib in $potential_libs; do 705334977a2fSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 7054b425557eSmrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 705534977a2fSmrg $EGREP "$match_pattern_regex" > /dev/null; then 705634977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 705734977a2fSmrg a_deplib="" 705834977a2fSmrg break 2 705934977a2fSmrg fi 706034977a2fSmrg done 706134977a2fSmrg done 706234977a2fSmrg fi 706334977a2fSmrg if test -n "$a_deplib" ; then 706434977a2fSmrg droppeddeps=yes 7065b425557eSmrg echo 706634977a2fSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7067b425557eSmrg echo "*** I have the capability to make that library automatically link in when" 7068b425557eSmrg echo "*** you link to this library. But I can only do this if you have a" 7069b425557eSmrg echo "*** shared version of the library, which you do not appear to have" 7070b425557eSmrg echo "*** because I did check the linker path looking for a file starting" 707134977a2fSmrg if test -z "$potlib" ; then 707234977a2fSmrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 707334977a2fSmrg else 707434977a2fSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 707534977a2fSmrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 707634977a2fSmrg fi 707734977a2fSmrg fi 707834977a2fSmrg ;; 707934977a2fSmrg *) 708034977a2fSmrg # Add a -L argument. 708134977a2fSmrg newdeplibs="$newdeplibs $a_deplib" 708234977a2fSmrg ;; 708334977a2fSmrg esac 708434977a2fSmrg done # Gone through all deplibs. 708534977a2fSmrg ;; 708634977a2fSmrg none | unknown | *) 708734977a2fSmrg newdeplibs="" 7088b425557eSmrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 708934977a2fSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 709034977a2fSmrg for i in $predeps $postdeps ; do 709134977a2fSmrg # can't use Xsed below, because $i might contain '/' 7092b425557eSmrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 709334977a2fSmrg done 709434977a2fSmrg fi 7095b425557eSmrg case $tmp_deplibs in 7096b425557eSmrg *[!\ \ ]*) 7097b425557eSmrg echo 709834977a2fSmrg if test "X$deplibs_check_method" = "Xnone"; then 7099b425557eSmrg echo "*** Warning: inter-library dependencies are not supported in this platform." 710034977a2fSmrg else 7101b425557eSmrg echo "*** Warning: inter-library dependencies are not known to be supported." 710234977a2fSmrg fi 7103b425557eSmrg echo "*** All declared inter-library dependencies are being dropped." 710434977a2fSmrg droppeddeps=yes 7105b425557eSmrg ;; 7106b425557eSmrg esac 710734977a2fSmrg ;; 710834977a2fSmrg esac 710934977a2fSmrg versuffix=$versuffix_save 711034977a2fSmrg major=$major_save 711134977a2fSmrg release=$release_save 711234977a2fSmrg libname=$libname_save 711334977a2fSmrg name=$name_save 711434977a2fSmrg 711534977a2fSmrg case $host in 711634977a2fSmrg *-*-rhapsody* | *-*-darwin1.[012]) 711734977a2fSmrg # On Rhapsody replace the C library with the System framework 7118b425557eSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 711934977a2fSmrg ;; 712034977a2fSmrg esac 712134977a2fSmrg 712234977a2fSmrg if test "$droppeddeps" = yes; then 712334977a2fSmrg if test "$module" = yes; then 7124b425557eSmrg echo 7125b425557eSmrg echo "*** Warning: libtool could not satisfy all declared inter-library" 712634977a2fSmrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7127b425557eSmrg echo "*** a static module, that should work as long as the dlopening" 7128b425557eSmrg echo "*** application is linked with the -dlopen flag." 712934977a2fSmrg if test -z "$global_symbol_pipe"; then 7130b425557eSmrg echo 7131b425557eSmrg echo "*** However, this would only work if libtool was able to extract symbol" 7132b425557eSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7133b425557eSmrg echo "*** not find such a program. So, this module is probably useless." 7134b425557eSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 713534977a2fSmrg fi 713634977a2fSmrg if test "$build_old_libs" = no; then 713734977a2fSmrg oldlibs="$output_objdir/$libname.$libext" 713834977a2fSmrg build_libtool_libs=module 713934977a2fSmrg build_old_libs=yes 714034977a2fSmrg else 714134977a2fSmrg build_libtool_libs=no 714234977a2fSmrg fi 714334977a2fSmrg else 7144b425557eSmrg echo "*** The inter-library dependencies that have been dropped here will be" 7145b425557eSmrg echo "*** automatically added whenever a program is linked with this library" 7146b425557eSmrg echo "*** or is declared to -dlopen it." 714734977a2fSmrg 714834977a2fSmrg if test "$allow_undefined" = no; then 7149b425557eSmrg echo 7150b425557eSmrg echo "*** Since this library must not contain undefined symbols," 7151b425557eSmrg echo "*** because either the platform does not support them or" 7152b425557eSmrg echo "*** it was explicitly requested with -no-undefined," 7153b425557eSmrg echo "*** libtool will only create a static version of it." 715434977a2fSmrg if test "$build_old_libs" = no; then 715534977a2fSmrg oldlibs="$output_objdir/$libname.$libext" 715634977a2fSmrg build_libtool_libs=module 715734977a2fSmrg build_old_libs=yes 715834977a2fSmrg else 715934977a2fSmrg build_libtool_libs=no 716034977a2fSmrg fi 716134977a2fSmrg fi 716234977a2fSmrg fi 716334977a2fSmrg fi 716434977a2fSmrg # Done checking deplibs! 716534977a2fSmrg deplibs=$newdeplibs 716634977a2fSmrg fi 716734977a2fSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 716834977a2fSmrg case $host in 716934977a2fSmrg *-*-darwin*) 7170b425557eSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7171b425557eSmrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7172b425557eSmrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 717334977a2fSmrg ;; 717434977a2fSmrg esac 717534977a2fSmrg 717634977a2fSmrg # move library search paths that coincide with paths to not yet 717734977a2fSmrg # installed libraries to the beginning of the library search list 717834977a2fSmrg new_libs= 717934977a2fSmrg for path in $notinst_path; do 718034977a2fSmrg case " $new_libs " in 718134977a2fSmrg *" -L$path/$objdir "*) ;; 718234977a2fSmrg *) 718334977a2fSmrg case " $deplibs " in 718434977a2fSmrg *" -L$path/$objdir "*) 718534977a2fSmrg new_libs="$new_libs -L$path/$objdir" ;; 718634977a2fSmrg esac 718734977a2fSmrg ;; 718834977a2fSmrg esac 718934977a2fSmrg done 719034977a2fSmrg for deplib in $deplibs; do 719134977a2fSmrg case $deplib in 719234977a2fSmrg -L*) 719334977a2fSmrg case " $new_libs " in 719434977a2fSmrg *" $deplib "*) ;; 719534977a2fSmrg *) new_libs="$new_libs $deplib" ;; 719634977a2fSmrg esac 719734977a2fSmrg ;; 719834977a2fSmrg *) new_libs="$new_libs $deplib" ;; 719934977a2fSmrg esac 720034977a2fSmrg done 720134977a2fSmrg deplibs="$new_libs" 720234977a2fSmrg 720334977a2fSmrg # All the library-specific variables (install_libdir is set above). 720434977a2fSmrg library_names= 720534977a2fSmrg old_library= 720634977a2fSmrg dlname= 720734977a2fSmrg 720834977a2fSmrg # Test again, we may have decided not to build it any more 720934977a2fSmrg if test "$build_libtool_libs" = yes; then 721034977a2fSmrg if test "$hardcode_into_libs" = yes; then 721134977a2fSmrg # Hardcode the library paths 721234977a2fSmrg hardcode_libdirs= 721334977a2fSmrg dep_rpath= 721434977a2fSmrg rpath="$finalize_rpath" 721534977a2fSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 721634977a2fSmrg for libdir in $rpath; do 721734977a2fSmrg if test -n "$hardcode_libdir_flag_spec"; then 721834977a2fSmrg if test -n "$hardcode_libdir_separator"; then 721934977a2fSmrg if test -z "$hardcode_libdirs"; then 722034977a2fSmrg hardcode_libdirs="$libdir" 722134977a2fSmrg else 722234977a2fSmrg # Just accumulate the unique libdirs. 722334977a2fSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 722434977a2fSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 722534977a2fSmrg ;; 722634977a2fSmrg *) 722734977a2fSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 722834977a2fSmrg ;; 722934977a2fSmrg esac 723034977a2fSmrg fi 723134977a2fSmrg else 723234977a2fSmrg eval flag=\"$hardcode_libdir_flag_spec\" 723334977a2fSmrg dep_rpath="$dep_rpath $flag" 723434977a2fSmrg fi 723534977a2fSmrg elif test -n "$runpath_var"; then 723634977a2fSmrg case "$perm_rpath " in 723734977a2fSmrg *" $libdir "*) ;; 723834977a2fSmrg *) perm_rpath="$perm_rpath $libdir" ;; 723934977a2fSmrg esac 724034977a2fSmrg fi 724134977a2fSmrg done 724234977a2fSmrg # Substitute the hardcoded libdirs into the rpath. 724334977a2fSmrg if test -n "$hardcode_libdir_separator" && 724434977a2fSmrg test -n "$hardcode_libdirs"; then 724534977a2fSmrg libdir="$hardcode_libdirs" 724634977a2fSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 724734977a2fSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 724834977a2fSmrg else 724934977a2fSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 725034977a2fSmrg fi 725134977a2fSmrg fi 725234977a2fSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 725334977a2fSmrg # We should set the runpath_var. 725434977a2fSmrg rpath= 725534977a2fSmrg for dir in $perm_rpath; do 725634977a2fSmrg rpath="$rpath$dir:" 725734977a2fSmrg done 725834977a2fSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 725934977a2fSmrg fi 726034977a2fSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 726134977a2fSmrg fi 7262ee3138f1Smrg 726334977a2fSmrg shlibpath="$finalize_shlibpath" 726434977a2fSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 726534977a2fSmrg if test -n "$shlibpath"; then 726634977a2fSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 726734977a2fSmrg fi 7268ee3138f1Smrg 726934977a2fSmrg # Get the real and link names of the library. 727034977a2fSmrg eval shared_ext=\"$shrext_cmds\" 727134977a2fSmrg eval library_names=\"$library_names_spec\" 727234977a2fSmrg set dummy $library_names 727334977a2fSmrg shift 727434977a2fSmrg realname="$1" 727534977a2fSmrg shift 7276ee3138f1Smrg 727734977a2fSmrg if test -n "$soname_spec"; then 727834977a2fSmrg eval soname=\"$soname_spec\" 727934977a2fSmrg else 728034977a2fSmrg soname="$realname" 728134977a2fSmrg fi 728234977a2fSmrg if test -z "$dlname"; then 728334977a2fSmrg dlname=$soname 728434977a2fSmrg fi 7285ee3138f1Smrg 728634977a2fSmrg lib="$output_objdir/$realname" 728734977a2fSmrg linknames= 728834977a2fSmrg for link 728934977a2fSmrg do 729034977a2fSmrg linknames="$linknames $link" 729134977a2fSmrg done 7292ee3138f1Smrg 729334977a2fSmrg # Use standard objects if they are pic 7294b425557eSmrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 729534977a2fSmrg test "X$libobjs" = "X " && libobjs= 7296ee3138f1Smrg 729734977a2fSmrg delfiles= 729834977a2fSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 729934977a2fSmrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 730034977a2fSmrg export_symbols="$output_objdir/$libname.uexp" 730134977a2fSmrg delfiles="$delfiles $export_symbols" 730234977a2fSmrg fi 7303ee3138f1Smrg 730434977a2fSmrg orig_export_symbols= 730534977a2fSmrg case $host_os in 730634977a2fSmrg cygwin* | mingw* | cegcc*) 730734977a2fSmrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 730834977a2fSmrg # exporting using user supplied symfile 730934977a2fSmrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 731034977a2fSmrg # and it's NOT already a .def file. Must figure out 731134977a2fSmrg # which of the given symbols are data symbols and tag 731234977a2fSmrg # them as such. So, trigger use of export_symbols_cmds. 731334977a2fSmrg # export_symbols gets reassigned inside the "prepare 731434977a2fSmrg # the list of exported symbols" if statement, so the 731534977a2fSmrg # include_expsyms logic still works. 731634977a2fSmrg orig_export_symbols="$export_symbols" 731734977a2fSmrg export_symbols= 731834977a2fSmrg always_export_symbols=yes 731934977a2fSmrg fi 732034977a2fSmrg fi 732134977a2fSmrg ;; 732234977a2fSmrg esac 7323ee3138f1Smrg 732434977a2fSmrg # Prepare the list of exported symbols 732534977a2fSmrg if test -z "$export_symbols"; then 732634977a2fSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 732734977a2fSmrg func_verbose "generating symbol list for \`$libname.la'" 732834977a2fSmrg export_symbols="$output_objdir/$libname.exp" 732934977a2fSmrg $opt_dry_run || $RM $export_symbols 733034977a2fSmrg cmds=$export_symbols_cmds 733134977a2fSmrg save_ifs="$IFS"; IFS='~' 733234977a2fSmrg for cmd in $cmds; do 733334977a2fSmrg IFS="$save_ifs" 733434977a2fSmrg eval cmd=\"$cmd\" 733534977a2fSmrg func_len " $cmd" 733634977a2fSmrg len=$func_len_result 733734977a2fSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 733834977a2fSmrg func_show_eval "$cmd" 'exit $?' 733934977a2fSmrg skipped_export=false 734034977a2fSmrg else 734134977a2fSmrg # The command line is too long to execute in one step. 734234977a2fSmrg func_verbose "using reloadable object file for export list..." 734334977a2fSmrg skipped_export=: 734434977a2fSmrg # Break out early, otherwise skipped_export may be 734534977a2fSmrg # set to false by a later but shorter cmd. 734634977a2fSmrg break 734734977a2fSmrg fi 734834977a2fSmrg done 734934977a2fSmrg IFS="$save_ifs" 735034977a2fSmrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 735134977a2fSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 735234977a2fSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 735334977a2fSmrg fi 735434977a2fSmrg fi 7355ee3138f1Smrg fi 7356ee3138f1Smrg 735734977a2fSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 735834977a2fSmrg tmp_export_symbols="$export_symbols" 735934977a2fSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7360b425557eSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 736134977a2fSmrg fi 7362ee3138f1Smrg 736334977a2fSmrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 736434977a2fSmrg # The given exports_symbols file has to be filtered, so filter it. 736534977a2fSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 736634977a2fSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 736734977a2fSmrg # 's' commands which not all seds can handle. GNU sed should be fine 736834977a2fSmrg # though. Also, the filter scales superlinearly with the number of 736934977a2fSmrg # global variables. join(1) would be nice here, but unfortunately 737034977a2fSmrg # isn't a blessed tool. 737134977a2fSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 737234977a2fSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 737334977a2fSmrg export_symbols=$output_objdir/$libname.def 737434977a2fSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 737534977a2fSmrg fi 7376ee3138f1Smrg 737734977a2fSmrg tmp_deplibs= 737834977a2fSmrg for test_deplib in $deplibs; do 737934977a2fSmrg case " $convenience " in 738034977a2fSmrg *" $test_deplib "*) ;; 738134977a2fSmrg *) 738234977a2fSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 738334977a2fSmrg ;; 738434977a2fSmrg esac 738534977a2fSmrg done 738634977a2fSmrg deplibs="$tmp_deplibs" 7387ee3138f1Smrg 738834977a2fSmrg if test -n "$convenience"; then 738934977a2fSmrg if test -n "$whole_archive_flag_spec" && 739034977a2fSmrg test "$compiler_needs_object" = yes && 739134977a2fSmrg test -z "$libobjs"; then 739234977a2fSmrg # extract the archives, so we have objects to list. 739334977a2fSmrg # TODO: could optimize this to just extract one archive. 739434977a2fSmrg whole_archive_flag_spec= 739534977a2fSmrg fi 739634977a2fSmrg if test -n "$whole_archive_flag_spec"; then 739734977a2fSmrg save_libobjs=$libobjs 739834977a2fSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 739934977a2fSmrg test "X$libobjs" = "X " && libobjs= 740034977a2fSmrg else 740134977a2fSmrg gentop="$output_objdir/${outputname}x" 740234977a2fSmrg generated="$generated $gentop" 7403ee3138f1Smrg 740434977a2fSmrg func_extract_archives $gentop $convenience 740534977a2fSmrg libobjs="$libobjs $func_extract_archives_result" 740634977a2fSmrg test "X$libobjs" = "X " && libobjs= 740734977a2fSmrg fi 7408ee3138f1Smrg fi 7409ee3138f1Smrg 741034977a2fSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 741134977a2fSmrg eval flag=\"$thread_safe_flag_spec\" 741234977a2fSmrg linker_flags="$linker_flags $flag" 7413ee3138f1Smrg fi 7414ee3138f1Smrg 741534977a2fSmrg # Make a backup of the uninstalled library when relinking 741634977a2fSmrg if test "$mode" = relink; then 741734977a2fSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 741834977a2fSmrg fi 7419ee3138f1Smrg 742034977a2fSmrg # Do each of the archive commands. 742134977a2fSmrg if test "$module" = yes && test -n "$module_cmds" ; then 742234977a2fSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 742334977a2fSmrg eval test_cmds=\"$module_expsym_cmds\" 742434977a2fSmrg cmds=$module_expsym_cmds 742534977a2fSmrg else 742634977a2fSmrg eval test_cmds=\"$module_cmds\" 742734977a2fSmrg cmds=$module_cmds 742834977a2fSmrg fi 7429ee3138f1Smrg else 743034977a2fSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 743134977a2fSmrg eval test_cmds=\"$archive_expsym_cmds\" 743234977a2fSmrg cmds=$archive_expsym_cmds 743334977a2fSmrg else 743434977a2fSmrg eval test_cmds=\"$archive_cmds\" 743534977a2fSmrg cmds=$archive_cmds 743634977a2fSmrg fi 7437ee3138f1Smrg fi 7438ee3138f1Smrg 743934977a2fSmrg if test "X$skipped_export" != "X:" && 744034977a2fSmrg func_len " $test_cmds" && 744134977a2fSmrg len=$func_len_result && 744234977a2fSmrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 744334977a2fSmrg : 744434977a2fSmrg else 744534977a2fSmrg # The command line is too long to link in one step, link piecewise 744634977a2fSmrg # or, if using GNU ld and skipped_export is not :, use a linker 744734977a2fSmrg # script. 7448ee3138f1Smrg 744934977a2fSmrg # Save the value of $output and $libobjs because we want to 745034977a2fSmrg # use them later. If we have whole_archive_flag_spec, we 745134977a2fSmrg # want to use save_libobjs as it was before 745234977a2fSmrg # whole_archive_flag_spec was expanded, because we can't 745334977a2fSmrg # assume the linker understands whole_archive_flag_spec. 745434977a2fSmrg # This may have to be revisited, in case too many 745534977a2fSmrg # convenience libraries get linked in and end up exceeding 745634977a2fSmrg # the spec. 745734977a2fSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 745834977a2fSmrg save_libobjs=$libobjs 745934977a2fSmrg fi 746034977a2fSmrg save_output=$output 7461b425557eSmrg func_basename "$output" 7462b425557eSmrg output_la=$func_basename_result 7463ee3138f1Smrg 746434977a2fSmrg # Clear the reloadable object creation command queue and 746534977a2fSmrg # initialize k to one. 746634977a2fSmrg test_cmds= 746734977a2fSmrg concat_cmds= 746834977a2fSmrg objlist= 746934977a2fSmrg last_robj= 747034977a2fSmrg k=1 747134977a2fSmrg 747234977a2fSmrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 747334977a2fSmrg output=${output_objdir}/${output_la}.lnkscript 747434977a2fSmrg func_verbose "creating GNU ld script: $output" 7475b425557eSmrg echo 'INPUT (' > $output 747634977a2fSmrg for obj in $save_libobjs 7477ee3138f1Smrg do 747834977a2fSmrg $ECHO "$obj" >> $output 747934977a2fSmrg done 7480b425557eSmrg echo ')' >> $output 748134977a2fSmrg delfiles="$delfiles $output" 748234977a2fSmrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 748334977a2fSmrg output=${output_objdir}/${output_la}.lnk 748434977a2fSmrg func_verbose "creating linker input file list: $output" 748534977a2fSmrg : > $output 748634977a2fSmrg set x $save_libobjs 748734977a2fSmrg shift 748834977a2fSmrg firstobj= 748934977a2fSmrg if test "$compiler_needs_object" = yes; then 749034977a2fSmrg firstobj="$1 " 749134977a2fSmrg shift 749234977a2fSmrg fi 749334977a2fSmrg for obj 749434977a2fSmrg do 749534977a2fSmrg $ECHO "$obj" >> $output 749634977a2fSmrg done 749734977a2fSmrg delfiles="$delfiles $output" 749834977a2fSmrg output=$firstobj\"$file_list_spec$output\" 749934977a2fSmrg else 750034977a2fSmrg if test -n "$save_libobjs"; then 750134977a2fSmrg func_verbose "creating reloadable object files..." 750234977a2fSmrg output=$output_objdir/$output_la-${k}.$objext 750334977a2fSmrg eval test_cmds=\"$reload_cmds\" 750434977a2fSmrg func_len " $test_cmds" 750534977a2fSmrg len0=$func_len_result 750634977a2fSmrg len=$len0 750734977a2fSmrg 750834977a2fSmrg # Loop over the list of objects to be linked. 750934977a2fSmrg for obj in $save_libobjs 751034977a2fSmrg do 751134977a2fSmrg func_len " $obj" 751234977a2fSmrg func_arith $len + $func_len_result 751334977a2fSmrg len=$func_arith_result 751434977a2fSmrg if test "X$objlist" = X || 751534977a2fSmrg test "$len" -lt "$max_cmd_len"; then 751634977a2fSmrg func_append objlist " $obj" 751734977a2fSmrg else 751834977a2fSmrg # The command $test_cmds is almost too long, add a 751934977a2fSmrg # command to the queue. 752034977a2fSmrg if test "$k" -eq 1 ; then 752134977a2fSmrg # The first file doesn't have a previous command to add. 7522b425557eSmrg reload_objs=$objlist 7523b425557eSmrg eval concat_cmds=\"$reload_cmds\" 752434977a2fSmrg else 752534977a2fSmrg # All subsequent reloadable object files will link in 752634977a2fSmrg # the last one created. 7527b425557eSmrg reload_objs="$objlist $last_robj" 7528b425557eSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 752934977a2fSmrg fi 753034977a2fSmrg last_robj=$output_objdir/$output_la-${k}.$objext 753134977a2fSmrg func_arith $k + 1 753234977a2fSmrg k=$func_arith_result 753334977a2fSmrg output=$output_objdir/$output_la-${k}.$objext 7534b425557eSmrg objlist=" $obj" 753534977a2fSmrg func_len " $last_robj" 753634977a2fSmrg func_arith $len0 + $func_len_result 753734977a2fSmrg len=$func_arith_result 753834977a2fSmrg fi 753934977a2fSmrg done 754034977a2fSmrg # Handle the remaining objects by creating one last 754134977a2fSmrg # reloadable object file. All subsequent reloadable object 754234977a2fSmrg # files will link in the last one created. 754334977a2fSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7544b425557eSmrg reload_objs="$objlist $last_robj" 7545b425557eSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 754634977a2fSmrg if test -n "$last_robj"; then 754734977a2fSmrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 754834977a2fSmrg fi 754934977a2fSmrg delfiles="$delfiles $output" 7550ee3138f1Smrg 755134977a2fSmrg else 755234977a2fSmrg output= 755334977a2fSmrg fi 7554ee3138f1Smrg 755534977a2fSmrg if ${skipped_export-false}; then 755634977a2fSmrg func_verbose "generating symbol list for \`$libname.la'" 755734977a2fSmrg export_symbols="$output_objdir/$libname.exp" 755834977a2fSmrg $opt_dry_run || $RM $export_symbols 755934977a2fSmrg libobjs=$output 756034977a2fSmrg # Append the command to create the export file. 756134977a2fSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 756234977a2fSmrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 756334977a2fSmrg if test -n "$last_robj"; then 756434977a2fSmrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 756534977a2fSmrg fi 7566ee3138f1Smrg fi 7567ee3138f1Smrg 756834977a2fSmrg test -n "$save_libobjs" && 756934977a2fSmrg func_verbose "creating a temporary reloadable object file: $output" 7570ee3138f1Smrg 757134977a2fSmrg # Loop through the commands generated above and execute them. 757234977a2fSmrg save_ifs="$IFS"; IFS='~' 757334977a2fSmrg for cmd in $concat_cmds; do 757434977a2fSmrg IFS="$save_ifs" 757534977a2fSmrg $opt_silent || { 757634977a2fSmrg func_quote_for_expand "$cmd" 757734977a2fSmrg eval "func_echo $func_quote_for_expand_result" 757834977a2fSmrg } 757934977a2fSmrg $opt_dry_run || eval "$cmd" || { 758034977a2fSmrg lt_exit=$? 758134977a2fSmrg 758234977a2fSmrg # Restore the uninstalled library and exit 758334977a2fSmrg if test "$mode" = relink; then 758434977a2fSmrg ( cd "$output_objdir" && \ 758534977a2fSmrg $RM "${realname}T" && \ 758634977a2fSmrg $MV "${realname}U" "$realname" ) 758734977a2fSmrg fi 7588ee3138f1Smrg 758934977a2fSmrg exit $lt_exit 759034977a2fSmrg } 759134977a2fSmrg done 759234977a2fSmrg IFS="$save_ifs" 7593ee3138f1Smrg 759434977a2fSmrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 759534977a2fSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 759634977a2fSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7597ee3138f1Smrg fi 7598ee3138f1Smrg fi 7599ee3138f1Smrg 760034977a2fSmrg if ${skipped_export-false}; then 760134977a2fSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 760234977a2fSmrg tmp_export_symbols="$export_symbols" 760334977a2fSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7604b425557eSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 760534977a2fSmrg fi 7606ee3138f1Smrg 760734977a2fSmrg if test -n "$orig_export_symbols"; then 760834977a2fSmrg # The given exports_symbols file has to be filtered, so filter it. 760934977a2fSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 761034977a2fSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 761134977a2fSmrg # 's' commands which not all seds can handle. GNU sed should be fine 761234977a2fSmrg # though. Also, the filter scales superlinearly with the number of 761334977a2fSmrg # global variables. join(1) would be nice here, but unfortunately 761434977a2fSmrg # isn't a blessed tool. 761534977a2fSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 761634977a2fSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 761734977a2fSmrg export_symbols=$output_objdir/$libname.def 761834977a2fSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 761934977a2fSmrg fi 762034977a2fSmrg fi 7621ee3138f1Smrg 762234977a2fSmrg libobjs=$output 762334977a2fSmrg # Restore the value of output. 762434977a2fSmrg output=$save_output 7625ee3138f1Smrg 762634977a2fSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 762734977a2fSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 762834977a2fSmrg test "X$libobjs" = "X " && libobjs= 762934977a2fSmrg fi 763034977a2fSmrg # Expand the library linking commands again to reset the 763134977a2fSmrg # value of $libobjs for piecewise linking. 7632ee3138f1Smrg 763334977a2fSmrg # Do each of the archive commands. 763434977a2fSmrg if test "$module" = yes && test -n "$module_cmds" ; then 763534977a2fSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 763634977a2fSmrg cmds=$module_expsym_cmds 763734977a2fSmrg else 763834977a2fSmrg cmds=$module_cmds 7639ee3138f1Smrg fi 7640ee3138f1Smrg else 764134977a2fSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 764234977a2fSmrg cmds=$archive_expsym_cmds 764334977a2fSmrg else 764434977a2fSmrg cmds=$archive_cmds 764534977a2fSmrg fi 7646ee3138f1Smrg fi 764734977a2fSmrg fi 7648ee3138f1Smrg 764934977a2fSmrg if test -n "$delfiles"; then 765034977a2fSmrg # Append the command to remove temporary files to $cmds. 765134977a2fSmrg eval cmds=\"\$cmds~\$RM $delfiles\" 765234977a2fSmrg fi 7653ee3138f1Smrg 765434977a2fSmrg # Add any objects from preloaded convenience libraries 765534977a2fSmrg if test -n "$dlprefiles"; then 765634977a2fSmrg gentop="$output_objdir/${outputname}x" 765734977a2fSmrg generated="$generated $gentop" 7658ee3138f1Smrg 765934977a2fSmrg func_extract_archives $gentop $dlprefiles 766034977a2fSmrg libobjs="$libobjs $func_extract_archives_result" 766134977a2fSmrg test "X$libobjs" = "X " && libobjs= 766234977a2fSmrg fi 7663ee3138f1Smrg 766434977a2fSmrg save_ifs="$IFS"; IFS='~' 766534977a2fSmrg for cmd in $cmds; do 766634977a2fSmrg IFS="$save_ifs" 766734977a2fSmrg eval cmd=\"$cmd\" 766834977a2fSmrg $opt_silent || { 766934977a2fSmrg func_quote_for_expand "$cmd" 767034977a2fSmrg eval "func_echo $func_quote_for_expand_result" 767134977a2fSmrg } 767234977a2fSmrg $opt_dry_run || eval "$cmd" || { 767334977a2fSmrg lt_exit=$? 7674ee3138f1Smrg 767534977a2fSmrg # Restore the uninstalled library and exit 767634977a2fSmrg if test "$mode" = relink; then 767734977a2fSmrg ( cd "$output_objdir" && \ 767834977a2fSmrg $RM "${realname}T" && \ 767934977a2fSmrg $MV "${realname}U" "$realname" ) 768034977a2fSmrg fi 7681ee3138f1Smrg 768234977a2fSmrg exit $lt_exit 768334977a2fSmrg } 768434977a2fSmrg done 768534977a2fSmrg IFS="$save_ifs" 7686ee3138f1Smrg 768734977a2fSmrg # Restore the uninstalled library and exit 768834977a2fSmrg if test "$mode" = relink; then 768934977a2fSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7690ee3138f1Smrg 769134977a2fSmrg if test -n "$convenience"; then 769234977a2fSmrg if test -z "$whole_archive_flag_spec"; then 769334977a2fSmrg func_show_eval '${RM}r "$gentop"' 769434977a2fSmrg fi 769534977a2fSmrg fi 7696ee3138f1Smrg 769734977a2fSmrg exit $EXIT_SUCCESS 769834977a2fSmrg fi 769934977a2fSmrg 770034977a2fSmrg # Create links to the real library. 770134977a2fSmrg for linkname in $linknames; do 770234977a2fSmrg if test "$realname" != "$linkname"; then 770334977a2fSmrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 7704ee3138f1Smrg fi 7705ee3138f1Smrg done 7706ee3138f1Smrg 770734977a2fSmrg # If -module or -export-dynamic was specified, set the dlname. 770834977a2fSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 770934977a2fSmrg # On all known operating systems, these are identical. 771034977a2fSmrg dlname="$soname" 771134977a2fSmrg fi 771234977a2fSmrg fi 7713ee3138f1Smrg ;; 7714ee3138f1Smrg 771534977a2fSmrg obj) 771634977a2fSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 771734977a2fSmrg func_warning "\`-dlopen' is ignored for objects" 771834977a2fSmrg fi 7719ee3138f1Smrg 772034977a2fSmrg case " $deplibs" in 772134977a2fSmrg *\ -l* | *\ -L*) 772234977a2fSmrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 7723ee3138f1Smrg esac 7724ee3138f1Smrg 772534977a2fSmrg test -n "$rpath" && \ 772634977a2fSmrg func_warning "\`-rpath' is ignored for objects" 772734977a2fSmrg 772834977a2fSmrg test -n "$xrpath" && \ 772934977a2fSmrg func_warning "\`-R' is ignored for objects" 7730ee3138f1Smrg 773134977a2fSmrg test -n "$vinfo" && \ 773234977a2fSmrg func_warning "\`-version-info' is ignored for objects" 7733ee3138f1Smrg 773434977a2fSmrg test -n "$release" && \ 773534977a2fSmrg func_warning "\`-release' is ignored for objects" 773634977a2fSmrg 773734977a2fSmrg case $output in 773834977a2fSmrg *.lo) 773934977a2fSmrg test -n "$objs$old_deplibs" && \ 774034977a2fSmrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 774134977a2fSmrg 774234977a2fSmrg libobj=$output 774334977a2fSmrg func_lo2o "$libobj" 774434977a2fSmrg obj=$func_lo2o_result 7745ee3138f1Smrg ;; 7746ee3138f1Smrg *) 774734977a2fSmrg libobj= 774834977a2fSmrg obj="$output" 7749ee3138f1Smrg ;; 7750ee3138f1Smrg esac 7751ee3138f1Smrg 775234977a2fSmrg # Delete the old objects. 775334977a2fSmrg $opt_dry_run || $RM $obj $libobj 7754ee3138f1Smrg 775534977a2fSmrg # Objects from convenience libraries. This assumes 775634977a2fSmrg # single-version convenience libraries. Whenever we create 775734977a2fSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 775834977a2fSmrg # the extraction. 775934977a2fSmrg reload_conv_objs= 776034977a2fSmrg gentop= 776134977a2fSmrg # reload_cmds runs $LD directly, so let us get rid of 776234977a2fSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 776334977a2fSmrg # turning comma into space.. 776434977a2fSmrg wl= 7765ee3138f1Smrg 776634977a2fSmrg if test -n "$convenience"; then 776734977a2fSmrg if test -n "$whole_archive_flag_spec"; then 776834977a2fSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 7769b425557eSmrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 777034977a2fSmrg else 777134977a2fSmrg gentop="$output_objdir/${obj}x" 777234977a2fSmrg generated="$generated $gentop" 7773ee3138f1Smrg 777434977a2fSmrg func_extract_archives $gentop $convenience 777534977a2fSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 777634977a2fSmrg fi 7777ee3138f1Smrg fi 7778ee3138f1Smrg 777934977a2fSmrg # Create the old-style object. 7780b425557eSmrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 7781ee3138f1Smrg 778234977a2fSmrg output="$obj" 778334977a2fSmrg func_execute_cmds "$reload_cmds" 'exit $?' 7784ee3138f1Smrg 778534977a2fSmrg # Exit if we aren't doing a library object file. 778634977a2fSmrg if test -z "$libobj"; then 778734977a2fSmrg if test -n "$gentop"; then 778834977a2fSmrg func_show_eval '${RM}r "$gentop"' 778934977a2fSmrg fi 779034977a2fSmrg 779134977a2fSmrg exit $EXIT_SUCCESS 7792ee3138f1Smrg fi 779334977a2fSmrg 779434977a2fSmrg if test "$build_libtool_libs" != yes; then 779534977a2fSmrg if test -n "$gentop"; then 779634977a2fSmrg func_show_eval '${RM}r "$gentop"' 779734977a2fSmrg fi 779834977a2fSmrg 779934977a2fSmrg # Create an invalid libtool object if no PIC, so that we don't 780034977a2fSmrg # accidentally link it into a program. 780134977a2fSmrg # $show "echo timestamp > $libobj" 780234977a2fSmrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 780334977a2fSmrg exit $EXIT_SUCCESS 780434977a2fSmrg fi 780534977a2fSmrg 780634977a2fSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 780734977a2fSmrg # Only do commands if we really have different PIC objects. 780834977a2fSmrg reload_objs="$libobjs $reload_conv_objs" 780934977a2fSmrg output="$libobj" 781034977a2fSmrg func_execute_cmds "$reload_cmds" 'exit $?' 781134977a2fSmrg fi 781234977a2fSmrg 781334977a2fSmrg if test -n "$gentop"; then 781434977a2fSmrg func_show_eval '${RM}r "$gentop"' 781534977a2fSmrg fi 781634977a2fSmrg 781734977a2fSmrg exit $EXIT_SUCCESS 7818ee3138f1Smrg ;; 7819ee3138f1Smrg 782034977a2fSmrg prog) 782134977a2fSmrg case $host in 782234977a2fSmrg *cygwin*) func_stripname '' '.exe' "$output" 782334977a2fSmrg output=$func_stripname_result.exe;; 782434977a2fSmrg esac 782534977a2fSmrg test -n "$vinfo" && \ 782634977a2fSmrg func_warning "\`-version-info' is ignored for programs" 7827ee3138f1Smrg 782834977a2fSmrg test -n "$release" && \ 782934977a2fSmrg func_warning "\`-release' is ignored for programs" 7830ee3138f1Smrg 783134977a2fSmrg test "$preload" = yes \ 783234977a2fSmrg && test "$dlopen_support" = unknown \ 783334977a2fSmrg && test "$dlopen_self" = unknown \ 783434977a2fSmrg && test "$dlopen_self_static" = unknown && \ 783534977a2fSmrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 783634977a2fSmrg 783734977a2fSmrg case $host in 783834977a2fSmrg *-*-rhapsody* | *-*-darwin1.[012]) 783934977a2fSmrg # On Rhapsody replace the C library is the System framework 7840b425557eSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 7841b425557eSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 7842ee3138f1Smrg ;; 784334977a2fSmrg esac 7844ee3138f1Smrg 784534977a2fSmrg case $host in 784634977a2fSmrg *-*-darwin*) 784734977a2fSmrg # Don't allow lazy linking, it breaks C++ global constructors 784834977a2fSmrg # But is supposedly fixed on 10.4 or later (yay!). 784934977a2fSmrg if test "$tagname" = CXX ; then 785034977a2fSmrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 785134977a2fSmrg 10.[0123]) 785234977a2fSmrg compile_command="$compile_command ${wl}-bind_at_load" 785334977a2fSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 785434977a2fSmrg ;; 785534977a2fSmrg esac 7856ee3138f1Smrg fi 785734977a2fSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7858b425557eSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7859b425557eSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 786034977a2fSmrg ;; 786134977a2fSmrg esac 7862ee3138f1Smrg 7863ee3138f1Smrg 786434977a2fSmrg # move library search paths that coincide with paths to not yet 786534977a2fSmrg # installed libraries to the beginning of the library search list 786634977a2fSmrg new_libs= 786734977a2fSmrg for path in $notinst_path; do 786834977a2fSmrg case " $new_libs " in 786934977a2fSmrg *" -L$path/$objdir "*) ;; 787034977a2fSmrg *) 787134977a2fSmrg case " $compile_deplibs " in 787234977a2fSmrg *" -L$path/$objdir "*) 787334977a2fSmrg new_libs="$new_libs -L$path/$objdir" ;; 7874ee3138f1Smrg esac 787534977a2fSmrg ;; 787634977a2fSmrg esac 787734977a2fSmrg done 787834977a2fSmrg for deplib in $compile_deplibs; do 787934977a2fSmrg case $deplib in 788034977a2fSmrg -L*) 788134977a2fSmrg case " $new_libs " in 788234977a2fSmrg *" $deplib "*) ;; 788334977a2fSmrg *) new_libs="$new_libs $deplib" ;; 7884ee3138f1Smrg esac 788534977a2fSmrg ;; 788634977a2fSmrg *) new_libs="$new_libs $deplib" ;; 788734977a2fSmrg esac 788834977a2fSmrg done 788934977a2fSmrg compile_deplibs="$new_libs" 7890ee3138f1Smrg 7891ee3138f1Smrg 789234977a2fSmrg compile_command="$compile_command $compile_deplibs" 789334977a2fSmrg finalize_command="$finalize_command $finalize_deplibs" 7894ee3138f1Smrg 789534977a2fSmrg if test -n "$rpath$xrpath"; then 789634977a2fSmrg # If the user specified any rpath flags, then add them. 789734977a2fSmrg for libdir in $rpath $xrpath; do 789834977a2fSmrg # This is the magic to use -rpath. 789934977a2fSmrg case "$finalize_rpath " in 790034977a2fSmrg *" $libdir "*) ;; 790134977a2fSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 790234977a2fSmrg esac 790334977a2fSmrg done 790434977a2fSmrg fi 7905ee3138f1Smrg 790634977a2fSmrg # Now hardcode the library paths 790734977a2fSmrg rpath= 790834977a2fSmrg hardcode_libdirs= 790934977a2fSmrg for libdir in $compile_rpath $finalize_rpath; do 791034977a2fSmrg if test -n "$hardcode_libdir_flag_spec"; then 791134977a2fSmrg if test -n "$hardcode_libdir_separator"; then 791234977a2fSmrg if test -z "$hardcode_libdirs"; then 791334977a2fSmrg hardcode_libdirs="$libdir" 791434977a2fSmrg else 791534977a2fSmrg # Just accumulate the unique libdirs. 791634977a2fSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 791734977a2fSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 791834977a2fSmrg ;; 791934977a2fSmrg *) 792034977a2fSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 792134977a2fSmrg ;; 792234977a2fSmrg esac 792334977a2fSmrg fi 7924ee3138f1Smrg else 792534977a2fSmrg eval flag=\"$hardcode_libdir_flag_spec\" 792634977a2fSmrg rpath="$rpath $flag" 7927ee3138f1Smrg fi 792834977a2fSmrg elif test -n "$runpath_var"; then 792934977a2fSmrg case "$perm_rpath " in 793034977a2fSmrg *" $libdir "*) ;; 793134977a2fSmrg *) perm_rpath="$perm_rpath $libdir" ;; 793234977a2fSmrg esac 793334977a2fSmrg fi 793434977a2fSmrg case $host in 793534977a2fSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 793634977a2fSmrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 793734977a2fSmrg case :$dllsearchpath: in 793834977a2fSmrg *":$libdir:"*) ;; 793934977a2fSmrg ::) dllsearchpath=$libdir;; 794034977a2fSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 794134977a2fSmrg esac 794234977a2fSmrg case :$dllsearchpath: in 794334977a2fSmrg *":$testbindir:"*) ;; 794434977a2fSmrg ::) dllsearchpath=$testbindir;; 794534977a2fSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 794634977a2fSmrg esac 794734977a2fSmrg ;; 794834977a2fSmrg esac 794934977a2fSmrg done 795034977a2fSmrg # Substitute the hardcoded libdirs into the rpath. 795134977a2fSmrg if test -n "$hardcode_libdir_separator" && 795234977a2fSmrg test -n "$hardcode_libdirs"; then 795334977a2fSmrg libdir="$hardcode_libdirs" 795434977a2fSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 795534977a2fSmrg fi 795634977a2fSmrg compile_rpath="$rpath" 7957ee3138f1Smrg 795834977a2fSmrg rpath= 795934977a2fSmrg hardcode_libdirs= 796034977a2fSmrg for libdir in $finalize_rpath; do 796134977a2fSmrg if test -n "$hardcode_libdir_flag_spec"; then 796234977a2fSmrg if test -n "$hardcode_libdir_separator"; then 796334977a2fSmrg if test -z "$hardcode_libdirs"; then 796434977a2fSmrg hardcode_libdirs="$libdir" 796534977a2fSmrg else 796634977a2fSmrg # Just accumulate the unique libdirs. 796734977a2fSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 796834977a2fSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 796934977a2fSmrg ;; 797034977a2fSmrg *) 797134977a2fSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 797234977a2fSmrg ;; 797334977a2fSmrg esac 797434977a2fSmrg fi 7975ee3138f1Smrg else 797634977a2fSmrg eval flag=\"$hardcode_libdir_flag_spec\" 797734977a2fSmrg rpath="$rpath $flag" 7978ee3138f1Smrg fi 797934977a2fSmrg elif test -n "$runpath_var"; then 798034977a2fSmrg case "$finalize_perm_rpath " in 798134977a2fSmrg *" $libdir "*) ;; 798234977a2fSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 798334977a2fSmrg esac 7984ee3138f1Smrg fi 798534977a2fSmrg done 798634977a2fSmrg # Substitute the hardcoded libdirs into the rpath. 798734977a2fSmrg if test -n "$hardcode_libdir_separator" && 798834977a2fSmrg test -n "$hardcode_libdirs"; then 798934977a2fSmrg libdir="$hardcode_libdirs" 799034977a2fSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 799134977a2fSmrg fi 799234977a2fSmrg finalize_rpath="$rpath" 7993ee3138f1Smrg 799434977a2fSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 799534977a2fSmrg # Transform all the library objects into standard objects. 7996b425557eSmrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 7997b425557eSmrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 799834977a2fSmrg fi 7999ee3138f1Smrg 800034977a2fSmrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8001ee3138f1Smrg 800234977a2fSmrg # template prelinking step 800334977a2fSmrg if test -n "$prelink_cmds"; then 800434977a2fSmrg func_execute_cmds "$prelink_cmds" 'exit $?' 800534977a2fSmrg fi 8006ee3138f1Smrg 800734977a2fSmrg wrappers_required=yes 800834977a2fSmrg case $host in 8009b425557eSmrg *cegcc* | *mingw32ce*) 8010b425557eSmrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8011b425557eSmrg wrappers_required=no 8012b425557eSmrg ;; 801334977a2fSmrg *cygwin* | *mingw* ) 801434977a2fSmrg if test "$build_libtool_libs" != yes; then 801534977a2fSmrg wrappers_required=no 801634977a2fSmrg fi 801734977a2fSmrg ;; 801834977a2fSmrg *) 801934977a2fSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 802034977a2fSmrg wrappers_required=no 802134977a2fSmrg fi 802234977a2fSmrg ;; 802334977a2fSmrg esac 802434977a2fSmrg if test "$wrappers_required" = no; then 802534977a2fSmrg # Replace the output file specification. 8026b425557eSmrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 802734977a2fSmrg link_command="$compile_command$compile_rpath" 8028ee3138f1Smrg 802934977a2fSmrg # We have no uninstalled library dependencies, so finalize right now. 803034977a2fSmrg exit_status=0 803134977a2fSmrg func_show_eval "$link_command" 'exit_status=$?' 8032ee3138f1Smrg 803334977a2fSmrg # Delete the generated files. 803434977a2fSmrg if test -f "$output_objdir/${outputname}S.${objext}"; then 803534977a2fSmrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8036ee3138f1Smrg fi 8037ee3138f1Smrg 803834977a2fSmrg exit $exit_status 803934977a2fSmrg fi 8040ee3138f1Smrg 804134977a2fSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 804234977a2fSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 804334977a2fSmrg fi 804434977a2fSmrg if test -n "$finalize_shlibpath"; then 804534977a2fSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 804634977a2fSmrg fi 8047ee3138f1Smrg 804834977a2fSmrg compile_var= 804934977a2fSmrg finalize_var= 805034977a2fSmrg if test -n "$runpath_var"; then 805134977a2fSmrg if test -n "$perm_rpath"; then 805234977a2fSmrg # We should set the runpath_var. 805334977a2fSmrg rpath= 805434977a2fSmrg for dir in $perm_rpath; do 805534977a2fSmrg rpath="$rpath$dir:" 805634977a2fSmrg done 805734977a2fSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8058ee3138f1Smrg fi 805934977a2fSmrg if test -n "$finalize_perm_rpath"; then 806034977a2fSmrg # We should set the runpath_var. 806134977a2fSmrg rpath= 806234977a2fSmrg for dir in $finalize_perm_rpath; do 806334977a2fSmrg rpath="$rpath$dir:" 806434977a2fSmrg done 806534977a2fSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8066ee3138f1Smrg fi 806734977a2fSmrg fi 8068ee3138f1Smrg 806934977a2fSmrg if test "$no_install" = yes; then 807034977a2fSmrg # We don't need to create a wrapper script. 807134977a2fSmrg link_command="$compile_var$compile_command$compile_rpath" 807234977a2fSmrg # Replace the output file specification. 8073b425557eSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 807434977a2fSmrg # Delete the old output file. 807534977a2fSmrg $opt_dry_run || $RM $output 807634977a2fSmrg # Link the executable and exit 807734977a2fSmrg func_show_eval "$link_command" 'exit $?' 8078ee3138f1Smrg exit $EXIT_SUCCESS 807934977a2fSmrg fi 8080ee3138f1Smrg 808134977a2fSmrg if test "$hardcode_action" = relink; then 808234977a2fSmrg # Fast installation is not supported 808334977a2fSmrg link_command="$compile_var$compile_command$compile_rpath" 808434977a2fSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 808534977a2fSmrg 808634977a2fSmrg func_warning "this platform does not like uninstalled shared libraries" 808734977a2fSmrg func_warning "\`$output' will be relinked during installation" 808834977a2fSmrg else 808934977a2fSmrg if test "$fast_install" != no; then 809034977a2fSmrg link_command="$finalize_var$compile_command$finalize_rpath" 809134977a2fSmrg if test "$fast_install" = yes; then 8092b425557eSmrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 809334977a2fSmrg else 809434977a2fSmrg # fast_install is set to needless 809534977a2fSmrg relink_command= 809634977a2fSmrg fi 8097ee3138f1Smrg else 809834977a2fSmrg link_command="$compile_var$compile_command$compile_rpath" 809934977a2fSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8100ee3138f1Smrg fi 810134977a2fSmrg fi 8102ee3138f1Smrg 810334977a2fSmrg # Replace the output file specification. 8104b425557eSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8105ee3138f1Smrg 810634977a2fSmrg # Delete the old output files. 810734977a2fSmrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8108ee3138f1Smrg 810934977a2fSmrg func_show_eval "$link_command" 'exit $?' 8110ee3138f1Smrg 811134977a2fSmrg # Now create the wrapper script. 811234977a2fSmrg func_verbose "creating $output" 8113ee3138f1Smrg 811434977a2fSmrg # Quote the relink command for shipping. 811534977a2fSmrg if test -n "$relink_command"; then 811634977a2fSmrg # Preserve any variables that may affect compiler behavior 811734977a2fSmrg for var in $variables_saved_for_relink; do 811834977a2fSmrg if eval test -z \"\${$var+set}\"; then 811934977a2fSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 812034977a2fSmrg elif eval var_value=\$$var; test -z "$var_value"; then 812134977a2fSmrg relink_command="$var=; export $var; $relink_command" 8122ee3138f1Smrg else 812334977a2fSmrg func_quote_for_eval "$var_value" 812434977a2fSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8125ee3138f1Smrg fi 812634977a2fSmrg done 812734977a2fSmrg relink_command="(cd `pwd`; $relink_command)" 8128b425557eSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 812934977a2fSmrg fi 813034977a2fSmrg 813134977a2fSmrg # Only actually do things if not in dry run mode. 813234977a2fSmrg $opt_dry_run || { 813334977a2fSmrg # win32 will think the script is a binary if it has 813434977a2fSmrg # a .exe suffix, so we strip it off here. 813534977a2fSmrg case $output in 813634977a2fSmrg *.exe) func_stripname '' '.exe' "$output" 813734977a2fSmrg output=$func_stripname_result ;; 813834977a2fSmrg esac 813934977a2fSmrg # test for cygwin because mv fails w/o .exe extensions 814034977a2fSmrg case $host in 814134977a2fSmrg *cygwin*) 814234977a2fSmrg exeext=.exe 814334977a2fSmrg func_stripname '' '.exe' "$outputname" 814434977a2fSmrg outputname=$func_stripname_result ;; 814534977a2fSmrg *) exeext= ;; 8146ee3138f1Smrg esac 814734977a2fSmrg case $host in 814834977a2fSmrg *cygwin* | *mingw* ) 814934977a2fSmrg func_dirname_and_basename "$output" "" "." 815034977a2fSmrg output_name=$func_basename_result 815134977a2fSmrg output_path=$func_dirname_result 815234977a2fSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 815334977a2fSmrg cwrapper="$output_path/$output_name.exe" 815434977a2fSmrg $RM $cwrappersource $cwrapper 815534977a2fSmrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 815634977a2fSmrg 815734977a2fSmrg func_emit_cwrapperexe_src > $cwrappersource 815834977a2fSmrg 815934977a2fSmrg # The wrapper executable is built using the $host compiler, 816034977a2fSmrg # because it contains $host paths and files. If cross- 816134977a2fSmrg # compiling, it, like the target executable, must be 816234977a2fSmrg # executed on the $host or under an emulation environment. 816334977a2fSmrg $opt_dry_run || { 816434977a2fSmrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 816534977a2fSmrg $STRIP $cwrapper 816634977a2fSmrg } 8167ee3138f1Smrg 816834977a2fSmrg # Now, create the wrapper script for func_source use: 816934977a2fSmrg func_ltwrapper_scriptname $cwrapper 817034977a2fSmrg $RM $func_ltwrapper_scriptname_result 817134977a2fSmrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 817234977a2fSmrg $opt_dry_run || { 817334977a2fSmrg # note: this script will not be executed, so do not chmod. 817434977a2fSmrg if test "x$build" = "x$host" ; then 817534977a2fSmrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 817634977a2fSmrg else 817734977a2fSmrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 817834977a2fSmrg fi 817934977a2fSmrg } 818034977a2fSmrg ;; 818134977a2fSmrg * ) 818234977a2fSmrg $RM $output 818334977a2fSmrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 8184ee3138f1Smrg 818534977a2fSmrg func_emit_wrapper no > $output 818634977a2fSmrg chmod +x $output 818734977a2fSmrg ;; 818834977a2fSmrg esac 818934977a2fSmrg } 819034977a2fSmrg exit $EXIT_SUCCESS 819134977a2fSmrg ;; 819234977a2fSmrg esac 8193ee3138f1Smrg 819434977a2fSmrg # See if we need to build an old-fashioned archive. 819534977a2fSmrg for oldlib in $oldlibs; do 8196ee3138f1Smrg 819734977a2fSmrg if test "$build_libtool_libs" = convenience; then 819834977a2fSmrg oldobjs="$libobjs_save $symfileobj" 819934977a2fSmrg addlibs="$convenience" 820034977a2fSmrg build_libtool_libs=no 820134977a2fSmrg else 820234977a2fSmrg if test "$build_libtool_libs" = module; then 820334977a2fSmrg oldobjs="$libobjs_save" 820434977a2fSmrg build_libtool_libs=no 820534977a2fSmrg else 820634977a2fSmrg oldobjs="$old_deplibs $non_pic_objects" 820734977a2fSmrg if test "$preload" = yes && test -f "$symfileobj"; then 820834977a2fSmrg oldobjs="$oldobjs $symfileobj" 820934977a2fSmrg fi 821034977a2fSmrg fi 821134977a2fSmrg addlibs="$old_convenience" 8212ee3138f1Smrg fi 8213ee3138f1Smrg 821434977a2fSmrg if test -n "$addlibs"; then 821534977a2fSmrg gentop="$output_objdir/${outputname}x" 821634977a2fSmrg generated="$generated $gentop" 8217ee3138f1Smrg 821834977a2fSmrg func_extract_archives $gentop $addlibs 821934977a2fSmrg oldobjs="$oldobjs $func_extract_archives_result" 822034977a2fSmrg fi 8221ee3138f1Smrg 822234977a2fSmrg # Do each command in the archive commands. 822334977a2fSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 822434977a2fSmrg cmds=$old_archive_from_new_cmds 822534977a2fSmrg else 8226ee3138f1Smrg 822734977a2fSmrg # Add any objects from preloaded convenience libraries 822834977a2fSmrg if test -n "$dlprefiles"; then 822934977a2fSmrg gentop="$output_objdir/${outputname}x" 823034977a2fSmrg generated="$generated $gentop" 8231ee3138f1Smrg 823234977a2fSmrg func_extract_archives $gentop $dlprefiles 823334977a2fSmrg oldobjs="$oldobjs $func_extract_archives_result" 823434977a2fSmrg fi 8235ee3138f1Smrg 823634977a2fSmrg # POSIX demands no paths to be encoded in archives. We have 823734977a2fSmrg # to avoid creating archives with duplicate basenames if we 823834977a2fSmrg # might have to extract them afterwards, e.g., when creating a 823934977a2fSmrg # static archive out of a convenience library, or when linking 824034977a2fSmrg # the entirety of a libtool archive into another (currently 824134977a2fSmrg # not supported by libtool). 824234977a2fSmrg if (for obj in $oldobjs 824334977a2fSmrg do 824434977a2fSmrg func_basename "$obj" 824534977a2fSmrg $ECHO "$func_basename_result" 824634977a2fSmrg done | sort | sort -uc >/dev/null 2>&1); then 824734977a2fSmrg : 824834977a2fSmrg else 8249b425557eSmrg echo "copying selected object files to avoid basename conflicts..." 825034977a2fSmrg gentop="$output_objdir/${outputname}x" 825134977a2fSmrg generated="$generated $gentop" 825234977a2fSmrg func_mkdir_p "$gentop" 825334977a2fSmrg save_oldobjs=$oldobjs 825434977a2fSmrg oldobjs= 825534977a2fSmrg counter=1 825634977a2fSmrg for obj in $save_oldobjs 825734977a2fSmrg do 825834977a2fSmrg func_basename "$obj" 825934977a2fSmrg objbase="$func_basename_result" 826034977a2fSmrg case " $oldobjs " in 826134977a2fSmrg " ") oldobjs=$obj ;; 826234977a2fSmrg *[\ /]"$objbase "*) 826334977a2fSmrg while :; do 826434977a2fSmrg # Make sure we don't pick an alternate name that also 826534977a2fSmrg # overlaps. 826634977a2fSmrg newobj=lt$counter-$objbase 826734977a2fSmrg func_arith $counter + 1 826834977a2fSmrg counter=$func_arith_result 826934977a2fSmrg case " $oldobjs " in 827034977a2fSmrg *[\ /]"$newobj "*) ;; 827134977a2fSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 827234977a2fSmrg esac 827334977a2fSmrg done 827434977a2fSmrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 827534977a2fSmrg oldobjs="$oldobjs $gentop/$newobj" 827634977a2fSmrg ;; 827734977a2fSmrg *) oldobjs="$oldobjs $obj" ;; 827834977a2fSmrg esac 8279ee3138f1Smrg done 8280ee3138f1Smrg fi 828134977a2fSmrg eval cmds=\"$old_archive_cmds\" 8282ee3138f1Smrg 828334977a2fSmrg func_len " $cmds" 828434977a2fSmrg len=$func_len_result 828534977a2fSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 828634977a2fSmrg cmds=$old_archive_cmds 828734977a2fSmrg else 828834977a2fSmrg # the command line is too long to link in one step, link in parts 828934977a2fSmrg func_verbose "using piecewise archive linking..." 829034977a2fSmrg save_RANLIB=$RANLIB 829134977a2fSmrg RANLIB=: 829234977a2fSmrg objlist= 829334977a2fSmrg concat_cmds= 829434977a2fSmrg save_oldobjs=$oldobjs 829534977a2fSmrg oldobjs= 829634977a2fSmrg # Is there a better way of finding the last object in the list? 829734977a2fSmrg for obj in $save_oldobjs 829834977a2fSmrg do 829934977a2fSmrg last_oldobj=$obj 830034977a2fSmrg done 830134977a2fSmrg eval test_cmds=\"$old_archive_cmds\" 830234977a2fSmrg func_len " $test_cmds" 830334977a2fSmrg len0=$func_len_result 830434977a2fSmrg len=$len0 830534977a2fSmrg for obj in $save_oldobjs 830634977a2fSmrg do 830734977a2fSmrg func_len " $obj" 830834977a2fSmrg func_arith $len + $func_len_result 830934977a2fSmrg len=$func_arith_result 831034977a2fSmrg func_append objlist " $obj" 831134977a2fSmrg if test "$len" -lt "$max_cmd_len"; then 831234977a2fSmrg : 831334977a2fSmrg else 831434977a2fSmrg # the above command should be used before it gets too long 831534977a2fSmrg oldobjs=$objlist 831634977a2fSmrg if test "$obj" = "$last_oldobj" ; then 831734977a2fSmrg RANLIB=$save_RANLIB 831834977a2fSmrg fi 831934977a2fSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 832034977a2fSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 832134977a2fSmrg objlist= 832234977a2fSmrg len=$len0 832334977a2fSmrg fi 832434977a2fSmrg done 832534977a2fSmrg RANLIB=$save_RANLIB 832634977a2fSmrg oldobjs=$objlist 832734977a2fSmrg if test "X$oldobjs" = "X" ; then 832834977a2fSmrg eval cmds=\"\$concat_cmds\" 832934977a2fSmrg else 833034977a2fSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 833134977a2fSmrg fi 833234977a2fSmrg fi 833334977a2fSmrg fi 833434977a2fSmrg func_execute_cmds "$cmds" 'exit $?' 8335ee3138f1Smrg done 8336ee3138f1Smrg 833734977a2fSmrg test -n "$generated" && \ 833834977a2fSmrg func_show_eval "${RM}r$generated" 8339ee3138f1Smrg 834034977a2fSmrg # Now create the libtool archive. 834134977a2fSmrg case $output in 834234977a2fSmrg *.la) 834334977a2fSmrg old_library= 834434977a2fSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 834534977a2fSmrg func_verbose "creating $output" 8346ee3138f1Smrg 834734977a2fSmrg # Preserve any variables that may affect compiler behavior 834834977a2fSmrg for var in $variables_saved_for_relink; do 834934977a2fSmrg if eval test -z \"\${$var+set}\"; then 835034977a2fSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 835134977a2fSmrg elif eval var_value=\$$var; test -z "$var_value"; then 835234977a2fSmrg relink_command="$var=; export $var; $relink_command" 8353ee3138f1Smrg else 835434977a2fSmrg func_quote_for_eval "$var_value" 835534977a2fSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8356ee3138f1Smrg fi 835734977a2fSmrg done 835834977a2fSmrg # Quote the link command for shipping. 835934977a2fSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 8360b425557eSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 836134977a2fSmrg if test "$hardcode_automatic" = yes ; then 836234977a2fSmrg relink_command= 836334977a2fSmrg fi 8364ee3138f1Smrg 836534977a2fSmrg # Only create the output if not a dry run. 836634977a2fSmrg $opt_dry_run || { 836734977a2fSmrg for installed in no yes; do 836834977a2fSmrg if test "$installed" = yes; then 836934977a2fSmrg if test -z "$install_libdir"; then 837034977a2fSmrg break 837134977a2fSmrg fi 837234977a2fSmrg output="$output_objdir/$outputname"i 837334977a2fSmrg # Replace all uninstalled libtool libraries with the installed ones 837434977a2fSmrg newdependency_libs= 837534977a2fSmrg for deplib in $dependency_libs; do 837634977a2fSmrg case $deplib in 837734977a2fSmrg *.la) 837834977a2fSmrg func_basename "$deplib" 837934977a2fSmrg name="$func_basename_result" 838034977a2fSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 838134977a2fSmrg test -z "$libdir" && \ 838234977a2fSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 838334977a2fSmrg newdependency_libs="$newdependency_libs $libdir/$name" 838434977a2fSmrg ;; 838534977a2fSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 838634977a2fSmrg esac 838734977a2fSmrg done 838834977a2fSmrg dependency_libs="$newdependency_libs" 838934977a2fSmrg newdlfiles= 839034977a2fSmrg 839134977a2fSmrg for lib in $dlfiles; do 839234977a2fSmrg case $lib in 839334977a2fSmrg *.la) 839434977a2fSmrg func_basename "$lib" 839534977a2fSmrg name="$func_basename_result" 839634977a2fSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 839734977a2fSmrg test -z "$libdir" && \ 839834977a2fSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 839934977a2fSmrg newdlfiles="$newdlfiles $libdir/$name" 840034977a2fSmrg ;; 840134977a2fSmrg *) newdlfiles="$newdlfiles $lib" ;; 840234977a2fSmrg esac 840334977a2fSmrg done 840434977a2fSmrg dlfiles="$newdlfiles" 840534977a2fSmrg newdlprefiles= 840634977a2fSmrg for lib in $dlprefiles; do 840734977a2fSmrg case $lib in 840834977a2fSmrg *.la) 840934977a2fSmrg # Only pass preopened files to the pseudo-archive (for 841034977a2fSmrg # eventual linking with the app. that links it) if we 841134977a2fSmrg # didn't already link the preopened objects directly into 841234977a2fSmrg # the library: 841334977a2fSmrg func_basename "$lib" 841434977a2fSmrg name="$func_basename_result" 841534977a2fSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 841634977a2fSmrg test -z "$libdir" && \ 841734977a2fSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 841834977a2fSmrg newdlprefiles="$newdlprefiles $libdir/$name" 841934977a2fSmrg ;; 842034977a2fSmrg esac 842134977a2fSmrg done 842234977a2fSmrg dlprefiles="$newdlprefiles" 842334977a2fSmrg else 842434977a2fSmrg newdlfiles= 842534977a2fSmrg for lib in $dlfiles; do 842634977a2fSmrg case $lib in 842734977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 842834977a2fSmrg *) abs=`pwd`"/$lib" ;; 842934977a2fSmrg esac 843034977a2fSmrg newdlfiles="$newdlfiles $abs" 843134977a2fSmrg done 843234977a2fSmrg dlfiles="$newdlfiles" 843334977a2fSmrg newdlprefiles= 843434977a2fSmrg for lib in $dlprefiles; do 843534977a2fSmrg case $lib in 843634977a2fSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 843734977a2fSmrg *) abs=`pwd`"/$lib" ;; 843834977a2fSmrg esac 843934977a2fSmrg newdlprefiles="$newdlprefiles $abs" 844034977a2fSmrg done 844134977a2fSmrg dlprefiles="$newdlprefiles" 844234977a2fSmrg fi 844334977a2fSmrg $RM $output 844434977a2fSmrg # place dlname in correct position for cygwin 8445b425557eSmrg # In fact, it would be nice if we could use this code for all target 8446b425557eSmrg # systems that can't hard-code library paths into their executables 8447b425557eSmrg # and that have no shared library path variable independent of PATH, 8448b425557eSmrg # but it turns out we can't easily determine that from inspecting 8449b425557eSmrg # libtool variables, so we have to hard-code the OSs to which it 8450b425557eSmrg # applies here; at the moment, that means platforms that use the PE 8451b425557eSmrg # object format with DLL files. See the long comment at the top of 8452b425557eSmrg # tests/bindir.at for full details. 845334977a2fSmrg tdlname=$dlname 845434977a2fSmrg case $host,$output,$installed,$module,$dlname in 8455b425557eSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 8456b425557eSmrg # If a -bindir argument was supplied, place the dll there. 8457b425557eSmrg if test "x$bindir" != x ; 8458b425557eSmrg then 8459b425557eSmrg func_relative_path "$install_libdir" "$bindir" 8460b425557eSmrg tdlname=$func_relative_path_result$dlname 8461b425557eSmrg else 8462b425557eSmrg # Otherwise fall back on heuristic. 8463b425557eSmrg tdlname=../bin/$dlname 8464b425557eSmrg fi 8465b425557eSmrg ;; 846634977a2fSmrg esac 846734977a2fSmrg $ECHO > $output "\ 846834977a2fSmrg# $outputname - a libtool library file 846934977a2fSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 847034977a2fSmrg# 847134977a2fSmrg# Please DO NOT delete this file! 847234977a2fSmrg# It is necessary for linking the library. 8473ee3138f1Smrg 847434977a2fSmrg# The name that we can dlopen(3). 847534977a2fSmrgdlname='$tdlname' 8476ee3138f1Smrg 847734977a2fSmrg# Names of this library. 847834977a2fSmrglibrary_names='$library_names' 8479ee3138f1Smrg 848034977a2fSmrg# The name of the static archive. 848134977a2fSmrgold_library='$old_library' 8482ee3138f1Smrg 848334977a2fSmrg# Linker flags that can not go in dependency_libs. 848434977a2fSmrginherited_linker_flags='$new_inherited_linker_flags' 8485ee3138f1Smrg 848634977a2fSmrg# Libraries that this one depends upon. 848734977a2fSmrgdependency_libs='$dependency_libs' 8488ee3138f1Smrg 848934977a2fSmrg# Names of additional weak libraries provided by this library 849034977a2fSmrgweak_library_names='$weak_libs' 8491ee3138f1Smrg 849234977a2fSmrg# Version information for $libname. 849334977a2fSmrgcurrent=$current 849434977a2fSmrgage=$age 849534977a2fSmrgrevision=$revision 8496ee3138f1Smrg 849734977a2fSmrg# Is this an already installed library? 849834977a2fSmrginstalled=$installed 8499ee3138f1Smrg 850034977a2fSmrg# Should we warn about portability when linking against -modules? 850134977a2fSmrgshouldnotlink=$module 8502ee3138f1Smrg 850334977a2fSmrg# Files to dlopen/dlpreopen 850434977a2fSmrgdlopen='$dlfiles' 850534977a2fSmrgdlpreopen='$dlprefiles' 8506ee3138f1Smrg 850734977a2fSmrg# Directory that this library needs to be installed in: 850834977a2fSmrglibdir='$install_libdir'" 850934977a2fSmrg if test "$installed" = no && test "$need_relink" = yes; then 851034977a2fSmrg $ECHO >> $output "\ 851134977a2fSmrgrelink_command=\"$relink_command\"" 851234977a2fSmrg fi 851334977a2fSmrg done 851434977a2fSmrg } 8515ee3138f1Smrg 851634977a2fSmrg # Do a symbolic link so that the libtool archive can be found in 851734977a2fSmrg # LD_LIBRARY_PATH before the program is installed. 851834977a2fSmrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 851934977a2fSmrg ;; 852034977a2fSmrg esac 852134977a2fSmrg exit $EXIT_SUCCESS 852234977a2fSmrg} 8523ee3138f1Smrg 852434977a2fSmrg{ test "$mode" = link || test "$mode" = relink; } && 852534977a2fSmrg func_mode_link ${1+"$@"} 8526ee3138f1Smrg 8527ee3138f1Smrg 852834977a2fSmrg# func_mode_uninstall arg... 852934977a2fSmrgfunc_mode_uninstall () 853034977a2fSmrg{ 853134977a2fSmrg $opt_debug 853234977a2fSmrg RM="$nonopt" 8533ee3138f1Smrg files= 8534ee3138f1Smrg rmforce= 8535ee3138f1Smrg exit_status=0 8536ee3138f1Smrg 8537ee3138f1Smrg # This variable tells wrapper scripts just to set variables rather 8538ee3138f1Smrg # than running their programs. 8539ee3138f1Smrg libtool_install_magic="$magic" 8540ee3138f1Smrg 8541ee3138f1Smrg for arg 8542ee3138f1Smrg do 8543ee3138f1Smrg case $arg in 854434977a2fSmrg -f) RM="$RM $arg"; rmforce=yes ;; 854534977a2fSmrg -*) RM="$RM $arg" ;; 8546ee3138f1Smrg *) files="$files $arg" ;; 8547ee3138f1Smrg esac 8548ee3138f1Smrg done 8549ee3138f1Smrg 855034977a2fSmrg test -z "$RM" && \ 855134977a2fSmrg func_fatal_help "you must specify an RM program" 8552ee3138f1Smrg 8553ee3138f1Smrg rmdirs= 8554ee3138f1Smrg 8555ee3138f1Smrg origobjdir="$objdir" 8556ee3138f1Smrg for file in $files; do 855734977a2fSmrg func_dirname "$file" "" "." 855834977a2fSmrg dir="$func_dirname_result" 855934977a2fSmrg if test "X$dir" = X.; then 8560ee3138f1Smrg objdir="$origobjdir" 8561ee3138f1Smrg else 8562ee3138f1Smrg objdir="$dir/$origobjdir" 8563ee3138f1Smrg fi 856434977a2fSmrg func_basename "$file" 856534977a2fSmrg name="$func_basename_result" 8566ee3138f1Smrg test "$mode" = uninstall && objdir="$dir" 8567ee3138f1Smrg 8568ee3138f1Smrg # Remember objdir for removal later, being careful to avoid duplicates 8569ee3138f1Smrg if test "$mode" = clean; then 8570ee3138f1Smrg case " $rmdirs " in 8571ee3138f1Smrg *" $objdir "*) ;; 8572ee3138f1Smrg *) rmdirs="$rmdirs $objdir" ;; 8573ee3138f1Smrg esac 8574ee3138f1Smrg fi 8575ee3138f1Smrg 8576ee3138f1Smrg # Don't error if the file doesn't exist and rm -f was used. 857734977a2fSmrg if { test -L "$file"; } >/dev/null 2>&1 || 857834977a2fSmrg { test -h "$file"; } >/dev/null 2>&1 || 857934977a2fSmrg test -f "$file"; then 8580ee3138f1Smrg : 8581ee3138f1Smrg elif test -d "$file"; then 8582ee3138f1Smrg exit_status=1 8583ee3138f1Smrg continue 8584ee3138f1Smrg elif test "$rmforce" = yes; then 8585ee3138f1Smrg continue 8586ee3138f1Smrg fi 8587ee3138f1Smrg 8588ee3138f1Smrg rmfiles="$file" 8589ee3138f1Smrg 8590ee3138f1Smrg case $name in 8591ee3138f1Smrg *.la) 8592ee3138f1Smrg # Possibly a libtool archive, so verify it. 859334977a2fSmrg if func_lalib_p "$file"; then 859434977a2fSmrg func_source $dir/$name 8595ee3138f1Smrg 8596ee3138f1Smrg # Delete the libtool libraries and symlinks. 8597ee3138f1Smrg for n in $library_names; do 8598ee3138f1Smrg rmfiles="$rmfiles $objdir/$n" 8599ee3138f1Smrg done 8600ee3138f1Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8601ee3138f1Smrg 8602ee3138f1Smrg case "$mode" in 8603ee3138f1Smrg clean) 8604ee3138f1Smrg case " $library_names " in 8605ee3138f1Smrg # " " in the beginning catches empty $dlname 8606ee3138f1Smrg *" $dlname "*) ;; 8607ee3138f1Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 8608ee3138f1Smrg esac 860934977a2fSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8610ee3138f1Smrg ;; 8611ee3138f1Smrg uninstall) 8612ee3138f1Smrg if test -n "$library_names"; then 8613ee3138f1Smrg # Do each command in the postuninstall commands. 861434977a2fSmrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8615ee3138f1Smrg fi 8616ee3138f1Smrg 8617ee3138f1Smrg if test -n "$old_library"; then 8618ee3138f1Smrg # Do each command in the old_postuninstall commands. 861934977a2fSmrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8620ee3138f1Smrg fi 8621ee3138f1Smrg # FIXME: should reinstall the best remaining shared library. 8622ee3138f1Smrg ;; 8623ee3138f1Smrg esac 8624ee3138f1Smrg fi 8625ee3138f1Smrg ;; 8626ee3138f1Smrg 8627ee3138f1Smrg *.lo) 8628ee3138f1Smrg # Possibly a libtool object, so verify it. 862934977a2fSmrg if func_lalib_p "$file"; then 8630ee3138f1Smrg 8631ee3138f1Smrg # Read the .lo file 863234977a2fSmrg func_source $dir/$name 8633ee3138f1Smrg 8634ee3138f1Smrg # Add PIC object to the list of files to remove. 863534977a2fSmrg if test -n "$pic_object" && 863634977a2fSmrg test "$pic_object" != none; then 8637ee3138f1Smrg rmfiles="$rmfiles $dir/$pic_object" 8638ee3138f1Smrg fi 8639ee3138f1Smrg 8640ee3138f1Smrg # Add non-PIC object to the list of files to remove. 864134977a2fSmrg if test -n "$non_pic_object" && 864234977a2fSmrg test "$non_pic_object" != none; then 8643ee3138f1Smrg rmfiles="$rmfiles $dir/$non_pic_object" 8644ee3138f1Smrg fi 8645ee3138f1Smrg fi 8646ee3138f1Smrg ;; 8647ee3138f1Smrg 8648ee3138f1Smrg *) 8649ee3138f1Smrg if test "$mode" = clean ; then 8650ee3138f1Smrg noexename=$name 8651ee3138f1Smrg case $file in 8652ee3138f1Smrg *.exe) 865334977a2fSmrg func_stripname '' '.exe' "$file" 865434977a2fSmrg file=$func_stripname_result 865534977a2fSmrg func_stripname '' '.exe' "$name" 865634977a2fSmrg noexename=$func_stripname_result 8657ee3138f1Smrg # $file with .exe has already been added to rmfiles, 8658ee3138f1Smrg # add $file without .exe 8659ee3138f1Smrg rmfiles="$rmfiles $file" 8660ee3138f1Smrg ;; 8661ee3138f1Smrg esac 8662ee3138f1Smrg # Do a test to see if this is a libtool program. 866334977a2fSmrg if func_ltwrapper_p "$file"; then 866434977a2fSmrg if func_ltwrapper_executable_p "$file"; then 866534977a2fSmrg func_ltwrapper_scriptname "$file" 866634977a2fSmrg relink_command= 866734977a2fSmrg func_source $func_ltwrapper_scriptname_result 866834977a2fSmrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 866934977a2fSmrg else 867034977a2fSmrg relink_command= 867134977a2fSmrg func_source $dir/$noexename 867234977a2fSmrg fi 8673ee3138f1Smrg 8674ee3138f1Smrg # note $name still contains .exe if it was in $file originally 8675ee3138f1Smrg # as does the version of $file that was added into $rmfiles 8676ee3138f1Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8677ee3138f1Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 8678ee3138f1Smrg rmfiles="$rmfiles $objdir/lt-$name" 8679ee3138f1Smrg fi 8680ee3138f1Smrg if test "X$noexename" != "X$name" ; then 8681ee3138f1Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8682ee3138f1Smrg fi 8683ee3138f1Smrg fi 8684ee3138f1Smrg fi 8685ee3138f1Smrg ;; 8686ee3138f1Smrg esac 868734977a2fSmrg func_show_eval "$RM $rmfiles" 'exit_status=1' 8688ee3138f1Smrg done 8689ee3138f1Smrg objdir="$origobjdir" 8690ee3138f1Smrg 8691ee3138f1Smrg # Try to remove the ${objdir}s in the directories where we deleted files 8692ee3138f1Smrg for dir in $rmdirs; do 8693ee3138f1Smrg if test -d "$dir"; then 869434977a2fSmrg func_show_eval "rmdir $dir >/dev/null 2>&1" 8695ee3138f1Smrg fi 8696ee3138f1Smrg done 8697ee3138f1Smrg 8698ee3138f1Smrg exit $exit_status 869934977a2fSmrg} 8700ee3138f1Smrg 870134977a2fSmrg{ test "$mode" = uninstall || test "$mode" = clean; } && 870234977a2fSmrg func_mode_uninstall ${1+"$@"} 8703ee3138f1Smrg 870434977a2fSmrgtest -z "$mode" && { 870534977a2fSmrg help="$generic_help" 870634977a2fSmrg func_fatal_help "you must specify a MODE" 870734977a2fSmrg} 870834977a2fSmrg 870934977a2fSmrgtest -z "$exec_cmd" && \ 871034977a2fSmrg func_fatal_help "invalid operation mode \`$mode'" 8711ee3138f1Smrg 8712ee3138f1Smrgif test -n "$exec_cmd"; then 871334977a2fSmrg eval exec "$exec_cmd" 8714ee3138f1Smrg exit $EXIT_FAILURE 8715ee3138f1Smrgfi 8716ee3138f1Smrg 871734977a2fSmrgexit $exit_status 8718ee3138f1Smrg 8719ee3138f1Smrg 8720ee3138f1Smrg# The TAGs below are defined such that we never get into a situation 8721ee3138f1Smrg# in which we disable both kinds of libraries. Given conflicting 8722ee3138f1Smrg# choices, we go for a static library, that is the most portable, 8723ee3138f1Smrg# since we can't tell whether shared libraries were disabled because 8724ee3138f1Smrg# the user asked for that or because the platform doesn't support 8725ee3138f1Smrg# them. This is particularly important on AIX, because we don't 8726ee3138f1Smrg# support having both static and shared libraries enabled at the same 8727ee3138f1Smrg# time on that platform, so we default to a shared-only configuration. 8728ee3138f1Smrg# If a disable-shared tag is given, we'll fallback to a static-only 8729ee3138f1Smrg# configuration. But we'll never go from static-only to shared-only. 8730ee3138f1Smrg 8731ee3138f1Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 873234977a2fSmrgbuild_libtool_libs=no 873334977a2fSmrgbuild_old_libs=yes 8734ee3138f1Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 8735ee3138f1Smrg 8736ee3138f1Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 873734977a2fSmrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8738ee3138f1Smrg# ### END LIBTOOL TAG CONFIG: disable-static 8739ee3138f1Smrg 8740ee3138f1Smrg# Local Variables: 8741ee3138f1Smrg# mode:shell-script 8742ee3138f1Smrg# sh-indentation:2 8743ee3138f1Smrg# End: 874434977a2fSmrg# vi:sw=2 874534977a2fSmrg 8746