ltmain.sh revision 6aec45a7
16aec45a7Smrg# Generated from ltmain.m4sh. 26aec45a7Smrg 36aec45a7Smrg# libtool (GNU libtool) 2.2.10 46aec45a7Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 56aec45a7Smrg 65c42550eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 76aec45a7Smrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 86aec45a7Smrg# This is free software; see the source for copying conditions. There is NO 96aec45a7Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 106aec45a7Smrg 116aec45a7Smrg# GNU Libtool is free software; you can redistribute it and/or modify 12ab47cfaaSmrg# it under the terms of the GNU General Public License as published by 13ab47cfaaSmrg# the Free Software Foundation; either version 2 of the License, or 14ab47cfaaSmrg# (at your option) any later version. 15ab47cfaaSmrg# 166aec45a7Smrg# As a special exception to the GNU General Public License, 176aec45a7Smrg# if you distribute this file as part of a program or library that 186aec45a7Smrg# is built using GNU Libtool, you may include this file under the 196aec45a7Smrg# same distribution terms that you use for the rest of that program. 206aec45a7Smrg# 216aec45a7Smrg# GNU Libtool is distributed in the hope that it will be useful, but 22ab47cfaaSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 23ab47cfaaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24ab47cfaaSmrg# General Public License for more details. 25ab47cfaaSmrg# 26ab47cfaaSmrg# You should have received a copy of the GNU General Public License 276aec45a7Smrg# along with GNU Libtool; see the file COPYING. If not, a copy 286aec45a7Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 296aec45a7Smrg# or obtained by writing to the Free Software Foundation, Inc., 306aec45a7Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 315c42550eSmrg 326aec45a7Smrg# Usage: $progname [OPTION]... [MODE-ARG]... 336aec45a7Smrg# 346aec45a7Smrg# Provide generalized library-building support services. 356aec45a7Smrg# 366aec45a7Smrg# --config show all configuration variables 376aec45a7Smrg# --debug enable verbose shell tracing 386aec45a7Smrg# -n, --dry-run display commands without modifying any files 396aec45a7Smrg# --features display basic configuration information and exit 406aec45a7Smrg# --mode=MODE use operation mode MODE 416aec45a7Smrg# --preserve-dup-deps don't remove duplicate dependency libraries 426aec45a7Smrg# --quiet, --silent don't print informational messages 436aec45a7Smrg# --no-quiet, --no-silent 446aec45a7Smrg# print informational messages (default) 456aec45a7Smrg# --tag=TAG use configuration variables from tag TAG 466aec45a7Smrg# -v, --verbose print more informational messages than default 476aec45a7Smrg# --no-verbose don't print the extra informational messages 486aec45a7Smrg# --version print version information 496aec45a7Smrg# -h, --help, --help-all print short, long, or detailed help message 506aec45a7Smrg# 516aec45a7Smrg# MODE must be one of the following: 526aec45a7Smrg# 536aec45a7Smrg# clean remove files from the build directory 546aec45a7Smrg# compile compile a source file into a libtool object 556aec45a7Smrg# execute automatically set library path, then run a program 566aec45a7Smrg# finish complete the installation of libtool libraries 576aec45a7Smrg# install install libraries or executables 586aec45a7Smrg# link create a library or an executable 596aec45a7Smrg# uninstall remove libraries from an installed directory 606aec45a7Smrg# 616aec45a7Smrg# MODE-ARGS vary depending on the MODE. When passed as first option, 626aec45a7Smrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 636aec45a7Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 646aec45a7Smrg# 656aec45a7Smrg# When reporting a bug, please describe a test case to reproduce it and 666aec45a7Smrg# include the following information: 676aec45a7Smrg# 686aec45a7Smrg# host-triplet: $host 696aec45a7Smrg# shell: $SHELL 706aec45a7Smrg# compiler: $LTCC 716aec45a7Smrg# compiler flags: $LTCFLAGS 726aec45a7Smrg# linker: $LD (gnu? $with_gnu_ld) 736aec45a7Smrg# $progname: (GNU libtool) 2.2.10 746aec45a7Smrg# automake: $automake_version 756aec45a7Smrg# autoconf: $autoconf_version 766aec45a7Smrg# 776aec45a7Smrg# Report bugs to <bug-libtool@gnu.org>. 78ab47cfaaSmrg 796aec45a7SmrgPROGRAM=libtool 80ab47cfaaSmrgPACKAGE=libtool 816aec45a7SmrgVERSION=2.2.10 826aec45a7SmrgTIMESTAMP="" 836aec45a7Smrgpackage_revision=1.3175 848697ee19Smrg 856aec45a7Smrg# Be Bourne compatible 868697ee19Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 878697ee19Smrg emulate sh 888697ee19Smrg NULLCMD=: 898697ee19Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 908697ee19Smrg # is contrary to our usage. Disable this feature. 918697ee19Smrg alias -g '${1+"$@"}'='"$@"' 92ab47cfaaSmrg setopt NO_GLOB_SUBST 938697ee19Smrgelse 948697ee19Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 95ab47cfaaSmrgfi 968697ee19SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 978697ee19SmrgDUALCASE=1; export DUALCASE # for MKS sh 98ab47cfaaSmrg 996aec45a7Smrg# A function that is used when there is no print builtin or printf. 1006aec45a7Smrgfunc_fallback_echo () 1016aec45a7Smrg{ 1026aec45a7Smrg eval 'cat <<_LTECHO_EOF 1036aec45a7Smrg$1 1046aec45a7Smrg_LTECHO_EOF' 1056aec45a7Smrg} 1065c42550eSmrg 1076aec45a7Smrg# NLS nuisances: We save the old values to restore during execute mode. 1086aec45a7Smrglt_user_locale= 1096aec45a7Smrglt_safe_locale= 1101473d951Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1118697ee19Smrgdo 1128697ee19Smrg eval "if test \"\${$lt_var+set}\" = set; then 1136aec45a7Smrg save_$lt_var=\$$lt_var 1146aec45a7Smrg $lt_var=C 1158697ee19Smrg export $lt_var 1166aec45a7Smrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 1176aec45a7Smrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 1188697ee19Smrg fi" 1198697ee19Smrgdone 1206aec45a7SmrgLC_ALL=C 1216aec45a7SmrgLANGUAGE=C 1226aec45a7Smrgexport LANGUAGE LC_ALL 123ab47cfaaSmrg 1246aec45a7Smrg$lt_unset CDPATH 1256aec45a7Smrg 1266aec45a7Smrg 1276aec45a7Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1286aec45a7Smrg# is ksh but when the shell is invoked as "sh" and the current value of 1296aec45a7Smrg# the _XPG environment variable is not equal to 1 (one), the special 1306aec45a7Smrg# positional parameter $0, within a function call, is the name of the 1316aec45a7Smrg# function. 1326aec45a7Smrgprogpath="$0" 1336aec45a7Smrg 1346aec45a7Smrg 1356aec45a7Smrg 1366aec45a7Smrg: ${CP="cp -f"} 1376aec45a7Smrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 1386aec45a7Smrg: ${EGREP="/bin/grep -E"} 1396aec45a7Smrg: ${FGREP="/bin/grep -F"} 1406aec45a7Smrg: ${GREP="/bin/grep"} 1416aec45a7Smrg: ${LN_S="ln -s"} 1426aec45a7Smrg: ${MAKE="make"} 1436aec45a7Smrg: ${MKDIR="mkdir"} 1446aec45a7Smrg: ${MV="mv -f"} 1456aec45a7Smrg: ${RM="rm -f"} 1466aec45a7Smrg: ${SED="/bin/sed"} 1476aec45a7Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 1486aec45a7Smrg: ${Xsed="$SED -e 1s/^X//"} 1496aec45a7Smrg 1506aec45a7Smrg# Global variables: 1516aec45a7SmrgEXIT_SUCCESS=0 1526aec45a7SmrgEXIT_FAILURE=1 1536aec45a7SmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 1546aec45a7SmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 1556aec45a7Smrg 1566aec45a7Smrgexit_status=$EXIT_SUCCESS 1571473d951Smrg 158ab47cfaaSmrg# Make sure IFS has a sensible default 159ab47cfaaSmrglt_nl=' 160ab47cfaaSmrg' 161ab47cfaaSmrgIFS=" $lt_nl" 162ab47cfaaSmrg 1636aec45a7Smrgdirname="s,/[^/]*$,," 1646aec45a7Smrgbasename="s,^.*/,," 1656aec45a7Smrg 1666aec45a7Smrg# func_dirname_and_basename file append nondir_replacement 1676aec45a7Smrg# perform func_basename and func_dirname in a single function 1686aec45a7Smrg# call: 1696aec45a7Smrg# dirname: Compute the dirname of FILE. If nonempty, 1706aec45a7Smrg# add APPEND to the result, otherwise set result 1716aec45a7Smrg# to NONDIR_REPLACEMENT. 1726aec45a7Smrg# value returned in "$func_dirname_result" 1736aec45a7Smrg# basename: Compute filename of FILE. 1746aec45a7Smrg# value retuned in "$func_basename_result" 1756aec45a7Smrg# Implementation must be kept synchronized with func_dirname 1766aec45a7Smrg# and func_basename. For efficiency, we do not delegate to 1776aec45a7Smrg# those functions but instead duplicate the functionality here. 1786aec45a7Smrgfunc_dirname_and_basename () 1796aec45a7Smrg{ 1806aec45a7Smrg # Extract subdirectory from the argument. 1816aec45a7Smrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 1826aec45a7Smrg if test "X$func_dirname_result" = "X${1}"; then 1836aec45a7Smrg func_dirname_result="${3}" 1846aec45a7Smrg else 1856aec45a7Smrg func_dirname_result="$func_dirname_result${2}" 1866aec45a7Smrg fi 1876aec45a7Smrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 1886aec45a7Smrg} 1891473d951Smrg 1906aec45a7Smrg# Generated shell functions inserted here. 1916aec45a7Smrg 1926aec45a7Smrg# These SED scripts presuppose an absolute path with a trailing slash. 1936aec45a7Smrgpathcar='s,^/\([^/]*\).*$,\1,' 1946aec45a7Smrgpathcdr='s,^/[^/]*,,' 1956aec45a7Smrgremovedotparts=':dotsl 1966aec45a7Smrg s@/\./@/@g 1976aec45a7Smrg t dotsl 1986aec45a7Smrg s,/\.$,/,' 1996aec45a7Smrgcollapseslashes='s@/\{1,\}@/@g' 2006aec45a7Smrgfinalslash='s,/*$,/,' 2016aec45a7Smrg 2026aec45a7Smrg# func_normal_abspath PATH 2036aec45a7Smrg# Remove doubled-up and trailing slashes, "." path components, 2046aec45a7Smrg# and cancel out any ".." path components in PATH after making 2056aec45a7Smrg# it an absolute path. 2066aec45a7Smrg# value returned in "$func_normal_abspath_result" 2076aec45a7Smrgfunc_normal_abspath () 2086aec45a7Smrg{ 2096aec45a7Smrg # Start from root dir and reassemble the path. 2106aec45a7Smrg func_normal_abspath_result= 2116aec45a7Smrg func_normal_abspath_tpath=$1 2126aec45a7Smrg func_normal_abspath_altnamespace= 2136aec45a7Smrg case $func_normal_abspath_tpath in 2146aec45a7Smrg "") 2156aec45a7Smrg # Empty path, that just means $cwd. 2166aec45a7Smrg func_stripname '' '/' "`pwd`" 2176aec45a7Smrg func_normal_abspath_result=$func_stripname_result 2186aec45a7Smrg return 2196aec45a7Smrg ;; 2206aec45a7Smrg # The next three entries are used to spot a run of precisely 2216aec45a7Smrg # two leading slashes without using negated character classes; 2226aec45a7Smrg # we take advantage of case's first-match behaviour. 2236aec45a7Smrg ///*) 2246aec45a7Smrg # Unusual form of absolute path, do nothing. 2256aec45a7Smrg ;; 2266aec45a7Smrg //*) 2276aec45a7Smrg # Not necessarily an ordinary path; POSIX reserves leading '//' 2286aec45a7Smrg # and for example Cygwin uses it to access remote file shares 2296aec45a7Smrg # over CIFS/SMB, so we conserve a leading double slash if found. 2306aec45a7Smrg func_normal_abspath_altnamespace=/ 2316aec45a7Smrg ;; 2326aec45a7Smrg /*) 2336aec45a7Smrg # Absolute path, do nothing. 2346aec45a7Smrg ;; 2356aec45a7Smrg *) 2366aec45a7Smrg # Relative path, prepend $cwd. 2376aec45a7Smrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 2386aec45a7Smrg ;; 2396aec45a7Smrg esac 2406aec45a7Smrg # Cancel out all the simple stuff to save iterations. We also want 2416aec45a7Smrg # the path to end with a slash for ease of parsing, so make sure 2426aec45a7Smrg # there is one (and only one) here. 2436aec45a7Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2446aec45a7Smrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 2456aec45a7Smrg while :; do 2466aec45a7Smrg # Processed it all yet? 2476aec45a7Smrg if test "$func_normal_abspath_tpath" = / ; then 2486aec45a7Smrg # If we ascended to the root using ".." the result may be empty now. 2496aec45a7Smrg if test -z "$func_normal_abspath_result" ; then 2506aec45a7Smrg func_normal_abspath_result=/ 2516aec45a7Smrg fi 2526aec45a7Smrg break 2536aec45a7Smrg fi 2546aec45a7Smrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2556aec45a7Smrg -e "$pathcar"` 2566aec45a7Smrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2576aec45a7Smrg -e "$pathcdr"` 2586aec45a7Smrg # Figure out what to do with it 2596aec45a7Smrg case $func_normal_abspath_tcomponent in 2606aec45a7Smrg "") 2616aec45a7Smrg # Trailing empty path component, ignore it. 2626aec45a7Smrg ;; 2636aec45a7Smrg ..) 2646aec45a7Smrg # Parent dir; strip last assembled component from result. 2656aec45a7Smrg func_dirname "$func_normal_abspath_result" 2666aec45a7Smrg func_normal_abspath_result=$func_dirname_result 2676aec45a7Smrg ;; 2686aec45a7Smrg *) 2696aec45a7Smrg # Actual path component, append it. 2706aec45a7Smrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 2716aec45a7Smrg ;; 2726aec45a7Smrg esac 2736aec45a7Smrg done 2746aec45a7Smrg # Restore leading double-slash if one was found on entry. 2756aec45a7Smrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 2766aec45a7Smrg} 2776aec45a7Smrg 2786aec45a7Smrg# func_relative_path SRCDIR DSTDIR 2796aec45a7Smrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 2806aec45a7Smrg# slash if non-empty, suitable for immediately appending a filename 2816aec45a7Smrg# without needing to append a separator. 2826aec45a7Smrg# value returned in "$func_relative_path_result" 2836aec45a7Smrgfunc_relative_path () 2846aec45a7Smrg{ 2856aec45a7Smrg func_relative_path_result= 2866aec45a7Smrg func_normal_abspath "$1" 2876aec45a7Smrg func_relative_path_tlibdir=$func_normal_abspath_result 2886aec45a7Smrg func_normal_abspath "$2" 2896aec45a7Smrg func_relative_path_tbindir=$func_normal_abspath_result 2906aec45a7Smrg 2916aec45a7Smrg # Ascend the tree starting from libdir 2926aec45a7Smrg while :; do 2936aec45a7Smrg # check if we have found a prefix of bindir 2946aec45a7Smrg case $func_relative_path_tbindir in 2956aec45a7Smrg $func_relative_path_tlibdir) 2966aec45a7Smrg # found an exact match 2976aec45a7Smrg func_relative_path_tcancelled= 2986aec45a7Smrg break 2996aec45a7Smrg ;; 3006aec45a7Smrg $func_relative_path_tlibdir*) 3016aec45a7Smrg # found a matching prefix 3026aec45a7Smrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 3036aec45a7Smrg func_relative_path_tcancelled=$func_stripname_result 3046aec45a7Smrg if test -z "$func_relative_path_result"; then 3056aec45a7Smrg func_relative_path_result=. 3066aec45a7Smrg fi 3076aec45a7Smrg break 3086aec45a7Smrg ;; 3096aec45a7Smrg *) 3106aec45a7Smrg func_dirname $func_relative_path_tlibdir 3116aec45a7Smrg func_relative_path_tlibdir=${func_dirname_result} 3126aec45a7Smrg if test "x$func_relative_path_tlibdir" = x ; then 3136aec45a7Smrg # Have to descend all the way to the root! 3146aec45a7Smrg func_relative_path_result=../$func_relative_path_result 3156aec45a7Smrg func_relative_path_tcancelled=$func_relative_path_tbindir 3166aec45a7Smrg break 3176aec45a7Smrg fi 3186aec45a7Smrg func_relative_path_result=../$func_relative_path_result 3196aec45a7Smrg ;; 3206aec45a7Smrg esac 3216aec45a7Smrg done 3226aec45a7Smrg 3236aec45a7Smrg # Now calculate path; take care to avoid doubling-up slashes. 3246aec45a7Smrg func_stripname '' '/' "$func_relative_path_result" 3256aec45a7Smrg func_relative_path_result=$func_stripname_result 3266aec45a7Smrg func_stripname '/' '/' "$func_relative_path_tcancelled" 3276aec45a7Smrg if test "x$func_stripname_result" != x ; then 3286aec45a7Smrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 3296aec45a7Smrg fi 3306aec45a7Smrg 3316aec45a7Smrg # Normalisation. If bindir is libdir, return empty string, 3326aec45a7Smrg # else relative path ending with a slash; either way, target 3336aec45a7Smrg # file name can be directly appended. 3346aec45a7Smrg if test ! -z "$func_relative_path_result"; then 3356aec45a7Smrg func_stripname './' '' "$func_relative_path_result/" 3366aec45a7Smrg func_relative_path_result=$func_stripname_result 3376aec45a7Smrg fi 3386aec45a7Smrg} 3396aec45a7Smrg 3406aec45a7Smrg# The name of this program: 3416aec45a7Smrgfunc_dirname_and_basename "$progpath" 3426aec45a7Smrgprogname=$func_basename_result 3436aec45a7Smrg 3446aec45a7Smrg# Make sure we have an absolute path for reexecution: 3456aec45a7Smrgcase $progpath in 3466aec45a7Smrg [\\/]*|[A-Za-z]:\\*) ;; 3476aec45a7Smrg *[\\/]*) 3486aec45a7Smrg progdir=$func_dirname_result 3496aec45a7Smrg progdir=`cd "$progdir" && pwd` 3506aec45a7Smrg progpath="$progdir/$progname" 3516aec45a7Smrg ;; 3526aec45a7Smrg *) 3536aec45a7Smrg save_IFS="$IFS" 3546aec45a7Smrg IFS=: 3556aec45a7Smrg for progdir in $PATH; do 3566aec45a7Smrg IFS="$save_IFS" 3576aec45a7Smrg test -x "$progdir/$progname" && break 3586aec45a7Smrg done 3596aec45a7Smrg IFS="$save_IFS" 3606aec45a7Smrg test -n "$progdir" || progdir=`pwd` 3616aec45a7Smrg progpath="$progdir/$progname" 3626aec45a7Smrg ;; 3636aec45a7Smrgesac 3646aec45a7Smrg 3656aec45a7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 3666aec45a7Smrg# metacharacters that are still active within double-quoted strings. 3676aec45a7SmrgXsed="${SED}"' -e 1s/^X//' 3686aec45a7Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 3696aec45a7Smrg 3706aec45a7Smrg# Same as above, but do not quote variable references. 3716aec45a7Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 3726aec45a7Smrg 3736aec45a7Smrg# Re-`\' parameter expansions in output of double_quote_subst that were 3746aec45a7Smrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 3756aec45a7Smrg# in input to double_quote_subst, that '$' was protected from expansion. 3766aec45a7Smrg# Since each input `\' is now two `\'s, look for any number of runs of 3776aec45a7Smrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 3786aec45a7Smrgbs='\\' 3796aec45a7Smrgbs2='\\\\' 3806aec45a7Smrgbs4='\\\\\\\\' 3816aec45a7Smrgdollar='\$' 3826aec45a7Smrgsed_double_backslash="\ 3836aec45a7Smrg s/$bs4/&\\ 3846aec45a7Smrg/g 3856aec45a7Smrg s/^$bs2$dollar/$bs&/ 3866aec45a7Smrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 3876aec45a7Smrg s/\n//g" 3886aec45a7Smrg 3896aec45a7Smrg# Standard options: 3906aec45a7Smrgopt_dry_run=false 3916aec45a7Smrgopt_help=false 3926aec45a7Smrgopt_quiet=false 3936aec45a7Smrgopt_verbose=false 3946aec45a7Smrgopt_warning=: 3956aec45a7Smrg 3966aec45a7Smrg# func_echo arg... 3976aec45a7Smrg# Echo program name prefixed message, along with the current mode 3986aec45a7Smrg# name if it has been set yet. 3996aec45a7Smrgfunc_echo () 4006aec45a7Smrg{ 4016aec45a7Smrg $ECHO "$progname${mode+: }$mode: $*" 4026aec45a7Smrg} 4036aec45a7Smrg 4046aec45a7Smrg# func_verbose arg... 4056aec45a7Smrg# Echo program name prefixed message in verbose mode only. 4066aec45a7Smrgfunc_verbose () 4076aec45a7Smrg{ 4086aec45a7Smrg $opt_verbose && func_echo ${1+"$@"} 4096aec45a7Smrg 4106aec45a7Smrg # A bug in bash halts the script if the last line of a function 4116aec45a7Smrg # fails when set -e is in force, so we need another command to 4126aec45a7Smrg # work around that: 4136aec45a7Smrg : 4146aec45a7Smrg} 4156aec45a7Smrg 4166aec45a7Smrg# func_echo_all arg... 4176aec45a7Smrg# Invoke $ECHO with all args, space-separated. 4186aec45a7Smrgfunc_echo_all () 4196aec45a7Smrg{ 4206aec45a7Smrg $ECHO "$*" 4216aec45a7Smrg} 4226aec45a7Smrg 4236aec45a7Smrg# func_error arg... 4246aec45a7Smrg# Echo program name prefixed message to standard error. 4256aec45a7Smrgfunc_error () 4266aec45a7Smrg{ 4276aec45a7Smrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 4286aec45a7Smrg} 4296aec45a7Smrg 4306aec45a7Smrg# func_warning arg... 4316aec45a7Smrg# Echo program name prefixed warning message to standard error. 4326aec45a7Smrgfunc_warning () 4336aec45a7Smrg{ 4346aec45a7Smrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 4356aec45a7Smrg 4366aec45a7Smrg # bash bug again: 4376aec45a7Smrg : 4386aec45a7Smrg} 4396aec45a7Smrg 4406aec45a7Smrg# func_fatal_error arg... 4416aec45a7Smrg# Echo program name prefixed message to standard error, and exit. 4426aec45a7Smrgfunc_fatal_error () 4436aec45a7Smrg{ 4446aec45a7Smrg func_error ${1+"$@"} 4456aec45a7Smrg exit $EXIT_FAILURE 4466aec45a7Smrg} 4476aec45a7Smrg 4486aec45a7Smrg# func_fatal_help arg... 4496aec45a7Smrg# Echo program name prefixed message to standard error, followed by 4506aec45a7Smrg# a help hint, and exit. 4516aec45a7Smrgfunc_fatal_help () 4526aec45a7Smrg{ 4536aec45a7Smrg func_error ${1+"$@"} 4546aec45a7Smrg func_fatal_error "$help" 4556aec45a7Smrg} 4566aec45a7Smrghelp="Try \`$progname --help' for more information." ## default 4576aec45a7Smrg 4586aec45a7Smrg 4596aec45a7Smrg# func_grep expression filename 4606aec45a7Smrg# Check whether EXPRESSION matches any line of FILENAME, without output. 4616aec45a7Smrgfunc_grep () 4626aec45a7Smrg{ 4636aec45a7Smrg $GREP "$1" "$2" >/dev/null 2>&1 4646aec45a7Smrg} 4656aec45a7Smrg 4666aec45a7Smrg 4676aec45a7Smrg# func_mkdir_p directory-path 4686aec45a7Smrg# Make sure the entire path to DIRECTORY-PATH is available. 4696aec45a7Smrgfunc_mkdir_p () 4706aec45a7Smrg{ 4716aec45a7Smrg my_directory_path="$1" 4726aec45a7Smrg my_dir_list= 4736aec45a7Smrg 4746aec45a7Smrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 4756aec45a7Smrg 4766aec45a7Smrg # Protect directory names starting with `-' 4776aec45a7Smrg case $my_directory_path in 4786aec45a7Smrg -*) my_directory_path="./$my_directory_path" ;; 4796aec45a7Smrg esac 4806aec45a7Smrg 4816aec45a7Smrg # While some portion of DIR does not yet exist... 4826aec45a7Smrg while test ! -d "$my_directory_path"; do 4836aec45a7Smrg # ...make a list in topmost first order. Use a colon delimited 4846aec45a7Smrg # list incase some portion of path contains whitespace. 4856aec45a7Smrg my_dir_list="$my_directory_path:$my_dir_list" 4866aec45a7Smrg 4876aec45a7Smrg # If the last portion added has no slash in it, the list is done 4886aec45a7Smrg case $my_directory_path in */*) ;; *) break ;; esac 4896aec45a7Smrg 4906aec45a7Smrg # ...otherwise throw away the child directory and loop 4916aec45a7Smrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 4926aec45a7Smrg done 4936aec45a7Smrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 4946aec45a7Smrg 4956aec45a7Smrg save_mkdir_p_IFS="$IFS"; IFS=':' 4966aec45a7Smrg for my_dir in $my_dir_list; do 4976aec45a7Smrg IFS="$save_mkdir_p_IFS" 4986aec45a7Smrg # mkdir can fail with a `File exist' error if two processes 4996aec45a7Smrg # try to create one of the directories concurrently. Don't 5006aec45a7Smrg # stop in that case! 5016aec45a7Smrg $MKDIR "$my_dir" 2>/dev/null || : 5026aec45a7Smrg done 5036aec45a7Smrg IFS="$save_mkdir_p_IFS" 5046aec45a7Smrg 5056aec45a7Smrg # Bail out if we (or some other process) failed to create a directory. 5066aec45a7Smrg test -d "$my_directory_path" || \ 5076aec45a7Smrg func_fatal_error "Failed to create \`$1'" 5086aec45a7Smrg fi 5096aec45a7Smrg} 510ab47cfaaSmrg 511ab47cfaaSmrg 512ab47cfaaSmrg# func_mktempdir [string] 513ab47cfaaSmrg# Make a temporary directory that won't clash with other running 514ab47cfaaSmrg# libtool processes, and avoids race conditions if possible. If 515ab47cfaaSmrg# given, STRING is the basename for that directory. 516ab47cfaaSmrgfunc_mktempdir () 517ab47cfaaSmrg{ 518ab47cfaaSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 519ab47cfaaSmrg 5206aec45a7Smrg if test "$opt_dry_run" = ":"; then 521ab47cfaaSmrg # Return a directory name, but don't create it in dry-run mode 522ab47cfaaSmrg my_tmpdir="${my_template}-$$" 523ab47cfaaSmrg else 524ab47cfaaSmrg 525ab47cfaaSmrg # If mktemp works, use that first and foremost 526ab47cfaaSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 527ab47cfaaSmrg 528ab47cfaaSmrg if test ! -d "$my_tmpdir"; then 5296aec45a7Smrg # Failing that, at least try and use $RANDOM to avoid a race 5306aec45a7Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 531ab47cfaaSmrg 5326aec45a7Smrg save_mktempdir_umask=`umask` 5336aec45a7Smrg umask 0077 5346aec45a7Smrg $MKDIR "$my_tmpdir" 5356aec45a7Smrg umask $save_mktempdir_umask 536ab47cfaaSmrg fi 537ab47cfaaSmrg 538ab47cfaaSmrg # If we're not in dry-run mode, bomb out on failure 5396aec45a7Smrg test -d "$my_tmpdir" || \ 5406aec45a7Smrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 541ab47cfaaSmrg fi 542ab47cfaaSmrg 5436aec45a7Smrg $ECHO "$my_tmpdir" 544ab47cfaaSmrg} 545ab47cfaaSmrg 546ab47cfaaSmrg 5476aec45a7Smrg# func_quote_for_eval arg 5486aec45a7Smrg# Aesthetically quote ARG to be evaled later. 5496aec45a7Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 5506aec45a7Smrg# is double-quoted, suitable for a subsequent eval, whereas 5516aec45a7Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 5526aec45a7Smrg# which are still active within double quotes backslashified. 5536aec45a7Smrgfunc_quote_for_eval () 554ab47cfaaSmrg{ 5556aec45a7Smrg case $1 in 5566aec45a7Smrg *[\\\`\"\$]*) 5576aec45a7Smrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 5586aec45a7Smrg *) 5596aec45a7Smrg func_quote_for_eval_unquoted_result="$1" ;; 5606aec45a7Smrg esac 5616aec45a7Smrg 5626aec45a7Smrg case $func_quote_for_eval_unquoted_result in 5636aec45a7Smrg # Double-quote args containing shell metacharacters to delay 5646aec45a7Smrg # word splitting, command substitution and and variable 5656aec45a7Smrg # expansion for a subsequent eval. 5666aec45a7Smrg # Many Bourne shells cannot handle close brackets correctly 5676aec45a7Smrg # in scan sets, so we specify it separately. 5686aec45a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5696aec45a7Smrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 5706aec45a7Smrg ;; 5716aec45a7Smrg *) 5726aec45a7Smrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 573ab47cfaaSmrg esac 574ab47cfaaSmrg} 575ab47cfaaSmrg 576ab47cfaaSmrg 5776aec45a7Smrg# func_quote_for_expand arg 5786aec45a7Smrg# Aesthetically quote ARG to be evaled later; same as above, 5796aec45a7Smrg# but do not quote variable references. 5806aec45a7Smrgfunc_quote_for_expand () 581ab47cfaaSmrg{ 5826aec45a7Smrg case $1 in 5836aec45a7Smrg *[\\\`\"]*) 5846aec45a7Smrg my_arg=`$ECHO "$1" | $SED \ 5856aec45a7Smrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 586ab47cfaaSmrg *) 5876aec45a7Smrg my_arg="$1" ;; 5886aec45a7Smrg esac 5896aec45a7Smrg 5906aec45a7Smrg case $my_arg in 5916aec45a7Smrg # Double-quote args containing shell metacharacters to delay 5926aec45a7Smrg # word splitting and command substitution for a subsequent eval. 5936aec45a7Smrg # Many Bourne shells cannot handle close brackets correctly 5946aec45a7Smrg # in scan sets, so we specify it separately. 5956aec45a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5966aec45a7Smrg my_arg="\"$my_arg\"" 5976aec45a7Smrg ;; 5986aec45a7Smrg esac 5996aec45a7Smrg 6006aec45a7Smrg func_quote_for_expand_result="$my_arg" 601ab47cfaaSmrg} 602ab47cfaaSmrg 603ab47cfaaSmrg 6046aec45a7Smrg# func_show_eval cmd [fail_exp] 6056aec45a7Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6066aec45a7Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6076aec45a7Smrg# is given, then evaluate it. 6086aec45a7Smrgfunc_show_eval () 609ab47cfaaSmrg{ 6106aec45a7Smrg my_cmd="$1" 6116aec45a7Smrg my_fail_exp="${2-:}" 6121473d951Smrg 6136aec45a7Smrg ${opt_silent-false} || { 6146aec45a7Smrg func_quote_for_expand "$my_cmd" 6156aec45a7Smrg eval "func_echo $func_quote_for_expand_result" 6166aec45a7Smrg } 6176aec45a7Smrg 6186aec45a7Smrg if ${opt_dry_run-false}; then :; else 6196aec45a7Smrg eval "$my_cmd" 6206aec45a7Smrg my_status=$? 6216aec45a7Smrg if test "$my_status" -eq 0; then :; else 6226aec45a7Smrg eval "(exit $my_status); $my_fail_exp" 6236aec45a7Smrg fi 624ab47cfaaSmrg fi 625ab47cfaaSmrg} 626ab47cfaaSmrg 6276aec45a7Smrg 6286aec45a7Smrg# func_show_eval_locale cmd [fail_exp] 6296aec45a7Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6306aec45a7Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6316aec45a7Smrg# is given, then evaluate it. Use the saved locale for evaluation. 6326aec45a7Smrgfunc_show_eval_locale () 633ab47cfaaSmrg{ 6346aec45a7Smrg my_cmd="$1" 6356aec45a7Smrg my_fail_exp="${2-:}" 636ab47cfaaSmrg 6376aec45a7Smrg ${opt_silent-false} || { 6386aec45a7Smrg func_quote_for_expand "$my_cmd" 6396aec45a7Smrg eval "func_echo $func_quote_for_expand_result" 6406aec45a7Smrg } 6411473d951Smrg 6426aec45a7Smrg if ${opt_dry_run-false}; then :; else 6436aec45a7Smrg eval "$lt_user_locale 6446aec45a7Smrg $my_cmd" 6456aec45a7Smrg my_status=$? 6466aec45a7Smrg eval "$lt_safe_locale" 6476aec45a7Smrg if test "$my_status" -eq 0; then :; else 6486aec45a7Smrg eval "(exit $my_status); $my_fail_exp" 6495c42550eSmrg fi 6506aec45a7Smrg fi 651ab47cfaaSmrg} 652ab47cfaaSmrg 6531473d951Smrg 6546aec45a7Smrg# func_version 6556aec45a7Smrg# Echo version message to standard output and exit. 6566aec45a7Smrgfunc_version () 6576aec45a7Smrg{ 6586aec45a7Smrg $SED -n '/(C)/!b go 6596aec45a7Smrg :more 6606aec45a7Smrg /\./!{ 6616aec45a7Smrg N 6626aec45a7Smrg s/\n# / / 6636aec45a7Smrg b more 6646aec45a7Smrg } 6656aec45a7Smrg :go 6666aec45a7Smrg /^# '$PROGRAM' (GNU /,/# warranty; / { 6676aec45a7Smrg s/^# // 6686aec45a7Smrg s/^# *$// 6696aec45a7Smrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 6706aec45a7Smrg p 6716aec45a7Smrg }' < "$progpath" 6726aec45a7Smrg exit $? 6736aec45a7Smrg} 6741473d951Smrg 6756aec45a7Smrg# func_usage 6766aec45a7Smrg# Echo short help message to standard output and exit. 6776aec45a7Smrgfunc_usage () 6786aec45a7Smrg{ 6796aec45a7Smrg $SED -n '/^# Usage:/,/^# *.*--help/ { 6806aec45a7Smrg s/^# // 6816aec45a7Smrg s/^# *$// 6826aec45a7Smrg s/\$progname/'$progname'/ 6836aec45a7Smrg p 6846aec45a7Smrg }' < "$progpath" 6856aec45a7Smrg echo 6866aec45a7Smrg $ECHO "run \`$progname --help | more' for full usage" 6876aec45a7Smrg exit $? 6886aec45a7Smrg} 689ab47cfaaSmrg 6906aec45a7Smrg# func_help [NOEXIT] 6916aec45a7Smrg# Echo long help message to standard output and exit, 6926aec45a7Smrg# unless 'noexit' is passed as argument. 6936aec45a7Smrgfunc_help () 6946aec45a7Smrg{ 6956aec45a7Smrg $SED -n '/^# Usage:/,/# Report bugs to/ { 6966aec45a7Smrg s/^# // 6976aec45a7Smrg s/^# *$// 6986aec45a7Smrg s*\$progname*'$progname'* 6996aec45a7Smrg s*\$host*'"$host"'* 7006aec45a7Smrg s*\$SHELL*'"$SHELL"'* 7016aec45a7Smrg s*\$LTCC*'"$LTCC"'* 7026aec45a7Smrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 7036aec45a7Smrg s*\$LD*'"$LD"'* 7046aec45a7Smrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 7056aec45a7Smrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 7066aec45a7Smrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 7076aec45a7Smrg p 7086aec45a7Smrg }' < "$progpath" 7096aec45a7Smrg ret=$? 7106aec45a7Smrg if test -z "$1"; then 7116aec45a7Smrg exit $ret 7126aec45a7Smrg fi 7136aec45a7Smrg} 714ab47cfaaSmrg 7156aec45a7Smrg# func_missing_arg argname 7166aec45a7Smrg# Echo program name prefixed message to standard error and set global 7176aec45a7Smrg# exit_cmd. 7186aec45a7Smrgfunc_missing_arg () 7196aec45a7Smrg{ 7206aec45a7Smrg func_error "missing argument for $1." 7216aec45a7Smrg exit_cmd=exit 7226aec45a7Smrg} 723ab47cfaaSmrg 7246aec45a7Smrgexit_cmd=: 7251473d951Smrg 726ab47cfaaSmrg 7278697ee19Smrg 7281473d951Smrg 729ab47cfaaSmrg 7306aec45a7Smrg 7316aec45a7Smrgmagic="%%%MAGIC variable%%%" 7326aec45a7Smrgmagic_exe="%%%MAGIC EXE variable%%%" 7336aec45a7Smrg 7346aec45a7Smrg# Global variables. 7356aec45a7Smrg# $mode is unset 7366aec45a7Smrgnonopt= 7376aec45a7Smrgexecute_dlfiles= 7386aec45a7Smrgpreserve_args= 7396aec45a7Smrglo2o="s/\\.lo\$/.${objext}/" 7406aec45a7Smrgo2lo="s/\\.${objext}\$/.lo/" 7416aec45a7Smrgextracted_archives= 7426aec45a7Smrgextracted_serial=0 7436aec45a7Smrg 7446aec45a7Smrgopt_dry_run=false 7456aec45a7Smrgopt_duplicate_deps=false 7466aec45a7Smrgopt_silent=false 7476aec45a7Smrgopt_debug=: 7486aec45a7Smrg 7496aec45a7Smrg# If this variable is set in any of the actions, the command in it 7506aec45a7Smrg# will be execed at the end. This prevents here-documents from being 7516aec45a7Smrg# left over by shells. 7526aec45a7Smrgexec_cmd= 7536aec45a7Smrg 7546aec45a7Smrg# func_fatal_configuration arg... 7556aec45a7Smrg# Echo program name prefixed message to standard error, followed by 7566aec45a7Smrg# a configuration failure hint, and exit. 7576aec45a7Smrgfunc_fatal_configuration () 7586aec45a7Smrg{ 7596aec45a7Smrg func_error ${1+"$@"} 7606aec45a7Smrg func_error "See the $PACKAGE documentation for more information." 7616aec45a7Smrg func_fatal_error "Fatal configuration error." 7626aec45a7Smrg} 7636aec45a7Smrg 7646aec45a7Smrg 7656aec45a7Smrg# func_config 7666aec45a7Smrg# Display the configuration for all the tags in this script. 7676aec45a7Smrgfunc_config () 7686aec45a7Smrg{ 7696aec45a7Smrg re_begincf='^# ### BEGIN LIBTOOL' 7706aec45a7Smrg re_endcf='^# ### END LIBTOOL' 7716aec45a7Smrg 7726aec45a7Smrg # Default configuration. 7736aec45a7Smrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 7746aec45a7Smrg 775ab47cfaaSmrg # Now print the configurations for the tags. 776ab47cfaaSmrg for tagname in $taglist; do 7776aec45a7Smrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 778ab47cfaaSmrg done 7795c42550eSmrg 7806aec45a7Smrg exit $? 7816aec45a7Smrg} 7825c42550eSmrg 7836aec45a7Smrg# func_features 7846aec45a7Smrg# Display the features supported by this script. 7856aec45a7Smrgfunc_features () 7866aec45a7Smrg{ 7876aec45a7Smrg echo "host: $host" 788ab47cfaaSmrg if test "$build_libtool_libs" = yes; then 7896aec45a7Smrg echo "enable shared libraries" 790ab47cfaaSmrg else 7916aec45a7Smrg echo "disable shared libraries" 792ab47cfaaSmrg fi 793ab47cfaaSmrg if test "$build_old_libs" = yes; then 7946aec45a7Smrg echo "enable static libraries" 795ab47cfaaSmrg else 7966aec45a7Smrg echo "disable static libraries" 797ab47cfaaSmrg fi 7986aec45a7Smrg 799ab47cfaaSmrg exit $? 8006aec45a7Smrg} 801ab47cfaaSmrg 8026aec45a7Smrg# func_enable_tag tagname 8036aec45a7Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or 8046aec45a7Smrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 8056aec45a7Smrg# variable here. 8066aec45a7Smrgfunc_enable_tag () 8076aec45a7Smrg{ 8086aec45a7Smrg # Global variable: 8096aec45a7Smrg tagname="$1" 810ab47cfaaSmrg 8116aec45a7Smrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 8126aec45a7Smrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 8136aec45a7Smrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 8141473d951Smrg 8156aec45a7Smrg # Validate tagname. 8166aec45a7Smrg case $tagname in 8176aec45a7Smrg *[!-_A-Za-z0-9,/]*) 8186aec45a7Smrg func_fatal_error "invalid tag name: $tagname" 8196aec45a7Smrg ;; 8206aec45a7Smrg esac 821ab47cfaaSmrg 8226aec45a7Smrg # Don't test for the "default" C tag, as we know it's 8236aec45a7Smrg # there but not specially marked. 8246aec45a7Smrg case $tagname in 8256aec45a7Smrg CC) ;; 8266aec45a7Smrg *) 8276aec45a7Smrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 8286aec45a7Smrg taglist="$taglist $tagname" 8296aec45a7Smrg 8306aec45a7Smrg # Evaluate the configuration. Be careful to quote the path 8316aec45a7Smrg # and the sed script, to avoid splitting on whitespace, but 8326aec45a7Smrg # also don't use non-portable quotes within backquotes within 8336aec45a7Smrg # quotes we have to do it in 2 steps: 8346aec45a7Smrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 8356aec45a7Smrg eval "$extractedcf" 8366aec45a7Smrg else 8376aec45a7Smrg func_error "ignoring unknown tag $tagname" 8386aec45a7Smrg fi 8396aec45a7Smrg ;; 8406aec45a7Smrg esac 8416aec45a7Smrg} 8426aec45a7Smrg 8436aec45a7Smrg# Parse options once, thoroughly. This comes as soon as possible in 8446aec45a7Smrg# the script to make things like `libtool --version' happen quickly. 8456aec45a7Smrg{ 8465c42550eSmrg 8476aec45a7Smrg # Shorthand for --mode=foo, only valid as the first argument 8486aec45a7Smrg case $1 in 8496aec45a7Smrg clean|clea|cle|cl) 8506aec45a7Smrg shift; set dummy --mode clean ${1+"$@"}; shift 851ab47cfaaSmrg ;; 8526aec45a7Smrg compile|compil|compi|comp|com|co|c) 8536aec45a7Smrg shift; set dummy --mode compile ${1+"$@"}; shift 854ab47cfaaSmrg ;; 8556aec45a7Smrg execute|execut|execu|exec|exe|ex|e) 8566aec45a7Smrg shift; set dummy --mode execute ${1+"$@"}; shift 8571473d951Smrg ;; 8586aec45a7Smrg finish|finis|fini|fin|fi|f) 8596aec45a7Smrg shift; set dummy --mode finish ${1+"$@"}; shift 8601473d951Smrg ;; 8616aec45a7Smrg install|instal|insta|inst|ins|in|i) 8626aec45a7Smrg shift; set dummy --mode install ${1+"$@"}; shift 8636aec45a7Smrg ;; 8646aec45a7Smrg link|lin|li|l) 8656aec45a7Smrg shift; set dummy --mode link ${1+"$@"}; shift 8666aec45a7Smrg ;; 8676aec45a7Smrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 8686aec45a7Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 869ab47cfaaSmrg ;; 870ab47cfaaSmrg esac 871ab47cfaaSmrg 8726aec45a7Smrg # Parse non-mode specific arguments: 8736aec45a7Smrg while test "$#" -gt 0; do 8746aec45a7Smrg opt="$1" 8756aec45a7Smrg shift 8761473d951Smrg 8776aec45a7Smrg case $opt in 8786aec45a7Smrg --config) func_config ;; 8791473d951Smrg 8806aec45a7Smrg --debug) preserve_args="$preserve_args $opt" 8816aec45a7Smrg func_echo "enabling shell trace mode" 8826aec45a7Smrg opt_debug='set -x' 8836aec45a7Smrg $opt_debug 8846aec45a7Smrg ;; 8851473d951Smrg 8866aec45a7Smrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 8876aec45a7Smrg execute_dlfiles="$execute_dlfiles $1" 8886aec45a7Smrg shift 8896aec45a7Smrg ;; 8901473d951Smrg 8916aec45a7Smrg --dry-run | -n) opt_dry_run=: ;; 8926aec45a7Smrg --features) func_features ;; 8936aec45a7Smrg --finish) mode="finish" ;; 8946aec45a7Smrg 8956aec45a7Smrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 8966aec45a7Smrg case $1 in 8976aec45a7Smrg # Valid mode arguments: 8986aec45a7Smrg clean) ;; 8996aec45a7Smrg compile) ;; 9006aec45a7Smrg execute) ;; 9016aec45a7Smrg finish) ;; 9026aec45a7Smrg install) ;; 9036aec45a7Smrg link) ;; 9046aec45a7Smrg relink) ;; 9056aec45a7Smrg uninstall) ;; 9066aec45a7Smrg 9076aec45a7Smrg # Catch anything else as an error 9086aec45a7Smrg *) func_error "invalid argument for $opt" 9096aec45a7Smrg exit_cmd=exit 9106aec45a7Smrg break 9116aec45a7Smrg ;; 9126aec45a7Smrg esac 9136aec45a7Smrg 9146aec45a7Smrg mode="$1" 9156aec45a7Smrg shift 9166aec45a7Smrg ;; 9176aec45a7Smrg 9186aec45a7Smrg --preserve-dup-deps) 9196aec45a7Smrg opt_duplicate_deps=: ;; 9206aec45a7Smrg 9216aec45a7Smrg --quiet|--silent) preserve_args="$preserve_args $opt" 9226aec45a7Smrg opt_silent=: 9236aec45a7Smrg opt_verbose=false 9246aec45a7Smrg ;; 9256aec45a7Smrg 9266aec45a7Smrg --no-quiet|--no-silent) 9276aec45a7Smrg preserve_args="$preserve_args $opt" 9286aec45a7Smrg opt_silent=false 9296aec45a7Smrg ;; 9306aec45a7Smrg 9316aec45a7Smrg --verbose| -v) preserve_args="$preserve_args $opt" 9326aec45a7Smrg opt_silent=false 9336aec45a7Smrg opt_verbose=: 9346aec45a7Smrg ;; 9356aec45a7Smrg 9366aec45a7Smrg --no-verbose) preserve_args="$preserve_args $opt" 9376aec45a7Smrg opt_verbose=false 9386aec45a7Smrg ;; 9396aec45a7Smrg 9406aec45a7Smrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 9416aec45a7Smrg preserve_args="$preserve_args $opt $1" 9426aec45a7Smrg func_enable_tag "$1" # tagname is set here 9436aec45a7Smrg shift 9446aec45a7Smrg ;; 9456aec45a7Smrg 9466aec45a7Smrg # Separate optargs to long options: 9476aec45a7Smrg -dlopen=*|--mode=*|--tag=*) 9486aec45a7Smrg func_opt_split "$opt" 9496aec45a7Smrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 9506aec45a7Smrg shift 9516aec45a7Smrg ;; 9526aec45a7Smrg 9536aec45a7Smrg -\?|-h) func_usage ;; 9546aec45a7Smrg --help) opt_help=: ;; 9556aec45a7Smrg --help-all) opt_help=': help-all' ;; 9566aec45a7Smrg --version) func_version ;; 9576aec45a7Smrg 9586aec45a7Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 9596aec45a7Smrg 9606aec45a7Smrg *) nonopt="$opt" 9616aec45a7Smrg break 9626aec45a7Smrg ;; 9636aec45a7Smrg esac 9646aec45a7Smrg done 9656aec45a7Smrg 9666aec45a7Smrg 9676aec45a7Smrg case $host in 9686aec45a7Smrg *cygwin* | *mingw* | *pw32* | *cegcc*) 9696aec45a7Smrg # don't eliminate duplications in $postdeps and $predeps 9706aec45a7Smrg opt_duplicate_compiler_generated_deps=: 9715c42550eSmrg ;; 9725c42550eSmrg *) 9736aec45a7Smrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 9746aec45a7Smrg ;; 9756aec45a7Smrg esac 9761473d951Smrg 9776aec45a7Smrg # Having warned about all mis-specified options, bail out if 9786aec45a7Smrg # anything was wrong. 9796aec45a7Smrg $exit_cmd $EXIT_FAILURE 9806aec45a7Smrg} 9816aec45a7Smrg 9826aec45a7Smrg# func_check_version_match 9836aec45a7Smrg# Ensure that we are using m4 macros, and libtool script from the same 9846aec45a7Smrg# release of libtool. 9856aec45a7Smrgfunc_check_version_match () 9866aec45a7Smrg{ 9876aec45a7Smrg if test "$package_revision" != "$macro_revision"; then 9886aec45a7Smrg if test "$VERSION" != "$macro_version"; then 9896aec45a7Smrg if test -z "$macro_version"; then 9906aec45a7Smrg cat >&2 <<_LT_EOF 9916aec45a7Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9926aec45a7Smrg$progname: definition of this LT_INIT comes from an older release. 9936aec45a7Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9946aec45a7Smrg$progname: and run autoconf again. 9956aec45a7Smrg_LT_EOF 9966aec45a7Smrg else 9976aec45a7Smrg cat >&2 <<_LT_EOF 9986aec45a7Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9996aec45a7Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 10006aec45a7Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 10016aec45a7Smrg$progname: and run autoconf again. 10026aec45a7Smrg_LT_EOF 1003ab47cfaaSmrg fi 10046aec45a7Smrg else 10056aec45a7Smrg cat >&2 <<_LT_EOF 10066aec45a7Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 10076aec45a7Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 10086aec45a7Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 10096aec45a7Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 10106aec45a7Smrg_LT_EOF 10116aec45a7Smrg fi 10126aec45a7Smrg 10136aec45a7Smrg exit $EXIT_MISMATCH 10146aec45a7Smrg fi 10156aec45a7Smrg} 10166aec45a7Smrg 10176aec45a7Smrg 10186aec45a7Smrg## ----------- ## 10196aec45a7Smrg## Main. ## 10206aec45a7Smrg## ----------- ## 10216aec45a7Smrg 10226aec45a7Smrg$opt_help || { 10236aec45a7Smrg # Sanity checks first: 10246aec45a7Smrg func_check_version_match 10256aec45a7Smrg 10266aec45a7Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 10276aec45a7Smrg func_fatal_configuration "not configured to build any kind of library" 1028ab47cfaaSmrg fi 1029ab47cfaaSmrg 10306aec45a7Smrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 10316aec45a7Smrg 10326aec45a7Smrg 10336aec45a7Smrg # Darwin sucks 10346aec45a7Smrg eval std_shrext=\"$shrext_cmds\" 10356aec45a7Smrg 10366aec45a7Smrg 1037ab47cfaaSmrg # Only execute mode is allowed to have -dlopen flags. 1038ab47cfaaSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 10396aec45a7Smrg func_error "unrecognized option \`-dlopen'" 10406aec45a7Smrg $ECHO "$help" 1>&2 1041ab47cfaaSmrg exit $EXIT_FAILURE 1042ab47cfaaSmrg fi 1043ab47cfaaSmrg 1044ab47cfaaSmrg # Change the help message to a mode-specific one. 1045ab47cfaaSmrg generic_help="$help" 10466aec45a7Smrg help="Try \`$progname --help --mode=$mode' for more information." 10476aec45a7Smrg} 1048ab47cfaaSmrg 1049ab47cfaaSmrg 10506aec45a7Smrg# func_lalib_p file 10516aec45a7Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 10526aec45a7Smrg# This function is only a basic sanity check; it will hardly flush out 10536aec45a7Smrg# determined imposters. 10546aec45a7Smrgfunc_lalib_p () 10556aec45a7Smrg{ 10566aec45a7Smrg test -f "$1" && 10576aec45a7Smrg $SED -e 4q "$1" 2>/dev/null \ 10586aec45a7Smrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 10596aec45a7Smrg} 1060ab47cfaaSmrg 10616aec45a7Smrg# func_lalib_unsafe_p file 10626aec45a7Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 10636aec45a7Smrg# This function implements the same check as func_lalib_p without 10646aec45a7Smrg# resorting to external programs. To this end, it redirects stdin and 10656aec45a7Smrg# closes it afterwards, without saving the original file descriptor. 10666aec45a7Smrg# As a safety measure, use it only where a negative result would be 10676aec45a7Smrg# fatal anyway. Works if `file' does not exist. 10686aec45a7Smrgfunc_lalib_unsafe_p () 10696aec45a7Smrg{ 10706aec45a7Smrg lalib_p=no 10716aec45a7Smrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 10726aec45a7Smrg for lalib_p_l in 1 2 3 4 10736aec45a7Smrg do 10746aec45a7Smrg read lalib_p_line 10756aec45a7Smrg case "$lalib_p_line" in 10766aec45a7Smrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 10776aec45a7Smrg esac 10786aec45a7Smrg done 10796aec45a7Smrg exec 0<&5 5<&- 10806aec45a7Smrg fi 10816aec45a7Smrg test "$lalib_p" = yes 10826aec45a7Smrg} 1083ab47cfaaSmrg 10846aec45a7Smrg# func_ltwrapper_script_p file 10856aec45a7Smrg# True iff FILE is a libtool wrapper script 10866aec45a7Smrg# This function is only a basic sanity check; it will hardly flush out 10876aec45a7Smrg# determined imposters. 10886aec45a7Smrgfunc_ltwrapper_script_p () 10896aec45a7Smrg{ 10906aec45a7Smrg func_lalib_p "$1" 10916aec45a7Smrg} 1092ab47cfaaSmrg 10936aec45a7Smrg# func_ltwrapper_executable_p file 10946aec45a7Smrg# True iff FILE is a libtool wrapper executable 10956aec45a7Smrg# This function is only a basic sanity check; it will hardly flush out 10966aec45a7Smrg# determined imposters. 10976aec45a7Smrgfunc_ltwrapper_executable_p () 10986aec45a7Smrg{ 10996aec45a7Smrg func_ltwrapper_exec_suffix= 11006aec45a7Smrg case $1 in 11016aec45a7Smrg *.exe) ;; 11026aec45a7Smrg *) func_ltwrapper_exec_suffix=.exe ;; 11036aec45a7Smrg esac 11046aec45a7Smrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 11056aec45a7Smrg} 11066aec45a7Smrg 11076aec45a7Smrg# func_ltwrapper_scriptname file 11086aec45a7Smrg# Assumes file is an ltwrapper_executable 11096aec45a7Smrg# uses $file to determine the appropriate filename for a 11106aec45a7Smrg# temporary ltwrapper_script. 11116aec45a7Smrgfunc_ltwrapper_scriptname () 11126aec45a7Smrg{ 11136aec45a7Smrg func_ltwrapper_scriptname_result="" 11146aec45a7Smrg if func_ltwrapper_executable_p "$1"; then 11156aec45a7Smrg func_dirname_and_basename "$1" "" "." 11166aec45a7Smrg func_stripname '' '.exe' "$func_basename_result" 11176aec45a7Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 11186aec45a7Smrg fi 11196aec45a7Smrg} 11206aec45a7Smrg 11216aec45a7Smrg# func_ltwrapper_p file 11226aec45a7Smrg# True iff FILE is a libtool wrapper script or wrapper executable 11236aec45a7Smrg# This function is only a basic sanity check; it will hardly flush out 11246aec45a7Smrg# determined imposters. 11256aec45a7Smrgfunc_ltwrapper_p () 11266aec45a7Smrg{ 11276aec45a7Smrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 11286aec45a7Smrg} 11296aec45a7Smrg 11306aec45a7Smrg 11316aec45a7Smrg# func_execute_cmds commands fail_cmd 11326aec45a7Smrg# Execute tilde-delimited COMMANDS. 11336aec45a7Smrg# If FAIL_CMD is given, eval that upon failure. 11346aec45a7Smrg# FAIL_CMD may read-access the current command in variable CMD! 11356aec45a7Smrgfunc_execute_cmds () 11366aec45a7Smrg{ 11376aec45a7Smrg $opt_debug 11386aec45a7Smrg save_ifs=$IFS; IFS='~' 11396aec45a7Smrg for cmd in $1; do 11406aec45a7Smrg IFS=$save_ifs 11416aec45a7Smrg eval cmd=\"$cmd\" 11426aec45a7Smrg func_show_eval "$cmd" "${2-:}" 11436aec45a7Smrg done 11446aec45a7Smrg IFS=$save_ifs 11456aec45a7Smrg} 11466aec45a7Smrg 11476aec45a7Smrg 11486aec45a7Smrg# func_source file 11496aec45a7Smrg# Source FILE, adding directory component if necessary. 11506aec45a7Smrg# Note that it is not necessary on cygwin/mingw to append a dot to 11516aec45a7Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 11526aec45a7Smrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 11536aec45a7Smrg# `FILE.' does not work on cygwin managed mounts. 11546aec45a7Smrgfunc_source () 11556aec45a7Smrg{ 11566aec45a7Smrg $opt_debug 11576aec45a7Smrg case $1 in 11586aec45a7Smrg */* | *\\*) . "$1" ;; 11596aec45a7Smrg *) . "./$1" ;; 11606aec45a7Smrg esac 11616aec45a7Smrg} 11626aec45a7Smrg 11636aec45a7Smrg 11646aec45a7Smrg# func_infer_tag arg 11656aec45a7Smrg# Infer tagged configuration to use if any are available and 11666aec45a7Smrg# if one wasn't chosen via the "--tag" command line option. 11676aec45a7Smrg# Only attempt this if the compiler in the base compile 11686aec45a7Smrg# command doesn't match the default compiler. 11696aec45a7Smrg# arg is usually of the form 'gcc ...' 11706aec45a7Smrgfunc_infer_tag () 11716aec45a7Smrg{ 11726aec45a7Smrg $opt_debug 11736aec45a7Smrg if test -n "$available_tags" && test -z "$tagname"; then 11746aec45a7Smrg CC_quoted= 11756aec45a7Smrg for arg in $CC; do 11766aec45a7Smrg func_quote_for_eval "$arg" 11776aec45a7Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 11786aec45a7Smrg done 11796aec45a7Smrg CC_expanded=`func_echo_all $CC` 11806aec45a7Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 11816aec45a7Smrg case $@ in 11826aec45a7Smrg # Blanks in the command may have been stripped by the calling shell, 11836aec45a7Smrg # but not from the CC environment variable when configure was run. 11846aec45a7Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 11856aec45a7Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 11866aec45a7Smrg # Blanks at the start of $base_compile will cause this to fail 11876aec45a7Smrg # if we don't check for them as well. 11886aec45a7Smrg *) 11896aec45a7Smrg for z in $available_tags; do 11906aec45a7Smrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 11916aec45a7Smrg # Evaluate the configuration. 11926aec45a7Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 11936aec45a7Smrg CC_quoted= 11946aec45a7Smrg for arg in $CC; do 11956aec45a7Smrg # Double-quote args containing other shell metacharacters. 11966aec45a7Smrg func_quote_for_eval "$arg" 11976aec45a7Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 11986aec45a7Smrg done 11996aec45a7Smrg CC_expanded=`func_echo_all $CC` 12006aec45a7Smrg CC_quoted_expanded=`func_echo_all $CC_quoted` 12016aec45a7Smrg case "$@ " in 12026aec45a7Smrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 12036aec45a7Smrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 12046aec45a7Smrg # The compiler in the base compile command matches 12056aec45a7Smrg # the one in the tagged configuration. 12066aec45a7Smrg # Assume this is the tagged configuration we want. 12076aec45a7Smrg tagname=$z 12086aec45a7Smrg break 12096aec45a7Smrg ;; 12106aec45a7Smrg esac 12116aec45a7Smrg fi 12126aec45a7Smrg done 12136aec45a7Smrg # If $tagname still isn't set, then no tagged configuration 12146aec45a7Smrg # was found and let the user know that the "--tag" command 12156aec45a7Smrg # line option must be used. 12166aec45a7Smrg if test -z "$tagname"; then 12176aec45a7Smrg func_echo "unable to infer tagged configuration" 12186aec45a7Smrg func_fatal_error "specify a tag with \`--tag'" 12196aec45a7Smrg# else 12206aec45a7Smrg# func_verbose "using $tagname tagged configuration" 12216aec45a7Smrg fi 12226aec45a7Smrg ;; 12236aec45a7Smrg esac 12246aec45a7Smrg fi 12256aec45a7Smrg} 12266aec45a7Smrg 12276aec45a7Smrg 12286aec45a7Smrg 12296aec45a7Smrg# func_write_libtool_object output_name pic_name nonpic_name 12306aec45a7Smrg# Create a libtool object file (analogous to a ".la" file), 12316aec45a7Smrg# but don't create it if we're doing a dry run. 12326aec45a7Smrgfunc_write_libtool_object () 12336aec45a7Smrg{ 12346aec45a7Smrg write_libobj=${1} 12356aec45a7Smrg if test "$build_libtool_libs" = yes; then 12366aec45a7Smrg write_lobj=\'${2}\' 12376aec45a7Smrg else 12386aec45a7Smrg write_lobj=none 12396aec45a7Smrg fi 12406aec45a7Smrg 12416aec45a7Smrg if test "$build_old_libs" = yes; then 12426aec45a7Smrg write_oldobj=\'${3}\' 12436aec45a7Smrg else 12446aec45a7Smrg write_oldobj=none 12456aec45a7Smrg fi 12466aec45a7Smrg 12476aec45a7Smrg $opt_dry_run || { 12486aec45a7Smrg cat >${write_libobj}T <<EOF 12496aec45a7Smrg# $write_libobj - a libtool object file 12506aec45a7Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 12516aec45a7Smrg# 12526aec45a7Smrg# Please DO NOT delete this file! 12536aec45a7Smrg# It is necessary for linking the library. 12546aec45a7Smrg 12556aec45a7Smrg# Name of the PIC object. 12566aec45a7Smrgpic_object=$write_lobj 12576aec45a7Smrg 12586aec45a7Smrg# Name of the non-PIC object 12596aec45a7Smrgnon_pic_object=$write_oldobj 12606aec45a7Smrg 12616aec45a7SmrgEOF 12626aec45a7Smrg $MV "${write_libobj}T" "${write_libobj}" 12636aec45a7Smrg } 12646aec45a7Smrg} 12656aec45a7Smrg 12666aec45a7Smrg# func_mode_compile arg... 12676aec45a7Smrgfunc_mode_compile () 12686aec45a7Smrg{ 12696aec45a7Smrg $opt_debug 12706aec45a7Smrg # Get the compilation command and the source file. 12716aec45a7Smrg base_compile= 12726aec45a7Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 12736aec45a7Smrg suppress_opt=yes 12746aec45a7Smrg suppress_output= 12756aec45a7Smrg arg_mode=normal 12766aec45a7Smrg libobj= 12776aec45a7Smrg later= 12786aec45a7Smrg pie_flag= 12796aec45a7Smrg 12806aec45a7Smrg for arg 12816aec45a7Smrg do 12826aec45a7Smrg case $arg_mode in 12836aec45a7Smrg arg ) 12846aec45a7Smrg # do not "continue". Instead, add this to base_compile 12856aec45a7Smrg lastarg="$arg" 12866aec45a7Smrg arg_mode=normal 12876aec45a7Smrg ;; 12886aec45a7Smrg 12896aec45a7Smrg target ) 12906aec45a7Smrg libobj="$arg" 12916aec45a7Smrg arg_mode=normal 12926aec45a7Smrg continue 12936aec45a7Smrg ;; 12946aec45a7Smrg 12956aec45a7Smrg normal ) 12966aec45a7Smrg # Accept any command-line options. 12976aec45a7Smrg case $arg in 12986aec45a7Smrg -o) 12996aec45a7Smrg test -n "$libobj" && \ 13006aec45a7Smrg func_fatal_error "you cannot specify \`-o' more than once" 13016aec45a7Smrg arg_mode=target 13026aec45a7Smrg continue 13036aec45a7Smrg ;; 13046aec45a7Smrg 13056aec45a7Smrg -pie | -fpie | -fPIE) 13066aec45a7Smrg pie_flag="$pie_flag $arg" 13076aec45a7Smrg continue 13086aec45a7Smrg ;; 13096aec45a7Smrg 13106aec45a7Smrg -shared | -static | -prefer-pic | -prefer-non-pic) 13116aec45a7Smrg later="$later $arg" 13126aec45a7Smrg continue 13136aec45a7Smrg ;; 13141473d951Smrg 13151473d951Smrg -no-suppress) 1316ab47cfaaSmrg suppress_opt=no 1317ab47cfaaSmrg continue 1318ab47cfaaSmrg ;; 1319ab47cfaaSmrg 1320ab47cfaaSmrg -Xcompiler) 1321ab47cfaaSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 1322ab47cfaaSmrg continue # The current "srcfile" will either be retained or 1323ab47cfaaSmrg ;; # replaced later. I would guess that would be a bug. 1324ab47cfaaSmrg 1325ab47cfaaSmrg -Wc,*) 13266aec45a7Smrg func_stripname '-Wc,' '' "$arg" 13276aec45a7Smrg args=$func_stripname_result 1328ab47cfaaSmrg lastarg= 1329ab47cfaaSmrg save_ifs="$IFS"; IFS=',' 13306aec45a7Smrg for arg in $args; do 1331ab47cfaaSmrg IFS="$save_ifs" 13326aec45a7Smrg func_quote_for_eval "$arg" 13336aec45a7Smrg lastarg="$lastarg $func_quote_for_eval_result" 1334ab47cfaaSmrg done 1335ab47cfaaSmrg IFS="$save_ifs" 13366aec45a7Smrg func_stripname ' ' '' "$lastarg" 13376aec45a7Smrg lastarg=$func_stripname_result 1338ab47cfaaSmrg 1339ab47cfaaSmrg # Add the arguments to base_compile. 1340ab47cfaaSmrg base_compile="$base_compile $lastarg" 1341ab47cfaaSmrg continue 1342ab47cfaaSmrg ;; 1343ab47cfaaSmrg 13446aec45a7Smrg *) 1345ab47cfaaSmrg # Accept the current argument as the source file. 1346ab47cfaaSmrg # The previous "srcfile" becomes the current argument. 1347ab47cfaaSmrg # 1348ab47cfaaSmrg lastarg="$srcfile" 1349ab47cfaaSmrg srcfile="$arg" 1350ab47cfaaSmrg ;; 1351ab47cfaaSmrg esac # case $arg 1352ab47cfaaSmrg ;; 1353ab47cfaaSmrg esac # case $arg_mode 1354ab47cfaaSmrg 1355ab47cfaaSmrg # Aesthetically quote the previous argument. 13566aec45a7Smrg func_quote_for_eval "$lastarg" 13576aec45a7Smrg base_compile="$base_compile $func_quote_for_eval_result" 1358ab47cfaaSmrg done # for arg 1359ab47cfaaSmrg 1360ab47cfaaSmrg case $arg_mode in 1361ab47cfaaSmrg arg) 13626aec45a7Smrg func_fatal_error "you must specify an argument for -Xcompile" 1363ab47cfaaSmrg ;; 1364ab47cfaaSmrg target) 13656aec45a7Smrg func_fatal_error "you must specify a target with \`-o'" 1366ab47cfaaSmrg ;; 1367ab47cfaaSmrg *) 1368ab47cfaaSmrg # Get the name of the library object. 13696aec45a7Smrg test -z "$libobj" && { 13706aec45a7Smrg func_basename "$srcfile" 13716aec45a7Smrg libobj="$func_basename_result" 13726aec45a7Smrg } 1373ab47cfaaSmrg ;; 1374ab47cfaaSmrg esac 1375ab47cfaaSmrg 1376ab47cfaaSmrg # Recognize several different file suffixes. 1377ab47cfaaSmrg # If the user specifies -o file.o, it is replaced with file.lo 1378ab47cfaaSmrg case $libobj in 13796aec45a7Smrg *.[cCFSifmso] | \ 13806aec45a7Smrg *.ada | *.adb | *.ads | *.asm | \ 13816aec45a7Smrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 13826aec45a7Smrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 13836aec45a7Smrg func_xform "$libobj" 13846aec45a7Smrg libobj=$func_xform_result 13856aec45a7Smrg ;; 1386ab47cfaaSmrg esac 1387ab47cfaaSmrg 1388ab47cfaaSmrg case $libobj in 13896aec45a7Smrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1390ab47cfaaSmrg *) 13916aec45a7Smrg func_fatal_error "cannot determine name of library object from \`$libobj'" 1392ab47cfaaSmrg ;; 1393ab47cfaaSmrg esac 1394ab47cfaaSmrg 1395ab47cfaaSmrg func_infer_tag $base_compile 1396ab47cfaaSmrg 1397ab47cfaaSmrg for arg in $later; do 1398ab47cfaaSmrg case $arg in 13996aec45a7Smrg -shared) 14006aec45a7Smrg test "$build_libtool_libs" != yes && \ 14016aec45a7Smrg func_fatal_configuration "can not build a shared library" 14026aec45a7Smrg build_old_libs=no 14036aec45a7Smrg continue 14046aec45a7Smrg ;; 14056aec45a7Smrg 1406ab47cfaaSmrg -static) 14076aec45a7Smrg build_libtool_libs=no 1408ab47cfaaSmrg build_old_libs=yes 1409ab47cfaaSmrg continue 1410ab47cfaaSmrg ;; 1411ab47cfaaSmrg 1412ab47cfaaSmrg -prefer-pic) 1413ab47cfaaSmrg pic_mode=yes 1414ab47cfaaSmrg continue 1415ab47cfaaSmrg ;; 1416ab47cfaaSmrg 1417ab47cfaaSmrg -prefer-non-pic) 1418ab47cfaaSmrg pic_mode=no 1419ab47cfaaSmrg continue 1420ab47cfaaSmrg ;; 1421ab47cfaaSmrg esac 1422ab47cfaaSmrg done 1423ab47cfaaSmrg 14246aec45a7Smrg func_quote_for_eval "$libobj" 14256aec45a7Smrg test "X$libobj" != "X$func_quote_for_eval_result" \ 14266aec45a7Smrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 14276aec45a7Smrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 14286aec45a7Smrg func_dirname_and_basename "$obj" "/" "" 14296aec45a7Smrg objname="$func_basename_result" 14306aec45a7Smrg xdir="$func_dirname_result" 1431ab47cfaaSmrg lobj=${xdir}$objdir/$objname 1432ab47cfaaSmrg 14336aec45a7Smrg test -z "$base_compile" && \ 14346aec45a7Smrg func_fatal_help "you must specify a compilation command" 1435ab47cfaaSmrg 1436ab47cfaaSmrg # Delete any leftover library objects. 1437ab47cfaaSmrg if test "$build_old_libs" = yes; then 1438ab47cfaaSmrg removelist="$obj $lobj $libobj ${libobj}T" 1439ab47cfaaSmrg else 1440ab47cfaaSmrg removelist="$lobj $libobj ${libobj}T" 1441ab47cfaaSmrg fi 1442ab47cfaaSmrg 1443ab47cfaaSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 1444ab47cfaaSmrg case $host_os in 14456aec45a7Smrg cygwin* | mingw* | pw32* | os2* | cegcc*) 1446ab47cfaaSmrg pic_mode=default 1447ab47cfaaSmrg ;; 1448ab47cfaaSmrg esac 1449ab47cfaaSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1450ab47cfaaSmrg # non-PIC code in shared libraries is not supported 1451ab47cfaaSmrg pic_mode=default 1452ab47cfaaSmrg fi 1453ab47cfaaSmrg 1454ab47cfaaSmrg # Calculate the filename of the output object if compiler does 1455ab47cfaaSmrg # not support -o with -c 1456ab47cfaaSmrg if test "$compiler_c_o" = no; then 14576aec45a7Smrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 1458ab47cfaaSmrg lockfile="$output_obj.lock" 1459ab47cfaaSmrg else 1460ab47cfaaSmrg output_obj= 1461ab47cfaaSmrg need_locks=no 1462ab47cfaaSmrg lockfile= 1463ab47cfaaSmrg fi 1464ab47cfaaSmrg 1465ab47cfaaSmrg # Lock this critical section if it is needed 1466ab47cfaaSmrg # We use this script file to make the link, it avoids creating a new file 1467ab47cfaaSmrg if test "$need_locks" = yes; then 14686aec45a7Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 14696aec45a7Smrg func_echo "Waiting for $lockfile to be removed" 1470ab47cfaaSmrg sleep 2 1471ab47cfaaSmrg done 1472ab47cfaaSmrg elif test "$need_locks" = warn; then 1473ab47cfaaSmrg if test -f "$lockfile"; then 14746aec45a7Smrg $ECHO "\ 1475ab47cfaaSmrg*** ERROR, $lockfile exists and contains: 1476ab47cfaaSmrg`cat $lockfile 2>/dev/null` 1477ab47cfaaSmrg 1478ab47cfaaSmrgThis indicates that another process is trying to use the same 1479ab47cfaaSmrgtemporary object file, and libtool could not work around it because 1480ab47cfaaSmrgyour compiler does not support \`-c' and \`-o' together. If you 1481ab47cfaaSmrgrepeat this compilation, it may succeed, by chance, but you had better 1482ab47cfaaSmrgavoid parallel builds (make -j) in this platform, or get a better 1483ab47cfaaSmrgcompiler." 1484ab47cfaaSmrg 14856aec45a7Smrg $opt_dry_run || $RM $removelist 1486ab47cfaaSmrg exit $EXIT_FAILURE 1487ab47cfaaSmrg fi 14886aec45a7Smrg removelist="$removelist $output_obj" 14896aec45a7Smrg $ECHO "$srcfile" > "$lockfile" 1490ab47cfaaSmrg fi 1491ab47cfaaSmrg 14926aec45a7Smrg $opt_dry_run || $RM $removelist 14936aec45a7Smrg removelist="$removelist $lockfile" 14946aec45a7Smrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 14956aec45a7Smrg 1496ab47cfaaSmrg if test -n "$fix_srcfile_path"; then 1497ab47cfaaSmrg eval srcfile=\"$fix_srcfile_path\" 1498ab47cfaaSmrg fi 14996aec45a7Smrg func_quote_for_eval "$srcfile" 15006aec45a7Smrg qsrcfile=$func_quote_for_eval_result 1501ab47cfaaSmrg 1502ab47cfaaSmrg # Only build a PIC object if we are building libtool libraries. 1503ab47cfaaSmrg if test "$build_libtool_libs" = yes; then 1504ab47cfaaSmrg # Without this assignment, base_compile gets emptied. 1505ab47cfaaSmrg fbsd_hideous_sh_bug=$base_compile 1506ab47cfaaSmrg 1507ab47cfaaSmrg if test "$pic_mode" != no; then 1508ab47cfaaSmrg command="$base_compile $qsrcfile $pic_flag" 1509ab47cfaaSmrg else 1510ab47cfaaSmrg # Don't build PIC code 1511ab47cfaaSmrg command="$base_compile $qsrcfile" 1512ab47cfaaSmrg fi 1513ab47cfaaSmrg 15146aec45a7Smrg func_mkdir_p "$xdir$objdir" 1515ab47cfaaSmrg 1516ab47cfaaSmrg if test -z "$output_obj"; then 1517ab47cfaaSmrg # Place PIC objects in $objdir 1518ab47cfaaSmrg command="$command -o $lobj" 1519ab47cfaaSmrg fi 1520ab47cfaaSmrg 15216aec45a7Smrg func_show_eval_locale "$command" \ 15226aec45a7Smrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1523ab47cfaaSmrg 1524ab47cfaaSmrg if test "$need_locks" = warn && 1525ab47cfaaSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 15266aec45a7Smrg $ECHO "\ 1527ab47cfaaSmrg*** ERROR, $lockfile contains: 1528ab47cfaaSmrg`cat $lockfile 2>/dev/null` 1529ab47cfaaSmrg 1530ab47cfaaSmrgbut it should contain: 1531ab47cfaaSmrg$srcfile 1532ab47cfaaSmrg 1533ab47cfaaSmrgThis indicates that another process is trying to use the same 1534ab47cfaaSmrgtemporary object file, and libtool could not work around it because 1535ab47cfaaSmrgyour compiler does not support \`-c' and \`-o' together. If you 1536ab47cfaaSmrgrepeat this compilation, it may succeed, by chance, but you had better 1537ab47cfaaSmrgavoid parallel builds (make -j) in this platform, or get a better 1538ab47cfaaSmrgcompiler." 1539ab47cfaaSmrg 15406aec45a7Smrg $opt_dry_run || $RM $removelist 1541ab47cfaaSmrg exit $EXIT_FAILURE 1542ab47cfaaSmrg fi 1543ab47cfaaSmrg 1544ab47cfaaSmrg # Just move the object if needed, then go on to compile the next one 1545ab47cfaaSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 15466aec45a7Smrg func_show_eval '$MV "$output_obj" "$lobj"' \ 15476aec45a7Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1548ab47cfaaSmrg fi 1549ab47cfaaSmrg 1550ab47cfaaSmrg # Allow error messages only from the first compilation. 1551ab47cfaaSmrg if test "$suppress_opt" = yes; then 15526aec45a7Smrg suppress_output=' >/dev/null 2>&1' 1553ab47cfaaSmrg fi 1554ab47cfaaSmrg fi 1555ab47cfaaSmrg 1556ab47cfaaSmrg # Only build a position-dependent object if we build old libraries. 1557ab47cfaaSmrg if test "$build_old_libs" = yes; then 1558ab47cfaaSmrg if test "$pic_mode" != yes; then 1559ab47cfaaSmrg # Don't build PIC code 15606aec45a7Smrg command="$base_compile $qsrcfile$pie_flag" 1561ab47cfaaSmrg else 1562ab47cfaaSmrg command="$base_compile $qsrcfile $pic_flag" 1563ab47cfaaSmrg fi 1564ab47cfaaSmrg if test "$compiler_c_o" = yes; then 1565ab47cfaaSmrg command="$command -o $obj" 1566ab47cfaaSmrg fi 1567ab47cfaaSmrg 1568ab47cfaaSmrg # Suppress compiler output if we already did a PIC compilation. 1569ab47cfaaSmrg command="$command$suppress_output" 15706aec45a7Smrg func_show_eval_locale "$command" \ 15716aec45a7Smrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1572ab47cfaaSmrg 1573ab47cfaaSmrg if test "$need_locks" = warn && 1574ab47cfaaSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 15756aec45a7Smrg $ECHO "\ 1576ab47cfaaSmrg*** ERROR, $lockfile contains: 1577ab47cfaaSmrg`cat $lockfile 2>/dev/null` 1578ab47cfaaSmrg 1579ab47cfaaSmrgbut it should contain: 1580ab47cfaaSmrg$srcfile 1581ab47cfaaSmrg 1582ab47cfaaSmrgThis indicates that another process is trying to use the same 1583ab47cfaaSmrgtemporary object file, and libtool could not work around it because 1584ab47cfaaSmrgyour compiler does not support \`-c' and \`-o' together. If you 1585ab47cfaaSmrgrepeat this compilation, it may succeed, by chance, but you had better 1586ab47cfaaSmrgavoid parallel builds (make -j) in this platform, or get a better 1587ab47cfaaSmrgcompiler." 1588ab47cfaaSmrg 15896aec45a7Smrg $opt_dry_run || $RM $removelist 1590ab47cfaaSmrg exit $EXIT_FAILURE 1591ab47cfaaSmrg fi 1592ab47cfaaSmrg 1593ab47cfaaSmrg # Just move the object if needed 1594ab47cfaaSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 15956aec45a7Smrg func_show_eval '$MV "$output_obj" "$obj"' \ 15966aec45a7Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1597ab47cfaaSmrg fi 1598ab47cfaaSmrg fi 1599ab47cfaaSmrg 16006aec45a7Smrg $opt_dry_run || { 16016aec45a7Smrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1602ab47cfaaSmrg 16036aec45a7Smrg # Unlock the critical section if it was locked 16046aec45a7Smrg if test "$need_locks" != no; then 16056aec45a7Smrg removelist=$lockfile 16066aec45a7Smrg $RM "$lockfile" 16076aec45a7Smrg fi 16086aec45a7Smrg } 1609ab47cfaaSmrg 1610ab47cfaaSmrg exit $EXIT_SUCCESS 16116aec45a7Smrg} 1612ab47cfaaSmrg 16136aec45a7Smrg$opt_help || { 16146aec45a7Smrg test "$mode" = compile && func_mode_compile ${1+"$@"} 16156aec45a7Smrg} 1616ab47cfaaSmrg 16176aec45a7Smrgfunc_mode_help () 16186aec45a7Smrg{ 16196aec45a7Smrg # We need to display help for each of the modes. 16206aec45a7Smrg case $mode in 16216aec45a7Smrg "") 16226aec45a7Smrg # Generic help is extracted from the usage comments 16236aec45a7Smrg # at the start of this file. 16246aec45a7Smrg func_help 16256aec45a7Smrg ;; 1626ab47cfaaSmrg 16276aec45a7Smrg clean) 16286aec45a7Smrg $ECHO \ 16296aec45a7Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1630ab47cfaaSmrg 16316aec45a7SmrgRemove files from the build directory. 1632ab47cfaaSmrg 16336aec45a7SmrgRM is the name of the program to use to delete files associated with each FILE 16346aec45a7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 16356aec45a7Smrgto RM. 1636ab47cfaaSmrg 16376aec45a7SmrgIf FILE is a libtool library, object or program, all the files associated 16386aec45a7Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 16396aec45a7Smrg ;; 1640ab47cfaaSmrg 16416aec45a7Smrg compile) 16426aec45a7Smrg $ECHO \ 16436aec45a7Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1644ab47cfaaSmrg 16456aec45a7SmrgCompile a source file into a libtool library object. 1646ab47cfaaSmrg 16476aec45a7SmrgThis mode accepts the following additional options: 1648ab47cfaaSmrg 16496aec45a7Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 16506aec45a7Smrg -no-suppress do not suppress compiler output for multiple passes 16516aec45a7Smrg -prefer-pic try to build PIC objects only 16526aec45a7Smrg -prefer-non-pic try to build non-PIC objects only 16536aec45a7Smrg -shared do not build a \`.o' file suitable for static linking 16546aec45a7Smrg -static only build a \`.o' file suitable for static linking 16556aec45a7Smrg -Wc,FLAG pass FLAG directly to the compiler 1656ab47cfaaSmrg 16576aec45a7SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 16586aec45a7Smrgfrom the given SOURCEFILE. 1659ab47cfaaSmrg 16606aec45a7SmrgThe output file name is determined by removing the directory component from 16616aec45a7SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 16626aec45a7Smrglibrary object suffix, \`.lo'." 16636aec45a7Smrg ;; 1664ab47cfaaSmrg 16656aec45a7Smrg execute) 16666aec45a7Smrg $ECHO \ 16676aec45a7Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1668ab47cfaaSmrg 16696aec45a7SmrgAutomatically set library path, then run a program. 1670ab47cfaaSmrg 16716aec45a7SmrgThis mode accepts the following additional options: 1672ab47cfaaSmrg 16736aec45a7Smrg -dlopen FILE add the directory containing FILE to the library path 1674ab47cfaaSmrg 16756aec45a7SmrgThis mode sets the library path environment variable according to \`-dlopen' 16766aec45a7Smrgflags. 1677ab47cfaaSmrg 16786aec45a7SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 16796aec45a7Smrginto their corresponding uninstalled binary, and any of their required library 16806aec45a7Smrgdirectories are added to the library path. 1681ab47cfaaSmrg 16826aec45a7SmrgThen, COMMAND is executed, with ARGS as arguments." 16836aec45a7Smrg ;; 1684ab47cfaaSmrg 16856aec45a7Smrg finish) 16866aec45a7Smrg $ECHO \ 16876aec45a7Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1688ab47cfaaSmrg 16896aec45a7SmrgComplete the installation of libtool libraries. 1690ab47cfaaSmrg 16916aec45a7SmrgEach LIBDIR is a directory that contains libtool libraries. 1692ab47cfaaSmrg 16936aec45a7SmrgThe commands that this mode executes may require superuser privileges. Use 16946aec45a7Smrgthe \`--dry-run' option if you just want to see what would be executed." 16956aec45a7Smrg ;; 1696ab47cfaaSmrg 16976aec45a7Smrg install) 16986aec45a7Smrg $ECHO \ 16996aec45a7Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1700ab47cfaaSmrg 17016aec45a7SmrgInstall executables or libraries. 1702ab47cfaaSmrg 17036aec45a7SmrgINSTALL-COMMAND is the installation command. The first component should be 17046aec45a7Smrgeither the \`install' or \`cp' program. 1705ab47cfaaSmrg 17066aec45a7SmrgThe following components of INSTALL-COMMAND are treated specially: 1707ab47cfaaSmrg 17086aec45a7Smrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1709ab47cfaaSmrg 17106aec45a7SmrgThe rest of the components are interpreted as arguments to that command (only 17116aec45a7SmrgBSD-compatible install options are recognized)." 17126aec45a7Smrg ;; 1713ab47cfaaSmrg 17146aec45a7Smrg link) 17156aec45a7Smrg $ECHO \ 17166aec45a7Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1717ab47cfaaSmrg 17186aec45a7SmrgLink object files or libraries together to form another library, or to 17196aec45a7Smrgcreate an executable program. 1720ab47cfaaSmrg 17216aec45a7SmrgLINK-COMMAND is a command using the C compiler that you would use to create 17226aec45a7Smrga program from several object files. 1723ab47cfaaSmrg 17246aec45a7SmrgThe following components of LINK-COMMAND are treated specially: 1725ab47cfaaSmrg 17266aec45a7Smrg -all-static do not do any dynamic linking at all 17276aec45a7Smrg -avoid-version do not add a version suffix if possible 17286aec45a7Smrg -bindir BINDIR specify path to binaries directory (for systems where 17296aec45a7Smrg libraries must be found in the PATH setting at runtime) 17306aec45a7Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 17316aec45a7Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 17326aec45a7Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 17336aec45a7Smrg -export-symbols SYMFILE 17346aec45a7Smrg try to export only the symbols listed in SYMFILE 17356aec45a7Smrg -export-symbols-regex REGEX 17366aec45a7Smrg try to export only the symbols matching REGEX 17376aec45a7Smrg -LLIBDIR search LIBDIR for required installed libraries 17386aec45a7Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 17396aec45a7Smrg -module build a library that can dlopened 17406aec45a7Smrg -no-fast-install disable the fast-install mode 17416aec45a7Smrg -no-install link a not-installable executable 17426aec45a7Smrg -no-undefined declare that a library does not refer to external symbols 17436aec45a7Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 17446aec45a7Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 17456aec45a7Smrg -precious-files-regex REGEX 17466aec45a7Smrg don't remove output files matching REGEX 17476aec45a7Smrg -release RELEASE specify package release information 17486aec45a7Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 17496aec45a7Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 17506aec45a7Smrg -shared only do dynamic linking of libtool libraries 17516aec45a7Smrg -shrext SUFFIX override the standard shared library file extension 17526aec45a7Smrg -static do not do any dynamic linking of uninstalled libtool libraries 17536aec45a7Smrg -static-libtool-libs 17546aec45a7Smrg do not do any dynamic linking of libtool libraries 17556aec45a7Smrg -version-info CURRENT[:REVISION[:AGE]] 17566aec45a7Smrg specify library version info [each variable defaults to 0] 17576aec45a7Smrg -weak LIBNAME declare that the target provides the LIBNAME interface 17586aec45a7Smrg -Wc,FLAG 17596aec45a7Smrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 17606aec45a7Smrg -Wl,FLAG 17616aec45a7Smrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 17626aec45a7Smrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 1763ab47cfaaSmrg 17646aec45a7SmrgAll other options (arguments beginning with \`-') are ignored. 1765ab47cfaaSmrg 17666aec45a7SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 17676aec45a7Smrgtreated as uninstalled libtool libraries, other files are standard or library 17686aec45a7Smrgobject files. 1769ab47cfaaSmrg 17706aec45a7SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 17716aec45a7Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 17726aec45a7Smrgrequired, except when creating a convenience library. 1773ab47cfaaSmrg 17746aec45a7SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 17756aec45a7Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 1776ab47cfaaSmrg 17776aec45a7SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 17786aec45a7Smrgis created, otherwise an executable program is created." 17796aec45a7Smrg ;; 1780ab47cfaaSmrg 17816aec45a7Smrg uninstall) 17826aec45a7Smrg $ECHO \ 17836aec45a7Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1784ab47cfaaSmrg 17856aec45a7SmrgRemove libraries from an installation directory. 1786ab47cfaaSmrg 17876aec45a7SmrgRM is the name of the program to use to delete files associated with each FILE 17886aec45a7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 17896aec45a7Smrgto RM. 1790ab47cfaaSmrg 17916aec45a7SmrgIf FILE is a libtool library, all the files associated with it are deleted. 17926aec45a7SmrgOtherwise, only FILE itself is deleted using RM." 17936aec45a7Smrg ;; 1794ab47cfaaSmrg 17956aec45a7Smrg *) 17966aec45a7Smrg func_fatal_help "invalid operation mode \`$mode'" 17976aec45a7Smrg ;; 17986aec45a7Smrg esac 1799ab47cfaaSmrg 18006aec45a7Smrg echo 18016aec45a7Smrg $ECHO "Try \`$progname --help' for more information about other modes." 18026aec45a7Smrg} 18031473d951Smrg 18046aec45a7Smrg# Now that we've collected a possible --mode arg, show help if necessary 18056aec45a7Smrgif $opt_help; then 18066aec45a7Smrg if test "$opt_help" = :; then 18076aec45a7Smrg func_mode_help 18086aec45a7Smrg else 18096aec45a7Smrg { 18106aec45a7Smrg func_help noexit 18116aec45a7Smrg for mode in compile link execute install finish uninstall clean; do 18126aec45a7Smrg func_mode_help 18136aec45a7Smrg done 18146aec45a7Smrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 18156aec45a7Smrg { 18166aec45a7Smrg func_help noexit 18176aec45a7Smrg for mode in compile link execute install finish uninstall clean; do 18186aec45a7Smrg echo 18196aec45a7Smrg func_mode_help 18206aec45a7Smrg done 18216aec45a7Smrg } | 18226aec45a7Smrg sed '1d 18236aec45a7Smrg /^When reporting/,/^Report/{ 18246aec45a7Smrg H 18256aec45a7Smrg d 18266aec45a7Smrg } 18276aec45a7Smrg $x 18286aec45a7Smrg /information about other modes/d 18296aec45a7Smrg /more detailed .*MODE/d 18306aec45a7Smrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 18316aec45a7Smrg fi 18326aec45a7Smrg exit $? 18336aec45a7Smrgfi 18341473d951Smrg 18351473d951Smrg 18366aec45a7Smrg# func_mode_execute arg... 18376aec45a7Smrgfunc_mode_execute () 18386aec45a7Smrg{ 18396aec45a7Smrg $opt_debug 18406aec45a7Smrg # The first argument is the command name. 18416aec45a7Smrg cmd="$nonopt" 18426aec45a7Smrg test -z "$cmd" && \ 18436aec45a7Smrg func_fatal_help "you must specify a COMMAND" 18441473d951Smrg 18456aec45a7Smrg # Handle -dlopen flags immediately. 18466aec45a7Smrg for file in $execute_dlfiles; do 18476aec45a7Smrg test -f "$file" \ 18486aec45a7Smrg || func_fatal_help "\`$file' is not a file" 18491473d951Smrg 18506aec45a7Smrg dir= 18516aec45a7Smrg case $file in 18526aec45a7Smrg *.la) 18536aec45a7Smrg # Check to see that this really is a libtool archive. 18546aec45a7Smrg func_lalib_unsafe_p "$file" \ 18556aec45a7Smrg || func_fatal_help "\`$lib' is not a valid libtool archive" 18561473d951Smrg 18576aec45a7Smrg # Read the libtool library. 18586aec45a7Smrg dlname= 18596aec45a7Smrg library_names= 18606aec45a7Smrg func_source "$file" 18611473d951Smrg 18626aec45a7Smrg # Skip this library if it cannot be dlopened. 18636aec45a7Smrg if test -z "$dlname"; then 18646aec45a7Smrg # Warn if it was a shared library. 18656aec45a7Smrg test -n "$library_names" && \ 18666aec45a7Smrg func_warning "\`$file' was not linked with \`-export-dynamic'" 18676aec45a7Smrg continue 18686aec45a7Smrg fi 18695c42550eSmrg 18706aec45a7Smrg func_dirname "$file" "" "." 18716aec45a7Smrg dir="$func_dirname_result" 18725c42550eSmrg 18736aec45a7Smrg if test -f "$dir/$objdir/$dlname"; then 18746aec45a7Smrg dir="$dir/$objdir" 18756aec45a7Smrg else 18766aec45a7Smrg if test ! -f "$dir/$dlname"; then 18776aec45a7Smrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 18786aec45a7Smrg fi 18796aec45a7Smrg fi 18801473d951Smrg ;; 18815c42550eSmrg 18826aec45a7Smrg *.lo) 18836aec45a7Smrg # Just add the directory containing the .lo file. 18846aec45a7Smrg func_dirname "$file" "" "." 18856aec45a7Smrg dir="$func_dirname_result" 18861473d951Smrg ;; 18876aec45a7Smrg 18886aec45a7Smrg *) 18896aec45a7Smrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 18905c42550eSmrg continue 1891ab47cfaaSmrg ;; 18926aec45a7Smrg esac 1893ab47cfaaSmrg 18946aec45a7Smrg # Get the absolute pathname. 18956aec45a7Smrg absdir=`cd "$dir" && pwd` 18966aec45a7Smrg test -n "$absdir" && dir="$absdir" 1897ab47cfaaSmrg 18986aec45a7Smrg # Now add the directory to shlibpath_var. 18996aec45a7Smrg if eval "test -z \"\$$shlibpath_var\""; then 19006aec45a7Smrg eval "$shlibpath_var=\"\$dir\"" 19016aec45a7Smrg else 19026aec45a7Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 19036aec45a7Smrg fi 19046aec45a7Smrg done 1905ab47cfaaSmrg 19066aec45a7Smrg # This variable tells wrapper scripts just to set shlibpath_var 19076aec45a7Smrg # rather than running their programs. 19086aec45a7Smrg libtool_execute_magic="$magic" 1909ab47cfaaSmrg 19106aec45a7Smrg # Check if any of the arguments is a wrapper script. 19116aec45a7Smrg args= 19126aec45a7Smrg for file 19136aec45a7Smrg do 19146aec45a7Smrg case $file in 19156aec45a7Smrg -* | *.la | *.lo ) ;; 19166aec45a7Smrg *) 19176aec45a7Smrg # Do a test to see if this is really a libtool program. 19186aec45a7Smrg if func_ltwrapper_script_p "$file"; then 19196aec45a7Smrg func_source "$file" 19206aec45a7Smrg # Transform arg to wrapped name. 19216aec45a7Smrg file="$progdir/$program" 19226aec45a7Smrg elif func_ltwrapper_executable_p "$file"; then 19236aec45a7Smrg func_ltwrapper_scriptname "$file" 19246aec45a7Smrg func_source "$func_ltwrapper_scriptname_result" 19256aec45a7Smrg # Transform arg to wrapped name. 19266aec45a7Smrg file="$progdir/$program" 19276aec45a7Smrg fi 19285c42550eSmrg ;; 19296aec45a7Smrg esac 19306aec45a7Smrg # Quote arguments (to preserve shell metacharacters). 19316aec45a7Smrg func_quote_for_eval "$file" 19326aec45a7Smrg args="$args $func_quote_for_eval_result" 19336aec45a7Smrg done 1934ab47cfaaSmrg 19356aec45a7Smrg if test "X$opt_dry_run" = Xfalse; then 19366aec45a7Smrg if test -n "$shlibpath_var"; then 19376aec45a7Smrg # Export the shlibpath_var. 19386aec45a7Smrg eval "export $shlibpath_var" 19396aec45a7Smrg fi 1940ab47cfaaSmrg 19416aec45a7Smrg # Restore saved environment variables 19426aec45a7Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 19436aec45a7Smrg do 19446aec45a7Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 19456aec45a7Smrg $lt_var=\$save_$lt_var; export $lt_var 19466aec45a7Smrg else 19476aec45a7Smrg $lt_unset $lt_var 19486aec45a7Smrg fi" 19496aec45a7Smrg done 1950ab47cfaaSmrg 19516aec45a7Smrg # Now prepare to actually exec the command. 19526aec45a7Smrg exec_cmd="\$cmd$args" 19536aec45a7Smrg else 19546aec45a7Smrg # Display what would be done. 19556aec45a7Smrg if test -n "$shlibpath_var"; then 19566aec45a7Smrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 19576aec45a7Smrg echo "export $shlibpath_var" 19586aec45a7Smrg fi 19596aec45a7Smrg $ECHO "$cmd$args" 19606aec45a7Smrg exit $EXIT_SUCCESS 19616aec45a7Smrg fi 19626aec45a7Smrg} 19631473d951Smrg 19646aec45a7Smrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 19651473d951Smrg 19661473d951Smrg 19676aec45a7Smrg# func_mode_finish arg... 19686aec45a7Smrgfunc_mode_finish () 19696aec45a7Smrg{ 19706aec45a7Smrg $opt_debug 19716aec45a7Smrg libdirs="$nonopt" 19726aec45a7Smrg admincmds= 19731473d951Smrg 19746aec45a7Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 19756aec45a7Smrg for dir 19766aec45a7Smrg do 19776aec45a7Smrg libdirs="$libdirs $dir" 19786aec45a7Smrg done 19791473d951Smrg 19806aec45a7Smrg for libdir in $libdirs; do 19816aec45a7Smrg if test -n "$finish_cmds"; then 19826aec45a7Smrg # Do each command in the finish commands. 19836aec45a7Smrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 19846aec45a7Smrg'"$cmd"'"' 19856aec45a7Smrg fi 19866aec45a7Smrg if test -n "$finish_eval"; then 19876aec45a7Smrg # Do the single finish_eval. 19886aec45a7Smrg eval cmds=\"$finish_eval\" 19896aec45a7Smrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 19906aec45a7Smrg $cmds" 19916aec45a7Smrg fi 19926aec45a7Smrg done 19936aec45a7Smrg fi 19941473d951Smrg 19956aec45a7Smrg # Exit here if they wanted silent mode. 19966aec45a7Smrg $opt_silent && exit $EXIT_SUCCESS 19971473d951Smrg 19986aec45a7Smrg echo "----------------------------------------------------------------------" 19996aec45a7Smrg echo "Libraries have been installed in:" 20006aec45a7Smrg for libdir in $libdirs; do 20016aec45a7Smrg $ECHO " $libdir" 20026aec45a7Smrg done 20036aec45a7Smrg echo 20046aec45a7Smrg echo "If you ever happen to want to link against installed libraries" 20056aec45a7Smrg echo "in a given directory, LIBDIR, you must either use libtool, and" 20066aec45a7Smrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 20076aec45a7Smrg echo "flag during linking and do at least one of the following:" 20086aec45a7Smrg if test -n "$shlibpath_var"; then 20096aec45a7Smrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 20106aec45a7Smrg echo " during execution" 20116aec45a7Smrg fi 20126aec45a7Smrg if test -n "$runpath_var"; then 20136aec45a7Smrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 20146aec45a7Smrg echo " during linking" 20156aec45a7Smrg fi 20166aec45a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 20176aec45a7Smrg libdir=LIBDIR 20186aec45a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 20191473d951Smrg 20206aec45a7Smrg $ECHO " - use the \`$flag' linker flag" 20216aec45a7Smrg fi 20226aec45a7Smrg if test -n "$admincmds"; then 20236aec45a7Smrg $ECHO " - have your system administrator run these commands:$admincmds" 20246aec45a7Smrg fi 20256aec45a7Smrg if test -f /etc/ld.so.conf; then 20266aec45a7Smrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 20276aec45a7Smrg fi 20286aec45a7Smrg echo 20291473d951Smrg 20306aec45a7Smrg echo "See any operating system documentation about shared libraries for" 20316aec45a7Smrg case $host in 20326aec45a7Smrg solaris2.[6789]|solaris2.1[0-9]) 20336aec45a7Smrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 20346aec45a7Smrg echo "pages." 20356aec45a7Smrg ;; 20366aec45a7Smrg *) 20376aec45a7Smrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 20386aec45a7Smrg ;; 20396aec45a7Smrg esac 20406aec45a7Smrg echo "----------------------------------------------------------------------" 20416aec45a7Smrg exit $EXIT_SUCCESS 20426aec45a7Smrg} 20431473d951Smrg 20446aec45a7Smrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 20455c42550eSmrg 2046ab47cfaaSmrg 20476aec45a7Smrg# func_mode_install arg... 20486aec45a7Smrgfunc_mode_install () 20496aec45a7Smrg{ 20506aec45a7Smrg $opt_debug 20516aec45a7Smrg # There may be an optional sh(1) argument at the beginning of 20526aec45a7Smrg # install_prog (especially on Windows NT). 20536aec45a7Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 20546aec45a7Smrg # Allow the use of GNU shtool's install command. 20556aec45a7Smrg case $nonopt in *shtool*) :;; *) false;; esac; then 20566aec45a7Smrg # Aesthetically quote it. 20576aec45a7Smrg func_quote_for_eval "$nonopt" 20586aec45a7Smrg install_prog="$func_quote_for_eval_result " 20596aec45a7Smrg arg=$1 20606aec45a7Smrg shift 20616aec45a7Smrg else 20626aec45a7Smrg install_prog= 20636aec45a7Smrg arg=$nonopt 20646aec45a7Smrg fi 2065ab47cfaaSmrg 20666aec45a7Smrg # The real first argument should be the name of the installation program. 20676aec45a7Smrg # Aesthetically quote it. 20686aec45a7Smrg func_quote_for_eval "$arg" 20696aec45a7Smrg install_prog="$install_prog$func_quote_for_eval_result" 20706aec45a7Smrg install_shared_prog=$install_prog 20716aec45a7Smrg case " $install_prog " in 20726aec45a7Smrg *[\\\ /]cp\ *) install_cp=: ;; 20736aec45a7Smrg *) install_cp=false ;; 20746aec45a7Smrg esac 2075ab47cfaaSmrg 20766aec45a7Smrg # We need to accept at least all the BSD install flags. 20776aec45a7Smrg dest= 20786aec45a7Smrg files= 20796aec45a7Smrg opts= 20806aec45a7Smrg prev= 20816aec45a7Smrg install_type= 20826aec45a7Smrg isdir=no 20836aec45a7Smrg stripme= 20846aec45a7Smrg no_mode=: 20856aec45a7Smrg for arg 20866aec45a7Smrg do 20876aec45a7Smrg arg2= 20886aec45a7Smrg if test -n "$dest"; then 20896aec45a7Smrg files="$files $dest" 20906aec45a7Smrg dest=$arg 20915c42550eSmrg continue 20926aec45a7Smrg fi 2093ab47cfaaSmrg 20946aec45a7Smrg case $arg in 20956aec45a7Smrg -d) isdir=yes ;; 20966aec45a7Smrg -f) 20976aec45a7Smrg if $install_cp; then :; else 20986aec45a7Smrg prev=$arg 2099ab47cfaaSmrg fi 21006aec45a7Smrg ;; 21016aec45a7Smrg -g | -m | -o) 21026aec45a7Smrg prev=$arg 21036aec45a7Smrg ;; 21046aec45a7Smrg -s) 21056aec45a7Smrg stripme=" -s" 21065c42550eSmrg continue 21075c42550eSmrg ;; 21086aec45a7Smrg -*) 21096aec45a7Smrg ;; 21105c42550eSmrg *) 21116aec45a7Smrg # If the previous option needed an argument, then skip it. 21126aec45a7Smrg if test -n "$prev"; then 21136aec45a7Smrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 21146aec45a7Smrg arg2=$install_override_mode 21156aec45a7Smrg no_mode=false 21166aec45a7Smrg fi 21176aec45a7Smrg prev= 21186aec45a7Smrg else 21196aec45a7Smrg dest=$arg 21206aec45a7Smrg continue 21216aec45a7Smrg fi 21221473d951Smrg ;; 21236aec45a7Smrg esac 2124ab47cfaaSmrg 21256aec45a7Smrg # Aesthetically quote the argument. 21266aec45a7Smrg func_quote_for_eval "$arg" 21276aec45a7Smrg install_prog="$install_prog $func_quote_for_eval_result" 21286aec45a7Smrg if test -n "$arg2"; then 21296aec45a7Smrg func_quote_for_eval "$arg2" 21305c42550eSmrg fi 21316aec45a7Smrg install_shared_prog="$install_shared_prog $func_quote_for_eval_result" 21326aec45a7Smrg done 21331473d951Smrg 21346aec45a7Smrg test -z "$install_prog" && \ 21356aec45a7Smrg func_fatal_help "you must specify an install program" 21361473d951Smrg 21376aec45a7Smrg test -n "$prev" && \ 21386aec45a7Smrg func_fatal_help "the \`$prev' option requires an argument" 21391473d951Smrg 21406aec45a7Smrg if test -n "$install_override_mode" && $no_mode; then 21416aec45a7Smrg if $install_cp; then :; else 21426aec45a7Smrg func_quote_for_eval "$install_override_mode" 21436aec45a7Smrg install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" 21446aec45a7Smrg fi 21455c42550eSmrg fi 21461473d951Smrg 21476aec45a7Smrg if test -z "$files"; then 21486aec45a7Smrg if test -z "$dest"; then 21496aec45a7Smrg func_fatal_help "no file or destination specified" 21506aec45a7Smrg else 21516aec45a7Smrg func_fatal_help "you must specify a destination" 21521473d951Smrg fi 21531473d951Smrg fi 21541473d951Smrg 21556aec45a7Smrg # Strip any trailing slash from the destination. 21566aec45a7Smrg func_stripname '' '/' "$dest" 21576aec45a7Smrg dest=$func_stripname_result 2158ab47cfaaSmrg 21596aec45a7Smrg # Check to see that the destination is a directory. 21606aec45a7Smrg test -d "$dest" && isdir=yes 21616aec45a7Smrg if test "$isdir" = yes; then 21626aec45a7Smrg destdir="$dest" 21636aec45a7Smrg destname= 21646aec45a7Smrg else 21656aec45a7Smrg func_dirname_and_basename "$dest" "" "." 21666aec45a7Smrg destdir="$func_dirname_result" 21676aec45a7Smrg destname="$func_basename_result" 21686aec45a7Smrg 21696aec45a7Smrg # Not a directory, so check to see that there is only one file specified. 21706aec45a7Smrg set dummy $files; shift 21716aec45a7Smrg test "$#" -gt 1 && \ 21726aec45a7Smrg func_fatal_help "\`$dest' is not a directory" 21736aec45a7Smrg fi 21746aec45a7Smrg case $destdir in 21756aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 21765c42550eSmrg *) 21776aec45a7Smrg for file in $files; do 21786aec45a7Smrg case $file in 21796aec45a7Smrg *.lo) ;; 21806aec45a7Smrg *) 21816aec45a7Smrg func_fatal_help "\`$destdir' must be an absolute directory name" 21826aec45a7Smrg ;; 21836aec45a7Smrg esac 21846aec45a7Smrg done 21855c42550eSmrg ;; 21865c42550eSmrg esac 2187ab47cfaaSmrg 21886aec45a7Smrg # This variable tells wrapper scripts just to set variables rather 21896aec45a7Smrg # than running their programs. 21906aec45a7Smrg libtool_install_magic="$magic" 2191ab47cfaaSmrg 21926aec45a7Smrg staticlibs= 21936aec45a7Smrg future_libdirs= 21946aec45a7Smrg current_libdirs= 21956aec45a7Smrg for file in $files; do 2196ab47cfaaSmrg 21976aec45a7Smrg # Do each installation. 21986aec45a7Smrg case $file in 21996aec45a7Smrg *.$libext) 22006aec45a7Smrg # Do the static libraries later. 22016aec45a7Smrg staticlibs="$staticlibs $file" 22026aec45a7Smrg ;; 22036aec45a7Smrg 22046aec45a7Smrg *.la) 22056aec45a7Smrg # Check to see that this really is a libtool archive. 22066aec45a7Smrg func_lalib_unsafe_p "$file" \ 22076aec45a7Smrg || func_fatal_help "\`$file' is not a valid libtool archive" 22086aec45a7Smrg 22096aec45a7Smrg library_names= 22106aec45a7Smrg old_library= 22116aec45a7Smrg relink_command= 22126aec45a7Smrg func_source "$file" 22136aec45a7Smrg 22146aec45a7Smrg # Add the libdir to current_libdirs if it is the destination. 22156aec45a7Smrg if test "X$destdir" = "X$libdir"; then 22166aec45a7Smrg case "$current_libdirs " in 22176aec45a7Smrg *" $libdir "*) ;; 22186aec45a7Smrg *) current_libdirs="$current_libdirs $libdir" ;; 22191473d951Smrg esac 22206aec45a7Smrg else 22216aec45a7Smrg # Note the libdir as a future libdir. 22226aec45a7Smrg case "$future_libdirs " in 22236aec45a7Smrg *" $libdir "*) ;; 22246aec45a7Smrg *) future_libdirs="$future_libdirs $libdir" ;; 22256aec45a7Smrg esac 22266aec45a7Smrg fi 2227ab47cfaaSmrg 22286aec45a7Smrg func_dirname "$file" "/" "" 22296aec45a7Smrg dir="$func_dirname_result" 22306aec45a7Smrg dir="$dir$objdir" 22316aec45a7Smrg 22326aec45a7Smrg if test -n "$relink_command"; then 22336aec45a7Smrg # Determine the prefix the user has applied to our future dir. 22346aec45a7Smrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 22356aec45a7Smrg 22366aec45a7Smrg # Don't allow the user to place us outside of our expected 22376aec45a7Smrg # location b/c this prevents finding dependent libraries that 22386aec45a7Smrg # are installed to the same prefix. 22396aec45a7Smrg # At present, this check doesn't affect windows .dll's that 22406aec45a7Smrg # are installed into $libdir/../bin (currently, that works fine) 22416aec45a7Smrg # but it's something to keep an eye on. 22426aec45a7Smrg test "$inst_prefix_dir" = "$destdir" && \ 22436aec45a7Smrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 22446aec45a7Smrg 22456aec45a7Smrg if test -n "$inst_prefix_dir"; then 22466aec45a7Smrg # Stick the inst_prefix_dir data into the link command. 22476aec45a7Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 22486aec45a7Smrg else 22496aec45a7Smrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 22506aec45a7Smrg fi 22516aec45a7Smrg 22526aec45a7Smrg func_warning "relinking \`$file'" 22536aec45a7Smrg func_show_eval "$relink_command" \ 22546aec45a7Smrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 22556aec45a7Smrg fi 22566aec45a7Smrg 22576aec45a7Smrg # See the names of the shared library. 22586aec45a7Smrg set dummy $library_names; shift 22596aec45a7Smrg if test -n "$1"; then 22606aec45a7Smrg realname="$1" 22616aec45a7Smrg shift 22626aec45a7Smrg 22636aec45a7Smrg srcname="$realname" 22646aec45a7Smrg test -n "$relink_command" && srcname="$realname"T 22656aec45a7Smrg 22666aec45a7Smrg # Install the shared library and build the symlinks. 22676aec45a7Smrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 22686aec45a7Smrg 'exit $?' 22696aec45a7Smrg tstripme="$stripme" 22706aec45a7Smrg case $host_os in 22716aec45a7Smrg cygwin* | mingw* | pw32* | cegcc*) 22726aec45a7Smrg case $realname in 22736aec45a7Smrg *.dll.a) 22746aec45a7Smrg tstripme="" 22756aec45a7Smrg ;; 22766aec45a7Smrg esac 22771473d951Smrg ;; 22781473d951Smrg esac 22796aec45a7Smrg if test -n "$tstripme" && test -n "$striplib"; then 22806aec45a7Smrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 22816aec45a7Smrg fi 22826aec45a7Smrg 22836aec45a7Smrg if test "$#" -gt 0; then 22846aec45a7Smrg # Delete the old symlinks, and create new ones. 22856aec45a7Smrg # Try `ln -sf' first, because the `ln' binary might depend on 22866aec45a7Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 22876aec45a7Smrg # so we also need to try rm && ln -s. 22886aec45a7Smrg for linkname 22896aec45a7Smrg do 22906aec45a7Smrg test "$linkname" != "$realname" \ 22916aec45a7Smrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 22926aec45a7Smrg done 22936aec45a7Smrg fi 22946aec45a7Smrg 22956aec45a7Smrg # Do each command in the postinstall commands. 22966aec45a7Smrg lib="$destdir/$realname" 22976aec45a7Smrg func_execute_cmds "$postinstall_cmds" 'exit $?' 22986aec45a7Smrg fi 22996aec45a7Smrg 23006aec45a7Smrg # Install the pseudo-library for information purposes. 23016aec45a7Smrg func_basename "$file" 23026aec45a7Smrg name="$func_basename_result" 23036aec45a7Smrg instname="$dir/$name"i 23046aec45a7Smrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 23056aec45a7Smrg 23066aec45a7Smrg # Maybe install the static library, too. 23076aec45a7Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 23081473d951Smrg ;; 23096aec45a7Smrg 23106aec45a7Smrg *.lo) 23116aec45a7Smrg # Install (i.e. copy) a libtool object. 23126aec45a7Smrg 23136aec45a7Smrg # Figure out destination file name, if it wasn't already specified. 23146aec45a7Smrg if test -n "$destname"; then 23156aec45a7Smrg destfile="$destdir/$destname" 23166aec45a7Smrg else 23176aec45a7Smrg func_basename "$file" 23186aec45a7Smrg destfile="$func_basename_result" 23196aec45a7Smrg destfile="$destdir/$destfile" 23206aec45a7Smrg fi 23216aec45a7Smrg 23226aec45a7Smrg # Deduce the name of the destination old-style object file. 23236aec45a7Smrg case $destfile in 23246aec45a7Smrg *.lo) 23256aec45a7Smrg func_lo2o "$destfile" 23266aec45a7Smrg staticdest=$func_lo2o_result 23275c42550eSmrg ;; 23286aec45a7Smrg *.$objext) 23296aec45a7Smrg staticdest="$destfile" 23306aec45a7Smrg destfile= 23315c42550eSmrg ;; 23326aec45a7Smrg *) 23336aec45a7Smrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 23345c42550eSmrg ;; 23356aec45a7Smrg esac 23366aec45a7Smrg 23376aec45a7Smrg # Install the libtool object if requested. 23386aec45a7Smrg test -n "$destfile" && \ 23396aec45a7Smrg func_show_eval "$install_prog $file $destfile" 'exit $?' 23406aec45a7Smrg 23416aec45a7Smrg # Install the old object if enabled. 23426aec45a7Smrg if test "$build_old_libs" = yes; then 23436aec45a7Smrg # Deduce the name of the old-style object file. 23446aec45a7Smrg func_lo2o "$file" 23456aec45a7Smrg staticobj=$func_lo2o_result 23466aec45a7Smrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 23475c42550eSmrg fi 23486aec45a7Smrg exit $EXIT_SUCCESS 23496aec45a7Smrg ;; 2350ab47cfaaSmrg 23516aec45a7Smrg *) 23526aec45a7Smrg # Figure out destination file name, if it wasn't already specified. 23536aec45a7Smrg if test -n "$destname"; then 23546aec45a7Smrg destfile="$destdir/$destname" 23555c42550eSmrg else 23566aec45a7Smrg func_basename "$file" 23576aec45a7Smrg destfile="$func_basename_result" 23586aec45a7Smrg destfile="$destdir/$destfile" 23595c42550eSmrg fi 2360ab47cfaaSmrg 23616aec45a7Smrg # If the file is missing, and there is a .exe on the end, strip it 23626aec45a7Smrg # because it is most likely a libtool script we actually want to 23636aec45a7Smrg # install 23646aec45a7Smrg stripped_ext="" 23656aec45a7Smrg case $file in 23666aec45a7Smrg *.exe) 23676aec45a7Smrg if test ! -f "$file"; then 23686aec45a7Smrg func_stripname '' '.exe' "$file" 23696aec45a7Smrg file=$func_stripname_result 23706aec45a7Smrg stripped_ext=".exe" 23716aec45a7Smrg fi 23726aec45a7Smrg ;; 23736aec45a7Smrg esac 2374ab47cfaaSmrg 23756aec45a7Smrg # Do a test to see if this is really a libtool program. 23766aec45a7Smrg case $host in 23776aec45a7Smrg *cygwin* | *mingw*) 23786aec45a7Smrg if func_ltwrapper_executable_p "$file"; then 23796aec45a7Smrg func_ltwrapper_scriptname "$file" 23806aec45a7Smrg wrapper=$func_ltwrapper_scriptname_result 23816aec45a7Smrg else 23826aec45a7Smrg func_stripname '' '.exe' "$file" 23836aec45a7Smrg wrapper=$func_stripname_result 23846aec45a7Smrg fi 23856aec45a7Smrg ;; 23866aec45a7Smrg *) 23876aec45a7Smrg wrapper=$file 23886aec45a7Smrg ;; 23896aec45a7Smrg esac 23906aec45a7Smrg if func_ltwrapper_script_p "$wrapper"; then 23916aec45a7Smrg notinst_deplibs= 23926aec45a7Smrg relink_command= 2393ab47cfaaSmrg 23946aec45a7Smrg func_source "$wrapper" 2395ab47cfaaSmrg 23966aec45a7Smrg # Check the variables that should have been set. 23976aec45a7Smrg test -z "$generated_by_libtool_version" && \ 23986aec45a7Smrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 2399ab47cfaaSmrg 24006aec45a7Smrg finalize=yes 24016aec45a7Smrg for lib in $notinst_deplibs; do 24026aec45a7Smrg # Check to see that each library is installed. 24036aec45a7Smrg libdir= 24046aec45a7Smrg if test -f "$lib"; then 24056aec45a7Smrg func_source "$lib" 24065c42550eSmrg fi 24076aec45a7Smrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 24086aec45a7Smrg if test -n "$libdir" && test ! -f "$libfile"; then 24096aec45a7Smrg func_warning "\`$lib' has not been installed in \`$libdir'" 24106aec45a7Smrg finalize=no 24116aec45a7Smrg fi 24126aec45a7Smrg done 2413ab47cfaaSmrg 24146aec45a7Smrg relink_command= 24156aec45a7Smrg func_source "$wrapper" 2416ab47cfaaSmrg 24176aec45a7Smrg outputname= 24186aec45a7Smrg if test "$fast_install" = no && test -n "$relink_command"; then 24196aec45a7Smrg $opt_dry_run || { 24206aec45a7Smrg if test "$finalize" = yes; then 24216aec45a7Smrg tmpdir=`func_mktempdir` 24226aec45a7Smrg func_basename "$file$stripped_ext" 24236aec45a7Smrg file="$func_basename_result" 24246aec45a7Smrg outputname="$tmpdir/$file" 24256aec45a7Smrg # Replace the output file specification. 24266aec45a7Smrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 24276aec45a7Smrg 24286aec45a7Smrg $opt_silent || { 24296aec45a7Smrg func_quote_for_expand "$relink_command" 24306aec45a7Smrg eval "func_echo $func_quote_for_expand_result" 24316aec45a7Smrg } 24326aec45a7Smrg if eval "$relink_command"; then : 24336aec45a7Smrg else 24346aec45a7Smrg func_error "error: relink \`$file' with the above command before installing it" 24356aec45a7Smrg $opt_dry_run || ${RM}r "$tmpdir" 24366aec45a7Smrg continue 24376aec45a7Smrg fi 24386aec45a7Smrg file="$outputname" 24396aec45a7Smrg else 24406aec45a7Smrg func_warning "cannot relink \`$file'" 24416aec45a7Smrg fi 24426aec45a7Smrg } 24435c42550eSmrg else 24446aec45a7Smrg # Install the binary that we compiled earlier. 24456aec45a7Smrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 24465c42550eSmrg fi 24476aec45a7Smrg fi 2448ab47cfaaSmrg 24496aec45a7Smrg # remove .exe since cygwin /usr/bin/install will append another 24506aec45a7Smrg # one anyway 24516aec45a7Smrg case $install_prog,$host in 24526aec45a7Smrg */usr/bin/install*,*cygwin*) 24536aec45a7Smrg case $file:$destfile in 24546aec45a7Smrg *.exe:*.exe) 24556aec45a7Smrg # this is ok 24566aec45a7Smrg ;; 24576aec45a7Smrg *.exe:*) 24586aec45a7Smrg destfile=$destfile.exe 24596aec45a7Smrg ;; 24606aec45a7Smrg *:*.exe) 24616aec45a7Smrg func_stripname '' '.exe' "$destfile" 24626aec45a7Smrg destfile=$func_stripname_result 24636aec45a7Smrg ;; 24646aec45a7Smrg esac 24655c42550eSmrg ;; 24665c42550eSmrg esac 24676aec45a7Smrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 24686aec45a7Smrg $opt_dry_run || if test -n "$outputname"; then 24696aec45a7Smrg ${RM}r "$tmpdir" 24706aec45a7Smrg fi 24716aec45a7Smrg ;; 24726aec45a7Smrg esac 24736aec45a7Smrg done 2474ab47cfaaSmrg 24756aec45a7Smrg for file in $staticlibs; do 24766aec45a7Smrg func_basename "$file" 24776aec45a7Smrg name="$func_basename_result" 24786aec45a7Smrg 24796aec45a7Smrg # Set up the ranlib parameters. 24806aec45a7Smrg oldlib="$destdir/$name" 24816aec45a7Smrg 24826aec45a7Smrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 24836aec45a7Smrg 24846aec45a7Smrg if test -n "$stripme" && test -n "$old_striplib"; then 24856aec45a7Smrg func_show_eval "$old_striplib $oldlib" 'exit $?' 24866aec45a7Smrg fi 24876aec45a7Smrg 24886aec45a7Smrg # Do each command in the postinstall commands. 24896aec45a7Smrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 24906aec45a7Smrg done 24916aec45a7Smrg 24926aec45a7Smrg test -n "$future_libdirs" && \ 24936aec45a7Smrg func_warning "remember to run \`$progname --finish$future_libdirs'" 24946aec45a7Smrg 24956aec45a7Smrg if test -n "$current_libdirs"; then 24966aec45a7Smrg # Maybe just do a dry run. 24976aec45a7Smrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 24986aec45a7Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 24996aec45a7Smrg else 25006aec45a7Smrg exit $EXIT_SUCCESS 25016aec45a7Smrg fi 25026aec45a7Smrg} 25036aec45a7Smrg 25046aec45a7Smrgtest "$mode" = install && func_mode_install ${1+"$@"} 25056aec45a7Smrg 25066aec45a7Smrg 25076aec45a7Smrg# func_generate_dlsyms outputname originator pic_p 25086aec45a7Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with 25096aec45a7Smrg# a dlpreopen symbol table. 25106aec45a7Smrgfunc_generate_dlsyms () 25116aec45a7Smrg{ 25126aec45a7Smrg $opt_debug 25136aec45a7Smrg my_outputname="$1" 25146aec45a7Smrg my_originator="$2" 25156aec45a7Smrg my_pic_p="${3-no}" 25166aec45a7Smrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 25176aec45a7Smrg my_dlsyms= 25186aec45a7Smrg 25196aec45a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 25206aec45a7Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 25216aec45a7Smrg my_dlsyms="${my_outputname}S.c" 25226aec45a7Smrg else 25236aec45a7Smrg func_error "not configured to extract global symbols from dlpreopened files" 25246aec45a7Smrg fi 25256aec45a7Smrg fi 25266aec45a7Smrg 25276aec45a7Smrg if test -n "$my_dlsyms"; then 25286aec45a7Smrg case $my_dlsyms in 25296aec45a7Smrg "") ;; 25306aec45a7Smrg *.c) 25316aec45a7Smrg # Discover the nlist of each of the dlfiles. 25326aec45a7Smrg nlist="$output_objdir/${my_outputname}.nm" 25336aec45a7Smrg 25346aec45a7Smrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 25356aec45a7Smrg 25366aec45a7Smrg # Parse the name list into a source file. 25376aec45a7Smrg func_verbose "creating $output_objdir/$my_dlsyms" 25386aec45a7Smrg 25396aec45a7Smrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 25406aec45a7Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 25416aec45a7Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 25426aec45a7Smrg 25436aec45a7Smrg#ifdef __cplusplus 25446aec45a7Smrgextern \"C\" { 25456aec45a7Smrg#endif 25466aec45a7Smrg 25476aec45a7Smrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 25486aec45a7Smrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 25496aec45a7Smrg#endif 25506aec45a7Smrg 25516aec45a7Smrg/* External symbol declarations for the compiler. */\ 25526aec45a7Smrg" 25536aec45a7Smrg 25546aec45a7Smrg if test "$dlself" = yes; then 25556aec45a7Smrg func_verbose "generating symbol list for \`$output'" 25566aec45a7Smrg 25576aec45a7Smrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 25586aec45a7Smrg 25596aec45a7Smrg # Add our own program objects to the symbol list. 25606aec45a7Smrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 25616aec45a7Smrg for progfile in $progfiles; do 25626aec45a7Smrg func_verbose "extracting global C symbols from \`$progfile'" 25636aec45a7Smrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 25646aec45a7Smrg done 25656aec45a7Smrg 25666aec45a7Smrg if test -n "$exclude_expsyms"; then 25676aec45a7Smrg $opt_dry_run || { 25686aec45a7Smrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 25696aec45a7Smrg eval '$MV "$nlist"T "$nlist"' 25706aec45a7Smrg } 25715c42550eSmrg fi 25726aec45a7Smrg 25736aec45a7Smrg if test -n "$export_symbols_regex"; then 25746aec45a7Smrg $opt_dry_run || { 25756aec45a7Smrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 25766aec45a7Smrg eval '$MV "$nlist"T "$nlist"' 25776aec45a7Smrg } 25786aec45a7Smrg fi 25796aec45a7Smrg 25806aec45a7Smrg # Prepare the list of exported symbols 25816aec45a7Smrg if test -z "$export_symbols"; then 25826aec45a7Smrg export_symbols="$output_objdir/$outputname.exp" 25836aec45a7Smrg $opt_dry_run || { 25846aec45a7Smrg $RM $export_symbols 25856aec45a7Smrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 25866aec45a7Smrg case $host in 25876aec45a7Smrg *cygwin* | *mingw* | *cegcc* ) 25886aec45a7Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 25896aec45a7Smrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 25906aec45a7Smrg ;; 25916aec45a7Smrg esac 25926aec45a7Smrg } 25935c42550eSmrg else 25946aec45a7Smrg $opt_dry_run || { 25956aec45a7Smrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 25966aec45a7Smrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 25976aec45a7Smrg eval '$MV "$nlist"T "$nlist"' 25986aec45a7Smrg case $host in 25996aec45a7Smrg *cygwin* | *mingw* | *cegcc* ) 26006aec45a7Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 26016aec45a7Smrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 26026aec45a7Smrg ;; 26036aec45a7Smrg esac 26046aec45a7Smrg } 26055c42550eSmrg fi 26066aec45a7Smrg fi 2607ab47cfaaSmrg 26086aec45a7Smrg for dlprefile in $dlprefiles; do 26096aec45a7Smrg func_verbose "extracting global C symbols from \`$dlprefile'" 26106aec45a7Smrg func_basename "$dlprefile" 26116aec45a7Smrg name="$func_basename_result" 26126aec45a7Smrg $opt_dry_run || { 26136aec45a7Smrg eval '$ECHO ": $name " >> "$nlist"' 26146aec45a7Smrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 26156aec45a7Smrg } 26166aec45a7Smrg done 26176aec45a7Smrg 26186aec45a7Smrg $opt_dry_run || { 26196aec45a7Smrg # Make sure we have at least an empty file. 26206aec45a7Smrg test -f "$nlist" || : > "$nlist" 26216aec45a7Smrg 26226aec45a7Smrg if test -n "$exclude_expsyms"; then 26236aec45a7Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 26246aec45a7Smrg $MV "$nlist"T "$nlist" 26255c42550eSmrg fi 26266aec45a7Smrg 26276aec45a7Smrg # Try sorting and uniquifying the output. 26286aec45a7Smrg if $GREP -v "^: " < "$nlist" | 26296aec45a7Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 26306aec45a7Smrg sort -k 3 26316aec45a7Smrg else 26326aec45a7Smrg sort +2 26336aec45a7Smrg fi | 26346aec45a7Smrg uniq > "$nlist"S; then 26356aec45a7Smrg : 26365c42550eSmrg else 26376aec45a7Smrg $GREP -v "^: " < "$nlist" > "$nlist"S 26385c42550eSmrg fi 2639ab47cfaaSmrg 26406aec45a7Smrg if test -f "$nlist"S; then 26416aec45a7Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 26425c42550eSmrg else 26436aec45a7Smrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 26445c42550eSmrg fi 2645ab47cfaaSmrg 26466aec45a7Smrg echo >> "$output_objdir/$my_dlsyms" "\ 2647ab47cfaaSmrg 26486aec45a7Smrg/* The mapping between symbol names and symbols. */ 26496aec45a7Smrgtypedef struct { 26506aec45a7Smrg const char *name; 26516aec45a7Smrg void *address; 26526aec45a7Smrg} lt_dlsymlist; 26536aec45a7Smrg" 26546aec45a7Smrg case $host in 26556aec45a7Smrg *cygwin* | *mingw* | *cegcc* ) 26566aec45a7Smrg echo >> "$output_objdir/$my_dlsyms" "\ 26576aec45a7Smrg/* DATA imports from DLLs on WIN32 con't be const, because 26586aec45a7Smrg runtime relocations are performed -- see ld's documentation 26596aec45a7Smrg on pseudo-relocs. */" 26606aec45a7Smrg lt_dlsym_const= ;; 26616aec45a7Smrg *osf5*) 26626aec45a7Smrg echo >> "$output_objdir/$my_dlsyms" "\ 26636aec45a7Smrg/* This system does not cope well with relocations in const data */" 26646aec45a7Smrg lt_dlsym_const= ;; 26656aec45a7Smrg *) 26666aec45a7Smrg lt_dlsym_const=const ;; 26676aec45a7Smrg esac 2668ab47cfaaSmrg 26696aec45a7Smrg echo >> "$output_objdir/$my_dlsyms" "\ 26706aec45a7Smrgextern $lt_dlsym_const lt_dlsymlist 26716aec45a7Smrglt_${my_prefix}_LTX_preloaded_symbols[]; 26726aec45a7Smrg$lt_dlsym_const lt_dlsymlist 26736aec45a7Smrglt_${my_prefix}_LTX_preloaded_symbols[] = 26746aec45a7Smrg{\ 26756aec45a7Smrg { \"$my_originator\", (void *) 0 }," 2676ab47cfaaSmrg 26776aec45a7Smrg case $need_lib_prefix in 26786aec45a7Smrg no) 26796aec45a7Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 26806aec45a7Smrg ;; 26816aec45a7Smrg *) 26826aec45a7Smrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 26836aec45a7Smrg ;; 26846aec45a7Smrg esac 26856aec45a7Smrg echo >> "$output_objdir/$my_dlsyms" "\ 26866aec45a7Smrg {0, (void *) 0} 26876aec45a7Smrg}; 26881473d951Smrg 26896aec45a7Smrg/* This works around a problem in FreeBSD linker */ 26906aec45a7Smrg#ifdef FREEBSD_WORKAROUND 26916aec45a7Smrgstatic const void *lt_preloaded_setup() { 26926aec45a7Smrg return lt_${my_prefix}_LTX_preloaded_symbols; 26936aec45a7Smrg} 26946aec45a7Smrg#endif 2695ab47cfaaSmrg 26966aec45a7Smrg#ifdef __cplusplus 26976aec45a7Smrg} 26986aec45a7Smrg#endif\ 26996aec45a7Smrg" 27006aec45a7Smrg } # !$opt_dry_run 27011473d951Smrg 27026aec45a7Smrg pic_flag_for_symtable= 27036aec45a7Smrg case "$compile_command " in 27046aec45a7Smrg *" -static "*) ;; 27056aec45a7Smrg *) 27066aec45a7Smrg case $host in 27076aec45a7Smrg # compiling the symbol table file with pic_flag works around 27086aec45a7Smrg # a FreeBSD bug that causes programs to crash when -lm is 27096aec45a7Smrg # linked before any other PIC object. But we must not use 27106aec45a7Smrg # pic_flag when linking with -static. The problem exists in 27116aec45a7Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 27126aec45a7Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 27136aec45a7Smrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 27146aec45a7Smrg *-*-hpux*) 27156aec45a7Smrg pic_flag_for_symtable=" $pic_flag" ;; 27166aec45a7Smrg *) 27176aec45a7Smrg if test "X$my_pic_p" != Xno; then 27186aec45a7Smrg pic_flag_for_symtable=" $pic_flag" 27196aec45a7Smrg fi 27206aec45a7Smrg ;; 27216aec45a7Smrg esac 27226aec45a7Smrg ;; 27236aec45a7Smrg esac 27246aec45a7Smrg symtab_cflags= 27256aec45a7Smrg for arg in $LTCFLAGS; do 27266aec45a7Smrg case $arg in 27276aec45a7Smrg -pie | -fpie | -fPIE) ;; 27286aec45a7Smrg *) symtab_cflags="$symtab_cflags $arg" ;; 27296aec45a7Smrg esac 27306aec45a7Smrg done 2731ab47cfaaSmrg 27326aec45a7Smrg # Now compile the dynamic symbol file. 27336aec45a7Smrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2734ab47cfaaSmrg 27356aec45a7Smrg # Clean up the generated files. 27366aec45a7Smrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 27371473d951Smrg 27386aec45a7Smrg # Transform the symbol file into the correct name. 27396aec45a7Smrg symfileobj="$output_objdir/${my_outputname}S.$objext" 27406aec45a7Smrg case $host in 27416aec45a7Smrg *cygwin* | *mingw* | *cegcc* ) 27426aec45a7Smrg if test -f "$output_objdir/$my_outputname.def"; then 27436aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 27446aec45a7Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 27456aec45a7Smrg else 27466aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 27476aec45a7Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 27486aec45a7Smrg fi 27496aec45a7Smrg ;; 27506aec45a7Smrg *) 27516aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 27526aec45a7Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 27536aec45a7Smrg ;; 27546aec45a7Smrg esac 27556aec45a7Smrg ;; 27566aec45a7Smrg *) 27576aec45a7Smrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 27586aec45a7Smrg ;; 27596aec45a7Smrg esac 27606aec45a7Smrg else 27616aec45a7Smrg # We keep going just in case the user didn't refer to 27626aec45a7Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 27636aec45a7Smrg # really was required. 27641473d951Smrg 27656aec45a7Smrg # Nullify the symbol file. 27666aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 27676aec45a7Smrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 27686aec45a7Smrg fi 27696aec45a7Smrg} 27701473d951Smrg 27716aec45a7Smrg# func_win32_libid arg 27726aec45a7Smrg# return the library type of file 'arg' 27736aec45a7Smrg# 27746aec45a7Smrg# Need a lot of goo to handle *both* DLLs and import libs 27756aec45a7Smrg# Has to be a shell function in order to 'eat' the argument 27766aec45a7Smrg# that is supplied when $file_magic_command is called. 27776aec45a7Smrg# Despite the name, also deal with 64 bit binaries. 27786aec45a7Smrgfunc_win32_libid () 27796aec45a7Smrg{ 27806aec45a7Smrg $opt_debug 27816aec45a7Smrg win32_libid_type="unknown" 27826aec45a7Smrg win32_fileres=`file -L $1 2>/dev/null` 27836aec45a7Smrg case $win32_fileres in 27846aec45a7Smrg *ar\ archive\ import\ library*) # definitely import 27856aec45a7Smrg win32_libid_type="x86 archive import" 27866aec45a7Smrg ;; 27876aec45a7Smrg *ar\ archive*) # could be an import, or static 27886aec45a7Smrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 27896aec45a7Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 27906aec45a7Smrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 27916aec45a7Smrg win32_nmres=`eval $NM -f posix -A $1 | 27926aec45a7Smrg $SED -n -e ' 27936aec45a7Smrg 1,100{ 27946aec45a7Smrg / I /{ 27956aec45a7Smrg s,.*,import, 27966aec45a7Smrg p 27976aec45a7Smrg q 27986aec45a7Smrg } 27996aec45a7Smrg }'` 28006aec45a7Smrg case $win32_nmres in 28016aec45a7Smrg import*) win32_libid_type="x86 archive import";; 28026aec45a7Smrg *) win32_libid_type="x86 archive static";; 28036aec45a7Smrg esac 28046aec45a7Smrg fi 28056aec45a7Smrg ;; 28066aec45a7Smrg *DLL*) 28076aec45a7Smrg win32_libid_type="x86 DLL" 28086aec45a7Smrg ;; 28096aec45a7Smrg *executable*) # but shell scripts are "executable" too... 28106aec45a7Smrg case $win32_fileres in 28116aec45a7Smrg *MS\ Windows\ PE\ Intel*) 28126aec45a7Smrg win32_libid_type="x86 DLL" 28136aec45a7Smrg ;; 28146aec45a7Smrg esac 28156aec45a7Smrg ;; 28166aec45a7Smrg esac 28176aec45a7Smrg $ECHO "$win32_libid_type" 28186aec45a7Smrg} 28191473d951Smrg 2820ab47cfaaSmrg 2821ab47cfaaSmrg 28226aec45a7Smrg# func_extract_an_archive dir oldlib 28236aec45a7Smrgfunc_extract_an_archive () 28246aec45a7Smrg{ 28256aec45a7Smrg $opt_debug 28266aec45a7Smrg f_ex_an_ar_dir="$1"; shift 28276aec45a7Smrg f_ex_an_ar_oldlib="$1" 28286aec45a7Smrg if test "$lock_old_archive_extraction" = yes; then 28296aec45a7Smrg lockfile=$f_ex_an_ar_oldlib.lock 28306aec45a7Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 28316aec45a7Smrg func_echo "Waiting for $lockfile to be removed" 28326aec45a7Smrg sleep 2 28336aec45a7Smrg done 28346aec45a7Smrg fi 28356aec45a7Smrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 28366aec45a7Smrg 'stat=$?; rm -f "$lockfile"; exit $stat' 28376aec45a7Smrg if test "$lock_old_archive_extraction" = yes; then 28386aec45a7Smrg $opt_dry_run || rm -f "$lockfile" 28396aec45a7Smrg fi 28406aec45a7Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 28416aec45a7Smrg : 28426aec45a7Smrg else 28436aec45a7Smrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 28446aec45a7Smrg fi 28456aec45a7Smrg} 28461473d951Smrg 28471473d951Smrg 28486aec45a7Smrg# func_extract_archives gentop oldlib ... 28496aec45a7Smrgfunc_extract_archives () 28506aec45a7Smrg{ 28516aec45a7Smrg $opt_debug 28526aec45a7Smrg my_gentop="$1"; shift 28536aec45a7Smrg my_oldlibs=${1+"$@"} 28546aec45a7Smrg my_oldobjs="" 28556aec45a7Smrg my_xlib="" 28566aec45a7Smrg my_xabs="" 28576aec45a7Smrg my_xdir="" 28581473d951Smrg 28596aec45a7Smrg for my_xlib in $my_oldlibs; do 28606aec45a7Smrg # Extract the objects. 28616aec45a7Smrg case $my_xlib in 28626aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 28636aec45a7Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 28646aec45a7Smrg esac 28656aec45a7Smrg func_basename "$my_xlib" 28666aec45a7Smrg my_xlib="$func_basename_result" 28676aec45a7Smrg my_xlib_u=$my_xlib 28686aec45a7Smrg while :; do 28696aec45a7Smrg case " $extracted_archives " in 28706aec45a7Smrg *" $my_xlib_u "*) 28716aec45a7Smrg func_arith $extracted_serial + 1 28726aec45a7Smrg extracted_serial=$func_arith_result 28736aec45a7Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 28746aec45a7Smrg *) break ;; 28756aec45a7Smrg esac 28766aec45a7Smrg done 28776aec45a7Smrg extracted_archives="$extracted_archives $my_xlib_u" 28786aec45a7Smrg my_xdir="$my_gentop/$my_xlib_u" 28791473d951Smrg 28806aec45a7Smrg func_mkdir_p "$my_xdir" 28816aec45a7Smrg 28826aec45a7Smrg case $host in 28836aec45a7Smrg *-darwin*) 28846aec45a7Smrg func_verbose "Extracting $my_xabs" 28856aec45a7Smrg # Do not bother doing anything if just a dry run 28866aec45a7Smrg $opt_dry_run || { 28876aec45a7Smrg darwin_orig_dir=`pwd` 28886aec45a7Smrg cd $my_xdir || exit $? 28896aec45a7Smrg darwin_archive=$my_xabs 28906aec45a7Smrg darwin_curdir=`pwd` 28916aec45a7Smrg darwin_base_archive=`basename "$darwin_archive"` 28926aec45a7Smrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 28936aec45a7Smrg if test -n "$darwin_arches"; then 28946aec45a7Smrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 28956aec45a7Smrg darwin_arch= 28966aec45a7Smrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 28976aec45a7Smrg for darwin_arch in $darwin_arches ; do 28986aec45a7Smrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 28996aec45a7Smrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 29006aec45a7Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 29016aec45a7Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 29026aec45a7Smrg cd "$darwin_curdir" 29036aec45a7Smrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 29046aec45a7Smrg done # $darwin_arches 29056aec45a7Smrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 29066aec45a7Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 29076aec45a7Smrg darwin_file= 29086aec45a7Smrg darwin_files= 29096aec45a7Smrg for darwin_file in $darwin_filelist; do 29106aec45a7Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 29116aec45a7Smrg $LIPO -create -output "$darwin_file" $darwin_files 29126aec45a7Smrg done # $darwin_filelist 29136aec45a7Smrg $RM -rf unfat-$$ 29146aec45a7Smrg cd "$darwin_orig_dir" 29155c42550eSmrg else 29166aec45a7Smrg cd $darwin_orig_dir 29176aec45a7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 29186aec45a7Smrg fi # $darwin_arches 29196aec45a7Smrg } # !$opt_dry_run 29206aec45a7Smrg ;; 29216aec45a7Smrg *) 29226aec45a7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 29236aec45a7Smrg ;; 29246aec45a7Smrg esac 29256aec45a7Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 29266aec45a7Smrg done 2927ab47cfaaSmrg 29286aec45a7Smrg func_extract_archives_result="$my_oldobjs" 29296aec45a7Smrg} 2930ab47cfaaSmrg 29311473d951Smrg 29326aec45a7Smrg# func_emit_wrapper [arg=no] 29336aec45a7Smrg# 29346aec45a7Smrg# Emit a libtool wrapper script on stdout. 29356aec45a7Smrg# Don't directly open a file because we may want to 29366aec45a7Smrg# incorporate the script contents within a cygwin/mingw 29376aec45a7Smrg# wrapper executable. Must ONLY be called from within 29386aec45a7Smrg# func_mode_link because it depends on a number of variables 29396aec45a7Smrg# set therein. 29406aec45a7Smrg# 29416aec45a7Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 29426aec45a7Smrg# variable will take. If 'yes', then the emitted script 29436aec45a7Smrg# will assume that the directory in which it is stored is 29446aec45a7Smrg# the $objdir directory. This is a cygwin/mingw-specific 29456aec45a7Smrg# behavior. 29466aec45a7Smrgfunc_emit_wrapper () 29476aec45a7Smrg{ 29486aec45a7Smrg func_emit_wrapper_arg1=${1-no} 29495c42550eSmrg 29506aec45a7Smrg $ECHO "\ 29516aec45a7Smrg#! $SHELL 29521473d951Smrg 29536aec45a7Smrg# $output - temporary wrapper script for $objdir/$outputname 29546aec45a7Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 29556aec45a7Smrg# 29566aec45a7Smrg# The $output program cannot be directly executed until all the libtool 29576aec45a7Smrg# libraries that it depends on are installed. 29586aec45a7Smrg# 29596aec45a7Smrg# This wrapper script should never be moved out of the build directory. 29606aec45a7Smrg# If it is, it will not operate correctly. 2961ab47cfaaSmrg 29626aec45a7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 29636aec45a7Smrg# metacharacters that are still active within double-quoted strings. 29646aec45a7Smrgsed_quote_subst='$sed_quote_subst' 2965ab47cfaaSmrg 29666aec45a7Smrg# Be Bourne compatible 29676aec45a7Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 29686aec45a7Smrg emulate sh 29696aec45a7Smrg NULLCMD=: 29706aec45a7Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 29716aec45a7Smrg # is contrary to our usage. Disable this feature. 29726aec45a7Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 29736aec45a7Smrg setopt NO_GLOB_SUBST 29746aec45a7Smrgelse 29756aec45a7Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 29766aec45a7Smrgfi 29776aec45a7SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 29786aec45a7SmrgDUALCASE=1; export DUALCASE # for MKS sh 2979ab47cfaaSmrg 29806aec45a7Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 29816aec45a7Smrg# if CDPATH is set. 29826aec45a7Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2983ab47cfaaSmrg 29846aec45a7Smrgrelink_command=\"$relink_command\" 2985ab47cfaaSmrg 29866aec45a7Smrg# This environment variable determines our operation mode. 29876aec45a7Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 29886aec45a7Smrg # install mode needs the following variables: 29896aec45a7Smrg generated_by_libtool_version='$macro_version' 29906aec45a7Smrg notinst_deplibs='$notinst_deplibs' 29916aec45a7Smrgelse 29926aec45a7Smrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 29936aec45a7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 29946aec45a7Smrg file=\"\$0\"" 2995ab47cfaaSmrg 29966aec45a7Smrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 29976aec45a7Smrg $ECHO "\ 2998ab47cfaaSmrg 29996aec45a7Smrg# A function that is used when there is no print builtin or printf. 30006aec45a7Smrgfunc_fallback_echo () 30016aec45a7Smrg{ 30026aec45a7Smrg eval 'cat <<_LTECHO_EOF 30036aec45a7Smrg\$1 30046aec45a7Smrg_LTECHO_EOF' 30056aec45a7Smrg} 30066aec45a7Smrg ECHO=\"$qECHO\" 30076aec45a7Smrg fi 30086aec45a7Smrg 30096aec45a7Smrg# Very basic option parsing. These options are (a) specific to 30106aec45a7Smrg# the libtool wrapper, (b) are identical between the wrapper 30116aec45a7Smrg# /script/ and the wrapper /executable/ which is used only on 30126aec45a7Smrg# windows platforms, and (c) all begin with the string "--lt-" 30136aec45a7Smrg# (application programs are unlikely to have options which match 30146aec45a7Smrg# this pattern). 30156aec45a7Smrg# 30166aec45a7Smrg# There are only two supported options: --lt-debug and 30176aec45a7Smrg# --lt-dump-script. There is, deliberately, no --lt-help. 30186aec45a7Smrg# 30196aec45a7Smrg# The first argument to this parsing function should be the 30206aec45a7Smrg# script's $0 value, followed by "$@". 30216aec45a7Smrglt_option_debug= 30226aec45a7Smrgfunc_parse_lt_options () 30236aec45a7Smrg{ 30246aec45a7Smrg lt_script_arg0=\$0 30256aec45a7Smrg shift 30266aec45a7Smrg for lt_opt 30276aec45a7Smrg do 30286aec45a7Smrg case \"\$lt_opt\" in 30296aec45a7Smrg --lt-debug) lt_option_debug=1 ;; 30306aec45a7Smrg --lt-dump-script) 30316aec45a7Smrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 30326aec45a7Smrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 30336aec45a7Smrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 30346aec45a7Smrg cat \"\$lt_dump_D/\$lt_dump_F\" 30356aec45a7Smrg exit 0 30366aec45a7Smrg ;; 30376aec45a7Smrg --lt-*) 30386aec45a7Smrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 30396aec45a7Smrg exit 1 30405c42550eSmrg ;; 30416aec45a7Smrg esac 30426aec45a7Smrg done 3043ab47cfaaSmrg 30446aec45a7Smrg # Print the debug banner immediately: 30456aec45a7Smrg if test -n \"\$lt_option_debug\"; then 30466aec45a7Smrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 30476aec45a7Smrg fi 30486aec45a7Smrg} 3049ab47cfaaSmrg 30506aec45a7Smrg# Used when --lt-debug. Prints its arguments to stdout 30516aec45a7Smrg# (redirection is the responsibility of the caller) 30526aec45a7Smrgfunc_lt_dump_args () 30536aec45a7Smrg{ 30546aec45a7Smrg lt_dump_args_N=1; 30556aec45a7Smrg for lt_arg 30566aec45a7Smrg do 30576aec45a7Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 30586aec45a7Smrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 30596aec45a7Smrg done 30606aec45a7Smrg} 3061ab47cfaaSmrg 30626aec45a7Smrg# Core function for launching the target application 30636aec45a7Smrgfunc_exec_program_core () 30646aec45a7Smrg{ 30656aec45a7Smrg" 30666aec45a7Smrg case $host in 30676aec45a7Smrg # Backslashes separate directories on plain windows 30686aec45a7Smrg *-*-mingw | *-*-os2* | *-cegcc*) 30696aec45a7Smrg $ECHO "\ 30706aec45a7Smrg if test -n \"\$lt_option_debug\"; then 30716aec45a7Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 30726aec45a7Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 30735c42550eSmrg fi 30746aec45a7Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 30756aec45a7Smrg" 30766aec45a7Smrg ;; 3077ab47cfaaSmrg 30786aec45a7Smrg *) 30796aec45a7Smrg $ECHO "\ 30806aec45a7Smrg if test -n \"\$lt_option_debug\"; then 30816aec45a7Smrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 30826aec45a7Smrg func_lt_dump_args \${1+\"\$@\"} 1>&2 30835c42550eSmrg fi 30846aec45a7Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 30856aec45a7Smrg" 30866aec45a7Smrg ;; 30876aec45a7Smrg esac 30886aec45a7Smrg $ECHO "\ 30896aec45a7Smrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 30906aec45a7Smrg exit 1 30916aec45a7Smrg} 3092ab47cfaaSmrg 30936aec45a7Smrg# A function to encapsulate launching the target application 30946aec45a7Smrg# Strips options in the --lt-* namespace from \$@ and 30956aec45a7Smrg# launches target application with the remaining arguments. 30966aec45a7Smrgfunc_exec_program () 30976aec45a7Smrg{ 30986aec45a7Smrg for lt_wr_arg 30996aec45a7Smrg do 31006aec45a7Smrg case \$lt_wr_arg in 31016aec45a7Smrg --lt-*) ;; 31026aec45a7Smrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 31036aec45a7Smrg esac 31046aec45a7Smrg shift 31056aec45a7Smrg done 31066aec45a7Smrg func_exec_program_core \${1+\"\$@\"} 31076aec45a7Smrg} 3108ab47cfaaSmrg 31096aec45a7Smrg # Parse options 31106aec45a7Smrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3111ab47cfaaSmrg 31126aec45a7Smrg # Find the directory that this script lives in. 31136aec45a7Smrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 31146aec45a7Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 3115ab47cfaaSmrg 31166aec45a7Smrg # Follow symbolic links until we get to the real thisdir. 31176aec45a7Smrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 31186aec45a7Smrg while test -n \"\$file\"; do 31196aec45a7Smrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 3120ab47cfaaSmrg 31216aec45a7Smrg # If there was a directory component, then change thisdir. 31226aec45a7Smrg if test \"x\$destdir\" != \"x\$file\"; then 31236aec45a7Smrg case \"\$destdir\" in 31246aec45a7Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 31256aec45a7Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 31266aec45a7Smrg esac 31276aec45a7Smrg fi 3128ab47cfaaSmrg 31296aec45a7Smrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 31306aec45a7Smrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 31316aec45a7Smrg done 3132ab47cfaaSmrg 31336aec45a7Smrg # Usually 'no', except on cygwin/mingw when embedded into 31346aec45a7Smrg # the cwrapper. 31356aec45a7Smrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 31366aec45a7Smrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 31376aec45a7Smrg # special case for '.' 31386aec45a7Smrg if test \"\$thisdir\" = \".\"; then 31396aec45a7Smrg thisdir=\`pwd\` 31406aec45a7Smrg fi 31416aec45a7Smrg # remove .libs from thisdir 31426aec45a7Smrg case \"\$thisdir\" in 31436aec45a7Smrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 31446aec45a7Smrg $objdir ) thisdir=. ;; 31456aec45a7Smrg esac 31466aec45a7Smrg fi 3147ab47cfaaSmrg 31486aec45a7Smrg # Try to get the absolute directory name. 31496aec45a7Smrg absdir=\`cd \"\$thisdir\" && pwd\` 31506aec45a7Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 31516aec45a7Smrg" 3152ab47cfaaSmrg 31536aec45a7Smrg if test "$fast_install" = yes; then 31546aec45a7Smrg $ECHO "\ 31556aec45a7Smrg program=lt-'$outputname'$exeext 31566aec45a7Smrg progdir=\"\$thisdir/$objdir\" 3157ab47cfaaSmrg 31586aec45a7Smrg if test ! -f \"\$progdir/\$program\" || 31596aec45a7Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 31606aec45a7Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 3161ab47cfaaSmrg 31626aec45a7Smrg file=\"\$\$-\$program\" 3163ab47cfaaSmrg 31646aec45a7Smrg if test ! -d \"\$progdir\"; then 31656aec45a7Smrg $MKDIR \"\$progdir\" 31666aec45a7Smrg else 31676aec45a7Smrg $RM \"\$progdir/\$file\" 31686aec45a7Smrg fi" 3169ab47cfaaSmrg 31706aec45a7Smrg $ECHO "\ 3171ab47cfaaSmrg 31726aec45a7Smrg # relink executable if necessary 31736aec45a7Smrg if test -n \"\$relink_command\"; then 31746aec45a7Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 31756aec45a7Smrg else 31766aec45a7Smrg $ECHO \"\$relink_command_output\" >&2 31776aec45a7Smrg $RM \"\$progdir/\$file\" 31786aec45a7Smrg exit 1 31796aec45a7Smrg fi 31806aec45a7Smrg fi 3181ab47cfaaSmrg 31826aec45a7Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 31836aec45a7Smrg { $RM \"\$progdir/\$program\"; 31846aec45a7Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 31856aec45a7Smrg $RM \"\$progdir/\$file\" 31866aec45a7Smrg fi" 31876aec45a7Smrg else 31886aec45a7Smrg $ECHO "\ 31896aec45a7Smrg program='$outputname' 31906aec45a7Smrg progdir=\"\$thisdir/$objdir\" 31916aec45a7Smrg" 31926aec45a7Smrg fi 3193ab47cfaaSmrg 31946aec45a7Smrg $ECHO "\ 3195ab47cfaaSmrg 31966aec45a7Smrg if test -f \"\$progdir/\$program\"; then" 3197ab47cfaaSmrg 31986aec45a7Smrg # Export our shlibpath_var if we have one. 31996aec45a7Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 32006aec45a7Smrg $ECHO "\ 32016aec45a7Smrg # Add our own library path to $shlibpath_var 32026aec45a7Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 3203ab47cfaaSmrg 32046aec45a7Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 32056aec45a7Smrg # The second colon is a workaround for a bug in BeOS R4 sed 32066aec45a7Smrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 3207ab47cfaaSmrg 32086aec45a7Smrg export $shlibpath_var 32096aec45a7Smrg" 32106aec45a7Smrg fi 32111473d951Smrg 32126aec45a7Smrg # fixup the dll searchpath if we need to. 32136aec45a7Smrg if test -n "$dllsearchpath"; then 32146aec45a7Smrg $ECHO "\ 32156aec45a7Smrg # Add the dll search path components to the executable PATH 32166aec45a7Smrg PATH=$dllsearchpath:\$PATH 32176aec45a7Smrg" 32186aec45a7Smrg fi 32191473d951Smrg 32206aec45a7Smrg $ECHO "\ 32216aec45a7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 32226aec45a7Smrg # Run the actual program with our arguments. 32236aec45a7Smrg func_exec_program \${1+\"\$@\"} 32246aec45a7Smrg fi 32256aec45a7Smrg else 32266aec45a7Smrg # The program doesn't exist. 32276aec45a7Smrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 32286aec45a7Smrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 32296aec45a7Smrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 32306aec45a7Smrg exit 1 32316aec45a7Smrg fi 32326aec45a7Smrgfi\ 32336aec45a7Smrg" 32346aec45a7Smrg} 32351473d951Smrg 32361473d951Smrg 32376aec45a7Smrg# func_to_host_path arg 32386aec45a7Smrg# 32396aec45a7Smrg# Convert paths to host format when used with build tools. 32406aec45a7Smrg# Intended for use with "native" mingw (where libtool itself 32416aec45a7Smrg# is running under the msys shell), or in the following cross- 32426aec45a7Smrg# build environments: 32436aec45a7Smrg# $build $host 32446aec45a7Smrg# mingw (msys) mingw [e.g. native] 32456aec45a7Smrg# cygwin mingw 32466aec45a7Smrg# *nix + wine mingw 32476aec45a7Smrg# where wine is equipped with the `winepath' executable. 32486aec45a7Smrg# In the native mingw case, the (msys) shell automatically 32496aec45a7Smrg# converts paths for any non-msys applications it launches, 32506aec45a7Smrg# but that facility isn't available from inside the cwrapper. 32516aec45a7Smrg# Similar accommodations are necessary for $host mingw and 32526aec45a7Smrg# $build cygwin. Calling this function does no harm for other 32536aec45a7Smrg# $host/$build combinations not listed above. 32546aec45a7Smrg# 32556aec45a7Smrg# ARG is the path (on $build) that should be converted to 32566aec45a7Smrg# the proper representation for $host. The result is stored 32576aec45a7Smrg# in $func_to_host_path_result. 32586aec45a7Smrgfunc_to_host_path () 32596aec45a7Smrg{ 32606aec45a7Smrg func_to_host_path_result="$1" 32616aec45a7Smrg if test -n "$1"; then 32626aec45a7Smrg case $host in 32636aec45a7Smrg *mingw* ) 32646aec45a7Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 32656aec45a7Smrg case $build in 32666aec45a7Smrg *mingw* ) # actually, msys 32676aec45a7Smrg # awkward: cmd appends spaces to result 32686aec45a7Smrg func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | 32696aec45a7Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 32706aec45a7Smrg ;; 32716aec45a7Smrg *cygwin* ) 32726aec45a7Smrg func_to_host_path_result=`cygpath -w "$1" | 32736aec45a7Smrg $SED -e "$lt_sed_naive_backslashify"` 32746aec45a7Smrg ;; 32756aec45a7Smrg * ) 32766aec45a7Smrg # Unfortunately, winepath does not exit with a non-zero 32776aec45a7Smrg # error code, so we are forced to check the contents of 32786aec45a7Smrg # stdout. On the other hand, if the command is not 32796aec45a7Smrg # found, the shell will set an exit code of 127 and print 32806aec45a7Smrg # *an error message* to stdout. So we must check for both 32816aec45a7Smrg # error code of zero AND non-empty stdout, which explains 32826aec45a7Smrg # the odd construction: 32836aec45a7Smrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 32846aec45a7Smrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 32856aec45a7Smrg func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | 32866aec45a7Smrg $SED -e "$lt_sed_naive_backslashify"` 32876aec45a7Smrg else 32886aec45a7Smrg # Allow warning below. 32896aec45a7Smrg func_to_host_path_result= 32906aec45a7Smrg fi 32916aec45a7Smrg ;; 32926aec45a7Smrg esac 32936aec45a7Smrg if test -z "$func_to_host_path_result" ; then 32946aec45a7Smrg func_error "Could not determine host path corresponding to" 32956aec45a7Smrg func_error " \`$1'" 32966aec45a7Smrg func_error "Continuing, but uninstalled executables may not work." 32976aec45a7Smrg # Fallback: 32986aec45a7Smrg func_to_host_path_result="$1" 32996aec45a7Smrg fi 33006aec45a7Smrg ;; 33016aec45a7Smrg esac 33026aec45a7Smrg fi 33036aec45a7Smrg} 33046aec45a7Smrg# end: func_to_host_path 33051473d951Smrg 33066aec45a7Smrg# func_to_host_pathlist arg 33076aec45a7Smrg# 33086aec45a7Smrg# Convert pathlists to host format when used with build tools. 33096aec45a7Smrg# See func_to_host_path(), above. This function supports the 33106aec45a7Smrg# following $build/$host combinations (but does no harm for 33116aec45a7Smrg# combinations not listed here): 33126aec45a7Smrg# $build $host 33136aec45a7Smrg# mingw (msys) mingw [e.g. native] 33146aec45a7Smrg# cygwin mingw 33156aec45a7Smrg# *nix + wine mingw 33166aec45a7Smrg# 33176aec45a7Smrg# Path separators are also converted from $build format to 33186aec45a7Smrg# $host format. If ARG begins or ends with a path separator 33196aec45a7Smrg# character, it is preserved (but converted to $host format) 33206aec45a7Smrg# on output. 33216aec45a7Smrg# 33226aec45a7Smrg# ARG is a pathlist (on $build) that should be converted to 33236aec45a7Smrg# the proper representation on $host. The result is stored 33246aec45a7Smrg# in $func_to_host_pathlist_result. 33256aec45a7Smrgfunc_to_host_pathlist () 33266aec45a7Smrg{ 33276aec45a7Smrg func_to_host_pathlist_result="$1" 33286aec45a7Smrg if test -n "$1"; then 33296aec45a7Smrg case $host in 33306aec45a7Smrg *mingw* ) 33316aec45a7Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 33326aec45a7Smrg # Remove leading and trailing path separator characters from 33336aec45a7Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 33346aec45a7Smrg # into '.;' and ';.', and winepath ignores them completely. 33356aec45a7Smrg func_stripname : : "$1" 33366aec45a7Smrg func_to_host_pathlist_tmp1=$func_stripname_result 33376aec45a7Smrg case $build in 33386aec45a7Smrg *mingw* ) # Actually, msys. 33396aec45a7Smrg # Awkward: cmd appends spaces to result. 33406aec45a7Smrg func_to_host_pathlist_result=` 33416aec45a7Smrg ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | 33426aec45a7Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 33436aec45a7Smrg ;; 33446aec45a7Smrg *cygwin* ) 33456aec45a7Smrg func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | 33466aec45a7Smrg $SED -e "$lt_sed_naive_backslashify"` 33476aec45a7Smrg ;; 33486aec45a7Smrg * ) 33496aec45a7Smrg # unfortunately, winepath doesn't convert pathlists 33506aec45a7Smrg func_to_host_pathlist_result="" 33516aec45a7Smrg func_to_host_pathlist_oldIFS=$IFS 33526aec45a7Smrg IFS=: 33536aec45a7Smrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 33546aec45a7Smrg IFS=$func_to_host_pathlist_oldIFS 33556aec45a7Smrg if test -n "$func_to_host_pathlist_f" ; then 33566aec45a7Smrg func_to_host_path "$func_to_host_pathlist_f" 33576aec45a7Smrg if test -n "$func_to_host_path_result" ; then 33586aec45a7Smrg if test -z "$func_to_host_pathlist_result" ; then 33596aec45a7Smrg func_to_host_pathlist_result="$func_to_host_path_result" 33606aec45a7Smrg else 33616aec45a7Smrg func_append func_to_host_pathlist_result ";$func_to_host_path_result" 33626aec45a7Smrg fi 33636aec45a7Smrg fi 33646aec45a7Smrg fi 33656aec45a7Smrg done 33666aec45a7Smrg IFS=$func_to_host_pathlist_oldIFS 33676aec45a7Smrg ;; 33686aec45a7Smrg esac 33696aec45a7Smrg if test -z "$func_to_host_pathlist_result"; then 33706aec45a7Smrg func_error "Could not determine the host path(s) corresponding to" 33716aec45a7Smrg func_error " \`$1'" 33726aec45a7Smrg func_error "Continuing, but uninstalled executables may not work." 33736aec45a7Smrg # Fallback. This may break if $1 contains DOS-style drive 33746aec45a7Smrg # specifications. The fix is not to complicate the expression 33756aec45a7Smrg # below, but for the user to provide a working wine installation 33766aec45a7Smrg # with winepath so that path translation in the cross-to-mingw 33776aec45a7Smrg # case works properly. 33786aec45a7Smrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 33796aec45a7Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 33806aec45a7Smrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 33816aec45a7Smrg fi 33826aec45a7Smrg # Now, add the leading and trailing path separators back 33836aec45a7Smrg case "$1" in 33846aec45a7Smrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 33856aec45a7Smrg ;; 33866aec45a7Smrg esac 33876aec45a7Smrg case "$1" in 33886aec45a7Smrg *: ) func_append func_to_host_pathlist_result ";" 33896aec45a7Smrg ;; 33906aec45a7Smrg esac 33916aec45a7Smrg ;; 33926aec45a7Smrg esac 33936aec45a7Smrg fi 33946aec45a7Smrg} 33956aec45a7Smrg# end: func_to_host_pathlist 33961473d951Smrg 33976aec45a7Smrg# func_emit_cwrapperexe_src 33986aec45a7Smrg# emit the source code for a wrapper executable on stdout 33996aec45a7Smrg# Must ONLY be called from within func_mode_link because 34006aec45a7Smrg# it depends on a number of variable set therein. 34016aec45a7Smrgfunc_emit_cwrapperexe_src () 34026aec45a7Smrg{ 34036aec45a7Smrg cat <<EOF 3404ab47cfaaSmrg 34056aec45a7Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 34066aec45a7Smrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3407ab47cfaaSmrg 34086aec45a7Smrg The $output program cannot be directly executed until all the libtool 34096aec45a7Smrg libraries that it depends on are installed. 3410ab47cfaaSmrg 34116aec45a7Smrg This wrapper executable should never be moved out of the build directory. 34126aec45a7Smrg If it is, it will not operate correctly. 34136aec45a7Smrg*/ 34146aec45a7SmrgEOF 34156aec45a7Smrg cat <<"EOF" 34166aec45a7Smrg#ifdef _MSC_VER 34176aec45a7Smrg# define _CRT_SECURE_NO_DEPRECATE 1 34186aec45a7Smrg#endif 34196aec45a7Smrg#include <stdio.h> 34206aec45a7Smrg#include <stdlib.h> 34216aec45a7Smrg#ifdef _MSC_VER 34226aec45a7Smrg# include <direct.h> 34236aec45a7Smrg# include <process.h> 34246aec45a7Smrg# include <io.h> 34256aec45a7Smrg#else 34266aec45a7Smrg# include <unistd.h> 34276aec45a7Smrg# include <stdint.h> 34286aec45a7Smrg# ifdef __CYGWIN__ 34296aec45a7Smrg# include <io.h> 34306aec45a7Smrg# endif 34316aec45a7Smrg#endif 34326aec45a7Smrg#include <malloc.h> 34336aec45a7Smrg#include <stdarg.h> 34346aec45a7Smrg#include <assert.h> 34356aec45a7Smrg#include <string.h> 34366aec45a7Smrg#include <ctype.h> 34376aec45a7Smrg#include <errno.h> 34386aec45a7Smrg#include <fcntl.h> 34396aec45a7Smrg#include <sys/stat.h> 3440ab47cfaaSmrg 34416aec45a7Smrg/* declarations of non-ANSI functions */ 34426aec45a7Smrg#if defined(__MINGW32__) 34436aec45a7Smrg# ifdef __STRICT_ANSI__ 34446aec45a7Smrgint _putenv (const char *); 34456aec45a7Smrg# endif 34466aec45a7Smrg#elif defined(__CYGWIN__) 34476aec45a7Smrg# ifdef __STRICT_ANSI__ 34486aec45a7Smrgchar *realpath (const char *, char *); 34496aec45a7Smrgint putenv (char *); 34506aec45a7Smrgint setenv (const char *, const char *, int); 34516aec45a7Smrg# endif 34526aec45a7Smrg/* #elif defined (other platforms) ... */ 34536aec45a7Smrg#endif 3454ab47cfaaSmrg 34556aec45a7Smrg/* portability defines, excluding path handling macros */ 34566aec45a7Smrg#if defined(_MSC_VER) 34576aec45a7Smrg# define setmode _setmode 34586aec45a7Smrg# define stat _stat 34596aec45a7Smrg# define chmod _chmod 34606aec45a7Smrg# define getcwd _getcwd 34616aec45a7Smrg# define putenv _putenv 34626aec45a7Smrg# define S_IXUSR _S_IEXEC 34636aec45a7Smrg# ifndef _INTPTR_T_DEFINED 34646aec45a7Smrg# define _INTPTR_T_DEFINED 34656aec45a7Smrg# define intptr_t int 34666aec45a7Smrg# endif 34676aec45a7Smrg#elif defined(__MINGW32__) 34686aec45a7Smrg# define setmode _setmode 34696aec45a7Smrg# define stat _stat 34706aec45a7Smrg# define chmod _chmod 34716aec45a7Smrg# define getcwd _getcwd 34726aec45a7Smrg# define putenv _putenv 34736aec45a7Smrg#elif defined(__CYGWIN__) 34746aec45a7Smrg# define HAVE_SETENV 34756aec45a7Smrg# define FOPEN_WB "wb" 34766aec45a7Smrg/* #elif defined (other platforms) ... */ 34776aec45a7Smrg#endif 3478ab47cfaaSmrg 34796aec45a7Smrg#if defined(PATH_MAX) 34806aec45a7Smrg# define LT_PATHMAX PATH_MAX 34816aec45a7Smrg#elif defined(MAXPATHLEN) 34826aec45a7Smrg# define LT_PATHMAX MAXPATHLEN 34836aec45a7Smrg#else 34846aec45a7Smrg# define LT_PATHMAX 1024 34856aec45a7Smrg#endif 3486ab47cfaaSmrg 34876aec45a7Smrg#ifndef S_IXOTH 34886aec45a7Smrg# define S_IXOTH 0 34896aec45a7Smrg#endif 34906aec45a7Smrg#ifndef S_IXGRP 34916aec45a7Smrg# define S_IXGRP 0 34926aec45a7Smrg#endif 3493ab47cfaaSmrg 34946aec45a7Smrg/* path handling portability macros */ 34956aec45a7Smrg#ifndef DIR_SEPARATOR 34966aec45a7Smrg# define DIR_SEPARATOR '/' 34976aec45a7Smrg# define PATH_SEPARATOR ':' 34986aec45a7Smrg#endif 3499ab47cfaaSmrg 35006aec45a7Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 35016aec45a7Smrg defined (__OS2__) 35026aec45a7Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 35036aec45a7Smrg# define FOPEN_WB "wb" 35046aec45a7Smrg# ifndef DIR_SEPARATOR_2 35056aec45a7Smrg# define DIR_SEPARATOR_2 '\\' 35066aec45a7Smrg# endif 35076aec45a7Smrg# ifndef PATH_SEPARATOR_2 35086aec45a7Smrg# define PATH_SEPARATOR_2 ';' 35096aec45a7Smrg# endif 35106aec45a7Smrg#endif 3511ab47cfaaSmrg 35126aec45a7Smrg#ifndef DIR_SEPARATOR_2 35136aec45a7Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 35146aec45a7Smrg#else /* DIR_SEPARATOR_2 */ 35156aec45a7Smrg# define IS_DIR_SEPARATOR(ch) \ 35166aec45a7Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 35176aec45a7Smrg#endif /* DIR_SEPARATOR_2 */ 3518ab47cfaaSmrg 35196aec45a7Smrg#ifndef PATH_SEPARATOR_2 35206aec45a7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 35216aec45a7Smrg#else /* PATH_SEPARATOR_2 */ 35226aec45a7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 35236aec45a7Smrg#endif /* PATH_SEPARATOR_2 */ 35246aec45a7Smrg 35256aec45a7Smrg#ifndef FOPEN_WB 35266aec45a7Smrg# define FOPEN_WB "w" 35276aec45a7Smrg#endif 35286aec45a7Smrg#ifndef _O_BINARY 35296aec45a7Smrg# define _O_BINARY 0 35306aec45a7Smrg#endif 35316aec45a7Smrg 35326aec45a7Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 35336aec45a7Smrg#define XFREE(stale) do { \ 35346aec45a7Smrg if (stale) { free ((void *) stale); stale = 0; } \ 35356aec45a7Smrg} while (0) 35366aec45a7Smrg 35376aec45a7Smrg#if defined(LT_DEBUGWRAPPER) 35386aec45a7Smrgstatic int lt_debug = 1; 35396aec45a7Smrg#else 35406aec45a7Smrgstatic int lt_debug = 0; 35416aec45a7Smrg#endif 35426aec45a7Smrg 35436aec45a7Smrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 35446aec45a7Smrg 35456aec45a7Smrgvoid *xmalloc (size_t num); 35466aec45a7Smrgchar *xstrdup (const char *string); 35476aec45a7Smrgconst char *base_name (const char *name); 35486aec45a7Smrgchar *find_executable (const char *wrapper); 35496aec45a7Smrgchar *chase_symlinks (const char *pathspec); 35506aec45a7Smrgint make_executable (const char *path); 35516aec45a7Smrgint check_executable (const char *path); 35526aec45a7Smrgchar *strendzap (char *str, const char *pat); 35536aec45a7Smrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 35546aec45a7Smrgvoid lt_fatal (const char *file, int line, const char *message, ...); 35556aec45a7Smrgstatic const char *nonnull (const char *s); 35566aec45a7Smrgstatic const char *nonempty (const char *s); 35576aec45a7Smrgvoid lt_setenv (const char *name, const char *value); 35586aec45a7Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 35596aec45a7Smrgvoid lt_update_exe_path (const char *name, const char *value); 35606aec45a7Smrgvoid lt_update_lib_path (const char *name, const char *value); 35616aec45a7Smrgchar **prepare_spawn (char **argv); 35626aec45a7Smrgvoid lt_dump_script (FILE *f); 35636aec45a7SmrgEOF 35646aec45a7Smrg 35656aec45a7Smrg cat <<EOF 35666aec45a7Smrgconst char * MAGIC_EXE = "$magic_exe"; 35676aec45a7Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 35686aec45a7SmrgEOF 35696aec45a7Smrg 35706aec45a7Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 35716aec45a7Smrg func_to_host_pathlist "$temp_rpath" 35726aec45a7Smrg cat <<EOF 35736aec45a7Smrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 35745c42550eSmrgEOF 35755c42550eSmrg else 35766aec45a7Smrg cat <<"EOF" 35776aec45a7Smrgconst char * LIB_PATH_VALUE = ""; 35786aec45a7SmrgEOF 35795c42550eSmrg fi 35806aec45a7Smrg 35816aec45a7Smrg if test -n "$dllsearchpath"; then 35826aec45a7Smrg func_to_host_pathlist "$dllsearchpath:" 35836aec45a7Smrg cat <<EOF 35846aec45a7Smrgconst char * EXE_PATH_VARNAME = "PATH"; 35856aec45a7Smrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 35866aec45a7SmrgEOF 35875c42550eSmrg else 35886aec45a7Smrg cat <<"EOF" 35896aec45a7Smrgconst char * EXE_PATH_VARNAME = ""; 35906aec45a7Smrgconst char * EXE_PATH_VALUE = ""; 35916aec45a7SmrgEOF 35925c42550eSmrg fi 35936aec45a7Smrg 35946aec45a7Smrg if test "$fast_install" = yes; then 35956aec45a7Smrg cat <<EOF 35966aec45a7Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 35976aec45a7SmrgEOF 35985c42550eSmrg else 35996aec45a7Smrg cat <<EOF 36006aec45a7Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 36016aec45a7SmrgEOF 36025c42550eSmrg fi 3603ab47cfaaSmrg 3604ab47cfaaSmrg 36056aec45a7Smrg cat <<"EOF" 3606ab47cfaaSmrg 36076aec45a7Smrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 3608ab47cfaaSmrg 36096aec45a7Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 36106aec45a7Smrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 36116aec45a7Smrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 3612ab47cfaaSmrg 36136aec45a7Smrgint 36146aec45a7Smrgmain (int argc, char *argv[]) 36156aec45a7Smrg{ 36166aec45a7Smrg char **newargz; 36176aec45a7Smrg int newargc; 36186aec45a7Smrg char *tmp_pathspec; 36196aec45a7Smrg char *actual_cwrapper_path; 36206aec45a7Smrg char *actual_cwrapper_name; 36216aec45a7Smrg char *target_name; 36226aec45a7Smrg char *lt_argv_zero; 36236aec45a7Smrg intptr_t rval = 127; 3624ab47cfaaSmrg 36256aec45a7Smrg int i; 3626ab47cfaaSmrg 36276aec45a7Smrg program_name = (char *) xstrdup (base_name (argv[0])); 36286aec45a7Smrg newargz = XMALLOC (char *, argc + 1); 3629ab47cfaaSmrg 36306aec45a7Smrg /* very simple arg parsing; don't want to rely on getopt 36316aec45a7Smrg * also, copy all non cwrapper options to newargz, except 36326aec45a7Smrg * argz[0], which is handled differently 36336aec45a7Smrg */ 36346aec45a7Smrg newargc=0; 36356aec45a7Smrg for (i = 1; i < argc; i++) 36366aec45a7Smrg { 36376aec45a7Smrg if (strcmp (argv[i], dumpscript_opt) == 0) 36386aec45a7Smrg { 36396aec45a7SmrgEOF 36406aec45a7Smrg case "$host" in 36416aec45a7Smrg *mingw* | *cygwin* ) 36426aec45a7Smrg # make stdout use "unix" line endings 36436aec45a7Smrg echo " setmode(1,_O_BINARY);" 36446aec45a7Smrg ;; 36455c42550eSmrg esac 3646ab47cfaaSmrg 36476aec45a7Smrg cat <<"EOF" 36486aec45a7Smrg lt_dump_script (stdout); 36496aec45a7Smrg return 0; 36506aec45a7Smrg } 36516aec45a7Smrg if (strcmp (argv[i], debug_opt) == 0) 36526aec45a7Smrg { 36536aec45a7Smrg lt_debug = 1; 36546aec45a7Smrg continue; 36556aec45a7Smrg } 36566aec45a7Smrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 36576aec45a7Smrg { 36586aec45a7Smrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 36596aec45a7Smrg namespace, but it is not one of the ones we know about and 36606aec45a7Smrg have already dealt with, above (inluding dump-script), then 36616aec45a7Smrg report an error. Otherwise, targets might begin to believe 36626aec45a7Smrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 36636aec45a7Smrg namespace. The first time any user complains about this, we'll 36646aec45a7Smrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 36656aec45a7Smrg or a configure.ac-settable value. 36666aec45a7Smrg */ 36676aec45a7Smrg lt_fatal (__FILE__, __LINE__, 36686aec45a7Smrg "unrecognized %s option: '%s'", 36696aec45a7Smrg ltwrapper_option_prefix, argv[i]); 36706aec45a7Smrg } 36716aec45a7Smrg /* otherwise ... */ 36726aec45a7Smrg newargz[++newargc] = xstrdup (argv[i]); 36736aec45a7Smrg } 36746aec45a7Smrg newargz[++newargc] = NULL; 3675ab47cfaaSmrg 36766aec45a7SmrgEOF 36776aec45a7Smrg cat <<EOF 36786aec45a7Smrg /* The GNU banner must be the first non-error debug message */ 36796aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 36806aec45a7SmrgEOF 36816aec45a7Smrg cat <<"EOF" 36826aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 36836aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 36846aec45a7Smrg 36856aec45a7Smrg tmp_pathspec = find_executable (argv[0]); 36866aec45a7Smrg if (tmp_pathspec == NULL) 36876aec45a7Smrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 36886aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 36896aec45a7Smrg "(main) found exe (before symlink chase) at: %s\n", 36906aec45a7Smrg tmp_pathspec); 36916aec45a7Smrg 36926aec45a7Smrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 36936aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 36946aec45a7Smrg "(main) found exe (after symlink chase) at: %s\n", 36956aec45a7Smrg actual_cwrapper_path); 36966aec45a7Smrg XFREE (tmp_pathspec); 36976aec45a7Smrg 36986aec45a7Smrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 36996aec45a7Smrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 37006aec45a7Smrg 37016aec45a7Smrg /* wrapper name transforms */ 37026aec45a7Smrg strendzap (actual_cwrapper_name, ".exe"); 37036aec45a7Smrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 37046aec45a7Smrg XFREE (actual_cwrapper_name); 37056aec45a7Smrg actual_cwrapper_name = tmp_pathspec; 37066aec45a7Smrg tmp_pathspec = 0; 37076aec45a7Smrg 37086aec45a7Smrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 37096aec45a7Smrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 37106aec45a7Smrg strendzap (target_name, ".exe"); 37116aec45a7Smrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 37126aec45a7Smrg XFREE (target_name); 37136aec45a7Smrg target_name = tmp_pathspec; 37146aec45a7Smrg tmp_pathspec = 0; 37156aec45a7Smrg 37166aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 37176aec45a7Smrg "(main) libtool target name: %s\n", 37186aec45a7Smrg target_name); 37196aec45a7SmrgEOF 3720ab47cfaaSmrg 37216aec45a7Smrg cat <<EOF 37226aec45a7Smrg newargz[0] = 37236aec45a7Smrg XMALLOC (char, (strlen (actual_cwrapper_path) + 37246aec45a7Smrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 37256aec45a7Smrg strcpy (newargz[0], actual_cwrapper_path); 37266aec45a7Smrg strcat (newargz[0], "$objdir"); 37276aec45a7Smrg strcat (newargz[0], "/"); 37286aec45a7SmrgEOF 3729ab47cfaaSmrg 37306aec45a7Smrg cat <<"EOF" 37316aec45a7Smrg /* stop here, and copy so we don't have to do this twice */ 37326aec45a7Smrg tmp_pathspec = xstrdup (newargz[0]); 3733ab47cfaaSmrg 37346aec45a7Smrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 37356aec45a7Smrg strcat (newargz[0], actual_cwrapper_name); 3736ab47cfaaSmrg 37376aec45a7Smrg /* DO want the lt- prefix here if it exists, so use target_name */ 37386aec45a7Smrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 37396aec45a7Smrg XFREE (tmp_pathspec); 37406aec45a7Smrg tmp_pathspec = NULL; 37416aec45a7SmrgEOF 3742ab47cfaaSmrg 37436aec45a7Smrg case $host_os in 37446aec45a7Smrg mingw*) 37456aec45a7Smrg cat <<"EOF" 37466aec45a7Smrg { 37476aec45a7Smrg char* p; 37486aec45a7Smrg while ((p = strchr (newargz[0], '\\')) != NULL) 37496aec45a7Smrg { 37506aec45a7Smrg *p = '/'; 37516aec45a7Smrg } 37526aec45a7Smrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 37536aec45a7Smrg { 37546aec45a7Smrg *p = '/'; 37556aec45a7Smrg } 37566aec45a7Smrg } 37576aec45a7SmrgEOF 37586aec45a7Smrg ;; 37596aec45a7Smrg esac 3760ab47cfaaSmrg 37616aec45a7Smrg cat <<"EOF" 37626aec45a7Smrg XFREE (target_name); 37636aec45a7Smrg XFREE (actual_cwrapper_path); 37646aec45a7Smrg XFREE (actual_cwrapper_name); 3765ab47cfaaSmrg 37666aec45a7Smrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 37676aec45a7Smrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 37686aec45a7Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 37696aec45a7Smrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3770ab47cfaaSmrg 37716aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 37726aec45a7Smrg nonnull (lt_argv_zero)); 37736aec45a7Smrg for (i = 0; i < newargc; i++) 37746aec45a7Smrg { 37756aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 37766aec45a7Smrg i, nonnull (newargz[i])); 37776aec45a7Smrg } 3778ab47cfaaSmrg 37796aec45a7SmrgEOF 3780ab47cfaaSmrg 37816aec45a7Smrg case $host_os in 37826aec45a7Smrg mingw*) 37836aec45a7Smrg cat <<"EOF" 37846aec45a7Smrg /* execv doesn't actually work on mingw as expected on unix */ 37856aec45a7Smrg newargz = prepare_spawn (newargz); 37866aec45a7Smrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 37876aec45a7Smrg if (rval == -1) 37886aec45a7Smrg { 37896aec45a7Smrg /* failed to start process */ 37906aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 37916aec45a7Smrg "(main) failed to launch target \"%s\": %s\n", 37926aec45a7Smrg lt_argv_zero, nonnull (strerror (errno))); 37936aec45a7Smrg return 127; 37946aec45a7Smrg } 37956aec45a7Smrg return rval; 37966aec45a7SmrgEOF 37976aec45a7Smrg ;; 37986aec45a7Smrg *) 37996aec45a7Smrg cat <<"EOF" 38006aec45a7Smrg execv (lt_argv_zero, newargz); 38016aec45a7Smrg return rval; /* =127, but avoids unused variable warning */ 38026aec45a7SmrgEOF 38036aec45a7Smrg ;; 38046aec45a7Smrg esac 3805ab47cfaaSmrg 38066aec45a7Smrg cat <<"EOF" 38076aec45a7Smrg} 3808ab47cfaaSmrg 38096aec45a7Smrgvoid * 38106aec45a7Smrgxmalloc (size_t num) 38116aec45a7Smrg{ 38126aec45a7Smrg void *p = (void *) malloc (num); 38136aec45a7Smrg if (!p) 38146aec45a7Smrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 3815ab47cfaaSmrg 38166aec45a7Smrg return p; 38176aec45a7Smrg} 3818ab47cfaaSmrg 38196aec45a7Smrgchar * 38206aec45a7Smrgxstrdup (const char *string) 38216aec45a7Smrg{ 38226aec45a7Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 38236aec45a7Smrg string) : NULL; 38246aec45a7Smrg} 3825ab47cfaaSmrg 38266aec45a7Smrgconst char * 38276aec45a7Smrgbase_name (const char *name) 38286aec45a7Smrg{ 38296aec45a7Smrg const char *base; 3830ab47cfaaSmrg 38316aec45a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 38326aec45a7Smrg /* Skip over the disk name in MSDOS pathnames. */ 38336aec45a7Smrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 38346aec45a7Smrg name += 2; 38356aec45a7Smrg#endif 3836ab47cfaaSmrg 38376aec45a7Smrg for (base = name; *name; name++) 38386aec45a7Smrg if (IS_DIR_SEPARATOR (*name)) 38396aec45a7Smrg base = name + 1; 38406aec45a7Smrg return base; 38416aec45a7Smrg} 3842ab47cfaaSmrg 38436aec45a7Smrgint 38446aec45a7Smrgcheck_executable (const char *path) 38456aec45a7Smrg{ 38466aec45a7Smrg struct stat st; 3847ab47cfaaSmrg 38486aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 38496aec45a7Smrg nonempty (path)); 38506aec45a7Smrg if ((!path) || (!*path)) 38516aec45a7Smrg return 0; 3852ab47cfaaSmrg 38536aec45a7Smrg if ((stat (path, &st) >= 0) 38546aec45a7Smrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 38556aec45a7Smrg return 1; 38566aec45a7Smrg else 38576aec45a7Smrg return 0; 38586aec45a7Smrg} 3859ab47cfaaSmrg 38606aec45a7Smrgint 38616aec45a7Smrgmake_executable (const char *path) 38626aec45a7Smrg{ 38636aec45a7Smrg int rval = 0; 38646aec45a7Smrg struct stat st; 38655c42550eSmrg 38666aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 38676aec45a7Smrg nonempty (path)); 38686aec45a7Smrg if ((!path) || (!*path)) 38696aec45a7Smrg return 0; 38705c42550eSmrg 38716aec45a7Smrg if (stat (path, &st) >= 0) 38726aec45a7Smrg { 38736aec45a7Smrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 38746aec45a7Smrg } 38756aec45a7Smrg return rval; 38766aec45a7Smrg} 38775c42550eSmrg 38786aec45a7Smrg/* Searches for the full path of the wrapper. Returns 38796aec45a7Smrg newly allocated full path name if found, NULL otherwise 38806aec45a7Smrg Does not chase symlinks, even on platforms that support them. 38816aec45a7Smrg*/ 38826aec45a7Smrgchar * 38836aec45a7Smrgfind_executable (const char *wrapper) 38846aec45a7Smrg{ 38856aec45a7Smrg int has_slash = 0; 38866aec45a7Smrg const char *p; 38876aec45a7Smrg const char *p_next; 38886aec45a7Smrg /* static buffer for getcwd */ 38896aec45a7Smrg char tmp[LT_PATHMAX + 1]; 38906aec45a7Smrg int tmp_len; 38916aec45a7Smrg char *concat_name; 38925c42550eSmrg 38936aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 38946aec45a7Smrg nonempty (wrapper)); 38955c42550eSmrg 38966aec45a7Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 38976aec45a7Smrg return NULL; 3898ab47cfaaSmrg 38996aec45a7Smrg /* Absolute path? */ 39006aec45a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 39016aec45a7Smrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 39026aec45a7Smrg { 39036aec45a7Smrg concat_name = xstrdup (wrapper); 39046aec45a7Smrg if (check_executable (concat_name)) 39056aec45a7Smrg return concat_name; 39066aec45a7Smrg XFREE (concat_name); 39076aec45a7Smrg } 39086aec45a7Smrg else 39096aec45a7Smrg { 39106aec45a7Smrg#endif 39116aec45a7Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 39126aec45a7Smrg { 39136aec45a7Smrg concat_name = xstrdup (wrapper); 39146aec45a7Smrg if (check_executable (concat_name)) 39156aec45a7Smrg return concat_name; 39166aec45a7Smrg XFREE (concat_name); 39176aec45a7Smrg } 39186aec45a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 39196aec45a7Smrg } 39206aec45a7Smrg#endif 3921ab47cfaaSmrg 39226aec45a7Smrg for (p = wrapper; *p; p++) 39236aec45a7Smrg if (*p == '/') 39246aec45a7Smrg { 39256aec45a7Smrg has_slash = 1; 39266aec45a7Smrg break; 39276aec45a7Smrg } 39286aec45a7Smrg if (!has_slash) 39296aec45a7Smrg { 39306aec45a7Smrg /* no slashes; search PATH */ 39316aec45a7Smrg const char *path = getenv ("PATH"); 39326aec45a7Smrg if (path != NULL) 39336aec45a7Smrg { 39346aec45a7Smrg for (p = path; *p; p = p_next) 39356aec45a7Smrg { 39366aec45a7Smrg const char *q; 39376aec45a7Smrg size_t p_len; 39386aec45a7Smrg for (q = p; *q; q++) 39396aec45a7Smrg if (IS_PATH_SEPARATOR (*q)) 39406aec45a7Smrg break; 39416aec45a7Smrg p_len = q - p; 39426aec45a7Smrg p_next = (*q == '\0' ? q : q + 1); 39436aec45a7Smrg if (p_len == 0) 39446aec45a7Smrg { 39456aec45a7Smrg /* empty path: current directory */ 39466aec45a7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 39476aec45a7Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 39486aec45a7Smrg nonnull (strerror (errno))); 39496aec45a7Smrg tmp_len = strlen (tmp); 39506aec45a7Smrg concat_name = 39516aec45a7Smrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 39526aec45a7Smrg memcpy (concat_name, tmp, tmp_len); 39536aec45a7Smrg concat_name[tmp_len] = '/'; 39546aec45a7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 39556aec45a7Smrg } 39566aec45a7Smrg else 39576aec45a7Smrg { 39586aec45a7Smrg concat_name = 39596aec45a7Smrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 39606aec45a7Smrg memcpy (concat_name, p, p_len); 39616aec45a7Smrg concat_name[p_len] = '/'; 39626aec45a7Smrg strcpy (concat_name + p_len + 1, wrapper); 39636aec45a7Smrg } 39646aec45a7Smrg if (check_executable (concat_name)) 39656aec45a7Smrg return concat_name; 39666aec45a7Smrg XFREE (concat_name); 39676aec45a7Smrg } 39686aec45a7Smrg } 39696aec45a7Smrg /* not found in PATH; assume curdir */ 39706aec45a7Smrg } 39716aec45a7Smrg /* Relative path | not found in path: prepend cwd */ 39726aec45a7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 39736aec45a7Smrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 39746aec45a7Smrg nonnull (strerror (errno))); 39756aec45a7Smrg tmp_len = strlen (tmp); 39766aec45a7Smrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 39776aec45a7Smrg memcpy (concat_name, tmp, tmp_len); 39786aec45a7Smrg concat_name[tmp_len] = '/'; 39796aec45a7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 3980ab47cfaaSmrg 39816aec45a7Smrg if (check_executable (concat_name)) 39826aec45a7Smrg return concat_name; 39836aec45a7Smrg XFREE (concat_name); 39846aec45a7Smrg return NULL; 39856aec45a7Smrg} 39865c42550eSmrg 39876aec45a7Smrgchar * 39886aec45a7Smrgchase_symlinks (const char *pathspec) 39896aec45a7Smrg{ 39906aec45a7Smrg#ifndef S_ISLNK 39916aec45a7Smrg return xstrdup (pathspec); 39926aec45a7Smrg#else 39936aec45a7Smrg char buf[LT_PATHMAX]; 39946aec45a7Smrg struct stat s; 39956aec45a7Smrg char *tmp_pathspec = xstrdup (pathspec); 39966aec45a7Smrg char *p; 39976aec45a7Smrg int has_symlinks = 0; 39986aec45a7Smrg while (strlen (tmp_pathspec) && !has_symlinks) 39996aec45a7Smrg { 40006aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 40016aec45a7Smrg "checking path component for symlinks: %s\n", 40026aec45a7Smrg tmp_pathspec); 40036aec45a7Smrg if (lstat (tmp_pathspec, &s) == 0) 40046aec45a7Smrg { 40056aec45a7Smrg if (S_ISLNK (s.st_mode) != 0) 40066aec45a7Smrg { 40076aec45a7Smrg has_symlinks = 1; 40086aec45a7Smrg break; 40096aec45a7Smrg } 40105c42550eSmrg 40116aec45a7Smrg /* search backwards for last DIR_SEPARATOR */ 40126aec45a7Smrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 40136aec45a7Smrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 40146aec45a7Smrg p--; 40156aec45a7Smrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 40166aec45a7Smrg { 40176aec45a7Smrg /* no more DIR_SEPARATORS left */ 40186aec45a7Smrg break; 40196aec45a7Smrg } 40206aec45a7Smrg *p = '\0'; 40216aec45a7Smrg } 40226aec45a7Smrg else 40236aec45a7Smrg { 40246aec45a7Smrg lt_fatal (__FILE__, __LINE__, 40256aec45a7Smrg "error accessing file \"%s\": %s", 40266aec45a7Smrg tmp_pathspec, nonnull (strerror (errno))); 40276aec45a7Smrg } 40286aec45a7Smrg } 40296aec45a7Smrg XFREE (tmp_pathspec); 40305c42550eSmrg 40316aec45a7Smrg if (!has_symlinks) 40326aec45a7Smrg { 40336aec45a7Smrg return xstrdup (pathspec); 40346aec45a7Smrg } 40355c42550eSmrg 40366aec45a7Smrg tmp_pathspec = realpath (pathspec, buf); 40376aec45a7Smrg if (tmp_pathspec == 0) 40386aec45a7Smrg { 40396aec45a7Smrg lt_fatal (__FILE__, __LINE__, 40406aec45a7Smrg "could not follow symlinks for %s", pathspec); 40416aec45a7Smrg } 40426aec45a7Smrg return xstrdup (tmp_pathspec); 40436aec45a7Smrg#endif 40446aec45a7Smrg} 4045ab47cfaaSmrg 40466aec45a7Smrgchar * 40476aec45a7Smrgstrendzap (char *str, const char *pat) 40486aec45a7Smrg{ 40496aec45a7Smrg size_t len, patlen; 4050ab47cfaaSmrg 40516aec45a7Smrg assert (str != NULL); 40526aec45a7Smrg assert (pat != NULL); 4053ab47cfaaSmrg 40546aec45a7Smrg len = strlen (str); 40556aec45a7Smrg patlen = strlen (pat); 4056ab47cfaaSmrg 40576aec45a7Smrg if (patlen <= len) 40586aec45a7Smrg { 40596aec45a7Smrg str += len - patlen; 40606aec45a7Smrg if (strcmp (str, pat) == 0) 40616aec45a7Smrg *str = '\0'; 40626aec45a7Smrg } 40636aec45a7Smrg return str; 40646aec45a7Smrg} 4065ab47cfaaSmrg 40666aec45a7Smrgvoid 40676aec45a7Smrglt_debugprintf (const char *file, int line, const char *fmt, ...) 40686aec45a7Smrg{ 40696aec45a7Smrg va_list args; 40706aec45a7Smrg if (lt_debug) 40716aec45a7Smrg { 40726aec45a7Smrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 40736aec45a7Smrg va_start (args, fmt); 40746aec45a7Smrg (void) vfprintf (stderr, fmt, args); 40756aec45a7Smrg va_end (args); 40766aec45a7Smrg } 40776aec45a7Smrg} 4078ab47cfaaSmrg 40796aec45a7Smrgstatic void 40806aec45a7Smrglt_error_core (int exit_status, const char *file, 40816aec45a7Smrg int line, const char *mode, 40826aec45a7Smrg const char *message, va_list ap) 40836aec45a7Smrg{ 40846aec45a7Smrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 40856aec45a7Smrg vfprintf (stderr, message, ap); 40866aec45a7Smrg fprintf (stderr, ".\n"); 4087ab47cfaaSmrg 40886aec45a7Smrg if (exit_status >= 0) 40896aec45a7Smrg exit (exit_status); 40906aec45a7Smrg} 4091ab47cfaaSmrg 40926aec45a7Smrgvoid 40936aec45a7Smrglt_fatal (const char *file, int line, const char *message, ...) 40946aec45a7Smrg{ 40956aec45a7Smrg va_list ap; 40966aec45a7Smrg va_start (ap, message); 40976aec45a7Smrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 40986aec45a7Smrg va_end (ap); 40996aec45a7Smrg} 4100ab47cfaaSmrg 41016aec45a7Smrgstatic const char * 41026aec45a7Smrgnonnull (const char *s) 41036aec45a7Smrg{ 41046aec45a7Smrg return s ? s : "(null)"; 41056aec45a7Smrg} 4106ab47cfaaSmrg 41076aec45a7Smrgstatic const char * 41086aec45a7Smrgnonempty (const char *s) 41096aec45a7Smrg{ 41106aec45a7Smrg return (s && !*s) ? "(empty)" : nonnull (s); 41116aec45a7Smrg} 4112ab47cfaaSmrg 41136aec45a7Smrgvoid 41146aec45a7Smrglt_setenv (const char *name, const char *value) 41156aec45a7Smrg{ 41166aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 41176aec45a7Smrg "(lt_setenv) setting '%s' to '%s'\n", 41186aec45a7Smrg nonnull (name), nonnull (value)); 41196aec45a7Smrg { 41206aec45a7Smrg#ifdef HAVE_SETENV 41216aec45a7Smrg /* always make a copy, for consistency with !HAVE_SETENV */ 41226aec45a7Smrg char *str = xstrdup (value); 41236aec45a7Smrg setenv (name, str, 1); 41246aec45a7Smrg#else 41256aec45a7Smrg int len = strlen (name) + 1 + strlen (value) + 1; 41266aec45a7Smrg char *str = XMALLOC (char, len); 41276aec45a7Smrg sprintf (str, "%s=%s", name, value); 41286aec45a7Smrg if (putenv (str) != EXIT_SUCCESS) 41296aec45a7Smrg { 41306aec45a7Smrg XFREE (str); 41316aec45a7Smrg } 41326aec45a7Smrg#endif 41336aec45a7Smrg } 41346aec45a7Smrg} 4135ab47cfaaSmrg 41366aec45a7Smrgchar * 41376aec45a7Smrglt_extend_str (const char *orig_value, const char *add, int to_end) 41386aec45a7Smrg{ 41396aec45a7Smrg char *new_value; 41406aec45a7Smrg if (orig_value && *orig_value) 41416aec45a7Smrg { 41426aec45a7Smrg int orig_value_len = strlen (orig_value); 41436aec45a7Smrg int add_len = strlen (add); 41446aec45a7Smrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 41456aec45a7Smrg if (to_end) 41466aec45a7Smrg { 41476aec45a7Smrg strcpy (new_value, orig_value); 41486aec45a7Smrg strcpy (new_value + orig_value_len, add); 41496aec45a7Smrg } 41506aec45a7Smrg else 41516aec45a7Smrg { 41526aec45a7Smrg strcpy (new_value, add); 41536aec45a7Smrg strcpy (new_value + add_len, orig_value); 41546aec45a7Smrg } 41556aec45a7Smrg } 41566aec45a7Smrg else 41576aec45a7Smrg { 41586aec45a7Smrg new_value = xstrdup (add); 41596aec45a7Smrg } 41606aec45a7Smrg return new_value; 41616aec45a7Smrg} 4162ab47cfaaSmrg 41636aec45a7Smrgvoid 41646aec45a7Smrglt_update_exe_path (const char *name, const char *value) 41656aec45a7Smrg{ 41666aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 41676aec45a7Smrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 41686aec45a7Smrg nonnull (name), nonnull (value)); 4169ab47cfaaSmrg 41706aec45a7Smrg if (name && *name && value && *value) 41716aec45a7Smrg { 41726aec45a7Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 41736aec45a7Smrg /* some systems can't cope with a ':'-terminated path #' */ 41746aec45a7Smrg int len = strlen (new_value); 41756aec45a7Smrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 41766aec45a7Smrg { 41776aec45a7Smrg new_value[len-1] = '\0'; 41786aec45a7Smrg } 41796aec45a7Smrg lt_setenv (name, new_value); 41806aec45a7Smrg XFREE (new_value); 41816aec45a7Smrg } 41826aec45a7Smrg} 4183ab47cfaaSmrg 41846aec45a7Smrgvoid 41856aec45a7Smrglt_update_lib_path (const char *name, const char *value) 41866aec45a7Smrg{ 41876aec45a7Smrg lt_debugprintf (__FILE__, __LINE__, 41886aec45a7Smrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 41896aec45a7Smrg nonnull (name), nonnull (value)); 4190ab47cfaaSmrg 41916aec45a7Smrg if (name && *name && value && *value) 41926aec45a7Smrg { 41936aec45a7Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 41946aec45a7Smrg lt_setenv (name, new_value); 41956aec45a7Smrg XFREE (new_value); 41966aec45a7Smrg } 41976aec45a7Smrg} 4198ab47cfaaSmrg 41996aec45a7SmrgEOF 42006aec45a7Smrg case $host_os in 42016aec45a7Smrg mingw*) 42026aec45a7Smrg cat <<"EOF" 42036aec45a7Smrg 42046aec45a7Smrg/* Prepares an argument vector before calling spawn(). 42056aec45a7Smrg Note that spawn() does not by itself call the command interpreter 42066aec45a7Smrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 42076aec45a7Smrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 42086aec45a7Smrg GetVersionEx(&v); 42096aec45a7Smrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 42106aec45a7Smrg }) ? "cmd.exe" : "command.com"). 42116aec45a7Smrg Instead it simply concatenates the arguments, separated by ' ', and calls 42126aec45a7Smrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 42136aec45a7Smrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 42146aec45a7Smrg special way: 42156aec45a7Smrg - Space and tab are interpreted as delimiters. They are not treated as 42166aec45a7Smrg delimiters if they are surrounded by double quotes: "...". 42176aec45a7Smrg - Unescaped double quotes are removed from the input. Their only effect is 42186aec45a7Smrg that within double quotes, space and tab are treated like normal 42196aec45a7Smrg characters. 42206aec45a7Smrg - Backslashes not followed by double quotes are not special. 42216aec45a7Smrg - But 2*n+1 backslashes followed by a double quote become 42226aec45a7Smrg n backslashes followed by a double quote (n >= 0): 42236aec45a7Smrg \" -> " 42246aec45a7Smrg \\\" -> \" 42256aec45a7Smrg \\\\\" -> \\" 42266aec45a7Smrg */ 42276aec45a7Smrg#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" 42286aec45a7Smrg#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" 42296aec45a7Smrgchar ** 42306aec45a7Smrgprepare_spawn (char **argv) 42316aec45a7Smrg{ 42326aec45a7Smrg size_t argc; 42336aec45a7Smrg char **new_argv; 42346aec45a7Smrg size_t i; 4235ab47cfaaSmrg 42366aec45a7Smrg /* Count number of arguments. */ 42376aec45a7Smrg for (argc = 0; argv[argc] != NULL; argc++) 42386aec45a7Smrg ; 4239ab47cfaaSmrg 42406aec45a7Smrg /* Allocate new argument vector. */ 42416aec45a7Smrg new_argv = XMALLOC (char *, argc + 1); 4242ab47cfaaSmrg 42436aec45a7Smrg /* Put quoted arguments into the new argument vector. */ 42446aec45a7Smrg for (i = 0; i < argc; i++) 42456aec45a7Smrg { 42466aec45a7Smrg const char *string = argv[i]; 42476aec45a7Smrg 42486aec45a7Smrg if (string[0] == '\0') 42496aec45a7Smrg new_argv[i] = xstrdup ("\"\""); 42506aec45a7Smrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 42516aec45a7Smrg { 42526aec45a7Smrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 42536aec45a7Smrg size_t length; 42546aec45a7Smrg unsigned int backslashes; 42556aec45a7Smrg const char *s; 42566aec45a7Smrg char *quoted_string; 42576aec45a7Smrg char *p; 42586aec45a7Smrg 42596aec45a7Smrg length = 0; 42606aec45a7Smrg backslashes = 0; 42616aec45a7Smrg if (quote_around) 42626aec45a7Smrg length++; 42636aec45a7Smrg for (s = string; *s != '\0'; s++) 42646aec45a7Smrg { 42656aec45a7Smrg char c = *s; 42666aec45a7Smrg if (c == '"') 42676aec45a7Smrg length += backslashes + 1; 42686aec45a7Smrg length++; 42696aec45a7Smrg if (c == '\\') 42706aec45a7Smrg backslashes++; 42716aec45a7Smrg else 42726aec45a7Smrg backslashes = 0; 42736aec45a7Smrg } 42746aec45a7Smrg if (quote_around) 42756aec45a7Smrg length += backslashes + 1; 42766aec45a7Smrg 42776aec45a7Smrg quoted_string = XMALLOC (char, length + 1); 42786aec45a7Smrg 42796aec45a7Smrg p = quoted_string; 42806aec45a7Smrg backslashes = 0; 42816aec45a7Smrg if (quote_around) 42826aec45a7Smrg *p++ = '"'; 42836aec45a7Smrg for (s = string; *s != '\0'; s++) 42846aec45a7Smrg { 42856aec45a7Smrg char c = *s; 42866aec45a7Smrg if (c == '"') 42876aec45a7Smrg { 42886aec45a7Smrg unsigned int j; 42896aec45a7Smrg for (j = backslashes + 1; j > 0; j--) 42906aec45a7Smrg *p++ = '\\'; 42916aec45a7Smrg } 42926aec45a7Smrg *p++ = c; 42936aec45a7Smrg if (c == '\\') 42946aec45a7Smrg backslashes++; 42956aec45a7Smrg else 42966aec45a7Smrg backslashes = 0; 42976aec45a7Smrg } 42986aec45a7Smrg if (quote_around) 42996aec45a7Smrg { 43006aec45a7Smrg unsigned int j; 43016aec45a7Smrg for (j = backslashes; j > 0; j--) 43026aec45a7Smrg *p++ = '\\'; 43036aec45a7Smrg *p++ = '"'; 43046aec45a7Smrg } 43056aec45a7Smrg *p = '\0'; 4306ab47cfaaSmrg 43076aec45a7Smrg new_argv[i] = quoted_string; 43086aec45a7Smrg } 43096aec45a7Smrg else 43106aec45a7Smrg new_argv[i] = (char *) string; 43116aec45a7Smrg } 43126aec45a7Smrg new_argv[argc] = NULL; 4313ab47cfaaSmrg 43146aec45a7Smrg return new_argv; 43156aec45a7Smrg} 43166aec45a7SmrgEOF 43175c42550eSmrg ;; 43186aec45a7Smrg esac 4319ab47cfaaSmrg 43206aec45a7Smrg cat <<"EOF" 43216aec45a7Smrgvoid lt_dump_script (FILE* f) 43226aec45a7Smrg{ 43236aec45a7SmrgEOF 43246aec45a7Smrg func_emit_wrapper yes | 43256aec45a7Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 43266aec45a7Smrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 4327ab47cfaaSmrg 43286aec45a7Smrg cat <<"EOF" 43296aec45a7Smrg} 43306aec45a7SmrgEOF 43316aec45a7Smrg} 43326aec45a7Smrg# end: func_emit_cwrapperexe_src 4333ab47cfaaSmrg 43346aec45a7Smrg# func_win32_import_lib_p ARG 43356aec45a7Smrg# True if ARG is an import lib, as indicated by $file_magic_cmd 43366aec45a7Smrgfunc_win32_import_lib_p () 43376aec45a7Smrg{ 43386aec45a7Smrg $opt_debug 43396aec45a7Smrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 43406aec45a7Smrg *import*) : ;; 43416aec45a7Smrg *) false ;; 43426aec45a7Smrg esac 43436aec45a7Smrg} 4344ab47cfaaSmrg 43456aec45a7Smrg# func_mode_link arg... 43466aec45a7Smrgfunc_mode_link () 43476aec45a7Smrg{ 43486aec45a7Smrg $opt_debug 43496aec45a7Smrg case $host in 43506aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 43516aec45a7Smrg # It is impossible to link a dll without this setting, and 43526aec45a7Smrg # we shouldn't force the makefile maintainer to figure out 43536aec45a7Smrg # which system we are compiling for in order to pass an extra 43546aec45a7Smrg # flag for every libtool invocation. 43556aec45a7Smrg # allow_undefined=no 4356ab47cfaaSmrg 43576aec45a7Smrg # FIXME: Unfortunately, there are problems with the above when trying 43586aec45a7Smrg # to make a dll which has undefined symbols, in which case not 43596aec45a7Smrg # even a static library is built. For now, we need to specify 43606aec45a7Smrg # -no-undefined on the libtool link line when we can be certain 43616aec45a7Smrg # that all symbols are satisfied, otherwise we get a static library. 43626aec45a7Smrg allow_undefined=yes 43636aec45a7Smrg ;; 43646aec45a7Smrg *) 43656aec45a7Smrg allow_undefined=yes 43666aec45a7Smrg ;; 43676aec45a7Smrg esac 43686aec45a7Smrg libtool_args=$nonopt 43696aec45a7Smrg base_compile="$nonopt $@" 43706aec45a7Smrg compile_command=$nonopt 43716aec45a7Smrg finalize_command=$nonopt 4372ab47cfaaSmrg 43736aec45a7Smrg compile_rpath= 43746aec45a7Smrg finalize_rpath= 43756aec45a7Smrg compile_shlibpath= 43766aec45a7Smrg finalize_shlibpath= 43776aec45a7Smrg convenience= 43786aec45a7Smrg old_convenience= 43796aec45a7Smrg deplibs= 43806aec45a7Smrg old_deplibs= 43816aec45a7Smrg compiler_flags= 43826aec45a7Smrg linker_flags= 43836aec45a7Smrg dllsearchpath= 43846aec45a7Smrg lib_search_path=`pwd` 43856aec45a7Smrg inst_prefix_dir= 43866aec45a7Smrg new_inherited_linker_flags= 4387ab47cfaaSmrg 43886aec45a7Smrg avoid_version=no 43896aec45a7Smrg bindir= 43906aec45a7Smrg dlfiles= 43916aec45a7Smrg dlprefiles= 43926aec45a7Smrg dlself=no 43936aec45a7Smrg export_dynamic=no 43946aec45a7Smrg export_symbols= 43956aec45a7Smrg export_symbols_regex= 43966aec45a7Smrg generated= 43976aec45a7Smrg libobjs= 43986aec45a7Smrg ltlibs= 43996aec45a7Smrg module=no 44006aec45a7Smrg no_install=no 44016aec45a7Smrg objs= 44026aec45a7Smrg non_pic_objects= 44036aec45a7Smrg precious_files_regex= 44046aec45a7Smrg prefer_static_libs=no 44056aec45a7Smrg preload=no 44066aec45a7Smrg prev= 44076aec45a7Smrg prevarg= 44086aec45a7Smrg release= 44096aec45a7Smrg rpath= 44106aec45a7Smrg xrpath= 44116aec45a7Smrg perm_rpath= 44126aec45a7Smrg temp_rpath= 44136aec45a7Smrg thread_safe=no 44146aec45a7Smrg vinfo= 44156aec45a7Smrg vinfo_number=no 44166aec45a7Smrg weak_libs= 44176aec45a7Smrg single_module="${wl}-single_module" 44186aec45a7Smrg func_infer_tag $base_compile 4419ab47cfaaSmrg 44206aec45a7Smrg # We need to know -static, to get the right output filenames. 44216aec45a7Smrg for arg 44226aec45a7Smrg do 44236aec45a7Smrg case $arg in 44246aec45a7Smrg -shared) 44256aec45a7Smrg test "$build_libtool_libs" != yes && \ 44266aec45a7Smrg func_fatal_configuration "can not build a shared library" 44276aec45a7Smrg build_old_libs=no 44286aec45a7Smrg break 44296aec45a7Smrg ;; 44306aec45a7Smrg -all-static | -static | -static-libtool-libs) 44316aec45a7Smrg case $arg in 44326aec45a7Smrg -all-static) 44336aec45a7Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 44346aec45a7Smrg func_warning "complete static linking is impossible in this configuration" 44356aec45a7Smrg fi 44366aec45a7Smrg if test -n "$link_static_flag"; then 44376aec45a7Smrg dlopen_self=$dlopen_self_static 44386aec45a7Smrg fi 44396aec45a7Smrg prefer_static_libs=yes 44406aec45a7Smrg ;; 44416aec45a7Smrg -static) 44426aec45a7Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 44436aec45a7Smrg dlopen_self=$dlopen_self_static 44446aec45a7Smrg fi 44456aec45a7Smrg prefer_static_libs=built 44466aec45a7Smrg ;; 44476aec45a7Smrg -static-libtool-libs) 44486aec45a7Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 44496aec45a7Smrg dlopen_self=$dlopen_self_static 44506aec45a7Smrg fi 44516aec45a7Smrg prefer_static_libs=yes 44526aec45a7Smrg ;; 44536aec45a7Smrg esac 44546aec45a7Smrg build_libtool_libs=no 44556aec45a7Smrg build_old_libs=yes 44566aec45a7Smrg break 44576aec45a7Smrg ;; 44586aec45a7Smrg esac 44596aec45a7Smrg done 4460ab47cfaaSmrg 44616aec45a7Smrg # See if our shared archives depend on static archives. 44626aec45a7Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4463ab47cfaaSmrg 44646aec45a7Smrg # Go through the arguments, transforming them on the way. 44656aec45a7Smrg while test "$#" -gt 0; do 44666aec45a7Smrg arg="$1" 44676aec45a7Smrg shift 44686aec45a7Smrg func_quote_for_eval "$arg" 44696aec45a7Smrg qarg=$func_quote_for_eval_unquoted_result 44706aec45a7Smrg func_append libtool_args " $func_quote_for_eval_result" 4471ab47cfaaSmrg 44726aec45a7Smrg # If the previous option needs an argument, assign it. 44736aec45a7Smrg if test -n "$prev"; then 44746aec45a7Smrg case $prev in 44756aec45a7Smrg output) 44766aec45a7Smrg func_append compile_command " @OUTPUT@" 44776aec45a7Smrg func_append finalize_command " @OUTPUT@" 44786aec45a7Smrg ;; 44796aec45a7Smrg esac 4480ab47cfaaSmrg 44816aec45a7Smrg case $prev in 44826aec45a7Smrg bindir) 44836aec45a7Smrg bindir="$arg" 44846aec45a7Smrg prev= 44856aec45a7Smrg continue 44866aec45a7Smrg ;; 44876aec45a7Smrg dlfiles|dlprefiles) 44886aec45a7Smrg if test "$preload" = no; then 44896aec45a7Smrg # Add the symbol object into the linking commands. 44906aec45a7Smrg func_append compile_command " @SYMFILE@" 44916aec45a7Smrg func_append finalize_command " @SYMFILE@" 44926aec45a7Smrg preload=yes 44935c42550eSmrg fi 44946aec45a7Smrg case $arg in 44956aec45a7Smrg *.la | *.lo) ;; # We handle these cases below. 44966aec45a7Smrg force) 44976aec45a7Smrg if test "$dlself" = no; then 44986aec45a7Smrg dlself=needless 44996aec45a7Smrg export_dynamic=yes 45005c42550eSmrg fi 45016aec45a7Smrg prev= 45026aec45a7Smrg continue 45036aec45a7Smrg ;; 45046aec45a7Smrg self) 45056aec45a7Smrg if test "$prev" = dlprefiles; then 45066aec45a7Smrg dlself=yes 45076aec45a7Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 45086aec45a7Smrg dlself=yes 45095c42550eSmrg else 45106aec45a7Smrg dlself=needless 45116aec45a7Smrg export_dynamic=yes 45125c42550eSmrg fi 45136aec45a7Smrg prev= 45146aec45a7Smrg continue 45156aec45a7Smrg ;; 45166aec45a7Smrg *) 45176aec45a7Smrg if test "$prev" = dlfiles; then 45186aec45a7Smrg dlfiles="$dlfiles $arg" 45195c42550eSmrg else 45206aec45a7Smrg dlprefiles="$dlprefiles $arg" 45215c42550eSmrg fi 45226aec45a7Smrg prev= 45236aec45a7Smrg continue 45246aec45a7Smrg ;; 45256aec45a7Smrg esac 45266aec45a7Smrg ;; 45276aec45a7Smrg expsyms) 45286aec45a7Smrg export_symbols="$arg" 45296aec45a7Smrg test -f "$arg" \ 45306aec45a7Smrg || func_fatal_error "symbol file \`$arg' does not exist" 45316aec45a7Smrg prev= 45326aec45a7Smrg continue 45336aec45a7Smrg ;; 45346aec45a7Smrg expsyms_regex) 45356aec45a7Smrg export_symbols_regex="$arg" 45366aec45a7Smrg prev= 45376aec45a7Smrg continue 45386aec45a7Smrg ;; 45396aec45a7Smrg framework) 45405c42550eSmrg case $host in 45416aec45a7Smrg *-*-darwin*) 45426aec45a7Smrg case "$deplibs " in 45436aec45a7Smrg *" $qarg.ltframework "*) ;; 45446aec45a7Smrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 45456aec45a7Smrg ;; 45466aec45a7Smrg esac 45476aec45a7Smrg ;; 45485c42550eSmrg esac 45496aec45a7Smrg prev= 45506aec45a7Smrg continue 45515c42550eSmrg ;; 45526aec45a7Smrg inst_prefix) 45536aec45a7Smrg inst_prefix_dir="$arg" 45546aec45a7Smrg prev= 45556aec45a7Smrg continue 45565c42550eSmrg ;; 45576aec45a7Smrg objectlist) 45586aec45a7Smrg if test -f "$arg"; then 45596aec45a7Smrg save_arg=$arg 45606aec45a7Smrg moreargs= 45616aec45a7Smrg for fil in `cat "$save_arg"` 45626aec45a7Smrg do 45636aec45a7Smrg# moreargs="$moreargs $fil" 45646aec45a7Smrg arg=$fil 45656aec45a7Smrg # A libtool-controlled object. 4566ab47cfaaSmrg 45676aec45a7Smrg # Check to see that this really is a libtool object. 45686aec45a7Smrg if func_lalib_unsafe_p "$arg"; then 45696aec45a7Smrg pic_object= 45706aec45a7Smrg non_pic_object= 4571ab47cfaaSmrg 45726aec45a7Smrg # Read the .lo file 45736aec45a7Smrg func_source "$arg" 4574ab47cfaaSmrg 45756aec45a7Smrg if test -z "$pic_object" || 45766aec45a7Smrg test -z "$non_pic_object" || 45776aec45a7Smrg test "$pic_object" = none && 45786aec45a7Smrg test "$non_pic_object" = none; then 45796aec45a7Smrg func_fatal_error "cannot find name of object for \`$arg'" 45806aec45a7Smrg fi 4581ab47cfaaSmrg 45826aec45a7Smrg # Extract subdirectory from the argument. 45836aec45a7Smrg func_dirname "$arg" "/" "" 45846aec45a7Smrg xdir="$func_dirname_result" 4585ab47cfaaSmrg 45866aec45a7Smrg if test "$pic_object" != none; then 45876aec45a7Smrg # Prepend the subdirectory the object is found in. 45886aec45a7Smrg pic_object="$xdir$pic_object" 4589ab47cfaaSmrg 45906aec45a7Smrg if test "$prev" = dlfiles; then 45916aec45a7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 45926aec45a7Smrg dlfiles="$dlfiles $pic_object" 45936aec45a7Smrg prev= 45946aec45a7Smrg continue 45956aec45a7Smrg else 45966aec45a7Smrg # If libtool objects are unsupported, then we need to preload. 45976aec45a7Smrg prev=dlprefiles 45986aec45a7Smrg fi 45996aec45a7Smrg fi 46008697ee19Smrg 46016aec45a7Smrg # CHECK ME: I think I busted this. -Ossama 46026aec45a7Smrg if test "$prev" = dlprefiles; then 46036aec45a7Smrg # Preload the old-style object. 46046aec45a7Smrg dlprefiles="$dlprefiles $pic_object" 46056aec45a7Smrg prev= 46066aec45a7Smrg fi 4607ab47cfaaSmrg 46086aec45a7Smrg # A PIC object. 46096aec45a7Smrg func_append libobjs " $pic_object" 46106aec45a7Smrg arg="$pic_object" 46116aec45a7Smrg fi 46121473d951Smrg 46136aec45a7Smrg # Non-PIC object. 46146aec45a7Smrg if test "$non_pic_object" != none; then 46156aec45a7Smrg # Prepend the subdirectory the object is found in. 46166aec45a7Smrg non_pic_object="$xdir$non_pic_object" 46171473d951Smrg 46186aec45a7Smrg # A standard non-PIC object 46196aec45a7Smrg func_append non_pic_objects " $non_pic_object" 46206aec45a7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 46216aec45a7Smrg arg="$non_pic_object" 46226aec45a7Smrg fi 46236aec45a7Smrg else 46246aec45a7Smrg # If the PIC object exists, use it instead. 46256aec45a7Smrg # $xdir was prepended to $pic_object above. 46266aec45a7Smrg non_pic_object="$pic_object" 46276aec45a7Smrg func_append non_pic_objects " $non_pic_object" 46286aec45a7Smrg fi 46296aec45a7Smrg else 46306aec45a7Smrg # Only an error if not doing a dry-run. 46316aec45a7Smrg if $opt_dry_run; then 46326aec45a7Smrg # Extract subdirectory from the argument. 46336aec45a7Smrg func_dirname "$arg" "/" "" 46346aec45a7Smrg xdir="$func_dirname_result" 46356aec45a7Smrg 46366aec45a7Smrg func_lo2o "$arg" 46376aec45a7Smrg pic_object=$xdir$objdir/$func_lo2o_result 46386aec45a7Smrg non_pic_object=$xdir$func_lo2o_result 46396aec45a7Smrg func_append libobjs " $pic_object" 46406aec45a7Smrg func_append non_pic_objects " $non_pic_object" 46416aec45a7Smrg else 46426aec45a7Smrg func_fatal_error "\`$arg' is not a valid libtool object" 46436aec45a7Smrg fi 46446aec45a7Smrg fi 46456aec45a7Smrg done 46465c42550eSmrg else 46476aec45a7Smrg func_fatal_error "link input file \`$arg' does not exist" 46485c42550eSmrg fi 46496aec45a7Smrg arg=$save_arg 46506aec45a7Smrg prev= 46516aec45a7Smrg continue 46526aec45a7Smrg ;; 46536aec45a7Smrg precious_regex) 46546aec45a7Smrg precious_files_regex="$arg" 46556aec45a7Smrg prev= 46566aec45a7Smrg continue 46576aec45a7Smrg ;; 46586aec45a7Smrg release) 46596aec45a7Smrg release="-$arg" 46606aec45a7Smrg prev= 46616aec45a7Smrg continue 46626aec45a7Smrg ;; 46636aec45a7Smrg rpath | xrpath) 46646aec45a7Smrg # We need an absolute path. 46656aec45a7Smrg case $arg in 46666aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 46676aec45a7Smrg *) 46686aec45a7Smrg func_fatal_error "only absolute run-paths are allowed" 46696aec45a7Smrg ;; 46706aec45a7Smrg esac 46716aec45a7Smrg if test "$prev" = rpath; then 46726aec45a7Smrg case "$rpath " in 46736aec45a7Smrg *" $arg "*) ;; 46746aec45a7Smrg *) rpath="$rpath $arg" ;; 46756aec45a7Smrg esac 46765c42550eSmrg else 46776aec45a7Smrg case "$xrpath " in 46786aec45a7Smrg *" $arg "*) ;; 46796aec45a7Smrg *) xrpath="$xrpath $arg" ;; 46806aec45a7Smrg esac 46815c42550eSmrg fi 46826aec45a7Smrg prev= 46836aec45a7Smrg continue 46846aec45a7Smrg ;; 46856aec45a7Smrg shrext) 46866aec45a7Smrg shrext_cmds="$arg" 46876aec45a7Smrg prev= 46886aec45a7Smrg continue 46896aec45a7Smrg ;; 46906aec45a7Smrg weak) 46916aec45a7Smrg weak_libs="$weak_libs $arg" 46926aec45a7Smrg prev= 46936aec45a7Smrg continue 46946aec45a7Smrg ;; 46956aec45a7Smrg xcclinker) 46966aec45a7Smrg linker_flags="$linker_flags $qarg" 46976aec45a7Smrg compiler_flags="$compiler_flags $qarg" 46986aec45a7Smrg prev= 46996aec45a7Smrg func_append compile_command " $qarg" 47006aec45a7Smrg func_append finalize_command " $qarg" 47016aec45a7Smrg continue 47026aec45a7Smrg ;; 47036aec45a7Smrg xcompiler) 47046aec45a7Smrg compiler_flags="$compiler_flags $qarg" 47056aec45a7Smrg prev= 47066aec45a7Smrg func_append compile_command " $qarg" 47076aec45a7Smrg func_append finalize_command " $qarg" 47086aec45a7Smrg continue 47096aec45a7Smrg ;; 47106aec45a7Smrg xlinker) 47116aec45a7Smrg linker_flags="$linker_flags $qarg" 47126aec45a7Smrg compiler_flags="$compiler_flags $wl$qarg" 47136aec45a7Smrg prev= 47146aec45a7Smrg func_append compile_command " $wl$qarg" 47156aec45a7Smrg func_append finalize_command " $wl$qarg" 47166aec45a7Smrg continue 47176aec45a7Smrg ;; 47186aec45a7Smrg *) 47196aec45a7Smrg eval "$prev=\"\$arg\"" 47206aec45a7Smrg prev= 47216aec45a7Smrg continue 47226aec45a7Smrg ;; 47231473d951Smrg esac 47246aec45a7Smrg fi # test -n "$prev" 47251473d951Smrg 47266aec45a7Smrg prevarg="$arg" 47271473d951Smrg 47286aec45a7Smrg case $arg in 47296aec45a7Smrg -all-static) 47306aec45a7Smrg if test -n "$link_static_flag"; then 47316aec45a7Smrg # See comment for -static flag below, for more details. 47326aec45a7Smrg func_append compile_command " $link_static_flag" 47336aec45a7Smrg func_append finalize_command " $link_static_flag" 47346aec45a7Smrg fi 47356aec45a7Smrg continue 47366aec45a7Smrg ;; 47371473d951Smrg 47386aec45a7Smrg -allow-undefined) 47396aec45a7Smrg # FIXME: remove this flag sometime in the future. 47406aec45a7Smrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 47416aec45a7Smrg ;; 47421473d951Smrg 47436aec45a7Smrg -avoid-version) 47446aec45a7Smrg avoid_version=yes 47456aec45a7Smrg continue 47466aec45a7Smrg ;; 47471473d951Smrg 47486aec45a7Smrg -bindir) 47496aec45a7Smrg prev=bindir 47506aec45a7Smrg continue 47516aec45a7Smrg ;; 47521473d951Smrg 47536aec45a7Smrg -dlopen) 47546aec45a7Smrg prev=dlfiles 47556aec45a7Smrg continue 47566aec45a7Smrg ;; 47571473d951Smrg 47586aec45a7Smrg -dlpreopen) 47596aec45a7Smrg prev=dlprefiles 47606aec45a7Smrg continue 47616aec45a7Smrg ;; 47621473d951Smrg 47636aec45a7Smrg -export-dynamic) 47646aec45a7Smrg export_dynamic=yes 47656aec45a7Smrg continue 47666aec45a7Smrg ;; 47671473d951Smrg 47686aec45a7Smrg -export-symbols | -export-symbols-regex) 47696aec45a7Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 47706aec45a7Smrg func_fatal_error "more than one -exported-symbols argument is not allowed" 47716aec45a7Smrg fi 47726aec45a7Smrg if test "X$arg" = "X-export-symbols"; then 47736aec45a7Smrg prev=expsyms 47746aec45a7Smrg else 47756aec45a7Smrg prev=expsyms_regex 47766aec45a7Smrg fi 47776aec45a7Smrg continue 47786aec45a7Smrg ;; 47791473d951Smrg 47806aec45a7Smrg -framework) 47816aec45a7Smrg prev=framework 47826aec45a7Smrg continue 47836aec45a7Smrg ;; 47841473d951Smrg 47856aec45a7Smrg -inst-prefix-dir) 47866aec45a7Smrg prev=inst_prefix 47876aec45a7Smrg continue 47886aec45a7Smrg ;; 47891473d951Smrg 47906aec45a7Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 47916aec45a7Smrg # so, if we see these flags be careful not to treat them like -L 47926aec45a7Smrg -L[A-Z][A-Z]*:*) 47936aec45a7Smrg case $with_gcc/$host in 47946aec45a7Smrg no/*-*-irix* | /*-*-irix*) 47956aec45a7Smrg func_append compile_command " $arg" 47966aec45a7Smrg func_append finalize_command " $arg" 47976aec45a7Smrg ;; 47986aec45a7Smrg esac 47996aec45a7Smrg continue 48006aec45a7Smrg ;; 48011473d951Smrg 48026aec45a7Smrg -L*) 48036aec45a7Smrg func_stripname '-L' '' "$arg" 48046aec45a7Smrg dir=$func_stripname_result 48056aec45a7Smrg if test -z "$dir"; then 48066aec45a7Smrg if test "$#" -gt 0; then 48076aec45a7Smrg func_fatal_error "require no space between \`-L' and \`$1'" 48086aec45a7Smrg else 48096aec45a7Smrg func_fatal_error "need path for \`-L' option" 48106aec45a7Smrg fi 48116aec45a7Smrg fi 48126aec45a7Smrg # We need an absolute path. 48136aec45a7Smrg case $dir in 48146aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 48156aec45a7Smrg *) 48166aec45a7Smrg absdir=`cd "$dir" && pwd` 48176aec45a7Smrg test -z "$absdir" && \ 48186aec45a7Smrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 48196aec45a7Smrg dir="$absdir" 48206aec45a7Smrg ;; 48216aec45a7Smrg esac 48226aec45a7Smrg case "$deplibs " in 48236aec45a7Smrg *" -L$dir "*) ;; 48246aec45a7Smrg *) 48256aec45a7Smrg deplibs="$deplibs -L$dir" 48266aec45a7Smrg lib_search_path="$lib_search_path $dir" 48276aec45a7Smrg ;; 48286aec45a7Smrg esac 48296aec45a7Smrg case $host in 48306aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 48316aec45a7Smrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 48326aec45a7Smrg case :$dllsearchpath: in 48336aec45a7Smrg *":$dir:"*) ;; 48346aec45a7Smrg ::) dllsearchpath=$dir;; 48356aec45a7Smrg *) dllsearchpath="$dllsearchpath:$dir";; 48366aec45a7Smrg esac 48376aec45a7Smrg case :$dllsearchpath: in 48386aec45a7Smrg *":$testbindir:"*) ;; 48396aec45a7Smrg ::) dllsearchpath=$testbindir;; 48406aec45a7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 48416aec45a7Smrg esac 48426aec45a7Smrg ;; 48436aec45a7Smrg esac 48446aec45a7Smrg continue 48456aec45a7Smrg ;; 48461473d951Smrg 48476aec45a7Smrg -l*) 48486aec45a7Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 48496aec45a7Smrg case $host in 48506aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 48516aec45a7Smrg # These systems don't actually have a C or math library (as such) 48526aec45a7Smrg continue 48536aec45a7Smrg ;; 48546aec45a7Smrg *-*-os2*) 48556aec45a7Smrg # These systems don't actually have a C library (as such) 48566aec45a7Smrg test "X$arg" = "X-lc" && continue 48576aec45a7Smrg ;; 48586aec45a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 48596aec45a7Smrg # Do not include libc due to us having libc/libc_r. 48606aec45a7Smrg test "X$arg" = "X-lc" && continue 48616aec45a7Smrg ;; 48626aec45a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 48636aec45a7Smrg # Rhapsody C and math libraries are in the System framework 48646aec45a7Smrg deplibs="$deplibs System.ltframework" 48656aec45a7Smrg continue 48666aec45a7Smrg ;; 48676aec45a7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 48686aec45a7Smrg # Causes problems with __ctype 48696aec45a7Smrg test "X$arg" = "X-lc" && continue 48706aec45a7Smrg ;; 48716aec45a7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 48726aec45a7Smrg # Compiler inserts libc in the correct place for threads to work 48736aec45a7Smrg test "X$arg" = "X-lc" && continue 48746aec45a7Smrg ;; 48756aec45a7Smrg esac 48766aec45a7Smrg elif test "X$arg" = "X-lc_r"; then 48776aec45a7Smrg case $host in 48786aec45a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 48796aec45a7Smrg # Do not include libc_r directly, use -pthread flag. 48806aec45a7Smrg continue 48816aec45a7Smrg ;; 48826aec45a7Smrg esac 48836aec45a7Smrg fi 48846aec45a7Smrg deplibs="$deplibs $arg" 48856aec45a7Smrg continue 48866aec45a7Smrg ;; 48871473d951Smrg 48886aec45a7Smrg -module) 48896aec45a7Smrg module=yes 48906aec45a7Smrg continue 48916aec45a7Smrg ;; 48921473d951Smrg 48936aec45a7Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 48946aec45a7Smrg # classes, name mangling, and exception handling. 48956aec45a7Smrg # Darwin uses the -arch flag to determine output architecture. 48966aec45a7Smrg -model|-arch|-isysroot) 48976aec45a7Smrg compiler_flags="$compiler_flags $arg" 48986aec45a7Smrg func_append compile_command " $arg" 48996aec45a7Smrg func_append finalize_command " $arg" 49006aec45a7Smrg prev=xcompiler 49016aec45a7Smrg continue 49026aec45a7Smrg ;; 49031473d951Smrg 49046aec45a7Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 49056aec45a7Smrg compiler_flags="$compiler_flags $arg" 49066aec45a7Smrg func_append compile_command " $arg" 49076aec45a7Smrg func_append finalize_command " $arg" 49086aec45a7Smrg case "$new_inherited_linker_flags " in 49096aec45a7Smrg *" $arg "*) ;; 49106aec45a7Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 49116aec45a7Smrg esac 49126aec45a7Smrg continue 49136aec45a7Smrg ;; 49141473d951Smrg 49156aec45a7Smrg -multi_module) 49166aec45a7Smrg single_module="${wl}-multi_module" 49176aec45a7Smrg continue 49186aec45a7Smrg ;; 49191473d951Smrg 49206aec45a7Smrg -no-fast-install) 49216aec45a7Smrg fast_install=no 49226aec45a7Smrg continue 49236aec45a7Smrg ;; 49241473d951Smrg 49256aec45a7Smrg -no-install) 49266aec45a7Smrg case $host in 49276aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 49286aec45a7Smrg # The PATH hackery in wrapper scripts is required on Windows 49296aec45a7Smrg # and Darwin in order for the loader to find any dlls it needs. 49306aec45a7Smrg func_warning "\`-no-install' is ignored for $host" 49316aec45a7Smrg func_warning "assuming \`-no-fast-install' instead" 49326aec45a7Smrg fast_install=no 49336aec45a7Smrg ;; 49346aec45a7Smrg *) no_install=yes ;; 49356aec45a7Smrg esac 49366aec45a7Smrg continue 49376aec45a7Smrg ;; 49381473d951Smrg 49396aec45a7Smrg -no-undefined) 49406aec45a7Smrg allow_undefined=no 49416aec45a7Smrg continue 49426aec45a7Smrg ;; 49431473d951Smrg 49446aec45a7Smrg -objectlist) 49456aec45a7Smrg prev=objectlist 49466aec45a7Smrg continue 49476aec45a7Smrg ;; 49481473d951Smrg 49496aec45a7Smrg -o) prev=output ;; 49501473d951Smrg 49516aec45a7Smrg -precious-files-regex) 49526aec45a7Smrg prev=precious_regex 49536aec45a7Smrg continue 49546aec45a7Smrg ;; 49551473d951Smrg 49566aec45a7Smrg -release) 49576aec45a7Smrg prev=release 49586aec45a7Smrg continue 49596aec45a7Smrg ;; 49601473d951Smrg 49616aec45a7Smrg -rpath) 49626aec45a7Smrg prev=rpath 49636aec45a7Smrg continue 49646aec45a7Smrg ;; 49651473d951Smrg 49666aec45a7Smrg -R) 49676aec45a7Smrg prev=xrpath 49686aec45a7Smrg continue 49696aec45a7Smrg ;; 49701473d951Smrg 49716aec45a7Smrg -R*) 49726aec45a7Smrg func_stripname '-R' '' "$arg" 49736aec45a7Smrg dir=$func_stripname_result 49746aec45a7Smrg # We need an absolute path. 49756aec45a7Smrg case $dir in 49766aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 49776aec45a7Smrg *) 49786aec45a7Smrg func_fatal_error "only absolute run-paths are allowed" 49796aec45a7Smrg ;; 49806aec45a7Smrg esac 49816aec45a7Smrg case "$xrpath " in 49826aec45a7Smrg *" $dir "*) ;; 49836aec45a7Smrg *) xrpath="$xrpath $dir" ;; 49846aec45a7Smrg esac 49856aec45a7Smrg continue 49866aec45a7Smrg ;; 49871473d951Smrg 49886aec45a7Smrg -shared) 49896aec45a7Smrg # The effects of -shared are defined in a previous loop. 49906aec45a7Smrg continue 49916aec45a7Smrg ;; 49921473d951Smrg 49936aec45a7Smrg -shrext) 49946aec45a7Smrg prev=shrext 49956aec45a7Smrg continue 49966aec45a7Smrg ;; 49971473d951Smrg 49986aec45a7Smrg -static | -static-libtool-libs) 49996aec45a7Smrg # The effects of -static are defined in a previous loop. 50006aec45a7Smrg # We used to do the same as -all-static on platforms that 50016aec45a7Smrg # didn't have a PIC flag, but the assumption that the effects 50026aec45a7Smrg # would be equivalent was wrong. It would break on at least 50036aec45a7Smrg # Digital Unix and AIX. 50046aec45a7Smrg continue 50056aec45a7Smrg ;; 50061473d951Smrg 50076aec45a7Smrg -thread-safe) 50086aec45a7Smrg thread_safe=yes 50096aec45a7Smrg continue 50106aec45a7Smrg ;; 50111473d951Smrg 50126aec45a7Smrg -version-info) 50136aec45a7Smrg prev=vinfo 50146aec45a7Smrg continue 50156aec45a7Smrg ;; 50161473d951Smrg 50176aec45a7Smrg -version-number) 50186aec45a7Smrg prev=vinfo 50196aec45a7Smrg vinfo_number=yes 50206aec45a7Smrg continue 50216aec45a7Smrg ;; 5022ab47cfaaSmrg 50236aec45a7Smrg -weak) 50246aec45a7Smrg prev=weak 50256aec45a7Smrg continue 50266aec45a7Smrg ;; 50275c42550eSmrg 50286aec45a7Smrg -Wc,*) 50296aec45a7Smrg func_stripname '-Wc,' '' "$arg" 50306aec45a7Smrg args=$func_stripname_result 50316aec45a7Smrg arg= 50326aec45a7Smrg save_ifs="$IFS"; IFS=',' 50336aec45a7Smrg for flag in $args; do 50346aec45a7Smrg IFS="$save_ifs" 50356aec45a7Smrg func_quote_for_eval "$flag" 50366aec45a7Smrg arg="$arg $func_quote_for_eval_result" 50376aec45a7Smrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 50386aec45a7Smrg done 50396aec45a7Smrg IFS="$save_ifs" 50406aec45a7Smrg func_stripname ' ' '' "$arg" 50416aec45a7Smrg arg=$func_stripname_result 50426aec45a7Smrg ;; 50435c42550eSmrg 50446aec45a7Smrg -Wl,*) 50456aec45a7Smrg func_stripname '-Wl,' '' "$arg" 50466aec45a7Smrg args=$func_stripname_result 50476aec45a7Smrg arg= 50486aec45a7Smrg save_ifs="$IFS"; IFS=',' 50496aec45a7Smrg for flag in $args; do 50506aec45a7Smrg IFS="$save_ifs" 50516aec45a7Smrg func_quote_for_eval "$flag" 50526aec45a7Smrg arg="$arg $wl$func_quote_for_eval_result" 50536aec45a7Smrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 50546aec45a7Smrg linker_flags="$linker_flags $func_quote_for_eval_result" 50556aec45a7Smrg done 50566aec45a7Smrg IFS="$save_ifs" 50576aec45a7Smrg func_stripname ' ' '' "$arg" 50586aec45a7Smrg arg=$func_stripname_result 50596aec45a7Smrg ;; 50605c42550eSmrg 50616aec45a7Smrg -Xcompiler) 50626aec45a7Smrg prev=xcompiler 50636aec45a7Smrg continue 50646aec45a7Smrg ;; 50655c42550eSmrg 50666aec45a7Smrg -Xlinker) 50676aec45a7Smrg prev=xlinker 50686aec45a7Smrg continue 50696aec45a7Smrg ;; 50705c42550eSmrg 50716aec45a7Smrg -XCClinker) 50726aec45a7Smrg prev=xcclinker 50736aec45a7Smrg continue 50746aec45a7Smrg ;; 50755c42550eSmrg 50766aec45a7Smrg # -msg_* for osf cc 50776aec45a7Smrg -msg_*) 50786aec45a7Smrg func_quote_for_eval "$arg" 50796aec45a7Smrg arg="$func_quote_for_eval_result" 50806aec45a7Smrg ;; 50815c42550eSmrg 50826aec45a7Smrg # Flags to be passed through unchanged, with rationale: 50836aec45a7Smrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 50846aec45a7Smrg # -r[0-9][0-9]* specify processor for the SGI compiler 50856aec45a7Smrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 50866aec45a7Smrg # +DA*, +DD* enable 64-bit mode for the HP compiler 50876aec45a7Smrg # -q* compiler args for the IBM compiler 50886aec45a7Smrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 50896aec45a7Smrg # -F/path path to uninstalled frameworks, gcc on darwin 50906aec45a7Smrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 50916aec45a7Smrg # @file GCC response files 50926aec45a7Smrg # -tp=* Portland pgcc target processor selection 50936aec45a7Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 50946aec45a7Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) 50956aec45a7Smrg func_quote_for_eval "$arg" 50966aec45a7Smrg arg="$func_quote_for_eval_result" 50976aec45a7Smrg func_append compile_command " $arg" 50986aec45a7Smrg func_append finalize_command " $arg" 50996aec45a7Smrg compiler_flags="$compiler_flags $arg" 51006aec45a7Smrg continue 51016aec45a7Smrg ;; 51025c42550eSmrg 51036aec45a7Smrg # Some other compiler flag. 51046aec45a7Smrg -* | +*) 51056aec45a7Smrg func_quote_for_eval "$arg" 51066aec45a7Smrg arg="$func_quote_for_eval_result" 51076aec45a7Smrg ;; 51085c42550eSmrg 51096aec45a7Smrg *.$objext) 51106aec45a7Smrg # A standard object. 51116aec45a7Smrg objs="$objs $arg" 51126aec45a7Smrg ;; 51135c42550eSmrg 51146aec45a7Smrg *.lo) 51156aec45a7Smrg # A libtool-controlled object. 51165c42550eSmrg 51176aec45a7Smrg # Check to see that this really is a libtool object. 51186aec45a7Smrg if func_lalib_unsafe_p "$arg"; then 51196aec45a7Smrg pic_object= 51206aec45a7Smrg non_pic_object= 51215c42550eSmrg 51226aec45a7Smrg # Read the .lo file 51236aec45a7Smrg func_source "$arg" 51245c42550eSmrg 51256aec45a7Smrg if test -z "$pic_object" || 51266aec45a7Smrg test -z "$non_pic_object" || 51276aec45a7Smrg test "$pic_object" = none && 51286aec45a7Smrg test "$non_pic_object" = none; then 51296aec45a7Smrg func_fatal_error "cannot find name of object for \`$arg'" 51306aec45a7Smrg fi 51315c42550eSmrg 51326aec45a7Smrg # Extract subdirectory from the argument. 51336aec45a7Smrg func_dirname "$arg" "/" "" 51346aec45a7Smrg xdir="$func_dirname_result" 51355c42550eSmrg 51366aec45a7Smrg if test "$pic_object" != none; then 51376aec45a7Smrg # Prepend the subdirectory the object is found in. 51386aec45a7Smrg pic_object="$xdir$pic_object" 51395c42550eSmrg 51406aec45a7Smrg if test "$prev" = dlfiles; then 51416aec45a7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 51426aec45a7Smrg dlfiles="$dlfiles $pic_object" 51436aec45a7Smrg prev= 51446aec45a7Smrg continue 51456aec45a7Smrg else 51466aec45a7Smrg # If libtool objects are unsupported, then we need to preload. 51476aec45a7Smrg prev=dlprefiles 51486aec45a7Smrg fi 51496aec45a7Smrg fi 51506aec45a7Smrg 51516aec45a7Smrg # CHECK ME: I think I busted this. -Ossama 51526aec45a7Smrg if test "$prev" = dlprefiles; then 51536aec45a7Smrg # Preload the old-style object. 51546aec45a7Smrg dlprefiles="$dlprefiles $pic_object" 51556aec45a7Smrg prev= 51566aec45a7Smrg fi 51576aec45a7Smrg 51586aec45a7Smrg # A PIC object. 51596aec45a7Smrg func_append libobjs " $pic_object" 51606aec45a7Smrg arg="$pic_object" 51616aec45a7Smrg fi 51626aec45a7Smrg 51636aec45a7Smrg # Non-PIC object. 51646aec45a7Smrg if test "$non_pic_object" != none; then 51656aec45a7Smrg # Prepend the subdirectory the object is found in. 51666aec45a7Smrg non_pic_object="$xdir$non_pic_object" 51676aec45a7Smrg 51686aec45a7Smrg # A standard non-PIC object 51696aec45a7Smrg func_append non_pic_objects " $non_pic_object" 51706aec45a7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 51716aec45a7Smrg arg="$non_pic_object" 51726aec45a7Smrg fi 51736aec45a7Smrg else 51746aec45a7Smrg # If the PIC object exists, use it instead. 51756aec45a7Smrg # $xdir was prepended to $pic_object above. 51766aec45a7Smrg non_pic_object="$pic_object" 51776aec45a7Smrg func_append non_pic_objects " $non_pic_object" 51786aec45a7Smrg fi 51796aec45a7Smrg else 51806aec45a7Smrg # Only an error if not doing a dry-run. 51816aec45a7Smrg if $opt_dry_run; then 51826aec45a7Smrg # Extract subdirectory from the argument. 51836aec45a7Smrg func_dirname "$arg" "/" "" 51846aec45a7Smrg xdir="$func_dirname_result" 51856aec45a7Smrg 51866aec45a7Smrg func_lo2o "$arg" 51876aec45a7Smrg pic_object=$xdir$objdir/$func_lo2o_result 51886aec45a7Smrg non_pic_object=$xdir$func_lo2o_result 51896aec45a7Smrg func_append libobjs " $pic_object" 51906aec45a7Smrg func_append non_pic_objects " $non_pic_object" 51916aec45a7Smrg else 51926aec45a7Smrg func_fatal_error "\`$arg' is not a valid libtool object" 51936aec45a7Smrg fi 51946aec45a7Smrg fi 51956aec45a7Smrg ;; 51966aec45a7Smrg 51976aec45a7Smrg *.$libext) 51986aec45a7Smrg # An archive. 51996aec45a7Smrg deplibs="$deplibs $arg" 52006aec45a7Smrg old_deplibs="$old_deplibs $arg" 52016aec45a7Smrg continue 52026aec45a7Smrg ;; 52036aec45a7Smrg 52046aec45a7Smrg *.la) 52056aec45a7Smrg # A libtool-controlled library. 52066aec45a7Smrg 52076aec45a7Smrg if test "$prev" = dlfiles; then 52086aec45a7Smrg # This library was specified with -dlopen. 52096aec45a7Smrg dlfiles="$dlfiles $arg" 52106aec45a7Smrg prev= 52116aec45a7Smrg elif test "$prev" = dlprefiles; then 52126aec45a7Smrg # The library was specified with -dlpreopen. 52136aec45a7Smrg dlprefiles="$dlprefiles $arg" 52146aec45a7Smrg prev= 52156aec45a7Smrg else 52166aec45a7Smrg deplibs="$deplibs $arg" 52176aec45a7Smrg fi 52186aec45a7Smrg continue 52196aec45a7Smrg ;; 52206aec45a7Smrg 52216aec45a7Smrg # Some other compiler argument. 52226aec45a7Smrg *) 52236aec45a7Smrg # Unknown arguments in both finalize_command and compile_command need 52246aec45a7Smrg # to be aesthetically quoted because they are evaled later. 52256aec45a7Smrg func_quote_for_eval "$arg" 52266aec45a7Smrg arg="$func_quote_for_eval_result" 52276aec45a7Smrg ;; 52286aec45a7Smrg esac # arg 52296aec45a7Smrg 52306aec45a7Smrg # Now actually substitute the argument into the commands. 52316aec45a7Smrg if test -n "$arg"; then 52326aec45a7Smrg func_append compile_command " $arg" 52336aec45a7Smrg func_append finalize_command " $arg" 52346aec45a7Smrg fi 52356aec45a7Smrg done # argument parsing loop 52366aec45a7Smrg 52376aec45a7Smrg test -n "$prev" && \ 52386aec45a7Smrg func_fatal_help "the \`$prevarg' option requires an argument" 52396aec45a7Smrg 52406aec45a7Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 52416aec45a7Smrg eval arg=\"$export_dynamic_flag_spec\" 52426aec45a7Smrg func_append compile_command " $arg" 52436aec45a7Smrg func_append finalize_command " $arg" 52446aec45a7Smrg fi 52456aec45a7Smrg 52466aec45a7Smrg oldlibs= 52476aec45a7Smrg # calculate the name of the file, without its directory 52486aec45a7Smrg func_basename "$output" 52496aec45a7Smrg outputname="$func_basename_result" 52506aec45a7Smrg libobjs_save="$libobjs" 52516aec45a7Smrg 52526aec45a7Smrg if test -n "$shlibpath_var"; then 52536aec45a7Smrg # get the directories listed in $shlibpath_var 52546aec45a7Smrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 52555c42550eSmrg else 52566aec45a7Smrg shlib_search_path= 52575c42550eSmrg fi 52586aec45a7Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 52596aec45a7Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 5260ab47cfaaSmrg 52616aec45a7Smrg func_dirname "$output" "/" "" 52626aec45a7Smrg output_objdir="$func_dirname_result$objdir" 52636aec45a7Smrg # Create the object directory. 52646aec45a7Smrg func_mkdir_p "$output_objdir" 5265ab47cfaaSmrg 52666aec45a7Smrg # Determine the type of output 52676aec45a7Smrg case $output in 52686aec45a7Smrg "") 52696aec45a7Smrg func_fatal_help "you must specify an output file" 52706aec45a7Smrg ;; 52716aec45a7Smrg *.$libext) linkmode=oldlib ;; 52726aec45a7Smrg *.lo | *.$objext) linkmode=obj ;; 52736aec45a7Smrg *.la) linkmode=lib ;; 52746aec45a7Smrg *) linkmode=prog ;; # Anything else should be a program. 52756aec45a7Smrg esac 52766aec45a7Smrg 52776aec45a7Smrg specialdeplibs= 52786aec45a7Smrg 52796aec45a7Smrg libs= 52806aec45a7Smrg # Find all interdependent deplibs by searching for libraries 52816aec45a7Smrg # that are linked more than once (e.g. -la -lb -la) 52826aec45a7Smrg for deplib in $deplibs; do 52836aec45a7Smrg if $opt_duplicate_deps ; then 52846aec45a7Smrg case "$libs " in 52856aec45a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 52866aec45a7Smrg esac 52876aec45a7Smrg fi 52886aec45a7Smrg libs="$libs $deplib" 52896aec45a7Smrg done 52906aec45a7Smrg 52916aec45a7Smrg if test "$linkmode" = lib; then 52926aec45a7Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 52936aec45a7Smrg 52946aec45a7Smrg # Compute libraries that are listed more than once in $predeps 52956aec45a7Smrg # $postdeps and mark them as special (i.e., whose duplicates are 52966aec45a7Smrg # not to be eliminated). 52976aec45a7Smrg pre_post_deps= 52986aec45a7Smrg if $opt_duplicate_compiler_generated_deps; then 52996aec45a7Smrg for pre_post_dep in $predeps $postdeps; do 53006aec45a7Smrg case "$pre_post_deps " in 53016aec45a7Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 53026aec45a7Smrg esac 53036aec45a7Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 53046aec45a7Smrg done 53056aec45a7Smrg fi 53066aec45a7Smrg pre_post_deps= 53076aec45a7Smrg fi 53086aec45a7Smrg 53096aec45a7Smrg deplibs= 53106aec45a7Smrg newdependency_libs= 53116aec45a7Smrg newlib_search_path= 53126aec45a7Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 53136aec45a7Smrg notinst_deplibs= # not-installed libtool libraries 53146aec45a7Smrg notinst_path= # paths that contain not-installed libtool libraries 53156aec45a7Smrg 53166aec45a7Smrg case $linkmode in 53176aec45a7Smrg lib) 53186aec45a7Smrg passes="conv dlpreopen link" 53196aec45a7Smrg for file in $dlfiles $dlprefiles; do 53206aec45a7Smrg case $file in 53216aec45a7Smrg *.la) ;; 53226aec45a7Smrg *) 53236aec45a7Smrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 53246aec45a7Smrg ;; 53256aec45a7Smrg esac 53266aec45a7Smrg done 53276aec45a7Smrg ;; 53286aec45a7Smrg prog) 53296aec45a7Smrg compile_deplibs= 53306aec45a7Smrg finalize_deplibs= 53316aec45a7Smrg alldeplibs=no 53326aec45a7Smrg newdlfiles= 53336aec45a7Smrg newdlprefiles= 53346aec45a7Smrg passes="conv scan dlopen dlpreopen link" 53356aec45a7Smrg ;; 53366aec45a7Smrg *) passes="conv" 53376aec45a7Smrg ;; 53386aec45a7Smrg esac 53396aec45a7Smrg 53406aec45a7Smrg for pass in $passes; do 53416aec45a7Smrg # The preopen pass in lib mode reverses $deplibs; put it back here 53426aec45a7Smrg # so that -L comes before libs that need it for instance... 53436aec45a7Smrg if test "$linkmode,$pass" = "lib,link"; then 53446aec45a7Smrg ## FIXME: Find the place where the list is rebuilt in the wrong 53456aec45a7Smrg ## order, and fix it there properly 53466aec45a7Smrg tmp_deplibs= 53476aec45a7Smrg for deplib in $deplibs; do 53486aec45a7Smrg tmp_deplibs="$deplib $tmp_deplibs" 53496aec45a7Smrg done 53506aec45a7Smrg deplibs="$tmp_deplibs" 53516aec45a7Smrg fi 53526aec45a7Smrg 53536aec45a7Smrg if test "$linkmode,$pass" = "lib,link" || 53546aec45a7Smrg test "$linkmode,$pass" = "prog,scan"; then 53556aec45a7Smrg libs="$deplibs" 53566aec45a7Smrg deplibs= 53576aec45a7Smrg fi 53586aec45a7Smrg if test "$linkmode" = prog; then 53596aec45a7Smrg case $pass in 53606aec45a7Smrg dlopen) libs="$dlfiles" ;; 53616aec45a7Smrg dlpreopen) libs="$dlprefiles" ;; 53626aec45a7Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 53636aec45a7Smrg esac 53646aec45a7Smrg fi 53656aec45a7Smrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 53666aec45a7Smrg # Collect and forward deplibs of preopened libtool libs 53676aec45a7Smrg for lib in $dlprefiles; do 53686aec45a7Smrg # Ignore non-libtool-libs 53696aec45a7Smrg dependency_libs= 53706aec45a7Smrg case $lib in 53716aec45a7Smrg *.la) func_source "$lib" ;; 53726aec45a7Smrg esac 53736aec45a7Smrg 53746aec45a7Smrg # Collect preopened libtool deplibs, except any this library 53756aec45a7Smrg # has declared as weak libs 53766aec45a7Smrg for deplib in $dependency_libs; do 53776aec45a7Smrg func_basename "$deplib" 53786aec45a7Smrg deplib_base=$func_basename_result 53796aec45a7Smrg case " $weak_libs " in 53806aec45a7Smrg *" $deplib_base "*) ;; 53816aec45a7Smrg *) deplibs="$deplibs $deplib" ;; 53826aec45a7Smrg esac 53836aec45a7Smrg done 53846aec45a7Smrg done 53856aec45a7Smrg libs="$dlprefiles" 53866aec45a7Smrg fi 53876aec45a7Smrg if test "$pass" = dlopen; then 53886aec45a7Smrg # Collect dlpreopened libraries 53896aec45a7Smrg save_deplibs="$deplibs" 53906aec45a7Smrg deplibs= 53916aec45a7Smrg fi 53926aec45a7Smrg 53936aec45a7Smrg for deplib in $libs; do 53946aec45a7Smrg lib= 53956aec45a7Smrg found=no 53966aec45a7Smrg case $deplib in 53976aec45a7Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 53986aec45a7Smrg if test "$linkmode,$pass" = "prog,link"; then 53996aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 54006aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 54016aec45a7Smrg else 54026aec45a7Smrg compiler_flags="$compiler_flags $deplib" 54036aec45a7Smrg if test "$linkmode" = lib ; then 54046aec45a7Smrg case "$new_inherited_linker_flags " in 54056aec45a7Smrg *" $deplib "*) ;; 54066aec45a7Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 54076aec45a7Smrg esac 54086aec45a7Smrg fi 54096aec45a7Smrg fi 54106aec45a7Smrg continue 54116aec45a7Smrg ;; 54126aec45a7Smrg -l*) 54136aec45a7Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 54146aec45a7Smrg func_warning "\`-l' is ignored for archives/objects" 54156aec45a7Smrg continue 54166aec45a7Smrg fi 54176aec45a7Smrg func_stripname '-l' '' "$deplib" 54186aec45a7Smrg name=$func_stripname_result 54196aec45a7Smrg if test "$linkmode" = lib; then 54206aec45a7Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 54216aec45a7Smrg else 54226aec45a7Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 54236aec45a7Smrg fi 54246aec45a7Smrg for searchdir in $searchdirs; do 54256aec45a7Smrg for search_ext in .la $std_shrext .so .a; do 54266aec45a7Smrg # Search the libtool library 54276aec45a7Smrg lib="$searchdir/lib${name}${search_ext}" 54286aec45a7Smrg if test -f "$lib"; then 54296aec45a7Smrg if test "$search_ext" = ".la"; then 54306aec45a7Smrg found=yes 54316aec45a7Smrg else 54326aec45a7Smrg found=no 54336aec45a7Smrg fi 54346aec45a7Smrg break 2 54356aec45a7Smrg fi 54366aec45a7Smrg done 54376aec45a7Smrg done 54386aec45a7Smrg if test "$found" != yes; then 54396aec45a7Smrg # deplib doesn't seem to be a libtool library 54406aec45a7Smrg if test "$linkmode,$pass" = "prog,link"; then 54416aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 54426aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 54436aec45a7Smrg else 54446aec45a7Smrg deplibs="$deplib $deplibs" 54456aec45a7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 54466aec45a7Smrg fi 54476aec45a7Smrg continue 54486aec45a7Smrg else # deplib is a libtool library 54496aec45a7Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 54506aec45a7Smrg # We need to do some special things here, and not later. 54516aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 54526aec45a7Smrg case " $predeps $postdeps " in 54536aec45a7Smrg *" $deplib "*) 54546aec45a7Smrg if func_lalib_p "$lib"; then 54556aec45a7Smrg library_names= 54566aec45a7Smrg old_library= 54576aec45a7Smrg func_source "$lib" 54586aec45a7Smrg for l in $old_library $library_names; do 54596aec45a7Smrg ll="$l" 54606aec45a7Smrg done 54616aec45a7Smrg if test "X$ll" = "X$old_library" ; then # only static version available 54626aec45a7Smrg found=no 54636aec45a7Smrg func_dirname "$lib" "" "." 54646aec45a7Smrg ladir="$func_dirname_result" 54656aec45a7Smrg lib=$ladir/$old_library 54666aec45a7Smrg if test "$linkmode,$pass" = "prog,link"; then 54676aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 54686aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 54696aec45a7Smrg else 54706aec45a7Smrg deplibs="$deplib $deplibs" 54716aec45a7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 54726aec45a7Smrg fi 54736aec45a7Smrg continue 54746aec45a7Smrg fi 54756aec45a7Smrg fi 54766aec45a7Smrg ;; 54776aec45a7Smrg *) ;; 54786aec45a7Smrg esac 54796aec45a7Smrg fi 54806aec45a7Smrg fi 54816aec45a7Smrg ;; # -l 54826aec45a7Smrg *.ltframework) 54836aec45a7Smrg if test "$linkmode,$pass" = "prog,link"; then 54846aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 54856aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 54866aec45a7Smrg else 54876aec45a7Smrg deplibs="$deplib $deplibs" 54886aec45a7Smrg if test "$linkmode" = lib ; then 54896aec45a7Smrg case "$new_inherited_linker_flags " in 54906aec45a7Smrg *" $deplib "*) ;; 54916aec45a7Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 54926aec45a7Smrg esac 54936aec45a7Smrg fi 54946aec45a7Smrg fi 54956aec45a7Smrg continue 54966aec45a7Smrg ;; 54976aec45a7Smrg -L*) 54986aec45a7Smrg case $linkmode in 54996aec45a7Smrg lib) 55006aec45a7Smrg deplibs="$deplib $deplibs" 55016aec45a7Smrg test "$pass" = conv && continue 55026aec45a7Smrg newdependency_libs="$deplib $newdependency_libs" 55036aec45a7Smrg func_stripname '-L' '' "$deplib" 55046aec45a7Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 55056aec45a7Smrg ;; 55066aec45a7Smrg prog) 55076aec45a7Smrg if test "$pass" = conv; then 55086aec45a7Smrg deplibs="$deplib $deplibs" 55096aec45a7Smrg continue 55106aec45a7Smrg fi 55116aec45a7Smrg if test "$pass" = scan; then 55126aec45a7Smrg deplibs="$deplib $deplibs" 55136aec45a7Smrg else 55146aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 55156aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 55166aec45a7Smrg fi 55176aec45a7Smrg func_stripname '-L' '' "$deplib" 55186aec45a7Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 55196aec45a7Smrg ;; 55206aec45a7Smrg *) 55216aec45a7Smrg func_warning "\`-L' is ignored for archives/objects" 55226aec45a7Smrg ;; 55236aec45a7Smrg esac # linkmode 55246aec45a7Smrg continue 55256aec45a7Smrg ;; # -L 55266aec45a7Smrg -R*) 55276aec45a7Smrg if test "$pass" = link; then 55286aec45a7Smrg func_stripname '-R' '' "$deplib" 55296aec45a7Smrg dir=$func_stripname_result 55306aec45a7Smrg # Make sure the xrpath contains only unique directories. 55316aec45a7Smrg case "$xrpath " in 55326aec45a7Smrg *" $dir "*) ;; 55336aec45a7Smrg *) xrpath="$xrpath $dir" ;; 55346aec45a7Smrg esac 55356aec45a7Smrg fi 55366aec45a7Smrg deplibs="$deplib $deplibs" 55376aec45a7Smrg continue 55386aec45a7Smrg ;; 55396aec45a7Smrg *.la) lib="$deplib" ;; 55406aec45a7Smrg *.$libext) 55416aec45a7Smrg if test "$pass" = conv; then 55426aec45a7Smrg deplibs="$deplib $deplibs" 55436aec45a7Smrg continue 55446aec45a7Smrg fi 55456aec45a7Smrg case $linkmode in 55466aec45a7Smrg lib) 55476aec45a7Smrg # Linking convenience modules into shared libraries is allowed, 55486aec45a7Smrg # but linking other static libraries is non-portable. 55496aec45a7Smrg case " $dlpreconveniencelibs " in 55506aec45a7Smrg *" $deplib "*) ;; 55516aec45a7Smrg *) 55526aec45a7Smrg valid_a_lib=no 55536aec45a7Smrg case $deplibs_check_method in 55546aec45a7Smrg match_pattern*) 55556aec45a7Smrg set dummy $deplibs_check_method; shift 55566aec45a7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 55576aec45a7Smrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 55586aec45a7Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 55596aec45a7Smrg valid_a_lib=yes 55606aec45a7Smrg fi 55616aec45a7Smrg ;; 55626aec45a7Smrg pass_all) 55636aec45a7Smrg valid_a_lib=yes 55646aec45a7Smrg ;; 55656aec45a7Smrg esac 55666aec45a7Smrg if test "$valid_a_lib" != yes; then 55676aec45a7Smrg echo 55686aec45a7Smrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 55696aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 55706aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 55716aec45a7Smrg echo "*** shared version of the library, which you do not appear to have" 55726aec45a7Smrg echo "*** because the file extensions .$libext of this argument makes me believe" 55736aec45a7Smrg echo "*** that it is just a static archive that I should not use here." 55746aec45a7Smrg else 55756aec45a7Smrg echo 55766aec45a7Smrg $ECHO "*** Warning: Linking the shared library $output against the" 55776aec45a7Smrg $ECHO "*** static library $deplib is not portable!" 55786aec45a7Smrg deplibs="$deplib $deplibs" 55796aec45a7Smrg fi 55806aec45a7Smrg ;; 55816aec45a7Smrg esac 55826aec45a7Smrg continue 55836aec45a7Smrg ;; 55846aec45a7Smrg prog) 55856aec45a7Smrg if test "$pass" != link; then 55866aec45a7Smrg deplibs="$deplib $deplibs" 55876aec45a7Smrg else 55886aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 55896aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 55906aec45a7Smrg fi 55916aec45a7Smrg continue 55926aec45a7Smrg ;; 55936aec45a7Smrg esac # linkmode 55946aec45a7Smrg ;; # *.$libext 55956aec45a7Smrg *.lo | *.$objext) 55966aec45a7Smrg if test "$pass" = conv; then 55976aec45a7Smrg deplibs="$deplib $deplibs" 55986aec45a7Smrg elif test "$linkmode" = prog; then 55996aec45a7Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 56006aec45a7Smrg # If there is no dlopen support or we're linking statically, 56016aec45a7Smrg # we need to preload. 56026aec45a7Smrg newdlprefiles="$newdlprefiles $deplib" 56036aec45a7Smrg compile_deplibs="$deplib $compile_deplibs" 56046aec45a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 56056aec45a7Smrg else 56066aec45a7Smrg newdlfiles="$newdlfiles $deplib" 56076aec45a7Smrg fi 56086aec45a7Smrg fi 56096aec45a7Smrg continue 56106aec45a7Smrg ;; 56116aec45a7Smrg %DEPLIBS%) 56126aec45a7Smrg alldeplibs=yes 56136aec45a7Smrg continue 56146aec45a7Smrg ;; 56156aec45a7Smrg esac # case $deplib 56166aec45a7Smrg 56176aec45a7Smrg if test "$found" = yes || test -f "$lib"; then : 56186aec45a7Smrg else 56196aec45a7Smrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 56206aec45a7Smrg fi 56216aec45a7Smrg 56226aec45a7Smrg # Check to see that this really is a libtool archive. 56236aec45a7Smrg func_lalib_unsafe_p "$lib" \ 56246aec45a7Smrg || func_fatal_error "\`$lib' is not a valid libtool archive" 56256aec45a7Smrg 56266aec45a7Smrg func_dirname "$lib" "" "." 56276aec45a7Smrg ladir="$func_dirname_result" 56286aec45a7Smrg 56296aec45a7Smrg dlname= 56306aec45a7Smrg dlopen= 56316aec45a7Smrg dlpreopen= 56326aec45a7Smrg libdir= 56336aec45a7Smrg library_names= 56346aec45a7Smrg old_library= 56356aec45a7Smrg inherited_linker_flags= 56366aec45a7Smrg # If the library was installed with an old release of libtool, 56376aec45a7Smrg # it will not redefine variables installed, or shouldnotlink 56386aec45a7Smrg installed=yes 56396aec45a7Smrg shouldnotlink=no 56406aec45a7Smrg avoidtemprpath= 56416aec45a7Smrg 56426aec45a7Smrg 56436aec45a7Smrg # Read the .la file 56446aec45a7Smrg func_source "$lib" 56456aec45a7Smrg 56466aec45a7Smrg # Convert "-framework foo" to "foo.ltframework" 56476aec45a7Smrg if test -n "$inherited_linker_flags"; then 56486aec45a7Smrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 56496aec45a7Smrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 56506aec45a7Smrg case " $new_inherited_linker_flags " in 56516aec45a7Smrg *" $tmp_inherited_linker_flag "*) ;; 56526aec45a7Smrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 56536aec45a7Smrg esac 56546aec45a7Smrg done 56556aec45a7Smrg fi 56566aec45a7Smrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 56576aec45a7Smrg if test "$linkmode,$pass" = "lib,link" || 56586aec45a7Smrg test "$linkmode,$pass" = "prog,scan" || 56596aec45a7Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 56606aec45a7Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 56616aec45a7Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 56626aec45a7Smrg fi 56636aec45a7Smrg 56646aec45a7Smrg if test "$pass" = conv; then 56656aec45a7Smrg # Only check for convenience libraries 56666aec45a7Smrg deplibs="$lib $deplibs" 56676aec45a7Smrg if test -z "$libdir"; then 56686aec45a7Smrg if test -z "$old_library"; then 56696aec45a7Smrg func_fatal_error "cannot find name of link library for \`$lib'" 56706aec45a7Smrg fi 56716aec45a7Smrg # It is a libtool convenience library, so add in its objects. 56726aec45a7Smrg convenience="$convenience $ladir/$objdir/$old_library" 56736aec45a7Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 56746aec45a7Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 56756aec45a7Smrg func_fatal_error "\`$lib' is not a convenience library" 56766aec45a7Smrg fi 56776aec45a7Smrg tmp_libs= 56786aec45a7Smrg for deplib in $dependency_libs; do 56796aec45a7Smrg deplibs="$deplib $deplibs" 56806aec45a7Smrg if $opt_duplicate_deps ; then 56816aec45a7Smrg case "$tmp_libs " in 56826aec45a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 56836aec45a7Smrg esac 56846aec45a7Smrg fi 56856aec45a7Smrg tmp_libs="$tmp_libs $deplib" 56866aec45a7Smrg done 56876aec45a7Smrg continue 56886aec45a7Smrg fi # $pass = conv 56896aec45a7Smrg 56906aec45a7Smrg 56916aec45a7Smrg # Get the name of the library we link against. 56926aec45a7Smrg linklib= 56936aec45a7Smrg for l in $old_library $library_names; do 56946aec45a7Smrg linklib="$l" 56956aec45a7Smrg done 56966aec45a7Smrg if test -z "$linklib"; then 56976aec45a7Smrg func_fatal_error "cannot find name of link library for \`$lib'" 56986aec45a7Smrg fi 56996aec45a7Smrg 57006aec45a7Smrg # This library was specified with -dlopen. 57016aec45a7Smrg if test "$pass" = dlopen; then 57026aec45a7Smrg if test -z "$libdir"; then 57036aec45a7Smrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 57046aec45a7Smrg fi 57056aec45a7Smrg if test -z "$dlname" || 57066aec45a7Smrg test "$dlopen_support" != yes || 57076aec45a7Smrg test "$build_libtool_libs" = no; then 57086aec45a7Smrg # If there is no dlname, no dlopen support or we're linking 57096aec45a7Smrg # statically, we need to preload. We also need to preload any 57106aec45a7Smrg # dependent libraries so libltdl's deplib preloader doesn't 57116aec45a7Smrg # bomb out in the load deplibs phase. 57126aec45a7Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 57136aec45a7Smrg else 57146aec45a7Smrg newdlfiles="$newdlfiles $lib" 57156aec45a7Smrg fi 57166aec45a7Smrg continue 57176aec45a7Smrg fi # $pass = dlopen 57186aec45a7Smrg 57196aec45a7Smrg # We need an absolute path. 57206aec45a7Smrg case $ladir in 57216aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 57226aec45a7Smrg *) 57236aec45a7Smrg abs_ladir=`cd "$ladir" && pwd` 57246aec45a7Smrg if test -z "$abs_ladir"; then 57256aec45a7Smrg func_warning "cannot determine absolute directory name of \`$ladir'" 57266aec45a7Smrg func_warning "passing it literally to the linker, although it might fail" 57276aec45a7Smrg abs_ladir="$ladir" 57286aec45a7Smrg fi 57296aec45a7Smrg ;; 57306aec45a7Smrg esac 57316aec45a7Smrg func_basename "$lib" 57326aec45a7Smrg laname="$func_basename_result" 57336aec45a7Smrg 57346aec45a7Smrg # Find the relevant object directory and library name. 57356aec45a7Smrg if test "X$installed" = Xyes; then 57366aec45a7Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 57376aec45a7Smrg func_warning "library \`$lib' was moved." 57386aec45a7Smrg dir="$ladir" 57396aec45a7Smrg absdir="$abs_ladir" 57406aec45a7Smrg libdir="$abs_ladir" 57416aec45a7Smrg else 57426aec45a7Smrg dir="$libdir" 57436aec45a7Smrg absdir="$libdir" 57446aec45a7Smrg fi 57456aec45a7Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 57466aec45a7Smrg else 57476aec45a7Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 57486aec45a7Smrg dir="$ladir" 57496aec45a7Smrg absdir="$abs_ladir" 57506aec45a7Smrg # Remove this search path later 57516aec45a7Smrg notinst_path="$notinst_path $abs_ladir" 57526aec45a7Smrg else 57536aec45a7Smrg dir="$ladir/$objdir" 57546aec45a7Smrg absdir="$abs_ladir/$objdir" 57556aec45a7Smrg # Remove this search path later 57566aec45a7Smrg notinst_path="$notinst_path $abs_ladir" 57576aec45a7Smrg fi 57586aec45a7Smrg fi # $installed = yes 57596aec45a7Smrg func_stripname 'lib' '.la' "$laname" 57606aec45a7Smrg name=$func_stripname_result 57616aec45a7Smrg 57626aec45a7Smrg # This library was specified with -dlpreopen. 57636aec45a7Smrg if test "$pass" = dlpreopen; then 57646aec45a7Smrg if test -z "$libdir" && test "$linkmode" = prog; then 57656aec45a7Smrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 57666aec45a7Smrg fi 57676aec45a7Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 57686aec45a7Smrg # are required to link). 57696aec45a7Smrg if test -n "$old_library"; then 57706aec45a7Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 57716aec45a7Smrg # Keep a list of preopened convenience libraries to check 57726aec45a7Smrg # that they are being used correctly in the link pass. 57736aec45a7Smrg test -z "$libdir" && \ 57746aec45a7Smrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 57756aec45a7Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 57766aec45a7Smrg elif test -n "$dlname"; then 57776aec45a7Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 57786aec45a7Smrg else 57796aec45a7Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 57806aec45a7Smrg fi 57816aec45a7Smrg fi # $pass = dlpreopen 57826aec45a7Smrg 57836aec45a7Smrg if test -z "$libdir"; then 57846aec45a7Smrg # Link the convenience library 57856aec45a7Smrg if test "$linkmode" = lib; then 57866aec45a7Smrg deplibs="$dir/$old_library $deplibs" 57876aec45a7Smrg elif test "$linkmode,$pass" = "prog,link"; then 57886aec45a7Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 57896aec45a7Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 57906aec45a7Smrg else 57916aec45a7Smrg deplibs="$lib $deplibs" # used for prog,scan pass 57926aec45a7Smrg fi 57936aec45a7Smrg continue 57946aec45a7Smrg fi 57956aec45a7Smrg 57966aec45a7Smrg 57976aec45a7Smrg if test "$linkmode" = prog && test "$pass" != link; then 57986aec45a7Smrg newlib_search_path="$newlib_search_path $ladir" 57996aec45a7Smrg deplibs="$lib $deplibs" 58006aec45a7Smrg 58016aec45a7Smrg linkalldeplibs=no 58026aec45a7Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 58036aec45a7Smrg test "$build_libtool_libs" = no; then 58046aec45a7Smrg linkalldeplibs=yes 58056aec45a7Smrg fi 58066aec45a7Smrg 58076aec45a7Smrg tmp_libs= 58086aec45a7Smrg for deplib in $dependency_libs; do 58096aec45a7Smrg case $deplib in 58106aec45a7Smrg -L*) func_stripname '-L' '' "$deplib" 58116aec45a7Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 58126aec45a7Smrg ;; 58136aec45a7Smrg esac 58146aec45a7Smrg # Need to link against all dependency_libs? 58156aec45a7Smrg if test "$linkalldeplibs" = yes; then 58166aec45a7Smrg deplibs="$deplib $deplibs" 58176aec45a7Smrg else 58186aec45a7Smrg # Need to hardcode shared library paths 58196aec45a7Smrg # or/and link against static libraries 58206aec45a7Smrg newdependency_libs="$deplib $newdependency_libs" 58216aec45a7Smrg fi 58226aec45a7Smrg if $opt_duplicate_deps ; then 58236aec45a7Smrg case "$tmp_libs " in 58246aec45a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 58256aec45a7Smrg esac 58266aec45a7Smrg fi 58276aec45a7Smrg tmp_libs="$tmp_libs $deplib" 58286aec45a7Smrg done # for deplib 58296aec45a7Smrg continue 58306aec45a7Smrg fi # $linkmode = prog... 58316aec45a7Smrg 58326aec45a7Smrg if test "$linkmode,$pass" = "prog,link"; then 58336aec45a7Smrg if test -n "$library_names" && 58346aec45a7Smrg { { test "$prefer_static_libs" = no || 58356aec45a7Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 58366aec45a7Smrg test -z "$old_library"; }; then 58376aec45a7Smrg # We need to hardcode the library path 58386aec45a7Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 58396aec45a7Smrg # Make sure the rpath contains only unique directories. 58406aec45a7Smrg case "$temp_rpath:" in 58416aec45a7Smrg *"$absdir:"*) ;; 58426aec45a7Smrg *) temp_rpath="$temp_rpath$absdir:" ;; 58436aec45a7Smrg esac 58446aec45a7Smrg fi 58456aec45a7Smrg 58466aec45a7Smrg # Hardcode the library path. 58476aec45a7Smrg # Skip directories that are in the system default run-time 58486aec45a7Smrg # search path. 58496aec45a7Smrg case " $sys_lib_dlsearch_path " in 58506aec45a7Smrg *" $absdir "*) ;; 58516aec45a7Smrg *) 58526aec45a7Smrg case "$compile_rpath " in 58536aec45a7Smrg *" $absdir "*) ;; 58546aec45a7Smrg *) compile_rpath="$compile_rpath $absdir" 58556aec45a7Smrg esac 58566aec45a7Smrg ;; 58576aec45a7Smrg esac 58586aec45a7Smrg case " $sys_lib_dlsearch_path " in 58596aec45a7Smrg *" $libdir "*) ;; 58606aec45a7Smrg *) 58616aec45a7Smrg case "$finalize_rpath " in 58626aec45a7Smrg *" $libdir "*) ;; 58636aec45a7Smrg *) finalize_rpath="$finalize_rpath $libdir" 58646aec45a7Smrg esac 58656aec45a7Smrg ;; 58666aec45a7Smrg esac 58676aec45a7Smrg fi # $linkmode,$pass = prog,link... 58686aec45a7Smrg 58696aec45a7Smrg if test "$alldeplibs" = yes && 58706aec45a7Smrg { test "$deplibs_check_method" = pass_all || 58716aec45a7Smrg { test "$build_libtool_libs" = yes && 58726aec45a7Smrg test -n "$library_names"; }; }; then 58736aec45a7Smrg # We only need to search for static libraries 58746aec45a7Smrg continue 58756aec45a7Smrg fi 58766aec45a7Smrg fi 58776aec45a7Smrg 58786aec45a7Smrg link_static=no # Whether the deplib will be linked statically 58796aec45a7Smrg use_static_libs=$prefer_static_libs 58806aec45a7Smrg if test "$use_static_libs" = built && test "$installed" = yes; then 58816aec45a7Smrg use_static_libs=no 58826aec45a7Smrg fi 58836aec45a7Smrg if test -n "$library_names" && 58846aec45a7Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 58856aec45a7Smrg case $host in 58866aec45a7Smrg *cygwin* | *mingw* | *cegcc*) 58876aec45a7Smrg # No point in relinking DLLs because paths are not encoded 58886aec45a7Smrg notinst_deplibs="$notinst_deplibs $lib" 58896aec45a7Smrg need_relink=no 58906aec45a7Smrg ;; 58916aec45a7Smrg *) 58926aec45a7Smrg if test "$installed" = no; then 58936aec45a7Smrg notinst_deplibs="$notinst_deplibs $lib" 58946aec45a7Smrg need_relink=yes 58956aec45a7Smrg fi 58966aec45a7Smrg ;; 58976aec45a7Smrg esac 58986aec45a7Smrg # This is a shared library 58996aec45a7Smrg 59006aec45a7Smrg # Warn about portability, can't link against -module's on some 59016aec45a7Smrg # systems (darwin). Don't bleat about dlopened modules though! 59026aec45a7Smrg dlopenmodule="" 59036aec45a7Smrg for dlpremoduletest in $dlprefiles; do 59046aec45a7Smrg if test "X$dlpremoduletest" = "X$lib"; then 59056aec45a7Smrg dlopenmodule="$dlpremoduletest" 59066aec45a7Smrg break 59076aec45a7Smrg fi 59086aec45a7Smrg done 59096aec45a7Smrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 59106aec45a7Smrg echo 59116aec45a7Smrg if test "$linkmode" = prog; then 59126aec45a7Smrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 59136aec45a7Smrg else 59146aec45a7Smrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 59156aec45a7Smrg fi 59166aec45a7Smrg $ECHO "*** $linklib is not portable!" 59176aec45a7Smrg fi 59186aec45a7Smrg if test "$linkmode" = lib && 59196aec45a7Smrg test "$hardcode_into_libs" = yes; then 59206aec45a7Smrg # Hardcode the library path. 59216aec45a7Smrg # Skip directories that are in the system default run-time 59226aec45a7Smrg # search path. 59236aec45a7Smrg case " $sys_lib_dlsearch_path " in 59246aec45a7Smrg *" $absdir "*) ;; 59256aec45a7Smrg *) 59266aec45a7Smrg case "$compile_rpath " in 59276aec45a7Smrg *" $absdir "*) ;; 59286aec45a7Smrg *) compile_rpath="$compile_rpath $absdir" 59296aec45a7Smrg esac 59306aec45a7Smrg ;; 59316aec45a7Smrg esac 59326aec45a7Smrg case " $sys_lib_dlsearch_path " in 59336aec45a7Smrg *" $libdir "*) ;; 59346aec45a7Smrg *) 59356aec45a7Smrg case "$finalize_rpath " in 59366aec45a7Smrg *" $libdir "*) ;; 59376aec45a7Smrg *) finalize_rpath="$finalize_rpath $libdir" 59386aec45a7Smrg esac 59396aec45a7Smrg ;; 59406aec45a7Smrg esac 59416aec45a7Smrg fi 59426aec45a7Smrg 59436aec45a7Smrg if test -n "$old_archive_from_expsyms_cmds"; then 59446aec45a7Smrg # figure out the soname 59456aec45a7Smrg set dummy $library_names 59466aec45a7Smrg shift 59476aec45a7Smrg realname="$1" 59486aec45a7Smrg shift 59496aec45a7Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 59506aec45a7Smrg # use dlname if we got it. it's perfectly good, no? 59516aec45a7Smrg if test -n "$dlname"; then 59526aec45a7Smrg soname="$dlname" 59536aec45a7Smrg elif test -n "$soname_spec"; then 59546aec45a7Smrg # bleh windows 59556aec45a7Smrg case $host in 59566aec45a7Smrg *cygwin* | mingw* | *cegcc*) 59576aec45a7Smrg func_arith $current - $age 59586aec45a7Smrg major=$func_arith_result 59596aec45a7Smrg versuffix="-$major" 59606aec45a7Smrg ;; 59616aec45a7Smrg esac 59626aec45a7Smrg eval soname=\"$soname_spec\" 59636aec45a7Smrg else 59646aec45a7Smrg soname="$realname" 59656aec45a7Smrg fi 59666aec45a7Smrg 59676aec45a7Smrg # Make a new name for the extract_expsyms_cmds to use 59686aec45a7Smrg soroot="$soname" 59696aec45a7Smrg func_basename "$soroot" 59706aec45a7Smrg soname="$func_basename_result" 59716aec45a7Smrg func_stripname 'lib' '.dll' "$soname" 59726aec45a7Smrg newlib=libimp-$func_stripname_result.a 59736aec45a7Smrg 59746aec45a7Smrg # If the library has no export list, then create one now 59756aec45a7Smrg if test -f "$output_objdir/$soname-def"; then : 59766aec45a7Smrg else 59776aec45a7Smrg func_verbose "extracting exported symbol list from \`$soname'" 59786aec45a7Smrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 59796aec45a7Smrg fi 59806aec45a7Smrg 59816aec45a7Smrg # Create $newlib 59826aec45a7Smrg if test -f "$output_objdir/$newlib"; then :; else 59836aec45a7Smrg func_verbose "generating import library for \`$soname'" 59846aec45a7Smrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 59856aec45a7Smrg fi 59866aec45a7Smrg # make sure the library variables are pointing to the new library 59876aec45a7Smrg dir=$output_objdir 59886aec45a7Smrg linklib=$newlib 59896aec45a7Smrg fi # test -n "$old_archive_from_expsyms_cmds" 59906aec45a7Smrg 59916aec45a7Smrg if test "$linkmode" = prog || test "$mode" != relink; then 59926aec45a7Smrg add_shlibpath= 59936aec45a7Smrg add_dir= 59946aec45a7Smrg add= 59956aec45a7Smrg lib_linked=yes 59966aec45a7Smrg case $hardcode_action in 59976aec45a7Smrg immediate | unsupported) 59986aec45a7Smrg if test "$hardcode_direct" = no; then 59996aec45a7Smrg add="$dir/$linklib" 60006aec45a7Smrg case $host in 60016aec45a7Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 60026aec45a7Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 60036aec45a7Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 60046aec45a7Smrg *-*-unixware7*) add_dir="-L$dir" ;; 60056aec45a7Smrg *-*-darwin* ) 60066aec45a7Smrg # if the lib is a (non-dlopened) module then we can not 60076aec45a7Smrg # link against it, someone is ignoring the earlier warnings 60086aec45a7Smrg if /usr/bin/file -L $add 2> /dev/null | 60096aec45a7Smrg $GREP ": [^:]* bundle" >/dev/null ; then 60106aec45a7Smrg if test "X$dlopenmodule" != "X$lib"; then 60116aec45a7Smrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 60126aec45a7Smrg if test -z "$old_library" ; then 60136aec45a7Smrg echo 60146aec45a7Smrg echo "*** And there doesn't seem to be a static archive available" 60156aec45a7Smrg echo "*** The link will probably fail, sorry" 60166aec45a7Smrg else 60176aec45a7Smrg add="$dir/$old_library" 60186aec45a7Smrg fi 60196aec45a7Smrg elif test -n "$old_library"; then 60206aec45a7Smrg add="$dir/$old_library" 60216aec45a7Smrg fi 60226aec45a7Smrg fi 60236aec45a7Smrg esac 60246aec45a7Smrg elif test "$hardcode_minus_L" = no; then 60256aec45a7Smrg case $host in 60266aec45a7Smrg *-*-sunos*) add_shlibpath="$dir" ;; 60276aec45a7Smrg esac 60286aec45a7Smrg add_dir="-L$dir" 60296aec45a7Smrg add="-l$name" 60306aec45a7Smrg elif test "$hardcode_shlibpath_var" = no; then 60316aec45a7Smrg add_shlibpath="$dir" 60326aec45a7Smrg add="-l$name" 60336aec45a7Smrg else 60346aec45a7Smrg lib_linked=no 60356aec45a7Smrg fi 60366aec45a7Smrg ;; 60376aec45a7Smrg relink) 60386aec45a7Smrg if test "$hardcode_direct" = yes && 60396aec45a7Smrg test "$hardcode_direct_absolute" = no; then 60406aec45a7Smrg add="$dir/$linklib" 60416aec45a7Smrg elif test "$hardcode_minus_L" = yes; then 60426aec45a7Smrg add_dir="-L$dir" 60436aec45a7Smrg # Try looking first in the location we're being installed to. 60446aec45a7Smrg if test -n "$inst_prefix_dir"; then 60456aec45a7Smrg case $libdir in 60466aec45a7Smrg [\\/]*) 60476aec45a7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 60486aec45a7Smrg ;; 60496aec45a7Smrg esac 60506aec45a7Smrg fi 60516aec45a7Smrg add="-l$name" 60526aec45a7Smrg elif test "$hardcode_shlibpath_var" = yes; then 60536aec45a7Smrg add_shlibpath="$dir" 60546aec45a7Smrg add="-l$name" 60556aec45a7Smrg else 60566aec45a7Smrg lib_linked=no 60576aec45a7Smrg fi 60586aec45a7Smrg ;; 60596aec45a7Smrg *) lib_linked=no ;; 60606aec45a7Smrg esac 60616aec45a7Smrg 60626aec45a7Smrg if test "$lib_linked" != yes; then 60636aec45a7Smrg func_fatal_configuration "unsupported hardcode properties" 60646aec45a7Smrg fi 60656aec45a7Smrg 60666aec45a7Smrg if test -n "$add_shlibpath"; then 60676aec45a7Smrg case :$compile_shlibpath: in 60686aec45a7Smrg *":$add_shlibpath:"*) ;; 60696aec45a7Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 60706aec45a7Smrg esac 60716aec45a7Smrg fi 60726aec45a7Smrg if test "$linkmode" = prog; then 60736aec45a7Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 60746aec45a7Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 60756aec45a7Smrg else 60766aec45a7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 60776aec45a7Smrg test -n "$add" && deplibs="$add $deplibs" 60786aec45a7Smrg if test "$hardcode_direct" != yes && 60796aec45a7Smrg test "$hardcode_minus_L" != yes && 60806aec45a7Smrg test "$hardcode_shlibpath_var" = yes; then 60816aec45a7Smrg case :$finalize_shlibpath: in 60826aec45a7Smrg *":$libdir:"*) ;; 60836aec45a7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 60846aec45a7Smrg esac 60856aec45a7Smrg fi 60866aec45a7Smrg fi 60876aec45a7Smrg fi 60886aec45a7Smrg 60896aec45a7Smrg if test "$linkmode" = prog || test "$mode" = relink; then 60906aec45a7Smrg add_shlibpath= 60916aec45a7Smrg add_dir= 60926aec45a7Smrg add= 60936aec45a7Smrg # Finalize command for both is simple: just hardcode it. 60946aec45a7Smrg if test "$hardcode_direct" = yes && 60956aec45a7Smrg test "$hardcode_direct_absolute" = no; then 60966aec45a7Smrg add="$libdir/$linklib" 60976aec45a7Smrg elif test "$hardcode_minus_L" = yes; then 60986aec45a7Smrg add_dir="-L$libdir" 60996aec45a7Smrg add="-l$name" 61006aec45a7Smrg elif test "$hardcode_shlibpath_var" = yes; then 61016aec45a7Smrg case :$finalize_shlibpath: in 61026aec45a7Smrg *":$libdir:"*) ;; 61036aec45a7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 61046aec45a7Smrg esac 61056aec45a7Smrg add="-l$name" 61066aec45a7Smrg elif test "$hardcode_automatic" = yes; then 61076aec45a7Smrg if test -n "$inst_prefix_dir" && 61086aec45a7Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 61096aec45a7Smrg add="$inst_prefix_dir$libdir/$linklib" 61106aec45a7Smrg else 61116aec45a7Smrg add="$libdir/$linklib" 61126aec45a7Smrg fi 61136aec45a7Smrg else 61146aec45a7Smrg # We cannot seem to hardcode it, guess we'll fake it. 61156aec45a7Smrg add_dir="-L$libdir" 61166aec45a7Smrg # Try looking first in the location we're being installed to. 61176aec45a7Smrg if test -n "$inst_prefix_dir"; then 61186aec45a7Smrg case $libdir in 61196aec45a7Smrg [\\/]*) 61206aec45a7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 61216aec45a7Smrg ;; 61226aec45a7Smrg esac 61236aec45a7Smrg fi 61246aec45a7Smrg add="-l$name" 61256aec45a7Smrg fi 61266aec45a7Smrg 61276aec45a7Smrg if test "$linkmode" = prog; then 61286aec45a7Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 61296aec45a7Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 61306aec45a7Smrg else 61316aec45a7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 61326aec45a7Smrg test -n "$add" && deplibs="$add $deplibs" 61336aec45a7Smrg fi 61346aec45a7Smrg fi 61356aec45a7Smrg elif test "$linkmode" = prog; then 61366aec45a7Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 61376aec45a7Smrg # is not unsupported. This is valid on all known static and 61386aec45a7Smrg # shared platforms. 61396aec45a7Smrg if test "$hardcode_direct" != unsupported; then 61406aec45a7Smrg test -n "$old_library" && linklib="$old_library" 61416aec45a7Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 61426aec45a7Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 61436aec45a7Smrg else 61446aec45a7Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 61456aec45a7Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 61466aec45a7Smrg fi 61476aec45a7Smrg elif test "$build_libtool_libs" = yes; then 61486aec45a7Smrg # Not a shared library 61496aec45a7Smrg if test "$deplibs_check_method" != pass_all; then 61506aec45a7Smrg # We're trying link a shared library against a static one 61516aec45a7Smrg # but the system doesn't support it. 61526aec45a7Smrg 61536aec45a7Smrg # Just print a warning and add the library to dependency_libs so 61546aec45a7Smrg # that the program can be linked against the static library. 61556aec45a7Smrg echo 61566aec45a7Smrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 61576aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 61586aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 61596aec45a7Smrg echo "*** shared version of the library, which you do not appear to have." 61606aec45a7Smrg if test "$module" = yes; then 61616aec45a7Smrg echo "*** But as you try to build a module library, libtool will still create " 61626aec45a7Smrg echo "*** a static module, that should work as long as the dlopening application" 61636aec45a7Smrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 61646aec45a7Smrg if test -z "$global_symbol_pipe"; then 61656aec45a7Smrg echo 61666aec45a7Smrg echo "*** However, this would only work if libtool was able to extract symbol" 61676aec45a7Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 61686aec45a7Smrg echo "*** not find such a program. So, this module is probably useless." 61696aec45a7Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 61706aec45a7Smrg fi 61716aec45a7Smrg if test "$build_old_libs" = no; then 61726aec45a7Smrg build_libtool_libs=module 61736aec45a7Smrg build_old_libs=yes 61746aec45a7Smrg else 61756aec45a7Smrg build_libtool_libs=no 61766aec45a7Smrg fi 61776aec45a7Smrg fi 61786aec45a7Smrg else 61796aec45a7Smrg deplibs="$dir/$old_library $deplibs" 61806aec45a7Smrg link_static=yes 61816aec45a7Smrg fi 61826aec45a7Smrg fi # link shared/static library? 61836aec45a7Smrg 61846aec45a7Smrg if test "$linkmode" = lib; then 61856aec45a7Smrg if test -n "$dependency_libs" && 61866aec45a7Smrg { test "$hardcode_into_libs" != yes || 61876aec45a7Smrg test "$build_old_libs" = yes || 61886aec45a7Smrg test "$link_static" = yes; }; then 61896aec45a7Smrg # Extract -R from dependency_libs 61906aec45a7Smrg temp_deplibs= 61916aec45a7Smrg for libdir in $dependency_libs; do 61926aec45a7Smrg case $libdir in 61936aec45a7Smrg -R*) func_stripname '-R' '' "$libdir" 61946aec45a7Smrg temp_xrpath=$func_stripname_result 61956aec45a7Smrg case " $xrpath " in 61966aec45a7Smrg *" $temp_xrpath "*) ;; 61976aec45a7Smrg *) xrpath="$xrpath $temp_xrpath";; 61986aec45a7Smrg esac;; 61996aec45a7Smrg *) temp_deplibs="$temp_deplibs $libdir";; 62006aec45a7Smrg esac 62016aec45a7Smrg done 62026aec45a7Smrg dependency_libs="$temp_deplibs" 62036aec45a7Smrg fi 62046aec45a7Smrg 62056aec45a7Smrg newlib_search_path="$newlib_search_path $absdir" 62066aec45a7Smrg # Link against this library 62076aec45a7Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 62086aec45a7Smrg # ... and its dependency_libs 62096aec45a7Smrg tmp_libs= 62106aec45a7Smrg for deplib in $dependency_libs; do 62116aec45a7Smrg newdependency_libs="$deplib $newdependency_libs" 62126aec45a7Smrg if $opt_duplicate_deps ; then 62136aec45a7Smrg case "$tmp_libs " in 62146aec45a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 62156aec45a7Smrg esac 62166aec45a7Smrg fi 62176aec45a7Smrg tmp_libs="$tmp_libs $deplib" 62186aec45a7Smrg done 62196aec45a7Smrg 62206aec45a7Smrg if test "$link_all_deplibs" != no; then 62216aec45a7Smrg # Add the search paths of all dependency libraries 62226aec45a7Smrg for deplib in $dependency_libs; do 62236aec45a7Smrg path= 62246aec45a7Smrg case $deplib in 62256aec45a7Smrg -L*) path="$deplib" ;; 62266aec45a7Smrg *.la) 62276aec45a7Smrg func_dirname "$deplib" "" "." 62286aec45a7Smrg dir="$func_dirname_result" 62296aec45a7Smrg # We need an absolute path. 62306aec45a7Smrg case $dir in 62316aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 62326aec45a7Smrg *) 62336aec45a7Smrg absdir=`cd "$dir" && pwd` 62346aec45a7Smrg if test -z "$absdir"; then 62356aec45a7Smrg func_warning "cannot determine absolute directory name of \`$dir'" 62366aec45a7Smrg absdir="$dir" 62376aec45a7Smrg fi 62386aec45a7Smrg ;; 62396aec45a7Smrg esac 62406aec45a7Smrg if $GREP "^installed=no" $deplib > /dev/null; then 62416aec45a7Smrg case $host in 62426aec45a7Smrg *-*-darwin*) 62436aec45a7Smrg depdepl= 62446aec45a7Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 62456aec45a7Smrg if test -n "$deplibrary_names" ; then 62466aec45a7Smrg for tmp in $deplibrary_names ; do 62476aec45a7Smrg depdepl=$tmp 62486aec45a7Smrg done 62496aec45a7Smrg if test -f "$absdir/$objdir/$depdepl" ; then 62506aec45a7Smrg depdepl="$absdir/$objdir/$depdepl" 62516aec45a7Smrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 62526aec45a7Smrg if test -z "$darwin_install_name"; then 62536aec45a7Smrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 62546aec45a7Smrg fi 62556aec45a7Smrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 62566aec45a7Smrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 62576aec45a7Smrg path= 62586aec45a7Smrg fi 62596aec45a7Smrg fi 62606aec45a7Smrg ;; 62616aec45a7Smrg *) 62626aec45a7Smrg path="-L$absdir/$objdir" 62636aec45a7Smrg ;; 62646aec45a7Smrg esac 62656aec45a7Smrg else 62666aec45a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 62676aec45a7Smrg test -z "$libdir" && \ 62686aec45a7Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 62696aec45a7Smrg test "$absdir" != "$libdir" && \ 62706aec45a7Smrg func_warning "\`$deplib' seems to be moved" 62716aec45a7Smrg 62726aec45a7Smrg path="-L$absdir" 62736aec45a7Smrg fi 62746aec45a7Smrg ;; 62756aec45a7Smrg esac 62766aec45a7Smrg case " $deplibs " in 62776aec45a7Smrg *" $path "*) ;; 62786aec45a7Smrg *) deplibs="$path $deplibs" ;; 62796aec45a7Smrg esac 62806aec45a7Smrg done 62816aec45a7Smrg fi # link_all_deplibs != no 62826aec45a7Smrg fi # linkmode = lib 62836aec45a7Smrg done # for deplib in $libs 62846aec45a7Smrg if test "$pass" = link; then 62856aec45a7Smrg if test "$linkmode" = "prog"; then 62866aec45a7Smrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 62876aec45a7Smrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 62886aec45a7Smrg else 62896aec45a7Smrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 62906aec45a7Smrg fi 62916aec45a7Smrg fi 62926aec45a7Smrg dependency_libs="$newdependency_libs" 62936aec45a7Smrg if test "$pass" = dlpreopen; then 62946aec45a7Smrg # Link the dlpreopened libraries before other libraries 62956aec45a7Smrg for deplib in $save_deplibs; do 62966aec45a7Smrg deplibs="$deplib $deplibs" 62976aec45a7Smrg done 62986aec45a7Smrg fi 62996aec45a7Smrg if test "$pass" != dlopen; then 63006aec45a7Smrg if test "$pass" != conv; then 63016aec45a7Smrg # Make sure lib_search_path contains only unique directories. 63026aec45a7Smrg lib_search_path= 63036aec45a7Smrg for dir in $newlib_search_path; do 63046aec45a7Smrg case "$lib_search_path " in 63056aec45a7Smrg *" $dir "*) ;; 63066aec45a7Smrg *) lib_search_path="$lib_search_path $dir" ;; 63076aec45a7Smrg esac 63086aec45a7Smrg done 63096aec45a7Smrg newlib_search_path= 63106aec45a7Smrg fi 63116aec45a7Smrg 63126aec45a7Smrg if test "$linkmode,$pass" != "prog,link"; then 63136aec45a7Smrg vars="deplibs" 63146aec45a7Smrg else 63156aec45a7Smrg vars="compile_deplibs finalize_deplibs" 63166aec45a7Smrg fi 63176aec45a7Smrg for var in $vars dependency_libs; do 63186aec45a7Smrg # Add libraries to $var in reverse order 63196aec45a7Smrg eval tmp_libs=\"\$$var\" 63206aec45a7Smrg new_libs= 63216aec45a7Smrg for deplib in $tmp_libs; do 63226aec45a7Smrg # FIXME: Pedantically, this is the right thing to do, so 63236aec45a7Smrg # that some nasty dependency loop isn't accidentally 63246aec45a7Smrg # broken: 63256aec45a7Smrg #new_libs="$deplib $new_libs" 63266aec45a7Smrg # Pragmatically, this seems to cause very few problems in 63276aec45a7Smrg # practice: 63286aec45a7Smrg case $deplib in 63296aec45a7Smrg -L*) new_libs="$deplib $new_libs" ;; 63306aec45a7Smrg -R*) ;; 63316aec45a7Smrg *) 63326aec45a7Smrg # And here is the reason: when a library appears more 63336aec45a7Smrg # than once as an explicit dependence of a library, or 63346aec45a7Smrg # is implicitly linked in more than once by the 63356aec45a7Smrg # compiler, it is considered special, and multiple 63366aec45a7Smrg # occurrences thereof are not removed. Compare this 63376aec45a7Smrg # with having the same library being listed as a 63386aec45a7Smrg # dependency of multiple other libraries: in this case, 63396aec45a7Smrg # we know (pedantically, we assume) the library does not 63406aec45a7Smrg # need to be listed more than once, so we keep only the 63416aec45a7Smrg # last copy. This is not always right, but it is rare 63426aec45a7Smrg # enough that we require users that really mean to play 63436aec45a7Smrg # such unportable linking tricks to link the library 63446aec45a7Smrg # using -Wl,-lname, so that libtool does not consider it 63456aec45a7Smrg # for duplicate removal. 63466aec45a7Smrg case " $specialdeplibs " in 63476aec45a7Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 63486aec45a7Smrg *) 63496aec45a7Smrg case " $new_libs " in 63506aec45a7Smrg *" $deplib "*) ;; 63516aec45a7Smrg *) new_libs="$deplib $new_libs" ;; 63526aec45a7Smrg esac 63536aec45a7Smrg ;; 63546aec45a7Smrg esac 63556aec45a7Smrg ;; 63566aec45a7Smrg esac 63576aec45a7Smrg done 63586aec45a7Smrg tmp_libs= 63596aec45a7Smrg for deplib in $new_libs; do 63606aec45a7Smrg case $deplib in 63616aec45a7Smrg -L*) 63626aec45a7Smrg case " $tmp_libs " in 63636aec45a7Smrg *" $deplib "*) ;; 63646aec45a7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 63656aec45a7Smrg esac 63666aec45a7Smrg ;; 63676aec45a7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 63686aec45a7Smrg esac 63696aec45a7Smrg done 63706aec45a7Smrg eval $var=\"$tmp_libs\" 63716aec45a7Smrg done # for var 63726aec45a7Smrg fi 63736aec45a7Smrg # Last step: remove runtime libs from dependency_libs 63746aec45a7Smrg # (they stay in deplibs) 63756aec45a7Smrg tmp_libs= 63766aec45a7Smrg for i in $dependency_libs ; do 63776aec45a7Smrg case " $predeps $postdeps $compiler_lib_search_path " in 63786aec45a7Smrg *" $i "*) 63796aec45a7Smrg i="" 63806aec45a7Smrg ;; 63816aec45a7Smrg esac 63826aec45a7Smrg if test -n "$i" ; then 63836aec45a7Smrg tmp_libs="$tmp_libs $i" 63846aec45a7Smrg fi 63856aec45a7Smrg done 63866aec45a7Smrg dependency_libs=$tmp_libs 63876aec45a7Smrg done # for pass 63886aec45a7Smrg if test "$linkmode" = prog; then 63896aec45a7Smrg dlfiles="$newdlfiles" 63906aec45a7Smrg fi 63916aec45a7Smrg if test "$linkmode" = prog || test "$linkmode" = lib; then 63926aec45a7Smrg dlprefiles="$newdlprefiles" 63936aec45a7Smrg fi 63946aec45a7Smrg 63956aec45a7Smrg case $linkmode in 63966aec45a7Smrg oldlib) 63976aec45a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 63986aec45a7Smrg func_warning "\`-dlopen' is ignored for archives" 63996aec45a7Smrg fi 64006aec45a7Smrg 64016aec45a7Smrg case " $deplibs" in 64026aec45a7Smrg *\ -l* | *\ -L*) 64036aec45a7Smrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 64046aec45a7Smrg esac 64056aec45a7Smrg 64066aec45a7Smrg test -n "$rpath" && \ 64076aec45a7Smrg func_warning "\`-rpath' is ignored for archives" 64086aec45a7Smrg 64096aec45a7Smrg test -n "$xrpath" && \ 64106aec45a7Smrg func_warning "\`-R' is ignored for archives" 64116aec45a7Smrg 64126aec45a7Smrg test -n "$vinfo" && \ 64136aec45a7Smrg func_warning "\`-version-info/-version-number' is ignored for archives" 64146aec45a7Smrg 64156aec45a7Smrg test -n "$release" && \ 64166aec45a7Smrg func_warning "\`-release' is ignored for archives" 64176aec45a7Smrg 64186aec45a7Smrg test -n "$export_symbols$export_symbols_regex" && \ 64196aec45a7Smrg func_warning "\`-export-symbols' is ignored for archives" 64206aec45a7Smrg 64216aec45a7Smrg # Now set the variables for building old libraries. 64226aec45a7Smrg build_libtool_libs=no 64236aec45a7Smrg oldlibs="$output" 64246aec45a7Smrg objs="$objs$old_deplibs" 64256aec45a7Smrg ;; 64266aec45a7Smrg 64276aec45a7Smrg lib) 64286aec45a7Smrg # Make sure we only generate libraries of the form `libNAME.la'. 64296aec45a7Smrg case $outputname in 64306aec45a7Smrg lib*) 64316aec45a7Smrg func_stripname 'lib' '.la' "$outputname" 64326aec45a7Smrg name=$func_stripname_result 64336aec45a7Smrg eval shared_ext=\"$shrext_cmds\" 64346aec45a7Smrg eval libname=\"$libname_spec\" 64356aec45a7Smrg ;; 64366aec45a7Smrg *) 64376aec45a7Smrg test "$module" = no && \ 64386aec45a7Smrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 64396aec45a7Smrg 64406aec45a7Smrg if test "$need_lib_prefix" != no; then 64416aec45a7Smrg # Add the "lib" prefix for modules if required 64426aec45a7Smrg func_stripname '' '.la' "$outputname" 64436aec45a7Smrg name=$func_stripname_result 64446aec45a7Smrg eval shared_ext=\"$shrext_cmds\" 64456aec45a7Smrg eval libname=\"$libname_spec\" 64466aec45a7Smrg else 64476aec45a7Smrg func_stripname '' '.la' "$outputname" 64486aec45a7Smrg libname=$func_stripname_result 64496aec45a7Smrg fi 64506aec45a7Smrg ;; 64516aec45a7Smrg esac 64526aec45a7Smrg 64536aec45a7Smrg if test -n "$objs"; then 64546aec45a7Smrg if test "$deplibs_check_method" != pass_all; then 64556aec45a7Smrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 64566aec45a7Smrg else 64576aec45a7Smrg echo 64586aec45a7Smrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 64596aec45a7Smrg $ECHO "*** objects $objs is not portable!" 64606aec45a7Smrg libobjs="$libobjs $objs" 64616aec45a7Smrg fi 64626aec45a7Smrg fi 64636aec45a7Smrg 64646aec45a7Smrg test "$dlself" != no && \ 64656aec45a7Smrg func_warning "\`-dlopen self' is ignored for libtool libraries" 64666aec45a7Smrg 64676aec45a7Smrg set dummy $rpath 64686aec45a7Smrg shift 64696aec45a7Smrg test "$#" -gt 1 && \ 64706aec45a7Smrg func_warning "ignoring multiple \`-rpath's for a libtool library" 64716aec45a7Smrg 64726aec45a7Smrg install_libdir="$1" 64736aec45a7Smrg 64746aec45a7Smrg oldlibs= 64756aec45a7Smrg if test -z "$rpath"; then 64766aec45a7Smrg if test "$build_libtool_libs" = yes; then 64776aec45a7Smrg # Building a libtool convenience library. 64786aec45a7Smrg # Some compilers have problems with a `.al' extension so 64796aec45a7Smrg # convenience libraries should have the same extension an 64806aec45a7Smrg # archive normally would. 64816aec45a7Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 64826aec45a7Smrg build_libtool_libs=convenience 64836aec45a7Smrg build_old_libs=yes 64846aec45a7Smrg fi 64856aec45a7Smrg 64866aec45a7Smrg test -n "$vinfo" && \ 64876aec45a7Smrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 64886aec45a7Smrg 64896aec45a7Smrg test -n "$release" && \ 64906aec45a7Smrg func_warning "\`-release' is ignored for convenience libraries" 64916aec45a7Smrg else 64926aec45a7Smrg 64936aec45a7Smrg # Parse the version information argument. 64946aec45a7Smrg save_ifs="$IFS"; IFS=':' 64956aec45a7Smrg set dummy $vinfo 0 0 0 64966aec45a7Smrg shift 64976aec45a7Smrg IFS="$save_ifs" 64986aec45a7Smrg 64996aec45a7Smrg test -n "$7" && \ 65006aec45a7Smrg func_fatal_help "too many parameters to \`-version-info'" 65016aec45a7Smrg 65026aec45a7Smrg # convert absolute version numbers to libtool ages 65036aec45a7Smrg # this retains compatibility with .la files and attempts 65046aec45a7Smrg # to make the code below a bit more comprehensible 65056aec45a7Smrg 65066aec45a7Smrg case $vinfo_number in 65076aec45a7Smrg yes) 65086aec45a7Smrg number_major="$1" 65096aec45a7Smrg number_minor="$2" 65106aec45a7Smrg number_revision="$3" 65116aec45a7Smrg # 65126aec45a7Smrg # There are really only two kinds -- those that 65136aec45a7Smrg # use the current revision as the major version 65146aec45a7Smrg # and those that subtract age and use age as 65156aec45a7Smrg # a minor version. But, then there is irix 65166aec45a7Smrg # which has an extra 1 added just for fun 65176aec45a7Smrg # 65186aec45a7Smrg case $version_type in 65196aec45a7Smrg darwin|linux|osf|windows|none) 65206aec45a7Smrg func_arith $number_major + $number_minor 65216aec45a7Smrg current=$func_arith_result 65226aec45a7Smrg age="$number_minor" 65236aec45a7Smrg revision="$number_revision" 65246aec45a7Smrg ;; 65256aec45a7Smrg freebsd-aout|freebsd-elf|qnx|sunos) 65266aec45a7Smrg current="$number_major" 65276aec45a7Smrg revision="$number_minor" 65286aec45a7Smrg age="0" 65296aec45a7Smrg ;; 65306aec45a7Smrg irix|nonstopux) 65316aec45a7Smrg func_arith $number_major + $number_minor 65326aec45a7Smrg current=$func_arith_result 65336aec45a7Smrg age="$number_minor" 65346aec45a7Smrg revision="$number_minor" 65356aec45a7Smrg lt_irix_increment=no 65366aec45a7Smrg ;; 65376aec45a7Smrg esac 65386aec45a7Smrg ;; 65396aec45a7Smrg no) 65406aec45a7Smrg current="$1" 65416aec45a7Smrg revision="$2" 65426aec45a7Smrg age="$3" 65436aec45a7Smrg ;; 65446aec45a7Smrg esac 65456aec45a7Smrg 65466aec45a7Smrg # Check that each of the things are valid numbers. 65476aec45a7Smrg case $current in 65486aec45a7Smrg 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]) ;; 65496aec45a7Smrg *) 65506aec45a7Smrg func_error "CURRENT \`$current' must be a nonnegative integer" 65516aec45a7Smrg func_fatal_error "\`$vinfo' is not valid version information" 65526aec45a7Smrg ;; 65536aec45a7Smrg esac 65546aec45a7Smrg 65556aec45a7Smrg case $revision in 65566aec45a7Smrg 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]) ;; 65576aec45a7Smrg *) 65586aec45a7Smrg func_error "REVISION \`$revision' must be a nonnegative integer" 65596aec45a7Smrg func_fatal_error "\`$vinfo' is not valid version information" 65606aec45a7Smrg ;; 65616aec45a7Smrg esac 65626aec45a7Smrg 65636aec45a7Smrg case $age in 65646aec45a7Smrg 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]) ;; 65656aec45a7Smrg *) 65666aec45a7Smrg func_error "AGE \`$age' must be a nonnegative integer" 65676aec45a7Smrg func_fatal_error "\`$vinfo' is not valid version information" 65686aec45a7Smrg ;; 65696aec45a7Smrg esac 65706aec45a7Smrg 65716aec45a7Smrg if test "$age" -gt "$current"; then 65726aec45a7Smrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 65736aec45a7Smrg func_fatal_error "\`$vinfo' is not valid version information" 65746aec45a7Smrg fi 65756aec45a7Smrg 65766aec45a7Smrg # Calculate the version variables. 65776aec45a7Smrg major= 65786aec45a7Smrg versuffix= 65796aec45a7Smrg verstring= 65806aec45a7Smrg case $version_type in 65816aec45a7Smrg none) ;; 65826aec45a7Smrg 65836aec45a7Smrg darwin) 65846aec45a7Smrg # Like Linux, but with the current version available in 65856aec45a7Smrg # verstring for coding it into the library header 65866aec45a7Smrg func_arith $current - $age 65876aec45a7Smrg major=.$func_arith_result 65886aec45a7Smrg versuffix="$major.$age.$revision" 65896aec45a7Smrg # Darwin ld doesn't like 0 for these options... 65906aec45a7Smrg func_arith $current + 1 65916aec45a7Smrg minor_current=$func_arith_result 65926aec45a7Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 65936aec45a7Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 65946aec45a7Smrg ;; 65956aec45a7Smrg 65966aec45a7Smrg freebsd-aout) 65976aec45a7Smrg major=".$current" 65986aec45a7Smrg versuffix=".$current.$revision"; 65996aec45a7Smrg ;; 66006aec45a7Smrg 66016aec45a7Smrg freebsd-elf) 66026aec45a7Smrg major=".$current" 66036aec45a7Smrg versuffix=".$current" 66046aec45a7Smrg ;; 66056aec45a7Smrg 66066aec45a7Smrg irix | nonstopux) 66076aec45a7Smrg if test "X$lt_irix_increment" = "Xno"; then 66086aec45a7Smrg func_arith $current - $age 66096aec45a7Smrg else 66106aec45a7Smrg func_arith $current - $age + 1 66116aec45a7Smrg fi 66126aec45a7Smrg major=$func_arith_result 66136aec45a7Smrg 66146aec45a7Smrg case $version_type in 66156aec45a7Smrg nonstopux) verstring_prefix=nonstopux ;; 66166aec45a7Smrg *) verstring_prefix=sgi ;; 66176aec45a7Smrg esac 66186aec45a7Smrg verstring="$verstring_prefix$major.$revision" 66196aec45a7Smrg 66206aec45a7Smrg # Add in all the interfaces that we are compatible with. 66216aec45a7Smrg loop=$revision 66226aec45a7Smrg while test "$loop" -ne 0; do 66236aec45a7Smrg func_arith $revision - $loop 66246aec45a7Smrg iface=$func_arith_result 66256aec45a7Smrg func_arith $loop - 1 66266aec45a7Smrg loop=$func_arith_result 66276aec45a7Smrg verstring="$verstring_prefix$major.$iface:$verstring" 66286aec45a7Smrg done 66296aec45a7Smrg 66306aec45a7Smrg # Before this point, $major must not contain `.'. 66316aec45a7Smrg major=.$major 66326aec45a7Smrg versuffix="$major.$revision" 66336aec45a7Smrg ;; 66346aec45a7Smrg 66356aec45a7Smrg linux) 66366aec45a7Smrg func_arith $current - $age 66376aec45a7Smrg major=.$func_arith_result 66386aec45a7Smrg versuffix="$major.$age.$revision" 66396aec45a7Smrg ;; 66406aec45a7Smrg 66416aec45a7Smrg osf) 66426aec45a7Smrg func_arith $current - $age 66436aec45a7Smrg major=.$func_arith_result 66446aec45a7Smrg versuffix=".$current.$age.$revision" 66456aec45a7Smrg verstring="$current.$age.$revision" 66466aec45a7Smrg 66476aec45a7Smrg # Add in all the interfaces that we are compatible with. 66486aec45a7Smrg loop=$age 66496aec45a7Smrg while test "$loop" -ne 0; do 66506aec45a7Smrg func_arith $current - $loop 66516aec45a7Smrg iface=$func_arith_result 66526aec45a7Smrg func_arith $loop - 1 66536aec45a7Smrg loop=$func_arith_result 66546aec45a7Smrg verstring="$verstring:${iface}.0" 66556aec45a7Smrg done 66566aec45a7Smrg 66576aec45a7Smrg # Make executables depend on our current version. 66586aec45a7Smrg verstring="$verstring:${current}.0" 66596aec45a7Smrg ;; 66606aec45a7Smrg 66616aec45a7Smrg qnx) 66626aec45a7Smrg major=".$current" 66636aec45a7Smrg versuffix=".$current" 66646aec45a7Smrg ;; 66656aec45a7Smrg 66666aec45a7Smrg sunos) 66676aec45a7Smrg major=".$current" 66686aec45a7Smrg versuffix=".$current.$revision" 66696aec45a7Smrg ;; 66706aec45a7Smrg 66716aec45a7Smrg windows) 66726aec45a7Smrg # Use '-' rather than '.', since we only want one 66736aec45a7Smrg # extension on DOS 8.3 filesystems. 66746aec45a7Smrg func_arith $current - $age 66756aec45a7Smrg major=$func_arith_result 66766aec45a7Smrg versuffix="-$major" 66776aec45a7Smrg ;; 66786aec45a7Smrg 66796aec45a7Smrg *) 66806aec45a7Smrg func_fatal_configuration "unknown library version type \`$version_type'" 66816aec45a7Smrg ;; 66826aec45a7Smrg esac 66836aec45a7Smrg 66846aec45a7Smrg # Clear the version info if we defaulted, and they specified a release. 66856aec45a7Smrg if test -z "$vinfo" && test -n "$release"; then 66866aec45a7Smrg major= 66876aec45a7Smrg case $version_type in 66886aec45a7Smrg darwin) 66896aec45a7Smrg # we can't check for "0.0" in archive_cmds due to quoting 66906aec45a7Smrg # problems, so we reset it completely 66916aec45a7Smrg verstring= 66926aec45a7Smrg ;; 66936aec45a7Smrg *) 66946aec45a7Smrg verstring="0.0" 66956aec45a7Smrg ;; 66966aec45a7Smrg esac 66976aec45a7Smrg if test "$need_version" = no; then 66986aec45a7Smrg versuffix= 66996aec45a7Smrg else 67006aec45a7Smrg versuffix=".0.0" 67016aec45a7Smrg fi 67026aec45a7Smrg fi 67036aec45a7Smrg 67046aec45a7Smrg # Remove version info from name if versioning should be avoided 67056aec45a7Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 67066aec45a7Smrg major= 67076aec45a7Smrg versuffix= 67086aec45a7Smrg verstring="" 67096aec45a7Smrg fi 67106aec45a7Smrg 67116aec45a7Smrg # Check to see if the archive will have undefined symbols. 67126aec45a7Smrg if test "$allow_undefined" = yes; then 67136aec45a7Smrg if test "$allow_undefined_flag" = unsupported; then 67146aec45a7Smrg func_warning "undefined symbols not allowed in $host shared libraries" 67156aec45a7Smrg build_libtool_libs=no 67166aec45a7Smrg build_old_libs=yes 67176aec45a7Smrg fi 67186aec45a7Smrg else 67196aec45a7Smrg # Don't allow undefined symbols. 67206aec45a7Smrg allow_undefined_flag="$no_undefined_flag" 67216aec45a7Smrg fi 67226aec45a7Smrg 67236aec45a7Smrg fi 67246aec45a7Smrg 67256aec45a7Smrg func_generate_dlsyms "$libname" "$libname" "yes" 67266aec45a7Smrg libobjs="$libobjs $symfileobj" 67276aec45a7Smrg test "X$libobjs" = "X " && libobjs= 67286aec45a7Smrg 67296aec45a7Smrg if test "$mode" != relink; then 67306aec45a7Smrg # Remove our outputs, but don't remove object files since they 67316aec45a7Smrg # may have been created when compiling PIC objects. 67326aec45a7Smrg removelist= 67336aec45a7Smrg tempremovelist=`$ECHO "$output_objdir/*"` 67346aec45a7Smrg for p in $tempremovelist; do 67356aec45a7Smrg case $p in 67366aec45a7Smrg *.$objext | *.gcno) 67376aec45a7Smrg ;; 67386aec45a7Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 67396aec45a7Smrg if test "X$precious_files_regex" != "X"; then 67406aec45a7Smrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 67416aec45a7Smrg then 67426aec45a7Smrg continue 67436aec45a7Smrg fi 67446aec45a7Smrg fi 67456aec45a7Smrg removelist="$removelist $p" 67466aec45a7Smrg ;; 67476aec45a7Smrg *) ;; 67486aec45a7Smrg esac 67496aec45a7Smrg done 67506aec45a7Smrg test -n "$removelist" && \ 67516aec45a7Smrg func_show_eval "${RM}r \$removelist" 67526aec45a7Smrg fi 67536aec45a7Smrg 67546aec45a7Smrg # Now set the variables for building old libraries. 67556aec45a7Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 67566aec45a7Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 67576aec45a7Smrg 67586aec45a7Smrg # Transform .lo files to .o files. 67596aec45a7Smrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 67606aec45a7Smrg fi 67616aec45a7Smrg 67626aec45a7Smrg # Eliminate all temporary directories. 67636aec45a7Smrg #for path in $notinst_path; do 67646aec45a7Smrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 67656aec45a7Smrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 67666aec45a7Smrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 67676aec45a7Smrg #done 67686aec45a7Smrg 67696aec45a7Smrg if test -n "$xrpath"; then 67706aec45a7Smrg # If the user specified any rpath flags, then add them. 67716aec45a7Smrg temp_xrpath= 67726aec45a7Smrg for libdir in $xrpath; do 67736aec45a7Smrg temp_xrpath="$temp_xrpath -R$libdir" 67746aec45a7Smrg case "$finalize_rpath " in 67756aec45a7Smrg *" $libdir "*) ;; 67766aec45a7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 67776aec45a7Smrg esac 67786aec45a7Smrg done 67796aec45a7Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 67806aec45a7Smrg dependency_libs="$temp_xrpath $dependency_libs" 67816aec45a7Smrg fi 67826aec45a7Smrg fi 67836aec45a7Smrg 67846aec45a7Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 67856aec45a7Smrg old_dlfiles="$dlfiles" 67866aec45a7Smrg dlfiles= 67876aec45a7Smrg for lib in $old_dlfiles; do 67886aec45a7Smrg case " $dlprefiles $dlfiles " in 67896aec45a7Smrg *" $lib "*) ;; 67906aec45a7Smrg *) dlfiles="$dlfiles $lib" ;; 67916aec45a7Smrg esac 67926aec45a7Smrg done 67936aec45a7Smrg 67946aec45a7Smrg # Make sure dlprefiles contains only unique files 67956aec45a7Smrg old_dlprefiles="$dlprefiles" 67966aec45a7Smrg dlprefiles= 67976aec45a7Smrg for lib in $old_dlprefiles; do 67986aec45a7Smrg case "$dlprefiles " in 67996aec45a7Smrg *" $lib "*) ;; 68006aec45a7Smrg *) dlprefiles="$dlprefiles $lib" ;; 68016aec45a7Smrg esac 68026aec45a7Smrg done 68036aec45a7Smrg 68046aec45a7Smrg if test "$build_libtool_libs" = yes; then 68056aec45a7Smrg if test -n "$rpath"; then 68066aec45a7Smrg case $host in 68076aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 68086aec45a7Smrg # these systems don't actually have a c library (as such)! 68096aec45a7Smrg ;; 68106aec45a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 68116aec45a7Smrg # Rhapsody C library is in the System framework 68126aec45a7Smrg deplibs="$deplibs System.ltframework" 68136aec45a7Smrg ;; 68146aec45a7Smrg *-*-netbsd*) 68156aec45a7Smrg # Don't link with libc until the a.out ld.so is fixed. 68166aec45a7Smrg ;; 68176aec45a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 68186aec45a7Smrg # Do not include libc due to us having libc/libc_r. 68196aec45a7Smrg ;; 68206aec45a7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 68216aec45a7Smrg # Causes problems with __ctype 68226aec45a7Smrg ;; 68236aec45a7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 68246aec45a7Smrg # Compiler inserts libc in the correct place for threads to work 68256aec45a7Smrg ;; 68266aec45a7Smrg *) 68276aec45a7Smrg # Add libc to deplibs on all other systems if necessary. 68286aec45a7Smrg if test "$build_libtool_need_lc" = "yes"; then 68296aec45a7Smrg deplibs="$deplibs -lc" 68306aec45a7Smrg fi 68316aec45a7Smrg ;; 68326aec45a7Smrg esac 68336aec45a7Smrg fi 68346aec45a7Smrg 68356aec45a7Smrg # Transform deplibs into only deplibs that can be linked in shared. 68366aec45a7Smrg name_save=$name 68376aec45a7Smrg libname_save=$libname 68386aec45a7Smrg release_save=$release 68396aec45a7Smrg versuffix_save=$versuffix 68406aec45a7Smrg major_save=$major 68416aec45a7Smrg # I'm not sure if I'm treating the release correctly. I think 68426aec45a7Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 68436aec45a7Smrg # add it in twice. Is that correct? 68446aec45a7Smrg release="" 68456aec45a7Smrg versuffix="" 68466aec45a7Smrg major="" 68476aec45a7Smrg newdeplibs= 68486aec45a7Smrg droppeddeps=no 68496aec45a7Smrg case $deplibs_check_method in 68506aec45a7Smrg pass_all) 68516aec45a7Smrg # Don't check for shared/static. Everything works. 68526aec45a7Smrg # This might be a little naive. We might want to check 68536aec45a7Smrg # whether the library exists or not. But this is on 68546aec45a7Smrg # osf3 & osf4 and I'm not really sure... Just 68556aec45a7Smrg # implementing what was already the behavior. 68566aec45a7Smrg newdeplibs=$deplibs 68576aec45a7Smrg ;; 68586aec45a7Smrg test_compile) 68596aec45a7Smrg # This code stresses the "libraries are programs" paradigm to its 68606aec45a7Smrg # limits. Maybe even breaks it. We compile a program, linking it 68616aec45a7Smrg # against the deplibs as a proxy for the library. Then we can check 68626aec45a7Smrg # whether they linked in statically or dynamically with ldd. 68636aec45a7Smrg $opt_dry_run || $RM conftest.c 68646aec45a7Smrg cat > conftest.c <<EOF 68656aec45a7Smrg int main() { return 0; } 68666aec45a7SmrgEOF 68676aec45a7Smrg $opt_dry_run || $RM conftest 68686aec45a7Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 68696aec45a7Smrg ldd_output=`ldd conftest` 68706aec45a7Smrg for i in $deplibs; do 68716aec45a7Smrg case $i in 68726aec45a7Smrg -l*) 68736aec45a7Smrg func_stripname -l '' "$i" 68746aec45a7Smrg name=$func_stripname_result 68756aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 68766aec45a7Smrg case " $predeps $postdeps " in 68776aec45a7Smrg *" $i "*) 68786aec45a7Smrg newdeplibs="$newdeplibs $i" 68796aec45a7Smrg i="" 68806aec45a7Smrg ;; 68816aec45a7Smrg esac 68826aec45a7Smrg fi 68836aec45a7Smrg if test -n "$i" ; then 68846aec45a7Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 68856aec45a7Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 68866aec45a7Smrg set dummy $deplib_matches; shift 68876aec45a7Smrg deplib_match=$1 68886aec45a7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 68896aec45a7Smrg newdeplibs="$newdeplibs $i" 68906aec45a7Smrg else 68916aec45a7Smrg droppeddeps=yes 68926aec45a7Smrg echo 68936aec45a7Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 68946aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 68956aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 68966aec45a7Smrg echo "*** shared version of the library, which I believe you do not have" 68976aec45a7Smrg echo "*** because a test_compile did reveal that the linker did not use it for" 68986aec45a7Smrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 68996aec45a7Smrg fi 69006aec45a7Smrg fi 69016aec45a7Smrg ;; 69026aec45a7Smrg *) 69036aec45a7Smrg newdeplibs="$newdeplibs $i" 69046aec45a7Smrg ;; 69056aec45a7Smrg esac 69066aec45a7Smrg done 69076aec45a7Smrg else 69086aec45a7Smrg # Error occurred in the first compile. Let's try to salvage 69096aec45a7Smrg # the situation: Compile a separate program for each library. 69106aec45a7Smrg for i in $deplibs; do 69116aec45a7Smrg case $i in 69126aec45a7Smrg -l*) 69136aec45a7Smrg func_stripname -l '' "$i" 69146aec45a7Smrg name=$func_stripname_result 69156aec45a7Smrg $opt_dry_run || $RM conftest 69166aec45a7Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 69176aec45a7Smrg ldd_output=`ldd conftest` 69186aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 69196aec45a7Smrg case " $predeps $postdeps " in 69206aec45a7Smrg *" $i "*) 69216aec45a7Smrg newdeplibs="$newdeplibs $i" 69226aec45a7Smrg i="" 69236aec45a7Smrg ;; 69246aec45a7Smrg esac 69256aec45a7Smrg fi 69266aec45a7Smrg if test -n "$i" ; then 69276aec45a7Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 69286aec45a7Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 69296aec45a7Smrg set dummy $deplib_matches; shift 69306aec45a7Smrg deplib_match=$1 69316aec45a7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 69326aec45a7Smrg newdeplibs="$newdeplibs $i" 69336aec45a7Smrg else 69346aec45a7Smrg droppeddeps=yes 69356aec45a7Smrg echo 69366aec45a7Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 69376aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 69386aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 69396aec45a7Smrg echo "*** shared version of the library, which you do not appear to have" 69406aec45a7Smrg echo "*** because a test_compile did reveal that the linker did not use this one" 69416aec45a7Smrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 69426aec45a7Smrg fi 69436aec45a7Smrg fi 69446aec45a7Smrg else 69456aec45a7Smrg droppeddeps=yes 69466aec45a7Smrg echo 69476aec45a7Smrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 69486aec45a7Smrg echo "*** make it link in! You will probably need to install it or some" 69496aec45a7Smrg echo "*** library that it depends on before this library will be fully" 69506aec45a7Smrg echo "*** functional. Installing it before continuing would be even better." 69516aec45a7Smrg fi 69526aec45a7Smrg ;; 69536aec45a7Smrg *) 69546aec45a7Smrg newdeplibs="$newdeplibs $i" 69556aec45a7Smrg ;; 69566aec45a7Smrg esac 69576aec45a7Smrg done 69586aec45a7Smrg fi 69596aec45a7Smrg ;; 69606aec45a7Smrg file_magic*) 69616aec45a7Smrg set dummy $deplibs_check_method; shift 69626aec45a7Smrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 69636aec45a7Smrg for a_deplib in $deplibs; do 69646aec45a7Smrg case $a_deplib in 69656aec45a7Smrg -l*) 69666aec45a7Smrg func_stripname -l '' "$a_deplib" 69676aec45a7Smrg name=$func_stripname_result 69686aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 69696aec45a7Smrg case " $predeps $postdeps " in 69706aec45a7Smrg *" $a_deplib "*) 69716aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 69726aec45a7Smrg a_deplib="" 69736aec45a7Smrg ;; 69746aec45a7Smrg esac 69756aec45a7Smrg fi 69766aec45a7Smrg if test -n "$a_deplib" ; then 69776aec45a7Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 69786aec45a7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 69796aec45a7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 69806aec45a7Smrg for potent_lib in $potential_libs; do 69816aec45a7Smrg # Follow soft links. 69826aec45a7Smrg if ls -lLd "$potent_lib" 2>/dev/null | 69836aec45a7Smrg $GREP " -> " >/dev/null; then 69846aec45a7Smrg continue 69856aec45a7Smrg fi 69866aec45a7Smrg # The statement above tries to avoid entering an 69876aec45a7Smrg # endless loop below, in case of cyclic links. 69886aec45a7Smrg # We might still enter an endless loop, since a link 69896aec45a7Smrg # loop can be closed while we follow links, 69906aec45a7Smrg # but so what? 69916aec45a7Smrg potlib="$potent_lib" 69926aec45a7Smrg while test -h "$potlib" 2>/dev/null; do 69936aec45a7Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 69946aec45a7Smrg case $potliblink in 69956aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 69966aec45a7Smrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 69976aec45a7Smrg esac 69986aec45a7Smrg done 69996aec45a7Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 70006aec45a7Smrg $SED -e 10q | 70016aec45a7Smrg $EGREP "$file_magic_regex" > /dev/null; then 70026aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 70036aec45a7Smrg a_deplib="" 70046aec45a7Smrg break 2 70056aec45a7Smrg fi 70066aec45a7Smrg done 70076aec45a7Smrg done 70086aec45a7Smrg fi 70096aec45a7Smrg if test -n "$a_deplib" ; then 70106aec45a7Smrg droppeddeps=yes 70116aec45a7Smrg echo 70126aec45a7Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 70136aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 70146aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 70156aec45a7Smrg echo "*** shared version of the library, which you do not appear to have" 70166aec45a7Smrg echo "*** because I did check the linker path looking for a file starting" 70176aec45a7Smrg if test -z "$potlib" ; then 70186aec45a7Smrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 70196aec45a7Smrg else 70206aec45a7Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 70216aec45a7Smrg $ECHO "*** using a file magic. Last file checked: $potlib" 70226aec45a7Smrg fi 70236aec45a7Smrg fi 70246aec45a7Smrg ;; 70256aec45a7Smrg *) 70266aec45a7Smrg # Add a -L argument. 70276aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 70286aec45a7Smrg ;; 70296aec45a7Smrg esac 70306aec45a7Smrg done # Gone through all deplibs. 70316aec45a7Smrg ;; 70326aec45a7Smrg match_pattern*) 70336aec45a7Smrg set dummy $deplibs_check_method; shift 70346aec45a7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 70356aec45a7Smrg for a_deplib in $deplibs; do 70366aec45a7Smrg case $a_deplib in 70376aec45a7Smrg -l*) 70386aec45a7Smrg func_stripname -l '' "$a_deplib" 70396aec45a7Smrg name=$func_stripname_result 70406aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 70416aec45a7Smrg case " $predeps $postdeps " in 70426aec45a7Smrg *" $a_deplib "*) 70436aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 70446aec45a7Smrg a_deplib="" 70456aec45a7Smrg ;; 70466aec45a7Smrg esac 70476aec45a7Smrg fi 70486aec45a7Smrg if test -n "$a_deplib" ; then 70496aec45a7Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 70506aec45a7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 70516aec45a7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 70526aec45a7Smrg for potent_lib in $potential_libs; do 70536aec45a7Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 70546aec45a7Smrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 70556aec45a7Smrg $EGREP "$match_pattern_regex" > /dev/null; then 70566aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 70576aec45a7Smrg a_deplib="" 70586aec45a7Smrg break 2 70596aec45a7Smrg fi 70606aec45a7Smrg done 70616aec45a7Smrg done 70626aec45a7Smrg fi 70636aec45a7Smrg if test -n "$a_deplib" ; then 70646aec45a7Smrg droppeddeps=yes 70656aec45a7Smrg echo 70666aec45a7Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 70676aec45a7Smrg echo "*** I have the capability to make that library automatically link in when" 70686aec45a7Smrg echo "*** you link to this library. But I can only do this if you have a" 70696aec45a7Smrg echo "*** shared version of the library, which you do not appear to have" 70706aec45a7Smrg echo "*** because I did check the linker path looking for a file starting" 70716aec45a7Smrg if test -z "$potlib" ; then 70726aec45a7Smrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 70736aec45a7Smrg else 70746aec45a7Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 70756aec45a7Smrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 70766aec45a7Smrg fi 70776aec45a7Smrg fi 70786aec45a7Smrg ;; 70796aec45a7Smrg *) 70806aec45a7Smrg # Add a -L argument. 70816aec45a7Smrg newdeplibs="$newdeplibs $a_deplib" 70826aec45a7Smrg ;; 70836aec45a7Smrg esac 70846aec45a7Smrg done # Gone through all deplibs. 70856aec45a7Smrg ;; 70866aec45a7Smrg none | unknown | *) 70876aec45a7Smrg newdeplibs="" 70886aec45a7Smrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 70896aec45a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 70906aec45a7Smrg for i in $predeps $postdeps ; do 70916aec45a7Smrg # can't use Xsed below, because $i might contain '/' 70926aec45a7Smrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 70936aec45a7Smrg done 70946aec45a7Smrg fi 70956aec45a7Smrg case $tmp_deplibs in 70966aec45a7Smrg *[!\ \ ]*) 70976aec45a7Smrg echo 70986aec45a7Smrg if test "X$deplibs_check_method" = "Xnone"; then 70996aec45a7Smrg echo "*** Warning: inter-library dependencies are not supported in this platform." 71006aec45a7Smrg else 71016aec45a7Smrg echo "*** Warning: inter-library dependencies are not known to be supported." 71026aec45a7Smrg fi 71036aec45a7Smrg echo "*** All declared inter-library dependencies are being dropped." 71046aec45a7Smrg droppeddeps=yes 71056aec45a7Smrg ;; 71066aec45a7Smrg esac 71076aec45a7Smrg ;; 71086aec45a7Smrg esac 71096aec45a7Smrg versuffix=$versuffix_save 71106aec45a7Smrg major=$major_save 71116aec45a7Smrg release=$release_save 71126aec45a7Smrg libname=$libname_save 71136aec45a7Smrg name=$name_save 71146aec45a7Smrg 71156aec45a7Smrg case $host in 71166aec45a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 71176aec45a7Smrg # On Rhapsody replace the C library with the System framework 71186aec45a7Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 71196aec45a7Smrg ;; 71206aec45a7Smrg esac 71216aec45a7Smrg 71226aec45a7Smrg if test "$droppeddeps" = yes; then 71236aec45a7Smrg if test "$module" = yes; then 71246aec45a7Smrg echo 71256aec45a7Smrg echo "*** Warning: libtool could not satisfy all declared inter-library" 71266aec45a7Smrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 71276aec45a7Smrg echo "*** a static module, that should work as long as the dlopening" 71286aec45a7Smrg echo "*** application is linked with the -dlopen flag." 71296aec45a7Smrg if test -z "$global_symbol_pipe"; then 71306aec45a7Smrg echo 71316aec45a7Smrg echo "*** However, this would only work if libtool was able to extract symbol" 71326aec45a7Smrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 71336aec45a7Smrg echo "*** not find such a program. So, this module is probably useless." 71346aec45a7Smrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 71356aec45a7Smrg fi 71366aec45a7Smrg if test "$build_old_libs" = no; then 71376aec45a7Smrg oldlibs="$output_objdir/$libname.$libext" 71386aec45a7Smrg build_libtool_libs=module 71396aec45a7Smrg build_old_libs=yes 71406aec45a7Smrg else 71416aec45a7Smrg build_libtool_libs=no 71426aec45a7Smrg fi 71436aec45a7Smrg else 71446aec45a7Smrg echo "*** The inter-library dependencies that have been dropped here will be" 71456aec45a7Smrg echo "*** automatically added whenever a program is linked with this library" 71466aec45a7Smrg echo "*** or is declared to -dlopen it." 71476aec45a7Smrg 71486aec45a7Smrg if test "$allow_undefined" = no; then 71496aec45a7Smrg echo 71506aec45a7Smrg echo "*** Since this library must not contain undefined symbols," 71516aec45a7Smrg echo "*** because either the platform does not support them or" 71526aec45a7Smrg echo "*** it was explicitly requested with -no-undefined," 71536aec45a7Smrg echo "*** libtool will only create a static version of it." 71546aec45a7Smrg if test "$build_old_libs" = no; then 71556aec45a7Smrg oldlibs="$output_objdir/$libname.$libext" 71566aec45a7Smrg build_libtool_libs=module 71576aec45a7Smrg build_old_libs=yes 71586aec45a7Smrg else 71596aec45a7Smrg build_libtool_libs=no 71606aec45a7Smrg fi 71616aec45a7Smrg fi 71626aec45a7Smrg fi 71636aec45a7Smrg fi 71646aec45a7Smrg # Done checking deplibs! 71656aec45a7Smrg deplibs=$newdeplibs 71666aec45a7Smrg fi 71676aec45a7Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 71686aec45a7Smrg case $host in 71696aec45a7Smrg *-*-darwin*) 71706aec45a7Smrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 71716aec45a7Smrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 71726aec45a7Smrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 71736aec45a7Smrg ;; 71746aec45a7Smrg esac 71756aec45a7Smrg 71766aec45a7Smrg # move library search paths that coincide with paths to not yet 71776aec45a7Smrg # installed libraries to the beginning of the library search list 71786aec45a7Smrg new_libs= 71796aec45a7Smrg for path in $notinst_path; do 71806aec45a7Smrg case " $new_libs " in 71816aec45a7Smrg *" -L$path/$objdir "*) ;; 71826aec45a7Smrg *) 71836aec45a7Smrg case " $deplibs " in 71846aec45a7Smrg *" -L$path/$objdir "*) 71856aec45a7Smrg new_libs="$new_libs -L$path/$objdir" ;; 71866aec45a7Smrg esac 71876aec45a7Smrg ;; 71886aec45a7Smrg esac 71896aec45a7Smrg done 71906aec45a7Smrg for deplib in $deplibs; do 71916aec45a7Smrg case $deplib in 71926aec45a7Smrg -L*) 71936aec45a7Smrg case " $new_libs " in 71946aec45a7Smrg *" $deplib "*) ;; 71956aec45a7Smrg *) new_libs="$new_libs $deplib" ;; 71966aec45a7Smrg esac 71976aec45a7Smrg ;; 71986aec45a7Smrg *) new_libs="$new_libs $deplib" ;; 71996aec45a7Smrg esac 72006aec45a7Smrg done 72016aec45a7Smrg deplibs="$new_libs" 72026aec45a7Smrg 72036aec45a7Smrg # All the library-specific variables (install_libdir is set above). 72046aec45a7Smrg library_names= 72056aec45a7Smrg old_library= 72066aec45a7Smrg dlname= 72076aec45a7Smrg 72086aec45a7Smrg # Test again, we may have decided not to build it any more 72096aec45a7Smrg if test "$build_libtool_libs" = yes; then 72106aec45a7Smrg if test "$hardcode_into_libs" = yes; then 72116aec45a7Smrg # Hardcode the library paths 72126aec45a7Smrg hardcode_libdirs= 72136aec45a7Smrg dep_rpath= 72146aec45a7Smrg rpath="$finalize_rpath" 72156aec45a7Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 72166aec45a7Smrg for libdir in $rpath; do 72176aec45a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 72186aec45a7Smrg if test -n "$hardcode_libdir_separator"; then 72196aec45a7Smrg if test -z "$hardcode_libdirs"; then 72206aec45a7Smrg hardcode_libdirs="$libdir" 72216aec45a7Smrg else 72226aec45a7Smrg # Just accumulate the unique libdirs. 72236aec45a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 72246aec45a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 72256aec45a7Smrg ;; 72266aec45a7Smrg *) 72276aec45a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 72286aec45a7Smrg ;; 72296aec45a7Smrg esac 72306aec45a7Smrg fi 72316aec45a7Smrg else 72326aec45a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 72336aec45a7Smrg dep_rpath="$dep_rpath $flag" 72346aec45a7Smrg fi 72356aec45a7Smrg elif test -n "$runpath_var"; then 72366aec45a7Smrg case "$perm_rpath " in 72376aec45a7Smrg *" $libdir "*) ;; 72386aec45a7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 72396aec45a7Smrg esac 72406aec45a7Smrg fi 72416aec45a7Smrg done 72426aec45a7Smrg # Substitute the hardcoded libdirs into the rpath. 72436aec45a7Smrg if test -n "$hardcode_libdir_separator" && 72446aec45a7Smrg test -n "$hardcode_libdirs"; then 72456aec45a7Smrg libdir="$hardcode_libdirs" 72466aec45a7Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 72476aec45a7Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 72486aec45a7Smrg else 72496aec45a7Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 72506aec45a7Smrg fi 72516aec45a7Smrg fi 72526aec45a7Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 72536aec45a7Smrg # We should set the runpath_var. 72546aec45a7Smrg rpath= 72556aec45a7Smrg for dir in $perm_rpath; do 72566aec45a7Smrg rpath="$rpath$dir:" 72576aec45a7Smrg done 72586aec45a7Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 72596aec45a7Smrg fi 72606aec45a7Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 72616aec45a7Smrg fi 7262ab47cfaaSmrg 72636aec45a7Smrg shlibpath="$finalize_shlibpath" 72646aec45a7Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 72656aec45a7Smrg if test -n "$shlibpath"; then 72666aec45a7Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 72676aec45a7Smrg fi 7268ab47cfaaSmrg 72696aec45a7Smrg # Get the real and link names of the library. 72706aec45a7Smrg eval shared_ext=\"$shrext_cmds\" 72716aec45a7Smrg eval library_names=\"$library_names_spec\" 72726aec45a7Smrg set dummy $library_names 72736aec45a7Smrg shift 72746aec45a7Smrg realname="$1" 72756aec45a7Smrg shift 7276ab47cfaaSmrg 72776aec45a7Smrg if test -n "$soname_spec"; then 72786aec45a7Smrg eval soname=\"$soname_spec\" 72796aec45a7Smrg else 72806aec45a7Smrg soname="$realname" 72816aec45a7Smrg fi 72826aec45a7Smrg if test -z "$dlname"; then 72836aec45a7Smrg dlname=$soname 72846aec45a7Smrg fi 7285ab47cfaaSmrg 72866aec45a7Smrg lib="$output_objdir/$realname" 72876aec45a7Smrg linknames= 72886aec45a7Smrg for link 72896aec45a7Smrg do 72906aec45a7Smrg linknames="$linknames $link" 72916aec45a7Smrg done 7292ab47cfaaSmrg 72936aec45a7Smrg # Use standard objects if they are pic 72946aec45a7Smrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 72956aec45a7Smrg test "X$libobjs" = "X " && libobjs= 7296ab47cfaaSmrg 72976aec45a7Smrg delfiles= 72986aec45a7Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 72996aec45a7Smrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 73006aec45a7Smrg export_symbols="$output_objdir/$libname.uexp" 73016aec45a7Smrg delfiles="$delfiles $export_symbols" 73026aec45a7Smrg fi 7303ab47cfaaSmrg 73046aec45a7Smrg orig_export_symbols= 73056aec45a7Smrg case $host_os in 73066aec45a7Smrg cygwin* | mingw* | cegcc*) 73076aec45a7Smrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 73086aec45a7Smrg # exporting using user supplied symfile 73096aec45a7Smrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 73106aec45a7Smrg # and it's NOT already a .def file. Must figure out 73116aec45a7Smrg # which of the given symbols are data symbols and tag 73126aec45a7Smrg # them as such. So, trigger use of export_symbols_cmds. 73136aec45a7Smrg # export_symbols gets reassigned inside the "prepare 73146aec45a7Smrg # the list of exported symbols" if statement, so the 73156aec45a7Smrg # include_expsyms logic still works. 73166aec45a7Smrg orig_export_symbols="$export_symbols" 73176aec45a7Smrg export_symbols= 73186aec45a7Smrg always_export_symbols=yes 73196aec45a7Smrg fi 73206aec45a7Smrg fi 73216aec45a7Smrg ;; 73226aec45a7Smrg esac 7323ab47cfaaSmrg 73246aec45a7Smrg # Prepare the list of exported symbols 73256aec45a7Smrg if test -z "$export_symbols"; then 73266aec45a7Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 73276aec45a7Smrg func_verbose "generating symbol list for \`$libname.la'" 73286aec45a7Smrg export_symbols="$output_objdir/$libname.exp" 73296aec45a7Smrg $opt_dry_run || $RM $export_symbols 73306aec45a7Smrg cmds=$export_symbols_cmds 73316aec45a7Smrg save_ifs="$IFS"; IFS='~' 73326aec45a7Smrg for cmd in $cmds; do 73336aec45a7Smrg IFS="$save_ifs" 73346aec45a7Smrg eval cmd=\"$cmd\" 73356aec45a7Smrg func_len " $cmd" 73366aec45a7Smrg len=$func_len_result 73376aec45a7Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 73386aec45a7Smrg func_show_eval "$cmd" 'exit $?' 73396aec45a7Smrg skipped_export=false 73406aec45a7Smrg else 73416aec45a7Smrg # The command line is too long to execute in one step. 73426aec45a7Smrg func_verbose "using reloadable object file for export list..." 73436aec45a7Smrg skipped_export=: 73446aec45a7Smrg # Break out early, otherwise skipped_export may be 73456aec45a7Smrg # set to false by a later but shorter cmd. 73466aec45a7Smrg break 73476aec45a7Smrg fi 73486aec45a7Smrg done 73496aec45a7Smrg IFS="$save_ifs" 73506aec45a7Smrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 73516aec45a7Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 73526aec45a7Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 73536aec45a7Smrg fi 73546aec45a7Smrg fi 73556aec45a7Smrg fi 7356ab47cfaaSmrg 73576aec45a7Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 73586aec45a7Smrg tmp_export_symbols="$export_symbols" 73596aec45a7Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 73606aec45a7Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 73616aec45a7Smrg fi 7362ab47cfaaSmrg 73636aec45a7Smrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 73646aec45a7Smrg # The given exports_symbols file has to be filtered, so filter it. 73656aec45a7Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 73666aec45a7Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 73676aec45a7Smrg # 's' commands which not all seds can handle. GNU sed should be fine 73686aec45a7Smrg # though. Also, the filter scales superlinearly with the number of 73696aec45a7Smrg # global variables. join(1) would be nice here, but unfortunately 73706aec45a7Smrg # isn't a blessed tool. 73716aec45a7Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 73726aec45a7Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 73736aec45a7Smrg export_symbols=$output_objdir/$libname.def 73746aec45a7Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 73751473d951Smrg fi 7376ab47cfaaSmrg 73776aec45a7Smrg tmp_deplibs= 73786aec45a7Smrg for test_deplib in $deplibs; do 73796aec45a7Smrg case " $convenience " in 73806aec45a7Smrg *" $test_deplib "*) ;; 73816aec45a7Smrg *) 73826aec45a7Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 73836aec45a7Smrg ;; 73846aec45a7Smrg esac 73856aec45a7Smrg done 73866aec45a7Smrg deplibs="$tmp_deplibs" 7387ab47cfaaSmrg 73886aec45a7Smrg if test -n "$convenience"; then 73896aec45a7Smrg if test -n "$whole_archive_flag_spec" && 73906aec45a7Smrg test "$compiler_needs_object" = yes && 73916aec45a7Smrg test -z "$libobjs"; then 73926aec45a7Smrg # extract the archives, so we have objects to list. 73936aec45a7Smrg # TODO: could optimize this to just extract one archive. 73946aec45a7Smrg whole_archive_flag_spec= 73956aec45a7Smrg fi 73966aec45a7Smrg if test -n "$whole_archive_flag_spec"; then 73976aec45a7Smrg save_libobjs=$libobjs 73986aec45a7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 73996aec45a7Smrg test "X$libobjs" = "X " && libobjs= 74006aec45a7Smrg else 74016aec45a7Smrg gentop="$output_objdir/${outputname}x" 74026aec45a7Smrg generated="$generated $gentop" 7403ab47cfaaSmrg 74046aec45a7Smrg func_extract_archives $gentop $convenience 74056aec45a7Smrg libobjs="$libobjs $func_extract_archives_result" 74066aec45a7Smrg test "X$libobjs" = "X " && libobjs= 74076aec45a7Smrg fi 74086aec45a7Smrg fi 7409ab47cfaaSmrg 74106aec45a7Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 74116aec45a7Smrg eval flag=\"$thread_safe_flag_spec\" 74126aec45a7Smrg linker_flags="$linker_flags $flag" 74136aec45a7Smrg fi 7414ab47cfaaSmrg 74156aec45a7Smrg # Make a backup of the uninstalled library when relinking 74166aec45a7Smrg if test "$mode" = relink; then 74176aec45a7Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 74185c42550eSmrg fi 7419ab47cfaaSmrg 74206aec45a7Smrg # Do each of the archive commands. 74216aec45a7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 74226aec45a7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 74236aec45a7Smrg eval test_cmds=\"$module_expsym_cmds\" 74246aec45a7Smrg cmds=$module_expsym_cmds 74256aec45a7Smrg else 74266aec45a7Smrg eval test_cmds=\"$module_cmds\" 74276aec45a7Smrg cmds=$module_cmds 74286aec45a7Smrg fi 74296aec45a7Smrg else 74306aec45a7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 74316aec45a7Smrg eval test_cmds=\"$archive_expsym_cmds\" 74326aec45a7Smrg cmds=$archive_expsym_cmds 74336aec45a7Smrg else 74346aec45a7Smrg eval test_cmds=\"$archive_cmds\" 74356aec45a7Smrg cmds=$archive_cmds 74366aec45a7Smrg fi 74375c42550eSmrg fi 7438ab47cfaaSmrg 74396aec45a7Smrg if test "X$skipped_export" != "X:" && 74406aec45a7Smrg func_len " $test_cmds" && 74416aec45a7Smrg len=$func_len_result && 74426aec45a7Smrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 74436aec45a7Smrg : 74446aec45a7Smrg else 74456aec45a7Smrg # The command line is too long to link in one step, link piecewise 74466aec45a7Smrg # or, if using GNU ld and skipped_export is not :, use a linker 74476aec45a7Smrg # script. 7448ab47cfaaSmrg 74496aec45a7Smrg # Save the value of $output and $libobjs because we want to 74506aec45a7Smrg # use them later. If we have whole_archive_flag_spec, we 74516aec45a7Smrg # want to use save_libobjs as it was before 74526aec45a7Smrg # whole_archive_flag_spec was expanded, because we can't 74536aec45a7Smrg # assume the linker understands whole_archive_flag_spec. 74546aec45a7Smrg # This may have to be revisited, in case too many 74556aec45a7Smrg # convenience libraries get linked in and end up exceeding 74566aec45a7Smrg # the spec. 74576aec45a7Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 74586aec45a7Smrg save_libobjs=$libobjs 74596aec45a7Smrg fi 74606aec45a7Smrg save_output=$output 74616aec45a7Smrg func_basename "$output" 74626aec45a7Smrg output_la=$func_basename_result 74631473d951Smrg 74646aec45a7Smrg # Clear the reloadable object creation command queue and 74656aec45a7Smrg # initialize k to one. 74666aec45a7Smrg test_cmds= 74676aec45a7Smrg concat_cmds= 74686aec45a7Smrg objlist= 74696aec45a7Smrg last_robj= 74706aec45a7Smrg k=1 7471ab47cfaaSmrg 74726aec45a7Smrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 74736aec45a7Smrg output=${output_objdir}/${output_la}.lnkscript 74746aec45a7Smrg func_verbose "creating GNU ld script: $output" 74756aec45a7Smrg echo 'INPUT (' > $output 74766aec45a7Smrg for obj in $save_libobjs 74776aec45a7Smrg do 74786aec45a7Smrg $ECHO "$obj" >> $output 74796aec45a7Smrg done 74806aec45a7Smrg echo ')' >> $output 74816aec45a7Smrg delfiles="$delfiles $output" 74826aec45a7Smrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 74836aec45a7Smrg output=${output_objdir}/${output_la}.lnk 74846aec45a7Smrg func_verbose "creating linker input file list: $output" 74856aec45a7Smrg : > $output 74866aec45a7Smrg set x $save_libobjs 74876aec45a7Smrg shift 74886aec45a7Smrg firstobj= 74896aec45a7Smrg if test "$compiler_needs_object" = yes; then 74906aec45a7Smrg firstobj="$1 " 74916aec45a7Smrg shift 74926aec45a7Smrg fi 74936aec45a7Smrg for obj 74946aec45a7Smrg do 74956aec45a7Smrg $ECHO "$obj" >> $output 74966aec45a7Smrg done 74976aec45a7Smrg delfiles="$delfiles $output" 74986aec45a7Smrg output=$firstobj\"$file_list_spec$output\" 74996aec45a7Smrg else 75006aec45a7Smrg if test -n "$save_libobjs"; then 75016aec45a7Smrg func_verbose "creating reloadable object files..." 75026aec45a7Smrg output=$output_objdir/$output_la-${k}.$objext 75036aec45a7Smrg eval test_cmds=\"$reload_cmds\" 75046aec45a7Smrg func_len " $test_cmds" 75056aec45a7Smrg len0=$func_len_result 75066aec45a7Smrg len=$len0 75076aec45a7Smrg 75086aec45a7Smrg # Loop over the list of objects to be linked. 75096aec45a7Smrg for obj in $save_libobjs 75106aec45a7Smrg do 75116aec45a7Smrg func_len " $obj" 75126aec45a7Smrg func_arith $len + $func_len_result 75136aec45a7Smrg len=$func_arith_result 75146aec45a7Smrg if test "X$objlist" = X || 75156aec45a7Smrg test "$len" -lt "$max_cmd_len"; then 75166aec45a7Smrg func_append objlist " $obj" 75176aec45a7Smrg else 75186aec45a7Smrg # The command $test_cmds is almost too long, add a 75196aec45a7Smrg # command to the queue. 75206aec45a7Smrg if test "$k" -eq 1 ; then 75216aec45a7Smrg # The first file doesn't have a previous command to add. 75226aec45a7Smrg reload_objs=$objlist 75236aec45a7Smrg eval concat_cmds=\"$reload_cmds\" 75246aec45a7Smrg else 75256aec45a7Smrg # All subsequent reloadable object files will link in 75266aec45a7Smrg # the last one created. 75276aec45a7Smrg reload_objs="$objlist $last_robj" 75286aec45a7Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 75296aec45a7Smrg fi 75306aec45a7Smrg last_robj=$output_objdir/$output_la-${k}.$objext 75316aec45a7Smrg func_arith $k + 1 75326aec45a7Smrg k=$func_arith_result 75336aec45a7Smrg output=$output_objdir/$output_la-${k}.$objext 75346aec45a7Smrg objlist=" $obj" 75356aec45a7Smrg func_len " $last_robj" 75366aec45a7Smrg func_arith $len0 + $func_len_result 75376aec45a7Smrg len=$func_arith_result 75386aec45a7Smrg fi 75396aec45a7Smrg done 75406aec45a7Smrg # Handle the remaining objects by creating one last 75416aec45a7Smrg # reloadable object file. All subsequent reloadable object 75426aec45a7Smrg # files will link in the last one created. 75436aec45a7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 75446aec45a7Smrg reload_objs="$objlist $last_robj" 75456aec45a7Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 75466aec45a7Smrg if test -n "$last_robj"; then 75476aec45a7Smrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 75486aec45a7Smrg fi 75496aec45a7Smrg delfiles="$delfiles $output" 75506aec45a7Smrg 75516aec45a7Smrg else 75526aec45a7Smrg output= 75536aec45a7Smrg fi 7554ab47cfaaSmrg 75556aec45a7Smrg if ${skipped_export-false}; then 75566aec45a7Smrg func_verbose "generating symbol list for \`$libname.la'" 75576aec45a7Smrg export_symbols="$output_objdir/$libname.exp" 75586aec45a7Smrg $opt_dry_run || $RM $export_symbols 75596aec45a7Smrg libobjs=$output 75606aec45a7Smrg # Append the command to create the export file. 75616aec45a7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 75626aec45a7Smrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 75636aec45a7Smrg if test -n "$last_robj"; then 75646aec45a7Smrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 75656aec45a7Smrg fi 75666aec45a7Smrg fi 7567ab47cfaaSmrg 75686aec45a7Smrg test -n "$save_libobjs" && 75696aec45a7Smrg func_verbose "creating a temporary reloadable object file: $output" 7570ab47cfaaSmrg 75716aec45a7Smrg # Loop through the commands generated above and execute them. 75726aec45a7Smrg save_ifs="$IFS"; IFS='~' 75736aec45a7Smrg for cmd in $concat_cmds; do 75746aec45a7Smrg IFS="$save_ifs" 75756aec45a7Smrg $opt_silent || { 75766aec45a7Smrg func_quote_for_expand "$cmd" 75776aec45a7Smrg eval "func_echo $func_quote_for_expand_result" 75786aec45a7Smrg } 75796aec45a7Smrg $opt_dry_run || eval "$cmd" || { 75806aec45a7Smrg lt_exit=$? 75816aec45a7Smrg 75826aec45a7Smrg # Restore the uninstalled library and exit 75836aec45a7Smrg if test "$mode" = relink; then 75846aec45a7Smrg ( cd "$output_objdir" && \ 75856aec45a7Smrg $RM "${realname}T" && \ 75866aec45a7Smrg $MV "${realname}U" "$realname" ) 75876aec45a7Smrg fi 7588ab47cfaaSmrg 75896aec45a7Smrg exit $lt_exit 75906aec45a7Smrg } 75916aec45a7Smrg done 75926aec45a7Smrg IFS="$save_ifs" 7593ab47cfaaSmrg 75946aec45a7Smrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 75956aec45a7Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 75966aec45a7Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 75971473d951Smrg fi 75981473d951Smrg fi 7599ab47cfaaSmrg 76006aec45a7Smrg if ${skipped_export-false}; then 76016aec45a7Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 76026aec45a7Smrg tmp_export_symbols="$export_symbols" 76036aec45a7Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 76046aec45a7Smrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 76056aec45a7Smrg fi 7606ab47cfaaSmrg 76076aec45a7Smrg if test -n "$orig_export_symbols"; then 76086aec45a7Smrg # The given exports_symbols file has to be filtered, so filter it. 76096aec45a7Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 76106aec45a7Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 76116aec45a7Smrg # 's' commands which not all seds can handle. GNU sed should be fine 76126aec45a7Smrg # though. Also, the filter scales superlinearly with the number of 76136aec45a7Smrg # global variables. join(1) would be nice here, but unfortunately 76146aec45a7Smrg # isn't a blessed tool. 76156aec45a7Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 76166aec45a7Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 76176aec45a7Smrg export_symbols=$output_objdir/$libname.def 76186aec45a7Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 76196aec45a7Smrg fi 76206aec45a7Smrg fi 76211473d951Smrg 76226aec45a7Smrg libobjs=$output 76236aec45a7Smrg # Restore the value of output. 76246aec45a7Smrg output=$save_output 76255c42550eSmrg 76266aec45a7Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 76276aec45a7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 76286aec45a7Smrg test "X$libobjs" = "X " && libobjs= 76296aec45a7Smrg fi 76306aec45a7Smrg # Expand the library linking commands again to reset the 76316aec45a7Smrg # value of $libobjs for piecewise linking. 76326aec45a7Smrg 76336aec45a7Smrg # Do each of the archive commands. 76346aec45a7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 76356aec45a7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 76366aec45a7Smrg cmds=$module_expsym_cmds 7637ab47cfaaSmrg else 76386aec45a7Smrg cmds=$module_cmds 7639ab47cfaaSmrg fi 7640ab47cfaaSmrg else 76416aec45a7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 76426aec45a7Smrg cmds=$archive_expsym_cmds 76436aec45a7Smrg else 76446aec45a7Smrg cmds=$archive_cmds 76456aec45a7Smrg fi 7646ab47cfaaSmrg fi 7647ab47cfaaSmrg fi 7648ab47cfaaSmrg 76496aec45a7Smrg if test -n "$delfiles"; then 76506aec45a7Smrg # Append the command to remove temporary files to $cmds. 76516aec45a7Smrg eval cmds=\"\$cmds~\$RM $delfiles\" 76526aec45a7Smrg fi 7653ab47cfaaSmrg 76546aec45a7Smrg # Add any objects from preloaded convenience libraries 76556aec45a7Smrg if test -n "$dlprefiles"; then 76566aec45a7Smrg gentop="$output_objdir/${outputname}x" 76576aec45a7Smrg generated="$generated $gentop" 7658ab47cfaaSmrg 76596aec45a7Smrg func_extract_archives $gentop $dlprefiles 76606aec45a7Smrg libobjs="$libobjs $func_extract_archives_result" 76616aec45a7Smrg test "X$libobjs" = "X " && libobjs= 76621473d951Smrg fi 7663ab47cfaaSmrg 76646aec45a7Smrg save_ifs="$IFS"; IFS='~' 76656aec45a7Smrg for cmd in $cmds; do 76666aec45a7Smrg IFS="$save_ifs" 76676aec45a7Smrg eval cmd=\"$cmd\" 76686aec45a7Smrg $opt_silent || { 76696aec45a7Smrg func_quote_for_expand "$cmd" 76706aec45a7Smrg eval "func_echo $func_quote_for_expand_result" 76716aec45a7Smrg } 76726aec45a7Smrg $opt_dry_run || eval "$cmd" || { 76736aec45a7Smrg lt_exit=$? 7674ab47cfaaSmrg 76756aec45a7Smrg # Restore the uninstalled library and exit 76766aec45a7Smrg if test "$mode" = relink; then 76776aec45a7Smrg ( cd "$output_objdir" && \ 76786aec45a7Smrg $RM "${realname}T" && \ 76796aec45a7Smrg $MV "${realname}U" "$realname" ) 76805c42550eSmrg fi 7681ab47cfaaSmrg 76826aec45a7Smrg exit $lt_exit 76836aec45a7Smrg } 76846aec45a7Smrg done 76856aec45a7Smrg IFS="$save_ifs" 7686ab47cfaaSmrg 76876aec45a7Smrg # Restore the uninstalled library and exit 76886aec45a7Smrg if test "$mode" = relink; then 76896aec45a7Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7690ab47cfaaSmrg 76916aec45a7Smrg if test -n "$convenience"; then 76926aec45a7Smrg if test -z "$whole_archive_flag_spec"; then 76936aec45a7Smrg func_show_eval '${RM}r "$gentop"' 76946aec45a7Smrg fi 76956aec45a7Smrg fi 7696ab47cfaaSmrg 76976aec45a7Smrg exit $EXIT_SUCCESS 76986aec45a7Smrg fi 76991473d951Smrg 77006aec45a7Smrg # Create links to the real library. 77016aec45a7Smrg for linkname in $linknames; do 77026aec45a7Smrg if test "$realname" != "$linkname"; then 77036aec45a7Smrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 77046aec45a7Smrg fi 77056aec45a7Smrg done 77061473d951Smrg 77076aec45a7Smrg # If -module or -export-dynamic was specified, set the dlname. 77086aec45a7Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 77096aec45a7Smrg # On all known operating systems, these are identical. 77106aec45a7Smrg dlname="$soname" 77116aec45a7Smrg fi 77126aec45a7Smrg fi 77136aec45a7Smrg ;; 77141473d951Smrg 77156aec45a7Smrg obj) 77166aec45a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 77176aec45a7Smrg func_warning "\`-dlopen' is ignored for objects" 77186aec45a7Smrg fi 77191473d951Smrg 77206aec45a7Smrg case " $deplibs" in 77216aec45a7Smrg *\ -l* | *\ -L*) 77226aec45a7Smrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 77236aec45a7Smrg esac 77241473d951Smrg 77256aec45a7Smrg test -n "$rpath" && \ 77266aec45a7Smrg func_warning "\`-rpath' is ignored for objects" 77271473d951Smrg 77286aec45a7Smrg test -n "$xrpath" && \ 77296aec45a7Smrg func_warning "\`-R' is ignored for objects" 77306aec45a7Smrg 77316aec45a7Smrg test -n "$vinfo" && \ 77326aec45a7Smrg func_warning "\`-version-info' is ignored for objects" 7733ab47cfaaSmrg 77346aec45a7Smrg test -n "$release" && \ 77356aec45a7Smrg func_warning "\`-release' is ignored for objects" 77365c42550eSmrg 77376aec45a7Smrg case $output in 77386aec45a7Smrg *.lo) 77396aec45a7Smrg test -n "$objs$old_deplibs" && \ 77406aec45a7Smrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 77416aec45a7Smrg 77426aec45a7Smrg libobj=$output 77436aec45a7Smrg func_lo2o "$libobj" 77446aec45a7Smrg obj=$func_lo2o_result 77456aec45a7Smrg ;; 77466aec45a7Smrg *) 77476aec45a7Smrg libobj= 77486aec45a7Smrg obj="$output" 77495c42550eSmrg ;; 77501473d951Smrg esac 7751ab47cfaaSmrg 77526aec45a7Smrg # Delete the old objects. 77536aec45a7Smrg $opt_dry_run || $RM $obj $libobj 7754ab47cfaaSmrg 77556aec45a7Smrg # Objects from convenience libraries. This assumes 77566aec45a7Smrg # single-version convenience libraries. Whenever we create 77576aec45a7Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 77586aec45a7Smrg # the extraction. 77596aec45a7Smrg reload_conv_objs= 77606aec45a7Smrg gentop= 77616aec45a7Smrg # reload_cmds runs $LD directly, so let us get rid of 77626aec45a7Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 77636aec45a7Smrg # turning comma into space.. 77646aec45a7Smrg wl= 77651473d951Smrg 77666aec45a7Smrg if test -n "$convenience"; then 77676aec45a7Smrg if test -n "$whole_archive_flag_spec"; then 77686aec45a7Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 77696aec45a7Smrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 77705c42550eSmrg else 77716aec45a7Smrg gentop="$output_objdir/${obj}x" 77726aec45a7Smrg generated="$generated $gentop" 77736aec45a7Smrg 77746aec45a7Smrg func_extract_archives $gentop $convenience 77756aec45a7Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 77765c42550eSmrg fi 77776aec45a7Smrg fi 7778ab47cfaaSmrg 77796aec45a7Smrg # Create the old-style object. 77806aec45a7Smrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 7781ab47cfaaSmrg 77826aec45a7Smrg output="$obj" 77836aec45a7Smrg func_execute_cmds "$reload_cmds" 'exit $?' 7784ab47cfaaSmrg 77856aec45a7Smrg # Exit if we aren't doing a library object file. 77866aec45a7Smrg if test -z "$libobj"; then 77876aec45a7Smrg if test -n "$gentop"; then 77886aec45a7Smrg func_show_eval '${RM}r "$gentop"' 77896aec45a7Smrg fi 77905c42550eSmrg 77916aec45a7Smrg exit $EXIT_SUCCESS 77925c42550eSmrg fi 77935c42550eSmrg 77946aec45a7Smrg if test "$build_libtool_libs" != yes; then 77956aec45a7Smrg if test -n "$gentop"; then 77966aec45a7Smrg func_show_eval '${RM}r "$gentop"' 77976aec45a7Smrg fi 77985c42550eSmrg 77996aec45a7Smrg # Create an invalid libtool object if no PIC, so that we don't 78006aec45a7Smrg # accidentally link it into a program. 78016aec45a7Smrg # $show "echo timestamp > $libobj" 78026aec45a7Smrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 78036aec45a7Smrg exit $EXIT_SUCCESS 78046aec45a7Smrg fi 78055c42550eSmrg 78066aec45a7Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 78076aec45a7Smrg # Only do commands if we really have different PIC objects. 78086aec45a7Smrg reload_objs="$libobjs $reload_conv_objs" 78096aec45a7Smrg output="$libobj" 78106aec45a7Smrg func_execute_cmds "$reload_cmds" 'exit $?' 78115c42550eSmrg fi 78126aec45a7Smrg 78136aec45a7Smrg if test -n "$gentop"; then 78146aec45a7Smrg func_show_eval '${RM}r "$gentop"' 78156aec45a7Smrg fi 78166aec45a7Smrg 78176aec45a7Smrg exit $EXIT_SUCCESS 78185c42550eSmrg ;; 7819ab47cfaaSmrg 78206aec45a7Smrg prog) 78216aec45a7Smrg case $host in 78226aec45a7Smrg *cygwin*) func_stripname '' '.exe' "$output" 78236aec45a7Smrg output=$func_stripname_result.exe;; 78246aec45a7Smrg esac 78256aec45a7Smrg test -n "$vinfo" && \ 78266aec45a7Smrg func_warning "\`-version-info' is ignored for programs" 7827ab47cfaaSmrg 78286aec45a7Smrg test -n "$release" && \ 78296aec45a7Smrg func_warning "\`-release' is ignored for programs" 7830ab47cfaaSmrg 78316aec45a7Smrg test "$preload" = yes \ 78326aec45a7Smrg && test "$dlopen_support" = unknown \ 78336aec45a7Smrg && test "$dlopen_self" = unknown \ 78346aec45a7Smrg && test "$dlopen_self_static" = unknown && \ 78356aec45a7Smrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 78366aec45a7Smrg 78376aec45a7Smrg case $host in 78386aec45a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 78396aec45a7Smrg # On Rhapsody replace the C library is the System framework 78406aec45a7Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 78416aec45a7Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 78425c42550eSmrg ;; 78436aec45a7Smrg esac 78445c42550eSmrg 78456aec45a7Smrg case $host in 78466aec45a7Smrg *-*-darwin*) 78476aec45a7Smrg # Don't allow lazy linking, it breaks C++ global constructors 78486aec45a7Smrg # But is supposedly fixed on 10.4 or later (yay!). 78496aec45a7Smrg if test "$tagname" = CXX ; then 78506aec45a7Smrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 78516aec45a7Smrg 10.[0123]) 78526aec45a7Smrg compile_command="$compile_command ${wl}-bind_at_load" 78536aec45a7Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 78546aec45a7Smrg ;; 78556aec45a7Smrg esac 78565c42550eSmrg fi 78576aec45a7Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 78586aec45a7Smrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 78596aec45a7Smrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 78606aec45a7Smrg ;; 78616aec45a7Smrg esac 78625c42550eSmrg 78635c42550eSmrg 78646aec45a7Smrg # move library search paths that coincide with paths to not yet 78656aec45a7Smrg # installed libraries to the beginning of the library search list 78666aec45a7Smrg new_libs= 78676aec45a7Smrg for path in $notinst_path; do 78686aec45a7Smrg case " $new_libs " in 78696aec45a7Smrg *" -L$path/$objdir "*) ;; 78706aec45a7Smrg *) 78716aec45a7Smrg case " $compile_deplibs " in 78726aec45a7Smrg *" -L$path/$objdir "*) 78736aec45a7Smrg new_libs="$new_libs -L$path/$objdir" ;; 78741473d951Smrg esac 78756aec45a7Smrg ;; 78766aec45a7Smrg esac 78776aec45a7Smrg done 78786aec45a7Smrg for deplib in $compile_deplibs; do 78796aec45a7Smrg case $deplib in 78806aec45a7Smrg -L*) 78816aec45a7Smrg case " $new_libs " in 78826aec45a7Smrg *" $deplib "*) ;; 78836aec45a7Smrg *) new_libs="$new_libs $deplib" ;; 78841473d951Smrg esac 78856aec45a7Smrg ;; 78866aec45a7Smrg *) new_libs="$new_libs $deplib" ;; 78876aec45a7Smrg esac 78886aec45a7Smrg done 78896aec45a7Smrg compile_deplibs="$new_libs" 7890ab47cfaaSmrg 78915c42550eSmrg 78926aec45a7Smrg compile_command="$compile_command $compile_deplibs" 78936aec45a7Smrg finalize_command="$finalize_command $finalize_deplibs" 78945c42550eSmrg 78956aec45a7Smrg if test -n "$rpath$xrpath"; then 78966aec45a7Smrg # If the user specified any rpath flags, then add them. 78976aec45a7Smrg for libdir in $rpath $xrpath; do 78986aec45a7Smrg # This is the magic to use -rpath. 78996aec45a7Smrg case "$finalize_rpath " in 79006aec45a7Smrg *" $libdir "*) ;; 79016aec45a7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 79026aec45a7Smrg esac 79036aec45a7Smrg done 79046aec45a7Smrg fi 79055c42550eSmrg 79066aec45a7Smrg # Now hardcode the library paths 79076aec45a7Smrg rpath= 79086aec45a7Smrg hardcode_libdirs= 79096aec45a7Smrg for libdir in $compile_rpath $finalize_rpath; do 79106aec45a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 79116aec45a7Smrg if test -n "$hardcode_libdir_separator"; then 79126aec45a7Smrg if test -z "$hardcode_libdirs"; then 79136aec45a7Smrg hardcode_libdirs="$libdir" 79146aec45a7Smrg else 79156aec45a7Smrg # Just accumulate the unique libdirs. 79166aec45a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 79176aec45a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 79186aec45a7Smrg ;; 79196aec45a7Smrg *) 79206aec45a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 79216aec45a7Smrg ;; 79226aec45a7Smrg esac 79236aec45a7Smrg fi 79245c42550eSmrg else 79256aec45a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 79266aec45a7Smrg rpath="$rpath $flag" 79275c42550eSmrg fi 79286aec45a7Smrg elif test -n "$runpath_var"; then 79296aec45a7Smrg case "$perm_rpath " in 79306aec45a7Smrg *" $libdir "*) ;; 79316aec45a7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 79326aec45a7Smrg esac 79336aec45a7Smrg fi 79346aec45a7Smrg case $host in 79356aec45a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 79366aec45a7Smrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 79376aec45a7Smrg case :$dllsearchpath: in 79386aec45a7Smrg *":$libdir:"*) ;; 79396aec45a7Smrg ::) dllsearchpath=$libdir;; 79406aec45a7Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 79416aec45a7Smrg esac 79426aec45a7Smrg case :$dllsearchpath: in 79436aec45a7Smrg *":$testbindir:"*) ;; 79446aec45a7Smrg ::) dllsearchpath=$testbindir;; 79456aec45a7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 79466aec45a7Smrg esac 79476aec45a7Smrg ;; 79486aec45a7Smrg esac 79496aec45a7Smrg done 79506aec45a7Smrg # Substitute the hardcoded libdirs into the rpath. 79516aec45a7Smrg if test -n "$hardcode_libdir_separator" && 79526aec45a7Smrg test -n "$hardcode_libdirs"; then 79536aec45a7Smrg libdir="$hardcode_libdirs" 79546aec45a7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 79556aec45a7Smrg fi 79566aec45a7Smrg compile_rpath="$rpath" 79575c42550eSmrg 79586aec45a7Smrg rpath= 79596aec45a7Smrg hardcode_libdirs= 79606aec45a7Smrg for libdir in $finalize_rpath; do 79616aec45a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 79626aec45a7Smrg if test -n "$hardcode_libdir_separator"; then 79636aec45a7Smrg if test -z "$hardcode_libdirs"; then 79646aec45a7Smrg hardcode_libdirs="$libdir" 79656aec45a7Smrg else 79666aec45a7Smrg # Just accumulate the unique libdirs. 79676aec45a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 79686aec45a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 79696aec45a7Smrg ;; 79706aec45a7Smrg *) 79716aec45a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 79726aec45a7Smrg ;; 79736aec45a7Smrg esac 79746aec45a7Smrg fi 7975ab47cfaaSmrg else 79766aec45a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 79776aec45a7Smrg rpath="$rpath $flag" 7978ab47cfaaSmrg fi 79796aec45a7Smrg elif test -n "$runpath_var"; then 79806aec45a7Smrg case "$finalize_perm_rpath " in 79816aec45a7Smrg *" $libdir "*) ;; 79826aec45a7Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 79836aec45a7Smrg esac 7984ab47cfaaSmrg fi 79856aec45a7Smrg done 79866aec45a7Smrg # Substitute the hardcoded libdirs into the rpath. 79876aec45a7Smrg if test -n "$hardcode_libdir_separator" && 79886aec45a7Smrg test -n "$hardcode_libdirs"; then 79896aec45a7Smrg libdir="$hardcode_libdirs" 79906aec45a7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 79916aec45a7Smrg fi 79926aec45a7Smrg finalize_rpath="$rpath" 7993ab47cfaaSmrg 79946aec45a7Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 79956aec45a7Smrg # Transform all the library objects into standard objects. 79966aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 79976aec45a7Smrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 79986aec45a7Smrg fi 7999ab47cfaaSmrg 80006aec45a7Smrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8001ab47cfaaSmrg 80026aec45a7Smrg # template prelinking step 80036aec45a7Smrg if test -n "$prelink_cmds"; then 80046aec45a7Smrg func_execute_cmds "$prelink_cmds" 'exit $?' 80056aec45a7Smrg fi 8006ab47cfaaSmrg 80076aec45a7Smrg wrappers_required=yes 80086aec45a7Smrg case $host in 80096aec45a7Smrg *cegcc* | *mingw32ce*) 80106aec45a7Smrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 80116aec45a7Smrg wrappers_required=no 80126aec45a7Smrg ;; 80136aec45a7Smrg *cygwin* | *mingw* ) 80146aec45a7Smrg if test "$build_libtool_libs" != yes; then 80156aec45a7Smrg wrappers_required=no 80166aec45a7Smrg fi 80176aec45a7Smrg ;; 80186aec45a7Smrg *) 80196aec45a7Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 80206aec45a7Smrg wrappers_required=no 80216aec45a7Smrg fi 80226aec45a7Smrg ;; 80236aec45a7Smrg esac 80246aec45a7Smrg if test "$wrappers_required" = no; then 80256aec45a7Smrg # Replace the output file specification. 80266aec45a7Smrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 80276aec45a7Smrg link_command="$compile_command$compile_rpath" 8028ab47cfaaSmrg 80296aec45a7Smrg # We have no uninstalled library dependencies, so finalize right now. 80306aec45a7Smrg exit_status=0 80316aec45a7Smrg func_show_eval "$link_command" 'exit_status=$?' 8032ab47cfaaSmrg 80336aec45a7Smrg # Delete the generated files. 80346aec45a7Smrg if test -f "$output_objdir/${outputname}S.${objext}"; then 80356aec45a7Smrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8036ab47cfaaSmrg fi 8037ab47cfaaSmrg 80386aec45a7Smrg exit $exit_status 80396aec45a7Smrg fi 8040ab47cfaaSmrg 80416aec45a7Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 80426aec45a7Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 80436aec45a7Smrg fi 80446aec45a7Smrg if test -n "$finalize_shlibpath"; then 80456aec45a7Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 80466aec45a7Smrg fi 80475c42550eSmrg 80486aec45a7Smrg compile_var= 80496aec45a7Smrg finalize_var= 80506aec45a7Smrg if test -n "$runpath_var"; then 80516aec45a7Smrg if test -n "$perm_rpath"; then 80526aec45a7Smrg # We should set the runpath_var. 80536aec45a7Smrg rpath= 80546aec45a7Smrg for dir in $perm_rpath; do 80556aec45a7Smrg rpath="$rpath$dir:" 80566aec45a7Smrg done 80576aec45a7Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8058ab47cfaaSmrg fi 80596aec45a7Smrg if test -n "$finalize_perm_rpath"; then 80606aec45a7Smrg # We should set the runpath_var. 80616aec45a7Smrg rpath= 80626aec45a7Smrg for dir in $finalize_perm_rpath; do 80636aec45a7Smrg rpath="$rpath$dir:" 80646aec45a7Smrg done 80656aec45a7Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8066ab47cfaaSmrg fi 80676aec45a7Smrg fi 8068ab47cfaaSmrg 80696aec45a7Smrg if test "$no_install" = yes; then 80706aec45a7Smrg # We don't need to create a wrapper script. 80716aec45a7Smrg link_command="$compile_var$compile_command$compile_rpath" 80726aec45a7Smrg # Replace the output file specification. 80736aec45a7Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 80746aec45a7Smrg # Delete the old output file. 80756aec45a7Smrg $opt_dry_run || $RM $output 80766aec45a7Smrg # Link the executable and exit 80776aec45a7Smrg func_show_eval "$link_command" 'exit $?' 80785c42550eSmrg exit $EXIT_SUCCESS 80796aec45a7Smrg fi 80801473d951Smrg 80816aec45a7Smrg if test "$hardcode_action" = relink; then 80826aec45a7Smrg # Fast installation is not supported 80836aec45a7Smrg link_command="$compile_var$compile_command$compile_rpath" 80846aec45a7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 80856aec45a7Smrg 80866aec45a7Smrg func_warning "this platform does not like uninstalled shared libraries" 80876aec45a7Smrg func_warning "\`$output' will be relinked during installation" 80886aec45a7Smrg else 80896aec45a7Smrg if test "$fast_install" != no; then 80906aec45a7Smrg link_command="$finalize_var$compile_command$finalize_rpath" 80916aec45a7Smrg if test "$fast_install" = yes; then 80926aec45a7Smrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 80936aec45a7Smrg else 80946aec45a7Smrg # fast_install is set to needless 80956aec45a7Smrg relink_command= 80966aec45a7Smrg fi 8097ab47cfaaSmrg else 80986aec45a7Smrg link_command="$compile_var$compile_command$compile_rpath" 80996aec45a7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8100ab47cfaaSmrg fi 81016aec45a7Smrg fi 8102ab47cfaaSmrg 81036aec45a7Smrg # Replace the output file specification. 81046aec45a7Smrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8105ab47cfaaSmrg 81066aec45a7Smrg # Delete the old output files. 81076aec45a7Smrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8108ab47cfaaSmrg 81096aec45a7Smrg func_show_eval "$link_command" 'exit $?' 81105c42550eSmrg 81116aec45a7Smrg # Now create the wrapper script. 81126aec45a7Smrg func_verbose "creating $output" 81135c42550eSmrg 81146aec45a7Smrg # Quote the relink command for shipping. 81156aec45a7Smrg if test -n "$relink_command"; then 81166aec45a7Smrg # Preserve any variables that may affect compiler behavior 81176aec45a7Smrg for var in $variables_saved_for_relink; do 81186aec45a7Smrg if eval test -z \"\${$var+set}\"; then 81196aec45a7Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 81206aec45a7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 81216aec45a7Smrg relink_command="$var=; export $var; $relink_command" 8122ab47cfaaSmrg else 81236aec45a7Smrg func_quote_for_eval "$var_value" 81246aec45a7Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8125ab47cfaaSmrg fi 81266aec45a7Smrg done 81276aec45a7Smrg relink_command="(cd `pwd`; $relink_command)" 81286aec45a7Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 81296aec45a7Smrg fi 81301473d951Smrg 81316aec45a7Smrg # Only actually do things if not in dry run mode. 81326aec45a7Smrg $opt_dry_run || { 81336aec45a7Smrg # win32 will think the script is a binary if it has 81346aec45a7Smrg # a .exe suffix, so we strip it off here. 81356aec45a7Smrg case $output in 81366aec45a7Smrg *.exe) func_stripname '' '.exe' "$output" 81376aec45a7Smrg output=$func_stripname_result ;; 81386aec45a7Smrg esac 81396aec45a7Smrg # test for cygwin because mv fails w/o .exe extensions 81406aec45a7Smrg case $host in 81416aec45a7Smrg *cygwin*) 81426aec45a7Smrg exeext=.exe 81436aec45a7Smrg func_stripname '' '.exe' "$outputname" 81446aec45a7Smrg outputname=$func_stripname_result ;; 81456aec45a7Smrg *) exeext= ;; 8146ab47cfaaSmrg esac 81476aec45a7Smrg case $host in 81486aec45a7Smrg *cygwin* | *mingw* ) 81496aec45a7Smrg func_dirname_and_basename "$output" "" "." 81506aec45a7Smrg output_name=$func_basename_result 81516aec45a7Smrg output_path=$func_dirname_result 81526aec45a7Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 81536aec45a7Smrg cwrapper="$output_path/$output_name.exe" 81546aec45a7Smrg $RM $cwrappersource $cwrapper 81556aec45a7Smrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 81566aec45a7Smrg 81576aec45a7Smrg func_emit_cwrapperexe_src > $cwrappersource 81586aec45a7Smrg 81596aec45a7Smrg # The wrapper executable is built using the $host compiler, 81606aec45a7Smrg # because it contains $host paths and files. If cross- 81616aec45a7Smrg # compiling, it, like the target executable, must be 81626aec45a7Smrg # executed on the $host or under an emulation environment. 81636aec45a7Smrg $opt_dry_run || { 81646aec45a7Smrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 81656aec45a7Smrg $STRIP $cwrapper 81666aec45a7Smrg } 8167ab47cfaaSmrg 81686aec45a7Smrg # Now, create the wrapper script for func_source use: 81696aec45a7Smrg func_ltwrapper_scriptname $cwrapper 81706aec45a7Smrg $RM $func_ltwrapper_scriptname_result 81716aec45a7Smrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 81726aec45a7Smrg $opt_dry_run || { 81736aec45a7Smrg # note: this script will not be executed, so do not chmod. 81746aec45a7Smrg if test "x$build" = "x$host" ; then 81756aec45a7Smrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 81766aec45a7Smrg else 81776aec45a7Smrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 81786aec45a7Smrg fi 81796aec45a7Smrg } 81806aec45a7Smrg ;; 81816aec45a7Smrg * ) 81826aec45a7Smrg $RM $output 81836aec45a7Smrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 8184ab47cfaaSmrg 81856aec45a7Smrg func_emit_wrapper no > $output 81866aec45a7Smrg chmod +x $output 81876aec45a7Smrg ;; 81886aec45a7Smrg esac 81896aec45a7Smrg } 81906aec45a7Smrg exit $EXIT_SUCCESS 81916aec45a7Smrg ;; 81926aec45a7Smrg esac 8193ab47cfaaSmrg 81946aec45a7Smrg # See if we need to build an old-fashioned archive. 81956aec45a7Smrg for oldlib in $oldlibs; do 8196ab47cfaaSmrg 81976aec45a7Smrg if test "$build_libtool_libs" = convenience; then 81986aec45a7Smrg oldobjs="$libobjs_save $symfileobj" 81996aec45a7Smrg addlibs="$convenience" 82006aec45a7Smrg build_libtool_libs=no 82016aec45a7Smrg else 82026aec45a7Smrg if test "$build_libtool_libs" = module; then 82036aec45a7Smrg oldobjs="$libobjs_save" 82046aec45a7Smrg build_libtool_libs=no 82056aec45a7Smrg else 82066aec45a7Smrg oldobjs="$old_deplibs $non_pic_objects" 82076aec45a7Smrg if test "$preload" = yes && test -f "$symfileobj"; then 82086aec45a7Smrg oldobjs="$oldobjs $symfileobj" 82096aec45a7Smrg fi 82106aec45a7Smrg fi 82116aec45a7Smrg addlibs="$old_convenience" 8212ab47cfaaSmrg fi 8213ab47cfaaSmrg 82146aec45a7Smrg if test -n "$addlibs"; then 82156aec45a7Smrg gentop="$output_objdir/${outputname}x" 82166aec45a7Smrg generated="$generated $gentop" 8217ab47cfaaSmrg 82186aec45a7Smrg func_extract_archives $gentop $addlibs 82196aec45a7Smrg oldobjs="$oldobjs $func_extract_archives_result" 82206aec45a7Smrg fi 8221ab47cfaaSmrg 82226aec45a7Smrg # Do each command in the archive commands. 82236aec45a7Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 82246aec45a7Smrg cmds=$old_archive_from_new_cmds 82256aec45a7Smrg else 8226ab47cfaaSmrg 82276aec45a7Smrg # Add any objects from preloaded convenience libraries 82286aec45a7Smrg if test -n "$dlprefiles"; then 82296aec45a7Smrg gentop="$output_objdir/${outputname}x" 82306aec45a7Smrg generated="$generated $gentop" 8231ab47cfaaSmrg 82326aec45a7Smrg func_extract_archives $gentop $dlprefiles 82336aec45a7Smrg oldobjs="$oldobjs $func_extract_archives_result" 82346aec45a7Smrg fi 8235ab47cfaaSmrg 82366aec45a7Smrg # POSIX demands no paths to be encoded in archives. We have 82376aec45a7Smrg # to avoid creating archives with duplicate basenames if we 82386aec45a7Smrg # might have to extract them afterwards, e.g., when creating a 82396aec45a7Smrg # static archive out of a convenience library, or when linking 82406aec45a7Smrg # the entirety of a libtool archive into another (currently 82416aec45a7Smrg # not supported by libtool). 82426aec45a7Smrg if (for obj in $oldobjs 82436aec45a7Smrg do 82446aec45a7Smrg func_basename "$obj" 82456aec45a7Smrg $ECHO "$func_basename_result" 82466aec45a7Smrg done | sort | sort -uc >/dev/null 2>&1); then 82476aec45a7Smrg : 82486aec45a7Smrg else 82496aec45a7Smrg echo "copying selected object files to avoid basename conflicts..." 82506aec45a7Smrg gentop="$output_objdir/${outputname}x" 82516aec45a7Smrg generated="$generated $gentop" 82526aec45a7Smrg func_mkdir_p "$gentop" 82536aec45a7Smrg save_oldobjs=$oldobjs 82546aec45a7Smrg oldobjs= 82556aec45a7Smrg counter=1 82566aec45a7Smrg for obj in $save_oldobjs 82576aec45a7Smrg do 82586aec45a7Smrg func_basename "$obj" 82596aec45a7Smrg objbase="$func_basename_result" 82606aec45a7Smrg case " $oldobjs " in 82616aec45a7Smrg " ") oldobjs=$obj ;; 82626aec45a7Smrg *[\ /]"$objbase "*) 82636aec45a7Smrg while :; do 82646aec45a7Smrg # Make sure we don't pick an alternate name that also 82656aec45a7Smrg # overlaps. 82666aec45a7Smrg newobj=lt$counter-$objbase 82676aec45a7Smrg func_arith $counter + 1 82686aec45a7Smrg counter=$func_arith_result 82696aec45a7Smrg case " $oldobjs " in 82706aec45a7Smrg *[\ /]"$newobj "*) ;; 82716aec45a7Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 82726aec45a7Smrg esac 82736aec45a7Smrg done 82746aec45a7Smrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 82756aec45a7Smrg oldobjs="$oldobjs $gentop/$newobj" 82766aec45a7Smrg ;; 82776aec45a7Smrg *) oldobjs="$oldobjs $obj" ;; 82786aec45a7Smrg esac 8279ab47cfaaSmrg done 82801473d951Smrg fi 82816aec45a7Smrg eval cmds=\"$old_archive_cmds\" 82825c42550eSmrg 82836aec45a7Smrg func_len " $cmds" 82846aec45a7Smrg len=$func_len_result 82856aec45a7Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 82866aec45a7Smrg cmds=$old_archive_cmds 82876aec45a7Smrg else 82886aec45a7Smrg # the command line is too long to link in one step, link in parts 82896aec45a7Smrg func_verbose "using piecewise archive linking..." 82906aec45a7Smrg save_RANLIB=$RANLIB 82916aec45a7Smrg RANLIB=: 82926aec45a7Smrg objlist= 82936aec45a7Smrg concat_cmds= 82946aec45a7Smrg save_oldobjs=$oldobjs 82956aec45a7Smrg oldobjs= 82966aec45a7Smrg # Is there a better way of finding the last object in the list? 82976aec45a7Smrg for obj in $save_oldobjs 82986aec45a7Smrg do 82996aec45a7Smrg last_oldobj=$obj 83006aec45a7Smrg done 83016aec45a7Smrg eval test_cmds=\"$old_archive_cmds\" 83026aec45a7Smrg func_len " $test_cmds" 83036aec45a7Smrg len0=$func_len_result 83046aec45a7Smrg len=$len0 83056aec45a7Smrg for obj in $save_oldobjs 83066aec45a7Smrg do 83076aec45a7Smrg func_len " $obj" 83086aec45a7Smrg func_arith $len + $func_len_result 83096aec45a7Smrg len=$func_arith_result 83106aec45a7Smrg func_append objlist " $obj" 83116aec45a7Smrg if test "$len" -lt "$max_cmd_len"; then 83126aec45a7Smrg : 83136aec45a7Smrg else 83146aec45a7Smrg # the above command should be used before it gets too long 83156aec45a7Smrg oldobjs=$objlist 83166aec45a7Smrg if test "$obj" = "$last_oldobj" ; then 83176aec45a7Smrg RANLIB=$save_RANLIB 83186aec45a7Smrg fi 83196aec45a7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 83206aec45a7Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 83216aec45a7Smrg objlist= 83226aec45a7Smrg len=$len0 83236aec45a7Smrg fi 83246aec45a7Smrg done 83256aec45a7Smrg RANLIB=$save_RANLIB 83266aec45a7Smrg oldobjs=$objlist 83276aec45a7Smrg if test "X$oldobjs" = "X" ; then 83286aec45a7Smrg eval cmds=\"\$concat_cmds\" 83296aec45a7Smrg else 83306aec45a7Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 83316aec45a7Smrg fi 83326aec45a7Smrg fi 83336aec45a7Smrg fi 83346aec45a7Smrg func_execute_cmds "$cmds" 'exit $?' 8335ab47cfaaSmrg done 8336ab47cfaaSmrg 83376aec45a7Smrg test -n "$generated" && \ 83386aec45a7Smrg func_show_eval "${RM}r$generated" 8339ab47cfaaSmrg 83406aec45a7Smrg # Now create the libtool archive. 83416aec45a7Smrg case $output in 83426aec45a7Smrg *.la) 83436aec45a7Smrg old_library= 83446aec45a7Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 83456aec45a7Smrg func_verbose "creating $output" 83461473d951Smrg 83476aec45a7Smrg # Preserve any variables that may affect compiler behavior 83486aec45a7Smrg for var in $variables_saved_for_relink; do 83496aec45a7Smrg if eval test -z \"\${$var+set}\"; then 83506aec45a7Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 83516aec45a7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 83526aec45a7Smrg relink_command="$var=; export $var; $relink_command" 83535c42550eSmrg else 83546aec45a7Smrg func_quote_for_eval "$var_value" 83556aec45a7Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 83565c42550eSmrg fi 83576aec45a7Smrg done 83586aec45a7Smrg # Quote the link command for shipping. 83596aec45a7Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 83606aec45a7Smrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 83616aec45a7Smrg if test "$hardcode_automatic" = yes ; then 83626aec45a7Smrg relink_command= 83636aec45a7Smrg fi 8364ab47cfaaSmrg 83656aec45a7Smrg # Only create the output if not a dry run. 83666aec45a7Smrg $opt_dry_run || { 83676aec45a7Smrg for installed in no yes; do 83686aec45a7Smrg if test "$installed" = yes; then 83696aec45a7Smrg if test -z "$install_libdir"; then 83706aec45a7Smrg break 83716aec45a7Smrg fi 83726aec45a7Smrg output="$output_objdir/$outputname"i 83736aec45a7Smrg # Replace all uninstalled libtool libraries with the installed ones 83746aec45a7Smrg newdependency_libs= 83756aec45a7Smrg for deplib in $dependency_libs; do 83766aec45a7Smrg case $deplib in 83776aec45a7Smrg *.la) 83786aec45a7Smrg func_basename "$deplib" 83796aec45a7Smrg name="$func_basename_result" 83806aec45a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 83816aec45a7Smrg test -z "$libdir" && \ 83826aec45a7Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 83836aec45a7Smrg newdependency_libs="$newdependency_libs $libdir/$name" 83846aec45a7Smrg ;; 83856aec45a7Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 83866aec45a7Smrg esac 83876aec45a7Smrg done 83886aec45a7Smrg dependency_libs="$newdependency_libs" 83896aec45a7Smrg newdlfiles= 83906aec45a7Smrg 83916aec45a7Smrg for lib in $dlfiles; do 83926aec45a7Smrg case $lib in 83936aec45a7Smrg *.la) 83946aec45a7Smrg func_basename "$lib" 83956aec45a7Smrg name="$func_basename_result" 83966aec45a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 83976aec45a7Smrg test -z "$libdir" && \ 83986aec45a7Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 83996aec45a7Smrg newdlfiles="$newdlfiles $libdir/$name" 84006aec45a7Smrg ;; 84016aec45a7Smrg *) newdlfiles="$newdlfiles $lib" ;; 84026aec45a7Smrg esac 84036aec45a7Smrg done 84046aec45a7Smrg dlfiles="$newdlfiles" 84056aec45a7Smrg newdlprefiles= 84066aec45a7Smrg for lib in $dlprefiles; do 84076aec45a7Smrg case $lib in 84086aec45a7Smrg *.la) 84096aec45a7Smrg # Only pass preopened files to the pseudo-archive (for 84106aec45a7Smrg # eventual linking with the app. that links it) if we 84116aec45a7Smrg # didn't already link the preopened objects directly into 84126aec45a7Smrg # the library: 84136aec45a7Smrg func_basename "$lib" 84146aec45a7Smrg name="$func_basename_result" 84156aec45a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 84166aec45a7Smrg test -z "$libdir" && \ 84176aec45a7Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 84186aec45a7Smrg newdlprefiles="$newdlprefiles $libdir/$name" 84196aec45a7Smrg ;; 84206aec45a7Smrg esac 84216aec45a7Smrg done 84226aec45a7Smrg dlprefiles="$newdlprefiles" 84236aec45a7Smrg else 84246aec45a7Smrg newdlfiles= 84256aec45a7Smrg for lib in $dlfiles; do 84266aec45a7Smrg case $lib in 84276aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 84286aec45a7Smrg *) abs=`pwd`"/$lib" ;; 84296aec45a7Smrg esac 84306aec45a7Smrg newdlfiles="$newdlfiles $abs" 84316aec45a7Smrg done 84326aec45a7Smrg dlfiles="$newdlfiles" 84336aec45a7Smrg newdlprefiles= 84346aec45a7Smrg for lib in $dlprefiles; do 84356aec45a7Smrg case $lib in 84366aec45a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 84376aec45a7Smrg *) abs=`pwd`"/$lib" ;; 84386aec45a7Smrg esac 84396aec45a7Smrg newdlprefiles="$newdlprefiles $abs" 84406aec45a7Smrg done 84416aec45a7Smrg dlprefiles="$newdlprefiles" 84426aec45a7Smrg fi 84436aec45a7Smrg $RM $output 84446aec45a7Smrg # place dlname in correct position for cygwin 84456aec45a7Smrg # In fact, it would be nice if we could use this code for all target 84466aec45a7Smrg # systems that can't hard-code library paths into their executables 84476aec45a7Smrg # and that have no shared library path variable independent of PATH, 84486aec45a7Smrg # but it turns out we can't easily determine that from inspecting 84496aec45a7Smrg # libtool variables, so we have to hard-code the OSs to which it 84506aec45a7Smrg # applies here; at the moment, that means platforms that use the PE 84516aec45a7Smrg # object format with DLL files. See the long comment at the top of 84526aec45a7Smrg # tests/bindir.at for full details. 84536aec45a7Smrg tdlname=$dlname 84546aec45a7Smrg case $host,$output,$installed,$module,$dlname in 84556aec45a7Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 84566aec45a7Smrg # If a -bindir argument was supplied, place the dll there. 84576aec45a7Smrg if test "x$bindir" != x ; 84586aec45a7Smrg then 84596aec45a7Smrg func_relative_path "$install_libdir" "$bindir" 84606aec45a7Smrg tdlname=$func_relative_path_result$dlname 84616aec45a7Smrg else 84626aec45a7Smrg # Otherwise fall back on heuristic. 84636aec45a7Smrg tdlname=../bin/$dlname 84646aec45a7Smrg fi 84656aec45a7Smrg ;; 84666aec45a7Smrg esac 84676aec45a7Smrg $ECHO > $output "\ 84686aec45a7Smrg# $outputname - a libtool library file 84696aec45a7Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 84706aec45a7Smrg# 84716aec45a7Smrg# Please DO NOT delete this file! 84726aec45a7Smrg# It is necessary for linking the library. 8473ab47cfaaSmrg 84746aec45a7Smrg# The name that we can dlopen(3). 84756aec45a7Smrgdlname='$tdlname' 8476ab47cfaaSmrg 84776aec45a7Smrg# Names of this library. 84786aec45a7Smrglibrary_names='$library_names' 8479ab47cfaaSmrg 84806aec45a7Smrg# The name of the static archive. 84816aec45a7Smrgold_library='$old_library' 8482ab47cfaaSmrg 84836aec45a7Smrg# Linker flags that can not go in dependency_libs. 84846aec45a7Smrginherited_linker_flags='$new_inherited_linker_flags' 8485ab47cfaaSmrg 84866aec45a7Smrg# Libraries that this one depends upon. 84876aec45a7Smrgdependency_libs='$dependency_libs' 8488ab47cfaaSmrg 84896aec45a7Smrg# Names of additional weak libraries provided by this library 84906aec45a7Smrgweak_library_names='$weak_libs' 8491ab47cfaaSmrg 84926aec45a7Smrg# Version information for $libname. 84936aec45a7Smrgcurrent=$current 84946aec45a7Smrgage=$age 84956aec45a7Smrgrevision=$revision 8496ab47cfaaSmrg 84976aec45a7Smrg# Is this an already installed library? 84986aec45a7Smrginstalled=$installed 8499ab47cfaaSmrg 85006aec45a7Smrg# Should we warn about portability when linking against -modules? 85016aec45a7Smrgshouldnotlink=$module 8502ab47cfaaSmrg 85036aec45a7Smrg# Files to dlopen/dlpreopen 85046aec45a7Smrgdlopen='$dlfiles' 85056aec45a7Smrgdlpreopen='$dlprefiles' 8506ab47cfaaSmrg 85076aec45a7Smrg# Directory that this library needs to be installed in: 85086aec45a7Smrglibdir='$install_libdir'" 85096aec45a7Smrg if test "$installed" = no && test "$need_relink" = yes; then 85106aec45a7Smrg $ECHO >> $output "\ 85116aec45a7Smrgrelink_command=\"$relink_command\"" 85126aec45a7Smrg fi 85136aec45a7Smrg done 85146aec45a7Smrg } 8515ab47cfaaSmrg 85166aec45a7Smrg # Do a symbolic link so that the libtool archive can be found in 85176aec45a7Smrg # LD_LIBRARY_PATH before the program is installed. 85186aec45a7Smrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 85196aec45a7Smrg ;; 85206aec45a7Smrg esac 85216aec45a7Smrg exit $EXIT_SUCCESS 85226aec45a7Smrg} 85235c42550eSmrg 85246aec45a7Smrg{ test "$mode" = link || test "$mode" = relink; } && 85256aec45a7Smrg func_mode_link ${1+"$@"} 8526ab47cfaaSmrg 8527ab47cfaaSmrg 85286aec45a7Smrg# func_mode_uninstall arg... 85296aec45a7Smrgfunc_mode_uninstall () 85306aec45a7Smrg{ 85316aec45a7Smrg $opt_debug 85326aec45a7Smrg RM="$nonopt" 8533ab47cfaaSmrg files= 8534ab47cfaaSmrg rmforce= 8535ab47cfaaSmrg exit_status=0 8536ab47cfaaSmrg 8537ab47cfaaSmrg # This variable tells wrapper scripts just to set variables rather 8538ab47cfaaSmrg # than running their programs. 8539ab47cfaaSmrg libtool_install_magic="$magic" 8540ab47cfaaSmrg 8541ab47cfaaSmrg for arg 8542ab47cfaaSmrg do 8543ab47cfaaSmrg case $arg in 85446aec45a7Smrg -f) RM="$RM $arg"; rmforce=yes ;; 85456aec45a7Smrg -*) RM="$RM $arg" ;; 8546ab47cfaaSmrg *) files="$files $arg" ;; 8547ab47cfaaSmrg esac 8548ab47cfaaSmrg done 8549ab47cfaaSmrg 85506aec45a7Smrg test -z "$RM" && \ 85516aec45a7Smrg func_fatal_help "you must specify an RM program" 8552ab47cfaaSmrg 8553ab47cfaaSmrg rmdirs= 8554ab47cfaaSmrg 8555ab47cfaaSmrg origobjdir="$objdir" 8556ab47cfaaSmrg for file in $files; do 85576aec45a7Smrg func_dirname "$file" "" "." 85586aec45a7Smrg dir="$func_dirname_result" 85596aec45a7Smrg if test "X$dir" = X.; then 8560ab47cfaaSmrg objdir="$origobjdir" 8561ab47cfaaSmrg else 8562ab47cfaaSmrg objdir="$dir/$origobjdir" 8563ab47cfaaSmrg fi 85646aec45a7Smrg func_basename "$file" 85656aec45a7Smrg name="$func_basename_result" 8566ab47cfaaSmrg test "$mode" = uninstall && objdir="$dir" 8567ab47cfaaSmrg 8568ab47cfaaSmrg # Remember objdir for removal later, being careful to avoid duplicates 8569ab47cfaaSmrg if test "$mode" = clean; then 8570ab47cfaaSmrg case " $rmdirs " in 8571ab47cfaaSmrg *" $objdir "*) ;; 8572ab47cfaaSmrg *) rmdirs="$rmdirs $objdir" ;; 8573ab47cfaaSmrg esac 8574ab47cfaaSmrg fi 8575ab47cfaaSmrg 8576ab47cfaaSmrg # Don't error if the file doesn't exist and rm -f was used. 85776aec45a7Smrg if { test -L "$file"; } >/dev/null 2>&1 || 85786aec45a7Smrg { test -h "$file"; } >/dev/null 2>&1 || 85796aec45a7Smrg test -f "$file"; then 8580ab47cfaaSmrg : 8581ab47cfaaSmrg elif test -d "$file"; then 8582ab47cfaaSmrg exit_status=1 8583ab47cfaaSmrg continue 8584ab47cfaaSmrg elif test "$rmforce" = yes; then 8585ab47cfaaSmrg continue 8586ab47cfaaSmrg fi 8587ab47cfaaSmrg 8588ab47cfaaSmrg rmfiles="$file" 8589ab47cfaaSmrg 8590ab47cfaaSmrg case $name in 8591ab47cfaaSmrg *.la) 8592ab47cfaaSmrg # Possibly a libtool archive, so verify it. 85936aec45a7Smrg if func_lalib_p "$file"; then 85946aec45a7Smrg func_source $dir/$name 8595ab47cfaaSmrg 8596ab47cfaaSmrg # Delete the libtool libraries and symlinks. 8597ab47cfaaSmrg for n in $library_names; do 8598ab47cfaaSmrg rmfiles="$rmfiles $objdir/$n" 8599ab47cfaaSmrg done 8600ab47cfaaSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8601ab47cfaaSmrg 8602ab47cfaaSmrg case "$mode" in 8603ab47cfaaSmrg clean) 8604ab47cfaaSmrg case " $library_names " in 8605ab47cfaaSmrg # " " in the beginning catches empty $dlname 8606ab47cfaaSmrg *" $dlname "*) ;; 8607ab47cfaaSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 8608ab47cfaaSmrg esac 86096aec45a7Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8610ab47cfaaSmrg ;; 8611ab47cfaaSmrg uninstall) 8612ab47cfaaSmrg if test -n "$library_names"; then 8613ab47cfaaSmrg # Do each command in the postuninstall commands. 86146aec45a7Smrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8615ab47cfaaSmrg fi 8616ab47cfaaSmrg 8617ab47cfaaSmrg if test -n "$old_library"; then 8618ab47cfaaSmrg # Do each command in the old_postuninstall commands. 86196aec45a7Smrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8620ab47cfaaSmrg fi 8621ab47cfaaSmrg # FIXME: should reinstall the best remaining shared library. 8622ab47cfaaSmrg ;; 8623ab47cfaaSmrg esac 8624ab47cfaaSmrg fi 8625ab47cfaaSmrg ;; 8626ab47cfaaSmrg 8627ab47cfaaSmrg *.lo) 8628ab47cfaaSmrg # Possibly a libtool object, so verify it. 86296aec45a7Smrg if func_lalib_p "$file"; then 8630ab47cfaaSmrg 8631ab47cfaaSmrg # Read the .lo file 86326aec45a7Smrg func_source $dir/$name 8633ab47cfaaSmrg 8634ab47cfaaSmrg # Add PIC object to the list of files to remove. 86356aec45a7Smrg if test -n "$pic_object" && 86366aec45a7Smrg test "$pic_object" != none; then 8637ab47cfaaSmrg rmfiles="$rmfiles $dir/$pic_object" 8638ab47cfaaSmrg fi 8639ab47cfaaSmrg 8640ab47cfaaSmrg # Add non-PIC object to the list of files to remove. 86416aec45a7Smrg if test -n "$non_pic_object" && 86426aec45a7Smrg test "$non_pic_object" != none; then 8643ab47cfaaSmrg rmfiles="$rmfiles $dir/$non_pic_object" 8644ab47cfaaSmrg fi 8645ab47cfaaSmrg fi 8646ab47cfaaSmrg ;; 8647ab47cfaaSmrg 8648ab47cfaaSmrg *) 8649ab47cfaaSmrg if test "$mode" = clean ; then 8650ab47cfaaSmrg noexename=$name 8651ab47cfaaSmrg case $file in 8652ab47cfaaSmrg *.exe) 86536aec45a7Smrg func_stripname '' '.exe' "$file" 86546aec45a7Smrg file=$func_stripname_result 86556aec45a7Smrg func_stripname '' '.exe' "$name" 86566aec45a7Smrg noexename=$func_stripname_result 8657ab47cfaaSmrg # $file with .exe has already been added to rmfiles, 8658ab47cfaaSmrg # add $file without .exe 8659ab47cfaaSmrg rmfiles="$rmfiles $file" 8660ab47cfaaSmrg ;; 8661ab47cfaaSmrg esac 8662ab47cfaaSmrg # Do a test to see if this is a libtool program. 86636aec45a7Smrg if func_ltwrapper_p "$file"; then 86646aec45a7Smrg if func_ltwrapper_executable_p "$file"; then 86656aec45a7Smrg func_ltwrapper_scriptname "$file" 86666aec45a7Smrg relink_command= 86676aec45a7Smrg func_source $func_ltwrapper_scriptname_result 86686aec45a7Smrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 86696aec45a7Smrg else 86706aec45a7Smrg relink_command= 86716aec45a7Smrg func_source $dir/$noexename 86726aec45a7Smrg fi 8673ab47cfaaSmrg 8674ab47cfaaSmrg # note $name still contains .exe if it was in $file originally 8675ab47cfaaSmrg # as does the version of $file that was added into $rmfiles 8676ab47cfaaSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8677ab47cfaaSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 8678ab47cfaaSmrg rmfiles="$rmfiles $objdir/lt-$name" 8679ab47cfaaSmrg fi 8680ab47cfaaSmrg if test "X$noexename" != "X$name" ; then 8681ab47cfaaSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8682ab47cfaaSmrg fi 8683ab47cfaaSmrg fi 8684ab47cfaaSmrg fi 8685ab47cfaaSmrg ;; 8686ab47cfaaSmrg esac 86876aec45a7Smrg func_show_eval "$RM $rmfiles" 'exit_status=1' 8688ab47cfaaSmrg done 8689ab47cfaaSmrg objdir="$origobjdir" 8690ab47cfaaSmrg 8691ab47cfaaSmrg # Try to remove the ${objdir}s in the directories where we deleted files 8692ab47cfaaSmrg for dir in $rmdirs; do 8693ab47cfaaSmrg if test -d "$dir"; then 86946aec45a7Smrg func_show_eval "rmdir $dir >/dev/null 2>&1" 8695ab47cfaaSmrg fi 8696ab47cfaaSmrg done 8697ab47cfaaSmrg 8698ab47cfaaSmrg exit $exit_status 86996aec45a7Smrg} 8700ab47cfaaSmrg 87016aec45a7Smrg{ test "$mode" = uninstall || test "$mode" = clean; } && 87026aec45a7Smrg func_mode_uninstall ${1+"$@"} 87031473d951Smrg 87046aec45a7Smrgtest -z "$mode" && { 87056aec45a7Smrg help="$generic_help" 87066aec45a7Smrg func_fatal_help "you must specify a MODE" 87076aec45a7Smrg} 87086aec45a7Smrg 87096aec45a7Smrgtest -z "$exec_cmd" && \ 87106aec45a7Smrg func_fatal_help "invalid operation mode \`$mode'" 8711ab47cfaaSmrg 8712ab47cfaaSmrgif test -n "$exec_cmd"; then 87136aec45a7Smrg eval exec "$exec_cmd" 8714ab47cfaaSmrg exit $EXIT_FAILURE 8715ab47cfaaSmrgfi 8716ab47cfaaSmrg 87176aec45a7Smrgexit $exit_status 87185c42550eSmrg 8719ab47cfaaSmrg 8720ab47cfaaSmrg# The TAGs below are defined such that we never get into a situation 8721ab47cfaaSmrg# in which we disable both kinds of libraries. Given conflicting 8722ab47cfaaSmrg# choices, we go for a static library, that is the most portable, 8723ab47cfaaSmrg# since we can't tell whether shared libraries were disabled because 8724ab47cfaaSmrg# the user asked for that or because the platform doesn't support 8725ab47cfaaSmrg# them. This is particularly important on AIX, because we don't 8726ab47cfaaSmrg# support having both static and shared libraries enabled at the same 8727ab47cfaaSmrg# time on that platform, so we default to a shared-only configuration. 8728ab47cfaaSmrg# If a disable-shared tag is given, we'll fallback to a static-only 8729ab47cfaaSmrg# configuration. But we'll never go from static-only to shared-only. 8730ab47cfaaSmrg 8731ab47cfaaSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 87326aec45a7Smrgbuild_libtool_libs=no 87336aec45a7Smrgbuild_old_libs=yes 8734ab47cfaaSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 8735ab47cfaaSmrg 8736ab47cfaaSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 87376aec45a7Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8738ab47cfaaSmrg# ### END LIBTOOL TAG CONFIG: disable-static 8739ab47cfaaSmrg 8740ab47cfaaSmrg# Local Variables: 8741ab47cfaaSmrg# mode:shell-script 8742ab47cfaaSmrg# sh-indentation:2 8743ab47cfaaSmrg# End: 87446aec45a7Smrg# vi:sw=2 87456aec45a7Smrg 8746