ltmain.sh revision 2a75d1c4
12a75d1c4Smrg 22a75d1c4Smrg# libtool (GNU libtool) 2.4 32a75d1c4Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 42a75d1c4Smrg 57ce7e03cSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 62a75d1c4Smrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 72a75d1c4Smrg# This is free software; see the source for copying conditions. There is NO 82a75d1c4Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 92a75d1c4Smrg 102a75d1c4Smrg# GNU Libtool is free software; you can redistribute it and/or modify 11f7ec340bSmacallan# it under the terms of the GNU General Public License as published by 12f7ec340bSmacallan# the Free Software Foundation; either version 2 of the License, or 13f7ec340bSmacallan# (at your option) any later version. 14f7ec340bSmacallan# 152a75d1c4Smrg# As a special exception to the GNU General Public License, 162a75d1c4Smrg# if you distribute this file as part of a program or library that 172a75d1c4Smrg# is built using GNU Libtool, you may include this file under the 182a75d1c4Smrg# same distribution terms that you use for the rest of that program. 192a75d1c4Smrg# 202a75d1c4Smrg# GNU Libtool is distributed in the hope that it will be useful, but 21f7ec340bSmacallan# WITHOUT ANY WARRANTY; without even the implied warranty of 22f7ec340bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23f7ec340bSmacallan# General Public License for more details. 24f7ec340bSmacallan# 25f7ec340bSmacallan# You should have received a copy of the GNU General Public License 262a75d1c4Smrg# along with GNU Libtool; see the file COPYING. If not, a copy 272a75d1c4Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 282a75d1c4Smrg# or obtained by writing to the Free Software Foundation, Inc., 292a75d1c4Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30f7ec340bSmacallan 312a75d1c4Smrg# Usage: $progname [OPTION]... [MODE-ARG]... 322a75d1c4Smrg# 332a75d1c4Smrg# Provide generalized library-building support services. 342a75d1c4Smrg# 352a75d1c4Smrg# --config show all configuration variables 362a75d1c4Smrg# --debug enable verbose shell tracing 372a75d1c4Smrg# -n, --dry-run display commands without modifying any files 382a75d1c4Smrg# --features display basic configuration information and exit 392a75d1c4Smrg# --mode=MODE use operation mode MODE 402a75d1c4Smrg# --preserve-dup-deps don't remove duplicate dependency libraries 412a75d1c4Smrg# --quiet, --silent don't print informational messages 422a75d1c4Smrg# --no-quiet, --no-silent 432a75d1c4Smrg# print informational messages (default) 442a75d1c4Smrg# --tag=TAG use configuration variables from tag TAG 452a75d1c4Smrg# -v, --verbose print more informational messages than default 462a75d1c4Smrg# --no-verbose don't print the extra informational messages 472a75d1c4Smrg# --version print version information 482a75d1c4Smrg# -h, --help, --help-all print short, long, or detailed help message 492a75d1c4Smrg# 502a75d1c4Smrg# MODE must be one of the following: 512a75d1c4Smrg# 522a75d1c4Smrg# clean remove files from the build directory 532a75d1c4Smrg# compile compile a source file into a libtool object 542a75d1c4Smrg# execute automatically set library path, then run a program 552a75d1c4Smrg# finish complete the installation of libtool libraries 562a75d1c4Smrg# install install libraries or executables 572a75d1c4Smrg# link create a library or an executable 582a75d1c4Smrg# uninstall remove libraries from an installed directory 592a75d1c4Smrg# 602a75d1c4Smrg# MODE-ARGS vary depending on the MODE. When passed as first option, 612a75d1c4Smrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 622a75d1c4Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 632a75d1c4Smrg# 642a75d1c4Smrg# When reporting a bug, please describe a test case to reproduce it and 652a75d1c4Smrg# include the following information: 662a75d1c4Smrg# 672a75d1c4Smrg# host-triplet: $host 682a75d1c4Smrg# shell: $SHELL 692a75d1c4Smrg# compiler: $LTCC 702a75d1c4Smrg# compiler flags: $LTCFLAGS 712a75d1c4Smrg# linker: $LD (gnu? $with_gnu_ld) 722a75d1c4Smrg# $progname: (GNU libtool) 2.4 732a75d1c4Smrg# automake: $automake_version 742a75d1c4Smrg# autoconf: $autoconf_version 752a75d1c4Smrg# 762a75d1c4Smrg# Report bugs to <bug-libtool@gnu.org>. 772a75d1c4Smrg# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 782a75d1c4Smrg# General help using GNU software: <http://www.gnu.org/gethelp/>. 79f7ec340bSmacallan 802a75d1c4SmrgPROGRAM=libtool 81f7ec340bSmacallanPACKAGE=libtool 822a75d1c4SmrgVERSION=2.4 832a75d1c4SmrgTIMESTAMP="" 842a75d1c4Smrgpackage_revision=1.3293 857ce7e03cSmrg 862a75d1c4Smrg# Be Bourne compatible 877ce7e03cSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 887ce7e03cSmrg emulate sh 897ce7e03cSmrg NULLCMD=: 907ce7e03cSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 917ce7e03cSmrg # is contrary to our usage. Disable this feature. 927ce7e03cSmrg alias -g '${1+"$@"}'='"$@"' 93f7ec340bSmacallan setopt NO_GLOB_SUBST 947ce7e03cSmrgelse 957ce7e03cSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 96f7ec340bSmacallanfi 977ce7e03cSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 987ce7e03cSmrgDUALCASE=1; export DUALCASE # for MKS sh 99f7ec340bSmacallan 1002a75d1c4Smrg# A function that is used when there is no print builtin or printf. 1012a75d1c4Smrgfunc_fallback_echo () 1022a75d1c4Smrg{ 1032a75d1c4Smrg eval 'cat <<_LTECHO_EOF 1042a75d1c4Smrg$1 1052a75d1c4Smrg_LTECHO_EOF' 1062a75d1c4Smrg} 107f7ec340bSmacallan 1082a75d1c4Smrg# NLS nuisances: We save the old values to restore during execute mode. 1092a75d1c4Smrglt_user_locale= 1102a75d1c4Smrglt_safe_locale= 1117ce7e03cSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1127ce7e03cSmrgdo 1137ce7e03cSmrg eval "if test \"\${$lt_var+set}\" = set; then 1142a75d1c4Smrg save_$lt_var=\$$lt_var 1152a75d1c4Smrg $lt_var=C 1167ce7e03cSmrg export $lt_var 1172a75d1c4Smrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 1182a75d1c4Smrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 1197ce7e03cSmrg fi" 1207ce7e03cSmrgdone 1212a75d1c4SmrgLC_ALL=C 1222a75d1c4SmrgLANGUAGE=C 1232a75d1c4Smrgexport LANGUAGE LC_ALL 1242a75d1c4Smrg 1252a75d1c4Smrg$lt_unset CDPATH 1267ce7e03cSmrg 1272a75d1c4Smrg 1282a75d1c4Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1292a75d1c4Smrg# is ksh but when the shell is invoked as "sh" and the current value of 1302a75d1c4Smrg# the _XPG environment variable is not equal to 1 (one), the special 1312a75d1c4Smrg# positional parameter $0, within a function call, is the name of the 1322a75d1c4Smrg# function. 1332a75d1c4Smrgprogpath="$0" 1342a75d1c4Smrg 1352a75d1c4Smrg 1362a75d1c4Smrg 1372a75d1c4Smrg: ${CP="cp -f"} 1382a75d1c4Smrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 1392a75d1c4Smrg: ${EGREP="grep -E"} 1402a75d1c4Smrg: ${FGREP="grep -F"} 1412a75d1c4Smrg: ${GREP="grep"} 1422a75d1c4Smrg: ${LN_S="ln -s"} 1432a75d1c4Smrg: ${MAKE="make"} 1442a75d1c4Smrg: ${MKDIR="mkdir"} 1452a75d1c4Smrg: ${MV="mv -f"} 1462a75d1c4Smrg: ${RM="rm -f"} 1472a75d1c4Smrg: ${SED="sed"} 1482a75d1c4Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 1492a75d1c4Smrg: ${Xsed="$SED -e 1s/^X//"} 1502a75d1c4Smrg 1512a75d1c4Smrg# Global variables: 1522a75d1c4SmrgEXIT_SUCCESS=0 1532a75d1c4SmrgEXIT_FAILURE=1 1542a75d1c4SmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 1552a75d1c4SmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 1562a75d1c4Smrg 1572a75d1c4Smrgexit_status=$EXIT_SUCCESS 158f7ec340bSmacallan 159f7ec340bSmacallan# Make sure IFS has a sensible default 160f7ec340bSmacallanlt_nl=' 161f7ec340bSmacallan' 162f7ec340bSmacallanIFS=" $lt_nl" 163f7ec340bSmacallan 1642a75d1c4Smrgdirname="s,/[^/]*$,," 1652a75d1c4Smrgbasename="s,^.*/,," 166f7ec340bSmacallan 1672a75d1c4Smrg# func_dirname file append nondir_replacement 1682a75d1c4Smrg# Compute the dirname of FILE. If nonempty, add APPEND to the result, 1692a75d1c4Smrg# otherwise set result to NONDIR_REPLACEMENT. 1702a75d1c4Smrgfunc_dirname () 1712a75d1c4Smrg{ 1722a75d1c4Smrg func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 1732a75d1c4Smrg if test "X$func_dirname_result" = "X${1}"; then 1742a75d1c4Smrg func_dirname_result="${3}" 1752a75d1c4Smrg else 1762a75d1c4Smrg func_dirname_result="$func_dirname_result${2}" 1772a75d1c4Smrg fi 1782a75d1c4Smrg} # func_dirname may be replaced by extended shell implementation 1792a75d1c4Smrg 1802a75d1c4Smrg 1812a75d1c4Smrg# func_basename file 1822a75d1c4Smrgfunc_basename () 1832a75d1c4Smrg{ 1842a75d1c4Smrg func_basename_result=`$ECHO "${1}" | $SED "$basename"` 1852a75d1c4Smrg} # func_basename may be replaced by extended shell implementation 1862a75d1c4Smrg 1872a75d1c4Smrg 1882a75d1c4Smrg# func_dirname_and_basename file append nondir_replacement 1892a75d1c4Smrg# perform func_basename and func_dirname in a single function 1902a75d1c4Smrg# call: 1912a75d1c4Smrg# dirname: Compute the dirname of FILE. If nonempty, 1922a75d1c4Smrg# add APPEND to the result, otherwise set result 1932a75d1c4Smrg# to NONDIR_REPLACEMENT. 1942a75d1c4Smrg# value returned in "$func_dirname_result" 1952a75d1c4Smrg# basename: Compute filename of FILE. 1962a75d1c4Smrg# value retuned in "$func_basename_result" 1972a75d1c4Smrg# Implementation must be kept synchronized with func_dirname 1982a75d1c4Smrg# and func_basename. For efficiency, we do not delegate to 1992a75d1c4Smrg# those functions but instead duplicate the functionality here. 2002a75d1c4Smrgfunc_dirname_and_basename () 2012a75d1c4Smrg{ 2022a75d1c4Smrg # Extract subdirectory from the argument. 2032a75d1c4Smrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 2042a75d1c4Smrg if test "X$func_dirname_result" = "X${1}"; then 2052a75d1c4Smrg func_dirname_result="${3}" 2062a75d1c4Smrg else 2072a75d1c4Smrg func_dirname_result="$func_dirname_result${2}" 2082a75d1c4Smrg fi 2092a75d1c4Smrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 2102a75d1c4Smrg} # func_dirname_and_basename may be replaced by extended shell implementation 2112a75d1c4Smrg 2122a75d1c4Smrg 2132a75d1c4Smrg# func_stripname prefix suffix name 2142a75d1c4Smrg# strip PREFIX and SUFFIX off of NAME. 2152a75d1c4Smrg# PREFIX and SUFFIX must not contain globbing or regex special 2162a75d1c4Smrg# characters, hashes, percent signs, but SUFFIX may contain a leading 2172a75d1c4Smrg# dot (in which case that matches only a dot). 2182a75d1c4Smrg# func_strip_suffix prefix name 2192a75d1c4Smrgfunc_stripname () 2202a75d1c4Smrg{ 2212a75d1c4Smrg case ${2} in 2222a75d1c4Smrg .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 2232a75d1c4Smrg *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 2242a75d1c4Smrg esac 2252a75d1c4Smrg} # func_stripname may be replaced by extended shell implementation 2262a75d1c4Smrg 2272a75d1c4Smrg 2282a75d1c4Smrg# These SED scripts presuppose an absolute path with a trailing slash. 2292a75d1c4Smrgpathcar='s,^/\([^/]*\).*$,\1,' 2302a75d1c4Smrgpathcdr='s,^/[^/]*,,' 2312a75d1c4Smrgremovedotparts=':dotsl 2322a75d1c4Smrg s@/\./@/@g 2332a75d1c4Smrg t dotsl 2342a75d1c4Smrg s,/\.$,/,' 2352a75d1c4Smrgcollapseslashes='s@/\{1,\}@/@g' 2362a75d1c4Smrgfinalslash='s,/*$,/,' 2372a75d1c4Smrg 2382a75d1c4Smrg# func_normal_abspath PATH 2392a75d1c4Smrg# Remove doubled-up and trailing slashes, "." path components, 2402a75d1c4Smrg# and cancel out any ".." path components in PATH after making 2412a75d1c4Smrg# it an absolute path. 2422a75d1c4Smrg# value returned in "$func_normal_abspath_result" 2432a75d1c4Smrgfunc_normal_abspath () 2442a75d1c4Smrg{ 2452a75d1c4Smrg # Start from root dir and reassemble the path. 2462a75d1c4Smrg func_normal_abspath_result= 2472a75d1c4Smrg func_normal_abspath_tpath=$1 2482a75d1c4Smrg func_normal_abspath_altnamespace= 2492a75d1c4Smrg case $func_normal_abspath_tpath in 2502a75d1c4Smrg "") 2512a75d1c4Smrg # Empty path, that just means $cwd. 2522a75d1c4Smrg func_stripname '' '/' "`pwd`" 2532a75d1c4Smrg func_normal_abspath_result=$func_stripname_result 2542a75d1c4Smrg return 2552a75d1c4Smrg ;; 2562a75d1c4Smrg # The next three entries are used to spot a run of precisely 2572a75d1c4Smrg # two leading slashes without using negated character classes; 2582a75d1c4Smrg # we take advantage of case's first-match behaviour. 2592a75d1c4Smrg ///*) 2602a75d1c4Smrg # Unusual form of absolute path, do nothing. 2612a75d1c4Smrg ;; 2622a75d1c4Smrg //*) 2632a75d1c4Smrg # Not necessarily an ordinary path; POSIX reserves leading '//' 2642a75d1c4Smrg # and for example Cygwin uses it to access remote file shares 2652a75d1c4Smrg # over CIFS/SMB, so we conserve a leading double slash if found. 2662a75d1c4Smrg func_normal_abspath_altnamespace=/ 2672a75d1c4Smrg ;; 2682a75d1c4Smrg /*) 2692a75d1c4Smrg # Absolute path, do nothing. 2702a75d1c4Smrg ;; 2712a75d1c4Smrg *) 2722a75d1c4Smrg # Relative path, prepend $cwd. 2732a75d1c4Smrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 2742a75d1c4Smrg ;; 2752a75d1c4Smrg esac 2762a75d1c4Smrg # Cancel out all the simple stuff to save iterations. We also want 2772a75d1c4Smrg # the path to end with a slash for ease of parsing, so make sure 2782a75d1c4Smrg # there is one (and only one) here. 2792a75d1c4Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2802a75d1c4Smrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 2812a75d1c4Smrg while :; do 2822a75d1c4Smrg # Processed it all yet? 2832a75d1c4Smrg if test "$func_normal_abspath_tpath" = / ; then 2842a75d1c4Smrg # If we ascended to the root using ".." the result may be empty now. 2852a75d1c4Smrg if test -z "$func_normal_abspath_result" ; then 2862a75d1c4Smrg func_normal_abspath_result=/ 2872a75d1c4Smrg fi 2882a75d1c4Smrg break 2892a75d1c4Smrg fi 2902a75d1c4Smrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2912a75d1c4Smrg -e "$pathcar"` 2922a75d1c4Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2932a75d1c4Smrg -e "$pathcdr"` 2942a75d1c4Smrg # Figure out what to do with it 2952a75d1c4Smrg case $func_normal_abspath_tcomponent in 2962a75d1c4Smrg "") 2972a75d1c4Smrg # Trailing empty path component, ignore it. 2982a75d1c4Smrg ;; 2992a75d1c4Smrg ..) 3002a75d1c4Smrg # Parent dir; strip last assembled component from result. 3012a75d1c4Smrg func_dirname "$func_normal_abspath_result" 3022a75d1c4Smrg func_normal_abspath_result=$func_dirname_result 3032a75d1c4Smrg ;; 3042a75d1c4Smrg *) 3052a75d1c4Smrg # Actual path component, append it. 3062a75d1c4Smrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 3072a75d1c4Smrg ;; 3082a75d1c4Smrg esac 3092a75d1c4Smrg done 3102a75d1c4Smrg # Restore leading double-slash if one was found on entry. 3112a75d1c4Smrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 3122a75d1c4Smrg} 3132a75d1c4Smrg 3142a75d1c4Smrg# func_relative_path SRCDIR DSTDIR 3152a75d1c4Smrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 3162a75d1c4Smrg# slash if non-empty, suitable for immediately appending a filename 3172a75d1c4Smrg# without needing to append a separator. 3182a75d1c4Smrg# value returned in "$func_relative_path_result" 3192a75d1c4Smrgfunc_relative_path () 3202a75d1c4Smrg{ 3212a75d1c4Smrg func_relative_path_result= 3222a75d1c4Smrg func_normal_abspath "$1" 3232a75d1c4Smrg func_relative_path_tlibdir=$func_normal_abspath_result 3242a75d1c4Smrg func_normal_abspath "$2" 3252a75d1c4Smrg func_relative_path_tbindir=$func_normal_abspath_result 3262a75d1c4Smrg 3272a75d1c4Smrg # Ascend the tree starting from libdir 3282a75d1c4Smrg while :; do 3292a75d1c4Smrg # check if we have found a prefix of bindir 3302a75d1c4Smrg case $func_relative_path_tbindir in 3312a75d1c4Smrg $func_relative_path_tlibdir) 3322a75d1c4Smrg # found an exact match 3332a75d1c4Smrg func_relative_path_tcancelled= 3342a75d1c4Smrg break 3352a75d1c4Smrg ;; 3362a75d1c4Smrg $func_relative_path_tlibdir*) 3372a75d1c4Smrg # found a matching prefix 3382a75d1c4Smrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 3392a75d1c4Smrg func_relative_path_tcancelled=$func_stripname_result 3402a75d1c4Smrg if test -z "$func_relative_path_result"; then 3412a75d1c4Smrg func_relative_path_result=. 3422a75d1c4Smrg fi 3432a75d1c4Smrg break 3442a75d1c4Smrg ;; 3452a75d1c4Smrg *) 3462a75d1c4Smrg func_dirname $func_relative_path_tlibdir 3472a75d1c4Smrg func_relative_path_tlibdir=${func_dirname_result} 3482a75d1c4Smrg if test "x$func_relative_path_tlibdir" = x ; then 3492a75d1c4Smrg # Have to descend all the way to the root! 3502a75d1c4Smrg func_relative_path_result=../$func_relative_path_result 3512a75d1c4Smrg func_relative_path_tcancelled=$func_relative_path_tbindir 3522a75d1c4Smrg break 3532a75d1c4Smrg fi 3542a75d1c4Smrg func_relative_path_result=../$func_relative_path_result 3552a75d1c4Smrg ;; 3562a75d1c4Smrg esac 3572a75d1c4Smrg done 3582a75d1c4Smrg 3592a75d1c4Smrg # Now calculate path; take care to avoid doubling-up slashes. 3602a75d1c4Smrg func_stripname '' '/' "$func_relative_path_result" 3612a75d1c4Smrg func_relative_path_result=$func_stripname_result 3622a75d1c4Smrg func_stripname '/' '/' "$func_relative_path_tcancelled" 3632a75d1c4Smrg if test "x$func_stripname_result" != x ; then 3642a75d1c4Smrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 3652a75d1c4Smrg fi 3662a75d1c4Smrg 3672a75d1c4Smrg # Normalisation. If bindir is libdir, return empty string, 3682a75d1c4Smrg # else relative path ending with a slash; either way, target 3692a75d1c4Smrg # file name can be directly appended. 3702a75d1c4Smrg if test ! -z "$func_relative_path_result"; then 3712a75d1c4Smrg func_stripname './' '' "$func_relative_path_result/" 3722a75d1c4Smrg func_relative_path_result=$func_stripname_result 3732a75d1c4Smrg fi 3742a75d1c4Smrg} 3752a75d1c4Smrg 3762a75d1c4Smrg# The name of this program: 3772a75d1c4Smrgfunc_dirname_and_basename "$progpath" 3782a75d1c4Smrgprogname=$func_basename_result 3792a75d1c4Smrg 3802a75d1c4Smrg# Make sure we have an absolute path for reexecution: 3812a75d1c4Smrgcase $progpath in 3822a75d1c4Smrg [\\/]*|[A-Za-z]:\\*) ;; 3832a75d1c4Smrg *[\\/]*) 3842a75d1c4Smrg progdir=$func_dirname_result 3852a75d1c4Smrg progdir=`cd "$progdir" && pwd` 3862a75d1c4Smrg progpath="$progdir/$progname" 3872a75d1c4Smrg ;; 3882a75d1c4Smrg *) 3892a75d1c4Smrg save_IFS="$IFS" 3902a75d1c4Smrg IFS=: 3912a75d1c4Smrg for progdir in $PATH; do 3922a75d1c4Smrg IFS="$save_IFS" 3932a75d1c4Smrg test -x "$progdir/$progname" && break 3942a75d1c4Smrg done 3952a75d1c4Smrg IFS="$save_IFS" 3962a75d1c4Smrg test -n "$progdir" || progdir=`pwd` 3972a75d1c4Smrg progpath="$progdir/$progname" 3982a75d1c4Smrg ;; 3992a75d1c4Smrgesac 4002a75d1c4Smrg 4012a75d1c4Smrg# Sed substitution that helps us do robust quoting. It backslashifies 4022a75d1c4Smrg# metacharacters that are still active within double-quoted strings. 4032a75d1c4SmrgXsed="${SED}"' -e 1s/^X//' 4042a75d1c4Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 4052a75d1c4Smrg 4062a75d1c4Smrg# Same as above, but do not quote variable references. 4072a75d1c4Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 4082a75d1c4Smrg 4092a75d1c4Smrg# Sed substitution that turns a string into a regex matching for the 4102a75d1c4Smrg# string literally. 4112a75d1c4Smrgsed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 4122a75d1c4Smrg 4132a75d1c4Smrg# Sed substitution that converts a w32 file name or path 4142a75d1c4Smrg# which contains forward slashes, into one that contains 4152a75d1c4Smrg# (escaped) backslashes. A very naive implementation. 4162a75d1c4Smrglt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 4172a75d1c4Smrg 4182a75d1c4Smrg# Re-`\' parameter expansions in output of double_quote_subst that were 4192a75d1c4Smrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 4202a75d1c4Smrg# in input to double_quote_subst, that '$' was protected from expansion. 4212a75d1c4Smrg# Since each input `\' is now two `\'s, look for any number of runs of 4222a75d1c4Smrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 4232a75d1c4Smrgbs='\\' 4242a75d1c4Smrgbs2='\\\\' 4252a75d1c4Smrgbs4='\\\\\\\\' 4262a75d1c4Smrgdollar='\$' 4272a75d1c4Smrgsed_double_backslash="\ 4282a75d1c4Smrg s/$bs4/&\\ 4292a75d1c4Smrg/g 4302a75d1c4Smrg s/^$bs2$dollar/$bs&/ 4312a75d1c4Smrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 4322a75d1c4Smrg s/\n//g" 4332a75d1c4Smrg 4342a75d1c4Smrg# Standard options: 4352a75d1c4Smrgopt_dry_run=false 4362a75d1c4Smrgopt_help=false 4372a75d1c4Smrgopt_quiet=false 4382a75d1c4Smrgopt_verbose=false 4392a75d1c4Smrgopt_warning=: 4402a75d1c4Smrg 4412a75d1c4Smrg# func_echo arg... 4422a75d1c4Smrg# Echo program name prefixed message, along with the current mode 4432a75d1c4Smrg# name if it has been set yet. 4442a75d1c4Smrgfunc_echo () 4452a75d1c4Smrg{ 4462a75d1c4Smrg $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 4472a75d1c4Smrg} 4482a75d1c4Smrg 4492a75d1c4Smrg# func_verbose arg... 4502a75d1c4Smrg# Echo program name prefixed message in verbose mode only. 4512a75d1c4Smrgfunc_verbose () 4522a75d1c4Smrg{ 4532a75d1c4Smrg $opt_verbose && func_echo ${1+"$@"} 4542a75d1c4Smrg 4552a75d1c4Smrg # A bug in bash halts the script if the last line of a function 4562a75d1c4Smrg # fails when set -e is in force, so we need another command to 4572a75d1c4Smrg # work around that: 4582a75d1c4Smrg : 4592a75d1c4Smrg} 4602a75d1c4Smrg 4612a75d1c4Smrg# func_echo_all arg... 4622a75d1c4Smrg# Invoke $ECHO with all args, space-separated. 4632a75d1c4Smrgfunc_echo_all () 4642a75d1c4Smrg{ 4652a75d1c4Smrg $ECHO "$*" 4662a75d1c4Smrg} 4672a75d1c4Smrg 4682a75d1c4Smrg# func_error arg... 4692a75d1c4Smrg# Echo program name prefixed message to standard error. 4702a75d1c4Smrgfunc_error () 4712a75d1c4Smrg{ 4722a75d1c4Smrg $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 4732a75d1c4Smrg} 4742a75d1c4Smrg 4752a75d1c4Smrg# func_warning arg... 4762a75d1c4Smrg# Echo program name prefixed warning message to standard error. 4772a75d1c4Smrgfunc_warning () 4782a75d1c4Smrg{ 4792a75d1c4Smrg $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 4802a75d1c4Smrg 4812a75d1c4Smrg # bash bug again: 4822a75d1c4Smrg : 4832a75d1c4Smrg} 4842a75d1c4Smrg 4852a75d1c4Smrg# func_fatal_error arg... 4862a75d1c4Smrg# Echo program name prefixed message to standard error, and exit. 4872a75d1c4Smrgfunc_fatal_error () 4882a75d1c4Smrg{ 4892a75d1c4Smrg func_error ${1+"$@"} 4902a75d1c4Smrg exit $EXIT_FAILURE 4912a75d1c4Smrg} 4922a75d1c4Smrg 4932a75d1c4Smrg# func_fatal_help arg... 4942a75d1c4Smrg# Echo program name prefixed message to standard error, followed by 4952a75d1c4Smrg# a help hint, and exit. 4962a75d1c4Smrgfunc_fatal_help () 4972a75d1c4Smrg{ 4982a75d1c4Smrg func_error ${1+"$@"} 4992a75d1c4Smrg func_fatal_error "$help" 5002a75d1c4Smrg} 5012a75d1c4Smrghelp="Try \`$progname --help' for more information." ## default 5022a75d1c4Smrg 5032a75d1c4Smrg 5042a75d1c4Smrg# func_grep expression filename 5052a75d1c4Smrg# Check whether EXPRESSION matches any line of FILENAME, without output. 5062a75d1c4Smrgfunc_grep () 5072a75d1c4Smrg{ 5082a75d1c4Smrg $GREP "$1" "$2" >/dev/null 2>&1 5092a75d1c4Smrg} 5102a75d1c4Smrg 5112a75d1c4Smrg 5122a75d1c4Smrg# func_mkdir_p directory-path 5132a75d1c4Smrg# Make sure the entire path to DIRECTORY-PATH is available. 5142a75d1c4Smrgfunc_mkdir_p () 5152a75d1c4Smrg{ 5162a75d1c4Smrg my_directory_path="$1" 5172a75d1c4Smrg my_dir_list= 5182a75d1c4Smrg 5192a75d1c4Smrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 5202a75d1c4Smrg 5212a75d1c4Smrg # Protect directory names starting with `-' 5222a75d1c4Smrg case $my_directory_path in 5232a75d1c4Smrg -*) my_directory_path="./$my_directory_path" ;; 5242a75d1c4Smrg esac 5252a75d1c4Smrg 5262a75d1c4Smrg # While some portion of DIR does not yet exist... 5272a75d1c4Smrg while test ! -d "$my_directory_path"; do 5282a75d1c4Smrg # ...make a list in topmost first order. Use a colon delimited 5292a75d1c4Smrg # list incase some portion of path contains whitespace. 5302a75d1c4Smrg my_dir_list="$my_directory_path:$my_dir_list" 5312a75d1c4Smrg 5322a75d1c4Smrg # If the last portion added has no slash in it, the list is done 5332a75d1c4Smrg case $my_directory_path in */*) ;; *) break ;; esac 5342a75d1c4Smrg 5352a75d1c4Smrg # ...otherwise throw away the child directory and loop 5362a75d1c4Smrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 5372a75d1c4Smrg done 5382a75d1c4Smrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 5392a75d1c4Smrg 5402a75d1c4Smrg save_mkdir_p_IFS="$IFS"; IFS=':' 5412a75d1c4Smrg for my_dir in $my_dir_list; do 5422a75d1c4Smrg IFS="$save_mkdir_p_IFS" 5432a75d1c4Smrg # mkdir can fail with a `File exist' error if two processes 5442a75d1c4Smrg # try to create one of the directories concurrently. Don't 5452a75d1c4Smrg # stop in that case! 5462a75d1c4Smrg $MKDIR "$my_dir" 2>/dev/null || : 5472a75d1c4Smrg done 5482a75d1c4Smrg IFS="$save_mkdir_p_IFS" 5492a75d1c4Smrg 5502a75d1c4Smrg # Bail out if we (or some other process) failed to create a directory. 5512a75d1c4Smrg test -d "$my_directory_path" || \ 5522a75d1c4Smrg func_fatal_error "Failed to create \`$1'" 5532a75d1c4Smrg fi 5542a75d1c4Smrg} 555f7ec340bSmacallan 556f7ec340bSmacallan 557f7ec340bSmacallan# func_mktempdir [string] 558f7ec340bSmacallan# Make a temporary directory that won't clash with other running 559f7ec340bSmacallan# libtool processes, and avoids race conditions if possible. If 560f7ec340bSmacallan# given, STRING is the basename for that directory. 561f7ec340bSmacallanfunc_mktempdir () 562f7ec340bSmacallan{ 563f7ec340bSmacallan my_template="${TMPDIR-/tmp}/${1-$progname}" 564f7ec340bSmacallan 5652a75d1c4Smrg if test "$opt_dry_run" = ":"; then 566f7ec340bSmacallan # Return a directory name, but don't create it in dry-run mode 567f7ec340bSmacallan my_tmpdir="${my_template}-$$" 568f7ec340bSmacallan else 569f7ec340bSmacallan 570f7ec340bSmacallan # If mktemp works, use that first and foremost 571f7ec340bSmacallan my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 572f7ec340bSmacallan 573f7ec340bSmacallan if test ! -d "$my_tmpdir"; then 5742a75d1c4Smrg # Failing that, at least try and use $RANDOM to avoid a race 5752a75d1c4Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 576f7ec340bSmacallan 5772a75d1c4Smrg save_mktempdir_umask=`umask` 5782a75d1c4Smrg umask 0077 5792a75d1c4Smrg $MKDIR "$my_tmpdir" 5802a75d1c4Smrg umask $save_mktempdir_umask 581f7ec340bSmacallan fi 582f7ec340bSmacallan 583f7ec340bSmacallan # If we're not in dry-run mode, bomb out on failure 5842a75d1c4Smrg test -d "$my_tmpdir" || \ 5852a75d1c4Smrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 586f7ec340bSmacallan fi 587f7ec340bSmacallan 5882a75d1c4Smrg $ECHO "$my_tmpdir" 589f7ec340bSmacallan} 590f7ec340bSmacallan 591f7ec340bSmacallan 5922a75d1c4Smrg# func_quote_for_eval arg 5932a75d1c4Smrg# Aesthetically quote ARG to be evaled later. 5942a75d1c4Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 5952a75d1c4Smrg# is double-quoted, suitable for a subsequent eval, whereas 5962a75d1c4Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 5972a75d1c4Smrg# which are still active within double quotes backslashified. 5982a75d1c4Smrgfunc_quote_for_eval () 599f7ec340bSmacallan{ 6002a75d1c4Smrg case $1 in 6012a75d1c4Smrg *[\\\`\"\$]*) 6022a75d1c4Smrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 6032a75d1c4Smrg *) 6042a75d1c4Smrg func_quote_for_eval_unquoted_result="$1" ;; 6052a75d1c4Smrg esac 6062a75d1c4Smrg 6072a75d1c4Smrg case $func_quote_for_eval_unquoted_result in 6082a75d1c4Smrg # Double-quote args containing shell metacharacters to delay 6092a75d1c4Smrg # word splitting, command substitution and and variable 6102a75d1c4Smrg # expansion for a subsequent eval. 6112a75d1c4Smrg # Many Bourne shells cannot handle close brackets correctly 6122a75d1c4Smrg # in scan sets, so we specify it separately. 6132a75d1c4Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 6142a75d1c4Smrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 6152a75d1c4Smrg ;; 6162a75d1c4Smrg *) 6172a75d1c4Smrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 6182a75d1c4Smrg esac 6192a75d1c4Smrg} 6202a75d1c4Smrg 6212a75d1c4Smrg 6222a75d1c4Smrg# func_quote_for_expand arg 6232a75d1c4Smrg# Aesthetically quote ARG to be evaled later; same as above, 6242a75d1c4Smrg# but do not quote variable references. 6252a75d1c4Smrgfunc_quote_for_expand () 6262a75d1c4Smrg{ 6272a75d1c4Smrg case $1 in 6282a75d1c4Smrg *[\\\`\"]*) 6292a75d1c4Smrg my_arg=`$ECHO "$1" | $SED \ 6302a75d1c4Smrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 6312a75d1c4Smrg *) 6322a75d1c4Smrg my_arg="$1" ;; 6332a75d1c4Smrg esac 6342a75d1c4Smrg 6352a75d1c4Smrg case $my_arg in 6362a75d1c4Smrg # Double-quote args containing shell metacharacters to delay 6372a75d1c4Smrg # word splitting and command substitution for a subsequent eval. 6382a75d1c4Smrg # Many Bourne shells cannot handle close brackets correctly 6392a75d1c4Smrg # in scan sets, so we specify it separately. 6402a75d1c4Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 6412a75d1c4Smrg my_arg="\"$my_arg\"" 6422a75d1c4Smrg ;; 6432a75d1c4Smrg esac 6442a75d1c4Smrg 6452a75d1c4Smrg func_quote_for_expand_result="$my_arg" 6462a75d1c4Smrg} 6472a75d1c4Smrg 6482a75d1c4Smrg 6492a75d1c4Smrg# func_show_eval cmd [fail_exp] 6502a75d1c4Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6512a75d1c4Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6522a75d1c4Smrg# is given, then evaluate it. 6532a75d1c4Smrgfunc_show_eval () 6542a75d1c4Smrg{ 6552a75d1c4Smrg my_cmd="$1" 6562a75d1c4Smrg my_fail_exp="${2-:}" 6572a75d1c4Smrg 6582a75d1c4Smrg ${opt_silent-false} || { 6592a75d1c4Smrg func_quote_for_expand "$my_cmd" 6602a75d1c4Smrg eval "func_echo $func_quote_for_expand_result" 6612a75d1c4Smrg } 6622a75d1c4Smrg 6632a75d1c4Smrg if ${opt_dry_run-false}; then :; else 6642a75d1c4Smrg eval "$my_cmd" 6652a75d1c4Smrg my_status=$? 6662a75d1c4Smrg if test "$my_status" -eq 0; then :; else 6672a75d1c4Smrg eval "(exit $my_status); $my_fail_exp" 6682a75d1c4Smrg fi 669f7ec340bSmacallan fi 6702a75d1c4Smrg} 6712a75d1c4Smrg 6722a75d1c4Smrg 6732a75d1c4Smrg# func_show_eval_locale cmd [fail_exp] 6742a75d1c4Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6752a75d1c4Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6762a75d1c4Smrg# is given, then evaluate it. Use the saved locale for evaluation. 6772a75d1c4Smrgfunc_show_eval_locale () 6782a75d1c4Smrg{ 6792a75d1c4Smrg my_cmd="$1" 6802a75d1c4Smrg my_fail_exp="${2-:}" 6812a75d1c4Smrg 6822a75d1c4Smrg ${opt_silent-false} || { 6832a75d1c4Smrg func_quote_for_expand "$my_cmd" 6842a75d1c4Smrg eval "func_echo $func_quote_for_expand_result" 6852a75d1c4Smrg } 6862a75d1c4Smrg 6872a75d1c4Smrg if ${opt_dry_run-false}; then :; else 6882a75d1c4Smrg eval "$lt_user_locale 6892a75d1c4Smrg $my_cmd" 6902a75d1c4Smrg my_status=$? 6912a75d1c4Smrg eval "$lt_safe_locale" 6922a75d1c4Smrg if test "$my_status" -eq 0; then :; else 6932a75d1c4Smrg eval "(exit $my_status); $my_fail_exp" 6942a75d1c4Smrg fi 6952a75d1c4Smrg fi 6962a75d1c4Smrg} 6972a75d1c4Smrg 6982a75d1c4Smrg# func_tr_sh 6992a75d1c4Smrg# Turn $1 into a string suitable for a shell variable name. 7002a75d1c4Smrg# Result is stored in $func_tr_sh_result. All characters 7012a75d1c4Smrg# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 7022a75d1c4Smrg# if $1 begins with a digit, a '_' is prepended as well. 7032a75d1c4Smrgfunc_tr_sh () 7042a75d1c4Smrg{ 7052a75d1c4Smrg case $1 in 7062a75d1c4Smrg [0-9]* | *[!a-zA-Z0-9_]*) 7072a75d1c4Smrg func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 708f7ec340bSmacallan ;; 7092a75d1c4Smrg * ) 7102a75d1c4Smrg func_tr_sh_result=$1 711f7ec340bSmacallan ;; 712f7ec340bSmacallan esac 713f7ec340bSmacallan} 714f7ec340bSmacallan 715f7ec340bSmacallan 7162a75d1c4Smrg# func_version 7172a75d1c4Smrg# Echo version message to standard output and exit. 7182a75d1c4Smrgfunc_version () 719f7ec340bSmacallan{ 7202a75d1c4Smrg $opt_debug 7212a75d1c4Smrg 7222a75d1c4Smrg $SED -n '/(C)/!b go 7232a75d1c4Smrg :more 7242a75d1c4Smrg /\./!{ 7252a75d1c4Smrg N 7262a75d1c4Smrg s/\n# / / 7272a75d1c4Smrg b more 7282a75d1c4Smrg } 7292a75d1c4Smrg :go 7302a75d1c4Smrg /^# '$PROGRAM' (GNU /,/# warranty; / { 7312a75d1c4Smrg s/^# // 7322a75d1c4Smrg s/^# *$// 7332a75d1c4Smrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 7342a75d1c4Smrg p 7352a75d1c4Smrg }' < "$progpath" 7362a75d1c4Smrg exit $? 737f7ec340bSmacallan} 738f7ec340bSmacallan 7392a75d1c4Smrg# func_usage 7402a75d1c4Smrg# Echo short help message to standard output and exit. 7412a75d1c4Smrgfunc_usage () 742f7ec340bSmacallan{ 7432a75d1c4Smrg $opt_debug 7442a75d1c4Smrg 7452a75d1c4Smrg $SED -n '/^# Usage:/,/^# *.*--help/ { 7462a75d1c4Smrg s/^# // 7472a75d1c4Smrg s/^# *$// 7482a75d1c4Smrg s/\$progname/'$progname'/ 7492a75d1c4Smrg p 7502a75d1c4Smrg }' < "$progpath" 7512a75d1c4Smrg echo 7522a75d1c4Smrg $ECHO "run \`$progname --help | more' for full usage" 7532a75d1c4Smrg exit $? 754f7ec340bSmacallan} 755f7ec340bSmacallan 7562a75d1c4Smrg# func_help [NOEXIT] 7572a75d1c4Smrg# Echo long help message to standard output and exit, 7582a75d1c4Smrg# unless 'noexit' is passed as argument. 7592a75d1c4Smrgfunc_help () 760f7ec340bSmacallan{ 7612a75d1c4Smrg $opt_debug 7622a75d1c4Smrg 7632a75d1c4Smrg $SED -n '/^# Usage:/,/# Report bugs to/ { 7642a75d1c4Smrg :print 7652a75d1c4Smrg s/^# // 7662a75d1c4Smrg s/^# *$// 7672a75d1c4Smrg s*\$progname*'$progname'* 7682a75d1c4Smrg s*\$host*'"$host"'* 7692a75d1c4Smrg s*\$SHELL*'"$SHELL"'* 7702a75d1c4Smrg s*\$LTCC*'"$LTCC"'* 7712a75d1c4Smrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 7722a75d1c4Smrg s*\$LD*'"$LD"'* 7732a75d1c4Smrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 7742a75d1c4Smrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 7752a75d1c4Smrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 7762a75d1c4Smrg p 7772a75d1c4Smrg d 7782a75d1c4Smrg } 7792a75d1c4Smrg /^# .* home page:/b print 7802a75d1c4Smrg /^# General help using/b print 7812a75d1c4Smrg ' < "$progpath" 7822a75d1c4Smrg ret=$? 7832a75d1c4Smrg if test -z "$1"; then 7842a75d1c4Smrg exit $ret 785f7ec340bSmacallan fi 7862a75d1c4Smrg} 787f7ec340bSmacallan 7882a75d1c4Smrg# func_missing_arg argname 7892a75d1c4Smrg# Echo program name prefixed message to standard error and set global 7902a75d1c4Smrg# exit_cmd. 7912a75d1c4Smrgfunc_missing_arg () 7922a75d1c4Smrg{ 7932a75d1c4Smrg $opt_debug 794f7ec340bSmacallan 7952a75d1c4Smrg func_error "missing argument for $1." 7962a75d1c4Smrg exit_cmd=exit 797f7ec340bSmacallan} 798f7ec340bSmacallan 799f7ec340bSmacallan 8002a75d1c4Smrg# func_split_short_opt shortopt 8012a75d1c4Smrg# Set func_split_short_opt_name and func_split_short_opt_arg shell 8022a75d1c4Smrg# variables after splitting SHORTOPT after the 2nd character. 8032a75d1c4Smrgfunc_split_short_opt () 8042a75d1c4Smrg{ 8052a75d1c4Smrg my_sed_short_opt='1s/^\(..\).*$/\1/;q' 8062a75d1c4Smrg my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 8072a75d1c4Smrg 8082a75d1c4Smrg func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 8092a75d1c4Smrg func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 8102a75d1c4Smrg} # func_split_short_opt may be replaced by extended shell implementation 811f7ec340bSmacallan 812f7ec340bSmacallan 8132a75d1c4Smrg# func_split_long_opt longopt 8142a75d1c4Smrg# Set func_split_long_opt_name and func_split_long_opt_arg shell 8152a75d1c4Smrg# variables after splitting LONGOPT at the `=' sign. 8162a75d1c4Smrgfunc_split_long_opt () 8172a75d1c4Smrg{ 8182a75d1c4Smrg my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 8192a75d1c4Smrg my_sed_long_arg='1s/^--[^=]*=//' 820f7ec340bSmacallan 8212a75d1c4Smrg func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 8222a75d1c4Smrg func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 8232a75d1c4Smrg} # func_split_long_opt may be replaced by extended shell implementation 824f7ec340bSmacallan 8252a75d1c4Smrgexit_cmd=: 826f7ec340bSmacallan 827f7ec340bSmacallan 828f7ec340bSmacallan 8297ce7e03cSmrg 830f7ec340bSmacallan 8312a75d1c4Smrgmagic="%%%MAGIC variable%%%" 8322a75d1c4Smrgmagic_exe="%%%MAGIC EXE variable%%%" 8332a75d1c4Smrg 8342a75d1c4Smrg# Global variables. 8352a75d1c4Smrgnonopt= 8362a75d1c4Smrgpreserve_args= 8372a75d1c4Smrglo2o="s/\\.lo\$/.${objext}/" 8382a75d1c4Smrgo2lo="s/\\.${objext}\$/.lo/" 8392a75d1c4Smrgextracted_archives= 8402a75d1c4Smrgextracted_serial=0 8412a75d1c4Smrg 8422a75d1c4Smrg# If this variable is set in any of the actions, the command in it 8432a75d1c4Smrg# will be execed at the end. This prevents here-documents from being 8442a75d1c4Smrg# left over by shells. 8452a75d1c4Smrgexec_cmd= 8462a75d1c4Smrg 8472a75d1c4Smrg# func_append var value 8482a75d1c4Smrg# Append VALUE to the end of shell variable VAR. 8492a75d1c4Smrgfunc_append () 8502a75d1c4Smrg{ 8512a75d1c4Smrg eval "${1}=\$${1}\${2}" 8522a75d1c4Smrg} # func_append may be replaced by extended shell implementation 8532a75d1c4Smrg 8542a75d1c4Smrg# func_append_quoted var value 8552a75d1c4Smrg# Quote VALUE and append to the end of shell variable VAR, separated 8562a75d1c4Smrg# by a space. 8572a75d1c4Smrgfunc_append_quoted () 8582a75d1c4Smrg{ 8592a75d1c4Smrg func_quote_for_eval "${2}" 8602a75d1c4Smrg eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 8612a75d1c4Smrg} # func_append_quoted may be replaced by extended shell implementation 8622a75d1c4Smrg 8632a75d1c4Smrg 8642a75d1c4Smrg# func_arith arithmetic-term... 8652a75d1c4Smrgfunc_arith () 8662a75d1c4Smrg{ 8672a75d1c4Smrg func_arith_result=`expr "${@}"` 8682a75d1c4Smrg} # func_arith may be replaced by extended shell implementation 8692a75d1c4Smrg 8702a75d1c4Smrg 8712a75d1c4Smrg# func_len string 8722a75d1c4Smrg# STRING may not start with a hyphen. 8732a75d1c4Smrgfunc_len () 8742a75d1c4Smrg{ 8752a75d1c4Smrg func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 8762a75d1c4Smrg} # func_len may be replaced by extended shell implementation 8772a75d1c4Smrg 8782a75d1c4Smrg 8792a75d1c4Smrg# func_lo2o object 8802a75d1c4Smrgfunc_lo2o () 8812a75d1c4Smrg{ 8822a75d1c4Smrg func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 8832a75d1c4Smrg} # func_lo2o may be replaced by extended shell implementation 8842a75d1c4Smrg 8852a75d1c4Smrg 8862a75d1c4Smrg# func_xform libobj-or-source 8872a75d1c4Smrgfunc_xform () 8882a75d1c4Smrg{ 8892a75d1c4Smrg func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 8902a75d1c4Smrg} # func_xform may be replaced by extended shell implementation 8912a75d1c4Smrg 8922a75d1c4Smrg 8932a75d1c4Smrg# func_fatal_configuration arg... 8942a75d1c4Smrg# Echo program name prefixed message to standard error, followed by 8952a75d1c4Smrg# a configuration failure hint, and exit. 8962a75d1c4Smrgfunc_fatal_configuration () 8972a75d1c4Smrg{ 8982a75d1c4Smrg func_error ${1+"$@"} 8992a75d1c4Smrg func_error "See the $PACKAGE documentation for more information." 9002a75d1c4Smrg func_fatal_error "Fatal configuration error." 9012a75d1c4Smrg} 9022a75d1c4Smrg 9032a75d1c4Smrg 9042a75d1c4Smrg# func_config 9052a75d1c4Smrg# Display the configuration for all the tags in this script. 9062a75d1c4Smrgfunc_config () 9072a75d1c4Smrg{ 9082a75d1c4Smrg re_begincf='^# ### BEGIN LIBTOOL' 9092a75d1c4Smrg re_endcf='^# ### END LIBTOOL' 9102a75d1c4Smrg 9112a75d1c4Smrg # Default configuration. 9122a75d1c4Smrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 9132a75d1c4Smrg 914f7ec340bSmacallan # Now print the configurations for the tags. 915f7ec340bSmacallan for tagname in $taglist; do 9162a75d1c4Smrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 917f7ec340bSmacallan done 918f7ec340bSmacallan 9192a75d1c4Smrg exit $? 9202a75d1c4Smrg} 921f7ec340bSmacallan 9222a75d1c4Smrg# func_features 9232a75d1c4Smrg# Display the features supported by this script. 9242a75d1c4Smrgfunc_features () 9252a75d1c4Smrg{ 9262a75d1c4Smrg echo "host: $host" 927f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 9282a75d1c4Smrg echo "enable shared libraries" 929f7ec340bSmacallan else 9302a75d1c4Smrg echo "disable shared libraries" 931f7ec340bSmacallan fi 932f7ec340bSmacallan if test "$build_old_libs" = yes; then 9332a75d1c4Smrg echo "enable static libraries" 934f7ec340bSmacallan else 9352a75d1c4Smrg echo "disable static libraries" 936f7ec340bSmacallan fi 937f7ec340bSmacallan 9382a75d1c4Smrg exit $? 9392a75d1c4Smrg} 940f7ec340bSmacallan 9412a75d1c4Smrg# func_enable_tag tagname 9422a75d1c4Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or 9432a75d1c4Smrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 9442a75d1c4Smrg# variable here. 9452a75d1c4Smrgfunc_enable_tag () 9462a75d1c4Smrg{ 9472a75d1c4Smrg # Global variable: 9482a75d1c4Smrg tagname="$1" 949f7ec340bSmacallan 9502a75d1c4Smrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 9512a75d1c4Smrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 9522a75d1c4Smrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 953f7ec340bSmacallan 9542a75d1c4Smrg # Validate tagname. 9552a75d1c4Smrg case $tagname in 9562a75d1c4Smrg *[!-_A-Za-z0-9,/]*) 9572a75d1c4Smrg func_fatal_error "invalid tag name: $tagname" 9582a75d1c4Smrg ;; 9592a75d1c4Smrg esac 960f7ec340bSmacallan 9612a75d1c4Smrg # Don't test for the "default" C tag, as we know it's 9622a75d1c4Smrg # there but not specially marked. 9632a75d1c4Smrg case $tagname in 9642a75d1c4Smrg CC) ;; 9652a75d1c4Smrg *) 9662a75d1c4Smrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 9672a75d1c4Smrg taglist="$taglist $tagname" 9682a75d1c4Smrg 9692a75d1c4Smrg # Evaluate the configuration. Be careful to quote the path 9702a75d1c4Smrg # and the sed script, to avoid splitting on whitespace, but 9712a75d1c4Smrg # also don't use non-portable quotes within backquotes within 9722a75d1c4Smrg # quotes we have to do it in 2 steps: 9732a75d1c4Smrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 9742a75d1c4Smrg eval "$extractedcf" 9752a75d1c4Smrg else 9762a75d1c4Smrg func_error "ignoring unknown tag $tagname" 9772a75d1c4Smrg fi 9782a75d1c4Smrg ;; 9792a75d1c4Smrg esac 9802a75d1c4Smrg} 981f7ec340bSmacallan 9822a75d1c4Smrg# func_check_version_match 9832a75d1c4Smrg# Ensure that we are using m4 macros, and libtool script from the same 9842a75d1c4Smrg# release of libtool. 9852a75d1c4Smrgfunc_check_version_match () 9862a75d1c4Smrg{ 9872a75d1c4Smrg if test "$package_revision" != "$macro_revision"; then 9882a75d1c4Smrg if test "$VERSION" != "$macro_version"; then 9892a75d1c4Smrg if test -z "$macro_version"; then 9902a75d1c4Smrg cat >&2 <<_LT_EOF 9912a75d1c4Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9922a75d1c4Smrg$progname: definition of this LT_INIT comes from an older release. 9932a75d1c4Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9942a75d1c4Smrg$progname: and run autoconf again. 9952a75d1c4Smrg_LT_EOF 9962a75d1c4Smrg else 9972a75d1c4Smrg cat >&2 <<_LT_EOF 9982a75d1c4Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9992a75d1c4Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 10002a75d1c4Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 10012a75d1c4Smrg$progname: and run autoconf again. 10022a75d1c4Smrg_LT_EOF 10032a75d1c4Smrg fi 10042a75d1c4Smrg else 10052a75d1c4Smrg cat >&2 <<_LT_EOF 10062a75d1c4Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 10072a75d1c4Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 10082a75d1c4Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 10092a75d1c4Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 10102a75d1c4Smrg_LT_EOF 10112a75d1c4Smrg fi 1012f7ec340bSmacallan 10132a75d1c4Smrg exit $EXIT_MISMATCH 10142a75d1c4Smrg fi 10152a75d1c4Smrg} 1016f7ec340bSmacallan 1017f7ec340bSmacallan 10182a75d1c4Smrg# Shorthand for --mode=foo, only valid as the first argument 10192a75d1c4Smrgcase $1 in 10202a75d1c4Smrgclean|clea|cle|cl) 10212a75d1c4Smrg shift; set dummy --mode clean ${1+"$@"}; shift 10222a75d1c4Smrg ;; 10232a75d1c4Smrgcompile|compil|compi|comp|com|co|c) 10242a75d1c4Smrg shift; set dummy --mode compile ${1+"$@"}; shift 10252a75d1c4Smrg ;; 10262a75d1c4Smrgexecute|execut|execu|exec|exe|ex|e) 10272a75d1c4Smrg shift; set dummy --mode execute ${1+"$@"}; shift 10282a75d1c4Smrg ;; 10292a75d1c4Smrgfinish|finis|fini|fin|fi|f) 10302a75d1c4Smrg shift; set dummy --mode finish ${1+"$@"}; shift 1031f7ec340bSmacallan ;; 10322a75d1c4Smrginstall|instal|insta|inst|ins|in|i) 10332a75d1c4Smrg shift; set dummy --mode install ${1+"$@"}; shift 1034f7ec340bSmacallan ;; 10352a75d1c4Smrglink|lin|li|l) 10362a75d1c4Smrg shift; set dummy --mode link ${1+"$@"}; shift 10372a75d1c4Smrg ;; 10382a75d1c4Smrguninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 10392a75d1c4Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 1040f7ec340bSmacallan ;; 1041f7ec340bSmacallanesac 1042f7ec340bSmacallan 1043f7ec340bSmacallan 1044f7ec340bSmacallan 10452a75d1c4Smrg# Option defaults: 10462a75d1c4Smrgopt_debug=: 10472a75d1c4Smrgopt_dry_run=false 10482a75d1c4Smrgopt_config=false 10492a75d1c4Smrgopt_preserve_dup_deps=false 10502a75d1c4Smrgopt_features=false 10512a75d1c4Smrgopt_finish=false 10522a75d1c4Smrgopt_help=false 10532a75d1c4Smrgopt_help_all=false 10542a75d1c4Smrgopt_silent=: 10552a75d1c4Smrgopt_verbose=: 10562a75d1c4Smrgopt_silent=false 10572a75d1c4Smrgopt_verbose=false 1058f7ec340bSmacallan 10592a75d1c4Smrg 10602a75d1c4Smrg# Parse options once, thoroughly. This comes as soon as possible in the 10612a75d1c4Smrg# script to make things like `--version' happen as quickly as we can. 10622a75d1c4Smrg{ 10632a75d1c4Smrg # this just eases exit handling 10642a75d1c4Smrg while test $# -gt 0; do 10652a75d1c4Smrg opt="$1" 10662a75d1c4Smrg shift 10672a75d1c4Smrg case $opt in 10682a75d1c4Smrg --debug|-x) opt_debug='set -x' 10692a75d1c4Smrg func_echo "enabling shell trace mode" 10702a75d1c4Smrg $opt_debug 10712a75d1c4Smrg ;; 10722a75d1c4Smrg --dry-run|--dryrun|-n) 10732a75d1c4Smrg opt_dry_run=: 10742a75d1c4Smrg ;; 10752a75d1c4Smrg --config) 10762a75d1c4Smrg opt_config=: 10772a75d1c4Smrgfunc_config 10782a75d1c4Smrg ;; 10792a75d1c4Smrg --dlopen|-dlopen) 10802a75d1c4Smrg optarg="$1" 10812a75d1c4Smrg opt_dlopen="${opt_dlopen+$opt_dlopen 10822a75d1c4Smrg}$optarg" 10832a75d1c4Smrg shift 10842a75d1c4Smrg ;; 10852a75d1c4Smrg --preserve-dup-deps) 10862a75d1c4Smrg opt_preserve_dup_deps=: 10872a75d1c4Smrg ;; 10882a75d1c4Smrg --features) 10892a75d1c4Smrg opt_features=: 10902a75d1c4Smrgfunc_features 10912a75d1c4Smrg ;; 10922a75d1c4Smrg --finish) 10932a75d1c4Smrg opt_finish=: 10942a75d1c4Smrgset dummy --mode finish ${1+"$@"}; shift 10952a75d1c4Smrg ;; 10962a75d1c4Smrg --help) 10972a75d1c4Smrg opt_help=: 10982a75d1c4Smrg ;; 10992a75d1c4Smrg --help-all) 11002a75d1c4Smrg opt_help_all=: 11012a75d1c4Smrgopt_help=': help-all' 11022a75d1c4Smrg ;; 11032a75d1c4Smrg --mode) 11042a75d1c4Smrg test $# = 0 && func_missing_arg $opt && break 11052a75d1c4Smrg optarg="$1" 11062a75d1c4Smrg opt_mode="$optarg" 11072a75d1c4Smrgcase $optarg in 11082a75d1c4Smrg # Valid mode arguments: 11092a75d1c4Smrg clean|compile|execute|finish|install|link|relink|uninstall) ;; 11102a75d1c4Smrg 11112a75d1c4Smrg # Catch anything else as an error 11122a75d1c4Smrg *) func_error "invalid argument for $opt" 11132a75d1c4Smrg exit_cmd=exit 11142a75d1c4Smrg break 11152a75d1c4Smrg ;; 11162a75d1c4Smrgesac 11172a75d1c4Smrg shift 11182a75d1c4Smrg ;; 11192a75d1c4Smrg --no-silent|--no-quiet) 11202a75d1c4Smrg opt_silent=false 11212a75d1c4Smrgfunc_append preserve_args " $opt" 11222a75d1c4Smrg ;; 11232a75d1c4Smrg --no-verbose) 11242a75d1c4Smrg opt_verbose=false 11252a75d1c4Smrgfunc_append preserve_args " $opt" 11262a75d1c4Smrg ;; 11272a75d1c4Smrg --silent|--quiet) 11282a75d1c4Smrg opt_silent=: 11292a75d1c4Smrgfunc_append preserve_args " $opt" 11302a75d1c4Smrg opt_verbose=false 11312a75d1c4Smrg ;; 11322a75d1c4Smrg --verbose|-v) 11332a75d1c4Smrg opt_verbose=: 11342a75d1c4Smrgfunc_append preserve_args " $opt" 11352a75d1c4Smrgopt_silent=false 11362a75d1c4Smrg ;; 11372a75d1c4Smrg --tag) 11382a75d1c4Smrg test $# = 0 && func_missing_arg $opt && break 11392a75d1c4Smrg optarg="$1" 11402a75d1c4Smrg opt_tag="$optarg" 11412a75d1c4Smrgfunc_append preserve_args " $opt $optarg" 11422a75d1c4Smrgfunc_enable_tag "$optarg" 11432a75d1c4Smrg shift 11442a75d1c4Smrg ;; 11452a75d1c4Smrg 11462a75d1c4Smrg -\?|-h) func_usage ;; 11472a75d1c4Smrg --help) func_help ;; 11482a75d1c4Smrg --version) func_version ;; 11492a75d1c4Smrg 11502a75d1c4Smrg # Separate optargs to long options: 11512a75d1c4Smrg --*=*) 11522a75d1c4Smrg func_split_long_opt "$opt" 11532a75d1c4Smrg set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 11542a75d1c4Smrg shift 11552a75d1c4Smrg ;; 11562a75d1c4Smrg 11572a75d1c4Smrg # Separate non-argument short options: 11582a75d1c4Smrg -\?*|-h*|-n*|-v*) 11592a75d1c4Smrg func_split_short_opt "$opt" 11602a75d1c4Smrg set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 11612a75d1c4Smrg shift 11622a75d1c4Smrg ;; 11632a75d1c4Smrg 11642a75d1c4Smrg --) break ;; 11652a75d1c4Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 11662a75d1c4Smrg *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1167f7ec340bSmacallan esac 11682a75d1c4Smrg done 1169f7ec340bSmacallan 11702a75d1c4Smrg # Validate options: 11712a75d1c4Smrg 11722a75d1c4Smrg # save first non-option argument 11732a75d1c4Smrg if test "$#" -gt 0; then 11742a75d1c4Smrg nonopt="$opt" 11752a75d1c4Smrg shift 1176f7ec340bSmacallan fi 1177f7ec340bSmacallan 11782a75d1c4Smrg # preserve --debug 11792a75d1c4Smrg test "$opt_debug" = : || func_append preserve_args " --debug" 1180f7ec340bSmacallan 11812a75d1c4Smrg case $host in 11822a75d1c4Smrg *cygwin* | *mingw* | *pw32* | *cegcc*) 11832a75d1c4Smrg # don't eliminate duplications in $postdeps and $predeps 11842a75d1c4Smrg opt_duplicate_compiler_generated_deps=: 11852a75d1c4Smrg ;; 11862a75d1c4Smrg *) 11872a75d1c4Smrg opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 11882a75d1c4Smrg ;; 11892a75d1c4Smrg esac 1190f7ec340bSmacallan 11912a75d1c4Smrg $opt_help || { 11922a75d1c4Smrg # Sanity checks first: 11932a75d1c4Smrg func_check_version_match 1194f7ec340bSmacallan 11952a75d1c4Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 11962a75d1c4Smrg func_fatal_configuration "not configured to build any kind of library" 11972a75d1c4Smrg fi 1198f7ec340bSmacallan 11992a75d1c4Smrg # Darwin sucks 12002a75d1c4Smrg eval std_shrext=\"$shrext_cmds\" 1201f7ec340bSmacallan 12022a75d1c4Smrg # Only execute mode is allowed to have -dlopen flags. 12032a75d1c4Smrg if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 12042a75d1c4Smrg func_error "unrecognized option \`-dlopen'" 12052a75d1c4Smrg $ECHO "$help" 1>&2 12062a75d1c4Smrg exit $EXIT_FAILURE 12072a75d1c4Smrg fi 1208f7ec340bSmacallan 12092a75d1c4Smrg # Change the help message to a mode-specific one. 12102a75d1c4Smrg generic_help="$help" 12112a75d1c4Smrg help="Try \`$progname --help --mode=$opt_mode' for more information." 12122a75d1c4Smrg } 1213f7ec340bSmacallan 1214f7ec340bSmacallan 12152a75d1c4Smrg # Bail if the options were screwed 12162a75d1c4Smrg $exit_cmd $EXIT_FAILURE 12172a75d1c4Smrg} 1218f7ec340bSmacallan 1219f7ec340bSmacallan 1220f7ec340bSmacallan 1221f7ec340bSmacallan 12222a75d1c4Smrg## ----------- ## 12232a75d1c4Smrg## Main. ## 12242a75d1c4Smrg## ----------- ## 1225f7ec340bSmacallan 12262a75d1c4Smrg# func_lalib_p file 12272a75d1c4Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 12282a75d1c4Smrg# This function is only a basic sanity check; it will hardly flush out 12292a75d1c4Smrg# determined imposters. 12302a75d1c4Smrgfunc_lalib_p () 12312a75d1c4Smrg{ 12322a75d1c4Smrg test -f "$1" && 12332a75d1c4Smrg $SED -e 4q "$1" 2>/dev/null \ 12342a75d1c4Smrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 12352a75d1c4Smrg} 1236f7ec340bSmacallan 12372a75d1c4Smrg# func_lalib_unsafe_p file 12382a75d1c4Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 12392a75d1c4Smrg# This function implements the same check as func_lalib_p without 12402a75d1c4Smrg# resorting to external programs. To this end, it redirects stdin and 12412a75d1c4Smrg# closes it afterwards, without saving the original file descriptor. 12422a75d1c4Smrg# As a safety measure, use it only where a negative result would be 12432a75d1c4Smrg# fatal anyway. Works if `file' does not exist. 12442a75d1c4Smrgfunc_lalib_unsafe_p () 12452a75d1c4Smrg{ 12462a75d1c4Smrg lalib_p=no 12472a75d1c4Smrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 12482a75d1c4Smrg for lalib_p_l in 1 2 3 4 12492a75d1c4Smrg do 12502a75d1c4Smrg read lalib_p_line 12512a75d1c4Smrg case "$lalib_p_line" in 12522a75d1c4Smrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 12532a75d1c4Smrg esac 12542a75d1c4Smrg done 12552a75d1c4Smrg exec 0<&5 5<&- 12562a75d1c4Smrg fi 12572a75d1c4Smrg test "$lalib_p" = yes 12582a75d1c4Smrg} 1259f7ec340bSmacallan 12602a75d1c4Smrg# func_ltwrapper_script_p file 12612a75d1c4Smrg# True iff FILE is a libtool wrapper script 12622a75d1c4Smrg# This function is only a basic sanity check; it will hardly flush out 12632a75d1c4Smrg# determined imposters. 12642a75d1c4Smrgfunc_ltwrapper_script_p () 12652a75d1c4Smrg{ 12662a75d1c4Smrg func_lalib_p "$1" 12672a75d1c4Smrg} 1268f7ec340bSmacallan 12692a75d1c4Smrg# func_ltwrapper_executable_p file 12702a75d1c4Smrg# True iff FILE is a libtool wrapper executable 12712a75d1c4Smrg# This function is only a basic sanity check; it will hardly flush out 12722a75d1c4Smrg# determined imposters. 12732a75d1c4Smrgfunc_ltwrapper_executable_p () 12742a75d1c4Smrg{ 12752a75d1c4Smrg func_ltwrapper_exec_suffix= 12762a75d1c4Smrg case $1 in 12772a75d1c4Smrg *.exe) ;; 12782a75d1c4Smrg *) func_ltwrapper_exec_suffix=.exe ;; 1279f7ec340bSmacallan esac 12802a75d1c4Smrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 12812a75d1c4Smrg} 1282f7ec340bSmacallan 12832a75d1c4Smrg# func_ltwrapper_scriptname file 12842a75d1c4Smrg# Assumes file is an ltwrapper_executable 12852a75d1c4Smrg# uses $file to determine the appropriate filename for a 12862a75d1c4Smrg# temporary ltwrapper_script. 12872a75d1c4Smrgfunc_ltwrapper_scriptname () 12882a75d1c4Smrg{ 12892a75d1c4Smrg func_dirname_and_basename "$1" "" "." 12902a75d1c4Smrg func_stripname '' '.exe' "$func_basename_result" 12912a75d1c4Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 12922a75d1c4Smrg} 1293f7ec340bSmacallan 12942a75d1c4Smrg# func_ltwrapper_p file 12952a75d1c4Smrg# True iff FILE is a libtool wrapper script or wrapper executable 12962a75d1c4Smrg# This function is only a basic sanity check; it will hardly flush out 12972a75d1c4Smrg# determined imposters. 12982a75d1c4Smrgfunc_ltwrapper_p () 12992a75d1c4Smrg{ 13002a75d1c4Smrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 13012a75d1c4Smrg} 1302f7ec340bSmacallan 1303f7ec340bSmacallan 13042a75d1c4Smrg# func_execute_cmds commands fail_cmd 13052a75d1c4Smrg# Execute tilde-delimited COMMANDS. 13062a75d1c4Smrg# If FAIL_CMD is given, eval that upon failure. 13072a75d1c4Smrg# FAIL_CMD may read-access the current command in variable CMD! 13082a75d1c4Smrgfunc_execute_cmds () 13092a75d1c4Smrg{ 13102a75d1c4Smrg $opt_debug 13112a75d1c4Smrg save_ifs=$IFS; IFS='~' 13122a75d1c4Smrg for cmd in $1; do 13132a75d1c4Smrg IFS=$save_ifs 13142a75d1c4Smrg eval cmd=\"$cmd\" 13152a75d1c4Smrg func_show_eval "$cmd" "${2-:}" 1316f7ec340bSmacallan done 13172a75d1c4Smrg IFS=$save_ifs 13182a75d1c4Smrg} 1319f7ec340bSmacallan 1320f7ec340bSmacallan 13212a75d1c4Smrg# func_source file 13222a75d1c4Smrg# Source FILE, adding directory component if necessary. 13232a75d1c4Smrg# Note that it is not necessary on cygwin/mingw to append a dot to 13242a75d1c4Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 13252a75d1c4Smrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 13262a75d1c4Smrg# `FILE.' does not work on cygwin managed mounts. 13272a75d1c4Smrgfunc_source () 13282a75d1c4Smrg{ 13292a75d1c4Smrg $opt_debug 13302a75d1c4Smrg case $1 in 13312a75d1c4Smrg */* | *\\*) . "$1" ;; 13322a75d1c4Smrg *) . "./$1" ;; 13332a75d1c4Smrg esac 13342a75d1c4Smrg} 1335f7ec340bSmacallan 1336f7ec340bSmacallan 13372a75d1c4Smrg# func_resolve_sysroot PATH 13382a75d1c4Smrg# Replace a leading = in PATH with a sysroot. Store the result into 13392a75d1c4Smrg# func_resolve_sysroot_result 13402a75d1c4Smrgfunc_resolve_sysroot () 13412a75d1c4Smrg{ 13422a75d1c4Smrg func_resolve_sysroot_result=$1 13432a75d1c4Smrg case $func_resolve_sysroot_result in 13442a75d1c4Smrg =*) 13452a75d1c4Smrg func_stripname '=' '' "$func_resolve_sysroot_result" 13462a75d1c4Smrg func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 13472a75d1c4Smrg ;; 13482a75d1c4Smrg esac 13492a75d1c4Smrg} 1350f7ec340bSmacallan 13512a75d1c4Smrg# func_replace_sysroot PATH 13522a75d1c4Smrg# If PATH begins with the sysroot, replace it with = and 13532a75d1c4Smrg# store the result into func_replace_sysroot_result. 13542a75d1c4Smrgfunc_replace_sysroot () 13552a75d1c4Smrg{ 13562a75d1c4Smrg case "$lt_sysroot:$1" in 13572a75d1c4Smrg ?*:"$lt_sysroot"*) 13582a75d1c4Smrg func_stripname "$lt_sysroot" '' "$1" 13592a75d1c4Smrg func_replace_sysroot_result="=$func_stripname_result" 13602a75d1c4Smrg ;; 13612a75d1c4Smrg *) 13622a75d1c4Smrg # Including no sysroot. 13632a75d1c4Smrg func_replace_sysroot_result=$1 13642a75d1c4Smrg ;; 13652a75d1c4Smrg esac 13662a75d1c4Smrg} 1367f7ec340bSmacallan 13682a75d1c4Smrg# func_infer_tag arg 13692a75d1c4Smrg# Infer tagged configuration to use if any are available and 13702a75d1c4Smrg# if one wasn't chosen via the "--tag" command line option. 13712a75d1c4Smrg# Only attempt this if the compiler in the base compile 13722a75d1c4Smrg# command doesn't match the default compiler. 13732a75d1c4Smrg# arg is usually of the form 'gcc ...' 13742a75d1c4Smrgfunc_infer_tag () 13752a75d1c4Smrg{ 13762a75d1c4Smrg $opt_debug 13772a75d1c4Smrg if test -n "$available_tags" && test -z "$tagname"; then 13782a75d1c4Smrg CC_quoted= 13792a75d1c4Smrg for arg in $CC; do 13802a75d1c4Smrg func_append_quoted CC_quoted "$arg" 13812a75d1c4Smrg done 13822a75d1c4Smrg CC_expanded=`func_echo_all $CC` 13832a75d1c4Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 13842a75d1c4Smrg case $@ in 13852a75d1c4Smrg # Blanks in the command may have been stripped by the calling shell, 13862a75d1c4Smrg # but not from the CC environment variable when configure was run. 13872a75d1c4Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 13882a75d1c4Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 13892a75d1c4Smrg # Blanks at the start of $base_compile will cause this to fail 13902a75d1c4Smrg # if we don't check for them as well. 13912a75d1c4Smrg *) 13922a75d1c4Smrg for z in $available_tags; do 13932a75d1c4Smrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 13942a75d1c4Smrg # Evaluate the configuration. 13952a75d1c4Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 13962a75d1c4Smrg CC_quoted= 13972a75d1c4Smrg for arg in $CC; do 13982a75d1c4Smrg # Double-quote args containing other shell metacharacters. 13992a75d1c4Smrg func_append_quoted CC_quoted "$arg" 14002a75d1c4Smrg done 14012a75d1c4Smrg CC_expanded=`func_echo_all $CC` 14022a75d1c4Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 14032a75d1c4Smrg case "$@ " in 14042a75d1c4Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 14052a75d1c4Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 14062a75d1c4Smrg # The compiler in the base compile command matches 14072a75d1c4Smrg # the one in the tagged configuration. 14082a75d1c4Smrg # Assume this is the tagged configuration we want. 14092a75d1c4Smrg tagname=$z 14102a75d1c4Smrg break 14112a75d1c4Smrg ;; 14122a75d1c4Smrg esac 14132a75d1c4Smrg fi 14142a75d1c4Smrg done 14152a75d1c4Smrg # If $tagname still isn't set, then no tagged configuration 14162a75d1c4Smrg # was found and let the user know that the "--tag" command 14172a75d1c4Smrg # line option must be used. 14182a75d1c4Smrg if test -z "$tagname"; then 14192a75d1c4Smrg func_echo "unable to infer tagged configuration" 14202a75d1c4Smrg func_fatal_error "specify a tag with \`--tag'" 14212a75d1c4Smrg# else 14222a75d1c4Smrg# func_verbose "using $tagname tagged configuration" 14232a75d1c4Smrg fi 14242a75d1c4Smrg ;; 14252a75d1c4Smrg esac 1426f7ec340bSmacallan fi 14272a75d1c4Smrg} 1428f7ec340bSmacallan 1429f7ec340bSmacallan 1430f7ec340bSmacallan 14312a75d1c4Smrg# func_write_libtool_object output_name pic_name nonpic_name 14322a75d1c4Smrg# Create a libtool object file (analogous to a ".la" file), 14332a75d1c4Smrg# but don't create it if we're doing a dry run. 14342a75d1c4Smrgfunc_write_libtool_object () 14352a75d1c4Smrg{ 14362a75d1c4Smrg write_libobj=${1} 14372a75d1c4Smrg if test "$build_libtool_libs" = yes; then 14382a75d1c4Smrg write_lobj=\'${2}\' 14392a75d1c4Smrg else 14402a75d1c4Smrg write_lobj=none 1441f7ec340bSmacallan fi 1442f7ec340bSmacallan 14432a75d1c4Smrg if test "$build_old_libs" = yes; then 14442a75d1c4Smrg write_oldobj=\'${3}\' 14452a75d1c4Smrg else 14462a75d1c4Smrg write_oldobj=none 1447f7ec340bSmacallan fi 1448f7ec340bSmacallan 14492a75d1c4Smrg $opt_dry_run || { 14502a75d1c4Smrg cat >${write_libobj}T <<EOF 14512a75d1c4Smrg# $write_libobj - a libtool object file 14522a75d1c4Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1453f7ec340bSmacallan# 1454f7ec340bSmacallan# Please DO NOT delete this file! 1455f7ec340bSmacallan# It is necessary for linking the library. 1456f7ec340bSmacallan 1457f7ec340bSmacallan# Name of the PIC object. 14582a75d1c4Smrgpic_object=$write_lobj 1459f7ec340bSmacallan 14602a75d1c4Smrg# Name of the non-PIC object 14612a75d1c4Smrgnon_pic_object=$write_oldobj 1462f7ec340bSmacallan 14632a75d1c4SmrgEOF 14642a75d1c4Smrg $MV "${write_libobj}T" "${write_libobj}" 14652a75d1c4Smrg } 14662a75d1c4Smrg} 1467f7ec340bSmacallan 1468f7ec340bSmacallan 14692a75d1c4Smrg################################################## 14702a75d1c4Smrg# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 14712a75d1c4Smrg################################################## 1472f7ec340bSmacallan 14732a75d1c4Smrg# func_convert_core_file_wine_to_w32 ARG 14742a75d1c4Smrg# Helper function used by file name conversion functions when $build is *nix, 14752a75d1c4Smrg# and $host is mingw, cygwin, or some other w32 environment. Relies on a 14762a75d1c4Smrg# correctly configured wine environment available, with the winepath program 14772a75d1c4Smrg# in $build's $PATH. 14782a75d1c4Smrg# 14792a75d1c4Smrg# ARG is the $build file name to be converted to w32 format. 14802a75d1c4Smrg# Result is available in $func_convert_core_file_wine_to_w32_result, and will 14812a75d1c4Smrg# be empty on error (or when ARG is empty) 14822a75d1c4Smrgfunc_convert_core_file_wine_to_w32 () 14832a75d1c4Smrg{ 14842a75d1c4Smrg $opt_debug 14852a75d1c4Smrg func_convert_core_file_wine_to_w32_result="$1" 14862a75d1c4Smrg if test -n "$1"; then 14872a75d1c4Smrg # Unfortunately, winepath does not exit with a non-zero error code, so we 14882a75d1c4Smrg # are forced to check the contents of stdout. On the other hand, if the 14892a75d1c4Smrg # command is not found, the shell will set an exit code of 127 and print 14902a75d1c4Smrg # *an error message* to stdout. So we must check for both error code of 14912a75d1c4Smrg # zero AND non-empty stdout, which explains the odd construction: 14922a75d1c4Smrg func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 14932a75d1c4Smrg if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 14942a75d1c4Smrg func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 14952a75d1c4Smrg $SED -e "$lt_sed_naive_backslashify"` 14962a75d1c4Smrg else 14972a75d1c4Smrg func_convert_core_file_wine_to_w32_result= 14982a75d1c4Smrg fi 14992a75d1c4Smrg fi 15002a75d1c4Smrg} 15012a75d1c4Smrg# end: func_convert_core_file_wine_to_w32 1502f7ec340bSmacallan 15032a75d1c4Smrg 15042a75d1c4Smrg# func_convert_core_path_wine_to_w32 ARG 15052a75d1c4Smrg# Helper function used by path conversion functions when $build is *nix, and 15062a75d1c4Smrg# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 15072a75d1c4Smrg# configured wine environment available, with the winepath program in $build's 15082a75d1c4Smrg# $PATH. Assumes ARG has no leading or trailing path separator characters. 15092a75d1c4Smrg# 15102a75d1c4Smrg# ARG is path to be converted from $build format to win32. 15112a75d1c4Smrg# Result is available in $func_convert_core_path_wine_to_w32_result. 15122a75d1c4Smrg# Unconvertible file (directory) names in ARG are skipped; if no directory names 15132a75d1c4Smrg# are convertible, then the result may be empty. 15142a75d1c4Smrgfunc_convert_core_path_wine_to_w32 () 15152a75d1c4Smrg{ 15162a75d1c4Smrg $opt_debug 15172a75d1c4Smrg # unfortunately, winepath doesn't convert paths, only file names 15182a75d1c4Smrg func_convert_core_path_wine_to_w32_result="" 15192a75d1c4Smrg if test -n "$1"; then 15202a75d1c4Smrg oldIFS=$IFS 15212a75d1c4Smrg IFS=: 15222a75d1c4Smrg for func_convert_core_path_wine_to_w32_f in $1; do 15232a75d1c4Smrg IFS=$oldIFS 15242a75d1c4Smrg func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 15252a75d1c4Smrg if test -n "$func_convert_core_file_wine_to_w32_result" ; then 15262a75d1c4Smrg if test -z "$func_convert_core_path_wine_to_w32_result"; then 15272a75d1c4Smrg func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 15282a75d1c4Smrg else 15292a75d1c4Smrg func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 15302a75d1c4Smrg fi 1531f7ec340bSmacallan fi 15322a75d1c4Smrg done 15332a75d1c4Smrg IFS=$oldIFS 15342a75d1c4Smrg fi 15352a75d1c4Smrg} 15362a75d1c4Smrg# end: func_convert_core_path_wine_to_w32 15372a75d1c4Smrg 15382a75d1c4Smrg 15392a75d1c4Smrg# func_cygpath ARGS... 15402a75d1c4Smrg# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 15412a75d1c4Smrg# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 15422a75d1c4Smrg# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 15432a75d1c4Smrg# (2), returns the Cygwin file name or path in func_cygpath_result (input 15442a75d1c4Smrg# file name or path is assumed to be in w32 format, as previously converted 15452a75d1c4Smrg# from $build's *nix or MSYS format). In case (3), returns the w32 file name 15462a75d1c4Smrg# or path in func_cygpath_result (input file name or path is assumed to be in 15472a75d1c4Smrg# Cygwin format). Returns an empty string on error. 15482a75d1c4Smrg# 15492a75d1c4Smrg# ARGS are passed to cygpath, with the last one being the file name or path to 15502a75d1c4Smrg# be converted. 15512a75d1c4Smrg# 15522a75d1c4Smrg# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 15532a75d1c4Smrg# environment variable; do not put it in $PATH. 15542a75d1c4Smrgfunc_cygpath () 15552a75d1c4Smrg{ 15562a75d1c4Smrg $opt_debug 15572a75d1c4Smrg if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 15582a75d1c4Smrg func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 15592a75d1c4Smrg if test "$?" -ne 0; then 15602a75d1c4Smrg # on failure, ensure result is empty 15612a75d1c4Smrg func_cygpath_result= 15622a75d1c4Smrg fi 15632a75d1c4Smrg else 15642a75d1c4Smrg func_cygpath_result= 15652a75d1c4Smrg func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 15662a75d1c4Smrg fi 15672a75d1c4Smrg} 15682a75d1c4Smrg#end: func_cygpath 1569f7ec340bSmacallan 1570f7ec340bSmacallan 15712a75d1c4Smrg# func_convert_core_msys_to_w32 ARG 15722a75d1c4Smrg# Convert file name or path ARG from MSYS format to w32 format. Return 15732a75d1c4Smrg# result in func_convert_core_msys_to_w32_result. 15742a75d1c4Smrgfunc_convert_core_msys_to_w32 () 15752a75d1c4Smrg{ 15762a75d1c4Smrg $opt_debug 15772a75d1c4Smrg # awkward: cmd appends spaces to result 15782a75d1c4Smrg func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 15792a75d1c4Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 15802a75d1c4Smrg} 15812a75d1c4Smrg#end: func_convert_core_msys_to_w32 1582f7ec340bSmacallan 1583f7ec340bSmacallan 15842a75d1c4Smrg# func_convert_file_check ARG1 ARG2 15852a75d1c4Smrg# Verify that ARG1 (a file name in $build format) was converted to $host 15862a75d1c4Smrg# format in ARG2. Otherwise, emit an error message, but continue (resetting 15872a75d1c4Smrg# func_to_host_file_result to ARG1). 15882a75d1c4Smrgfunc_convert_file_check () 15892a75d1c4Smrg{ 15902a75d1c4Smrg $opt_debug 15912a75d1c4Smrg if test -z "$2" && test -n "$1" ; then 15922a75d1c4Smrg func_error "Could not determine host file name corresponding to" 15932a75d1c4Smrg func_error " \`$1'" 15942a75d1c4Smrg func_error "Continuing, but uninstalled executables may not work." 15952a75d1c4Smrg # Fallback: 15962a75d1c4Smrg func_to_host_file_result="$1" 15972a75d1c4Smrg fi 15982a75d1c4Smrg} 15992a75d1c4Smrg# end func_convert_file_check 1600f7ec340bSmacallan 1601f7ec340bSmacallan 16022a75d1c4Smrg# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 16032a75d1c4Smrg# Verify that FROM_PATH (a path in $build format) was converted to $host 16042a75d1c4Smrg# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 16052a75d1c4Smrg# func_to_host_file_result to a simplistic fallback value (see below). 16062a75d1c4Smrgfunc_convert_path_check () 16072a75d1c4Smrg{ 16082a75d1c4Smrg $opt_debug 16092a75d1c4Smrg if test -z "$4" && test -n "$3"; then 16102a75d1c4Smrg func_error "Could not determine the host path corresponding to" 16112a75d1c4Smrg func_error " \`$3'" 16122a75d1c4Smrg func_error "Continuing, but uninstalled executables may not work." 16132a75d1c4Smrg # Fallback. This is a deliberately simplistic "conversion" and 16142a75d1c4Smrg # should not be "improved". See libtool.info. 16152a75d1c4Smrg if test "x$1" != "x$2"; then 16162a75d1c4Smrg lt_replace_pathsep_chars="s|$1|$2|g" 16172a75d1c4Smrg func_to_host_path_result=`echo "$3" | 16182a75d1c4Smrg $SED -e "$lt_replace_pathsep_chars"` 16192a75d1c4Smrg else 16202a75d1c4Smrg func_to_host_path_result="$3" 16212a75d1c4Smrg fi 16222a75d1c4Smrg fi 16232a75d1c4Smrg} 16242a75d1c4Smrg# end func_convert_path_check 1625f7ec340bSmacallan 1626f7ec340bSmacallan 16272a75d1c4Smrg# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 16282a75d1c4Smrg# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 16292a75d1c4Smrg# and appending REPL if ORIG matches BACKPAT. 16302a75d1c4Smrgfunc_convert_path_front_back_pathsep () 16312a75d1c4Smrg{ 16322a75d1c4Smrg $opt_debug 16332a75d1c4Smrg case $4 in 16342a75d1c4Smrg $1 ) func_to_host_path_result="$3$func_to_host_path_result" 16352a75d1c4Smrg ;; 16362a75d1c4Smrg esac 16372a75d1c4Smrg case $4 in 16382a75d1c4Smrg $2 ) func_append func_to_host_path_result "$3" 16392a75d1c4Smrg ;; 16402a75d1c4Smrg esac 16412a75d1c4Smrg} 16422a75d1c4Smrg# end func_convert_path_front_back_pathsep 1643f7ec340bSmacallan 1644f7ec340bSmacallan 16452a75d1c4Smrg################################################## 16462a75d1c4Smrg# $build to $host FILE NAME CONVERSION FUNCTIONS # 16472a75d1c4Smrg################################################## 16482a75d1c4Smrg# invoked via `$to_host_file_cmd ARG' 16492a75d1c4Smrg# 16502a75d1c4Smrg# In each case, ARG is the path to be converted from $build to $host format. 16512a75d1c4Smrg# Result will be available in $func_to_host_file_result. 1652f7ec340bSmacallan 1653f7ec340bSmacallan 16542a75d1c4Smrg# func_to_host_file ARG 16552a75d1c4Smrg# Converts the file name ARG from $build format to $host format. Return result 16562a75d1c4Smrg# in func_to_host_file_result. 16572a75d1c4Smrgfunc_to_host_file () 16582a75d1c4Smrg{ 16592a75d1c4Smrg $opt_debug 16602a75d1c4Smrg $to_host_file_cmd "$1" 16612a75d1c4Smrg} 16622a75d1c4Smrg# end func_to_host_file 1663f7ec340bSmacallan 1664f7ec340bSmacallan 16652a75d1c4Smrg# func_to_tool_file ARG LAZY 16662a75d1c4Smrg# converts the file name ARG from $build format to toolchain format. Return 16672a75d1c4Smrg# result in func_to_tool_file_result. If the conversion in use is listed 16682a75d1c4Smrg# in (the comma separated) LAZY, no conversion takes place. 16692a75d1c4Smrgfunc_to_tool_file () 16702a75d1c4Smrg{ 16712a75d1c4Smrg $opt_debug 16722a75d1c4Smrg case ,$2, in 16732a75d1c4Smrg *,"$to_tool_file_cmd",*) 16742a75d1c4Smrg func_to_tool_file_result=$1 16752a75d1c4Smrg ;; 16762a75d1c4Smrg *) 16772a75d1c4Smrg $to_tool_file_cmd "$1" 16782a75d1c4Smrg func_to_tool_file_result=$func_to_host_file_result 16792a75d1c4Smrg ;; 16802a75d1c4Smrg esac 16812a75d1c4Smrg} 16822a75d1c4Smrg# end func_to_tool_file 1683f7ec340bSmacallan 1684f7ec340bSmacallan 16852a75d1c4Smrg# func_convert_file_noop ARG 16862a75d1c4Smrg# Copy ARG to func_to_host_file_result. 16872a75d1c4Smrgfunc_convert_file_noop () 16882a75d1c4Smrg{ 16892a75d1c4Smrg func_to_host_file_result="$1" 16902a75d1c4Smrg} 16912a75d1c4Smrg# end func_convert_file_noop 1692f7ec340bSmacallan 1693f7ec340bSmacallan 16942a75d1c4Smrg# func_convert_file_msys_to_w32 ARG 16952a75d1c4Smrg# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 16962a75d1c4Smrg# conversion to w32 is not available inside the cwrapper. Returns result in 16972a75d1c4Smrg# func_to_host_file_result. 16982a75d1c4Smrgfunc_convert_file_msys_to_w32 () 16992a75d1c4Smrg{ 17002a75d1c4Smrg $opt_debug 17012a75d1c4Smrg func_to_host_file_result="$1" 17022a75d1c4Smrg if test -n "$1"; then 17032a75d1c4Smrg func_convert_core_msys_to_w32 "$1" 17042a75d1c4Smrg func_to_host_file_result="$func_convert_core_msys_to_w32_result" 17052a75d1c4Smrg fi 17062a75d1c4Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17072a75d1c4Smrg} 17082a75d1c4Smrg# end func_convert_file_msys_to_w32 1709f7ec340bSmacallan 1710f7ec340bSmacallan 17112a75d1c4Smrg# func_convert_file_cygwin_to_w32 ARG 17122a75d1c4Smrg# Convert file name ARG from Cygwin to w32 format. Returns result in 17132a75d1c4Smrg# func_to_host_file_result. 17142a75d1c4Smrgfunc_convert_file_cygwin_to_w32 () 17152a75d1c4Smrg{ 17162a75d1c4Smrg $opt_debug 17172a75d1c4Smrg func_to_host_file_result="$1" 17182a75d1c4Smrg if test -n "$1"; then 17192a75d1c4Smrg # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 17202a75d1c4Smrg # LT_CYGPATH in this case. 17212a75d1c4Smrg func_to_host_file_result=`cygpath -m "$1"` 17222a75d1c4Smrg fi 17232a75d1c4Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17242a75d1c4Smrg} 17252a75d1c4Smrg# end func_convert_file_cygwin_to_w32 1726f7ec340bSmacallan 1727f7ec340bSmacallan 17282a75d1c4Smrg# func_convert_file_nix_to_w32 ARG 17292a75d1c4Smrg# Convert file name ARG from *nix to w32 format. Requires a wine environment 17302a75d1c4Smrg# and a working winepath. Returns result in func_to_host_file_result. 17312a75d1c4Smrgfunc_convert_file_nix_to_w32 () 17322a75d1c4Smrg{ 17332a75d1c4Smrg $opt_debug 17342a75d1c4Smrg func_to_host_file_result="$1" 17352a75d1c4Smrg if test -n "$1"; then 17362a75d1c4Smrg func_convert_core_file_wine_to_w32 "$1" 17372a75d1c4Smrg func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 17382a75d1c4Smrg fi 17392a75d1c4Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17402a75d1c4Smrg} 17412a75d1c4Smrg# end func_convert_file_nix_to_w32 1742f7ec340bSmacallan 1743f7ec340bSmacallan 17442a75d1c4Smrg# func_convert_file_msys_to_cygwin ARG 17452a75d1c4Smrg# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 17462a75d1c4Smrg# Returns result in func_to_host_file_result. 17472a75d1c4Smrgfunc_convert_file_msys_to_cygwin () 17482a75d1c4Smrg{ 17492a75d1c4Smrg $opt_debug 17502a75d1c4Smrg func_to_host_file_result="$1" 17512a75d1c4Smrg if test -n "$1"; then 17522a75d1c4Smrg func_convert_core_msys_to_w32 "$1" 17532a75d1c4Smrg func_cygpath -u "$func_convert_core_msys_to_w32_result" 17542a75d1c4Smrg func_to_host_file_result="$func_cygpath_result" 17552a75d1c4Smrg fi 17562a75d1c4Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17572a75d1c4Smrg} 17582a75d1c4Smrg# end func_convert_file_msys_to_cygwin 1759f7ec340bSmacallan 1760f7ec340bSmacallan 17612a75d1c4Smrg# func_convert_file_nix_to_cygwin ARG 17622a75d1c4Smrg# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 17632a75d1c4Smrg# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 17642a75d1c4Smrg# in func_to_host_file_result. 17652a75d1c4Smrgfunc_convert_file_nix_to_cygwin () 17662a75d1c4Smrg{ 17672a75d1c4Smrg $opt_debug 17682a75d1c4Smrg func_to_host_file_result="$1" 17692a75d1c4Smrg if test -n "$1"; then 17702a75d1c4Smrg # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 17712a75d1c4Smrg func_convert_core_file_wine_to_w32 "$1" 17722a75d1c4Smrg func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 17732a75d1c4Smrg func_to_host_file_result="$func_cygpath_result" 17742a75d1c4Smrg fi 17752a75d1c4Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17762a75d1c4Smrg} 17772a75d1c4Smrg# end func_convert_file_nix_to_cygwin 1778f7ec340bSmacallan 1779f7ec340bSmacallan 17802a75d1c4Smrg############################################# 17812a75d1c4Smrg# $build to $host PATH CONVERSION FUNCTIONS # 17822a75d1c4Smrg############################################# 17832a75d1c4Smrg# invoked via `$to_host_path_cmd ARG' 17842a75d1c4Smrg# 17852a75d1c4Smrg# In each case, ARG is the path to be converted from $build to $host format. 17862a75d1c4Smrg# The result will be available in $func_to_host_path_result. 17872a75d1c4Smrg# 17882a75d1c4Smrg# Path separators are also converted from $build format to $host format. If 17892a75d1c4Smrg# ARG begins or ends with a path separator character, it is preserved (but 17902a75d1c4Smrg# converted to $host format) on output. 17912a75d1c4Smrg# 17922a75d1c4Smrg# All path conversion functions are named using the following convention: 17932a75d1c4Smrg# file name conversion function : func_convert_file_X_to_Y () 17942a75d1c4Smrg# path conversion function : func_convert_path_X_to_Y () 17952a75d1c4Smrg# where, for any given $build/$host combination the 'X_to_Y' value is the 17962a75d1c4Smrg# same. If conversion functions are added for new $build/$host combinations, 17972a75d1c4Smrg# the two new functions must follow this pattern, or func_init_to_host_path_cmd 17982a75d1c4Smrg# will break. 17992a75d1c4Smrg 18002a75d1c4Smrg 18012a75d1c4Smrg# func_init_to_host_path_cmd 18022a75d1c4Smrg# Ensures that function "pointer" variable $to_host_path_cmd is set to the 18032a75d1c4Smrg# appropriate value, based on the value of $to_host_file_cmd. 18042a75d1c4Smrgto_host_path_cmd= 18052a75d1c4Smrgfunc_init_to_host_path_cmd () 18062a75d1c4Smrg{ 18072a75d1c4Smrg $opt_debug 18082a75d1c4Smrg if test -z "$to_host_path_cmd"; then 18092a75d1c4Smrg func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 18102a75d1c4Smrg to_host_path_cmd="func_convert_path_${func_stripname_result}" 18112a75d1c4Smrg fi 18122a75d1c4Smrg} 1813f7ec340bSmacallan 1814f7ec340bSmacallan 18152a75d1c4Smrg# func_to_host_path ARG 18162a75d1c4Smrg# Converts the path ARG from $build format to $host format. Return result 18172a75d1c4Smrg# in func_to_host_path_result. 18182a75d1c4Smrgfunc_to_host_path () 18192a75d1c4Smrg{ 18202a75d1c4Smrg $opt_debug 18212a75d1c4Smrg func_init_to_host_path_cmd 18222a75d1c4Smrg $to_host_path_cmd "$1" 18232a75d1c4Smrg} 18242a75d1c4Smrg# end func_to_host_path 1825f7ec340bSmacallan 1826f7ec340bSmacallan 18272a75d1c4Smrg# func_convert_path_noop ARG 18282a75d1c4Smrg# Copy ARG to func_to_host_path_result. 18292a75d1c4Smrgfunc_convert_path_noop () 18302a75d1c4Smrg{ 18312a75d1c4Smrg func_to_host_path_result="$1" 18322a75d1c4Smrg} 18332a75d1c4Smrg# end func_convert_path_noop 1834f7ec340bSmacallan 1835f7ec340bSmacallan 18362a75d1c4Smrg# func_convert_path_msys_to_w32 ARG 18372a75d1c4Smrg# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 18382a75d1c4Smrg# conversion to w32 is not available inside the cwrapper. Returns result in 18392a75d1c4Smrg# func_to_host_path_result. 18402a75d1c4Smrgfunc_convert_path_msys_to_w32 () 18412a75d1c4Smrg{ 18422a75d1c4Smrg $opt_debug 18432a75d1c4Smrg func_to_host_path_result="$1" 18442a75d1c4Smrg if test -n "$1"; then 18452a75d1c4Smrg # Remove leading and trailing path separator characters from ARG. MSYS 18462a75d1c4Smrg # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 18472a75d1c4Smrg # and winepath ignores them completely. 18482a75d1c4Smrg func_stripname : : "$1" 18492a75d1c4Smrg func_to_host_path_tmp1=$func_stripname_result 18502a75d1c4Smrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 18512a75d1c4Smrg func_to_host_path_result="$func_convert_core_msys_to_w32_result" 18522a75d1c4Smrg func_convert_path_check : ";" \ 18532a75d1c4Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18542a75d1c4Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18552a75d1c4Smrg fi 18562a75d1c4Smrg} 18572a75d1c4Smrg# end func_convert_path_msys_to_w32 1858f7ec340bSmacallan 1859f7ec340bSmacallan 18602a75d1c4Smrg# func_convert_path_cygwin_to_w32 ARG 18612a75d1c4Smrg# Convert path ARG from Cygwin to w32 format. Returns result in 18622a75d1c4Smrg# func_to_host_file_result. 18632a75d1c4Smrgfunc_convert_path_cygwin_to_w32 () 18642a75d1c4Smrg{ 18652a75d1c4Smrg $opt_debug 18662a75d1c4Smrg func_to_host_path_result="$1" 18672a75d1c4Smrg if test -n "$1"; then 18682a75d1c4Smrg # See func_convert_path_msys_to_w32: 18692a75d1c4Smrg func_stripname : : "$1" 18702a75d1c4Smrg func_to_host_path_tmp1=$func_stripname_result 18712a75d1c4Smrg func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 18722a75d1c4Smrg func_convert_path_check : ";" \ 18732a75d1c4Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18742a75d1c4Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18752a75d1c4Smrg fi 18762a75d1c4Smrg} 18772a75d1c4Smrg# end func_convert_path_cygwin_to_w32 1878f7ec340bSmacallan 1879f7ec340bSmacallan 18802a75d1c4Smrg# func_convert_path_nix_to_w32 ARG 18812a75d1c4Smrg# Convert path ARG from *nix to w32 format. Requires a wine environment and 18822a75d1c4Smrg# a working winepath. Returns result in func_to_host_file_result. 18832a75d1c4Smrgfunc_convert_path_nix_to_w32 () 18842a75d1c4Smrg{ 18852a75d1c4Smrg $opt_debug 18862a75d1c4Smrg func_to_host_path_result="$1" 18872a75d1c4Smrg if test -n "$1"; then 18882a75d1c4Smrg # See func_convert_path_msys_to_w32: 18892a75d1c4Smrg func_stripname : : "$1" 18902a75d1c4Smrg func_to_host_path_tmp1=$func_stripname_result 18912a75d1c4Smrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 18922a75d1c4Smrg func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 18932a75d1c4Smrg func_convert_path_check : ";" \ 18942a75d1c4Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18952a75d1c4Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18962a75d1c4Smrg fi 18972a75d1c4Smrg} 18982a75d1c4Smrg# end func_convert_path_nix_to_w32 1899f7ec340bSmacallan 1900f7ec340bSmacallan 19012a75d1c4Smrg# func_convert_path_msys_to_cygwin ARG 19022a75d1c4Smrg# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 19032a75d1c4Smrg# Returns result in func_to_host_file_result. 19042a75d1c4Smrgfunc_convert_path_msys_to_cygwin () 19052a75d1c4Smrg{ 19062a75d1c4Smrg $opt_debug 19072a75d1c4Smrg func_to_host_path_result="$1" 19082a75d1c4Smrg if test -n "$1"; then 19092a75d1c4Smrg # See func_convert_path_msys_to_w32: 19102a75d1c4Smrg func_stripname : : "$1" 19112a75d1c4Smrg func_to_host_path_tmp1=$func_stripname_result 19122a75d1c4Smrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 19132a75d1c4Smrg func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 19142a75d1c4Smrg func_to_host_path_result="$func_cygpath_result" 19152a75d1c4Smrg func_convert_path_check : : \ 19162a75d1c4Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 19172a75d1c4Smrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19182a75d1c4Smrg fi 19192a75d1c4Smrg} 19202a75d1c4Smrg# end func_convert_path_msys_to_cygwin 1921f7ec340bSmacallan 1922f7ec340bSmacallan 19232a75d1c4Smrg# func_convert_path_nix_to_cygwin ARG 19242a75d1c4Smrg# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 19252a75d1c4Smrg# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 19262a75d1c4Smrg# func_to_host_file_result. 19272a75d1c4Smrgfunc_convert_path_nix_to_cygwin () 19282a75d1c4Smrg{ 19292a75d1c4Smrg $opt_debug 19302a75d1c4Smrg func_to_host_path_result="$1" 19312a75d1c4Smrg if test -n "$1"; then 19322a75d1c4Smrg # Remove leading and trailing path separator characters from 19332a75d1c4Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 19342a75d1c4Smrg # into '.;' and ';.', and winepath ignores them completely. 19352a75d1c4Smrg func_stripname : : "$1" 19362a75d1c4Smrg func_to_host_path_tmp1=$func_stripname_result 19372a75d1c4Smrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 19382a75d1c4Smrg func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 19392a75d1c4Smrg func_to_host_path_result="$func_cygpath_result" 19402a75d1c4Smrg func_convert_path_check : : \ 19412a75d1c4Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 19422a75d1c4Smrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19432a75d1c4Smrg fi 19442a75d1c4Smrg} 19452a75d1c4Smrg# end func_convert_path_nix_to_cygwin 1946f7ec340bSmacallan 1947f7ec340bSmacallan 19482a75d1c4Smrg# func_mode_compile arg... 19492a75d1c4Smrgfunc_mode_compile () 19502a75d1c4Smrg{ 19512a75d1c4Smrg $opt_debug 19522a75d1c4Smrg # Get the compilation command and the source file. 19532a75d1c4Smrg base_compile= 19542a75d1c4Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 19552a75d1c4Smrg suppress_opt=yes 19562a75d1c4Smrg suppress_output= 19572a75d1c4Smrg arg_mode=normal 19582a75d1c4Smrg libobj= 19592a75d1c4Smrg later= 19602a75d1c4Smrg pie_flag= 19612a75d1c4Smrg 19622a75d1c4Smrg for arg 19632a75d1c4Smrg do 19642a75d1c4Smrg case $arg_mode in 19652a75d1c4Smrg arg ) 19662a75d1c4Smrg # do not "continue". Instead, add this to base_compile 19672a75d1c4Smrg lastarg="$arg" 19682a75d1c4Smrg arg_mode=normal 19692a75d1c4Smrg ;; 19702a75d1c4Smrg 19712a75d1c4Smrg target ) 19722a75d1c4Smrg libobj="$arg" 19732a75d1c4Smrg arg_mode=normal 19742a75d1c4Smrg continue 19752a75d1c4Smrg ;; 19762a75d1c4Smrg 19772a75d1c4Smrg normal ) 19782a75d1c4Smrg # Accept any command-line options. 19792a75d1c4Smrg case $arg in 19802a75d1c4Smrg -o) 19812a75d1c4Smrg test -n "$libobj" && \ 19822a75d1c4Smrg func_fatal_error "you cannot specify \`-o' more than once" 19832a75d1c4Smrg arg_mode=target 1984f7ec340bSmacallan continue 1985f7ec340bSmacallan ;; 19862a75d1c4Smrg 19872a75d1c4Smrg -pie | -fpie | -fPIE) 19882a75d1c4Smrg func_append pie_flag " $arg" 1989f7ec340bSmacallan continue 1990f7ec340bSmacallan ;; 19912a75d1c4Smrg 19922a75d1c4Smrg -shared | -static | -prefer-pic | -prefer-non-pic) 19932a75d1c4Smrg func_append later " $arg" 1994f7ec340bSmacallan continue 1995f7ec340bSmacallan ;; 19962a75d1c4Smrg 19972a75d1c4Smrg -no-suppress) 19982a75d1c4Smrg suppress_opt=no 1999f7ec340bSmacallan continue 2000f7ec340bSmacallan ;; 2001f7ec340bSmacallan 20022a75d1c4Smrg -Xcompiler) 20032a75d1c4Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 20042a75d1c4Smrg continue # The current "srcfile" will either be retained or 20052a75d1c4Smrg ;; # replaced later. I would guess that would be a bug. 2006f7ec340bSmacallan 20072a75d1c4Smrg -Wc,*) 20082a75d1c4Smrg func_stripname '-Wc,' '' "$arg" 20092a75d1c4Smrg args=$func_stripname_result 20102a75d1c4Smrg lastarg= 20112a75d1c4Smrg save_ifs="$IFS"; IFS=',' 20122a75d1c4Smrg for arg in $args; do 20132a75d1c4Smrg IFS="$save_ifs" 20142a75d1c4Smrg func_append_quoted lastarg "$arg" 20152a75d1c4Smrg done 20162a75d1c4Smrg IFS="$save_ifs" 20172a75d1c4Smrg func_stripname ' ' '' "$lastarg" 20182a75d1c4Smrg lastarg=$func_stripname_result 2019f7ec340bSmacallan 20202a75d1c4Smrg # Add the arguments to base_compile. 20212a75d1c4Smrg func_append base_compile " $lastarg" 20222a75d1c4Smrg continue 20232a75d1c4Smrg ;; 2024f7ec340bSmacallan 20252a75d1c4Smrg *) 20262a75d1c4Smrg # Accept the current argument as the source file. 20272a75d1c4Smrg # The previous "srcfile" becomes the current argument. 20282a75d1c4Smrg # 20292a75d1c4Smrg lastarg="$srcfile" 20302a75d1c4Smrg srcfile="$arg" 20312a75d1c4Smrg ;; 20322a75d1c4Smrg esac # case $arg 2033f7ec340bSmacallan ;; 20342a75d1c4Smrg esac # case $arg_mode 2035f7ec340bSmacallan 20362a75d1c4Smrg # Aesthetically quote the previous argument. 20372a75d1c4Smrg func_append_quoted base_compile "$lastarg" 20382a75d1c4Smrg done # for arg 2039f7ec340bSmacallan 20402a75d1c4Smrg case $arg_mode in 20412a75d1c4Smrg arg) 20422a75d1c4Smrg func_fatal_error "you must specify an argument for -Xcompile" 20432a75d1c4Smrg ;; 20442a75d1c4Smrg target) 20452a75d1c4Smrg func_fatal_error "you must specify a target with \`-o'" 20462a75d1c4Smrg ;; 20472a75d1c4Smrg *) 20482a75d1c4Smrg # Get the name of the library object. 20492a75d1c4Smrg test -z "$libobj" && { 20502a75d1c4Smrg func_basename "$srcfile" 20512a75d1c4Smrg libobj="$func_basename_result" 20522a75d1c4Smrg } 20532a75d1c4Smrg ;; 20542a75d1c4Smrg esac 2055f7ec340bSmacallan 20562a75d1c4Smrg # Recognize several different file suffixes. 20572a75d1c4Smrg # If the user specifies -o file.o, it is replaced with file.lo 20582a75d1c4Smrg case $libobj in 20592a75d1c4Smrg *.[cCFSifmso] | \ 20602a75d1c4Smrg *.ada | *.adb | *.ads | *.asm | \ 20612a75d1c4Smrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 20622a75d1c4Smrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 20632a75d1c4Smrg func_xform "$libobj" 20642a75d1c4Smrg libobj=$func_xform_result 20652a75d1c4Smrg ;; 20662a75d1c4Smrg esac 2067f7ec340bSmacallan 20682a75d1c4Smrg case $libobj in 20692a75d1c4Smrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 20702a75d1c4Smrg *) 20712a75d1c4Smrg func_fatal_error "cannot determine name of library object from \`$libobj'" 20722a75d1c4Smrg ;; 20732a75d1c4Smrg esac 2074f7ec340bSmacallan 20752a75d1c4Smrg func_infer_tag $base_compile 2076f7ec340bSmacallan 20772a75d1c4Smrg for arg in $later; do 20782a75d1c4Smrg case $arg in 20792a75d1c4Smrg -shared) 20802a75d1c4Smrg test "$build_libtool_libs" != yes && \ 20812a75d1c4Smrg func_fatal_configuration "can not build a shared library" 20822a75d1c4Smrg build_old_libs=no 2083f7ec340bSmacallan continue 2084f7ec340bSmacallan ;; 2085f7ec340bSmacallan 20862a75d1c4Smrg -static) 20872a75d1c4Smrg build_libtool_libs=no 20882a75d1c4Smrg build_old_libs=yes 2089f7ec340bSmacallan continue 2090f7ec340bSmacallan ;; 2091f7ec340bSmacallan 20922a75d1c4Smrg -prefer-pic) 20932a75d1c4Smrg pic_mode=yes 2094f7ec340bSmacallan continue 2095f7ec340bSmacallan ;; 2096f7ec340bSmacallan 20972a75d1c4Smrg -prefer-non-pic) 20982a75d1c4Smrg pic_mode=no 2099f7ec340bSmacallan continue 2100f7ec340bSmacallan ;; 21012a75d1c4Smrg esac 21022a75d1c4Smrg done 2103f7ec340bSmacallan 21042a75d1c4Smrg func_quote_for_eval "$libobj" 21052a75d1c4Smrg test "X$libobj" != "X$func_quote_for_eval_result" \ 21062a75d1c4Smrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 21072a75d1c4Smrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 21082a75d1c4Smrg func_dirname_and_basename "$obj" "/" "" 21092a75d1c4Smrg objname="$func_basename_result" 21102a75d1c4Smrg xdir="$func_dirname_result" 21112a75d1c4Smrg lobj=${xdir}$objdir/$objname 2112f7ec340bSmacallan 21132a75d1c4Smrg test -z "$base_compile" && \ 21142a75d1c4Smrg func_fatal_help "you must specify a compilation command" 2115f7ec340bSmacallan 21162a75d1c4Smrg # Delete any leftover library objects. 21172a75d1c4Smrg if test "$build_old_libs" = yes; then 21182a75d1c4Smrg removelist="$obj $lobj $libobj ${libobj}T" 21192a75d1c4Smrg else 21202a75d1c4Smrg removelist="$lobj $libobj ${libobj}T" 21212a75d1c4Smrg fi 21227ce7e03cSmrg 21232a75d1c4Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 21242a75d1c4Smrg case $host_os in 21252a75d1c4Smrg cygwin* | mingw* | pw32* | os2* | cegcc*) 21262a75d1c4Smrg pic_mode=default 21272a75d1c4Smrg ;; 21282a75d1c4Smrg esac 21292a75d1c4Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 21302a75d1c4Smrg # non-PIC code in shared libraries is not supported 21312a75d1c4Smrg pic_mode=default 21322a75d1c4Smrg fi 2133f7ec340bSmacallan 21342a75d1c4Smrg # Calculate the filename of the output object if compiler does 21352a75d1c4Smrg # not support -o with -c 21362a75d1c4Smrg if test "$compiler_c_o" = no; then 21372a75d1c4Smrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 21382a75d1c4Smrg lockfile="$output_obj.lock" 21392a75d1c4Smrg else 21402a75d1c4Smrg output_obj= 21412a75d1c4Smrg need_locks=no 21422a75d1c4Smrg lockfile= 21432a75d1c4Smrg fi 2144f7ec340bSmacallan 21452a75d1c4Smrg # Lock this critical section if it is needed 21462a75d1c4Smrg # We use this script file to make the link, it avoids creating a new file 21472a75d1c4Smrg if test "$need_locks" = yes; then 21482a75d1c4Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 21492a75d1c4Smrg func_echo "Waiting for $lockfile to be removed" 21502a75d1c4Smrg sleep 2 21512a75d1c4Smrg done 21522a75d1c4Smrg elif test "$need_locks" = warn; then 21532a75d1c4Smrg if test -f "$lockfile"; then 21542a75d1c4Smrg $ECHO "\ 21552a75d1c4Smrg*** ERROR, $lockfile exists and contains: 21562a75d1c4Smrg`cat $lockfile 2>/dev/null` 2157f7ec340bSmacallan 21582a75d1c4SmrgThis indicates that another process is trying to use the same 21592a75d1c4Smrgtemporary object file, and libtool could not work around it because 21602a75d1c4Smrgyour compiler does not support \`-c' and \`-o' together. If you 21612a75d1c4Smrgrepeat this compilation, it may succeed, by chance, but you had better 21622a75d1c4Smrgavoid parallel builds (make -j) in this platform, or get a better 21632a75d1c4Smrgcompiler." 2164f7ec340bSmacallan 21652a75d1c4Smrg $opt_dry_run || $RM $removelist 21662a75d1c4Smrg exit $EXIT_FAILURE 21672a75d1c4Smrg fi 21682a75d1c4Smrg func_append removelist " $output_obj" 21692a75d1c4Smrg $ECHO "$srcfile" > "$lockfile" 21702a75d1c4Smrg fi 2171f7ec340bSmacallan 21722a75d1c4Smrg $opt_dry_run || $RM $removelist 21732a75d1c4Smrg func_append removelist " $lockfile" 21742a75d1c4Smrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2175f7ec340bSmacallan 21762a75d1c4Smrg func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 21772a75d1c4Smrg srcfile=$func_to_tool_file_result 21782a75d1c4Smrg func_quote_for_eval "$srcfile" 21792a75d1c4Smrg qsrcfile=$func_quote_for_eval_result 2180f7ec340bSmacallan 21812a75d1c4Smrg # Only build a PIC object if we are building libtool libraries. 21822a75d1c4Smrg if test "$build_libtool_libs" = yes; then 21832a75d1c4Smrg # Without this assignment, base_compile gets emptied. 21842a75d1c4Smrg fbsd_hideous_sh_bug=$base_compile 2185f7ec340bSmacallan 21862a75d1c4Smrg if test "$pic_mode" != no; then 21872a75d1c4Smrg command="$base_compile $qsrcfile $pic_flag" 21882a75d1c4Smrg else 21892a75d1c4Smrg # Don't build PIC code 21902a75d1c4Smrg command="$base_compile $qsrcfile" 21912a75d1c4Smrg fi 2192f7ec340bSmacallan 21932a75d1c4Smrg func_mkdir_p "$xdir$objdir" 2194f7ec340bSmacallan 21952a75d1c4Smrg if test -z "$output_obj"; then 21962a75d1c4Smrg # Place PIC objects in $objdir 21972a75d1c4Smrg func_append command " -o $lobj" 21982a75d1c4Smrg fi 2199f7ec340bSmacallan 22002a75d1c4Smrg func_show_eval_locale "$command" \ 22012a75d1c4Smrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2202f7ec340bSmacallan 22032a75d1c4Smrg if test "$need_locks" = warn && 22042a75d1c4Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 22052a75d1c4Smrg $ECHO "\ 22062a75d1c4Smrg*** ERROR, $lockfile contains: 22072a75d1c4Smrg`cat $lockfile 2>/dev/null` 2208f7ec340bSmacallan 22092a75d1c4Smrgbut it should contain: 22102a75d1c4Smrg$srcfile 2211f7ec340bSmacallan 22122a75d1c4SmrgThis indicates that another process is trying to use the same 22132a75d1c4Smrgtemporary object file, and libtool could not work around it because 22142a75d1c4Smrgyour compiler does not support \`-c' and \`-o' together. If you 22152a75d1c4Smrgrepeat this compilation, it may succeed, by chance, but you had better 22162a75d1c4Smrgavoid parallel builds (make -j) in this platform, or get a better 22172a75d1c4Smrgcompiler." 2218f7ec340bSmacallan 22192a75d1c4Smrg $opt_dry_run || $RM $removelist 22202a75d1c4Smrg exit $EXIT_FAILURE 22212a75d1c4Smrg fi 2222f7ec340bSmacallan 22232a75d1c4Smrg # Just move the object if needed, then go on to compile the next one 22242a75d1c4Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 22252a75d1c4Smrg func_show_eval '$MV "$output_obj" "$lobj"' \ 22262a75d1c4Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 22272a75d1c4Smrg fi 2228f7ec340bSmacallan 22292a75d1c4Smrg # Allow error messages only from the first compilation. 22302a75d1c4Smrg if test "$suppress_opt" = yes; then 22312a75d1c4Smrg suppress_output=' >/dev/null 2>&1' 22322a75d1c4Smrg fi 22332a75d1c4Smrg fi 2234f7ec340bSmacallan 22352a75d1c4Smrg # Only build a position-dependent object if we build old libraries. 22362a75d1c4Smrg if test "$build_old_libs" = yes; then 22372a75d1c4Smrg if test "$pic_mode" != yes; then 22382a75d1c4Smrg # Don't build PIC code 22392a75d1c4Smrg command="$base_compile $qsrcfile$pie_flag" 22402a75d1c4Smrg else 22412a75d1c4Smrg command="$base_compile $qsrcfile $pic_flag" 22422a75d1c4Smrg fi 22432a75d1c4Smrg if test "$compiler_c_o" = yes; then 22442a75d1c4Smrg func_append command " -o $obj" 22452a75d1c4Smrg fi 2246f7ec340bSmacallan 22472a75d1c4Smrg # Suppress compiler output if we already did a PIC compilation. 22482a75d1c4Smrg func_append command "$suppress_output" 22492a75d1c4Smrg func_show_eval_locale "$command" \ 22502a75d1c4Smrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2251f7ec340bSmacallan 22522a75d1c4Smrg if test "$need_locks" = warn && 22532a75d1c4Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 22542a75d1c4Smrg $ECHO "\ 22552a75d1c4Smrg*** ERROR, $lockfile contains: 22562a75d1c4Smrg`cat $lockfile 2>/dev/null` 2257f7ec340bSmacallan 22582a75d1c4Smrgbut it should contain: 22592a75d1c4Smrg$srcfile 2260f7ec340bSmacallan 22612a75d1c4SmrgThis indicates that another process is trying to use the same 22622a75d1c4Smrgtemporary object file, and libtool could not work around it because 22632a75d1c4Smrgyour compiler does not support \`-c' and \`-o' together. If you 22642a75d1c4Smrgrepeat this compilation, it may succeed, by chance, but you had better 22652a75d1c4Smrgavoid parallel builds (make -j) in this platform, or get a better 22662a75d1c4Smrgcompiler." 2267f7ec340bSmacallan 22682a75d1c4Smrg $opt_dry_run || $RM $removelist 22692a75d1c4Smrg exit $EXIT_FAILURE 22702a75d1c4Smrg fi 2271f7ec340bSmacallan 22722a75d1c4Smrg # Just move the object if needed 22732a75d1c4Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 22742a75d1c4Smrg func_show_eval '$MV "$output_obj" "$obj"' \ 22752a75d1c4Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 22762a75d1c4Smrg fi 22772a75d1c4Smrg fi 2278f7ec340bSmacallan 22792a75d1c4Smrg $opt_dry_run || { 22802a75d1c4Smrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2281f7ec340bSmacallan 22822a75d1c4Smrg # Unlock the critical section if it was locked 22832a75d1c4Smrg if test "$need_locks" != no; then 22842a75d1c4Smrg removelist=$lockfile 22852a75d1c4Smrg $RM "$lockfile" 22862a75d1c4Smrg fi 22872a75d1c4Smrg } 2288f7ec340bSmacallan 22892a75d1c4Smrg exit $EXIT_SUCCESS 22902a75d1c4Smrg} 2291f7ec340bSmacallan 22922a75d1c4Smrg$opt_help || { 22932a75d1c4Smrg test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 22942a75d1c4Smrg} 2295f7ec340bSmacallan 22962a75d1c4Smrgfunc_mode_help () 22972a75d1c4Smrg{ 22982a75d1c4Smrg # We need to display help for each of the modes. 22992a75d1c4Smrg case $opt_mode in 23002a75d1c4Smrg "") 23012a75d1c4Smrg # Generic help is extracted from the usage comments 23022a75d1c4Smrg # at the start of this file. 23032a75d1c4Smrg func_help 23042a75d1c4Smrg ;; 2305f7ec340bSmacallan 23062a75d1c4Smrg clean) 23072a75d1c4Smrg $ECHO \ 23082a75d1c4Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2309f7ec340bSmacallan 23102a75d1c4SmrgRemove files from the build directory. 2311f7ec340bSmacallan 23122a75d1c4SmrgRM is the name of the program to use to delete files associated with each FILE 23132a75d1c4Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 23142a75d1c4Smrgto RM. 2315f7ec340bSmacallan 23162a75d1c4SmrgIf FILE is a libtool library, object or program, all the files associated 23172a75d1c4Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 23182a75d1c4Smrg ;; 2319f7ec340bSmacallan 23202a75d1c4Smrg compile) 23212a75d1c4Smrg $ECHO \ 23222a75d1c4Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2323f7ec340bSmacallan 23242a75d1c4SmrgCompile a source file into a libtool library object. 2325f7ec340bSmacallan 23262a75d1c4SmrgThis mode accepts the following additional options: 2327f7ec340bSmacallan 23282a75d1c4Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 23292a75d1c4Smrg -no-suppress do not suppress compiler output for multiple passes 23302a75d1c4Smrg -prefer-pic try to build PIC objects only 23312a75d1c4Smrg -prefer-non-pic try to build non-PIC objects only 23322a75d1c4Smrg -shared do not build a \`.o' file suitable for static linking 23332a75d1c4Smrg -static only build a \`.o' file suitable for static linking 23342a75d1c4Smrg -Wc,FLAG pass FLAG directly to the compiler 2335f7ec340bSmacallan 23362a75d1c4SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 23372a75d1c4Smrgfrom the given SOURCEFILE. 2338f7ec340bSmacallan 23392a75d1c4SmrgThe output file name is determined by removing the directory component from 23402a75d1c4SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 23412a75d1c4Smrglibrary object suffix, \`.lo'." 23422a75d1c4Smrg ;; 2343f7ec340bSmacallan 23442a75d1c4Smrg execute) 23452a75d1c4Smrg $ECHO \ 23462a75d1c4Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2347f7ec340bSmacallan 23482a75d1c4SmrgAutomatically set library path, then run a program. 2349f7ec340bSmacallan 23502a75d1c4SmrgThis mode accepts the following additional options: 2351f7ec340bSmacallan 23522a75d1c4Smrg -dlopen FILE add the directory containing FILE to the library path 2353f7ec340bSmacallan 23542a75d1c4SmrgThis mode sets the library path environment variable according to \`-dlopen' 23552a75d1c4Smrgflags. 2356f7ec340bSmacallan 23572a75d1c4SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 23582a75d1c4Smrginto their corresponding uninstalled binary, and any of their required library 23592a75d1c4Smrgdirectories are added to the library path. 2360f7ec340bSmacallan 23612a75d1c4SmrgThen, COMMAND is executed, with ARGS as arguments." 23622a75d1c4Smrg ;; 2363f7ec340bSmacallan 23642a75d1c4Smrg finish) 23652a75d1c4Smrg $ECHO \ 23662a75d1c4Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2367f7ec340bSmacallan 23682a75d1c4SmrgComplete the installation of libtool libraries. 23692a75d1c4Smrg 23702a75d1c4SmrgEach LIBDIR is a directory that contains libtool libraries. 23712a75d1c4Smrg 23722a75d1c4SmrgThe commands that this mode executes may require superuser privileges. Use 23732a75d1c4Smrgthe \`--dry-run' option if you just want to see what would be executed." 23742a75d1c4Smrg ;; 23752a75d1c4Smrg 23762a75d1c4Smrg install) 23772a75d1c4Smrg $ECHO \ 23782a75d1c4Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 23792a75d1c4Smrg 23802a75d1c4SmrgInstall executables or libraries. 23812a75d1c4Smrg 23822a75d1c4SmrgINSTALL-COMMAND is the installation command. The first component should be 23832a75d1c4Smrgeither the \`install' or \`cp' program. 23842a75d1c4Smrg 23852a75d1c4SmrgThe following components of INSTALL-COMMAND are treated specially: 23862a75d1c4Smrg 23872a75d1c4Smrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 23882a75d1c4Smrg 23892a75d1c4SmrgThe rest of the components are interpreted as arguments to that command (only 23902a75d1c4SmrgBSD-compatible install options are recognized)." 23912a75d1c4Smrg ;; 23922a75d1c4Smrg 23932a75d1c4Smrg link) 23942a75d1c4Smrg $ECHO \ 23952a75d1c4Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 23962a75d1c4Smrg 23972a75d1c4SmrgLink object files or libraries together to form another library, or to 23982a75d1c4Smrgcreate an executable program. 23992a75d1c4Smrg 24002a75d1c4SmrgLINK-COMMAND is a command using the C compiler that you would use to create 24012a75d1c4Smrga program from several object files. 24022a75d1c4Smrg 24032a75d1c4SmrgThe following components of LINK-COMMAND are treated specially: 24042a75d1c4Smrg 24052a75d1c4Smrg -all-static do not do any dynamic linking at all 24062a75d1c4Smrg -avoid-version do not add a version suffix if possible 24072a75d1c4Smrg -bindir BINDIR specify path to binaries directory (for systems where 24082a75d1c4Smrg libraries must be found in the PATH setting at runtime) 24092a75d1c4Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 24102a75d1c4Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 24112a75d1c4Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 24122a75d1c4Smrg -export-symbols SYMFILE 24132a75d1c4Smrg try to export only the symbols listed in SYMFILE 24142a75d1c4Smrg -export-symbols-regex REGEX 24152a75d1c4Smrg try to export only the symbols matching REGEX 24162a75d1c4Smrg -LLIBDIR search LIBDIR for required installed libraries 24172a75d1c4Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 24182a75d1c4Smrg -module build a library that can dlopened 24192a75d1c4Smrg -no-fast-install disable the fast-install mode 24202a75d1c4Smrg -no-install link a not-installable executable 24212a75d1c4Smrg -no-undefined declare that a library does not refer to external symbols 24222a75d1c4Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 24232a75d1c4Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 24242a75d1c4Smrg -precious-files-regex REGEX 24252a75d1c4Smrg don't remove output files matching REGEX 24262a75d1c4Smrg -release RELEASE specify package release information 24272a75d1c4Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 24282a75d1c4Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 24292a75d1c4Smrg -shared only do dynamic linking of libtool libraries 24302a75d1c4Smrg -shrext SUFFIX override the standard shared library file extension 24312a75d1c4Smrg -static do not do any dynamic linking of uninstalled libtool libraries 24322a75d1c4Smrg -static-libtool-libs 24332a75d1c4Smrg do not do any dynamic linking of libtool libraries 24342a75d1c4Smrg -version-info CURRENT[:REVISION[:AGE]] 24352a75d1c4Smrg specify library version info [each variable defaults to 0] 24362a75d1c4Smrg -weak LIBNAME declare that the target provides the LIBNAME interface 24372a75d1c4Smrg -Wc,FLAG 24382a75d1c4Smrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 24392a75d1c4Smrg -Wl,FLAG 24402a75d1c4Smrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 24412a75d1c4Smrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 24422a75d1c4Smrg 24432a75d1c4SmrgAll other options (arguments beginning with \`-') are ignored. 24442a75d1c4Smrg 24452a75d1c4SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 24462a75d1c4Smrgtreated as uninstalled libtool libraries, other files are standard or library 24472a75d1c4Smrgobject files. 24482a75d1c4Smrg 24492a75d1c4SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 24502a75d1c4Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 24512a75d1c4Smrgrequired, except when creating a convenience library. 24522a75d1c4Smrg 24532a75d1c4SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 24542a75d1c4Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 24552a75d1c4Smrg 24562a75d1c4SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 24572a75d1c4Smrgis created, otherwise an executable program is created." 24582a75d1c4Smrg ;; 24592a75d1c4Smrg 24602a75d1c4Smrg uninstall) 24612a75d1c4Smrg $ECHO \ 24622a75d1c4Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 24632a75d1c4Smrg 24642a75d1c4SmrgRemove libraries from an installation directory. 24652a75d1c4Smrg 24662a75d1c4SmrgRM is the name of the program to use to delete files associated with each FILE 24672a75d1c4Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 24682a75d1c4Smrgto RM. 24692a75d1c4Smrg 24702a75d1c4SmrgIf FILE is a libtool library, all the files associated with it are deleted. 24712a75d1c4SmrgOtherwise, only FILE itself is deleted using RM." 24722a75d1c4Smrg ;; 24732a75d1c4Smrg 24742a75d1c4Smrg *) 24752a75d1c4Smrg func_fatal_help "invalid operation mode \`$opt_mode'" 24762a75d1c4Smrg ;; 2477f7ec340bSmacallan esac 2478f7ec340bSmacallan 24792a75d1c4Smrg echo 24802a75d1c4Smrg $ECHO "Try \`$progname --help' for more information about other modes." 24812a75d1c4Smrg} 2482f7ec340bSmacallan 24832a75d1c4Smrg# Now that we've collected a possible --mode arg, show help if necessary 24842a75d1c4Smrgif $opt_help; then 24852a75d1c4Smrg if test "$opt_help" = :; then 24862a75d1c4Smrg func_mode_help 24872a75d1c4Smrg else 24882a75d1c4Smrg { 24892a75d1c4Smrg func_help noexit 24902a75d1c4Smrg for opt_mode in compile link execute install finish uninstall clean; do 24912a75d1c4Smrg func_mode_help 24922a75d1c4Smrg done 24932a75d1c4Smrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 24942a75d1c4Smrg { 24952a75d1c4Smrg func_help noexit 24962a75d1c4Smrg for opt_mode in compile link execute install finish uninstall clean; do 24972a75d1c4Smrg echo 24982a75d1c4Smrg func_mode_help 24992a75d1c4Smrg done 25002a75d1c4Smrg } | 25012a75d1c4Smrg sed '1d 25022a75d1c4Smrg /^When reporting/,/^Report/{ 25032a75d1c4Smrg H 25042a75d1c4Smrg d 25052a75d1c4Smrg } 25062a75d1c4Smrg $x 25072a75d1c4Smrg /information about other modes/d 25082a75d1c4Smrg /more detailed .*MODE/d 25092a75d1c4Smrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 25102a75d1c4Smrg fi 25112a75d1c4Smrg exit $? 25122a75d1c4Smrgfi 2513f7ec340bSmacallan 2514f7ec340bSmacallan 25152a75d1c4Smrg# func_mode_execute arg... 25162a75d1c4Smrgfunc_mode_execute () 25172a75d1c4Smrg{ 25182a75d1c4Smrg $opt_debug 25192a75d1c4Smrg # The first argument is the command name. 25202a75d1c4Smrg cmd="$nonopt" 25212a75d1c4Smrg test -z "$cmd" && \ 25222a75d1c4Smrg func_fatal_help "you must specify a COMMAND" 25232a75d1c4Smrg 25242a75d1c4Smrg # Handle -dlopen flags immediately. 25252a75d1c4Smrg for file in $opt_dlopen; do 25262a75d1c4Smrg test -f "$file" \ 25272a75d1c4Smrg || func_fatal_help "\`$file' is not a file" 25282a75d1c4Smrg 25292a75d1c4Smrg dir= 25302a75d1c4Smrg case $file in 25312a75d1c4Smrg *.la) 25322a75d1c4Smrg func_resolve_sysroot "$file" 25332a75d1c4Smrg file=$func_resolve_sysroot_result 25342a75d1c4Smrg 25352a75d1c4Smrg # Check to see that this really is a libtool archive. 25362a75d1c4Smrg func_lalib_unsafe_p "$file" \ 25372a75d1c4Smrg || func_fatal_help "\`$lib' is not a valid libtool archive" 25382a75d1c4Smrg 25392a75d1c4Smrg # Read the libtool library. 25402a75d1c4Smrg dlname= 25412a75d1c4Smrg library_names= 25422a75d1c4Smrg func_source "$file" 25432a75d1c4Smrg 25442a75d1c4Smrg # Skip this library if it cannot be dlopened. 25452a75d1c4Smrg if test -z "$dlname"; then 25462a75d1c4Smrg # Warn if it was a shared library. 25472a75d1c4Smrg test -n "$library_names" && \ 25482a75d1c4Smrg func_warning "\`$file' was not linked with \`-export-dynamic'" 25492a75d1c4Smrg continue 25502a75d1c4Smrg fi 25512a75d1c4Smrg 25522a75d1c4Smrg func_dirname "$file" "" "." 25532a75d1c4Smrg dir="$func_dirname_result" 25542a75d1c4Smrg 25552a75d1c4Smrg if test -f "$dir/$objdir/$dlname"; then 25562a75d1c4Smrg func_append dir "/$objdir" 25572a75d1c4Smrg else 25582a75d1c4Smrg if test ! -f "$dir/$dlname"; then 25592a75d1c4Smrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 25602a75d1c4Smrg fi 25612a75d1c4Smrg fi 2562f7ec340bSmacallan ;; 25632a75d1c4Smrg 25642a75d1c4Smrg *.lo) 25652a75d1c4Smrg # Just add the directory containing the .lo file. 25662a75d1c4Smrg func_dirname "$file" "" "." 25672a75d1c4Smrg dir="$func_dirname_result" 2568f7ec340bSmacallan ;; 25692a75d1c4Smrg 25702a75d1c4Smrg *) 25712a75d1c4Smrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 25722a75d1c4Smrg continue 2573f7ec340bSmacallan ;; 25742a75d1c4Smrg esac 25752a75d1c4Smrg 25762a75d1c4Smrg # Get the absolute pathname. 25772a75d1c4Smrg absdir=`cd "$dir" && pwd` 25782a75d1c4Smrg test -n "$absdir" && dir="$absdir" 25792a75d1c4Smrg 25802a75d1c4Smrg # Now add the directory to shlibpath_var. 25812a75d1c4Smrg if eval "test -z \"\$$shlibpath_var\""; then 25822a75d1c4Smrg eval "$shlibpath_var=\"\$dir\"" 25832a75d1c4Smrg else 25842a75d1c4Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2585f7ec340bSmacallan fi 25862a75d1c4Smrg done 25872a75d1c4Smrg 25882a75d1c4Smrg # This variable tells wrapper scripts just to set shlibpath_var 25892a75d1c4Smrg # rather than running their programs. 25902a75d1c4Smrg libtool_execute_magic="$magic" 25912a75d1c4Smrg 25922a75d1c4Smrg # Check if any of the arguments is a wrapper script. 25932a75d1c4Smrg args= 25942a75d1c4Smrg for file 25952a75d1c4Smrg do 25962a75d1c4Smrg case $file in 25972a75d1c4Smrg -* | *.la | *.lo ) ;; 25982a75d1c4Smrg *) 25992a75d1c4Smrg # Do a test to see if this is really a libtool program. 26002a75d1c4Smrg if func_ltwrapper_script_p "$file"; then 26012a75d1c4Smrg func_source "$file" 26022a75d1c4Smrg # Transform arg to wrapped name. 26032a75d1c4Smrg file="$progdir/$program" 26042a75d1c4Smrg elif func_ltwrapper_executable_p "$file"; then 26052a75d1c4Smrg func_ltwrapper_scriptname "$file" 26062a75d1c4Smrg func_source "$func_ltwrapper_scriptname_result" 26072a75d1c4Smrg # Transform arg to wrapped name. 26082a75d1c4Smrg file="$progdir/$program" 26092a75d1c4Smrg fi 26102a75d1c4Smrg ;; 26112a75d1c4Smrg esac 26122a75d1c4Smrg # Quote arguments (to preserve shell metacharacters). 26132a75d1c4Smrg func_append_quoted args "$file" 26142a75d1c4Smrg done 26152a75d1c4Smrg 26162a75d1c4Smrg if test "X$opt_dry_run" = Xfalse; then 26172a75d1c4Smrg if test -n "$shlibpath_var"; then 26182a75d1c4Smrg # Export the shlibpath_var. 26192a75d1c4Smrg eval "export $shlibpath_var" 2620f7ec340bSmacallan fi 26212a75d1c4Smrg 26222a75d1c4Smrg # Restore saved environment variables 26232a75d1c4Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 26242a75d1c4Smrg do 26252a75d1c4Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 26262a75d1c4Smrg $lt_var=\$save_$lt_var; export $lt_var 26272a75d1c4Smrg else 26282a75d1c4Smrg $lt_unset $lt_var 26292a75d1c4Smrg fi" 26302a75d1c4Smrg done 26312a75d1c4Smrg 26322a75d1c4Smrg # Now prepare to actually exec the command. 26332a75d1c4Smrg exec_cmd="\$cmd$args" 26342a75d1c4Smrg else 26352a75d1c4Smrg # Display what would be done. 26362a75d1c4Smrg if test -n "$shlibpath_var"; then 26372a75d1c4Smrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 26382a75d1c4Smrg echo "export $shlibpath_var" 2639f7ec340bSmacallan fi 26402a75d1c4Smrg $ECHO "$cmd$args" 26412a75d1c4Smrg exit $EXIT_SUCCESS 26422a75d1c4Smrg fi 26432a75d1c4Smrg} 2644f7ec340bSmacallan 26452a75d1c4Smrgtest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2646f7ec340bSmacallan 2647f7ec340bSmacallan 26482a75d1c4Smrg# func_mode_finish arg... 26492a75d1c4Smrgfunc_mode_finish () 26502a75d1c4Smrg{ 26512a75d1c4Smrg $opt_debug 26522a75d1c4Smrg libs= 26532a75d1c4Smrg libdirs= 26542a75d1c4Smrg admincmds= 2655f7ec340bSmacallan 26562a75d1c4Smrg for opt in "$nonopt" ${1+"$@"} 26572a75d1c4Smrg do 26582a75d1c4Smrg if test -d "$opt"; then 26592a75d1c4Smrg func_append libdirs " $opt" 2660f7ec340bSmacallan 26612a75d1c4Smrg elif test -f "$opt"; then 26622a75d1c4Smrg if func_lalib_unsafe_p "$opt"; then 26632a75d1c4Smrg func_append libs " $opt" 26642a75d1c4Smrg else 26652a75d1c4Smrg func_warning "\`$opt' is not a valid libtool archive" 2666f7ec340bSmacallan fi 2667f7ec340bSmacallan 26682a75d1c4Smrg else 26692a75d1c4Smrg func_fatal_error "invalid argument \`$opt'" 26702a75d1c4Smrg fi 26712a75d1c4Smrg done 2672f7ec340bSmacallan 26732a75d1c4Smrg if test -n "$libs"; then 26742a75d1c4Smrg if test -n "$lt_sysroot"; then 26752a75d1c4Smrg sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 26762a75d1c4Smrg sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 26772a75d1c4Smrg else 26782a75d1c4Smrg sysroot_cmd= 26792a75d1c4Smrg fi 2680f7ec340bSmacallan 26812a75d1c4Smrg # Remove sysroot references 26822a75d1c4Smrg if $opt_dry_run; then 26832a75d1c4Smrg for lib in $libs; do 26842a75d1c4Smrg echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 26852a75d1c4Smrg done 26862a75d1c4Smrg else 26872a75d1c4Smrg tmpdir=`func_mktempdir` 26882a75d1c4Smrg for lib in $libs; do 26892a75d1c4Smrg sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 26902a75d1c4Smrg > $tmpdir/tmp-la 26912a75d1c4Smrg mv -f $tmpdir/tmp-la $lib 2692f7ec340bSmacallan done 26932a75d1c4Smrg ${RM}r "$tmpdir" 26942a75d1c4Smrg fi 26952a75d1c4Smrg fi 26962a75d1c4Smrg 26972a75d1c4Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 26982a75d1c4Smrg for libdir in $libdirs; do 26992a75d1c4Smrg if test -n "$finish_cmds"; then 27002a75d1c4Smrg # Do each command in the finish commands. 27012a75d1c4Smrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 27022a75d1c4Smrg'"$cmd"'"' 2703f7ec340bSmacallan fi 27042a75d1c4Smrg if test -n "$finish_eval"; then 27052a75d1c4Smrg # Do the single finish_eval. 27062a75d1c4Smrg eval cmds=\"$finish_eval\" 27072a75d1c4Smrg $opt_dry_run || eval "$cmds" || func_append admincmds " 27082a75d1c4Smrg $cmds" 27092a75d1c4Smrg fi 27102a75d1c4Smrg done 27112a75d1c4Smrg fi 2712f7ec340bSmacallan 27132a75d1c4Smrg # Exit here if they wanted silent mode. 27142a75d1c4Smrg $opt_silent && exit $EXIT_SUCCESS 2715f7ec340bSmacallan 27162a75d1c4Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 27172a75d1c4Smrg echo "----------------------------------------------------------------------" 27182a75d1c4Smrg echo "Libraries have been installed in:" 27192a75d1c4Smrg for libdir in $libdirs; do 27202a75d1c4Smrg $ECHO " $libdir" 27212a75d1c4Smrg done 27222a75d1c4Smrg echo 27232a75d1c4Smrg echo "If you ever happen to want to link against installed libraries" 27242a75d1c4Smrg echo "in a given directory, LIBDIR, you must either use libtool, and" 27252a75d1c4Smrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 27262a75d1c4Smrg echo "flag during linking and do at least one of the following:" 27272a75d1c4Smrg if test -n "$shlibpath_var"; then 27282a75d1c4Smrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 27292a75d1c4Smrg echo " during execution" 27302a75d1c4Smrg fi 27312a75d1c4Smrg if test -n "$runpath_var"; then 27322a75d1c4Smrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 27332a75d1c4Smrg echo " during linking" 27342a75d1c4Smrg fi 27352a75d1c4Smrg if test -n "$hardcode_libdir_flag_spec"; then 27362a75d1c4Smrg libdir=LIBDIR 27372a75d1c4Smrg eval flag=\"$hardcode_libdir_flag_spec\" 27382a75d1c4Smrg 27392a75d1c4Smrg $ECHO " - use the \`$flag' linker flag" 27402a75d1c4Smrg fi 27412a75d1c4Smrg if test -n "$admincmds"; then 27422a75d1c4Smrg $ECHO " - have your system administrator run these commands:$admincmds" 27432a75d1c4Smrg fi 27442a75d1c4Smrg if test -f /etc/ld.so.conf; then 27452a75d1c4Smrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 27462a75d1c4Smrg fi 27472a75d1c4Smrg echo 27482a75d1c4Smrg 27492a75d1c4Smrg echo "See any operating system documentation about shared libraries for" 27502a75d1c4Smrg case $host in 27512a75d1c4Smrg solaris2.[6789]|solaris2.1[0-9]) 27522a75d1c4Smrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 27532a75d1c4Smrg echo "pages." 27542a75d1c4Smrg ;; 2755f7ec340bSmacallan *) 27562a75d1c4Smrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 2757f7ec340bSmacallan ;; 27582a75d1c4Smrg esac 27592a75d1c4Smrg echo "----------------------------------------------------------------------" 27602a75d1c4Smrg fi 27612a75d1c4Smrg exit $EXIT_SUCCESS 27622a75d1c4Smrg} 2763f7ec340bSmacallan 27642a75d1c4Smrgtest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2765f7ec340bSmacallan 27662a75d1c4Smrg 27672a75d1c4Smrg# func_mode_install arg... 27682a75d1c4Smrgfunc_mode_install () 27692a75d1c4Smrg{ 27702a75d1c4Smrg $opt_debug 27712a75d1c4Smrg # There may be an optional sh(1) argument at the beginning of 27722a75d1c4Smrg # install_prog (especially on Windows NT). 27732a75d1c4Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 27742a75d1c4Smrg # Allow the use of GNU shtool's install command. 27752a75d1c4Smrg case $nonopt in *shtool*) :;; *) false;; esac; then 27762a75d1c4Smrg # Aesthetically quote it. 27772a75d1c4Smrg func_quote_for_eval "$nonopt" 27782a75d1c4Smrg install_prog="$func_quote_for_eval_result " 27792a75d1c4Smrg arg=$1 27802a75d1c4Smrg shift 27812a75d1c4Smrg else 27822a75d1c4Smrg install_prog= 27832a75d1c4Smrg arg=$nonopt 27842a75d1c4Smrg fi 27852a75d1c4Smrg 27862a75d1c4Smrg # The real first argument should be the name of the installation program. 27872a75d1c4Smrg # Aesthetically quote it. 27882a75d1c4Smrg func_quote_for_eval "$arg" 27892a75d1c4Smrg func_append install_prog "$func_quote_for_eval_result" 27902a75d1c4Smrg install_shared_prog=$install_prog 27912a75d1c4Smrg case " $install_prog " in 27922a75d1c4Smrg *[\\\ /]cp\ *) install_cp=: ;; 27932a75d1c4Smrg *) install_cp=false ;; 27942a75d1c4Smrg esac 27952a75d1c4Smrg 27962a75d1c4Smrg # We need to accept at least all the BSD install flags. 27972a75d1c4Smrg dest= 27982a75d1c4Smrg files= 27992a75d1c4Smrg opts= 28002a75d1c4Smrg prev= 28012a75d1c4Smrg install_type= 28022a75d1c4Smrg isdir=no 28032a75d1c4Smrg stripme= 28042a75d1c4Smrg no_mode=: 28052a75d1c4Smrg for arg 28062a75d1c4Smrg do 28072a75d1c4Smrg arg2= 28082a75d1c4Smrg if test -n "$dest"; then 28092a75d1c4Smrg func_append files " $dest" 28102a75d1c4Smrg dest=$arg 28112a75d1c4Smrg continue 28122a75d1c4Smrg fi 28132a75d1c4Smrg 28142a75d1c4Smrg case $arg in 28152a75d1c4Smrg -d) isdir=yes ;; 28162a75d1c4Smrg -f) 28172a75d1c4Smrg if $install_cp; then :; else 28182a75d1c4Smrg prev=$arg 28192a75d1c4Smrg fi 28202a75d1c4Smrg ;; 28212a75d1c4Smrg -g | -m | -o) 28222a75d1c4Smrg prev=$arg 28232a75d1c4Smrg ;; 28242a75d1c4Smrg -s) 28252a75d1c4Smrg stripme=" -s" 28262a75d1c4Smrg continue 28272a75d1c4Smrg ;; 28282a75d1c4Smrg -*) 28292a75d1c4Smrg ;; 28302a75d1c4Smrg *) 28312a75d1c4Smrg # If the previous option needed an argument, then skip it. 28322a75d1c4Smrg if test -n "$prev"; then 28332a75d1c4Smrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 28342a75d1c4Smrg arg2=$install_override_mode 28352a75d1c4Smrg no_mode=false 2836f7ec340bSmacallan fi 28372a75d1c4Smrg prev= 28382a75d1c4Smrg else 28392a75d1c4Smrg dest=$arg 2840f7ec340bSmacallan continue 2841f7ec340bSmacallan fi 28422a75d1c4Smrg ;; 28432a75d1c4Smrg esac 2844f7ec340bSmacallan 28452a75d1c4Smrg # Aesthetically quote the argument. 28462a75d1c4Smrg func_quote_for_eval "$arg" 28472a75d1c4Smrg func_append install_prog " $func_quote_for_eval_result" 28482a75d1c4Smrg if test -n "$arg2"; then 28492a75d1c4Smrg func_quote_for_eval "$arg2" 28502a75d1c4Smrg fi 28512a75d1c4Smrg func_append install_shared_prog " $func_quote_for_eval_result" 28522a75d1c4Smrg done 2853f7ec340bSmacallan 28542a75d1c4Smrg test -z "$install_prog" && \ 28552a75d1c4Smrg func_fatal_help "you must specify an install program" 2856f7ec340bSmacallan 28572a75d1c4Smrg test -n "$prev" && \ 28582a75d1c4Smrg func_fatal_help "the \`$prev' option requires an argument" 2859f7ec340bSmacallan 28602a75d1c4Smrg if test -n "$install_override_mode" && $no_mode; then 28612a75d1c4Smrg if $install_cp; then :; else 28622a75d1c4Smrg func_quote_for_eval "$install_override_mode" 28632a75d1c4Smrg func_append install_shared_prog " -m $func_quote_for_eval_result" 28642a75d1c4Smrg fi 28652a75d1c4Smrg fi 2866f7ec340bSmacallan 28672a75d1c4Smrg if test -z "$files"; then 28682a75d1c4Smrg if test -z "$dest"; then 28692a75d1c4Smrg func_fatal_help "no file or destination specified" 28702a75d1c4Smrg else 28712a75d1c4Smrg func_fatal_help "you must specify a destination" 28722a75d1c4Smrg fi 28732a75d1c4Smrg fi 2874f7ec340bSmacallan 28752a75d1c4Smrg # Strip any trailing slash from the destination. 28762a75d1c4Smrg func_stripname '' '/' "$dest" 28772a75d1c4Smrg dest=$func_stripname_result 2878f7ec340bSmacallan 28792a75d1c4Smrg # Check to see that the destination is a directory. 28802a75d1c4Smrg test -d "$dest" && isdir=yes 28812a75d1c4Smrg if test "$isdir" = yes; then 28822a75d1c4Smrg destdir="$dest" 28832a75d1c4Smrg destname= 28842a75d1c4Smrg else 28852a75d1c4Smrg func_dirname_and_basename "$dest" "" "." 28862a75d1c4Smrg destdir="$func_dirname_result" 28872a75d1c4Smrg destname="$func_basename_result" 2888f7ec340bSmacallan 28892a75d1c4Smrg # Not a directory, so check to see that there is only one file specified. 28902a75d1c4Smrg set dummy $files; shift 28912a75d1c4Smrg test "$#" -gt 1 && \ 28922a75d1c4Smrg func_fatal_help "\`$dest' is not a directory" 28932a75d1c4Smrg fi 28942a75d1c4Smrg case $destdir in 28952a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 28962a75d1c4Smrg *) 28972a75d1c4Smrg for file in $files; do 28982a75d1c4Smrg case $file in 28992a75d1c4Smrg *.lo) ;; 29002a75d1c4Smrg *) 29012a75d1c4Smrg func_fatal_help "\`$destdir' must be an absolute directory name" 29022a75d1c4Smrg ;; 29032a75d1c4Smrg esac 29042a75d1c4Smrg done 29052a75d1c4Smrg ;; 29062a75d1c4Smrg esac 2907f7ec340bSmacallan 29082a75d1c4Smrg # This variable tells wrapper scripts just to set variables rather 29092a75d1c4Smrg # than running their programs. 29102a75d1c4Smrg libtool_install_magic="$magic" 2911f7ec340bSmacallan 29122a75d1c4Smrg staticlibs= 29132a75d1c4Smrg future_libdirs= 29142a75d1c4Smrg current_libdirs= 29152a75d1c4Smrg for file in $files; do 2916f7ec340bSmacallan 29172a75d1c4Smrg # Do each installation. 29182a75d1c4Smrg case $file in 29192a75d1c4Smrg *.$libext) 29202a75d1c4Smrg # Do the static libraries later. 29212a75d1c4Smrg func_append staticlibs " $file" 29222a75d1c4Smrg ;; 2923f7ec340bSmacallan 29242a75d1c4Smrg *.la) 29252a75d1c4Smrg func_resolve_sysroot "$file" 29262a75d1c4Smrg file=$func_resolve_sysroot_result 2927f7ec340bSmacallan 29282a75d1c4Smrg # Check to see that this really is a libtool archive. 29292a75d1c4Smrg func_lalib_unsafe_p "$file" \ 29302a75d1c4Smrg || func_fatal_help "\`$file' is not a valid libtool archive" 2931f7ec340bSmacallan 29322a75d1c4Smrg library_names= 29332a75d1c4Smrg old_library= 29342a75d1c4Smrg relink_command= 29352a75d1c4Smrg func_source "$file" 2936f7ec340bSmacallan 29372a75d1c4Smrg # Add the libdir to current_libdirs if it is the destination. 29382a75d1c4Smrg if test "X$destdir" = "X$libdir"; then 29392a75d1c4Smrg case "$current_libdirs " in 29402a75d1c4Smrg *" $libdir "*) ;; 29412a75d1c4Smrg *) func_append current_libdirs " $libdir" ;; 29422a75d1c4Smrg esac 29432a75d1c4Smrg else 29442a75d1c4Smrg # Note the libdir as a future libdir. 29452a75d1c4Smrg case "$future_libdirs " in 29462a75d1c4Smrg *" $libdir "*) ;; 29472a75d1c4Smrg *) func_append future_libdirs " $libdir" ;; 29482a75d1c4Smrg esac 29492a75d1c4Smrg fi 2950f7ec340bSmacallan 29512a75d1c4Smrg func_dirname "$file" "/" "" 29522a75d1c4Smrg dir="$func_dirname_result" 29532a75d1c4Smrg func_append dir "$objdir" 2954f7ec340bSmacallan 29552a75d1c4Smrg if test -n "$relink_command"; then 29562a75d1c4Smrg # Determine the prefix the user has applied to our future dir. 29572a75d1c4Smrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2958f7ec340bSmacallan 29592a75d1c4Smrg # Don't allow the user to place us outside of our expected 29602a75d1c4Smrg # location b/c this prevents finding dependent libraries that 29612a75d1c4Smrg # are installed to the same prefix. 29622a75d1c4Smrg # At present, this check doesn't affect windows .dll's that 29632a75d1c4Smrg # are installed into $libdir/../bin (currently, that works fine) 29642a75d1c4Smrg # but it's something to keep an eye on. 29652a75d1c4Smrg test "$inst_prefix_dir" = "$destdir" && \ 29662a75d1c4Smrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 29672a75d1c4Smrg 29682a75d1c4Smrg if test -n "$inst_prefix_dir"; then 29692a75d1c4Smrg # Stick the inst_prefix_dir data into the link command. 29702a75d1c4Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2971f7ec340bSmacallan else 29722a75d1c4Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2973f7ec340bSmacallan fi 2974f7ec340bSmacallan 29752a75d1c4Smrg func_warning "relinking \`$file'" 29762a75d1c4Smrg func_show_eval "$relink_command" \ 29772a75d1c4Smrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 29782a75d1c4Smrg fi 29792a75d1c4Smrg 29802a75d1c4Smrg # See the names of the shared library. 29812a75d1c4Smrg set dummy $library_names; shift 29822a75d1c4Smrg if test -n "$1"; then 29832a75d1c4Smrg realname="$1" 29842a75d1c4Smrg shift 29852a75d1c4Smrg 29862a75d1c4Smrg srcname="$realname" 29872a75d1c4Smrg test -n "$relink_command" && srcname="$realname"T 29882a75d1c4Smrg 29892a75d1c4Smrg # Install the shared library and build the symlinks. 29902a75d1c4Smrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 29912a75d1c4Smrg 'exit $?' 29922a75d1c4Smrg tstripme="$stripme" 29932a75d1c4Smrg case $host_os in 29942a75d1c4Smrg cygwin* | mingw* | pw32* | cegcc*) 29952a75d1c4Smrg case $realname in 29962a75d1c4Smrg *.dll.a) 29972a75d1c4Smrg tstripme="" 29982a75d1c4Smrg ;; 29992a75d1c4Smrg esac 30002a75d1c4Smrg ;; 30012a75d1c4Smrg esac 30022a75d1c4Smrg if test -n "$tstripme" && test -n "$striplib"; then 30032a75d1c4Smrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 3004f7ec340bSmacallan fi 3005f7ec340bSmacallan 30062a75d1c4Smrg if test "$#" -gt 0; then 30072a75d1c4Smrg # Delete the old symlinks, and create new ones. 30082a75d1c4Smrg # Try `ln -sf' first, because the `ln' binary might depend on 30092a75d1c4Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 30102a75d1c4Smrg # so we also need to try rm && ln -s. 30112a75d1c4Smrg for linkname 30122a75d1c4Smrg do 30132a75d1c4Smrg test "$linkname" != "$realname" \ 30142a75d1c4Smrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3015f7ec340bSmacallan done 3016f7ec340bSmacallan fi 3017f7ec340bSmacallan 30182a75d1c4Smrg # Do each command in the postinstall commands. 30192a75d1c4Smrg lib="$destdir/$realname" 30202a75d1c4Smrg func_execute_cmds "$postinstall_cmds" 'exit $?' 30212a75d1c4Smrg fi 3022f7ec340bSmacallan 30232a75d1c4Smrg # Install the pseudo-library for information purposes. 30242a75d1c4Smrg func_basename "$file" 30252a75d1c4Smrg name="$func_basename_result" 30262a75d1c4Smrg instname="$dir/$name"i 30272a75d1c4Smrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3028f7ec340bSmacallan 30292a75d1c4Smrg # Maybe install the static library, too. 30302a75d1c4Smrg test -n "$old_library" && func_append staticlibs " $dir/$old_library" 30312a75d1c4Smrg ;; 30322a75d1c4Smrg 30332a75d1c4Smrg *.lo) 30342a75d1c4Smrg # Install (i.e. copy) a libtool object. 30352a75d1c4Smrg 30362a75d1c4Smrg # Figure out destination file name, if it wasn't already specified. 30372a75d1c4Smrg if test -n "$destname"; then 30382a75d1c4Smrg destfile="$destdir/$destname" 3039f7ec340bSmacallan else 30402a75d1c4Smrg func_basename "$file" 30412a75d1c4Smrg destfile="$func_basename_result" 30422a75d1c4Smrg destfile="$destdir/$destfile" 3043f7ec340bSmacallan fi 30442a75d1c4Smrg 30452a75d1c4Smrg # Deduce the name of the destination old-style object file. 30462a75d1c4Smrg case $destfile in 30472a75d1c4Smrg *.lo) 30482a75d1c4Smrg func_lo2o "$destfile" 30492a75d1c4Smrg staticdest=$func_lo2o_result 30502a75d1c4Smrg ;; 30512a75d1c4Smrg *.$objext) 30522a75d1c4Smrg staticdest="$destfile" 30532a75d1c4Smrg destfile= 30542a75d1c4Smrg ;; 30552a75d1c4Smrg *) 30562a75d1c4Smrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 3057f7ec340bSmacallan ;; 3058f7ec340bSmacallan esac 3059f7ec340bSmacallan 30602a75d1c4Smrg # Install the libtool object if requested. 30612a75d1c4Smrg test -n "$destfile" && \ 30622a75d1c4Smrg func_show_eval "$install_prog $file $destfile" 'exit $?' 3063f7ec340bSmacallan 30642a75d1c4Smrg # Install the old object if enabled. 30652a75d1c4Smrg if test "$build_old_libs" = yes; then 30662a75d1c4Smrg # Deduce the name of the old-style object file. 30672a75d1c4Smrg func_lo2o "$file" 30682a75d1c4Smrg staticobj=$func_lo2o_result 30692a75d1c4Smrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 30702a75d1c4Smrg fi 30712a75d1c4Smrg exit $EXIT_SUCCESS 30722a75d1c4Smrg ;; 3073f7ec340bSmacallan 30742a75d1c4Smrg *) 30752a75d1c4Smrg # Figure out destination file name, if it wasn't already specified. 30762a75d1c4Smrg if test -n "$destname"; then 30772a75d1c4Smrg destfile="$destdir/$destname" 30782a75d1c4Smrg else 30792a75d1c4Smrg func_basename "$file" 30802a75d1c4Smrg destfile="$func_basename_result" 30812a75d1c4Smrg destfile="$destdir/$destfile" 30822a75d1c4Smrg fi 3083f7ec340bSmacallan 30842a75d1c4Smrg # If the file is missing, and there is a .exe on the end, strip it 30852a75d1c4Smrg # because it is most likely a libtool script we actually want to 30862a75d1c4Smrg # install 30872a75d1c4Smrg stripped_ext="" 30882a75d1c4Smrg case $file in 30892a75d1c4Smrg *.exe) 30902a75d1c4Smrg if test ! -f "$file"; then 30912a75d1c4Smrg func_stripname '' '.exe' "$file" 30922a75d1c4Smrg file=$func_stripname_result 30932a75d1c4Smrg stripped_ext=".exe" 30942a75d1c4Smrg fi 30952a75d1c4Smrg ;; 30962a75d1c4Smrg esac 3097f7ec340bSmacallan 30982a75d1c4Smrg # Do a test to see if this is really a libtool program. 30992a75d1c4Smrg case $host in 31002a75d1c4Smrg *cygwin* | *mingw*) 31012a75d1c4Smrg if func_ltwrapper_executable_p "$file"; then 31022a75d1c4Smrg func_ltwrapper_scriptname "$file" 31032a75d1c4Smrg wrapper=$func_ltwrapper_scriptname_result 31042a75d1c4Smrg else 31052a75d1c4Smrg func_stripname '' '.exe' "$file" 31062a75d1c4Smrg wrapper=$func_stripname_result 31072a75d1c4Smrg fi 31082a75d1c4Smrg ;; 31092a75d1c4Smrg *) 31102a75d1c4Smrg wrapper=$file 31112a75d1c4Smrg ;; 31122a75d1c4Smrg esac 31132a75d1c4Smrg if func_ltwrapper_script_p "$wrapper"; then 31142a75d1c4Smrg notinst_deplibs= 31152a75d1c4Smrg relink_command= 3116f7ec340bSmacallan 31172a75d1c4Smrg func_source "$wrapper" 3118f7ec340bSmacallan 31192a75d1c4Smrg # Check the variables that should have been set. 31202a75d1c4Smrg test -z "$generated_by_libtool_version" && \ 31212a75d1c4Smrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3122f7ec340bSmacallan 31232a75d1c4Smrg finalize=yes 31242a75d1c4Smrg for lib in $notinst_deplibs; do 31252a75d1c4Smrg # Check to see that each library is installed. 31262a75d1c4Smrg libdir= 31272a75d1c4Smrg if test -f "$lib"; then 31282a75d1c4Smrg func_source "$lib" 31292a75d1c4Smrg fi 31302a75d1c4Smrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 31312a75d1c4Smrg if test -n "$libdir" && test ! -f "$libfile"; then 31322a75d1c4Smrg func_warning "\`$lib' has not been installed in \`$libdir'" 31332a75d1c4Smrg finalize=no 31342a75d1c4Smrg fi 31352a75d1c4Smrg done 3136f7ec340bSmacallan 31372a75d1c4Smrg relink_command= 31382a75d1c4Smrg func_source "$wrapper" 31392a75d1c4Smrg 31402a75d1c4Smrg outputname= 31412a75d1c4Smrg if test "$fast_install" = no && test -n "$relink_command"; then 31422a75d1c4Smrg $opt_dry_run || { 31432a75d1c4Smrg if test "$finalize" = yes; then 31442a75d1c4Smrg tmpdir=`func_mktempdir` 31452a75d1c4Smrg func_basename "$file$stripped_ext" 31462a75d1c4Smrg file="$func_basename_result" 31472a75d1c4Smrg outputname="$tmpdir/$file" 31482a75d1c4Smrg # Replace the output file specification. 31492a75d1c4Smrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 31502a75d1c4Smrg 31512a75d1c4Smrg $opt_silent || { 31522a75d1c4Smrg func_quote_for_expand "$relink_command" 31532a75d1c4Smrg eval "func_echo $func_quote_for_expand_result" 31542a75d1c4Smrg } 31552a75d1c4Smrg if eval "$relink_command"; then : 31562a75d1c4Smrg else 31572a75d1c4Smrg func_error "error: relink \`$file' with the above command before installing it" 31582a75d1c4Smrg $opt_dry_run || ${RM}r "$tmpdir" 31592a75d1c4Smrg continue 31602a75d1c4Smrg fi 31612a75d1c4Smrg file="$outputname" 31622a75d1c4Smrg else 31632a75d1c4Smrg func_warning "cannot relink \`$file'" 31642a75d1c4Smrg fi 31652a75d1c4Smrg } 31662a75d1c4Smrg else 31672a75d1c4Smrg # Install the binary that we compiled earlier. 31682a75d1c4Smrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 31692a75d1c4Smrg fi 3170f7ec340bSmacallan fi 31712a75d1c4Smrg 31722a75d1c4Smrg # remove .exe since cygwin /usr/bin/install will append another 31732a75d1c4Smrg # one anyway 31742a75d1c4Smrg case $install_prog,$host in 31752a75d1c4Smrg */usr/bin/install*,*cygwin*) 31762a75d1c4Smrg case $file:$destfile in 31772a75d1c4Smrg *.exe:*.exe) 31782a75d1c4Smrg # this is ok 31792a75d1c4Smrg ;; 31802a75d1c4Smrg *.exe:*) 31812a75d1c4Smrg destfile=$destfile.exe 31822a75d1c4Smrg ;; 31832a75d1c4Smrg *:*.exe) 31842a75d1c4Smrg func_stripname '' '.exe' "$destfile" 31852a75d1c4Smrg destfile=$func_stripname_result 31862a75d1c4Smrg ;; 31872a75d1c4Smrg esac 31882a75d1c4Smrg ;; 31892a75d1c4Smrg esac 31902a75d1c4Smrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 31912a75d1c4Smrg $opt_dry_run || if test -n "$outputname"; then 31922a75d1c4Smrg ${RM}r "$tmpdir" 3193f7ec340bSmacallan fi 3194f7ec340bSmacallan ;; 3195f7ec340bSmacallan esac 31962a75d1c4Smrg done 3197f7ec340bSmacallan 31982a75d1c4Smrg for file in $staticlibs; do 31992a75d1c4Smrg func_basename "$file" 32002a75d1c4Smrg name="$func_basename_result" 3201f7ec340bSmacallan 32022a75d1c4Smrg # Set up the ranlib parameters. 32032a75d1c4Smrg oldlib="$destdir/$name" 3204f7ec340bSmacallan 32052a75d1c4Smrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 32062a75d1c4Smrg 32072a75d1c4Smrg if test -n "$stripme" && test -n "$old_striplib"; then 32082a75d1c4Smrg func_show_eval "$old_striplib $oldlib" 'exit $?' 3209f7ec340bSmacallan fi 3210f7ec340bSmacallan 32112a75d1c4Smrg # Do each command in the postinstall commands. 32122a75d1c4Smrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 32132a75d1c4Smrg done 3214f7ec340bSmacallan 32152a75d1c4Smrg test -n "$future_libdirs" && \ 32162a75d1c4Smrg func_warning "remember to run \`$progname --finish$future_libdirs'" 3217f7ec340bSmacallan 32182a75d1c4Smrg if test -n "$current_libdirs"; then 32192a75d1c4Smrg # Maybe just do a dry run. 32202a75d1c4Smrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 32212a75d1c4Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 32222a75d1c4Smrg else 32232a75d1c4Smrg exit $EXIT_SUCCESS 32242a75d1c4Smrg fi 32252a75d1c4Smrg} 3226f7ec340bSmacallan 32272a75d1c4Smrgtest "$opt_mode" = install && func_mode_install ${1+"$@"} 3228f7ec340bSmacallan 3229f7ec340bSmacallan 32302a75d1c4Smrg# func_generate_dlsyms outputname originator pic_p 32312a75d1c4Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with 32322a75d1c4Smrg# a dlpreopen symbol table. 32332a75d1c4Smrgfunc_generate_dlsyms () 32342a75d1c4Smrg{ 32352a75d1c4Smrg $opt_debug 32362a75d1c4Smrg my_outputname="$1" 32372a75d1c4Smrg my_originator="$2" 32382a75d1c4Smrg my_pic_p="${3-no}" 32392a75d1c4Smrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 32402a75d1c4Smrg my_dlsyms= 32412a75d1c4Smrg 32422a75d1c4Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 32432a75d1c4Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 32442a75d1c4Smrg my_dlsyms="${my_outputname}S.c" 32452a75d1c4Smrg else 32462a75d1c4Smrg func_error "not configured to extract global symbols from dlpreopened files" 32472a75d1c4Smrg fi 32482a75d1c4Smrg fi 3249f7ec340bSmacallan 32502a75d1c4Smrg if test -n "$my_dlsyms"; then 32512a75d1c4Smrg case $my_dlsyms in 32522a75d1c4Smrg "") ;; 32532a75d1c4Smrg *.c) 32542a75d1c4Smrg # Discover the nlist of each of the dlfiles. 32552a75d1c4Smrg nlist="$output_objdir/${my_outputname}.nm" 3256f7ec340bSmacallan 32572a75d1c4Smrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3258f7ec340bSmacallan 32592a75d1c4Smrg # Parse the name list into a source file. 32602a75d1c4Smrg func_verbose "creating $output_objdir/$my_dlsyms" 3261f7ec340bSmacallan 32622a75d1c4Smrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 32632a75d1c4Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 32642a75d1c4Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3265f7ec340bSmacallan 32662a75d1c4Smrg#ifdef __cplusplus 32672a75d1c4Smrgextern \"C\" { 32682a75d1c4Smrg#endif 3269f7ec340bSmacallan 32702a75d1c4Smrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 32712a75d1c4Smrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 32722a75d1c4Smrg#endif 3273f7ec340bSmacallan 32742a75d1c4Smrg/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 32752a75d1c4Smrg#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 32762a75d1c4Smrg/* DATA imports from DLLs on WIN32 con't be const, because runtime 32772a75d1c4Smrg relocations are performed -- see ld's documentation on pseudo-relocs. */ 32782a75d1c4Smrg# define LT_DLSYM_CONST 32792a75d1c4Smrg#elif defined(__osf__) 32802a75d1c4Smrg/* This system does not cope well with relocations in const data. */ 32812a75d1c4Smrg# define LT_DLSYM_CONST 32822a75d1c4Smrg#else 32832a75d1c4Smrg# define LT_DLSYM_CONST const 32842a75d1c4Smrg#endif 3285f7ec340bSmacallan 32862a75d1c4Smrg/* External symbol declarations for the compiler. */\ 32872a75d1c4Smrg" 3288f7ec340bSmacallan 32892a75d1c4Smrg if test "$dlself" = yes; then 32902a75d1c4Smrg func_verbose "generating symbol list for \`$output'" 3291f7ec340bSmacallan 32922a75d1c4Smrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3293f7ec340bSmacallan 32942a75d1c4Smrg # Add our own program objects to the symbol list. 32952a75d1c4Smrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 32962a75d1c4Smrg for progfile in $progfiles; do 32972a75d1c4Smrg func_to_tool_file "$progfile" func_convert_file_msys_to_w32 32982a75d1c4Smrg func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 32992a75d1c4Smrg $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3300f7ec340bSmacallan done 3301f7ec340bSmacallan 33022a75d1c4Smrg if test -n "$exclude_expsyms"; then 33032a75d1c4Smrg $opt_dry_run || { 33042a75d1c4Smrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 33052a75d1c4Smrg eval '$MV "$nlist"T "$nlist"' 33062a75d1c4Smrg } 33072a75d1c4Smrg fi 3308f7ec340bSmacallan 33092a75d1c4Smrg if test -n "$export_symbols_regex"; then 33102a75d1c4Smrg $opt_dry_run || { 33112a75d1c4Smrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 33122a75d1c4Smrg eval '$MV "$nlist"T "$nlist"' 33132a75d1c4Smrg } 33142a75d1c4Smrg fi 3315f7ec340bSmacallan 33162a75d1c4Smrg # Prepare the list of exported symbols 33172a75d1c4Smrg if test -z "$export_symbols"; then 33182a75d1c4Smrg export_symbols="$output_objdir/$outputname.exp" 33192a75d1c4Smrg $opt_dry_run || { 33202a75d1c4Smrg $RM $export_symbols 33212a75d1c4Smrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 33222a75d1c4Smrg case $host in 33232a75d1c4Smrg *cygwin* | *mingw* | *cegcc* ) 33242a75d1c4Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 33252a75d1c4Smrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 33262a75d1c4Smrg ;; 33272a75d1c4Smrg esac 33282a75d1c4Smrg } 33292a75d1c4Smrg else 33302a75d1c4Smrg $opt_dry_run || { 33312a75d1c4Smrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 33322a75d1c4Smrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 33332a75d1c4Smrg eval '$MV "$nlist"T "$nlist"' 33342a75d1c4Smrg case $host in 33352a75d1c4Smrg *cygwin* | *mingw* | *cegcc* ) 33362a75d1c4Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 33372a75d1c4Smrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 33382a75d1c4Smrg ;; 33392a75d1c4Smrg esac 33402a75d1c4Smrg } 33412a75d1c4Smrg fi 33422a75d1c4Smrg fi 3343f7ec340bSmacallan 33442a75d1c4Smrg for dlprefile in $dlprefiles; do 33452a75d1c4Smrg func_verbose "extracting global C symbols from \`$dlprefile'" 33462a75d1c4Smrg func_basename "$dlprefile" 33472a75d1c4Smrg name="$func_basename_result" 33482a75d1c4Smrg case $host in 33492a75d1c4Smrg *cygwin* | *mingw* | *cegcc* ) 33502a75d1c4Smrg # if an import library, we need to obtain dlname 33512a75d1c4Smrg if func_win32_import_lib_p "$dlprefile"; then 33522a75d1c4Smrg func_tr_sh "$dlprefile" 33532a75d1c4Smrg eval "curr_lafile=\$libfile_$func_tr_sh_result" 33542a75d1c4Smrg dlprefile_dlbasename="" 33552a75d1c4Smrg if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 33562a75d1c4Smrg # Use subshell, to avoid clobbering current variable values 33572a75d1c4Smrg dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 33582a75d1c4Smrg if test -n "$dlprefile_dlname" ; then 33592a75d1c4Smrg func_basename "$dlprefile_dlname" 33602a75d1c4Smrg dlprefile_dlbasename="$func_basename_result" 33612a75d1c4Smrg else 33622a75d1c4Smrg # no lafile. user explicitly requested -dlpreopen <import library>. 33632a75d1c4Smrg $sharedlib_from_linklib_cmd "$dlprefile" 33642a75d1c4Smrg dlprefile_dlbasename=$sharedlib_from_linklib_result 33652a75d1c4Smrg fi 33662a75d1c4Smrg fi 33672a75d1c4Smrg $opt_dry_run || { 33682a75d1c4Smrg if test -n "$dlprefile_dlbasename" ; then 33692a75d1c4Smrg eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 33702a75d1c4Smrg else 33712a75d1c4Smrg func_warning "Could not compute DLL name from $name" 33722a75d1c4Smrg eval '$ECHO ": $name " >> "$nlist"' 33732a75d1c4Smrg fi 33742a75d1c4Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33752a75d1c4Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 33762a75d1c4Smrg $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 33772a75d1c4Smrg } 33782a75d1c4Smrg else # not an import lib 33792a75d1c4Smrg $opt_dry_run || { 33802a75d1c4Smrg eval '$ECHO ": $name " >> "$nlist"' 33812a75d1c4Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33822a75d1c4Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33832a75d1c4Smrg } 33842a75d1c4Smrg fi 33852a75d1c4Smrg ;; 33862a75d1c4Smrg *) 33872a75d1c4Smrg $opt_dry_run || { 33882a75d1c4Smrg eval '$ECHO ": $name " >> "$nlist"' 33892a75d1c4Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33902a75d1c4Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33912a75d1c4Smrg } 33922a75d1c4Smrg ;; 33932a75d1c4Smrg esac 33942a75d1c4Smrg done 3395f7ec340bSmacallan 33962a75d1c4Smrg $opt_dry_run || { 33972a75d1c4Smrg # Make sure we have at least an empty file. 33982a75d1c4Smrg test -f "$nlist" || : > "$nlist" 3399f7ec340bSmacallan 34002a75d1c4Smrg if test -n "$exclude_expsyms"; then 34012a75d1c4Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 34022a75d1c4Smrg $MV "$nlist"T "$nlist" 34032a75d1c4Smrg fi 3404f7ec340bSmacallan 34052a75d1c4Smrg # Try sorting and uniquifying the output. 34062a75d1c4Smrg if $GREP -v "^: " < "$nlist" | 34072a75d1c4Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 34082a75d1c4Smrg sort -k 3 34092a75d1c4Smrg else 34102a75d1c4Smrg sort +2 34112a75d1c4Smrg fi | 34122a75d1c4Smrg uniq > "$nlist"S; then 34132a75d1c4Smrg : 34142a75d1c4Smrg else 34152a75d1c4Smrg $GREP -v "^: " < "$nlist" > "$nlist"S 34162a75d1c4Smrg fi 3417f7ec340bSmacallan 34182a75d1c4Smrg if test -f "$nlist"S; then 34192a75d1c4Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 34202a75d1c4Smrg else 34212a75d1c4Smrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 34222a75d1c4Smrg fi 3423f7ec340bSmacallan 34242a75d1c4Smrg echo >> "$output_objdir/$my_dlsyms" "\ 34252a75d1c4Smrg 34262a75d1c4Smrg/* The mapping between symbol names and symbols. */ 34272a75d1c4Smrgtypedef struct { 34282a75d1c4Smrg const char *name; 34292a75d1c4Smrg void *address; 34302a75d1c4Smrg} lt_dlsymlist; 34312a75d1c4Smrgextern LT_DLSYM_CONST lt_dlsymlist 34322a75d1c4Smrglt_${my_prefix}_LTX_preloaded_symbols[]; 34332a75d1c4SmrgLT_DLSYM_CONST lt_dlsymlist 34342a75d1c4Smrglt_${my_prefix}_LTX_preloaded_symbols[] = 34352a75d1c4Smrg{\ 34362a75d1c4Smrg { \"$my_originator\", (void *) 0 }," 34372a75d1c4Smrg 34382a75d1c4Smrg case $need_lib_prefix in 34392a75d1c4Smrg no) 34402a75d1c4Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3441f7ec340bSmacallan ;; 3442f7ec340bSmacallan *) 34432a75d1c4Smrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444f7ec340bSmacallan ;; 3445f7ec340bSmacallan esac 34462a75d1c4Smrg echo >> "$output_objdir/$my_dlsyms" "\ 34472a75d1c4Smrg {0, (void *) 0} 34482a75d1c4Smrg}; 3449f7ec340bSmacallan 34502a75d1c4Smrg/* This works around a problem in FreeBSD linker */ 34512a75d1c4Smrg#ifdef FREEBSD_WORKAROUND 34522a75d1c4Smrgstatic const void *lt_preloaded_setup() { 34532a75d1c4Smrg return lt_${my_prefix}_LTX_preloaded_symbols; 34542a75d1c4Smrg} 34552a75d1c4Smrg#endif 3456f7ec340bSmacallan 34572a75d1c4Smrg#ifdef __cplusplus 34582a75d1c4Smrg} 34592a75d1c4Smrg#endif\ 34602a75d1c4Smrg" 34612a75d1c4Smrg } # !$opt_dry_run 3462f7ec340bSmacallan 34632a75d1c4Smrg pic_flag_for_symtable= 34642a75d1c4Smrg case "$compile_command " in 34652a75d1c4Smrg *" -static "*) ;; 34662a75d1c4Smrg *) 34672a75d1c4Smrg case $host in 34682a75d1c4Smrg # compiling the symbol table file with pic_flag works around 34692a75d1c4Smrg # a FreeBSD bug that causes programs to crash when -lm is 34702a75d1c4Smrg # linked before any other PIC object. But we must not use 34712a75d1c4Smrg # pic_flag when linking with -static. The problem exists in 34722a75d1c4Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 34732a75d1c4Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 34742a75d1c4Smrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 34752a75d1c4Smrg *-*-hpux*) 34762a75d1c4Smrg pic_flag_for_symtable=" $pic_flag" ;; 34772a75d1c4Smrg *) 34782a75d1c4Smrg if test "X$my_pic_p" != Xno; then 34792a75d1c4Smrg pic_flag_for_symtable=" $pic_flag" 34802a75d1c4Smrg fi 34812a75d1c4Smrg ;; 34822a75d1c4Smrg esac 34832a75d1c4Smrg ;; 34842a75d1c4Smrg esac 34852a75d1c4Smrg symtab_cflags= 34862a75d1c4Smrg for arg in $LTCFLAGS; do 34872a75d1c4Smrg case $arg in 34882a75d1c4Smrg -pie | -fpie | -fPIE) ;; 34892a75d1c4Smrg *) func_append symtab_cflags " $arg" ;; 3490f7ec340bSmacallan esac 3491f7ec340bSmacallan done 3492f7ec340bSmacallan 34932a75d1c4Smrg # Now compile the dynamic symbol file. 34942a75d1c4Smrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3495f7ec340bSmacallan 34962a75d1c4Smrg # Clean up the generated files. 34972a75d1c4Smrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3498f7ec340bSmacallan 34992a75d1c4Smrg # Transform the symbol file into the correct name. 35002a75d1c4Smrg symfileobj="$output_objdir/${my_outputname}S.$objext" 35012a75d1c4Smrg case $host in 35022a75d1c4Smrg *cygwin* | *mingw* | *cegcc* ) 35032a75d1c4Smrg if test -f "$output_objdir/$my_outputname.def"; then 35042a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 35052a75d1c4Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 35062a75d1c4Smrg else 35072a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35082a75d1c4Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35092a75d1c4Smrg fi 35102a75d1c4Smrg ;; 35112a75d1c4Smrg *) 35122a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35132a75d1c4Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35142a75d1c4Smrg ;; 35152a75d1c4Smrg esac 35162a75d1c4Smrg ;; 35172a75d1c4Smrg *) 35182a75d1c4Smrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 35192a75d1c4Smrg ;; 35202a75d1c4Smrg esac 35212a75d1c4Smrg else 35222a75d1c4Smrg # We keep going just in case the user didn't refer to 35232a75d1c4Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 35242a75d1c4Smrg # really was required. 3525f7ec340bSmacallan 35262a75d1c4Smrg # Nullify the symbol file. 35272a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 35282a75d1c4Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 35292a75d1c4Smrg fi 35302a75d1c4Smrg} 3531f7ec340bSmacallan 35322a75d1c4Smrg# func_win32_libid arg 35332a75d1c4Smrg# return the library type of file 'arg' 35342a75d1c4Smrg# 35352a75d1c4Smrg# Need a lot of goo to handle *both* DLLs and import libs 35362a75d1c4Smrg# Has to be a shell function in order to 'eat' the argument 35372a75d1c4Smrg# that is supplied when $file_magic_command is called. 35382a75d1c4Smrg# Despite the name, also deal with 64 bit binaries. 35392a75d1c4Smrgfunc_win32_libid () 35402a75d1c4Smrg{ 35412a75d1c4Smrg $opt_debug 35422a75d1c4Smrg win32_libid_type="unknown" 35432a75d1c4Smrg win32_fileres=`file -L $1 2>/dev/null` 35442a75d1c4Smrg case $win32_fileres in 35452a75d1c4Smrg *ar\ archive\ import\ library*) # definitely import 35462a75d1c4Smrg win32_libid_type="x86 archive import" 35472a75d1c4Smrg ;; 35482a75d1c4Smrg *ar\ archive*) # could be an import, or static 35492a75d1c4Smrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 35502a75d1c4Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 35512a75d1c4Smrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 35522a75d1c4Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 35532a75d1c4Smrg win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 35542a75d1c4Smrg $SED -n -e ' 35552a75d1c4Smrg 1,100{ 35562a75d1c4Smrg / I /{ 35572a75d1c4Smrg s,.*,import, 35582a75d1c4Smrg p 35592a75d1c4Smrg q 35602a75d1c4Smrg } 35612a75d1c4Smrg }'` 35622a75d1c4Smrg case $win32_nmres in 35632a75d1c4Smrg import*) win32_libid_type="x86 archive import";; 35642a75d1c4Smrg *) win32_libid_type="x86 archive static";; 35652a75d1c4Smrg esac 35662a75d1c4Smrg fi 35672a75d1c4Smrg ;; 35682a75d1c4Smrg *DLL*) 35692a75d1c4Smrg win32_libid_type="x86 DLL" 35702a75d1c4Smrg ;; 35712a75d1c4Smrg *executable*) # but shell scripts are "executable" too... 35722a75d1c4Smrg case $win32_fileres in 35732a75d1c4Smrg *MS\ Windows\ PE\ Intel*) 35742a75d1c4Smrg win32_libid_type="x86 DLL" 35752a75d1c4Smrg ;; 35762a75d1c4Smrg esac 35772a75d1c4Smrg ;; 35782a75d1c4Smrg esac 35792a75d1c4Smrg $ECHO "$win32_libid_type" 35802a75d1c4Smrg} 35812a75d1c4Smrg 35822a75d1c4Smrg# func_cygming_dll_for_implib ARG 35832a75d1c4Smrg# 35842a75d1c4Smrg# Platform-specific function to extract the 35852a75d1c4Smrg# name of the DLL associated with the specified 35862a75d1c4Smrg# import library ARG. 35872a75d1c4Smrg# Invoked by eval'ing the libtool variable 35882a75d1c4Smrg# $sharedlib_from_linklib_cmd 35892a75d1c4Smrg# Result is available in the variable 35902a75d1c4Smrg# $sharedlib_from_linklib_result 35912a75d1c4Smrgfunc_cygming_dll_for_implib () 35922a75d1c4Smrg{ 35932a75d1c4Smrg $opt_debug 35942a75d1c4Smrg sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 35952a75d1c4Smrg} 35962a75d1c4Smrg 35972a75d1c4Smrg# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 35982a75d1c4Smrg# 35992a75d1c4Smrg# The is the core of a fallback implementation of a 36002a75d1c4Smrg# platform-specific function to extract the name of the 36012a75d1c4Smrg# DLL associated with the specified import library LIBNAME. 36022a75d1c4Smrg# 36032a75d1c4Smrg# SECTION_NAME is either .idata$6 or .idata$7, depending 36042a75d1c4Smrg# on the platform and compiler that created the implib. 36052a75d1c4Smrg# 36062a75d1c4Smrg# Echos the name of the DLL associated with the 36072a75d1c4Smrg# specified import library. 36082a75d1c4Smrgfunc_cygming_dll_for_implib_fallback_core () 36092a75d1c4Smrg{ 36102a75d1c4Smrg $opt_debug 36112a75d1c4Smrg match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 36122a75d1c4Smrg $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 36132a75d1c4Smrg $SED '/^Contents of section '"$match_literal"':/{ 36142a75d1c4Smrg # Place marker at beginning of archive member dllname section 36152a75d1c4Smrg s/.*/====MARK====/ 36162a75d1c4Smrg p 36172a75d1c4Smrg d 36182a75d1c4Smrg } 36192a75d1c4Smrg # These lines can sometimes be longer than 43 characters, but 36202a75d1c4Smrg # are always uninteresting 36212a75d1c4Smrg /:[ ]*file format pe[i]\{,1\}-/d 36222a75d1c4Smrg /^In archive [^:]*:/d 36232a75d1c4Smrg # Ensure marker is printed 36242a75d1c4Smrg /^====MARK====/p 36252a75d1c4Smrg # Remove all lines with less than 43 characters 36262a75d1c4Smrg /^.\{43\}/!d 36272a75d1c4Smrg # From remaining lines, remove first 43 characters 36282a75d1c4Smrg s/^.\{43\}//' | 36292a75d1c4Smrg $SED -n ' 36302a75d1c4Smrg # Join marker and all lines until next marker into a single line 36312a75d1c4Smrg /^====MARK====/ b para 36322a75d1c4Smrg H 36332a75d1c4Smrg $ b para 36342a75d1c4Smrg b 36352a75d1c4Smrg :para 36362a75d1c4Smrg x 36372a75d1c4Smrg s/\n//g 36382a75d1c4Smrg # Remove the marker 36392a75d1c4Smrg s/^====MARK====// 36402a75d1c4Smrg # Remove trailing dots and whitespace 36412a75d1c4Smrg s/[\. \t]*$// 36422a75d1c4Smrg # Print 36432a75d1c4Smrg /./p' | 36442a75d1c4Smrg # we now have a list, one entry per line, of the stringified 36452a75d1c4Smrg # contents of the appropriate section of all members of the 36462a75d1c4Smrg # archive which possess that section. Heuristic: eliminate 36472a75d1c4Smrg # all those which have a first or second character that is 36482a75d1c4Smrg # a '.' (that is, objdump's representation of an unprintable 36492a75d1c4Smrg # character.) This should work for all archives with less than 36502a75d1c4Smrg # 0x302f exports -- but will fail for DLLs whose name actually 36512a75d1c4Smrg # begins with a literal '.' or a single character followed by 36522a75d1c4Smrg # a '.'. 36532a75d1c4Smrg # 36542a75d1c4Smrg # Of those that remain, print the first one. 36552a75d1c4Smrg $SED -e '/^\./d;/^.\./d;q' 36562a75d1c4Smrg} 36572a75d1c4Smrg 36582a75d1c4Smrg# func_cygming_gnu_implib_p ARG 36592a75d1c4Smrg# This predicate returns with zero status (TRUE) if 36602a75d1c4Smrg# ARG is a GNU/binutils-style import library. Returns 36612a75d1c4Smrg# with nonzero status (FALSE) otherwise. 36622a75d1c4Smrgfunc_cygming_gnu_implib_p () 36632a75d1c4Smrg{ 36642a75d1c4Smrg $opt_debug 36652a75d1c4Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 36662a75d1c4Smrg func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` 36672a75d1c4Smrg test -n "$func_cygming_gnu_implib_tmp" 36682a75d1c4Smrg} 36692a75d1c4Smrg 36702a75d1c4Smrg# func_cygming_ms_implib_p ARG 36712a75d1c4Smrg# This predicate returns with zero status (TRUE) if 36722a75d1c4Smrg# ARG is an MS-style import library. Returns 36732a75d1c4Smrg# with nonzero status (FALSE) otherwise. 36742a75d1c4Smrgfunc_cygming_ms_implib_p () 36752a75d1c4Smrg{ 36762a75d1c4Smrg $opt_debug 36772a75d1c4Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 36782a75d1c4Smrg func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 36792a75d1c4Smrg test -n "$func_cygming_ms_implib_tmp" 36802a75d1c4Smrg} 36812a75d1c4Smrg 36822a75d1c4Smrg# func_cygming_dll_for_implib_fallback ARG 36832a75d1c4Smrg# Platform-specific function to extract the 36842a75d1c4Smrg# name of the DLL associated with the specified 36852a75d1c4Smrg# import library ARG. 36862a75d1c4Smrg# 36872a75d1c4Smrg# This fallback implementation is for use when $DLLTOOL 36882a75d1c4Smrg# does not support the --identify-strict option. 36892a75d1c4Smrg# Invoked by eval'ing the libtool variable 36902a75d1c4Smrg# $sharedlib_from_linklib_cmd 36912a75d1c4Smrg# Result is available in the variable 36922a75d1c4Smrg# $sharedlib_from_linklib_result 36932a75d1c4Smrgfunc_cygming_dll_for_implib_fallback () 36942a75d1c4Smrg{ 36952a75d1c4Smrg $opt_debug 36962a75d1c4Smrg if func_cygming_gnu_implib_p "$1" ; then 36972a75d1c4Smrg # binutils import library 36982a75d1c4Smrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 36992a75d1c4Smrg elif func_cygming_ms_implib_p "$1" ; then 37002a75d1c4Smrg # ms-generated import library 37012a75d1c4Smrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 37022a75d1c4Smrg else 37032a75d1c4Smrg # unknown 37042a75d1c4Smrg sharedlib_from_linklib_result="" 37052a75d1c4Smrg fi 37062a75d1c4Smrg} 37072a75d1c4Smrg 37082a75d1c4Smrg 37092a75d1c4Smrg# func_extract_an_archive dir oldlib 37102a75d1c4Smrgfunc_extract_an_archive () 37112a75d1c4Smrg{ 37122a75d1c4Smrg $opt_debug 37132a75d1c4Smrg f_ex_an_ar_dir="$1"; shift 37142a75d1c4Smrg f_ex_an_ar_oldlib="$1" 37152a75d1c4Smrg if test "$lock_old_archive_extraction" = yes; then 37162a75d1c4Smrg lockfile=$f_ex_an_ar_oldlib.lock 37172a75d1c4Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 37182a75d1c4Smrg func_echo "Waiting for $lockfile to be removed" 37192a75d1c4Smrg sleep 2 3720f7ec340bSmacallan done 37212a75d1c4Smrg fi 37222a75d1c4Smrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 37232a75d1c4Smrg 'stat=$?; rm -f "$lockfile"; exit $stat' 37242a75d1c4Smrg if test "$lock_old_archive_extraction" = yes; then 37252a75d1c4Smrg $opt_dry_run || rm -f "$lockfile" 37262a75d1c4Smrg fi 37272a75d1c4Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 37282a75d1c4Smrg : 37292a75d1c4Smrg else 37302a75d1c4Smrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 37312a75d1c4Smrg fi 37322a75d1c4Smrg} 3733f7ec340bSmacallan 37342a75d1c4Smrg 37352a75d1c4Smrg# func_extract_archives gentop oldlib ... 37362a75d1c4Smrgfunc_extract_archives () 37372a75d1c4Smrg{ 37382a75d1c4Smrg $opt_debug 37392a75d1c4Smrg my_gentop="$1"; shift 37402a75d1c4Smrg my_oldlibs=${1+"$@"} 37412a75d1c4Smrg my_oldobjs="" 37422a75d1c4Smrg my_xlib="" 37432a75d1c4Smrg my_xabs="" 37442a75d1c4Smrg my_xdir="" 37452a75d1c4Smrg 37462a75d1c4Smrg for my_xlib in $my_oldlibs; do 37472a75d1c4Smrg # Extract the objects. 37482a75d1c4Smrg case $my_xlib in 37492a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 37502a75d1c4Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 37512a75d1c4Smrg esac 37522a75d1c4Smrg func_basename "$my_xlib" 37532a75d1c4Smrg my_xlib="$func_basename_result" 37542a75d1c4Smrg my_xlib_u=$my_xlib 37552a75d1c4Smrg while :; do 37562a75d1c4Smrg case " $extracted_archives " in 37572a75d1c4Smrg *" $my_xlib_u "*) 37582a75d1c4Smrg func_arith $extracted_serial + 1 37592a75d1c4Smrg extracted_serial=$func_arith_result 37602a75d1c4Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 37612a75d1c4Smrg *) break ;; 3762f7ec340bSmacallan esac 3763f7ec340bSmacallan done 37642a75d1c4Smrg extracted_archives="$extracted_archives $my_xlib_u" 37652a75d1c4Smrg my_xdir="$my_gentop/$my_xlib_u" 3766f7ec340bSmacallan 37672a75d1c4Smrg func_mkdir_p "$my_xdir" 3768f7ec340bSmacallan 37692a75d1c4Smrg case $host in 37702a75d1c4Smrg *-darwin*) 37712a75d1c4Smrg func_verbose "Extracting $my_xabs" 37722a75d1c4Smrg # Do not bother doing anything if just a dry run 37732a75d1c4Smrg $opt_dry_run || { 37742a75d1c4Smrg darwin_orig_dir=`pwd` 37752a75d1c4Smrg cd $my_xdir || exit $? 37762a75d1c4Smrg darwin_archive=$my_xabs 37772a75d1c4Smrg darwin_curdir=`pwd` 37782a75d1c4Smrg darwin_base_archive=`basename "$darwin_archive"` 37792a75d1c4Smrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 37802a75d1c4Smrg if test -n "$darwin_arches"; then 37812a75d1c4Smrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 37822a75d1c4Smrg darwin_arch= 37832a75d1c4Smrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 37842a75d1c4Smrg for darwin_arch in $darwin_arches ; do 37852a75d1c4Smrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 37862a75d1c4Smrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 37872a75d1c4Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 37882a75d1c4Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 37892a75d1c4Smrg cd "$darwin_curdir" 37902a75d1c4Smrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 37912a75d1c4Smrg done # $darwin_arches 37922a75d1c4Smrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 37932a75d1c4Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 37942a75d1c4Smrg darwin_file= 37952a75d1c4Smrg darwin_files= 37962a75d1c4Smrg for darwin_file in $darwin_filelist; do 37972a75d1c4Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 37982a75d1c4Smrg $LIPO -create -output "$darwin_file" $darwin_files 37992a75d1c4Smrg done # $darwin_filelist 38002a75d1c4Smrg $RM -rf unfat-$$ 38012a75d1c4Smrg cd "$darwin_orig_dir" 3802f7ec340bSmacallan else 38032a75d1c4Smrg cd $darwin_orig_dir 38042a75d1c4Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 38052a75d1c4Smrg fi # $darwin_arches 38062a75d1c4Smrg } # !$opt_dry_run 38072a75d1c4Smrg ;; 38082a75d1c4Smrg *) 38092a75d1c4Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 38102a75d1c4Smrg ;; 38112a75d1c4Smrg esac 38122a75d1c4Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 38132a75d1c4Smrg done 3814f7ec340bSmacallan 38152a75d1c4Smrg func_extract_archives_result="$my_oldobjs" 38162a75d1c4Smrg} 3817f7ec340bSmacallan 3818f7ec340bSmacallan 38192a75d1c4Smrg# func_emit_wrapper [arg=no] 38202a75d1c4Smrg# 38212a75d1c4Smrg# Emit a libtool wrapper script on stdout. 38222a75d1c4Smrg# Don't directly open a file because we may want to 38232a75d1c4Smrg# incorporate the script contents within a cygwin/mingw 38242a75d1c4Smrg# wrapper executable. Must ONLY be called from within 38252a75d1c4Smrg# func_mode_link because it depends on a number of variables 38262a75d1c4Smrg# set therein. 38272a75d1c4Smrg# 38282a75d1c4Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 38292a75d1c4Smrg# variable will take. If 'yes', then the emitted script 38302a75d1c4Smrg# will assume that the directory in which it is stored is 38312a75d1c4Smrg# the $objdir directory. This is a cygwin/mingw-specific 38322a75d1c4Smrg# behavior. 38332a75d1c4Smrgfunc_emit_wrapper () 38342a75d1c4Smrg{ 38352a75d1c4Smrg func_emit_wrapper_arg1=${1-no} 3836f7ec340bSmacallan 38372a75d1c4Smrg $ECHO "\ 38382a75d1c4Smrg#! $SHELL 3839f7ec340bSmacallan 38402a75d1c4Smrg# $output - temporary wrapper script for $objdir/$outputname 38412a75d1c4Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 38422a75d1c4Smrg# 38432a75d1c4Smrg# The $output program cannot be directly executed until all the libtool 38442a75d1c4Smrg# libraries that it depends on are installed. 38452a75d1c4Smrg# 38462a75d1c4Smrg# This wrapper script should never be moved out of the build directory. 38472a75d1c4Smrg# If it is, it will not operate correctly. 3848f7ec340bSmacallan 38492a75d1c4Smrg# Sed substitution that helps us do robust quoting. It backslashifies 38502a75d1c4Smrg# metacharacters that are still active within double-quoted strings. 38512a75d1c4Smrgsed_quote_subst='$sed_quote_subst' 3852f7ec340bSmacallan 38532a75d1c4Smrg# Be Bourne compatible 38542a75d1c4Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 38552a75d1c4Smrg emulate sh 38562a75d1c4Smrg NULLCMD=: 38572a75d1c4Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 38582a75d1c4Smrg # is contrary to our usage. Disable this feature. 38592a75d1c4Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 38602a75d1c4Smrg setopt NO_GLOB_SUBST 38612a75d1c4Smrgelse 38622a75d1c4Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 38632a75d1c4Smrgfi 38642a75d1c4SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 38652a75d1c4SmrgDUALCASE=1; export DUALCASE # for MKS sh 3866f7ec340bSmacallan 38672a75d1c4Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 38682a75d1c4Smrg# if CDPATH is set. 38692a75d1c4Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3870f7ec340bSmacallan 38712a75d1c4Smrgrelink_command=\"$relink_command\" 3872f7ec340bSmacallan 38732a75d1c4Smrg# This environment variable determines our operation mode. 38742a75d1c4Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 38752a75d1c4Smrg # install mode needs the following variables: 38762a75d1c4Smrg generated_by_libtool_version='$macro_version' 38772a75d1c4Smrg notinst_deplibs='$notinst_deplibs' 38782a75d1c4Smrgelse 38792a75d1c4Smrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 38802a75d1c4Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 38812a75d1c4Smrg file=\"\$0\"" 3882f7ec340bSmacallan 38832a75d1c4Smrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 38842a75d1c4Smrg $ECHO "\ 3885f7ec340bSmacallan 38862a75d1c4Smrg# A function that is used when there is no print builtin or printf. 38872a75d1c4Smrgfunc_fallback_echo () 38882a75d1c4Smrg{ 38892a75d1c4Smrg eval 'cat <<_LTECHO_EOF 38902a75d1c4Smrg\$1 38912a75d1c4Smrg_LTECHO_EOF' 38922a75d1c4Smrg} 38932a75d1c4Smrg ECHO=\"$qECHO\" 38942a75d1c4Smrg fi 3895f7ec340bSmacallan 38962a75d1c4Smrg# Very basic option parsing. These options are (a) specific to 38972a75d1c4Smrg# the libtool wrapper, (b) are identical between the wrapper 38982a75d1c4Smrg# /script/ and the wrapper /executable/ which is used only on 38992a75d1c4Smrg# windows platforms, and (c) all begin with the string "--lt-" 39002a75d1c4Smrg# (application programs are unlikely to have options which match 39012a75d1c4Smrg# this pattern). 39022a75d1c4Smrg# 39032a75d1c4Smrg# There are only two supported options: --lt-debug and 39042a75d1c4Smrg# --lt-dump-script. There is, deliberately, no --lt-help. 39052a75d1c4Smrg# 39062a75d1c4Smrg# The first argument to this parsing function should be the 39072a75d1c4Smrg# script's $0 value, followed by "$@". 39082a75d1c4Smrglt_option_debug= 39092a75d1c4Smrgfunc_parse_lt_options () 39102a75d1c4Smrg{ 39112a75d1c4Smrg lt_script_arg0=\$0 39122a75d1c4Smrg shift 39132a75d1c4Smrg for lt_opt 39142a75d1c4Smrg do 39152a75d1c4Smrg case \"\$lt_opt\" in 39162a75d1c4Smrg --lt-debug) lt_option_debug=1 ;; 39172a75d1c4Smrg --lt-dump-script) 39182a75d1c4Smrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 39192a75d1c4Smrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 39202a75d1c4Smrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 39212a75d1c4Smrg cat \"\$lt_dump_D/\$lt_dump_F\" 39222a75d1c4Smrg exit 0 39232a75d1c4Smrg ;; 39242a75d1c4Smrg --lt-*) 39252a75d1c4Smrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 39262a75d1c4Smrg exit 1 39272a75d1c4Smrg ;; 39282a75d1c4Smrg esac 39292a75d1c4Smrg done 3930f7ec340bSmacallan 39312a75d1c4Smrg # Print the debug banner immediately: 39322a75d1c4Smrg if test -n \"\$lt_option_debug\"; then 39332a75d1c4Smrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 39342a75d1c4Smrg fi 39352a75d1c4Smrg} 3936f7ec340bSmacallan 39372a75d1c4Smrg# Used when --lt-debug. Prints its arguments to stdout 39382a75d1c4Smrg# (redirection is the responsibility of the caller) 39392a75d1c4Smrgfunc_lt_dump_args () 39402a75d1c4Smrg{ 39412a75d1c4Smrg lt_dump_args_N=1; 39422a75d1c4Smrg for lt_arg 39432a75d1c4Smrg do 39442a75d1c4Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 39452a75d1c4Smrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 39462a75d1c4Smrg done 39472a75d1c4Smrg} 3948f7ec340bSmacallan 39492a75d1c4Smrg# Core function for launching the target application 39502a75d1c4Smrgfunc_exec_program_core () 39512a75d1c4Smrg{ 39522a75d1c4Smrg" 39532a75d1c4Smrg case $host in 39542a75d1c4Smrg # Backslashes separate directories on plain windows 39552a75d1c4Smrg *-*-mingw | *-*-os2* | *-cegcc*) 39562a75d1c4Smrg $ECHO "\ 39572a75d1c4Smrg if test -n \"\$lt_option_debug\"; then 39582a75d1c4Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 39592a75d1c4Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 39602a75d1c4Smrg fi 39612a75d1c4Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 39622a75d1c4Smrg" 39632a75d1c4Smrg ;; 3964f7ec340bSmacallan 39652a75d1c4Smrg *) 39662a75d1c4Smrg $ECHO "\ 39672a75d1c4Smrg if test -n \"\$lt_option_debug\"; then 39682a75d1c4Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 39692a75d1c4Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 39702a75d1c4Smrg fi 39712a75d1c4Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 39722a75d1c4Smrg" 39732a75d1c4Smrg ;; 39742a75d1c4Smrg esac 39752a75d1c4Smrg $ECHO "\ 39762a75d1c4Smrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 39772a75d1c4Smrg exit 1 39782a75d1c4Smrg} 3979f7ec340bSmacallan 39802a75d1c4Smrg# A function to encapsulate launching the target application 39812a75d1c4Smrg# Strips options in the --lt-* namespace from \$@ and 39822a75d1c4Smrg# launches target application with the remaining arguments. 39832a75d1c4Smrgfunc_exec_program () 39842a75d1c4Smrg{ 39852a75d1c4Smrg for lt_wr_arg 39862a75d1c4Smrg do 39872a75d1c4Smrg case \$lt_wr_arg in 39882a75d1c4Smrg --lt-*) ;; 39892a75d1c4Smrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 39902a75d1c4Smrg esac 39912a75d1c4Smrg shift 39922a75d1c4Smrg done 39932a75d1c4Smrg func_exec_program_core \${1+\"\$@\"} 39942a75d1c4Smrg} 3995f7ec340bSmacallan 39962a75d1c4Smrg # Parse options 39972a75d1c4Smrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3998f7ec340bSmacallan 39992a75d1c4Smrg # Find the directory that this script lives in. 40002a75d1c4Smrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 40012a75d1c4Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4002f7ec340bSmacallan 40032a75d1c4Smrg # Follow symbolic links until we get to the real thisdir. 40042a75d1c4Smrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 40052a75d1c4Smrg while test -n \"\$file\"; do 40062a75d1c4Smrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4007f7ec340bSmacallan 40082a75d1c4Smrg # If there was a directory component, then change thisdir. 40092a75d1c4Smrg if test \"x\$destdir\" != \"x\$file\"; then 40102a75d1c4Smrg case \"\$destdir\" in 40112a75d1c4Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 40122a75d1c4Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 40132a75d1c4Smrg esac 40142a75d1c4Smrg fi 4015f7ec340bSmacallan 40162a75d1c4Smrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 40172a75d1c4Smrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 40182a75d1c4Smrg done 4019f7ec340bSmacallan 40202a75d1c4Smrg # Usually 'no', except on cygwin/mingw when embedded into 40212a75d1c4Smrg # the cwrapper. 40222a75d1c4Smrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 40232a75d1c4Smrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 40242a75d1c4Smrg # special case for '.' 40252a75d1c4Smrg if test \"\$thisdir\" = \".\"; then 40262a75d1c4Smrg thisdir=\`pwd\` 40272a75d1c4Smrg fi 40282a75d1c4Smrg # remove .libs from thisdir 40292a75d1c4Smrg case \"\$thisdir\" in 40302a75d1c4Smrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 40312a75d1c4Smrg $objdir ) thisdir=. ;; 40322a75d1c4Smrg esac 40332a75d1c4Smrg fi 4034f7ec340bSmacallan 40352a75d1c4Smrg # Try to get the absolute directory name. 40362a75d1c4Smrg absdir=\`cd \"\$thisdir\" && pwd\` 40372a75d1c4Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 40382a75d1c4Smrg" 4039f7ec340bSmacallan 40402a75d1c4Smrg if test "$fast_install" = yes; then 40412a75d1c4Smrg $ECHO "\ 40422a75d1c4Smrg program=lt-'$outputname'$exeext 40432a75d1c4Smrg progdir=\"\$thisdir/$objdir\" 4044f7ec340bSmacallan 40452a75d1c4Smrg if test ! -f \"\$progdir/\$program\" || 40462a75d1c4Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 40472a75d1c4Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4048f7ec340bSmacallan 40492a75d1c4Smrg file=\"\$\$-\$program\" 4050f7ec340bSmacallan 40512a75d1c4Smrg if test ! -d \"\$progdir\"; then 40522a75d1c4Smrg $MKDIR \"\$progdir\" 40532a75d1c4Smrg else 40542a75d1c4Smrg $RM \"\$progdir/\$file\" 40552a75d1c4Smrg fi" 4056f7ec340bSmacallan 40572a75d1c4Smrg $ECHO "\ 4058f7ec340bSmacallan 40592a75d1c4Smrg # relink executable if necessary 40602a75d1c4Smrg if test -n \"\$relink_command\"; then 40612a75d1c4Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 40622a75d1c4Smrg else 40632a75d1c4Smrg $ECHO \"\$relink_command_output\" >&2 40642a75d1c4Smrg $RM \"\$progdir/\$file\" 40652a75d1c4Smrg exit 1 40662a75d1c4Smrg fi 40672a75d1c4Smrg fi 4068f7ec340bSmacallan 40692a75d1c4Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 40702a75d1c4Smrg { $RM \"\$progdir/\$program\"; 40712a75d1c4Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 40722a75d1c4Smrg $RM \"\$progdir/\$file\" 40732a75d1c4Smrg fi" 40742a75d1c4Smrg else 40752a75d1c4Smrg $ECHO "\ 40762a75d1c4Smrg program='$outputname' 40772a75d1c4Smrg progdir=\"\$thisdir/$objdir\" 40782a75d1c4Smrg" 4079f7ec340bSmacallan fi 4080f7ec340bSmacallan 40812a75d1c4Smrg $ECHO "\ 4082f7ec340bSmacallan 40832a75d1c4Smrg if test -f \"\$progdir/\$program\"; then" 4084f7ec340bSmacallan 40852a75d1c4Smrg # fixup the dll searchpath if we need to. 40862a75d1c4Smrg # 40872a75d1c4Smrg # Fix the DLL searchpath if we need to. Do this before prepending 40882a75d1c4Smrg # to shlibpath, because on Windows, both are PATH and uninstalled 40892a75d1c4Smrg # libraries must come first. 40902a75d1c4Smrg if test -n "$dllsearchpath"; then 40912a75d1c4Smrg $ECHO "\ 40922a75d1c4Smrg # Add the dll search path components to the executable PATH 40932a75d1c4Smrg PATH=$dllsearchpath:\$PATH 40942a75d1c4Smrg" 40952a75d1c4Smrg fi 4096f7ec340bSmacallan 40972a75d1c4Smrg # Export our shlibpath_var if we have one. 40982a75d1c4Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 40992a75d1c4Smrg $ECHO "\ 41002a75d1c4Smrg # Add our own library path to $shlibpath_var 41012a75d1c4Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4102f7ec340bSmacallan 41032a75d1c4Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 41042a75d1c4Smrg # The second colon is a workaround for a bug in BeOS R4 sed 41052a75d1c4Smrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4106f7ec340bSmacallan 41072a75d1c4Smrg export $shlibpath_var 41082a75d1c4Smrg" 41092a75d1c4Smrg fi 4110f7ec340bSmacallan 41112a75d1c4Smrg $ECHO "\ 41122a75d1c4Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 41132a75d1c4Smrg # Run the actual program with our arguments. 41142a75d1c4Smrg func_exec_program \${1+\"\$@\"} 41152a75d1c4Smrg fi 41162a75d1c4Smrg else 41172a75d1c4Smrg # The program doesn't exist. 41182a75d1c4Smrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 41192a75d1c4Smrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 41202a75d1c4Smrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 41212a75d1c4Smrg exit 1 41222a75d1c4Smrg fi 41232a75d1c4Smrgfi\ 41242a75d1c4Smrg" 41252a75d1c4Smrg} 4126f7ec340bSmacallan 4127f7ec340bSmacallan 41282a75d1c4Smrg# func_emit_cwrapperexe_src 41292a75d1c4Smrg# emit the source code for a wrapper executable on stdout 41302a75d1c4Smrg# Must ONLY be called from within func_mode_link because 41312a75d1c4Smrg# it depends on a number of variable set therein. 41322a75d1c4Smrgfunc_emit_cwrapperexe_src () 41332a75d1c4Smrg{ 41342a75d1c4Smrg cat <<EOF 4135f7ec340bSmacallan 41362a75d1c4Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 41372a75d1c4Smrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4138f7ec340bSmacallan 41392a75d1c4Smrg The $output program cannot be directly executed until all the libtool 41402a75d1c4Smrg libraries that it depends on are installed. 4141f7ec340bSmacallan 41422a75d1c4Smrg This wrapper executable should never be moved out of the build directory. 41432a75d1c4Smrg If it is, it will not operate correctly. 41442a75d1c4Smrg*/ 41452a75d1c4SmrgEOF 41462a75d1c4Smrg cat <<"EOF" 41472a75d1c4Smrg#ifdef _MSC_VER 41482a75d1c4Smrg# define _CRT_SECURE_NO_DEPRECATE 1 41492a75d1c4Smrg#endif 41502a75d1c4Smrg#include <stdio.h> 41512a75d1c4Smrg#include <stdlib.h> 41522a75d1c4Smrg#ifdef _MSC_VER 41532a75d1c4Smrg# include <direct.h> 41542a75d1c4Smrg# include <process.h> 41552a75d1c4Smrg# include <io.h> 41562a75d1c4Smrg#else 41572a75d1c4Smrg# include <unistd.h> 41582a75d1c4Smrg# include <stdint.h> 41592a75d1c4Smrg# ifdef __CYGWIN__ 41602a75d1c4Smrg# include <io.h> 41612a75d1c4Smrg# endif 41622a75d1c4Smrg#endif 41632a75d1c4Smrg#include <malloc.h> 41642a75d1c4Smrg#include <stdarg.h> 41652a75d1c4Smrg#include <assert.h> 41662a75d1c4Smrg#include <string.h> 41672a75d1c4Smrg#include <ctype.h> 41682a75d1c4Smrg#include <errno.h> 41692a75d1c4Smrg#include <fcntl.h> 41702a75d1c4Smrg#include <sys/stat.h> 4171f7ec340bSmacallan 41722a75d1c4Smrg/* declarations of non-ANSI functions */ 41732a75d1c4Smrg#if defined(__MINGW32__) 41742a75d1c4Smrg# ifdef __STRICT_ANSI__ 41752a75d1c4Smrgint _putenv (const char *); 41762a75d1c4Smrg# endif 41772a75d1c4Smrg#elif defined(__CYGWIN__) 41782a75d1c4Smrg# ifdef __STRICT_ANSI__ 41792a75d1c4Smrgchar *realpath (const char *, char *); 41802a75d1c4Smrgint putenv (char *); 41812a75d1c4Smrgint setenv (const char *, const char *, int); 41822a75d1c4Smrg# endif 41832a75d1c4Smrg/* #elif defined (other platforms) ... */ 41842a75d1c4Smrg#endif 4185f7ec340bSmacallan 41862a75d1c4Smrg/* portability defines, excluding path handling macros */ 41872a75d1c4Smrg#if defined(_MSC_VER) 41882a75d1c4Smrg# define setmode _setmode 41892a75d1c4Smrg# define stat _stat 41902a75d1c4Smrg# define chmod _chmod 41912a75d1c4Smrg# define getcwd _getcwd 41922a75d1c4Smrg# define putenv _putenv 41932a75d1c4Smrg# define S_IXUSR _S_IEXEC 41942a75d1c4Smrg# ifndef _INTPTR_T_DEFINED 41952a75d1c4Smrg# define _INTPTR_T_DEFINED 41962a75d1c4Smrg# define intptr_t int 41972a75d1c4Smrg# endif 41982a75d1c4Smrg#elif defined(__MINGW32__) 41992a75d1c4Smrg# define setmode _setmode 42002a75d1c4Smrg# define stat _stat 42012a75d1c4Smrg# define chmod _chmod 42022a75d1c4Smrg# define getcwd _getcwd 42032a75d1c4Smrg# define putenv _putenv 42042a75d1c4Smrg#elif defined(__CYGWIN__) 42052a75d1c4Smrg# define HAVE_SETENV 42062a75d1c4Smrg# define FOPEN_WB "wb" 42072a75d1c4Smrg/* #elif defined (other platforms) ... */ 42082a75d1c4Smrg#endif 4209f7ec340bSmacallan 42102a75d1c4Smrg#if defined(PATH_MAX) 42112a75d1c4Smrg# define LT_PATHMAX PATH_MAX 42122a75d1c4Smrg#elif defined(MAXPATHLEN) 42132a75d1c4Smrg# define LT_PATHMAX MAXPATHLEN 42142a75d1c4Smrg#else 42152a75d1c4Smrg# define LT_PATHMAX 1024 42162a75d1c4Smrg#endif 4217f7ec340bSmacallan 42182a75d1c4Smrg#ifndef S_IXOTH 42192a75d1c4Smrg# define S_IXOTH 0 42202a75d1c4Smrg#endif 42212a75d1c4Smrg#ifndef S_IXGRP 42222a75d1c4Smrg# define S_IXGRP 0 42232a75d1c4Smrg#endif 4224f7ec340bSmacallan 42252a75d1c4Smrg/* path handling portability macros */ 42262a75d1c4Smrg#ifndef DIR_SEPARATOR 42272a75d1c4Smrg# define DIR_SEPARATOR '/' 42282a75d1c4Smrg# define PATH_SEPARATOR ':' 42292a75d1c4Smrg#endif 4230f7ec340bSmacallan 42312a75d1c4Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 42322a75d1c4Smrg defined (__OS2__) 42332a75d1c4Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 42342a75d1c4Smrg# define FOPEN_WB "wb" 42352a75d1c4Smrg# ifndef DIR_SEPARATOR_2 42362a75d1c4Smrg# define DIR_SEPARATOR_2 '\\' 42372a75d1c4Smrg# endif 42382a75d1c4Smrg# ifndef PATH_SEPARATOR_2 42392a75d1c4Smrg# define PATH_SEPARATOR_2 ';' 42402a75d1c4Smrg# endif 42412a75d1c4Smrg#endif 4242f7ec340bSmacallan 42432a75d1c4Smrg#ifndef DIR_SEPARATOR_2 42442a75d1c4Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 42452a75d1c4Smrg#else /* DIR_SEPARATOR_2 */ 42462a75d1c4Smrg# define IS_DIR_SEPARATOR(ch) \ 42472a75d1c4Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 42482a75d1c4Smrg#endif /* DIR_SEPARATOR_2 */ 4249f7ec340bSmacallan 42502a75d1c4Smrg#ifndef PATH_SEPARATOR_2 42512a75d1c4Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 42522a75d1c4Smrg#else /* PATH_SEPARATOR_2 */ 42532a75d1c4Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 42542a75d1c4Smrg#endif /* PATH_SEPARATOR_2 */ 4255f7ec340bSmacallan 42562a75d1c4Smrg#ifndef FOPEN_WB 42572a75d1c4Smrg# define FOPEN_WB "w" 42582a75d1c4Smrg#endif 42592a75d1c4Smrg#ifndef _O_BINARY 42602a75d1c4Smrg# define _O_BINARY 0 42612a75d1c4Smrg#endif 4262f7ec340bSmacallan 42632a75d1c4Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 42642a75d1c4Smrg#define XFREE(stale) do { \ 42652a75d1c4Smrg if (stale) { free ((void *) stale); stale = 0; } \ 42662a75d1c4Smrg} while (0) 4267f7ec340bSmacallan 42682a75d1c4Smrg#if defined(LT_DEBUGWRAPPER) 42692a75d1c4Smrgstatic int lt_debug = 1; 42702a75d1c4Smrg#else 42712a75d1c4Smrgstatic int lt_debug = 0; 42722a75d1c4Smrg#endif 4273f7ec340bSmacallan 42742a75d1c4Smrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 42752a75d1c4Smrg 42762a75d1c4Smrgvoid *xmalloc (size_t num); 42772a75d1c4Smrgchar *xstrdup (const char *string); 42782a75d1c4Smrgconst char *base_name (const char *name); 42792a75d1c4Smrgchar *find_executable (const char *wrapper); 42802a75d1c4Smrgchar *chase_symlinks (const char *pathspec); 42812a75d1c4Smrgint make_executable (const char *path); 42822a75d1c4Smrgint check_executable (const char *path); 42832a75d1c4Smrgchar *strendzap (char *str, const char *pat); 42842a75d1c4Smrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 42852a75d1c4Smrgvoid lt_fatal (const char *file, int line, const char *message, ...); 42862a75d1c4Smrgstatic const char *nonnull (const char *s); 42872a75d1c4Smrgstatic const char *nonempty (const char *s); 42882a75d1c4Smrgvoid lt_setenv (const char *name, const char *value); 42892a75d1c4Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 42902a75d1c4Smrgvoid lt_update_exe_path (const char *name, const char *value); 42912a75d1c4Smrgvoid lt_update_lib_path (const char *name, const char *value); 42922a75d1c4Smrgchar **prepare_spawn (char **argv); 42932a75d1c4Smrgvoid lt_dump_script (FILE *f); 42942a75d1c4SmrgEOF 4295f7ec340bSmacallan 42962a75d1c4Smrg cat <<EOF 42972a75d1c4Smrgvolatile const char * MAGIC_EXE = "$magic_exe"; 42982a75d1c4Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 42992a75d1c4SmrgEOF 4300f7ec340bSmacallan 43012a75d1c4Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 43022a75d1c4Smrg func_to_host_path "$temp_rpath" 43032a75d1c4Smrg cat <<EOF 43042a75d1c4Smrgconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 43052a75d1c4SmrgEOF 43062a75d1c4Smrg else 43072a75d1c4Smrg cat <<"EOF" 43082a75d1c4Smrgconst char * LIB_PATH_VALUE = ""; 43092a75d1c4SmrgEOF 43102a75d1c4Smrg fi 4311f7ec340bSmacallan 43122a75d1c4Smrg if test -n "$dllsearchpath"; then 43132a75d1c4Smrg func_to_host_path "$dllsearchpath:" 43142a75d1c4Smrg cat <<EOF 43152a75d1c4Smrgconst char * EXE_PATH_VARNAME = "PATH"; 43162a75d1c4Smrgconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 43172a75d1c4SmrgEOF 43182a75d1c4Smrg else 43192a75d1c4Smrg cat <<"EOF" 43202a75d1c4Smrgconst char * EXE_PATH_VARNAME = ""; 43212a75d1c4Smrgconst char * EXE_PATH_VALUE = ""; 43222a75d1c4SmrgEOF 43232a75d1c4Smrg fi 4324f7ec340bSmacallan 43252a75d1c4Smrg if test "$fast_install" = yes; then 43262a75d1c4Smrg cat <<EOF 43272a75d1c4Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 43282a75d1c4SmrgEOF 43292a75d1c4Smrg else 43302a75d1c4Smrg cat <<EOF 43312a75d1c4Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 43322a75d1c4SmrgEOF 43332a75d1c4Smrg fi 4334f7ec340bSmacallan 4335f7ec340bSmacallan 43362a75d1c4Smrg cat <<"EOF" 4337f7ec340bSmacallan 43382a75d1c4Smrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 4339f7ec340bSmacallan 43402a75d1c4Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 43412a75d1c4Smrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 43422a75d1c4Smrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4343f7ec340bSmacallan 43442a75d1c4Smrgint 43452a75d1c4Smrgmain (int argc, char *argv[]) 43462a75d1c4Smrg{ 43472a75d1c4Smrg char **newargz; 43482a75d1c4Smrg int newargc; 43492a75d1c4Smrg char *tmp_pathspec; 43502a75d1c4Smrg char *actual_cwrapper_path; 43512a75d1c4Smrg char *actual_cwrapper_name; 43522a75d1c4Smrg char *target_name; 43532a75d1c4Smrg char *lt_argv_zero; 43542a75d1c4Smrg intptr_t rval = 127; 43552a75d1c4Smrg 43562a75d1c4Smrg int i; 43572a75d1c4Smrg 43582a75d1c4Smrg program_name = (char *) xstrdup (base_name (argv[0])); 43592a75d1c4Smrg newargz = XMALLOC (char *, argc + 1); 43602a75d1c4Smrg 43612a75d1c4Smrg /* very simple arg parsing; don't want to rely on getopt 43622a75d1c4Smrg * also, copy all non cwrapper options to newargz, except 43632a75d1c4Smrg * argz[0], which is handled differently 43642a75d1c4Smrg */ 43652a75d1c4Smrg newargc=0; 43662a75d1c4Smrg for (i = 1; i < argc; i++) 43672a75d1c4Smrg { 43682a75d1c4Smrg if (strcmp (argv[i], dumpscript_opt) == 0) 43692a75d1c4Smrg { 43702a75d1c4SmrgEOF 43712a75d1c4Smrg case "$host" in 43722a75d1c4Smrg *mingw* | *cygwin* ) 43732a75d1c4Smrg # make stdout use "unix" line endings 43742a75d1c4Smrg echo " setmode(1,_O_BINARY);" 4375f7ec340bSmacallan ;; 4376f7ec340bSmacallan esac 4377f7ec340bSmacallan 43782a75d1c4Smrg cat <<"EOF" 43792a75d1c4Smrg lt_dump_script (stdout); 43802a75d1c4Smrg return 0; 43812a75d1c4Smrg } 43822a75d1c4Smrg if (strcmp (argv[i], debug_opt) == 0) 43832a75d1c4Smrg { 43842a75d1c4Smrg lt_debug = 1; 43852a75d1c4Smrg continue; 43862a75d1c4Smrg } 43872a75d1c4Smrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 43882a75d1c4Smrg { 43892a75d1c4Smrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 43902a75d1c4Smrg namespace, but it is not one of the ones we know about and 43912a75d1c4Smrg have already dealt with, above (inluding dump-script), then 43922a75d1c4Smrg report an error. Otherwise, targets might begin to believe 43932a75d1c4Smrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 43942a75d1c4Smrg namespace. The first time any user complains about this, we'll 43952a75d1c4Smrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 43962a75d1c4Smrg or a configure.ac-settable value. 43972a75d1c4Smrg */ 43982a75d1c4Smrg lt_fatal (__FILE__, __LINE__, 43992a75d1c4Smrg "unrecognized %s option: '%s'", 44002a75d1c4Smrg ltwrapper_option_prefix, argv[i]); 44012a75d1c4Smrg } 44022a75d1c4Smrg /* otherwise ... */ 44032a75d1c4Smrg newargz[++newargc] = xstrdup (argv[i]); 44042a75d1c4Smrg } 44052a75d1c4Smrg newargz[++newargc] = NULL; 4406f7ec340bSmacallan 44072a75d1c4SmrgEOF 44082a75d1c4Smrg cat <<EOF 44092a75d1c4Smrg /* The GNU banner must be the first non-error debug message */ 44102a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 44112a75d1c4SmrgEOF 44122a75d1c4Smrg cat <<"EOF" 44132a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 44142a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 44152a75d1c4Smrg 44162a75d1c4Smrg tmp_pathspec = find_executable (argv[0]); 44172a75d1c4Smrg if (tmp_pathspec == NULL) 44182a75d1c4Smrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 44192a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 44202a75d1c4Smrg "(main) found exe (before symlink chase) at: %s\n", 44212a75d1c4Smrg tmp_pathspec); 44222a75d1c4Smrg 44232a75d1c4Smrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 44242a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 44252a75d1c4Smrg "(main) found exe (after symlink chase) at: %s\n", 44262a75d1c4Smrg actual_cwrapper_path); 44272a75d1c4Smrg XFREE (tmp_pathspec); 44282a75d1c4Smrg 44292a75d1c4Smrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 44302a75d1c4Smrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 44312a75d1c4Smrg 44322a75d1c4Smrg /* wrapper name transforms */ 44332a75d1c4Smrg strendzap (actual_cwrapper_name, ".exe"); 44342a75d1c4Smrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 44352a75d1c4Smrg XFREE (actual_cwrapper_name); 44362a75d1c4Smrg actual_cwrapper_name = tmp_pathspec; 44372a75d1c4Smrg tmp_pathspec = 0; 44382a75d1c4Smrg 44392a75d1c4Smrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 44402a75d1c4Smrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 44412a75d1c4Smrg strendzap (target_name, ".exe"); 44422a75d1c4Smrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 44432a75d1c4Smrg XFREE (target_name); 44442a75d1c4Smrg target_name = tmp_pathspec; 44452a75d1c4Smrg tmp_pathspec = 0; 44462a75d1c4Smrg 44472a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 44482a75d1c4Smrg "(main) libtool target name: %s\n", 44492a75d1c4Smrg target_name); 44502a75d1c4SmrgEOF 4451f7ec340bSmacallan 44522a75d1c4Smrg cat <<EOF 44532a75d1c4Smrg newargz[0] = 44542a75d1c4Smrg XMALLOC (char, (strlen (actual_cwrapper_path) + 44552a75d1c4Smrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 44562a75d1c4Smrg strcpy (newargz[0], actual_cwrapper_path); 44572a75d1c4Smrg strcat (newargz[0], "$objdir"); 44582a75d1c4Smrg strcat (newargz[0], "/"); 44592a75d1c4SmrgEOF 4460f7ec340bSmacallan 44612a75d1c4Smrg cat <<"EOF" 44622a75d1c4Smrg /* stop here, and copy so we don't have to do this twice */ 44632a75d1c4Smrg tmp_pathspec = xstrdup (newargz[0]); 4464f7ec340bSmacallan 44652a75d1c4Smrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 44662a75d1c4Smrg strcat (newargz[0], actual_cwrapper_name); 4467f7ec340bSmacallan 44682a75d1c4Smrg /* DO want the lt- prefix here if it exists, so use target_name */ 44692a75d1c4Smrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 44702a75d1c4Smrg XFREE (tmp_pathspec); 44712a75d1c4Smrg tmp_pathspec = NULL; 44722a75d1c4SmrgEOF 4473f7ec340bSmacallan 44742a75d1c4Smrg case $host_os in 44752a75d1c4Smrg mingw*) 44762a75d1c4Smrg cat <<"EOF" 44772a75d1c4Smrg { 44782a75d1c4Smrg char* p; 44792a75d1c4Smrg while ((p = strchr (newargz[0], '\\')) != NULL) 44802a75d1c4Smrg { 44812a75d1c4Smrg *p = '/'; 44822a75d1c4Smrg } 44832a75d1c4Smrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 44842a75d1c4Smrg { 44852a75d1c4Smrg *p = '/'; 44862a75d1c4Smrg } 44872a75d1c4Smrg } 44882a75d1c4SmrgEOF 44892a75d1c4Smrg ;; 44902a75d1c4Smrg esac 4491f7ec340bSmacallan 44922a75d1c4Smrg cat <<"EOF" 44932a75d1c4Smrg XFREE (target_name); 44942a75d1c4Smrg XFREE (actual_cwrapper_path); 44952a75d1c4Smrg XFREE (actual_cwrapper_name); 44962a75d1c4Smrg 44972a75d1c4Smrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 44982a75d1c4Smrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 44992a75d1c4Smrg /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 45002a75d1c4Smrg be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 45012a75d1c4Smrg because on Windows, both *_VARNAMEs are PATH but uninstalled 45022a75d1c4Smrg libraries must come first. */ 45032a75d1c4Smrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 45042a75d1c4Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 45052a75d1c4Smrg 45062a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 45072a75d1c4Smrg nonnull (lt_argv_zero)); 45082a75d1c4Smrg for (i = 0; i < newargc; i++) 45092a75d1c4Smrg { 45102a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 45112a75d1c4Smrg i, nonnull (newargz[i])); 45122a75d1c4Smrg } 4513f7ec340bSmacallan 45142a75d1c4SmrgEOF 4515f7ec340bSmacallan 45162a75d1c4Smrg case $host_os in 45172a75d1c4Smrg mingw*) 45182a75d1c4Smrg cat <<"EOF" 45192a75d1c4Smrg /* execv doesn't actually work on mingw as expected on unix */ 45202a75d1c4Smrg newargz = prepare_spawn (newargz); 45212a75d1c4Smrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 45222a75d1c4Smrg if (rval == -1) 45232a75d1c4Smrg { 45242a75d1c4Smrg /* failed to start process */ 45252a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 45262a75d1c4Smrg "(main) failed to launch target \"%s\": %s\n", 45272a75d1c4Smrg lt_argv_zero, nonnull (strerror (errno))); 45282a75d1c4Smrg return 127; 45292a75d1c4Smrg } 45302a75d1c4Smrg return rval; 45312a75d1c4SmrgEOF 45322a75d1c4Smrg ;; 45332a75d1c4Smrg *) 45342a75d1c4Smrg cat <<"EOF" 45352a75d1c4Smrg execv (lt_argv_zero, newargz); 45362a75d1c4Smrg return rval; /* =127, but avoids unused variable warning */ 45372a75d1c4SmrgEOF 45382a75d1c4Smrg ;; 45392a75d1c4Smrg esac 4540f7ec340bSmacallan 45412a75d1c4Smrg cat <<"EOF" 45422a75d1c4Smrg} 4543f7ec340bSmacallan 45442a75d1c4Smrgvoid * 45452a75d1c4Smrgxmalloc (size_t num) 45462a75d1c4Smrg{ 45472a75d1c4Smrg void *p = (void *) malloc (num); 45482a75d1c4Smrg if (!p) 45492a75d1c4Smrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4550f7ec340bSmacallan 45512a75d1c4Smrg return p; 45522a75d1c4Smrg} 4553f7ec340bSmacallan 45542a75d1c4Smrgchar * 45552a75d1c4Smrgxstrdup (const char *string) 45562a75d1c4Smrg{ 45572a75d1c4Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 45582a75d1c4Smrg string) : NULL; 45592a75d1c4Smrg} 4560f7ec340bSmacallan 45612a75d1c4Smrgconst char * 45622a75d1c4Smrgbase_name (const char *name) 45632a75d1c4Smrg{ 45642a75d1c4Smrg const char *base; 4565f7ec340bSmacallan 45662a75d1c4Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 45672a75d1c4Smrg /* Skip over the disk name in MSDOS pathnames. */ 45682a75d1c4Smrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 45692a75d1c4Smrg name += 2; 45702a75d1c4Smrg#endif 4571f7ec340bSmacallan 45722a75d1c4Smrg for (base = name; *name; name++) 45732a75d1c4Smrg if (IS_DIR_SEPARATOR (*name)) 45742a75d1c4Smrg base = name + 1; 45752a75d1c4Smrg return base; 45762a75d1c4Smrg} 4577f7ec340bSmacallan 45782a75d1c4Smrgint 45792a75d1c4Smrgcheck_executable (const char *path) 45802a75d1c4Smrg{ 45812a75d1c4Smrg struct stat st; 4582f7ec340bSmacallan 45832a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 45842a75d1c4Smrg nonempty (path)); 45852a75d1c4Smrg if ((!path) || (!*path)) 45862a75d1c4Smrg return 0; 4587f7ec340bSmacallan 45882a75d1c4Smrg if ((stat (path, &st) >= 0) 45892a75d1c4Smrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 45902a75d1c4Smrg return 1; 45912a75d1c4Smrg else 45922a75d1c4Smrg return 0; 45932a75d1c4Smrg} 4594f7ec340bSmacallan 45952a75d1c4Smrgint 45962a75d1c4Smrgmake_executable (const char *path) 45972a75d1c4Smrg{ 45982a75d1c4Smrg int rval = 0; 45992a75d1c4Smrg struct stat st; 4600f7ec340bSmacallan 46012a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 46022a75d1c4Smrg nonempty (path)); 46032a75d1c4Smrg if ((!path) || (!*path)) 46042a75d1c4Smrg return 0; 4605f7ec340bSmacallan 46062a75d1c4Smrg if (stat (path, &st) >= 0) 46072a75d1c4Smrg { 46082a75d1c4Smrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 46092a75d1c4Smrg } 46102a75d1c4Smrg return rval; 46112a75d1c4Smrg} 4612f7ec340bSmacallan 46132a75d1c4Smrg/* Searches for the full path of the wrapper. Returns 46142a75d1c4Smrg newly allocated full path name if found, NULL otherwise 46152a75d1c4Smrg Does not chase symlinks, even on platforms that support them. 46162a75d1c4Smrg*/ 46172a75d1c4Smrgchar * 46182a75d1c4Smrgfind_executable (const char *wrapper) 46192a75d1c4Smrg{ 46202a75d1c4Smrg int has_slash = 0; 46212a75d1c4Smrg const char *p; 46222a75d1c4Smrg const char *p_next; 46232a75d1c4Smrg /* static buffer for getcwd */ 46242a75d1c4Smrg char tmp[LT_PATHMAX + 1]; 46252a75d1c4Smrg int tmp_len; 46262a75d1c4Smrg char *concat_name; 4627f7ec340bSmacallan 46282a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 46292a75d1c4Smrg nonempty (wrapper)); 4630f7ec340bSmacallan 46312a75d1c4Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 46322a75d1c4Smrg return NULL; 4633f7ec340bSmacallan 46342a75d1c4Smrg /* Absolute path? */ 46352a75d1c4Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 46362a75d1c4Smrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 46372a75d1c4Smrg { 46382a75d1c4Smrg concat_name = xstrdup (wrapper); 46392a75d1c4Smrg if (check_executable (concat_name)) 46402a75d1c4Smrg return concat_name; 46412a75d1c4Smrg XFREE (concat_name); 46422a75d1c4Smrg } 46432a75d1c4Smrg else 46442a75d1c4Smrg { 46452a75d1c4Smrg#endif 46462a75d1c4Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 46472a75d1c4Smrg { 46482a75d1c4Smrg concat_name = xstrdup (wrapper); 46492a75d1c4Smrg if (check_executable (concat_name)) 46502a75d1c4Smrg return concat_name; 46512a75d1c4Smrg XFREE (concat_name); 46522a75d1c4Smrg } 46532a75d1c4Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 46542a75d1c4Smrg } 46552a75d1c4Smrg#endif 4656f7ec340bSmacallan 46572a75d1c4Smrg for (p = wrapper; *p; p++) 46582a75d1c4Smrg if (*p == '/') 46592a75d1c4Smrg { 46602a75d1c4Smrg has_slash = 1; 46612a75d1c4Smrg break; 46622a75d1c4Smrg } 46632a75d1c4Smrg if (!has_slash) 46642a75d1c4Smrg { 46652a75d1c4Smrg /* no slashes; search PATH */ 46662a75d1c4Smrg const char *path = getenv ("PATH"); 46672a75d1c4Smrg if (path != NULL) 46682a75d1c4Smrg { 46692a75d1c4Smrg for (p = path; *p; p = p_next) 46702a75d1c4Smrg { 46712a75d1c4Smrg const char *q; 46722a75d1c4Smrg size_t p_len; 46732a75d1c4Smrg for (q = p; *q; q++) 46742a75d1c4Smrg if (IS_PATH_SEPARATOR (*q)) 46752a75d1c4Smrg break; 46762a75d1c4Smrg p_len = q - p; 46772a75d1c4Smrg p_next = (*q == '\0' ? q : q + 1); 46782a75d1c4Smrg if (p_len == 0) 46792a75d1c4Smrg { 46802a75d1c4Smrg /* empty path: current directory */ 46812a75d1c4Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 46822a75d1c4Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 46832a75d1c4Smrg nonnull (strerror (errno))); 46842a75d1c4Smrg tmp_len = strlen (tmp); 46852a75d1c4Smrg concat_name = 46862a75d1c4Smrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 46872a75d1c4Smrg memcpy (concat_name, tmp, tmp_len); 46882a75d1c4Smrg concat_name[tmp_len] = '/'; 46892a75d1c4Smrg strcpy (concat_name + tmp_len + 1, wrapper); 46902a75d1c4Smrg } 46912a75d1c4Smrg else 46922a75d1c4Smrg { 46932a75d1c4Smrg concat_name = 46942a75d1c4Smrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 46952a75d1c4Smrg memcpy (concat_name, p, p_len); 46962a75d1c4Smrg concat_name[p_len] = '/'; 46972a75d1c4Smrg strcpy (concat_name + p_len + 1, wrapper); 46982a75d1c4Smrg } 46992a75d1c4Smrg if (check_executable (concat_name)) 47002a75d1c4Smrg return concat_name; 47012a75d1c4Smrg XFREE (concat_name); 47022a75d1c4Smrg } 47032a75d1c4Smrg } 47042a75d1c4Smrg /* not found in PATH; assume curdir */ 47052a75d1c4Smrg } 47062a75d1c4Smrg /* Relative path | not found in path: prepend cwd */ 47072a75d1c4Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 47082a75d1c4Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 47092a75d1c4Smrg nonnull (strerror (errno))); 47102a75d1c4Smrg tmp_len = strlen (tmp); 47112a75d1c4Smrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 47122a75d1c4Smrg memcpy (concat_name, tmp, tmp_len); 47132a75d1c4Smrg concat_name[tmp_len] = '/'; 47142a75d1c4Smrg strcpy (concat_name + tmp_len + 1, wrapper); 47152a75d1c4Smrg 47162a75d1c4Smrg if (check_executable (concat_name)) 47172a75d1c4Smrg return concat_name; 47182a75d1c4Smrg XFREE (concat_name); 47192a75d1c4Smrg return NULL; 4720f7ec340bSmacallan} 4721f7ec340bSmacallan 47222a75d1c4Smrgchar * 47232a75d1c4Smrgchase_symlinks (const char *pathspec) 47242a75d1c4Smrg{ 47252a75d1c4Smrg#ifndef S_ISLNK 47262a75d1c4Smrg return xstrdup (pathspec); 47272a75d1c4Smrg#else 47282a75d1c4Smrg char buf[LT_PATHMAX]; 47292a75d1c4Smrg struct stat s; 47302a75d1c4Smrg char *tmp_pathspec = xstrdup (pathspec); 47312a75d1c4Smrg char *p; 47322a75d1c4Smrg int has_symlinks = 0; 47332a75d1c4Smrg while (strlen (tmp_pathspec) && !has_symlinks) 47342a75d1c4Smrg { 47352a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 47362a75d1c4Smrg "checking path component for symlinks: %s\n", 47372a75d1c4Smrg tmp_pathspec); 47382a75d1c4Smrg if (lstat (tmp_pathspec, &s) == 0) 47392a75d1c4Smrg { 47402a75d1c4Smrg if (S_ISLNK (s.st_mode) != 0) 47412a75d1c4Smrg { 47422a75d1c4Smrg has_symlinks = 1; 47432a75d1c4Smrg break; 47442a75d1c4Smrg } 4745f7ec340bSmacallan 47462a75d1c4Smrg /* search backwards for last DIR_SEPARATOR */ 47472a75d1c4Smrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 47482a75d1c4Smrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 47492a75d1c4Smrg p--; 47502a75d1c4Smrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 47512a75d1c4Smrg { 47522a75d1c4Smrg /* no more DIR_SEPARATORS left */ 47532a75d1c4Smrg break; 47542a75d1c4Smrg } 47552a75d1c4Smrg *p = '\0'; 47562a75d1c4Smrg } 47572a75d1c4Smrg else 47582a75d1c4Smrg { 47592a75d1c4Smrg lt_fatal (__FILE__, __LINE__, 47602a75d1c4Smrg "error accessing file \"%s\": %s", 47612a75d1c4Smrg tmp_pathspec, nonnull (strerror (errno))); 47622a75d1c4Smrg } 47632a75d1c4Smrg } 47642a75d1c4Smrg XFREE (tmp_pathspec); 4765f7ec340bSmacallan 47662a75d1c4Smrg if (!has_symlinks) 47672a75d1c4Smrg { 47682a75d1c4Smrg return xstrdup (pathspec); 47692a75d1c4Smrg } 4770f7ec340bSmacallan 47712a75d1c4Smrg tmp_pathspec = realpath (pathspec, buf); 47722a75d1c4Smrg if (tmp_pathspec == 0) 47732a75d1c4Smrg { 47742a75d1c4Smrg lt_fatal (__FILE__, __LINE__, 47752a75d1c4Smrg "could not follow symlinks for %s", pathspec); 47762a75d1c4Smrg } 47772a75d1c4Smrg return xstrdup (tmp_pathspec); 47782a75d1c4Smrg#endif 4779f7ec340bSmacallan} 4780f7ec340bSmacallan 47812a75d1c4Smrgchar * 47822a75d1c4Smrgstrendzap (char *str, const char *pat) 47832a75d1c4Smrg{ 47842a75d1c4Smrg size_t len, patlen; 4785f7ec340bSmacallan 47862a75d1c4Smrg assert (str != NULL); 47872a75d1c4Smrg assert (pat != NULL); 4788f7ec340bSmacallan 47892a75d1c4Smrg len = strlen (str); 47902a75d1c4Smrg patlen = strlen (pat); 4791f7ec340bSmacallan 47922a75d1c4Smrg if (patlen <= len) 47932a75d1c4Smrg { 47942a75d1c4Smrg str += len - patlen; 47952a75d1c4Smrg if (strcmp (str, pat) == 0) 47962a75d1c4Smrg *str = '\0'; 47972a75d1c4Smrg } 47982a75d1c4Smrg return str; 47992a75d1c4Smrg} 4800f7ec340bSmacallan 48012a75d1c4Smrgvoid 48022a75d1c4Smrglt_debugprintf (const char *file, int line, const char *fmt, ...) 48032a75d1c4Smrg{ 48042a75d1c4Smrg va_list args; 48052a75d1c4Smrg if (lt_debug) 48062a75d1c4Smrg { 48072a75d1c4Smrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 48082a75d1c4Smrg va_start (args, fmt); 48092a75d1c4Smrg (void) vfprintf (stderr, fmt, args); 48102a75d1c4Smrg va_end (args); 48112a75d1c4Smrg } 48122a75d1c4Smrg} 4813f7ec340bSmacallan 48142a75d1c4Smrgstatic void 48152a75d1c4Smrglt_error_core (int exit_status, const char *file, 48162a75d1c4Smrg int line, const char *mode, 48172a75d1c4Smrg const char *message, va_list ap) 48182a75d1c4Smrg{ 48192a75d1c4Smrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 48202a75d1c4Smrg vfprintf (stderr, message, ap); 48212a75d1c4Smrg fprintf (stderr, ".\n"); 4822f7ec340bSmacallan 48232a75d1c4Smrg if (exit_status >= 0) 48242a75d1c4Smrg exit (exit_status); 48252a75d1c4Smrg} 4826f7ec340bSmacallan 48272a75d1c4Smrgvoid 48282a75d1c4Smrglt_fatal (const char *file, int line, const char *message, ...) 48292a75d1c4Smrg{ 48302a75d1c4Smrg va_list ap; 48312a75d1c4Smrg va_start (ap, message); 48322a75d1c4Smrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 48332a75d1c4Smrg va_end (ap); 48342a75d1c4Smrg} 4835f7ec340bSmacallan 48362a75d1c4Smrgstatic const char * 48372a75d1c4Smrgnonnull (const char *s) 48382a75d1c4Smrg{ 48392a75d1c4Smrg return s ? s : "(null)"; 48402a75d1c4Smrg} 4841f7ec340bSmacallan 48422a75d1c4Smrgstatic const char * 48432a75d1c4Smrgnonempty (const char *s) 48442a75d1c4Smrg{ 48452a75d1c4Smrg return (s && !*s) ? "(empty)" : nonnull (s); 48462a75d1c4Smrg} 4847f7ec340bSmacallan 48482a75d1c4Smrgvoid 48492a75d1c4Smrglt_setenv (const char *name, const char *value) 48502a75d1c4Smrg{ 48512a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 48522a75d1c4Smrg "(lt_setenv) setting '%s' to '%s'\n", 48532a75d1c4Smrg nonnull (name), nonnull (value)); 48542a75d1c4Smrg { 48552a75d1c4Smrg#ifdef HAVE_SETENV 48562a75d1c4Smrg /* always make a copy, for consistency with !HAVE_SETENV */ 48572a75d1c4Smrg char *str = xstrdup (value); 48582a75d1c4Smrg setenv (name, str, 1); 4859f7ec340bSmacallan#else 48602a75d1c4Smrg int len = strlen (name) + 1 + strlen (value) + 1; 48612a75d1c4Smrg char *str = XMALLOC (char, len); 48622a75d1c4Smrg sprintf (str, "%s=%s", name, value); 48632a75d1c4Smrg if (putenv (str) != EXIT_SUCCESS) 48642a75d1c4Smrg { 48652a75d1c4Smrg XFREE (str); 48662a75d1c4Smrg } 4867f7ec340bSmacallan#endif 48682a75d1c4Smrg } 48692a75d1c4Smrg} 4870f7ec340bSmacallan 48712a75d1c4Smrgchar * 48722a75d1c4Smrglt_extend_str (const char *orig_value, const char *add, int to_end) 48732a75d1c4Smrg{ 48742a75d1c4Smrg char *new_value; 48752a75d1c4Smrg if (orig_value && *orig_value) 48762a75d1c4Smrg { 48772a75d1c4Smrg int orig_value_len = strlen (orig_value); 48782a75d1c4Smrg int add_len = strlen (add); 48792a75d1c4Smrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 48802a75d1c4Smrg if (to_end) 48812a75d1c4Smrg { 48822a75d1c4Smrg strcpy (new_value, orig_value); 48832a75d1c4Smrg strcpy (new_value + orig_value_len, add); 48842a75d1c4Smrg } 48852a75d1c4Smrg else 48862a75d1c4Smrg { 48872a75d1c4Smrg strcpy (new_value, add); 48882a75d1c4Smrg strcpy (new_value + add_len, orig_value); 48892a75d1c4Smrg } 48902a75d1c4Smrg } 48912a75d1c4Smrg else 48922a75d1c4Smrg { 48932a75d1c4Smrg new_value = xstrdup (add); 48942a75d1c4Smrg } 48952a75d1c4Smrg return new_value; 48962a75d1c4Smrg} 4897f7ec340bSmacallan 48982a75d1c4Smrgvoid 48992a75d1c4Smrglt_update_exe_path (const char *name, const char *value) 49002a75d1c4Smrg{ 49012a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 49022a75d1c4Smrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 49032a75d1c4Smrg nonnull (name), nonnull (value)); 4904f7ec340bSmacallan 49052a75d1c4Smrg if (name && *name && value && *value) 49062a75d1c4Smrg { 49072a75d1c4Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 49082a75d1c4Smrg /* some systems can't cope with a ':'-terminated path #' */ 49092a75d1c4Smrg int len = strlen (new_value); 49102a75d1c4Smrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 49112a75d1c4Smrg { 49122a75d1c4Smrg new_value[len-1] = '\0'; 49132a75d1c4Smrg } 49142a75d1c4Smrg lt_setenv (name, new_value); 49152a75d1c4Smrg XFREE (new_value); 49162a75d1c4Smrg } 49172a75d1c4Smrg} 4918f7ec340bSmacallan 49192a75d1c4Smrgvoid 49202a75d1c4Smrglt_update_lib_path (const char *name, const char *value) 4921f7ec340bSmacallan{ 49222a75d1c4Smrg lt_debugprintf (__FILE__, __LINE__, 49232a75d1c4Smrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 49242a75d1c4Smrg nonnull (name), nonnull (value)); 4925f7ec340bSmacallan 49262a75d1c4Smrg if (name && *name && value && *value) 49272a75d1c4Smrg { 49282a75d1c4Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 49292a75d1c4Smrg lt_setenv (name, new_value); 49302a75d1c4Smrg XFREE (new_value); 49312a75d1c4Smrg } 49322a75d1c4Smrg} 4933f7ec340bSmacallan 4934f7ec340bSmacallanEOF 49352a75d1c4Smrg case $host_os in 49362a75d1c4Smrg mingw*) 49372a75d1c4Smrg cat <<"EOF" 49382a75d1c4Smrg 49392a75d1c4Smrg/* Prepares an argument vector before calling spawn(). 49402a75d1c4Smrg Note that spawn() does not by itself call the command interpreter 49412a75d1c4Smrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 49422a75d1c4Smrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 49432a75d1c4Smrg GetVersionEx(&v); 49442a75d1c4Smrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 49452a75d1c4Smrg }) ? "cmd.exe" : "command.com"). 49462a75d1c4Smrg Instead it simply concatenates the arguments, separated by ' ', and calls 49472a75d1c4Smrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 49482a75d1c4Smrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 49492a75d1c4Smrg special way: 49502a75d1c4Smrg - Space and tab are interpreted as delimiters. They are not treated as 49512a75d1c4Smrg delimiters if they are surrounded by double quotes: "...". 49522a75d1c4Smrg - Unescaped double quotes are removed from the input. Their only effect is 49532a75d1c4Smrg that within double quotes, space and tab are treated like normal 49542a75d1c4Smrg characters. 49552a75d1c4Smrg - Backslashes not followed by double quotes are not special. 49562a75d1c4Smrg - But 2*n+1 backslashes followed by a double quote become 49572a75d1c4Smrg n backslashes followed by a double quote (n >= 0): 49582a75d1c4Smrg \" -> " 49592a75d1c4Smrg \\\" -> \" 49602a75d1c4Smrg \\\\\" -> \\" 49612a75d1c4Smrg */ 49622a75d1c4Smrg#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" 49632a75d1c4Smrg#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" 49642a75d1c4Smrgchar ** 49652a75d1c4Smrgprepare_spawn (char **argv) 49662a75d1c4Smrg{ 49672a75d1c4Smrg size_t argc; 49682a75d1c4Smrg char **new_argv; 49692a75d1c4Smrg size_t i; 4970f7ec340bSmacallan 49712a75d1c4Smrg /* Count number of arguments. */ 49722a75d1c4Smrg for (argc = 0; argv[argc] != NULL; argc++) 4973f7ec340bSmacallan ; 4974f7ec340bSmacallan 49752a75d1c4Smrg /* Allocate new argument vector. */ 49762a75d1c4Smrg new_argv = XMALLOC (char *, argc + 1); 4977f7ec340bSmacallan 49782a75d1c4Smrg /* Put quoted arguments into the new argument vector. */ 49792a75d1c4Smrg for (i = 0; i < argc; i++) 49802a75d1c4Smrg { 49812a75d1c4Smrg const char *string = argv[i]; 49822a75d1c4Smrg 49832a75d1c4Smrg if (string[0] == '\0') 49842a75d1c4Smrg new_argv[i] = xstrdup ("\"\""); 49852a75d1c4Smrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 49862a75d1c4Smrg { 49872a75d1c4Smrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 49882a75d1c4Smrg size_t length; 49892a75d1c4Smrg unsigned int backslashes; 49902a75d1c4Smrg const char *s; 49912a75d1c4Smrg char *quoted_string; 49922a75d1c4Smrg char *p; 49932a75d1c4Smrg 49942a75d1c4Smrg length = 0; 49952a75d1c4Smrg backslashes = 0; 49962a75d1c4Smrg if (quote_around) 49972a75d1c4Smrg length++; 49982a75d1c4Smrg for (s = string; *s != '\0'; s++) 49992a75d1c4Smrg { 50002a75d1c4Smrg char c = *s; 50012a75d1c4Smrg if (c == '"') 50022a75d1c4Smrg length += backslashes + 1; 50032a75d1c4Smrg length++; 50042a75d1c4Smrg if (c == '\\') 50052a75d1c4Smrg backslashes++; 50062a75d1c4Smrg else 50072a75d1c4Smrg backslashes = 0; 50082a75d1c4Smrg } 50092a75d1c4Smrg if (quote_around) 50102a75d1c4Smrg length += backslashes + 1; 50112a75d1c4Smrg 50122a75d1c4Smrg quoted_string = XMALLOC (char, length + 1); 50132a75d1c4Smrg 50142a75d1c4Smrg p = quoted_string; 50152a75d1c4Smrg backslashes = 0; 50162a75d1c4Smrg if (quote_around) 50172a75d1c4Smrg *p++ = '"'; 50182a75d1c4Smrg for (s = string; *s != '\0'; s++) 50192a75d1c4Smrg { 50202a75d1c4Smrg char c = *s; 50212a75d1c4Smrg if (c == '"') 50222a75d1c4Smrg { 50232a75d1c4Smrg unsigned int j; 50242a75d1c4Smrg for (j = backslashes + 1; j > 0; j--) 50252a75d1c4Smrg *p++ = '\\'; 50262a75d1c4Smrg } 50272a75d1c4Smrg *p++ = c; 50282a75d1c4Smrg if (c == '\\') 50292a75d1c4Smrg backslashes++; 50302a75d1c4Smrg else 50312a75d1c4Smrg backslashes = 0; 50322a75d1c4Smrg } 50332a75d1c4Smrg if (quote_around) 50342a75d1c4Smrg { 50352a75d1c4Smrg unsigned int j; 50362a75d1c4Smrg for (j = backslashes; j > 0; j--) 50372a75d1c4Smrg *p++ = '\\'; 50382a75d1c4Smrg *p++ = '"'; 50392a75d1c4Smrg } 50402a75d1c4Smrg *p = '\0'; 50412a75d1c4Smrg 50422a75d1c4Smrg new_argv[i] = quoted_string; 50432a75d1c4Smrg } 50442a75d1c4Smrg else 50452a75d1c4Smrg new_argv[i] = (char *) string; 50462a75d1c4Smrg } 50472a75d1c4Smrg new_argv[argc] = NULL; 5048f7ec340bSmacallan 50492a75d1c4Smrg return new_argv; 5050f7ec340bSmacallan} 50512a75d1c4SmrgEOF 50522a75d1c4Smrg ;; 50532a75d1c4Smrg esac 5054f7ec340bSmacallan 50552a75d1c4Smrg cat <<"EOF" 50562a75d1c4Smrgvoid lt_dump_script (FILE* f) 5057f7ec340bSmacallan{ 50582a75d1c4SmrgEOF 50592a75d1c4Smrg func_emit_wrapper yes | 50602a75d1c4Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 50612a75d1c4Smrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 5062f7ec340bSmacallan 50632a75d1c4Smrg cat <<"EOF" 5064f7ec340bSmacallan} 50652a75d1c4SmrgEOF 5066f7ec340bSmacallan} 50672a75d1c4Smrg# end: func_emit_cwrapperexe_src 5068f7ec340bSmacallan 50692a75d1c4Smrg# func_win32_import_lib_p ARG 50702a75d1c4Smrg# True if ARG is an import lib, as indicated by $file_magic_cmd 50712a75d1c4Smrgfunc_win32_import_lib_p () 5072f7ec340bSmacallan{ 50732a75d1c4Smrg $opt_debug 50742a75d1c4Smrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 50752a75d1c4Smrg *import*) : ;; 50762a75d1c4Smrg *) false ;; 50772a75d1c4Smrg esac 5078f7ec340bSmacallan} 5079f7ec340bSmacallan 50802a75d1c4Smrg# func_mode_link arg... 50812a75d1c4Smrgfunc_mode_link () 5082f7ec340bSmacallan{ 50832a75d1c4Smrg $opt_debug 50842a75d1c4Smrg case $host in 50852a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 50862a75d1c4Smrg # It is impossible to link a dll without this setting, and 50872a75d1c4Smrg # we shouldn't force the makefile maintainer to figure out 50882a75d1c4Smrg # which system we are compiling for in order to pass an extra 50892a75d1c4Smrg # flag for every libtool invocation. 50902a75d1c4Smrg # allow_undefined=no 5091f7ec340bSmacallan 50922a75d1c4Smrg # FIXME: Unfortunately, there are problems with the above when trying 50932a75d1c4Smrg # to make a dll which has undefined symbols, in which case not 50942a75d1c4Smrg # even a static library is built. For now, we need to specify 50952a75d1c4Smrg # -no-undefined on the libtool link line when we can be certain 50962a75d1c4Smrg # that all symbols are satisfied, otherwise we get a static library. 50972a75d1c4Smrg allow_undefined=yes 50982a75d1c4Smrg ;; 50992a75d1c4Smrg *) 51002a75d1c4Smrg allow_undefined=yes 51012a75d1c4Smrg ;; 51022a75d1c4Smrg esac 51032a75d1c4Smrg libtool_args=$nonopt 51042a75d1c4Smrg base_compile="$nonopt $@" 51052a75d1c4Smrg compile_command=$nonopt 51062a75d1c4Smrg finalize_command=$nonopt 5107f7ec340bSmacallan 51082a75d1c4Smrg compile_rpath= 51092a75d1c4Smrg finalize_rpath= 51102a75d1c4Smrg compile_shlibpath= 51112a75d1c4Smrg finalize_shlibpath= 51122a75d1c4Smrg convenience= 51132a75d1c4Smrg old_convenience= 51142a75d1c4Smrg deplibs= 51152a75d1c4Smrg old_deplibs= 51162a75d1c4Smrg compiler_flags= 51172a75d1c4Smrg linker_flags= 51182a75d1c4Smrg dllsearchpath= 51192a75d1c4Smrg lib_search_path=`pwd` 51202a75d1c4Smrg inst_prefix_dir= 51212a75d1c4Smrg new_inherited_linker_flags= 5122f7ec340bSmacallan 51232a75d1c4Smrg avoid_version=no 51242a75d1c4Smrg bindir= 51252a75d1c4Smrg dlfiles= 51262a75d1c4Smrg dlprefiles= 51272a75d1c4Smrg dlself=no 51282a75d1c4Smrg export_dynamic=no 51292a75d1c4Smrg export_symbols= 51302a75d1c4Smrg export_symbols_regex= 51312a75d1c4Smrg generated= 51322a75d1c4Smrg libobjs= 51332a75d1c4Smrg ltlibs= 51342a75d1c4Smrg module=no 51352a75d1c4Smrg no_install=no 51362a75d1c4Smrg objs= 51372a75d1c4Smrg non_pic_objects= 51382a75d1c4Smrg precious_files_regex= 51392a75d1c4Smrg prefer_static_libs=no 51402a75d1c4Smrg preload=no 51412a75d1c4Smrg prev= 51422a75d1c4Smrg prevarg= 51432a75d1c4Smrg release= 51442a75d1c4Smrg rpath= 51452a75d1c4Smrg xrpath= 51462a75d1c4Smrg perm_rpath= 51472a75d1c4Smrg temp_rpath= 51482a75d1c4Smrg thread_safe=no 51492a75d1c4Smrg vinfo= 51502a75d1c4Smrg vinfo_number=no 51512a75d1c4Smrg weak_libs= 51522a75d1c4Smrg single_module="${wl}-single_module" 51532a75d1c4Smrg func_infer_tag $base_compile 5154f7ec340bSmacallan 51552a75d1c4Smrg # We need to know -static, to get the right output filenames. 51562a75d1c4Smrg for arg 51572a75d1c4Smrg do 51582a75d1c4Smrg case $arg in 51592a75d1c4Smrg -shared) 51602a75d1c4Smrg test "$build_libtool_libs" != yes && \ 51612a75d1c4Smrg func_fatal_configuration "can not build a shared library" 51622a75d1c4Smrg build_old_libs=no 51632a75d1c4Smrg break 51642a75d1c4Smrg ;; 51652a75d1c4Smrg -all-static | -static | -static-libtool-libs) 51662a75d1c4Smrg case $arg in 51672a75d1c4Smrg -all-static) 51682a75d1c4Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 51692a75d1c4Smrg func_warning "complete static linking is impossible in this configuration" 51702a75d1c4Smrg fi 51712a75d1c4Smrg if test -n "$link_static_flag"; then 51722a75d1c4Smrg dlopen_self=$dlopen_self_static 51732a75d1c4Smrg fi 51742a75d1c4Smrg prefer_static_libs=yes 51752a75d1c4Smrg ;; 51762a75d1c4Smrg -static) 51772a75d1c4Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 51782a75d1c4Smrg dlopen_self=$dlopen_self_static 51792a75d1c4Smrg fi 51802a75d1c4Smrg prefer_static_libs=built 51812a75d1c4Smrg ;; 51822a75d1c4Smrg -static-libtool-libs) 51832a75d1c4Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 51842a75d1c4Smrg dlopen_self=$dlopen_self_static 51852a75d1c4Smrg fi 51862a75d1c4Smrg prefer_static_libs=yes 51872a75d1c4Smrg ;; 51882a75d1c4Smrg esac 51892a75d1c4Smrg build_libtool_libs=no 51902a75d1c4Smrg build_old_libs=yes 51912a75d1c4Smrg break 51922a75d1c4Smrg ;; 51932a75d1c4Smrg esac 51942a75d1c4Smrg done 5195f7ec340bSmacallan 51962a75d1c4Smrg # See if our shared archives depend on static archives. 51972a75d1c4Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5198f7ec340bSmacallan 51992a75d1c4Smrg # Go through the arguments, transforming them on the way. 52002a75d1c4Smrg while test "$#" -gt 0; do 52012a75d1c4Smrg arg="$1" 52022a75d1c4Smrg shift 52032a75d1c4Smrg func_quote_for_eval "$arg" 52042a75d1c4Smrg qarg=$func_quote_for_eval_unquoted_result 52052a75d1c4Smrg func_append libtool_args " $func_quote_for_eval_result" 5206f7ec340bSmacallan 52072a75d1c4Smrg # If the previous option needs an argument, assign it. 52082a75d1c4Smrg if test -n "$prev"; then 52092a75d1c4Smrg case $prev in 52102a75d1c4Smrg output) 52112a75d1c4Smrg func_append compile_command " @OUTPUT@" 52122a75d1c4Smrg func_append finalize_command " @OUTPUT@" 52132a75d1c4Smrg ;; 52142a75d1c4Smrg esac 5215f7ec340bSmacallan 52162a75d1c4Smrg case $prev in 52172a75d1c4Smrg bindir) 52182a75d1c4Smrg bindir="$arg" 52192a75d1c4Smrg prev= 52202a75d1c4Smrg continue 52212a75d1c4Smrg ;; 52222a75d1c4Smrg dlfiles|dlprefiles) 52232a75d1c4Smrg if test "$preload" = no; then 52242a75d1c4Smrg # Add the symbol object into the linking commands. 52252a75d1c4Smrg func_append compile_command " @SYMFILE@" 52262a75d1c4Smrg func_append finalize_command " @SYMFILE@" 52272a75d1c4Smrg preload=yes 52282a75d1c4Smrg fi 52292a75d1c4Smrg case $arg in 52302a75d1c4Smrg *.la | *.lo) ;; # We handle these cases below. 52312a75d1c4Smrg force) 52322a75d1c4Smrg if test "$dlself" = no; then 52332a75d1c4Smrg dlself=needless 52342a75d1c4Smrg export_dynamic=yes 52352a75d1c4Smrg fi 52362a75d1c4Smrg prev= 52372a75d1c4Smrg continue 52382a75d1c4Smrg ;; 52392a75d1c4Smrg self) 52402a75d1c4Smrg if test "$prev" = dlprefiles; then 52412a75d1c4Smrg dlself=yes 52422a75d1c4Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 52432a75d1c4Smrg dlself=yes 52442a75d1c4Smrg else 52452a75d1c4Smrg dlself=needless 52462a75d1c4Smrg export_dynamic=yes 52472a75d1c4Smrg fi 52482a75d1c4Smrg prev= 52492a75d1c4Smrg continue 52502a75d1c4Smrg ;; 52512a75d1c4Smrg *) 52522a75d1c4Smrg if test "$prev" = dlfiles; then 52532a75d1c4Smrg func_append dlfiles " $arg" 52542a75d1c4Smrg else 52552a75d1c4Smrg func_append dlprefiles " $arg" 52562a75d1c4Smrg fi 52572a75d1c4Smrg prev= 52582a75d1c4Smrg continue 52592a75d1c4Smrg ;; 52602a75d1c4Smrg esac 52612a75d1c4Smrg ;; 52622a75d1c4Smrg expsyms) 52632a75d1c4Smrg export_symbols="$arg" 52642a75d1c4Smrg test -f "$arg" \ 52652a75d1c4Smrg || func_fatal_error "symbol file \`$arg' does not exist" 52662a75d1c4Smrg prev= 52672a75d1c4Smrg continue 52682a75d1c4Smrg ;; 52692a75d1c4Smrg expsyms_regex) 52702a75d1c4Smrg export_symbols_regex="$arg" 52712a75d1c4Smrg prev= 52722a75d1c4Smrg continue 52732a75d1c4Smrg ;; 52742a75d1c4Smrg framework) 52752a75d1c4Smrg case $host in 52762a75d1c4Smrg *-*-darwin*) 52772a75d1c4Smrg case "$deplibs " in 52782a75d1c4Smrg *" $qarg.ltframework "*) ;; 52792a75d1c4Smrg *) func_append deplibs " $qarg.ltframework" # this is fixed later 52802a75d1c4Smrg ;; 52812a75d1c4Smrg esac 52822a75d1c4Smrg ;; 52832a75d1c4Smrg esac 52842a75d1c4Smrg prev= 52852a75d1c4Smrg continue 52862a75d1c4Smrg ;; 52872a75d1c4Smrg inst_prefix) 52882a75d1c4Smrg inst_prefix_dir="$arg" 52892a75d1c4Smrg prev= 52902a75d1c4Smrg continue 52912a75d1c4Smrg ;; 52922a75d1c4Smrg objectlist) 52932a75d1c4Smrg if test -f "$arg"; then 52942a75d1c4Smrg save_arg=$arg 52952a75d1c4Smrg moreargs= 52962a75d1c4Smrg for fil in `cat "$save_arg"` 52972a75d1c4Smrg do 52982a75d1c4Smrg# func_append moreargs " $fil" 52992a75d1c4Smrg arg=$fil 53002a75d1c4Smrg # A libtool-controlled object. 5301f7ec340bSmacallan 53022a75d1c4Smrg # Check to see that this really is a libtool object. 53032a75d1c4Smrg if func_lalib_unsafe_p "$arg"; then 53042a75d1c4Smrg pic_object= 53052a75d1c4Smrg non_pic_object= 5306f7ec340bSmacallan 53072a75d1c4Smrg # Read the .lo file 53082a75d1c4Smrg func_source "$arg" 5309f7ec340bSmacallan 53102a75d1c4Smrg if test -z "$pic_object" || 53112a75d1c4Smrg test -z "$non_pic_object" || 53122a75d1c4Smrg test "$pic_object" = none && 53132a75d1c4Smrg test "$non_pic_object" = none; then 53142a75d1c4Smrg func_fatal_error "cannot find name of object for \`$arg'" 53152a75d1c4Smrg fi 5316f7ec340bSmacallan 53172a75d1c4Smrg # Extract subdirectory from the argument. 53182a75d1c4Smrg func_dirname "$arg" "/" "" 53192a75d1c4Smrg xdir="$func_dirname_result" 5320f7ec340bSmacallan 53212a75d1c4Smrg if test "$pic_object" != none; then 53222a75d1c4Smrg # Prepend the subdirectory the object is found in. 53232a75d1c4Smrg pic_object="$xdir$pic_object" 5324f7ec340bSmacallan 53252a75d1c4Smrg if test "$prev" = dlfiles; then 53262a75d1c4Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 53272a75d1c4Smrg func_append dlfiles " $pic_object" 53282a75d1c4Smrg prev= 53292a75d1c4Smrg continue 53302a75d1c4Smrg else 53312a75d1c4Smrg # If libtool objects are unsupported, then we need to preload. 53322a75d1c4Smrg prev=dlprefiles 53332a75d1c4Smrg fi 53342a75d1c4Smrg fi 5335f7ec340bSmacallan 53362a75d1c4Smrg # CHECK ME: I think I busted this. -Ossama 53372a75d1c4Smrg if test "$prev" = dlprefiles; then 53382a75d1c4Smrg # Preload the old-style object. 53392a75d1c4Smrg func_append dlprefiles " $pic_object" 53402a75d1c4Smrg prev= 53412a75d1c4Smrg fi 53427ce7e03cSmrg 53432a75d1c4Smrg # A PIC object. 53442a75d1c4Smrg func_append libobjs " $pic_object" 53452a75d1c4Smrg arg="$pic_object" 53462a75d1c4Smrg fi 5347f7ec340bSmacallan 53482a75d1c4Smrg # Non-PIC object. 53492a75d1c4Smrg if test "$non_pic_object" != none; then 53502a75d1c4Smrg # Prepend the subdirectory the object is found in. 53512a75d1c4Smrg non_pic_object="$xdir$non_pic_object" 5352f7ec340bSmacallan 53532a75d1c4Smrg # A standard non-PIC object 53542a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 53552a75d1c4Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 53562a75d1c4Smrg arg="$non_pic_object" 53572a75d1c4Smrg fi 53582a75d1c4Smrg else 53592a75d1c4Smrg # If the PIC object exists, use it instead. 53602a75d1c4Smrg # $xdir was prepended to $pic_object above. 53612a75d1c4Smrg non_pic_object="$pic_object" 53622a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 53632a75d1c4Smrg fi 53642a75d1c4Smrg else 53652a75d1c4Smrg # Only an error if not doing a dry-run. 53662a75d1c4Smrg if $opt_dry_run; then 53672a75d1c4Smrg # Extract subdirectory from the argument. 53682a75d1c4Smrg func_dirname "$arg" "/" "" 53692a75d1c4Smrg xdir="$func_dirname_result" 53702a75d1c4Smrg 53712a75d1c4Smrg func_lo2o "$arg" 53722a75d1c4Smrg pic_object=$xdir$objdir/$func_lo2o_result 53732a75d1c4Smrg non_pic_object=$xdir$func_lo2o_result 53742a75d1c4Smrg func_append libobjs " $pic_object" 53752a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 53762a75d1c4Smrg else 53772a75d1c4Smrg func_fatal_error "\`$arg' is not a valid libtool object" 53782a75d1c4Smrg fi 53792a75d1c4Smrg fi 53802a75d1c4Smrg done 53812a75d1c4Smrg else 53822a75d1c4Smrg func_fatal_error "link input file \`$arg' does not exist" 53832a75d1c4Smrg fi 53842a75d1c4Smrg arg=$save_arg 53852a75d1c4Smrg prev= 53862a75d1c4Smrg continue 53872a75d1c4Smrg ;; 53882a75d1c4Smrg precious_regex) 53892a75d1c4Smrg precious_files_regex="$arg" 53902a75d1c4Smrg prev= 53912a75d1c4Smrg continue 53922a75d1c4Smrg ;; 53932a75d1c4Smrg release) 53942a75d1c4Smrg release="-$arg" 53952a75d1c4Smrg prev= 53962a75d1c4Smrg continue 53972a75d1c4Smrg ;; 53982a75d1c4Smrg rpath | xrpath) 53992a75d1c4Smrg # We need an absolute path. 54002a75d1c4Smrg case $arg in 54012a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 54022a75d1c4Smrg *) 54032a75d1c4Smrg func_fatal_error "only absolute run-paths are allowed" 54042a75d1c4Smrg ;; 54052a75d1c4Smrg esac 54062a75d1c4Smrg if test "$prev" = rpath; then 54072a75d1c4Smrg case "$rpath " in 54082a75d1c4Smrg *" $arg "*) ;; 54092a75d1c4Smrg *) func_append rpath " $arg" ;; 54102a75d1c4Smrg esac 54112a75d1c4Smrg else 54122a75d1c4Smrg case "$xrpath " in 54132a75d1c4Smrg *" $arg "*) ;; 54142a75d1c4Smrg *) func_append xrpath " $arg" ;; 54152a75d1c4Smrg esac 54162a75d1c4Smrg fi 54172a75d1c4Smrg prev= 54182a75d1c4Smrg continue 54192a75d1c4Smrg ;; 54202a75d1c4Smrg shrext) 54212a75d1c4Smrg shrext_cmds="$arg" 54222a75d1c4Smrg prev= 54232a75d1c4Smrg continue 54242a75d1c4Smrg ;; 54252a75d1c4Smrg weak) 54262a75d1c4Smrg func_append weak_libs " $arg" 54272a75d1c4Smrg prev= 54282a75d1c4Smrg continue 54292a75d1c4Smrg ;; 54302a75d1c4Smrg xcclinker) 54312a75d1c4Smrg func_append linker_flags " $qarg" 54322a75d1c4Smrg func_append compiler_flags " $qarg" 54332a75d1c4Smrg prev= 54342a75d1c4Smrg func_append compile_command " $qarg" 54352a75d1c4Smrg func_append finalize_command " $qarg" 54362a75d1c4Smrg continue 54372a75d1c4Smrg ;; 54382a75d1c4Smrg xcompiler) 54392a75d1c4Smrg func_append compiler_flags " $qarg" 54402a75d1c4Smrg prev= 54412a75d1c4Smrg func_append compile_command " $qarg" 54422a75d1c4Smrg func_append finalize_command " $qarg" 54432a75d1c4Smrg continue 54442a75d1c4Smrg ;; 54452a75d1c4Smrg xlinker) 54462a75d1c4Smrg func_append linker_flags " $qarg" 54472a75d1c4Smrg func_append compiler_flags " $wl$qarg" 54482a75d1c4Smrg prev= 54492a75d1c4Smrg func_append compile_command " $wl$qarg" 54502a75d1c4Smrg func_append finalize_command " $wl$qarg" 54512a75d1c4Smrg continue 54522a75d1c4Smrg ;; 54532a75d1c4Smrg *) 54542a75d1c4Smrg eval "$prev=\"\$arg\"" 54552a75d1c4Smrg prev= 54562a75d1c4Smrg continue 54572a75d1c4Smrg ;; 54582a75d1c4Smrg esac 54592a75d1c4Smrg fi # test -n "$prev" 5460f7ec340bSmacallan 54612a75d1c4Smrg prevarg="$arg" 5462f7ec340bSmacallan 54632a75d1c4Smrg case $arg in 54642a75d1c4Smrg -all-static) 54652a75d1c4Smrg if test -n "$link_static_flag"; then 54662a75d1c4Smrg # See comment for -static flag below, for more details. 54672a75d1c4Smrg func_append compile_command " $link_static_flag" 54682a75d1c4Smrg func_append finalize_command " $link_static_flag" 54692a75d1c4Smrg fi 54702a75d1c4Smrg continue 54712a75d1c4Smrg ;; 5472f7ec340bSmacallan 54732a75d1c4Smrg -allow-undefined) 54742a75d1c4Smrg # FIXME: remove this flag sometime in the future. 54752a75d1c4Smrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 54762a75d1c4Smrg ;; 5477f7ec340bSmacallan 54782a75d1c4Smrg -avoid-version) 54792a75d1c4Smrg avoid_version=yes 54802a75d1c4Smrg continue 54812a75d1c4Smrg ;; 5482f7ec340bSmacallan 54832a75d1c4Smrg -bindir) 54842a75d1c4Smrg prev=bindir 54852a75d1c4Smrg continue 54862a75d1c4Smrg ;; 54872a75d1c4Smrg 54882a75d1c4Smrg -dlopen) 54892a75d1c4Smrg prev=dlfiles 54902a75d1c4Smrg continue 54912a75d1c4Smrg ;; 54922a75d1c4Smrg 54932a75d1c4Smrg -dlpreopen) 54942a75d1c4Smrg prev=dlprefiles 54952a75d1c4Smrg continue 54962a75d1c4Smrg ;; 54972a75d1c4Smrg 54982a75d1c4Smrg -export-dynamic) 54992a75d1c4Smrg export_dynamic=yes 55002a75d1c4Smrg continue 55012a75d1c4Smrg ;; 55022a75d1c4Smrg 55032a75d1c4Smrg -export-symbols | -export-symbols-regex) 55042a75d1c4Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 55052a75d1c4Smrg func_fatal_error "more than one -exported-symbols argument is not allowed" 55062a75d1c4Smrg fi 55072a75d1c4Smrg if test "X$arg" = "X-export-symbols"; then 55082a75d1c4Smrg prev=expsyms 55092a75d1c4Smrg else 55102a75d1c4Smrg prev=expsyms_regex 55112a75d1c4Smrg fi 55122a75d1c4Smrg continue 55132a75d1c4Smrg ;; 55142a75d1c4Smrg 55152a75d1c4Smrg -framework) 55162a75d1c4Smrg prev=framework 55172a75d1c4Smrg continue 55182a75d1c4Smrg ;; 55192a75d1c4Smrg 55202a75d1c4Smrg -inst-prefix-dir) 55212a75d1c4Smrg prev=inst_prefix 55222a75d1c4Smrg continue 55232a75d1c4Smrg ;; 55242a75d1c4Smrg 55252a75d1c4Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 55262a75d1c4Smrg # so, if we see these flags be careful not to treat them like -L 55272a75d1c4Smrg -L[A-Z][A-Z]*:*) 55282a75d1c4Smrg case $with_gcc/$host in 55292a75d1c4Smrg no/*-*-irix* | /*-*-irix*) 55302a75d1c4Smrg func_append compile_command " $arg" 55312a75d1c4Smrg func_append finalize_command " $arg" 55322a75d1c4Smrg ;; 55332a75d1c4Smrg esac 55342a75d1c4Smrg continue 55352a75d1c4Smrg ;; 55362a75d1c4Smrg 55372a75d1c4Smrg -L*) 55382a75d1c4Smrg func_stripname "-L" '' "$arg" 55392a75d1c4Smrg if test -z "$func_stripname_result"; then 55402a75d1c4Smrg if test "$#" -gt 0; then 55412a75d1c4Smrg func_fatal_error "require no space between \`-L' and \`$1'" 55422a75d1c4Smrg else 55432a75d1c4Smrg func_fatal_error "need path for \`-L' option" 55442a75d1c4Smrg fi 55452a75d1c4Smrg fi 55462a75d1c4Smrg func_resolve_sysroot "$func_stripname_result" 55472a75d1c4Smrg dir=$func_resolve_sysroot_result 55482a75d1c4Smrg # We need an absolute path. 55492a75d1c4Smrg case $dir in 55502a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 55512a75d1c4Smrg *) 55522a75d1c4Smrg absdir=`cd "$dir" && pwd` 55532a75d1c4Smrg test -z "$absdir" && \ 55542a75d1c4Smrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 55552a75d1c4Smrg dir="$absdir" 55562a75d1c4Smrg ;; 55572a75d1c4Smrg esac 55582a75d1c4Smrg case "$deplibs " in 55592a75d1c4Smrg *" -L$dir "* | *" $arg "*) 55602a75d1c4Smrg # Will only happen for absolute or sysroot arguments 55612a75d1c4Smrg ;; 55622a75d1c4Smrg *) 55632a75d1c4Smrg # Preserve sysroot, but never include relative directories 55642a75d1c4Smrg case $dir in 55652a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 55662a75d1c4Smrg *) func_append deplibs " -L$dir" ;; 55672a75d1c4Smrg esac 55682a75d1c4Smrg func_append lib_search_path " $dir" 55692a75d1c4Smrg ;; 55702a75d1c4Smrg esac 55712a75d1c4Smrg case $host in 55722a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 55732a75d1c4Smrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 55742a75d1c4Smrg case :$dllsearchpath: in 55752a75d1c4Smrg *":$dir:"*) ;; 55762a75d1c4Smrg ::) dllsearchpath=$dir;; 55772a75d1c4Smrg *) func_append dllsearchpath ":$dir";; 55782a75d1c4Smrg esac 55792a75d1c4Smrg case :$dllsearchpath: in 55802a75d1c4Smrg *":$testbindir:"*) ;; 55812a75d1c4Smrg ::) dllsearchpath=$testbindir;; 55822a75d1c4Smrg *) func_append dllsearchpath ":$testbindir";; 55832a75d1c4Smrg esac 55842a75d1c4Smrg ;; 55852a75d1c4Smrg esac 55862a75d1c4Smrg continue 55872a75d1c4Smrg ;; 55882a75d1c4Smrg 55892a75d1c4Smrg -l*) 55902a75d1c4Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 55912a75d1c4Smrg case $host in 55922a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 55932a75d1c4Smrg # These systems don't actually have a C or math library (as such) 55942a75d1c4Smrg continue 55952a75d1c4Smrg ;; 55962a75d1c4Smrg *-*-os2*) 55972a75d1c4Smrg # These systems don't actually have a C library (as such) 55982a75d1c4Smrg test "X$arg" = "X-lc" && continue 55992a75d1c4Smrg ;; 56002a75d1c4Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 56012a75d1c4Smrg # Do not include libc due to us having libc/libc_r. 56022a75d1c4Smrg test "X$arg" = "X-lc" && continue 56032a75d1c4Smrg ;; 56042a75d1c4Smrg *-*-rhapsody* | *-*-darwin1.[012]) 56052a75d1c4Smrg # Rhapsody C and math libraries are in the System framework 56062a75d1c4Smrg func_append deplibs " System.ltframework" 56072a75d1c4Smrg continue 56082a75d1c4Smrg ;; 56092a75d1c4Smrg *-*-sco3.2v5* | *-*-sco5v6*) 56102a75d1c4Smrg # Causes problems with __ctype 56112a75d1c4Smrg test "X$arg" = "X-lc" && continue 56122a75d1c4Smrg ;; 56132a75d1c4Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 56142a75d1c4Smrg # Compiler inserts libc in the correct place for threads to work 56152a75d1c4Smrg test "X$arg" = "X-lc" && continue 56162a75d1c4Smrg ;; 56172a75d1c4Smrg esac 56182a75d1c4Smrg elif test "X$arg" = "X-lc_r"; then 56192a75d1c4Smrg case $host in 56202a75d1c4Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 56212a75d1c4Smrg # Do not include libc_r directly, use -pthread flag. 56222a75d1c4Smrg continue 56232a75d1c4Smrg ;; 56242a75d1c4Smrg esac 56252a75d1c4Smrg fi 56262a75d1c4Smrg func_append deplibs " $arg" 56272a75d1c4Smrg continue 56282a75d1c4Smrg ;; 56292a75d1c4Smrg 56302a75d1c4Smrg -module) 56312a75d1c4Smrg module=yes 56322a75d1c4Smrg continue 56332a75d1c4Smrg ;; 56342a75d1c4Smrg 56352a75d1c4Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 56362a75d1c4Smrg # classes, name mangling, and exception handling. 56372a75d1c4Smrg # Darwin uses the -arch flag to determine output architecture. 56382a75d1c4Smrg -model|-arch|-isysroot|--sysroot) 56392a75d1c4Smrg func_append compiler_flags " $arg" 56402a75d1c4Smrg func_append compile_command " $arg" 56412a75d1c4Smrg func_append finalize_command " $arg" 56422a75d1c4Smrg prev=xcompiler 56432a75d1c4Smrg continue 56442a75d1c4Smrg ;; 56452a75d1c4Smrg 56462a75d1c4Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 56472a75d1c4Smrg func_append compiler_flags " $arg" 56482a75d1c4Smrg func_append compile_command " $arg" 56492a75d1c4Smrg func_append finalize_command " $arg" 56502a75d1c4Smrg case "$new_inherited_linker_flags " in 56512a75d1c4Smrg *" $arg "*) ;; 56522a75d1c4Smrg * ) func_append new_inherited_linker_flags " $arg" ;; 56532a75d1c4Smrg esac 56542a75d1c4Smrg continue 56552a75d1c4Smrg ;; 56562a75d1c4Smrg 56572a75d1c4Smrg -multi_module) 56582a75d1c4Smrg single_module="${wl}-multi_module" 56592a75d1c4Smrg continue 56602a75d1c4Smrg ;; 56612a75d1c4Smrg 56622a75d1c4Smrg -no-fast-install) 56632a75d1c4Smrg fast_install=no 56642a75d1c4Smrg continue 56652a75d1c4Smrg ;; 56662a75d1c4Smrg 56672a75d1c4Smrg -no-install) 56682a75d1c4Smrg case $host in 56692a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 56702a75d1c4Smrg # The PATH hackery in wrapper scripts is required on Windows 56712a75d1c4Smrg # and Darwin in order for the loader to find any dlls it needs. 56722a75d1c4Smrg func_warning "\`-no-install' is ignored for $host" 56732a75d1c4Smrg func_warning "assuming \`-no-fast-install' instead" 56742a75d1c4Smrg fast_install=no 56752a75d1c4Smrg ;; 56762a75d1c4Smrg *) no_install=yes ;; 56772a75d1c4Smrg esac 56782a75d1c4Smrg continue 56792a75d1c4Smrg ;; 56802a75d1c4Smrg 56812a75d1c4Smrg -no-undefined) 56822a75d1c4Smrg allow_undefined=no 56832a75d1c4Smrg continue 56842a75d1c4Smrg ;; 56852a75d1c4Smrg 56862a75d1c4Smrg -objectlist) 56872a75d1c4Smrg prev=objectlist 56882a75d1c4Smrg continue 56892a75d1c4Smrg ;; 56902a75d1c4Smrg 56912a75d1c4Smrg -o) prev=output ;; 56922a75d1c4Smrg 56932a75d1c4Smrg -precious-files-regex) 56942a75d1c4Smrg prev=precious_regex 56952a75d1c4Smrg continue 56962a75d1c4Smrg ;; 56972a75d1c4Smrg 56982a75d1c4Smrg -release) 56992a75d1c4Smrg prev=release 57002a75d1c4Smrg continue 57012a75d1c4Smrg ;; 57022a75d1c4Smrg 57032a75d1c4Smrg -rpath) 57042a75d1c4Smrg prev=rpath 57052a75d1c4Smrg continue 57062a75d1c4Smrg ;; 57072a75d1c4Smrg 57082a75d1c4Smrg -R) 57092a75d1c4Smrg prev=xrpath 57102a75d1c4Smrg continue 57112a75d1c4Smrg ;; 57122a75d1c4Smrg 57132a75d1c4Smrg -R*) 57142a75d1c4Smrg func_stripname '-R' '' "$arg" 57152a75d1c4Smrg dir=$func_stripname_result 57162a75d1c4Smrg # We need an absolute path. 57172a75d1c4Smrg case $dir in 57182a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 57192a75d1c4Smrg =*) 57202a75d1c4Smrg func_stripname '=' '' "$dir" 57212a75d1c4Smrg dir=$lt_sysroot$func_stripname_result 57222a75d1c4Smrg ;; 57232a75d1c4Smrg *) 57242a75d1c4Smrg func_fatal_error "only absolute run-paths are allowed" 57252a75d1c4Smrg ;; 57262a75d1c4Smrg esac 57272a75d1c4Smrg case "$xrpath " in 57282a75d1c4Smrg *" $dir "*) ;; 57292a75d1c4Smrg *) func_append xrpath " $dir" ;; 57302a75d1c4Smrg esac 57312a75d1c4Smrg continue 57322a75d1c4Smrg ;; 57332a75d1c4Smrg 57342a75d1c4Smrg -shared) 57352a75d1c4Smrg # The effects of -shared are defined in a previous loop. 57362a75d1c4Smrg continue 57372a75d1c4Smrg ;; 57382a75d1c4Smrg 57392a75d1c4Smrg -shrext) 57402a75d1c4Smrg prev=shrext 57412a75d1c4Smrg continue 57422a75d1c4Smrg ;; 57432a75d1c4Smrg 57442a75d1c4Smrg -static | -static-libtool-libs) 57452a75d1c4Smrg # The effects of -static are defined in a previous loop. 57462a75d1c4Smrg # We used to do the same as -all-static on platforms that 57472a75d1c4Smrg # didn't have a PIC flag, but the assumption that the effects 57482a75d1c4Smrg # would be equivalent was wrong. It would break on at least 57492a75d1c4Smrg # Digital Unix and AIX. 57502a75d1c4Smrg continue 57512a75d1c4Smrg ;; 57522a75d1c4Smrg 57532a75d1c4Smrg -thread-safe) 57542a75d1c4Smrg thread_safe=yes 57552a75d1c4Smrg continue 57562a75d1c4Smrg ;; 57572a75d1c4Smrg 57582a75d1c4Smrg -version-info) 57592a75d1c4Smrg prev=vinfo 57602a75d1c4Smrg continue 57612a75d1c4Smrg ;; 57622a75d1c4Smrg 57632a75d1c4Smrg -version-number) 57642a75d1c4Smrg prev=vinfo 57652a75d1c4Smrg vinfo_number=yes 57662a75d1c4Smrg continue 57672a75d1c4Smrg ;; 57682a75d1c4Smrg 57692a75d1c4Smrg -weak) 57702a75d1c4Smrg prev=weak 57712a75d1c4Smrg continue 57722a75d1c4Smrg ;; 57732a75d1c4Smrg 57742a75d1c4Smrg -Wc,*) 57752a75d1c4Smrg func_stripname '-Wc,' '' "$arg" 57762a75d1c4Smrg args=$func_stripname_result 57772a75d1c4Smrg arg= 57782a75d1c4Smrg save_ifs="$IFS"; IFS=',' 57792a75d1c4Smrg for flag in $args; do 57802a75d1c4Smrg IFS="$save_ifs" 57812a75d1c4Smrg func_quote_for_eval "$flag" 57822a75d1c4Smrg func_append arg " $func_quote_for_eval_result" 57832a75d1c4Smrg func_append compiler_flags " $func_quote_for_eval_result" 57842a75d1c4Smrg done 57852a75d1c4Smrg IFS="$save_ifs" 57862a75d1c4Smrg func_stripname ' ' '' "$arg" 57872a75d1c4Smrg arg=$func_stripname_result 57882a75d1c4Smrg ;; 57892a75d1c4Smrg 57902a75d1c4Smrg -Wl,*) 57912a75d1c4Smrg func_stripname '-Wl,' '' "$arg" 57922a75d1c4Smrg args=$func_stripname_result 57932a75d1c4Smrg arg= 57942a75d1c4Smrg save_ifs="$IFS"; IFS=',' 57952a75d1c4Smrg for flag in $args; do 57962a75d1c4Smrg IFS="$save_ifs" 57972a75d1c4Smrg func_quote_for_eval "$flag" 57982a75d1c4Smrg func_append arg " $wl$func_quote_for_eval_result" 57992a75d1c4Smrg func_append compiler_flags " $wl$func_quote_for_eval_result" 58002a75d1c4Smrg func_append linker_flags " $func_quote_for_eval_result" 58012a75d1c4Smrg done 58022a75d1c4Smrg IFS="$save_ifs" 58032a75d1c4Smrg func_stripname ' ' '' "$arg" 58042a75d1c4Smrg arg=$func_stripname_result 58052a75d1c4Smrg ;; 58062a75d1c4Smrg 58072a75d1c4Smrg -Xcompiler) 58082a75d1c4Smrg prev=xcompiler 58092a75d1c4Smrg continue 58102a75d1c4Smrg ;; 58112a75d1c4Smrg 58122a75d1c4Smrg -Xlinker) 58132a75d1c4Smrg prev=xlinker 58142a75d1c4Smrg continue 58152a75d1c4Smrg ;; 58162a75d1c4Smrg 58172a75d1c4Smrg -XCClinker) 58182a75d1c4Smrg prev=xcclinker 58192a75d1c4Smrg continue 58202a75d1c4Smrg ;; 58212a75d1c4Smrg 58222a75d1c4Smrg # -msg_* for osf cc 58232a75d1c4Smrg -msg_*) 58242a75d1c4Smrg func_quote_for_eval "$arg" 58252a75d1c4Smrg arg="$func_quote_for_eval_result" 58262a75d1c4Smrg ;; 58272a75d1c4Smrg 58282a75d1c4Smrg # Flags to be passed through unchanged, with rationale: 58292a75d1c4Smrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 58302a75d1c4Smrg # -r[0-9][0-9]* specify processor for the SGI compiler 58312a75d1c4Smrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 58322a75d1c4Smrg # +DA*, +DD* enable 64-bit mode for the HP compiler 58332a75d1c4Smrg # -q* compiler args for the IBM compiler 58342a75d1c4Smrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 58352a75d1c4Smrg # -F/path path to uninstalled frameworks, gcc on darwin 58362a75d1c4Smrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 58372a75d1c4Smrg # @file GCC response files 58382a75d1c4Smrg # -tp=* Portland pgcc target processor selection 58392a75d1c4Smrg # --sysroot=* for sysroot support 58402a75d1c4Smrg # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 58412a75d1c4Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 58422a75d1c4Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 58432a75d1c4Smrg -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 58442a75d1c4Smrg func_quote_for_eval "$arg" 58452a75d1c4Smrg arg="$func_quote_for_eval_result" 58462a75d1c4Smrg func_append compile_command " $arg" 58472a75d1c4Smrg func_append finalize_command " $arg" 58482a75d1c4Smrg func_append compiler_flags " $arg" 58492a75d1c4Smrg continue 58502a75d1c4Smrg ;; 58512a75d1c4Smrg 58522a75d1c4Smrg # Some other compiler flag. 58532a75d1c4Smrg -* | +*) 58542a75d1c4Smrg func_quote_for_eval "$arg" 58552a75d1c4Smrg arg="$func_quote_for_eval_result" 58562a75d1c4Smrg ;; 58572a75d1c4Smrg 58582a75d1c4Smrg *.$objext) 58592a75d1c4Smrg # A standard object. 58602a75d1c4Smrg func_append objs " $arg" 58612a75d1c4Smrg ;; 58622a75d1c4Smrg 58632a75d1c4Smrg *.lo) 58642a75d1c4Smrg # A libtool-controlled object. 58652a75d1c4Smrg 58662a75d1c4Smrg # Check to see that this really is a libtool object. 58672a75d1c4Smrg if func_lalib_unsafe_p "$arg"; then 58682a75d1c4Smrg pic_object= 58692a75d1c4Smrg non_pic_object= 58702a75d1c4Smrg 58712a75d1c4Smrg # Read the .lo file 58722a75d1c4Smrg func_source "$arg" 58732a75d1c4Smrg 58742a75d1c4Smrg if test -z "$pic_object" || 58752a75d1c4Smrg test -z "$non_pic_object" || 58762a75d1c4Smrg test "$pic_object" = none && 58772a75d1c4Smrg test "$non_pic_object" = none; then 58782a75d1c4Smrg func_fatal_error "cannot find name of object for \`$arg'" 58792a75d1c4Smrg fi 58802a75d1c4Smrg 58812a75d1c4Smrg # Extract subdirectory from the argument. 58822a75d1c4Smrg func_dirname "$arg" "/" "" 58832a75d1c4Smrg xdir="$func_dirname_result" 58842a75d1c4Smrg 58852a75d1c4Smrg if test "$pic_object" != none; then 58862a75d1c4Smrg # Prepend the subdirectory the object is found in. 58872a75d1c4Smrg pic_object="$xdir$pic_object" 58882a75d1c4Smrg 58892a75d1c4Smrg if test "$prev" = dlfiles; then 58902a75d1c4Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 58912a75d1c4Smrg func_append dlfiles " $pic_object" 58922a75d1c4Smrg prev= 58932a75d1c4Smrg continue 58942a75d1c4Smrg else 58952a75d1c4Smrg # If libtool objects are unsupported, then we need to preload. 58962a75d1c4Smrg prev=dlprefiles 58972a75d1c4Smrg fi 58982a75d1c4Smrg fi 58992a75d1c4Smrg 59002a75d1c4Smrg # CHECK ME: I think I busted this. -Ossama 59012a75d1c4Smrg if test "$prev" = dlprefiles; then 59022a75d1c4Smrg # Preload the old-style object. 59032a75d1c4Smrg func_append dlprefiles " $pic_object" 59042a75d1c4Smrg prev= 59052a75d1c4Smrg fi 59062a75d1c4Smrg 59072a75d1c4Smrg # A PIC object. 59082a75d1c4Smrg func_append libobjs " $pic_object" 59092a75d1c4Smrg arg="$pic_object" 59102a75d1c4Smrg fi 59112a75d1c4Smrg 59122a75d1c4Smrg # Non-PIC object. 59132a75d1c4Smrg if test "$non_pic_object" != none; then 59142a75d1c4Smrg # Prepend the subdirectory the object is found in. 59152a75d1c4Smrg non_pic_object="$xdir$non_pic_object" 59162a75d1c4Smrg 59172a75d1c4Smrg # A standard non-PIC object 59182a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 59192a75d1c4Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 59202a75d1c4Smrg arg="$non_pic_object" 59212a75d1c4Smrg fi 59222a75d1c4Smrg else 59232a75d1c4Smrg # If the PIC object exists, use it instead. 59242a75d1c4Smrg # $xdir was prepended to $pic_object above. 59252a75d1c4Smrg non_pic_object="$pic_object" 59262a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 59272a75d1c4Smrg fi 59282a75d1c4Smrg else 59292a75d1c4Smrg # Only an error if not doing a dry-run. 59302a75d1c4Smrg if $opt_dry_run; then 59312a75d1c4Smrg # Extract subdirectory from the argument. 59322a75d1c4Smrg func_dirname "$arg" "/" "" 59332a75d1c4Smrg xdir="$func_dirname_result" 59342a75d1c4Smrg 59352a75d1c4Smrg func_lo2o "$arg" 59362a75d1c4Smrg pic_object=$xdir$objdir/$func_lo2o_result 59372a75d1c4Smrg non_pic_object=$xdir$func_lo2o_result 59382a75d1c4Smrg func_append libobjs " $pic_object" 59392a75d1c4Smrg func_append non_pic_objects " $non_pic_object" 59402a75d1c4Smrg else 59412a75d1c4Smrg func_fatal_error "\`$arg' is not a valid libtool object" 59422a75d1c4Smrg fi 59432a75d1c4Smrg fi 59442a75d1c4Smrg ;; 59452a75d1c4Smrg 59462a75d1c4Smrg *.$libext) 59472a75d1c4Smrg # An archive. 59482a75d1c4Smrg func_append deplibs " $arg" 59492a75d1c4Smrg func_append old_deplibs " $arg" 59502a75d1c4Smrg continue 59512a75d1c4Smrg ;; 59522a75d1c4Smrg 59532a75d1c4Smrg *.la) 59542a75d1c4Smrg # A libtool-controlled library. 59552a75d1c4Smrg 59562a75d1c4Smrg func_resolve_sysroot "$arg" 59572a75d1c4Smrg if test "$prev" = dlfiles; then 59582a75d1c4Smrg # This library was specified with -dlopen. 59592a75d1c4Smrg func_append dlfiles " $func_resolve_sysroot_result" 59602a75d1c4Smrg prev= 59612a75d1c4Smrg elif test "$prev" = dlprefiles; then 59622a75d1c4Smrg # The library was specified with -dlpreopen. 59632a75d1c4Smrg func_append dlprefiles " $func_resolve_sysroot_result" 59642a75d1c4Smrg prev= 59652a75d1c4Smrg else 59662a75d1c4Smrg func_append deplibs " $func_resolve_sysroot_result" 59672a75d1c4Smrg fi 59682a75d1c4Smrg continue 59692a75d1c4Smrg ;; 59702a75d1c4Smrg 59712a75d1c4Smrg # Some other compiler argument. 59722a75d1c4Smrg *) 59732a75d1c4Smrg # Unknown arguments in both finalize_command and compile_command need 59742a75d1c4Smrg # to be aesthetically quoted because they are evaled later. 59752a75d1c4Smrg func_quote_for_eval "$arg" 59762a75d1c4Smrg arg="$func_quote_for_eval_result" 59772a75d1c4Smrg ;; 59782a75d1c4Smrg esac # arg 59792a75d1c4Smrg 59802a75d1c4Smrg # Now actually substitute the argument into the commands. 59812a75d1c4Smrg if test -n "$arg"; then 59822a75d1c4Smrg func_append compile_command " $arg" 59832a75d1c4Smrg func_append finalize_command " $arg" 59842a75d1c4Smrg fi 59852a75d1c4Smrg done # argument parsing loop 59862a75d1c4Smrg 59872a75d1c4Smrg test -n "$prev" && \ 59882a75d1c4Smrg func_fatal_help "the \`$prevarg' option requires an argument" 59892a75d1c4Smrg 59902a75d1c4Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 59912a75d1c4Smrg eval arg=\"$export_dynamic_flag_spec\" 59922a75d1c4Smrg func_append compile_command " $arg" 59932a75d1c4Smrg func_append finalize_command " $arg" 59942a75d1c4Smrg fi 59952a75d1c4Smrg 59962a75d1c4Smrg oldlibs= 59972a75d1c4Smrg # calculate the name of the file, without its directory 59982a75d1c4Smrg func_basename "$output" 59992a75d1c4Smrg outputname="$func_basename_result" 60002a75d1c4Smrg libobjs_save="$libobjs" 60012a75d1c4Smrg 60022a75d1c4Smrg if test -n "$shlibpath_var"; then 60032a75d1c4Smrg # get the directories listed in $shlibpath_var 60042a75d1c4Smrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 60052a75d1c4Smrg else 60062a75d1c4Smrg shlib_search_path= 60072a75d1c4Smrg fi 60082a75d1c4Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 60092a75d1c4Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 60102a75d1c4Smrg 60112a75d1c4Smrg func_dirname "$output" "/" "" 60122a75d1c4Smrg output_objdir="$func_dirname_result$objdir" 60132a75d1c4Smrg func_to_tool_file "$output_objdir/" 60142a75d1c4Smrg tool_output_objdir=$func_to_tool_file_result 60152a75d1c4Smrg # Create the object directory. 60162a75d1c4Smrg func_mkdir_p "$output_objdir" 60172a75d1c4Smrg 60182a75d1c4Smrg # Determine the type of output 60192a75d1c4Smrg case $output in 60202a75d1c4Smrg "") 60212a75d1c4Smrg func_fatal_help "you must specify an output file" 60222a75d1c4Smrg ;; 60232a75d1c4Smrg *.$libext) linkmode=oldlib ;; 60242a75d1c4Smrg *.lo | *.$objext) linkmode=obj ;; 60252a75d1c4Smrg *.la) linkmode=lib ;; 60262a75d1c4Smrg *) linkmode=prog ;; # Anything else should be a program. 60272a75d1c4Smrg esac 60282a75d1c4Smrg 60292a75d1c4Smrg specialdeplibs= 60302a75d1c4Smrg 60312a75d1c4Smrg libs= 60322a75d1c4Smrg # Find all interdependent deplibs by searching for libraries 60332a75d1c4Smrg # that are linked more than once (e.g. -la -lb -la) 60342a75d1c4Smrg for deplib in $deplibs; do 60352a75d1c4Smrg if $opt_preserve_dup_deps ; then 60362a75d1c4Smrg case "$libs " in 60372a75d1c4Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 60382a75d1c4Smrg esac 60392a75d1c4Smrg fi 60402a75d1c4Smrg func_append libs " $deplib" 60412a75d1c4Smrg done 60422a75d1c4Smrg 60432a75d1c4Smrg if test "$linkmode" = lib; then 60442a75d1c4Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 60452a75d1c4Smrg 60462a75d1c4Smrg # Compute libraries that are listed more than once in $predeps 60472a75d1c4Smrg # $postdeps and mark them as special (i.e., whose duplicates are 60482a75d1c4Smrg # not to be eliminated). 60492a75d1c4Smrg pre_post_deps= 60502a75d1c4Smrg if $opt_duplicate_compiler_generated_deps; then 60512a75d1c4Smrg for pre_post_dep in $predeps $postdeps; do 60522a75d1c4Smrg case "$pre_post_deps " in 60532a75d1c4Smrg *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 60542a75d1c4Smrg esac 60552a75d1c4Smrg func_append pre_post_deps " $pre_post_dep" 60562a75d1c4Smrg done 60572a75d1c4Smrg fi 60582a75d1c4Smrg pre_post_deps= 60592a75d1c4Smrg fi 60602a75d1c4Smrg 60612a75d1c4Smrg deplibs= 60622a75d1c4Smrg newdependency_libs= 60632a75d1c4Smrg newlib_search_path= 60642a75d1c4Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 60652a75d1c4Smrg notinst_deplibs= # not-installed libtool libraries 60662a75d1c4Smrg notinst_path= # paths that contain not-installed libtool libraries 60672a75d1c4Smrg 60682a75d1c4Smrg case $linkmode in 60692a75d1c4Smrg lib) 60702a75d1c4Smrg passes="conv dlpreopen link" 60712a75d1c4Smrg for file in $dlfiles $dlprefiles; do 60722a75d1c4Smrg case $file in 60732a75d1c4Smrg *.la) ;; 60742a75d1c4Smrg *) 60752a75d1c4Smrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 60762a75d1c4Smrg ;; 60772a75d1c4Smrg esac 60782a75d1c4Smrg done 60792a75d1c4Smrg ;; 60802a75d1c4Smrg prog) 60812a75d1c4Smrg compile_deplibs= 60822a75d1c4Smrg finalize_deplibs= 60832a75d1c4Smrg alldeplibs=no 60842a75d1c4Smrg newdlfiles= 60852a75d1c4Smrg newdlprefiles= 60862a75d1c4Smrg passes="conv scan dlopen dlpreopen link" 60872a75d1c4Smrg ;; 60882a75d1c4Smrg *) passes="conv" 60892a75d1c4Smrg ;; 60902a75d1c4Smrg esac 60912a75d1c4Smrg 60922a75d1c4Smrg for pass in $passes; do 60932a75d1c4Smrg # The preopen pass in lib mode reverses $deplibs; put it back here 60942a75d1c4Smrg # so that -L comes before libs that need it for instance... 60952a75d1c4Smrg if test "$linkmode,$pass" = "lib,link"; then 60962a75d1c4Smrg ## FIXME: Find the place where the list is rebuilt in the wrong 60972a75d1c4Smrg ## order, and fix it there properly 60982a75d1c4Smrg tmp_deplibs= 60992a75d1c4Smrg for deplib in $deplibs; do 61002a75d1c4Smrg tmp_deplibs="$deplib $tmp_deplibs" 61012a75d1c4Smrg done 61022a75d1c4Smrg deplibs="$tmp_deplibs" 61032a75d1c4Smrg fi 61042a75d1c4Smrg 61052a75d1c4Smrg if test "$linkmode,$pass" = "lib,link" || 61062a75d1c4Smrg test "$linkmode,$pass" = "prog,scan"; then 61072a75d1c4Smrg libs="$deplibs" 61082a75d1c4Smrg deplibs= 61092a75d1c4Smrg fi 61102a75d1c4Smrg if test "$linkmode" = prog; then 61112a75d1c4Smrg case $pass in 61122a75d1c4Smrg dlopen) libs="$dlfiles" ;; 61132a75d1c4Smrg dlpreopen) libs="$dlprefiles" ;; 61142a75d1c4Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 61152a75d1c4Smrg esac 61162a75d1c4Smrg fi 61172a75d1c4Smrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 61182a75d1c4Smrg # Collect and forward deplibs of preopened libtool libs 61192a75d1c4Smrg for lib in $dlprefiles; do 61202a75d1c4Smrg # Ignore non-libtool-libs 61212a75d1c4Smrg dependency_libs= 61222a75d1c4Smrg func_resolve_sysroot "$lib" 61232a75d1c4Smrg case $lib in 61242a75d1c4Smrg *.la) func_source "$func_resolve_sysroot_result" ;; 61252a75d1c4Smrg esac 61262a75d1c4Smrg 61272a75d1c4Smrg # Collect preopened libtool deplibs, except any this library 61282a75d1c4Smrg # has declared as weak libs 61292a75d1c4Smrg for deplib in $dependency_libs; do 61302a75d1c4Smrg func_basename "$deplib" 61312a75d1c4Smrg deplib_base=$func_basename_result 61322a75d1c4Smrg case " $weak_libs " in 61332a75d1c4Smrg *" $deplib_base "*) ;; 61342a75d1c4Smrg *) func_append deplibs " $deplib" ;; 61352a75d1c4Smrg esac 61362a75d1c4Smrg done 61372a75d1c4Smrg done 61382a75d1c4Smrg libs="$dlprefiles" 61392a75d1c4Smrg fi 61402a75d1c4Smrg if test "$pass" = dlopen; then 61412a75d1c4Smrg # Collect dlpreopened libraries 61422a75d1c4Smrg save_deplibs="$deplibs" 61432a75d1c4Smrg deplibs= 61442a75d1c4Smrg fi 61452a75d1c4Smrg 61462a75d1c4Smrg for deplib in $libs; do 61472a75d1c4Smrg lib= 61482a75d1c4Smrg found=no 61492a75d1c4Smrg case $deplib in 61502a75d1c4Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 61512a75d1c4Smrg if test "$linkmode,$pass" = "prog,link"; then 61522a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 61532a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 61542a75d1c4Smrg else 61552a75d1c4Smrg func_append compiler_flags " $deplib" 61562a75d1c4Smrg if test "$linkmode" = lib ; then 61572a75d1c4Smrg case "$new_inherited_linker_flags " in 61582a75d1c4Smrg *" $deplib "*) ;; 61592a75d1c4Smrg * ) func_append new_inherited_linker_flags " $deplib" ;; 61602a75d1c4Smrg esac 61612a75d1c4Smrg fi 61622a75d1c4Smrg fi 61632a75d1c4Smrg continue 61642a75d1c4Smrg ;; 61652a75d1c4Smrg -l*) 61662a75d1c4Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 61672a75d1c4Smrg func_warning "\`-l' is ignored for archives/objects" 61682a75d1c4Smrg continue 61692a75d1c4Smrg fi 61702a75d1c4Smrg func_stripname '-l' '' "$deplib" 61712a75d1c4Smrg name=$func_stripname_result 61722a75d1c4Smrg if test "$linkmode" = lib; then 61732a75d1c4Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 61742a75d1c4Smrg else 61752a75d1c4Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 61762a75d1c4Smrg fi 61772a75d1c4Smrg for searchdir in $searchdirs; do 61782a75d1c4Smrg for search_ext in .la $std_shrext .so .a; do 61792a75d1c4Smrg # Search the libtool library 61802a75d1c4Smrg lib="$searchdir/lib${name}${search_ext}" 61812a75d1c4Smrg if test -f "$lib"; then 61822a75d1c4Smrg if test "$search_ext" = ".la"; then 61832a75d1c4Smrg found=yes 61842a75d1c4Smrg else 61852a75d1c4Smrg found=no 61862a75d1c4Smrg fi 61872a75d1c4Smrg break 2 61882a75d1c4Smrg fi 61892a75d1c4Smrg done 61902a75d1c4Smrg done 61912a75d1c4Smrg if test "$found" != yes; then 61922a75d1c4Smrg # deplib doesn't seem to be a libtool library 61932a75d1c4Smrg if test "$linkmode,$pass" = "prog,link"; then 61942a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 61952a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 61962a75d1c4Smrg else 61972a75d1c4Smrg deplibs="$deplib $deplibs" 61982a75d1c4Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 61992a75d1c4Smrg fi 62002a75d1c4Smrg continue 62012a75d1c4Smrg else # deplib is a libtool library 62022a75d1c4Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 62032a75d1c4Smrg # We need to do some special things here, and not later. 62042a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 62052a75d1c4Smrg case " $predeps $postdeps " in 62062a75d1c4Smrg *" $deplib "*) 62072a75d1c4Smrg if func_lalib_p "$lib"; then 62082a75d1c4Smrg library_names= 62092a75d1c4Smrg old_library= 62102a75d1c4Smrg func_source "$lib" 62112a75d1c4Smrg for l in $old_library $library_names; do 62122a75d1c4Smrg ll="$l" 62132a75d1c4Smrg done 62142a75d1c4Smrg if test "X$ll" = "X$old_library" ; then # only static version available 62152a75d1c4Smrg found=no 62162a75d1c4Smrg func_dirname "$lib" "" "." 62172a75d1c4Smrg ladir="$func_dirname_result" 62182a75d1c4Smrg lib=$ladir/$old_library 62192a75d1c4Smrg if test "$linkmode,$pass" = "prog,link"; then 62202a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 62212a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 62222a75d1c4Smrg else 62232a75d1c4Smrg deplibs="$deplib $deplibs" 62242a75d1c4Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 62252a75d1c4Smrg fi 62262a75d1c4Smrg continue 62272a75d1c4Smrg fi 62282a75d1c4Smrg fi 62292a75d1c4Smrg ;; 62302a75d1c4Smrg *) ;; 62312a75d1c4Smrg esac 62322a75d1c4Smrg fi 62332a75d1c4Smrg fi 62342a75d1c4Smrg ;; # -l 62352a75d1c4Smrg *.ltframework) 62362a75d1c4Smrg if test "$linkmode,$pass" = "prog,link"; then 62372a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 62382a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 62392a75d1c4Smrg else 62402a75d1c4Smrg deplibs="$deplib $deplibs" 62412a75d1c4Smrg if test "$linkmode" = lib ; then 62422a75d1c4Smrg case "$new_inherited_linker_flags " in 62432a75d1c4Smrg *" $deplib "*) ;; 62442a75d1c4Smrg * ) func_append new_inherited_linker_flags " $deplib" ;; 62452a75d1c4Smrg esac 62462a75d1c4Smrg fi 62472a75d1c4Smrg fi 62482a75d1c4Smrg continue 62492a75d1c4Smrg ;; 62502a75d1c4Smrg -L*) 62512a75d1c4Smrg case $linkmode in 62522a75d1c4Smrg lib) 62532a75d1c4Smrg deplibs="$deplib $deplibs" 62542a75d1c4Smrg test "$pass" = conv && continue 62552a75d1c4Smrg newdependency_libs="$deplib $newdependency_libs" 62562a75d1c4Smrg func_stripname '-L' '' "$deplib" 62572a75d1c4Smrg func_resolve_sysroot "$func_stripname_result" 62582a75d1c4Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 62592a75d1c4Smrg ;; 62602a75d1c4Smrg prog) 62612a75d1c4Smrg if test "$pass" = conv; then 62622a75d1c4Smrg deplibs="$deplib $deplibs" 62632a75d1c4Smrg continue 62642a75d1c4Smrg fi 62652a75d1c4Smrg if test "$pass" = scan; then 62662a75d1c4Smrg deplibs="$deplib $deplibs" 62672a75d1c4Smrg else 62682a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 62692a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 62702a75d1c4Smrg fi 62712a75d1c4Smrg func_stripname '-L' '' "$deplib" 62722a75d1c4Smrg func_resolve_sysroot "$func_stripname_result" 62732a75d1c4Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 62742a75d1c4Smrg ;; 62752a75d1c4Smrg *) 62762a75d1c4Smrg func_warning "\`-L' is ignored for archives/objects" 62772a75d1c4Smrg ;; 62782a75d1c4Smrg esac # linkmode 62792a75d1c4Smrg continue 62802a75d1c4Smrg ;; # -L 62812a75d1c4Smrg -R*) 62822a75d1c4Smrg if test "$pass" = link; then 62832a75d1c4Smrg func_stripname '-R' '' "$deplib" 62842a75d1c4Smrg func_resolve_sysroot "$func_stripname_result" 62852a75d1c4Smrg dir=$func_resolve_sysroot_result 62862a75d1c4Smrg # Make sure the xrpath contains only unique directories. 62872a75d1c4Smrg case "$xrpath " in 62882a75d1c4Smrg *" $dir "*) ;; 62892a75d1c4Smrg *) func_append xrpath " $dir" ;; 62902a75d1c4Smrg esac 62912a75d1c4Smrg fi 62922a75d1c4Smrg deplibs="$deplib $deplibs" 62932a75d1c4Smrg continue 62942a75d1c4Smrg ;; 62952a75d1c4Smrg *.la) 62962a75d1c4Smrg func_resolve_sysroot "$deplib" 62972a75d1c4Smrg lib=$func_resolve_sysroot_result 62982a75d1c4Smrg ;; 62992a75d1c4Smrg *.$libext) 63002a75d1c4Smrg if test "$pass" = conv; then 63012a75d1c4Smrg deplibs="$deplib $deplibs" 63022a75d1c4Smrg continue 63032a75d1c4Smrg fi 63042a75d1c4Smrg case $linkmode in 63052a75d1c4Smrg lib) 63062a75d1c4Smrg # Linking convenience modules into shared libraries is allowed, 63072a75d1c4Smrg # but linking other static libraries is non-portable. 63082a75d1c4Smrg case " $dlpreconveniencelibs " in 63092a75d1c4Smrg *" $deplib "*) ;; 63102a75d1c4Smrg *) 63112a75d1c4Smrg valid_a_lib=no 63122a75d1c4Smrg case $deplibs_check_method in 63132a75d1c4Smrg match_pattern*) 63142a75d1c4Smrg set dummy $deplibs_check_method; shift 63152a75d1c4Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 63162a75d1c4Smrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 63172a75d1c4Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 63182a75d1c4Smrg valid_a_lib=yes 63192a75d1c4Smrg fi 63202a75d1c4Smrg ;; 63212a75d1c4Smrg pass_all) 63222a75d1c4Smrg valid_a_lib=yes 63232a75d1c4Smrg ;; 63242a75d1c4Smrg esac 63252a75d1c4Smrg if test "$valid_a_lib" != yes; then 63262a75d1c4Smrg echo 63272a75d1c4Smrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 63282a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 63292a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 63302a75d1c4Smrg echo "*** shared version of the library, which you do not appear to have" 63312a75d1c4Smrg echo "*** because the file extensions .$libext of this argument makes me believe" 63322a75d1c4Smrg echo "*** that it is just a static archive that I should not use here." 63332a75d1c4Smrg else 63342a75d1c4Smrg echo 63352a75d1c4Smrg $ECHO "*** Warning: Linking the shared library $output against the" 63362a75d1c4Smrg $ECHO "*** static library $deplib is not portable!" 63372a75d1c4Smrg deplibs="$deplib $deplibs" 63382a75d1c4Smrg fi 63392a75d1c4Smrg ;; 63402a75d1c4Smrg esac 63412a75d1c4Smrg continue 63422a75d1c4Smrg ;; 63432a75d1c4Smrg prog) 63442a75d1c4Smrg if test "$pass" != link; then 63452a75d1c4Smrg deplibs="$deplib $deplibs" 63462a75d1c4Smrg else 63472a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 63482a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 63492a75d1c4Smrg fi 63502a75d1c4Smrg continue 63512a75d1c4Smrg ;; 63522a75d1c4Smrg esac # linkmode 63532a75d1c4Smrg ;; # *.$libext 63542a75d1c4Smrg *.lo | *.$objext) 63552a75d1c4Smrg if test "$pass" = conv; then 63562a75d1c4Smrg deplibs="$deplib $deplibs" 63572a75d1c4Smrg elif test "$linkmode" = prog; then 63582a75d1c4Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 63592a75d1c4Smrg # If there is no dlopen support or we're linking statically, 63602a75d1c4Smrg # we need to preload. 63612a75d1c4Smrg func_append newdlprefiles " $deplib" 63622a75d1c4Smrg compile_deplibs="$deplib $compile_deplibs" 63632a75d1c4Smrg finalize_deplibs="$deplib $finalize_deplibs" 63642a75d1c4Smrg else 63652a75d1c4Smrg func_append newdlfiles " $deplib" 63662a75d1c4Smrg fi 63672a75d1c4Smrg fi 63682a75d1c4Smrg continue 63692a75d1c4Smrg ;; 63702a75d1c4Smrg %DEPLIBS%) 63712a75d1c4Smrg alldeplibs=yes 63722a75d1c4Smrg continue 63732a75d1c4Smrg ;; 63742a75d1c4Smrg esac # case $deplib 63752a75d1c4Smrg 63762a75d1c4Smrg if test "$found" = yes || test -f "$lib"; then : 63772a75d1c4Smrg else 63782a75d1c4Smrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 63792a75d1c4Smrg fi 63802a75d1c4Smrg 63812a75d1c4Smrg # Check to see that this really is a libtool archive. 63822a75d1c4Smrg func_lalib_unsafe_p "$lib" \ 63832a75d1c4Smrg || func_fatal_error "\`$lib' is not a valid libtool archive" 63842a75d1c4Smrg 63852a75d1c4Smrg func_dirname "$lib" "" "." 63862a75d1c4Smrg ladir="$func_dirname_result" 63872a75d1c4Smrg 63882a75d1c4Smrg dlname= 63892a75d1c4Smrg dlopen= 63902a75d1c4Smrg dlpreopen= 63912a75d1c4Smrg libdir= 63922a75d1c4Smrg library_names= 63932a75d1c4Smrg old_library= 63942a75d1c4Smrg inherited_linker_flags= 63952a75d1c4Smrg # If the library was installed with an old release of libtool, 63962a75d1c4Smrg # it will not redefine variables installed, or shouldnotlink 63972a75d1c4Smrg installed=yes 63982a75d1c4Smrg shouldnotlink=no 63992a75d1c4Smrg avoidtemprpath= 64002a75d1c4Smrg 64012a75d1c4Smrg 64022a75d1c4Smrg # Read the .la file 64032a75d1c4Smrg func_source "$lib" 64042a75d1c4Smrg 64052a75d1c4Smrg # Convert "-framework foo" to "foo.ltframework" 64062a75d1c4Smrg if test -n "$inherited_linker_flags"; then 64072a75d1c4Smrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 64082a75d1c4Smrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 64092a75d1c4Smrg case " $new_inherited_linker_flags " in 64102a75d1c4Smrg *" $tmp_inherited_linker_flag "*) ;; 64112a75d1c4Smrg *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 64122a75d1c4Smrg esac 64132a75d1c4Smrg done 64142a75d1c4Smrg fi 64152a75d1c4Smrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 64162a75d1c4Smrg if test "$linkmode,$pass" = "lib,link" || 64172a75d1c4Smrg test "$linkmode,$pass" = "prog,scan" || 64182a75d1c4Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 64192a75d1c4Smrg test -n "$dlopen" && func_append dlfiles " $dlopen" 64202a75d1c4Smrg test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 64212a75d1c4Smrg fi 64222a75d1c4Smrg 64232a75d1c4Smrg if test "$pass" = conv; then 64242a75d1c4Smrg # Only check for convenience libraries 64252a75d1c4Smrg deplibs="$lib $deplibs" 64262a75d1c4Smrg if test -z "$libdir"; then 64272a75d1c4Smrg if test -z "$old_library"; then 64282a75d1c4Smrg func_fatal_error "cannot find name of link library for \`$lib'" 64292a75d1c4Smrg fi 64302a75d1c4Smrg # It is a libtool convenience library, so add in its objects. 64312a75d1c4Smrg func_append convenience " $ladir/$objdir/$old_library" 64322a75d1c4Smrg func_append old_convenience " $ladir/$objdir/$old_library" 64332a75d1c4Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 64342a75d1c4Smrg func_fatal_error "\`$lib' is not a convenience library" 64352a75d1c4Smrg fi 64362a75d1c4Smrg tmp_libs= 64372a75d1c4Smrg for deplib in $dependency_libs; do 64382a75d1c4Smrg deplibs="$deplib $deplibs" 64392a75d1c4Smrg if $opt_preserve_dup_deps ; then 64402a75d1c4Smrg case "$tmp_libs " in 64412a75d1c4Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 64422a75d1c4Smrg esac 64432a75d1c4Smrg fi 64442a75d1c4Smrg func_append tmp_libs " $deplib" 64452a75d1c4Smrg done 64462a75d1c4Smrg continue 64472a75d1c4Smrg fi # $pass = conv 64482a75d1c4Smrg 64492a75d1c4Smrg 64502a75d1c4Smrg # Get the name of the library we link against. 64512a75d1c4Smrg linklib= 64522a75d1c4Smrg if test -n "$old_library" && 64532a75d1c4Smrg { test "$prefer_static_libs" = yes || 64542a75d1c4Smrg test "$prefer_static_libs,$installed" = "built,no"; }; then 64552a75d1c4Smrg linklib=$old_library 64562a75d1c4Smrg else 64572a75d1c4Smrg for l in $old_library $library_names; do 64582a75d1c4Smrg linklib="$l" 64592a75d1c4Smrg done 64602a75d1c4Smrg fi 64612a75d1c4Smrg if test -z "$linklib"; then 64622a75d1c4Smrg func_fatal_error "cannot find name of link library for \`$lib'" 64632a75d1c4Smrg fi 64642a75d1c4Smrg 64652a75d1c4Smrg # This library was specified with -dlopen. 64662a75d1c4Smrg if test "$pass" = dlopen; then 64672a75d1c4Smrg if test -z "$libdir"; then 64682a75d1c4Smrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 64692a75d1c4Smrg fi 64702a75d1c4Smrg if test -z "$dlname" || 64712a75d1c4Smrg test "$dlopen_support" != yes || 64722a75d1c4Smrg test "$build_libtool_libs" = no; then 64732a75d1c4Smrg # If there is no dlname, no dlopen support or we're linking 64742a75d1c4Smrg # statically, we need to preload. We also need to preload any 64752a75d1c4Smrg # dependent libraries so libltdl's deplib preloader doesn't 64762a75d1c4Smrg # bomb out in the load deplibs phase. 64772a75d1c4Smrg func_append dlprefiles " $lib $dependency_libs" 64782a75d1c4Smrg else 64792a75d1c4Smrg func_append newdlfiles " $lib" 64802a75d1c4Smrg fi 64812a75d1c4Smrg continue 64822a75d1c4Smrg fi # $pass = dlopen 64832a75d1c4Smrg 64842a75d1c4Smrg # We need an absolute path. 64852a75d1c4Smrg case $ladir in 64862a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 64872a75d1c4Smrg *) 64882a75d1c4Smrg abs_ladir=`cd "$ladir" && pwd` 64892a75d1c4Smrg if test -z "$abs_ladir"; then 64902a75d1c4Smrg func_warning "cannot determine absolute directory name of \`$ladir'" 64912a75d1c4Smrg func_warning "passing it literally to the linker, although it might fail" 64922a75d1c4Smrg abs_ladir="$ladir" 64932a75d1c4Smrg fi 64942a75d1c4Smrg ;; 64952a75d1c4Smrg esac 64962a75d1c4Smrg func_basename "$lib" 64972a75d1c4Smrg laname="$func_basename_result" 64982a75d1c4Smrg 64992a75d1c4Smrg # Find the relevant object directory and library name. 65002a75d1c4Smrg if test "X$installed" = Xyes; then 65012a75d1c4Smrg if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 65022a75d1c4Smrg func_warning "library \`$lib' was moved." 65032a75d1c4Smrg dir="$ladir" 65042a75d1c4Smrg absdir="$abs_ladir" 65052a75d1c4Smrg libdir="$abs_ladir" 65062a75d1c4Smrg else 65072a75d1c4Smrg dir="$lt_sysroot$libdir" 65082a75d1c4Smrg absdir="$lt_sysroot$libdir" 65092a75d1c4Smrg fi 65102a75d1c4Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 65112a75d1c4Smrg else 65122a75d1c4Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 65132a75d1c4Smrg dir="$ladir" 65142a75d1c4Smrg absdir="$abs_ladir" 65152a75d1c4Smrg # Remove this search path later 65162a75d1c4Smrg func_append notinst_path " $abs_ladir" 65172a75d1c4Smrg else 65182a75d1c4Smrg dir="$ladir/$objdir" 65192a75d1c4Smrg absdir="$abs_ladir/$objdir" 65202a75d1c4Smrg # Remove this search path later 65212a75d1c4Smrg func_append notinst_path " $abs_ladir" 65222a75d1c4Smrg fi 65232a75d1c4Smrg fi # $installed = yes 65242a75d1c4Smrg func_stripname 'lib' '.la' "$laname" 65252a75d1c4Smrg name=$func_stripname_result 65262a75d1c4Smrg 65272a75d1c4Smrg # This library was specified with -dlpreopen. 65282a75d1c4Smrg if test "$pass" = dlpreopen; then 65292a75d1c4Smrg if test -z "$libdir" && test "$linkmode" = prog; then 65302a75d1c4Smrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 65312a75d1c4Smrg fi 65322a75d1c4Smrg case "$host" in 65332a75d1c4Smrg # special handling for platforms with PE-DLLs. 65342a75d1c4Smrg *cygwin* | *mingw* | *cegcc* ) 65352a75d1c4Smrg # Linker will automatically link against shared library if both 65362a75d1c4Smrg # static and shared are present. Therefore, ensure we extract 65372a75d1c4Smrg # symbols from the import library if a shared library is present 65382a75d1c4Smrg # (otherwise, the dlopen module name will be incorrect). We do 65392a75d1c4Smrg # this by putting the import library name into $newdlprefiles. 65402a75d1c4Smrg # We recover the dlopen module name by 'saving' the la file 65412a75d1c4Smrg # name in a special purpose variable, and (later) extracting the 65422a75d1c4Smrg # dlname from the la file. 65432a75d1c4Smrg if test -n "$dlname"; then 65442a75d1c4Smrg func_tr_sh "$dir/$linklib" 65452a75d1c4Smrg eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 65462a75d1c4Smrg func_append newdlprefiles " $dir/$linklib" 65472a75d1c4Smrg else 65482a75d1c4Smrg func_append newdlprefiles " $dir/$old_library" 65492a75d1c4Smrg # Keep a list of preopened convenience libraries to check 65502a75d1c4Smrg # that they are being used correctly in the link pass. 65512a75d1c4Smrg test -z "$libdir" && \ 65522a75d1c4Smrg func_append dlpreconveniencelibs " $dir/$old_library" 65532a75d1c4Smrg fi 65542a75d1c4Smrg ;; 65552a75d1c4Smrg * ) 65562a75d1c4Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 65572a75d1c4Smrg # are required to link). 65582a75d1c4Smrg if test -n "$old_library"; then 65592a75d1c4Smrg func_append newdlprefiles " $dir/$old_library" 65602a75d1c4Smrg # Keep a list of preopened convenience libraries to check 65612a75d1c4Smrg # that they are being used correctly in the link pass. 65622a75d1c4Smrg test -z "$libdir" && \ 65632a75d1c4Smrg func_append dlpreconveniencelibs " $dir/$old_library" 65642a75d1c4Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 65652a75d1c4Smrg elif test -n "$dlname"; then 65662a75d1c4Smrg func_append newdlprefiles " $dir/$dlname" 65672a75d1c4Smrg else 65682a75d1c4Smrg func_append newdlprefiles " $dir/$linklib" 65692a75d1c4Smrg fi 65702a75d1c4Smrg ;; 65712a75d1c4Smrg esac 65722a75d1c4Smrg fi # $pass = dlpreopen 65732a75d1c4Smrg 65742a75d1c4Smrg if test -z "$libdir"; then 65752a75d1c4Smrg # Link the convenience library 65762a75d1c4Smrg if test "$linkmode" = lib; then 65772a75d1c4Smrg deplibs="$dir/$old_library $deplibs" 65782a75d1c4Smrg elif test "$linkmode,$pass" = "prog,link"; then 65792a75d1c4Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 65802a75d1c4Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 65812a75d1c4Smrg else 65822a75d1c4Smrg deplibs="$lib $deplibs" # used for prog,scan pass 65832a75d1c4Smrg fi 65842a75d1c4Smrg continue 65852a75d1c4Smrg fi 65862a75d1c4Smrg 65872a75d1c4Smrg 65882a75d1c4Smrg if test "$linkmode" = prog && test "$pass" != link; then 65892a75d1c4Smrg func_append newlib_search_path " $ladir" 65902a75d1c4Smrg deplibs="$lib $deplibs" 65912a75d1c4Smrg 65922a75d1c4Smrg linkalldeplibs=no 65932a75d1c4Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 65942a75d1c4Smrg test "$build_libtool_libs" = no; then 65952a75d1c4Smrg linkalldeplibs=yes 65962a75d1c4Smrg fi 65972a75d1c4Smrg 65982a75d1c4Smrg tmp_libs= 65992a75d1c4Smrg for deplib in $dependency_libs; do 66002a75d1c4Smrg case $deplib in 66012a75d1c4Smrg -L*) func_stripname '-L' '' "$deplib" 66022a75d1c4Smrg func_resolve_sysroot "$func_stripname_result" 66032a75d1c4Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 66042a75d1c4Smrg ;; 66052a75d1c4Smrg esac 66062a75d1c4Smrg # Need to link against all dependency_libs? 66072a75d1c4Smrg if test "$linkalldeplibs" = yes; then 66082a75d1c4Smrg deplibs="$deplib $deplibs" 66092a75d1c4Smrg else 66102a75d1c4Smrg # Need to hardcode shared library paths 66112a75d1c4Smrg # or/and link against static libraries 66122a75d1c4Smrg newdependency_libs="$deplib $newdependency_libs" 66132a75d1c4Smrg fi 66142a75d1c4Smrg if $opt_preserve_dup_deps ; then 66152a75d1c4Smrg case "$tmp_libs " in 66162a75d1c4Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 66172a75d1c4Smrg esac 66182a75d1c4Smrg fi 66192a75d1c4Smrg func_append tmp_libs " $deplib" 66202a75d1c4Smrg done # for deplib 66212a75d1c4Smrg continue 66222a75d1c4Smrg fi # $linkmode = prog... 66232a75d1c4Smrg 66242a75d1c4Smrg if test "$linkmode,$pass" = "prog,link"; then 66252a75d1c4Smrg if test -n "$library_names" && 66262a75d1c4Smrg { { test "$prefer_static_libs" = no || 66272a75d1c4Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 66282a75d1c4Smrg test -z "$old_library"; }; then 66292a75d1c4Smrg # We need to hardcode the library path 66302a75d1c4Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 66312a75d1c4Smrg # Make sure the rpath contains only unique directories. 66322a75d1c4Smrg case "$temp_rpath:" in 66332a75d1c4Smrg *"$absdir:"*) ;; 66342a75d1c4Smrg *) func_append temp_rpath "$absdir:" ;; 66352a75d1c4Smrg esac 66362a75d1c4Smrg fi 66372a75d1c4Smrg 66382a75d1c4Smrg # Hardcode the library path. 66392a75d1c4Smrg # Skip directories that are in the system default run-time 66402a75d1c4Smrg # search path. 66412a75d1c4Smrg case " $sys_lib_dlsearch_path " in 66422a75d1c4Smrg *" $absdir "*) ;; 66432a75d1c4Smrg *) 66442a75d1c4Smrg case "$compile_rpath " in 66452a75d1c4Smrg *" $absdir "*) ;; 66462a75d1c4Smrg *) func_append compile_rpath " $absdir" ;; 66472a75d1c4Smrg esac 66482a75d1c4Smrg ;; 66492a75d1c4Smrg esac 66502a75d1c4Smrg case " $sys_lib_dlsearch_path " in 66512a75d1c4Smrg *" $libdir "*) ;; 66522a75d1c4Smrg *) 66532a75d1c4Smrg case "$finalize_rpath " in 66542a75d1c4Smrg *" $libdir "*) ;; 66552a75d1c4Smrg *) func_append finalize_rpath " $libdir" ;; 66562a75d1c4Smrg esac 66572a75d1c4Smrg ;; 66582a75d1c4Smrg esac 66592a75d1c4Smrg fi # $linkmode,$pass = prog,link... 66602a75d1c4Smrg 66612a75d1c4Smrg if test "$alldeplibs" = yes && 66622a75d1c4Smrg { test "$deplibs_check_method" = pass_all || 66632a75d1c4Smrg { test "$build_libtool_libs" = yes && 66642a75d1c4Smrg test -n "$library_names"; }; }; then 66652a75d1c4Smrg # We only need to search for static libraries 66662a75d1c4Smrg continue 66672a75d1c4Smrg fi 66682a75d1c4Smrg fi 66692a75d1c4Smrg 66702a75d1c4Smrg link_static=no # Whether the deplib will be linked statically 66712a75d1c4Smrg use_static_libs=$prefer_static_libs 66722a75d1c4Smrg if test "$use_static_libs" = built && test "$installed" = yes; then 66732a75d1c4Smrg use_static_libs=no 66742a75d1c4Smrg fi 66752a75d1c4Smrg if test -n "$library_names" && 66762a75d1c4Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 66772a75d1c4Smrg case $host in 66782a75d1c4Smrg *cygwin* | *mingw* | *cegcc*) 66792a75d1c4Smrg # No point in relinking DLLs because paths are not encoded 66802a75d1c4Smrg func_append notinst_deplibs " $lib" 66812a75d1c4Smrg need_relink=no 66822a75d1c4Smrg ;; 66832a75d1c4Smrg *) 66842a75d1c4Smrg if test "$installed" = no; then 66852a75d1c4Smrg func_append notinst_deplibs " $lib" 66862a75d1c4Smrg need_relink=yes 66872a75d1c4Smrg fi 66882a75d1c4Smrg ;; 66892a75d1c4Smrg esac 66902a75d1c4Smrg # This is a shared library 66912a75d1c4Smrg 66922a75d1c4Smrg # Warn about portability, can't link against -module's on some 66932a75d1c4Smrg # systems (darwin). Don't bleat about dlopened modules though! 66942a75d1c4Smrg dlopenmodule="" 66952a75d1c4Smrg for dlpremoduletest in $dlprefiles; do 66962a75d1c4Smrg if test "X$dlpremoduletest" = "X$lib"; then 66972a75d1c4Smrg dlopenmodule="$dlpremoduletest" 66982a75d1c4Smrg break 66992a75d1c4Smrg fi 67002a75d1c4Smrg done 67012a75d1c4Smrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 67022a75d1c4Smrg echo 67032a75d1c4Smrg if test "$linkmode" = prog; then 67042a75d1c4Smrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 67052a75d1c4Smrg else 67062a75d1c4Smrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 67072a75d1c4Smrg fi 67082a75d1c4Smrg $ECHO "*** $linklib is not portable!" 67092a75d1c4Smrg fi 67102a75d1c4Smrg if test "$linkmode" = lib && 67112a75d1c4Smrg test "$hardcode_into_libs" = yes; then 67122a75d1c4Smrg # Hardcode the library path. 67132a75d1c4Smrg # Skip directories that are in the system default run-time 67142a75d1c4Smrg # search path. 67152a75d1c4Smrg case " $sys_lib_dlsearch_path " in 67162a75d1c4Smrg *" $absdir "*) ;; 67172a75d1c4Smrg *) 67182a75d1c4Smrg case "$compile_rpath " in 67192a75d1c4Smrg *" $absdir "*) ;; 67202a75d1c4Smrg *) func_append compile_rpath " $absdir" ;; 67212a75d1c4Smrg esac 67222a75d1c4Smrg ;; 67232a75d1c4Smrg esac 67242a75d1c4Smrg case " $sys_lib_dlsearch_path " in 67252a75d1c4Smrg *" $libdir "*) ;; 67262a75d1c4Smrg *) 67272a75d1c4Smrg case "$finalize_rpath " in 67282a75d1c4Smrg *" $libdir "*) ;; 67292a75d1c4Smrg *) func_append finalize_rpath " $libdir" ;; 67302a75d1c4Smrg esac 67312a75d1c4Smrg ;; 67322a75d1c4Smrg esac 67332a75d1c4Smrg fi 67342a75d1c4Smrg 67352a75d1c4Smrg if test -n "$old_archive_from_expsyms_cmds"; then 67362a75d1c4Smrg # figure out the soname 67372a75d1c4Smrg set dummy $library_names 67382a75d1c4Smrg shift 67392a75d1c4Smrg realname="$1" 67402a75d1c4Smrg shift 67412a75d1c4Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 67422a75d1c4Smrg # use dlname if we got it. it's perfectly good, no? 67432a75d1c4Smrg if test -n "$dlname"; then 67442a75d1c4Smrg soname="$dlname" 67452a75d1c4Smrg elif test -n "$soname_spec"; then 67462a75d1c4Smrg # bleh windows 67472a75d1c4Smrg case $host in 67482a75d1c4Smrg *cygwin* | mingw* | *cegcc*) 67492a75d1c4Smrg func_arith $current - $age 67502a75d1c4Smrg major=$func_arith_result 67512a75d1c4Smrg versuffix="-$major" 67522a75d1c4Smrg ;; 67532a75d1c4Smrg esac 67542a75d1c4Smrg eval soname=\"$soname_spec\" 67552a75d1c4Smrg else 67562a75d1c4Smrg soname="$realname" 67572a75d1c4Smrg fi 67582a75d1c4Smrg 67592a75d1c4Smrg # Make a new name for the extract_expsyms_cmds to use 67602a75d1c4Smrg soroot="$soname" 67612a75d1c4Smrg func_basename "$soroot" 67622a75d1c4Smrg soname="$func_basename_result" 67632a75d1c4Smrg func_stripname 'lib' '.dll' "$soname" 67642a75d1c4Smrg newlib=libimp-$func_stripname_result.a 67652a75d1c4Smrg 67662a75d1c4Smrg # If the library has no export list, then create one now 67672a75d1c4Smrg if test -f "$output_objdir/$soname-def"; then : 67682a75d1c4Smrg else 67692a75d1c4Smrg func_verbose "extracting exported symbol list from \`$soname'" 67702a75d1c4Smrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 67712a75d1c4Smrg fi 67722a75d1c4Smrg 67732a75d1c4Smrg # Create $newlib 67742a75d1c4Smrg if test -f "$output_objdir/$newlib"; then :; else 67752a75d1c4Smrg func_verbose "generating import library for \`$soname'" 67762a75d1c4Smrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 67772a75d1c4Smrg fi 67782a75d1c4Smrg # make sure the library variables are pointing to the new library 67792a75d1c4Smrg dir=$output_objdir 67802a75d1c4Smrg linklib=$newlib 67812a75d1c4Smrg fi # test -n "$old_archive_from_expsyms_cmds" 67822a75d1c4Smrg 67832a75d1c4Smrg if test "$linkmode" = prog || test "$opt_mode" != relink; then 67842a75d1c4Smrg add_shlibpath= 67852a75d1c4Smrg add_dir= 67862a75d1c4Smrg add= 67872a75d1c4Smrg lib_linked=yes 67882a75d1c4Smrg case $hardcode_action in 67892a75d1c4Smrg immediate | unsupported) 67902a75d1c4Smrg if test "$hardcode_direct" = no; then 67912a75d1c4Smrg add="$dir/$linklib" 67922a75d1c4Smrg case $host in 67932a75d1c4Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 67942a75d1c4Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 67952a75d1c4Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 67962a75d1c4Smrg *-*-unixware7*) add_dir="-L$dir" ;; 67972a75d1c4Smrg *-*-darwin* ) 67982a75d1c4Smrg # if the lib is a (non-dlopened) module then we can not 67992a75d1c4Smrg # link against it, someone is ignoring the earlier warnings 68002a75d1c4Smrg if /usr/bin/file -L $add 2> /dev/null | 68012a75d1c4Smrg $GREP ": [^:]* bundle" >/dev/null ; then 68022a75d1c4Smrg if test "X$dlopenmodule" != "X$lib"; then 68032a75d1c4Smrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 68042a75d1c4Smrg if test -z "$old_library" ; then 68052a75d1c4Smrg echo 68062a75d1c4Smrg echo "*** And there doesn't seem to be a static archive available" 68072a75d1c4Smrg echo "*** The link will probably fail, sorry" 68082a75d1c4Smrg else 68092a75d1c4Smrg add="$dir/$old_library" 68102a75d1c4Smrg fi 68112a75d1c4Smrg elif test -n "$old_library"; then 68122a75d1c4Smrg add="$dir/$old_library" 68132a75d1c4Smrg fi 68142a75d1c4Smrg fi 68152a75d1c4Smrg esac 68162a75d1c4Smrg elif test "$hardcode_minus_L" = no; then 68172a75d1c4Smrg case $host in 68182a75d1c4Smrg *-*-sunos*) add_shlibpath="$dir" ;; 68192a75d1c4Smrg esac 68202a75d1c4Smrg add_dir="-L$dir" 68212a75d1c4Smrg add="-l$name" 68222a75d1c4Smrg elif test "$hardcode_shlibpath_var" = no; then 68232a75d1c4Smrg add_shlibpath="$dir" 68242a75d1c4Smrg add="-l$name" 68252a75d1c4Smrg else 68262a75d1c4Smrg lib_linked=no 68272a75d1c4Smrg fi 68282a75d1c4Smrg ;; 68292a75d1c4Smrg relink) 68302a75d1c4Smrg if test "$hardcode_direct" = yes && 68312a75d1c4Smrg test "$hardcode_direct_absolute" = no; then 68322a75d1c4Smrg add="$dir/$linklib" 68332a75d1c4Smrg elif test "$hardcode_minus_L" = yes; then 68342a75d1c4Smrg add_dir="-L$dir" 68352a75d1c4Smrg # Try looking first in the location we're being installed to. 68362a75d1c4Smrg if test -n "$inst_prefix_dir"; then 68372a75d1c4Smrg case $libdir in 68382a75d1c4Smrg [\\/]*) 68392a75d1c4Smrg func_append add_dir " -L$inst_prefix_dir$libdir" 68402a75d1c4Smrg ;; 68412a75d1c4Smrg esac 68422a75d1c4Smrg fi 68432a75d1c4Smrg add="-l$name" 68442a75d1c4Smrg elif test "$hardcode_shlibpath_var" = yes; then 68452a75d1c4Smrg add_shlibpath="$dir" 68462a75d1c4Smrg add="-l$name" 68472a75d1c4Smrg else 68482a75d1c4Smrg lib_linked=no 68492a75d1c4Smrg fi 68502a75d1c4Smrg ;; 68512a75d1c4Smrg *) lib_linked=no ;; 68522a75d1c4Smrg esac 68532a75d1c4Smrg 68542a75d1c4Smrg if test "$lib_linked" != yes; then 68552a75d1c4Smrg func_fatal_configuration "unsupported hardcode properties" 68562a75d1c4Smrg fi 68572a75d1c4Smrg 68582a75d1c4Smrg if test -n "$add_shlibpath"; then 68592a75d1c4Smrg case :$compile_shlibpath: in 68602a75d1c4Smrg *":$add_shlibpath:"*) ;; 68612a75d1c4Smrg *) func_append compile_shlibpath "$add_shlibpath:" ;; 68622a75d1c4Smrg esac 68632a75d1c4Smrg fi 68642a75d1c4Smrg if test "$linkmode" = prog; then 68652a75d1c4Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 68662a75d1c4Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 68672a75d1c4Smrg else 68682a75d1c4Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 68692a75d1c4Smrg test -n "$add" && deplibs="$add $deplibs" 68702a75d1c4Smrg if test "$hardcode_direct" != yes && 68712a75d1c4Smrg test "$hardcode_minus_L" != yes && 68722a75d1c4Smrg test "$hardcode_shlibpath_var" = yes; then 68732a75d1c4Smrg case :$finalize_shlibpath: in 68742a75d1c4Smrg *":$libdir:"*) ;; 68752a75d1c4Smrg *) func_append finalize_shlibpath "$libdir:" ;; 68762a75d1c4Smrg esac 68772a75d1c4Smrg fi 68782a75d1c4Smrg fi 68792a75d1c4Smrg fi 68802a75d1c4Smrg 68812a75d1c4Smrg if test "$linkmode" = prog || test "$opt_mode" = relink; then 68822a75d1c4Smrg add_shlibpath= 68832a75d1c4Smrg add_dir= 68842a75d1c4Smrg add= 68852a75d1c4Smrg # Finalize command for both is simple: just hardcode it. 68862a75d1c4Smrg if test "$hardcode_direct" = yes && 68872a75d1c4Smrg test "$hardcode_direct_absolute" = no; then 68882a75d1c4Smrg add="$libdir/$linklib" 68892a75d1c4Smrg elif test "$hardcode_minus_L" = yes; then 68902a75d1c4Smrg add_dir="-L$libdir" 68912a75d1c4Smrg add="-l$name" 68922a75d1c4Smrg elif test "$hardcode_shlibpath_var" = yes; then 68932a75d1c4Smrg case :$finalize_shlibpath: in 68942a75d1c4Smrg *":$libdir:"*) ;; 68952a75d1c4Smrg *) func_append finalize_shlibpath "$libdir:" ;; 68962a75d1c4Smrg esac 68972a75d1c4Smrg add="-l$name" 68982a75d1c4Smrg elif test "$hardcode_automatic" = yes; then 68992a75d1c4Smrg if test -n "$inst_prefix_dir" && 69002a75d1c4Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 69012a75d1c4Smrg add="$inst_prefix_dir$libdir/$linklib" 69022a75d1c4Smrg else 69032a75d1c4Smrg add="$libdir/$linklib" 69042a75d1c4Smrg fi 69052a75d1c4Smrg else 69062a75d1c4Smrg # We cannot seem to hardcode it, guess we'll fake it. 69072a75d1c4Smrg add_dir="-L$libdir" 69082a75d1c4Smrg # Try looking first in the location we're being installed to. 69092a75d1c4Smrg if test -n "$inst_prefix_dir"; then 69102a75d1c4Smrg case $libdir in 69112a75d1c4Smrg [\\/]*) 69122a75d1c4Smrg func_append add_dir " -L$inst_prefix_dir$libdir" 69132a75d1c4Smrg ;; 69142a75d1c4Smrg esac 69152a75d1c4Smrg fi 69162a75d1c4Smrg add="-l$name" 69172a75d1c4Smrg fi 69182a75d1c4Smrg 69192a75d1c4Smrg if test "$linkmode" = prog; then 69202a75d1c4Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 69212a75d1c4Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 69222a75d1c4Smrg else 69232a75d1c4Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 69242a75d1c4Smrg test -n "$add" && deplibs="$add $deplibs" 69252a75d1c4Smrg fi 69262a75d1c4Smrg fi 69272a75d1c4Smrg elif test "$linkmode" = prog; then 69282a75d1c4Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 69292a75d1c4Smrg # is not unsupported. This is valid on all known static and 69302a75d1c4Smrg # shared platforms. 69312a75d1c4Smrg if test "$hardcode_direct" != unsupported; then 69322a75d1c4Smrg test -n "$old_library" && linklib="$old_library" 69332a75d1c4Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 69342a75d1c4Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 69352a75d1c4Smrg else 69362a75d1c4Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 69372a75d1c4Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 69382a75d1c4Smrg fi 69392a75d1c4Smrg elif test "$build_libtool_libs" = yes; then 69402a75d1c4Smrg # Not a shared library 69412a75d1c4Smrg if test "$deplibs_check_method" != pass_all; then 69422a75d1c4Smrg # We're trying link a shared library against a static one 69432a75d1c4Smrg # but the system doesn't support it. 69442a75d1c4Smrg 69452a75d1c4Smrg # Just print a warning and add the library to dependency_libs so 69462a75d1c4Smrg # that the program can be linked against the static library. 69472a75d1c4Smrg echo 69482a75d1c4Smrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 69492a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 69502a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 69512a75d1c4Smrg echo "*** shared version of the library, which you do not appear to have." 69522a75d1c4Smrg if test "$module" = yes; then 69532a75d1c4Smrg echo "*** But as you try to build a module library, libtool will still create " 69542a75d1c4Smrg echo "*** a static module, that should work as long as the dlopening application" 69552a75d1c4Smrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 69562a75d1c4Smrg if test -z "$global_symbol_pipe"; then 69572a75d1c4Smrg echo 69582a75d1c4Smrg echo "*** However, this would only work if libtool was able to extract symbol" 69592a75d1c4Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 69602a75d1c4Smrg echo "*** not find such a program. So, this module is probably useless." 69612a75d1c4Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 69622a75d1c4Smrg fi 69632a75d1c4Smrg if test "$build_old_libs" = no; then 69642a75d1c4Smrg build_libtool_libs=module 69652a75d1c4Smrg build_old_libs=yes 69662a75d1c4Smrg else 69672a75d1c4Smrg build_libtool_libs=no 69682a75d1c4Smrg fi 69692a75d1c4Smrg fi 69702a75d1c4Smrg else 69712a75d1c4Smrg deplibs="$dir/$old_library $deplibs" 69722a75d1c4Smrg link_static=yes 69732a75d1c4Smrg fi 69742a75d1c4Smrg fi # link shared/static library? 69752a75d1c4Smrg 69762a75d1c4Smrg if test "$linkmode" = lib; then 69772a75d1c4Smrg if test -n "$dependency_libs" && 69782a75d1c4Smrg { test "$hardcode_into_libs" != yes || 69792a75d1c4Smrg test "$build_old_libs" = yes || 69802a75d1c4Smrg test "$link_static" = yes; }; then 69812a75d1c4Smrg # Extract -R from dependency_libs 69822a75d1c4Smrg temp_deplibs= 69832a75d1c4Smrg for libdir in $dependency_libs; do 69842a75d1c4Smrg case $libdir in 69852a75d1c4Smrg -R*) func_stripname '-R' '' "$libdir" 69862a75d1c4Smrg temp_xrpath=$func_stripname_result 69872a75d1c4Smrg case " $xrpath " in 69882a75d1c4Smrg *" $temp_xrpath "*) ;; 69892a75d1c4Smrg *) func_append xrpath " $temp_xrpath";; 69902a75d1c4Smrg esac;; 69912a75d1c4Smrg *) func_append temp_deplibs " $libdir";; 69922a75d1c4Smrg esac 69932a75d1c4Smrg done 69942a75d1c4Smrg dependency_libs="$temp_deplibs" 69952a75d1c4Smrg fi 69962a75d1c4Smrg 69972a75d1c4Smrg func_append newlib_search_path " $absdir" 69982a75d1c4Smrg # Link against this library 69992a75d1c4Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 70002a75d1c4Smrg # ... and its dependency_libs 70012a75d1c4Smrg tmp_libs= 70022a75d1c4Smrg for deplib in $dependency_libs; do 70032a75d1c4Smrg newdependency_libs="$deplib $newdependency_libs" 70042a75d1c4Smrg case $deplib in 70052a75d1c4Smrg -L*) func_stripname '-L' '' "$deplib" 70062a75d1c4Smrg func_resolve_sysroot "$func_stripname_result";; 70072a75d1c4Smrg *) func_resolve_sysroot "$deplib" ;; 70082a75d1c4Smrg esac 70092a75d1c4Smrg if $opt_preserve_dup_deps ; then 70102a75d1c4Smrg case "$tmp_libs " in 70112a75d1c4Smrg *" $func_resolve_sysroot_result "*) 70122a75d1c4Smrg func_append specialdeplibs " $func_resolve_sysroot_result" ;; 70132a75d1c4Smrg esac 70142a75d1c4Smrg fi 70152a75d1c4Smrg func_append tmp_libs " $func_resolve_sysroot_result" 70162a75d1c4Smrg done 70172a75d1c4Smrg 70182a75d1c4Smrg if test "$link_all_deplibs" != no; then 70192a75d1c4Smrg # Add the search paths of all dependency libraries 70202a75d1c4Smrg for deplib in $dependency_libs; do 70212a75d1c4Smrg path= 70222a75d1c4Smrg case $deplib in 70232a75d1c4Smrg -L*) path="$deplib" ;; 70242a75d1c4Smrg *.la) 70252a75d1c4Smrg func_resolve_sysroot "$deplib" 70262a75d1c4Smrg deplib=$func_resolve_sysroot_result 70272a75d1c4Smrg func_dirname "$deplib" "" "." 70282a75d1c4Smrg dir=$func_dirname_result 70292a75d1c4Smrg # We need an absolute path. 70302a75d1c4Smrg case $dir in 70312a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 70322a75d1c4Smrg *) 70332a75d1c4Smrg absdir=`cd "$dir" && pwd` 70342a75d1c4Smrg if test -z "$absdir"; then 70352a75d1c4Smrg func_warning "cannot determine absolute directory name of \`$dir'" 70362a75d1c4Smrg absdir="$dir" 70372a75d1c4Smrg fi 70382a75d1c4Smrg ;; 70392a75d1c4Smrg esac 70402a75d1c4Smrg if $GREP "^installed=no" $deplib > /dev/null; then 70412a75d1c4Smrg case $host in 70422a75d1c4Smrg *-*-darwin*) 70432a75d1c4Smrg depdepl= 70442a75d1c4Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 70452a75d1c4Smrg if test -n "$deplibrary_names" ; then 70462a75d1c4Smrg for tmp in $deplibrary_names ; do 70472a75d1c4Smrg depdepl=$tmp 70482a75d1c4Smrg done 70492a75d1c4Smrg if test -f "$absdir/$objdir/$depdepl" ; then 70502a75d1c4Smrg depdepl="$absdir/$objdir/$depdepl" 70512a75d1c4Smrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 70522a75d1c4Smrg if test -z "$darwin_install_name"; then 70532a75d1c4Smrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 70542a75d1c4Smrg fi 70552a75d1c4Smrg func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 70562a75d1c4Smrg func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 70572a75d1c4Smrg path= 70582a75d1c4Smrg fi 70592a75d1c4Smrg fi 70602a75d1c4Smrg ;; 70612a75d1c4Smrg *) 70622a75d1c4Smrg path="-L$absdir/$objdir" 70632a75d1c4Smrg ;; 70642a75d1c4Smrg esac 70652a75d1c4Smrg else 70662a75d1c4Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 70672a75d1c4Smrg test -z "$libdir" && \ 70682a75d1c4Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 70692a75d1c4Smrg test "$absdir" != "$libdir" && \ 70702a75d1c4Smrg func_warning "\`$deplib' seems to be moved" 70712a75d1c4Smrg 70722a75d1c4Smrg path="-L$absdir" 70732a75d1c4Smrg fi 70742a75d1c4Smrg ;; 70752a75d1c4Smrg esac 70762a75d1c4Smrg case " $deplibs " in 70772a75d1c4Smrg *" $path "*) ;; 70782a75d1c4Smrg *) deplibs="$path $deplibs" ;; 70792a75d1c4Smrg esac 70802a75d1c4Smrg done 70812a75d1c4Smrg fi # link_all_deplibs != no 70822a75d1c4Smrg fi # linkmode = lib 70832a75d1c4Smrg done # for deplib in $libs 70842a75d1c4Smrg if test "$pass" = link; then 70852a75d1c4Smrg if test "$linkmode" = "prog"; then 70862a75d1c4Smrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 70872a75d1c4Smrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 70882a75d1c4Smrg else 70892a75d1c4Smrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 70902a75d1c4Smrg fi 70912a75d1c4Smrg fi 70922a75d1c4Smrg dependency_libs="$newdependency_libs" 70932a75d1c4Smrg if test "$pass" = dlpreopen; then 70942a75d1c4Smrg # Link the dlpreopened libraries before other libraries 70952a75d1c4Smrg for deplib in $save_deplibs; do 70962a75d1c4Smrg deplibs="$deplib $deplibs" 70972a75d1c4Smrg done 70982a75d1c4Smrg fi 70992a75d1c4Smrg if test "$pass" != dlopen; then 71002a75d1c4Smrg if test "$pass" != conv; then 71012a75d1c4Smrg # Make sure lib_search_path contains only unique directories. 71022a75d1c4Smrg lib_search_path= 71032a75d1c4Smrg for dir in $newlib_search_path; do 71042a75d1c4Smrg case "$lib_search_path " in 71052a75d1c4Smrg *" $dir "*) ;; 71062a75d1c4Smrg *) func_append lib_search_path " $dir" ;; 71072a75d1c4Smrg esac 71082a75d1c4Smrg done 71092a75d1c4Smrg newlib_search_path= 71102a75d1c4Smrg fi 71112a75d1c4Smrg 71122a75d1c4Smrg if test "$linkmode,$pass" != "prog,link"; then 71132a75d1c4Smrg vars="deplibs" 71142a75d1c4Smrg else 71152a75d1c4Smrg vars="compile_deplibs finalize_deplibs" 71162a75d1c4Smrg fi 71172a75d1c4Smrg for var in $vars dependency_libs; do 71182a75d1c4Smrg # Add libraries to $var in reverse order 71192a75d1c4Smrg eval tmp_libs=\"\$$var\" 71202a75d1c4Smrg new_libs= 71212a75d1c4Smrg for deplib in $tmp_libs; do 71222a75d1c4Smrg # FIXME: Pedantically, this is the right thing to do, so 71232a75d1c4Smrg # that some nasty dependency loop isn't accidentally 71242a75d1c4Smrg # broken: 71252a75d1c4Smrg #new_libs="$deplib $new_libs" 71262a75d1c4Smrg # Pragmatically, this seems to cause very few problems in 71272a75d1c4Smrg # practice: 71282a75d1c4Smrg case $deplib in 71292a75d1c4Smrg -L*) new_libs="$deplib $new_libs" ;; 71302a75d1c4Smrg -R*) ;; 71312a75d1c4Smrg *) 71322a75d1c4Smrg # And here is the reason: when a library appears more 71332a75d1c4Smrg # than once as an explicit dependence of a library, or 71342a75d1c4Smrg # is implicitly linked in more than once by the 71352a75d1c4Smrg # compiler, it is considered special, and multiple 71362a75d1c4Smrg # occurrences thereof are not removed. Compare this 71372a75d1c4Smrg # with having the same library being listed as a 71382a75d1c4Smrg # dependency of multiple other libraries: in this case, 71392a75d1c4Smrg # we know (pedantically, we assume) the library does not 71402a75d1c4Smrg # need to be listed more than once, so we keep only the 71412a75d1c4Smrg # last copy. This is not always right, but it is rare 71422a75d1c4Smrg # enough that we require users that really mean to play 71432a75d1c4Smrg # such unportable linking tricks to link the library 71442a75d1c4Smrg # using -Wl,-lname, so that libtool does not consider it 71452a75d1c4Smrg # for duplicate removal. 71462a75d1c4Smrg case " $specialdeplibs " in 71472a75d1c4Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 71482a75d1c4Smrg *) 71492a75d1c4Smrg case " $new_libs " in 71502a75d1c4Smrg *" $deplib "*) ;; 71512a75d1c4Smrg *) new_libs="$deplib $new_libs" ;; 71522a75d1c4Smrg esac 71532a75d1c4Smrg ;; 71542a75d1c4Smrg esac 71552a75d1c4Smrg ;; 71562a75d1c4Smrg esac 71572a75d1c4Smrg done 71582a75d1c4Smrg tmp_libs= 71592a75d1c4Smrg for deplib in $new_libs; do 71602a75d1c4Smrg case $deplib in 71612a75d1c4Smrg -L*) 71622a75d1c4Smrg case " $tmp_libs " in 71632a75d1c4Smrg *" $deplib "*) ;; 71642a75d1c4Smrg *) func_append tmp_libs " $deplib" ;; 71652a75d1c4Smrg esac 71662a75d1c4Smrg ;; 71672a75d1c4Smrg *) func_append tmp_libs " $deplib" ;; 71682a75d1c4Smrg esac 71692a75d1c4Smrg done 71702a75d1c4Smrg eval $var=\"$tmp_libs\" 71712a75d1c4Smrg done # for var 71722a75d1c4Smrg fi 71732a75d1c4Smrg # Last step: remove runtime libs from dependency_libs 71742a75d1c4Smrg # (they stay in deplibs) 71752a75d1c4Smrg tmp_libs= 71762a75d1c4Smrg for i in $dependency_libs ; do 71772a75d1c4Smrg case " $predeps $postdeps $compiler_lib_search_path " in 71782a75d1c4Smrg *" $i "*) 71792a75d1c4Smrg i="" 71802a75d1c4Smrg ;; 71812a75d1c4Smrg esac 71822a75d1c4Smrg if test -n "$i" ; then 71832a75d1c4Smrg func_append tmp_libs " $i" 71842a75d1c4Smrg fi 71852a75d1c4Smrg done 71862a75d1c4Smrg dependency_libs=$tmp_libs 71872a75d1c4Smrg done # for pass 71882a75d1c4Smrg if test "$linkmode" = prog; then 71892a75d1c4Smrg dlfiles="$newdlfiles" 71902a75d1c4Smrg fi 71912a75d1c4Smrg if test "$linkmode" = prog || test "$linkmode" = lib; then 71922a75d1c4Smrg dlprefiles="$newdlprefiles" 71932a75d1c4Smrg fi 71942a75d1c4Smrg 71952a75d1c4Smrg case $linkmode in 71962a75d1c4Smrg oldlib) 71972a75d1c4Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 71982a75d1c4Smrg func_warning "\`-dlopen' is ignored for archives" 71992a75d1c4Smrg fi 72002a75d1c4Smrg 72012a75d1c4Smrg case " $deplibs" in 72022a75d1c4Smrg *\ -l* | *\ -L*) 72032a75d1c4Smrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 72042a75d1c4Smrg esac 72052a75d1c4Smrg 72062a75d1c4Smrg test -n "$rpath" && \ 72072a75d1c4Smrg func_warning "\`-rpath' is ignored for archives" 72082a75d1c4Smrg 72092a75d1c4Smrg test -n "$xrpath" && \ 72102a75d1c4Smrg func_warning "\`-R' is ignored for archives" 72112a75d1c4Smrg 72122a75d1c4Smrg test -n "$vinfo" && \ 72132a75d1c4Smrg func_warning "\`-version-info/-version-number' is ignored for archives" 72142a75d1c4Smrg 72152a75d1c4Smrg test -n "$release" && \ 72162a75d1c4Smrg func_warning "\`-release' is ignored for archives" 72172a75d1c4Smrg 72182a75d1c4Smrg test -n "$export_symbols$export_symbols_regex" && \ 72192a75d1c4Smrg func_warning "\`-export-symbols' is ignored for archives" 72202a75d1c4Smrg 72212a75d1c4Smrg # Now set the variables for building old libraries. 72222a75d1c4Smrg build_libtool_libs=no 72232a75d1c4Smrg oldlibs="$output" 72242a75d1c4Smrg func_append objs "$old_deplibs" 72252a75d1c4Smrg ;; 72262a75d1c4Smrg 72272a75d1c4Smrg lib) 72282a75d1c4Smrg # Make sure we only generate libraries of the form `libNAME.la'. 72292a75d1c4Smrg case $outputname in 72302a75d1c4Smrg lib*) 72312a75d1c4Smrg func_stripname 'lib' '.la' "$outputname" 72322a75d1c4Smrg name=$func_stripname_result 72332a75d1c4Smrg eval shared_ext=\"$shrext_cmds\" 72342a75d1c4Smrg eval libname=\"$libname_spec\" 72352a75d1c4Smrg ;; 72362a75d1c4Smrg *) 72372a75d1c4Smrg test "$module" = no && \ 72382a75d1c4Smrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 72392a75d1c4Smrg 72402a75d1c4Smrg if test "$need_lib_prefix" != no; then 72412a75d1c4Smrg # Add the "lib" prefix for modules if required 72422a75d1c4Smrg func_stripname '' '.la' "$outputname" 72432a75d1c4Smrg name=$func_stripname_result 72442a75d1c4Smrg eval shared_ext=\"$shrext_cmds\" 72452a75d1c4Smrg eval libname=\"$libname_spec\" 72462a75d1c4Smrg else 72472a75d1c4Smrg func_stripname '' '.la' "$outputname" 72482a75d1c4Smrg libname=$func_stripname_result 72492a75d1c4Smrg fi 72502a75d1c4Smrg ;; 72512a75d1c4Smrg esac 72522a75d1c4Smrg 72532a75d1c4Smrg if test -n "$objs"; then 72542a75d1c4Smrg if test "$deplibs_check_method" != pass_all; then 72552a75d1c4Smrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 72562a75d1c4Smrg else 72572a75d1c4Smrg echo 72582a75d1c4Smrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 72592a75d1c4Smrg $ECHO "*** objects $objs is not portable!" 72602a75d1c4Smrg func_append libobjs " $objs" 72612a75d1c4Smrg fi 72622a75d1c4Smrg fi 72632a75d1c4Smrg 72642a75d1c4Smrg test "$dlself" != no && \ 72652a75d1c4Smrg func_warning "\`-dlopen self' is ignored for libtool libraries" 72662a75d1c4Smrg 72672a75d1c4Smrg set dummy $rpath 72682a75d1c4Smrg shift 72692a75d1c4Smrg test "$#" -gt 1 && \ 72702a75d1c4Smrg func_warning "ignoring multiple \`-rpath's for a libtool library" 72712a75d1c4Smrg 72722a75d1c4Smrg install_libdir="$1" 72732a75d1c4Smrg 72742a75d1c4Smrg oldlibs= 72752a75d1c4Smrg if test -z "$rpath"; then 72762a75d1c4Smrg if test "$build_libtool_libs" = yes; then 72772a75d1c4Smrg # Building a libtool convenience library. 72782a75d1c4Smrg # Some compilers have problems with a `.al' extension so 72792a75d1c4Smrg # convenience libraries should have the same extension an 72802a75d1c4Smrg # archive normally would. 72812a75d1c4Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 72822a75d1c4Smrg build_libtool_libs=convenience 72832a75d1c4Smrg build_old_libs=yes 72842a75d1c4Smrg fi 72852a75d1c4Smrg 72862a75d1c4Smrg test -n "$vinfo" && \ 72872a75d1c4Smrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 72882a75d1c4Smrg 72892a75d1c4Smrg test -n "$release" && \ 72902a75d1c4Smrg func_warning "\`-release' is ignored for convenience libraries" 72912a75d1c4Smrg else 72922a75d1c4Smrg 72932a75d1c4Smrg # Parse the version information argument. 72942a75d1c4Smrg save_ifs="$IFS"; IFS=':' 72952a75d1c4Smrg set dummy $vinfo 0 0 0 72962a75d1c4Smrg shift 72972a75d1c4Smrg IFS="$save_ifs" 72982a75d1c4Smrg 72992a75d1c4Smrg test -n "$7" && \ 73002a75d1c4Smrg func_fatal_help "too many parameters to \`-version-info'" 73012a75d1c4Smrg 73022a75d1c4Smrg # convert absolute version numbers to libtool ages 73032a75d1c4Smrg # this retains compatibility with .la files and attempts 73042a75d1c4Smrg # to make the code below a bit more comprehensible 73052a75d1c4Smrg 73062a75d1c4Smrg case $vinfo_number in 73072a75d1c4Smrg yes) 73082a75d1c4Smrg number_major="$1" 73092a75d1c4Smrg number_minor="$2" 73102a75d1c4Smrg number_revision="$3" 73112a75d1c4Smrg # 73122a75d1c4Smrg # There are really only two kinds -- those that 73132a75d1c4Smrg # use the current revision as the major version 73142a75d1c4Smrg # and those that subtract age and use age as 73152a75d1c4Smrg # a minor version. But, then there is irix 73162a75d1c4Smrg # which has an extra 1 added just for fun 73172a75d1c4Smrg # 73182a75d1c4Smrg case $version_type in 73192a75d1c4Smrg darwin|linux|osf|windows|none) 73202a75d1c4Smrg func_arith $number_major + $number_minor 73212a75d1c4Smrg current=$func_arith_result 73222a75d1c4Smrg age="$number_minor" 73232a75d1c4Smrg revision="$number_revision" 73242a75d1c4Smrg ;; 73252a75d1c4Smrg freebsd-aout|freebsd-elf|qnx|sunos) 73262a75d1c4Smrg current="$number_major" 73272a75d1c4Smrg revision="$number_minor" 73282a75d1c4Smrg age="0" 73292a75d1c4Smrg ;; 73302a75d1c4Smrg irix|nonstopux) 73312a75d1c4Smrg func_arith $number_major + $number_minor 73322a75d1c4Smrg current=$func_arith_result 73332a75d1c4Smrg age="$number_minor" 73342a75d1c4Smrg revision="$number_minor" 73352a75d1c4Smrg lt_irix_increment=no 73362a75d1c4Smrg ;; 73372a75d1c4Smrg esac 73382a75d1c4Smrg ;; 73392a75d1c4Smrg no) 73402a75d1c4Smrg current="$1" 73412a75d1c4Smrg revision="$2" 73422a75d1c4Smrg age="$3" 73432a75d1c4Smrg ;; 73442a75d1c4Smrg esac 73452a75d1c4Smrg 73462a75d1c4Smrg # Check that each of the things are valid numbers. 73472a75d1c4Smrg case $current in 73482a75d1c4Smrg 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]) ;; 73492a75d1c4Smrg *) 73502a75d1c4Smrg func_error "CURRENT \`$current' must be a nonnegative integer" 73512a75d1c4Smrg func_fatal_error "\`$vinfo' is not valid version information" 73522a75d1c4Smrg ;; 73532a75d1c4Smrg esac 73542a75d1c4Smrg 73552a75d1c4Smrg case $revision in 73562a75d1c4Smrg 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]) ;; 73572a75d1c4Smrg *) 73582a75d1c4Smrg func_error "REVISION \`$revision' must be a nonnegative integer" 73592a75d1c4Smrg func_fatal_error "\`$vinfo' is not valid version information" 73602a75d1c4Smrg ;; 73612a75d1c4Smrg esac 73622a75d1c4Smrg 73632a75d1c4Smrg case $age in 73642a75d1c4Smrg 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]) ;; 73652a75d1c4Smrg *) 73662a75d1c4Smrg func_error "AGE \`$age' must be a nonnegative integer" 73672a75d1c4Smrg func_fatal_error "\`$vinfo' is not valid version information" 73682a75d1c4Smrg ;; 73692a75d1c4Smrg esac 73702a75d1c4Smrg 73712a75d1c4Smrg if test "$age" -gt "$current"; then 73722a75d1c4Smrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 73732a75d1c4Smrg func_fatal_error "\`$vinfo' is not valid version information" 73742a75d1c4Smrg fi 73752a75d1c4Smrg 73762a75d1c4Smrg # Calculate the version variables. 73772a75d1c4Smrg major= 73782a75d1c4Smrg versuffix= 73792a75d1c4Smrg verstring= 73802a75d1c4Smrg case $version_type in 73812a75d1c4Smrg none) ;; 73822a75d1c4Smrg 73832a75d1c4Smrg darwin) 73842a75d1c4Smrg # Like Linux, but with the current version available in 73852a75d1c4Smrg # verstring for coding it into the library header 73862a75d1c4Smrg func_arith $current - $age 73872a75d1c4Smrg major=.$func_arith_result 73882a75d1c4Smrg versuffix="$major.$age.$revision" 73892a75d1c4Smrg # Darwin ld doesn't like 0 for these options... 73902a75d1c4Smrg func_arith $current + 1 73912a75d1c4Smrg minor_current=$func_arith_result 73922a75d1c4Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 73932a75d1c4Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 73942a75d1c4Smrg ;; 73952a75d1c4Smrg 73962a75d1c4Smrg freebsd-aout) 73972a75d1c4Smrg major=".$current" 73982a75d1c4Smrg versuffix=".$current.$revision"; 73992a75d1c4Smrg ;; 74002a75d1c4Smrg 74012a75d1c4Smrg freebsd-elf) 74022a75d1c4Smrg major=".$current" 74032a75d1c4Smrg versuffix=".$current" 74042a75d1c4Smrg ;; 74052a75d1c4Smrg 74062a75d1c4Smrg irix | nonstopux) 74072a75d1c4Smrg if test "X$lt_irix_increment" = "Xno"; then 74082a75d1c4Smrg func_arith $current - $age 74092a75d1c4Smrg else 74102a75d1c4Smrg func_arith $current - $age + 1 74112a75d1c4Smrg fi 74122a75d1c4Smrg major=$func_arith_result 74132a75d1c4Smrg 74142a75d1c4Smrg case $version_type in 74152a75d1c4Smrg nonstopux) verstring_prefix=nonstopux ;; 74162a75d1c4Smrg *) verstring_prefix=sgi ;; 74172a75d1c4Smrg esac 74182a75d1c4Smrg verstring="$verstring_prefix$major.$revision" 74192a75d1c4Smrg 74202a75d1c4Smrg # Add in all the interfaces that we are compatible with. 74212a75d1c4Smrg loop=$revision 74222a75d1c4Smrg while test "$loop" -ne 0; do 74232a75d1c4Smrg func_arith $revision - $loop 74242a75d1c4Smrg iface=$func_arith_result 74252a75d1c4Smrg func_arith $loop - 1 74262a75d1c4Smrg loop=$func_arith_result 74272a75d1c4Smrg verstring="$verstring_prefix$major.$iface:$verstring" 74282a75d1c4Smrg done 74292a75d1c4Smrg 74302a75d1c4Smrg # Before this point, $major must not contain `.'. 74312a75d1c4Smrg major=.$major 74322a75d1c4Smrg versuffix="$major.$revision" 74332a75d1c4Smrg ;; 74342a75d1c4Smrg 74352a75d1c4Smrg linux) 74362a75d1c4Smrg func_arith $current - $age 74372a75d1c4Smrg major=.$func_arith_result 74382a75d1c4Smrg versuffix="$major.$age.$revision" 74392a75d1c4Smrg ;; 74402a75d1c4Smrg 74412a75d1c4Smrg osf) 74422a75d1c4Smrg func_arith $current - $age 74432a75d1c4Smrg major=.$func_arith_result 74442a75d1c4Smrg versuffix=".$current.$age.$revision" 74452a75d1c4Smrg verstring="$current.$age.$revision" 74462a75d1c4Smrg 74472a75d1c4Smrg # Add in all the interfaces that we are compatible with. 74482a75d1c4Smrg loop=$age 74492a75d1c4Smrg while test "$loop" -ne 0; do 74502a75d1c4Smrg func_arith $current - $loop 74512a75d1c4Smrg iface=$func_arith_result 74522a75d1c4Smrg func_arith $loop - 1 74532a75d1c4Smrg loop=$func_arith_result 74542a75d1c4Smrg verstring="$verstring:${iface}.0" 74552a75d1c4Smrg done 74562a75d1c4Smrg 74572a75d1c4Smrg # Make executables depend on our current version. 74582a75d1c4Smrg func_append verstring ":${current}.0" 74592a75d1c4Smrg ;; 74602a75d1c4Smrg 74612a75d1c4Smrg qnx) 74622a75d1c4Smrg major=".$current" 74632a75d1c4Smrg versuffix=".$current" 74642a75d1c4Smrg ;; 74652a75d1c4Smrg 74662a75d1c4Smrg sunos) 74672a75d1c4Smrg major=".$current" 74682a75d1c4Smrg versuffix=".$current.$revision" 74692a75d1c4Smrg ;; 74702a75d1c4Smrg 74712a75d1c4Smrg windows) 74722a75d1c4Smrg # Use '-' rather than '.', since we only want one 74732a75d1c4Smrg # extension on DOS 8.3 filesystems. 74742a75d1c4Smrg func_arith $current - $age 74752a75d1c4Smrg major=$func_arith_result 74762a75d1c4Smrg versuffix="-$major" 74772a75d1c4Smrg ;; 74782a75d1c4Smrg 74792a75d1c4Smrg *) 74802a75d1c4Smrg func_fatal_configuration "unknown library version type \`$version_type'" 74812a75d1c4Smrg ;; 74822a75d1c4Smrg esac 74832a75d1c4Smrg 74842a75d1c4Smrg # Clear the version info if we defaulted, and they specified a release. 74852a75d1c4Smrg if test -z "$vinfo" && test -n "$release"; then 74862a75d1c4Smrg major= 74872a75d1c4Smrg case $version_type in 74882a75d1c4Smrg darwin) 74892a75d1c4Smrg # we can't check for "0.0" in archive_cmds due to quoting 74902a75d1c4Smrg # problems, so we reset it completely 74912a75d1c4Smrg verstring= 74922a75d1c4Smrg ;; 74932a75d1c4Smrg *) 74942a75d1c4Smrg verstring="0.0" 74952a75d1c4Smrg ;; 74962a75d1c4Smrg esac 74972a75d1c4Smrg if test "$need_version" = no; then 74982a75d1c4Smrg versuffix= 74992a75d1c4Smrg else 75002a75d1c4Smrg versuffix=".0.0" 75012a75d1c4Smrg fi 75022a75d1c4Smrg fi 75032a75d1c4Smrg 75042a75d1c4Smrg # Remove version info from name if versioning should be avoided 75052a75d1c4Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 75062a75d1c4Smrg major= 75072a75d1c4Smrg versuffix= 75082a75d1c4Smrg verstring="" 75092a75d1c4Smrg fi 75102a75d1c4Smrg 75112a75d1c4Smrg # Check to see if the archive will have undefined symbols. 75122a75d1c4Smrg if test "$allow_undefined" = yes; then 75132a75d1c4Smrg if test "$allow_undefined_flag" = unsupported; then 75142a75d1c4Smrg func_warning "undefined symbols not allowed in $host shared libraries" 75152a75d1c4Smrg build_libtool_libs=no 75162a75d1c4Smrg build_old_libs=yes 75172a75d1c4Smrg fi 75182a75d1c4Smrg else 75192a75d1c4Smrg # Don't allow undefined symbols. 75202a75d1c4Smrg allow_undefined_flag="$no_undefined_flag" 75212a75d1c4Smrg fi 75222a75d1c4Smrg 75232a75d1c4Smrg fi 75242a75d1c4Smrg 75252a75d1c4Smrg func_generate_dlsyms "$libname" "$libname" "yes" 75262a75d1c4Smrg func_append libobjs " $symfileobj" 75272a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 75282a75d1c4Smrg 75292a75d1c4Smrg if test "$opt_mode" != relink; then 75302a75d1c4Smrg # Remove our outputs, but don't remove object files since they 75312a75d1c4Smrg # may have been created when compiling PIC objects. 75322a75d1c4Smrg removelist= 75332a75d1c4Smrg tempremovelist=`$ECHO "$output_objdir/*"` 75342a75d1c4Smrg for p in $tempremovelist; do 75352a75d1c4Smrg case $p in 75362a75d1c4Smrg *.$objext | *.gcno) 75372a75d1c4Smrg ;; 75382a75d1c4Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 75392a75d1c4Smrg if test "X$precious_files_regex" != "X"; then 75402a75d1c4Smrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 75412a75d1c4Smrg then 75422a75d1c4Smrg continue 75432a75d1c4Smrg fi 75442a75d1c4Smrg fi 75452a75d1c4Smrg func_append removelist " $p" 75462a75d1c4Smrg ;; 75472a75d1c4Smrg *) ;; 75482a75d1c4Smrg esac 75492a75d1c4Smrg done 75502a75d1c4Smrg test -n "$removelist" && \ 75512a75d1c4Smrg func_show_eval "${RM}r \$removelist" 75522a75d1c4Smrg fi 75532a75d1c4Smrg 75542a75d1c4Smrg # Now set the variables for building old libraries. 75552a75d1c4Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 75562a75d1c4Smrg func_append oldlibs " $output_objdir/$libname.$libext" 75572a75d1c4Smrg 75582a75d1c4Smrg # Transform .lo files to .o files. 75592a75d1c4Smrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 75602a75d1c4Smrg fi 75612a75d1c4Smrg 75622a75d1c4Smrg # Eliminate all temporary directories. 75632a75d1c4Smrg #for path in $notinst_path; do 75642a75d1c4Smrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 75652a75d1c4Smrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 75662a75d1c4Smrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 75672a75d1c4Smrg #done 75682a75d1c4Smrg 75692a75d1c4Smrg if test -n "$xrpath"; then 75702a75d1c4Smrg # If the user specified any rpath flags, then add them. 75712a75d1c4Smrg temp_xrpath= 75722a75d1c4Smrg for libdir in $xrpath; do 75732a75d1c4Smrg func_replace_sysroot "$libdir" 75742a75d1c4Smrg func_append temp_xrpath " -R$func_replace_sysroot_result" 75752a75d1c4Smrg case "$finalize_rpath " in 75762a75d1c4Smrg *" $libdir "*) ;; 75772a75d1c4Smrg *) func_append finalize_rpath " $libdir" ;; 75782a75d1c4Smrg esac 75792a75d1c4Smrg done 75802a75d1c4Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 75812a75d1c4Smrg dependency_libs="$temp_xrpath $dependency_libs" 75822a75d1c4Smrg fi 75832a75d1c4Smrg fi 75842a75d1c4Smrg 75852a75d1c4Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 75862a75d1c4Smrg old_dlfiles="$dlfiles" 75872a75d1c4Smrg dlfiles= 75882a75d1c4Smrg for lib in $old_dlfiles; do 75892a75d1c4Smrg case " $dlprefiles $dlfiles " in 75902a75d1c4Smrg *" $lib "*) ;; 75912a75d1c4Smrg *) func_append dlfiles " $lib" ;; 75922a75d1c4Smrg esac 75932a75d1c4Smrg done 75942a75d1c4Smrg 75952a75d1c4Smrg # Make sure dlprefiles contains only unique files 75962a75d1c4Smrg old_dlprefiles="$dlprefiles" 75972a75d1c4Smrg dlprefiles= 75982a75d1c4Smrg for lib in $old_dlprefiles; do 75992a75d1c4Smrg case "$dlprefiles " in 76002a75d1c4Smrg *" $lib "*) ;; 76012a75d1c4Smrg *) func_append dlprefiles " $lib" ;; 76022a75d1c4Smrg esac 76032a75d1c4Smrg done 76042a75d1c4Smrg 76052a75d1c4Smrg if test "$build_libtool_libs" = yes; then 76062a75d1c4Smrg if test -n "$rpath"; then 76072a75d1c4Smrg case $host in 76082a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 76092a75d1c4Smrg # these systems don't actually have a c library (as such)! 76102a75d1c4Smrg ;; 76112a75d1c4Smrg *-*-rhapsody* | *-*-darwin1.[012]) 76122a75d1c4Smrg # Rhapsody C library is in the System framework 76132a75d1c4Smrg func_append deplibs " System.ltframework" 76142a75d1c4Smrg ;; 76152a75d1c4Smrg *-*-netbsd*) 76162a75d1c4Smrg # Don't link with libc until the a.out ld.so is fixed. 76172a75d1c4Smrg ;; 76182a75d1c4Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 76192a75d1c4Smrg # Do not include libc due to us having libc/libc_r. 76202a75d1c4Smrg ;; 76212a75d1c4Smrg *-*-sco3.2v5* | *-*-sco5v6*) 76222a75d1c4Smrg # Causes problems with __ctype 76232a75d1c4Smrg ;; 76242a75d1c4Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 76252a75d1c4Smrg # Compiler inserts libc in the correct place for threads to work 76262a75d1c4Smrg ;; 76272a75d1c4Smrg *) 76282a75d1c4Smrg # Add libc to deplibs on all other systems if necessary. 76292a75d1c4Smrg if test "$build_libtool_need_lc" = "yes"; then 76302a75d1c4Smrg func_append deplibs " -lc" 76312a75d1c4Smrg fi 76322a75d1c4Smrg ;; 76332a75d1c4Smrg esac 76342a75d1c4Smrg fi 76352a75d1c4Smrg 76362a75d1c4Smrg # Transform deplibs into only deplibs that can be linked in shared. 76372a75d1c4Smrg name_save=$name 76382a75d1c4Smrg libname_save=$libname 76392a75d1c4Smrg release_save=$release 76402a75d1c4Smrg versuffix_save=$versuffix 76412a75d1c4Smrg major_save=$major 76422a75d1c4Smrg # I'm not sure if I'm treating the release correctly. I think 76432a75d1c4Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 76442a75d1c4Smrg # add it in twice. Is that correct? 76452a75d1c4Smrg release="" 76462a75d1c4Smrg versuffix="" 76472a75d1c4Smrg major="" 76482a75d1c4Smrg newdeplibs= 76492a75d1c4Smrg droppeddeps=no 76502a75d1c4Smrg case $deplibs_check_method in 76512a75d1c4Smrg pass_all) 76522a75d1c4Smrg # Don't check for shared/static. Everything works. 76532a75d1c4Smrg # This might be a little naive. We might want to check 76542a75d1c4Smrg # whether the library exists or not. But this is on 76552a75d1c4Smrg # osf3 & osf4 and I'm not really sure... Just 76562a75d1c4Smrg # implementing what was already the behavior. 76572a75d1c4Smrg newdeplibs=$deplibs 76582a75d1c4Smrg ;; 76592a75d1c4Smrg test_compile) 76602a75d1c4Smrg # This code stresses the "libraries are programs" paradigm to its 76612a75d1c4Smrg # limits. Maybe even breaks it. We compile a program, linking it 76622a75d1c4Smrg # against the deplibs as a proxy for the library. Then we can check 76632a75d1c4Smrg # whether they linked in statically or dynamically with ldd. 76642a75d1c4Smrg $opt_dry_run || $RM conftest.c 76652a75d1c4Smrg cat > conftest.c <<EOF 76662a75d1c4Smrg int main() { return 0; } 76672a75d1c4SmrgEOF 76682a75d1c4Smrg $opt_dry_run || $RM conftest 76692a75d1c4Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 76702a75d1c4Smrg ldd_output=`ldd conftest` 76712a75d1c4Smrg for i in $deplibs; do 76722a75d1c4Smrg case $i in 76732a75d1c4Smrg -l*) 76742a75d1c4Smrg func_stripname -l '' "$i" 76752a75d1c4Smrg name=$func_stripname_result 76762a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 76772a75d1c4Smrg case " $predeps $postdeps " in 76782a75d1c4Smrg *" $i "*) 76792a75d1c4Smrg func_append newdeplibs " $i" 76802a75d1c4Smrg i="" 76812a75d1c4Smrg ;; 76822a75d1c4Smrg esac 76832a75d1c4Smrg fi 76842a75d1c4Smrg if test -n "$i" ; then 76852a75d1c4Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 76862a75d1c4Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 76872a75d1c4Smrg set dummy $deplib_matches; shift 76882a75d1c4Smrg deplib_match=$1 76892a75d1c4Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 76902a75d1c4Smrg func_append newdeplibs " $i" 76912a75d1c4Smrg else 76922a75d1c4Smrg droppeddeps=yes 76932a75d1c4Smrg echo 76942a75d1c4Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 76952a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 76962a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 76972a75d1c4Smrg echo "*** shared version of the library, which I believe you do not have" 76982a75d1c4Smrg echo "*** because a test_compile did reveal that the linker did not use it for" 76992a75d1c4Smrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 77002a75d1c4Smrg fi 77012a75d1c4Smrg fi 77022a75d1c4Smrg ;; 77032a75d1c4Smrg *) 77042a75d1c4Smrg func_append newdeplibs " $i" 77052a75d1c4Smrg ;; 77062a75d1c4Smrg esac 77072a75d1c4Smrg done 77082a75d1c4Smrg else 77092a75d1c4Smrg # Error occurred in the first compile. Let's try to salvage 77102a75d1c4Smrg # the situation: Compile a separate program for each library. 77112a75d1c4Smrg for i in $deplibs; do 77122a75d1c4Smrg case $i in 77132a75d1c4Smrg -l*) 77142a75d1c4Smrg func_stripname -l '' "$i" 77152a75d1c4Smrg name=$func_stripname_result 77162a75d1c4Smrg $opt_dry_run || $RM conftest 77172a75d1c4Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 77182a75d1c4Smrg ldd_output=`ldd conftest` 77192a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 77202a75d1c4Smrg case " $predeps $postdeps " in 77212a75d1c4Smrg *" $i "*) 77222a75d1c4Smrg func_append newdeplibs " $i" 77232a75d1c4Smrg i="" 77242a75d1c4Smrg ;; 77252a75d1c4Smrg esac 77262a75d1c4Smrg fi 77272a75d1c4Smrg if test -n "$i" ; then 77282a75d1c4Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 77292a75d1c4Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 77302a75d1c4Smrg set dummy $deplib_matches; shift 77312a75d1c4Smrg deplib_match=$1 77322a75d1c4Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77332a75d1c4Smrg func_append newdeplibs " $i" 77342a75d1c4Smrg else 77352a75d1c4Smrg droppeddeps=yes 77362a75d1c4Smrg echo 77372a75d1c4Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 77382a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 77392a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 77402a75d1c4Smrg echo "*** shared version of the library, which you do not appear to have" 77412a75d1c4Smrg echo "*** because a test_compile did reveal that the linker did not use this one" 77422a75d1c4Smrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 77432a75d1c4Smrg fi 77442a75d1c4Smrg fi 77452a75d1c4Smrg else 77462a75d1c4Smrg droppeddeps=yes 77472a75d1c4Smrg echo 77482a75d1c4Smrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 77492a75d1c4Smrg echo "*** make it link in! You will probably need to install it or some" 77502a75d1c4Smrg echo "*** library that it depends on before this library will be fully" 77512a75d1c4Smrg echo "*** functional. Installing it before continuing would be even better." 77522a75d1c4Smrg fi 77532a75d1c4Smrg ;; 77542a75d1c4Smrg *) 77552a75d1c4Smrg func_append newdeplibs " $i" 77562a75d1c4Smrg ;; 77572a75d1c4Smrg esac 77582a75d1c4Smrg done 77592a75d1c4Smrg fi 77602a75d1c4Smrg ;; 77612a75d1c4Smrg file_magic*) 77622a75d1c4Smrg set dummy $deplibs_check_method; shift 77632a75d1c4Smrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 77642a75d1c4Smrg for a_deplib in $deplibs; do 77652a75d1c4Smrg case $a_deplib in 77662a75d1c4Smrg -l*) 77672a75d1c4Smrg func_stripname -l '' "$a_deplib" 77682a75d1c4Smrg name=$func_stripname_result 77692a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 77702a75d1c4Smrg case " $predeps $postdeps " in 77712a75d1c4Smrg *" $a_deplib "*) 77722a75d1c4Smrg func_append newdeplibs " $a_deplib" 77732a75d1c4Smrg a_deplib="" 77742a75d1c4Smrg ;; 77752a75d1c4Smrg esac 77762a75d1c4Smrg fi 77772a75d1c4Smrg if test -n "$a_deplib" ; then 77782a75d1c4Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 77792a75d1c4Smrg if test -n "$file_magic_glob"; then 77802a75d1c4Smrg libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 77812a75d1c4Smrg else 77822a75d1c4Smrg libnameglob=$libname 77832a75d1c4Smrg fi 77842a75d1c4Smrg test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 77852a75d1c4Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 77862a75d1c4Smrg if test "$want_nocaseglob" = yes; then 77872a75d1c4Smrg shopt -s nocaseglob 77882a75d1c4Smrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 77892a75d1c4Smrg $nocaseglob 77902a75d1c4Smrg else 77912a75d1c4Smrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 77922a75d1c4Smrg fi 77932a75d1c4Smrg for potent_lib in $potential_libs; do 77942a75d1c4Smrg # Follow soft links. 77952a75d1c4Smrg if ls -lLd "$potent_lib" 2>/dev/null | 77962a75d1c4Smrg $GREP " -> " >/dev/null; then 77972a75d1c4Smrg continue 77982a75d1c4Smrg fi 77992a75d1c4Smrg # The statement above tries to avoid entering an 78002a75d1c4Smrg # endless loop below, in case of cyclic links. 78012a75d1c4Smrg # We might still enter an endless loop, since a link 78022a75d1c4Smrg # loop can be closed while we follow links, 78032a75d1c4Smrg # but so what? 78042a75d1c4Smrg potlib="$potent_lib" 78052a75d1c4Smrg while test -h "$potlib" 2>/dev/null; do 78062a75d1c4Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 78072a75d1c4Smrg case $potliblink in 78082a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 78092a75d1c4Smrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 78102a75d1c4Smrg esac 78112a75d1c4Smrg done 78122a75d1c4Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 78132a75d1c4Smrg $SED -e 10q | 78142a75d1c4Smrg $EGREP "$file_magic_regex" > /dev/null; then 78152a75d1c4Smrg func_append newdeplibs " $a_deplib" 78162a75d1c4Smrg a_deplib="" 78172a75d1c4Smrg break 2 78182a75d1c4Smrg fi 78192a75d1c4Smrg done 78202a75d1c4Smrg done 78212a75d1c4Smrg fi 78222a75d1c4Smrg if test -n "$a_deplib" ; then 78232a75d1c4Smrg droppeddeps=yes 78242a75d1c4Smrg echo 78252a75d1c4Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 78262a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 78272a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 78282a75d1c4Smrg echo "*** shared version of the library, which you do not appear to have" 78292a75d1c4Smrg echo "*** because I did check the linker path looking for a file starting" 78302a75d1c4Smrg if test -z "$potlib" ; then 78312a75d1c4Smrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 78322a75d1c4Smrg else 78332a75d1c4Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 78342a75d1c4Smrg $ECHO "*** using a file magic. Last file checked: $potlib" 78352a75d1c4Smrg fi 78362a75d1c4Smrg fi 78372a75d1c4Smrg ;; 78382a75d1c4Smrg *) 78392a75d1c4Smrg # Add a -L argument. 78402a75d1c4Smrg func_append newdeplibs " $a_deplib" 78412a75d1c4Smrg ;; 78422a75d1c4Smrg esac 78432a75d1c4Smrg done # Gone through all deplibs. 78442a75d1c4Smrg ;; 78452a75d1c4Smrg match_pattern*) 78462a75d1c4Smrg set dummy $deplibs_check_method; shift 78472a75d1c4Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 78482a75d1c4Smrg for a_deplib in $deplibs; do 78492a75d1c4Smrg case $a_deplib in 78502a75d1c4Smrg -l*) 78512a75d1c4Smrg func_stripname -l '' "$a_deplib" 78522a75d1c4Smrg name=$func_stripname_result 78532a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 78542a75d1c4Smrg case " $predeps $postdeps " in 78552a75d1c4Smrg *" $a_deplib "*) 78562a75d1c4Smrg func_append newdeplibs " $a_deplib" 78572a75d1c4Smrg a_deplib="" 78582a75d1c4Smrg ;; 78592a75d1c4Smrg esac 78602a75d1c4Smrg fi 78612a75d1c4Smrg if test -n "$a_deplib" ; then 78622a75d1c4Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 78632a75d1c4Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 78642a75d1c4Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 78652a75d1c4Smrg for potent_lib in $potential_libs; do 78662a75d1c4Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 78672a75d1c4Smrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 78682a75d1c4Smrg $EGREP "$match_pattern_regex" > /dev/null; then 78692a75d1c4Smrg func_append newdeplibs " $a_deplib" 78702a75d1c4Smrg a_deplib="" 78712a75d1c4Smrg break 2 78722a75d1c4Smrg fi 78732a75d1c4Smrg done 78742a75d1c4Smrg done 78752a75d1c4Smrg fi 78762a75d1c4Smrg if test -n "$a_deplib" ; then 78772a75d1c4Smrg droppeddeps=yes 78782a75d1c4Smrg echo 78792a75d1c4Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 78802a75d1c4Smrg echo "*** I have the capability to make that library automatically link in when" 78812a75d1c4Smrg echo "*** you link to this library. But I can only do this if you have a" 78822a75d1c4Smrg echo "*** shared version of the library, which you do not appear to have" 78832a75d1c4Smrg echo "*** because I did check the linker path looking for a file starting" 78842a75d1c4Smrg if test -z "$potlib" ; then 78852a75d1c4Smrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 78862a75d1c4Smrg else 78872a75d1c4Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 78882a75d1c4Smrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 78892a75d1c4Smrg fi 78902a75d1c4Smrg fi 78912a75d1c4Smrg ;; 78922a75d1c4Smrg *) 78932a75d1c4Smrg # Add a -L argument. 78942a75d1c4Smrg func_append newdeplibs " $a_deplib" 78952a75d1c4Smrg ;; 78962a75d1c4Smrg esac 78972a75d1c4Smrg done # Gone through all deplibs. 78982a75d1c4Smrg ;; 78992a75d1c4Smrg none | unknown | *) 79002a75d1c4Smrg newdeplibs="" 79012a75d1c4Smrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 79022a75d1c4Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 79032a75d1c4Smrg for i in $predeps $postdeps ; do 79042a75d1c4Smrg # can't use Xsed below, because $i might contain '/' 79052a75d1c4Smrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 79062a75d1c4Smrg done 79072a75d1c4Smrg fi 79082a75d1c4Smrg case $tmp_deplibs in 79092a75d1c4Smrg *[!\ \ ]*) 79102a75d1c4Smrg echo 79112a75d1c4Smrg if test "X$deplibs_check_method" = "Xnone"; then 79122a75d1c4Smrg echo "*** Warning: inter-library dependencies are not supported in this platform." 79132a75d1c4Smrg else 79142a75d1c4Smrg echo "*** Warning: inter-library dependencies are not known to be supported." 79152a75d1c4Smrg fi 79162a75d1c4Smrg echo "*** All declared inter-library dependencies are being dropped." 79172a75d1c4Smrg droppeddeps=yes 79182a75d1c4Smrg ;; 79192a75d1c4Smrg esac 79202a75d1c4Smrg ;; 79212a75d1c4Smrg esac 79222a75d1c4Smrg versuffix=$versuffix_save 79232a75d1c4Smrg major=$major_save 79242a75d1c4Smrg release=$release_save 79252a75d1c4Smrg libname=$libname_save 79262a75d1c4Smrg name=$name_save 79272a75d1c4Smrg 79282a75d1c4Smrg case $host in 79292a75d1c4Smrg *-*-rhapsody* | *-*-darwin1.[012]) 79302a75d1c4Smrg # On Rhapsody replace the C library with the System framework 79312a75d1c4Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 79322a75d1c4Smrg ;; 79332a75d1c4Smrg esac 79342a75d1c4Smrg 79352a75d1c4Smrg if test "$droppeddeps" = yes; then 79362a75d1c4Smrg if test "$module" = yes; then 79372a75d1c4Smrg echo 79382a75d1c4Smrg echo "*** Warning: libtool could not satisfy all declared inter-library" 79392a75d1c4Smrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 79402a75d1c4Smrg echo "*** a static module, that should work as long as the dlopening" 79412a75d1c4Smrg echo "*** application is linked with the -dlopen flag." 79422a75d1c4Smrg if test -z "$global_symbol_pipe"; then 79432a75d1c4Smrg echo 79442a75d1c4Smrg echo "*** However, this would only work if libtool was able to extract symbol" 79452a75d1c4Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 79462a75d1c4Smrg echo "*** not find such a program. So, this module is probably useless." 79472a75d1c4Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 79482a75d1c4Smrg fi 79492a75d1c4Smrg if test "$build_old_libs" = no; then 79502a75d1c4Smrg oldlibs="$output_objdir/$libname.$libext" 79512a75d1c4Smrg build_libtool_libs=module 79522a75d1c4Smrg build_old_libs=yes 79532a75d1c4Smrg else 79542a75d1c4Smrg build_libtool_libs=no 79552a75d1c4Smrg fi 79562a75d1c4Smrg else 79572a75d1c4Smrg echo "*** The inter-library dependencies that have been dropped here will be" 79582a75d1c4Smrg echo "*** automatically added whenever a program is linked with this library" 79592a75d1c4Smrg echo "*** or is declared to -dlopen it." 7960f7ec340bSmacallan 79612a75d1c4Smrg if test "$allow_undefined" = no; then 79622a75d1c4Smrg echo 79632a75d1c4Smrg echo "*** Since this library must not contain undefined symbols," 79642a75d1c4Smrg echo "*** because either the platform does not support them or" 79652a75d1c4Smrg echo "*** it was explicitly requested with -no-undefined," 79662a75d1c4Smrg echo "*** libtool will only create a static version of it." 79672a75d1c4Smrg if test "$build_old_libs" = no; then 79682a75d1c4Smrg oldlibs="$output_objdir/$libname.$libext" 79692a75d1c4Smrg build_libtool_libs=module 79702a75d1c4Smrg build_old_libs=yes 79712a75d1c4Smrg else 79722a75d1c4Smrg build_libtool_libs=no 79732a75d1c4Smrg fi 79742a75d1c4Smrg fi 79752a75d1c4Smrg fi 79762a75d1c4Smrg fi 79772a75d1c4Smrg # Done checking deplibs! 79782a75d1c4Smrg deplibs=$newdeplibs 79792a75d1c4Smrg fi 79802a75d1c4Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 79812a75d1c4Smrg case $host in 79822a75d1c4Smrg *-*-darwin*) 79832a75d1c4Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 79842a75d1c4Smrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 79852a75d1c4Smrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 79862a75d1c4Smrg ;; 79872a75d1c4Smrg esac 7988f7ec340bSmacallan 79892a75d1c4Smrg # move library search paths that coincide with paths to not yet 79902a75d1c4Smrg # installed libraries to the beginning of the library search list 79912a75d1c4Smrg new_libs= 79922a75d1c4Smrg for path in $notinst_path; do 79932a75d1c4Smrg case " $new_libs " in 79942a75d1c4Smrg *" -L$path/$objdir "*) ;; 79952a75d1c4Smrg *) 79962a75d1c4Smrg case " $deplibs " in 79972a75d1c4Smrg *" -L$path/$objdir "*) 79982a75d1c4Smrg func_append new_libs " -L$path/$objdir" ;; 79992a75d1c4Smrg esac 80002a75d1c4Smrg ;; 80012a75d1c4Smrg esac 80022a75d1c4Smrg done 80032a75d1c4Smrg for deplib in $deplibs; do 80042a75d1c4Smrg case $deplib in 80052a75d1c4Smrg -L*) 80062a75d1c4Smrg case " $new_libs " in 80072a75d1c4Smrg *" $deplib "*) ;; 80082a75d1c4Smrg *) func_append new_libs " $deplib" ;; 80092a75d1c4Smrg esac 80102a75d1c4Smrg ;; 80112a75d1c4Smrg *) func_append new_libs " $deplib" ;; 80122a75d1c4Smrg esac 80132a75d1c4Smrg done 80142a75d1c4Smrg deplibs="$new_libs" 8015f7ec340bSmacallan 80162a75d1c4Smrg # All the library-specific variables (install_libdir is set above). 80172a75d1c4Smrg library_names= 80182a75d1c4Smrg old_library= 80192a75d1c4Smrg dlname= 8020f7ec340bSmacallan 80212a75d1c4Smrg # Test again, we may have decided not to build it any more 80222a75d1c4Smrg if test "$build_libtool_libs" = yes; then 80232a75d1c4Smrg if test "$hardcode_into_libs" = yes; then 80242a75d1c4Smrg # Hardcode the library paths 80252a75d1c4Smrg hardcode_libdirs= 80262a75d1c4Smrg dep_rpath= 80272a75d1c4Smrg rpath="$finalize_rpath" 80282a75d1c4Smrg test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 80292a75d1c4Smrg for libdir in $rpath; do 80302a75d1c4Smrg if test -n "$hardcode_libdir_flag_spec"; then 80312a75d1c4Smrg if test -n "$hardcode_libdir_separator"; then 80322a75d1c4Smrg func_replace_sysroot "$libdir" 80332a75d1c4Smrg libdir=$func_replace_sysroot_result 80342a75d1c4Smrg if test -z "$hardcode_libdirs"; then 80352a75d1c4Smrg hardcode_libdirs="$libdir" 80362a75d1c4Smrg else 80372a75d1c4Smrg # Just accumulate the unique libdirs. 80382a75d1c4Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 80392a75d1c4Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 80402a75d1c4Smrg ;; 80412a75d1c4Smrg *) 80422a75d1c4Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 80432a75d1c4Smrg ;; 80442a75d1c4Smrg esac 80452a75d1c4Smrg fi 80462a75d1c4Smrg else 80472a75d1c4Smrg eval flag=\"$hardcode_libdir_flag_spec\" 80482a75d1c4Smrg func_append dep_rpath " $flag" 80492a75d1c4Smrg fi 80502a75d1c4Smrg elif test -n "$runpath_var"; then 80512a75d1c4Smrg case "$perm_rpath " in 80522a75d1c4Smrg *" $libdir "*) ;; 80532a75d1c4Smrg *) func_apped perm_rpath " $libdir" ;; 80542a75d1c4Smrg esac 80552a75d1c4Smrg fi 80562a75d1c4Smrg done 80572a75d1c4Smrg # Substitute the hardcoded libdirs into the rpath. 80582a75d1c4Smrg if test -n "$hardcode_libdir_separator" && 80592a75d1c4Smrg test -n "$hardcode_libdirs"; then 80602a75d1c4Smrg libdir="$hardcode_libdirs" 80612a75d1c4Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 80622a75d1c4Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 80632a75d1c4Smrg else 80642a75d1c4Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 80652a75d1c4Smrg fi 80662a75d1c4Smrg fi 80672a75d1c4Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 80682a75d1c4Smrg # We should set the runpath_var. 80692a75d1c4Smrg rpath= 80702a75d1c4Smrg for dir in $perm_rpath; do 80712a75d1c4Smrg func_append rpath "$dir:" 80722a75d1c4Smrg done 80732a75d1c4Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 80742a75d1c4Smrg fi 80752a75d1c4Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 80762a75d1c4Smrg fi 8077f7ec340bSmacallan 80782a75d1c4Smrg shlibpath="$finalize_shlibpath" 80792a75d1c4Smrg test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 80802a75d1c4Smrg if test -n "$shlibpath"; then 80812a75d1c4Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 80822a75d1c4Smrg fi 8083f7ec340bSmacallan 80842a75d1c4Smrg # Get the real and link names of the library. 80852a75d1c4Smrg eval shared_ext=\"$shrext_cmds\" 80862a75d1c4Smrg eval library_names=\"$library_names_spec\" 80872a75d1c4Smrg set dummy $library_names 80882a75d1c4Smrg shift 80892a75d1c4Smrg realname="$1" 80902a75d1c4Smrg shift 8091f7ec340bSmacallan 80922a75d1c4Smrg if test -n "$soname_spec"; then 80932a75d1c4Smrg eval soname=\"$soname_spec\" 8094f7ec340bSmacallan else 80952a75d1c4Smrg soname="$realname" 80962a75d1c4Smrg fi 80972a75d1c4Smrg if test -z "$dlname"; then 80982a75d1c4Smrg dlname=$soname 8099f7ec340bSmacallan fi 8100f7ec340bSmacallan 81012a75d1c4Smrg lib="$output_objdir/$realname" 81022a75d1c4Smrg linknames= 81032a75d1c4Smrg for link 81042a75d1c4Smrg do 81052a75d1c4Smrg func_append linknames " $link" 81062a75d1c4Smrg done 8107f7ec340bSmacallan 81082a75d1c4Smrg # Use standard objects if they are pic 81092a75d1c4Smrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 81102a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 8111f7ec340bSmacallan 81122a75d1c4Smrg delfiles= 81132a75d1c4Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 81142a75d1c4Smrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 81152a75d1c4Smrg export_symbols="$output_objdir/$libname.uexp" 81162a75d1c4Smrg func_append delfiles " $export_symbols" 81172a75d1c4Smrg fi 8118f7ec340bSmacallan 81192a75d1c4Smrg orig_export_symbols= 81202a75d1c4Smrg case $host_os in 81212a75d1c4Smrg cygwin* | mingw* | cegcc*) 81222a75d1c4Smrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 81232a75d1c4Smrg # exporting using user supplied symfile 81242a75d1c4Smrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 81252a75d1c4Smrg # and it's NOT already a .def file. Must figure out 81262a75d1c4Smrg # which of the given symbols are data symbols and tag 81272a75d1c4Smrg # them as such. So, trigger use of export_symbols_cmds. 81282a75d1c4Smrg # export_symbols gets reassigned inside the "prepare 81292a75d1c4Smrg # the list of exported symbols" if statement, so the 81302a75d1c4Smrg # include_expsyms logic still works. 81312a75d1c4Smrg orig_export_symbols="$export_symbols" 81322a75d1c4Smrg export_symbols= 81332a75d1c4Smrg always_export_symbols=yes 81342a75d1c4Smrg fi 81352a75d1c4Smrg fi 81362a75d1c4Smrg ;; 81372a75d1c4Smrg esac 8138f7ec340bSmacallan 81392a75d1c4Smrg # Prepare the list of exported symbols 81402a75d1c4Smrg if test -z "$export_symbols"; then 81412a75d1c4Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 81422a75d1c4Smrg func_verbose "generating symbol list for \`$libname.la'" 81432a75d1c4Smrg export_symbols="$output_objdir/$libname.exp" 81442a75d1c4Smrg $opt_dry_run || $RM $export_symbols 81452a75d1c4Smrg cmds=$export_symbols_cmds 81462a75d1c4Smrg save_ifs="$IFS"; IFS='~' 81472a75d1c4Smrg for cmd1 in $cmds; do 81482a75d1c4Smrg IFS="$save_ifs" 81492a75d1c4Smrg # Take the normal branch if the nm_file_list_spec branch 81502a75d1c4Smrg # doesn't work or if tool conversion is not needed. 81512a75d1c4Smrg case $nm_file_list_spec~$to_tool_file_cmd in 81522a75d1c4Smrg *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 81532a75d1c4Smrg try_normal_branch=yes 81542a75d1c4Smrg eval cmd=\"$cmd1\" 81552a75d1c4Smrg func_len " $cmd" 81562a75d1c4Smrg len=$func_len_result 81572a75d1c4Smrg ;; 81582a75d1c4Smrg *) 81592a75d1c4Smrg try_normal_branch=no 81602a75d1c4Smrg ;; 81612a75d1c4Smrg esac 81622a75d1c4Smrg if test "$try_normal_branch" = yes \ 81632a75d1c4Smrg && { test "$len" -lt "$max_cmd_len" \ 81642a75d1c4Smrg || test "$max_cmd_len" -le -1; } 81652a75d1c4Smrg then 81662a75d1c4Smrg func_show_eval "$cmd" 'exit $?' 81672a75d1c4Smrg skipped_export=false 81682a75d1c4Smrg elif test -n "$nm_file_list_spec"; then 81692a75d1c4Smrg func_basename "$output" 81702a75d1c4Smrg output_la=$func_basename_result 81712a75d1c4Smrg save_libobjs=$libobjs 81722a75d1c4Smrg save_output=$output 81732a75d1c4Smrg output=${output_objdir}/${output_la}.nm 81742a75d1c4Smrg func_to_tool_file "$output" 81752a75d1c4Smrg libobjs=$nm_file_list_spec$func_to_tool_file_result 81762a75d1c4Smrg func_append delfiles " $output" 81772a75d1c4Smrg func_verbose "creating $NM input file list: $output" 81782a75d1c4Smrg for obj in $save_libobjs; do 81792a75d1c4Smrg func_to_tool_file "$obj" 81802a75d1c4Smrg $ECHO "$func_to_tool_file_result" 81812a75d1c4Smrg done > "$output" 81822a75d1c4Smrg eval cmd=\"$cmd1\" 81832a75d1c4Smrg func_show_eval "$cmd" 'exit $?' 81842a75d1c4Smrg output=$save_output 81852a75d1c4Smrg libobjs=$save_libobjs 81862a75d1c4Smrg skipped_export=false 81872a75d1c4Smrg else 81882a75d1c4Smrg # The command line is too long to execute in one step. 81892a75d1c4Smrg func_verbose "using reloadable object file for export list..." 81902a75d1c4Smrg skipped_export=: 81912a75d1c4Smrg # Break out early, otherwise skipped_export may be 81922a75d1c4Smrg # set to false by a later but shorter cmd. 81932a75d1c4Smrg break 81942a75d1c4Smrg fi 81952a75d1c4Smrg done 81962a75d1c4Smrg IFS="$save_ifs" 81972a75d1c4Smrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 81982a75d1c4Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 81992a75d1c4Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 82002a75d1c4Smrg fi 82012a75d1c4Smrg fi 8202f7ec340bSmacallan fi 8203f7ec340bSmacallan 82042a75d1c4Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 82052a75d1c4Smrg tmp_export_symbols="$export_symbols" 82062a75d1c4Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 82072a75d1c4Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8208f7ec340bSmacallan fi 8209f7ec340bSmacallan 82102a75d1c4Smrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 82112a75d1c4Smrg # The given exports_symbols file has to be filtered, so filter it. 82122a75d1c4Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 82132a75d1c4Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 82142a75d1c4Smrg # 's' commands which not all seds can handle. GNU sed should be fine 82152a75d1c4Smrg # though. Also, the filter scales superlinearly with the number of 82162a75d1c4Smrg # global variables. join(1) would be nice here, but unfortunately 82172a75d1c4Smrg # isn't a blessed tool. 82182a75d1c4Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 82192a75d1c4Smrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 82202a75d1c4Smrg export_symbols=$output_objdir/$libname.def 82212a75d1c4Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 82222a75d1c4Smrg fi 8223f7ec340bSmacallan 82242a75d1c4Smrg tmp_deplibs= 82252a75d1c4Smrg for test_deplib in $deplibs; do 82262a75d1c4Smrg case " $convenience " in 82272a75d1c4Smrg *" $test_deplib "*) ;; 82282a75d1c4Smrg *) 82292a75d1c4Smrg func_append tmp_deplibs " $test_deplib" 82302a75d1c4Smrg ;; 82312a75d1c4Smrg esac 82322a75d1c4Smrg done 82332a75d1c4Smrg deplibs="$tmp_deplibs" 8234f7ec340bSmacallan 82352a75d1c4Smrg if test -n "$convenience"; then 82362a75d1c4Smrg if test -n "$whole_archive_flag_spec" && 82372a75d1c4Smrg test "$compiler_needs_object" = yes && 82382a75d1c4Smrg test -z "$libobjs"; then 82392a75d1c4Smrg # extract the archives, so we have objects to list. 82402a75d1c4Smrg # TODO: could optimize this to just extract one archive. 82412a75d1c4Smrg whole_archive_flag_spec= 82422a75d1c4Smrg fi 82432a75d1c4Smrg if test -n "$whole_archive_flag_spec"; then 82442a75d1c4Smrg save_libobjs=$libobjs 82452a75d1c4Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 82462a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 82472a75d1c4Smrg else 82482a75d1c4Smrg gentop="$output_objdir/${outputname}x" 82492a75d1c4Smrg func_append generated " $gentop" 8250f7ec340bSmacallan 82512a75d1c4Smrg func_extract_archives $gentop $convenience 82522a75d1c4Smrg func_append libobjs " $func_extract_archives_result" 82532a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 82542a75d1c4Smrg fi 8255f7ec340bSmacallan fi 8256f7ec340bSmacallan 82572a75d1c4Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 82582a75d1c4Smrg eval flag=\"$thread_safe_flag_spec\" 82592a75d1c4Smrg func_append linker_flags " $flag" 82602a75d1c4Smrg fi 8261f7ec340bSmacallan 82622a75d1c4Smrg # Make a backup of the uninstalled library when relinking 82632a75d1c4Smrg if test "$opt_mode" = relink; then 82642a75d1c4Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 82652a75d1c4Smrg fi 82662a75d1c4Smrg 82672a75d1c4Smrg # Do each of the archive commands. 82682a75d1c4Smrg if test "$module" = yes && test -n "$module_cmds" ; then 82692a75d1c4Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 82702a75d1c4Smrg eval test_cmds=\"$module_expsym_cmds\" 82712a75d1c4Smrg cmds=$module_expsym_cmds 82722a75d1c4Smrg else 82732a75d1c4Smrg eval test_cmds=\"$module_cmds\" 82742a75d1c4Smrg cmds=$module_cmds 82752a75d1c4Smrg fi 82762a75d1c4Smrg else 82772a75d1c4Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 82782a75d1c4Smrg eval test_cmds=\"$archive_expsym_cmds\" 82792a75d1c4Smrg cmds=$archive_expsym_cmds 82802a75d1c4Smrg else 82812a75d1c4Smrg eval test_cmds=\"$archive_cmds\" 82822a75d1c4Smrg cmds=$archive_cmds 82832a75d1c4Smrg fi 82842a75d1c4Smrg fi 8285f7ec340bSmacallan 82862a75d1c4Smrg if test "X$skipped_export" != "X:" && 82872a75d1c4Smrg func_len " $test_cmds" && 82882a75d1c4Smrg len=$func_len_result && 82892a75d1c4Smrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8290f7ec340bSmacallan : 8291f7ec340bSmacallan else 82922a75d1c4Smrg # The command line is too long to link in one step, link piecewise 82932a75d1c4Smrg # or, if using GNU ld and skipped_export is not :, use a linker 82942a75d1c4Smrg # script. 8295f7ec340bSmacallan 82962a75d1c4Smrg # Save the value of $output and $libobjs because we want to 82972a75d1c4Smrg # use them later. If we have whole_archive_flag_spec, we 82982a75d1c4Smrg # want to use save_libobjs as it was before 82992a75d1c4Smrg # whole_archive_flag_spec was expanded, because we can't 83002a75d1c4Smrg # assume the linker understands whole_archive_flag_spec. 83012a75d1c4Smrg # This may have to be revisited, in case too many 83022a75d1c4Smrg # convenience libraries get linked in and end up exceeding 83032a75d1c4Smrg # the spec. 83042a75d1c4Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 83052a75d1c4Smrg save_libobjs=$libobjs 8306f7ec340bSmacallan fi 83072a75d1c4Smrg save_output=$output 83082a75d1c4Smrg func_basename "$output" 83092a75d1c4Smrg output_la=$func_basename_result 8310f7ec340bSmacallan 83112a75d1c4Smrg # Clear the reloadable object creation command queue and 83122a75d1c4Smrg # initialize k to one. 83132a75d1c4Smrg test_cmds= 8314f7ec340bSmacallan concat_cmds= 83152a75d1c4Smrg objlist= 83162a75d1c4Smrg last_robj= 83172a75d1c4Smrg k=1 8318f7ec340bSmacallan 83192a75d1c4Smrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 83202a75d1c4Smrg output=${output_objdir}/${output_la}.lnkscript 83212a75d1c4Smrg func_verbose "creating GNU ld script: $output" 83222a75d1c4Smrg echo 'INPUT (' > $output 83232a75d1c4Smrg for obj in $save_libobjs 83242a75d1c4Smrg do 83252a75d1c4Smrg func_to_tool_file "$obj" 83262a75d1c4Smrg $ECHO "$func_to_tool_file_result" >> $output 83272a75d1c4Smrg done 83282a75d1c4Smrg echo ')' >> $output 83292a75d1c4Smrg func_append delfiles " $output" 83302a75d1c4Smrg func_to_tool_file "$output" 83312a75d1c4Smrg output=$func_to_tool_file_result 83322a75d1c4Smrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 83332a75d1c4Smrg output=${output_objdir}/${output_la}.lnk 83342a75d1c4Smrg func_verbose "creating linker input file list: $output" 83352a75d1c4Smrg : > $output 83362a75d1c4Smrg set x $save_libobjs 83372a75d1c4Smrg shift 83382a75d1c4Smrg firstobj= 83392a75d1c4Smrg if test "$compiler_needs_object" = yes; then 83402a75d1c4Smrg firstobj="$1 " 83412a75d1c4Smrg shift 83422a75d1c4Smrg fi 83432a75d1c4Smrg for obj 83442a75d1c4Smrg do 83452a75d1c4Smrg func_to_tool_file "$obj" 83462a75d1c4Smrg $ECHO "$func_to_tool_file_result" >> $output 83472a75d1c4Smrg done 83482a75d1c4Smrg func_append delfiles " $output" 83492a75d1c4Smrg func_to_tool_file "$output" 83502a75d1c4Smrg output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 83512a75d1c4Smrg else 83522a75d1c4Smrg if test -n "$save_libobjs"; then 83532a75d1c4Smrg func_verbose "creating reloadable object files..." 83542a75d1c4Smrg output=$output_objdir/$output_la-${k}.$objext 83552a75d1c4Smrg eval test_cmds=\"$reload_cmds\" 83562a75d1c4Smrg func_len " $test_cmds" 83572a75d1c4Smrg len0=$func_len_result 83582a75d1c4Smrg len=$len0 83592a75d1c4Smrg 83602a75d1c4Smrg # Loop over the list of objects to be linked. 83612a75d1c4Smrg for obj in $save_libobjs 83622a75d1c4Smrg do 83632a75d1c4Smrg func_len " $obj" 83642a75d1c4Smrg func_arith $len + $func_len_result 83652a75d1c4Smrg len=$func_arith_result 83662a75d1c4Smrg if test "X$objlist" = X || 83672a75d1c4Smrg test "$len" -lt "$max_cmd_len"; then 83682a75d1c4Smrg func_append objlist " $obj" 83692a75d1c4Smrg else 83702a75d1c4Smrg # The command $test_cmds is almost too long, add a 83712a75d1c4Smrg # command to the queue. 83722a75d1c4Smrg if test "$k" -eq 1 ; then 83732a75d1c4Smrg # The first file doesn't have a previous command to add. 83742a75d1c4Smrg reload_objs=$objlist 83752a75d1c4Smrg eval concat_cmds=\"$reload_cmds\" 83762a75d1c4Smrg else 83772a75d1c4Smrg # All subsequent reloadable object files will link in 83782a75d1c4Smrg # the last one created. 83792a75d1c4Smrg reload_objs="$objlist $last_robj" 83802a75d1c4Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 83812a75d1c4Smrg fi 83822a75d1c4Smrg last_robj=$output_objdir/$output_la-${k}.$objext 83832a75d1c4Smrg func_arith $k + 1 83842a75d1c4Smrg k=$func_arith_result 83852a75d1c4Smrg output=$output_objdir/$output_la-${k}.$objext 83862a75d1c4Smrg objlist=" $obj" 83872a75d1c4Smrg func_len " $last_robj" 83882a75d1c4Smrg func_arith $len0 + $func_len_result 83892a75d1c4Smrg len=$func_arith_result 83902a75d1c4Smrg fi 83912a75d1c4Smrg done 83922a75d1c4Smrg # Handle the remaining objects by creating one last 83932a75d1c4Smrg # reloadable object file. All subsequent reloadable object 83942a75d1c4Smrg # files will link in the last one created. 83952a75d1c4Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 83962a75d1c4Smrg reload_objs="$objlist $last_robj" 83972a75d1c4Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 83982a75d1c4Smrg if test -n "$last_robj"; then 83992a75d1c4Smrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8400f7ec340bSmacallan fi 84012a75d1c4Smrg func_append delfiles " $output" 84022a75d1c4Smrg 84032a75d1c4Smrg else 84042a75d1c4Smrg output= 84052a75d1c4Smrg fi 84062a75d1c4Smrg 84072a75d1c4Smrg if ${skipped_export-false}; then 84082a75d1c4Smrg func_verbose "generating symbol list for \`$libname.la'" 84092a75d1c4Smrg export_symbols="$output_objdir/$libname.exp" 84102a75d1c4Smrg $opt_dry_run || $RM $export_symbols 84112a75d1c4Smrg libobjs=$output 84122a75d1c4Smrg # Append the command to create the export file. 8413f7ec340bSmacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 84142a75d1c4Smrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 84152a75d1c4Smrg if test -n "$last_robj"; then 84162a75d1c4Smrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 84172a75d1c4Smrg fi 84182a75d1c4Smrg fi 84192a75d1c4Smrg 84202a75d1c4Smrg test -n "$save_libobjs" && 84212a75d1c4Smrg func_verbose "creating a temporary reloadable object file: $output" 84222a75d1c4Smrg 84232a75d1c4Smrg # Loop through the commands generated above and execute them. 84242a75d1c4Smrg save_ifs="$IFS"; IFS='~' 84252a75d1c4Smrg for cmd in $concat_cmds; do 84262a75d1c4Smrg IFS="$save_ifs" 84272a75d1c4Smrg $opt_silent || { 84282a75d1c4Smrg func_quote_for_expand "$cmd" 84292a75d1c4Smrg eval "func_echo $func_quote_for_expand_result" 84302a75d1c4Smrg } 84312a75d1c4Smrg $opt_dry_run || eval "$cmd" || { 84322a75d1c4Smrg lt_exit=$? 84332a75d1c4Smrg 84342a75d1c4Smrg # Restore the uninstalled library and exit 84352a75d1c4Smrg if test "$opt_mode" = relink; then 84362a75d1c4Smrg ( cd "$output_objdir" && \ 84372a75d1c4Smrg $RM "${realname}T" && \ 84382a75d1c4Smrg $MV "${realname}U" "$realname" ) 84392a75d1c4Smrg fi 84402a75d1c4Smrg 84412a75d1c4Smrg exit $lt_exit 84422a75d1c4Smrg } 84432a75d1c4Smrg done 84442a75d1c4Smrg IFS="$save_ifs" 84452a75d1c4Smrg 84462a75d1c4Smrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 84472a75d1c4Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 84482a75d1c4Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8449f7ec340bSmacallan fi 8450f7ec340bSmacallan fi 8451f7ec340bSmacallan 84522a75d1c4Smrg if ${skipped_export-false}; then 84532a75d1c4Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 84542a75d1c4Smrg tmp_export_symbols="$export_symbols" 84552a75d1c4Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 84562a75d1c4Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 84572a75d1c4Smrg fi 8458f7ec340bSmacallan 84592a75d1c4Smrg if test -n "$orig_export_symbols"; then 84602a75d1c4Smrg # The given exports_symbols file has to be filtered, so filter it. 84612a75d1c4Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 84622a75d1c4Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 84632a75d1c4Smrg # 's' commands which not all seds can handle. GNU sed should be fine 84642a75d1c4Smrg # though. Also, the filter scales superlinearly with the number of 84652a75d1c4Smrg # global variables. join(1) would be nice here, but unfortunately 84662a75d1c4Smrg # isn't a blessed tool. 84672a75d1c4Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 84682a75d1c4Smrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 84692a75d1c4Smrg export_symbols=$output_objdir/$libname.def 84702a75d1c4Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 84712a75d1c4Smrg fi 84722a75d1c4Smrg fi 8473f7ec340bSmacallan 84742a75d1c4Smrg libobjs=$output 84752a75d1c4Smrg # Restore the value of output. 84762a75d1c4Smrg output=$save_output 8477f7ec340bSmacallan 84782a75d1c4Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 84792a75d1c4Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 84802a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 84812a75d1c4Smrg fi 84822a75d1c4Smrg # Expand the library linking commands again to reset the 84832a75d1c4Smrg # value of $libobjs for piecewise linking. 8484f7ec340bSmacallan 84852a75d1c4Smrg # Do each of the archive commands. 84862a75d1c4Smrg if test "$module" = yes && test -n "$module_cmds" ; then 84872a75d1c4Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 84882a75d1c4Smrg cmds=$module_expsym_cmds 84892a75d1c4Smrg else 84902a75d1c4Smrg cmds=$module_cmds 8491f7ec340bSmacallan fi 8492f7ec340bSmacallan else 84932a75d1c4Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 84942a75d1c4Smrg cmds=$archive_expsym_cmds 84952a75d1c4Smrg else 84962a75d1c4Smrg cmds=$archive_cmds 84972a75d1c4Smrg fi 8498f7ec340bSmacallan fi 84992a75d1c4Smrg fi 8500f7ec340bSmacallan 85012a75d1c4Smrg if test -n "$delfiles"; then 85022a75d1c4Smrg # Append the command to remove temporary files to $cmds. 85032a75d1c4Smrg eval cmds=\"\$cmds~\$RM $delfiles\" 85042a75d1c4Smrg fi 8505f7ec340bSmacallan 85062a75d1c4Smrg # Add any objects from preloaded convenience libraries 85072a75d1c4Smrg if test -n "$dlprefiles"; then 85082a75d1c4Smrg gentop="$output_objdir/${outputname}x" 85092a75d1c4Smrg func_append generated " $gentop" 8510f7ec340bSmacallan 85112a75d1c4Smrg func_extract_archives $gentop $dlprefiles 85122a75d1c4Smrg func_append libobjs " $func_extract_archives_result" 85132a75d1c4Smrg test "X$libobjs" = "X " && libobjs= 85142a75d1c4Smrg fi 8515f7ec340bSmacallan 85162a75d1c4Smrg save_ifs="$IFS"; IFS='~' 85172a75d1c4Smrg for cmd in $cmds; do 85182a75d1c4Smrg IFS="$save_ifs" 85192a75d1c4Smrg eval cmd=\"$cmd\" 85202a75d1c4Smrg $opt_silent || { 85212a75d1c4Smrg func_quote_for_expand "$cmd" 85222a75d1c4Smrg eval "func_echo $func_quote_for_expand_result" 85232a75d1c4Smrg } 85242a75d1c4Smrg $opt_dry_run || eval "$cmd" || { 85252a75d1c4Smrg lt_exit=$? 8526f7ec340bSmacallan 85272a75d1c4Smrg # Restore the uninstalled library and exit 85282a75d1c4Smrg if test "$opt_mode" = relink; then 85292a75d1c4Smrg ( cd "$output_objdir" && \ 85302a75d1c4Smrg $RM "${realname}T" && \ 85312a75d1c4Smrg $MV "${realname}U" "$realname" ) 85322a75d1c4Smrg fi 8533f7ec340bSmacallan 85342a75d1c4Smrg exit $lt_exit 85352a75d1c4Smrg } 85362a75d1c4Smrg done 85372a75d1c4Smrg IFS="$save_ifs" 8538f7ec340bSmacallan 85392a75d1c4Smrg # Restore the uninstalled library and exit 85402a75d1c4Smrg if test "$opt_mode" = relink; then 85412a75d1c4Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8542f7ec340bSmacallan 85432a75d1c4Smrg if test -n "$convenience"; then 85442a75d1c4Smrg if test -z "$whole_archive_flag_spec"; then 85452a75d1c4Smrg func_show_eval '${RM}r "$gentop"' 85462a75d1c4Smrg fi 85472a75d1c4Smrg fi 8548f7ec340bSmacallan 85492a75d1c4Smrg exit $EXIT_SUCCESS 85502a75d1c4Smrg fi 85512a75d1c4Smrg 85522a75d1c4Smrg # Create links to the real library. 85532a75d1c4Smrg for linkname in $linknames; do 85542a75d1c4Smrg if test "$realname" != "$linkname"; then 85552a75d1c4Smrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8556f7ec340bSmacallan fi 8557f7ec340bSmacallan done 8558f7ec340bSmacallan 85592a75d1c4Smrg # If -module or -export-dynamic was specified, set the dlname. 85602a75d1c4Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 85612a75d1c4Smrg # On all known operating systems, these are identical. 85622a75d1c4Smrg dlname="$soname" 85632a75d1c4Smrg fi 85642a75d1c4Smrg fi 8565f7ec340bSmacallan ;; 8566f7ec340bSmacallan 85672a75d1c4Smrg obj) 85682a75d1c4Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 85692a75d1c4Smrg func_warning "\`-dlopen' is ignored for objects" 85702a75d1c4Smrg fi 8571f7ec340bSmacallan 85722a75d1c4Smrg case " $deplibs" in 85732a75d1c4Smrg *\ -l* | *\ -L*) 85742a75d1c4Smrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 8575f7ec340bSmacallan esac 8576f7ec340bSmacallan 85772a75d1c4Smrg test -n "$rpath" && \ 85782a75d1c4Smrg func_warning "\`-rpath' is ignored for objects" 8579f7ec340bSmacallan 85802a75d1c4Smrg test -n "$xrpath" && \ 85812a75d1c4Smrg func_warning "\`-R' is ignored for objects" 8582f7ec340bSmacallan 85832a75d1c4Smrg test -n "$vinfo" && \ 85842a75d1c4Smrg func_warning "\`-version-info' is ignored for objects" 85852a75d1c4Smrg 85862a75d1c4Smrg test -n "$release" && \ 85872a75d1c4Smrg func_warning "\`-release' is ignored for objects" 85882a75d1c4Smrg 85892a75d1c4Smrg case $output in 85902a75d1c4Smrg *.lo) 85912a75d1c4Smrg test -n "$objs$old_deplibs" && \ 85922a75d1c4Smrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 85932a75d1c4Smrg 85942a75d1c4Smrg libobj=$output 85952a75d1c4Smrg func_lo2o "$libobj" 85962a75d1c4Smrg obj=$func_lo2o_result 8597f7ec340bSmacallan ;; 8598f7ec340bSmacallan *) 85992a75d1c4Smrg libobj= 86002a75d1c4Smrg obj="$output" 8601f7ec340bSmacallan ;; 8602f7ec340bSmacallan esac 8603f7ec340bSmacallan 86042a75d1c4Smrg # Delete the old objects. 86052a75d1c4Smrg $opt_dry_run || $RM $obj $libobj 8606f7ec340bSmacallan 86072a75d1c4Smrg # Objects from convenience libraries. This assumes 86082a75d1c4Smrg # single-version convenience libraries. Whenever we create 86092a75d1c4Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 86102a75d1c4Smrg # the extraction. 86112a75d1c4Smrg reload_conv_objs= 86122a75d1c4Smrg gentop= 86132a75d1c4Smrg # reload_cmds runs $LD directly, so let us get rid of 86142a75d1c4Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 86152a75d1c4Smrg # turning comma into space.. 86162a75d1c4Smrg wl= 8617f7ec340bSmacallan 86182a75d1c4Smrg if test -n "$convenience"; then 86192a75d1c4Smrg if test -n "$whole_archive_flag_spec"; then 86202a75d1c4Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 86212a75d1c4Smrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 86222a75d1c4Smrg else 86232a75d1c4Smrg gentop="$output_objdir/${obj}x" 86242a75d1c4Smrg func_append generated " $gentop" 8625f7ec340bSmacallan 86262a75d1c4Smrg func_extract_archives $gentop $convenience 86272a75d1c4Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 86282a75d1c4Smrg fi 8629f7ec340bSmacallan fi 8630f7ec340bSmacallan 86312a75d1c4Smrg # If we're not building shared, we need to use non_pic_objs 86322a75d1c4Smrg test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8633f7ec340bSmacallan 86342a75d1c4Smrg # Create the old-style object. 86352a75d1c4Smrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8636f7ec340bSmacallan 86372a75d1c4Smrg output="$obj" 86382a75d1c4Smrg func_execute_cmds "$reload_cmds" 'exit $?' 86392a75d1c4Smrg 86402a75d1c4Smrg # Exit if we aren't doing a library object file. 86412a75d1c4Smrg if test -z "$libobj"; then 86422a75d1c4Smrg if test -n "$gentop"; then 86432a75d1c4Smrg func_show_eval '${RM}r "$gentop"' 86442a75d1c4Smrg fi 86452a75d1c4Smrg 86462a75d1c4Smrg exit $EXIT_SUCCESS 8647f7ec340bSmacallan fi 86482a75d1c4Smrg 86492a75d1c4Smrg if test "$build_libtool_libs" != yes; then 86502a75d1c4Smrg if test -n "$gentop"; then 86512a75d1c4Smrg func_show_eval '${RM}r "$gentop"' 86522a75d1c4Smrg fi 86532a75d1c4Smrg 86542a75d1c4Smrg # Create an invalid libtool object if no PIC, so that we don't 86552a75d1c4Smrg # accidentally link it into a program. 86562a75d1c4Smrg # $show "echo timestamp > $libobj" 86572a75d1c4Smrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 86582a75d1c4Smrg exit $EXIT_SUCCESS 86592a75d1c4Smrg fi 86602a75d1c4Smrg 86612a75d1c4Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 86622a75d1c4Smrg # Only do commands if we really have different PIC objects. 86632a75d1c4Smrg reload_objs="$libobjs $reload_conv_objs" 86642a75d1c4Smrg output="$libobj" 86652a75d1c4Smrg func_execute_cmds "$reload_cmds" 'exit $?' 86662a75d1c4Smrg fi 86672a75d1c4Smrg 86682a75d1c4Smrg if test -n "$gentop"; then 86692a75d1c4Smrg func_show_eval '${RM}r "$gentop"' 86702a75d1c4Smrg fi 86712a75d1c4Smrg 86722a75d1c4Smrg exit $EXIT_SUCCESS 8673f7ec340bSmacallan ;; 8674f7ec340bSmacallan 86752a75d1c4Smrg prog) 86762a75d1c4Smrg case $host in 86772a75d1c4Smrg *cygwin*) func_stripname '' '.exe' "$output" 86782a75d1c4Smrg output=$func_stripname_result.exe;; 86792a75d1c4Smrg esac 86802a75d1c4Smrg test -n "$vinfo" && \ 86812a75d1c4Smrg func_warning "\`-version-info' is ignored for programs" 8682f7ec340bSmacallan 86832a75d1c4Smrg test -n "$release" && \ 86842a75d1c4Smrg func_warning "\`-release' is ignored for programs" 8685f7ec340bSmacallan 86862a75d1c4Smrg test "$preload" = yes \ 86872a75d1c4Smrg && test "$dlopen_support" = unknown \ 86882a75d1c4Smrg && test "$dlopen_self" = unknown \ 86892a75d1c4Smrg && test "$dlopen_self_static" = unknown && \ 86902a75d1c4Smrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 86912a75d1c4Smrg 86922a75d1c4Smrg case $host in 86932a75d1c4Smrg *-*-rhapsody* | *-*-darwin1.[012]) 86942a75d1c4Smrg # On Rhapsody replace the C library is the System framework 86952a75d1c4Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 86962a75d1c4Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8697f7ec340bSmacallan ;; 86982a75d1c4Smrg esac 8699f7ec340bSmacallan 87002a75d1c4Smrg case $host in 87012a75d1c4Smrg *-*-darwin*) 87022a75d1c4Smrg # Don't allow lazy linking, it breaks C++ global constructors 87032a75d1c4Smrg # But is supposedly fixed on 10.4 or later (yay!). 87042a75d1c4Smrg if test "$tagname" = CXX ; then 87052a75d1c4Smrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 87062a75d1c4Smrg 10.[0123]) 87072a75d1c4Smrg func_append compile_command " ${wl}-bind_at_load" 87082a75d1c4Smrg func_append finalize_command " ${wl}-bind_at_load" 87092a75d1c4Smrg ;; 87102a75d1c4Smrg esac 8711f7ec340bSmacallan fi 87122a75d1c4Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 87132a75d1c4Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 87142a75d1c4Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 87152a75d1c4Smrg ;; 87162a75d1c4Smrg esac 8717f7ec340bSmacallan 8718f7ec340bSmacallan 87192a75d1c4Smrg # move library search paths that coincide with paths to not yet 87202a75d1c4Smrg # installed libraries to the beginning of the library search list 87212a75d1c4Smrg new_libs= 87222a75d1c4Smrg for path in $notinst_path; do 87232a75d1c4Smrg case " $new_libs " in 87242a75d1c4Smrg *" -L$path/$objdir "*) ;; 87252a75d1c4Smrg *) 87262a75d1c4Smrg case " $compile_deplibs " in 87272a75d1c4Smrg *" -L$path/$objdir "*) 87282a75d1c4Smrg func_append new_libs " -L$path/$objdir" ;; 8729f7ec340bSmacallan esac 87302a75d1c4Smrg ;; 87312a75d1c4Smrg esac 87322a75d1c4Smrg done 87332a75d1c4Smrg for deplib in $compile_deplibs; do 87342a75d1c4Smrg case $deplib in 87352a75d1c4Smrg -L*) 87362a75d1c4Smrg case " $new_libs " in 87372a75d1c4Smrg *" $deplib "*) ;; 87382a75d1c4Smrg *) func_append new_libs " $deplib" ;; 8739f7ec340bSmacallan esac 87402a75d1c4Smrg ;; 87412a75d1c4Smrg *) func_append new_libs " $deplib" ;; 87422a75d1c4Smrg esac 87432a75d1c4Smrg done 87442a75d1c4Smrg compile_deplibs="$new_libs" 8745f7ec340bSmacallan 8746f7ec340bSmacallan 87472a75d1c4Smrg func_append compile_command " $compile_deplibs" 87482a75d1c4Smrg func_append finalize_command " $finalize_deplibs" 8749f7ec340bSmacallan 87502a75d1c4Smrg if test -n "$rpath$xrpath"; then 87512a75d1c4Smrg # If the user specified any rpath flags, then add them. 87522a75d1c4Smrg for libdir in $rpath $xrpath; do 87532a75d1c4Smrg # This is the magic to use -rpath. 87542a75d1c4Smrg case "$finalize_rpath " in 87552a75d1c4Smrg *" $libdir "*) ;; 87562a75d1c4Smrg *) func_append finalize_rpath " $libdir" ;; 87572a75d1c4Smrg esac 87582a75d1c4Smrg done 87592a75d1c4Smrg fi 8760f7ec340bSmacallan 87612a75d1c4Smrg # Now hardcode the library paths 87622a75d1c4Smrg rpath= 87632a75d1c4Smrg hardcode_libdirs= 87642a75d1c4Smrg for libdir in $compile_rpath $finalize_rpath; do 87652a75d1c4Smrg if test -n "$hardcode_libdir_flag_spec"; then 87662a75d1c4Smrg if test -n "$hardcode_libdir_separator"; then 87672a75d1c4Smrg if test -z "$hardcode_libdirs"; then 87682a75d1c4Smrg hardcode_libdirs="$libdir" 87692a75d1c4Smrg else 87702a75d1c4Smrg # Just accumulate the unique libdirs. 87712a75d1c4Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 87722a75d1c4Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 87732a75d1c4Smrg ;; 87742a75d1c4Smrg *) 87752a75d1c4Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 87762a75d1c4Smrg ;; 87772a75d1c4Smrg esac 87782a75d1c4Smrg fi 8779f7ec340bSmacallan else 87802a75d1c4Smrg eval flag=\"$hardcode_libdir_flag_spec\" 87812a75d1c4Smrg func_append rpath " $flag" 8782f7ec340bSmacallan fi 87832a75d1c4Smrg elif test -n "$runpath_var"; then 87842a75d1c4Smrg case "$perm_rpath " in 87852a75d1c4Smrg *" $libdir "*) ;; 87862a75d1c4Smrg *) func_append perm_rpath " $libdir" ;; 87872a75d1c4Smrg esac 87882a75d1c4Smrg fi 87892a75d1c4Smrg case $host in 87902a75d1c4Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 87912a75d1c4Smrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 87922a75d1c4Smrg case :$dllsearchpath: in 87932a75d1c4Smrg *":$libdir:"*) ;; 87942a75d1c4Smrg ::) dllsearchpath=$libdir;; 87952a75d1c4Smrg *) func_append dllsearchpath ":$libdir";; 87962a75d1c4Smrg esac 87972a75d1c4Smrg case :$dllsearchpath: in 87982a75d1c4Smrg *":$testbindir:"*) ;; 87992a75d1c4Smrg ::) dllsearchpath=$testbindir;; 88002a75d1c4Smrg *) func_append dllsearchpath ":$testbindir";; 88012a75d1c4Smrg esac 88022a75d1c4Smrg ;; 88032a75d1c4Smrg esac 88042a75d1c4Smrg done 88052a75d1c4Smrg # Substitute the hardcoded libdirs into the rpath. 88062a75d1c4Smrg if test -n "$hardcode_libdir_separator" && 88072a75d1c4Smrg test -n "$hardcode_libdirs"; then 88082a75d1c4Smrg libdir="$hardcode_libdirs" 88092a75d1c4Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 88102a75d1c4Smrg fi 88112a75d1c4Smrg compile_rpath="$rpath" 8812f7ec340bSmacallan 88132a75d1c4Smrg rpath= 88142a75d1c4Smrg hardcode_libdirs= 88152a75d1c4Smrg for libdir in $finalize_rpath; do 88162a75d1c4Smrg if test -n "$hardcode_libdir_flag_spec"; then 88172a75d1c4Smrg if test -n "$hardcode_libdir_separator"; then 88182a75d1c4Smrg if test -z "$hardcode_libdirs"; then 88192a75d1c4Smrg hardcode_libdirs="$libdir" 88202a75d1c4Smrg else 88212a75d1c4Smrg # Just accumulate the unique libdirs. 88222a75d1c4Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 88232a75d1c4Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 88242a75d1c4Smrg ;; 88252a75d1c4Smrg *) 88262a75d1c4Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 88272a75d1c4Smrg ;; 88282a75d1c4Smrg esac 88292a75d1c4Smrg fi 8830f7ec340bSmacallan else 88312a75d1c4Smrg eval flag=\"$hardcode_libdir_flag_spec\" 88322a75d1c4Smrg func_append rpath " $flag" 8833f7ec340bSmacallan fi 88342a75d1c4Smrg elif test -n "$runpath_var"; then 88352a75d1c4Smrg case "$finalize_perm_rpath " in 88362a75d1c4Smrg *" $libdir "*) ;; 88372a75d1c4Smrg *) func_append finalize_perm_rpath " $libdir" ;; 88382a75d1c4Smrg esac 8839f7ec340bSmacallan fi 88402a75d1c4Smrg done 88412a75d1c4Smrg # Substitute the hardcoded libdirs into the rpath. 88422a75d1c4Smrg if test -n "$hardcode_libdir_separator" && 88432a75d1c4Smrg test -n "$hardcode_libdirs"; then 88442a75d1c4Smrg libdir="$hardcode_libdirs" 88452a75d1c4Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 88462a75d1c4Smrg fi 88472a75d1c4Smrg finalize_rpath="$rpath" 8848f7ec340bSmacallan 88492a75d1c4Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 88502a75d1c4Smrg # Transform all the library objects into standard objects. 88512a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 88522a75d1c4Smrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 88532a75d1c4Smrg fi 8854f7ec340bSmacallan 88552a75d1c4Smrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8856f7ec340bSmacallan 88572a75d1c4Smrg # template prelinking step 88582a75d1c4Smrg if test -n "$prelink_cmds"; then 88592a75d1c4Smrg func_execute_cmds "$prelink_cmds" 'exit $?' 88602a75d1c4Smrg fi 8861f7ec340bSmacallan 88622a75d1c4Smrg wrappers_required=yes 88632a75d1c4Smrg case $host in 88642a75d1c4Smrg *cegcc* | *mingw32ce*) 88652a75d1c4Smrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 88662a75d1c4Smrg wrappers_required=no 88672a75d1c4Smrg ;; 88682a75d1c4Smrg *cygwin* | *mingw* ) 88692a75d1c4Smrg if test "$build_libtool_libs" != yes; then 88702a75d1c4Smrg wrappers_required=no 88712a75d1c4Smrg fi 88722a75d1c4Smrg ;; 88732a75d1c4Smrg *) 88742a75d1c4Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 88752a75d1c4Smrg wrappers_required=no 88762a75d1c4Smrg fi 88772a75d1c4Smrg ;; 88782a75d1c4Smrg esac 88792a75d1c4Smrg if test "$wrappers_required" = no; then 88802a75d1c4Smrg # Replace the output file specification. 88812a75d1c4Smrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 88822a75d1c4Smrg link_command="$compile_command$compile_rpath" 8883f7ec340bSmacallan 88842a75d1c4Smrg # We have no uninstalled library dependencies, so finalize right now. 88852a75d1c4Smrg exit_status=0 88862a75d1c4Smrg func_show_eval "$link_command" 'exit_status=$?' 8887f7ec340bSmacallan 88882a75d1c4Smrg if test -n "$postlink_cmds"; then 88892a75d1c4Smrg func_to_tool_file "$output" 88902a75d1c4Smrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 88912a75d1c4Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 8892f7ec340bSmacallan fi 8893f7ec340bSmacallan 88942a75d1c4Smrg # Delete the generated files. 88952a75d1c4Smrg if test -f "$output_objdir/${outputname}S.${objext}"; then 88962a75d1c4Smrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 88972a75d1c4Smrg fi 8898f7ec340bSmacallan 88992a75d1c4Smrg exit $exit_status 89002a75d1c4Smrg fi 8901f7ec340bSmacallan 89022a75d1c4Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 89032a75d1c4Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 89042a75d1c4Smrg fi 89052a75d1c4Smrg if test -n "$finalize_shlibpath"; then 89062a75d1c4Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 89072a75d1c4Smrg fi 8908f7ec340bSmacallan 89092a75d1c4Smrg compile_var= 89102a75d1c4Smrg finalize_var= 89112a75d1c4Smrg if test -n "$runpath_var"; then 89122a75d1c4Smrg if test -n "$perm_rpath"; then 89132a75d1c4Smrg # We should set the runpath_var. 89142a75d1c4Smrg rpath= 89152a75d1c4Smrg for dir in $perm_rpath; do 89162a75d1c4Smrg func_append rpath "$dir:" 89172a75d1c4Smrg done 89182a75d1c4Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8919f7ec340bSmacallan fi 89202a75d1c4Smrg if test -n "$finalize_perm_rpath"; then 89212a75d1c4Smrg # We should set the runpath_var. 89222a75d1c4Smrg rpath= 89232a75d1c4Smrg for dir in $finalize_perm_rpath; do 89242a75d1c4Smrg func_append rpath "$dir:" 89252a75d1c4Smrg done 89262a75d1c4Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8927f7ec340bSmacallan fi 89282a75d1c4Smrg fi 8929f7ec340bSmacallan 89302a75d1c4Smrg if test "$no_install" = yes; then 89312a75d1c4Smrg # We don't need to create a wrapper script. 89322a75d1c4Smrg link_command="$compile_var$compile_command$compile_rpath" 89332a75d1c4Smrg # Replace the output file specification. 89342a75d1c4Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 89352a75d1c4Smrg # Delete the old output file. 89362a75d1c4Smrg $opt_dry_run || $RM $output 89372a75d1c4Smrg # Link the executable and exit 89382a75d1c4Smrg func_show_eval "$link_command" 'exit $?' 8939f7ec340bSmacallan 89402a75d1c4Smrg if test -n "$postlink_cmds"; then 89412a75d1c4Smrg func_to_tool_file "$output" 89422a75d1c4Smrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89432a75d1c4Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 8944f7ec340bSmacallan fi 89452a75d1c4Smrg 8946f7ec340bSmacallan exit $EXIT_SUCCESS 89472a75d1c4Smrg fi 8948f7ec340bSmacallan 89492a75d1c4Smrg if test "$hardcode_action" = relink; then 89502a75d1c4Smrg # Fast installation is not supported 89512a75d1c4Smrg link_command="$compile_var$compile_command$compile_rpath" 89522a75d1c4Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 89532a75d1c4Smrg 89542a75d1c4Smrg func_warning "this platform does not like uninstalled shared libraries" 89552a75d1c4Smrg func_warning "\`$output' will be relinked during installation" 89562a75d1c4Smrg else 89572a75d1c4Smrg if test "$fast_install" != no; then 89582a75d1c4Smrg link_command="$finalize_var$compile_command$finalize_rpath" 89592a75d1c4Smrg if test "$fast_install" = yes; then 89602a75d1c4Smrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 89612a75d1c4Smrg else 89622a75d1c4Smrg # fast_install is set to needless 89632a75d1c4Smrg relink_command= 89642a75d1c4Smrg fi 8965f7ec340bSmacallan else 89662a75d1c4Smrg link_command="$compile_var$compile_command$compile_rpath" 89672a75d1c4Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8968f7ec340bSmacallan fi 89692a75d1c4Smrg fi 8970f7ec340bSmacallan 89712a75d1c4Smrg # Replace the output file specification. 89722a75d1c4Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8973f7ec340bSmacallan 89742a75d1c4Smrg # Delete the old output files. 89752a75d1c4Smrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8976f7ec340bSmacallan 89772a75d1c4Smrg func_show_eval "$link_command" 'exit $?' 8978f7ec340bSmacallan 89792a75d1c4Smrg if test -n "$postlink_cmds"; then 89802a75d1c4Smrg func_to_tool_file "$output_objdir/$outputname" 89812a75d1c4Smrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89822a75d1c4Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 89832a75d1c4Smrg fi 8984f7ec340bSmacallan 89852a75d1c4Smrg # Now create the wrapper script. 89862a75d1c4Smrg func_verbose "creating $output" 8987f7ec340bSmacallan 89882a75d1c4Smrg # Quote the relink command for shipping. 89892a75d1c4Smrg if test -n "$relink_command"; then 89902a75d1c4Smrg # Preserve any variables that may affect compiler behavior 89912a75d1c4Smrg for var in $variables_saved_for_relink; do 89922a75d1c4Smrg if eval test -z \"\${$var+set}\"; then 89932a75d1c4Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 89942a75d1c4Smrg elif eval var_value=\$$var; test -z "$var_value"; then 89952a75d1c4Smrg relink_command="$var=; export $var; $relink_command" 8996f7ec340bSmacallan else 89972a75d1c4Smrg func_quote_for_eval "$var_value" 89982a75d1c4Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8999f7ec340bSmacallan fi 90002a75d1c4Smrg done 90012a75d1c4Smrg relink_command="(cd `pwd`; $relink_command)" 90022a75d1c4Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 90032a75d1c4Smrg fi 90042a75d1c4Smrg 90052a75d1c4Smrg # Only actually do things if not in dry run mode. 90062a75d1c4Smrg $opt_dry_run || { 90072a75d1c4Smrg # win32 will think the script is a binary if it has 90082a75d1c4Smrg # a .exe suffix, so we strip it off here. 90092a75d1c4Smrg case $output in 90102a75d1c4Smrg *.exe) func_stripname '' '.exe' "$output" 90112a75d1c4Smrg output=$func_stripname_result ;; 9012f7ec340bSmacallan esac 90132a75d1c4Smrg # test for cygwin because mv fails w/o .exe extensions 90142a75d1c4Smrg case $host in 90152a75d1c4Smrg *cygwin*) 90162a75d1c4Smrg exeext=.exe 90172a75d1c4Smrg func_stripname '' '.exe' "$outputname" 90182a75d1c4Smrg outputname=$func_stripname_result ;; 90192a75d1c4Smrg *) exeext= ;; 90202a75d1c4Smrg esac 90212a75d1c4Smrg case $host in 90222a75d1c4Smrg *cygwin* | *mingw* ) 90232a75d1c4Smrg func_dirname_and_basename "$output" "" "." 90242a75d1c4Smrg output_name=$func_basename_result 90252a75d1c4Smrg output_path=$func_dirname_result 90262a75d1c4Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 90272a75d1c4Smrg cwrapper="$output_path/$output_name.exe" 90282a75d1c4Smrg $RM $cwrappersource $cwrapper 90292a75d1c4Smrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 90302a75d1c4Smrg 90312a75d1c4Smrg func_emit_cwrapperexe_src > $cwrappersource 90322a75d1c4Smrg 90332a75d1c4Smrg # The wrapper executable is built using the $host compiler, 90342a75d1c4Smrg # because it contains $host paths and files. If cross- 90352a75d1c4Smrg # compiling, it, like the target executable, must be 90362a75d1c4Smrg # executed on the $host or under an emulation environment. 90372a75d1c4Smrg $opt_dry_run || { 90382a75d1c4Smrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 90392a75d1c4Smrg $STRIP $cwrapper 90402a75d1c4Smrg } 9041f7ec340bSmacallan 90422a75d1c4Smrg # Now, create the wrapper script for func_source use: 90432a75d1c4Smrg func_ltwrapper_scriptname $cwrapper 90442a75d1c4Smrg $RM $func_ltwrapper_scriptname_result 90452a75d1c4Smrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 90462a75d1c4Smrg $opt_dry_run || { 90472a75d1c4Smrg # note: this script will not be executed, so do not chmod. 90482a75d1c4Smrg if test "x$build" = "x$host" ; then 90492a75d1c4Smrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 90502a75d1c4Smrg else 90512a75d1c4Smrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 90522a75d1c4Smrg fi 90532a75d1c4Smrg } 90542a75d1c4Smrg ;; 90552a75d1c4Smrg * ) 90562a75d1c4Smrg $RM $output 90572a75d1c4Smrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9058f7ec340bSmacallan 90592a75d1c4Smrg func_emit_wrapper no > $output 90602a75d1c4Smrg chmod +x $output 90612a75d1c4Smrg ;; 90622a75d1c4Smrg esac 90632a75d1c4Smrg } 90642a75d1c4Smrg exit $EXIT_SUCCESS 90652a75d1c4Smrg ;; 90662a75d1c4Smrg esac 9067f7ec340bSmacallan 90682a75d1c4Smrg # See if we need to build an old-fashioned archive. 90692a75d1c4Smrg for oldlib in $oldlibs; do 9070f7ec340bSmacallan 90712a75d1c4Smrg if test "$build_libtool_libs" = convenience; then 90722a75d1c4Smrg oldobjs="$libobjs_save $symfileobj" 90732a75d1c4Smrg addlibs="$convenience" 90742a75d1c4Smrg build_libtool_libs=no 90752a75d1c4Smrg else 90762a75d1c4Smrg if test "$build_libtool_libs" = module; then 90772a75d1c4Smrg oldobjs="$libobjs_save" 90782a75d1c4Smrg build_libtool_libs=no 90792a75d1c4Smrg else 90802a75d1c4Smrg oldobjs="$old_deplibs $non_pic_objects" 90812a75d1c4Smrg if test "$preload" = yes && test -f "$symfileobj"; then 90822a75d1c4Smrg func_append oldobjs " $symfileobj" 90832a75d1c4Smrg fi 90842a75d1c4Smrg fi 90852a75d1c4Smrg addlibs="$old_convenience" 9086f7ec340bSmacallan fi 9087f7ec340bSmacallan 90882a75d1c4Smrg if test -n "$addlibs"; then 90892a75d1c4Smrg gentop="$output_objdir/${outputname}x" 90902a75d1c4Smrg func_append generated " $gentop" 9091f7ec340bSmacallan 90922a75d1c4Smrg func_extract_archives $gentop $addlibs 90932a75d1c4Smrg func_append oldobjs " $func_extract_archives_result" 90942a75d1c4Smrg fi 9095f7ec340bSmacallan 90962a75d1c4Smrg # Do each command in the archive commands. 90972a75d1c4Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 90982a75d1c4Smrg cmds=$old_archive_from_new_cmds 90992a75d1c4Smrg else 9100f7ec340bSmacallan 91012a75d1c4Smrg # Add any objects from preloaded convenience libraries 91022a75d1c4Smrg if test -n "$dlprefiles"; then 91032a75d1c4Smrg gentop="$output_objdir/${outputname}x" 91042a75d1c4Smrg func_append generated " $gentop" 9105f7ec340bSmacallan 91062a75d1c4Smrg func_extract_archives $gentop $dlprefiles 91072a75d1c4Smrg func_append oldobjs " $func_extract_archives_result" 91082a75d1c4Smrg fi 9109f7ec340bSmacallan 91102a75d1c4Smrg # POSIX demands no paths to be encoded in archives. We have 91112a75d1c4Smrg # to avoid creating archives with duplicate basenames if we 91122a75d1c4Smrg # might have to extract them afterwards, e.g., when creating a 91132a75d1c4Smrg # static archive out of a convenience library, or when linking 91142a75d1c4Smrg # the entirety of a libtool archive into another (currently 91152a75d1c4Smrg # not supported by libtool). 91162a75d1c4Smrg if (for obj in $oldobjs 91172a75d1c4Smrg do 91182a75d1c4Smrg func_basename "$obj" 91192a75d1c4Smrg $ECHO "$func_basename_result" 91202a75d1c4Smrg done | sort | sort -uc >/dev/null 2>&1); then 91212a75d1c4Smrg : 91222a75d1c4Smrg else 91232a75d1c4Smrg echo "copying selected object files to avoid basename conflicts..." 91242a75d1c4Smrg gentop="$output_objdir/${outputname}x" 91252a75d1c4Smrg func_append generated " $gentop" 91262a75d1c4Smrg func_mkdir_p "$gentop" 91272a75d1c4Smrg save_oldobjs=$oldobjs 91282a75d1c4Smrg oldobjs= 91292a75d1c4Smrg counter=1 91302a75d1c4Smrg for obj in $save_oldobjs 91312a75d1c4Smrg do 91322a75d1c4Smrg func_basename "$obj" 91332a75d1c4Smrg objbase="$func_basename_result" 91342a75d1c4Smrg case " $oldobjs " in 91352a75d1c4Smrg " ") oldobjs=$obj ;; 91362a75d1c4Smrg *[\ /]"$objbase "*) 91372a75d1c4Smrg while :; do 91382a75d1c4Smrg # Make sure we don't pick an alternate name that also 91392a75d1c4Smrg # overlaps. 91402a75d1c4Smrg newobj=lt$counter-$objbase 91412a75d1c4Smrg func_arith $counter + 1 91422a75d1c4Smrg counter=$func_arith_result 91432a75d1c4Smrg case " $oldobjs " in 91442a75d1c4Smrg *[\ /]"$newobj "*) ;; 91452a75d1c4Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 91462a75d1c4Smrg esac 91472a75d1c4Smrg done 91482a75d1c4Smrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 91492a75d1c4Smrg func_append oldobjs " $gentop/$newobj" 91502a75d1c4Smrg ;; 91512a75d1c4Smrg *) func_append oldobjs " $obj" ;; 91522a75d1c4Smrg esac 9153f7ec340bSmacallan done 9154f7ec340bSmacallan fi 91552a75d1c4Smrg eval cmds=\"$old_archive_cmds\" 9156f7ec340bSmacallan 91572a75d1c4Smrg func_len " $cmds" 91582a75d1c4Smrg len=$func_len_result 91592a75d1c4Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 91602a75d1c4Smrg cmds=$old_archive_cmds 91612a75d1c4Smrg elif test -n "$archiver_list_spec"; then 91622a75d1c4Smrg func_verbose "using command file archive linking..." 91632a75d1c4Smrg for obj in $oldobjs 91642a75d1c4Smrg do 91652a75d1c4Smrg func_to_tool_file "$obj" 91662a75d1c4Smrg $ECHO "$func_to_tool_file_result" 91672a75d1c4Smrg done > $output_objdir/$libname.libcmd 91682a75d1c4Smrg func_to_tool_file "$output_objdir/$libname.libcmd" 91692a75d1c4Smrg oldobjs=" $archiver_list_spec$func_to_tool_file_result" 91702a75d1c4Smrg cmds=$old_archive_cmds 91712a75d1c4Smrg else 91722a75d1c4Smrg # the command line is too long to link in one step, link in parts 91732a75d1c4Smrg func_verbose "using piecewise archive linking..." 91742a75d1c4Smrg save_RANLIB=$RANLIB 91752a75d1c4Smrg RANLIB=: 91762a75d1c4Smrg objlist= 91772a75d1c4Smrg concat_cmds= 91782a75d1c4Smrg save_oldobjs=$oldobjs 91792a75d1c4Smrg oldobjs= 91802a75d1c4Smrg # Is there a better way of finding the last object in the list? 91812a75d1c4Smrg for obj in $save_oldobjs 91822a75d1c4Smrg do 91832a75d1c4Smrg last_oldobj=$obj 91842a75d1c4Smrg done 91852a75d1c4Smrg eval test_cmds=\"$old_archive_cmds\" 91862a75d1c4Smrg func_len " $test_cmds" 91872a75d1c4Smrg len0=$func_len_result 91882a75d1c4Smrg len=$len0 91892a75d1c4Smrg for obj in $save_oldobjs 91902a75d1c4Smrg do 91912a75d1c4Smrg func_len " $obj" 91922a75d1c4Smrg func_arith $len + $func_len_result 91932a75d1c4Smrg len=$func_arith_result 91942a75d1c4Smrg func_append objlist " $obj" 91952a75d1c4Smrg if test "$len" -lt "$max_cmd_len"; then 91962a75d1c4Smrg : 91972a75d1c4Smrg else 91982a75d1c4Smrg # the above command should be used before it gets too long 91992a75d1c4Smrg oldobjs=$objlist 92002a75d1c4Smrg if test "$obj" = "$last_oldobj" ; then 92012a75d1c4Smrg RANLIB=$save_RANLIB 92022a75d1c4Smrg fi 92032a75d1c4Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 92042a75d1c4Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 92052a75d1c4Smrg objlist= 92062a75d1c4Smrg len=$len0 92072a75d1c4Smrg fi 92082a75d1c4Smrg done 92092a75d1c4Smrg RANLIB=$save_RANLIB 92102a75d1c4Smrg oldobjs=$objlist 92112a75d1c4Smrg if test "X$oldobjs" = "X" ; then 92122a75d1c4Smrg eval cmds=\"\$concat_cmds\" 92132a75d1c4Smrg else 92142a75d1c4Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 92152a75d1c4Smrg fi 92162a75d1c4Smrg fi 92172a75d1c4Smrg fi 92182a75d1c4Smrg func_execute_cmds "$cmds" 'exit $?' 9219f7ec340bSmacallan done 9220f7ec340bSmacallan 92212a75d1c4Smrg test -n "$generated" && \ 92222a75d1c4Smrg func_show_eval "${RM}r$generated" 9223f7ec340bSmacallan 92242a75d1c4Smrg # Now create the libtool archive. 92252a75d1c4Smrg case $output in 92262a75d1c4Smrg *.la) 92272a75d1c4Smrg old_library= 92282a75d1c4Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 92292a75d1c4Smrg func_verbose "creating $output" 9230f7ec340bSmacallan 92312a75d1c4Smrg # Preserve any variables that may affect compiler behavior 92322a75d1c4Smrg for var in $variables_saved_for_relink; do 92332a75d1c4Smrg if eval test -z \"\${$var+set}\"; then 92342a75d1c4Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 92352a75d1c4Smrg elif eval var_value=\$$var; test -z "$var_value"; then 92362a75d1c4Smrg relink_command="$var=; export $var; $relink_command" 9237f7ec340bSmacallan else 92382a75d1c4Smrg func_quote_for_eval "$var_value" 92392a75d1c4Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9240f7ec340bSmacallan fi 92412a75d1c4Smrg done 92422a75d1c4Smrg # Quote the link command for shipping. 92432a75d1c4Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 92442a75d1c4Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 92452a75d1c4Smrg if test "$hardcode_automatic" = yes ; then 92462a75d1c4Smrg relink_command= 92472a75d1c4Smrg fi 9248f7ec340bSmacallan 92492a75d1c4Smrg # Only create the output if not a dry run. 92502a75d1c4Smrg $opt_dry_run || { 92512a75d1c4Smrg for installed in no yes; do 92522a75d1c4Smrg if test "$installed" = yes; then 92532a75d1c4Smrg if test -z "$install_libdir"; then 92542a75d1c4Smrg break 92552a75d1c4Smrg fi 92562a75d1c4Smrg output="$output_objdir/$outputname"i 92572a75d1c4Smrg # Replace all uninstalled libtool libraries with the installed ones 92582a75d1c4Smrg newdependency_libs= 92592a75d1c4Smrg for deplib in $dependency_libs; do 92602a75d1c4Smrg case $deplib in 92612a75d1c4Smrg *.la) 92622a75d1c4Smrg func_basename "$deplib" 92632a75d1c4Smrg name="$func_basename_result" 92642a75d1c4Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 92652a75d1c4Smrg test -z "$libdir" && \ 92662a75d1c4Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 92672a75d1c4Smrg func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 92682a75d1c4Smrg ;; 92692a75d1c4Smrg -L*) 92702a75d1c4Smrg func_stripname -L '' "$deplib" 92712a75d1c4Smrg func_replace_sysroot "$func_stripname_result" 92722a75d1c4Smrg func_append newdependency_libs " -L$func_replace_sysroot_result" 92732a75d1c4Smrg ;; 92742a75d1c4Smrg -R*) 92752a75d1c4Smrg func_stripname -R '' "$deplib" 92762a75d1c4Smrg func_replace_sysroot "$func_stripname_result" 92772a75d1c4Smrg func_append newdependency_libs " -R$func_replace_sysroot_result" 92782a75d1c4Smrg ;; 92792a75d1c4Smrg *) func_append newdependency_libs " $deplib" ;; 92802a75d1c4Smrg esac 92812a75d1c4Smrg done 92822a75d1c4Smrg dependency_libs="$newdependency_libs" 92832a75d1c4Smrg newdlfiles= 92842a75d1c4Smrg 92852a75d1c4Smrg for lib in $dlfiles; do 92862a75d1c4Smrg case $lib in 92872a75d1c4Smrg *.la) 92882a75d1c4Smrg func_basename "$lib" 92892a75d1c4Smrg name="$func_basename_result" 92902a75d1c4Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 92912a75d1c4Smrg test -z "$libdir" && \ 92922a75d1c4Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 92932a75d1c4Smrg func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 92942a75d1c4Smrg ;; 92952a75d1c4Smrg *) func_append newdlfiles " $lib" ;; 92962a75d1c4Smrg esac 92972a75d1c4Smrg done 92982a75d1c4Smrg dlfiles="$newdlfiles" 92992a75d1c4Smrg newdlprefiles= 93002a75d1c4Smrg for lib in $dlprefiles; do 93012a75d1c4Smrg case $lib in 93022a75d1c4Smrg *.la) 93032a75d1c4Smrg # Only pass preopened files to the pseudo-archive (for 93042a75d1c4Smrg # eventual linking with the app. that links it) if we 93052a75d1c4Smrg # didn't already link the preopened objects directly into 93062a75d1c4Smrg # the library: 93072a75d1c4Smrg func_basename "$lib" 93082a75d1c4Smrg name="$func_basename_result" 93092a75d1c4Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 93102a75d1c4Smrg test -z "$libdir" && \ 93112a75d1c4Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 93122a75d1c4Smrg func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 93132a75d1c4Smrg ;; 93142a75d1c4Smrg esac 93152a75d1c4Smrg done 93162a75d1c4Smrg dlprefiles="$newdlprefiles" 93172a75d1c4Smrg else 93182a75d1c4Smrg newdlfiles= 93192a75d1c4Smrg for lib in $dlfiles; do 93202a75d1c4Smrg case $lib in 93212a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 93222a75d1c4Smrg *) abs=`pwd`"/$lib" ;; 93232a75d1c4Smrg esac 93242a75d1c4Smrg func_append newdlfiles " $abs" 93252a75d1c4Smrg done 93262a75d1c4Smrg dlfiles="$newdlfiles" 93272a75d1c4Smrg newdlprefiles= 93282a75d1c4Smrg for lib in $dlprefiles; do 93292a75d1c4Smrg case $lib in 93302a75d1c4Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 93312a75d1c4Smrg *) abs=`pwd`"/$lib" ;; 93322a75d1c4Smrg esac 93332a75d1c4Smrg func_append newdlprefiles " $abs" 93342a75d1c4Smrg done 93352a75d1c4Smrg dlprefiles="$newdlprefiles" 93362a75d1c4Smrg fi 93372a75d1c4Smrg $RM $output 93382a75d1c4Smrg # place dlname in correct position for cygwin 93392a75d1c4Smrg # In fact, it would be nice if we could use this code for all target 93402a75d1c4Smrg # systems that can't hard-code library paths into their executables 93412a75d1c4Smrg # and that have no shared library path variable independent of PATH, 93422a75d1c4Smrg # but it turns out we can't easily determine that from inspecting 93432a75d1c4Smrg # libtool variables, so we have to hard-code the OSs to which it 93442a75d1c4Smrg # applies here; at the moment, that means platforms that use the PE 93452a75d1c4Smrg # object format with DLL files. See the long comment at the top of 93462a75d1c4Smrg # tests/bindir.at for full details. 93472a75d1c4Smrg tdlname=$dlname 93482a75d1c4Smrg case $host,$output,$installed,$module,$dlname in 93492a75d1c4Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 93502a75d1c4Smrg # If a -bindir argument was supplied, place the dll there. 93512a75d1c4Smrg if test "x$bindir" != x ; 93522a75d1c4Smrg then 93532a75d1c4Smrg func_relative_path "$install_libdir" "$bindir" 93542a75d1c4Smrg tdlname=$func_relative_path_result$dlname 93552a75d1c4Smrg else 93562a75d1c4Smrg # Otherwise fall back on heuristic. 93572a75d1c4Smrg tdlname=../bin/$dlname 93582a75d1c4Smrg fi 93592a75d1c4Smrg ;; 93602a75d1c4Smrg esac 93612a75d1c4Smrg $ECHO > $output "\ 93622a75d1c4Smrg# $outputname - a libtool library file 93632a75d1c4Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 93642a75d1c4Smrg# 93652a75d1c4Smrg# Please DO NOT delete this file! 93662a75d1c4Smrg# It is necessary for linking the library. 9367f7ec340bSmacallan 93682a75d1c4Smrg# The name that we can dlopen(3). 93692a75d1c4Smrgdlname='$tdlname' 9370f7ec340bSmacallan 93712a75d1c4Smrg# Names of this library. 93722a75d1c4Smrglibrary_names='$library_names' 9373f7ec340bSmacallan 93742a75d1c4Smrg# The name of the static archive. 93752a75d1c4Smrgold_library='$old_library' 9376f7ec340bSmacallan 93772a75d1c4Smrg# Linker flags that can not go in dependency_libs. 93782a75d1c4Smrginherited_linker_flags='$new_inherited_linker_flags' 9379f7ec340bSmacallan 93802a75d1c4Smrg# Libraries that this one depends upon. 93812a75d1c4Smrgdependency_libs='$dependency_libs' 9382f7ec340bSmacallan 93832a75d1c4Smrg# Names of additional weak libraries provided by this library 93842a75d1c4Smrgweak_library_names='$weak_libs' 9385f7ec340bSmacallan 93862a75d1c4Smrg# Version information for $libname. 93872a75d1c4Smrgcurrent=$current 93882a75d1c4Smrgage=$age 93892a75d1c4Smrgrevision=$revision 9390f7ec340bSmacallan 93912a75d1c4Smrg# Is this an already installed library? 93922a75d1c4Smrginstalled=$installed 9393f7ec340bSmacallan 93942a75d1c4Smrg# Should we warn about portability when linking against -modules? 93952a75d1c4Smrgshouldnotlink=$module 9396f7ec340bSmacallan 93972a75d1c4Smrg# Files to dlopen/dlpreopen 93982a75d1c4Smrgdlopen='$dlfiles' 93992a75d1c4Smrgdlpreopen='$dlprefiles' 9400f7ec340bSmacallan 94012a75d1c4Smrg# Directory that this library needs to be installed in: 94022a75d1c4Smrglibdir='$install_libdir'" 94032a75d1c4Smrg if test "$installed" = no && test "$need_relink" = yes; then 94042a75d1c4Smrg $ECHO >> $output "\ 94052a75d1c4Smrgrelink_command=\"$relink_command\"" 94062a75d1c4Smrg fi 94072a75d1c4Smrg done 94082a75d1c4Smrg } 9409f7ec340bSmacallan 94102a75d1c4Smrg # Do a symbolic link so that the libtool archive can be found in 94112a75d1c4Smrg # LD_LIBRARY_PATH before the program is installed. 94122a75d1c4Smrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 94132a75d1c4Smrg ;; 94142a75d1c4Smrg esac 94152a75d1c4Smrg exit $EXIT_SUCCESS 94162a75d1c4Smrg} 9417f7ec340bSmacallan 94182a75d1c4Smrg{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 94192a75d1c4Smrg func_mode_link ${1+"$@"} 9420f7ec340bSmacallan 9421f7ec340bSmacallan 94222a75d1c4Smrg# func_mode_uninstall arg... 94232a75d1c4Smrgfunc_mode_uninstall () 94242a75d1c4Smrg{ 94252a75d1c4Smrg $opt_debug 94262a75d1c4Smrg RM="$nonopt" 9427f7ec340bSmacallan files= 9428f7ec340bSmacallan rmforce= 9429f7ec340bSmacallan exit_status=0 9430f7ec340bSmacallan 9431f7ec340bSmacallan # This variable tells wrapper scripts just to set variables rather 9432f7ec340bSmacallan # than running their programs. 9433f7ec340bSmacallan libtool_install_magic="$magic" 9434f7ec340bSmacallan 9435f7ec340bSmacallan for arg 9436f7ec340bSmacallan do 9437f7ec340bSmacallan case $arg in 94382a75d1c4Smrg -f) func_append RM " $arg"; rmforce=yes ;; 94392a75d1c4Smrg -*) func_append RM " $arg" ;; 94402a75d1c4Smrg *) func_append files " $arg" ;; 9441f7ec340bSmacallan esac 9442f7ec340bSmacallan done 9443f7ec340bSmacallan 94442a75d1c4Smrg test -z "$RM" && \ 94452a75d1c4Smrg func_fatal_help "you must specify an RM program" 9446f7ec340bSmacallan 9447f7ec340bSmacallan rmdirs= 9448f7ec340bSmacallan 9449f7ec340bSmacallan for file in $files; do 94502a75d1c4Smrg func_dirname "$file" "" "." 94512a75d1c4Smrg dir="$func_dirname_result" 94522a75d1c4Smrg if test "X$dir" = X.; then 94532a75d1c4Smrg odir="$objdir" 9454f7ec340bSmacallan else 94552a75d1c4Smrg odir="$dir/$objdir" 9456f7ec340bSmacallan fi 94572a75d1c4Smrg func_basename "$file" 94582a75d1c4Smrg name="$func_basename_result" 94592a75d1c4Smrg test "$opt_mode" = uninstall && odir="$dir" 9460f7ec340bSmacallan 94612a75d1c4Smrg # Remember odir for removal later, being careful to avoid duplicates 94622a75d1c4Smrg if test "$opt_mode" = clean; then 9463f7ec340bSmacallan case " $rmdirs " in 94642a75d1c4Smrg *" $odir "*) ;; 94652a75d1c4Smrg *) func_append rmdirs " $odir" ;; 9466f7ec340bSmacallan esac 9467f7ec340bSmacallan fi 9468f7ec340bSmacallan 9469f7ec340bSmacallan # Don't error if the file doesn't exist and rm -f was used. 94702a75d1c4Smrg if { test -L "$file"; } >/dev/null 2>&1 || 94712a75d1c4Smrg { test -h "$file"; } >/dev/null 2>&1 || 94722a75d1c4Smrg test -f "$file"; then 9473f7ec340bSmacallan : 9474f7ec340bSmacallan elif test -d "$file"; then 9475f7ec340bSmacallan exit_status=1 9476f7ec340bSmacallan continue 9477f7ec340bSmacallan elif test "$rmforce" = yes; then 9478f7ec340bSmacallan continue 9479f7ec340bSmacallan fi 9480f7ec340bSmacallan 9481f7ec340bSmacallan rmfiles="$file" 9482f7ec340bSmacallan 9483f7ec340bSmacallan case $name in 9484f7ec340bSmacallan *.la) 9485f7ec340bSmacallan # Possibly a libtool archive, so verify it. 94862a75d1c4Smrg if func_lalib_p "$file"; then 94872a75d1c4Smrg func_source $dir/$name 9488f7ec340bSmacallan 9489f7ec340bSmacallan # Delete the libtool libraries and symlinks. 9490f7ec340bSmacallan for n in $library_names; do 94912a75d1c4Smrg func_append rmfiles " $odir/$n" 9492f7ec340bSmacallan done 94932a75d1c4Smrg test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9494f7ec340bSmacallan 94952a75d1c4Smrg case "$opt_mode" in 9496f7ec340bSmacallan clean) 94972a75d1c4Smrg case " $library_names " in 9498f7ec340bSmacallan *" $dlname "*) ;; 94992a75d1c4Smrg *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9500f7ec340bSmacallan esac 95012a75d1c4Smrg test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9502f7ec340bSmacallan ;; 9503f7ec340bSmacallan uninstall) 9504f7ec340bSmacallan if test -n "$library_names"; then 9505f7ec340bSmacallan # Do each command in the postuninstall commands. 95062a75d1c4Smrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9507f7ec340bSmacallan fi 9508f7ec340bSmacallan 9509f7ec340bSmacallan if test -n "$old_library"; then 9510f7ec340bSmacallan # Do each command in the old_postuninstall commands. 95112a75d1c4Smrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9512f7ec340bSmacallan fi 9513f7ec340bSmacallan # FIXME: should reinstall the best remaining shared library. 9514f7ec340bSmacallan ;; 9515f7ec340bSmacallan esac 9516f7ec340bSmacallan fi 9517f7ec340bSmacallan ;; 9518f7ec340bSmacallan 9519f7ec340bSmacallan *.lo) 9520f7ec340bSmacallan # Possibly a libtool object, so verify it. 95212a75d1c4Smrg if func_lalib_p "$file"; then 9522f7ec340bSmacallan 9523f7ec340bSmacallan # Read the .lo file 95242a75d1c4Smrg func_source $dir/$name 9525f7ec340bSmacallan 9526f7ec340bSmacallan # Add PIC object to the list of files to remove. 95272a75d1c4Smrg if test -n "$pic_object" && 95282a75d1c4Smrg test "$pic_object" != none; then 95292a75d1c4Smrg func_append rmfiles " $dir/$pic_object" 9530f7ec340bSmacallan fi 9531f7ec340bSmacallan 9532f7ec340bSmacallan # Add non-PIC object to the list of files to remove. 95332a75d1c4Smrg if test -n "$non_pic_object" && 95342a75d1c4Smrg test "$non_pic_object" != none; then 95352a75d1c4Smrg func_append rmfiles " $dir/$non_pic_object" 9536f7ec340bSmacallan fi 9537f7ec340bSmacallan fi 9538f7ec340bSmacallan ;; 9539f7ec340bSmacallan 9540f7ec340bSmacallan *) 95412a75d1c4Smrg if test "$opt_mode" = clean ; then 9542f7ec340bSmacallan noexename=$name 9543f7ec340bSmacallan case $file in 9544f7ec340bSmacallan *.exe) 95452a75d1c4Smrg func_stripname '' '.exe' "$file" 95462a75d1c4Smrg file=$func_stripname_result 95472a75d1c4Smrg func_stripname '' '.exe' "$name" 95482a75d1c4Smrg noexename=$func_stripname_result 9549f7ec340bSmacallan # $file with .exe has already been added to rmfiles, 9550f7ec340bSmacallan # add $file without .exe 95512a75d1c4Smrg func_append rmfiles " $file" 9552f7ec340bSmacallan ;; 9553f7ec340bSmacallan esac 9554f7ec340bSmacallan # Do a test to see if this is a libtool program. 95552a75d1c4Smrg if func_ltwrapper_p "$file"; then 95562a75d1c4Smrg if func_ltwrapper_executable_p "$file"; then 95572a75d1c4Smrg func_ltwrapper_scriptname "$file" 95582a75d1c4Smrg relink_command= 95592a75d1c4Smrg func_source $func_ltwrapper_scriptname_result 95602a75d1c4Smrg func_append rmfiles " $func_ltwrapper_scriptname_result" 95612a75d1c4Smrg else 95622a75d1c4Smrg relink_command= 95632a75d1c4Smrg func_source $dir/$noexename 95642a75d1c4Smrg fi 9565f7ec340bSmacallan 9566f7ec340bSmacallan # note $name still contains .exe if it was in $file originally 9567f7ec340bSmacallan # as does the version of $file that was added into $rmfiles 95682a75d1c4Smrg func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9569f7ec340bSmacallan if test "$fast_install" = yes && test -n "$relink_command"; then 95702a75d1c4Smrg func_append rmfiles " $odir/lt-$name" 9571f7ec340bSmacallan fi 9572f7ec340bSmacallan if test "X$noexename" != "X$name" ; then 95732a75d1c4Smrg func_append rmfiles " $odir/lt-${noexename}.c" 9574f7ec340bSmacallan fi 9575f7ec340bSmacallan fi 9576f7ec340bSmacallan fi 9577f7ec340bSmacallan ;; 9578f7ec340bSmacallan esac 95792a75d1c4Smrg func_show_eval "$RM $rmfiles" 'exit_status=1' 9580f7ec340bSmacallan done 9581f7ec340bSmacallan 9582f7ec340bSmacallan # Try to remove the ${objdir}s in the directories where we deleted files 9583f7ec340bSmacallan for dir in $rmdirs; do 9584f7ec340bSmacallan if test -d "$dir"; then 95852a75d1c4Smrg func_show_eval "rmdir $dir >/dev/null 2>&1" 9586f7ec340bSmacallan fi 9587f7ec340bSmacallan done 9588f7ec340bSmacallan 9589f7ec340bSmacallan exit $exit_status 95902a75d1c4Smrg} 9591f7ec340bSmacallan 95922a75d1c4Smrg{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 95932a75d1c4Smrg func_mode_uninstall ${1+"$@"} 9594f7ec340bSmacallan 95952a75d1c4Smrgtest -z "$opt_mode" && { 95962a75d1c4Smrg help="$generic_help" 95972a75d1c4Smrg func_fatal_help "you must specify a MODE" 95982a75d1c4Smrg} 95992a75d1c4Smrg 96002a75d1c4Smrgtest -z "$exec_cmd" && \ 96012a75d1c4Smrg func_fatal_help "invalid operation mode \`$opt_mode'" 9602f7ec340bSmacallan 9603f7ec340bSmacallanif test -n "$exec_cmd"; then 96042a75d1c4Smrg eval exec "$exec_cmd" 9605f7ec340bSmacallan exit $EXIT_FAILURE 9606f7ec340bSmacallanfi 9607f7ec340bSmacallan 96082a75d1c4Smrgexit $exit_status 9609f7ec340bSmacallan 9610f7ec340bSmacallan 9611f7ec340bSmacallan# The TAGs below are defined such that we never get into a situation 9612f7ec340bSmacallan# in which we disable both kinds of libraries. Given conflicting 9613f7ec340bSmacallan# choices, we go for a static library, that is the most portable, 9614f7ec340bSmacallan# since we can't tell whether shared libraries were disabled because 9615f7ec340bSmacallan# the user asked for that or because the platform doesn't support 9616f7ec340bSmacallan# them. This is particularly important on AIX, because we don't 9617f7ec340bSmacallan# support having both static and shared libraries enabled at the same 9618f7ec340bSmacallan# time on that platform, so we default to a shared-only configuration. 9619f7ec340bSmacallan# If a disable-shared tag is given, we'll fallback to a static-only 9620f7ec340bSmacallan# configuration. But we'll never go from static-only to shared-only. 9621f7ec340bSmacallan 9622f7ec340bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 96232a75d1c4Smrgbuild_libtool_libs=no 96242a75d1c4Smrgbuild_old_libs=yes 9625f7ec340bSmacallan# ### END LIBTOOL TAG CONFIG: disable-shared 9626f7ec340bSmacallan 9627f7ec340bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-static 96282a75d1c4Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9629f7ec340bSmacallan# ### END LIBTOOL TAG CONFIG: disable-static 9630f7ec340bSmacallan 9631f7ec340bSmacallan# Local Variables: 9632f7ec340bSmacallan# mode:shell-script 9633f7ec340bSmacallan# sh-indentation:2 9634f7ec340bSmacallan# End: 96352a75d1c4Smrg# vi:sw=2 96362a75d1c4Smrg 9637