ltmain.sh revision 62ab96ba
15eefee25Smacallan# ltmain.sh - Provide generalized library-building support services. 25eefee25Smacallan# NOTE: Changing this file will not affect anything until you rerun configure. 35eefee25Smacallan# 462ab96baSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 562ab96baSmrg# 2007, 2008 Free Software Foundation, Inc. 65eefee25Smacallan# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 75eefee25Smacallan# 85eefee25Smacallan# This program is free software; you can redistribute it and/or modify 95eefee25Smacallan# it under the terms of the GNU General Public License as published by 105eefee25Smacallan# the Free Software Foundation; either version 2 of the License, or 115eefee25Smacallan# (at your option) any later version. 125eefee25Smacallan# 135eefee25Smacallan# This program is distributed in the hope that it will be useful, but 145eefee25Smacallan# WITHOUT ANY WARRANTY; without even the implied warranty of 155eefee25Smacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 165eefee25Smacallan# General Public License for more details. 175eefee25Smacallan# 185eefee25Smacallan# You should have received a copy of the GNU General Public License 195eefee25Smacallan# along with this program; if not, write to the Free Software 205eefee25Smacallan# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 215eefee25Smacallan# 225eefee25Smacallan# As a special exception to the GNU General Public License, if you 235eefee25Smacallan# distribute this file as part of a program that contains a 245eefee25Smacallan# configuration script generated by Autoconf, you may include it under 255eefee25Smacallan# the same distribution terms that you use for the rest of that program. 265eefee25Smacallan 275eefee25Smacallanbasename="s,^.*/,,g" 285eefee25Smacallan 295eefee25Smacallan# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 305eefee25Smacallan# is ksh but when the shell is invoked as "sh" and the current value of 315eefee25Smacallan# the _XPG environment variable is not equal to 1 (one), the special 325eefee25Smacallan# positional parameter $0, within a function call, is the name of the 335eefee25Smacallan# function. 345eefee25Smacallanprogpath="$0" 355eefee25Smacallan 365eefee25Smacallan# The name of this program: 375eefee25Smacallanprogname=`echo "$progpath" | $SED $basename` 385eefee25Smacallanmodename="$progname" 395eefee25Smacallan 405eefee25Smacallan# Global variables: 415eefee25SmacallanEXIT_SUCCESS=0 425eefee25SmacallanEXIT_FAILURE=1 435eefee25Smacallan 445eefee25SmacallanPROGRAM=ltmain.sh 455eefee25SmacallanPACKAGE=libtool 4662ab96baSmrgVERSION="1.5.26 Debian 1.5.26-4" 4762ab96baSmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 4862ab96baSmrg 4962ab96baSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5062ab96baSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 5162ab96baSmrg emulate sh 5262ab96baSmrg NULLCMD=: 5362ab96baSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 5462ab96baSmrg # is contrary to our usage. Disable this feature. 5562ab96baSmrg alias -g '${1+"$@"}'='"$@"' 565eefee25Smacallan setopt NO_GLOB_SUBST 5762ab96baSmrgelse 5862ab96baSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 595eefee25Smacallanfi 6062ab96baSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 6162ab96baSmrgDUALCASE=1; export DUALCASE # for MKS sh 625eefee25Smacallan 635eefee25Smacallan# Check that we have a working $echo. 645eefee25Smacallanif test "X$1" = X--no-reexec; then 655eefee25Smacallan # Discard the --no-reexec flag, and continue. 665eefee25Smacallan shift 675eefee25Smacallanelif test "X$1" = X--fallback-echo; then 685eefee25Smacallan # Avoid inline document here, it may be left over 695eefee25Smacallan : 705eefee25Smacallanelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 715eefee25Smacallan # Yippee, $echo works! 725eefee25Smacallan : 735eefee25Smacallanelse 745eefee25Smacallan # Restart under the correct shell, and then maybe $echo will work. 755eefee25Smacallan exec $SHELL "$progpath" --no-reexec ${1+"$@"} 765eefee25Smacallanfi 775eefee25Smacallan 785eefee25Smacallanif test "X$1" = X--fallback-echo; then 795eefee25Smacallan # used as fallback echo 805eefee25Smacallan shift 815eefee25Smacallan cat <<EOF 825eefee25Smacallan$* 835eefee25SmacallanEOF 845eefee25Smacallan exit $EXIT_SUCCESS 855eefee25Smacallanfi 865eefee25Smacallan 875eefee25Smacallandefault_mode= 885eefee25Smacallanhelp="Try \`$progname --help' for more information." 895eefee25Smacallanmagic="%%%MAGIC variable%%%" 905eefee25Smacallanmkdir="mkdir" 915eefee25Smacallanmv="mv -f" 925eefee25Smacallanrm="rm -f" 935eefee25Smacallan 945eefee25Smacallan# Sed substitution that helps us do robust quoting. It backslashifies 955eefee25Smacallan# metacharacters that are still active within double-quoted strings. 965eefee25SmacallanXsed="${SED}"' -e 1s/^X//' 975eefee25Smacallansed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 985eefee25Smacallan# test EBCDIC or ASCII 995eefee25Smacallancase `echo X|tr X '\101'` in 1005eefee25Smacallan A) # ASCII based system 1015eefee25Smacallan # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 1025eefee25Smacallan SP2NL='tr \040 \012' 1035eefee25Smacallan NL2SP='tr \015\012 \040\040' 1045eefee25Smacallan ;; 1055eefee25Smacallan *) # EBCDIC based system 1065eefee25Smacallan SP2NL='tr \100 \n' 1075eefee25Smacallan NL2SP='tr \r\n \100\100' 1085eefee25Smacallan ;; 1095eefee25Smacallanesac 1105eefee25Smacallan 1115eefee25Smacallan# NLS nuisances. 1125eefee25Smacallan# Only set LANG and LC_ALL to C if already set. 1135eefee25Smacallan# These must not be set unconditionally because not all systems understand 1145eefee25Smacallan# e.g. LANG=C (notably SCO). 1155eefee25Smacallan# We save the old values to restore during execute mode. 11662ab96baSmrglt_env= 11762ab96baSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11862ab96baSmrgdo 11962ab96baSmrg eval "if test \"\${$lt_var+set}\" = set; then 12062ab96baSmrg save_$lt_var=\$$lt_var 12162ab96baSmrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 12262ab96baSmrg $lt_var=C 12362ab96baSmrg export $lt_var 12462ab96baSmrg fi" 12562ab96baSmrgdone 12662ab96baSmrg 12762ab96baSmrgif test -n "$lt_env"; then 12862ab96baSmrg lt_env="env $lt_env" 1295eefee25Smacallanfi 1305eefee25Smacallan 1315eefee25Smacallan# Make sure IFS has a sensible default 1325eefee25Smacallanlt_nl=' 1335eefee25Smacallan' 1345eefee25SmacallanIFS=" $lt_nl" 1355eefee25Smacallan 1365eefee25Smacallanif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1375eefee25Smacallan $echo "$modename: not configured to build any kind of library" 1>&2 1385eefee25Smacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1395eefee25Smacallan exit $EXIT_FAILURE 1405eefee25Smacallanfi 1415eefee25Smacallan 1425eefee25Smacallan# Global variables. 1435eefee25Smacallanmode=$default_mode 1445eefee25Smacallannonopt= 1455eefee25Smacallanprev= 1465eefee25Smacallanprevopt= 1475eefee25Smacallanrun= 1485eefee25Smacallanshow="$echo" 1495eefee25Smacallanshow_help= 1505eefee25Smacallanexecute_dlfiles= 1515eefee25Smacallanduplicate_deps=no 1525eefee25Smacallanpreserve_args= 1535eefee25Smacallanlo2o="s/\\.lo\$/.${objext}/" 1545eefee25Smacallano2lo="s/\\.${objext}\$/.lo/" 15562ab96baSmrgextracted_archives= 15662ab96baSmrgextracted_serial=0 1575eefee25Smacallan 1585eefee25Smacallan##################################### 1595eefee25Smacallan# Shell function definitions: 1605eefee25Smacallan# This seems to be the best place for them 1615eefee25Smacallan 1625eefee25Smacallan# func_mktempdir [string] 1635eefee25Smacallan# Make a temporary directory that won't clash with other running 1645eefee25Smacallan# libtool processes, and avoids race conditions if possible. If 1655eefee25Smacallan# given, STRING is the basename for that directory. 1665eefee25Smacallanfunc_mktempdir () 1675eefee25Smacallan{ 1685eefee25Smacallan my_template="${TMPDIR-/tmp}/${1-$progname}" 1695eefee25Smacallan 1705eefee25Smacallan if test "$run" = ":"; then 1715eefee25Smacallan # Return a directory name, but don't create it in dry-run mode 1725eefee25Smacallan my_tmpdir="${my_template}-$$" 1735eefee25Smacallan else 1745eefee25Smacallan 1755eefee25Smacallan # If mktemp works, use that first and foremost 1765eefee25Smacallan my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1775eefee25Smacallan 1785eefee25Smacallan if test ! -d "$my_tmpdir"; then 1795eefee25Smacallan # Failing that, at least try and use $RANDOM to avoid a race 1805eefee25Smacallan my_tmpdir="${my_template}-${RANDOM-0}$$" 1815eefee25Smacallan 1825eefee25Smacallan save_mktempdir_umask=`umask` 1835eefee25Smacallan umask 0077 1845eefee25Smacallan $mkdir "$my_tmpdir" 1855eefee25Smacallan umask $save_mktempdir_umask 1865eefee25Smacallan fi 1875eefee25Smacallan 1885eefee25Smacallan # If we're not in dry-run mode, bomb out on failure 1895eefee25Smacallan test -d "$my_tmpdir" || { 1905eefee25Smacallan $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 1915eefee25Smacallan exit $EXIT_FAILURE 1925eefee25Smacallan } 1935eefee25Smacallan fi 1945eefee25Smacallan 1955eefee25Smacallan $echo "X$my_tmpdir" | $Xsed 1965eefee25Smacallan} 1975eefee25Smacallan 1985eefee25Smacallan 1995eefee25Smacallan# func_win32_libid arg 2005eefee25Smacallan# return the library type of file 'arg' 2015eefee25Smacallan# 2025eefee25Smacallan# Need a lot of goo to handle *both* DLLs and import libs 2035eefee25Smacallan# Has to be a shell function in order to 'eat' the argument 2045eefee25Smacallan# that is supplied when $file_magic_command is called. 2055eefee25Smacallanfunc_win32_libid () 2065eefee25Smacallan{ 2075eefee25Smacallan win32_libid_type="unknown" 2085eefee25Smacallan win32_fileres=`file -L $1 2>/dev/null` 2095eefee25Smacallan case $win32_fileres in 2105eefee25Smacallan *ar\ archive\ import\ library*) # definitely import 2115eefee25Smacallan win32_libid_type="x86 archive import" 2125eefee25Smacallan ;; 2135eefee25Smacallan *ar\ archive*) # could be an import, or static 2145eefee25Smacallan if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 2155eefee25Smacallan $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2165eefee25Smacallan win32_nmres=`eval $NM -f posix -A $1 | \ 21762ab96baSmrg $SED -n -e '1,100{ 21862ab96baSmrg / I /{ 21962ab96baSmrg s,.*,import, 22062ab96baSmrg p 22162ab96baSmrg q 22262ab96baSmrg } 22362ab96baSmrg }'` 2245eefee25Smacallan case $win32_nmres in 2255eefee25Smacallan import*) win32_libid_type="x86 archive import";; 2265eefee25Smacallan *) win32_libid_type="x86 archive static";; 2275eefee25Smacallan esac 2285eefee25Smacallan fi 2295eefee25Smacallan ;; 2305eefee25Smacallan *DLL*) 2315eefee25Smacallan win32_libid_type="x86 DLL" 2325eefee25Smacallan ;; 2335eefee25Smacallan *executable*) # but shell scripts are "executable" too... 2345eefee25Smacallan case $win32_fileres in 2355eefee25Smacallan *MS\ Windows\ PE\ Intel*) 2365eefee25Smacallan win32_libid_type="x86 DLL" 2375eefee25Smacallan ;; 2385eefee25Smacallan esac 2395eefee25Smacallan ;; 2405eefee25Smacallan esac 2415eefee25Smacallan $echo $win32_libid_type 2425eefee25Smacallan} 2435eefee25Smacallan 2445eefee25Smacallan 2455eefee25Smacallan# func_infer_tag arg 2465eefee25Smacallan# Infer tagged configuration to use if any are available and 2475eefee25Smacallan# if one wasn't chosen via the "--tag" command line option. 2485eefee25Smacallan# Only attempt this if the compiler in the base compile 2495eefee25Smacallan# command doesn't match the default compiler. 2505eefee25Smacallan# arg is usually of the form 'gcc ...' 2515eefee25Smacallanfunc_infer_tag () 2525eefee25Smacallan{ 2535eefee25Smacallan if test -n "$available_tags" && test -z "$tagname"; then 2545eefee25Smacallan CC_quoted= 2555eefee25Smacallan for arg in $CC; do 2565eefee25Smacallan case $arg in 2575eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2585eefee25Smacallan arg="\"$arg\"" 2595eefee25Smacallan ;; 2605eefee25Smacallan esac 2615eefee25Smacallan CC_quoted="$CC_quoted $arg" 2625eefee25Smacallan done 2635eefee25Smacallan case $@ in 2645eefee25Smacallan # Blanks in the command may have been stripped by the calling shell, 2655eefee25Smacallan # but not from the CC environment variable when configure was run. 2665eefee25Smacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 2675eefee25Smacallan # Blanks at the start of $base_compile will cause this to fail 2685eefee25Smacallan # if we don't check for them as well. 2695eefee25Smacallan *) 2705eefee25Smacallan for z in $available_tags; do 2715eefee25Smacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2725eefee25Smacallan # Evaluate the configuration. 2735eefee25Smacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2745eefee25Smacallan CC_quoted= 2755eefee25Smacallan for arg in $CC; do 2765eefee25Smacallan # Double-quote args containing other shell metacharacters. 2775eefee25Smacallan case $arg in 2785eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2795eefee25Smacallan arg="\"$arg\"" 2805eefee25Smacallan ;; 2815eefee25Smacallan esac 2825eefee25Smacallan CC_quoted="$CC_quoted $arg" 2835eefee25Smacallan done 2845eefee25Smacallan case "$@ " in 2855eefee25Smacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 2865eefee25Smacallan # The compiler in the base compile command matches 2875eefee25Smacallan # the one in the tagged configuration. 2885eefee25Smacallan # Assume this is the tagged configuration we want. 2895eefee25Smacallan tagname=$z 2905eefee25Smacallan break 2915eefee25Smacallan ;; 2925eefee25Smacallan esac 2935eefee25Smacallan fi 2945eefee25Smacallan done 2955eefee25Smacallan # If $tagname still isn't set, then no tagged configuration 2965eefee25Smacallan # was found and let the user know that the "--tag" command 2975eefee25Smacallan # line option must be used. 2985eefee25Smacallan if test -z "$tagname"; then 2995eefee25Smacallan $echo "$modename: unable to infer tagged configuration" 3005eefee25Smacallan $echo "$modename: specify a tag with \`--tag'" 1>&2 3015eefee25Smacallan exit $EXIT_FAILURE 3025eefee25Smacallan# else 3035eefee25Smacallan# $echo "$modename: using $tagname tagged configuration" 3045eefee25Smacallan fi 3055eefee25Smacallan ;; 3065eefee25Smacallan esac 3075eefee25Smacallan fi 3085eefee25Smacallan} 3095eefee25Smacallan 3105eefee25Smacallan 3115eefee25Smacallan# func_extract_an_archive dir oldlib 3125eefee25Smacallanfunc_extract_an_archive () 3135eefee25Smacallan{ 3145eefee25Smacallan f_ex_an_ar_dir="$1"; shift 3155eefee25Smacallan f_ex_an_ar_oldlib="$1" 3165eefee25Smacallan 3175eefee25Smacallan $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 3185eefee25Smacallan $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 3195eefee25Smacallan if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3205eefee25Smacallan : 3215eefee25Smacallan else 3225eefee25Smacallan $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 3235eefee25Smacallan exit $EXIT_FAILURE 3245eefee25Smacallan fi 3255eefee25Smacallan} 3265eefee25Smacallan 3275eefee25Smacallan# func_extract_archives gentop oldlib ... 3285eefee25Smacallanfunc_extract_archives () 3295eefee25Smacallan{ 3305eefee25Smacallan my_gentop="$1"; shift 3315eefee25Smacallan my_oldlibs=${1+"$@"} 3325eefee25Smacallan my_oldobjs="" 3335eefee25Smacallan my_xlib="" 3345eefee25Smacallan my_xabs="" 3355eefee25Smacallan my_xdir="" 3365eefee25Smacallan my_status="" 3375eefee25Smacallan 3385eefee25Smacallan $show "${rm}r $my_gentop" 3395eefee25Smacallan $run ${rm}r "$my_gentop" 3405eefee25Smacallan $show "$mkdir $my_gentop" 3415eefee25Smacallan $run $mkdir "$my_gentop" 3425eefee25Smacallan my_status=$? 3435eefee25Smacallan if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3445eefee25Smacallan exit $my_status 3455eefee25Smacallan fi 3465eefee25Smacallan 3475eefee25Smacallan for my_xlib in $my_oldlibs; do 3485eefee25Smacallan # Extract the objects. 3495eefee25Smacallan case $my_xlib in 3505eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3515eefee25Smacallan *) my_xabs=`pwd`"/$my_xlib" ;; 3525eefee25Smacallan esac 3535eefee25Smacallan my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 35462ab96baSmrg my_xlib_u=$my_xlib 35562ab96baSmrg while :; do 35662ab96baSmrg case " $extracted_archives " in 35762ab96baSmrg *" $my_xlib_u "*) 35862ab96baSmrg extracted_serial=`expr $extracted_serial + 1` 35962ab96baSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 36062ab96baSmrg *) break ;; 36162ab96baSmrg esac 36262ab96baSmrg done 36362ab96baSmrg extracted_archives="$extracted_archives $my_xlib_u" 36462ab96baSmrg my_xdir="$my_gentop/$my_xlib_u" 3655eefee25Smacallan 3665eefee25Smacallan $show "${rm}r $my_xdir" 3675eefee25Smacallan $run ${rm}r "$my_xdir" 3685eefee25Smacallan $show "$mkdir $my_xdir" 3695eefee25Smacallan $run $mkdir "$my_xdir" 3705eefee25Smacallan exit_status=$? 3715eefee25Smacallan if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 3725eefee25Smacallan exit $exit_status 3735eefee25Smacallan fi 3745eefee25Smacallan case $host in 3755eefee25Smacallan *-darwin*) 3765eefee25Smacallan $show "Extracting $my_xabs" 3775eefee25Smacallan # Do not bother doing anything if just a dry run 3785eefee25Smacallan if test -z "$run"; then 3795eefee25Smacallan darwin_orig_dir=`pwd` 3805eefee25Smacallan cd $my_xdir || exit $? 3815eefee25Smacallan darwin_archive=$my_xabs 3825eefee25Smacallan darwin_curdir=`pwd` 3835eefee25Smacallan darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 3845eefee25Smacallan darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 3855eefee25Smacallan if test -n "$darwin_arches"; then 3865eefee25Smacallan darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 3875eefee25Smacallan darwin_arch= 3885eefee25Smacallan $show "$darwin_base_archive has multiple architectures $darwin_arches" 3895eefee25Smacallan for darwin_arch in $darwin_arches ; do 3905eefee25Smacallan mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3915eefee25Smacallan lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3925eefee25Smacallan cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3935eefee25Smacallan func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3945eefee25Smacallan cd "$darwin_curdir" 3955eefee25Smacallan $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3965eefee25Smacallan done # $darwin_arches 3975eefee25Smacallan ## Okay now we have a bunch of thin objects, gotta fatten them up :) 3985eefee25Smacallan darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 3995eefee25Smacallan darwin_file= 4005eefee25Smacallan darwin_files= 4015eefee25Smacallan for darwin_file in $darwin_filelist; do 4025eefee25Smacallan darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 4035eefee25Smacallan lipo -create -output "$darwin_file" $darwin_files 4045eefee25Smacallan done # $darwin_filelist 4055eefee25Smacallan ${rm}r unfat-$$ 4065eefee25Smacallan cd "$darwin_orig_dir" 4075eefee25Smacallan else 4085eefee25Smacallan cd "$darwin_orig_dir" 4095eefee25Smacallan func_extract_an_archive "$my_xdir" "$my_xabs" 4105eefee25Smacallan fi # $darwin_arches 4115eefee25Smacallan fi # $run 4125eefee25Smacallan ;; 4135eefee25Smacallan *) 4145eefee25Smacallan func_extract_an_archive "$my_xdir" "$my_xabs" 4155eefee25Smacallan ;; 4165eefee25Smacallan esac 4175eefee25Smacallan my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 4185eefee25Smacallan done 4195eefee25Smacallan func_extract_archives_result="$my_oldobjs" 4205eefee25Smacallan} 4215eefee25Smacallan# End of Shell function definitions 4225eefee25Smacallan##################################### 4235eefee25Smacallan 4245eefee25Smacallan# Darwin sucks 4255eefee25Smacallaneval std_shrext=\"$shrext_cmds\" 4265eefee25Smacallan 4275eefee25Smacallandisable_libs=no 4285eefee25Smacallan 4295eefee25Smacallan# Parse our command line options once, thoroughly. 4305eefee25Smacallanwhile test "$#" -gt 0 4315eefee25Smacallando 4325eefee25Smacallan arg="$1" 4335eefee25Smacallan shift 4345eefee25Smacallan 4355eefee25Smacallan case $arg in 4365eefee25Smacallan -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4375eefee25Smacallan *) optarg= ;; 4385eefee25Smacallan esac 4395eefee25Smacallan 4405eefee25Smacallan # If the previous option needs an argument, assign it. 4415eefee25Smacallan if test -n "$prev"; then 4425eefee25Smacallan case $prev in 4435eefee25Smacallan execute_dlfiles) 4445eefee25Smacallan execute_dlfiles="$execute_dlfiles $arg" 4455eefee25Smacallan ;; 4465eefee25Smacallan tag) 4475eefee25Smacallan tagname="$arg" 4485eefee25Smacallan preserve_args="${preserve_args}=$arg" 4495eefee25Smacallan 4505eefee25Smacallan # Check whether tagname contains only valid characters 4515eefee25Smacallan case $tagname in 4525eefee25Smacallan *[!-_A-Za-z0-9,/]*) 4535eefee25Smacallan $echo "$progname: invalid tag name: $tagname" 1>&2 4545eefee25Smacallan exit $EXIT_FAILURE 4555eefee25Smacallan ;; 4565eefee25Smacallan esac 4575eefee25Smacallan 4585eefee25Smacallan case $tagname in 4595eefee25Smacallan CC) 4605eefee25Smacallan # Don't test for the "default" C tag, as we know, it's there, but 4615eefee25Smacallan # not specially marked. 4625eefee25Smacallan ;; 4635eefee25Smacallan *) 4645eefee25Smacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 4655eefee25Smacallan taglist="$taglist $tagname" 4665eefee25Smacallan # Evaluate the configuration. 4675eefee25Smacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 4685eefee25Smacallan else 4695eefee25Smacallan $echo "$progname: ignoring unknown tag $tagname" 1>&2 4705eefee25Smacallan fi 4715eefee25Smacallan ;; 4725eefee25Smacallan esac 4735eefee25Smacallan ;; 4745eefee25Smacallan *) 4755eefee25Smacallan eval "$prev=\$arg" 4765eefee25Smacallan ;; 4775eefee25Smacallan esac 4785eefee25Smacallan 4795eefee25Smacallan prev= 4805eefee25Smacallan prevopt= 4815eefee25Smacallan continue 4825eefee25Smacallan fi 4835eefee25Smacallan 4845eefee25Smacallan # Have we seen a non-optional argument yet? 4855eefee25Smacallan case $arg in 4865eefee25Smacallan --help) 4875eefee25Smacallan show_help=yes 4885eefee25Smacallan ;; 4895eefee25Smacallan 4905eefee25Smacallan --version) 49162ab96baSmrg echo "\ 49262ab96baSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 49362ab96baSmrg 49462ab96baSmrgCopyright (C) 2008 Free Software Foundation, Inc. 49562ab96baSmrgThis is free software; see the source for copying conditions. There is NO 49662ab96baSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 4975eefee25Smacallan exit $? 4985eefee25Smacallan ;; 4995eefee25Smacallan 5005eefee25Smacallan --config) 5015eefee25Smacallan ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 5025eefee25Smacallan # Now print the configurations for the tags. 5035eefee25Smacallan for tagname in $taglist; do 5045eefee25Smacallan ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 5055eefee25Smacallan done 5065eefee25Smacallan exit $? 5075eefee25Smacallan ;; 5085eefee25Smacallan 5095eefee25Smacallan --debug) 5105eefee25Smacallan $echo "$progname: enabling shell trace mode" 5115eefee25Smacallan set -x 5125eefee25Smacallan preserve_args="$preserve_args $arg" 5135eefee25Smacallan ;; 5145eefee25Smacallan 5155eefee25Smacallan --dry-run | -n) 5165eefee25Smacallan run=: 5175eefee25Smacallan ;; 5185eefee25Smacallan 5195eefee25Smacallan --features) 5205eefee25Smacallan $echo "host: $host" 5215eefee25Smacallan if test "$build_libtool_libs" = yes; then 5225eefee25Smacallan $echo "enable shared libraries" 5235eefee25Smacallan else 5245eefee25Smacallan $echo "disable shared libraries" 5255eefee25Smacallan fi 5265eefee25Smacallan if test "$build_old_libs" = yes; then 5275eefee25Smacallan $echo "enable static libraries" 5285eefee25Smacallan else 5295eefee25Smacallan $echo "disable static libraries" 5305eefee25Smacallan fi 5315eefee25Smacallan exit $? 5325eefee25Smacallan ;; 5335eefee25Smacallan 5345eefee25Smacallan --finish) mode="finish" ;; 5355eefee25Smacallan 5365eefee25Smacallan --mode) prevopt="--mode" prev=mode ;; 5375eefee25Smacallan --mode=*) mode="$optarg" ;; 5385eefee25Smacallan 5395eefee25Smacallan --preserve-dup-deps) duplicate_deps="yes" ;; 5405eefee25Smacallan 5415eefee25Smacallan --quiet | --silent) 5425eefee25Smacallan show=: 5435eefee25Smacallan preserve_args="$preserve_args $arg" 5445eefee25Smacallan ;; 5455eefee25Smacallan 5465eefee25Smacallan --tag) 5475eefee25Smacallan prevopt="--tag" 5485eefee25Smacallan prev=tag 5495eefee25Smacallan preserve_args="$preserve_args --tag" 5505eefee25Smacallan ;; 5515eefee25Smacallan --tag=*) 5525eefee25Smacallan set tag "$optarg" ${1+"$@"} 5535eefee25Smacallan shift 5545eefee25Smacallan prev=tag 5555eefee25Smacallan preserve_args="$preserve_args --tag" 5565eefee25Smacallan ;; 5575eefee25Smacallan 5585eefee25Smacallan -dlopen) 5595eefee25Smacallan prevopt="-dlopen" 5605eefee25Smacallan prev=execute_dlfiles 5615eefee25Smacallan ;; 5625eefee25Smacallan 5635eefee25Smacallan -*) 5645eefee25Smacallan $echo "$modename: unrecognized option \`$arg'" 1>&2 5655eefee25Smacallan $echo "$help" 1>&2 5665eefee25Smacallan exit $EXIT_FAILURE 5675eefee25Smacallan ;; 5685eefee25Smacallan 5695eefee25Smacallan *) 5705eefee25Smacallan nonopt="$arg" 5715eefee25Smacallan break 5725eefee25Smacallan ;; 5735eefee25Smacallan esac 5745eefee25Smacallandone 5755eefee25Smacallan 5765eefee25Smacallanif test -n "$prevopt"; then 5775eefee25Smacallan $echo "$modename: option \`$prevopt' requires an argument" 1>&2 5785eefee25Smacallan $echo "$help" 1>&2 5795eefee25Smacallan exit $EXIT_FAILURE 5805eefee25Smacallanfi 5815eefee25Smacallan 5825eefee25Smacallancase $disable_libs in 5835eefee25Smacallanno) 5845eefee25Smacallan ;; 5855eefee25Smacallanshared) 5865eefee25Smacallan build_libtool_libs=no 5875eefee25Smacallan build_old_libs=yes 5885eefee25Smacallan ;; 5895eefee25Smacallanstatic) 5905eefee25Smacallan build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5915eefee25Smacallan ;; 5925eefee25Smacallanesac 5935eefee25Smacallan 5945eefee25Smacallan# If this variable is set in any of the actions, the command in it 5955eefee25Smacallan# will be execed at the end. This prevents here-documents from being 5965eefee25Smacallan# left over by shells. 5975eefee25Smacallanexec_cmd= 5985eefee25Smacallan 5995eefee25Smacallanif test -z "$show_help"; then 6005eefee25Smacallan 6015eefee25Smacallan # Infer the operation mode. 6025eefee25Smacallan if test -z "$mode"; then 6035eefee25Smacallan $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 6045eefee25Smacallan $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 6055eefee25Smacallan case $nonopt in 6065eefee25Smacallan *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 6075eefee25Smacallan mode=link 6085eefee25Smacallan for arg 6095eefee25Smacallan do 6105eefee25Smacallan case $arg in 6115eefee25Smacallan -c) 6125eefee25Smacallan mode=compile 6135eefee25Smacallan break 6145eefee25Smacallan ;; 6155eefee25Smacallan esac 6165eefee25Smacallan done 6175eefee25Smacallan ;; 6185eefee25Smacallan *db | *dbx | *strace | *truss) 6195eefee25Smacallan mode=execute 6205eefee25Smacallan ;; 6215eefee25Smacallan *install*|cp|mv) 6225eefee25Smacallan mode=install 6235eefee25Smacallan ;; 6245eefee25Smacallan *rm) 6255eefee25Smacallan mode=uninstall 6265eefee25Smacallan ;; 6275eefee25Smacallan *) 6285eefee25Smacallan # If we have no mode, but dlfiles were specified, then do execute mode. 6295eefee25Smacallan test -n "$execute_dlfiles" && mode=execute 6305eefee25Smacallan 6315eefee25Smacallan # Just use the default operation mode. 6325eefee25Smacallan if test -z "$mode"; then 6335eefee25Smacallan if test -n "$nonopt"; then 6345eefee25Smacallan $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6355eefee25Smacallan else 6365eefee25Smacallan $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6375eefee25Smacallan fi 6385eefee25Smacallan fi 6395eefee25Smacallan ;; 6405eefee25Smacallan esac 6415eefee25Smacallan fi 6425eefee25Smacallan 6435eefee25Smacallan # Only execute mode is allowed to have -dlopen flags. 6445eefee25Smacallan if test -n "$execute_dlfiles" && test "$mode" != execute; then 6455eefee25Smacallan $echo "$modename: unrecognized option \`-dlopen'" 1>&2 6465eefee25Smacallan $echo "$help" 1>&2 6475eefee25Smacallan exit $EXIT_FAILURE 6485eefee25Smacallan fi 6495eefee25Smacallan 6505eefee25Smacallan # Change the help message to a mode-specific one. 6515eefee25Smacallan generic_help="$help" 6525eefee25Smacallan help="Try \`$modename --help --mode=$mode' for more information." 6535eefee25Smacallan 6545eefee25Smacallan # These modes are in order of execution frequency so that they run quickly. 6555eefee25Smacallan case $mode in 6565eefee25Smacallan # libtool compile mode 6575eefee25Smacallan compile) 6585eefee25Smacallan modename="$modename: compile" 6595eefee25Smacallan # Get the compilation command and the source file. 6605eefee25Smacallan base_compile= 6615eefee25Smacallan srcfile="$nonopt" # always keep a non-empty value in "srcfile" 6625eefee25Smacallan suppress_opt=yes 6635eefee25Smacallan suppress_output= 6645eefee25Smacallan arg_mode=normal 6655eefee25Smacallan libobj= 6665eefee25Smacallan later= 6675eefee25Smacallan 6685eefee25Smacallan for arg 6695eefee25Smacallan do 6705eefee25Smacallan case $arg_mode in 6715eefee25Smacallan arg ) 6725eefee25Smacallan # do not "continue". Instead, add this to base_compile 6735eefee25Smacallan lastarg="$arg" 6745eefee25Smacallan arg_mode=normal 6755eefee25Smacallan ;; 6765eefee25Smacallan 6775eefee25Smacallan target ) 6785eefee25Smacallan libobj="$arg" 6795eefee25Smacallan arg_mode=normal 6805eefee25Smacallan continue 6815eefee25Smacallan ;; 6825eefee25Smacallan 6835eefee25Smacallan normal ) 6845eefee25Smacallan # Accept any command-line options. 6855eefee25Smacallan case $arg in 6865eefee25Smacallan -o) 6875eefee25Smacallan if test -n "$libobj" ; then 6885eefee25Smacallan $echo "$modename: you cannot specify \`-o' more than once" 1>&2 6895eefee25Smacallan exit $EXIT_FAILURE 6905eefee25Smacallan fi 6915eefee25Smacallan arg_mode=target 6925eefee25Smacallan continue 6935eefee25Smacallan ;; 6945eefee25Smacallan 6955eefee25Smacallan -static | -prefer-pic | -prefer-non-pic) 6965eefee25Smacallan later="$later $arg" 6975eefee25Smacallan continue 6985eefee25Smacallan ;; 6995eefee25Smacallan 7005eefee25Smacallan -no-suppress) 7015eefee25Smacallan suppress_opt=no 7025eefee25Smacallan continue 7035eefee25Smacallan ;; 7045eefee25Smacallan 7055eefee25Smacallan -Xcompiler) 7065eefee25Smacallan arg_mode=arg # the next one goes into the "base_compile" arg list 7075eefee25Smacallan continue # The current "srcfile" will either be retained or 7085eefee25Smacallan ;; # replaced later. I would guess that would be a bug. 7095eefee25Smacallan 7105eefee25Smacallan -Wc,*) 7115eefee25Smacallan args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 7125eefee25Smacallan lastarg= 7135eefee25Smacallan save_ifs="$IFS"; IFS=',' 7145eefee25Smacallan for arg in $args; do 7155eefee25Smacallan IFS="$save_ifs" 7165eefee25Smacallan 7175eefee25Smacallan # Double-quote args containing other shell metacharacters. 7185eefee25Smacallan # Many Bourne shells cannot handle close brackets correctly 7195eefee25Smacallan # in scan sets, so we specify it separately. 7205eefee25Smacallan case $arg in 7215eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7225eefee25Smacallan arg="\"$arg\"" 7235eefee25Smacallan ;; 7245eefee25Smacallan esac 7255eefee25Smacallan lastarg="$lastarg $arg" 7265eefee25Smacallan done 7275eefee25Smacallan IFS="$save_ifs" 7285eefee25Smacallan lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 7295eefee25Smacallan 7305eefee25Smacallan # Add the arguments to base_compile. 7315eefee25Smacallan base_compile="$base_compile $lastarg" 7325eefee25Smacallan continue 7335eefee25Smacallan ;; 7345eefee25Smacallan 7355eefee25Smacallan * ) 7365eefee25Smacallan # Accept the current argument as the source file. 7375eefee25Smacallan # The previous "srcfile" becomes the current argument. 7385eefee25Smacallan # 7395eefee25Smacallan lastarg="$srcfile" 7405eefee25Smacallan srcfile="$arg" 7415eefee25Smacallan ;; 7425eefee25Smacallan esac # case $arg 7435eefee25Smacallan ;; 7445eefee25Smacallan esac # case $arg_mode 7455eefee25Smacallan 7465eefee25Smacallan # Aesthetically quote the previous argument. 7475eefee25Smacallan lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7485eefee25Smacallan 7495eefee25Smacallan case $lastarg in 7505eefee25Smacallan # Double-quote args containing other shell metacharacters. 7515eefee25Smacallan # Many Bourne shells cannot handle close brackets correctly 7525eefee25Smacallan # in scan sets, and some SunOS ksh mistreat backslash-escaping 7535eefee25Smacallan # in scan sets (worked around with variable expansion), 7545eefee25Smacallan # and furthermore cannot handle '|' '&' '(' ')' in scan sets 7555eefee25Smacallan # at all, so we specify them separately. 7565eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7575eefee25Smacallan lastarg="\"$lastarg\"" 7585eefee25Smacallan ;; 7595eefee25Smacallan esac 7605eefee25Smacallan 7615eefee25Smacallan base_compile="$base_compile $lastarg" 7625eefee25Smacallan done # for arg 7635eefee25Smacallan 7645eefee25Smacallan case $arg_mode in 7655eefee25Smacallan arg) 7665eefee25Smacallan $echo "$modename: you must specify an argument for -Xcompile" 7675eefee25Smacallan exit $EXIT_FAILURE 7685eefee25Smacallan ;; 7695eefee25Smacallan target) 7705eefee25Smacallan $echo "$modename: you must specify a target with \`-o'" 1>&2 7715eefee25Smacallan exit $EXIT_FAILURE 7725eefee25Smacallan ;; 7735eefee25Smacallan *) 7745eefee25Smacallan # Get the name of the library object. 7755eefee25Smacallan [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 7765eefee25Smacallan ;; 7775eefee25Smacallan esac 7785eefee25Smacallan 7795eefee25Smacallan # Recognize several different file suffixes. 7805eefee25Smacallan # If the user specifies -o file.o, it is replaced with file.lo 7815eefee25Smacallan xform='[cCFSifmso]' 7825eefee25Smacallan case $libobj in 7835eefee25Smacallan *.ada) xform=ada ;; 7845eefee25Smacallan *.adb) xform=adb ;; 7855eefee25Smacallan *.ads) xform=ads ;; 7865eefee25Smacallan *.asm) xform=asm ;; 7875eefee25Smacallan *.c++) xform=c++ ;; 7885eefee25Smacallan *.cc) xform=cc ;; 7895eefee25Smacallan *.ii) xform=ii ;; 7905eefee25Smacallan *.class) xform=class ;; 7915eefee25Smacallan *.cpp) xform=cpp ;; 7925eefee25Smacallan *.cxx) xform=cxx ;; 79362ab96baSmrg *.[fF][09]?) xform=[fF][09]. ;; 7945eefee25Smacallan *.for) xform=for ;; 7955eefee25Smacallan *.java) xform=java ;; 79662ab96baSmrg *.obj) xform=obj ;; 79762ab96baSmrg *.sx) xform=sx ;; 7985eefee25Smacallan esac 7995eefee25Smacallan 8005eefee25Smacallan libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 8015eefee25Smacallan 8025eefee25Smacallan case $libobj in 8035eefee25Smacallan *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 8045eefee25Smacallan *) 8055eefee25Smacallan $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 8065eefee25Smacallan exit $EXIT_FAILURE 8075eefee25Smacallan ;; 8085eefee25Smacallan esac 8095eefee25Smacallan 8105eefee25Smacallan func_infer_tag $base_compile 8115eefee25Smacallan 8125eefee25Smacallan for arg in $later; do 8135eefee25Smacallan case $arg in 8145eefee25Smacallan -static) 8155eefee25Smacallan build_old_libs=yes 8165eefee25Smacallan continue 8175eefee25Smacallan ;; 8185eefee25Smacallan 8195eefee25Smacallan -prefer-pic) 8205eefee25Smacallan pic_mode=yes 8215eefee25Smacallan continue 8225eefee25Smacallan ;; 8235eefee25Smacallan 8245eefee25Smacallan -prefer-non-pic) 8255eefee25Smacallan pic_mode=no 8265eefee25Smacallan continue 8275eefee25Smacallan ;; 8285eefee25Smacallan esac 8295eefee25Smacallan done 8305eefee25Smacallan 8315eefee25Smacallan qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 8325eefee25Smacallan case $qlibobj in 8335eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8345eefee25Smacallan qlibobj="\"$qlibobj\"" ;; 8355eefee25Smacallan esac 8365eefee25Smacallan test "X$libobj" != "X$qlibobj" \ 8375eefee25Smacallan && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 8385eefee25Smacallan && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 8395eefee25Smacallan objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 8405eefee25Smacallan xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8415eefee25Smacallan if test "X$xdir" = "X$obj"; then 8425eefee25Smacallan xdir= 8435eefee25Smacallan else 8445eefee25Smacallan xdir=$xdir/ 8455eefee25Smacallan fi 8465eefee25Smacallan lobj=${xdir}$objdir/$objname 8475eefee25Smacallan 8485eefee25Smacallan if test -z "$base_compile"; then 8495eefee25Smacallan $echo "$modename: you must specify a compilation command" 1>&2 8505eefee25Smacallan $echo "$help" 1>&2 8515eefee25Smacallan exit $EXIT_FAILURE 8525eefee25Smacallan fi 8535eefee25Smacallan 8545eefee25Smacallan # Delete any leftover library objects. 8555eefee25Smacallan if test "$build_old_libs" = yes; then 8565eefee25Smacallan removelist="$obj $lobj $libobj ${libobj}T" 8575eefee25Smacallan else 8585eefee25Smacallan removelist="$lobj $libobj ${libobj}T" 8595eefee25Smacallan fi 8605eefee25Smacallan 8615eefee25Smacallan $run $rm $removelist 8625eefee25Smacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8635eefee25Smacallan 8645eefee25Smacallan # On Cygwin there's no "real" PIC flag so we must build both object types 8655eefee25Smacallan case $host_os in 8665eefee25Smacallan cygwin* | mingw* | pw32* | os2*) 8675eefee25Smacallan pic_mode=default 8685eefee25Smacallan ;; 8695eefee25Smacallan esac 8705eefee25Smacallan if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 8715eefee25Smacallan # non-PIC code in shared libraries is not supported 8725eefee25Smacallan pic_mode=default 8735eefee25Smacallan fi 8745eefee25Smacallan 8755eefee25Smacallan # Calculate the filename of the output object if compiler does 8765eefee25Smacallan # not support -o with -c 8775eefee25Smacallan if test "$compiler_c_o" = no; then 8785eefee25Smacallan output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 8795eefee25Smacallan lockfile="$output_obj.lock" 8805eefee25Smacallan removelist="$removelist $output_obj $lockfile" 8815eefee25Smacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8825eefee25Smacallan else 8835eefee25Smacallan output_obj= 8845eefee25Smacallan need_locks=no 8855eefee25Smacallan lockfile= 8865eefee25Smacallan fi 8875eefee25Smacallan 8885eefee25Smacallan # Lock this critical section if it is needed 8895eefee25Smacallan # We use this script file to make the link, it avoids creating a new file 8905eefee25Smacallan if test "$need_locks" = yes; then 8915eefee25Smacallan until $run ln "$progpath" "$lockfile" 2>/dev/null; do 8925eefee25Smacallan $show "Waiting for $lockfile to be removed" 8935eefee25Smacallan sleep 2 8945eefee25Smacallan done 8955eefee25Smacallan elif test "$need_locks" = warn; then 8965eefee25Smacallan if test -f "$lockfile"; then 8975eefee25Smacallan $echo "\ 8985eefee25Smacallan*** ERROR, $lockfile exists and contains: 8995eefee25Smacallan`cat $lockfile 2>/dev/null` 9005eefee25Smacallan 9015eefee25SmacallanThis indicates that another process is trying to use the same 9025eefee25Smacallantemporary object file, and libtool could not work around it because 9035eefee25Smacallanyour compiler does not support \`-c' and \`-o' together. If you 9045eefee25Smacallanrepeat this compilation, it may succeed, by chance, but you had better 9055eefee25Smacallanavoid parallel builds (make -j) in this platform, or get a better 9065eefee25Smacallancompiler." 9075eefee25Smacallan 9085eefee25Smacallan $run $rm $removelist 9095eefee25Smacallan exit $EXIT_FAILURE 9105eefee25Smacallan fi 9115eefee25Smacallan $echo "$srcfile" > "$lockfile" 9125eefee25Smacallan fi 9135eefee25Smacallan 9145eefee25Smacallan if test -n "$fix_srcfile_path"; then 9155eefee25Smacallan eval srcfile=\"$fix_srcfile_path\" 9165eefee25Smacallan fi 9175eefee25Smacallan qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 9185eefee25Smacallan case $qsrcfile in 9195eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 9205eefee25Smacallan qsrcfile="\"$qsrcfile\"" ;; 9215eefee25Smacallan esac 9225eefee25Smacallan 9235eefee25Smacallan $run $rm "$libobj" "${libobj}T" 9245eefee25Smacallan 9255eefee25Smacallan # Create a libtool object file (analogous to a ".la" file), 9265eefee25Smacallan # but don't create it if we're doing a dry run. 9275eefee25Smacallan test -z "$run" && cat > ${libobj}T <<EOF 9285eefee25Smacallan# $libobj - a libtool object file 9295eefee25Smacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 9305eefee25Smacallan# 9315eefee25Smacallan# Please DO NOT delete this file! 9325eefee25Smacallan# It is necessary for linking the library. 9335eefee25Smacallan 9345eefee25Smacallan# Name of the PIC object. 9355eefee25SmacallanEOF 9365eefee25Smacallan 9375eefee25Smacallan # Only build a PIC object if we are building libtool libraries. 9385eefee25Smacallan if test "$build_libtool_libs" = yes; then 9395eefee25Smacallan # Without this assignment, base_compile gets emptied. 9405eefee25Smacallan fbsd_hideous_sh_bug=$base_compile 9415eefee25Smacallan 9425eefee25Smacallan if test "$pic_mode" != no; then 9435eefee25Smacallan command="$base_compile $qsrcfile $pic_flag" 9445eefee25Smacallan else 9455eefee25Smacallan # Don't build PIC code 9465eefee25Smacallan command="$base_compile $qsrcfile" 9475eefee25Smacallan fi 9485eefee25Smacallan 9495eefee25Smacallan if test ! -d "${xdir}$objdir"; then 9505eefee25Smacallan $show "$mkdir ${xdir}$objdir" 9515eefee25Smacallan $run $mkdir ${xdir}$objdir 9525eefee25Smacallan exit_status=$? 9535eefee25Smacallan if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 9545eefee25Smacallan exit $exit_status 9555eefee25Smacallan fi 9565eefee25Smacallan fi 9575eefee25Smacallan 9585eefee25Smacallan if test -z "$output_obj"; then 9595eefee25Smacallan # Place PIC objects in $objdir 9605eefee25Smacallan command="$command -o $lobj" 9615eefee25Smacallan fi 9625eefee25Smacallan 9635eefee25Smacallan $run $rm "$lobj" "$output_obj" 9645eefee25Smacallan 9655eefee25Smacallan $show "$command" 96662ab96baSmrg if $run eval $lt_env "$command"; then : 9675eefee25Smacallan else 9685eefee25Smacallan test -n "$output_obj" && $run $rm $removelist 9695eefee25Smacallan exit $EXIT_FAILURE 9705eefee25Smacallan fi 9715eefee25Smacallan 9725eefee25Smacallan if test "$need_locks" = warn && 9735eefee25Smacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 9745eefee25Smacallan $echo "\ 9755eefee25Smacallan*** ERROR, $lockfile contains: 9765eefee25Smacallan`cat $lockfile 2>/dev/null` 9775eefee25Smacallan 9785eefee25Smacallanbut it should contain: 9795eefee25Smacallan$srcfile 9805eefee25Smacallan 9815eefee25SmacallanThis indicates that another process is trying to use the same 9825eefee25Smacallantemporary object file, and libtool could not work around it because 9835eefee25Smacallanyour compiler does not support \`-c' and \`-o' together. If you 9845eefee25Smacallanrepeat this compilation, it may succeed, by chance, but you had better 9855eefee25Smacallanavoid parallel builds (make -j) in this platform, or get a better 9865eefee25Smacallancompiler." 9875eefee25Smacallan 9885eefee25Smacallan $run $rm $removelist 9895eefee25Smacallan exit $EXIT_FAILURE 9905eefee25Smacallan fi 9915eefee25Smacallan 9925eefee25Smacallan # Just move the object if needed, then go on to compile the next one 9935eefee25Smacallan if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 9945eefee25Smacallan $show "$mv $output_obj $lobj" 9955eefee25Smacallan if $run $mv $output_obj $lobj; then : 9965eefee25Smacallan else 9975eefee25Smacallan error=$? 9985eefee25Smacallan $run $rm $removelist 9995eefee25Smacallan exit $error 10005eefee25Smacallan fi 10015eefee25Smacallan fi 10025eefee25Smacallan 10035eefee25Smacallan # Append the name of the PIC object to the libtool object file. 10045eefee25Smacallan test -z "$run" && cat >> ${libobj}T <<EOF 10055eefee25Smacallanpic_object='$objdir/$objname' 10065eefee25Smacallan 10075eefee25SmacallanEOF 10085eefee25Smacallan 10095eefee25Smacallan # Allow error messages only from the first compilation. 10105eefee25Smacallan if test "$suppress_opt" = yes; then 10115eefee25Smacallan suppress_output=' >/dev/null 2>&1' 10125eefee25Smacallan fi 10135eefee25Smacallan else 10145eefee25Smacallan # No PIC object so indicate it doesn't exist in the libtool 10155eefee25Smacallan # object file. 10165eefee25Smacallan test -z "$run" && cat >> ${libobj}T <<EOF 10175eefee25Smacallanpic_object=none 10185eefee25Smacallan 10195eefee25SmacallanEOF 10205eefee25Smacallan fi 10215eefee25Smacallan 10225eefee25Smacallan # Only build a position-dependent object if we build old libraries. 10235eefee25Smacallan if test "$build_old_libs" = yes; then 10245eefee25Smacallan if test "$pic_mode" != yes; then 10255eefee25Smacallan # Don't build PIC code 10265eefee25Smacallan command="$base_compile $qsrcfile" 10275eefee25Smacallan else 10285eefee25Smacallan command="$base_compile $qsrcfile $pic_flag" 10295eefee25Smacallan fi 10305eefee25Smacallan if test "$compiler_c_o" = yes; then 10315eefee25Smacallan command="$command -o $obj" 10325eefee25Smacallan fi 10335eefee25Smacallan 10345eefee25Smacallan # Suppress compiler output if we already did a PIC compilation. 10355eefee25Smacallan command="$command$suppress_output" 10365eefee25Smacallan $run $rm "$obj" "$output_obj" 10375eefee25Smacallan $show "$command" 103862ab96baSmrg if $run eval $lt_env "$command"; then : 10395eefee25Smacallan else 10405eefee25Smacallan $run $rm $removelist 10415eefee25Smacallan exit $EXIT_FAILURE 10425eefee25Smacallan fi 10435eefee25Smacallan 10445eefee25Smacallan if test "$need_locks" = warn && 10455eefee25Smacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 10465eefee25Smacallan $echo "\ 10475eefee25Smacallan*** ERROR, $lockfile contains: 10485eefee25Smacallan`cat $lockfile 2>/dev/null` 10495eefee25Smacallan 10505eefee25Smacallanbut it should contain: 10515eefee25Smacallan$srcfile 10525eefee25Smacallan 10535eefee25SmacallanThis indicates that another process is trying to use the same 10545eefee25Smacallantemporary object file, and libtool could not work around it because 10555eefee25Smacallanyour compiler does not support \`-c' and \`-o' together. If you 10565eefee25Smacallanrepeat this compilation, it may succeed, by chance, but you had better 10575eefee25Smacallanavoid parallel builds (make -j) in this platform, or get a better 10585eefee25Smacallancompiler." 10595eefee25Smacallan 10605eefee25Smacallan $run $rm $removelist 10615eefee25Smacallan exit $EXIT_FAILURE 10625eefee25Smacallan fi 10635eefee25Smacallan 10645eefee25Smacallan # Just move the object if needed 10655eefee25Smacallan if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 10665eefee25Smacallan $show "$mv $output_obj $obj" 10675eefee25Smacallan if $run $mv $output_obj $obj; then : 10685eefee25Smacallan else 10695eefee25Smacallan error=$? 10705eefee25Smacallan $run $rm $removelist 10715eefee25Smacallan exit $error 10725eefee25Smacallan fi 10735eefee25Smacallan fi 10745eefee25Smacallan 10755eefee25Smacallan # Append the name of the non-PIC object the libtool object file. 10765eefee25Smacallan # Only append if the libtool object file exists. 10775eefee25Smacallan test -z "$run" && cat >> ${libobj}T <<EOF 10785eefee25Smacallan# Name of the non-PIC object. 10795eefee25Smacallannon_pic_object='$objname' 10805eefee25Smacallan 10815eefee25SmacallanEOF 10825eefee25Smacallan else 10835eefee25Smacallan # Append the name of the non-PIC object the libtool object file. 10845eefee25Smacallan # Only append if the libtool object file exists. 10855eefee25Smacallan test -z "$run" && cat >> ${libobj}T <<EOF 10865eefee25Smacallan# Name of the non-PIC object. 10875eefee25Smacallannon_pic_object=none 10885eefee25Smacallan 10895eefee25SmacallanEOF 10905eefee25Smacallan fi 10915eefee25Smacallan 10925eefee25Smacallan $run $mv "${libobj}T" "${libobj}" 10935eefee25Smacallan 10945eefee25Smacallan # Unlock the critical section if it was locked 10955eefee25Smacallan if test "$need_locks" != no; then 10965eefee25Smacallan $run $rm "$lockfile" 10975eefee25Smacallan fi 10985eefee25Smacallan 10995eefee25Smacallan exit $EXIT_SUCCESS 11005eefee25Smacallan ;; 11015eefee25Smacallan 11025eefee25Smacallan # libtool link mode 11035eefee25Smacallan link | relink) 11045eefee25Smacallan modename="$modename: link" 11055eefee25Smacallan case $host in 11065eefee25Smacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 11075eefee25Smacallan # It is impossible to link a dll without this setting, and 11085eefee25Smacallan # we shouldn't force the makefile maintainer to figure out 11095eefee25Smacallan # which system we are compiling for in order to pass an extra 11105eefee25Smacallan # flag for every libtool invocation. 11115eefee25Smacallan # allow_undefined=no 11125eefee25Smacallan 11135eefee25Smacallan # FIXME: Unfortunately, there are problems with the above when trying 11145eefee25Smacallan # to make a dll which has undefined symbols, in which case not 11155eefee25Smacallan # even a static library is built. For now, we need to specify 11165eefee25Smacallan # -no-undefined on the libtool link line when we can be certain 11175eefee25Smacallan # that all symbols are satisfied, otherwise we get a static library. 11185eefee25Smacallan allow_undefined=yes 11195eefee25Smacallan ;; 11205eefee25Smacallan *) 11215eefee25Smacallan allow_undefined=yes 11225eefee25Smacallan ;; 11235eefee25Smacallan esac 11245eefee25Smacallan libtool_args="$nonopt" 11255eefee25Smacallan base_compile="$nonopt $@" 11265eefee25Smacallan compile_command="$nonopt" 11275eefee25Smacallan finalize_command="$nonopt" 11285eefee25Smacallan 11295eefee25Smacallan compile_rpath= 11305eefee25Smacallan finalize_rpath= 11315eefee25Smacallan compile_shlibpath= 11325eefee25Smacallan finalize_shlibpath= 11335eefee25Smacallan convenience= 11345eefee25Smacallan old_convenience= 11355eefee25Smacallan deplibs= 11365eefee25Smacallan old_deplibs= 11375eefee25Smacallan compiler_flags= 11385eefee25Smacallan linker_flags= 11395eefee25Smacallan dllsearchpath= 11405eefee25Smacallan lib_search_path=`pwd` 11415eefee25Smacallan inst_prefix_dir= 11425eefee25Smacallan 11435eefee25Smacallan avoid_version=no 11445eefee25Smacallan dlfiles= 11455eefee25Smacallan dlprefiles= 11465eefee25Smacallan dlself=no 11475eefee25Smacallan export_dynamic=no 11485eefee25Smacallan export_symbols= 11495eefee25Smacallan export_symbols_regex= 11505eefee25Smacallan generated= 11515eefee25Smacallan libobjs= 11525eefee25Smacallan ltlibs= 11535eefee25Smacallan module=no 11545eefee25Smacallan no_install=no 11555eefee25Smacallan objs= 11565eefee25Smacallan non_pic_objects= 11575eefee25Smacallan notinst_path= # paths that contain not-installed libtool libraries 11585eefee25Smacallan precious_files_regex= 11595eefee25Smacallan prefer_static_libs=no 11605eefee25Smacallan preload=no 11615eefee25Smacallan prev= 11625eefee25Smacallan prevarg= 11635eefee25Smacallan release= 11645eefee25Smacallan rpath= 11655eefee25Smacallan xrpath= 11665eefee25Smacallan perm_rpath= 11675eefee25Smacallan temp_rpath= 11685eefee25Smacallan thread_safe=no 11695eefee25Smacallan vinfo= 11705eefee25Smacallan vinfo_number=no 117162ab96baSmrg single_module="${wl}-single_module" 11725eefee25Smacallan 11735eefee25Smacallan func_infer_tag $base_compile 11745eefee25Smacallan 11755eefee25Smacallan # We need to know -static, to get the right output filenames. 11765eefee25Smacallan for arg 11775eefee25Smacallan do 11785eefee25Smacallan case $arg in 117962ab96baSmrg -all-static | -static | -static-libtool-libs) 118062ab96baSmrg case $arg in 118162ab96baSmrg -all-static) 11825eefee25Smacallan if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 11835eefee25Smacallan $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 11845eefee25Smacallan fi 11855eefee25Smacallan if test -n "$link_static_flag"; then 11865eefee25Smacallan dlopen_self=$dlopen_self_static 11875eefee25Smacallan fi 11885eefee25Smacallan prefer_static_libs=yes 118962ab96baSmrg ;; 119062ab96baSmrg -static) 11915eefee25Smacallan if test -z "$pic_flag" && test -n "$link_static_flag"; then 11925eefee25Smacallan dlopen_self=$dlopen_self_static 11935eefee25Smacallan fi 11945eefee25Smacallan prefer_static_libs=built 119562ab96baSmrg ;; 119662ab96baSmrg -static-libtool-libs) 119762ab96baSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 119862ab96baSmrg dlopen_self=$dlopen_self_static 119962ab96baSmrg fi 120062ab96baSmrg prefer_static_libs=yes 120162ab96baSmrg ;; 120262ab96baSmrg esac 12035eefee25Smacallan build_libtool_libs=no 12045eefee25Smacallan build_old_libs=yes 12055eefee25Smacallan break 12065eefee25Smacallan ;; 12075eefee25Smacallan esac 12085eefee25Smacallan done 12095eefee25Smacallan 12105eefee25Smacallan # See if our shared archives depend on static archives. 12115eefee25Smacallan test -n "$old_archive_from_new_cmds" && build_old_libs=yes 12125eefee25Smacallan 12135eefee25Smacallan # Go through the arguments, transforming them on the way. 12145eefee25Smacallan while test "$#" -gt 0; do 12155eefee25Smacallan arg="$1" 12165eefee25Smacallan shift 12175eefee25Smacallan case $arg in 12185eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 12195eefee25Smacallan qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 12205eefee25Smacallan ;; 12215eefee25Smacallan *) qarg=$arg ;; 12225eefee25Smacallan esac 12235eefee25Smacallan libtool_args="$libtool_args $qarg" 12245eefee25Smacallan 12255eefee25Smacallan # If the previous option needs an argument, assign it. 12265eefee25Smacallan if test -n "$prev"; then 12275eefee25Smacallan case $prev in 12285eefee25Smacallan output) 12295eefee25Smacallan compile_command="$compile_command @OUTPUT@" 12305eefee25Smacallan finalize_command="$finalize_command @OUTPUT@" 12315eefee25Smacallan ;; 12325eefee25Smacallan esac 12335eefee25Smacallan 12345eefee25Smacallan case $prev in 12355eefee25Smacallan dlfiles|dlprefiles) 12365eefee25Smacallan if test "$preload" = no; then 12375eefee25Smacallan # Add the symbol object into the linking commands. 12385eefee25Smacallan compile_command="$compile_command @SYMFILE@" 12395eefee25Smacallan finalize_command="$finalize_command @SYMFILE@" 12405eefee25Smacallan preload=yes 12415eefee25Smacallan fi 12425eefee25Smacallan case $arg in 12435eefee25Smacallan *.la | *.lo) ;; # We handle these cases below. 12445eefee25Smacallan force) 12455eefee25Smacallan if test "$dlself" = no; then 12465eefee25Smacallan dlself=needless 12475eefee25Smacallan export_dynamic=yes 12485eefee25Smacallan fi 12495eefee25Smacallan prev= 12505eefee25Smacallan continue 12515eefee25Smacallan ;; 12525eefee25Smacallan self) 12535eefee25Smacallan if test "$prev" = dlprefiles; then 12545eefee25Smacallan dlself=yes 12555eefee25Smacallan elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 12565eefee25Smacallan dlself=yes 12575eefee25Smacallan else 12585eefee25Smacallan dlself=needless 12595eefee25Smacallan export_dynamic=yes 12605eefee25Smacallan fi 12615eefee25Smacallan prev= 12625eefee25Smacallan continue 12635eefee25Smacallan ;; 12645eefee25Smacallan *) 12655eefee25Smacallan if test "$prev" = dlfiles; then 12665eefee25Smacallan dlfiles="$dlfiles $arg" 12675eefee25Smacallan else 12685eefee25Smacallan dlprefiles="$dlprefiles $arg" 12695eefee25Smacallan fi 12705eefee25Smacallan prev= 12715eefee25Smacallan continue 12725eefee25Smacallan ;; 12735eefee25Smacallan esac 12745eefee25Smacallan ;; 12755eefee25Smacallan expsyms) 12765eefee25Smacallan export_symbols="$arg" 12775eefee25Smacallan if test ! -f "$arg"; then 12785eefee25Smacallan $echo "$modename: symbol file \`$arg' does not exist" 12795eefee25Smacallan exit $EXIT_FAILURE 12805eefee25Smacallan fi 12815eefee25Smacallan prev= 12825eefee25Smacallan continue 12835eefee25Smacallan ;; 12845eefee25Smacallan expsyms_regex) 12855eefee25Smacallan export_symbols_regex="$arg" 12865eefee25Smacallan prev= 12875eefee25Smacallan continue 12885eefee25Smacallan ;; 12895eefee25Smacallan inst_prefix) 12905eefee25Smacallan inst_prefix_dir="$arg" 12915eefee25Smacallan prev= 12925eefee25Smacallan continue 12935eefee25Smacallan ;; 12945eefee25Smacallan precious_regex) 12955eefee25Smacallan precious_files_regex="$arg" 12965eefee25Smacallan prev= 12975eefee25Smacallan continue 12985eefee25Smacallan ;; 12995eefee25Smacallan release) 13005eefee25Smacallan release="-$arg" 13015eefee25Smacallan prev= 13025eefee25Smacallan continue 13035eefee25Smacallan ;; 13045eefee25Smacallan objectlist) 13055eefee25Smacallan if test -f "$arg"; then 13065eefee25Smacallan save_arg=$arg 13075eefee25Smacallan moreargs= 13085eefee25Smacallan for fil in `cat $save_arg` 13095eefee25Smacallan do 13105eefee25Smacallan# moreargs="$moreargs $fil" 13115eefee25Smacallan arg=$fil 13125eefee25Smacallan # A libtool-controlled object. 13135eefee25Smacallan 13145eefee25Smacallan # Check to see that this really is a libtool object. 13155eefee25Smacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 13165eefee25Smacallan pic_object= 13175eefee25Smacallan non_pic_object= 13185eefee25Smacallan 13195eefee25Smacallan # Read the .lo file 13205eefee25Smacallan # If there is no directory component, then add one. 13215eefee25Smacallan case $arg in 13225eefee25Smacallan */* | *\\*) . $arg ;; 13235eefee25Smacallan *) . ./$arg ;; 13245eefee25Smacallan esac 13255eefee25Smacallan 13265eefee25Smacallan if test -z "$pic_object" || \ 13275eefee25Smacallan test -z "$non_pic_object" || 13285eefee25Smacallan test "$pic_object" = none && \ 13295eefee25Smacallan test "$non_pic_object" = none; then 13305eefee25Smacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 13315eefee25Smacallan exit $EXIT_FAILURE 13325eefee25Smacallan fi 13335eefee25Smacallan 13345eefee25Smacallan # Extract subdirectory from the argument. 13355eefee25Smacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13365eefee25Smacallan if test "X$xdir" = "X$arg"; then 13375eefee25Smacallan xdir= 13385eefee25Smacallan else 13395eefee25Smacallan xdir="$xdir/" 13405eefee25Smacallan fi 13415eefee25Smacallan 13425eefee25Smacallan if test "$pic_object" != none; then 13435eefee25Smacallan # Prepend the subdirectory the object is found in. 13445eefee25Smacallan pic_object="$xdir$pic_object" 13455eefee25Smacallan 13465eefee25Smacallan if test "$prev" = dlfiles; then 13475eefee25Smacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13485eefee25Smacallan dlfiles="$dlfiles $pic_object" 13495eefee25Smacallan prev= 13505eefee25Smacallan continue 13515eefee25Smacallan else 13525eefee25Smacallan # If libtool objects are unsupported, then we need to preload. 13535eefee25Smacallan prev=dlprefiles 13545eefee25Smacallan fi 13555eefee25Smacallan fi 13565eefee25Smacallan 13575eefee25Smacallan # CHECK ME: I think I busted this. -Ossama 13585eefee25Smacallan if test "$prev" = dlprefiles; then 13595eefee25Smacallan # Preload the old-style object. 13605eefee25Smacallan dlprefiles="$dlprefiles $pic_object" 13615eefee25Smacallan prev= 13625eefee25Smacallan fi 13635eefee25Smacallan 13645eefee25Smacallan # A PIC object. 13655eefee25Smacallan libobjs="$libobjs $pic_object" 13665eefee25Smacallan arg="$pic_object" 13675eefee25Smacallan fi 13685eefee25Smacallan 13695eefee25Smacallan # Non-PIC object. 13705eefee25Smacallan if test "$non_pic_object" != none; then 13715eefee25Smacallan # Prepend the subdirectory the object is found in. 13725eefee25Smacallan non_pic_object="$xdir$non_pic_object" 13735eefee25Smacallan 13745eefee25Smacallan # A standard non-PIC object 13755eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 13765eefee25Smacallan if test -z "$pic_object" || test "$pic_object" = none ; then 13775eefee25Smacallan arg="$non_pic_object" 13785eefee25Smacallan fi 13795eefee25Smacallan else 13805eefee25Smacallan # If the PIC object exists, use it instead. 13815eefee25Smacallan # $xdir was prepended to $pic_object above. 13825eefee25Smacallan non_pic_object="$pic_object" 13835eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 13845eefee25Smacallan fi 13855eefee25Smacallan else 13865eefee25Smacallan # Only an error if not doing a dry-run. 13875eefee25Smacallan if test -z "$run"; then 13885eefee25Smacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 13895eefee25Smacallan exit $EXIT_FAILURE 13905eefee25Smacallan else 13915eefee25Smacallan # Dry-run case. 13925eefee25Smacallan 13935eefee25Smacallan # Extract subdirectory from the argument. 13945eefee25Smacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13955eefee25Smacallan if test "X$xdir" = "X$arg"; then 13965eefee25Smacallan xdir= 13975eefee25Smacallan else 13985eefee25Smacallan xdir="$xdir/" 13995eefee25Smacallan fi 14005eefee25Smacallan 14015eefee25Smacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 14025eefee25Smacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 14035eefee25Smacallan libobjs="$libobjs $pic_object" 14045eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 14055eefee25Smacallan fi 14065eefee25Smacallan fi 14075eefee25Smacallan done 14085eefee25Smacallan else 14095eefee25Smacallan $echo "$modename: link input file \`$save_arg' does not exist" 14105eefee25Smacallan exit $EXIT_FAILURE 14115eefee25Smacallan fi 14125eefee25Smacallan arg=$save_arg 14135eefee25Smacallan prev= 14145eefee25Smacallan continue 14155eefee25Smacallan ;; 14165eefee25Smacallan rpath | xrpath) 14175eefee25Smacallan # We need an absolute path. 14185eefee25Smacallan case $arg in 14195eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 14205eefee25Smacallan *) 14215eefee25Smacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 14225eefee25Smacallan exit $EXIT_FAILURE 14235eefee25Smacallan ;; 14245eefee25Smacallan esac 14255eefee25Smacallan if test "$prev" = rpath; then 14265eefee25Smacallan case "$rpath " in 14275eefee25Smacallan *" $arg "*) ;; 14285eefee25Smacallan *) rpath="$rpath $arg" ;; 14295eefee25Smacallan esac 14305eefee25Smacallan else 14315eefee25Smacallan case "$xrpath " in 14325eefee25Smacallan *" $arg "*) ;; 14335eefee25Smacallan *) xrpath="$xrpath $arg" ;; 14345eefee25Smacallan esac 14355eefee25Smacallan fi 14365eefee25Smacallan prev= 14375eefee25Smacallan continue 14385eefee25Smacallan ;; 14395eefee25Smacallan xcompiler) 14405eefee25Smacallan compiler_flags="$compiler_flags $qarg" 14415eefee25Smacallan prev= 14425eefee25Smacallan compile_command="$compile_command $qarg" 14435eefee25Smacallan finalize_command="$finalize_command $qarg" 14445eefee25Smacallan continue 14455eefee25Smacallan ;; 14465eefee25Smacallan xlinker) 14475eefee25Smacallan linker_flags="$linker_flags $qarg" 14485eefee25Smacallan compiler_flags="$compiler_flags $wl$qarg" 14495eefee25Smacallan prev= 14505eefee25Smacallan compile_command="$compile_command $wl$qarg" 14515eefee25Smacallan finalize_command="$finalize_command $wl$qarg" 14525eefee25Smacallan continue 14535eefee25Smacallan ;; 14545eefee25Smacallan xcclinker) 14555eefee25Smacallan linker_flags="$linker_flags $qarg" 14565eefee25Smacallan compiler_flags="$compiler_flags $qarg" 14575eefee25Smacallan prev= 14585eefee25Smacallan compile_command="$compile_command $qarg" 14595eefee25Smacallan finalize_command="$finalize_command $qarg" 14605eefee25Smacallan continue 14615eefee25Smacallan ;; 14625eefee25Smacallan shrext) 14635eefee25Smacallan shrext_cmds="$arg" 14645eefee25Smacallan prev= 14655eefee25Smacallan continue 14665eefee25Smacallan ;; 14675eefee25Smacallan darwin_framework|darwin_framework_skip) 14685eefee25Smacallan test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 14695eefee25Smacallan compile_command="$compile_command $arg" 14705eefee25Smacallan finalize_command="$finalize_command $arg" 14715eefee25Smacallan prev= 14725eefee25Smacallan continue 14735eefee25Smacallan ;; 14745eefee25Smacallan *) 14755eefee25Smacallan eval "$prev=\"\$arg\"" 14765eefee25Smacallan prev= 14775eefee25Smacallan continue 14785eefee25Smacallan ;; 14795eefee25Smacallan esac 14805eefee25Smacallan fi # test -n "$prev" 14815eefee25Smacallan 14825eefee25Smacallan prevarg="$arg" 14835eefee25Smacallan 14845eefee25Smacallan case $arg in 14855eefee25Smacallan -all-static) 14865eefee25Smacallan if test -n "$link_static_flag"; then 14875eefee25Smacallan compile_command="$compile_command $link_static_flag" 14885eefee25Smacallan finalize_command="$finalize_command $link_static_flag" 14895eefee25Smacallan fi 14905eefee25Smacallan continue 14915eefee25Smacallan ;; 14925eefee25Smacallan 14935eefee25Smacallan -allow-undefined) 14945eefee25Smacallan # FIXME: remove this flag sometime in the future. 14955eefee25Smacallan $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 14965eefee25Smacallan continue 14975eefee25Smacallan ;; 14985eefee25Smacallan 14995eefee25Smacallan -avoid-version) 15005eefee25Smacallan avoid_version=yes 15015eefee25Smacallan continue 15025eefee25Smacallan ;; 15035eefee25Smacallan 15045eefee25Smacallan -dlopen) 15055eefee25Smacallan prev=dlfiles 15065eefee25Smacallan continue 15075eefee25Smacallan ;; 15085eefee25Smacallan 15095eefee25Smacallan -dlpreopen) 15105eefee25Smacallan prev=dlprefiles 15115eefee25Smacallan continue 15125eefee25Smacallan ;; 15135eefee25Smacallan 15145eefee25Smacallan -export-dynamic) 15155eefee25Smacallan export_dynamic=yes 15165eefee25Smacallan continue 15175eefee25Smacallan ;; 15185eefee25Smacallan 15195eefee25Smacallan -export-symbols | -export-symbols-regex) 15205eefee25Smacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 15215eefee25Smacallan $echo "$modename: more than one -exported-symbols argument is not allowed" 15225eefee25Smacallan exit $EXIT_FAILURE 15235eefee25Smacallan fi 15245eefee25Smacallan if test "X$arg" = "X-export-symbols"; then 15255eefee25Smacallan prev=expsyms 15265eefee25Smacallan else 15275eefee25Smacallan prev=expsyms_regex 15285eefee25Smacallan fi 15295eefee25Smacallan continue 15305eefee25Smacallan ;; 15315eefee25Smacallan 15325eefee25Smacallan -framework|-arch|-isysroot) 15335eefee25Smacallan case " $CC " in 15345eefee25Smacallan *" ${arg} ${1} "* | *" ${arg} ${1} "*) 15355eefee25Smacallan prev=darwin_framework_skip ;; 15365eefee25Smacallan *) compiler_flags="$compiler_flags $arg" 15375eefee25Smacallan prev=darwin_framework ;; 15385eefee25Smacallan esac 15395eefee25Smacallan compile_command="$compile_command $arg" 15405eefee25Smacallan finalize_command="$finalize_command $arg" 15415eefee25Smacallan continue 15425eefee25Smacallan ;; 15435eefee25Smacallan 15445eefee25Smacallan -inst-prefix-dir) 15455eefee25Smacallan prev=inst_prefix 15465eefee25Smacallan continue 15475eefee25Smacallan ;; 15485eefee25Smacallan 15495eefee25Smacallan # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 15505eefee25Smacallan # so, if we see these flags be careful not to treat them like -L 15515eefee25Smacallan -L[A-Z][A-Z]*:*) 15525eefee25Smacallan case $with_gcc/$host in 15535eefee25Smacallan no/*-*-irix* | /*-*-irix*) 15545eefee25Smacallan compile_command="$compile_command $arg" 15555eefee25Smacallan finalize_command="$finalize_command $arg" 15565eefee25Smacallan ;; 15575eefee25Smacallan esac 15585eefee25Smacallan continue 15595eefee25Smacallan ;; 15605eefee25Smacallan 15615eefee25Smacallan -L*) 15625eefee25Smacallan dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 15635eefee25Smacallan # We need an absolute path. 15645eefee25Smacallan case $dir in 15655eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 15665eefee25Smacallan *) 15675eefee25Smacallan absdir=`cd "$dir" && pwd` 15685eefee25Smacallan if test -z "$absdir"; then 15695eefee25Smacallan $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 15705eefee25Smacallan absdir="$dir" 15715eefee25Smacallan notinst_path="$notinst_path $dir" 15725eefee25Smacallan fi 15735eefee25Smacallan dir="$absdir" 15745eefee25Smacallan ;; 15755eefee25Smacallan esac 15765eefee25Smacallan case "$deplibs " in 15775eefee25Smacallan *" -L$dir "*) ;; 15785eefee25Smacallan *) 15795eefee25Smacallan deplibs="$deplibs -L$dir" 15805eefee25Smacallan lib_search_path="$lib_search_path $dir" 15815eefee25Smacallan ;; 15825eefee25Smacallan esac 15835eefee25Smacallan case $host in 15845eefee25Smacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 15855eefee25Smacallan testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 15865eefee25Smacallan case :$dllsearchpath: in 15875eefee25Smacallan *":$dir:"*) ;; 15885eefee25Smacallan *) dllsearchpath="$dllsearchpath:$dir";; 15895eefee25Smacallan esac 15905eefee25Smacallan case :$dllsearchpath: in 15915eefee25Smacallan *":$testbindir:"*) ;; 15925eefee25Smacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 15935eefee25Smacallan esac 15945eefee25Smacallan ;; 15955eefee25Smacallan esac 15965eefee25Smacallan continue 15975eefee25Smacallan ;; 15985eefee25Smacallan 15995eefee25Smacallan -l*) 16005eefee25Smacallan if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 16015eefee25Smacallan case $host in 16025eefee25Smacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 16035eefee25Smacallan # These systems don't actually have a C or math library (as such) 16045eefee25Smacallan continue 16055eefee25Smacallan ;; 16065eefee25Smacallan *-*-os2*) 16075eefee25Smacallan # These systems don't actually have a C library (as such) 16085eefee25Smacallan test "X$arg" = "X-lc" && continue 16095eefee25Smacallan ;; 16105eefee25Smacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16115eefee25Smacallan # Do not include libc due to us having libc/libc_r. 16125eefee25Smacallan test "X$arg" = "X-lc" && continue 16135eefee25Smacallan ;; 16145eefee25Smacallan *-*-rhapsody* | *-*-darwin1.[012]) 16155eefee25Smacallan # Rhapsody C and math libraries are in the System framework 16165eefee25Smacallan deplibs="$deplibs -framework System" 16175eefee25Smacallan continue 16185eefee25Smacallan ;; 16195eefee25Smacallan *-*-sco3.2v5* | *-*-sco5v6*) 16205eefee25Smacallan # Causes problems with __ctype 16215eefee25Smacallan test "X$arg" = "X-lc" && continue 16225eefee25Smacallan ;; 16235eefee25Smacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 16245eefee25Smacallan # Compiler inserts libc in the correct place for threads to work 16255eefee25Smacallan test "X$arg" = "X-lc" && continue 16265eefee25Smacallan ;; 16275eefee25Smacallan esac 16285eefee25Smacallan elif test "X$arg" = "X-lc_r"; then 16295eefee25Smacallan case $host in 16305eefee25Smacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16315eefee25Smacallan # Do not include libc_r directly, use -pthread flag. 16325eefee25Smacallan continue 16335eefee25Smacallan ;; 16345eefee25Smacallan esac 16355eefee25Smacallan fi 16365eefee25Smacallan deplibs="$deplibs $arg" 16375eefee25Smacallan continue 16385eefee25Smacallan ;; 16395eefee25Smacallan 16405eefee25Smacallan # Tru64 UNIX uses -model [arg] to determine the layout of C++ 16415eefee25Smacallan # classes, name mangling, and exception handling. 16425eefee25Smacallan -model) 16435eefee25Smacallan compile_command="$compile_command $arg" 16445eefee25Smacallan compiler_flags="$compiler_flags $arg" 16455eefee25Smacallan finalize_command="$finalize_command $arg" 16465eefee25Smacallan prev=xcompiler 16475eefee25Smacallan continue 16485eefee25Smacallan ;; 16495eefee25Smacallan 165062ab96baSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 16515eefee25Smacallan compiler_flags="$compiler_flags $arg" 16525eefee25Smacallan compile_command="$compile_command $arg" 16535eefee25Smacallan finalize_command="$finalize_command $arg" 16545eefee25Smacallan continue 16555eefee25Smacallan ;; 16565eefee25Smacallan 165762ab96baSmrg -multi_module) 165862ab96baSmrg single_module="${wl}-multi_module" 165962ab96baSmrg continue 166062ab96baSmrg ;; 166162ab96baSmrg 16625eefee25Smacallan -module) 16635eefee25Smacallan module=yes 16645eefee25Smacallan continue 16655eefee25Smacallan ;; 16665eefee25Smacallan 16675eefee25Smacallan # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 16685eefee25Smacallan # -r[0-9][0-9]* specifies the processor on the SGI compiler 16695eefee25Smacallan # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 16705eefee25Smacallan # +DA*, +DD* enable 64-bit mode on the HP compiler 16715eefee25Smacallan # -q* pass through compiler args for the IBM compiler 16725eefee25Smacallan # -m* pass through architecture-specific compiler args for GCC 16735eefee25Smacallan # -m*, -t[45]*, -txscale* pass through architecture-specific 16745eefee25Smacallan # compiler args for GCC 167562ab96baSmrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 167662ab96baSmrg # -F/path gives path to uninstalled frameworks, gcc on darwin 16775eefee25Smacallan # @file GCC response files 167862ab96baSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 167962ab96baSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 16805eefee25Smacallan 16815eefee25Smacallan # Unknown arguments in both finalize_command and compile_command need 16825eefee25Smacallan # to be aesthetically quoted because they are evaled later. 16835eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 16845eefee25Smacallan case $arg in 16855eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 16865eefee25Smacallan arg="\"$arg\"" 16875eefee25Smacallan ;; 16885eefee25Smacallan esac 16895eefee25Smacallan compile_command="$compile_command $arg" 16905eefee25Smacallan finalize_command="$finalize_command $arg" 16915eefee25Smacallan compiler_flags="$compiler_flags $arg" 16925eefee25Smacallan continue 16935eefee25Smacallan ;; 16945eefee25Smacallan 16955eefee25Smacallan -shrext) 16965eefee25Smacallan prev=shrext 16975eefee25Smacallan continue 16985eefee25Smacallan ;; 16995eefee25Smacallan 17005eefee25Smacallan -no-fast-install) 17015eefee25Smacallan fast_install=no 17025eefee25Smacallan continue 17035eefee25Smacallan ;; 17045eefee25Smacallan 17055eefee25Smacallan -no-install) 17065eefee25Smacallan case $host in 170762ab96baSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 17085eefee25Smacallan # The PATH hackery in wrapper scripts is required on Windows 170962ab96baSmrg # and Darwin in order for the loader to find any dlls it needs. 17105eefee25Smacallan $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 17115eefee25Smacallan $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 17125eefee25Smacallan fast_install=no 17135eefee25Smacallan ;; 17145eefee25Smacallan *) no_install=yes ;; 17155eefee25Smacallan esac 17165eefee25Smacallan continue 17175eefee25Smacallan ;; 17185eefee25Smacallan 17195eefee25Smacallan -no-undefined) 17205eefee25Smacallan allow_undefined=no 17215eefee25Smacallan continue 17225eefee25Smacallan ;; 17235eefee25Smacallan 17245eefee25Smacallan -objectlist) 17255eefee25Smacallan prev=objectlist 17265eefee25Smacallan continue 17275eefee25Smacallan ;; 17285eefee25Smacallan 17295eefee25Smacallan -o) prev=output ;; 17305eefee25Smacallan 17315eefee25Smacallan -precious-files-regex) 17325eefee25Smacallan prev=precious_regex 17335eefee25Smacallan continue 17345eefee25Smacallan ;; 17355eefee25Smacallan 17365eefee25Smacallan -release) 17375eefee25Smacallan prev=release 17385eefee25Smacallan continue 17395eefee25Smacallan ;; 17405eefee25Smacallan 17415eefee25Smacallan -rpath) 17425eefee25Smacallan prev=rpath 17435eefee25Smacallan continue 17445eefee25Smacallan ;; 17455eefee25Smacallan 17465eefee25Smacallan -R) 17475eefee25Smacallan prev=xrpath 17485eefee25Smacallan continue 17495eefee25Smacallan ;; 17505eefee25Smacallan 17515eefee25Smacallan -R*) 17525eefee25Smacallan dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 17535eefee25Smacallan # We need an absolute path. 17545eefee25Smacallan case $dir in 17555eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 17565eefee25Smacallan *) 17575eefee25Smacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 17585eefee25Smacallan exit $EXIT_FAILURE 17595eefee25Smacallan ;; 17605eefee25Smacallan esac 17615eefee25Smacallan case "$xrpath " in 17625eefee25Smacallan *" $dir "*) ;; 17635eefee25Smacallan *) xrpath="$xrpath $dir" ;; 17645eefee25Smacallan esac 17655eefee25Smacallan continue 17665eefee25Smacallan ;; 17675eefee25Smacallan 176862ab96baSmrg -static | -static-libtool-libs) 17695eefee25Smacallan # The effects of -static are defined in a previous loop. 17705eefee25Smacallan # We used to do the same as -all-static on platforms that 17715eefee25Smacallan # didn't have a PIC flag, but the assumption that the effects 17725eefee25Smacallan # would be equivalent was wrong. It would break on at least 17735eefee25Smacallan # Digital Unix and AIX. 17745eefee25Smacallan continue 17755eefee25Smacallan ;; 17765eefee25Smacallan 17775eefee25Smacallan -thread-safe) 17785eefee25Smacallan thread_safe=yes 17795eefee25Smacallan continue 17805eefee25Smacallan ;; 17815eefee25Smacallan 17825eefee25Smacallan -version-info) 17835eefee25Smacallan prev=vinfo 17845eefee25Smacallan continue 17855eefee25Smacallan ;; 17865eefee25Smacallan -version-number) 17875eefee25Smacallan prev=vinfo 17885eefee25Smacallan vinfo_number=yes 17895eefee25Smacallan continue 17905eefee25Smacallan ;; 17915eefee25Smacallan 17925eefee25Smacallan -Wc,*) 17935eefee25Smacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 17945eefee25Smacallan arg= 17955eefee25Smacallan save_ifs="$IFS"; IFS=',' 17965eefee25Smacallan for flag in $args; do 17975eefee25Smacallan IFS="$save_ifs" 17985eefee25Smacallan case $flag in 17995eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18005eefee25Smacallan flag="\"$flag\"" 18015eefee25Smacallan ;; 18025eefee25Smacallan esac 18035eefee25Smacallan arg="$arg $wl$flag" 18045eefee25Smacallan compiler_flags="$compiler_flags $flag" 18055eefee25Smacallan done 18065eefee25Smacallan IFS="$save_ifs" 18075eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18085eefee25Smacallan ;; 18095eefee25Smacallan 18105eefee25Smacallan -Wl,*) 18115eefee25Smacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 18125eefee25Smacallan arg= 18135eefee25Smacallan save_ifs="$IFS"; IFS=',' 18145eefee25Smacallan for flag in $args; do 18155eefee25Smacallan IFS="$save_ifs" 18165eefee25Smacallan case $flag in 18175eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18185eefee25Smacallan flag="\"$flag\"" 18195eefee25Smacallan ;; 18205eefee25Smacallan esac 18215eefee25Smacallan arg="$arg $wl$flag" 18225eefee25Smacallan compiler_flags="$compiler_flags $wl$flag" 18235eefee25Smacallan linker_flags="$linker_flags $flag" 18245eefee25Smacallan done 18255eefee25Smacallan IFS="$save_ifs" 18265eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18275eefee25Smacallan ;; 18285eefee25Smacallan 18295eefee25Smacallan -Xcompiler) 18305eefee25Smacallan prev=xcompiler 18315eefee25Smacallan continue 18325eefee25Smacallan ;; 18335eefee25Smacallan 18345eefee25Smacallan -Xlinker) 18355eefee25Smacallan prev=xlinker 18365eefee25Smacallan continue 18375eefee25Smacallan ;; 18385eefee25Smacallan 18395eefee25Smacallan -XCClinker) 18405eefee25Smacallan prev=xcclinker 18415eefee25Smacallan continue 18425eefee25Smacallan ;; 18435eefee25Smacallan 18445eefee25Smacallan # Some other compiler flag. 18455eefee25Smacallan -* | +*) 18465eefee25Smacallan # Unknown arguments in both finalize_command and compile_command need 18475eefee25Smacallan # to be aesthetically quoted because they are evaled later. 18485eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 18495eefee25Smacallan case $arg in 18505eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18515eefee25Smacallan arg="\"$arg\"" 18525eefee25Smacallan ;; 18535eefee25Smacallan esac 18545eefee25Smacallan ;; 18555eefee25Smacallan 18565eefee25Smacallan *.$objext) 18575eefee25Smacallan # A standard object. 18585eefee25Smacallan objs="$objs $arg" 18595eefee25Smacallan ;; 18605eefee25Smacallan 18615eefee25Smacallan *.lo) 18625eefee25Smacallan # A libtool-controlled object. 18635eefee25Smacallan 18645eefee25Smacallan # Check to see that this really is a libtool object. 18655eefee25Smacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 18665eefee25Smacallan pic_object= 18675eefee25Smacallan non_pic_object= 18685eefee25Smacallan 18695eefee25Smacallan # Read the .lo file 18705eefee25Smacallan # If there is no directory component, then add one. 18715eefee25Smacallan case $arg in 18725eefee25Smacallan */* | *\\*) . $arg ;; 18735eefee25Smacallan *) . ./$arg ;; 18745eefee25Smacallan esac 18755eefee25Smacallan 18765eefee25Smacallan if test -z "$pic_object" || \ 18775eefee25Smacallan test -z "$non_pic_object" || 18785eefee25Smacallan test "$pic_object" = none && \ 18795eefee25Smacallan test "$non_pic_object" = none; then 18805eefee25Smacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 18815eefee25Smacallan exit $EXIT_FAILURE 18825eefee25Smacallan fi 18835eefee25Smacallan 18845eefee25Smacallan # Extract subdirectory from the argument. 18855eefee25Smacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18865eefee25Smacallan if test "X$xdir" = "X$arg"; then 18875eefee25Smacallan xdir= 18885eefee25Smacallan else 18895eefee25Smacallan xdir="$xdir/" 18905eefee25Smacallan fi 18915eefee25Smacallan 18925eefee25Smacallan if test "$pic_object" != none; then 18935eefee25Smacallan # Prepend the subdirectory the object is found in. 18945eefee25Smacallan pic_object="$xdir$pic_object" 18955eefee25Smacallan 18965eefee25Smacallan if test "$prev" = dlfiles; then 18975eefee25Smacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 18985eefee25Smacallan dlfiles="$dlfiles $pic_object" 18995eefee25Smacallan prev= 19005eefee25Smacallan continue 19015eefee25Smacallan else 19025eefee25Smacallan # If libtool objects are unsupported, then we need to preload. 19035eefee25Smacallan prev=dlprefiles 19045eefee25Smacallan fi 19055eefee25Smacallan fi 19065eefee25Smacallan 19075eefee25Smacallan # CHECK ME: I think I busted this. -Ossama 19085eefee25Smacallan if test "$prev" = dlprefiles; then 19095eefee25Smacallan # Preload the old-style object. 19105eefee25Smacallan dlprefiles="$dlprefiles $pic_object" 19115eefee25Smacallan prev= 19125eefee25Smacallan fi 19135eefee25Smacallan 19145eefee25Smacallan # A PIC object. 19155eefee25Smacallan libobjs="$libobjs $pic_object" 19165eefee25Smacallan arg="$pic_object" 19175eefee25Smacallan fi 19185eefee25Smacallan 19195eefee25Smacallan # Non-PIC object. 19205eefee25Smacallan if test "$non_pic_object" != none; then 19215eefee25Smacallan # Prepend the subdirectory the object is found in. 19225eefee25Smacallan non_pic_object="$xdir$non_pic_object" 19235eefee25Smacallan 19245eefee25Smacallan # A standard non-PIC object 19255eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 19265eefee25Smacallan if test -z "$pic_object" || test "$pic_object" = none ; then 19275eefee25Smacallan arg="$non_pic_object" 19285eefee25Smacallan fi 19295eefee25Smacallan else 19305eefee25Smacallan # If the PIC object exists, use it instead. 19315eefee25Smacallan # $xdir was prepended to $pic_object above. 19325eefee25Smacallan non_pic_object="$pic_object" 19335eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 19345eefee25Smacallan fi 19355eefee25Smacallan else 19365eefee25Smacallan # Only an error if not doing a dry-run. 19375eefee25Smacallan if test -z "$run"; then 19385eefee25Smacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 19395eefee25Smacallan exit $EXIT_FAILURE 19405eefee25Smacallan else 19415eefee25Smacallan # Dry-run case. 19425eefee25Smacallan 19435eefee25Smacallan # Extract subdirectory from the argument. 19445eefee25Smacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 19455eefee25Smacallan if test "X$xdir" = "X$arg"; then 19465eefee25Smacallan xdir= 19475eefee25Smacallan else 19485eefee25Smacallan xdir="$xdir/" 19495eefee25Smacallan fi 19505eefee25Smacallan 19515eefee25Smacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 19525eefee25Smacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 19535eefee25Smacallan libobjs="$libobjs $pic_object" 19545eefee25Smacallan non_pic_objects="$non_pic_objects $non_pic_object" 19555eefee25Smacallan fi 19565eefee25Smacallan fi 19575eefee25Smacallan ;; 19585eefee25Smacallan 19595eefee25Smacallan *.$libext) 19605eefee25Smacallan # An archive. 19615eefee25Smacallan deplibs="$deplibs $arg" 19625eefee25Smacallan old_deplibs="$old_deplibs $arg" 19635eefee25Smacallan continue 19645eefee25Smacallan ;; 19655eefee25Smacallan 19665eefee25Smacallan *.la) 19675eefee25Smacallan # A libtool-controlled library. 19685eefee25Smacallan 19695eefee25Smacallan if test "$prev" = dlfiles; then 19705eefee25Smacallan # This library was specified with -dlopen. 19715eefee25Smacallan dlfiles="$dlfiles $arg" 19725eefee25Smacallan prev= 19735eefee25Smacallan elif test "$prev" = dlprefiles; then 19745eefee25Smacallan # The library was specified with -dlpreopen. 19755eefee25Smacallan dlprefiles="$dlprefiles $arg" 19765eefee25Smacallan prev= 19775eefee25Smacallan else 19785eefee25Smacallan deplibs="$deplibs $arg" 19795eefee25Smacallan fi 19805eefee25Smacallan continue 19815eefee25Smacallan ;; 19825eefee25Smacallan 19835eefee25Smacallan # Some other compiler argument. 19845eefee25Smacallan *) 19855eefee25Smacallan # Unknown arguments in both finalize_command and compile_command need 19865eefee25Smacallan # to be aesthetically quoted because they are evaled later. 19875eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 19885eefee25Smacallan case $arg in 19895eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19905eefee25Smacallan arg="\"$arg\"" 19915eefee25Smacallan ;; 19925eefee25Smacallan esac 19935eefee25Smacallan ;; 19945eefee25Smacallan esac # arg 19955eefee25Smacallan 19965eefee25Smacallan # Now actually substitute the argument into the commands. 19975eefee25Smacallan if test -n "$arg"; then 19985eefee25Smacallan compile_command="$compile_command $arg" 19995eefee25Smacallan finalize_command="$finalize_command $arg" 20005eefee25Smacallan fi 20015eefee25Smacallan done # argument parsing loop 20025eefee25Smacallan 20035eefee25Smacallan if test -n "$prev"; then 20045eefee25Smacallan $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 20055eefee25Smacallan $echo "$help" 1>&2 20065eefee25Smacallan exit $EXIT_FAILURE 20075eefee25Smacallan fi 20085eefee25Smacallan 20095eefee25Smacallan if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 20105eefee25Smacallan eval arg=\"$export_dynamic_flag_spec\" 20115eefee25Smacallan compile_command="$compile_command $arg" 20125eefee25Smacallan finalize_command="$finalize_command $arg" 20135eefee25Smacallan fi 20145eefee25Smacallan 20155eefee25Smacallan oldlibs= 20165eefee25Smacallan # calculate the name of the file, without its directory 20175eefee25Smacallan outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 20185eefee25Smacallan libobjs_save="$libobjs" 20195eefee25Smacallan 20205eefee25Smacallan if test -n "$shlibpath_var"; then 20215eefee25Smacallan # get the directories listed in $shlibpath_var 20225eefee25Smacallan eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 20235eefee25Smacallan else 20245eefee25Smacallan shlib_search_path= 20255eefee25Smacallan fi 20265eefee25Smacallan eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 20275eefee25Smacallan eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 20285eefee25Smacallan 20295eefee25Smacallan output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 20305eefee25Smacallan if test "X$output_objdir" = "X$output"; then 20315eefee25Smacallan output_objdir="$objdir" 20325eefee25Smacallan else 20335eefee25Smacallan output_objdir="$output_objdir/$objdir" 20345eefee25Smacallan fi 20355eefee25Smacallan # Create the object directory. 20365eefee25Smacallan if test ! -d "$output_objdir"; then 20375eefee25Smacallan $show "$mkdir $output_objdir" 20385eefee25Smacallan $run $mkdir $output_objdir 20395eefee25Smacallan exit_status=$? 20405eefee25Smacallan if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 20415eefee25Smacallan exit $exit_status 20425eefee25Smacallan fi 20435eefee25Smacallan fi 20445eefee25Smacallan 20455eefee25Smacallan # Determine the type of output 20465eefee25Smacallan case $output in 20475eefee25Smacallan "") 20485eefee25Smacallan $echo "$modename: you must specify an output file" 1>&2 20495eefee25Smacallan $echo "$help" 1>&2 20505eefee25Smacallan exit $EXIT_FAILURE 20515eefee25Smacallan ;; 20525eefee25Smacallan *.$libext) linkmode=oldlib ;; 20535eefee25Smacallan *.lo | *.$objext) linkmode=obj ;; 20545eefee25Smacallan *.la) linkmode=lib ;; 20555eefee25Smacallan *) linkmode=prog ;; # Anything else should be a program. 20565eefee25Smacallan esac 20575eefee25Smacallan 20585eefee25Smacallan case $host in 20595eefee25Smacallan *cygwin* | *mingw* | *pw32*) 20605eefee25Smacallan # don't eliminate duplications in $postdeps and $predeps 20615eefee25Smacallan duplicate_compiler_generated_deps=yes 20625eefee25Smacallan ;; 20635eefee25Smacallan *) 20645eefee25Smacallan duplicate_compiler_generated_deps=$duplicate_deps 20655eefee25Smacallan ;; 20665eefee25Smacallan esac 20675eefee25Smacallan specialdeplibs= 20685eefee25Smacallan 20695eefee25Smacallan libs= 20705eefee25Smacallan # Find all interdependent deplibs by searching for libraries 20715eefee25Smacallan # that are linked more than once (e.g. -la -lb -la) 20725eefee25Smacallan for deplib in $deplibs; do 20735eefee25Smacallan if test "X$duplicate_deps" = "Xyes" ; then 20745eefee25Smacallan case "$libs " in 20755eefee25Smacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 20765eefee25Smacallan esac 20775eefee25Smacallan fi 20785eefee25Smacallan libs="$libs $deplib" 20795eefee25Smacallan done 20805eefee25Smacallan 20815eefee25Smacallan if test "$linkmode" = lib; then 20825eefee25Smacallan libs="$predeps $libs $compiler_lib_search_path $postdeps" 20835eefee25Smacallan 20845eefee25Smacallan # Compute libraries that are listed more than once in $predeps 20855eefee25Smacallan # $postdeps and mark them as special (i.e., whose duplicates are 20865eefee25Smacallan # not to be eliminated). 20875eefee25Smacallan pre_post_deps= 20885eefee25Smacallan if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 20895eefee25Smacallan for pre_post_dep in $predeps $postdeps; do 20905eefee25Smacallan case "$pre_post_deps " in 20915eefee25Smacallan *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 20925eefee25Smacallan esac 20935eefee25Smacallan pre_post_deps="$pre_post_deps $pre_post_dep" 20945eefee25Smacallan done 20955eefee25Smacallan fi 20965eefee25Smacallan pre_post_deps= 20975eefee25Smacallan fi 20985eefee25Smacallan 20995eefee25Smacallan deplibs= 21005eefee25Smacallan newdependency_libs= 21015eefee25Smacallan newlib_search_path= 21025eefee25Smacallan need_relink=no # whether we're linking any uninstalled libtool libraries 21035eefee25Smacallan notinst_deplibs= # not-installed libtool libraries 21045eefee25Smacallan case $linkmode in 21055eefee25Smacallan lib) 21065eefee25Smacallan passes="conv link" 21075eefee25Smacallan for file in $dlfiles $dlprefiles; do 21085eefee25Smacallan case $file in 21095eefee25Smacallan *.la) ;; 21105eefee25Smacallan *) 21115eefee25Smacallan $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 21125eefee25Smacallan exit $EXIT_FAILURE 21135eefee25Smacallan ;; 21145eefee25Smacallan esac 21155eefee25Smacallan done 21165eefee25Smacallan ;; 21175eefee25Smacallan prog) 21185eefee25Smacallan compile_deplibs= 21195eefee25Smacallan finalize_deplibs= 21205eefee25Smacallan alldeplibs=no 21215eefee25Smacallan newdlfiles= 21225eefee25Smacallan newdlprefiles= 21235eefee25Smacallan passes="conv scan dlopen dlpreopen link" 21245eefee25Smacallan ;; 21255eefee25Smacallan *) passes="conv" 21265eefee25Smacallan ;; 21275eefee25Smacallan esac 21285eefee25Smacallan for pass in $passes; do 21295eefee25Smacallan if test "$linkmode,$pass" = "lib,link" || 21305eefee25Smacallan test "$linkmode,$pass" = "prog,scan"; then 21315eefee25Smacallan libs="$deplibs" 21325eefee25Smacallan deplibs= 21335eefee25Smacallan fi 21345eefee25Smacallan if test "$linkmode" = prog; then 21355eefee25Smacallan case $pass in 21365eefee25Smacallan dlopen) libs="$dlfiles" ;; 21375eefee25Smacallan dlpreopen) libs="$dlprefiles" ;; 213862ab96baSmrg link) 213962ab96baSmrg libs="$deplibs %DEPLIBS%" 214062ab96baSmrg test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 214162ab96baSmrg ;; 21425eefee25Smacallan esac 21435eefee25Smacallan fi 21445eefee25Smacallan if test "$pass" = dlopen; then 21455eefee25Smacallan # Collect dlpreopened libraries 21465eefee25Smacallan save_deplibs="$deplibs" 21475eefee25Smacallan deplibs= 21485eefee25Smacallan fi 21495eefee25Smacallan for deplib in $libs; do 21505eefee25Smacallan lib= 21515eefee25Smacallan found=no 21525eefee25Smacallan case $deplib in 215362ab96baSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 21545eefee25Smacallan if test "$linkmode,$pass" = "prog,link"; then 21555eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 21565eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 21575eefee25Smacallan else 21585eefee25Smacallan compiler_flags="$compiler_flags $deplib" 21595eefee25Smacallan fi 21605eefee25Smacallan continue 21615eefee25Smacallan ;; 21625eefee25Smacallan -l*) 21635eefee25Smacallan if test "$linkmode" != lib && test "$linkmode" != prog; then 21645eefee25Smacallan $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 21655eefee25Smacallan continue 21665eefee25Smacallan fi 21675eefee25Smacallan name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 216862ab96baSmrg if test "$linkmode" = lib; then 216962ab96baSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 217062ab96baSmrg else 217162ab96baSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 217262ab96baSmrg fi 217362ab96baSmrg for searchdir in $searchdirs; do 21745eefee25Smacallan for search_ext in .la $std_shrext .so .a; do 21755eefee25Smacallan # Search the libtool library 21765eefee25Smacallan lib="$searchdir/lib${name}${search_ext}" 21775eefee25Smacallan if test -f "$lib"; then 21785eefee25Smacallan if test "$search_ext" = ".la"; then 21795eefee25Smacallan found=yes 21805eefee25Smacallan else 21815eefee25Smacallan found=no 21825eefee25Smacallan fi 21835eefee25Smacallan break 2 21845eefee25Smacallan fi 21855eefee25Smacallan done 21865eefee25Smacallan done 21875eefee25Smacallan if test "$found" != yes; then 21885eefee25Smacallan # deplib doesn't seem to be a libtool library 21895eefee25Smacallan if test "$linkmode,$pass" = "prog,link"; then 21905eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 21915eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 21925eefee25Smacallan else 21935eefee25Smacallan deplibs="$deplib $deplibs" 21945eefee25Smacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21955eefee25Smacallan fi 21965eefee25Smacallan continue 21975eefee25Smacallan else # deplib is a libtool library 21985eefee25Smacallan # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 21995eefee25Smacallan # We need to do some special things here, and not later. 22005eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 22015eefee25Smacallan case " $predeps $postdeps " in 22025eefee25Smacallan *" $deplib "*) 22035eefee25Smacallan if (${SED} -e '2q' $lib | 22045eefee25Smacallan grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 22055eefee25Smacallan library_names= 22065eefee25Smacallan old_library= 22075eefee25Smacallan case $lib in 22085eefee25Smacallan */* | *\\*) . $lib ;; 22095eefee25Smacallan *) . ./$lib ;; 22105eefee25Smacallan esac 22115eefee25Smacallan for l in $old_library $library_names; do 22125eefee25Smacallan ll="$l" 22135eefee25Smacallan done 22145eefee25Smacallan if test "X$ll" = "X$old_library" ; then # only static version available 22155eefee25Smacallan found=no 22165eefee25Smacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 22175eefee25Smacallan test "X$ladir" = "X$lib" && ladir="." 22185eefee25Smacallan lib=$ladir/$old_library 22195eefee25Smacallan if test "$linkmode,$pass" = "prog,link"; then 22205eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 22215eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 22225eefee25Smacallan else 22235eefee25Smacallan deplibs="$deplib $deplibs" 22245eefee25Smacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 22255eefee25Smacallan fi 22265eefee25Smacallan continue 22275eefee25Smacallan fi 22285eefee25Smacallan fi 22295eefee25Smacallan ;; 22305eefee25Smacallan *) ;; 22315eefee25Smacallan esac 22325eefee25Smacallan fi 22335eefee25Smacallan fi 22345eefee25Smacallan ;; # -l 22355eefee25Smacallan -L*) 22365eefee25Smacallan case $linkmode in 22375eefee25Smacallan lib) 22385eefee25Smacallan deplibs="$deplib $deplibs" 22395eefee25Smacallan test "$pass" = conv && continue 22405eefee25Smacallan newdependency_libs="$deplib $newdependency_libs" 22415eefee25Smacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22425eefee25Smacallan ;; 22435eefee25Smacallan prog) 22445eefee25Smacallan if test "$pass" = conv; then 22455eefee25Smacallan deplibs="$deplib $deplibs" 22465eefee25Smacallan continue 22475eefee25Smacallan fi 22485eefee25Smacallan if test "$pass" = scan; then 22495eefee25Smacallan deplibs="$deplib $deplibs" 22505eefee25Smacallan else 22515eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 22525eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 22535eefee25Smacallan fi 22545eefee25Smacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22555eefee25Smacallan ;; 22565eefee25Smacallan *) 22575eefee25Smacallan $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 22585eefee25Smacallan ;; 22595eefee25Smacallan esac # linkmode 22605eefee25Smacallan continue 22615eefee25Smacallan ;; # -L 22625eefee25Smacallan -R*) 22635eefee25Smacallan if test "$pass" = link; then 22645eefee25Smacallan dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 22655eefee25Smacallan # Make sure the xrpath contains only unique directories. 22665eefee25Smacallan case "$xrpath " in 22675eefee25Smacallan *" $dir "*) ;; 22685eefee25Smacallan *) xrpath="$xrpath $dir" ;; 22695eefee25Smacallan esac 22705eefee25Smacallan fi 22715eefee25Smacallan deplibs="$deplib $deplibs" 22725eefee25Smacallan continue 22735eefee25Smacallan ;; 22745eefee25Smacallan *.la) lib="$deplib" ;; 22755eefee25Smacallan *.$libext) 22765eefee25Smacallan if test "$pass" = conv; then 22775eefee25Smacallan deplibs="$deplib $deplibs" 22785eefee25Smacallan continue 22795eefee25Smacallan fi 22805eefee25Smacallan case $linkmode in 22815eefee25Smacallan lib) 22825eefee25Smacallan valid_a_lib=no 22835eefee25Smacallan case $deplibs_check_method in 22845eefee25Smacallan match_pattern*) 22855eefee25Smacallan set dummy $deplibs_check_method 22865eefee25Smacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 22875eefee25Smacallan if eval $echo \"$deplib\" 2>/dev/null \ 22885eefee25Smacallan | $SED 10q \ 22895eefee25Smacallan | $EGREP "$match_pattern_regex" > /dev/null; then 22905eefee25Smacallan valid_a_lib=yes 22915eefee25Smacallan fi 22925eefee25Smacallan ;; 22935eefee25Smacallan pass_all) 22945eefee25Smacallan valid_a_lib=yes 22955eefee25Smacallan ;; 22965eefee25Smacallan esac 22975eefee25Smacallan if test "$valid_a_lib" != yes; then 22985eefee25Smacallan $echo 22995eefee25Smacallan $echo "*** Warning: Trying to link with static lib archive $deplib." 23005eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 23015eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 23025eefee25Smacallan $echo "*** shared version of the library, which you do not appear to have" 23035eefee25Smacallan $echo "*** because the file extensions .$libext of this argument makes me believe" 23045eefee25Smacallan $echo "*** that it is just a static archive that I should not used here." 23055eefee25Smacallan else 23065eefee25Smacallan $echo 23075eefee25Smacallan $echo "*** Warning: Linking the shared library $output against the" 23085eefee25Smacallan $echo "*** static library $deplib is not portable!" 23095eefee25Smacallan deplibs="$deplib $deplibs" 23105eefee25Smacallan fi 23115eefee25Smacallan continue 23125eefee25Smacallan ;; 23135eefee25Smacallan prog) 23145eefee25Smacallan if test "$pass" != link; then 23155eefee25Smacallan deplibs="$deplib $deplibs" 23165eefee25Smacallan else 23175eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 23185eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 23195eefee25Smacallan fi 23205eefee25Smacallan continue 23215eefee25Smacallan ;; 23225eefee25Smacallan esac # linkmode 23235eefee25Smacallan ;; # *.$libext 23245eefee25Smacallan *.lo | *.$objext) 23255eefee25Smacallan if test "$pass" = conv; then 23265eefee25Smacallan deplibs="$deplib $deplibs" 23275eefee25Smacallan elif test "$linkmode" = prog; then 23285eefee25Smacallan if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 23295eefee25Smacallan # If there is no dlopen support or we're linking statically, 23305eefee25Smacallan # we need to preload. 23315eefee25Smacallan newdlprefiles="$newdlprefiles $deplib" 23325eefee25Smacallan compile_deplibs="$deplib $compile_deplibs" 23335eefee25Smacallan finalize_deplibs="$deplib $finalize_deplibs" 23345eefee25Smacallan else 23355eefee25Smacallan newdlfiles="$newdlfiles $deplib" 23365eefee25Smacallan fi 23375eefee25Smacallan fi 23385eefee25Smacallan continue 23395eefee25Smacallan ;; 23405eefee25Smacallan %DEPLIBS%) 23415eefee25Smacallan alldeplibs=yes 23425eefee25Smacallan continue 23435eefee25Smacallan ;; 23445eefee25Smacallan esac # case $deplib 23455eefee25Smacallan if test "$found" = yes || test -f "$lib"; then : 23465eefee25Smacallan else 23475eefee25Smacallan $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 23485eefee25Smacallan exit $EXIT_FAILURE 23495eefee25Smacallan fi 23505eefee25Smacallan 23515eefee25Smacallan # Check to see that this really is a libtool archive. 23525eefee25Smacallan if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 23535eefee25Smacallan else 23545eefee25Smacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 23555eefee25Smacallan exit $EXIT_FAILURE 23565eefee25Smacallan fi 23575eefee25Smacallan 23585eefee25Smacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 23595eefee25Smacallan test "X$ladir" = "X$lib" && ladir="." 23605eefee25Smacallan 23615eefee25Smacallan dlname= 23625eefee25Smacallan dlopen= 23635eefee25Smacallan dlpreopen= 23645eefee25Smacallan libdir= 23655eefee25Smacallan library_names= 23665eefee25Smacallan old_library= 23675eefee25Smacallan # If the library was installed with an old release of libtool, 23685eefee25Smacallan # it will not redefine variables installed, or shouldnotlink 23695eefee25Smacallan installed=yes 23705eefee25Smacallan shouldnotlink=no 23715eefee25Smacallan avoidtemprpath= 23725eefee25Smacallan 23735eefee25Smacallan 23745eefee25Smacallan # Read the .la file 23755eefee25Smacallan case $lib in 23765eefee25Smacallan */* | *\\*) . $lib ;; 23775eefee25Smacallan *) . ./$lib ;; 23785eefee25Smacallan esac 23795eefee25Smacallan 23805eefee25Smacallan if test "$linkmode,$pass" = "lib,link" || 23815eefee25Smacallan test "$linkmode,$pass" = "prog,scan" || 23825eefee25Smacallan { test "$linkmode" != prog && test "$linkmode" != lib; }; then 23835eefee25Smacallan test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 23845eefee25Smacallan test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 23855eefee25Smacallan fi 23865eefee25Smacallan 23875eefee25Smacallan if test "$pass" = conv; then 23885eefee25Smacallan # Only check for convenience libraries 23895eefee25Smacallan deplibs="$lib $deplibs" 23905eefee25Smacallan if test -z "$libdir"; then 23915eefee25Smacallan if test -z "$old_library"; then 23925eefee25Smacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23935eefee25Smacallan exit $EXIT_FAILURE 23945eefee25Smacallan fi 23955eefee25Smacallan # It is a libtool convenience library, so add in its objects. 23965eefee25Smacallan convenience="$convenience $ladir/$objdir/$old_library" 23975eefee25Smacallan old_convenience="$old_convenience $ladir/$objdir/$old_library" 23985eefee25Smacallan tmp_libs= 23995eefee25Smacallan for deplib in $dependency_libs; do 24005eefee25Smacallan deplibs="$deplib $deplibs" 24015eefee25Smacallan if test "X$duplicate_deps" = "Xyes" ; then 24025eefee25Smacallan case "$tmp_libs " in 24035eefee25Smacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 24045eefee25Smacallan esac 24055eefee25Smacallan fi 24065eefee25Smacallan tmp_libs="$tmp_libs $deplib" 24075eefee25Smacallan done 24085eefee25Smacallan elif test "$linkmode" != prog && test "$linkmode" != lib; then 24095eefee25Smacallan $echo "$modename: \`$lib' is not a convenience library" 1>&2 24105eefee25Smacallan exit $EXIT_FAILURE 24115eefee25Smacallan fi 24125eefee25Smacallan continue 24135eefee25Smacallan fi # $pass = conv 24145eefee25Smacallan 24155eefee25Smacallan 24165eefee25Smacallan # Get the name of the library we link against. 24175eefee25Smacallan linklib= 24185eefee25Smacallan for l in $old_library $library_names; do 24195eefee25Smacallan linklib="$l" 24205eefee25Smacallan done 24215eefee25Smacallan if test -z "$linklib"; then 24225eefee25Smacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 24235eefee25Smacallan exit $EXIT_FAILURE 24245eefee25Smacallan fi 24255eefee25Smacallan 24265eefee25Smacallan # This library was specified with -dlopen. 24275eefee25Smacallan if test "$pass" = dlopen; then 24285eefee25Smacallan if test -z "$libdir"; then 24295eefee25Smacallan $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 24305eefee25Smacallan exit $EXIT_FAILURE 24315eefee25Smacallan fi 24325eefee25Smacallan if test -z "$dlname" || 24335eefee25Smacallan test "$dlopen_support" != yes || 24345eefee25Smacallan test "$build_libtool_libs" = no; then 24355eefee25Smacallan # If there is no dlname, no dlopen support or we're linking 24365eefee25Smacallan # statically, we need to preload. We also need to preload any 24375eefee25Smacallan # dependent libraries so libltdl's deplib preloader doesn't 24385eefee25Smacallan # bomb out in the load deplibs phase. 24395eefee25Smacallan dlprefiles="$dlprefiles $lib $dependency_libs" 24405eefee25Smacallan else 24415eefee25Smacallan newdlfiles="$newdlfiles $lib" 24425eefee25Smacallan fi 24435eefee25Smacallan continue 24445eefee25Smacallan fi # $pass = dlopen 24455eefee25Smacallan 24465eefee25Smacallan # We need an absolute path. 24475eefee25Smacallan case $ladir in 24485eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 24495eefee25Smacallan *) 24505eefee25Smacallan abs_ladir=`cd "$ladir" && pwd` 24515eefee25Smacallan if test -z "$abs_ladir"; then 24525eefee25Smacallan $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 24535eefee25Smacallan $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 24545eefee25Smacallan abs_ladir="$ladir" 24555eefee25Smacallan fi 24565eefee25Smacallan ;; 24575eefee25Smacallan esac 24585eefee25Smacallan laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 24595eefee25Smacallan 24605eefee25Smacallan # Find the relevant object directory and library name. 24615eefee25Smacallan if test "X$installed" = Xyes; then 24625eefee25Smacallan if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24635eefee25Smacallan $echo "$modename: warning: library \`$lib' was moved." 1>&2 24645eefee25Smacallan dir="$ladir" 24655eefee25Smacallan absdir="$abs_ladir" 24665eefee25Smacallan libdir="$abs_ladir" 24675eefee25Smacallan else 24685eefee25Smacallan dir="$libdir" 24695eefee25Smacallan absdir="$libdir" 24705eefee25Smacallan fi 24715eefee25Smacallan test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 24725eefee25Smacallan else 24735eefee25Smacallan if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24745eefee25Smacallan dir="$ladir" 24755eefee25Smacallan absdir="$abs_ladir" 24765eefee25Smacallan # Remove this search path later 24775eefee25Smacallan notinst_path="$notinst_path $abs_ladir" 24785eefee25Smacallan else 24795eefee25Smacallan dir="$ladir/$objdir" 24805eefee25Smacallan absdir="$abs_ladir/$objdir" 24815eefee25Smacallan # Remove this search path later 24825eefee25Smacallan notinst_path="$notinst_path $abs_ladir" 24835eefee25Smacallan fi 24845eefee25Smacallan fi # $installed = yes 24855eefee25Smacallan name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 24865eefee25Smacallan 24875eefee25Smacallan # This library was specified with -dlpreopen. 24885eefee25Smacallan if test "$pass" = dlpreopen; then 24895eefee25Smacallan if test -z "$libdir"; then 24905eefee25Smacallan $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 24915eefee25Smacallan exit $EXIT_FAILURE 24925eefee25Smacallan fi 24935eefee25Smacallan # Prefer using a static library (so that no silly _DYNAMIC symbols 24945eefee25Smacallan # are required to link). 24955eefee25Smacallan if test -n "$old_library"; then 24965eefee25Smacallan newdlprefiles="$newdlprefiles $dir/$old_library" 24975eefee25Smacallan # Otherwise, use the dlname, so that lt_dlopen finds it. 24985eefee25Smacallan elif test -n "$dlname"; then 24995eefee25Smacallan newdlprefiles="$newdlprefiles $dir/$dlname" 25005eefee25Smacallan else 25015eefee25Smacallan newdlprefiles="$newdlprefiles $dir/$linklib" 25025eefee25Smacallan fi 25035eefee25Smacallan fi # $pass = dlpreopen 25045eefee25Smacallan 25055eefee25Smacallan if test -z "$libdir"; then 25065eefee25Smacallan # Link the convenience library 25075eefee25Smacallan if test "$linkmode" = lib; then 25085eefee25Smacallan deplibs="$dir/$old_library $deplibs" 25095eefee25Smacallan elif test "$linkmode,$pass" = "prog,link"; then 25105eefee25Smacallan compile_deplibs="$dir/$old_library $compile_deplibs" 25115eefee25Smacallan finalize_deplibs="$dir/$old_library $finalize_deplibs" 25125eefee25Smacallan else 25135eefee25Smacallan deplibs="$lib $deplibs" # used for prog,scan pass 25145eefee25Smacallan fi 25155eefee25Smacallan continue 25165eefee25Smacallan fi 25175eefee25Smacallan 25185eefee25Smacallan 25195eefee25Smacallan if test "$linkmode" = prog && test "$pass" != link; then 25205eefee25Smacallan newlib_search_path="$newlib_search_path $ladir" 25215eefee25Smacallan deplibs="$lib $deplibs" 25225eefee25Smacallan 25235eefee25Smacallan linkalldeplibs=no 25245eefee25Smacallan if test "$link_all_deplibs" != no || test -z "$library_names" || 25255eefee25Smacallan test "$build_libtool_libs" = no; then 25265eefee25Smacallan linkalldeplibs=yes 25275eefee25Smacallan fi 25285eefee25Smacallan 25295eefee25Smacallan tmp_libs= 25305eefee25Smacallan for deplib in $dependency_libs; do 25315eefee25Smacallan case $deplib in 25325eefee25Smacallan -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 25335eefee25Smacallan esac 25345eefee25Smacallan # Need to link against all dependency_libs? 25355eefee25Smacallan if test "$linkalldeplibs" = yes; then 25365eefee25Smacallan deplibs="$deplib $deplibs" 25375eefee25Smacallan else 25385eefee25Smacallan # Need to hardcode shared library paths 25395eefee25Smacallan # or/and link against static libraries 25405eefee25Smacallan newdependency_libs="$deplib $newdependency_libs" 25415eefee25Smacallan fi 25425eefee25Smacallan if test "X$duplicate_deps" = "Xyes" ; then 25435eefee25Smacallan case "$tmp_libs " in 25445eefee25Smacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 25455eefee25Smacallan esac 25465eefee25Smacallan fi 25475eefee25Smacallan tmp_libs="$tmp_libs $deplib" 25485eefee25Smacallan done # for deplib 25495eefee25Smacallan continue 25505eefee25Smacallan fi # $linkmode = prog... 25515eefee25Smacallan 25525eefee25Smacallan if test "$linkmode,$pass" = "prog,link"; then 25535eefee25Smacallan if test -n "$library_names" && 255462ab96baSmrg { { test "$prefer_static_libs" = no || 255562ab96baSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 255662ab96baSmrg test -z "$old_library"; }; then 25575eefee25Smacallan # We need to hardcode the library path 25585eefee25Smacallan if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 25595eefee25Smacallan # Make sure the rpath contains only unique directories. 25605eefee25Smacallan case "$temp_rpath " in 25615eefee25Smacallan *" $dir "*) ;; 25625eefee25Smacallan *" $absdir "*) ;; 25635eefee25Smacallan *) temp_rpath="$temp_rpath $absdir" ;; 25645eefee25Smacallan esac 25655eefee25Smacallan fi 25665eefee25Smacallan 25675eefee25Smacallan # Hardcode the library path. 25685eefee25Smacallan # Skip directories that are in the system default run-time 25695eefee25Smacallan # search path. 25705eefee25Smacallan case " $sys_lib_dlsearch_path " in 25715eefee25Smacallan *" $absdir "*) ;; 25725eefee25Smacallan *) 25735eefee25Smacallan case "$compile_rpath " in 25745eefee25Smacallan *" $absdir "*) ;; 25755eefee25Smacallan *) compile_rpath="$compile_rpath $absdir" 25765eefee25Smacallan esac 25775eefee25Smacallan ;; 25785eefee25Smacallan esac 25795eefee25Smacallan case " $sys_lib_dlsearch_path " in 25805eefee25Smacallan *" $libdir "*) ;; 25815eefee25Smacallan *) 25825eefee25Smacallan case "$finalize_rpath " in 25835eefee25Smacallan *" $libdir "*) ;; 25845eefee25Smacallan *) finalize_rpath="$finalize_rpath $libdir" 25855eefee25Smacallan esac 25865eefee25Smacallan ;; 25875eefee25Smacallan esac 25885eefee25Smacallan fi # $linkmode,$pass = prog,link... 25895eefee25Smacallan 25905eefee25Smacallan if test "$alldeplibs" = yes && 25915eefee25Smacallan { test "$deplibs_check_method" = pass_all || 25925eefee25Smacallan { test "$build_libtool_libs" = yes && 25935eefee25Smacallan test -n "$library_names"; }; }; then 25945eefee25Smacallan # We only need to search for static libraries 25955eefee25Smacallan continue 25965eefee25Smacallan fi 25975eefee25Smacallan fi 25985eefee25Smacallan 25995eefee25Smacallan link_static=no # Whether the deplib will be linked statically 26005eefee25Smacallan use_static_libs=$prefer_static_libs 26015eefee25Smacallan if test "$use_static_libs" = built && test "$installed" = yes ; then 26025eefee25Smacallan use_static_libs=no 26035eefee25Smacallan fi 26045eefee25Smacallan if test -n "$library_names" && 26055eefee25Smacallan { test "$use_static_libs" = no || test -z "$old_library"; }; then 26065eefee25Smacallan if test "$installed" = no; then 26075eefee25Smacallan notinst_deplibs="$notinst_deplibs $lib" 26085eefee25Smacallan need_relink=yes 26095eefee25Smacallan fi 26105eefee25Smacallan # This is a shared library 26115eefee25Smacallan 26125eefee25Smacallan # Warn about portability, can't link against -module's on 26135eefee25Smacallan # some systems (darwin) 26145eefee25Smacallan if test "$shouldnotlink" = yes && test "$pass" = link ; then 26155eefee25Smacallan $echo 26165eefee25Smacallan if test "$linkmode" = prog; then 26175eefee25Smacallan $echo "*** Warning: Linking the executable $output against the loadable module" 26185eefee25Smacallan else 26195eefee25Smacallan $echo "*** Warning: Linking the shared library $output against the loadable module" 26205eefee25Smacallan fi 26215eefee25Smacallan $echo "*** $linklib is not portable!" 26225eefee25Smacallan fi 26235eefee25Smacallan if test "$linkmode" = lib && 26245eefee25Smacallan test "$hardcode_into_libs" = yes; then 26255eefee25Smacallan # Hardcode the library path. 26265eefee25Smacallan # Skip directories that are in the system default run-time 26275eefee25Smacallan # search path. 26285eefee25Smacallan case " $sys_lib_dlsearch_path " in 26295eefee25Smacallan *" $absdir "*) ;; 26305eefee25Smacallan *) 26315eefee25Smacallan case "$compile_rpath " in 26325eefee25Smacallan *" $absdir "*) ;; 26335eefee25Smacallan *) compile_rpath="$compile_rpath $absdir" 26345eefee25Smacallan esac 26355eefee25Smacallan ;; 26365eefee25Smacallan esac 26375eefee25Smacallan case " $sys_lib_dlsearch_path " in 26385eefee25Smacallan *" $libdir "*) ;; 26395eefee25Smacallan *) 26405eefee25Smacallan case "$finalize_rpath " in 26415eefee25Smacallan *" $libdir "*) ;; 26425eefee25Smacallan *) finalize_rpath="$finalize_rpath $libdir" 26435eefee25Smacallan esac 26445eefee25Smacallan ;; 26455eefee25Smacallan esac 26465eefee25Smacallan fi 26475eefee25Smacallan 26485eefee25Smacallan if test -n "$old_archive_from_expsyms_cmds"; then 26495eefee25Smacallan # figure out the soname 26505eefee25Smacallan set dummy $library_names 26515eefee25Smacallan realname="$2" 26525eefee25Smacallan shift; shift 26535eefee25Smacallan libname=`eval \\$echo \"$libname_spec\"` 26545eefee25Smacallan # use dlname if we got it. it's perfectly good, no? 26555eefee25Smacallan if test -n "$dlname"; then 26565eefee25Smacallan soname="$dlname" 26575eefee25Smacallan elif test -n "$soname_spec"; then 26585eefee25Smacallan # bleh windows 26595eefee25Smacallan case $host in 26605eefee25Smacallan *cygwin* | mingw*) 26615eefee25Smacallan major=`expr $current - $age` 26625eefee25Smacallan versuffix="-$major" 26635eefee25Smacallan ;; 26645eefee25Smacallan esac 26655eefee25Smacallan eval soname=\"$soname_spec\" 26665eefee25Smacallan else 26675eefee25Smacallan soname="$realname" 26685eefee25Smacallan fi 26695eefee25Smacallan 26705eefee25Smacallan # Make a new name for the extract_expsyms_cmds to use 26715eefee25Smacallan soroot="$soname" 26725eefee25Smacallan soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 26735eefee25Smacallan newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 26745eefee25Smacallan 26755eefee25Smacallan # If the library has no export list, then create one now 26765eefee25Smacallan if test -f "$output_objdir/$soname-def"; then : 26775eefee25Smacallan else 26785eefee25Smacallan $show "extracting exported symbol list from \`$soname'" 26795eefee25Smacallan save_ifs="$IFS"; IFS='~' 26805eefee25Smacallan cmds=$extract_expsyms_cmds 26815eefee25Smacallan for cmd in $cmds; do 26825eefee25Smacallan IFS="$save_ifs" 26835eefee25Smacallan eval cmd=\"$cmd\" 26845eefee25Smacallan $show "$cmd" 26855eefee25Smacallan $run eval "$cmd" || exit $? 26865eefee25Smacallan done 26875eefee25Smacallan IFS="$save_ifs" 26885eefee25Smacallan fi 26895eefee25Smacallan 26905eefee25Smacallan # Create $newlib 26915eefee25Smacallan if test -f "$output_objdir/$newlib"; then :; else 26925eefee25Smacallan $show "generating import library for \`$soname'" 26935eefee25Smacallan save_ifs="$IFS"; IFS='~' 26945eefee25Smacallan cmds=$old_archive_from_expsyms_cmds 26955eefee25Smacallan for cmd in $cmds; do 26965eefee25Smacallan IFS="$save_ifs" 26975eefee25Smacallan eval cmd=\"$cmd\" 26985eefee25Smacallan $show "$cmd" 26995eefee25Smacallan $run eval "$cmd" || exit $? 27005eefee25Smacallan done 27015eefee25Smacallan IFS="$save_ifs" 27025eefee25Smacallan fi 27035eefee25Smacallan # make sure the library variables are pointing to the new library 27045eefee25Smacallan dir=$output_objdir 27055eefee25Smacallan linklib=$newlib 27065eefee25Smacallan fi # test -n "$old_archive_from_expsyms_cmds" 27075eefee25Smacallan 27085eefee25Smacallan if test "$linkmode" = prog || test "$mode" != relink; then 27095eefee25Smacallan add_shlibpath= 27105eefee25Smacallan add_dir= 27115eefee25Smacallan add= 27125eefee25Smacallan lib_linked=yes 27135eefee25Smacallan case $hardcode_action in 27145eefee25Smacallan immediate | unsupported) 27155eefee25Smacallan if test "$hardcode_direct" = no; then 27165eefee25Smacallan add="$dir/$linklib" 27175eefee25Smacallan case $host in 27185eefee25Smacallan *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 27195eefee25Smacallan *-*-sysv4*uw2*) add_dir="-L$dir" ;; 27205eefee25Smacallan *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 27215eefee25Smacallan *-*-unixware7*) add_dir="-L$dir" ;; 27225eefee25Smacallan *-*-darwin* ) 27235eefee25Smacallan # if the lib is a module then we can not link against 27245eefee25Smacallan # it, someone is ignoring the new warnings I added 27255eefee25Smacallan if /usr/bin/file -L $add 2> /dev/null | 27265eefee25Smacallan $EGREP ": [^:]* bundle" >/dev/null ; then 27275eefee25Smacallan $echo "** Warning, lib $linklib is a module, not a shared library" 27285eefee25Smacallan if test -z "$old_library" ; then 27295eefee25Smacallan $echo 27305eefee25Smacallan $echo "** And there doesn't seem to be a static archive available" 27315eefee25Smacallan $echo "** The link will probably fail, sorry" 27325eefee25Smacallan else 27335eefee25Smacallan add="$dir/$old_library" 27345eefee25Smacallan fi 27355eefee25Smacallan fi 27365eefee25Smacallan esac 27375eefee25Smacallan elif test "$hardcode_minus_L" = no; then 27385eefee25Smacallan case $host in 27395eefee25Smacallan *-*-sunos*) add_shlibpath="$dir" ;; 27405eefee25Smacallan esac 27415eefee25Smacallan add_dir="-L$dir" 27425eefee25Smacallan add="-l$name" 27435eefee25Smacallan elif test "$hardcode_shlibpath_var" = no; then 27445eefee25Smacallan add_shlibpath="$dir" 27455eefee25Smacallan add="-l$name" 27465eefee25Smacallan else 27475eefee25Smacallan lib_linked=no 27485eefee25Smacallan fi 27495eefee25Smacallan ;; 27505eefee25Smacallan relink) 27515eefee25Smacallan if test "$hardcode_direct" = yes; then 27525eefee25Smacallan add="$dir/$linklib" 27535eefee25Smacallan elif test "$hardcode_minus_L" = yes; then 27545eefee25Smacallan add_dir="-L$dir" 27555eefee25Smacallan # Try looking first in the location we're being installed to. 27565eefee25Smacallan if test -n "$inst_prefix_dir"; then 27575eefee25Smacallan case $libdir in 27585eefee25Smacallan [\\/]*) 27595eefee25Smacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 27605eefee25Smacallan ;; 27615eefee25Smacallan esac 27625eefee25Smacallan fi 27635eefee25Smacallan add="-l$name" 27645eefee25Smacallan elif test "$hardcode_shlibpath_var" = yes; then 27655eefee25Smacallan add_shlibpath="$dir" 27665eefee25Smacallan add="-l$name" 27675eefee25Smacallan else 27685eefee25Smacallan lib_linked=no 27695eefee25Smacallan fi 27705eefee25Smacallan ;; 27715eefee25Smacallan *) lib_linked=no ;; 27725eefee25Smacallan esac 27735eefee25Smacallan 27745eefee25Smacallan if test "$lib_linked" != yes; then 27755eefee25Smacallan $echo "$modename: configuration error: unsupported hardcode properties" 27765eefee25Smacallan exit $EXIT_FAILURE 27775eefee25Smacallan fi 27785eefee25Smacallan 27795eefee25Smacallan if test -n "$add_shlibpath"; then 27805eefee25Smacallan case :$compile_shlibpath: in 27815eefee25Smacallan *":$add_shlibpath:"*) ;; 27825eefee25Smacallan *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 27835eefee25Smacallan esac 27845eefee25Smacallan fi 27855eefee25Smacallan if test "$linkmode" = prog; then 27865eefee25Smacallan test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 27875eefee25Smacallan test -n "$add" && compile_deplibs="$add $compile_deplibs" 27885eefee25Smacallan else 27895eefee25Smacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 27905eefee25Smacallan test -n "$add" && deplibs="$add $deplibs" 27915eefee25Smacallan if test "$hardcode_direct" != yes && \ 27925eefee25Smacallan test "$hardcode_minus_L" != yes && \ 27935eefee25Smacallan test "$hardcode_shlibpath_var" = yes; then 27945eefee25Smacallan case :$finalize_shlibpath: in 27955eefee25Smacallan *":$libdir:"*) ;; 27965eefee25Smacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27975eefee25Smacallan esac 27985eefee25Smacallan fi 27995eefee25Smacallan fi 28005eefee25Smacallan fi 28015eefee25Smacallan 28025eefee25Smacallan if test "$linkmode" = prog || test "$mode" = relink; then 28035eefee25Smacallan add_shlibpath= 28045eefee25Smacallan add_dir= 28055eefee25Smacallan add= 28065eefee25Smacallan # Finalize command for both is simple: just hardcode it. 28075eefee25Smacallan if test "$hardcode_direct" = yes; then 28085eefee25Smacallan add="$libdir/$linklib" 28095eefee25Smacallan elif test "$hardcode_minus_L" = yes; then 28105eefee25Smacallan add_dir="-L$libdir" 28115eefee25Smacallan add="-l$name" 28125eefee25Smacallan elif test "$hardcode_shlibpath_var" = yes; then 28135eefee25Smacallan case :$finalize_shlibpath: in 28145eefee25Smacallan *":$libdir:"*) ;; 28155eefee25Smacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 28165eefee25Smacallan esac 28175eefee25Smacallan add="-l$name" 28185eefee25Smacallan elif test "$hardcode_automatic" = yes; then 28195eefee25Smacallan if test -n "$inst_prefix_dir" && 28205eefee25Smacallan test -f "$inst_prefix_dir$libdir/$linklib" ; then 28215eefee25Smacallan add="$inst_prefix_dir$libdir/$linklib" 28225eefee25Smacallan else 28235eefee25Smacallan add="$libdir/$linklib" 28245eefee25Smacallan fi 28255eefee25Smacallan else 28265eefee25Smacallan # We cannot seem to hardcode it, guess we'll fake it. 28275eefee25Smacallan add_dir="-L$libdir" 28285eefee25Smacallan # Try looking first in the location we're being installed to. 28295eefee25Smacallan if test -n "$inst_prefix_dir"; then 28305eefee25Smacallan case $libdir in 28315eefee25Smacallan [\\/]*) 28325eefee25Smacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 28335eefee25Smacallan ;; 28345eefee25Smacallan esac 28355eefee25Smacallan fi 28365eefee25Smacallan add="-l$name" 28375eefee25Smacallan fi 28385eefee25Smacallan 28395eefee25Smacallan if test "$linkmode" = prog; then 28405eefee25Smacallan test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 28415eefee25Smacallan test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 28425eefee25Smacallan else 28435eefee25Smacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 28445eefee25Smacallan test -n "$add" && deplibs="$add $deplibs" 28455eefee25Smacallan fi 28465eefee25Smacallan fi 28475eefee25Smacallan elif test "$linkmode" = prog; then 28485eefee25Smacallan # Here we assume that one of hardcode_direct or hardcode_minus_L 28495eefee25Smacallan # is not unsupported. This is valid on all known static and 28505eefee25Smacallan # shared platforms. 28515eefee25Smacallan if test "$hardcode_direct" != unsupported; then 28525eefee25Smacallan test -n "$old_library" && linklib="$old_library" 28535eefee25Smacallan compile_deplibs="$dir/$linklib $compile_deplibs" 28545eefee25Smacallan finalize_deplibs="$dir/$linklib $finalize_deplibs" 28555eefee25Smacallan else 28565eefee25Smacallan compile_deplibs="-l$name -L$dir $compile_deplibs" 28575eefee25Smacallan finalize_deplibs="-l$name -L$dir $finalize_deplibs" 28585eefee25Smacallan fi 28595eefee25Smacallan elif test "$build_libtool_libs" = yes; then 28605eefee25Smacallan # Not a shared library 28615eefee25Smacallan if test "$deplibs_check_method" != pass_all; then 28625eefee25Smacallan # We're trying link a shared library against a static one 28635eefee25Smacallan # but the system doesn't support it. 28645eefee25Smacallan 28655eefee25Smacallan # Just print a warning and add the library to dependency_libs so 28665eefee25Smacallan # that the program can be linked against the static library. 28675eefee25Smacallan $echo 28685eefee25Smacallan $echo "*** Warning: This system can not link to static lib archive $lib." 28695eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 28705eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 28715eefee25Smacallan $echo "*** shared version of the library, which you do not appear to have." 28725eefee25Smacallan if test "$module" = yes; then 28735eefee25Smacallan $echo "*** But as you try to build a module library, libtool will still create " 28745eefee25Smacallan $echo "*** a static module, that should work as long as the dlopening application" 28755eefee25Smacallan $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 28765eefee25Smacallan if test -z "$global_symbol_pipe"; then 28775eefee25Smacallan $echo 28785eefee25Smacallan $echo "*** However, this would only work if libtool was able to extract symbol" 28795eefee25Smacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 28805eefee25Smacallan $echo "*** not find such a program. So, this module is probably useless." 28815eefee25Smacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 28825eefee25Smacallan fi 28835eefee25Smacallan if test "$build_old_libs" = no; then 28845eefee25Smacallan build_libtool_libs=module 28855eefee25Smacallan build_old_libs=yes 28865eefee25Smacallan else 28875eefee25Smacallan build_libtool_libs=no 28885eefee25Smacallan fi 28895eefee25Smacallan fi 28905eefee25Smacallan else 28915eefee25Smacallan deplibs="$dir/$old_library $deplibs" 28925eefee25Smacallan link_static=yes 28935eefee25Smacallan fi 28945eefee25Smacallan fi # link shared/static library? 28955eefee25Smacallan 28965eefee25Smacallan if test "$linkmode" = lib; then 28975eefee25Smacallan if test -n "$dependency_libs" && 28985eefee25Smacallan { test "$hardcode_into_libs" != yes || 28995eefee25Smacallan test "$build_old_libs" = yes || 29005eefee25Smacallan test "$link_static" = yes; }; then 29015eefee25Smacallan # Extract -R from dependency_libs 29025eefee25Smacallan temp_deplibs= 29035eefee25Smacallan for libdir in $dependency_libs; do 29045eefee25Smacallan case $libdir in 29055eefee25Smacallan -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 29065eefee25Smacallan case " $xrpath " in 29075eefee25Smacallan *" $temp_xrpath "*) ;; 29085eefee25Smacallan *) xrpath="$xrpath $temp_xrpath";; 29095eefee25Smacallan esac;; 29105eefee25Smacallan *) temp_deplibs="$temp_deplibs $libdir";; 29115eefee25Smacallan esac 29125eefee25Smacallan done 29135eefee25Smacallan dependency_libs="$temp_deplibs" 29145eefee25Smacallan fi 29155eefee25Smacallan 29165eefee25Smacallan newlib_search_path="$newlib_search_path $absdir" 29175eefee25Smacallan # Link against this library 29185eefee25Smacallan test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 29195eefee25Smacallan # ... and its dependency_libs 29205eefee25Smacallan tmp_libs= 29215eefee25Smacallan for deplib in $dependency_libs; do 29225eefee25Smacallan newdependency_libs="$deplib $newdependency_libs" 29235eefee25Smacallan if test "X$duplicate_deps" = "Xyes" ; then 29245eefee25Smacallan case "$tmp_libs " in 29255eefee25Smacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 29265eefee25Smacallan esac 29275eefee25Smacallan fi 29285eefee25Smacallan tmp_libs="$tmp_libs $deplib" 29295eefee25Smacallan done 29305eefee25Smacallan 29315eefee25Smacallan if test "$link_all_deplibs" != no; then 29325eefee25Smacallan # Add the search paths of all dependency libraries 29335eefee25Smacallan for deplib in $dependency_libs; do 29345eefee25Smacallan case $deplib in 29355eefee25Smacallan -L*) path="$deplib" ;; 29365eefee25Smacallan *.la) 29375eefee25Smacallan dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 29385eefee25Smacallan test "X$dir" = "X$deplib" && dir="." 29395eefee25Smacallan # We need an absolute path. 29405eefee25Smacallan case $dir in 29415eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 29425eefee25Smacallan *) 29435eefee25Smacallan absdir=`cd "$dir" && pwd` 29445eefee25Smacallan if test -z "$absdir"; then 29455eefee25Smacallan $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 29465eefee25Smacallan absdir="$dir" 29475eefee25Smacallan fi 29485eefee25Smacallan ;; 29495eefee25Smacallan esac 29505eefee25Smacallan if grep "^installed=no" $deplib > /dev/null; then 29515eefee25Smacallan path="$absdir/$objdir" 29525eefee25Smacallan else 29535eefee25Smacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29545eefee25Smacallan if test -z "$libdir"; then 29555eefee25Smacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 29565eefee25Smacallan exit $EXIT_FAILURE 29575eefee25Smacallan fi 29585eefee25Smacallan if test "$absdir" != "$libdir"; then 29595eefee25Smacallan $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 29605eefee25Smacallan fi 29615eefee25Smacallan path="$absdir" 29625eefee25Smacallan fi 29635eefee25Smacallan depdepl= 29645eefee25Smacallan case $host in 29655eefee25Smacallan *-*-darwin*) 29665eefee25Smacallan # we do not want to link against static libs, 29675eefee25Smacallan # but need to link against shared 29685eefee25Smacallan eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 296962ab96baSmrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29705eefee25Smacallan if test -n "$deplibrary_names" ; then 29715eefee25Smacallan for tmp in $deplibrary_names ; do 29725eefee25Smacallan depdepl=$tmp 29735eefee25Smacallan done 297462ab96baSmrg if test -f "$deplibdir/$depdepl" ; then 297562ab96baSmrg depdepl="$deplibdir/$depdepl" 297662ab96baSmrg elif test -f "$path/$depdepl" ; then 29775eefee25Smacallan depdepl="$path/$depdepl" 297862ab96baSmrg else 297962ab96baSmrg # Can't find it, oh well... 298062ab96baSmrg depdepl= 29815eefee25Smacallan fi 29825eefee25Smacallan # do not add paths which are already there 29835eefee25Smacallan case " $newlib_search_path " in 29845eefee25Smacallan *" $path "*) ;; 29855eefee25Smacallan *) newlib_search_path="$newlib_search_path $path";; 29865eefee25Smacallan esac 29875eefee25Smacallan fi 29885eefee25Smacallan path="" 29895eefee25Smacallan ;; 29905eefee25Smacallan *) 29915eefee25Smacallan path="-L$path" 29925eefee25Smacallan ;; 29935eefee25Smacallan esac 29945eefee25Smacallan ;; 29955eefee25Smacallan -l*) 29965eefee25Smacallan case $host in 29975eefee25Smacallan *-*-darwin*) 29985eefee25Smacallan # Again, we only want to link against shared libraries 29995eefee25Smacallan eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 30005eefee25Smacallan for tmp in $newlib_search_path ; do 30015eefee25Smacallan if test -f "$tmp/lib$tmp_libs.dylib" ; then 30025eefee25Smacallan eval depdepl="$tmp/lib$tmp_libs.dylib" 30035eefee25Smacallan break 30045eefee25Smacallan fi 30055eefee25Smacallan done 30065eefee25Smacallan path="" 30075eefee25Smacallan ;; 30085eefee25Smacallan *) continue ;; 30095eefee25Smacallan esac 30105eefee25Smacallan ;; 30115eefee25Smacallan *) continue ;; 30125eefee25Smacallan esac 30135eefee25Smacallan case " $deplibs " in 30145eefee25Smacallan *" $path "*) ;; 30155eefee25Smacallan *) deplibs="$path $deplibs" ;; 30165eefee25Smacallan esac 30175eefee25Smacallan case " $deplibs " in 30185eefee25Smacallan *" $depdepl "*) ;; 30195eefee25Smacallan *) deplibs="$depdepl $deplibs" ;; 30205eefee25Smacallan esac 30215eefee25Smacallan done 30225eefee25Smacallan fi # link_all_deplibs != no 30235eefee25Smacallan fi # linkmode = lib 30245eefee25Smacallan done # for deplib in $libs 30255eefee25Smacallan dependency_libs="$newdependency_libs" 30265eefee25Smacallan if test "$pass" = dlpreopen; then 30275eefee25Smacallan # Link the dlpreopened libraries before other libraries 30285eefee25Smacallan for deplib in $save_deplibs; do 30295eefee25Smacallan deplibs="$deplib $deplibs" 30305eefee25Smacallan done 30315eefee25Smacallan fi 30325eefee25Smacallan if test "$pass" != dlopen; then 30335eefee25Smacallan if test "$pass" != conv; then 30345eefee25Smacallan # Make sure lib_search_path contains only unique directories. 30355eefee25Smacallan lib_search_path= 30365eefee25Smacallan for dir in $newlib_search_path; do 30375eefee25Smacallan case "$lib_search_path " in 30385eefee25Smacallan *" $dir "*) ;; 30395eefee25Smacallan *) lib_search_path="$lib_search_path $dir" ;; 30405eefee25Smacallan esac 30415eefee25Smacallan done 30425eefee25Smacallan newlib_search_path= 30435eefee25Smacallan fi 30445eefee25Smacallan 30455eefee25Smacallan if test "$linkmode,$pass" != "prog,link"; then 30465eefee25Smacallan vars="deplibs" 30475eefee25Smacallan else 30485eefee25Smacallan vars="compile_deplibs finalize_deplibs" 30495eefee25Smacallan fi 30505eefee25Smacallan for var in $vars dependency_libs; do 30515eefee25Smacallan # Add libraries to $var in reverse order 30525eefee25Smacallan eval tmp_libs=\"\$$var\" 30535eefee25Smacallan new_libs= 30545eefee25Smacallan for deplib in $tmp_libs; do 30555eefee25Smacallan # FIXME: Pedantically, this is the right thing to do, so 30565eefee25Smacallan # that some nasty dependency loop isn't accidentally 30575eefee25Smacallan # broken: 30585eefee25Smacallan #new_libs="$deplib $new_libs" 30595eefee25Smacallan # Pragmatically, this seems to cause very few problems in 30605eefee25Smacallan # practice: 30615eefee25Smacallan case $deplib in 30625eefee25Smacallan -L*) new_libs="$deplib $new_libs" ;; 30635eefee25Smacallan -R*) ;; 30645eefee25Smacallan *) 30655eefee25Smacallan # And here is the reason: when a library appears more 30665eefee25Smacallan # than once as an explicit dependence of a library, or 30675eefee25Smacallan # is implicitly linked in more than once by the 30685eefee25Smacallan # compiler, it is considered special, and multiple 30695eefee25Smacallan # occurrences thereof are not removed. Compare this 30705eefee25Smacallan # with having the same library being listed as a 30715eefee25Smacallan # dependency of multiple other libraries: in this case, 30725eefee25Smacallan # we know (pedantically, we assume) the library does not 30735eefee25Smacallan # need to be listed more than once, so we keep only the 30745eefee25Smacallan # last copy. This is not always right, but it is rare 30755eefee25Smacallan # enough that we require users that really mean to play 30765eefee25Smacallan # such unportable linking tricks to link the library 30775eefee25Smacallan # using -Wl,-lname, so that libtool does not consider it 30785eefee25Smacallan # for duplicate removal. 30795eefee25Smacallan case " $specialdeplibs " in 30805eefee25Smacallan *" $deplib "*) new_libs="$deplib $new_libs" ;; 30815eefee25Smacallan *) 30825eefee25Smacallan case " $new_libs " in 30835eefee25Smacallan *" $deplib "*) ;; 30845eefee25Smacallan *) new_libs="$deplib $new_libs" ;; 30855eefee25Smacallan esac 30865eefee25Smacallan ;; 30875eefee25Smacallan esac 30885eefee25Smacallan ;; 30895eefee25Smacallan esac 30905eefee25Smacallan done 30915eefee25Smacallan tmp_libs= 30925eefee25Smacallan for deplib in $new_libs; do 30935eefee25Smacallan case $deplib in 30945eefee25Smacallan -L*) 30955eefee25Smacallan case " $tmp_libs " in 30965eefee25Smacallan *" $deplib "*) ;; 30975eefee25Smacallan *) tmp_libs="$tmp_libs $deplib" ;; 30985eefee25Smacallan esac 30995eefee25Smacallan ;; 31005eefee25Smacallan *) tmp_libs="$tmp_libs $deplib" ;; 31015eefee25Smacallan esac 31025eefee25Smacallan done 31035eefee25Smacallan eval $var=\"$tmp_libs\" 31045eefee25Smacallan done # for var 31055eefee25Smacallan fi 31065eefee25Smacallan # Last step: remove runtime libs from dependency_libs 31075eefee25Smacallan # (they stay in deplibs) 31085eefee25Smacallan tmp_libs= 31095eefee25Smacallan for i in $dependency_libs ; do 31105eefee25Smacallan case " $predeps $postdeps $compiler_lib_search_path " in 31115eefee25Smacallan *" $i "*) 31125eefee25Smacallan i="" 31135eefee25Smacallan ;; 31145eefee25Smacallan esac 31155eefee25Smacallan if test -n "$i" ; then 31165eefee25Smacallan tmp_libs="$tmp_libs $i" 31175eefee25Smacallan fi 31185eefee25Smacallan done 31195eefee25Smacallan dependency_libs=$tmp_libs 31205eefee25Smacallan done # for pass 31215eefee25Smacallan if test "$linkmode" = prog; then 31225eefee25Smacallan dlfiles="$newdlfiles" 31235eefee25Smacallan dlprefiles="$newdlprefiles" 31245eefee25Smacallan fi 31255eefee25Smacallan 31265eefee25Smacallan case $linkmode in 31275eefee25Smacallan oldlib) 312862ab96baSmrg case " $deplibs" in 312962ab96baSmrg *\ -l* | *\ -L*) 313062ab96baSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 313162ab96baSmrg esac 31325eefee25Smacallan 31335eefee25Smacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 31345eefee25Smacallan $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 31355eefee25Smacallan fi 31365eefee25Smacallan 31375eefee25Smacallan if test -n "$rpath"; then 31385eefee25Smacallan $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 31395eefee25Smacallan fi 31405eefee25Smacallan 31415eefee25Smacallan if test -n "$xrpath"; then 31425eefee25Smacallan $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 31435eefee25Smacallan fi 31445eefee25Smacallan 31455eefee25Smacallan if test -n "$vinfo"; then 31465eefee25Smacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 31475eefee25Smacallan fi 31485eefee25Smacallan 31495eefee25Smacallan if test -n "$release"; then 31505eefee25Smacallan $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 31515eefee25Smacallan fi 31525eefee25Smacallan 31535eefee25Smacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 31545eefee25Smacallan $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 31555eefee25Smacallan fi 31565eefee25Smacallan 31575eefee25Smacallan # Now set the variables for building old libraries. 31585eefee25Smacallan build_libtool_libs=no 31595eefee25Smacallan oldlibs="$output" 31605eefee25Smacallan objs="$objs$old_deplibs" 31615eefee25Smacallan ;; 31625eefee25Smacallan 31635eefee25Smacallan lib) 31645eefee25Smacallan # Make sure we only generate libraries of the form `libNAME.la'. 31655eefee25Smacallan case $outputname in 31665eefee25Smacallan lib*) 31675eefee25Smacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 31685eefee25Smacallan eval shared_ext=\"$shrext_cmds\" 31695eefee25Smacallan eval libname=\"$libname_spec\" 31705eefee25Smacallan ;; 31715eefee25Smacallan *) 31725eefee25Smacallan if test "$module" = no; then 31735eefee25Smacallan $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 31745eefee25Smacallan $echo "$help" 1>&2 31755eefee25Smacallan exit $EXIT_FAILURE 31765eefee25Smacallan fi 31775eefee25Smacallan if test "$need_lib_prefix" != no; then 31785eefee25Smacallan # Add the "lib" prefix for modules if required 31795eefee25Smacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31805eefee25Smacallan eval shared_ext=\"$shrext_cmds\" 31815eefee25Smacallan eval libname=\"$libname_spec\" 31825eefee25Smacallan else 31835eefee25Smacallan libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31845eefee25Smacallan fi 31855eefee25Smacallan ;; 31865eefee25Smacallan esac 31875eefee25Smacallan 31885eefee25Smacallan if test -n "$objs"; then 31895eefee25Smacallan if test "$deplibs_check_method" != pass_all; then 31905eefee25Smacallan $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 31915eefee25Smacallan exit $EXIT_FAILURE 31925eefee25Smacallan else 31935eefee25Smacallan $echo 31945eefee25Smacallan $echo "*** Warning: Linking the shared library $output against the non-libtool" 31955eefee25Smacallan $echo "*** objects $objs is not portable!" 31965eefee25Smacallan libobjs="$libobjs $objs" 31975eefee25Smacallan fi 31985eefee25Smacallan fi 31995eefee25Smacallan 32005eefee25Smacallan if test "$dlself" != no; then 32015eefee25Smacallan $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 32025eefee25Smacallan fi 32035eefee25Smacallan 32045eefee25Smacallan set dummy $rpath 32055eefee25Smacallan if test "$#" -gt 2; then 32065eefee25Smacallan $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 32075eefee25Smacallan fi 32085eefee25Smacallan install_libdir="$2" 32095eefee25Smacallan 32105eefee25Smacallan oldlibs= 32115eefee25Smacallan if test -z "$rpath"; then 32125eefee25Smacallan if test "$build_libtool_libs" = yes; then 32135eefee25Smacallan # Building a libtool convenience library. 32145eefee25Smacallan # Some compilers have problems with a `.al' extension so 32155eefee25Smacallan # convenience libraries should have the same extension an 32165eefee25Smacallan # archive normally would. 32175eefee25Smacallan oldlibs="$output_objdir/$libname.$libext $oldlibs" 32185eefee25Smacallan build_libtool_libs=convenience 32195eefee25Smacallan build_old_libs=yes 32205eefee25Smacallan fi 32215eefee25Smacallan 32225eefee25Smacallan if test -n "$vinfo"; then 32235eefee25Smacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 32245eefee25Smacallan fi 32255eefee25Smacallan 32265eefee25Smacallan if test -n "$release"; then 32275eefee25Smacallan $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 32285eefee25Smacallan fi 32295eefee25Smacallan else 32305eefee25Smacallan 32315eefee25Smacallan # Parse the version information argument. 32325eefee25Smacallan save_ifs="$IFS"; IFS=':' 32335eefee25Smacallan set dummy $vinfo 0 0 0 32345eefee25Smacallan IFS="$save_ifs" 32355eefee25Smacallan 32365eefee25Smacallan if test -n "$8"; then 32375eefee25Smacallan $echo "$modename: too many parameters to \`-version-info'" 1>&2 32385eefee25Smacallan $echo "$help" 1>&2 32395eefee25Smacallan exit $EXIT_FAILURE 32405eefee25Smacallan fi 32415eefee25Smacallan 32425eefee25Smacallan # convert absolute version numbers to libtool ages 32435eefee25Smacallan # this retains compatibility with .la files and attempts 32445eefee25Smacallan # to make the code below a bit more comprehensible 32455eefee25Smacallan 32465eefee25Smacallan case $vinfo_number in 32475eefee25Smacallan yes) 32485eefee25Smacallan number_major="$2" 32495eefee25Smacallan number_minor="$3" 32505eefee25Smacallan number_revision="$4" 32515eefee25Smacallan # 32525eefee25Smacallan # There are really only two kinds -- those that 32535eefee25Smacallan # use the current revision as the major version 32545eefee25Smacallan # and those that subtract age and use age as 32555eefee25Smacallan # a minor version. But, then there is irix 32565eefee25Smacallan # which has an extra 1 added just for fun 32575eefee25Smacallan # 32585eefee25Smacallan case $version_type in 325962ab96baSmrg darwin|linux|osf|windows|none) 32605eefee25Smacallan current=`expr $number_major + $number_minor` 32615eefee25Smacallan age="$number_minor" 32625eefee25Smacallan revision="$number_revision" 32635eefee25Smacallan ;; 32645eefee25Smacallan freebsd-aout|freebsd-elf|sunos) 32655eefee25Smacallan current="$number_major" 32665eefee25Smacallan revision="$number_minor" 32675eefee25Smacallan age="0" 32685eefee25Smacallan ;; 32695eefee25Smacallan irix|nonstopux) 327062ab96baSmrg current=`expr $number_major + $number_minor` 32715eefee25Smacallan age="$number_minor" 32725eefee25Smacallan revision="$number_minor" 327362ab96baSmrg lt_irix_increment=no 327462ab96baSmrg ;; 327562ab96baSmrg *) 327662ab96baSmrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 327762ab96baSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 327862ab96baSmrg exit $EXIT_FAILURE 32795eefee25Smacallan ;; 32805eefee25Smacallan esac 32815eefee25Smacallan ;; 32825eefee25Smacallan no) 32835eefee25Smacallan current="$2" 32845eefee25Smacallan revision="$3" 32855eefee25Smacallan age="$4" 32865eefee25Smacallan ;; 32875eefee25Smacallan esac 32885eefee25Smacallan 32895eefee25Smacallan # Check that each of the things are valid numbers. 32905eefee25Smacallan case $current in 32915eefee25Smacallan 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]) ;; 32925eefee25Smacallan *) 32935eefee25Smacallan $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 32945eefee25Smacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32955eefee25Smacallan exit $EXIT_FAILURE 32965eefee25Smacallan ;; 32975eefee25Smacallan esac 32985eefee25Smacallan 32995eefee25Smacallan case $revision in 33005eefee25Smacallan 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]) ;; 33015eefee25Smacallan *) 33025eefee25Smacallan $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 33035eefee25Smacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33045eefee25Smacallan exit $EXIT_FAILURE 33055eefee25Smacallan ;; 33065eefee25Smacallan esac 33075eefee25Smacallan 33085eefee25Smacallan case $age in 33095eefee25Smacallan 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]) ;; 33105eefee25Smacallan *) 33115eefee25Smacallan $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 33125eefee25Smacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33135eefee25Smacallan exit $EXIT_FAILURE 33145eefee25Smacallan ;; 33155eefee25Smacallan esac 33165eefee25Smacallan 33175eefee25Smacallan if test "$age" -gt "$current"; then 33185eefee25Smacallan $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 33195eefee25Smacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33205eefee25Smacallan exit $EXIT_FAILURE 33215eefee25Smacallan fi 33225eefee25Smacallan 33235eefee25Smacallan # Calculate the version variables. 33245eefee25Smacallan major= 33255eefee25Smacallan versuffix= 33265eefee25Smacallan verstring= 33275eefee25Smacallan case $version_type in 33285eefee25Smacallan none) ;; 33295eefee25Smacallan 33305eefee25Smacallan darwin) 33315eefee25Smacallan # Like Linux, but with the current version available in 33325eefee25Smacallan # verstring for coding it into the library header 33335eefee25Smacallan major=.`expr $current - $age` 33345eefee25Smacallan versuffix="$major.$age.$revision" 33355eefee25Smacallan # Darwin ld doesn't like 0 for these options... 33365eefee25Smacallan minor_current=`expr $current + 1` 333762ab96baSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 333862ab96baSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 33395eefee25Smacallan ;; 33405eefee25Smacallan 33415eefee25Smacallan freebsd-aout) 33425eefee25Smacallan major=".$current" 33435eefee25Smacallan versuffix=".$current.$revision"; 33445eefee25Smacallan ;; 33455eefee25Smacallan 33465eefee25Smacallan freebsd-elf) 33475eefee25Smacallan major=".$current" 33485eefee25Smacallan versuffix=".$current"; 33495eefee25Smacallan ;; 33505eefee25Smacallan 33515eefee25Smacallan irix | nonstopux) 335262ab96baSmrg if test "X$lt_irix_increment" = "Xno"; then 335362ab96baSmrg major=`expr $current - $age` 335462ab96baSmrg else 335562ab96baSmrg major=`expr $current - $age + 1` 335662ab96baSmrg fi 33575eefee25Smacallan case $version_type in 33585eefee25Smacallan nonstopux) verstring_prefix=nonstopux ;; 33595eefee25Smacallan *) verstring_prefix=sgi ;; 33605eefee25Smacallan esac 33615eefee25Smacallan verstring="$verstring_prefix$major.$revision" 33625eefee25Smacallan 33635eefee25Smacallan # Add in all the interfaces that we are compatible with. 33645eefee25Smacallan loop=$revision 33655eefee25Smacallan while test "$loop" -ne 0; do 33665eefee25Smacallan iface=`expr $revision - $loop` 33675eefee25Smacallan loop=`expr $loop - 1` 33685eefee25Smacallan verstring="$verstring_prefix$major.$iface:$verstring" 33695eefee25Smacallan done 33705eefee25Smacallan 33715eefee25Smacallan # Before this point, $major must not contain `.'. 33725eefee25Smacallan major=.$major 33735eefee25Smacallan versuffix="$major.$revision" 33745eefee25Smacallan ;; 33755eefee25Smacallan 33765eefee25Smacallan linux) 33775eefee25Smacallan major=.`expr $current - $age` 33785eefee25Smacallan versuffix="$major.$age.$revision" 33795eefee25Smacallan ;; 33805eefee25Smacallan 33815eefee25Smacallan osf) 33825eefee25Smacallan major=.`expr $current - $age` 33835eefee25Smacallan versuffix=".$current.$age.$revision" 33845eefee25Smacallan verstring="$current.$age.$revision" 33855eefee25Smacallan 33865eefee25Smacallan # Add in all the interfaces that we are compatible with. 33875eefee25Smacallan loop=$age 33885eefee25Smacallan while test "$loop" -ne 0; do 33895eefee25Smacallan iface=`expr $current - $loop` 33905eefee25Smacallan loop=`expr $loop - 1` 33915eefee25Smacallan verstring="$verstring:${iface}.0" 33925eefee25Smacallan done 33935eefee25Smacallan 33945eefee25Smacallan # Make executables depend on our current version. 33955eefee25Smacallan verstring="$verstring:${current}.0" 33965eefee25Smacallan ;; 33975eefee25Smacallan 33985eefee25Smacallan sunos) 33995eefee25Smacallan major=".$current" 34005eefee25Smacallan versuffix=".$current.$revision" 34015eefee25Smacallan ;; 34025eefee25Smacallan 34035eefee25Smacallan windows) 34045eefee25Smacallan # Use '-' rather than '.', since we only want one 34055eefee25Smacallan # extension on DOS 8.3 filesystems. 34065eefee25Smacallan major=`expr $current - $age` 34075eefee25Smacallan versuffix="-$major" 34085eefee25Smacallan ;; 34095eefee25Smacallan 34105eefee25Smacallan *) 34115eefee25Smacallan $echo "$modename: unknown library version type \`$version_type'" 1>&2 34125eefee25Smacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 34135eefee25Smacallan exit $EXIT_FAILURE 34145eefee25Smacallan ;; 34155eefee25Smacallan esac 34165eefee25Smacallan 34175eefee25Smacallan # Clear the version info if we defaulted, and they specified a release. 34185eefee25Smacallan if test -z "$vinfo" && test -n "$release"; then 34195eefee25Smacallan major= 34205eefee25Smacallan case $version_type in 34215eefee25Smacallan darwin) 34225eefee25Smacallan # we can't check for "0.0" in archive_cmds due to quoting 34235eefee25Smacallan # problems, so we reset it completely 34245eefee25Smacallan verstring= 34255eefee25Smacallan ;; 34265eefee25Smacallan *) 34275eefee25Smacallan verstring="0.0" 34285eefee25Smacallan ;; 34295eefee25Smacallan esac 34305eefee25Smacallan if test "$need_version" = no; then 34315eefee25Smacallan versuffix= 34325eefee25Smacallan else 34335eefee25Smacallan versuffix=".0.0" 34345eefee25Smacallan fi 34355eefee25Smacallan fi 34365eefee25Smacallan 34375eefee25Smacallan # Remove version info from name if versioning should be avoided 34385eefee25Smacallan if test "$avoid_version" = yes && test "$need_version" = no; then 34395eefee25Smacallan major= 34405eefee25Smacallan versuffix= 34415eefee25Smacallan verstring="" 34425eefee25Smacallan fi 34435eefee25Smacallan 34445eefee25Smacallan # Check to see if the archive will have undefined symbols. 34455eefee25Smacallan if test "$allow_undefined" = yes; then 34465eefee25Smacallan if test "$allow_undefined_flag" = unsupported; then 34475eefee25Smacallan $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 34485eefee25Smacallan build_libtool_libs=no 34495eefee25Smacallan build_old_libs=yes 34505eefee25Smacallan fi 34515eefee25Smacallan else 34525eefee25Smacallan # Don't allow undefined symbols. 34535eefee25Smacallan allow_undefined_flag="$no_undefined_flag" 34545eefee25Smacallan fi 34555eefee25Smacallan fi 34565eefee25Smacallan 34575eefee25Smacallan if test "$mode" != relink; then 34585eefee25Smacallan # Remove our outputs, but don't remove object files since they 34595eefee25Smacallan # may have been created when compiling PIC objects. 34605eefee25Smacallan removelist= 34615eefee25Smacallan tempremovelist=`$echo "$output_objdir/*"` 34625eefee25Smacallan for p in $tempremovelist; do 34635eefee25Smacallan case $p in 34645eefee25Smacallan *.$objext) 34655eefee25Smacallan ;; 34665eefee25Smacallan $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 34675eefee25Smacallan if test "X$precious_files_regex" != "X"; then 34685eefee25Smacallan if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 34695eefee25Smacallan then 34705eefee25Smacallan continue 34715eefee25Smacallan fi 34725eefee25Smacallan fi 34735eefee25Smacallan removelist="$removelist $p" 34745eefee25Smacallan ;; 34755eefee25Smacallan *) ;; 34765eefee25Smacallan esac 34775eefee25Smacallan done 34785eefee25Smacallan if test -n "$removelist"; then 34795eefee25Smacallan $show "${rm}r $removelist" 34805eefee25Smacallan $run ${rm}r $removelist 34815eefee25Smacallan fi 34825eefee25Smacallan fi 34835eefee25Smacallan 34845eefee25Smacallan # Now set the variables for building old libraries. 34855eefee25Smacallan if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 34865eefee25Smacallan oldlibs="$oldlibs $output_objdir/$libname.$libext" 34875eefee25Smacallan 34885eefee25Smacallan # Transform .lo files to .o files. 34895eefee25Smacallan oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 34905eefee25Smacallan fi 34915eefee25Smacallan 34925eefee25Smacallan # Eliminate all temporary directories. 349362ab96baSmrg #for path in $notinst_path; do 349462ab96baSmrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 349562ab96baSmrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 349662ab96baSmrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 349762ab96baSmrg #done 34985eefee25Smacallan 34995eefee25Smacallan if test -n "$xrpath"; then 35005eefee25Smacallan # If the user specified any rpath flags, then add them. 35015eefee25Smacallan temp_xrpath= 35025eefee25Smacallan for libdir in $xrpath; do 35035eefee25Smacallan temp_xrpath="$temp_xrpath -R$libdir" 35045eefee25Smacallan case "$finalize_rpath " in 35055eefee25Smacallan *" $libdir "*) ;; 35065eefee25Smacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 35075eefee25Smacallan esac 35085eefee25Smacallan done 35095eefee25Smacallan if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 35105eefee25Smacallan dependency_libs="$temp_xrpath $dependency_libs" 35115eefee25Smacallan fi 35125eefee25Smacallan fi 35135eefee25Smacallan 35145eefee25Smacallan # Make sure dlfiles contains only unique files that won't be dlpreopened 35155eefee25Smacallan old_dlfiles="$dlfiles" 35165eefee25Smacallan dlfiles= 35175eefee25Smacallan for lib in $old_dlfiles; do 35185eefee25Smacallan case " $dlprefiles $dlfiles " in 35195eefee25Smacallan *" $lib "*) ;; 35205eefee25Smacallan *) dlfiles="$dlfiles $lib" ;; 35215eefee25Smacallan esac 35225eefee25Smacallan done 35235eefee25Smacallan 35245eefee25Smacallan # Make sure dlprefiles contains only unique files 35255eefee25Smacallan old_dlprefiles="$dlprefiles" 35265eefee25Smacallan dlprefiles= 35275eefee25Smacallan for lib in $old_dlprefiles; do 35285eefee25Smacallan case "$dlprefiles " in 35295eefee25Smacallan *" $lib "*) ;; 35305eefee25Smacallan *) dlprefiles="$dlprefiles $lib" ;; 35315eefee25Smacallan esac 35325eefee25Smacallan done 35335eefee25Smacallan 35345eefee25Smacallan if test "$build_libtool_libs" = yes; then 35355eefee25Smacallan if test -n "$rpath"; then 35365eefee25Smacallan case $host in 35375eefee25Smacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 35385eefee25Smacallan # these systems don't actually have a c library (as such)! 35395eefee25Smacallan ;; 35405eefee25Smacallan *-*-rhapsody* | *-*-darwin1.[012]) 35415eefee25Smacallan # Rhapsody C library is in the System framework 35425eefee25Smacallan deplibs="$deplibs -framework System" 35435eefee25Smacallan ;; 35445eefee25Smacallan *-*-netbsd*) 35455eefee25Smacallan # Don't link with libc until the a.out ld.so is fixed. 35465eefee25Smacallan ;; 35475eefee25Smacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 35485eefee25Smacallan # Do not include libc due to us having libc/libc_r. 35495eefee25Smacallan ;; 35505eefee25Smacallan *-*-sco3.2v5* | *-*-sco5v6*) 35515eefee25Smacallan # Causes problems with __ctype 35525eefee25Smacallan ;; 35535eefee25Smacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 35545eefee25Smacallan # Compiler inserts libc in the correct place for threads to work 35555eefee25Smacallan ;; 35565eefee25Smacallan *) 35575eefee25Smacallan # Add libc to deplibs on all other systems if necessary. 35585eefee25Smacallan if test "$build_libtool_need_lc" = "yes"; then 35595eefee25Smacallan deplibs="$deplibs -lc" 35605eefee25Smacallan fi 35615eefee25Smacallan ;; 35625eefee25Smacallan esac 35635eefee25Smacallan fi 35645eefee25Smacallan 35655eefee25Smacallan # Transform deplibs into only deplibs that can be linked in shared. 35665eefee25Smacallan name_save=$name 35675eefee25Smacallan libname_save=$libname 35685eefee25Smacallan release_save=$release 35695eefee25Smacallan versuffix_save=$versuffix 35705eefee25Smacallan major_save=$major 35715eefee25Smacallan # I'm not sure if I'm treating the release correctly. I think 35725eefee25Smacallan # release should show up in the -l (ie -lgmp5) so we don't want to 35735eefee25Smacallan # add it in twice. Is that correct? 35745eefee25Smacallan release="" 35755eefee25Smacallan versuffix="" 35765eefee25Smacallan major="" 35775eefee25Smacallan newdeplibs= 35785eefee25Smacallan droppeddeps=no 35795eefee25Smacallan case $deplibs_check_method in 35805eefee25Smacallan pass_all) 35815eefee25Smacallan # Don't check for shared/static. Everything works. 35825eefee25Smacallan # This might be a little naive. We might want to check 35835eefee25Smacallan # whether the library exists or not. But this is on 35845eefee25Smacallan # osf3 & osf4 and I'm not really sure... Just 35855eefee25Smacallan # implementing what was already the behavior. 35865eefee25Smacallan newdeplibs=$deplibs 35875eefee25Smacallan ;; 35885eefee25Smacallan test_compile) 35895eefee25Smacallan # This code stresses the "libraries are programs" paradigm to its 35905eefee25Smacallan # limits. Maybe even breaks it. We compile a program, linking it 35915eefee25Smacallan # against the deplibs as a proxy for the library. Then we can check 35925eefee25Smacallan # whether they linked in statically or dynamically with ldd. 35935eefee25Smacallan $rm conftest.c 35945eefee25Smacallan cat > conftest.c <<EOF 35955eefee25Smacallan int main() { return 0; } 35965eefee25SmacallanEOF 35975eefee25Smacallan $rm conftest 359862ab96baSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 35995eefee25Smacallan ldd_output=`ldd conftest` 36005eefee25Smacallan for i in $deplibs; do 36015eefee25Smacallan name=`expr $i : '-l\(.*\)'` 36025eefee25Smacallan # If $name is empty we are operating on a -L argument. 360362ab96baSmrg if test "$name" != "" && test "$name" != "0"; then 36045eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36055eefee25Smacallan case " $predeps $postdeps " in 36065eefee25Smacallan *" $i "*) 36075eefee25Smacallan newdeplibs="$newdeplibs $i" 36085eefee25Smacallan i="" 36095eefee25Smacallan ;; 36105eefee25Smacallan esac 36115eefee25Smacallan fi 36125eefee25Smacallan if test -n "$i" ; then 36135eefee25Smacallan libname=`eval \\$echo \"$libname_spec\"` 36145eefee25Smacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 36155eefee25Smacallan set dummy $deplib_matches 36165eefee25Smacallan deplib_match=$2 36175eefee25Smacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36185eefee25Smacallan newdeplibs="$newdeplibs $i" 36195eefee25Smacallan else 36205eefee25Smacallan droppeddeps=yes 36215eefee25Smacallan $echo 36225eefee25Smacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 36235eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 36245eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 36255eefee25Smacallan $echo "*** shared version of the library, which I believe you do not have" 36265eefee25Smacallan $echo "*** because a test_compile did reveal that the linker did not use it for" 36275eefee25Smacallan $echo "*** its dynamic dependency list that programs get resolved with at runtime." 36285eefee25Smacallan fi 36295eefee25Smacallan fi 36305eefee25Smacallan else 36315eefee25Smacallan newdeplibs="$newdeplibs $i" 36325eefee25Smacallan fi 36335eefee25Smacallan done 36345eefee25Smacallan else 36355eefee25Smacallan # Error occurred in the first compile. Let's try to salvage 36365eefee25Smacallan # the situation: Compile a separate program for each library. 36375eefee25Smacallan for i in $deplibs; do 36385eefee25Smacallan name=`expr $i : '-l\(.*\)'` 36395eefee25Smacallan # If $name is empty we are operating on a -L argument. 36405eefee25Smacallan if test "$name" != "" && test "$name" != "0"; then 36415eefee25Smacallan $rm conftest 364262ab96baSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 36435eefee25Smacallan ldd_output=`ldd conftest` 36445eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36455eefee25Smacallan case " $predeps $postdeps " in 36465eefee25Smacallan *" $i "*) 36475eefee25Smacallan newdeplibs="$newdeplibs $i" 36485eefee25Smacallan i="" 36495eefee25Smacallan ;; 36505eefee25Smacallan esac 36515eefee25Smacallan fi 36525eefee25Smacallan if test -n "$i" ; then 36535eefee25Smacallan libname=`eval \\$echo \"$libname_spec\"` 36545eefee25Smacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 36555eefee25Smacallan set dummy $deplib_matches 36565eefee25Smacallan deplib_match=$2 36575eefee25Smacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36585eefee25Smacallan newdeplibs="$newdeplibs $i" 36595eefee25Smacallan else 36605eefee25Smacallan droppeddeps=yes 36615eefee25Smacallan $echo 36625eefee25Smacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 36635eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 36645eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 36655eefee25Smacallan $echo "*** shared version of the library, which you do not appear to have" 36665eefee25Smacallan $echo "*** because a test_compile did reveal that the linker did not use this one" 36675eefee25Smacallan $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 36685eefee25Smacallan fi 36695eefee25Smacallan fi 36705eefee25Smacallan else 36715eefee25Smacallan droppeddeps=yes 36725eefee25Smacallan $echo 36735eefee25Smacallan $echo "*** Warning! Library $i is needed by this library but I was not able to" 367462ab96baSmrg $echo "*** make it link in! You will probably need to install it or some" 36755eefee25Smacallan $echo "*** library that it depends on before this library will be fully" 36765eefee25Smacallan $echo "*** functional. Installing it before continuing would be even better." 36775eefee25Smacallan fi 36785eefee25Smacallan else 36795eefee25Smacallan newdeplibs="$newdeplibs $i" 36805eefee25Smacallan fi 36815eefee25Smacallan done 36825eefee25Smacallan fi 36835eefee25Smacallan ;; 36845eefee25Smacallan file_magic*) 36855eefee25Smacallan set dummy $deplibs_check_method 36865eefee25Smacallan file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36875eefee25Smacallan for a_deplib in $deplibs; do 36885eefee25Smacallan name=`expr $a_deplib : '-l\(.*\)'` 36895eefee25Smacallan # If $name is empty we are operating on a -L argument. 36905eefee25Smacallan if test "$name" != "" && test "$name" != "0"; then 36915eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36925eefee25Smacallan case " $predeps $postdeps " in 36935eefee25Smacallan *" $a_deplib "*) 36945eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 36955eefee25Smacallan a_deplib="" 36965eefee25Smacallan ;; 36975eefee25Smacallan esac 36985eefee25Smacallan fi 36995eefee25Smacallan if test -n "$a_deplib" ; then 37005eefee25Smacallan libname=`eval \\$echo \"$libname_spec\"` 37015eefee25Smacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37025eefee25Smacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37035eefee25Smacallan for potent_lib in $potential_libs; do 37045eefee25Smacallan # Follow soft links. 37055eefee25Smacallan if ls -lLd "$potent_lib" 2>/dev/null \ 37065eefee25Smacallan | grep " -> " >/dev/null; then 37075eefee25Smacallan continue 37085eefee25Smacallan fi 37095eefee25Smacallan # The statement above tries to avoid entering an 37105eefee25Smacallan # endless loop below, in case of cyclic links. 37115eefee25Smacallan # We might still enter an endless loop, since a link 37125eefee25Smacallan # loop can be closed while we follow links, 37135eefee25Smacallan # but so what? 37145eefee25Smacallan potlib="$potent_lib" 37155eefee25Smacallan while test -h "$potlib" 2>/dev/null; do 37165eefee25Smacallan potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 37175eefee25Smacallan case $potliblink in 37185eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 37195eefee25Smacallan *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 37205eefee25Smacallan esac 37215eefee25Smacallan done 37225eefee25Smacallan if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 37235eefee25Smacallan | ${SED} 10q \ 37245eefee25Smacallan | $EGREP "$file_magic_regex" > /dev/null; then 37255eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 37265eefee25Smacallan a_deplib="" 37275eefee25Smacallan break 2 37285eefee25Smacallan fi 37295eefee25Smacallan done 37305eefee25Smacallan done 37315eefee25Smacallan fi 37325eefee25Smacallan if test -n "$a_deplib" ; then 37335eefee25Smacallan droppeddeps=yes 37345eefee25Smacallan $echo 37355eefee25Smacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 37365eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 37375eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 37385eefee25Smacallan $echo "*** shared version of the library, which you do not appear to have" 37395eefee25Smacallan $echo "*** because I did check the linker path looking for a file starting" 37405eefee25Smacallan if test -z "$potlib" ; then 37415eefee25Smacallan $echo "*** with $libname but no candidates were found. (...for file magic test)" 37425eefee25Smacallan else 37435eefee25Smacallan $echo "*** with $libname and none of the candidates passed a file format test" 37445eefee25Smacallan $echo "*** using a file magic. Last file checked: $potlib" 37455eefee25Smacallan fi 37465eefee25Smacallan fi 37475eefee25Smacallan else 37485eefee25Smacallan # Add a -L argument. 37495eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 37505eefee25Smacallan fi 37515eefee25Smacallan done # Gone through all deplibs. 37525eefee25Smacallan ;; 37535eefee25Smacallan match_pattern*) 37545eefee25Smacallan set dummy $deplibs_check_method 37555eefee25Smacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 37565eefee25Smacallan for a_deplib in $deplibs; do 37575eefee25Smacallan name=`expr $a_deplib : '-l\(.*\)'` 37585eefee25Smacallan # If $name is empty we are operating on a -L argument. 37595eefee25Smacallan if test -n "$name" && test "$name" != "0"; then 37605eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37615eefee25Smacallan case " $predeps $postdeps " in 37625eefee25Smacallan *" $a_deplib "*) 37635eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 37645eefee25Smacallan a_deplib="" 37655eefee25Smacallan ;; 37665eefee25Smacallan esac 37675eefee25Smacallan fi 37685eefee25Smacallan if test -n "$a_deplib" ; then 37695eefee25Smacallan libname=`eval \\$echo \"$libname_spec\"` 37705eefee25Smacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37715eefee25Smacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37725eefee25Smacallan for potent_lib in $potential_libs; do 37735eefee25Smacallan potlib="$potent_lib" # see symlink-check above in file_magic test 37745eefee25Smacallan if eval $echo \"$potent_lib\" 2>/dev/null \ 37755eefee25Smacallan | ${SED} 10q \ 37765eefee25Smacallan | $EGREP "$match_pattern_regex" > /dev/null; then 37775eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 37785eefee25Smacallan a_deplib="" 37795eefee25Smacallan break 2 37805eefee25Smacallan fi 37815eefee25Smacallan done 37825eefee25Smacallan done 37835eefee25Smacallan fi 37845eefee25Smacallan if test -n "$a_deplib" ; then 37855eefee25Smacallan droppeddeps=yes 37865eefee25Smacallan $echo 37875eefee25Smacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 37885eefee25Smacallan $echo "*** I have the capability to make that library automatically link in when" 37895eefee25Smacallan $echo "*** you link to this library. But I can only do this if you have a" 37905eefee25Smacallan $echo "*** shared version of the library, which you do not appear to have" 37915eefee25Smacallan $echo "*** because I did check the linker path looking for a file starting" 37925eefee25Smacallan if test -z "$potlib" ; then 37935eefee25Smacallan $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 37945eefee25Smacallan else 37955eefee25Smacallan $echo "*** with $libname and none of the candidates passed a file format test" 37965eefee25Smacallan $echo "*** using a regex pattern. Last file checked: $potlib" 37975eefee25Smacallan fi 37985eefee25Smacallan fi 37995eefee25Smacallan else 38005eefee25Smacallan # Add a -L argument. 38015eefee25Smacallan newdeplibs="$newdeplibs $a_deplib" 38025eefee25Smacallan fi 38035eefee25Smacallan done # Gone through all deplibs. 38045eefee25Smacallan ;; 38055eefee25Smacallan none | unknown | *) 38065eefee25Smacallan newdeplibs="" 38075eefee25Smacallan tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 38085eefee25Smacallan -e 's/ -[LR][^ ]*//g'` 38095eefee25Smacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 38105eefee25Smacallan for i in $predeps $postdeps ; do 38115eefee25Smacallan # can't use Xsed below, because $i might contain '/' 38125eefee25Smacallan tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 38135eefee25Smacallan done 38145eefee25Smacallan fi 38155eefee25Smacallan if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 38165eefee25Smacallan | grep . >/dev/null; then 38175eefee25Smacallan $echo 38185eefee25Smacallan if test "X$deplibs_check_method" = "Xnone"; then 38195eefee25Smacallan $echo "*** Warning: inter-library dependencies are not supported in this platform." 38205eefee25Smacallan else 38215eefee25Smacallan $echo "*** Warning: inter-library dependencies are not known to be supported." 38225eefee25Smacallan fi 38235eefee25Smacallan $echo "*** All declared inter-library dependencies are being dropped." 38245eefee25Smacallan droppeddeps=yes 38255eefee25Smacallan fi 38265eefee25Smacallan ;; 38275eefee25Smacallan esac 38285eefee25Smacallan versuffix=$versuffix_save 38295eefee25Smacallan major=$major_save 38305eefee25Smacallan release=$release_save 38315eefee25Smacallan libname=$libname_save 38325eefee25Smacallan name=$name_save 38335eefee25Smacallan 38345eefee25Smacallan case $host in 38355eefee25Smacallan *-*-rhapsody* | *-*-darwin1.[012]) 38365eefee25Smacallan # On Rhapsody replace the C library is the System framework 38375eefee25Smacallan newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 38385eefee25Smacallan ;; 38395eefee25Smacallan esac 38405eefee25Smacallan 38415eefee25Smacallan if test "$droppeddeps" = yes; then 38425eefee25Smacallan if test "$module" = yes; then 38435eefee25Smacallan $echo 38445eefee25Smacallan $echo "*** Warning: libtool could not satisfy all declared inter-library" 38455eefee25Smacallan $echo "*** dependencies of module $libname. Therefore, libtool will create" 38465eefee25Smacallan $echo "*** a static module, that should work as long as the dlopening" 38475eefee25Smacallan $echo "*** application is linked with the -dlopen flag." 38485eefee25Smacallan if test -z "$global_symbol_pipe"; then 38495eefee25Smacallan $echo 38505eefee25Smacallan $echo "*** However, this would only work if libtool was able to extract symbol" 38515eefee25Smacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 38525eefee25Smacallan $echo "*** not find such a program. So, this module is probably useless." 38535eefee25Smacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 38545eefee25Smacallan fi 38555eefee25Smacallan if test "$build_old_libs" = no; then 38565eefee25Smacallan oldlibs="$output_objdir/$libname.$libext" 38575eefee25Smacallan build_libtool_libs=module 38585eefee25Smacallan build_old_libs=yes 38595eefee25Smacallan else 38605eefee25Smacallan build_libtool_libs=no 38615eefee25Smacallan fi 38625eefee25Smacallan else 38635eefee25Smacallan $echo "*** The inter-library dependencies that have been dropped here will be" 38645eefee25Smacallan $echo "*** automatically added whenever a program is linked with this library" 38655eefee25Smacallan $echo "*** or is declared to -dlopen it." 38665eefee25Smacallan 38675eefee25Smacallan if test "$allow_undefined" = no; then 38685eefee25Smacallan $echo 38695eefee25Smacallan $echo "*** Since this library must not contain undefined symbols," 38705eefee25Smacallan $echo "*** because either the platform does not support them or" 38715eefee25Smacallan $echo "*** it was explicitly requested with -no-undefined," 38725eefee25Smacallan $echo "*** libtool will only create a static version of it." 38735eefee25Smacallan if test "$build_old_libs" = no; then 38745eefee25Smacallan oldlibs="$output_objdir/$libname.$libext" 38755eefee25Smacallan build_libtool_libs=module 38765eefee25Smacallan build_old_libs=yes 38775eefee25Smacallan else 38785eefee25Smacallan build_libtool_libs=no 38795eefee25Smacallan fi 38805eefee25Smacallan fi 38815eefee25Smacallan fi 38825eefee25Smacallan fi 38835eefee25Smacallan # Done checking deplibs! 38845eefee25Smacallan deplibs=$newdeplibs 38855eefee25Smacallan fi 38865eefee25Smacallan 38875eefee25Smacallan 38885eefee25Smacallan # move library search paths that coincide with paths to not yet 38895eefee25Smacallan # installed libraries to the beginning of the library search list 38905eefee25Smacallan new_libs= 38915eefee25Smacallan for path in $notinst_path; do 38925eefee25Smacallan case " $new_libs " in 38935eefee25Smacallan *" -L$path/$objdir "*) ;; 38945eefee25Smacallan *) 38955eefee25Smacallan case " $deplibs " in 38965eefee25Smacallan *" -L$path/$objdir "*) 38975eefee25Smacallan new_libs="$new_libs -L$path/$objdir" ;; 38985eefee25Smacallan esac 38995eefee25Smacallan ;; 39005eefee25Smacallan esac 39015eefee25Smacallan done 39025eefee25Smacallan for deplib in $deplibs; do 39035eefee25Smacallan case $deplib in 39045eefee25Smacallan -L*) 39055eefee25Smacallan case " $new_libs " in 39065eefee25Smacallan *" $deplib "*) ;; 39075eefee25Smacallan *) new_libs="$new_libs $deplib" ;; 39085eefee25Smacallan esac 39095eefee25Smacallan ;; 39105eefee25Smacallan *) new_libs="$new_libs $deplib" ;; 39115eefee25Smacallan esac 39125eefee25Smacallan done 39135eefee25Smacallan deplibs="$new_libs" 39145eefee25Smacallan 39155eefee25Smacallan 39165eefee25Smacallan # All the library-specific variables (install_libdir is set above). 39175eefee25Smacallan library_names= 39185eefee25Smacallan old_library= 39195eefee25Smacallan dlname= 39205eefee25Smacallan 39215eefee25Smacallan # Test again, we may have decided not to build it any more 39225eefee25Smacallan if test "$build_libtool_libs" = yes; then 39235eefee25Smacallan if test "$hardcode_into_libs" = yes; then 39245eefee25Smacallan # Hardcode the library paths 39255eefee25Smacallan hardcode_libdirs= 39265eefee25Smacallan dep_rpath= 39275eefee25Smacallan rpath="$finalize_rpath" 39285eefee25Smacallan test "$mode" != relink && rpath="$compile_rpath$rpath" 39295eefee25Smacallan for libdir in $rpath; do 39305eefee25Smacallan if test -n "$hardcode_libdir_flag_spec"; then 39315eefee25Smacallan if test -n "$hardcode_libdir_separator"; then 39325eefee25Smacallan if test -z "$hardcode_libdirs"; then 39335eefee25Smacallan hardcode_libdirs="$libdir" 39345eefee25Smacallan else 39355eefee25Smacallan # Just accumulate the unique libdirs. 39365eefee25Smacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 39375eefee25Smacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 39385eefee25Smacallan ;; 39395eefee25Smacallan *) 39405eefee25Smacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 39415eefee25Smacallan ;; 39425eefee25Smacallan esac 39435eefee25Smacallan fi 39445eefee25Smacallan else 39455eefee25Smacallan eval flag=\"$hardcode_libdir_flag_spec\" 39465eefee25Smacallan dep_rpath="$dep_rpath $flag" 39475eefee25Smacallan fi 39485eefee25Smacallan elif test -n "$runpath_var"; then 39495eefee25Smacallan case "$perm_rpath " in 39505eefee25Smacallan *" $libdir "*) ;; 39515eefee25Smacallan *) perm_rpath="$perm_rpath $libdir" ;; 39525eefee25Smacallan esac 39535eefee25Smacallan fi 39545eefee25Smacallan done 39555eefee25Smacallan # Substitute the hardcoded libdirs into the rpath. 39565eefee25Smacallan if test -n "$hardcode_libdir_separator" && 39575eefee25Smacallan test -n "$hardcode_libdirs"; then 39585eefee25Smacallan libdir="$hardcode_libdirs" 39595eefee25Smacallan if test -n "$hardcode_libdir_flag_spec_ld"; then 396062ab96baSmrg case $archive_cmds in 396162ab96baSmrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 396262ab96baSmrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 396362ab96baSmrg esac 39645eefee25Smacallan else 39655eefee25Smacallan eval dep_rpath=\"$hardcode_libdir_flag_spec\" 39665eefee25Smacallan fi 39675eefee25Smacallan fi 39685eefee25Smacallan if test -n "$runpath_var" && test -n "$perm_rpath"; then 39695eefee25Smacallan # We should set the runpath_var. 39705eefee25Smacallan rpath= 39715eefee25Smacallan for dir in $perm_rpath; do 39725eefee25Smacallan rpath="$rpath$dir:" 39735eefee25Smacallan done 39745eefee25Smacallan eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 39755eefee25Smacallan fi 39765eefee25Smacallan test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 39775eefee25Smacallan fi 39785eefee25Smacallan 39795eefee25Smacallan shlibpath="$finalize_shlibpath" 39805eefee25Smacallan test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 39815eefee25Smacallan if test -n "$shlibpath"; then 39825eefee25Smacallan eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 39835eefee25Smacallan fi 39845eefee25Smacallan 39855eefee25Smacallan # Get the real and link names of the library. 39865eefee25Smacallan eval shared_ext=\"$shrext_cmds\" 39875eefee25Smacallan eval library_names=\"$library_names_spec\" 39885eefee25Smacallan set dummy $library_names 39895eefee25Smacallan realname="$2" 39905eefee25Smacallan shift; shift 39915eefee25Smacallan 39925eefee25Smacallan if test -n "$soname_spec"; then 39935eefee25Smacallan eval soname=\"$soname_spec\" 39945eefee25Smacallan else 39955eefee25Smacallan soname="$realname" 39965eefee25Smacallan fi 39975eefee25Smacallan if test -z "$dlname"; then 39985eefee25Smacallan dlname=$soname 39995eefee25Smacallan fi 40005eefee25Smacallan 40015eefee25Smacallan lib="$output_objdir/$realname" 40025eefee25Smacallan linknames= 40035eefee25Smacallan for link 40045eefee25Smacallan do 40055eefee25Smacallan linknames="$linknames $link" 40065eefee25Smacallan done 40075eefee25Smacallan 40085eefee25Smacallan # Use standard objects if they are pic 40095eefee25Smacallan test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 40105eefee25Smacallan 40115eefee25Smacallan # Prepare the list of exported symbols 40125eefee25Smacallan if test -z "$export_symbols"; then 40135eefee25Smacallan if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 40145eefee25Smacallan $show "generating symbol list for \`$libname.la'" 40155eefee25Smacallan export_symbols="$output_objdir/$libname.exp" 40165eefee25Smacallan $run $rm $export_symbols 40175eefee25Smacallan cmds=$export_symbols_cmds 40185eefee25Smacallan save_ifs="$IFS"; IFS='~' 40195eefee25Smacallan for cmd in $cmds; do 40205eefee25Smacallan IFS="$save_ifs" 40215eefee25Smacallan eval cmd=\"$cmd\" 40225eefee25Smacallan if len=`expr "X$cmd" : ".*"` && 40235eefee25Smacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40245eefee25Smacallan $show "$cmd" 40255eefee25Smacallan $run eval "$cmd" || exit $? 40265eefee25Smacallan skipped_export=false 40275eefee25Smacallan else 40285eefee25Smacallan # The command line is too long to execute in one step. 40295eefee25Smacallan $show "using reloadable object file for export list..." 40305eefee25Smacallan skipped_export=: 40315eefee25Smacallan # Break out early, otherwise skipped_export may be 40325eefee25Smacallan # set to false by a later but shorter cmd. 40335eefee25Smacallan break 40345eefee25Smacallan fi 40355eefee25Smacallan done 40365eefee25Smacallan IFS="$save_ifs" 40375eefee25Smacallan if test -n "$export_symbols_regex"; then 40385eefee25Smacallan $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 40395eefee25Smacallan $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 40405eefee25Smacallan $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 40415eefee25Smacallan $run eval '$mv "${export_symbols}T" "$export_symbols"' 40425eefee25Smacallan fi 40435eefee25Smacallan fi 40445eefee25Smacallan fi 40455eefee25Smacallan 40465eefee25Smacallan if test -n "$export_symbols" && test -n "$include_expsyms"; then 40475eefee25Smacallan $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 40485eefee25Smacallan fi 40495eefee25Smacallan 40505eefee25Smacallan tmp_deplibs= 40515eefee25Smacallan for test_deplib in $deplibs; do 40525eefee25Smacallan case " $convenience " in 40535eefee25Smacallan *" $test_deplib "*) ;; 40545eefee25Smacallan *) 40555eefee25Smacallan tmp_deplibs="$tmp_deplibs $test_deplib" 40565eefee25Smacallan ;; 40575eefee25Smacallan esac 40585eefee25Smacallan done 40595eefee25Smacallan deplibs="$tmp_deplibs" 40605eefee25Smacallan 40615eefee25Smacallan if test -n "$convenience"; then 40625eefee25Smacallan if test -n "$whole_archive_flag_spec"; then 40635eefee25Smacallan save_libobjs=$libobjs 40645eefee25Smacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 40655eefee25Smacallan else 40665eefee25Smacallan gentop="$output_objdir/${outputname}x" 40675eefee25Smacallan generated="$generated $gentop" 40685eefee25Smacallan 40695eefee25Smacallan func_extract_archives $gentop $convenience 40705eefee25Smacallan libobjs="$libobjs $func_extract_archives_result" 40715eefee25Smacallan fi 40725eefee25Smacallan fi 40735eefee25Smacallan 40745eefee25Smacallan if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 40755eefee25Smacallan eval flag=\"$thread_safe_flag_spec\" 40765eefee25Smacallan linker_flags="$linker_flags $flag" 40775eefee25Smacallan fi 40785eefee25Smacallan 40795eefee25Smacallan # Make a backup of the uninstalled library when relinking 40805eefee25Smacallan if test "$mode" = relink; then 40815eefee25Smacallan $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 40825eefee25Smacallan fi 40835eefee25Smacallan 40845eefee25Smacallan # Do each of the archive commands. 40855eefee25Smacallan if test "$module" = yes && test -n "$module_cmds" ; then 40865eefee25Smacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 40875eefee25Smacallan eval test_cmds=\"$module_expsym_cmds\" 40885eefee25Smacallan cmds=$module_expsym_cmds 40895eefee25Smacallan else 40905eefee25Smacallan eval test_cmds=\"$module_cmds\" 40915eefee25Smacallan cmds=$module_cmds 40925eefee25Smacallan fi 40935eefee25Smacallan else 40945eefee25Smacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 40955eefee25Smacallan eval test_cmds=\"$archive_expsym_cmds\" 40965eefee25Smacallan cmds=$archive_expsym_cmds 40975eefee25Smacallan else 40985eefee25Smacallan eval test_cmds=\"$archive_cmds\" 40995eefee25Smacallan cmds=$archive_cmds 41005eefee25Smacallan fi 41015eefee25Smacallan fi 41025eefee25Smacallan 41035eefee25Smacallan if test "X$skipped_export" != "X:" && 41045eefee25Smacallan len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41055eefee25Smacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 41065eefee25Smacallan : 41075eefee25Smacallan else 41085eefee25Smacallan # The command line is too long to link in one step, link piecewise. 41095eefee25Smacallan $echo "creating reloadable object files..." 41105eefee25Smacallan 41115eefee25Smacallan # Save the value of $output and $libobjs because we want to 41125eefee25Smacallan # use them later. If we have whole_archive_flag_spec, we 41135eefee25Smacallan # want to use save_libobjs as it was before 41145eefee25Smacallan # whole_archive_flag_spec was expanded, because we can't 41155eefee25Smacallan # assume the linker understands whole_archive_flag_spec. 41165eefee25Smacallan # This may have to be revisited, in case too many 41175eefee25Smacallan # convenience libraries get linked in and end up exceeding 41185eefee25Smacallan # the spec. 41195eefee25Smacallan if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 41205eefee25Smacallan save_libobjs=$libobjs 41215eefee25Smacallan fi 41225eefee25Smacallan save_output=$output 41235eefee25Smacallan output_la=`$echo "X$output" | $Xsed -e "$basename"` 41245eefee25Smacallan 41255eefee25Smacallan # Clear the reloadable object creation command queue and 41265eefee25Smacallan # initialize k to one. 41275eefee25Smacallan test_cmds= 41285eefee25Smacallan concat_cmds= 41295eefee25Smacallan objlist= 41305eefee25Smacallan delfiles= 41315eefee25Smacallan last_robj= 41325eefee25Smacallan k=1 41335eefee25Smacallan output=$output_objdir/$output_la-${k}.$objext 41345eefee25Smacallan # Loop over the list of objects to be linked. 41355eefee25Smacallan for obj in $save_libobjs 41365eefee25Smacallan do 41375eefee25Smacallan eval test_cmds=\"$reload_cmds $objlist $last_robj\" 41385eefee25Smacallan if test "X$objlist" = X || 41395eefee25Smacallan { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41405eefee25Smacallan test "$len" -le "$max_cmd_len"; }; then 41415eefee25Smacallan objlist="$objlist $obj" 41425eefee25Smacallan else 41435eefee25Smacallan # The command $test_cmds is almost too long, add a 41445eefee25Smacallan # command to the queue. 41455eefee25Smacallan if test "$k" -eq 1 ; then 41465eefee25Smacallan # The first file doesn't have a previous command to add. 41475eefee25Smacallan eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 41485eefee25Smacallan else 41495eefee25Smacallan # All subsequent reloadable object files will link in 41505eefee25Smacallan # the last one created. 41515eefee25Smacallan eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 41525eefee25Smacallan fi 41535eefee25Smacallan last_robj=$output_objdir/$output_la-${k}.$objext 41545eefee25Smacallan k=`expr $k + 1` 41555eefee25Smacallan output=$output_objdir/$output_la-${k}.$objext 41565eefee25Smacallan objlist=$obj 41575eefee25Smacallan len=1 41585eefee25Smacallan fi 41595eefee25Smacallan done 41605eefee25Smacallan # Handle the remaining objects by creating one last 41615eefee25Smacallan # reloadable object file. All subsequent reloadable object 41625eefee25Smacallan # files will link in the last one created. 41635eefee25Smacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 41645eefee25Smacallan eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 41655eefee25Smacallan 41665eefee25Smacallan if ${skipped_export-false}; then 41675eefee25Smacallan $show "generating symbol list for \`$libname.la'" 41685eefee25Smacallan export_symbols="$output_objdir/$libname.exp" 41695eefee25Smacallan $run $rm $export_symbols 41705eefee25Smacallan libobjs=$output 41715eefee25Smacallan # Append the command to create the export file. 41725eefee25Smacallan eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 41735eefee25Smacallan fi 41745eefee25Smacallan 41755eefee25Smacallan # Set up a command to remove the reloadable object files 41765eefee25Smacallan # after they are used. 41775eefee25Smacallan i=0 41785eefee25Smacallan while test "$i" -lt "$k" 41795eefee25Smacallan do 41805eefee25Smacallan i=`expr $i + 1` 41815eefee25Smacallan delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 41825eefee25Smacallan done 41835eefee25Smacallan 41845eefee25Smacallan $echo "creating a temporary reloadable object file: $output" 41855eefee25Smacallan 41865eefee25Smacallan # Loop through the commands generated above and execute them. 41875eefee25Smacallan save_ifs="$IFS"; IFS='~' 41885eefee25Smacallan for cmd in $concat_cmds; do 41895eefee25Smacallan IFS="$save_ifs" 41905eefee25Smacallan $show "$cmd" 41915eefee25Smacallan $run eval "$cmd" || exit $? 41925eefee25Smacallan done 41935eefee25Smacallan IFS="$save_ifs" 41945eefee25Smacallan 41955eefee25Smacallan libobjs=$output 41965eefee25Smacallan # Restore the value of output. 41975eefee25Smacallan output=$save_output 41985eefee25Smacallan 41995eefee25Smacallan if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 42005eefee25Smacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 42015eefee25Smacallan fi 42025eefee25Smacallan # Expand the library linking commands again to reset the 42035eefee25Smacallan # value of $libobjs for piecewise linking. 42045eefee25Smacallan 42055eefee25Smacallan # Do each of the archive commands. 42065eefee25Smacallan if test "$module" = yes && test -n "$module_cmds" ; then 42075eefee25Smacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 42085eefee25Smacallan cmds=$module_expsym_cmds 42095eefee25Smacallan else 42105eefee25Smacallan cmds=$module_cmds 42115eefee25Smacallan fi 42125eefee25Smacallan else 42135eefee25Smacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 42145eefee25Smacallan cmds=$archive_expsym_cmds 42155eefee25Smacallan else 42165eefee25Smacallan cmds=$archive_cmds 42175eefee25Smacallan fi 42185eefee25Smacallan fi 42195eefee25Smacallan 42205eefee25Smacallan # Append the command to remove the reloadable object files 42215eefee25Smacallan # to the just-reset $cmds. 42225eefee25Smacallan eval cmds=\"\$cmds~\$rm $delfiles\" 42235eefee25Smacallan fi 42245eefee25Smacallan save_ifs="$IFS"; IFS='~' 42255eefee25Smacallan for cmd in $cmds; do 42265eefee25Smacallan IFS="$save_ifs" 42275eefee25Smacallan eval cmd=\"$cmd\" 42285eefee25Smacallan $show "$cmd" 42295eefee25Smacallan $run eval "$cmd" || { 42305eefee25Smacallan lt_exit=$? 42315eefee25Smacallan 42325eefee25Smacallan # Restore the uninstalled library and exit 42335eefee25Smacallan if test "$mode" = relink; then 42345eefee25Smacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 42355eefee25Smacallan fi 42365eefee25Smacallan 42375eefee25Smacallan exit $lt_exit 42385eefee25Smacallan } 42395eefee25Smacallan done 42405eefee25Smacallan IFS="$save_ifs" 42415eefee25Smacallan 42425eefee25Smacallan # Restore the uninstalled library and exit 42435eefee25Smacallan if test "$mode" = relink; then 42445eefee25Smacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 42455eefee25Smacallan 42465eefee25Smacallan if test -n "$convenience"; then 42475eefee25Smacallan if test -z "$whole_archive_flag_spec"; then 42485eefee25Smacallan $show "${rm}r $gentop" 42495eefee25Smacallan $run ${rm}r "$gentop" 42505eefee25Smacallan fi 42515eefee25Smacallan fi 42525eefee25Smacallan 42535eefee25Smacallan exit $EXIT_SUCCESS 42545eefee25Smacallan fi 42555eefee25Smacallan 42565eefee25Smacallan # Create links to the real library. 42575eefee25Smacallan for linkname in $linknames; do 42585eefee25Smacallan if test "$realname" != "$linkname"; then 42595eefee25Smacallan $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 42605eefee25Smacallan $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 42615eefee25Smacallan fi 42625eefee25Smacallan done 42635eefee25Smacallan 42645eefee25Smacallan # If -module or -export-dynamic was specified, set the dlname. 42655eefee25Smacallan if test "$module" = yes || test "$export_dynamic" = yes; then 42665eefee25Smacallan # On all known operating systems, these are identical. 42675eefee25Smacallan dlname="$soname" 42685eefee25Smacallan fi 42695eefee25Smacallan fi 42705eefee25Smacallan ;; 42715eefee25Smacallan 42725eefee25Smacallan obj) 427362ab96baSmrg case " $deplibs" in 427462ab96baSmrg *\ -l* | *\ -L*) 427562ab96baSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 427662ab96baSmrg esac 42775eefee25Smacallan 42785eefee25Smacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 42795eefee25Smacallan $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 42805eefee25Smacallan fi 42815eefee25Smacallan 42825eefee25Smacallan if test -n "$rpath"; then 42835eefee25Smacallan $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 42845eefee25Smacallan fi 42855eefee25Smacallan 42865eefee25Smacallan if test -n "$xrpath"; then 42875eefee25Smacallan $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 42885eefee25Smacallan fi 42895eefee25Smacallan 42905eefee25Smacallan if test -n "$vinfo"; then 42915eefee25Smacallan $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 42925eefee25Smacallan fi 42935eefee25Smacallan 42945eefee25Smacallan if test -n "$release"; then 42955eefee25Smacallan $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 42965eefee25Smacallan fi 42975eefee25Smacallan 42985eefee25Smacallan case $output in 42995eefee25Smacallan *.lo) 43005eefee25Smacallan if test -n "$objs$old_deplibs"; then 43015eefee25Smacallan $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 43025eefee25Smacallan exit $EXIT_FAILURE 43035eefee25Smacallan fi 43045eefee25Smacallan libobj="$output" 43055eefee25Smacallan obj=`$echo "X$output" | $Xsed -e "$lo2o"` 43065eefee25Smacallan ;; 43075eefee25Smacallan *) 43085eefee25Smacallan libobj= 43095eefee25Smacallan obj="$output" 43105eefee25Smacallan ;; 43115eefee25Smacallan esac 43125eefee25Smacallan 43135eefee25Smacallan # Delete the old objects. 43145eefee25Smacallan $run $rm $obj $libobj 43155eefee25Smacallan 43165eefee25Smacallan # Objects from convenience libraries. This assumes 43175eefee25Smacallan # single-version convenience libraries. Whenever we create 43185eefee25Smacallan # different ones for PIC/non-PIC, this we'll have to duplicate 43195eefee25Smacallan # the extraction. 43205eefee25Smacallan reload_conv_objs= 43215eefee25Smacallan gentop= 43225eefee25Smacallan # reload_cmds runs $LD directly, so let us get rid of 432362ab96baSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 432462ab96baSmrg # turning comma into space.. 43255eefee25Smacallan wl= 43265eefee25Smacallan 43275eefee25Smacallan if test -n "$convenience"; then 43285eefee25Smacallan if test -n "$whole_archive_flag_spec"; then 432962ab96baSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 433062ab96baSmrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 43315eefee25Smacallan else 43325eefee25Smacallan gentop="$output_objdir/${obj}x" 43335eefee25Smacallan generated="$generated $gentop" 43345eefee25Smacallan 43355eefee25Smacallan func_extract_archives $gentop $convenience 43365eefee25Smacallan reload_conv_objs="$reload_objs $func_extract_archives_result" 43375eefee25Smacallan fi 43385eefee25Smacallan fi 43395eefee25Smacallan 43405eefee25Smacallan # Create the old-style object. 43415eefee25Smacallan reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 43425eefee25Smacallan 43435eefee25Smacallan output="$obj" 43445eefee25Smacallan cmds=$reload_cmds 43455eefee25Smacallan save_ifs="$IFS"; IFS='~' 43465eefee25Smacallan for cmd in $cmds; do 43475eefee25Smacallan IFS="$save_ifs" 43485eefee25Smacallan eval cmd=\"$cmd\" 43495eefee25Smacallan $show "$cmd" 43505eefee25Smacallan $run eval "$cmd" || exit $? 43515eefee25Smacallan done 43525eefee25Smacallan IFS="$save_ifs" 43535eefee25Smacallan 43545eefee25Smacallan # Exit if we aren't doing a library object file. 43555eefee25Smacallan if test -z "$libobj"; then 43565eefee25Smacallan if test -n "$gentop"; then 43575eefee25Smacallan $show "${rm}r $gentop" 43585eefee25Smacallan $run ${rm}r $gentop 43595eefee25Smacallan fi 43605eefee25Smacallan 43615eefee25Smacallan exit $EXIT_SUCCESS 43625eefee25Smacallan fi 43635eefee25Smacallan 43645eefee25Smacallan if test "$build_libtool_libs" != yes; then 43655eefee25Smacallan if test -n "$gentop"; then 43665eefee25Smacallan $show "${rm}r $gentop" 43675eefee25Smacallan $run ${rm}r $gentop 43685eefee25Smacallan fi 43695eefee25Smacallan 43705eefee25Smacallan # Create an invalid libtool object if no PIC, so that we don't 43715eefee25Smacallan # accidentally link it into a program. 43725eefee25Smacallan # $show "echo timestamp > $libobj" 43735eefee25Smacallan # $run eval "echo timestamp > $libobj" || exit $? 43745eefee25Smacallan exit $EXIT_SUCCESS 43755eefee25Smacallan fi 43765eefee25Smacallan 43775eefee25Smacallan if test -n "$pic_flag" || test "$pic_mode" != default; then 43785eefee25Smacallan # Only do commands if we really have different PIC objects. 43795eefee25Smacallan reload_objs="$libobjs $reload_conv_objs" 43805eefee25Smacallan output="$libobj" 43815eefee25Smacallan cmds=$reload_cmds 43825eefee25Smacallan save_ifs="$IFS"; IFS='~' 43835eefee25Smacallan for cmd in $cmds; do 43845eefee25Smacallan IFS="$save_ifs" 43855eefee25Smacallan eval cmd=\"$cmd\" 43865eefee25Smacallan $show "$cmd" 43875eefee25Smacallan $run eval "$cmd" || exit $? 43885eefee25Smacallan done 43895eefee25Smacallan IFS="$save_ifs" 43905eefee25Smacallan fi 43915eefee25Smacallan 43925eefee25Smacallan if test -n "$gentop"; then 43935eefee25Smacallan $show "${rm}r $gentop" 43945eefee25Smacallan $run ${rm}r $gentop 43955eefee25Smacallan fi 43965eefee25Smacallan 43975eefee25Smacallan exit $EXIT_SUCCESS 43985eefee25Smacallan ;; 43995eefee25Smacallan 44005eefee25Smacallan prog) 44015eefee25Smacallan case $host in 44025eefee25Smacallan *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 44035eefee25Smacallan esac 44045eefee25Smacallan if test -n "$vinfo"; then 44055eefee25Smacallan $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 44065eefee25Smacallan fi 44075eefee25Smacallan 44085eefee25Smacallan if test -n "$release"; then 44095eefee25Smacallan $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 44105eefee25Smacallan fi 44115eefee25Smacallan 44125eefee25Smacallan if test "$preload" = yes; then 44135eefee25Smacallan if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 44145eefee25Smacallan test "$dlopen_self_static" = unknown; then 44155eefee25Smacallan $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 44165eefee25Smacallan fi 44175eefee25Smacallan fi 44185eefee25Smacallan 44195eefee25Smacallan case $host in 44205eefee25Smacallan *-*-rhapsody* | *-*-darwin1.[012]) 44215eefee25Smacallan # On Rhapsody replace the C library is the System framework 44225eefee25Smacallan compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44235eefee25Smacallan finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44245eefee25Smacallan ;; 44255eefee25Smacallan esac 44265eefee25Smacallan 44275eefee25Smacallan case $host in 44285eefee25Smacallan *darwin*) 44295eefee25Smacallan # Don't allow lazy linking, it breaks C++ global constructors 44305eefee25Smacallan if test "$tagname" = CXX ; then 44315eefee25Smacallan compile_command="$compile_command ${wl}-bind_at_load" 44325eefee25Smacallan finalize_command="$finalize_command ${wl}-bind_at_load" 44335eefee25Smacallan fi 44345eefee25Smacallan ;; 44355eefee25Smacallan esac 44365eefee25Smacallan 44375eefee25Smacallan 44385eefee25Smacallan # move library search paths that coincide with paths to not yet 44395eefee25Smacallan # installed libraries to the beginning of the library search list 44405eefee25Smacallan new_libs= 44415eefee25Smacallan for path in $notinst_path; do 44425eefee25Smacallan case " $new_libs " in 44435eefee25Smacallan *" -L$path/$objdir "*) ;; 44445eefee25Smacallan *) 44455eefee25Smacallan case " $compile_deplibs " in 44465eefee25Smacallan *" -L$path/$objdir "*) 44475eefee25Smacallan new_libs="$new_libs -L$path/$objdir" ;; 44485eefee25Smacallan esac 44495eefee25Smacallan ;; 44505eefee25Smacallan esac 44515eefee25Smacallan done 44525eefee25Smacallan for deplib in $compile_deplibs; do 44535eefee25Smacallan case $deplib in 44545eefee25Smacallan -L*) 44555eefee25Smacallan case " $new_libs " in 44565eefee25Smacallan *" $deplib "*) ;; 44575eefee25Smacallan *) new_libs="$new_libs $deplib" ;; 44585eefee25Smacallan esac 44595eefee25Smacallan ;; 44605eefee25Smacallan *) new_libs="$new_libs $deplib" ;; 44615eefee25Smacallan esac 44625eefee25Smacallan done 44635eefee25Smacallan compile_deplibs="$new_libs" 44645eefee25Smacallan 44655eefee25Smacallan 44665eefee25Smacallan compile_command="$compile_command $compile_deplibs" 44675eefee25Smacallan finalize_command="$finalize_command $finalize_deplibs" 44685eefee25Smacallan 44695eefee25Smacallan if test -n "$rpath$xrpath"; then 44705eefee25Smacallan # If the user specified any rpath flags, then add them. 44715eefee25Smacallan for libdir in $rpath $xrpath; do 44725eefee25Smacallan # This is the magic to use -rpath. 44735eefee25Smacallan case "$finalize_rpath " in 44745eefee25Smacallan *" $libdir "*) ;; 44755eefee25Smacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 44765eefee25Smacallan esac 44775eefee25Smacallan done 44785eefee25Smacallan fi 44795eefee25Smacallan 44805eefee25Smacallan # Now hardcode the library paths 44815eefee25Smacallan rpath= 44825eefee25Smacallan hardcode_libdirs= 44835eefee25Smacallan for libdir in $compile_rpath $finalize_rpath; do 44845eefee25Smacallan if test -n "$hardcode_libdir_flag_spec"; then 44855eefee25Smacallan if test -n "$hardcode_libdir_separator"; then 44865eefee25Smacallan if test -z "$hardcode_libdirs"; then 44875eefee25Smacallan hardcode_libdirs="$libdir" 44885eefee25Smacallan else 44895eefee25Smacallan # Just accumulate the unique libdirs. 44905eefee25Smacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44915eefee25Smacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44925eefee25Smacallan ;; 44935eefee25Smacallan *) 44945eefee25Smacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44955eefee25Smacallan ;; 44965eefee25Smacallan esac 44975eefee25Smacallan fi 44985eefee25Smacallan else 44995eefee25Smacallan eval flag=\"$hardcode_libdir_flag_spec\" 45005eefee25Smacallan rpath="$rpath $flag" 45015eefee25Smacallan fi 45025eefee25Smacallan elif test -n "$runpath_var"; then 45035eefee25Smacallan case "$perm_rpath " in 45045eefee25Smacallan *" $libdir "*) ;; 45055eefee25Smacallan *) perm_rpath="$perm_rpath $libdir" ;; 45065eefee25Smacallan esac 45075eefee25Smacallan fi 45085eefee25Smacallan case $host in 45095eefee25Smacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 45105eefee25Smacallan testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 45115eefee25Smacallan case :$dllsearchpath: in 45125eefee25Smacallan *":$libdir:"*) ;; 45135eefee25Smacallan *) dllsearchpath="$dllsearchpath:$libdir";; 45145eefee25Smacallan esac 45155eefee25Smacallan case :$dllsearchpath: in 45165eefee25Smacallan *":$testbindir:"*) ;; 45175eefee25Smacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 45185eefee25Smacallan esac 45195eefee25Smacallan ;; 45205eefee25Smacallan esac 45215eefee25Smacallan done 45225eefee25Smacallan # Substitute the hardcoded libdirs into the rpath. 45235eefee25Smacallan if test -n "$hardcode_libdir_separator" && 45245eefee25Smacallan test -n "$hardcode_libdirs"; then 45255eefee25Smacallan libdir="$hardcode_libdirs" 45265eefee25Smacallan eval rpath=\" $hardcode_libdir_flag_spec\" 45275eefee25Smacallan fi 45285eefee25Smacallan compile_rpath="$rpath" 45295eefee25Smacallan 45305eefee25Smacallan rpath= 45315eefee25Smacallan hardcode_libdirs= 45325eefee25Smacallan for libdir in $finalize_rpath; do 45335eefee25Smacallan if test -n "$hardcode_libdir_flag_spec"; then 45345eefee25Smacallan if test -n "$hardcode_libdir_separator"; then 45355eefee25Smacallan if test -z "$hardcode_libdirs"; then 45365eefee25Smacallan hardcode_libdirs="$libdir" 45375eefee25Smacallan else 45385eefee25Smacallan # Just accumulate the unique libdirs. 45395eefee25Smacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 45405eefee25Smacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 45415eefee25Smacallan ;; 45425eefee25Smacallan *) 45435eefee25Smacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 45445eefee25Smacallan ;; 45455eefee25Smacallan esac 45465eefee25Smacallan fi 45475eefee25Smacallan else 45485eefee25Smacallan eval flag=\"$hardcode_libdir_flag_spec\" 45495eefee25Smacallan rpath="$rpath $flag" 45505eefee25Smacallan fi 45515eefee25Smacallan elif test -n "$runpath_var"; then 45525eefee25Smacallan case "$finalize_perm_rpath " in 45535eefee25Smacallan *" $libdir "*) ;; 45545eefee25Smacallan *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 45555eefee25Smacallan esac 45565eefee25Smacallan fi 45575eefee25Smacallan done 45585eefee25Smacallan # Substitute the hardcoded libdirs into the rpath. 45595eefee25Smacallan if test -n "$hardcode_libdir_separator" && 45605eefee25Smacallan test -n "$hardcode_libdirs"; then 45615eefee25Smacallan libdir="$hardcode_libdirs" 45625eefee25Smacallan eval rpath=\" $hardcode_libdir_flag_spec\" 45635eefee25Smacallan fi 45645eefee25Smacallan finalize_rpath="$rpath" 45655eefee25Smacallan 45665eefee25Smacallan if test -n "$libobjs" && test "$build_old_libs" = yes; then 45675eefee25Smacallan # Transform all the library objects into standard objects. 45685eefee25Smacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45695eefee25Smacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45705eefee25Smacallan fi 45715eefee25Smacallan 45725eefee25Smacallan dlsyms= 45735eefee25Smacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 45745eefee25Smacallan if test -n "$NM" && test -n "$global_symbol_pipe"; then 45755eefee25Smacallan dlsyms="${outputname}S.c" 45765eefee25Smacallan else 45775eefee25Smacallan $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 45785eefee25Smacallan fi 45795eefee25Smacallan fi 45805eefee25Smacallan 45815eefee25Smacallan if test -n "$dlsyms"; then 45825eefee25Smacallan case $dlsyms in 45835eefee25Smacallan "") ;; 45845eefee25Smacallan *.c) 45855eefee25Smacallan # Discover the nlist of each of the dlfiles. 45865eefee25Smacallan nlist="$output_objdir/${outputname}.nm" 45875eefee25Smacallan 45885eefee25Smacallan $show "$rm $nlist ${nlist}S ${nlist}T" 45895eefee25Smacallan $run $rm "$nlist" "${nlist}S" "${nlist}T" 45905eefee25Smacallan 45915eefee25Smacallan # Parse the name list into a source file. 45925eefee25Smacallan $show "creating $output_objdir/$dlsyms" 45935eefee25Smacallan 45945eefee25Smacallan test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 45955eefee25Smacallan/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 45965eefee25Smacallan/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 45975eefee25Smacallan 45985eefee25Smacallan#ifdef __cplusplus 45995eefee25Smacallanextern \"C\" { 46005eefee25Smacallan#endif 46015eefee25Smacallan 46025eefee25Smacallan/* Prevent the only kind of declaration conflicts we can make. */ 46035eefee25Smacallan#define lt_preloaded_symbols some_other_symbol 46045eefee25Smacallan 46055eefee25Smacallan/* External symbol declarations for the compiler. */\ 46065eefee25Smacallan" 46075eefee25Smacallan 46085eefee25Smacallan if test "$dlself" = yes; then 46095eefee25Smacallan $show "generating symbol list for \`$output'" 46105eefee25Smacallan 46115eefee25Smacallan test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 46125eefee25Smacallan 46135eefee25Smacallan # Add our own program objects to the symbol list. 46145eefee25Smacallan progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 46155eefee25Smacallan for arg in $progfiles; do 46165eefee25Smacallan $show "extracting global C symbols from \`$arg'" 46175eefee25Smacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46185eefee25Smacallan done 46195eefee25Smacallan 46205eefee25Smacallan if test -n "$exclude_expsyms"; then 46215eefee25Smacallan $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 46225eefee25Smacallan $run eval '$mv "$nlist"T "$nlist"' 46235eefee25Smacallan fi 46245eefee25Smacallan 46255eefee25Smacallan if test -n "$export_symbols_regex"; then 46265eefee25Smacallan $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 46275eefee25Smacallan $run eval '$mv "$nlist"T "$nlist"' 46285eefee25Smacallan fi 46295eefee25Smacallan 46305eefee25Smacallan # Prepare the list of exported symbols 46315eefee25Smacallan if test -z "$export_symbols"; then 46325eefee25Smacallan export_symbols="$output_objdir/$outputname.exp" 46335eefee25Smacallan $run $rm $export_symbols 46345eefee25Smacallan $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 46355eefee25Smacallan case $host in 46365eefee25Smacallan *cygwin* | *mingw* ) 46375eefee25Smacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46385eefee25Smacallan $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 46395eefee25Smacallan ;; 46405eefee25Smacallan esac 46415eefee25Smacallan else 46425eefee25Smacallan $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 46435eefee25Smacallan $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 46445eefee25Smacallan $run eval 'mv "$nlist"T "$nlist"' 46455eefee25Smacallan case $host in 46465eefee25Smacallan *cygwin* | *mingw* ) 46475eefee25Smacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46485eefee25Smacallan $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 46495eefee25Smacallan ;; 46505eefee25Smacallan esac 46515eefee25Smacallan fi 46525eefee25Smacallan fi 46535eefee25Smacallan 46545eefee25Smacallan for arg in $dlprefiles; do 46555eefee25Smacallan $show "extracting global C symbols from \`$arg'" 46565eefee25Smacallan name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 46575eefee25Smacallan $run eval '$echo ": $name " >> "$nlist"' 46585eefee25Smacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46595eefee25Smacallan done 46605eefee25Smacallan 46615eefee25Smacallan if test -z "$run"; then 46625eefee25Smacallan # Make sure we have at least an empty file. 46635eefee25Smacallan test -f "$nlist" || : > "$nlist" 46645eefee25Smacallan 46655eefee25Smacallan if test -n "$exclude_expsyms"; then 46665eefee25Smacallan $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 46675eefee25Smacallan $mv "$nlist"T "$nlist" 46685eefee25Smacallan fi 46695eefee25Smacallan 46705eefee25Smacallan # Try sorting and uniquifying the output. 46715eefee25Smacallan if grep -v "^: " < "$nlist" | 46725eefee25Smacallan if sort -k 3 </dev/null >/dev/null 2>&1; then 46735eefee25Smacallan sort -k 3 46745eefee25Smacallan else 46755eefee25Smacallan sort +2 46765eefee25Smacallan fi | 46775eefee25Smacallan uniq > "$nlist"S; then 46785eefee25Smacallan : 46795eefee25Smacallan else 46805eefee25Smacallan grep -v "^: " < "$nlist" > "$nlist"S 46815eefee25Smacallan fi 46825eefee25Smacallan 46835eefee25Smacallan if test -f "$nlist"S; then 46845eefee25Smacallan eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 46855eefee25Smacallan else 46865eefee25Smacallan $echo '/* NONE */' >> "$output_objdir/$dlsyms" 46875eefee25Smacallan fi 46885eefee25Smacallan 46895eefee25Smacallan $echo >> "$output_objdir/$dlsyms" "\ 46905eefee25Smacallan 46915eefee25Smacallan#undef lt_preloaded_symbols 46925eefee25Smacallan 46935eefee25Smacallan#if defined (__STDC__) && __STDC__ 46945eefee25Smacallan# define lt_ptr void * 46955eefee25Smacallan#else 46965eefee25Smacallan# define lt_ptr char * 46975eefee25Smacallan# define const 46985eefee25Smacallan#endif 46995eefee25Smacallan 47005eefee25Smacallan/* The mapping between symbol names and symbols. */ 47015eefee25Smacallan" 47025eefee25Smacallan 47035eefee25Smacallan case $host in 47045eefee25Smacallan *cygwin* | *mingw* ) 47055eefee25Smacallan $echo >> "$output_objdir/$dlsyms" "\ 47065eefee25Smacallan/* DATA imports from DLLs on WIN32 can't be const, because 47075eefee25Smacallan runtime relocations are performed -- see ld's documentation 47085eefee25Smacallan on pseudo-relocs */ 47095eefee25Smacallanstruct { 47105eefee25Smacallan" 47115eefee25Smacallan ;; 47125eefee25Smacallan * ) 47135eefee25Smacallan $echo >> "$output_objdir/$dlsyms" "\ 47145eefee25Smacallanconst struct { 47155eefee25Smacallan" 47165eefee25Smacallan ;; 47175eefee25Smacallan esac 47185eefee25Smacallan 47195eefee25Smacallan 47205eefee25Smacallan $echo >> "$output_objdir/$dlsyms" "\ 47215eefee25Smacallan const char *name; 47225eefee25Smacallan lt_ptr address; 47235eefee25Smacallan} 47245eefee25Smacallanlt_preloaded_symbols[] = 47255eefee25Smacallan{\ 47265eefee25Smacallan" 47275eefee25Smacallan 47285eefee25Smacallan eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 47295eefee25Smacallan 47305eefee25Smacallan $echo >> "$output_objdir/$dlsyms" "\ 47315eefee25Smacallan {0, (lt_ptr) 0} 47325eefee25Smacallan}; 47335eefee25Smacallan 47345eefee25Smacallan/* This works around a problem in FreeBSD linker */ 47355eefee25Smacallan#ifdef FREEBSD_WORKAROUND 47365eefee25Smacallanstatic const void *lt_preloaded_setup() { 47375eefee25Smacallan return lt_preloaded_symbols; 47385eefee25Smacallan} 47395eefee25Smacallan#endif 47405eefee25Smacallan 47415eefee25Smacallan#ifdef __cplusplus 47425eefee25Smacallan} 47435eefee25Smacallan#endif\ 47445eefee25Smacallan" 47455eefee25Smacallan fi 47465eefee25Smacallan 47475eefee25Smacallan pic_flag_for_symtable= 47485eefee25Smacallan case $host in 47495eefee25Smacallan # compiling the symbol table file with pic_flag works around 47505eefee25Smacallan # a FreeBSD bug that causes programs to crash when -lm is 47515eefee25Smacallan # linked before any other PIC object. But we must not use 47525eefee25Smacallan # pic_flag when linking with -static. The problem exists in 47535eefee25Smacallan # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 47545eefee25Smacallan *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 47555eefee25Smacallan case "$compile_command " in 47565eefee25Smacallan *" -static "*) ;; 47575eefee25Smacallan *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 47585eefee25Smacallan esac;; 47595eefee25Smacallan *-*-hpux*) 47605eefee25Smacallan case "$compile_command " in 47615eefee25Smacallan *" -static "*) ;; 47625eefee25Smacallan *) pic_flag_for_symtable=" $pic_flag";; 47635eefee25Smacallan esac 47645eefee25Smacallan esac 47655eefee25Smacallan 47665eefee25Smacallan # Now compile the dynamic symbol file. 47675eefee25Smacallan $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 47685eefee25Smacallan $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 47695eefee25Smacallan 47705eefee25Smacallan # Clean up the generated files. 47715eefee25Smacallan $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 47725eefee25Smacallan $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 47735eefee25Smacallan 47745eefee25Smacallan # Transform the symbol file into the correct name. 47755eefee25Smacallan case $host in 47765eefee25Smacallan *cygwin* | *mingw* ) 47775eefee25Smacallan if test -f "$output_objdir/${outputname}.def" ; then 477862ab96baSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 477962ab96baSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47805eefee25Smacallan else 478162ab96baSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 478262ab96baSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47835eefee25Smacallan fi 47845eefee25Smacallan ;; 47855eefee25Smacallan * ) 478662ab96baSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 478762ab96baSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47885eefee25Smacallan ;; 47895eefee25Smacallan esac 47905eefee25Smacallan ;; 47915eefee25Smacallan *) 47925eefee25Smacallan $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 47935eefee25Smacallan exit $EXIT_FAILURE 47945eefee25Smacallan ;; 47955eefee25Smacallan esac 47965eefee25Smacallan else 47975eefee25Smacallan # We keep going just in case the user didn't refer to 47985eefee25Smacallan # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 47995eefee25Smacallan # really was required. 48005eefee25Smacallan 48015eefee25Smacallan # Nullify the symbol file. 480262ab96baSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 480362ab96baSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 48045eefee25Smacallan fi 48055eefee25Smacallan 48065eefee25Smacallan if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 48075eefee25Smacallan # Replace the output file specification. 480862ab96baSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 48095eefee25Smacallan link_command="$compile_command$compile_rpath" 48105eefee25Smacallan 48115eefee25Smacallan # We have no uninstalled library dependencies, so finalize right now. 48125eefee25Smacallan $show "$link_command" 48135eefee25Smacallan $run eval "$link_command" 48145eefee25Smacallan exit_status=$? 48155eefee25Smacallan 48165eefee25Smacallan # Delete the generated files. 48175eefee25Smacallan if test -n "$dlsyms"; then 48185eefee25Smacallan $show "$rm $output_objdir/${outputname}S.${objext}" 48195eefee25Smacallan $run $rm "$output_objdir/${outputname}S.${objext}" 48205eefee25Smacallan fi 48215eefee25Smacallan 48225eefee25Smacallan exit $exit_status 48235eefee25Smacallan fi 48245eefee25Smacallan 48255eefee25Smacallan if test -n "$shlibpath_var"; then 48265eefee25Smacallan # We should set the shlibpath_var 48275eefee25Smacallan rpath= 48285eefee25Smacallan for dir in $temp_rpath; do 48295eefee25Smacallan case $dir in 48305eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) 48315eefee25Smacallan # Absolute path. 48325eefee25Smacallan rpath="$rpath$dir:" 48335eefee25Smacallan ;; 48345eefee25Smacallan *) 48355eefee25Smacallan # Relative path: add a thisdir entry. 48365eefee25Smacallan rpath="$rpath\$thisdir/$dir:" 48375eefee25Smacallan ;; 48385eefee25Smacallan esac 48395eefee25Smacallan done 48405eefee25Smacallan temp_rpath="$rpath" 48415eefee25Smacallan fi 48425eefee25Smacallan 48435eefee25Smacallan if test -n "$compile_shlibpath$finalize_shlibpath"; then 48445eefee25Smacallan compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 48455eefee25Smacallan fi 48465eefee25Smacallan if test -n "$finalize_shlibpath"; then 48475eefee25Smacallan finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 48485eefee25Smacallan fi 48495eefee25Smacallan 48505eefee25Smacallan compile_var= 48515eefee25Smacallan finalize_var= 48525eefee25Smacallan if test -n "$runpath_var"; then 48535eefee25Smacallan if test -n "$perm_rpath"; then 48545eefee25Smacallan # We should set the runpath_var. 48555eefee25Smacallan rpath= 48565eefee25Smacallan for dir in $perm_rpath; do 48575eefee25Smacallan rpath="$rpath$dir:" 48585eefee25Smacallan done 48595eefee25Smacallan compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 48605eefee25Smacallan fi 48615eefee25Smacallan if test -n "$finalize_perm_rpath"; then 48625eefee25Smacallan # We should set the runpath_var. 48635eefee25Smacallan rpath= 48645eefee25Smacallan for dir in $finalize_perm_rpath; do 48655eefee25Smacallan rpath="$rpath$dir:" 48665eefee25Smacallan done 48675eefee25Smacallan finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 48685eefee25Smacallan fi 48695eefee25Smacallan fi 48705eefee25Smacallan 48715eefee25Smacallan if test "$no_install" = yes; then 48725eefee25Smacallan # We don't need to create a wrapper script. 48735eefee25Smacallan link_command="$compile_var$compile_command$compile_rpath" 48745eefee25Smacallan # Replace the output file specification. 48755eefee25Smacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 48765eefee25Smacallan # Delete the old output file. 48775eefee25Smacallan $run $rm $output 48785eefee25Smacallan # Link the executable and exit 48795eefee25Smacallan $show "$link_command" 48805eefee25Smacallan $run eval "$link_command" || exit $? 48815eefee25Smacallan exit $EXIT_SUCCESS 48825eefee25Smacallan fi 48835eefee25Smacallan 48845eefee25Smacallan if test "$hardcode_action" = relink; then 48855eefee25Smacallan # Fast installation is not supported 48865eefee25Smacallan link_command="$compile_var$compile_command$compile_rpath" 48875eefee25Smacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 48885eefee25Smacallan 48895eefee25Smacallan $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 48905eefee25Smacallan $echo "$modename: \`$output' will be relinked during installation" 1>&2 48915eefee25Smacallan else 48925eefee25Smacallan if test "$fast_install" != no; then 48935eefee25Smacallan link_command="$finalize_var$compile_command$finalize_rpath" 48945eefee25Smacallan if test "$fast_install" = yes; then 489562ab96baSmrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 48965eefee25Smacallan else 48975eefee25Smacallan # fast_install is set to needless 48985eefee25Smacallan relink_command= 48995eefee25Smacallan fi 49005eefee25Smacallan else 49015eefee25Smacallan link_command="$compile_var$compile_command$compile_rpath" 49025eefee25Smacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 49035eefee25Smacallan fi 49045eefee25Smacallan fi 49055eefee25Smacallan 49065eefee25Smacallan # Replace the output file specification. 49075eefee25Smacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 49085eefee25Smacallan 49095eefee25Smacallan # Delete the old output files. 49105eefee25Smacallan $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 49115eefee25Smacallan 49125eefee25Smacallan $show "$link_command" 49135eefee25Smacallan $run eval "$link_command" || exit $? 49145eefee25Smacallan 49155eefee25Smacallan # Now create the wrapper script. 49165eefee25Smacallan $show "creating $output" 49175eefee25Smacallan 49185eefee25Smacallan # Quote the relink command for shipping. 49195eefee25Smacallan if test -n "$relink_command"; then 49205eefee25Smacallan # Preserve any variables that may affect compiler behavior 49215eefee25Smacallan for var in $variables_saved_for_relink; do 49225eefee25Smacallan if eval test -z \"\${$var+set}\"; then 49235eefee25Smacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 49245eefee25Smacallan elif eval var_value=\$$var; test -z "$var_value"; then 49255eefee25Smacallan relink_command="$var=; export $var; $relink_command" 49265eefee25Smacallan else 49275eefee25Smacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 49285eefee25Smacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 49295eefee25Smacallan fi 49305eefee25Smacallan done 49315eefee25Smacallan relink_command="(cd `pwd`; $relink_command)" 493262ab96baSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 49335eefee25Smacallan fi 49345eefee25Smacallan 49355eefee25Smacallan # Quote $echo for shipping. 49365eefee25Smacallan if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 49375eefee25Smacallan case $progpath in 49385eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 49395eefee25Smacallan *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 49405eefee25Smacallan esac 49415eefee25Smacallan qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 49425eefee25Smacallan else 49435eefee25Smacallan qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 49445eefee25Smacallan fi 49455eefee25Smacallan 49465eefee25Smacallan # Only actually do things if our run command is non-null. 49475eefee25Smacallan if test -z "$run"; then 49485eefee25Smacallan # win32 will think the script is a binary if it has 49495eefee25Smacallan # a .exe suffix, so we strip it off here. 49505eefee25Smacallan case $output in 49515eefee25Smacallan *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 49525eefee25Smacallan esac 49535eefee25Smacallan # test for cygwin because mv fails w/o .exe extensions 49545eefee25Smacallan case $host in 49555eefee25Smacallan *cygwin*) 49565eefee25Smacallan exeext=.exe 49575eefee25Smacallan outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 49585eefee25Smacallan *) exeext= ;; 49595eefee25Smacallan esac 49605eefee25Smacallan case $host in 49615eefee25Smacallan *cygwin* | *mingw* ) 49625eefee25Smacallan output_name=`basename $output` 49635eefee25Smacallan output_path=`dirname $output` 49645eefee25Smacallan cwrappersource="$output_path/$objdir/lt-$output_name.c" 49655eefee25Smacallan cwrapper="$output_path/$output_name.exe" 49665eefee25Smacallan $rm $cwrappersource $cwrapper 49675eefee25Smacallan trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 49685eefee25Smacallan 49695eefee25Smacallan cat > $cwrappersource <<EOF 49705eefee25Smacallan 49715eefee25Smacallan/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 49725eefee25Smacallan Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 49735eefee25Smacallan 49745eefee25Smacallan The $output program cannot be directly executed until all the libtool 49755eefee25Smacallan libraries that it depends on are installed. 49765eefee25Smacallan 49775eefee25Smacallan This wrapper executable should never be moved out of the build directory. 49785eefee25Smacallan If it is, it will not operate correctly. 49795eefee25Smacallan 49805eefee25Smacallan Currently, it simply execs the wrapper *script* "/bin/sh $output", 49815eefee25Smacallan but could eventually absorb all of the scripts functionality and 49825eefee25Smacallan exec $objdir/$outputname directly. 49835eefee25Smacallan*/ 49845eefee25SmacallanEOF 49855eefee25Smacallan cat >> $cwrappersource<<"EOF" 49865eefee25Smacallan#include <stdio.h> 49875eefee25Smacallan#include <stdlib.h> 49885eefee25Smacallan#include <unistd.h> 49895eefee25Smacallan#include <malloc.h> 49905eefee25Smacallan#include <stdarg.h> 49915eefee25Smacallan#include <assert.h> 49925eefee25Smacallan#include <string.h> 49935eefee25Smacallan#include <ctype.h> 49945eefee25Smacallan#include <sys/stat.h> 49955eefee25Smacallan 49965eefee25Smacallan#if defined(PATH_MAX) 49975eefee25Smacallan# define LT_PATHMAX PATH_MAX 49985eefee25Smacallan#elif defined(MAXPATHLEN) 49995eefee25Smacallan# define LT_PATHMAX MAXPATHLEN 50005eefee25Smacallan#else 50015eefee25Smacallan# define LT_PATHMAX 1024 50025eefee25Smacallan#endif 50035eefee25Smacallan 50045eefee25Smacallan#ifndef DIR_SEPARATOR 50055eefee25Smacallan# define DIR_SEPARATOR '/' 50065eefee25Smacallan# define PATH_SEPARATOR ':' 50075eefee25Smacallan#endif 50085eefee25Smacallan 50095eefee25Smacallan#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 50105eefee25Smacallan defined (__OS2__) 50115eefee25Smacallan# define HAVE_DOS_BASED_FILE_SYSTEM 50125eefee25Smacallan# ifndef DIR_SEPARATOR_2 50135eefee25Smacallan# define DIR_SEPARATOR_2 '\\' 50145eefee25Smacallan# endif 50155eefee25Smacallan# ifndef PATH_SEPARATOR_2 50165eefee25Smacallan# define PATH_SEPARATOR_2 ';' 50175eefee25Smacallan# endif 50185eefee25Smacallan#endif 50195eefee25Smacallan 50205eefee25Smacallan#ifndef DIR_SEPARATOR_2 50215eefee25Smacallan# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 50225eefee25Smacallan#else /* DIR_SEPARATOR_2 */ 50235eefee25Smacallan# define IS_DIR_SEPARATOR(ch) \ 50245eefee25Smacallan (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 50255eefee25Smacallan#endif /* DIR_SEPARATOR_2 */ 50265eefee25Smacallan 50275eefee25Smacallan#ifndef PATH_SEPARATOR_2 50285eefee25Smacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 50295eefee25Smacallan#else /* PATH_SEPARATOR_2 */ 50305eefee25Smacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 50315eefee25Smacallan#endif /* PATH_SEPARATOR_2 */ 50325eefee25Smacallan 50335eefee25Smacallan#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 50345eefee25Smacallan#define XFREE(stale) do { \ 50355eefee25Smacallan if (stale) { free ((void *) stale); stale = 0; } \ 50365eefee25Smacallan} while (0) 50375eefee25Smacallan 50385eefee25Smacallan/* -DDEBUG is fairly common in CFLAGS. */ 50395eefee25Smacallan#undef DEBUG 50405eefee25Smacallan#if defined DEBUGWRAPPER 50415eefee25Smacallan# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 50425eefee25Smacallan#else 50435eefee25Smacallan# define DEBUG(format, ...) 50445eefee25Smacallan#endif 50455eefee25Smacallan 50465eefee25Smacallanconst char *program_name = NULL; 50475eefee25Smacallan 50485eefee25Smacallanvoid * xmalloc (size_t num); 50495eefee25Smacallanchar * xstrdup (const char *string); 50505eefee25Smacallanconst char * base_name (const char *name); 50515eefee25Smacallanchar * find_executable(const char *wrapper); 50525eefee25Smacallanint check_executable(const char *path); 50535eefee25Smacallanchar * strendzap(char *str, const char *pat); 50545eefee25Smacallanvoid lt_fatal (const char *message, ...); 50555eefee25Smacallan 50565eefee25Smacallanint 50575eefee25Smacallanmain (int argc, char *argv[]) 50585eefee25Smacallan{ 50595eefee25Smacallan char **newargz; 50605eefee25Smacallan int i; 50615eefee25Smacallan 50625eefee25Smacallan program_name = (char *) xstrdup (base_name (argv[0])); 50635eefee25Smacallan DEBUG("(main) argv[0] : %s\n",argv[0]); 50645eefee25Smacallan DEBUG("(main) program_name : %s\n",program_name); 50655eefee25Smacallan newargz = XMALLOC(char *, argc+2); 50665eefee25SmacallanEOF 50675eefee25Smacallan 50685eefee25Smacallan cat >> $cwrappersource <<EOF 50695eefee25Smacallan newargz[0] = (char *) xstrdup("$SHELL"); 50705eefee25SmacallanEOF 50715eefee25Smacallan 50725eefee25Smacallan cat >> $cwrappersource <<"EOF" 50735eefee25Smacallan newargz[1] = find_executable(argv[0]); 50745eefee25Smacallan if (newargz[1] == NULL) 50755eefee25Smacallan lt_fatal("Couldn't find %s", argv[0]); 50765eefee25Smacallan DEBUG("(main) found exe at : %s\n",newargz[1]); 50775eefee25Smacallan /* we know the script has the same name, without the .exe */ 50785eefee25Smacallan /* so make sure newargz[1] doesn't end in .exe */ 50795eefee25Smacallan strendzap(newargz[1],".exe"); 50805eefee25Smacallan for (i = 1; i < argc; i++) 50815eefee25Smacallan newargz[i+1] = xstrdup(argv[i]); 50825eefee25Smacallan newargz[argc+1] = NULL; 50835eefee25Smacallan 50845eefee25Smacallan for (i=0; i<argc+1; i++) 50855eefee25Smacallan { 50865eefee25Smacallan DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 50875eefee25Smacallan ; 50885eefee25Smacallan } 50895eefee25Smacallan 50905eefee25SmacallanEOF 50915eefee25Smacallan 50925eefee25Smacallan case $host_os in 50935eefee25Smacallan mingw*) 50945eefee25Smacallan cat >> $cwrappersource <<EOF 50955eefee25Smacallan execv("$SHELL",(char const **)newargz); 50965eefee25SmacallanEOF 50975eefee25Smacallan ;; 50985eefee25Smacallan *) 50995eefee25Smacallan cat >> $cwrappersource <<EOF 51005eefee25Smacallan execv("$SHELL",newargz); 51015eefee25SmacallanEOF 51025eefee25Smacallan ;; 51035eefee25Smacallan esac 51045eefee25Smacallan 51055eefee25Smacallan cat >> $cwrappersource <<"EOF" 51065eefee25Smacallan return 127; 51075eefee25Smacallan} 51085eefee25Smacallan 51095eefee25Smacallanvoid * 51105eefee25Smacallanxmalloc (size_t num) 51115eefee25Smacallan{ 51125eefee25Smacallan void * p = (void *) malloc (num); 51135eefee25Smacallan if (!p) 51145eefee25Smacallan lt_fatal ("Memory exhausted"); 51155eefee25Smacallan 51165eefee25Smacallan return p; 51175eefee25Smacallan} 51185eefee25Smacallan 51195eefee25Smacallanchar * 51205eefee25Smacallanxstrdup (const char *string) 51215eefee25Smacallan{ 51225eefee25Smacallan return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 51235eefee25Smacallan; 51245eefee25Smacallan} 51255eefee25Smacallan 51265eefee25Smacallanconst char * 51275eefee25Smacallanbase_name (const char *name) 51285eefee25Smacallan{ 51295eefee25Smacallan const char *base; 51305eefee25Smacallan 51315eefee25Smacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51325eefee25Smacallan /* Skip over the disk name in MSDOS pathnames. */ 51335eefee25Smacallan if (isalpha ((unsigned char)name[0]) && name[1] == ':') 51345eefee25Smacallan name += 2; 51355eefee25Smacallan#endif 51365eefee25Smacallan 51375eefee25Smacallan for (base = name; *name; name++) 51385eefee25Smacallan if (IS_DIR_SEPARATOR (*name)) 51395eefee25Smacallan base = name + 1; 51405eefee25Smacallan return base; 51415eefee25Smacallan} 51425eefee25Smacallan 51435eefee25Smacallanint 51445eefee25Smacallancheck_executable(const char * path) 51455eefee25Smacallan{ 51465eefee25Smacallan struct stat st; 51475eefee25Smacallan 51485eefee25Smacallan DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 51495eefee25Smacallan if ((!path) || (!*path)) 51505eefee25Smacallan return 0; 51515eefee25Smacallan 51525eefee25Smacallan if ((stat (path, &st) >= 0) && 51535eefee25Smacallan ( 51545eefee25Smacallan /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 51555eefee25Smacallan#if defined (S_IXOTH) 51565eefee25Smacallan ((st.st_mode & S_IXOTH) == S_IXOTH) || 51575eefee25Smacallan#endif 51585eefee25Smacallan#if defined (S_IXGRP) 51595eefee25Smacallan ((st.st_mode & S_IXGRP) == S_IXGRP) || 51605eefee25Smacallan#endif 51615eefee25Smacallan ((st.st_mode & S_IXUSR) == S_IXUSR)) 51625eefee25Smacallan ) 51635eefee25Smacallan return 1; 51645eefee25Smacallan else 51655eefee25Smacallan return 0; 51665eefee25Smacallan} 51675eefee25Smacallan 51685eefee25Smacallan/* Searches for the full path of the wrapper. Returns 51695eefee25Smacallan newly allocated full path name if found, NULL otherwise */ 51705eefee25Smacallanchar * 51715eefee25Smacallanfind_executable (const char* wrapper) 51725eefee25Smacallan{ 51735eefee25Smacallan int has_slash = 0; 51745eefee25Smacallan const char* p; 51755eefee25Smacallan const char* p_next; 51765eefee25Smacallan /* static buffer for getcwd */ 51775eefee25Smacallan char tmp[LT_PATHMAX + 1]; 51785eefee25Smacallan int tmp_len; 51795eefee25Smacallan char* concat_name; 51805eefee25Smacallan 51815eefee25Smacallan DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 51825eefee25Smacallan 51835eefee25Smacallan if ((wrapper == NULL) || (*wrapper == '\0')) 51845eefee25Smacallan return NULL; 51855eefee25Smacallan 51865eefee25Smacallan /* Absolute path? */ 51875eefee25Smacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51885eefee25Smacallan if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 51895eefee25Smacallan { 51905eefee25Smacallan concat_name = xstrdup (wrapper); 51915eefee25Smacallan if (check_executable(concat_name)) 51925eefee25Smacallan return concat_name; 51935eefee25Smacallan XFREE(concat_name); 51945eefee25Smacallan } 51955eefee25Smacallan else 51965eefee25Smacallan { 51975eefee25Smacallan#endif 51985eefee25Smacallan if (IS_DIR_SEPARATOR (wrapper[0])) 51995eefee25Smacallan { 52005eefee25Smacallan concat_name = xstrdup (wrapper); 52015eefee25Smacallan if (check_executable(concat_name)) 52025eefee25Smacallan return concat_name; 52035eefee25Smacallan XFREE(concat_name); 52045eefee25Smacallan } 52055eefee25Smacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 52065eefee25Smacallan } 52075eefee25Smacallan#endif 52085eefee25Smacallan 52095eefee25Smacallan for (p = wrapper; *p; p++) 52105eefee25Smacallan if (*p == '/') 52115eefee25Smacallan { 52125eefee25Smacallan has_slash = 1; 52135eefee25Smacallan break; 52145eefee25Smacallan } 52155eefee25Smacallan if (!has_slash) 52165eefee25Smacallan { 52175eefee25Smacallan /* no slashes; search PATH */ 52185eefee25Smacallan const char* path = getenv ("PATH"); 52195eefee25Smacallan if (path != NULL) 52205eefee25Smacallan { 52215eefee25Smacallan for (p = path; *p; p = p_next) 52225eefee25Smacallan { 52235eefee25Smacallan const char* q; 52245eefee25Smacallan size_t p_len; 52255eefee25Smacallan for (q = p; *q; q++) 52265eefee25Smacallan if (IS_PATH_SEPARATOR(*q)) 52275eefee25Smacallan break; 52285eefee25Smacallan p_len = q - p; 52295eefee25Smacallan p_next = (*q == '\0' ? q : q + 1); 52305eefee25Smacallan if (p_len == 0) 52315eefee25Smacallan { 52325eefee25Smacallan /* empty path: current directory */ 52335eefee25Smacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 52345eefee25Smacallan lt_fatal ("getcwd failed"); 52355eefee25Smacallan tmp_len = strlen(tmp); 52365eefee25Smacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52375eefee25Smacallan memcpy (concat_name, tmp, tmp_len); 52385eefee25Smacallan concat_name[tmp_len] = '/'; 52395eefee25Smacallan strcpy (concat_name + tmp_len + 1, wrapper); 52405eefee25Smacallan } 52415eefee25Smacallan else 52425eefee25Smacallan { 52435eefee25Smacallan concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 52445eefee25Smacallan memcpy (concat_name, p, p_len); 52455eefee25Smacallan concat_name[p_len] = '/'; 52465eefee25Smacallan strcpy (concat_name + p_len + 1, wrapper); 52475eefee25Smacallan } 52485eefee25Smacallan if (check_executable(concat_name)) 52495eefee25Smacallan return concat_name; 52505eefee25Smacallan XFREE(concat_name); 52515eefee25Smacallan } 52525eefee25Smacallan } 52535eefee25Smacallan /* not found in PATH; assume curdir */ 52545eefee25Smacallan } 52555eefee25Smacallan /* Relative path | not found in path: prepend cwd */ 52565eefee25Smacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 52575eefee25Smacallan lt_fatal ("getcwd failed"); 52585eefee25Smacallan tmp_len = strlen(tmp); 52595eefee25Smacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52605eefee25Smacallan memcpy (concat_name, tmp, tmp_len); 52615eefee25Smacallan concat_name[tmp_len] = '/'; 52625eefee25Smacallan strcpy (concat_name + tmp_len + 1, wrapper); 52635eefee25Smacallan 52645eefee25Smacallan if (check_executable(concat_name)) 52655eefee25Smacallan return concat_name; 52665eefee25Smacallan XFREE(concat_name); 52675eefee25Smacallan return NULL; 52685eefee25Smacallan} 52695eefee25Smacallan 52705eefee25Smacallanchar * 52715eefee25Smacallanstrendzap(char *str, const char *pat) 52725eefee25Smacallan{ 52735eefee25Smacallan size_t len, patlen; 52745eefee25Smacallan 52755eefee25Smacallan assert(str != NULL); 52765eefee25Smacallan assert(pat != NULL); 52775eefee25Smacallan 52785eefee25Smacallan len = strlen(str); 52795eefee25Smacallan patlen = strlen(pat); 52805eefee25Smacallan 52815eefee25Smacallan if (patlen <= len) 52825eefee25Smacallan { 52835eefee25Smacallan str += len - patlen; 52845eefee25Smacallan if (strcmp(str, pat) == 0) 52855eefee25Smacallan *str = '\0'; 52865eefee25Smacallan } 52875eefee25Smacallan return str; 52885eefee25Smacallan} 52895eefee25Smacallan 52905eefee25Smacallanstatic void 52915eefee25Smacallanlt_error_core (int exit_status, const char * mode, 52925eefee25Smacallan const char * message, va_list ap) 52935eefee25Smacallan{ 52945eefee25Smacallan fprintf (stderr, "%s: %s: ", program_name, mode); 52955eefee25Smacallan vfprintf (stderr, message, ap); 52965eefee25Smacallan fprintf (stderr, ".\n"); 52975eefee25Smacallan 52985eefee25Smacallan if (exit_status >= 0) 52995eefee25Smacallan exit (exit_status); 53005eefee25Smacallan} 53015eefee25Smacallan 53025eefee25Smacallanvoid 53035eefee25Smacallanlt_fatal (const char *message, ...) 53045eefee25Smacallan{ 53055eefee25Smacallan va_list ap; 53065eefee25Smacallan va_start (ap, message); 53075eefee25Smacallan lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 53085eefee25Smacallan va_end (ap); 53095eefee25Smacallan} 53105eefee25SmacallanEOF 53115eefee25Smacallan # we should really use a build-platform specific compiler 53125eefee25Smacallan # here, but OTOH, the wrappers (shell script and this C one) 53135eefee25Smacallan # are only useful if you want to execute the "real" binary. 53145eefee25Smacallan # Since the "real" binary is built for $host, then this 53155eefee25Smacallan # wrapper might as well be built for $host, too. 53165eefee25Smacallan $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 53175eefee25Smacallan ;; 53185eefee25Smacallan esac 53195eefee25Smacallan $rm $output 53205eefee25Smacallan trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 53215eefee25Smacallan 53225eefee25Smacallan $echo > $output "\ 53235eefee25Smacallan#! $SHELL 53245eefee25Smacallan 53255eefee25Smacallan# $output - temporary wrapper script for $objdir/$outputname 53265eefee25Smacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 53275eefee25Smacallan# 53285eefee25Smacallan# The $output program cannot be directly executed until all the libtool 53295eefee25Smacallan# libraries that it depends on are installed. 53305eefee25Smacallan# 53315eefee25Smacallan# This wrapper script should never be moved out of the build directory. 53325eefee25Smacallan# If it is, it will not operate correctly. 53335eefee25Smacallan 53345eefee25Smacallan# Sed substitution that helps us do robust quoting. It backslashifies 53355eefee25Smacallan# metacharacters that are still active within double-quoted strings. 53365eefee25SmacallanXsed='${SED} -e 1s/^X//' 53375eefee25Smacallansed_quote_subst='$sed_quote_subst' 53385eefee25Smacallan 533962ab96baSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 534062ab96baSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 534162ab96baSmrg emulate sh 534262ab96baSmrg NULLCMD=: 534362ab96baSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 534462ab96baSmrg # is contrary to our usage. Disable this feature. 534562ab96baSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 534662ab96baSmrg setopt NO_GLOB_SUBST 534762ab96baSmrgelse 534862ab96baSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 534962ab96baSmrgfi 535062ab96baSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 535162ab96baSmrgDUALCASE=1; export DUALCASE # for MKS sh 535262ab96baSmrg 53535eefee25Smacallan# The HP-UX ksh and POSIX shell print the target directory to stdout 53545eefee25Smacallan# if CDPATH is set. 53555eefee25Smacallan(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 53565eefee25Smacallan 53575eefee25Smacallanrelink_command=\"$relink_command\" 53585eefee25Smacallan 53595eefee25Smacallan# This environment variable determines our operation mode. 53605eefee25Smacallanif test \"\$libtool_install_magic\" = \"$magic\"; then 53615eefee25Smacallan # install mode needs the following variable: 53625eefee25Smacallan notinst_deplibs='$notinst_deplibs' 53635eefee25Smacallanelse 53645eefee25Smacallan # When we are sourced in execute mode, \$file and \$echo are already set. 53655eefee25Smacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 53665eefee25Smacallan echo=\"$qecho\" 53675eefee25Smacallan file=\"\$0\" 53685eefee25Smacallan # Make sure echo works. 53695eefee25Smacallan if test \"X\$1\" = X--no-reexec; then 53705eefee25Smacallan # Discard the --no-reexec flag, and continue. 53715eefee25Smacallan shift 53725eefee25Smacallan elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 53735eefee25Smacallan # Yippee, \$echo works! 53745eefee25Smacallan : 53755eefee25Smacallan else 53765eefee25Smacallan # Restart under the correct shell, and then maybe \$echo will work. 53775eefee25Smacallan exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 53785eefee25Smacallan fi 53795eefee25Smacallan fi\ 53805eefee25Smacallan" 53815eefee25Smacallan $echo >> $output "\ 53825eefee25Smacallan 53835eefee25Smacallan # Find the directory that this script lives in. 53845eefee25Smacallan thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 53855eefee25Smacallan test \"x\$thisdir\" = \"x\$file\" && thisdir=. 53865eefee25Smacallan 53875eefee25Smacallan # Follow symbolic links until we get to the real thisdir. 53885eefee25Smacallan file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 53895eefee25Smacallan while test -n \"\$file\"; do 53905eefee25Smacallan destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 53915eefee25Smacallan 53925eefee25Smacallan # If there was a directory component, then change thisdir. 53935eefee25Smacallan if test \"x\$destdir\" != \"x\$file\"; then 53945eefee25Smacallan case \"\$destdir\" in 53955eefee25Smacallan [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 53965eefee25Smacallan *) thisdir=\"\$thisdir/\$destdir\" ;; 53975eefee25Smacallan esac 53985eefee25Smacallan fi 53995eefee25Smacallan 54005eefee25Smacallan file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 54015eefee25Smacallan file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 54025eefee25Smacallan done 54035eefee25Smacallan 54045eefee25Smacallan # Try to get the absolute directory name. 54055eefee25Smacallan absdir=\`cd \"\$thisdir\" && pwd\` 54065eefee25Smacallan test -n \"\$absdir\" && thisdir=\"\$absdir\" 54075eefee25Smacallan" 54085eefee25Smacallan 54095eefee25Smacallan if test "$fast_install" = yes; then 54105eefee25Smacallan $echo >> $output "\ 54115eefee25Smacallan program=lt-'$outputname'$exeext 54125eefee25Smacallan progdir=\"\$thisdir/$objdir\" 54135eefee25Smacallan 54145eefee25Smacallan if test ! -f \"\$progdir/\$program\" || \\ 54155eefee25Smacallan { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 54165eefee25Smacallan test \"X\$file\" != \"X\$progdir/\$program\"; }; then 54175eefee25Smacallan 54185eefee25Smacallan file=\"\$\$-\$program\" 54195eefee25Smacallan 54205eefee25Smacallan if test ! -d \"\$progdir\"; then 54215eefee25Smacallan $mkdir \"\$progdir\" 54225eefee25Smacallan else 54235eefee25Smacallan $rm \"\$progdir/\$file\" 54245eefee25Smacallan fi" 54255eefee25Smacallan 54265eefee25Smacallan $echo >> $output "\ 54275eefee25Smacallan 54285eefee25Smacallan # relink executable if necessary 54295eefee25Smacallan if test -n \"\$relink_command\"; then 54305eefee25Smacallan if relink_command_output=\`eval \$relink_command 2>&1\`; then : 54315eefee25Smacallan else 54325eefee25Smacallan $echo \"\$relink_command_output\" >&2 54335eefee25Smacallan $rm \"\$progdir/\$file\" 54345eefee25Smacallan exit $EXIT_FAILURE 54355eefee25Smacallan fi 54365eefee25Smacallan fi 54375eefee25Smacallan 54385eefee25Smacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 54395eefee25Smacallan { $rm \"\$progdir/\$program\"; 54405eefee25Smacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 54415eefee25Smacallan $rm \"\$progdir/\$file\" 54425eefee25Smacallan fi" 54435eefee25Smacallan else 54445eefee25Smacallan $echo >> $output "\ 54455eefee25Smacallan program='$outputname' 54465eefee25Smacallan progdir=\"\$thisdir/$objdir\" 54475eefee25Smacallan" 54485eefee25Smacallan fi 54495eefee25Smacallan 54505eefee25Smacallan $echo >> $output "\ 54515eefee25Smacallan 54525eefee25Smacallan if test -f \"\$progdir/\$program\"; then" 54535eefee25Smacallan 54545eefee25Smacallan # Export our shlibpath_var if we have one. 54555eefee25Smacallan if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 54565eefee25Smacallan $echo >> $output "\ 54575eefee25Smacallan # Add our own library path to $shlibpath_var 54585eefee25Smacallan $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 54595eefee25Smacallan 54605eefee25Smacallan # Some systems cannot cope with colon-terminated $shlibpath_var 54615eefee25Smacallan # The second colon is a workaround for a bug in BeOS R4 sed 54625eefee25Smacallan $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 54635eefee25Smacallan 54645eefee25Smacallan export $shlibpath_var 54655eefee25Smacallan" 54665eefee25Smacallan fi 54675eefee25Smacallan 54685eefee25Smacallan # fixup the dll searchpath if we need to. 54695eefee25Smacallan if test -n "$dllsearchpath"; then 54705eefee25Smacallan $echo >> $output "\ 54715eefee25Smacallan # Add the dll search path components to the executable PATH 54725eefee25Smacallan PATH=$dllsearchpath:\$PATH 54735eefee25Smacallan" 54745eefee25Smacallan fi 54755eefee25Smacallan 54765eefee25Smacallan $echo >> $output "\ 54775eefee25Smacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 54785eefee25Smacallan # Run the actual program with our arguments. 54795eefee25Smacallan" 54805eefee25Smacallan case $host in 54815eefee25Smacallan # Backslashes separate directories on plain windows 54825eefee25Smacallan *-*-mingw | *-*-os2*) 54835eefee25Smacallan $echo >> $output "\ 54845eefee25Smacallan exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 54855eefee25Smacallan" 54865eefee25Smacallan ;; 54875eefee25Smacallan 54885eefee25Smacallan *) 54895eefee25Smacallan $echo >> $output "\ 54905eefee25Smacallan exec \"\$progdir/\$program\" \${1+\"\$@\"} 54915eefee25Smacallan" 54925eefee25Smacallan ;; 54935eefee25Smacallan esac 54945eefee25Smacallan $echo >> $output "\ 549562ab96baSmrg \$echo \"\$0: cannot exec \$program \$*\" 54965eefee25Smacallan exit $EXIT_FAILURE 54975eefee25Smacallan fi 54985eefee25Smacallan else 54995eefee25Smacallan # The program doesn't exist. 55005eefee25Smacallan \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 55015eefee25Smacallan \$echo \"This script is just a wrapper for \$program.\" 1>&2 55025eefee25Smacallan $echo \"See the $PACKAGE documentation for more information.\" 1>&2 55035eefee25Smacallan exit $EXIT_FAILURE 55045eefee25Smacallan fi 55055eefee25Smacallanfi\ 55065eefee25Smacallan" 55075eefee25Smacallan chmod +x $output 55085eefee25Smacallan fi 55095eefee25Smacallan exit $EXIT_SUCCESS 55105eefee25Smacallan ;; 55115eefee25Smacallan esac 55125eefee25Smacallan 55135eefee25Smacallan # See if we need to build an old-fashioned archive. 55145eefee25Smacallan for oldlib in $oldlibs; do 55155eefee25Smacallan 55165eefee25Smacallan if test "$build_libtool_libs" = convenience; then 55175eefee25Smacallan oldobjs="$libobjs_save" 55185eefee25Smacallan addlibs="$convenience" 55195eefee25Smacallan build_libtool_libs=no 55205eefee25Smacallan else 55215eefee25Smacallan if test "$build_libtool_libs" = module; then 55225eefee25Smacallan oldobjs="$libobjs_save" 55235eefee25Smacallan build_libtool_libs=no 55245eefee25Smacallan else 55255eefee25Smacallan oldobjs="$old_deplibs $non_pic_objects" 55265eefee25Smacallan fi 55275eefee25Smacallan addlibs="$old_convenience" 55285eefee25Smacallan fi 55295eefee25Smacallan 55305eefee25Smacallan if test -n "$addlibs"; then 55315eefee25Smacallan gentop="$output_objdir/${outputname}x" 55325eefee25Smacallan generated="$generated $gentop" 55335eefee25Smacallan 55345eefee25Smacallan func_extract_archives $gentop $addlibs 55355eefee25Smacallan oldobjs="$oldobjs $func_extract_archives_result" 55365eefee25Smacallan fi 55375eefee25Smacallan 55385eefee25Smacallan # Do each command in the archive commands. 55395eefee25Smacallan if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 55405eefee25Smacallan cmds=$old_archive_from_new_cmds 55415eefee25Smacallan else 55425eefee25Smacallan # POSIX demands no paths to be encoded in archives. We have 55435eefee25Smacallan # to avoid creating archives with duplicate basenames if we 55445eefee25Smacallan # might have to extract them afterwards, e.g., when creating a 55455eefee25Smacallan # static archive out of a convenience library, or when linking 55465eefee25Smacallan # the entirety of a libtool archive into another (currently 55475eefee25Smacallan # not supported by libtool). 55485eefee25Smacallan if (for obj in $oldobjs 55495eefee25Smacallan do 55505eefee25Smacallan $echo "X$obj" | $Xsed -e 's%^.*/%%' 55515eefee25Smacallan done | sort | sort -uc >/dev/null 2>&1); then 55525eefee25Smacallan : 55535eefee25Smacallan else 55545eefee25Smacallan $echo "copying selected object files to avoid basename conflicts..." 55555eefee25Smacallan 55565eefee25Smacallan if test -z "$gentop"; then 55575eefee25Smacallan gentop="$output_objdir/${outputname}x" 55585eefee25Smacallan generated="$generated $gentop" 55595eefee25Smacallan 55605eefee25Smacallan $show "${rm}r $gentop" 55615eefee25Smacallan $run ${rm}r "$gentop" 55625eefee25Smacallan $show "$mkdir $gentop" 55635eefee25Smacallan $run $mkdir "$gentop" 55645eefee25Smacallan exit_status=$? 55655eefee25Smacallan if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 55665eefee25Smacallan exit $exit_status 55675eefee25Smacallan fi 55685eefee25Smacallan fi 55695eefee25Smacallan 55705eefee25Smacallan save_oldobjs=$oldobjs 55715eefee25Smacallan oldobjs= 55725eefee25Smacallan counter=1 55735eefee25Smacallan for obj in $save_oldobjs 55745eefee25Smacallan do 55755eefee25Smacallan objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 55765eefee25Smacallan case " $oldobjs " in 55775eefee25Smacallan " ") oldobjs=$obj ;; 55785eefee25Smacallan *[\ /]"$objbase "*) 55795eefee25Smacallan while :; do 55805eefee25Smacallan # Make sure we don't pick an alternate name that also 55815eefee25Smacallan # overlaps. 55825eefee25Smacallan newobj=lt$counter-$objbase 55835eefee25Smacallan counter=`expr $counter + 1` 55845eefee25Smacallan case " $oldobjs " in 55855eefee25Smacallan *[\ /]"$newobj "*) ;; 55865eefee25Smacallan *) if test ! -f "$gentop/$newobj"; then break; fi ;; 55875eefee25Smacallan esac 55885eefee25Smacallan done 55895eefee25Smacallan $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 55905eefee25Smacallan $run ln "$obj" "$gentop/$newobj" || 55915eefee25Smacallan $run cp "$obj" "$gentop/$newobj" 55925eefee25Smacallan oldobjs="$oldobjs $gentop/$newobj" 55935eefee25Smacallan ;; 55945eefee25Smacallan *) oldobjs="$oldobjs $obj" ;; 55955eefee25Smacallan esac 55965eefee25Smacallan done 55975eefee25Smacallan fi 55985eefee25Smacallan 55995eefee25Smacallan eval cmds=\"$old_archive_cmds\" 56005eefee25Smacallan 56015eefee25Smacallan if len=`expr "X$cmds" : ".*"` && 56025eefee25Smacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 56035eefee25Smacallan cmds=$old_archive_cmds 56045eefee25Smacallan else 56055eefee25Smacallan # the command line is too long to link in one step, link in parts 56065eefee25Smacallan $echo "using piecewise archive linking..." 56075eefee25Smacallan save_RANLIB=$RANLIB 56085eefee25Smacallan RANLIB=: 56095eefee25Smacallan objlist= 56105eefee25Smacallan concat_cmds= 56115eefee25Smacallan save_oldobjs=$oldobjs 56125eefee25Smacallan 56135eefee25Smacallan # Is there a better way of finding the last object in the list? 56145eefee25Smacallan for obj in $save_oldobjs 56155eefee25Smacallan do 56165eefee25Smacallan last_oldobj=$obj 56175eefee25Smacallan done 56185eefee25Smacallan for obj in $save_oldobjs 56195eefee25Smacallan do 56205eefee25Smacallan oldobjs="$objlist $obj" 56215eefee25Smacallan objlist="$objlist $obj" 56225eefee25Smacallan eval test_cmds=\"$old_archive_cmds\" 56235eefee25Smacallan if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 56245eefee25Smacallan test "$len" -le "$max_cmd_len"; then 56255eefee25Smacallan : 56265eefee25Smacallan else 56275eefee25Smacallan # the above command should be used before it gets too long 56285eefee25Smacallan oldobjs=$objlist 56295eefee25Smacallan if test "$obj" = "$last_oldobj" ; then 56305eefee25Smacallan RANLIB=$save_RANLIB 56315eefee25Smacallan fi 56325eefee25Smacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 56335eefee25Smacallan eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 56345eefee25Smacallan objlist= 56355eefee25Smacallan fi 56365eefee25Smacallan done 56375eefee25Smacallan RANLIB=$save_RANLIB 56385eefee25Smacallan oldobjs=$objlist 56395eefee25Smacallan if test "X$oldobjs" = "X" ; then 56405eefee25Smacallan eval cmds=\"\$concat_cmds\" 56415eefee25Smacallan else 56425eefee25Smacallan eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 56435eefee25Smacallan fi 56445eefee25Smacallan fi 56455eefee25Smacallan fi 56465eefee25Smacallan save_ifs="$IFS"; IFS='~' 56475eefee25Smacallan for cmd in $cmds; do 56485eefee25Smacallan eval cmd=\"$cmd\" 56495eefee25Smacallan IFS="$save_ifs" 56505eefee25Smacallan $show "$cmd" 56515eefee25Smacallan $run eval "$cmd" || exit $? 56525eefee25Smacallan done 56535eefee25Smacallan IFS="$save_ifs" 56545eefee25Smacallan done 56555eefee25Smacallan 56565eefee25Smacallan if test -n "$generated"; then 56575eefee25Smacallan $show "${rm}r$generated" 56585eefee25Smacallan $run ${rm}r$generated 56595eefee25Smacallan fi 56605eefee25Smacallan 56615eefee25Smacallan # Now create the libtool archive. 56625eefee25Smacallan case $output in 56635eefee25Smacallan *.la) 56645eefee25Smacallan old_library= 56655eefee25Smacallan test "$build_old_libs" = yes && old_library="$libname.$libext" 56665eefee25Smacallan $show "creating $output" 56675eefee25Smacallan 56685eefee25Smacallan # Preserve any variables that may affect compiler behavior 56695eefee25Smacallan for var in $variables_saved_for_relink; do 56705eefee25Smacallan if eval test -z \"\${$var+set}\"; then 56715eefee25Smacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 56725eefee25Smacallan elif eval var_value=\$$var; test -z "$var_value"; then 56735eefee25Smacallan relink_command="$var=; export $var; $relink_command" 56745eefee25Smacallan else 56755eefee25Smacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 56765eefee25Smacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 56775eefee25Smacallan fi 56785eefee25Smacallan done 56795eefee25Smacallan # Quote the link command for shipping. 56805eefee25Smacallan relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 568162ab96baSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 56825eefee25Smacallan if test "$hardcode_automatic" = yes ; then 56835eefee25Smacallan relink_command= 56845eefee25Smacallan fi 56855eefee25Smacallan 56865eefee25Smacallan 56875eefee25Smacallan # Only create the output if not a dry run. 56885eefee25Smacallan if test -z "$run"; then 56895eefee25Smacallan for installed in no yes; do 56905eefee25Smacallan if test "$installed" = yes; then 56915eefee25Smacallan if test -z "$install_libdir"; then 56925eefee25Smacallan break 56935eefee25Smacallan fi 56945eefee25Smacallan output="$output_objdir/$outputname"i 56955eefee25Smacallan # Replace all uninstalled libtool libraries with the installed ones 56965eefee25Smacallan newdependency_libs= 56975eefee25Smacallan for deplib in $dependency_libs; do 56985eefee25Smacallan case $deplib in 56995eefee25Smacallan *.la) 57005eefee25Smacallan name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 57015eefee25Smacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 57025eefee25Smacallan if test -z "$libdir"; then 57035eefee25Smacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 57045eefee25Smacallan exit $EXIT_FAILURE 57055eefee25Smacallan fi 57065eefee25Smacallan newdependency_libs="$newdependency_libs $libdir/$name" 57075eefee25Smacallan ;; 57085eefee25Smacallan *) newdependency_libs="$newdependency_libs $deplib" ;; 57095eefee25Smacallan esac 57105eefee25Smacallan done 57115eefee25Smacallan dependency_libs="$newdependency_libs" 57125eefee25Smacallan newdlfiles= 57135eefee25Smacallan for lib in $dlfiles; do 57145eefee25Smacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57155eefee25Smacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57165eefee25Smacallan if test -z "$libdir"; then 57175eefee25Smacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57185eefee25Smacallan exit $EXIT_FAILURE 57195eefee25Smacallan fi 57205eefee25Smacallan newdlfiles="$newdlfiles $libdir/$name" 57215eefee25Smacallan done 57225eefee25Smacallan dlfiles="$newdlfiles" 57235eefee25Smacallan newdlprefiles= 57245eefee25Smacallan for lib in $dlprefiles; do 57255eefee25Smacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57265eefee25Smacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57275eefee25Smacallan if test -z "$libdir"; then 57285eefee25Smacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57295eefee25Smacallan exit $EXIT_FAILURE 57305eefee25Smacallan fi 57315eefee25Smacallan newdlprefiles="$newdlprefiles $libdir/$name" 57325eefee25Smacallan done 57335eefee25Smacallan dlprefiles="$newdlprefiles" 57345eefee25Smacallan else 57355eefee25Smacallan newdlfiles= 57365eefee25Smacallan for lib in $dlfiles; do 57375eefee25Smacallan case $lib in 57385eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57395eefee25Smacallan *) abs=`pwd`"/$lib" ;; 57405eefee25Smacallan esac 57415eefee25Smacallan newdlfiles="$newdlfiles $abs" 57425eefee25Smacallan done 57435eefee25Smacallan dlfiles="$newdlfiles" 57445eefee25Smacallan newdlprefiles= 57455eefee25Smacallan for lib in $dlprefiles; do 57465eefee25Smacallan case $lib in 57475eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57485eefee25Smacallan *) abs=`pwd`"/$lib" ;; 57495eefee25Smacallan esac 57505eefee25Smacallan newdlprefiles="$newdlprefiles $abs" 57515eefee25Smacallan done 57525eefee25Smacallan dlprefiles="$newdlprefiles" 57535eefee25Smacallan fi 57545eefee25Smacallan $rm $output 57555eefee25Smacallan # place dlname in correct position for cygwin 57565eefee25Smacallan tdlname=$dlname 57575eefee25Smacallan case $host,$output,$installed,$module,$dlname in 57585eefee25Smacallan *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 57595eefee25Smacallan esac 57605eefee25Smacallan $echo > $output "\ 57615eefee25Smacallan# $outputname - a libtool library file 57625eefee25Smacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 57635eefee25Smacallan# 57645eefee25Smacallan# Please DO NOT delete this file! 57655eefee25Smacallan# It is necessary for linking the library. 57665eefee25Smacallan 57675eefee25Smacallan# The name that we can dlopen(3). 57685eefee25Smacallandlname='$tdlname' 57695eefee25Smacallan 57705eefee25Smacallan# Names of this library. 57715eefee25Smacallanlibrary_names='$library_names' 57725eefee25Smacallan 57735eefee25Smacallan# The name of the static archive. 57745eefee25Smacallanold_library='$old_library' 57755eefee25Smacallan 57765eefee25Smacallan# Libraries that this one depends upon. 57775eefee25Smacallandependency_libs='$dependency_libs' 57785eefee25Smacallan 57795eefee25Smacallan# Version information for $libname. 57805eefee25Smacallancurrent=$current 57815eefee25Smacallanage=$age 57825eefee25Smacallanrevision=$revision 57835eefee25Smacallan 57845eefee25Smacallan# Is this an already installed library? 57855eefee25Smacallaninstalled=$installed 57865eefee25Smacallan 57875eefee25Smacallan# Should we warn about portability when linking against -modules? 57885eefee25Smacallanshouldnotlink=$module 57895eefee25Smacallan 57905eefee25Smacallan# Files to dlopen/dlpreopen 57915eefee25Smacallandlopen='$dlfiles' 57925eefee25Smacallandlpreopen='$dlprefiles' 57935eefee25Smacallan 57945eefee25Smacallan# Directory that this library needs to be installed in: 57955eefee25Smacallanlibdir='$install_libdir'" 57965eefee25Smacallan if test "$installed" = no && test "$need_relink" = yes; then 57975eefee25Smacallan $echo >> $output "\ 57985eefee25Smacallanrelink_command=\"$relink_command\"" 57995eefee25Smacallan fi 58005eefee25Smacallan done 58015eefee25Smacallan fi 58025eefee25Smacallan 58035eefee25Smacallan # Do a symbolic link so that the libtool archive can be found in 58045eefee25Smacallan # LD_LIBRARY_PATH before the program is installed. 58055eefee25Smacallan $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 58065eefee25Smacallan $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 58075eefee25Smacallan ;; 58085eefee25Smacallan esac 58095eefee25Smacallan exit $EXIT_SUCCESS 58105eefee25Smacallan ;; 58115eefee25Smacallan 58125eefee25Smacallan # libtool install mode 58135eefee25Smacallan install) 58145eefee25Smacallan modename="$modename: install" 58155eefee25Smacallan 58165eefee25Smacallan # There may be an optional sh(1) argument at the beginning of 58175eefee25Smacallan # install_prog (especially on Windows NT). 58185eefee25Smacallan if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 58195eefee25Smacallan # Allow the use of GNU shtool's install command. 58205eefee25Smacallan $echo "X$nonopt" | grep shtool > /dev/null; then 58215eefee25Smacallan # Aesthetically quote it. 58225eefee25Smacallan arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 58235eefee25Smacallan case $arg in 58245eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58255eefee25Smacallan arg="\"$arg\"" 58265eefee25Smacallan ;; 58275eefee25Smacallan esac 58285eefee25Smacallan install_prog="$arg " 58295eefee25Smacallan arg="$1" 58305eefee25Smacallan shift 58315eefee25Smacallan else 58325eefee25Smacallan install_prog= 58335eefee25Smacallan arg=$nonopt 58345eefee25Smacallan fi 58355eefee25Smacallan 58365eefee25Smacallan # The real first argument should be the name of the installation program. 58375eefee25Smacallan # Aesthetically quote it. 58385eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58395eefee25Smacallan case $arg in 58405eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58415eefee25Smacallan arg="\"$arg\"" 58425eefee25Smacallan ;; 58435eefee25Smacallan esac 58445eefee25Smacallan install_prog="$install_prog$arg" 58455eefee25Smacallan 58465eefee25Smacallan # We need to accept at least all the BSD install flags. 58475eefee25Smacallan dest= 58485eefee25Smacallan files= 58495eefee25Smacallan opts= 58505eefee25Smacallan prev= 58515eefee25Smacallan install_type= 58525eefee25Smacallan isdir=no 58535eefee25Smacallan stripme= 58545eefee25Smacallan for arg 58555eefee25Smacallan do 58565eefee25Smacallan if test -n "$dest"; then 58575eefee25Smacallan files="$files $dest" 58585eefee25Smacallan dest=$arg 58595eefee25Smacallan continue 58605eefee25Smacallan fi 58615eefee25Smacallan 58625eefee25Smacallan case $arg in 58635eefee25Smacallan -d) isdir=yes ;; 58645eefee25Smacallan -f) 58655eefee25Smacallan case " $install_prog " in 58665eefee25Smacallan *[\\\ /]cp\ *) ;; 58675eefee25Smacallan *) prev=$arg ;; 58685eefee25Smacallan esac 58695eefee25Smacallan ;; 58705eefee25Smacallan -g | -m | -o) prev=$arg ;; 58715eefee25Smacallan -s) 58725eefee25Smacallan stripme=" -s" 58735eefee25Smacallan continue 58745eefee25Smacallan ;; 58755eefee25Smacallan -*) 58765eefee25Smacallan ;; 58775eefee25Smacallan *) 58785eefee25Smacallan # If the previous option needed an argument, then skip it. 58795eefee25Smacallan if test -n "$prev"; then 58805eefee25Smacallan prev= 58815eefee25Smacallan else 58825eefee25Smacallan dest=$arg 58835eefee25Smacallan continue 58845eefee25Smacallan fi 58855eefee25Smacallan ;; 58865eefee25Smacallan esac 58875eefee25Smacallan 58885eefee25Smacallan # Aesthetically quote the argument. 58895eefee25Smacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58905eefee25Smacallan case $arg in 58915eefee25Smacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58925eefee25Smacallan arg="\"$arg\"" 58935eefee25Smacallan ;; 58945eefee25Smacallan esac 58955eefee25Smacallan install_prog="$install_prog $arg" 58965eefee25Smacallan done 58975eefee25Smacallan 58985eefee25Smacallan if test -z "$install_prog"; then 58995eefee25Smacallan $echo "$modename: you must specify an install program" 1>&2 59005eefee25Smacallan $echo "$help" 1>&2 59015eefee25Smacallan exit $EXIT_FAILURE 59025eefee25Smacallan fi 59035eefee25Smacallan 59045eefee25Smacallan if test -n "$prev"; then 59055eefee25Smacallan $echo "$modename: the \`$prev' option requires an argument" 1>&2 59065eefee25Smacallan $echo "$help" 1>&2 59075eefee25Smacallan exit $EXIT_FAILURE 59085eefee25Smacallan fi 59095eefee25Smacallan 59105eefee25Smacallan if test -z "$files"; then 59115eefee25Smacallan if test -z "$dest"; then 59125eefee25Smacallan $echo "$modename: no file or destination specified" 1>&2 59135eefee25Smacallan else 59145eefee25Smacallan $echo "$modename: you must specify a destination" 1>&2 59155eefee25Smacallan fi 59165eefee25Smacallan $echo "$help" 1>&2 59175eefee25Smacallan exit $EXIT_FAILURE 59185eefee25Smacallan fi 59195eefee25Smacallan 59205eefee25Smacallan # Strip any trailing slash from the destination. 59215eefee25Smacallan dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 59225eefee25Smacallan 59235eefee25Smacallan # Check to see that the destination is a directory. 59245eefee25Smacallan test -d "$dest" && isdir=yes 59255eefee25Smacallan if test "$isdir" = yes; then 59265eefee25Smacallan destdir="$dest" 59275eefee25Smacallan destname= 59285eefee25Smacallan else 59295eefee25Smacallan destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 59305eefee25Smacallan test "X$destdir" = "X$dest" && destdir=. 59315eefee25Smacallan destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 59325eefee25Smacallan 59335eefee25Smacallan # Not a directory, so check to see that there is only one file specified. 59345eefee25Smacallan set dummy $files 59355eefee25Smacallan if test "$#" -gt 2; then 59365eefee25Smacallan $echo "$modename: \`$dest' is not a directory" 1>&2 59375eefee25Smacallan $echo "$help" 1>&2 59385eefee25Smacallan exit $EXIT_FAILURE 59395eefee25Smacallan fi 59405eefee25Smacallan fi 59415eefee25Smacallan case $destdir in 59425eefee25Smacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 59435eefee25Smacallan *) 59445eefee25Smacallan for file in $files; do 59455eefee25Smacallan case $file in 59465eefee25Smacallan *.lo) ;; 59475eefee25Smacallan *) 59485eefee25Smacallan $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 59495eefee25Smacallan $echo "$help" 1>&2 59505eefee25Smacallan exit $EXIT_FAILURE 59515eefee25Smacallan ;; 59525eefee25Smacallan esac 59535eefee25Smacallan done 59545eefee25Smacallan ;; 59555eefee25Smacallan esac 59565eefee25Smacallan 59575eefee25Smacallan # This variable tells wrapper scripts just to set variables rather 59585eefee25Smacallan # than running their programs. 59595eefee25Smacallan libtool_install_magic="$magic" 59605eefee25Smacallan 59615eefee25Smacallan staticlibs= 59625eefee25Smacallan future_libdirs= 59635eefee25Smacallan current_libdirs= 59645eefee25Smacallan for file in $files; do 59655eefee25Smacallan 59665eefee25Smacallan # Do each installation. 59675eefee25Smacallan case $file in 59685eefee25Smacallan *.$libext) 59695eefee25Smacallan # Do the static libraries later. 59705eefee25Smacallan staticlibs="$staticlibs $file" 59715eefee25Smacallan ;; 59725eefee25Smacallan 59735eefee25Smacallan *.la) 59745eefee25Smacallan # Check to see that this really is a libtool archive. 59755eefee25Smacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 59765eefee25Smacallan else 59775eefee25Smacallan $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 59785eefee25Smacallan $echo "$help" 1>&2 59795eefee25Smacallan exit $EXIT_FAILURE 59805eefee25Smacallan fi 59815eefee25Smacallan 59825eefee25Smacallan library_names= 59835eefee25Smacallan old_library= 59845eefee25Smacallan relink_command= 59855eefee25Smacallan # If there is no directory component, then add one. 59865eefee25Smacallan case $file in 59875eefee25Smacallan */* | *\\*) . $file ;; 59885eefee25Smacallan *) . ./$file ;; 59895eefee25Smacallan esac 59905eefee25Smacallan 59915eefee25Smacallan # Add the libdir to current_libdirs if it is the destination. 59925eefee25Smacallan if test "X$destdir" = "X$libdir"; then 59935eefee25Smacallan case "$current_libdirs " in 59945eefee25Smacallan *" $libdir "*) ;; 59955eefee25Smacallan *) current_libdirs="$current_libdirs $libdir" ;; 59965eefee25Smacallan esac 59975eefee25Smacallan else 59985eefee25Smacallan # Note the libdir as a future libdir. 59995eefee25Smacallan case "$future_libdirs " in 60005eefee25Smacallan *" $libdir "*) ;; 60015eefee25Smacallan *) future_libdirs="$future_libdirs $libdir" ;; 60025eefee25Smacallan esac 60035eefee25Smacallan fi 60045eefee25Smacallan 60055eefee25Smacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 60065eefee25Smacallan test "X$dir" = "X$file/" && dir= 60075eefee25Smacallan dir="$dir$objdir" 60085eefee25Smacallan 60095eefee25Smacallan if test -n "$relink_command"; then 60105eefee25Smacallan # Determine the prefix the user has applied to our future dir. 60115eefee25Smacallan inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 60125eefee25Smacallan 60135eefee25Smacallan # Don't allow the user to place us outside of our expected 60145eefee25Smacallan # location b/c this prevents finding dependent libraries that 60155eefee25Smacallan # are installed to the same prefix. 60165eefee25Smacallan # At present, this check doesn't affect windows .dll's that 60175eefee25Smacallan # are installed into $libdir/../bin (currently, that works fine) 60185eefee25Smacallan # but it's something to keep an eye on. 60195eefee25Smacallan if test "$inst_prefix_dir" = "$destdir"; then 60205eefee25Smacallan $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 60215eefee25Smacallan exit $EXIT_FAILURE 60225eefee25Smacallan fi 60235eefee25Smacallan 60245eefee25Smacallan if test -n "$inst_prefix_dir"; then 60255eefee25Smacallan # Stick the inst_prefix_dir data into the link command. 602662ab96baSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 60275eefee25Smacallan else 602862ab96baSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 60295eefee25Smacallan fi 60305eefee25Smacallan 60315eefee25Smacallan $echo "$modename: warning: relinking \`$file'" 1>&2 60325eefee25Smacallan $show "$relink_command" 60335eefee25Smacallan if $run eval "$relink_command"; then : 60345eefee25Smacallan else 60355eefee25Smacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 60365eefee25Smacallan exit $EXIT_FAILURE 60375eefee25Smacallan fi 60385eefee25Smacallan fi 60395eefee25Smacallan 60405eefee25Smacallan # See the names of the shared library. 60415eefee25Smacallan set dummy $library_names 60425eefee25Smacallan if test -n "$2"; then 60435eefee25Smacallan realname="$2" 60445eefee25Smacallan shift 60455eefee25Smacallan shift 60465eefee25Smacallan 60475eefee25Smacallan srcname="$realname" 60485eefee25Smacallan test -n "$relink_command" && srcname="$realname"T 60495eefee25Smacallan 60505eefee25Smacallan # Install the shared library and build the symlinks. 60515eefee25Smacallan $show "$install_prog $dir/$srcname $destdir/$realname" 60525eefee25Smacallan $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 60535eefee25Smacallan if test -n "$stripme" && test -n "$striplib"; then 60545eefee25Smacallan $show "$striplib $destdir/$realname" 60555eefee25Smacallan $run eval "$striplib $destdir/$realname" || exit $? 60565eefee25Smacallan fi 60575eefee25Smacallan 60585eefee25Smacallan if test "$#" -gt 0; then 60595eefee25Smacallan # Delete the old symlinks, and create new ones. 60605eefee25Smacallan # Try `ln -sf' first, because the `ln' binary might depend on 60615eefee25Smacallan # the symlink we replace! Solaris /bin/ln does not understand -f, 60625eefee25Smacallan # so we also need to try rm && ln -s. 60635eefee25Smacallan for linkname 60645eefee25Smacallan do 60655eefee25Smacallan if test "$linkname" != "$realname"; then 60665eefee25Smacallan $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60675eefee25Smacallan $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60685eefee25Smacallan fi 60695eefee25Smacallan done 60705eefee25Smacallan fi 60715eefee25Smacallan 60725eefee25Smacallan # Do each command in the postinstall commands. 60735eefee25Smacallan lib="$destdir/$realname" 60745eefee25Smacallan cmds=$postinstall_cmds 60755eefee25Smacallan save_ifs="$IFS"; IFS='~' 60765eefee25Smacallan for cmd in $cmds; do 60775eefee25Smacallan IFS="$save_ifs" 60785eefee25Smacallan eval cmd=\"$cmd\" 60795eefee25Smacallan $show "$cmd" 60805eefee25Smacallan $run eval "$cmd" || { 60815eefee25Smacallan lt_exit=$? 60825eefee25Smacallan 60835eefee25Smacallan # Restore the uninstalled library and exit 60845eefee25Smacallan if test "$mode" = relink; then 60855eefee25Smacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 60865eefee25Smacallan fi 60875eefee25Smacallan 60885eefee25Smacallan exit $lt_exit 60895eefee25Smacallan } 60905eefee25Smacallan done 60915eefee25Smacallan IFS="$save_ifs" 60925eefee25Smacallan fi 60935eefee25Smacallan 60945eefee25Smacallan # Install the pseudo-library for information purposes. 60955eefee25Smacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60965eefee25Smacallan instname="$dir/$name"i 60975eefee25Smacallan $show "$install_prog $instname $destdir/$name" 60985eefee25Smacallan $run eval "$install_prog $instname $destdir/$name" || exit $? 60995eefee25Smacallan 61005eefee25Smacallan # Maybe install the static library, too. 61015eefee25Smacallan test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 61025eefee25Smacallan ;; 61035eefee25Smacallan 61045eefee25Smacallan *.lo) 61055eefee25Smacallan # Install (i.e. copy) a libtool object. 61065eefee25Smacallan 61075eefee25Smacallan # Figure out destination file name, if it wasn't already specified. 61085eefee25Smacallan if test -n "$destname"; then 61095eefee25Smacallan destfile="$destdir/$destname" 61105eefee25Smacallan else 61115eefee25Smacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61125eefee25Smacallan destfile="$destdir/$destfile" 61135eefee25Smacallan fi 61145eefee25Smacallan 61155eefee25Smacallan # Deduce the name of the destination old-style object file. 61165eefee25Smacallan case $destfile in 61175eefee25Smacallan *.lo) 61185eefee25Smacallan staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 61195eefee25Smacallan ;; 61205eefee25Smacallan *.$objext) 61215eefee25Smacallan staticdest="$destfile" 61225eefee25Smacallan destfile= 61235eefee25Smacallan ;; 61245eefee25Smacallan *) 61255eefee25Smacallan $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 61265eefee25Smacallan $echo "$help" 1>&2 61275eefee25Smacallan exit $EXIT_FAILURE 61285eefee25Smacallan ;; 61295eefee25Smacallan esac 61305eefee25Smacallan 61315eefee25Smacallan # Install the libtool object if requested. 61325eefee25Smacallan if test -n "$destfile"; then 61335eefee25Smacallan $show "$install_prog $file $destfile" 61345eefee25Smacallan $run eval "$install_prog $file $destfile" || exit $? 61355eefee25Smacallan fi 61365eefee25Smacallan 61375eefee25Smacallan # Install the old object if enabled. 61385eefee25Smacallan if test "$build_old_libs" = yes; then 61395eefee25Smacallan # Deduce the name of the old-style object file. 61405eefee25Smacallan staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 61415eefee25Smacallan 61425eefee25Smacallan $show "$install_prog $staticobj $staticdest" 61435eefee25Smacallan $run eval "$install_prog \$staticobj \$staticdest" || exit $? 61445eefee25Smacallan fi 61455eefee25Smacallan exit $EXIT_SUCCESS 61465eefee25Smacallan ;; 61475eefee25Smacallan 61485eefee25Smacallan *) 61495eefee25Smacallan # Figure out destination file name, if it wasn't already specified. 61505eefee25Smacallan if test -n "$destname"; then 61515eefee25Smacallan destfile="$destdir/$destname" 61525eefee25Smacallan else 61535eefee25Smacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61545eefee25Smacallan destfile="$destdir/$destfile" 61555eefee25Smacallan fi 61565eefee25Smacallan 61575eefee25Smacallan # If the file is missing, and there is a .exe on the end, strip it 61585eefee25Smacallan # because it is most likely a libtool script we actually want to 61595eefee25Smacallan # install 61605eefee25Smacallan stripped_ext="" 61615eefee25Smacallan case $file in 61625eefee25Smacallan *.exe) 61635eefee25Smacallan if test ! -f "$file"; then 61645eefee25Smacallan file=`$echo $file|${SED} 's,.exe$,,'` 61655eefee25Smacallan stripped_ext=".exe" 61665eefee25Smacallan fi 61675eefee25Smacallan ;; 61685eefee25Smacallan esac 61695eefee25Smacallan 61705eefee25Smacallan # Do a test to see if this is really a libtool program. 61715eefee25Smacallan case $host in 61725eefee25Smacallan *cygwin*|*mingw*) 61735eefee25Smacallan wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 61745eefee25Smacallan ;; 61755eefee25Smacallan *) 61765eefee25Smacallan wrapper=$file 61775eefee25Smacallan ;; 61785eefee25Smacallan esac 61795eefee25Smacallan if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 61805eefee25Smacallan notinst_deplibs= 61815eefee25Smacallan relink_command= 61825eefee25Smacallan 61835eefee25Smacallan # Note that it is not necessary on cygwin/mingw to append a dot to 61845eefee25Smacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 61855eefee25Smacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 61865eefee25Smacallan # `FILE.' does not work on cygwin managed mounts. 61875eefee25Smacallan # 61885eefee25Smacallan # If there is no directory component, then add one. 61895eefee25Smacallan case $wrapper in 61905eefee25Smacallan */* | *\\*) . ${wrapper} ;; 61915eefee25Smacallan *) . ./${wrapper} ;; 61925eefee25Smacallan esac 61935eefee25Smacallan 61945eefee25Smacallan # Check the variables that should have been set. 61955eefee25Smacallan if test -z "$notinst_deplibs"; then 61965eefee25Smacallan $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 61975eefee25Smacallan exit $EXIT_FAILURE 61985eefee25Smacallan fi 61995eefee25Smacallan 62005eefee25Smacallan finalize=yes 62015eefee25Smacallan for lib in $notinst_deplibs; do 62025eefee25Smacallan # Check to see that each library is installed. 62035eefee25Smacallan libdir= 62045eefee25Smacallan if test -f "$lib"; then 62055eefee25Smacallan # If there is no directory component, then add one. 62065eefee25Smacallan case $lib in 62075eefee25Smacallan */* | *\\*) . $lib ;; 62085eefee25Smacallan *) . ./$lib ;; 62095eefee25Smacallan esac 62105eefee25Smacallan fi 62115eefee25Smacallan libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 62125eefee25Smacallan if test -n "$libdir" && test ! -f "$libfile"; then 62135eefee25Smacallan $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 62145eefee25Smacallan finalize=no 62155eefee25Smacallan fi 62165eefee25Smacallan done 62175eefee25Smacallan 62185eefee25Smacallan relink_command= 62195eefee25Smacallan # Note that it is not necessary on cygwin/mingw to append a dot to 62205eefee25Smacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 62215eefee25Smacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 62225eefee25Smacallan # `FILE.' does not work on cygwin managed mounts. 62235eefee25Smacallan # 62245eefee25Smacallan # If there is no directory component, then add one. 62255eefee25Smacallan case $wrapper in 62265eefee25Smacallan */* | *\\*) . ${wrapper} ;; 62275eefee25Smacallan *) . ./${wrapper} ;; 62285eefee25Smacallan esac 62295eefee25Smacallan 62305eefee25Smacallan outputname= 62315eefee25Smacallan if test "$fast_install" = no && test -n "$relink_command"; then 62325eefee25Smacallan if test "$finalize" = yes && test -z "$run"; then 62335eefee25Smacallan tmpdir=`func_mktempdir` 62345eefee25Smacallan file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 62355eefee25Smacallan outputname="$tmpdir/$file" 62365eefee25Smacallan # Replace the output file specification. 623762ab96baSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 62385eefee25Smacallan 62395eefee25Smacallan $show "$relink_command" 62405eefee25Smacallan if $run eval "$relink_command"; then : 62415eefee25Smacallan else 62425eefee25Smacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 62435eefee25Smacallan ${rm}r "$tmpdir" 62445eefee25Smacallan continue 62455eefee25Smacallan fi 62465eefee25Smacallan file="$outputname" 62475eefee25Smacallan else 62485eefee25Smacallan $echo "$modename: warning: cannot relink \`$file'" 1>&2 62495eefee25Smacallan fi 62505eefee25Smacallan else 62515eefee25Smacallan # Install the binary that we compiled earlier. 62525eefee25Smacallan file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 62535eefee25Smacallan fi 62545eefee25Smacallan fi 62555eefee25Smacallan 62565eefee25Smacallan # remove .exe since cygwin /usr/bin/install will append another 62575eefee25Smacallan # one anyway 62585eefee25Smacallan case $install_prog,$host in 62595eefee25Smacallan */usr/bin/install*,*cygwin*) 62605eefee25Smacallan case $file:$destfile in 62615eefee25Smacallan *.exe:*.exe) 62625eefee25Smacallan # this is ok 62635eefee25Smacallan ;; 62645eefee25Smacallan *.exe:*) 62655eefee25Smacallan destfile=$destfile.exe 62665eefee25Smacallan ;; 62675eefee25Smacallan *:*.exe) 62685eefee25Smacallan destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 62695eefee25Smacallan ;; 62705eefee25Smacallan esac 62715eefee25Smacallan ;; 62725eefee25Smacallan esac 62735eefee25Smacallan $show "$install_prog$stripme $file $destfile" 62745eefee25Smacallan $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 62755eefee25Smacallan test -n "$outputname" && ${rm}r "$tmpdir" 62765eefee25Smacallan ;; 62775eefee25Smacallan esac 62785eefee25Smacallan done 62795eefee25Smacallan 62805eefee25Smacallan for file in $staticlibs; do 62815eefee25Smacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 62825eefee25Smacallan 62835eefee25Smacallan # Set up the ranlib parameters. 62845eefee25Smacallan oldlib="$destdir/$name" 62855eefee25Smacallan 62865eefee25Smacallan $show "$install_prog $file $oldlib" 62875eefee25Smacallan $run eval "$install_prog \$file \$oldlib" || exit $? 62885eefee25Smacallan 62895eefee25Smacallan if test -n "$stripme" && test -n "$old_striplib"; then 62905eefee25Smacallan $show "$old_striplib $oldlib" 62915eefee25Smacallan $run eval "$old_striplib $oldlib" || exit $? 62925eefee25Smacallan fi 62935eefee25Smacallan 62945eefee25Smacallan # Do each command in the postinstall commands. 62955eefee25Smacallan cmds=$old_postinstall_cmds 62965eefee25Smacallan save_ifs="$IFS"; IFS='~' 62975eefee25Smacallan for cmd in $cmds; do 62985eefee25Smacallan IFS="$save_ifs" 62995eefee25Smacallan eval cmd=\"$cmd\" 63005eefee25Smacallan $show "$cmd" 63015eefee25Smacallan $run eval "$cmd" || exit $? 63025eefee25Smacallan done 63035eefee25Smacallan IFS="$save_ifs" 63045eefee25Smacallan done 63055eefee25Smacallan 63065eefee25Smacallan if test -n "$future_libdirs"; then 63075eefee25Smacallan $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 63085eefee25Smacallan fi 63095eefee25Smacallan 63105eefee25Smacallan if test -n "$current_libdirs"; then 63115eefee25Smacallan # Maybe just do a dry run. 63125eefee25Smacallan test -n "$run" && current_libdirs=" -n$current_libdirs" 63135eefee25Smacallan exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 63145eefee25Smacallan else 63155eefee25Smacallan exit $EXIT_SUCCESS 63165eefee25Smacallan fi 63175eefee25Smacallan ;; 63185eefee25Smacallan 63195eefee25Smacallan # libtool finish mode 63205eefee25Smacallan finish) 63215eefee25Smacallan modename="$modename: finish" 63225eefee25Smacallan libdirs="$nonopt" 63235eefee25Smacallan admincmds= 63245eefee25Smacallan 63255eefee25Smacallan if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 63265eefee25Smacallan for dir 63275eefee25Smacallan do 63285eefee25Smacallan libdirs="$libdirs $dir" 63295eefee25Smacallan done 63305eefee25Smacallan 63315eefee25Smacallan for libdir in $libdirs; do 63325eefee25Smacallan if test -n "$finish_cmds"; then 63335eefee25Smacallan # Do each command in the finish commands. 63345eefee25Smacallan cmds=$finish_cmds 63355eefee25Smacallan save_ifs="$IFS"; IFS='~' 63365eefee25Smacallan for cmd in $cmds; do 63375eefee25Smacallan IFS="$save_ifs" 63385eefee25Smacallan eval cmd=\"$cmd\" 63395eefee25Smacallan $show "$cmd" 63405eefee25Smacallan $run eval "$cmd" || admincmds="$admincmds 63415eefee25Smacallan $cmd" 63425eefee25Smacallan done 63435eefee25Smacallan IFS="$save_ifs" 63445eefee25Smacallan fi 63455eefee25Smacallan if test -n "$finish_eval"; then 63465eefee25Smacallan # Do the single finish_eval. 63475eefee25Smacallan eval cmds=\"$finish_eval\" 63485eefee25Smacallan $run eval "$cmds" || admincmds="$admincmds 63495eefee25Smacallan $cmds" 63505eefee25Smacallan fi 63515eefee25Smacallan done 63525eefee25Smacallan fi 63535eefee25Smacallan 63545eefee25Smacallan # Exit here if they wanted silent mode. 63555eefee25Smacallan test "$show" = : && exit $EXIT_SUCCESS 63565eefee25Smacallan 63575eefee25Smacallan $echo "X----------------------------------------------------------------------" | $Xsed 63585eefee25Smacallan $echo "Libraries have been installed in:" 63595eefee25Smacallan for libdir in $libdirs; do 63605eefee25Smacallan $echo " $libdir" 63615eefee25Smacallan done 63625eefee25Smacallan $echo 63635eefee25Smacallan $echo "If you ever happen to want to link against installed libraries" 63645eefee25Smacallan $echo "in a given directory, LIBDIR, you must either use libtool, and" 63655eefee25Smacallan $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 63665eefee25Smacallan $echo "flag during linking and do at least one of the following:" 63675eefee25Smacallan if test -n "$shlibpath_var"; then 63685eefee25Smacallan $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 63695eefee25Smacallan $echo " during execution" 63705eefee25Smacallan fi 63715eefee25Smacallan if test -n "$runpath_var"; then 63725eefee25Smacallan $echo " - add LIBDIR to the \`$runpath_var' environment variable" 63735eefee25Smacallan $echo " during linking" 63745eefee25Smacallan fi 63755eefee25Smacallan if test -n "$hardcode_libdir_flag_spec"; then 63765eefee25Smacallan libdir=LIBDIR 63775eefee25Smacallan eval flag=\"$hardcode_libdir_flag_spec\" 63785eefee25Smacallan 63795eefee25Smacallan $echo " - use the \`$flag' linker flag" 63805eefee25Smacallan fi 63815eefee25Smacallan if test -n "$admincmds"; then 63825eefee25Smacallan $echo " - have your system administrator run these commands:$admincmds" 63835eefee25Smacallan fi 63845eefee25Smacallan if test -f /etc/ld.so.conf; then 63855eefee25Smacallan $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 63865eefee25Smacallan fi 63875eefee25Smacallan $echo 63885eefee25Smacallan $echo "See any operating system documentation about shared libraries for" 63895eefee25Smacallan $echo "more information, such as the ld(1) and ld.so(8) manual pages." 63905eefee25Smacallan $echo "X----------------------------------------------------------------------" | $Xsed 63915eefee25Smacallan exit $EXIT_SUCCESS 63925eefee25Smacallan ;; 63935eefee25Smacallan 63945eefee25Smacallan # libtool execute mode 63955eefee25Smacallan execute) 63965eefee25Smacallan modename="$modename: execute" 63975eefee25Smacallan 63985eefee25Smacallan # The first argument is the command name. 63995eefee25Smacallan cmd="$nonopt" 64005eefee25Smacallan if test -z "$cmd"; then 64015eefee25Smacallan $echo "$modename: you must specify a COMMAND" 1>&2 64025eefee25Smacallan $echo "$help" 64035eefee25Smacallan exit $EXIT_FAILURE 64045eefee25Smacallan fi 64055eefee25Smacallan 64065eefee25Smacallan # Handle -dlopen flags immediately. 64075eefee25Smacallan for file in $execute_dlfiles; do 64085eefee25Smacallan if test ! -f "$file"; then 64095eefee25Smacallan $echo "$modename: \`$file' is not a file" 1>&2 64105eefee25Smacallan $echo "$help" 1>&2 64115eefee25Smacallan exit $EXIT_FAILURE 64125eefee25Smacallan fi 64135eefee25Smacallan 64145eefee25Smacallan dir= 64155eefee25Smacallan case $file in 64165eefee25Smacallan *.la) 64175eefee25Smacallan # Check to see that this really is a libtool archive. 64185eefee25Smacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 64195eefee25Smacallan else 64205eefee25Smacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 64215eefee25Smacallan $echo "$help" 1>&2 64225eefee25Smacallan exit $EXIT_FAILURE 64235eefee25Smacallan fi 64245eefee25Smacallan 64255eefee25Smacallan # Read the libtool library. 64265eefee25Smacallan dlname= 64275eefee25Smacallan library_names= 64285eefee25Smacallan 64295eefee25Smacallan # If there is no directory component, then add one. 64305eefee25Smacallan case $file in 64315eefee25Smacallan */* | *\\*) . $file ;; 64325eefee25Smacallan *) . ./$file ;; 64335eefee25Smacallan esac 64345eefee25Smacallan 64355eefee25Smacallan # Skip this library if it cannot be dlopened. 64365eefee25Smacallan if test -z "$dlname"; then 64375eefee25Smacallan # Warn if it was a shared library. 64385eefee25Smacallan test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 64395eefee25Smacallan continue 64405eefee25Smacallan fi 64415eefee25Smacallan 64425eefee25Smacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64435eefee25Smacallan test "X$dir" = "X$file" && dir=. 64445eefee25Smacallan 64455eefee25Smacallan if test -f "$dir/$objdir/$dlname"; then 64465eefee25Smacallan dir="$dir/$objdir" 64475eefee25Smacallan else 644862ab96baSmrg if test ! -f "$dir/$dlname"; then 644962ab96baSmrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 645062ab96baSmrg exit $EXIT_FAILURE 645162ab96baSmrg fi 64525eefee25Smacallan fi 64535eefee25Smacallan ;; 64545eefee25Smacallan 64555eefee25Smacallan *.lo) 64565eefee25Smacallan # Just add the directory containing the .lo file. 64575eefee25Smacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64585eefee25Smacallan test "X$dir" = "X$file" && dir=. 64595eefee25Smacallan ;; 64605eefee25Smacallan 64615eefee25Smacallan *) 64625eefee25Smacallan $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 64635eefee25Smacallan continue 64645eefee25Smacallan ;; 64655eefee25Smacallan esac 64665eefee25Smacallan 64675eefee25Smacallan # Get the absolute pathname. 64685eefee25Smacallan absdir=`cd "$dir" && pwd` 64695eefee25Smacallan test -n "$absdir" && dir="$absdir" 64705eefee25Smacallan 64715eefee25Smacallan # Now add the directory to shlibpath_var. 64725eefee25Smacallan if eval "test -z \"\$$shlibpath_var\""; then 64735eefee25Smacallan eval "$shlibpath_var=\"\$dir\"" 64745eefee25Smacallan else 64755eefee25Smacallan eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 64765eefee25Smacallan fi 64775eefee25Smacallan done 64785eefee25Smacallan 64795eefee25Smacallan # This variable tells wrapper scripts just to set shlibpath_var 64805eefee25Smacallan # rather than running their programs. 64815eefee25Smacallan libtool_execute_magic="$magic" 64825eefee25Smacallan 64835eefee25Smacallan # Check if any of the arguments is a wrapper script. 64845eefee25Smacallan args= 64855eefee25Smacallan for file 64865eefee25Smacallan do 64875eefee25Smacallan case $file in 64885eefee25Smacallan -*) ;; 64895eefee25Smacallan *) 64905eefee25Smacallan # Do a test to see if this is really a libtool program. 64915eefee25Smacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 64925eefee25Smacallan # If there is no directory component, then add one. 64935eefee25Smacallan case $file in 64945eefee25Smacallan */* | *\\*) . $file ;; 64955eefee25Smacallan *) . ./$file ;; 64965eefee25Smacallan esac 64975eefee25Smacallan 64985eefee25Smacallan # Transform arg to wrapped name. 64995eefee25Smacallan file="$progdir/$program" 65005eefee25Smacallan fi 65015eefee25Smacallan ;; 65025eefee25Smacallan esac 65035eefee25Smacallan # Quote arguments (to preserve shell metacharacters). 65045eefee25Smacallan file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 65055eefee25Smacallan args="$args \"$file\"" 65065eefee25Smacallan done 65075eefee25Smacallan 65085eefee25Smacallan if test -z "$run"; then 65095eefee25Smacallan if test -n "$shlibpath_var"; then 65105eefee25Smacallan # Export the shlibpath_var. 65115eefee25Smacallan eval "export $shlibpath_var" 65125eefee25Smacallan fi 65135eefee25Smacallan 65145eefee25Smacallan # Restore saved environment variables 651562ab96baSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 651662ab96baSmrg do 651762ab96baSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 651862ab96baSmrg $lt_var=\$save_$lt_var; export $lt_var 651962ab96baSmrg fi" 652062ab96baSmrg done 65215eefee25Smacallan 65225eefee25Smacallan # Now prepare to actually exec the command. 65235eefee25Smacallan exec_cmd="\$cmd$args" 65245eefee25Smacallan else 65255eefee25Smacallan # Display what would be done. 65265eefee25Smacallan if test -n "$shlibpath_var"; then 65275eefee25Smacallan eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 65285eefee25Smacallan $echo "export $shlibpath_var" 65295eefee25Smacallan fi 65305eefee25Smacallan $echo "$cmd$args" 65315eefee25Smacallan exit $EXIT_SUCCESS 65325eefee25Smacallan fi 65335eefee25Smacallan ;; 65345eefee25Smacallan 65355eefee25Smacallan # libtool clean and uninstall mode 65365eefee25Smacallan clean | uninstall) 65375eefee25Smacallan modename="$modename: $mode" 65385eefee25Smacallan rm="$nonopt" 65395eefee25Smacallan files= 65405eefee25Smacallan rmforce= 65415eefee25Smacallan exit_status=0 65425eefee25Smacallan 65435eefee25Smacallan # This variable tells wrapper scripts just to set variables rather 65445eefee25Smacallan # than running their programs. 65455eefee25Smacallan libtool_install_magic="$magic" 65465eefee25Smacallan 65475eefee25Smacallan for arg 65485eefee25Smacallan do 65495eefee25Smacallan case $arg in 65505eefee25Smacallan -f) rm="$rm $arg"; rmforce=yes ;; 65515eefee25Smacallan -*) rm="$rm $arg" ;; 65525eefee25Smacallan *) files="$files $arg" ;; 65535eefee25Smacallan esac 65545eefee25Smacallan done 65555eefee25Smacallan 65565eefee25Smacallan if test -z "$rm"; then 65575eefee25Smacallan $echo "$modename: you must specify an RM program" 1>&2 65585eefee25Smacallan $echo "$help" 1>&2 65595eefee25Smacallan exit $EXIT_FAILURE 65605eefee25Smacallan fi 65615eefee25Smacallan 65625eefee25Smacallan rmdirs= 65635eefee25Smacallan 65645eefee25Smacallan origobjdir="$objdir" 65655eefee25Smacallan for file in $files; do 65665eefee25Smacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 65675eefee25Smacallan if test "X$dir" = "X$file"; then 65685eefee25Smacallan dir=. 65695eefee25Smacallan objdir="$origobjdir" 65705eefee25Smacallan else 65715eefee25Smacallan objdir="$dir/$origobjdir" 65725eefee25Smacallan fi 65735eefee25Smacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 65745eefee25Smacallan test "$mode" = uninstall && objdir="$dir" 65755eefee25Smacallan 65765eefee25Smacallan # Remember objdir for removal later, being careful to avoid duplicates 65775eefee25Smacallan if test "$mode" = clean; then 65785eefee25Smacallan case " $rmdirs " in 65795eefee25Smacallan *" $objdir "*) ;; 65805eefee25Smacallan *) rmdirs="$rmdirs $objdir" ;; 65815eefee25Smacallan esac 65825eefee25Smacallan fi 65835eefee25Smacallan 65845eefee25Smacallan # Don't error if the file doesn't exist and rm -f was used. 65855eefee25Smacallan if (test -L "$file") >/dev/null 2>&1 \ 65865eefee25Smacallan || (test -h "$file") >/dev/null 2>&1 \ 65875eefee25Smacallan || test -f "$file"; then 65885eefee25Smacallan : 65895eefee25Smacallan elif test -d "$file"; then 65905eefee25Smacallan exit_status=1 65915eefee25Smacallan continue 65925eefee25Smacallan elif test "$rmforce" = yes; then 65935eefee25Smacallan continue 65945eefee25Smacallan fi 65955eefee25Smacallan 65965eefee25Smacallan rmfiles="$file" 65975eefee25Smacallan 65985eefee25Smacallan case $name in 65995eefee25Smacallan *.la) 66005eefee25Smacallan # Possibly a libtool archive, so verify it. 66015eefee25Smacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66025eefee25Smacallan . $dir/$name 66035eefee25Smacallan 66045eefee25Smacallan # Delete the libtool libraries and symlinks. 66055eefee25Smacallan for n in $library_names; do 66065eefee25Smacallan rmfiles="$rmfiles $objdir/$n" 66075eefee25Smacallan done 66085eefee25Smacallan test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 66095eefee25Smacallan 66105eefee25Smacallan case "$mode" in 66115eefee25Smacallan clean) 66125eefee25Smacallan case " $library_names " in 66135eefee25Smacallan # " " in the beginning catches empty $dlname 66145eefee25Smacallan *" $dlname "*) ;; 66155eefee25Smacallan *) rmfiles="$rmfiles $objdir/$dlname" ;; 66165eefee25Smacallan esac 66175eefee25Smacallan test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 66185eefee25Smacallan ;; 66195eefee25Smacallan uninstall) 66205eefee25Smacallan if test -n "$library_names"; then 66215eefee25Smacallan # Do each command in the postuninstall commands. 66225eefee25Smacallan cmds=$postuninstall_cmds 66235eefee25Smacallan save_ifs="$IFS"; IFS='~' 66245eefee25Smacallan for cmd in $cmds; do 66255eefee25Smacallan IFS="$save_ifs" 66265eefee25Smacallan eval cmd=\"$cmd\" 66275eefee25Smacallan $show "$cmd" 66285eefee25Smacallan $run eval "$cmd" 66295eefee25Smacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 66305eefee25Smacallan exit_status=1 66315eefee25Smacallan fi 66325eefee25Smacallan done 66335eefee25Smacallan IFS="$save_ifs" 66345eefee25Smacallan fi 66355eefee25Smacallan 66365eefee25Smacallan if test -n "$old_library"; then 66375eefee25Smacallan # Do each command in the old_postuninstall commands. 66385eefee25Smacallan cmds=$old_postuninstall_cmds 66395eefee25Smacallan save_ifs="$IFS"; IFS='~' 66405eefee25Smacallan for cmd in $cmds; do 66415eefee25Smacallan IFS="$save_ifs" 66425eefee25Smacallan eval cmd=\"$cmd\" 66435eefee25Smacallan $show "$cmd" 66445eefee25Smacallan $run eval "$cmd" 66455eefee25Smacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 66465eefee25Smacallan exit_status=1 66475eefee25Smacallan fi 66485eefee25Smacallan done 66495eefee25Smacallan IFS="$save_ifs" 66505eefee25Smacallan fi 66515eefee25Smacallan # FIXME: should reinstall the best remaining shared library. 66525eefee25Smacallan ;; 66535eefee25Smacallan esac 66545eefee25Smacallan fi 66555eefee25Smacallan ;; 66565eefee25Smacallan 66575eefee25Smacallan *.lo) 66585eefee25Smacallan # Possibly a libtool object, so verify it. 66595eefee25Smacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66605eefee25Smacallan 66615eefee25Smacallan # Read the .lo file 66625eefee25Smacallan . $dir/$name 66635eefee25Smacallan 66645eefee25Smacallan # Add PIC object to the list of files to remove. 66655eefee25Smacallan if test -n "$pic_object" \ 66665eefee25Smacallan && test "$pic_object" != none; then 66675eefee25Smacallan rmfiles="$rmfiles $dir/$pic_object" 66685eefee25Smacallan fi 66695eefee25Smacallan 66705eefee25Smacallan # Add non-PIC object to the list of files to remove. 66715eefee25Smacallan if test -n "$non_pic_object" \ 66725eefee25Smacallan && test "$non_pic_object" != none; then 66735eefee25Smacallan rmfiles="$rmfiles $dir/$non_pic_object" 66745eefee25Smacallan fi 66755eefee25Smacallan fi 66765eefee25Smacallan ;; 66775eefee25Smacallan 66785eefee25Smacallan *) 66795eefee25Smacallan if test "$mode" = clean ; then 66805eefee25Smacallan noexename=$name 66815eefee25Smacallan case $file in 66825eefee25Smacallan *.exe) 66835eefee25Smacallan file=`$echo $file|${SED} 's,.exe$,,'` 66845eefee25Smacallan noexename=`$echo $name|${SED} 's,.exe$,,'` 66855eefee25Smacallan # $file with .exe has already been added to rmfiles, 66865eefee25Smacallan # add $file without .exe 66875eefee25Smacallan rmfiles="$rmfiles $file" 66885eefee25Smacallan ;; 66895eefee25Smacallan esac 66905eefee25Smacallan # Do a test to see if this is a libtool program. 66915eefee25Smacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66925eefee25Smacallan relink_command= 66935eefee25Smacallan . $dir/$noexename 66945eefee25Smacallan 66955eefee25Smacallan # note $name still contains .exe if it was in $file originally 66965eefee25Smacallan # as does the version of $file that was added into $rmfiles 66975eefee25Smacallan rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 66985eefee25Smacallan if test "$fast_install" = yes && test -n "$relink_command"; then 66995eefee25Smacallan rmfiles="$rmfiles $objdir/lt-$name" 67005eefee25Smacallan fi 67015eefee25Smacallan if test "X$noexename" != "X$name" ; then 67025eefee25Smacallan rmfiles="$rmfiles $objdir/lt-${noexename}.c" 67035eefee25Smacallan fi 67045eefee25Smacallan fi 67055eefee25Smacallan fi 67065eefee25Smacallan ;; 67075eefee25Smacallan esac 67085eefee25Smacallan $show "$rm $rmfiles" 67095eefee25Smacallan $run $rm $rmfiles || exit_status=1 67105eefee25Smacallan done 67115eefee25Smacallan objdir="$origobjdir" 67125eefee25Smacallan 67135eefee25Smacallan # Try to remove the ${objdir}s in the directories where we deleted files 67145eefee25Smacallan for dir in $rmdirs; do 67155eefee25Smacallan if test -d "$dir"; then 67165eefee25Smacallan $show "rmdir $dir" 67175eefee25Smacallan $run rmdir $dir >/dev/null 2>&1 67185eefee25Smacallan fi 67195eefee25Smacallan done 67205eefee25Smacallan 67215eefee25Smacallan exit $exit_status 67225eefee25Smacallan ;; 67235eefee25Smacallan 67245eefee25Smacallan "") 67255eefee25Smacallan $echo "$modename: you must specify a MODE" 1>&2 67265eefee25Smacallan $echo "$generic_help" 1>&2 67275eefee25Smacallan exit $EXIT_FAILURE 67285eefee25Smacallan ;; 67295eefee25Smacallan esac 67305eefee25Smacallan 67315eefee25Smacallan if test -z "$exec_cmd"; then 67325eefee25Smacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 67335eefee25Smacallan $echo "$generic_help" 1>&2 67345eefee25Smacallan exit $EXIT_FAILURE 67355eefee25Smacallan fi 67365eefee25Smacallanfi # test -z "$show_help" 67375eefee25Smacallan 67385eefee25Smacallanif test -n "$exec_cmd"; then 67395eefee25Smacallan eval exec $exec_cmd 67405eefee25Smacallan exit $EXIT_FAILURE 67415eefee25Smacallanfi 67425eefee25Smacallan 67435eefee25Smacallan# We need to display help for each of the modes. 67445eefee25Smacallancase $mode in 67455eefee25Smacallan"") $echo \ 67465eefee25Smacallan"Usage: $modename [OPTION]... [MODE-ARG]... 67475eefee25Smacallan 67485eefee25SmacallanProvide generalized library-building support services. 67495eefee25Smacallan 67505eefee25Smacallan --config show all configuration variables 67515eefee25Smacallan --debug enable verbose shell tracing 67525eefee25Smacallan-n, --dry-run display commands without modifying any files 67535eefee25Smacallan --features display basic configuration information and exit 67545eefee25Smacallan --finish same as \`--mode=finish' 67555eefee25Smacallan --help display this help message and exit 67565eefee25Smacallan --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 67575eefee25Smacallan --quiet same as \`--silent' 67585eefee25Smacallan --silent don't print informational messages 67595eefee25Smacallan --tag=TAG use configuration variables from tag TAG 67605eefee25Smacallan --version print version information 67615eefee25Smacallan 67625eefee25SmacallanMODE must be one of the following: 67635eefee25Smacallan 67645eefee25Smacallan clean remove files from the build directory 67655eefee25Smacallan compile compile a source file into a libtool object 67665eefee25Smacallan execute automatically set library path, then run a program 67675eefee25Smacallan finish complete the installation of libtool libraries 67685eefee25Smacallan install install libraries or executables 67695eefee25Smacallan link create a library or an executable 67705eefee25Smacallan uninstall remove libraries from an installed directory 67715eefee25Smacallan 67725eefee25SmacallanMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 67735eefee25Smacallana more detailed description of MODE. 67745eefee25Smacallan 67755eefee25SmacallanReport bugs to <bug-libtool@gnu.org>." 67765eefee25Smacallan exit $EXIT_SUCCESS 67775eefee25Smacallan ;; 67785eefee25Smacallan 67795eefee25Smacallanclean) 67805eefee25Smacallan $echo \ 67815eefee25Smacallan"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 67825eefee25Smacallan 67835eefee25SmacallanRemove files from the build directory. 67845eefee25Smacallan 67855eefee25SmacallanRM is the name of the program to use to delete files associated with each FILE 67865eefee25Smacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 67875eefee25Smacallanto RM. 67885eefee25Smacallan 67895eefee25SmacallanIf FILE is a libtool library, object or program, all the files associated 67905eefee25Smacallanwith it are deleted. Otherwise, only FILE itself is deleted using RM." 67915eefee25Smacallan ;; 67925eefee25Smacallan 67935eefee25Smacallancompile) 67945eefee25Smacallan $echo \ 67955eefee25Smacallan"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 67965eefee25Smacallan 67975eefee25SmacallanCompile a source file into a libtool library object. 67985eefee25Smacallan 67995eefee25SmacallanThis mode accepts the following additional options: 68005eefee25Smacallan 68015eefee25Smacallan -o OUTPUT-FILE set the output file name to OUTPUT-FILE 68025eefee25Smacallan -prefer-pic try to building PIC objects only 68035eefee25Smacallan -prefer-non-pic try to building non-PIC objects only 68045eefee25Smacallan -static always build a \`.o' file suitable for static linking 68055eefee25Smacallan 68065eefee25SmacallanCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 68075eefee25Smacallanfrom the given SOURCEFILE. 68085eefee25Smacallan 68095eefee25SmacallanThe output file name is determined by removing the directory component from 68105eefee25SmacallanSOURCEFILE, then substituting the C source code suffix \`.c' with the 68115eefee25Smacallanlibrary object suffix, \`.lo'." 68125eefee25Smacallan ;; 68135eefee25Smacallan 68145eefee25Smacallanexecute) 68155eefee25Smacallan $echo \ 68165eefee25Smacallan"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 68175eefee25Smacallan 68185eefee25SmacallanAutomatically set library path, then run a program. 68195eefee25Smacallan 68205eefee25SmacallanThis mode accepts the following additional options: 68215eefee25Smacallan 68225eefee25Smacallan -dlopen FILE add the directory containing FILE to the library path 68235eefee25Smacallan 68245eefee25SmacallanThis mode sets the library path environment variable according to \`-dlopen' 68255eefee25Smacallanflags. 68265eefee25Smacallan 68275eefee25SmacallanIf any of the ARGS are libtool executable wrappers, then they are translated 68285eefee25Smacallaninto their corresponding uninstalled binary, and any of their required library 68295eefee25Smacallandirectories are added to the library path. 68305eefee25Smacallan 68315eefee25SmacallanThen, COMMAND is executed, with ARGS as arguments." 68325eefee25Smacallan ;; 68335eefee25Smacallan 68345eefee25Smacallanfinish) 68355eefee25Smacallan $echo \ 68365eefee25Smacallan"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 68375eefee25Smacallan 68385eefee25SmacallanComplete the installation of libtool libraries. 68395eefee25Smacallan 68405eefee25SmacallanEach LIBDIR is a directory that contains libtool libraries. 68415eefee25Smacallan 68425eefee25SmacallanThe commands that this mode executes may require superuser privileges. Use 68435eefee25Smacallanthe \`--dry-run' option if you just want to see what would be executed." 68445eefee25Smacallan ;; 68455eefee25Smacallan 68465eefee25Smacallaninstall) 68475eefee25Smacallan $echo \ 68485eefee25Smacallan"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 68495eefee25Smacallan 68505eefee25SmacallanInstall executables or libraries. 68515eefee25Smacallan 68525eefee25SmacallanINSTALL-COMMAND is the installation command. The first component should be 68535eefee25Smacallaneither the \`install' or \`cp' program. 68545eefee25Smacallan 68555eefee25SmacallanThe rest of the components are interpreted as arguments to that command (only 68565eefee25SmacallanBSD-compatible install options are recognized)." 68575eefee25Smacallan ;; 68585eefee25Smacallan 68595eefee25Smacallanlink) 68605eefee25Smacallan $echo \ 68615eefee25Smacallan"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 68625eefee25Smacallan 68635eefee25SmacallanLink object files or libraries together to form another library, or to 68645eefee25Smacallancreate an executable program. 68655eefee25Smacallan 68665eefee25SmacallanLINK-COMMAND is a command using the C compiler that you would use to create 68675eefee25Smacallana program from several object files. 68685eefee25Smacallan 68695eefee25SmacallanThe following components of LINK-COMMAND are treated specially: 68705eefee25Smacallan 68715eefee25Smacallan -all-static do not do any dynamic linking at all 68725eefee25Smacallan -avoid-version do not add a version suffix if possible 68735eefee25Smacallan -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 68745eefee25Smacallan -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 68755eefee25Smacallan -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 68765eefee25Smacallan -export-symbols SYMFILE 687762ab96baSmrg try to export only the symbols listed in SYMFILE 68785eefee25Smacallan -export-symbols-regex REGEX 687962ab96baSmrg try to export only the symbols matching REGEX 68805eefee25Smacallan -LLIBDIR search LIBDIR for required installed libraries 68815eefee25Smacallan -lNAME OUTPUT-FILE requires the installed library libNAME 68825eefee25Smacallan -module build a library that can dlopened 68835eefee25Smacallan -no-fast-install disable the fast-install mode 68845eefee25Smacallan -no-install link a not-installable executable 68855eefee25Smacallan -no-undefined declare that a library does not refer to external symbols 68865eefee25Smacallan -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 68875eefee25Smacallan -objectlist FILE Use a list of object files found in FILE to specify objects 68885eefee25Smacallan -precious-files-regex REGEX 68895eefee25Smacallan don't remove output files matching REGEX 68905eefee25Smacallan -release RELEASE specify package release information 68915eefee25Smacallan -rpath LIBDIR the created library will eventually be installed in LIBDIR 68925eefee25Smacallan -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 689362ab96baSmrg -static do not do any dynamic linking of uninstalled libtool libraries 689462ab96baSmrg -static-libtool-libs 689562ab96baSmrg do not do any dynamic linking of libtool libraries 68965eefee25Smacallan -version-info CURRENT[:REVISION[:AGE]] 689762ab96baSmrg specify library version info [each variable defaults to 0] 68985eefee25Smacallan 68995eefee25SmacallanAll other options (arguments beginning with \`-') are ignored. 69005eefee25Smacallan 69015eefee25SmacallanEvery other argument is treated as a filename. Files ending in \`.la' are 69025eefee25Smacallantreated as uninstalled libtool libraries, other files are standard or library 69035eefee25Smacallanobject files. 69045eefee25Smacallan 69055eefee25SmacallanIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 69065eefee25Smacallanonly library objects (\`.lo' files) may be specified, and \`-rpath' is 69075eefee25Smacallanrequired, except when creating a convenience library. 69085eefee25Smacallan 69095eefee25SmacallanIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 69105eefee25Smacallanusing \`ar' and \`ranlib', or on Windows using \`lib'. 69115eefee25Smacallan 69125eefee25SmacallanIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 69135eefee25Smacallanis created, otherwise an executable program is created." 69145eefee25Smacallan ;; 69155eefee25Smacallan 69165eefee25Smacallanuninstall) 69175eefee25Smacallan $echo \ 69185eefee25Smacallan"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 69195eefee25Smacallan 69205eefee25SmacallanRemove libraries from an installation directory. 69215eefee25Smacallan 69225eefee25SmacallanRM is the name of the program to use to delete files associated with each FILE 69235eefee25Smacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 69245eefee25Smacallanto RM. 69255eefee25Smacallan 69265eefee25SmacallanIf FILE is a libtool library, all the files associated with it are deleted. 69275eefee25SmacallanOtherwise, only FILE itself is deleted using RM." 69285eefee25Smacallan ;; 69295eefee25Smacallan 69305eefee25Smacallan*) 69315eefee25Smacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 69325eefee25Smacallan $echo "$help" 1>&2 69335eefee25Smacallan exit $EXIT_FAILURE 69345eefee25Smacallan ;; 69355eefee25Smacallanesac 69365eefee25Smacallan 69375eefee25Smacallan$echo 69385eefee25Smacallan$echo "Try \`$modename --help' for more information about other modes." 69395eefee25Smacallan 69405eefee25Smacallanexit $? 69415eefee25Smacallan 69425eefee25Smacallan# The TAGs below are defined such that we never get into a situation 69435eefee25Smacallan# in which we disable both kinds of libraries. Given conflicting 69445eefee25Smacallan# choices, we go for a static library, that is the most portable, 69455eefee25Smacallan# since we can't tell whether shared libraries were disabled because 69465eefee25Smacallan# the user asked for that or because the platform doesn't support 69475eefee25Smacallan# them. This is particularly important on AIX, because we don't 69485eefee25Smacallan# support having both static and shared libraries enabled at the same 69495eefee25Smacallan# time on that platform, so we default to a shared-only configuration. 69505eefee25Smacallan# If a disable-shared tag is given, we'll fallback to a static-only 69515eefee25Smacallan# configuration. But we'll never go from static-only to shared-only. 69525eefee25Smacallan 69535eefee25Smacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 69545eefee25Smacallandisable_libs=shared 69555eefee25Smacallan# ### END LIBTOOL TAG CONFIG: disable-shared 69565eefee25Smacallan 69575eefee25Smacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-static 69585eefee25Smacallandisable_libs=static 69595eefee25Smacallan# ### END LIBTOOL TAG CONFIG: disable-static 69605eefee25Smacallan 69615eefee25Smacallan# Local Variables: 69625eefee25Smacallan# mode:shell-script 69635eefee25Smacallan# sh-indentation:2 69645eefee25Smacallan# End: 6965