11c576705Slukem# ltmain.sh - Provide generalized library-building support services. 21c576705Slukem# NOTE: Changing this file will not affect anything until you rerun configure. 31c576705Slukem# 41c576705Slukem# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 51c576705Slukem# 2007, 2008 Free Software Foundation, Inc. 61c576705Slukem# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 71c576705Slukem# 81c576705Slukem# This program is free software; you can redistribute it and/or modify 91c576705Slukem# it under the terms of the GNU General Public License as published by 101c576705Slukem# the Free Software Foundation; either version 2 of the License, or 111c576705Slukem# (at your option) any later version. 121c576705Slukem# 131c576705Slukem# This program is distributed in the hope that it will be useful, but 141c576705Slukem# WITHOUT ANY WARRANTY; without even the implied warranty of 151c576705Slukem# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 161c576705Slukem# General Public License for more details. 171c576705Slukem# 181c576705Slukem# You should have received a copy of the GNU General Public License 191c576705Slukem# along with this program; if not, write to the Free Software 201c576705Slukem# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 211c576705Slukem# 221c576705Slukem# As a special exception to the GNU General Public License, if you 231c576705Slukem# distribute this file as part of a program that contains a 241c576705Slukem# configuration script generated by Autoconf, you may include it under 251c576705Slukem# the same distribution terms that you use for the rest of that program. 261c576705Slukem 271c576705Slukembasename="s,^.*/,,g" 281c576705Slukem 291c576705Slukem# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 301c576705Slukem# is ksh but when the shell is invoked as "sh" and the current value of 311c576705Slukem# the _XPG environment variable is not equal to 1 (one), the special 321c576705Slukem# positional parameter $0, within a function call, is the name of the 331c576705Slukem# function. 341c576705Slukemprogpath="$0" 351c576705Slukem 361c576705Slukem# The name of this program: 371c576705Slukemprogname=`echo "$progpath" | $SED $basename` 381c576705Slukemmodename="$progname" 391c576705Slukem 401c576705Slukem# Global variables: 411c576705SlukemEXIT_SUCCESS=0 421c576705SlukemEXIT_FAILURE=1 431c576705Slukem 441c576705SlukemPROGRAM=ltmain.sh 451c576705SlukemPACKAGE=libtool 461c576705SlukemVERSION=1.5.26 471c576705SlukemTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)" 481c576705Slukem 491c576705Slukem# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 501c576705Slukemif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 511c576705Slukem emulate sh 521c576705Slukem NULLCMD=: 531c576705Slukem # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 541c576705Slukem # is contrary to our usage. Disable this feature. 551c576705Slukem alias -g '${1+"$@"}'='"$@"' 561c576705Slukem setopt NO_GLOB_SUBST 571c576705Slukemelse 581c576705Slukem case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 591c576705Slukemfi 601c576705SlukemBIN_SH=xpg4; export BIN_SH # for Tru64 611c576705SlukemDUALCASE=1; export DUALCASE # for MKS sh 621c576705Slukem 63*6ca3cd61Sagc# Check that we have a working $ECHO. 641c576705Slukemif test "X$1" = X--no-reexec; then 651c576705Slukem # Discard the --no-reexec flag, and continue. 661c576705Slukem shift 671c576705Slukemelif test "X$1" = X--fallback-echo; then 681c576705Slukem # Avoid inline document here, it may be left over 691c576705Slukem : 70*6ca3cd61Sagcelif test "X`($ECHO '\t') 2>/dev/null`" = 'X\t'; then 71*6ca3cd61Sagc # Yippee, $ECHO works! 721c576705Slukem : 731c576705Slukemelse 74*6ca3cd61Sagc # Restart under the correct shell, and then maybe $ECHO will work. 751c576705Slukem exec $SHELL "$progpath" --no-reexec ${1+"$@"} 761c576705Slukemfi 771c576705Slukem 781c576705Slukemif test "X$1" = X--fallback-echo; then 791c576705Slukem # used as fallback echo 801c576705Slukem shift 811c576705Slukem cat <<EOF 821c576705Slukem$* 831c576705SlukemEOF 841c576705Slukem exit $EXIT_SUCCESS 851c576705Slukemfi 861c576705Slukem 871c576705Slukemdefault_mode= 881c576705Slukemhelp="Try \`$progname --help' for more information." 891c576705Slukemmagic="%%%MAGIC variable%%%" 901c576705Slukemmkdir="mkdir" 911c576705Slukemmv="mv -f" 921c576705Slukemrm="rm -f" 931c576705Slukem 941c576705Slukem# Sed substitution that helps us do robust quoting. It backslashifies 951c576705Slukem# metacharacters that are still active within double-quoted strings. 961c576705SlukemXsed="${SED}"' -e 1s/^X//' 971c576705Slukemsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 981c576705Slukem# test EBCDIC or ASCII 991c576705Slukemcase `echo X|tr X '\101'` in 1001c576705Slukem A) # ASCII based system 1011c576705Slukem # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 1021c576705Slukem SP2NL='tr \040 \012' 1031c576705Slukem NL2SP='tr \015\012 \040\040' 1041c576705Slukem ;; 1051c576705Slukem *) # EBCDIC based system 1061c576705Slukem SP2NL='tr \100 \n' 1071c576705Slukem NL2SP='tr \r\n \100\100' 1081c576705Slukem ;; 1091c576705Slukemesac 1101c576705Slukem 1111c576705Slukem# NLS nuisances. 1121c576705Slukem# Only set LANG and LC_ALL to C if already set. 1131c576705Slukem# These must not be set unconditionally because not all systems understand 1141c576705Slukem# e.g. LANG=C (notably SCO). 1151c576705Slukem# We save the old values to restore during execute mode. 1161c576705Slukemlt_env= 1171c576705Slukemfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1181c576705Slukemdo 1191c576705Slukem eval "if test \"\${$lt_var+set}\" = set; then 1201c576705Slukem save_$lt_var=\$$lt_var 1211c576705Slukem lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1221c576705Slukem $lt_var=C 1231c576705Slukem export $lt_var 1241c576705Slukem fi" 1251c576705Slukemdone 1261c576705Slukem 1271c576705Slukemif test -n "$lt_env"; then 1281c576705Slukem lt_env="env $lt_env" 1291c576705Slukemfi 1301c576705Slukem 1311c576705Slukem# Make sure IFS has a sensible default 1321c576705Slukemlt_nl=' 1331c576705Slukem' 1341c576705SlukemIFS=" $lt_nl" 1351c576705Slukem 1361c576705Slukemif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 137*6ca3cd61Sagc $ECHO "$modename: not configured to build any kind of library" 1>&2 138*6ca3cd61Sagc $ECHO "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1391c576705Slukem exit $EXIT_FAILURE 1401c576705Slukemfi 1411c576705Slukem 1421c576705Slukem# Global variables. 1431c576705Slukemmode=$default_mode 1441c576705Slukemnonopt= 1451c576705Slukemprev= 1461c576705Slukemprevopt= 1471c576705Slukemrun= 148*6ca3cd61Sagcshow="$ECHO" 1491c576705Slukemshow_help= 1501c576705Slukemexecute_dlfiles= 1511c576705Slukemduplicate_deps=no 1521c576705Slukempreserve_args= 1531c576705Slukemlo2o="s/\\.lo\$/.${objext}/" 1541c576705Slukemo2lo="s/\\.${objext}\$/.lo/" 1551c576705Slukemextracted_archives= 1561c576705Slukemextracted_serial=0 1571c576705Slukem 1581c576705Slukem##################################### 1591c576705Slukem# Shell function definitions: 1601c576705Slukem# This seems to be the best place for them 1611c576705Slukem 1621c576705Slukem# func_mktempdir [string] 1631c576705Slukem# Make a temporary directory that won't clash with other running 1641c576705Slukem# libtool processes, and avoids race conditions if possible. If 1651c576705Slukem# given, STRING is the basename for that directory. 1661c576705Slukemfunc_mktempdir () 1671c576705Slukem{ 1681c576705Slukem my_template="${TMPDIR-/tmp}/${1-$progname}" 1691c576705Slukem 1701c576705Slukem if test "$run" = ":"; then 1711c576705Slukem # Return a directory name, but don't create it in dry-run mode 1721c576705Slukem my_tmpdir="${my_template}-$$" 1731c576705Slukem else 1741c576705Slukem 1751c576705Slukem # If mktemp works, use that first and foremost 1761c576705Slukem my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1771c576705Slukem 1781c576705Slukem if test ! -d "$my_tmpdir"; then 1791c576705Slukem # Failing that, at least try and use $RANDOM to avoid a race 1801c576705Slukem my_tmpdir="${my_template}-${RANDOM-0}$$" 1811c576705Slukem 1821c576705Slukem save_mktempdir_umask=`umask` 1831c576705Slukem umask 0077 1841c576705Slukem $mkdir "$my_tmpdir" 1851c576705Slukem umask $save_mktempdir_umask 1861c576705Slukem fi 1871c576705Slukem 1881c576705Slukem # If we're not in dry-run mode, bomb out on failure 1891c576705Slukem test -d "$my_tmpdir" || { 190*6ca3cd61Sagc $ECHO "cannot create temporary directory \`$my_tmpdir'" 1>&2 1911c576705Slukem exit $EXIT_FAILURE 1921c576705Slukem } 1931c576705Slukem fi 1941c576705Slukem 195*6ca3cd61Sagc $ECHO "X$my_tmpdir" | $Xsed 1961c576705Slukem} 1971c576705Slukem 1981c576705Slukem 1991c576705Slukem# func_win32_libid arg 2001c576705Slukem# return the library type of file 'arg' 2011c576705Slukem# 2021c576705Slukem# Need a lot of goo to handle *both* DLLs and import libs 2031c576705Slukem# Has to be a shell function in order to 'eat' the argument 2041c576705Slukem# that is supplied when $file_magic_command is called. 2051c576705Slukemfunc_win32_libid () 2061c576705Slukem{ 2071c576705Slukem win32_libid_type="unknown" 2081c576705Slukem win32_fileres=`file -L $1 2>/dev/null` 2091c576705Slukem case $win32_fileres in 2101c576705Slukem *ar\ archive\ import\ library*) # definitely import 2111c576705Slukem win32_libid_type="x86 archive import" 2121c576705Slukem ;; 2131c576705Slukem *ar\ archive*) # could be an import, or static 2141c576705Slukem if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 2151c576705Slukem $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2161c576705Slukem win32_nmres=`eval $NM -f posix -A $1 | \ 2171c576705Slukem $SED -n -e '1,100{ 2181c576705Slukem / I /{ 2191c576705Slukem s,.*,import, 2201c576705Slukem p 2211c576705Slukem q 2221c576705Slukem } 2231c576705Slukem }'` 2241c576705Slukem case $win32_nmres in 2251c576705Slukem import*) win32_libid_type="x86 archive import";; 2261c576705Slukem *) win32_libid_type="x86 archive static";; 2271c576705Slukem esac 2281c576705Slukem fi 2291c576705Slukem ;; 2301c576705Slukem *DLL*) 2311c576705Slukem win32_libid_type="x86 DLL" 2321c576705Slukem ;; 2331c576705Slukem *executable*) # but shell scripts are "executable" too... 2341c576705Slukem case $win32_fileres in 2351c576705Slukem *MS\ Windows\ PE\ Intel*) 2361c576705Slukem win32_libid_type="x86 DLL" 2371c576705Slukem ;; 2381c576705Slukem esac 2391c576705Slukem ;; 2401c576705Slukem esac 241*6ca3cd61Sagc $ECHO $win32_libid_type 2421c576705Slukem} 2431c576705Slukem 2441c576705Slukem 2451c576705Slukem# func_infer_tag arg 2461c576705Slukem# Infer tagged configuration to use if any are available and 2471c576705Slukem# if one wasn't chosen via the "--tag" command line option. 2481c576705Slukem# Only attempt this if the compiler in the base compile 2491c576705Slukem# command doesn't match the default compiler. 2501c576705Slukem# arg is usually of the form 'gcc ...' 2511c576705Slukemfunc_infer_tag () 2521c576705Slukem{ 2531c576705Slukem # Set the commonly-used compilers for some tags. 2541c576705Slukem tag_compilers_CC="*cc *xlc" 2551c576705Slukem tag_compilers_CXX="*++ *CC" 2561c576705Slukem tag_compilers_F77="*77 *fort" 257*6ca3cd61Sagc base_compiler=`set -- "$@"; $ECHO $1` 2581c576705Slukem # If $tagname still isn't set, then try to infer if the default 2591c576705Slukem # "CC" tag applies by matching up the base compile command to some 2601c576705Slukem # compilers commonly used for the "CC" tag. 2611c576705Slukem if test -z "$tagname"; then 2621c576705Slukem z=CC 2631c576705Slukem eval "tag_compilers=\$tag_compilers_${z}" 2641c576705Slukem if test -n "$tag_compilers"; then 2651c576705Slukem for zp in $tag_compilers; do 2661c576705Slukem case $base_compiler in 2671c576705Slukem $zp) 2681c576705Slukem # The compiler in the base compile command matches 2691c576705Slukem # one of the common compilers for the current tag. 2701c576705Slukem # Assume this is the tagged configuration we want. 2711c576705Slukem tagname=$z 2721c576705Slukem break 2731c576705Slukem ;; 2741c576705Slukem esac 2751c576705Slukem done 2761c576705Slukem fi 2771c576705Slukem fi 2781c576705Slukem if test -n "$available_tags" && test -z "$tagname"; then 2791c576705Slukem CC_quoted= 2801c576705Slukem for arg in $CC; do 2811c576705Slukem case $arg in 2821c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2831c576705Slukem arg="\"$arg\"" 2841c576705Slukem ;; 2851c576705Slukem esac 2861c576705Slukem CC_quoted="$CC_quoted $arg" 2871c576705Slukem done 2881c576705Slukem case $@ in 2891c576705Slukem # Blanks in the command may have been stripped by the calling shell, 2901c576705Slukem # but not from the CC environment variable when configure was run. 291*6ca3cd61Sagc " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 2921c576705Slukem # Blanks at the start of $base_compile will cause this to fail 2931c576705Slukem # if we don't check for them as well. 2941c576705Slukem *) 2951c576705Slukem for z in $available_tags; do 2961c576705Slukem if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2971c576705Slukem # Evaluate the configuration. 2981c576705Slukem eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2991c576705Slukem CC_quoted= 3001c576705Slukem for arg in $CC; do 3011c576705Slukem # Double-quote args containing other shell metacharacters. 3021c576705Slukem case $arg in 3031c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 3041c576705Slukem arg="\"$arg\"" 3051c576705Slukem ;; 3061c576705Slukem esac 3071c576705Slukem CC_quoted="$CC_quoted $arg" 3081c576705Slukem done 3091c576705Slukem case "$@ " in 310*6ca3cd61Sagc " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 3111c576705Slukem # The compiler in the base compile command matches 3121c576705Slukem # the one in the tagged configuration. 3131c576705Slukem # Assume this is the tagged configuration we want. 3141c576705Slukem tagname=$z 3151c576705Slukem break 3161c576705Slukem ;; 3171c576705Slukem esac 3181c576705Slukem # If $tagname still isn't set, then try to infer it by 3191c576705Slukem # matching up the base compile command to some compilers 3201c576705Slukem # commonly used for certain tags. 321*6ca3cd61Sagc base_compiler=`set -- "$@"; $ECHO $1` 3221c576705Slukem eval "tag_compilers=\$tag_compilers_${z}" 3231c576705Slukem if test -n "$tag_compilers"; then 3241c576705Slukem for zp in $tag_compilers; do 3251c576705Slukem case $base_compiler in 3261c576705Slukem $zp) 3271c576705Slukem # The compiler in the base compile command matches 3281c576705Slukem # one of the common compilers for the current tag. 3291c576705Slukem # Assume this is the tagged configuration we want. 3301c576705Slukem tagname=$z 3311c576705Slukem break 3321c576705Slukem ;; 3331c576705Slukem esac 3341c576705Slukem done 3351c576705Slukem if test -n "$tagname"; then 3361c576705Slukem break 3371c576705Slukem fi 3381c576705Slukem fi 3391c576705Slukem fi 3401c576705Slukem done 3411c576705Slukem # If $tagname still isn't set, then no tagged configuration 3421c576705Slukem # was found and let the user know that the "--tag" command 3431c576705Slukem # line option must be used. 3441c576705Slukem if test -z "$tagname"; then 345*6ca3cd61Sagc $ECHO "$modename: unable to infer tagged configuration" 346*6ca3cd61Sagc $ECHO "$modename: specify a tag with \`--tag'" 1>&2 3471c576705Slukem exit $EXIT_FAILURE 3481c576705Slukem# else 349*6ca3cd61Sagc# $ECHO "$modename: using $tagname tagged configuration" 3501c576705Slukem fi 3511c576705Slukem ;; 3521c576705Slukem esac 3531c576705Slukem fi 3541c576705Slukem} 3551c576705Slukem 3561c576705Slukem 3571c576705Slukem# func_extract_an_archive dir oldlib 3581c576705Slukemfunc_extract_an_archive () 3591c576705Slukem{ 3601c576705Slukem f_ex_an_ar_dir="$1"; shift 3611c576705Slukem f_ex_an_ar_oldlib="$1" 3621c576705Slukem 3631c576705Slukem $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 3641c576705Slukem $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 3651c576705Slukem if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3661c576705Slukem : 3671c576705Slukem else 368*6ca3cd61Sagc $ECHO "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 3691c576705Slukem exit $EXIT_FAILURE 3701c576705Slukem fi 3711c576705Slukem} 3721c576705Slukem 3731c576705Slukem# func_extract_archives gentop oldlib ... 3741c576705Slukemfunc_extract_archives () 3751c576705Slukem{ 3761c576705Slukem my_gentop="$1"; shift 3771c576705Slukem my_oldlibs=${1+"$@"} 3781c576705Slukem my_oldobjs="" 3791c576705Slukem my_xlib="" 3801c576705Slukem my_xabs="" 3811c576705Slukem my_xdir="" 3821c576705Slukem my_status="" 3831c576705Slukem 3841c576705Slukem $show "${rm}r $my_gentop" 3851c576705Slukem $run ${rm}r "$my_gentop" 3861c576705Slukem $show "$mkdir $my_gentop" 3871c576705Slukem $run $mkdir "$my_gentop" 3881c576705Slukem my_status=$? 3891c576705Slukem if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3901c576705Slukem exit $my_status 3911c576705Slukem fi 3921c576705Slukem 3931c576705Slukem for my_xlib in $my_oldlibs; do 3941c576705Slukem # Extract the objects. 3951c576705Slukem case $my_xlib in 3961c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3971c576705Slukem *) my_xabs=`pwd`"/$my_xlib" ;; 3981c576705Slukem esac 399*6ca3cd61Sagc my_xlib=`$ECHO "X$my_xlib" | $Xsed -e 's%^.*/%%'` 4001c576705Slukem my_xlib_u=$my_xlib 4011c576705Slukem while :; do 4021c576705Slukem case " $extracted_archives " in 4031c576705Slukem *" $my_xlib_u "*) 4041c576705Slukem extracted_serial=`expr $extracted_serial + 1` 4051c576705Slukem my_xlib_u=lt$extracted_serial-$my_xlib ;; 4061c576705Slukem *) break ;; 4071c576705Slukem esac 4081c576705Slukem done 4091c576705Slukem extracted_archives="$extracted_archives $my_xlib_u" 4101c576705Slukem my_xdir="$my_gentop/$my_xlib_u" 4111c576705Slukem 4121c576705Slukem $show "${rm}r $my_xdir" 4131c576705Slukem $run ${rm}r "$my_xdir" 4141c576705Slukem $show "$mkdir $my_xdir" 4151c576705Slukem $run $mkdir "$my_xdir" 4161c576705Slukem exit_status=$? 4171c576705Slukem if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 4181c576705Slukem exit $exit_status 4191c576705Slukem fi 4201c576705Slukem case $host in 4211c576705Slukem *-darwin*) 4221c576705Slukem $show "Extracting $my_xabs" 4231c576705Slukem # Do not bother doing anything if just a dry run 4241c576705Slukem if test -z "$run"; then 4251c576705Slukem darwin_orig_dir=`pwd` 4261c576705Slukem cd $my_xdir || exit $? 4271c576705Slukem darwin_archive=$my_xabs 4281c576705Slukem darwin_curdir=`pwd` 429*6ca3cd61Sagc darwin_base_archive=`$ECHO "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 4301c576705Slukem darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 4311c576705Slukem if test -n "$darwin_arches"; then 4321c576705Slukem darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 4331c576705Slukem darwin_arch= 4341c576705Slukem $show "$darwin_base_archive has multiple architectures $darwin_arches" 4351c576705Slukem for darwin_arch in $darwin_arches ; do 4361c576705Slukem mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 4371c576705Slukem lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 4381c576705Slukem cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 4391c576705Slukem func_extract_an_archive "`pwd`" "${darwin_base_archive}" 4401c576705Slukem cd "$darwin_curdir" 4411c576705Slukem $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 4421c576705Slukem done # $darwin_arches 4431c576705Slukem ## Okay now we have a bunch of thin objects, gotta fatten them up :) 4441c576705Slukem darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 4451c576705Slukem darwin_file= 4461c576705Slukem darwin_files= 4471c576705Slukem for darwin_file in $darwin_filelist; do 4481c576705Slukem darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 4491c576705Slukem lipo -create -output "$darwin_file" $darwin_files 4501c576705Slukem done # $darwin_filelist 4511c576705Slukem ${rm}r unfat-$$ 4521c576705Slukem cd "$darwin_orig_dir" 4531c576705Slukem else 4541c576705Slukem cd "$darwin_orig_dir" 4551c576705Slukem func_extract_an_archive "$my_xdir" "$my_xabs" 4561c576705Slukem fi # $darwin_arches 4571c576705Slukem fi # $run 4581c576705Slukem ;; 4591c576705Slukem *) 4601c576705Slukem func_extract_an_archive "$my_xdir" "$my_xabs" 4611c576705Slukem ;; 4621c576705Slukem esac 4631c576705Slukem my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 4641c576705Slukem done 4651c576705Slukem func_extract_archives_result="$my_oldobjs" 4661c576705Slukem} 4671c576705Slukem# End of Shell function definitions 4681c576705Slukem##################################### 4691c576705Slukem 4701c576705Slukem# Darwin sucks 4711c576705Slukemeval std_shrext=\"$shrext_cmds\" 4721c576705Slukem 4731c576705Slukemdisable_libs=no 4741c576705Slukem 4751c576705Slukem# Parse our command line options once, thoroughly. 4761c576705Slukemwhile test "$#" -gt 0 4771c576705Slukemdo 4781c576705Slukem arg="$1" 4791c576705Slukem shift 4801c576705Slukem 4811c576705Slukem case $arg in 482*6ca3cd61Sagc -*=*) optarg=`$ECHO "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4831c576705Slukem *) optarg= ;; 4841c576705Slukem esac 4851c576705Slukem 4861c576705Slukem # If the previous option needs an argument, assign it. 4871c576705Slukem if test -n "$prev"; then 4881c576705Slukem case $prev in 4891c576705Slukem execute_dlfiles) 4901c576705Slukem execute_dlfiles="$execute_dlfiles $arg" 4911c576705Slukem ;; 4921c576705Slukem tag) 4931c576705Slukem tagname="$arg" 4941c576705Slukem preserve_args="${preserve_args}=$arg" 4951c576705Slukem 4961c576705Slukem # Check whether tagname contains only valid characters 4971c576705Slukem case $tagname in 4981c576705Slukem *[!-_A-Za-z0-9,/]*) 499*6ca3cd61Sagc $ECHO "$progname: invalid tag name: $tagname" 1>&2 5001c576705Slukem exit $EXIT_FAILURE 5011c576705Slukem ;; 5021c576705Slukem esac 5031c576705Slukem 5041c576705Slukem case $tagname in 5051c576705Slukem CC) 5061c576705Slukem # Don't test for the "default" C tag, as we know, it's there, but 5071c576705Slukem # not specially marked. 5081c576705Slukem ;; 5091c576705Slukem *) 5101c576705Slukem if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 5111c576705Slukem taglist="$taglist $tagname" 5121c576705Slukem # Evaluate the configuration. 5131c576705Slukem eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 5141c576705Slukem else 515*6ca3cd61Sagc $ECHO "$progname: ignoring unknown tag $tagname" 1>&2 5161c576705Slukem fi 5171c576705Slukem ;; 5181c576705Slukem esac 5191c576705Slukem ;; 5201c576705Slukem *) 5211c576705Slukem eval "$prev=\$arg" 5221c576705Slukem ;; 5231c576705Slukem esac 5241c576705Slukem 5251c576705Slukem prev= 5261c576705Slukem prevopt= 5271c576705Slukem continue 5281c576705Slukem fi 5291c576705Slukem 5301c576705Slukem # Have we seen a non-optional argument yet? 5311c576705Slukem case $arg in 5321c576705Slukem --help) 5331c576705Slukem show_help=yes 5341c576705Slukem ;; 5351c576705Slukem 5361c576705Slukem --version) 5371c576705Slukem echo "\ 5381c576705Slukem$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 5391c576705Slukem 5401c576705SlukemCopyright (C) 2008 Free Software Foundation, Inc. 5411c576705SlukemThis is free software; see the source for copying conditions. There is NO 5421c576705Slukemwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 5431c576705Slukem exit $? 5441c576705Slukem ;; 5451c576705Slukem 5461c576705Slukem --config) 5471c576705Slukem ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 5481c576705Slukem # Now print the configurations for the tags. 5491c576705Slukem for tagname in $taglist; do 5501c576705Slukem ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 5511c576705Slukem done 5521c576705Slukem exit $? 5531c576705Slukem ;; 5541c576705Slukem 5551c576705Slukem --debug) 556*6ca3cd61Sagc $ECHO "$progname: enabling shell trace mode" 5571c576705Slukem set -x 5581c576705Slukem preserve_args="$preserve_args $arg" 5591c576705Slukem ;; 5601c576705Slukem 5611c576705Slukem --dry-run | -n) 5621c576705Slukem run=: 5631c576705Slukem ;; 5641c576705Slukem 5651c576705Slukem --features) 566*6ca3cd61Sagc $ECHO "host: $host" 5671c576705Slukem if test "$build_libtool_libs" = yes; then 568*6ca3cd61Sagc $ECHO "enable shared libraries" 5691c576705Slukem else 570*6ca3cd61Sagc $ECHO "disable shared libraries" 5711c576705Slukem fi 5721c576705Slukem if test "$build_old_libs" = yes; then 573*6ca3cd61Sagc $ECHO "enable static libraries" 5741c576705Slukem else 575*6ca3cd61Sagc $ECHO "disable static libraries" 5761c576705Slukem fi 5771c576705Slukem exit $? 5781c576705Slukem ;; 5791c576705Slukem 5801c576705Slukem --finish) mode="finish" ;; 5811c576705Slukem 5821c576705Slukem --mode) prevopt="--mode" prev=mode ;; 5831c576705Slukem --mode=*) mode="$optarg" ;; 5841c576705Slukem 5851c576705Slukem --preserve-dup-deps) duplicate_deps="yes" ;; 5861c576705Slukem 5871c576705Slukem --quiet | --silent) 5881c576705Slukem show=: 5891c576705Slukem preserve_args="$preserve_args $arg" 5901c576705Slukem ;; 5911c576705Slukem 5921c576705Slukem --tag) 5931c576705Slukem prevopt="--tag" 5941c576705Slukem prev=tag 5951c576705Slukem preserve_args="$preserve_args --tag" 5961c576705Slukem ;; 5971c576705Slukem --tag=*) 5981c576705Slukem set tag "$optarg" ${1+"$@"} 5991c576705Slukem shift 6001c576705Slukem prev=tag 6011c576705Slukem preserve_args="$preserve_args --tag" 6021c576705Slukem ;; 6031c576705Slukem 6041c576705Slukem -dlopen) 6051c576705Slukem prevopt="-dlopen" 6061c576705Slukem prev=execute_dlfiles 6071c576705Slukem ;; 6081c576705Slukem 6091c576705Slukem -*) 610*6ca3cd61Sagc $ECHO "$modename: unrecognized option \`$arg'" 1>&2 611*6ca3cd61Sagc $ECHO "$help" 1>&2 6121c576705Slukem exit $EXIT_FAILURE 6131c576705Slukem ;; 6141c576705Slukem 6151c576705Slukem *) 6161c576705Slukem nonopt="$arg" 6171c576705Slukem break 6181c576705Slukem ;; 6191c576705Slukem esac 6201c576705Slukemdone 6211c576705Slukem 6221c576705Slukemif test -n "$prevopt"; then 623*6ca3cd61Sagc $ECHO "$modename: option \`$prevopt' requires an argument" 1>&2 624*6ca3cd61Sagc $ECHO "$help" 1>&2 6251c576705Slukem exit $EXIT_FAILURE 6261c576705Slukemfi 6271c576705Slukem 6281c576705Slukemcase $disable_libs in 6291c576705Slukemno) 6301c576705Slukem ;; 6311c576705Slukemshared) 6321c576705Slukem build_libtool_libs=no 6331c576705Slukem build_old_libs=yes 6341c576705Slukem ;; 6351c576705Slukemstatic) 6361c576705Slukem build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 6371c576705Slukem ;; 6381c576705Slukemesac 6391c576705Slukem 6401c576705Slukem# If this variable is set in any of the actions, the command in it 6411c576705Slukem# will be execed at the end. This prevents here-documents from being 6421c576705Slukem# left over by shells. 6431c576705Slukemexec_cmd= 6441c576705Slukem 6451c576705Slukemif test -z "$show_help"; then 6461c576705Slukem 6471c576705Slukem # Infer the operation mode. 6481c576705Slukem if test -z "$mode"; then 649*6ca3cd61Sagc $ECHO "*** Warning: inferring the mode of operation is deprecated." 1>&2 650*6ca3cd61Sagc $ECHO "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 6511c576705Slukem case $nonopt in 6521c576705Slukem *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc* | *CC) 6531c576705Slukem mode=link 6541c576705Slukem for arg 6551c576705Slukem do 6561c576705Slukem case $arg in 6571c576705Slukem -c) 6581c576705Slukem mode=compile 6591c576705Slukem break 6601c576705Slukem ;; 6611c576705Slukem esac 6621c576705Slukem done 6631c576705Slukem ;; 6641c576705Slukem *db | *dbx | *strace | *truss) 6651c576705Slukem mode=execute 6661c576705Slukem ;; 6671c576705Slukem *install*|cp|mv) 6681c576705Slukem mode=install 6691c576705Slukem ;; 6701c576705Slukem *rm) 6711c576705Slukem mode=uninstall 6721c576705Slukem ;; 6731c576705Slukem *) 6741c576705Slukem # If we have no mode, but dlfiles were specified, then do execute mode. 6751c576705Slukem test -n "$execute_dlfiles" && mode=execute 6761c576705Slukem 6771c576705Slukem # Just use the default operation mode. 6781c576705Slukem if test -z "$mode"; then 6791c576705Slukem if test -n "$nonopt"; then 680*6ca3cd61Sagc $ECHO "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6811c576705Slukem else 682*6ca3cd61Sagc $ECHO "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6831c576705Slukem fi 6841c576705Slukem fi 6851c576705Slukem ;; 6861c576705Slukem esac 6871c576705Slukem fi 6881c576705Slukem 6891c576705Slukem # Only execute mode is allowed to have -dlopen flags. 6901c576705Slukem if test -n "$execute_dlfiles" && test "$mode" != execute; then 691*6ca3cd61Sagc $ECHO "$modename: unrecognized option \`-dlopen'" 1>&2 692*6ca3cd61Sagc $ECHO "$help" 1>&2 6931c576705Slukem exit $EXIT_FAILURE 6941c576705Slukem fi 6951c576705Slukem 6961c576705Slukem # Change the help message to a mode-specific one. 6971c576705Slukem generic_help="$help" 6981c576705Slukem help="Try \`$modename --help --mode=$mode' for more information." 6991c576705Slukem 7001c576705Slukem # These modes are in order of execution frequency so that they run quickly. 7011c576705Slukem case $mode in 7021c576705Slukem # libtool compile mode 7031c576705Slukem compile) 7041c576705Slukem modename="$modename: compile" 7051c576705Slukem # Get the compilation command and the source file. 7061c576705Slukem base_compile= 7071c576705Slukem srcfile="$nonopt" # always keep a non-empty value in "srcfile" 7081c576705Slukem suppress_opt=yes 7091c576705Slukem suppress_output= 7101c576705Slukem arg_mode=normal 7111c576705Slukem libobj= 7121c576705Slukem later= 7131c576705Slukem 7141c576705Slukem for arg 7151c576705Slukem do 7161c576705Slukem case $arg_mode in 7171c576705Slukem arg ) 7181c576705Slukem # do not "continue". Instead, add this to base_compile 7191c576705Slukem lastarg="$arg" 7201c576705Slukem arg_mode=normal 7211c576705Slukem ;; 7221c576705Slukem 7231c576705Slukem target ) 7241c576705Slukem libobj="$arg" 7251c576705Slukem arg_mode=normal 7261c576705Slukem continue 7271c576705Slukem ;; 7281c576705Slukem 7291c576705Slukem normal ) 7301c576705Slukem # Accept any command-line options. 7311c576705Slukem case $arg in 7321c576705Slukem -o) 7331c576705Slukem if test -n "$libobj" ; then 734*6ca3cd61Sagc $ECHO "$modename: you cannot specify \`-o' more than once" 1>&2 7351c576705Slukem exit $EXIT_FAILURE 7361c576705Slukem fi 7371c576705Slukem arg_mode=target 7381c576705Slukem continue 7391c576705Slukem ;; 7401c576705Slukem 7411c576705Slukem -static | -prefer-pic | -prefer-non-pic) 7421c576705Slukem later="$later $arg" 7431c576705Slukem continue 7441c576705Slukem ;; 7451c576705Slukem 7461c576705Slukem -no-suppress) 7471c576705Slukem suppress_opt=no 7481c576705Slukem continue 7491c576705Slukem ;; 7501c576705Slukem 7511c576705Slukem -Xcompiler) 7521c576705Slukem arg_mode=arg # the next one goes into the "base_compile" arg list 7531c576705Slukem continue # The current "srcfile" will either be retained or 7541c576705Slukem ;; # replaced later. I would guess that would be a bug. 7551c576705Slukem 7561c576705Slukem -Wc,*) 757*6ca3cd61Sagc args=`$ECHO "X$arg" | $Xsed -e "s/^-Wc,//"` 7581c576705Slukem lastarg= 7591c576705Slukem save_ifs="$IFS"; IFS=',' 7601c576705Slukem for arg in $args; do 7611c576705Slukem IFS="$save_ifs" 7621c576705Slukem 7631c576705Slukem # Double-quote args containing other shell metacharacters. 7641c576705Slukem # Many Bourne shells cannot handle close brackets correctly 7651c576705Slukem # in scan sets, so we specify it separately. 7661c576705Slukem case $arg in 7671c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7681c576705Slukem arg="\"$arg\"" 7691c576705Slukem ;; 7701c576705Slukem esac 7711c576705Slukem lastarg="$lastarg $arg" 7721c576705Slukem done 7731c576705Slukem IFS="$save_ifs" 774*6ca3cd61Sagc lastarg=`$ECHO "X$lastarg" | $Xsed -e "s/^ //"` 7751c576705Slukem 7761c576705Slukem # Add the arguments to base_compile. 7771c576705Slukem base_compile="$base_compile $lastarg" 7781c576705Slukem continue 7791c576705Slukem ;; 7801c576705Slukem 7811c576705Slukem * ) 7821c576705Slukem # Accept the current argument as the source file. 7831c576705Slukem # The previous "srcfile" becomes the current argument. 7841c576705Slukem # 7851c576705Slukem lastarg="$srcfile" 7861c576705Slukem srcfile="$arg" 7871c576705Slukem ;; 7881c576705Slukem esac # case $arg 7891c576705Slukem ;; 7901c576705Slukem esac # case $arg_mode 7911c576705Slukem 7921c576705Slukem # Aesthetically quote the previous argument. 793*6ca3cd61Sagc lastarg=`$ECHO "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7941c576705Slukem 7951c576705Slukem case $lastarg in 7961c576705Slukem # Double-quote args containing other shell metacharacters. 7971c576705Slukem # Many Bourne shells cannot handle close brackets correctly 7981c576705Slukem # in scan sets, and some SunOS ksh mistreat backslash-escaping 7991c576705Slukem # in scan sets (worked around with variable expansion), 8001c576705Slukem # and furthermore cannot handle '|' '&' '(' ')' in scan sets 8011c576705Slukem # at all, so we specify them separately. 8021c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8031c576705Slukem lastarg="\"$lastarg\"" 8041c576705Slukem ;; 8051c576705Slukem esac 8061c576705Slukem 8071c576705Slukem base_compile="$base_compile $lastarg" 8081c576705Slukem done # for arg 8091c576705Slukem 8101c576705Slukem case $arg_mode in 8111c576705Slukem arg) 812*6ca3cd61Sagc $ECHO "$modename: you must specify an argument for -Xcompile" 8131c576705Slukem exit $EXIT_FAILURE 8141c576705Slukem ;; 8151c576705Slukem target) 816*6ca3cd61Sagc $ECHO "$modename: you must specify a target with \`-o'" 1>&2 8171c576705Slukem exit $EXIT_FAILURE 8181c576705Slukem ;; 8191c576705Slukem *) 8201c576705Slukem # Get the name of the library object. 821*6ca3cd61Sagc [ -z "$libobj" ] && libobj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%'` 8221c576705Slukem ;; 8231c576705Slukem esac 8241c576705Slukem 8251c576705Slukem # Recognize several different file suffixes. 8261c576705Slukem # If the user specifies -o file.o, it is replaced with file.lo 8271c576705Slukem xform='[cCFSifmso]' 8281c576705Slukem case $libobj in 8291c576705Slukem *.ada) xform=ada ;; 8301c576705Slukem *.adb) xform=adb ;; 8311c576705Slukem *.ads) xform=ads ;; 8321c576705Slukem *.asm) xform=asm ;; 8331c576705Slukem *.c++) xform=c++ ;; 8341c576705Slukem *.cc) xform=cc ;; 8351c576705Slukem *.ii) xform=ii ;; 8361c576705Slukem *.class) xform=class ;; 8371c576705Slukem *.cpp) xform=cpp ;; 8381c576705Slukem *.cxx) xform=cxx ;; 8391c576705Slukem *.[fF][09]?) xform=[fF][09]. ;; 8401c576705Slukem *.for) xform=for ;; 8411c576705Slukem *.java) xform=java ;; 8421c576705Slukem *.obj) xform=obj ;; 8431c576705Slukem *.sx) xform=sx ;; 8441c576705Slukem esac 8451c576705Slukem 846*6ca3cd61Sagc libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 8471c576705Slukem 8481c576705Slukem case $libobj in 849*6ca3cd61Sagc *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;; 8501c576705Slukem *) 851*6ca3cd61Sagc $ECHO "$modename: cannot determine name of library object from \`$libobj'" 1>&2 8521c576705Slukem exit $EXIT_FAILURE 8531c576705Slukem ;; 8541c576705Slukem esac 8551c576705Slukem 8561c576705Slukem func_infer_tag $base_compile 8571c576705Slukem 8581c576705Slukem for arg in $later; do 8591c576705Slukem case $arg in 8601c576705Slukem -static) 8611c576705Slukem build_old_libs=yes 8621c576705Slukem continue 8631c576705Slukem ;; 8641c576705Slukem 8651c576705Slukem -prefer-pic) 8661c576705Slukem pic_mode=yes 8671c576705Slukem continue 8681c576705Slukem ;; 8691c576705Slukem 8701c576705Slukem -prefer-non-pic) 8711c576705Slukem pic_mode=no 8721c576705Slukem continue 8731c576705Slukem ;; 8741c576705Slukem esac 8751c576705Slukem done 8761c576705Slukem 877*6ca3cd61Sagc qlibobj=`$ECHO "X$libobj" | $Xsed -e "$sed_quote_subst"` 8781c576705Slukem case $qlibobj in 8791c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8801c576705Slukem qlibobj="\"$qlibobj\"" ;; 8811c576705Slukem esac 8821c576705Slukem test "X$libobj" != "X$qlibobj" \ 883*6ca3cd61Sagc && $ECHO "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 884*6ca3cd61Sagc && $ECHO "$modename: libobj name \`$libobj' may not contain shell special characters." 885*6ca3cd61Sagc objname=`$ECHO "X$obj" | $Xsed -e 's%^.*/%%'` 886*6ca3cd61Sagc xdir=`$ECHO "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8871c576705Slukem if test "X$xdir" = "X$obj"; then 8881c576705Slukem xdir= 8891c576705Slukem else 8901c576705Slukem xdir=$xdir/ 8911c576705Slukem fi 8921c576705Slukem lobj=${xdir}$objdir/$objname 8931c576705Slukem 8941c576705Slukem if test -z "$base_compile"; then 895*6ca3cd61Sagc $ECHO "$modename: you must specify a compilation command" 1>&2 896*6ca3cd61Sagc $ECHO "$help" 1>&2 8971c576705Slukem exit $EXIT_FAILURE 8981c576705Slukem fi 8991c576705Slukem 9001c576705Slukem # Delete any leftover library objects. 9011c576705Slukem if test "$build_old_libs" = yes; then 9021c576705Slukem removelist="$obj $lobj $libobj ${libobj}T" 9031c576705Slukem else 9041c576705Slukem removelist="$lobj $libobj ${libobj}T" 9051c576705Slukem fi 9061c576705Slukem 9071c576705Slukem $run $rm $removelist 9081c576705Slukem trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 9091c576705Slukem 9101c576705Slukem # On Cygwin there's no "real" PIC flag so we must build both object types 9111c576705Slukem case $host_os in 9121c576705Slukem cygwin* | mingw* | pw32* | os2*) 9131c576705Slukem pic_mode=default 9141c576705Slukem ;; 9151c576705Slukem esac 9161c576705Slukem if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 9171c576705Slukem # non-PIC code in shared libraries is not supported 9181c576705Slukem pic_mode=default 9191c576705Slukem fi 9201c576705Slukem 9211c576705Slukem # Calculate the filename of the output object if compiler does 9221c576705Slukem # not support -o with -c 9231c576705Slukem if test "$compiler_c_o" = no; then 924*6ca3cd61Sagc output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 9251c576705Slukem lockfile="$output_obj.lock" 9261c576705Slukem removelist="$removelist $output_obj $lockfile" 9271c576705Slukem trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 9281c576705Slukem else 9291c576705Slukem output_obj= 9301c576705Slukem need_locks=no 9311c576705Slukem lockfile= 9321c576705Slukem fi 9331c576705Slukem 9341c576705Slukem # Lock this critical section if it is needed 9351c576705Slukem # We use this script file to make the link, it avoids creating a new file 9361c576705Slukem if test "$need_locks" = yes; then 9371c576705Slukem until $run ln "$progpath" "$lockfile" 2>/dev/null; do 9381c576705Slukem $show "Waiting for $lockfile to be removed" 9391c576705Slukem sleep 2 9401c576705Slukem done 9411c576705Slukem elif test "$need_locks" = warn; then 9421c576705Slukem if test -f "$lockfile"; then 943*6ca3cd61Sagc $ECHO "\ 9441c576705Slukem*** ERROR, $lockfile exists and contains: 9451c576705Slukem`cat $lockfile 2>/dev/null` 9461c576705Slukem 9471c576705SlukemThis indicates that another process is trying to use the same 9481c576705Slukemtemporary object file, and libtool could not work around it because 9491c576705Slukemyour compiler does not support \`-c' and \`-o' together. If you 9501c576705Slukemrepeat this compilation, it may succeed, by chance, but you had better 9511c576705Slukemavoid parallel builds (make -j) in this platform, or get a better 9521c576705Slukemcompiler." 9531c576705Slukem 9541c576705Slukem $run $rm $removelist 9551c576705Slukem exit $EXIT_FAILURE 9561c576705Slukem fi 957*6ca3cd61Sagc $ECHO "$srcfile" > "$lockfile" 9581c576705Slukem fi 9591c576705Slukem 9601c576705Slukem if test -n "$fix_srcfile_path"; then 9611c576705Slukem eval srcfile=\"$fix_srcfile_path\" 9621c576705Slukem fi 963*6ca3cd61Sagc qsrcfile=`$ECHO "X$srcfile" | $Xsed -e "$sed_quote_subst"` 9641c576705Slukem case $qsrcfile in 9651c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 9661c576705Slukem qsrcfile="\"$qsrcfile\"" ;; 9671c576705Slukem esac 9681c576705Slukem 9691c576705Slukem $run $rm "$libobj" "${libobj}T" 9701c576705Slukem 9711c576705Slukem # Create a libtool object file (analogous to a ".la" file), 9721c576705Slukem # but don't create it if we're doing a dry run. 9731c576705Slukem test -z "$run" && cat > ${libobj}T <<EOF 9741c576705Slukem# $libobj - a libtool object file 9751c576705Slukem# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 9761c576705Slukem# 9771c576705Slukem# Please DO NOT delete this file! 9781c576705Slukem# It is necessary for linking the library. 9791c576705Slukem 9801c576705Slukem# Name of the PIC object. 9811c576705SlukemEOF 9821c576705Slukem 9831c576705Slukem # Only build a PIC object if we are building libtool libraries. 9841c576705Slukem if test "$build_libtool_libs" = yes; then 9851c576705Slukem # Without this assignment, base_compile gets emptied. 9861c576705Slukem fbsd_hideous_sh_bug=$base_compile 9871c576705Slukem 9881c576705Slukem if test "$pic_mode" != no; then 9891c576705Slukem command="$base_compile $qsrcfile $pic_flag" 9901c576705Slukem else 9911c576705Slukem # Don't build PIC code 9921c576705Slukem command="$base_compile $qsrcfile" 9931c576705Slukem fi 9941c576705Slukem 9951c576705Slukem if test ! -d "${xdir}$objdir"; then 9961c576705Slukem $show "$mkdir ${xdir}$objdir" 9971c576705Slukem $run $mkdir ${xdir}$objdir 9981c576705Slukem exit_status=$? 9991c576705Slukem if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 10001c576705Slukem exit $exit_status 10011c576705Slukem fi 10021c576705Slukem fi 10031c576705Slukem 10041c576705Slukem if test -z "$output_obj"; then 10051c576705Slukem # Place PIC objects in $objdir 10061c576705Slukem command="$command -o $lobj" 10071c576705Slukem fi 10081c576705Slukem 10091c576705Slukem $run $rm "$lobj" "$output_obj" 10101c576705Slukem 10111c576705Slukem $show "$command" 10121c576705Slukem if $run eval $lt_env "$command"; then : 10131c576705Slukem else 10141c576705Slukem test -n "$output_obj" && $run $rm $removelist 10151c576705Slukem exit $EXIT_FAILURE 10161c576705Slukem fi 10171c576705Slukem 10181c576705Slukem if test "$need_locks" = warn && 10191c576705Slukem test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1020*6ca3cd61Sagc $ECHO "\ 10211c576705Slukem*** ERROR, $lockfile contains: 10221c576705Slukem`cat $lockfile 2>/dev/null` 10231c576705Slukem 10241c576705Slukembut it should contain: 10251c576705Slukem$srcfile 10261c576705Slukem 10271c576705SlukemThis indicates that another process is trying to use the same 10281c576705Slukemtemporary object file, and libtool could not work around it because 10291c576705Slukemyour compiler does not support \`-c' and \`-o' together. If you 10301c576705Slukemrepeat this compilation, it may succeed, by chance, but you had better 10311c576705Slukemavoid parallel builds (make -j) in this platform, or get a better 10321c576705Slukemcompiler." 10331c576705Slukem 10341c576705Slukem $run $rm $removelist 10351c576705Slukem exit $EXIT_FAILURE 10361c576705Slukem fi 10371c576705Slukem 10381c576705Slukem # Just move the object if needed, then go on to compile the next one 10391c576705Slukem if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 10401c576705Slukem $show "$mv $output_obj $lobj" 10411c576705Slukem if $run $mv $output_obj $lobj; then : 10421c576705Slukem else 10431c576705Slukem error=$? 10441c576705Slukem $run $rm $removelist 10451c576705Slukem exit $error 10461c576705Slukem fi 10471c576705Slukem fi 10481c576705Slukem 10491c576705Slukem # Append the name of the PIC object to the libtool object file. 10501c576705Slukem test -z "$run" && cat >> ${libobj}T <<EOF 10511c576705Slukempic_object='$objdir/$objname' 10521c576705Slukem 10531c576705SlukemEOF 10541c576705Slukem 10551c576705Slukem # Allow error messages only from the first compilation. 10561c576705Slukem if test "$suppress_opt" = yes; then 10571c576705Slukem suppress_output=' >/dev/null 2>&1' 10581c576705Slukem fi 10591c576705Slukem else 10601c576705Slukem # No PIC object so indicate it doesn't exist in the libtool 10611c576705Slukem # object file. 10621c576705Slukem test -z "$run" && cat >> ${libobj}T <<EOF 10631c576705Slukempic_object=none 10641c576705Slukem 10651c576705SlukemEOF 10661c576705Slukem fi 10671c576705Slukem 10681c576705Slukem # Only build a position-dependent object if we build old libraries. 10691c576705Slukem if test "$build_old_libs" = yes; then 10701c576705Slukem if test "$pic_mode" != yes; then 10711c576705Slukem # Don't build PIC code 10721c576705Slukem command="$base_compile $qsrcfile" 10731c576705Slukem else 10741c576705Slukem command="$base_compile $qsrcfile $pic_flag" 10751c576705Slukem fi 10761c576705Slukem if test "$compiler_c_o" = yes; then 10771c576705Slukem command="$command -o $obj" 10781c576705Slukem fi 10791c576705Slukem 10801c576705Slukem # Suppress compiler output if we already did a PIC compilation. 10811c576705Slukem command="$command$suppress_output" 10821c576705Slukem $run $rm "$obj" "$output_obj" 10831c576705Slukem $show "$command" 10841c576705Slukem if $run eval $lt_env "$command"; then : 10851c576705Slukem else 10861c576705Slukem $run $rm $removelist 10871c576705Slukem exit $EXIT_FAILURE 10881c576705Slukem fi 10891c576705Slukem 10901c576705Slukem if test "$need_locks" = warn && 10911c576705Slukem test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1092*6ca3cd61Sagc $ECHO "\ 10931c576705Slukem*** ERROR, $lockfile contains: 10941c576705Slukem`cat $lockfile 2>/dev/null` 10951c576705Slukem 10961c576705Slukembut it should contain: 10971c576705Slukem$srcfile 10981c576705Slukem 10991c576705SlukemThis indicates that another process is trying to use the same 11001c576705Slukemtemporary object file, and libtool could not work around it because 11011c576705Slukemyour compiler does not support \`-c' and \`-o' together. If you 11021c576705Slukemrepeat this compilation, it may succeed, by chance, but you had better 11031c576705Slukemavoid parallel builds (make -j) in this platform, or get a better 11041c576705Slukemcompiler." 11051c576705Slukem 11061c576705Slukem $run $rm $removelist 11071c576705Slukem exit $EXIT_FAILURE 11081c576705Slukem fi 11091c576705Slukem 11101c576705Slukem # Just move the object if needed 11111c576705Slukem if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 11121c576705Slukem $show "$mv $output_obj $obj" 11131c576705Slukem if $run $mv $output_obj $obj; then : 11141c576705Slukem else 11151c576705Slukem error=$? 11161c576705Slukem $run $rm $removelist 11171c576705Slukem exit $error 11181c576705Slukem fi 11191c576705Slukem fi 11201c576705Slukem 11211c576705Slukem # Append the name of the non-PIC object the libtool object file. 11221c576705Slukem # Only append if the libtool object file exists. 11231c576705Slukem test -z "$run" && cat >> ${libobj}T <<EOF 11241c576705Slukem# Name of the non-PIC object. 11251c576705Slukemnon_pic_object='$objname' 11261c576705Slukem 11271c576705SlukemEOF 11281c576705Slukem else 11291c576705Slukem # Append the name of the non-PIC object the libtool object file. 11301c576705Slukem # Only append if the libtool object file exists. 11311c576705Slukem test -z "$run" && cat >> ${libobj}T <<EOF 11321c576705Slukem# Name of the non-PIC object. 11331c576705Slukemnon_pic_object=none 11341c576705Slukem 11351c576705SlukemEOF 11361c576705Slukem fi 11371c576705Slukem 11381c576705Slukem $run $mv "${libobj}T" "${libobj}" 11391c576705Slukem 11401c576705Slukem # Unlock the critical section if it was locked 11411c576705Slukem if test "$need_locks" != no; then 11421c576705Slukem $run $rm "$lockfile" 11431c576705Slukem fi 11441c576705Slukem 11451c576705Slukem exit $EXIT_SUCCESS 11461c576705Slukem ;; 11471c576705Slukem 11481c576705Slukem # libtool link mode 11491c576705Slukem link | relink) 11501c576705Slukem modename="$modename: link" 11511c576705Slukem case $host in 11521c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 11531c576705Slukem # It is impossible to link a dll without this setting, and 11541c576705Slukem # we shouldn't force the makefile maintainer to figure out 11551c576705Slukem # which system we are compiling for in order to pass an extra 11561c576705Slukem # flag for every libtool invocation. 11571c576705Slukem # allow_undefined=no 11581c576705Slukem 11591c576705Slukem # FIXME: Unfortunately, there are problems with the above when trying 11601c576705Slukem # to make a dll which has undefined symbols, in which case not 11611c576705Slukem # even a static library is built. For now, we need to specify 11621c576705Slukem # -no-undefined on the libtool link line when we can be certain 11631c576705Slukem # that all symbols are satisfied, otherwise we get a static library. 11641c576705Slukem allow_undefined=yes 11651c576705Slukem ;; 11661c576705Slukem *) 11671c576705Slukem allow_undefined=yes 11681c576705Slukem ;; 11691c576705Slukem esac 11701c576705Slukem libtool_args="$nonopt" 11711c576705Slukem base_compile="$nonopt $@" 11721c576705Slukem compile_command="$nonopt" 11731c576705Slukem finalize_command="$nonopt" 11741c576705Slukem 11751c576705Slukem compile_rpath= 11761c576705Slukem finalize_rpath= 11771c576705Slukem compile_shlibpath= 11781c576705Slukem finalize_shlibpath= 11791c576705Slukem convenience= 11801c576705Slukem old_convenience= 11811c576705Slukem deplibs= 11821c576705Slukem old_deplibs= 11831c576705Slukem compiler_flags= 11841c576705Slukem linker_flags= 11851c576705Slukem dllsearchpath= 11861c576705Slukem lib_search_path=`pwd` 11871c576705Slukem inst_prefix_dir= 11881c576705Slukem 11891c576705Slukem avoid_version=no 11901c576705Slukem dlfiles= 11911c576705Slukem dlprefiles= 11921c576705Slukem dlself=no 11931c576705Slukem export_dynamic=no 11941c576705Slukem export_symbols= 11951c576705Slukem export_symbols_regex= 11961c576705Slukem generated= 11971c576705Slukem libobjs= 11981c576705Slukem ltlibs= 11991c576705Slukem module=no 12001c576705Slukem no_install=no 12011c576705Slukem objs= 12021c576705Slukem non_pic_objects= 12031c576705Slukem notinst_path= # paths that contain not-installed libtool libraries 12041c576705Slukem precious_files_regex= 12051c576705Slukem prefer_static_libs=no 12061c576705Slukem preload=no 12071c576705Slukem prev= 12081c576705Slukem prevarg= 12091c576705Slukem release= 12101c576705Slukem rpath= 12111c576705Slukem xrpath= 12121c576705Slukem perm_rpath= 12131c576705Slukem temp_rpath= 12141c576705Slukem thread_safe=no 12151c576705Slukem vinfo= 12161c576705Slukem vinfo_number=no 12171c576705Slukem single_module="${wl}-single_module" 12181c576705Slukem 12191c576705Slukem func_infer_tag $base_compile 12201c576705Slukem 12211c576705Slukem # We need to know -static, to get the right output filenames. 12221c576705Slukem for arg 12231c576705Slukem do 12241c576705Slukem case $arg in 12251c576705Slukem -all-static | -static | -static-libtool-libs) 12261c576705Slukem case $arg in 12271c576705Slukem -all-static) 12281c576705Slukem if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1229*6ca3cd61Sagc $ECHO "$modename: warning: complete static linking is impossible in this configuration" 1>&2 12301c576705Slukem fi 12311c576705Slukem if test -n "$link_static_flag"; then 12321c576705Slukem dlopen_self=$dlopen_self_static 12331c576705Slukem fi 12341c576705Slukem prefer_static_libs=yes 12351c576705Slukem ;; 12361c576705Slukem -static) 12371c576705Slukem if test -z "$pic_flag" && test -n "$link_static_flag"; then 12381c576705Slukem dlopen_self=$dlopen_self_static 12391c576705Slukem fi 12401c576705Slukem prefer_static_libs=built 12411c576705Slukem ;; 12421c576705Slukem -static-libtool-libs) 12431c576705Slukem if test -z "$pic_flag" && test -n "$link_static_flag"; then 12441c576705Slukem dlopen_self=$dlopen_self_static 12451c576705Slukem fi 12461c576705Slukem prefer_static_libs=yes 12471c576705Slukem ;; 12481c576705Slukem esac 12491c576705Slukem build_libtool_libs=no 12501c576705Slukem build_old_libs=yes 12511c576705Slukem break 12521c576705Slukem ;; 12531c576705Slukem esac 12541c576705Slukem done 12551c576705Slukem 12561c576705Slukem # See if our shared archives depend on static archives. 12571c576705Slukem test -n "$old_archive_from_new_cmds" && build_old_libs=yes 12581c576705Slukem 12591c576705Slukem # Go through the arguments, transforming them on the way. 12601c576705Slukem while test "$#" -gt 0; do 12611c576705Slukem arg="$1" 12621c576705Slukem shift 12631c576705Slukem case $arg in 12641c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1265*6ca3cd61Sagc qarg=\"`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 12661c576705Slukem ;; 12671c576705Slukem *) qarg=$arg ;; 12681c576705Slukem esac 12691c576705Slukem libtool_args="$libtool_args $qarg" 12701c576705Slukem 12711c576705Slukem # If the previous option needs an argument, assign it. 12721c576705Slukem if test -n "$prev"; then 12731c576705Slukem case $prev in 12741c576705Slukem output) 12751c576705Slukem compile_command="$compile_command @OUTPUT@" 12761c576705Slukem finalize_command="$finalize_command @OUTPUT@" 12771c576705Slukem ;; 12781c576705Slukem esac 12791c576705Slukem 12801c576705Slukem case $prev in 12811c576705Slukem dlfiles|dlprefiles) 12821c576705Slukem if test "$preload" = no; then 12831c576705Slukem # Add the symbol object into the linking commands. 12841c576705Slukem compile_command="$compile_command @SYMFILE@" 12851c576705Slukem finalize_command="$finalize_command @SYMFILE@" 12861c576705Slukem preload=yes 12871c576705Slukem fi 12881c576705Slukem case $arg in 12891c576705Slukem *.la | *.lo) ;; # We handle these cases below. 12901c576705Slukem force) 12911c576705Slukem if test "$dlself" = no; then 12921c576705Slukem dlself=needless 12931c576705Slukem export_dynamic=yes 12941c576705Slukem fi 12951c576705Slukem prev= 12961c576705Slukem continue 12971c576705Slukem ;; 12981c576705Slukem self) 12991c576705Slukem if test "$prev" = dlprefiles; then 13001c576705Slukem dlself=yes 13011c576705Slukem elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 13021c576705Slukem dlself=yes 13031c576705Slukem else 13041c576705Slukem dlself=needless 13051c576705Slukem export_dynamic=yes 13061c576705Slukem fi 13071c576705Slukem prev= 13081c576705Slukem continue 13091c576705Slukem ;; 13101c576705Slukem *) 13111c576705Slukem if test "$prev" = dlfiles; then 13121c576705Slukem dlfiles="$dlfiles $arg" 13131c576705Slukem else 13141c576705Slukem dlprefiles="$dlprefiles $arg" 13151c576705Slukem fi 13161c576705Slukem prev= 13171c576705Slukem continue 13181c576705Slukem ;; 13191c576705Slukem esac 13201c576705Slukem ;; 13211c576705Slukem expsyms) 13221c576705Slukem export_symbols="$arg" 13231c576705Slukem if test ! -f "$arg"; then 1324*6ca3cd61Sagc $ECHO "$modename: symbol file \`$arg' does not exist" 13251c576705Slukem exit $EXIT_FAILURE 13261c576705Slukem fi 13271c576705Slukem prev= 13281c576705Slukem continue 13291c576705Slukem ;; 13301c576705Slukem expsyms_regex) 13311c576705Slukem export_symbols_regex="$arg" 13321c576705Slukem prev= 13331c576705Slukem continue 13341c576705Slukem ;; 13351c576705Slukem inst_prefix) 13361c576705Slukem inst_prefix_dir="$arg" 13371c576705Slukem prev= 13381c576705Slukem continue 13391c576705Slukem ;; 13401c576705Slukem precious_regex) 13411c576705Slukem precious_files_regex="$arg" 13421c576705Slukem prev= 13431c576705Slukem continue 13441c576705Slukem ;; 13451c576705Slukem release) 13461c576705Slukem release="-$arg" 13471c576705Slukem prev= 13481c576705Slukem continue 13491c576705Slukem ;; 13501c576705Slukem objectlist) 13511c576705Slukem if test -f "$arg"; then 13521c576705Slukem save_arg=$arg 13531c576705Slukem moreargs= 13541c576705Slukem for fil in `cat $save_arg` 13551c576705Slukem do 13561c576705Slukem# moreargs="$moreargs $fil" 13571c576705Slukem arg=$fil 13581c576705Slukem # A libtool-controlled object. 13591c576705Slukem 13601c576705Slukem # Check to see that this really is a libtool object. 13611c576705Slukem if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 13621c576705Slukem pic_object= 13631c576705Slukem non_pic_object= 13641c576705Slukem 13651c576705Slukem # Read the .lo file 13661c576705Slukem # If there is no directory component, then add one. 13671c576705Slukem case $arg in 13681c576705Slukem */* | *\\*) . $arg ;; 13691c576705Slukem *) . ./$arg ;; 13701c576705Slukem esac 13711c576705Slukem 13721c576705Slukem if test -z "$pic_object" || \ 13731c576705Slukem test -z "$non_pic_object" || 13741c576705Slukem test "$pic_object" = none && \ 13751c576705Slukem test "$non_pic_object" = none; then 1376*6ca3cd61Sagc $ECHO "$modename: cannot find name of object for \`$arg'" 1>&2 13771c576705Slukem exit $EXIT_FAILURE 13781c576705Slukem fi 13791c576705Slukem 13801c576705Slukem # Extract subdirectory from the argument. 1381*6ca3cd61Sagc xdir=`$ECHO "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13821c576705Slukem if test "X$xdir" = "X$arg"; then 13831c576705Slukem xdir= 13841c576705Slukem else 13851c576705Slukem xdir="$xdir/" 13861c576705Slukem fi 13871c576705Slukem 13881c576705Slukem if test "$pic_object" != none; then 13891c576705Slukem # Prepend the subdirectory the object is found in. 13901c576705Slukem pic_object="$xdir$pic_object" 13911c576705Slukem 13921c576705Slukem if test "$prev" = dlfiles; then 13931c576705Slukem if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13941c576705Slukem dlfiles="$dlfiles $pic_object" 13951c576705Slukem prev= 13961c576705Slukem continue 13971c576705Slukem else 13981c576705Slukem # If libtool objects are unsupported, then we need to preload. 13991c576705Slukem prev=dlprefiles 14001c576705Slukem fi 14011c576705Slukem fi 14021c576705Slukem 14031c576705Slukem # CHECK ME: I think I busted this. -Ossama 14041c576705Slukem if test "$prev" = dlprefiles; then 14051c576705Slukem # Preload the old-style object. 14061c576705Slukem dlprefiles="$dlprefiles $pic_object" 14071c576705Slukem prev= 14081c576705Slukem fi 14091c576705Slukem 14101c576705Slukem # A PIC object. 14111c576705Slukem libobjs="$libobjs $pic_object" 14121c576705Slukem arg="$pic_object" 14131c576705Slukem fi 14141c576705Slukem 14151c576705Slukem # Non-PIC object. 14161c576705Slukem if test "$non_pic_object" != none; then 14171c576705Slukem # Prepend the subdirectory the object is found in. 14181c576705Slukem non_pic_object="$xdir$non_pic_object" 14191c576705Slukem 14201c576705Slukem # A standard non-PIC object 14211c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 14221c576705Slukem if test -z "$pic_object" || test "$pic_object" = none ; then 14231c576705Slukem arg="$non_pic_object" 14241c576705Slukem fi 14251c576705Slukem else 14261c576705Slukem # If the PIC object exists, use it instead. 14271c576705Slukem # $xdir was prepended to $pic_object above. 14281c576705Slukem non_pic_object="$pic_object" 14291c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 14301c576705Slukem fi 14311c576705Slukem else 14321c576705Slukem # Only an error if not doing a dry-run. 14331c576705Slukem if test -z "$run"; then 1434*6ca3cd61Sagc $ECHO "$modename: \`$arg' is not a valid libtool object" 1>&2 14351c576705Slukem exit $EXIT_FAILURE 14361c576705Slukem else 14371c576705Slukem # Dry-run case. 14381c576705Slukem 14391c576705Slukem # Extract subdirectory from the argument. 1440*6ca3cd61Sagc xdir=`$ECHO "X$arg" | $Xsed -e 's%/[^/]*$%%'` 14411c576705Slukem if test "X$xdir" = "X$arg"; then 14421c576705Slukem xdir= 14431c576705Slukem else 14441c576705Slukem xdir="$xdir/" 14451c576705Slukem fi 14461c576705Slukem 1447*6ca3cd61Sagc pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1448*6ca3cd61Sagc non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"` 14491c576705Slukem libobjs="$libobjs $pic_object" 14501c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 14511c576705Slukem fi 14521c576705Slukem fi 14531c576705Slukem done 14541c576705Slukem else 1455*6ca3cd61Sagc $ECHO "$modename: link input file \`$save_arg' does not exist" 14561c576705Slukem exit $EXIT_FAILURE 14571c576705Slukem fi 14581c576705Slukem arg=$save_arg 14591c576705Slukem prev= 14601c576705Slukem continue 14611c576705Slukem ;; 14621c576705Slukem rpath | xrpath) 14631c576705Slukem # We need an absolute path. 14641c576705Slukem case $arg in 14651c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) ;; 14661c576705Slukem *) 1467*6ca3cd61Sagc $ECHO "$modename: only absolute run-paths are allowed" 1>&2 14681c576705Slukem exit $EXIT_FAILURE 14691c576705Slukem ;; 14701c576705Slukem esac 14711c576705Slukem # Canonicalise the pathname 14721c576705Slukem tmp="" 14731c576705Slukem while test "$arg" != "$tmp" 14741c576705Slukem do 14751c576705Slukem tmp=$arg 1476*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'` 14771c576705Slukem done 14781c576705Slukem if test "$prev" = rpath; then 14791c576705Slukem case "$rpath " in 14801c576705Slukem *" $arg "*) ;; 14811c576705Slukem *) rpath="$rpath $arg" ;; 14821c576705Slukem esac 14831c576705Slukem else 14841c576705Slukem case "$xrpath " in 14851c576705Slukem *" $arg "*) ;; 14861c576705Slukem *) xrpath="$xrpath $arg" ;; 14871c576705Slukem esac 14881c576705Slukem fi 14891c576705Slukem prev= 14901c576705Slukem continue 14911c576705Slukem ;; 14921c576705Slukem xcompiler) 14931c576705Slukem compiler_flags="$compiler_flags $qarg" 14941c576705Slukem prev= 14951c576705Slukem compile_command="$compile_command $qarg" 14961c576705Slukem finalize_command="$finalize_command $qarg" 14971c576705Slukem continue 14981c576705Slukem ;; 14991c576705Slukem xlinker) 15001c576705Slukem linker_flags="$linker_flags $qarg" 15011c576705Slukem compiler_flags="$compiler_flags $wl$qarg" 15021c576705Slukem prev= 15031c576705Slukem compile_command="$compile_command $wl$qarg" 15041c576705Slukem finalize_command="$finalize_command $wl$qarg" 15051c576705Slukem continue 15061c576705Slukem ;; 15071c576705Slukem xcclinker) 15081c576705Slukem linker_flags="$linker_flags $qarg" 15091c576705Slukem compiler_flags="$compiler_flags $qarg" 15101c576705Slukem prev= 15111c576705Slukem compile_command="$compile_command $qarg" 15121c576705Slukem finalize_command="$finalize_command $qarg" 15131c576705Slukem continue 15141c576705Slukem ;; 15151c576705Slukem shrext) 15161c576705Slukem shrext_cmds="$arg" 15171c576705Slukem prev= 15181c576705Slukem continue 15191c576705Slukem ;; 15201c576705Slukem darwin_framework|darwin_framework_skip) 15211c576705Slukem test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 15221c576705Slukem compile_command="$compile_command $arg" 15231c576705Slukem finalize_command="$finalize_command $arg" 15241c576705Slukem prev= 15251c576705Slukem continue 15261c576705Slukem ;; 15271c576705Slukem *) 15281c576705Slukem eval "$prev=\"\$arg\"" 15291c576705Slukem prev= 15301c576705Slukem continue 15311c576705Slukem ;; 15321c576705Slukem esac 15331c576705Slukem fi # test -n "$prev" 15341c576705Slukem 15351c576705Slukem prevarg="$arg" 15361c576705Slukem 15371c576705Slukem case $arg in 15381c576705Slukem -all-static) 15391c576705Slukem if test -n "$link_static_flag"; then 15401c576705Slukem compile_command="$compile_command $link_static_flag" 15411c576705Slukem finalize_command="$finalize_command $link_static_flag" 15421c576705Slukem fi 15431c576705Slukem continue 15441c576705Slukem ;; 15451c576705Slukem 15461c576705Slukem -allow-undefined) 15471c576705Slukem # FIXME: remove this flag sometime in the future. 1548*6ca3cd61Sagc $ECHO "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 15491c576705Slukem continue 15501c576705Slukem ;; 15511c576705Slukem 15521c576705Slukem -avoid-version) 15531c576705Slukem avoid_version=yes 15541c576705Slukem continue 15551c576705Slukem ;; 15561c576705Slukem 15571c576705Slukem -dlopen) 15581c576705Slukem prev=dlfiles 15591c576705Slukem continue 15601c576705Slukem ;; 15611c576705Slukem 15621c576705Slukem -dlpreopen) 15631c576705Slukem prev=dlprefiles 15641c576705Slukem continue 15651c576705Slukem ;; 15661c576705Slukem 15671c576705Slukem -export-dynamic) 15681c576705Slukem export_dynamic=yes 15691c576705Slukem continue 15701c576705Slukem ;; 15711c576705Slukem 15721c576705Slukem -export-symbols | -export-symbols-regex) 15731c576705Slukem if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1574*6ca3cd61Sagc $ECHO "$modename: more than one -exported-symbols argument is not allowed" 15751c576705Slukem exit $EXIT_FAILURE 15761c576705Slukem fi 15771c576705Slukem if test "X$arg" = "X-export-symbols"; then 15781c576705Slukem prev=expsyms 15791c576705Slukem else 15801c576705Slukem prev=expsyms_regex 15811c576705Slukem fi 15821c576705Slukem continue 15831c576705Slukem ;; 15841c576705Slukem 15851c576705Slukem -framework|-arch|-isysroot) 15861c576705Slukem case " $CC " in 15871c576705Slukem *" ${arg} ${1} "* | *" ${arg} ${1} "*) 15881c576705Slukem prev=darwin_framework_skip ;; 15891c576705Slukem *) compiler_flags="$compiler_flags $arg" 15901c576705Slukem prev=darwin_framework ;; 15911c576705Slukem esac 15921c576705Slukem compile_command="$compile_command $arg" 15931c576705Slukem finalize_command="$finalize_command $arg" 15941c576705Slukem continue 15951c576705Slukem ;; 15961c576705Slukem 15971c576705Slukem -inst-prefix-dir) 15981c576705Slukem prev=inst_prefix 15991c576705Slukem continue 16001c576705Slukem ;; 16011c576705Slukem 16021c576705Slukem # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 16031c576705Slukem # so, if we see these flags be careful not to treat them like -L 16041c576705Slukem -L[A-Z][A-Z]*:*) 16051c576705Slukem case $with_gcc/$host in 16061c576705Slukem no/*-*-irix* | /*-*-irix*) 16071c576705Slukem compile_command="$compile_command $arg" 16081c576705Slukem finalize_command="$finalize_command $arg" 16091c576705Slukem ;; 16101c576705Slukem esac 16111c576705Slukem continue 16121c576705Slukem ;; 16131c576705Slukem 16141c576705Slukem -L*) 1615*6ca3cd61Sagc dir=`$ECHO "X$arg" | $Xsed -e 's/^-L//'` 16161c576705Slukem # We need an absolute path. 16171c576705Slukem case $dir in 16181c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) ;; 16191c576705Slukem *) 16201c576705Slukem absdir=`cd "$dir" && pwd` 16211c576705Slukem if test -z "$absdir"; then 1622*6ca3cd61Sagc $ECHO "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 16231c576705Slukem absdir="$dir" 16241c576705Slukem notinst_path="$notinst_path $dir" 16251c576705Slukem fi 16261c576705Slukem dir="$absdir" 16271c576705Slukem ;; 16281c576705Slukem esac 16291c576705Slukem case "$deplibs " in 16301c576705Slukem *" -L$dir "*) ;; 16311c576705Slukem *) 16321c576705Slukem deplibs="$deplibs -L$dir" 16331c576705Slukem lib_search_path="$lib_search_path $dir" 16341c576705Slukem ;; 16351c576705Slukem esac 16361c576705Slukem case $host in 16371c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1638*6ca3cd61Sagc testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 16391c576705Slukem case :$dllsearchpath: in 16401c576705Slukem *":$dir:"*) ;; 16411c576705Slukem *) dllsearchpath="$dllsearchpath:$dir";; 16421c576705Slukem esac 16431c576705Slukem case :$dllsearchpath: in 16441c576705Slukem *":$testbindir:"*) ;; 16451c576705Slukem *) dllsearchpath="$dllsearchpath:$testbindir";; 16461c576705Slukem esac 16471c576705Slukem ;; 16481c576705Slukem esac 16491c576705Slukem continue 16501c576705Slukem ;; 16511c576705Slukem 16521c576705Slukem -l*) 16531c576705Slukem if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 16541c576705Slukem case $host in 16551c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 16561c576705Slukem # These systems don't actually have a C or math library (as such) 16571c576705Slukem continue 16581c576705Slukem ;; 16591c576705Slukem *-*-os2*) 16601c576705Slukem # These systems don't actually have a C library (as such) 16611c576705Slukem test "X$arg" = "X-lc" && continue 16621c576705Slukem ;; 16631c576705Slukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16641c576705Slukem # Do not include libc due to us having libc/libc_r. 16651c576705Slukem test "X$arg" = "X-lc" && continue 16661c576705Slukem ;; 16671c576705Slukem *-*-rhapsody* | *-*-darwin1.[012]) 16681c576705Slukem # Rhapsody C and math libraries are in the System framework 16691c576705Slukem deplibs="$deplibs -framework System" 16701c576705Slukem continue 16711c576705Slukem ;; 16721c576705Slukem *-*-sco3.2v5* | *-*-sco5v6*) 16731c576705Slukem # Causes problems with __ctype 16741c576705Slukem test "X$arg" = "X-lc" && continue 16751c576705Slukem ;; 16761c576705Slukem *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 16771c576705Slukem # Compiler inserts libc in the correct place for threads to work 16781c576705Slukem test "X$arg" = "X-lc" && continue 16791c576705Slukem ;; 16801c576705Slukem esac 16811c576705Slukem elif test "X$arg" = "X-lc_r"; then 16821c576705Slukem case $host in 16831c576705Slukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16841c576705Slukem # Do not include libc_r directly, use -pthread flag. 16851c576705Slukem continue 16861c576705Slukem ;; 16871c576705Slukem esac 16881c576705Slukem fi 16891c576705Slukem deplibs="$deplibs $arg" 16901c576705Slukem continue 16911c576705Slukem ;; 16921c576705Slukem 16931c576705Slukem # Tru64 UNIX uses -model [arg] to determine the layout of C++ 16941c576705Slukem # classes, name mangling, and exception handling. 16951c576705Slukem -model) 16961c576705Slukem compile_command="$compile_command $arg" 16971c576705Slukem compiler_flags="$compiler_flags $arg" 16981c576705Slukem finalize_command="$finalize_command $arg" 16991c576705Slukem prev=xcompiler 17001c576705Slukem continue 17011c576705Slukem ;; 17021c576705Slukem 17031c576705Slukem -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 17041c576705Slukem compiler_flags="$compiler_flags $arg" 17051c576705Slukem compile_command="$compile_command $arg" 17061c576705Slukem finalize_command="$finalize_command $arg" 17071c576705Slukem case $host:$arg in 17081c576705Slukem *-*-dragonfly*:-pthread) 17091c576705Slukem # pkgsrc hack to use -pthread in .la file for final linking 17101c576705Slukem deplibs="$deplibs $arg" 17111c576705Slukem ;; 17121c576705Slukem esac 17131c576705Slukem continue 17141c576705Slukem ;; 17151c576705Slukem 17161c576705Slukem -multi_module) 17171c576705Slukem single_module="${wl}-multi_module" 17181c576705Slukem continue 17191c576705Slukem ;; 17201c576705Slukem 17211c576705Slukem -module) 17221c576705Slukem module=yes 17231c576705Slukem continue 17241c576705Slukem ;; 17251c576705Slukem 17261c576705Slukem # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 17271c576705Slukem # -r[0-9][0-9]* specifies the processor on the SGI compiler 17281c576705Slukem # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 17291c576705Slukem # +DA*, +DD* enable 64-bit mode on the HP compiler 17301c576705Slukem # -q* pass through compiler args for the IBM compiler 17311c576705Slukem # -m* pass through architecture-specific compiler args for GCC 17321c576705Slukem # -m*, -t[45]*, -txscale* pass through architecture-specific 17331c576705Slukem # compiler args for GCC 17341c576705Slukem # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 17351c576705Slukem # -F/path gives path to uninstalled frameworks, gcc on darwin 17361c576705Slukem # @file GCC response files 17371c576705Slukem -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 17381c576705Slukem -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 17391c576705Slukem 17401c576705Slukem # Unknown arguments in both finalize_command and compile_command need 17411c576705Slukem # to be aesthetically quoted because they are evaled later. 1742*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"` 17431c576705Slukem case $arg in 17441c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 17451c576705Slukem arg="\"$arg\"" 17461c576705Slukem ;; 17471c576705Slukem esac 17481c576705Slukem compile_command="$compile_command $arg" 17491c576705Slukem finalize_command="$finalize_command $arg" 17501c576705Slukem compiler_flags="$compiler_flags $arg" 17511c576705Slukem continue 17521c576705Slukem ;; 17531c576705Slukem 17541c576705Slukem -shrext) 17551c576705Slukem prev=shrext 17561c576705Slukem continue 17571c576705Slukem ;; 17581c576705Slukem 17591c576705Slukem -no-fast-install) 17601c576705Slukem fast_install=no 17611c576705Slukem continue 17621c576705Slukem ;; 17631c576705Slukem 17641c576705Slukem -no-install) 17651c576705Slukem case $host in 17661c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 17671c576705Slukem # The PATH hackery in wrapper scripts is required on Windows 17681c576705Slukem # and Darwin in order for the loader to find any dlls it needs. 1769*6ca3cd61Sagc $ECHO "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1770*6ca3cd61Sagc $ECHO "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 17711c576705Slukem fast_install=no 17721c576705Slukem ;; 17731c576705Slukem *) no_install=yes ;; 17741c576705Slukem esac 17751c576705Slukem continue 17761c576705Slukem ;; 17771c576705Slukem 17781c576705Slukem -no-undefined) 17791c576705Slukem allow_undefined=no 17801c576705Slukem continue 17811c576705Slukem ;; 17821c576705Slukem 17831c576705Slukem -objectlist) 17841c576705Slukem prev=objectlist 17851c576705Slukem continue 17861c576705Slukem ;; 17871c576705Slukem 17881c576705Slukem -o) prev=output ;; 17891c576705Slukem 17901c576705Slukem -precious-files-regex) 17911c576705Slukem prev=precious_regex 17921c576705Slukem continue 17931c576705Slukem ;; 17941c576705Slukem 17951c576705Slukem -release) 17961c576705Slukem prev=release 17971c576705Slukem continue 17981c576705Slukem ;; 17991c576705Slukem 18001c576705Slukem -rpath) 18011c576705Slukem prev=rpath 18021c576705Slukem continue 18031c576705Slukem ;; 18041c576705Slukem 18051c576705Slukem -R) 18061c576705Slukem prev=xrpath 18071c576705Slukem continue 18081c576705Slukem ;; 18091c576705Slukem 18101c576705Slukem -R*) 1811*6ca3cd61Sagc dir=`$ECHO "X$arg" | $Xsed -e 's/^-R//'` 18121c576705Slukem # We need an absolute path. 18131c576705Slukem case $dir in 18141c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) ;; 18151c576705Slukem *) 1816*6ca3cd61Sagc $ECHO "$modename: only absolute run-paths are allowed" 1>&2 18171c576705Slukem exit $EXIT_FAILURE 18181c576705Slukem ;; 18191c576705Slukem esac 18201c576705Slukem case "$xrpath " in 18211c576705Slukem *" $dir "*) ;; 18221c576705Slukem *) xrpath="$xrpath $dir" ;; 18231c576705Slukem esac 18241c576705Slukem continue 18251c576705Slukem ;; 18261c576705Slukem 18271c576705Slukem -static | -static-libtool-libs) 18281c576705Slukem # The effects of -static are defined in a previous loop. 18291c576705Slukem # We used to do the same as -all-static on platforms that 18301c576705Slukem # didn't have a PIC flag, but the assumption that the effects 18311c576705Slukem # would be equivalent was wrong. It would break on at least 18321c576705Slukem # Digital Unix and AIX. 18331c576705Slukem continue 18341c576705Slukem ;; 18351c576705Slukem 18361c576705Slukem -thread-safe) 18371c576705Slukem thread_safe=yes 18381c576705Slukem continue 18391c576705Slukem ;; 18401c576705Slukem 18411c576705Slukem -version-info) 18421c576705Slukem prev=vinfo 18431c576705Slukem continue 18441c576705Slukem ;; 18451c576705Slukem -version-number) 18461c576705Slukem prev=vinfo 18471c576705Slukem vinfo_number=yes 18481c576705Slukem continue 18491c576705Slukem ;; 18501c576705Slukem 18511c576705Slukem -Wc,*) 1852*6ca3cd61Sagc args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 18531c576705Slukem arg= 18541c576705Slukem save_ifs="$IFS"; IFS=',' 18551c576705Slukem for flag in $args; do 18561c576705Slukem IFS="$save_ifs" 18571c576705Slukem case $flag in 18581c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18591c576705Slukem flag="\"$flag\"" 18601c576705Slukem ;; 18611c576705Slukem esac 18621c576705Slukem arg="$arg $wl$flag" 18631c576705Slukem compiler_flags="$compiler_flags $flag" 18641c576705Slukem done 18651c576705Slukem IFS="$save_ifs" 1866*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "s/^ //"` 18671c576705Slukem ;; 18681c576705Slukem 18691c576705Slukem -Wl,*) 1870*6ca3cd61Sagc args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 18711c576705Slukem arg= 18721c576705Slukem save_ifs="$IFS"; IFS=',' 18731c576705Slukem for flag in $args; do 18741c576705Slukem IFS="$save_ifs" 18751c576705Slukem case $flag in 18761c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18771c576705Slukem flag="\"$flag\"" 18781c576705Slukem ;; 18791c576705Slukem esac 18801c576705Slukem arg="$arg $wl$flag" 18811c576705Slukem compiler_flags="$compiler_flags $wl$flag" 18821c576705Slukem linker_flags="$linker_flags $flag" 18831c576705Slukem done 18841c576705Slukem IFS="$save_ifs" 1885*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "s/^ //"` 18861c576705Slukem ;; 18871c576705Slukem 18881c576705Slukem -Xcompiler) 18891c576705Slukem prev=xcompiler 18901c576705Slukem continue 18911c576705Slukem ;; 18921c576705Slukem 18931c576705Slukem -Xlinker) 18941c576705Slukem prev=xlinker 18951c576705Slukem continue 18961c576705Slukem ;; 18971c576705Slukem 18981c576705Slukem -XCClinker) 18991c576705Slukem prev=xcclinker 19001c576705Slukem continue 19011c576705Slukem ;; 19021c576705Slukem 19031c576705Slukem # Some other compiler flag. 19041c576705Slukem -* | +*) 19051c576705Slukem # Unknown arguments in both finalize_command and compile_command need 19061c576705Slukem # to be aesthetically quoted because they are evaled later. 1907*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"` 19081c576705Slukem case $arg in 19091c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19101c576705Slukem arg="\"$arg\"" 19111c576705Slukem ;; 19121c576705Slukem esac 19131c576705Slukem ;; 19141c576705Slukem 19151c576705Slukem *.$objext) 19161c576705Slukem # A standard object. 19171c576705Slukem objs="$objs $arg" 19181c576705Slukem ;; 19191c576705Slukem 19201c576705Slukem *.lo) 19211c576705Slukem # A libtool-controlled object. 19221c576705Slukem 19231c576705Slukem # Check to see that this really is a libtool object. 19241c576705Slukem if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 19251c576705Slukem pic_object= 19261c576705Slukem non_pic_object= 19271c576705Slukem 19281c576705Slukem # Read the .lo file 19291c576705Slukem # If there is no directory component, then add one. 19301c576705Slukem case $arg in 19311c576705Slukem */* | *\\*) . $arg ;; 19321c576705Slukem *) . ./$arg ;; 19331c576705Slukem esac 19341c576705Slukem 19351c576705Slukem if test -z "$pic_object" || \ 19361c576705Slukem test -z "$non_pic_object" || 19371c576705Slukem test "$pic_object" = none && \ 19381c576705Slukem test "$non_pic_object" = none; then 1939*6ca3cd61Sagc $ECHO "$modename: cannot find name of object for \`$arg'" 1>&2 19401c576705Slukem exit $EXIT_FAILURE 19411c576705Slukem fi 19421c576705Slukem 19431c576705Slukem # Extract subdirectory from the argument. 1944*6ca3cd61Sagc xdir=`$ECHO "X$arg" | $Xsed -e 's%/[^/]*$%%'` 19451c576705Slukem if test "X$xdir" = "X$arg"; then 19461c576705Slukem xdir= 19471c576705Slukem else 19481c576705Slukem xdir="$xdir/" 19491c576705Slukem fi 19501c576705Slukem 19511c576705Slukem if test "$pic_object" != none; then 19521c576705Slukem # Prepend the subdirectory the object is found in. 19531c576705Slukem pic_object="$xdir$pic_object" 19541c576705Slukem 19551c576705Slukem if test "$prev" = dlfiles; then 19561c576705Slukem if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 19571c576705Slukem dlfiles="$dlfiles $pic_object" 19581c576705Slukem prev= 19591c576705Slukem continue 19601c576705Slukem else 19611c576705Slukem # If libtool objects are unsupported, then we need to preload. 19621c576705Slukem prev=dlprefiles 19631c576705Slukem fi 19641c576705Slukem fi 19651c576705Slukem 19661c576705Slukem # CHECK ME: I think I busted this. -Ossama 19671c576705Slukem if test "$prev" = dlprefiles; then 19681c576705Slukem # Preload the old-style object. 19691c576705Slukem dlprefiles="$dlprefiles $pic_object" 19701c576705Slukem prev= 19711c576705Slukem fi 19721c576705Slukem 19731c576705Slukem # A PIC object. 19741c576705Slukem libobjs="$libobjs $pic_object" 19751c576705Slukem arg="$pic_object" 19761c576705Slukem fi 19771c576705Slukem 19781c576705Slukem # Non-PIC object. 19791c576705Slukem if test "$non_pic_object" != none; then 19801c576705Slukem # Prepend the subdirectory the object is found in. 19811c576705Slukem non_pic_object="$xdir$non_pic_object" 19821c576705Slukem 19831c576705Slukem # A standard non-PIC object 19841c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 19851c576705Slukem if test -z "$pic_object" || test "$pic_object" = none ; then 19861c576705Slukem arg="$non_pic_object" 19871c576705Slukem fi 19881c576705Slukem else 19891c576705Slukem # If the PIC object exists, use it instead. 19901c576705Slukem # $xdir was prepended to $pic_object above. 19911c576705Slukem non_pic_object="$pic_object" 19921c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 19931c576705Slukem fi 19941c576705Slukem else 19951c576705Slukem # Only an error if not doing a dry-run. 19961c576705Slukem if test -z "$run"; then 1997*6ca3cd61Sagc $ECHO "$modename: \`$arg' is not a valid libtool object" 1>&2 19981c576705Slukem exit $EXIT_FAILURE 19991c576705Slukem else 20001c576705Slukem # Dry-run case. 20011c576705Slukem 20021c576705Slukem # Extract subdirectory from the argument. 2003*6ca3cd61Sagc xdir=`$ECHO "X$arg" | $Xsed -e 's%/[^/]*$%%'` 20041c576705Slukem if test "X$xdir" = "X$arg"; then 20051c576705Slukem xdir= 20061c576705Slukem else 20071c576705Slukem xdir="$xdir/" 20081c576705Slukem fi 20091c576705Slukem 2010*6ca3cd61Sagc pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 2011*6ca3cd61Sagc non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"` 20121c576705Slukem libobjs="$libobjs $pic_object" 20131c576705Slukem non_pic_objects="$non_pic_objects $non_pic_object" 20141c576705Slukem fi 20151c576705Slukem fi 20161c576705Slukem ;; 20171c576705Slukem 20181c576705Slukem *.$libext) 20191c576705Slukem # An archive. 20201c576705Slukem deplibs="$deplibs $arg" 20211c576705Slukem old_deplibs="$old_deplibs $arg" 20221c576705Slukem continue 20231c576705Slukem ;; 20241c576705Slukem 20251c576705Slukem *.la) 20261c576705Slukem # A libtool-controlled library. 20271c576705Slukem 20281c576705Slukem if test "$prev" = dlfiles; then 20291c576705Slukem # This library was specified with -dlopen. 20301c576705Slukem dlfiles="$dlfiles $arg" 20311c576705Slukem prev= 20321c576705Slukem elif test "$prev" = dlprefiles; then 20331c576705Slukem # The library was specified with -dlpreopen. 20341c576705Slukem dlprefiles="$dlprefiles $arg" 20351c576705Slukem prev= 20361c576705Slukem else 20371c576705Slukem deplibs="$deplibs $arg" 20381c576705Slukem fi 20391c576705Slukem continue 20401c576705Slukem ;; 20411c576705Slukem 20421c576705Slukem # Some other compiler argument. 20431c576705Slukem *) 20441c576705Slukem # Unknown arguments in both finalize_command and compile_command need 20451c576705Slukem # to be aesthetically quoted because they are evaled later. 2046*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"` 20471c576705Slukem case $arg in 20481c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 20491c576705Slukem arg="\"$arg\"" 20501c576705Slukem ;; 20511c576705Slukem esac 20521c576705Slukem ;; 20531c576705Slukem esac # arg 20541c576705Slukem 20551c576705Slukem # Now actually substitute the argument into the commands. 20561c576705Slukem if test -n "$arg"; then 20571c576705Slukem compile_command="$compile_command $arg" 20581c576705Slukem finalize_command="$finalize_command $arg" 20591c576705Slukem fi 20601c576705Slukem done # argument parsing loop 20611c576705Slukem 20621c576705Slukem if test -n "$prev"; then 2063*6ca3cd61Sagc $ECHO "$modename: the \`$prevarg' option requires an argument" 1>&2 2064*6ca3cd61Sagc $ECHO "$help" 1>&2 20651c576705Slukem exit $EXIT_FAILURE 20661c576705Slukem fi 20671c576705Slukem 20681c576705Slukem if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 20691c576705Slukem eval arg=\"$export_dynamic_flag_spec\" 20701c576705Slukem compile_command="$compile_command $arg" 20711c576705Slukem finalize_command="$finalize_command $arg" 20721c576705Slukem fi 20731c576705Slukem 20741c576705Slukem oldlibs= 20751c576705Slukem # calculate the name of the file, without its directory 2076*6ca3cd61Sagc outputname=`$ECHO "X$output" | $Xsed -e 's%^.*/%%'` 20771c576705Slukem libobjs_save="$libobjs" 20781c576705Slukem 20791c576705Slukem if test -n "$shlibpath_var"; then 20801c576705Slukem # get the directories listed in $shlibpath_var 2081*6ca3cd61Sagc eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 20821c576705Slukem else 20831c576705Slukem shlib_search_path= 20841c576705Slukem fi 20851c576705Slukem eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 20861c576705Slukem eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 20871c576705Slukem 2088*6ca3cd61Sagc output_objdir=`$ECHO "X$output" | $Xsed -e 's%/[^/]*$%%'` 20891c576705Slukem if test "X$output_objdir" = "X$output"; then 20901c576705Slukem output_objdir="$objdir" 20911c576705Slukem else 20921c576705Slukem output_objdir="$output_objdir/$objdir" 20931c576705Slukem fi 20941c576705Slukem # Create the object directory. 20951c576705Slukem if test ! -d "$output_objdir"; then 20961c576705Slukem $show "$mkdir $output_objdir" 20971c576705Slukem $run $mkdir $output_objdir 20981c576705Slukem exit_status=$? 20991c576705Slukem if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 21001c576705Slukem exit $exit_status 21011c576705Slukem fi 21021c576705Slukem fi 21031c576705Slukem 21041c576705Slukem # Determine the type of output 21051c576705Slukem case $output in 21061c576705Slukem "") 2107*6ca3cd61Sagc $ECHO "$modename: you must specify an output file" 1>&2 2108*6ca3cd61Sagc $ECHO "$help" 1>&2 21091c576705Slukem exit $EXIT_FAILURE 21101c576705Slukem ;; 21111c576705Slukem *.$libext) linkmode=oldlib ;; 21121c576705Slukem *.lo | *.$objext) linkmode=obj ;; 21131c576705Slukem *.la) linkmode=lib ;; 21141c576705Slukem *) linkmode=prog ;; # Anything else should be a program. 21151c576705Slukem esac 21161c576705Slukem 21171c576705Slukem case $host in 21181c576705Slukem *cygwin* | *mingw* | *pw32*) 21191c576705Slukem # don't eliminate duplications in $postdeps and $predeps 21201c576705Slukem duplicate_compiler_generated_deps=yes 21211c576705Slukem ;; 21221c576705Slukem *) 21231c576705Slukem duplicate_compiler_generated_deps=$duplicate_deps 21241c576705Slukem ;; 21251c576705Slukem esac 21261c576705Slukem specialdeplibs= 21271c576705Slukem 21281c576705Slukem libs= 21291c576705Slukem # Find all interdependent deplibs by searching for libraries 21301c576705Slukem # that are linked more than once (e.g. -la -lb -la) 21311c576705Slukem for deplib in $deplibs; do 21321c576705Slukem if test "X$duplicate_deps" = "Xyes" ; then 21331c576705Slukem case "$libs " in 21341c576705Slukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 21351c576705Slukem esac 21361c576705Slukem fi 21371c576705Slukem libs="$libs $deplib" 21381c576705Slukem done 21391c576705Slukem 21401c576705Slukem if test "$linkmode" = lib; then 21411c576705Slukem libs="$predeps $libs $compiler_lib_search_path $postdeps" 21421c576705Slukem 21431c576705Slukem # Compute libraries that are listed more than once in $predeps 21441c576705Slukem # $postdeps and mark them as special (i.e., whose duplicates are 21451c576705Slukem # not to be eliminated). 21461c576705Slukem pre_post_deps= 21471c576705Slukem if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 21481c576705Slukem for pre_post_dep in $predeps $postdeps; do 21491c576705Slukem case "$pre_post_deps " in 21501c576705Slukem *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 21511c576705Slukem esac 21521c576705Slukem pre_post_deps="$pre_post_deps $pre_post_dep" 21531c576705Slukem done 21541c576705Slukem fi 21551c576705Slukem pre_post_deps= 21561c576705Slukem fi 21571c576705Slukem 21581c576705Slukem deplibs= 21591c576705Slukem newdependency_libs= 21601c576705Slukem newlib_search_path= 21611c576705Slukem need_relink=no # whether we're linking any uninstalled libtool libraries 21621c576705Slukem notinst_deplibs= # not-installed libtool libraries 21631c576705Slukem case $linkmode in 21641c576705Slukem lib) 21651c576705Slukem passes="conv link" 21661c576705Slukem for file in $dlfiles $dlprefiles; do 21671c576705Slukem case $file in 21681c576705Slukem *.la) ;; 21691c576705Slukem *) 2170*6ca3cd61Sagc $ECHO "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 21711c576705Slukem exit $EXIT_FAILURE 21721c576705Slukem ;; 21731c576705Slukem esac 21741c576705Slukem done 21751c576705Slukem ;; 21761c576705Slukem prog) 21771c576705Slukem compile_deplibs= 21781c576705Slukem finalize_deplibs= 21791c576705Slukem alldeplibs=no 21801c576705Slukem newdlfiles= 21811c576705Slukem newdlprefiles= 21821c576705Slukem passes="conv scan dlopen dlpreopen link" 21831c576705Slukem ;; 21841c576705Slukem *) passes="conv" 21851c576705Slukem ;; 21861c576705Slukem esac 21871c576705Slukem for pass in $passes; do 21881c576705Slukem if test "$linkmode,$pass" = "lib,link" || 21891c576705Slukem test "$linkmode,$pass" = "prog,scan"; then 21901c576705Slukem libs="$deplibs" 21911c576705Slukem deplibs= 21921c576705Slukem fi 21931c576705Slukem if test "$linkmode" = prog; then 21941c576705Slukem case $pass in 21951c576705Slukem dlopen) libs="$dlfiles" ;; 21961c576705Slukem dlpreopen) libs="$dlprefiles" ;; 21971c576705Slukem link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 21981c576705Slukem esac 21991c576705Slukem fi 22001c576705Slukem if test "$pass" = dlopen; then 22011c576705Slukem # Collect dlpreopened libraries 22021c576705Slukem save_deplibs="$deplibs" 22031c576705Slukem deplibs= 22041c576705Slukem fi 22051c576705Slukem for deplib in $libs; do 22061c576705Slukem lib= 22071c576705Slukem found=no 22081c576705Slukem case $deplib in 22091c576705Slukem -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 22101c576705Slukem if test "$linkmode,$pass" = "prog,link"; then 22111c576705Slukem compile_deplibs="$deplib $compile_deplibs" 22121c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 22131c576705Slukem else 22141c576705Slukem compiler_flags="$compiler_flags $deplib" 22151c576705Slukem fi 22161c576705Slukem case $host:$deplib in 22171c576705Slukem *-*-dragonfly*:-pthread) 22181c576705Slukem # pkgsrc hack to use -pthread in .la file for final linking 22191c576705Slukem case $linkmode in 22201c576705Slukem lib) 22211c576705Slukem deplibs="$deplib $deplibs" 22221c576705Slukem test "$pass" = conv && continue 22231c576705Slukem newdependency_libs="$deplib $newdependency_libs" 22241c576705Slukem ;; 22251c576705Slukem prog) 22261c576705Slukem if test "$pass" = conv; then 22271c576705Slukem deplibs="$deplib $deplibs" 22281c576705Slukem continue 22291c576705Slukem fi 22301c576705Slukem if test "$pass" = scan; then 22311c576705Slukem deplibs="$deplib $deplibs" 22321c576705Slukem else 22331c576705Slukem compile_deplibs="$deplib $compile_deplibs" 22341c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 22351c576705Slukem fi 22361c576705Slukem ;; 22371c576705Slukem esac 22381c576705Slukem ;; 22391c576705Slukem esac 22401c576705Slukem continue 22411c576705Slukem ;; 22421c576705Slukem -l*) 22431c576705Slukem if test "$linkmode" != lib && test "$linkmode" != prog; then 2244*6ca3cd61Sagc $ECHO "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 22451c576705Slukem continue 22461c576705Slukem fi 2247*6ca3cd61Sagc name=`$ECHO "X$deplib" | $Xsed -e 's/^-l//'` 22481c576705Slukem if test "$linkmode" = lib; then 22491c576705Slukem searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 22501c576705Slukem else 22511c576705Slukem searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 22521c576705Slukem fi 22531c576705Slukem for searchdir in $searchdirs; do 22541c576705Slukem for search_ext in .la $std_shrext .so .a; do 22551c576705Slukem # Search the libtool library 22561c576705Slukem lib="$searchdir/lib${name}${search_ext}" 22571c576705Slukem if test -f "$lib"; then 22581c576705Slukem if test "$search_ext" = ".la"; then 22591c576705Slukem found=yes 22601c576705Slukem else 22611c576705Slukem found=no 22621c576705Slukem fi 22631c576705Slukem break 2 22641c576705Slukem fi 22651c576705Slukem done 22661c576705Slukem done 22671c576705Slukem if test "$found" != yes; then 22681c576705Slukem # deplib doesn't seem to be a libtool library 22691c576705Slukem if test "$linkmode,$pass" = "prog,link"; then 22701c576705Slukem compile_deplibs="$deplib $compile_deplibs" 22711c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 22721c576705Slukem else 22731c576705Slukem deplibs="$deplib $deplibs" 22741c576705Slukem test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 22751c576705Slukem fi 22761c576705Slukem continue 22771c576705Slukem else # deplib is a libtool library 22781c576705Slukem # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 22791c576705Slukem # We need to do some special things here, and not later. 22801c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 22811c576705Slukem case " $predeps $postdeps " in 22821c576705Slukem *" $deplib "*) 22831c576705Slukem if (${SED} -e '2q' $lib | 22841c576705Slukem grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 22851c576705Slukem library_names= 22861c576705Slukem old_library= 22871c576705Slukem case $lib in 22881c576705Slukem */* | *\\*) . $lib ;; 22891c576705Slukem *) . ./$lib ;; 22901c576705Slukem esac 22911c576705Slukem for l in $old_library $library_names; do 22921c576705Slukem ll="$l" 22931c576705Slukem done 22941c576705Slukem if test "X$ll" = "X$old_library" ; then # only static version available 22951c576705Slukem found=no 2296*6ca3cd61Sagc ladir=`$ECHO "X$lib" | $Xsed -e 's%/[^/]*$%%'` 22971c576705Slukem test "X$ladir" = "X$lib" && ladir="." 22981c576705Slukem lib=$ladir/$old_library 22991c576705Slukem if test "$linkmode,$pass" = "prog,link"; then 23001c576705Slukem compile_deplibs="$deplib $compile_deplibs" 23011c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 23021c576705Slukem else 23031c576705Slukem deplibs="$deplib $deplibs" 23041c576705Slukem test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 23051c576705Slukem fi 23061c576705Slukem continue 23071c576705Slukem fi 23081c576705Slukem fi 23091c576705Slukem ;; 23101c576705Slukem *) ;; 23111c576705Slukem esac 23121c576705Slukem fi 23131c576705Slukem fi 23141c576705Slukem ;; # -l 23151c576705Slukem -L*) 23161c576705Slukem case $linkmode in 23171c576705Slukem lib) 23181c576705Slukem deplibs="$deplib $deplibs" 23191c576705Slukem test "$pass" = conv && continue 23201c576705Slukem newdependency_libs="$deplib $newdependency_libs" 2321*6ca3cd61Sagc newlib_search_path="$newlib_search_path "`$ECHO "X$deplib" | $Xsed -e 's/^-L//'` 23221c576705Slukem ;; 23231c576705Slukem prog) 23241c576705Slukem if test "$pass" = conv; then 23251c576705Slukem deplibs="$deplib $deplibs" 23261c576705Slukem continue 23271c576705Slukem fi 23281c576705Slukem if test "$pass" = scan; then 23291c576705Slukem deplibs="$deplib $deplibs" 23301c576705Slukem else 23311c576705Slukem compile_deplibs="$deplib $compile_deplibs" 23321c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 23331c576705Slukem fi 2334*6ca3cd61Sagc newlib_search_path="$newlib_search_path "`$ECHO "X$deplib" | $Xsed -e 's/^-L//'` 23351c576705Slukem ;; 23361c576705Slukem *) 2337*6ca3cd61Sagc $ECHO "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 23381c576705Slukem ;; 23391c576705Slukem esac # linkmode 23401c576705Slukem continue 23411c576705Slukem ;; # -L 23421c576705Slukem -R*) 23431c576705Slukem if test "$pass" = link; then 2344*6ca3cd61Sagc dir=`$ECHO "X$deplib" | $Xsed -e 's/^-R//'` 23451c576705Slukem # Make sure the xrpath contains only unique directories. 23461c576705Slukem case "$xrpath " in 23471c576705Slukem *" $dir "*) ;; 23481c576705Slukem *) xrpath="$xrpath $dir" ;; 23491c576705Slukem esac 23501c576705Slukem fi 23511c576705Slukem deplibs="$deplib $deplibs" 23521c576705Slukem continue 23531c576705Slukem ;; 23541c576705Slukem *.la) lib="$deplib" ;; 23551c576705Slukem *.$libext) 23561c576705Slukem if test "$pass" = conv; then 23571c576705Slukem deplibs="$deplib $deplibs" 23581c576705Slukem continue 23591c576705Slukem fi 23601c576705Slukem case $linkmode in 23611c576705Slukem lib) 23621c576705Slukem valid_a_lib=no 23631c576705Slukem case $deplibs_check_method in 23641c576705Slukem match_pattern*) 23651c576705Slukem set dummy $deplibs_check_method 23661c576705Slukem match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2367*6ca3cd61Sagc if eval $ECHO \"$deplib\" 2>/dev/null \ 23681c576705Slukem | $SED 10q \ 23691c576705Slukem | $EGREP "$match_pattern_regex" > /dev/null; then 23701c576705Slukem valid_a_lib=yes 23711c576705Slukem fi 23721c576705Slukem ;; 23731c576705Slukem pass_all) 23741c576705Slukem valid_a_lib=yes 23751c576705Slukem ;; 23761c576705Slukem esac 23771c576705Slukem if test "$valid_a_lib" != yes; then 2378*6ca3cd61Sagc $ECHO 2379*6ca3cd61Sagc $ECHO "*** Warning: Trying to link with static lib archive $deplib." 2380*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 2381*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 2382*6ca3cd61Sagc $ECHO "*** shared version of the library, which you do not appear to have" 2383*6ca3cd61Sagc $ECHO "*** because the file extensions .$libext of this argument makes me believe" 2384*6ca3cd61Sagc $ECHO "*** that it is just a static archive that I should not used here." 23851c576705Slukem else 2386*6ca3cd61Sagc $ECHO 2387*6ca3cd61Sagc $ECHO "*** Warning: Linking the shared library $output against the" 2388*6ca3cd61Sagc $ECHO "*** static library $deplib is not portable!" 23891c576705Slukem deplibs="$deplib $deplibs" 23901c576705Slukem fi 23911c576705Slukem continue 23921c576705Slukem ;; 23931c576705Slukem prog) 23941c576705Slukem if test "$pass" != link; then 23951c576705Slukem deplibs="$deplib $deplibs" 23961c576705Slukem else 23971c576705Slukem compile_deplibs="$deplib $compile_deplibs" 23981c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 23991c576705Slukem fi 24001c576705Slukem continue 24011c576705Slukem ;; 24021c576705Slukem esac # linkmode 24031c576705Slukem ;; # *.$libext 24041c576705Slukem *.lo | *.$objext) 24051c576705Slukem if test "$pass" = conv; then 24061c576705Slukem deplibs="$deplib $deplibs" 24071c576705Slukem elif test "$linkmode" = prog; then 24081c576705Slukem if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 24091c576705Slukem # If there is no dlopen support or we're linking statically, 24101c576705Slukem # we need to preload. 24111c576705Slukem newdlprefiles="$newdlprefiles $deplib" 24121c576705Slukem compile_deplibs="$deplib $compile_deplibs" 24131c576705Slukem finalize_deplibs="$deplib $finalize_deplibs" 24141c576705Slukem else 24151c576705Slukem newdlfiles="$newdlfiles $deplib" 24161c576705Slukem fi 24171c576705Slukem fi 24181c576705Slukem continue 24191c576705Slukem ;; 24201c576705Slukem %DEPLIBS%) 24211c576705Slukem alldeplibs=yes 24221c576705Slukem continue 24231c576705Slukem ;; 24241c576705Slukem esac # case $deplib 24251c576705Slukem if test "$found" = yes || test -f "$lib"; then : 24261c576705Slukem else 2427*6ca3cd61Sagc $ECHO "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 24281c576705Slukem exit $EXIT_FAILURE 24291c576705Slukem fi 24301c576705Slukem 24311c576705Slukem # Check to see that this really is a libtool archive. 24321c576705Slukem if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 24331c576705Slukem else 2434*6ca3cd61Sagc $ECHO "$modename: \`$lib' is not a valid libtool archive" 1>&2 24351c576705Slukem exit $EXIT_FAILURE 24361c576705Slukem fi 24371c576705Slukem 2438*6ca3cd61Sagc ladir=`$ECHO "X$lib" | $Xsed -e 's%/[^/]*$%%'` 24391c576705Slukem test "X$ladir" = "X$lib" && ladir="." 24401c576705Slukem 24411c576705Slukem dlname= 24421c576705Slukem dlopen= 24431c576705Slukem dlpreopen= 24441c576705Slukem libdir= 24451c576705Slukem library_names= 24461c576705Slukem old_library= 24471c576705Slukem # If the library was installed with an old release of libtool, 24481c576705Slukem # it will not redefine variables installed, or shouldnotlink 24491c576705Slukem installed=yes 24501c576705Slukem shouldnotlink=no 24511c576705Slukem avoidtemprpath= 24521c576705Slukem 24531c576705Slukem 24541c576705Slukem # Read the .la file 24551c576705Slukem case $lib in 24561c576705Slukem */* | *\\*) . $lib ;; 24571c576705Slukem *) . ./$lib ;; 24581c576705Slukem esac 24591c576705Slukem 24601c576705Slukem if test "$linkmode,$pass" = "lib,link" || 24611c576705Slukem test "$linkmode,$pass" = "prog,scan" || 24621c576705Slukem { test "$linkmode" != prog && test "$linkmode" != lib; }; then 24631c576705Slukem test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 24641c576705Slukem test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 24651c576705Slukem fi 24661c576705Slukem 24671c576705Slukem if test "$pass" = conv; then 24681c576705Slukem # Only check for convenience libraries 24691c576705Slukem deplibs="$lib $deplibs" 24701c576705Slukem if test -z "$libdir"; then 24711c576705Slukem if test -z "$old_library"; then 2472*6ca3cd61Sagc $ECHO "$modename: cannot find name of link library for \`$lib'" 1>&2 24731c576705Slukem exit $EXIT_FAILURE 24741c576705Slukem fi 24751c576705Slukem # It is a libtool convenience library, so add in its objects. 24761c576705Slukem convenience="$convenience $ladir/$objdir/$old_library" 24771c576705Slukem old_convenience="$old_convenience $ladir/$objdir/$old_library" 24781c576705Slukem tmp_libs= 24791c576705Slukem for deplib in $dependency_libs; do 24801c576705Slukem deplibs="$deplib $deplibs" 24811c576705Slukem if test "X$duplicate_deps" = "Xyes" ; then 24821c576705Slukem case "$tmp_libs " in 24831c576705Slukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 24841c576705Slukem esac 24851c576705Slukem fi 24861c576705Slukem tmp_libs="$tmp_libs $deplib" 24871c576705Slukem done 24881c576705Slukem elif test "$linkmode" != prog && test "$linkmode" != lib; then 2489*6ca3cd61Sagc $ECHO "$modename: \`$lib' is not a convenience library" 1>&2 24901c576705Slukem exit $EXIT_FAILURE 24911c576705Slukem fi 24921c576705Slukem continue 24931c576705Slukem fi # $pass = conv 24941c576705Slukem 24951c576705Slukem 24961c576705Slukem # Get the name of the library we link against. 24971c576705Slukem linklib= 24981c576705Slukem for l in $old_library $library_names; do 24991c576705Slukem linklib="$l" 25001c576705Slukem done 25011c576705Slukem if test -z "$linklib"; then 2502*6ca3cd61Sagc $ECHO "$modename: cannot find name of link library for \`$lib'" 1>&2 25031c576705Slukem exit $EXIT_FAILURE 25041c576705Slukem fi 25051c576705Slukem 25061c576705Slukem # This library was specified with -dlopen. 25071c576705Slukem if test "$pass" = dlopen; then 25081c576705Slukem if test -z "$libdir"; then 2509*6ca3cd61Sagc $ECHO "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 25101c576705Slukem exit $EXIT_FAILURE 25111c576705Slukem fi 25121c576705Slukem if test -z "$dlname" || 25131c576705Slukem test "$dlopen_support" != yes || 25141c576705Slukem test "$build_libtool_libs" = no; then 25151c576705Slukem # If there is no dlname, no dlopen support or we're linking 25161c576705Slukem # statically, we need to preload. We also need to preload any 25171c576705Slukem # dependent libraries so libltdl's deplib preloader doesn't 25181c576705Slukem # bomb out in the load deplibs phase. 25191c576705Slukem dlprefiles="$dlprefiles $lib $dependency_libs" 25201c576705Slukem else 25211c576705Slukem newdlfiles="$newdlfiles $lib" 25221c576705Slukem fi 25231c576705Slukem continue 25241c576705Slukem fi # $pass = dlopen 25251c576705Slukem 25261c576705Slukem # We need an absolute path. 25271c576705Slukem case $ladir in 25281c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 25291c576705Slukem *) 25301c576705Slukem abs_ladir=`cd "$ladir" && pwd` 25311c576705Slukem if test -z "$abs_ladir"; then 2532*6ca3cd61Sagc $ECHO "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2533*6ca3cd61Sagc $ECHO "$modename: passing it literally to the linker, although it might fail" 1>&2 25341c576705Slukem abs_ladir="$ladir" 25351c576705Slukem fi 25361c576705Slukem ;; 25371c576705Slukem esac 2538*6ca3cd61Sagc laname=`$ECHO "X$lib" | $Xsed -e 's%^.*/%%'` 25391c576705Slukem 25401c576705Slukem # Find the relevant object directory and library name. 25411c576705Slukem if test "X$installed" = Xyes; then 25421c576705Slukem if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2543*6ca3cd61Sagc $ECHO "$modename: warning: library \`$lib' was moved." 1>&2 25441c576705Slukem dir="$ladir" 25451c576705Slukem absdir="$abs_ladir" 25461c576705Slukem libdir="$abs_ladir" 25471c576705Slukem else 25481c576705Slukem dir="$libdir" 25491c576705Slukem absdir="$libdir" 25501c576705Slukem fi 25511c576705Slukem test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 25521c576705Slukem else 25531c576705Slukem if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 25541c576705Slukem dir="$ladir" 25551c576705Slukem absdir="$abs_ladir" 25561c576705Slukem # Remove this search path later 25571c576705Slukem notinst_path="$notinst_path $abs_ladir" 25581c576705Slukem else 25591c576705Slukem dir="$ladir/$objdir" 25601c576705Slukem absdir="$abs_ladir/$objdir" 25611c576705Slukem # Remove this search path later 25621c576705Slukem notinst_path="$notinst_path $abs_ladir" 25631c576705Slukem fi 25641c576705Slukem fi # $installed = yes 2565*6ca3cd61Sagc name=`$ECHO "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 25661c576705Slukem 25671c576705Slukem # This library was specified with -dlpreopen. 25681c576705Slukem if test "$pass" = dlpreopen; then 25691c576705Slukem if test -z "$libdir"; then 2570*6ca3cd61Sagc $ECHO "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 25711c576705Slukem exit $EXIT_FAILURE 25721c576705Slukem fi 25731c576705Slukem # Prefer using a static library (so that no silly _DYNAMIC symbols 25741c576705Slukem # are required to link). 25751c576705Slukem if test -n "$old_library"; then 25761c576705Slukem newdlprefiles="$newdlprefiles $dir/$old_library" 25771c576705Slukem # Otherwise, use the dlname, so that lt_dlopen finds it. 25781c576705Slukem elif test -n "$dlname"; then 25791c576705Slukem newdlprefiles="$newdlprefiles $dir/$dlname" 25801c576705Slukem else 25811c576705Slukem newdlprefiles="$newdlprefiles $dir/$linklib" 25821c576705Slukem fi 25831c576705Slukem fi # $pass = dlpreopen 25841c576705Slukem 25851c576705Slukem if test -z "$libdir"; then 25861c576705Slukem # Link the convenience library 25871c576705Slukem if test "$linkmode" = lib; then 25881c576705Slukem deplibs="$dir/$old_library $deplibs" 25891c576705Slukem elif test "$linkmode,$pass" = "prog,link"; then 25901c576705Slukem compile_deplibs="$dir/$old_library $compile_deplibs" 25911c576705Slukem finalize_deplibs="$dir/$old_library $finalize_deplibs" 25921c576705Slukem else 25931c576705Slukem deplibs="$lib $deplibs" # used for prog,scan pass 25941c576705Slukem fi 25951c576705Slukem continue 25961c576705Slukem fi 25971c576705Slukem 25981c576705Slukem 25991c576705Slukem if test "$linkmode" = prog && test "$pass" != link; then 26001c576705Slukem newlib_search_path="$newlib_search_path $ladir" 26011c576705Slukem deplibs="$lib $deplibs" 26021c576705Slukem 26031c576705Slukem linkalldeplibs=no 26041c576705Slukem if test "$link_all_deplibs" != no || test -z "$library_names" || 26051c576705Slukem test "$build_libtool_libs" = no; then 26061c576705Slukem linkalldeplibs=yes 26071c576705Slukem fi 26081c576705Slukem 26091c576705Slukem tmp_libs= 26101c576705Slukem for deplib in $dependency_libs; do 26111c576705Slukem case $deplib in 2612*6ca3cd61Sagc -L*) newlib_search_path="$newlib_search_path "`$ECHO "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 26131c576705Slukem esac 26141c576705Slukem # Need to link against all dependency_libs? 26151c576705Slukem if test "$linkalldeplibs" = yes; then 26161c576705Slukem deplibs="$deplib $deplibs" 26171c576705Slukem else 26181c576705Slukem # Need to hardcode shared library paths 26191c576705Slukem # or/and link against static libraries 26201c576705Slukem newdependency_libs="$deplib $newdependency_libs" 26211c576705Slukem fi 26221c576705Slukem if test "X$duplicate_deps" = "Xyes" ; then 26231c576705Slukem case "$tmp_libs " in 26241c576705Slukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 26251c576705Slukem esac 26261c576705Slukem fi 26271c576705Slukem tmp_libs="$tmp_libs $deplib" 26281c576705Slukem done # for deplib 26291c576705Slukem continue 26301c576705Slukem fi # $linkmode = prog... 26311c576705Slukem 26321c576705Slukem if test "$linkmode,$pass" = "prog,link"; then 26331c576705Slukem if test -n "$library_names" && 26341c576705Slukem { { test "$prefer_static_libs" = no || 26351c576705Slukem test "$prefer_static_libs,$installed" = "built,yes"; } || 26361c576705Slukem test -z "$old_library"; }; then 26371c576705Slukem # We need to hardcode the library path 26381c576705Slukem if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 26391c576705Slukem # Make sure the rpath contains only unique directories. 26401c576705Slukem case "$temp_rpath " in 26411c576705Slukem *" $dir "*) ;; 26421c576705Slukem *" $absdir "*) ;; 26431c576705Slukem *) temp_rpath="$temp_rpath $absdir" ;; 26441c576705Slukem esac 26451c576705Slukem fi 26461c576705Slukem 26471c576705Slukem # Hardcode the library path. 26481c576705Slukem # Skip directories that are in the system default run-time 26491c576705Slukem # search path. 26501c576705Slukem case " $sys_lib_dlsearch_path " in 26511c576705Slukem *" $absdir "*) ;; 26521c576705Slukem *) 26531c576705Slukem case "$compile_rpath " in 26541c576705Slukem *" $absdir "*) ;; 26551c576705Slukem *) compile_rpath="$compile_rpath $absdir" 26561c576705Slukem esac 26571c576705Slukem ;; 26581c576705Slukem esac 26591c576705Slukem case " $sys_lib_dlsearch_path " in 26601c576705Slukem *" $libdir "*) ;; 26611c576705Slukem *) 26621c576705Slukem case "$finalize_rpath " in 26631c576705Slukem *" $libdir "*) ;; 26641c576705Slukem *) finalize_rpath="$finalize_rpath $libdir" 26651c576705Slukem esac 26661c576705Slukem ;; 26671c576705Slukem esac 26681c576705Slukem fi # $linkmode,$pass = prog,link... 26691c576705Slukem 26701c576705Slukem if test "$alldeplibs" = yes && 26711c576705Slukem { test "$deplibs_check_method" = pass_all || 26721c576705Slukem { test "$build_libtool_libs" = yes && 26731c576705Slukem test -n "$library_names"; }; }; then 26741c576705Slukem # We only need to search for static libraries 26751c576705Slukem continue 26761c576705Slukem fi 26771c576705Slukem fi 26781c576705Slukem 26791c576705Slukem link_static=no # Whether the deplib will be linked statically 26801c576705Slukem use_static_libs=$prefer_static_libs 26811c576705Slukem if test "$use_static_libs" = built && test "$installed" = yes ; then 26821c576705Slukem use_static_libs=no 26831c576705Slukem fi 26841c576705Slukem if test -n "$library_names" && 26851c576705Slukem { test "$use_static_libs" = no || test -z "$old_library"; }; then 26861c576705Slukem if test "$installed" = no; then 26871c576705Slukem notinst_deplibs="$notinst_deplibs $lib" 26881c576705Slukem need_relink=yes 26891c576705Slukem fi 26901c576705Slukem # This is a shared library 26911c576705Slukem 26921c576705Slukem # Warn about portability, can't link against -module's on 26931c576705Slukem # some systems (darwin) 26941c576705Slukem if test "$shouldnotlink" = yes && test "$pass" = link ; then 2695*6ca3cd61Sagc $ECHO 26961c576705Slukem if test "$linkmode" = prog; then 2697*6ca3cd61Sagc $ECHO "*** Warning: Linking the executable $output against the loadable module" 26981c576705Slukem else 2699*6ca3cd61Sagc $ECHO "*** Warning: Linking the shared library $output against the loadable module" 27001c576705Slukem fi 2701*6ca3cd61Sagc $ECHO "*** $linklib is not portable!" 27021c576705Slukem fi 27031c576705Slukem if test "$linkmode" = lib && 27041c576705Slukem test "$hardcode_into_libs" = yes; then 27051c576705Slukem # Hardcode the library path. 27061c576705Slukem # Skip directories that are in the system default run-time 27071c576705Slukem # search path. 27081c576705Slukem case " $sys_lib_dlsearch_path " in 27091c576705Slukem *" $absdir "*) ;; 27101c576705Slukem *) 27111c576705Slukem case "$compile_rpath " in 27121c576705Slukem *" $absdir "*) ;; 27131c576705Slukem *) compile_rpath="$compile_rpath $absdir" 27141c576705Slukem esac 27151c576705Slukem ;; 27161c576705Slukem esac 27171c576705Slukem case " $sys_lib_dlsearch_path " in 27181c576705Slukem *" $libdir "*) ;; 27191c576705Slukem *) 27201c576705Slukem case "$finalize_rpath " in 27211c576705Slukem *" $libdir "*) ;; 27221c576705Slukem *) finalize_rpath="$finalize_rpath $libdir" 27231c576705Slukem esac 27241c576705Slukem ;; 27251c576705Slukem esac 27261c576705Slukem fi 27271c576705Slukem 27281c576705Slukem if test -n "$old_archive_from_expsyms_cmds"; then 27291c576705Slukem # figure out the soname 27301c576705Slukem set dummy $library_names 27311c576705Slukem realname="$2" 27321c576705Slukem shift; shift 2733*6ca3cd61Sagc libname=`eval \\$ECHO \"$libname_spec\"` 27341c576705Slukem # use dlname if we got it. it's perfectly good, no? 27351c576705Slukem if test -n "$dlname"; then 27361c576705Slukem soname="$dlname" 27371c576705Slukem elif test -n "$soname_spec"; then 27381c576705Slukem # bleh windows 27391c576705Slukem case $host in 27401c576705Slukem *cygwin* | mingw*) 27411c576705Slukem major=`expr $current - $age` 27421c576705Slukem versuffix="-$major" 27431c576705Slukem ;; 27441c576705Slukem esac 27451c576705Slukem eval soname=\"$soname_spec\" 27461c576705Slukem else 27471c576705Slukem soname="$realname" 27481c576705Slukem fi 27491c576705Slukem 27501c576705Slukem # Make a new name for the extract_expsyms_cmds to use 27511c576705Slukem soroot="$soname" 2752*6ca3cd61Sagc soname=`$ECHO $soroot | ${SED} -e 's/^.*\///'` 2753*6ca3cd61Sagc newlib="libimp-`$ECHO $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 27541c576705Slukem 27551c576705Slukem # If the library has no export list, then create one now 27561c576705Slukem if test -f "$output_objdir/$soname-def"; then : 27571c576705Slukem else 27581c576705Slukem $show "extracting exported symbol list from \`$soname'" 27591c576705Slukem save_ifs="$IFS"; IFS='~' 27601c576705Slukem cmds=$extract_expsyms_cmds 27611c576705Slukem for cmd in $cmds; do 27621c576705Slukem IFS="$save_ifs" 27631c576705Slukem eval cmd=\"$cmd\" 27641c576705Slukem $show "$cmd" 27651c576705Slukem $run eval "$cmd" || exit $? 27661c576705Slukem done 27671c576705Slukem IFS="$save_ifs" 27681c576705Slukem fi 27691c576705Slukem 27701c576705Slukem # Create $newlib 27711c576705Slukem if test -f "$output_objdir/$newlib"; then :; else 27721c576705Slukem $show "generating import library for \`$soname'" 27731c576705Slukem save_ifs="$IFS"; IFS='~' 27741c576705Slukem cmds=$old_archive_from_expsyms_cmds 27751c576705Slukem for cmd in $cmds; do 27761c576705Slukem IFS="$save_ifs" 27771c576705Slukem eval cmd=\"$cmd\" 27781c576705Slukem $show "$cmd" 27791c576705Slukem $run eval "$cmd" || exit $? 27801c576705Slukem done 27811c576705Slukem IFS="$save_ifs" 27821c576705Slukem fi 27831c576705Slukem # make sure the library variables are pointing to the new library 27841c576705Slukem dir=$output_objdir 27851c576705Slukem linklib=$newlib 27861c576705Slukem fi # test -n "$old_archive_from_expsyms_cmds" 27871c576705Slukem 27881c576705Slukem if test "$linkmode" = prog || test "$mode" != relink; then 27891c576705Slukem add_shlibpath= 27901c576705Slukem add_dir= 27911c576705Slukem add= 27921c576705Slukem lib_linked=yes 27931c576705Slukem case $hardcode_action in 27941c576705Slukem immediate | unsupported) 27951c576705Slukem if test "$hardcode_direct" = no; then 27961c576705Slukem add="$dir/$linklib" 27971c576705Slukem case $host in 27981c576705Slukem *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 27991c576705Slukem *-*-sysv4*uw2*) add_dir="-L$dir" ;; 28001c576705Slukem *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 28011c576705Slukem *-*-unixware7*) add_dir="-L$dir" ;; 28021c576705Slukem *-*-darwin* ) 28031c576705Slukem # if the lib is a module then we can not link against 28041c576705Slukem # it, someone is ignoring the new warnings I added 28051c576705Slukem if /usr/bin/file -L $add 2> /dev/null | 28061c576705Slukem $EGREP ": [^:]* bundle" >/dev/null ; then 2807*6ca3cd61Sagc $ECHO "** Warning, lib $linklib is a module, not a shared library" 28081c576705Slukem if test -z "$old_library" ; then 2809*6ca3cd61Sagc $ECHO 2810*6ca3cd61Sagc $ECHO "** And there doesn't seem to be a static archive available" 2811*6ca3cd61Sagc $ECHO "** The link will probably fail, sorry" 28121c576705Slukem else 28131c576705Slukem add="$dir/$old_library" 28141c576705Slukem fi 28151c576705Slukem fi 28161c576705Slukem esac 28171c576705Slukem elif test "$hardcode_minus_L" = no; then 28181c576705Slukem case $host in 28191c576705Slukem *-*-sunos*) add_shlibpath="$dir" ;; 28201c576705Slukem esac 28211c576705Slukem add_dir="-L$dir" 28221c576705Slukem add="-l$name" 28231c576705Slukem elif test "$hardcode_shlibpath_var" = no; then 28241c576705Slukem add_shlibpath="$dir" 28251c576705Slukem add="-l$name" 28261c576705Slukem else 28271c576705Slukem lib_linked=no 28281c576705Slukem fi 28291c576705Slukem ;; 28301c576705Slukem relink) 28311c576705Slukem if test "$hardcode_direct" = yes; then 28321c576705Slukem add="$dir/$linklib" 28331c576705Slukem elif test "$hardcode_minus_L" = yes; then 28341c576705Slukem add_dir="-L$dir" 28351c576705Slukem # Try looking first in the location we're being installed to. 28361c576705Slukem if test -n "$inst_prefix_dir"; then 28371c576705Slukem case $libdir in 28381c576705Slukem [\\/]*) 28391c576705Slukem add_dir="$add_dir -L$inst_prefix_dir$libdir" 28401c576705Slukem ;; 28411c576705Slukem esac 28421c576705Slukem fi 28431c576705Slukem add="-l$name" 28441c576705Slukem elif test "$hardcode_shlibpath_var" = yes; then 28451c576705Slukem add_shlibpath="$dir" 28461c576705Slukem add="-l$name" 28471c576705Slukem else 28481c576705Slukem lib_linked=no 28491c576705Slukem fi 28501c576705Slukem ;; 28511c576705Slukem *) lib_linked=no ;; 28521c576705Slukem esac 28531c576705Slukem 28541c576705Slukem if test "$lib_linked" != yes; then 2855*6ca3cd61Sagc $ECHO "$modename: configuration error: unsupported hardcode properties" 28561c576705Slukem exit $EXIT_FAILURE 28571c576705Slukem fi 28581c576705Slukem 28591c576705Slukem if test -n "$add_shlibpath"; then 28601c576705Slukem case :$compile_shlibpath: in 28611c576705Slukem *":$add_shlibpath:"*) ;; 28621c576705Slukem *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 28631c576705Slukem esac 28641c576705Slukem fi 28651c576705Slukem if test "$linkmode" = prog; then 28661c576705Slukem test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 28671c576705Slukem test -n "$add" && compile_deplibs="$add $compile_deplibs" 28681c576705Slukem else 28691c576705Slukem test -n "$add_dir" && deplibs="$add_dir $deplibs" 28701c576705Slukem test -n "$add" && deplibs="$add $deplibs" 28711c576705Slukem if test "$hardcode_direct" != yes && \ 28721c576705Slukem test "$hardcode_minus_L" != yes && \ 28731c576705Slukem test "$hardcode_shlibpath_var" = yes; then 28741c576705Slukem case :$finalize_shlibpath: in 28751c576705Slukem *":$libdir:"*) ;; 28761c576705Slukem *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 28771c576705Slukem esac 28781c576705Slukem fi 28791c576705Slukem fi 28801c576705Slukem fi 28811c576705Slukem 28821c576705Slukem if test "$linkmode" = prog || test "$mode" = relink; then 28831c576705Slukem add_shlibpath= 28841c576705Slukem add_dir= 28851c576705Slukem add= 28861c576705Slukem # Finalize command for both is simple: just hardcode it. 28871c576705Slukem if test "$hardcode_direct" = yes; then 28881c576705Slukem add="$libdir/$linklib" 28891c576705Slukem elif test "$hardcode_minus_L" = yes; then 28901c576705Slukem add_dir="-L$libdir" 28911c576705Slukem add="-l$name" 28921c576705Slukem elif test "$hardcode_shlibpath_var" = yes; then 28931c576705Slukem case :$finalize_shlibpath: in 28941c576705Slukem *":$libdir:"*) ;; 28951c576705Slukem *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 28961c576705Slukem esac 28971c576705Slukem add="-l$name" 28981c576705Slukem elif test "$hardcode_automatic" = yes; then 28991c576705Slukem if test -n "$inst_prefix_dir" && 29001c576705Slukem test -f "$inst_prefix_dir$libdir/$linklib" ; then 29011c576705Slukem add="$inst_prefix_dir$libdir/$linklib" 29021c576705Slukem else 29031c576705Slukem add="$libdir/$linklib" 29041c576705Slukem fi 29051c576705Slukem else 29061c576705Slukem # We cannot seem to hardcode it, guess we'll fake it. 29071c576705Slukem add_dir="-L$libdir" 29081c576705Slukem # Try looking first in the location we're being installed to. 29091c576705Slukem if test -n "$inst_prefix_dir"; then 29101c576705Slukem case $libdir in 29111c576705Slukem [\\/]*) 29121c576705Slukem add_dir="$add_dir -L$inst_prefix_dir$libdir" 29131c576705Slukem ;; 29141c576705Slukem esac 29151c576705Slukem fi 29161c576705Slukem add="-l$name" 29171c576705Slukem fi 29181c576705Slukem 29191c576705Slukem if test "$linkmode" = prog; then 29201c576705Slukem test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 29211c576705Slukem test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 29221c576705Slukem else 29231c576705Slukem test -n "$add_dir" && deplibs="$add_dir $deplibs" 29241c576705Slukem test -n "$add" && deplibs="$add $deplibs" 29251c576705Slukem fi 29261c576705Slukem fi 29271c576705Slukem elif test "$linkmode" = prog; then 29281c576705Slukem # Here we assume that one of hardcode_direct or hardcode_minus_L 29291c576705Slukem # is not unsupported. This is valid on all known static and 29301c576705Slukem # shared platforms. 29311c576705Slukem if test "$hardcode_direct" != unsupported; then 29321c576705Slukem test -n "$old_library" && linklib="$old_library" 29331c576705Slukem compile_deplibs="$dir/$linklib $compile_deplibs" 29341c576705Slukem finalize_deplibs="$dir/$linklib $finalize_deplibs" 29351c576705Slukem else 29361c576705Slukem compile_deplibs="-l$name -L$dir $compile_deplibs" 29371c576705Slukem finalize_deplibs="-l$name -L$dir $finalize_deplibs" 29381c576705Slukem fi 29391c576705Slukem elif test "$build_libtool_libs" = yes; then 29401c576705Slukem # Not a shared library 29411c576705Slukem if test "$deplibs_check_method" != pass_all; then 29421c576705Slukem # We're trying link a shared library against a static one 29431c576705Slukem # but the system doesn't support it. 29441c576705Slukem 29451c576705Slukem # Just print a warning and add the library to dependency_libs so 29461c576705Slukem # that the program can be linked against the static library. 2947*6ca3cd61Sagc $ECHO 2948*6ca3cd61Sagc $ECHO "*** Warning: This system can not link to static lib archive $lib." 2949*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 2950*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 2951*6ca3cd61Sagc $ECHO "*** shared version of the library, which you do not appear to have." 29521c576705Slukem if test "$module" = yes; then 2953*6ca3cd61Sagc $ECHO "*** But as you try to build a module library, libtool will still create " 2954*6ca3cd61Sagc $ECHO "*** a static module, that should work as long as the dlopening application" 2955*6ca3cd61Sagc $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 29561c576705Slukem if test -z "$global_symbol_pipe"; then 2957*6ca3cd61Sagc $ECHO 2958*6ca3cd61Sagc $ECHO "*** However, this would only work if libtool was able to extract symbol" 2959*6ca3cd61Sagc $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 2960*6ca3cd61Sagc $ECHO "*** not find such a program. So, this module is probably useless." 2961*6ca3cd61Sagc $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 29621c576705Slukem fi 29631c576705Slukem if test "$build_old_libs" = no; then 29641c576705Slukem build_libtool_libs=module 29651c576705Slukem build_old_libs=yes 29661c576705Slukem else 29671c576705Slukem build_libtool_libs=no 29681c576705Slukem fi 29691c576705Slukem fi 29701c576705Slukem else 29711c576705Slukem deplibs="$dir/$old_library $deplibs" 29721c576705Slukem link_static=yes 29731c576705Slukem fi 29741c576705Slukem fi # link shared/static library? 29751c576705Slukem 29761c576705Slukem if test "$linkmode" = lib; then 29771c576705Slukem if test -n "$dependency_libs" && 29781c576705Slukem { test "$hardcode_into_libs" != yes || 29791c576705Slukem test "$build_old_libs" = yes || 29801c576705Slukem test "$link_static" = yes; }; then 29811c576705Slukem # Extract -R from dependency_libs 29821c576705Slukem temp_deplibs= 29831c576705Slukem for libdir in $dependency_libs; do 29841c576705Slukem case $libdir in 2985*6ca3cd61Sagc -R*) temp_xrpath=`$ECHO "X$libdir" | $Xsed -e 's/^-R//'` 29861c576705Slukem case " $xrpath " in 29871c576705Slukem *" $temp_xrpath "*) ;; 29881c576705Slukem *) xrpath="$xrpath $temp_xrpath";; 29891c576705Slukem esac;; 29901c576705Slukem *) temp_deplibs="$temp_deplibs $libdir";; 29911c576705Slukem esac 29921c576705Slukem done 29931c576705Slukem dependency_libs="$temp_deplibs" 29941c576705Slukem fi 29951c576705Slukem 29961c576705Slukem newlib_search_path="$newlib_search_path $absdir" 29971c576705Slukem # Link against this library 29981c576705Slukem test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 29991c576705Slukem # ... and its dependency_libs 30001c576705Slukem tmp_libs= 30011c576705Slukem for deplib in $dependency_libs; do 30021c576705Slukem newdependency_libs="$deplib $newdependency_libs" 30031c576705Slukem if test "X$duplicate_deps" = "Xyes" ; then 30041c576705Slukem case "$tmp_libs " in 30051c576705Slukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 30061c576705Slukem esac 30071c576705Slukem fi 30081c576705Slukem tmp_libs="$tmp_libs $deplib" 30091c576705Slukem done 30101c576705Slukem 30111c576705Slukem if test "$link_all_deplibs" != no; then 30121c576705Slukem # Add the search paths of all dependency libraries 30131c576705Slukem for deplib in $dependency_libs; do 30141c576705Slukem case $deplib in 30151c576705Slukem -L*) path="$deplib" ;; 30161c576705Slukem *.la) 3017*6ca3cd61Sagc dir=`$ECHO "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 30181c576705Slukem test "X$dir" = "X$deplib" && dir="." 30191c576705Slukem # We need an absolute path. 30201c576705Slukem case $dir in 30211c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 30221c576705Slukem *) 30231c576705Slukem absdir=`cd "$dir" && pwd` 30241c576705Slukem if test -z "$absdir"; then 3025*6ca3cd61Sagc $ECHO "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 30261c576705Slukem absdir="$dir" 30271c576705Slukem fi 30281c576705Slukem ;; 30291c576705Slukem esac 30301c576705Slukem if grep "^installed=no" $deplib > /dev/null; then 30311c576705Slukem path="$absdir/$objdir" 30321c576705Slukem else 30331c576705Slukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 30341c576705Slukem if test -z "$libdir"; then 3035*6ca3cd61Sagc $ECHO "$modename: \`$deplib' is not a valid libtool archive" 1>&2 30361c576705Slukem exit $EXIT_FAILURE 30371c576705Slukem fi 30381c576705Slukem if test "$absdir" != "$libdir"; then 3039*6ca3cd61Sagc $ECHO "$modename: warning: \`$deplib' seems to be moved" 1>&2 30401c576705Slukem fi 30411c576705Slukem path="$absdir" 30421c576705Slukem fi 30431c576705Slukem depdepl= 30441c576705Slukem case $host in 30451c576705Slukem *-*-darwin*) 30461c576705Slukem # we do not want to link against static libs, 30471c576705Slukem # but need to link against shared 30481c576705Slukem eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 30491c576705Slukem eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 30501c576705Slukem if test -n "$deplibrary_names" ; then 30511c576705Slukem for tmp in $deplibrary_names ; do 30521c576705Slukem depdepl=$tmp 30531c576705Slukem done 30541c576705Slukem if test -f "$deplibdir/$depdepl" ; then 30551c576705Slukem depdepl="$deplibdir/$depdepl" 30561c576705Slukem elif test -f "$path/$depdepl" ; then 30571c576705Slukem depdepl="$path/$depdepl" 30581c576705Slukem else 30591c576705Slukem # Can't find it, oh well... 30601c576705Slukem depdepl= 30611c576705Slukem fi 30621c576705Slukem # do not add paths which are already there 30631c576705Slukem case " $newlib_search_path " in 30641c576705Slukem *" $path "*) ;; 30651c576705Slukem *) newlib_search_path="$newlib_search_path $path";; 30661c576705Slukem esac 30671c576705Slukem fi 30681c576705Slukem path="" 30691c576705Slukem ;; 30701c576705Slukem *) 30711c576705Slukem path="-L$path" 30721c576705Slukem ;; 30731c576705Slukem esac 30741c576705Slukem ;; 30751c576705Slukem -l*) 30761c576705Slukem case $host in 30771c576705Slukem *-*-darwin*) 30781c576705Slukem # Again, we only want to link against shared libraries 3079*6ca3cd61Sagc eval tmp_libs=`$ECHO "X$deplib" | $Xsed -e "s,^\-l,,"` 30801c576705Slukem for tmp in $newlib_search_path ; do 30811c576705Slukem if test -f "$tmp/lib$tmp_libs.dylib" ; then 30821c576705Slukem eval depdepl="$tmp/lib$tmp_libs.dylib" 30831c576705Slukem break 30841c576705Slukem fi 30851c576705Slukem done 30861c576705Slukem path="" 30871c576705Slukem ;; 30881c576705Slukem *) continue ;; 30891c576705Slukem esac 30901c576705Slukem ;; 30911c576705Slukem *) continue ;; 30921c576705Slukem esac 30931c576705Slukem case " $deplibs " in 30941c576705Slukem *" $path "*) ;; 30951c576705Slukem *) deplibs="$path $deplibs" ;; 30961c576705Slukem esac 30971c576705Slukem case " $deplibs " in 30981c576705Slukem *" $depdepl "*) ;; 30991c576705Slukem *) deplibs="$depdepl $deplibs" ;; 31001c576705Slukem esac 31011c576705Slukem done 31021c576705Slukem fi # link_all_deplibs != no 31031c576705Slukem fi # linkmode = lib 31041c576705Slukem done # for deplib in $libs 31051c576705Slukem dependency_libs="$newdependency_libs" 31061c576705Slukem if test "$pass" = dlpreopen; then 31071c576705Slukem # Link the dlpreopened libraries before other libraries 31081c576705Slukem for deplib in $save_deplibs; do 31091c576705Slukem deplibs="$deplib $deplibs" 31101c576705Slukem done 31111c576705Slukem fi 31121c576705Slukem if test "$pass" != dlopen; then 31131c576705Slukem if test "$pass" != conv; then 31141c576705Slukem # Make sure lib_search_path contains only unique directories. 31151c576705Slukem lib_search_path= 31161c576705Slukem for dir in $newlib_search_path; do 31171c576705Slukem case "$lib_search_path " in 31181c576705Slukem *" $dir "*) ;; 31191c576705Slukem *) lib_search_path="$lib_search_path $dir" ;; 31201c576705Slukem esac 31211c576705Slukem done 31221c576705Slukem newlib_search_path= 31231c576705Slukem fi 31241c576705Slukem 31251c576705Slukem if test "$linkmode,$pass" != "prog,link"; then 31261c576705Slukem vars="deplibs" 31271c576705Slukem else 31281c576705Slukem vars="compile_deplibs finalize_deplibs" 31291c576705Slukem fi 31301c576705Slukem for var in $vars dependency_libs; do 31311c576705Slukem # Add libraries to $var in reverse order 31321c576705Slukem eval tmp_libs=\"\$$var\" 31331c576705Slukem new_libs= 31341c576705Slukem for deplib in $tmp_libs; do 31351c576705Slukem # FIXME: Pedantically, this is the right thing to do, so 31361c576705Slukem # that some nasty dependency loop isn't accidentally 31371c576705Slukem # broken: 31381c576705Slukem #new_libs="$deplib $new_libs" 31391c576705Slukem # Pragmatically, this seems to cause very few problems in 31401c576705Slukem # practice: 31411c576705Slukem case $deplib in 31421c576705Slukem -L*) new_libs="$deplib $new_libs" ;; 31431c576705Slukem -R*) ;; 31441c576705Slukem *) 31451c576705Slukem # And here is the reason: when a library appears more 31461c576705Slukem # than once as an explicit dependence of a library, or 31471c576705Slukem # is implicitly linked in more than once by the 31481c576705Slukem # compiler, it is considered special, and multiple 31491c576705Slukem # occurrences thereof are not removed. Compare this 31501c576705Slukem # with having the same library being listed as a 31511c576705Slukem # dependency of multiple other libraries: in this case, 31521c576705Slukem # we know (pedantically, we assume) the library does not 31531c576705Slukem # need to be listed more than once, so we keep only the 31541c576705Slukem # last copy. This is not always right, but it is rare 31551c576705Slukem # enough that we require users that really mean to play 31561c576705Slukem # such unportable linking tricks to link the library 31571c576705Slukem # using -Wl,-lname, so that libtool does not consider it 31581c576705Slukem # for duplicate removal. 31591c576705Slukem case " $specialdeplibs " in 31601c576705Slukem *" $deplib "*) new_libs="$deplib $new_libs" ;; 31611c576705Slukem *) 31621c576705Slukem case " $new_libs " in 31631c576705Slukem *" $deplib "*) ;; 31641c576705Slukem *) new_libs="$deplib $new_libs" ;; 31651c576705Slukem esac 31661c576705Slukem ;; 31671c576705Slukem esac 31681c576705Slukem ;; 31691c576705Slukem esac 31701c576705Slukem done 31711c576705Slukem tmp_libs= 31721c576705Slukem for deplib in $new_libs; do 31731c576705Slukem case $deplib in 31741c576705Slukem -L*) 31751c576705Slukem case " $tmp_libs " in 31761c576705Slukem *" $deplib "*) ;; 31771c576705Slukem *) tmp_libs="$tmp_libs $deplib" ;; 31781c576705Slukem esac 31791c576705Slukem ;; 31801c576705Slukem *) tmp_libs="$tmp_libs $deplib" ;; 31811c576705Slukem esac 31821c576705Slukem done 31831c576705Slukem eval $var=\"$tmp_libs\" 31841c576705Slukem done # for var 31851c576705Slukem fi 31861c576705Slukem # Last step: remove runtime libs from dependency_libs 31871c576705Slukem # (they stay in deplibs) 31881c576705Slukem tmp_libs= 31891c576705Slukem for i in $dependency_libs ; do 31901c576705Slukem case " $predeps $postdeps $compiler_lib_search_path " in 31911c576705Slukem *" $i "*) 31921c576705Slukem i="" 31931c576705Slukem ;; 31941c576705Slukem esac 31951c576705Slukem if test -n "$i" ; then 31961c576705Slukem tmp_libs="$tmp_libs $i" 31971c576705Slukem fi 31981c576705Slukem done 31991c576705Slukem dependency_libs=$tmp_libs 32001c576705Slukem done # for pass 32011c576705Slukem if test "$linkmode" = prog; then 32021c576705Slukem dlfiles="$newdlfiles" 32031c576705Slukem dlprefiles="$newdlprefiles" 32041c576705Slukem fi 32051c576705Slukem 32061c576705Slukem case $linkmode in 32071c576705Slukem oldlib) 32081c576705Slukem case " $deplibs" in 32091c576705Slukem *\ -l* | *\ -L*) 3210*6ca3cd61Sagc $ECHO "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 32111c576705Slukem esac 32121c576705Slukem 32131c576705Slukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3214*6ca3cd61Sagc $ECHO "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 32151c576705Slukem fi 32161c576705Slukem 32171c576705Slukem if test -n "$rpath"; then 3218*6ca3cd61Sagc $ECHO "$modename: warning: \`-rpath' is ignored for archives" 1>&2 32191c576705Slukem fi 32201c576705Slukem 32211c576705Slukem if test -n "$xrpath"; then 3222*6ca3cd61Sagc $ECHO "$modename: warning: \`-R' is ignored for archives" 1>&2 32231c576705Slukem fi 32241c576705Slukem 32251c576705Slukem if test -n "$vinfo"; then 3226*6ca3cd61Sagc $ECHO "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 32271c576705Slukem fi 32281c576705Slukem 32291c576705Slukem if test -n "$release"; then 3230*6ca3cd61Sagc $ECHO "$modename: warning: \`-release' is ignored for archives" 1>&2 32311c576705Slukem fi 32321c576705Slukem 32331c576705Slukem if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3234*6ca3cd61Sagc $ECHO "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 32351c576705Slukem fi 32361c576705Slukem 32371c576705Slukem # Now set the variables for building old libraries. 32381c576705Slukem build_libtool_libs=no 32391c576705Slukem oldlibs="$output" 32401c576705Slukem objs="$objs$old_deplibs" 32411c576705Slukem ;; 32421c576705Slukem 32431c576705Slukem lib) 32441c576705Slukem # Make sure we only generate libraries of the form `libNAME.la'. 32451c576705Slukem case $outputname in 32461c576705Slukem lib*) 3247*6ca3cd61Sagc name=`$ECHO "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 32481c576705Slukem eval shared_ext=\"$shrext_cmds\" 32491c576705Slukem eval libname=\"$libname_spec\" 32501c576705Slukem ;; 32511c576705Slukem *) 32521c576705Slukem if test "$module" = no; then 3253*6ca3cd61Sagc $ECHO "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3254*6ca3cd61Sagc $ECHO "$help" 1>&2 32551c576705Slukem exit $EXIT_FAILURE 32561c576705Slukem fi 32571c576705Slukem if test "$need_lib_prefix" != no; then 32581c576705Slukem # Add the "lib" prefix for modules if required 3259*6ca3cd61Sagc name=`$ECHO "X$outputname" | $Xsed -e 's/\.la$//'` 32601c576705Slukem eval shared_ext=\"$shrext_cmds\" 32611c576705Slukem eval libname=\"$libname_spec\" 32621c576705Slukem else 3263*6ca3cd61Sagc libname=`$ECHO "X$outputname" | $Xsed -e 's/\.la$//'` 32641c576705Slukem fi 32651c576705Slukem ;; 32661c576705Slukem esac 32671c576705Slukem 32681c576705Slukem if test -n "$objs"; then 32691c576705Slukem if test "$deplibs_check_method" != pass_all; then 3270*6ca3cd61Sagc $ECHO "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 32711c576705Slukem exit $EXIT_FAILURE 32721c576705Slukem else 3273*6ca3cd61Sagc $ECHO 3274*6ca3cd61Sagc $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 3275*6ca3cd61Sagc $ECHO "*** objects $objs is not portable!" 32761c576705Slukem libobjs="$libobjs $objs" 32771c576705Slukem fi 32781c576705Slukem fi 32791c576705Slukem 32801c576705Slukem if test "$dlself" != no; then 3281*6ca3cd61Sagc $ECHO "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 32821c576705Slukem fi 32831c576705Slukem 32841c576705Slukem set dummy $rpath 32851c576705Slukem if test "$#" -gt 2; then 3286*6ca3cd61Sagc $ECHO "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 32871c576705Slukem fi 32881c576705Slukem install_libdir="$2" 32891c576705Slukem 32901c576705Slukem oldlibs= 32911c576705Slukem if test -z "$rpath"; then 32921c576705Slukem if test "$build_libtool_libs" = yes; then 32931c576705Slukem # Building a libtool convenience library. 32941c576705Slukem # Some compilers have problems with a `.al' extension so 32951c576705Slukem # convenience libraries should have the same extension an 32961c576705Slukem # archive normally would. 32971c576705Slukem oldlibs="$output_objdir/$libname.$libext $oldlibs" 32981c576705Slukem build_libtool_libs=convenience 32991c576705Slukem build_old_libs=yes 33001c576705Slukem fi 33011c576705Slukem 33021c576705Slukem if test -n "$vinfo"; then 3303*6ca3cd61Sagc $ECHO "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 33041c576705Slukem fi 33051c576705Slukem 33061c576705Slukem if test -n "$release"; then 3307*6ca3cd61Sagc $ECHO "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 33081c576705Slukem fi 33091c576705Slukem else 33101c576705Slukem 33111c576705Slukem # Parse the version information argument. 33121c576705Slukem save_ifs="$IFS"; IFS=':' 33131c576705Slukem set dummy $vinfo 0 0 0 33141c576705Slukem IFS="$save_ifs" 33151c576705Slukem 33161c576705Slukem if test -n "$8"; then 3317*6ca3cd61Sagc $ECHO "$modename: too many parameters to \`-version-info'" 1>&2 3318*6ca3cd61Sagc $ECHO "$help" 1>&2 33191c576705Slukem exit $EXIT_FAILURE 33201c576705Slukem fi 33211c576705Slukem 33221c576705Slukem # convert absolute version numbers to libtool ages 33231c576705Slukem # this retains compatibility with .la files and attempts 33241c576705Slukem # to make the code below a bit more comprehensible 33251c576705Slukem 33261c576705Slukem case $vinfo_number in 33271c576705Slukem yes) 33281c576705Slukem number_major="$2" 33291c576705Slukem number_minor="$3" 33301c576705Slukem number_revision="$4" 33311c576705Slukem # 33321c576705Slukem # There are really only two kinds -- those that 33331c576705Slukem # use the current revision as the major version 33341c576705Slukem # and those that subtract age and use age as 33351c576705Slukem # a minor version. But, then there is irix 33361c576705Slukem # which has an extra 1 added just for fun 33371c576705Slukem # 33381c576705Slukem case $version_type in 33391c576705Slukem darwin|linux|osf|windows|none) 33401c576705Slukem current=`expr $number_major + $number_minor` 33411c576705Slukem age="$number_minor" 33421c576705Slukem revision="$number_revision" 33431c576705Slukem ;; 33441c576705Slukem freebsd-aout|freebsd-elf|sunos) 33451c576705Slukem current="$number_major" 33461c576705Slukem revision="$number_minor" 33471c576705Slukem age="0" 33481c576705Slukem ;; 33491c576705Slukem irix|nonstopux) 33501c576705Slukem current=`expr $number_major + $number_minor` 33511c576705Slukem age="$number_minor" 33521c576705Slukem revision="$number_minor" 33531c576705Slukem lt_irix_increment=no 33541c576705Slukem ;; 33551c576705Slukem esac 33561c576705Slukem ;; 33571c576705Slukem no) 33581c576705Slukem current="$2" 33591c576705Slukem revision="$3" 33601c576705Slukem age="$4" 33611c576705Slukem ;; 33621c576705Slukem esac 33631c576705Slukem 33641c576705Slukem # Check that each of the things are valid numbers. 33651c576705Slukem case $current in 33661c576705Slukem 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]) ;; 33671c576705Slukem *) 3368*6ca3cd61Sagc $ECHO "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3369*6ca3cd61Sagc $ECHO "$modename: \`$vinfo' is not valid version information" 1>&2 33701c576705Slukem exit $EXIT_FAILURE 33711c576705Slukem ;; 33721c576705Slukem esac 33731c576705Slukem 33741c576705Slukem case $revision in 33751c576705Slukem 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]) ;; 33761c576705Slukem *) 3377*6ca3cd61Sagc $ECHO "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3378*6ca3cd61Sagc $ECHO "$modename: \`$vinfo' is not valid version information" 1>&2 33791c576705Slukem exit $EXIT_FAILURE 33801c576705Slukem ;; 33811c576705Slukem esac 33821c576705Slukem 33831c576705Slukem case $age in 33841c576705Slukem 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]) ;; 33851c576705Slukem *) 3386*6ca3cd61Sagc $ECHO "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3387*6ca3cd61Sagc $ECHO "$modename: \`$vinfo' is not valid version information" 1>&2 33881c576705Slukem exit $EXIT_FAILURE 33891c576705Slukem ;; 33901c576705Slukem esac 33911c576705Slukem 33921c576705Slukem if test "$age" -gt "$current"; then 3393*6ca3cd61Sagc $ECHO "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3394*6ca3cd61Sagc $ECHO "$modename: \`$vinfo' is not valid version information" 1>&2 33951c576705Slukem exit $EXIT_FAILURE 33961c576705Slukem fi 33971c576705Slukem 33981c576705Slukem # Calculate the version variables. 33991c576705Slukem major= 34001c576705Slukem versuffix= 34011c576705Slukem versuffix2= 34021c576705Slukem verstring= 34031c576705Slukem case $version_type in 34041c576705Slukem none) ;; 34051c576705Slukem 34061c576705Slukem darwin) 34071c576705Slukem # Like Linux, but with the current version available in 34081c576705Slukem # verstring for coding it into the library header 34091c576705Slukem major=.`expr $current - $age` 34101c576705Slukem versuffix="$major.$age.$revision" 34111c576705Slukem # Darwin ld doesn't like 0 for these options... 34121c576705Slukem minor_current=`expr $current + 1` 34131c576705Slukem xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 34141c576705Slukem verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 34151c576705Slukem ;; 34161c576705Slukem 34171c576705Slukem freebsd-aout) 34181c576705Slukem major=".$current" 34191c576705Slukem versuffix=".$current.$revision"; 34201c576705Slukem ;; 34211c576705Slukem 34221c576705Slukem freebsd-elf) 34231c576705Slukem major=".$current" 34241c576705Slukem versuffix=".$current"; 34251c576705Slukem ;; 34261c576705Slukem 34271c576705Slukem irix | nonstopux) 34281c576705Slukem if test "X$lt_irix_increment" = "Xno"; then 34291c576705Slukem major=`expr $current - $age` 34301c576705Slukem else 34311c576705Slukem major=`expr $current - $age + 1` 34321c576705Slukem fi 34331c576705Slukem case $version_type in 34341c576705Slukem nonstopux) verstring_prefix=nonstopux ;; 34351c576705Slukem *) verstring_prefix=sgi ;; 34361c576705Slukem esac 34371c576705Slukem verstring="$verstring_prefix$major.$revision" 34381c576705Slukem 34391c576705Slukem # Add in all the interfaces that we are compatible with. 34401c576705Slukem loop=$revision 34411c576705Slukem while test "$loop" -ne 0; do 34421c576705Slukem iface=`expr $revision - $loop` 34431c576705Slukem loop=`expr $loop - 1` 34441c576705Slukem verstring="$verstring_prefix$major.$iface:$verstring" 34451c576705Slukem done 34461c576705Slukem 34471c576705Slukem # Before this point, $major must not contain `.'. 34481c576705Slukem major=.$major 34491c576705Slukem versuffix="$major.$revision" 34501c576705Slukem ;; 34511c576705Slukem 34521c576705Slukem linux) 34531c576705Slukem major=.`expr $current - $age` 34541c576705Slukem versuffix="$major.$age.$revision" 34551c576705Slukem versuffix2="$major.$age" 34561c576705Slukem ;; 34571c576705Slukem 34581c576705Slukem osf) 34591c576705Slukem major=.`expr $current - $age` 34601c576705Slukem versuffix=".$current.$age.$revision" 34611c576705Slukem verstring="$current.$age.$revision" 34621c576705Slukem 34631c576705Slukem # Add in all the interfaces that we are compatible with. 34641c576705Slukem loop=$age 34651c576705Slukem while test "$loop" -ne 0; do 34661c576705Slukem iface=`expr $current - $loop` 34671c576705Slukem loop=`expr $loop - 1` 34681c576705Slukem verstring="$verstring:${iface}.0" 34691c576705Slukem done 34701c576705Slukem 34711c576705Slukem # Make executables depend on our current version. 34721c576705Slukem verstring="$verstring:${current}.0" 34731c576705Slukem ;; 34741c576705Slukem 34751c576705Slukem sunos) 34761c576705Slukem major=".$current" 34771c576705Slukem versuffix=".$current.$revision" 34781c576705Slukem ;; 34791c576705Slukem 34801c576705Slukem windows) 34811c576705Slukem # Use '-' rather than '.', since we only want one 34821c576705Slukem # extension on DOS 8.3 filesystems. 34831c576705Slukem major=`expr $current - $age` 34841c576705Slukem versuffix="-$major" 34851c576705Slukem ;; 34861c576705Slukem 34871c576705Slukem *) 3488*6ca3cd61Sagc $ECHO "$modename: unknown library version type \`$version_type'" 1>&2 3489*6ca3cd61Sagc $ECHO "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 34901c576705Slukem exit $EXIT_FAILURE 34911c576705Slukem ;; 34921c576705Slukem esac 34931c576705Slukem 34941c576705Slukem # Clear the version info if we defaulted, and they specified a release. 34951c576705Slukem if test -z "$vinfo" && test -n "$release"; then 34961c576705Slukem major= 34971c576705Slukem case $version_type in 34981c576705Slukem darwin) 34991c576705Slukem # we can't check for "0.0" in archive_cmds due to quoting 35001c576705Slukem # problems, so we reset it completely 35011c576705Slukem verstring= 35021c576705Slukem ;; 35031c576705Slukem *) 35041c576705Slukem verstring="0.0" 35051c576705Slukem ;; 35061c576705Slukem esac 35071c576705Slukem if test "$need_version" = no; then 35081c576705Slukem versuffix= 35091c576705Slukem else 35101c576705Slukem versuffix=".0.0" 35111c576705Slukem fi 35121c576705Slukem fi 35131c576705Slukem 35141c576705Slukem # Remove version info from name if versioning should be avoided 35151c576705Slukem if test "$avoid_version" = yes && test "$need_version" = no; then 35161c576705Slukem major= 35171c576705Slukem versuffix= 35181c576705Slukem versuffix2= 35191c576705Slukem verstring="" 35201c576705Slukem fi 35211c576705Slukem 35221c576705Slukem # Check to see if the archive will have undefined symbols. 35231c576705Slukem if test "$allow_undefined" = yes; then 35241c576705Slukem if test "$allow_undefined_flag" = unsupported; then 3525*6ca3cd61Sagc $ECHO "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 35261c576705Slukem build_libtool_libs=no 35271c576705Slukem build_old_libs=yes 35281c576705Slukem fi 35291c576705Slukem else 35301c576705Slukem # Don't allow undefined symbols. 35311c576705Slukem allow_undefined_flag="$no_undefined_flag" 35321c576705Slukem fi 35331c576705Slukem fi 35341c576705Slukem 35351c576705Slukem if test "$mode" != relink; then 35361c576705Slukem # Remove our outputs, but don't remove object files since they 35371c576705Slukem # may have been created when compiling PIC objects. 35381c576705Slukem removelist= 3539*6ca3cd61Sagc tempremovelist=`$ECHO "$output_objdir/*"` 35401c576705Slukem for p in $tempremovelist; do 35411c576705Slukem case $p in 35421c576705Slukem *.$objext) 35431c576705Slukem ;; 35441c576705Slukem $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 35451c576705Slukem if test "X$precious_files_regex" != "X"; then 35461c576705Slukem if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 35471c576705Slukem then 35481c576705Slukem continue 35491c576705Slukem fi 35501c576705Slukem fi 35511c576705Slukem removelist="$removelist $p" 35521c576705Slukem ;; 35531c576705Slukem *) ;; 35541c576705Slukem esac 35551c576705Slukem done 35561c576705Slukem if test -n "$removelist"; then 35571c576705Slukem $show "${rm}r $removelist" 35581c576705Slukem $run ${rm}r $removelist 35591c576705Slukem fi 35601c576705Slukem fi 35611c576705Slukem 35621c576705Slukem # Now set the variables for building old libraries. 35631c576705Slukem if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 35641c576705Slukem oldlibs="$oldlibs $output_objdir/$libname.$libext" 35651c576705Slukem 35661c576705Slukem # Transform .lo files to .o files. 3567*6ca3cd61Sagc oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 35681c576705Slukem fi 35691c576705Slukem 35701c576705Slukem # Eliminate all temporary directories. 35711c576705Slukem #for path in $notinst_path; do 3572*6ca3cd61Sagc # lib_search_path=`$ECHO "$lib_search_path " | ${SED} -e "s% $path % %g"` 3573*6ca3cd61Sagc # deplibs=`$ECHO "$deplibs " | ${SED} -e "s% -L$path % %g"` 3574*6ca3cd61Sagc # dependency_libs=`$ECHO "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 35751c576705Slukem #done 35761c576705Slukem 35771c576705Slukem if test -n "$xrpath"; then 35781c576705Slukem # If the user specified any rpath flags, then add them. 35791c576705Slukem temp_xrpath= 35801c576705Slukem for libdir in $xrpath; do 35811c576705Slukem temp_xrpath="$temp_xrpath -R$libdir" 35821c576705Slukem case "$finalize_rpath " in 35831c576705Slukem *" $libdir "*) ;; 35841c576705Slukem *) finalize_rpath="$finalize_rpath $libdir" ;; 35851c576705Slukem esac 35861c576705Slukem done 35871c576705Slukem if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 35881c576705Slukem dependency_libs="$temp_xrpath $dependency_libs" 35891c576705Slukem fi 35901c576705Slukem fi 35911c576705Slukem 35921c576705Slukem # Make sure dlfiles contains only unique files that won't be dlpreopened 35931c576705Slukem old_dlfiles="$dlfiles" 35941c576705Slukem dlfiles= 35951c576705Slukem for lib in $old_dlfiles; do 35961c576705Slukem case " $dlprefiles $dlfiles " in 35971c576705Slukem *" $lib "*) ;; 35981c576705Slukem *) dlfiles="$dlfiles $lib" ;; 35991c576705Slukem esac 36001c576705Slukem done 36011c576705Slukem 36021c576705Slukem # Make sure dlprefiles contains only unique files 36031c576705Slukem old_dlprefiles="$dlprefiles" 36041c576705Slukem dlprefiles= 36051c576705Slukem for lib in $old_dlprefiles; do 36061c576705Slukem case "$dlprefiles " in 36071c576705Slukem *" $lib "*) ;; 36081c576705Slukem *) dlprefiles="$dlprefiles $lib" ;; 36091c576705Slukem esac 36101c576705Slukem done 36111c576705Slukem 36121c576705Slukem if test "$build_libtool_libs" = yes; then 36131c576705Slukem if test -n "$rpath"; then 36141c576705Slukem case $host in 36151c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 36161c576705Slukem # these systems don't actually have a c library (as such)! 36171c576705Slukem ;; 36181c576705Slukem *-*-rhapsody* | *-*-darwin1.[012]) 36191c576705Slukem # Rhapsody C library is in the System framework 36201c576705Slukem deplibs="$deplibs -framework System" 36211c576705Slukem ;; 36221c576705Slukem *-*-netbsd*) 36231c576705Slukem # Don't link with libc until the a.out ld.so is fixed. 36241c576705Slukem ;; 36251c576705Slukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 36261c576705Slukem # Do not include libc due to us having libc/libc_r. 36271c576705Slukem ;; 36281c576705Slukem *-*-sco3.2v5* | *-*-sco5v6*) 36291c576705Slukem # Causes problems with __ctype 36301c576705Slukem ;; 36311c576705Slukem *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 36321c576705Slukem # Compiler inserts libc in the correct place for threads to work 36331c576705Slukem ;; 36341c576705Slukem *) 36351c576705Slukem # Add libc to deplibs on all other systems if necessary. 36361c576705Slukem if test "$build_libtool_need_lc" = "yes"; then 36371c576705Slukem deplibs="$deplibs -lc" 36381c576705Slukem fi 36391c576705Slukem ;; 36401c576705Slukem esac 36411c576705Slukem fi 36421c576705Slukem 36431c576705Slukem # Transform deplibs into only deplibs that can be linked in shared. 36441c576705Slukem name_save=$name 36451c576705Slukem libname_save=$libname 36461c576705Slukem release_save=$release 36471c576705Slukem versuffix_save=$versuffix 36481c576705Slukem major_save=$major 36491c576705Slukem # I'm not sure if I'm treating the release correctly. I think 36501c576705Slukem # release should show up in the -l (ie -lgmp5) so we don't want to 36511c576705Slukem # add it in twice. Is that correct? 36521c576705Slukem release="" 36531c576705Slukem versuffix="" 36541c576705Slukem major="" 36551c576705Slukem newdeplibs= 36561c576705Slukem droppeddeps=no 36571c576705Slukem case $deplibs_check_method in 36581c576705Slukem pass_all) 36591c576705Slukem # Don't check for shared/static. Everything works. 36601c576705Slukem # This might be a little naive. We might want to check 36611c576705Slukem # whether the library exists or not. But this is on 36621c576705Slukem # osf3 & osf4 and I'm not really sure... Just 36631c576705Slukem # implementing what was already the behavior. 36641c576705Slukem newdeplibs=$deplibs 36651c576705Slukem ;; 36661c576705Slukem test_compile) 36671c576705Slukem # This code stresses the "libraries are programs" paradigm to its 36681c576705Slukem # limits. Maybe even breaks it. We compile a program, linking it 36691c576705Slukem # against the deplibs as a proxy for the library. Then we can check 36701c576705Slukem # whether they linked in statically or dynamically with ldd. 36711c576705Slukem $rm conftest.c 36721c576705Slukem cat > conftest.c <<EOF 36731c576705Slukem int main() { return 0; } 36741c576705SlukemEOF 36751c576705Slukem $rm conftest 36761c576705Slukem if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 36771c576705Slukem ldd_output=`ldd conftest` 36781c576705Slukem for i in $deplibs; do 36791c576705Slukem name=`expr $i : '-l\(.*\)'` 36801c576705Slukem # If $name is empty we are operating on a -L argument. 36811c576705Slukem if test "$name" != "" && test "$name" != "0"; then 36821c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36831c576705Slukem case " $predeps $postdeps " in 36841c576705Slukem *" $i "*) 36851c576705Slukem newdeplibs="$newdeplibs $i" 36861c576705Slukem i="" 36871c576705Slukem ;; 36881c576705Slukem esac 36891c576705Slukem fi 36901c576705Slukem if test -n "$i" ; then 3691*6ca3cd61Sagc libname=`eval \\$ECHO \"$libname_spec\"` 3692*6ca3cd61Sagc deplib_matches=`eval \\$ECHO \"$library_names_spec\"` 36931c576705Slukem set dummy $deplib_matches 36941c576705Slukem deplib_match=$2 36951c576705Slukem if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36961c576705Slukem newdeplibs="$newdeplibs $i" 36971c576705Slukem else 36981c576705Slukem droppeddeps=yes 3699*6ca3cd61Sagc $ECHO 3700*6ca3cd61Sagc $ECHO "*** Warning: dynamic linker does not accept needed library $i." 3701*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 3702*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 3703*6ca3cd61Sagc $ECHO "*** shared version of the library, which I believe you do not have" 3704*6ca3cd61Sagc $ECHO "*** because a test_compile did reveal that the linker did not use it for" 3705*6ca3cd61Sagc $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 37061c576705Slukem fi 37071c576705Slukem fi 37081c576705Slukem else 37091c576705Slukem newdeplibs="$newdeplibs $i" 37101c576705Slukem fi 37111c576705Slukem done 37121c576705Slukem else 37131c576705Slukem # Error occurred in the first compile. Let's try to salvage 37141c576705Slukem # the situation: Compile a separate program for each library. 37151c576705Slukem for i in $deplibs; do 37161c576705Slukem name=`expr $i : '-l\(.*\)'` 37171c576705Slukem # If $name is empty we are operating on a -L argument. 37181c576705Slukem if test "$name" != "" && test "$name" != "0"; then 37191c576705Slukem $rm conftest 37201c576705Slukem if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 37211c576705Slukem ldd_output=`ldd conftest` 37221c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37231c576705Slukem case " $predeps $postdeps " in 37241c576705Slukem *" $i "*) 37251c576705Slukem newdeplibs="$newdeplibs $i" 37261c576705Slukem i="" 37271c576705Slukem ;; 37281c576705Slukem esac 37291c576705Slukem fi 37301c576705Slukem if test -n "$i" ; then 3731*6ca3cd61Sagc libname=`eval \\$ECHO \"$libname_spec\"` 3732*6ca3cd61Sagc deplib_matches=`eval \\$ECHO \"$library_names_spec\"` 37331c576705Slukem set dummy $deplib_matches 37341c576705Slukem deplib_match=$2 37351c576705Slukem if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 37361c576705Slukem newdeplibs="$newdeplibs $i" 37371c576705Slukem else 37381c576705Slukem droppeddeps=yes 3739*6ca3cd61Sagc $ECHO 3740*6ca3cd61Sagc $ECHO "*** Warning: dynamic linker does not accept needed library $i." 3741*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 3742*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 3743*6ca3cd61Sagc $ECHO "*** shared version of the library, which you do not appear to have" 3744*6ca3cd61Sagc $ECHO "*** because a test_compile did reveal that the linker did not use this one" 3745*6ca3cd61Sagc $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 37461c576705Slukem fi 37471c576705Slukem fi 37481c576705Slukem else 37491c576705Slukem droppeddeps=yes 3750*6ca3cd61Sagc $ECHO 3751*6ca3cd61Sagc $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 3752*6ca3cd61Sagc $ECHO "*** make it link in! You will probably need to install it or some" 3753*6ca3cd61Sagc $ECHO "*** library that it depends on before this library will be fully" 3754*6ca3cd61Sagc $ECHO "*** functional. Installing it before continuing would be even better." 37551c576705Slukem fi 37561c576705Slukem else 37571c576705Slukem newdeplibs="$newdeplibs $i" 37581c576705Slukem fi 37591c576705Slukem done 37601c576705Slukem fi 37611c576705Slukem ;; 37621c576705Slukem file_magic*) 37631c576705Slukem set dummy $deplibs_check_method 37641c576705Slukem file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 37651c576705Slukem for a_deplib in $deplibs; do 37661c576705Slukem name=`expr $a_deplib : '-l\(.*\)'` 37671c576705Slukem # If $name is empty we are operating on a -L argument. 37681c576705Slukem if test "$name" != "" && test "$name" != "0"; then 37691c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37701c576705Slukem case " $predeps $postdeps " in 37711c576705Slukem *" $a_deplib "*) 37721c576705Slukem newdeplibs="$newdeplibs $a_deplib" 37731c576705Slukem a_deplib="" 37741c576705Slukem ;; 37751c576705Slukem esac 37761c576705Slukem fi 37771c576705Slukem if test -n "$a_deplib" ; then 3778*6ca3cd61Sagc libname=`eval \\$ECHO \"$libname_spec\"` 37791c576705Slukem for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37801c576705Slukem potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37811c576705Slukem for potent_lib in $potential_libs; do 37821c576705Slukem # Follow soft links. 37831c576705Slukem if ls -lLd "$potent_lib" 2>/dev/null \ 37841c576705Slukem | grep " -> " >/dev/null; then 37851c576705Slukem continue 37861c576705Slukem fi 37871c576705Slukem # The statement above tries to avoid entering an 37881c576705Slukem # endless loop below, in case of cyclic links. 37891c576705Slukem # We might still enter an endless loop, since a link 37901c576705Slukem # loop can be closed while we follow links, 37911c576705Slukem # but so what? 37921c576705Slukem potlib="$potent_lib" 37931c576705Slukem while test -h "$potlib" 2>/dev/null; do 37941c576705Slukem potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 37951c576705Slukem case $potliblink in 37961c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3797*6ca3cd61Sagc *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 37981c576705Slukem esac 37991c576705Slukem done 38001c576705Slukem if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 38011c576705Slukem | ${SED} 10q \ 38021c576705Slukem | $EGREP "$file_magic_regex" > /dev/null; then 38031c576705Slukem newdeplibs="$newdeplibs $a_deplib" 38041c576705Slukem a_deplib="" 38051c576705Slukem break 2 38061c576705Slukem fi 38071c576705Slukem done 38081c576705Slukem done 38091c576705Slukem fi 38101c576705Slukem if test -n "$a_deplib" ; then 38111c576705Slukem droppeddeps=yes 3812*6ca3cd61Sagc $ECHO 3813*6ca3cd61Sagc $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 3814*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 3815*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 3816*6ca3cd61Sagc $ECHO "*** shared version of the library, which you do not appear to have" 3817*6ca3cd61Sagc $ECHO "*** because I did check the linker path looking for a file starting" 38181c576705Slukem if test -z "$potlib" ; then 3819*6ca3cd61Sagc $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 38201c576705Slukem else 3821*6ca3cd61Sagc $ECHO "*** with $libname and none of the candidates passed a file format test" 3822*6ca3cd61Sagc $ECHO "*** using a file magic. Last file checked: $potlib" 38231c576705Slukem fi 38241c576705Slukem fi 38251c576705Slukem else 38261c576705Slukem # Add a -L argument. 38271c576705Slukem newdeplibs="$newdeplibs $a_deplib" 38281c576705Slukem fi 38291c576705Slukem done # Gone through all deplibs. 38301c576705Slukem ;; 38311c576705Slukem match_pattern*) 38321c576705Slukem set dummy $deplibs_check_method 38331c576705Slukem match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 38341c576705Slukem for a_deplib in $deplibs; do 38351c576705Slukem name=`expr $a_deplib : '-l\(.*\)'` 38361c576705Slukem # If $name is empty we are operating on a -L argument. 38371c576705Slukem if test -n "$name" && test "$name" != "0"; then 38381c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 38391c576705Slukem case " $predeps $postdeps " in 38401c576705Slukem *" $a_deplib "*) 38411c576705Slukem newdeplibs="$newdeplibs $a_deplib" 38421c576705Slukem a_deplib="" 38431c576705Slukem ;; 38441c576705Slukem esac 38451c576705Slukem fi 38461c576705Slukem if test -n "$a_deplib" ; then 3847*6ca3cd61Sagc libname=`eval \\$ECHO \"$libname_spec\"` 38481c576705Slukem for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 38491c576705Slukem potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 38501c576705Slukem for potent_lib in $potential_libs; do 38511c576705Slukem potlib="$potent_lib" # see symlink-check above in file_magic test 3852*6ca3cd61Sagc if eval $ECHO \"$potent_lib\" 2>/dev/null \ 38531c576705Slukem | ${SED} 10q \ 38541c576705Slukem | $EGREP "$match_pattern_regex" > /dev/null; then 38551c576705Slukem newdeplibs="$newdeplibs $a_deplib" 38561c576705Slukem a_deplib="" 38571c576705Slukem break 2 38581c576705Slukem fi 38591c576705Slukem done 38601c576705Slukem done 38611c576705Slukem fi 38621c576705Slukem if test -n "$a_deplib" ; then 38631c576705Slukem droppeddeps=yes 3864*6ca3cd61Sagc $ECHO 3865*6ca3cd61Sagc $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 3866*6ca3cd61Sagc $ECHO "*** I have the capability to make that library automatically link in when" 3867*6ca3cd61Sagc $ECHO "*** you link to this library. But I can only do this if you have a" 3868*6ca3cd61Sagc $ECHO "*** shared version of the library, which you do not appear to have" 3869*6ca3cd61Sagc $ECHO "*** because I did check the linker path looking for a file starting" 38701c576705Slukem if test -z "$potlib" ; then 3871*6ca3cd61Sagc $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 38721c576705Slukem else 3873*6ca3cd61Sagc $ECHO "*** with $libname and none of the candidates passed a file format test" 3874*6ca3cd61Sagc $ECHO "*** using a regex pattern. Last file checked: $potlib" 38751c576705Slukem fi 38761c576705Slukem fi 38771c576705Slukem else 38781c576705Slukem # Add a -L argument. 38791c576705Slukem newdeplibs="$newdeplibs $a_deplib" 38801c576705Slukem fi 38811c576705Slukem done # Gone through all deplibs. 38821c576705Slukem ;; 38831c576705Slukem none | unknown | *) 38841c576705Slukem newdeplibs="" 3885*6ca3cd61Sagc tmp_deplibs=`$ECHO "X $deplibs" | $Xsed -e 's/ -lc$//' \ 38861c576705Slukem -e 's/ -[LR][^ ]*//g'` 38871c576705Slukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 38881c576705Slukem for i in $predeps $postdeps ; do 38891c576705Slukem # can't use Xsed below, because $i might contain '/' 3890*6ca3cd61Sagc tmp_deplibs=`$ECHO "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 38911c576705Slukem done 38921c576705Slukem fi 3893*6ca3cd61Sagc if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 38941c576705Slukem | grep . >/dev/null; then 3895*6ca3cd61Sagc $ECHO 38961c576705Slukem if test "X$deplibs_check_method" = "Xnone"; then 3897*6ca3cd61Sagc $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 38981c576705Slukem else 3899*6ca3cd61Sagc $ECHO "*** Warning: inter-library dependencies are not known to be supported." 39001c576705Slukem fi 3901*6ca3cd61Sagc $ECHO "*** All declared inter-library dependencies are being dropped." 39021c576705Slukem droppeddeps=yes 39031c576705Slukem fi 39041c576705Slukem ;; 39051c576705Slukem esac 39061c576705Slukem versuffix=$versuffix_save 39071c576705Slukem major=$major_save 39081c576705Slukem release=$release_save 39091c576705Slukem libname=$libname_save 39101c576705Slukem name=$name_save 39111c576705Slukem 39121c576705Slukem case $host in 39131c576705Slukem *-*-rhapsody* | *-*-darwin1.[012]) 39141c576705Slukem # On Rhapsody replace the C library is the System framework 3915*6ca3cd61Sagc newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 39161c576705Slukem ;; 39171c576705Slukem esac 39181c576705Slukem 39191c576705Slukem if test "$droppeddeps" = yes; then 39201c576705Slukem if test "$module" = yes; then 3921*6ca3cd61Sagc $ECHO 3922*6ca3cd61Sagc $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 3923*6ca3cd61Sagc $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 3924*6ca3cd61Sagc $ECHO "*** a static module, that should work as long as the dlopening" 3925*6ca3cd61Sagc $ECHO "*** application is linked with the -dlopen flag." 39261c576705Slukem if test -z "$global_symbol_pipe"; then 3927*6ca3cd61Sagc $ECHO 3928*6ca3cd61Sagc $ECHO "*** However, this would only work if libtool was able to extract symbol" 3929*6ca3cd61Sagc $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 3930*6ca3cd61Sagc $ECHO "*** not find such a program. So, this module is probably useless." 3931*6ca3cd61Sagc $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 39321c576705Slukem fi 39331c576705Slukem if test "$build_old_libs" = no; then 39341c576705Slukem oldlibs="$output_objdir/$libname.$libext" 39351c576705Slukem build_libtool_libs=module 39361c576705Slukem build_old_libs=yes 39371c576705Slukem else 39381c576705Slukem build_libtool_libs=no 39391c576705Slukem fi 39401c576705Slukem else 3941*6ca3cd61Sagc $ECHO "*** The inter-library dependencies that have been dropped here will be" 3942*6ca3cd61Sagc $ECHO "*** automatically added whenever a program is linked with this library" 3943*6ca3cd61Sagc $ECHO "*** or is declared to -dlopen it." 39441c576705Slukem 39451c576705Slukem if test "$allow_undefined" = no; then 3946*6ca3cd61Sagc $ECHO 3947*6ca3cd61Sagc $ECHO "*** Since this library must not contain undefined symbols," 3948*6ca3cd61Sagc $ECHO "*** because either the platform does not support them or" 3949*6ca3cd61Sagc $ECHO "*** it was explicitly requested with -no-undefined," 3950*6ca3cd61Sagc $ECHO "*** libtool will only create a static version of it." 39511c576705Slukem if test "$build_old_libs" = no; then 39521c576705Slukem oldlibs="$output_objdir/$libname.$libext" 39531c576705Slukem build_libtool_libs=module 39541c576705Slukem build_old_libs=yes 39551c576705Slukem else 39561c576705Slukem build_libtool_libs=no 39571c576705Slukem fi 39581c576705Slukem fi 39591c576705Slukem fi 39601c576705Slukem fi 39611c576705Slukem # Done checking deplibs! 39621c576705Slukem deplibs=$newdeplibs 39631c576705Slukem fi 39641c576705Slukem 39651c576705Slukem 39661c576705Slukem # move library search paths that coincide with paths to not yet 39671c576705Slukem # installed libraries to the beginning of the library search list 39681c576705Slukem new_libs= 39691c576705Slukem for path in $notinst_path; do 39701c576705Slukem case " $new_libs " in 39711c576705Slukem *" -L$path/$objdir "*) ;; 39721c576705Slukem *) 39731c576705Slukem case " $deplibs " in 39741c576705Slukem *" -L$path/$objdir "*) 39751c576705Slukem new_libs="$new_libs -L$path/$objdir" ;; 39761c576705Slukem esac 39771c576705Slukem ;; 39781c576705Slukem esac 39791c576705Slukem done 39801c576705Slukem for deplib in $deplibs; do 39811c576705Slukem case $deplib in 39821c576705Slukem -L*) 39831c576705Slukem case " $new_libs " in 39841c576705Slukem *" $deplib "*) ;; 39851c576705Slukem *) new_libs="$new_libs $deplib" ;; 39861c576705Slukem esac 39871c576705Slukem ;; 39881c576705Slukem *) new_libs="$new_libs $deplib" ;; 39891c576705Slukem esac 39901c576705Slukem done 39911c576705Slukem deplibs="$new_libs" 39921c576705Slukem 39931c576705Slukem 39941c576705Slukem # All the library-specific variables (install_libdir is set above). 39951c576705Slukem library_names= 39961c576705Slukem old_library= 39971c576705Slukem dlname= 39981c576705Slukem 39991c576705Slukem # Test again, we may have decided not to build it any more 40001c576705Slukem if test "$build_libtool_libs" = yes; then 40011c576705Slukem if test "$hardcode_into_libs" = yes; then 40021c576705Slukem # Hardcode the library paths 40031c576705Slukem hardcode_libdirs= 40041c576705Slukem dep_rpath= 40051c576705Slukem rpath="$finalize_rpath" 40061c576705Slukem test "$mode" != relink && rpath="$compile_rpath$rpath" 40071c576705Slukem for libdir in $rpath; do 40081c576705Slukem if test -n "$hardcode_libdir_flag_spec"; then 40091c576705Slukem if test -n "$hardcode_libdir_separator"; then 40101c576705Slukem if test -z "$hardcode_libdirs"; then 40111c576705Slukem hardcode_libdirs="$libdir" 40121c576705Slukem else 40131c576705Slukem # Just accumulate the unique libdirs. 40141c576705Slukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 40151c576705Slukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 40161c576705Slukem ;; 40171c576705Slukem *) 40181c576705Slukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 40191c576705Slukem ;; 40201c576705Slukem esac 40211c576705Slukem fi 40221c576705Slukem else 40231c576705Slukem eval flag=\"$hardcode_libdir_flag_spec\" 40241c576705Slukem dep_rpath="$dep_rpath $flag" 40251c576705Slukem fi 40261c576705Slukem elif test -n "$runpath_var"; then 40271c576705Slukem case "$perm_rpath " in 40281c576705Slukem *" $libdir "*) ;; 40291c576705Slukem *) perm_rpath="$perm_rpath $libdir" ;; 40301c576705Slukem esac 40311c576705Slukem fi 40321c576705Slukem done 40331c576705Slukem # Substitute the hardcoded libdirs into the rpath. 40341c576705Slukem if test -n "$hardcode_libdir_separator" && 40351c576705Slukem test -n "$hardcode_libdirs"; then 40361c576705Slukem libdir="$hardcode_libdirs" 40371c576705Slukem if test -n "$hardcode_libdir_flag_spec_ld"; then 40381c576705Slukem case $archive_cmds in 40391c576705Slukem *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 40401c576705Slukem *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 40411c576705Slukem esac 40421c576705Slukem else 40431c576705Slukem eval dep_rpath=\"$hardcode_libdir_flag_spec\" 40441c576705Slukem fi 40451c576705Slukem fi 40461c576705Slukem if test -n "$runpath_var" && test -n "$perm_rpath"; then 40471c576705Slukem # We should set the runpath_var. 40481c576705Slukem rpath= 40491c576705Slukem for dir in $perm_rpath; do 40501c576705Slukem rpath="$rpath$dir:" 40511c576705Slukem done 40521c576705Slukem eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 40531c576705Slukem fi 40541c576705Slukem test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 40551c576705Slukem fi 40561c576705Slukem 40571c576705Slukem shlibpath="$finalize_shlibpath" 40581c576705Slukem test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 40591c576705Slukem if test -n "$shlibpath"; then 40601c576705Slukem eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 40611c576705Slukem fi 40621c576705Slukem 40631c576705Slukem # Get the real and link names of the library. 40641c576705Slukem eval shared_ext=\"$shrext_cmds\" 40651c576705Slukem eval library_names=\"$library_names_spec\" 40661c576705Slukem set dummy $library_names 40671c576705Slukem realname="$2" 40681c576705Slukem shift; shift 40691c576705Slukem 40701c576705Slukem if test -n "$soname_spec"; then 40711c576705Slukem eval soname=\"$soname_spec\" 40721c576705Slukem else 40731c576705Slukem soname="$realname" 40741c576705Slukem fi 40751c576705Slukem if test -z "$dlname"; then 40761c576705Slukem dlname=$soname 40771c576705Slukem fi 40781c576705Slukem 40791c576705Slukem lib="$output_objdir/$realname" 40801c576705Slukem linknames= 40811c576705Slukem for link 40821c576705Slukem do 40831c576705Slukem linknames="$linknames $link" 40841c576705Slukem done 40851c576705Slukem 40861c576705Slukem # Use standard objects if they are pic 4087*6ca3cd61Sagc test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 40881c576705Slukem 40891c576705Slukem # Prepare the list of exported symbols 40901c576705Slukem if test -z "$export_symbols"; then 40911c576705Slukem if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 40921c576705Slukem $show "generating symbol list for \`$libname.la'" 40931c576705Slukem export_symbols="$output_objdir/$libname.exp" 40941c576705Slukem $run $rm $export_symbols 40951c576705Slukem cmds=$export_symbols_cmds 40961c576705Slukem save_ifs="$IFS"; IFS='~' 40971c576705Slukem for cmd in $cmds; do 40981c576705Slukem IFS="$save_ifs" 40991c576705Slukem eval cmd=\"$cmd\" 41001c576705Slukem if len=`expr "X$cmd" : ".*"` && 41011c576705Slukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 41021c576705Slukem $show "$cmd" 41031c576705Slukem $run eval "$cmd" || exit $? 41041c576705Slukem skipped_export=false 41051c576705Slukem else 41061c576705Slukem # The command line is too long to execute in one step. 41071c576705Slukem $show "using reloadable object file for export list..." 41081c576705Slukem skipped_export=: 41091c576705Slukem # Break out early, otherwise skipped_export may be 41101c576705Slukem # set to false by a later but shorter cmd. 41111c576705Slukem break 41121c576705Slukem fi 41131c576705Slukem done 41141c576705Slukem IFS="$save_ifs" 41151c576705Slukem if test -n "$export_symbols_regex"; then 41161c576705Slukem $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 41171c576705Slukem $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 41181c576705Slukem $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 41191c576705Slukem $run eval '$mv "${export_symbols}T" "$export_symbols"' 41201c576705Slukem fi 41211c576705Slukem fi 41221c576705Slukem fi 41231c576705Slukem 41241c576705Slukem if test -n "$export_symbols" && test -n "$include_expsyms"; then 4125*6ca3cd61Sagc $run eval '$ECHO "X$include_expsyms" | $SP2NL >> "$export_symbols"' 41261c576705Slukem fi 41271c576705Slukem 41281c576705Slukem tmp_deplibs= 41291c576705Slukem for test_deplib in $deplibs; do 41301c576705Slukem case " $convenience " in 41311c576705Slukem *" $test_deplib "*) ;; 41321c576705Slukem *) 41331c576705Slukem tmp_deplibs="$tmp_deplibs $test_deplib" 41341c576705Slukem ;; 41351c576705Slukem esac 41361c576705Slukem done 41371c576705Slukem deplibs="$tmp_deplibs" 41381c576705Slukem 41391c576705Slukem if test -n "$convenience"; then 41401c576705Slukem if test -n "$whole_archive_flag_spec"; then 41411c576705Slukem save_libobjs=$libobjs 41421c576705Slukem eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 41431c576705Slukem else 41441c576705Slukem gentop="$output_objdir/${outputname}x" 41451c576705Slukem generated="$generated $gentop" 41461c576705Slukem 41471c576705Slukem func_extract_archives $gentop $convenience 41481c576705Slukem libobjs="$libobjs $func_extract_archives_result" 41491c576705Slukem fi 41501c576705Slukem fi 41511c576705Slukem 41521c576705Slukem if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 41531c576705Slukem eval flag=\"$thread_safe_flag_spec\" 41541c576705Slukem linker_flags="$linker_flags $flag" 41551c576705Slukem fi 41561c576705Slukem 41571c576705Slukem # Make a backup of the uninstalled library when relinking 41581c576705Slukem if test "$mode" = relink; then 41591c576705Slukem $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 41601c576705Slukem fi 41611c576705Slukem 41621c576705Slukem # Do each of the archive commands. 41631c576705Slukem if test "$module" = yes && test -n "$module_cmds" ; then 41641c576705Slukem if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 41651c576705Slukem eval test_cmds=\"$module_expsym_cmds\" 41661c576705Slukem cmds=$module_expsym_cmds 41671c576705Slukem else 41681c576705Slukem eval test_cmds=\"$module_cmds\" 41691c576705Slukem cmds=$module_cmds 41701c576705Slukem fi 41711c576705Slukem else 41721c576705Slukem if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 41731c576705Slukem eval test_cmds=\"$archive_expsym_cmds\" 41741c576705Slukem cmds=$archive_expsym_cmds 41751c576705Slukem else 41761c576705Slukem eval test_cmds=\"$archive_cmds\" 41771c576705Slukem cmds=$archive_cmds 41781c576705Slukem fi 41791c576705Slukem fi 41801c576705Slukem 41811c576705Slukem if test "X$skipped_export" != "X:" && 41821c576705Slukem len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41831c576705Slukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 41841c576705Slukem : 41851c576705Slukem else 41861c576705Slukem # The command line is too long to link in one step, link piecewise. 4187*6ca3cd61Sagc $ECHO "creating reloadable object files..." 41881c576705Slukem 41891c576705Slukem # Save the value of $output and $libobjs because we want to 41901c576705Slukem # use them later. If we have whole_archive_flag_spec, we 41911c576705Slukem # want to use save_libobjs as it was before 41921c576705Slukem # whole_archive_flag_spec was expanded, because we can't 41931c576705Slukem # assume the linker understands whole_archive_flag_spec. 41941c576705Slukem # This may have to be revisited, in case too many 41951c576705Slukem # convenience libraries get linked in and end up exceeding 41961c576705Slukem # the spec. 41971c576705Slukem if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 41981c576705Slukem save_libobjs=$libobjs 41991c576705Slukem fi 42001c576705Slukem save_output=$output 4201*6ca3cd61Sagc output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 42021c576705Slukem 42031c576705Slukem # Clear the reloadable object creation command queue and 42041c576705Slukem # initialize k to one. 42051c576705Slukem test_cmds= 42061c576705Slukem concat_cmds= 42071c576705Slukem objlist= 42081c576705Slukem delfiles= 42091c576705Slukem last_robj= 42101c576705Slukem k=1 42111c576705Slukem output=$output_objdir/$output_la-${k}.$objext 42121c576705Slukem # Loop over the list of objects to be linked. 42131c576705Slukem for obj in $save_libobjs 42141c576705Slukem do 42151c576705Slukem eval test_cmds=\"$reload_cmds $objlist $last_robj\" 42161c576705Slukem if test "X$objlist" = X || 42171c576705Slukem { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 42181c576705Slukem test "$len" -le "$max_cmd_len"; }; then 42191c576705Slukem objlist="$objlist $obj" 42201c576705Slukem else 42211c576705Slukem # The command $test_cmds is almost too long, add a 42221c576705Slukem # command to the queue. 42231c576705Slukem if test "$k" -eq 1 ; then 42241c576705Slukem # The first file doesn't have a previous command to add. 42251c576705Slukem eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 42261c576705Slukem else 42271c576705Slukem # All subsequent reloadable object files will link in 42281c576705Slukem # the last one created. 42291c576705Slukem eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 42301c576705Slukem fi 42311c576705Slukem last_robj=$output_objdir/$output_la-${k}.$objext 42321c576705Slukem k=`expr $k + 1` 42331c576705Slukem output=$output_objdir/$output_la-${k}.$objext 42341c576705Slukem objlist=$obj 42351c576705Slukem len=1 42361c576705Slukem fi 42371c576705Slukem done 42381c576705Slukem # Handle the remaining objects by creating one last 42391c576705Slukem # reloadable object file. All subsequent reloadable object 42401c576705Slukem # files will link in the last one created. 42411c576705Slukem test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 42421c576705Slukem eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 42431c576705Slukem 42441c576705Slukem if ${skipped_export-false}; then 42451c576705Slukem $show "generating symbol list for \`$libname.la'" 42461c576705Slukem export_symbols="$output_objdir/$libname.exp" 42471c576705Slukem $run $rm $export_symbols 42481c576705Slukem libobjs=$output 42491c576705Slukem # Append the command to create the export file. 42501c576705Slukem eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 42511c576705Slukem fi 42521c576705Slukem 42531c576705Slukem # Set up a command to remove the reloadable object files 42541c576705Slukem # after they are used. 42551c576705Slukem i=0 42561c576705Slukem while test "$i" -lt "$k" 42571c576705Slukem do 42581c576705Slukem i=`expr $i + 1` 42591c576705Slukem delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 42601c576705Slukem done 42611c576705Slukem 4262*6ca3cd61Sagc $ECHO "creating a temporary reloadable object file: $output" 42631c576705Slukem 42641c576705Slukem # Loop through the commands generated above and execute them. 42651c576705Slukem save_ifs="$IFS"; IFS='~' 42661c576705Slukem for cmd in $concat_cmds; do 42671c576705Slukem IFS="$save_ifs" 42681c576705Slukem $show "$cmd" 42691c576705Slukem $run eval "$cmd" || exit $? 42701c576705Slukem done 42711c576705Slukem IFS="$save_ifs" 42721c576705Slukem 42731c576705Slukem libobjs=$output 42741c576705Slukem # Restore the value of output. 42751c576705Slukem output=$save_output 42761c576705Slukem 42771c576705Slukem if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 42781c576705Slukem eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 42791c576705Slukem fi 42801c576705Slukem # Expand the library linking commands again to reset the 42811c576705Slukem # value of $libobjs for piecewise linking. 42821c576705Slukem 42831c576705Slukem # Do each of the archive commands. 42841c576705Slukem if test "$module" = yes && test -n "$module_cmds" ; then 42851c576705Slukem if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 42861c576705Slukem cmds=$module_expsym_cmds 42871c576705Slukem else 42881c576705Slukem cmds=$module_cmds 42891c576705Slukem fi 42901c576705Slukem else 42911c576705Slukem if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 42921c576705Slukem cmds=$archive_expsym_cmds 42931c576705Slukem else 42941c576705Slukem cmds=$archive_cmds 42951c576705Slukem fi 42961c576705Slukem fi 42971c576705Slukem 42981c576705Slukem # Append the command to remove the reloadable object files 42991c576705Slukem # to the just-reset $cmds. 43001c576705Slukem eval cmds=\"\$cmds~\$rm $delfiles\" 43011c576705Slukem fi 43021c576705Slukem save_ifs="$IFS"; IFS='~' 43031c576705Slukem for cmd in $cmds; do 43041c576705Slukem IFS="$save_ifs" 43051c576705Slukem eval cmd=\"$cmd\" 43061c576705Slukem $show "$cmd" 43071c576705Slukem $run eval "$cmd" || { 43081c576705Slukem lt_exit=$? 43091c576705Slukem 43101c576705Slukem # Restore the uninstalled library and exit 43111c576705Slukem if test "$mode" = relink; then 43121c576705Slukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 43131c576705Slukem fi 43141c576705Slukem 43151c576705Slukem exit $lt_exit 43161c576705Slukem } 43171c576705Slukem done 43181c576705Slukem IFS="$save_ifs" 43191c576705Slukem 43201c576705Slukem # Restore the uninstalled library and exit 43211c576705Slukem if test "$mode" = relink; then 43221c576705Slukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 43231c576705Slukem 43241c576705Slukem if test -n "$convenience"; then 43251c576705Slukem if test -z "$whole_archive_flag_spec"; then 43261c576705Slukem $show "${rm}r $gentop" 43271c576705Slukem $run ${rm}r "$gentop" 43281c576705Slukem fi 43291c576705Slukem fi 43301c576705Slukem 43311c576705Slukem exit $EXIT_SUCCESS 43321c576705Slukem fi 43331c576705Slukem 43341c576705Slukem # Create links to the real library. 43351c576705Slukem for linkname in $linknames; do 43361c576705Slukem if test "$realname" != "$linkname"; then 43371c576705Slukem $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 43381c576705Slukem $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 43391c576705Slukem fi 43401c576705Slukem done 43411c576705Slukem 43421c576705Slukem # If -module or -export-dynamic was specified, set the dlname. 43431c576705Slukem if test "$module" = yes || test "$export_dynamic" = yes; then 43441c576705Slukem # On all known operating systems, these are identical. 43451c576705Slukem dlname="$soname" 43461c576705Slukem fi 43471c576705Slukem fi 43481c576705Slukem ;; 43491c576705Slukem 43501c576705Slukem obj) 43511c576705Slukem case " $deplibs" in 43521c576705Slukem *\ -l* | *\ -L*) 4353*6ca3cd61Sagc $ECHO "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 43541c576705Slukem esac 43551c576705Slukem 43561c576705Slukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4357*6ca3cd61Sagc $ECHO "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 43581c576705Slukem fi 43591c576705Slukem 43601c576705Slukem if test -n "$rpath"; then 4361*6ca3cd61Sagc $ECHO "$modename: warning: \`-rpath' is ignored for objects" 1>&2 43621c576705Slukem fi 43631c576705Slukem 43641c576705Slukem if test -n "$xrpath"; then 4365*6ca3cd61Sagc $ECHO "$modename: warning: \`-R' is ignored for objects" 1>&2 43661c576705Slukem fi 43671c576705Slukem 43681c576705Slukem if test -n "$vinfo"; then 4369*6ca3cd61Sagc $ECHO "$modename: warning: \`-version-info' is ignored for objects" 1>&2 43701c576705Slukem fi 43711c576705Slukem 43721c576705Slukem if test -n "$release"; then 4373*6ca3cd61Sagc $ECHO "$modename: warning: \`-release' is ignored for objects" 1>&2 43741c576705Slukem fi 43751c576705Slukem 43761c576705Slukem case $output in 43771c576705Slukem *.lo) 43781c576705Slukem if test -n "$objs$old_deplibs"; then 4379*6ca3cd61Sagc $ECHO "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 43801c576705Slukem exit $EXIT_FAILURE 43811c576705Slukem fi 43821c576705Slukem libobj="$output" 4383*6ca3cd61Sagc obj=`$ECHO "X$output" | $Xsed -e "$lo2o"` 43841c576705Slukem ;; 43851c576705Slukem *) 43861c576705Slukem libobj= 43871c576705Slukem obj="$output" 43881c576705Slukem ;; 43891c576705Slukem esac 43901c576705Slukem 43911c576705Slukem # Delete the old objects. 43921c576705Slukem $run $rm $obj $libobj 43931c576705Slukem 43941c576705Slukem # Objects from convenience libraries. This assumes 43951c576705Slukem # single-version convenience libraries. Whenever we create 43961c576705Slukem # different ones for PIC/non-PIC, this we'll have to duplicate 43971c576705Slukem # the extraction. 43981c576705Slukem reload_conv_objs= 43991c576705Slukem gentop= 44001c576705Slukem # reload_cmds runs $LD directly, so let us get rid of 44011c576705Slukem # -Wl from whole_archive_flag_spec and hope we can get by with 44021c576705Slukem # turning comma into space.. 44031c576705Slukem wl= 44041c576705Slukem 44051c576705Slukem if test -n "$convenience"; then 44061c576705Slukem if test -n "$whole_archive_flag_spec"; then 44071c576705Slukem eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 4408*6ca3cd61Sagc reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 44091c576705Slukem else 44101c576705Slukem gentop="$output_objdir/${obj}x" 44111c576705Slukem generated="$generated $gentop" 44121c576705Slukem 44131c576705Slukem func_extract_archives $gentop $convenience 44141c576705Slukem reload_conv_objs="$reload_objs $func_extract_archives_result" 44151c576705Slukem fi 44161c576705Slukem fi 44171c576705Slukem 44181c576705Slukem # Create the old-style object. 4419*6ca3cd61Sagc 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 44201c576705Slukem 44211c576705Slukem output="$obj" 44221c576705Slukem cmds=$reload_cmds 44231c576705Slukem save_ifs="$IFS"; IFS='~' 44241c576705Slukem for cmd in $cmds; do 44251c576705Slukem IFS="$save_ifs" 44261c576705Slukem eval cmd=\"$cmd\" 44271c576705Slukem $show "$cmd" 44281c576705Slukem $run eval "$cmd" || exit $? 44291c576705Slukem done 44301c576705Slukem IFS="$save_ifs" 44311c576705Slukem 44321c576705Slukem # Exit if we aren't doing a library object file. 44331c576705Slukem if test -z "$libobj"; then 44341c576705Slukem if test -n "$gentop"; then 44351c576705Slukem $show "${rm}r $gentop" 44361c576705Slukem $run ${rm}r $gentop 44371c576705Slukem fi 44381c576705Slukem 44391c576705Slukem exit $EXIT_SUCCESS 44401c576705Slukem fi 44411c576705Slukem 44421c576705Slukem if test "$build_libtool_libs" != yes; then 44431c576705Slukem if test -n "$gentop"; then 44441c576705Slukem $show "${rm}r $gentop" 44451c576705Slukem $run ${rm}r $gentop 44461c576705Slukem fi 44471c576705Slukem 44481c576705Slukem # Create an invalid libtool object if no PIC, so that we don't 44491c576705Slukem # accidentally link it into a program. 44501c576705Slukem # $show "echo timestamp > $libobj" 44511c576705Slukem # $run eval "echo timestamp > $libobj" || exit $? 44521c576705Slukem exit $EXIT_SUCCESS 44531c576705Slukem fi 44541c576705Slukem 44551c576705Slukem if test -n "$pic_flag" || test "$pic_mode" != default; then 44561c576705Slukem # Only do commands if we really have different PIC objects. 44571c576705Slukem reload_objs="$libobjs $reload_conv_objs" 44581c576705Slukem output="$libobj" 44591c576705Slukem cmds=$reload_cmds 44601c576705Slukem save_ifs="$IFS"; IFS='~' 44611c576705Slukem for cmd in $cmds; do 44621c576705Slukem IFS="$save_ifs" 44631c576705Slukem eval cmd=\"$cmd\" 44641c576705Slukem $show "$cmd" 44651c576705Slukem $run eval "$cmd" || exit $? 44661c576705Slukem done 44671c576705Slukem IFS="$save_ifs" 44681c576705Slukem fi 44691c576705Slukem 44701c576705Slukem if test -n "$gentop"; then 44711c576705Slukem $show "${rm}r $gentop" 44721c576705Slukem $run ${rm}r $gentop 44731c576705Slukem fi 44741c576705Slukem 44751c576705Slukem exit $EXIT_SUCCESS 44761c576705Slukem ;; 44771c576705Slukem 44781c576705Slukem prog) 44791c576705Slukem case $host in 4480*6ca3cd61Sagc *cygwin*) output=`$ECHO $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 44811c576705Slukem esac 44821c576705Slukem if test -n "$vinfo"; then 4483*6ca3cd61Sagc $ECHO "$modename: warning: \`-version-info' is ignored for programs" 1>&2 44841c576705Slukem fi 44851c576705Slukem 44861c576705Slukem if test -n "$release"; then 4487*6ca3cd61Sagc $ECHO "$modename: warning: \`-release' is ignored for programs" 1>&2 44881c576705Slukem fi 44891c576705Slukem 44901c576705Slukem if test "$preload" = yes; then 44911c576705Slukem if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 44921c576705Slukem test "$dlopen_self_static" = unknown; then 4493*6ca3cd61Sagc $ECHO "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 44941c576705Slukem fi 44951c576705Slukem fi 44961c576705Slukem 44971c576705Slukem case $host in 44981c576705Slukem *-*-rhapsody* | *-*-darwin1.[012]) 44991c576705Slukem # On Rhapsody replace the C library is the System framework 4500*6ca3cd61Sagc compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4501*6ca3cd61Sagc finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 45021c576705Slukem ;; 45031c576705Slukem esac 45041c576705Slukem 45051c576705Slukem case $host in 45061c576705Slukem *darwin*) 45071c576705Slukem # Don't allow lazy linking, it breaks C++ global constructors 45081c576705Slukem if test "$tagname" = CXX ; then 45091c576705Slukem compile_command="$compile_command ${wl}-bind_at_load" 45101c576705Slukem finalize_command="$finalize_command ${wl}-bind_at_load" 45111c576705Slukem fi 45121c576705Slukem ;; 45131c576705Slukem esac 45141c576705Slukem 45151c576705Slukem 45161c576705Slukem # move library search paths that coincide with paths to not yet 45171c576705Slukem # installed libraries to the beginning of the library search list 45181c576705Slukem new_libs= 45191c576705Slukem for path in $notinst_path; do 45201c576705Slukem case " $new_libs " in 45211c576705Slukem *" -L$path/$objdir "*) ;; 45221c576705Slukem *) 45231c576705Slukem case " $compile_deplibs " in 45241c576705Slukem *" -L$path/$objdir "*) 45251c576705Slukem new_libs="$new_libs -L$path/$objdir" ;; 45261c576705Slukem esac 45271c576705Slukem ;; 45281c576705Slukem esac 45291c576705Slukem done 45301c576705Slukem for deplib in $compile_deplibs; do 45311c576705Slukem case $deplib in 45321c576705Slukem -L*) 45331c576705Slukem case " $new_libs " in 45341c576705Slukem *" $deplib "*) ;; 45351c576705Slukem *) new_libs="$new_libs $deplib" ;; 45361c576705Slukem esac 45371c576705Slukem ;; 45381c576705Slukem *) new_libs="$new_libs $deplib" ;; 45391c576705Slukem esac 45401c576705Slukem done 45411c576705Slukem compile_deplibs="$new_libs" 45421c576705Slukem 45431c576705Slukem 45441c576705Slukem compile_command="$compile_command $compile_deplibs" 45451c576705Slukem finalize_command="$finalize_command $finalize_deplibs" 45461c576705Slukem 45471c576705Slukem if test -n "$rpath$xrpath"; then 45481c576705Slukem # If the user specified any rpath flags, then add them. 45491c576705Slukem for libdir in $rpath $xrpath; do 45501c576705Slukem # This is the magic to use -rpath. 45511c576705Slukem case "$finalize_rpath " in 45521c576705Slukem *" $libdir "*) ;; 45531c576705Slukem *) finalize_rpath="$finalize_rpath $libdir" ;; 45541c576705Slukem esac 45551c576705Slukem done 45561c576705Slukem fi 45571c576705Slukem 45581c576705Slukem # Now hardcode the library paths 45591c576705Slukem rpath= 45601c576705Slukem hardcode_libdirs= 45611c576705Slukem for libdir in $compile_rpath $finalize_rpath; do 45621c576705Slukem if test -n "$hardcode_libdir_flag_spec"; then 45631c576705Slukem if test -n "$hardcode_libdir_separator"; then 45641c576705Slukem if test -z "$hardcode_libdirs"; then 45651c576705Slukem hardcode_libdirs="$libdir" 45661c576705Slukem else 45671c576705Slukem # Just accumulate the unique libdirs. 45681c576705Slukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 45691c576705Slukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 45701c576705Slukem ;; 45711c576705Slukem *) 45721c576705Slukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 45731c576705Slukem ;; 45741c576705Slukem esac 45751c576705Slukem fi 45761c576705Slukem else 45771c576705Slukem eval flag=\"$hardcode_libdir_flag_spec\" 45781c576705Slukem rpath="$rpath $flag" 45791c576705Slukem fi 45801c576705Slukem elif test -n "$runpath_var"; then 45811c576705Slukem case "$perm_rpath " in 45821c576705Slukem *" $libdir "*) ;; 45831c576705Slukem *) perm_rpath="$perm_rpath $libdir" ;; 45841c576705Slukem esac 45851c576705Slukem fi 45861c576705Slukem case $host in 45871c576705Slukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4588*6ca3cd61Sagc testbindir=`$ECHO "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 45891c576705Slukem case :$dllsearchpath: in 45901c576705Slukem *":$libdir:"*) ;; 45911c576705Slukem *) dllsearchpath="$dllsearchpath:$libdir";; 45921c576705Slukem esac 45931c576705Slukem case :$dllsearchpath: in 45941c576705Slukem *":$testbindir:"*) ;; 45951c576705Slukem *) dllsearchpath="$dllsearchpath:$testbindir";; 45961c576705Slukem esac 45971c576705Slukem ;; 45981c576705Slukem esac 45991c576705Slukem done 46001c576705Slukem # Substitute the hardcoded libdirs into the rpath. 46011c576705Slukem if test -n "$hardcode_libdir_separator" && 46021c576705Slukem test -n "$hardcode_libdirs"; then 46031c576705Slukem libdir="$hardcode_libdirs" 46041c576705Slukem eval rpath=\" $hardcode_libdir_flag_spec\" 46051c576705Slukem fi 46061c576705Slukem compile_rpath="$rpath" 46071c576705Slukem 46081c576705Slukem rpath= 46091c576705Slukem hardcode_libdirs= 46101c576705Slukem for libdir in $finalize_rpath; do 46111c576705Slukem if test -n "$hardcode_libdir_flag_spec"; then 46121c576705Slukem if test -n "$hardcode_libdir_separator"; then 46131c576705Slukem if test -z "$hardcode_libdirs"; then 46141c576705Slukem hardcode_libdirs="$libdir" 46151c576705Slukem else 46161c576705Slukem # Just accumulate the unique libdirs. 46171c576705Slukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 46181c576705Slukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 46191c576705Slukem ;; 46201c576705Slukem *) 46211c576705Slukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 46221c576705Slukem ;; 46231c576705Slukem esac 46241c576705Slukem fi 46251c576705Slukem else 46261c576705Slukem eval flag=\"$hardcode_libdir_flag_spec\" 46271c576705Slukem rpath="$rpath $flag" 46281c576705Slukem fi 46291c576705Slukem elif test -n "$runpath_var"; then 46301c576705Slukem case "$finalize_perm_rpath " in 46311c576705Slukem *" $libdir "*) ;; 46321c576705Slukem *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 46331c576705Slukem esac 46341c576705Slukem fi 46351c576705Slukem done 46361c576705Slukem # Substitute the hardcoded libdirs into the rpath. 46371c576705Slukem if test -n "$hardcode_libdir_separator" && 46381c576705Slukem test -n "$hardcode_libdirs"; then 46391c576705Slukem libdir="$hardcode_libdirs" 46401c576705Slukem eval rpath=\" $hardcode_libdir_flag_spec\" 46411c576705Slukem fi 46421c576705Slukem finalize_rpath="$rpath" 46431c576705Slukem 46441c576705Slukem if test -n "$libobjs" && test "$build_old_libs" = yes; then 46451c576705Slukem # Transform all the library objects into standard objects. 4646*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4647*6ca3cd61Sagc finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 46481c576705Slukem fi 46491c576705Slukem 46501c576705Slukem dlsyms= 46511c576705Slukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 46521c576705Slukem if test -n "$NM" && test -n "$global_symbol_pipe"; then 46531c576705Slukem dlsyms="${outputname}S.c" 46541c576705Slukem else 4655*6ca3cd61Sagc $ECHO "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 46561c576705Slukem fi 46571c576705Slukem fi 46581c576705Slukem 46591c576705Slukem if test -n "$dlsyms"; then 46601c576705Slukem case $dlsyms in 46611c576705Slukem "") ;; 46621c576705Slukem *.c) 46631c576705Slukem # Discover the nlist of each of the dlfiles. 46641c576705Slukem nlist="$output_objdir/${outputname}.nm" 46651c576705Slukem 46661c576705Slukem $show "$rm $nlist ${nlist}S ${nlist}T" 46671c576705Slukem $run $rm "$nlist" "${nlist}S" "${nlist}T" 46681c576705Slukem 46691c576705Slukem # Parse the name list into a source file. 46701c576705Slukem $show "creating $output_objdir/$dlsyms" 46711c576705Slukem 4672*6ca3cd61Sagc test -z "$run" && $ECHO > "$output_objdir/$dlsyms" "\ 46731c576705Slukem/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 46741c576705Slukem/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 46751c576705Slukem 46761c576705Slukem#ifdef __cplusplus 46771c576705Slukemextern \"C\" { 46781c576705Slukem#endif 46791c576705Slukem 46801c576705Slukem/* Prevent the only kind of declaration conflicts we can make. */ 46811c576705Slukem#define lt_preloaded_symbols some_other_symbol 46821c576705Slukem 46831c576705Slukem/* External symbol declarations for the compiler. */\ 46841c576705Slukem" 46851c576705Slukem 46861c576705Slukem if test "$dlself" = yes; then 46871c576705Slukem $show "generating symbol list for \`$output'" 46881c576705Slukem 4689*6ca3cd61Sagc test -z "$run" && $ECHO ': @PROGRAM@ ' > "$nlist" 46901c576705Slukem 46911c576705Slukem # Add our own program objects to the symbol list. 4692*6ca3cd61Sagc progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 46931c576705Slukem for arg in $progfiles; do 46941c576705Slukem $show "extracting global C symbols from \`$arg'" 46951c576705Slukem $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46961c576705Slukem done 46971c576705Slukem 46981c576705Slukem if test -n "$exclude_expsyms"; then 46991c576705Slukem $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 47001c576705Slukem $run eval '$mv "$nlist"T "$nlist"' 47011c576705Slukem fi 47021c576705Slukem 47031c576705Slukem if test -n "$export_symbols_regex"; then 47041c576705Slukem $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 47051c576705Slukem $run eval '$mv "$nlist"T "$nlist"' 47061c576705Slukem fi 47071c576705Slukem 47081c576705Slukem # Prepare the list of exported symbols 47091c576705Slukem if test -z "$export_symbols"; then 47101c576705Slukem export_symbols="$output_objdir/$outputname.exp" 47111c576705Slukem $run $rm $export_symbols 47121c576705Slukem $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 47131c576705Slukem case $host in 47141c576705Slukem *cygwin* | *mingw* ) 47151c576705Slukem $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 47161c576705Slukem $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 47171c576705Slukem ;; 47181c576705Slukem esac 47191c576705Slukem else 47201c576705Slukem $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 47211c576705Slukem $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 47221c576705Slukem $run eval 'mv "$nlist"T "$nlist"' 47231c576705Slukem case $host in 47241c576705Slukem *cygwin* | *mingw* ) 47251c576705Slukem $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 47261c576705Slukem $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 47271c576705Slukem ;; 47281c576705Slukem esac 47291c576705Slukem fi 47301c576705Slukem fi 47311c576705Slukem 47321c576705Slukem for arg in $dlprefiles; do 47331c576705Slukem $show "extracting global C symbols from \`$arg'" 4734*6ca3cd61Sagc name=`$ECHO "$arg" | ${SED} -e 's%^.*/%%'` 4735*6ca3cd61Sagc $run eval '$ECHO ": $name " >> "$nlist"' 47361c576705Slukem $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 47371c576705Slukem done 47381c576705Slukem 47391c576705Slukem if test -z "$run"; then 47401c576705Slukem # Make sure we have at least an empty file. 47411c576705Slukem test -f "$nlist" || : > "$nlist" 47421c576705Slukem 47431c576705Slukem if test -n "$exclude_expsyms"; then 47441c576705Slukem $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 47451c576705Slukem $mv "$nlist"T "$nlist" 47461c576705Slukem fi 47471c576705Slukem 47481c576705Slukem # Try sorting and uniquifying the output. 47491c576705Slukem if grep -v "^: " < "$nlist" | 47501c576705Slukem if sort -k 3 </dev/null >/dev/null 2>&1; then 47511c576705Slukem sort -k 3 47521c576705Slukem else 47531c576705Slukem sort +2 47541c576705Slukem fi | 47551c576705Slukem uniq > "$nlist"S; then 47561c576705Slukem : 47571c576705Slukem else 47581c576705Slukem grep -v "^: " < "$nlist" > "$nlist"S 47591c576705Slukem fi 47601c576705Slukem 47611c576705Slukem if test -f "$nlist"S; then 47621c576705Slukem eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 47631c576705Slukem else 4764*6ca3cd61Sagc $ECHO '/* NONE */' >> "$output_objdir/$dlsyms" 47651c576705Slukem fi 47661c576705Slukem 4767*6ca3cd61Sagc $ECHO >> "$output_objdir/$dlsyms" "\ 47681c576705Slukem 47691c576705Slukem#undef lt_preloaded_symbols 47701c576705Slukem 47711c576705Slukem#if defined (__STDC__) && __STDC__ 47721c576705Slukem# define lt_ptr void * 47731c576705Slukem#else 47741c576705Slukem# define lt_ptr char * 47751c576705Slukem# define const 47761c576705Slukem#endif 47771c576705Slukem 47781c576705Slukem/* The mapping between symbol names and symbols. */ 47791c576705Slukem" 47801c576705Slukem 47811c576705Slukem case $host in 47821c576705Slukem *cygwin* | *mingw* ) 4783*6ca3cd61Sagc $ECHO >> "$output_objdir/$dlsyms" "\ 47841c576705Slukem/* DATA imports from DLLs on WIN32 can't be const, because 47851c576705Slukem runtime relocations are performed -- see ld's documentation 47861c576705Slukem on pseudo-relocs */ 47871c576705Slukemstruct { 47881c576705Slukem" 47891c576705Slukem ;; 47901c576705Slukem * ) 4791*6ca3cd61Sagc $ECHO >> "$output_objdir/$dlsyms" "\ 47921c576705Slukemconst struct { 47931c576705Slukem" 47941c576705Slukem ;; 47951c576705Slukem esac 47961c576705Slukem 47971c576705Slukem 4798*6ca3cd61Sagc $ECHO >> "$output_objdir/$dlsyms" "\ 47991c576705Slukem const char *name; 48001c576705Slukem lt_ptr address; 48011c576705Slukem} 48021c576705Slukemlt_preloaded_symbols[] = 48031c576705Slukem{\ 48041c576705Slukem" 48051c576705Slukem 48061c576705Slukem eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 48071c576705Slukem 4808*6ca3cd61Sagc $ECHO >> "$output_objdir/$dlsyms" "\ 48091c576705Slukem {0, (lt_ptr) 0} 48101c576705Slukem}; 48111c576705Slukem 48121c576705Slukem/* This works around a problem in FreeBSD linker */ 48131c576705Slukem#ifdef FREEBSD_WORKAROUND 48141c576705Slukemstatic const void *lt_preloaded_setup() { 48151c576705Slukem return lt_preloaded_symbols; 48161c576705Slukem} 48171c576705Slukem#endif 48181c576705Slukem 48191c576705Slukem#ifdef __cplusplus 48201c576705Slukem} 48211c576705Slukem#endif\ 48221c576705Slukem" 48231c576705Slukem fi 48241c576705Slukem 48251c576705Slukem pic_flag_for_symtable= 48261c576705Slukem case $host in 48271c576705Slukem # compiling the symbol table file with pic_flag works around 48281c576705Slukem # a FreeBSD bug that causes programs to crash when -lm is 48291c576705Slukem # linked before any other PIC object. But we must not use 48301c576705Slukem # pic_flag when linking with -static. The problem exists in 48311c576705Slukem # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 48321c576705Slukem *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 48331c576705Slukem case "$compile_command " in 48341c576705Slukem *" -static "*) ;; 48351c576705Slukem *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 48361c576705Slukem esac;; 48371c576705Slukem *-*-hpux*) 48381c576705Slukem case "$compile_command " in 48391c576705Slukem *" -static "*) ;; 48401c576705Slukem *) pic_flag_for_symtable=" $pic_flag";; 48411c576705Slukem esac 48421c576705Slukem esac 48431c576705Slukem 48441c576705Slukem # Now compile the dynamic symbol file. 48451c576705Slukem $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 48461c576705Slukem $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 48471c576705Slukem 48481c576705Slukem # Clean up the generated files. 48491c576705Slukem $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 48501c576705Slukem $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 48511c576705Slukem 48521c576705Slukem # Transform the symbol file into the correct name. 48531c576705Slukem case $host in 48541c576705Slukem *cygwin* | *mingw* ) 48551c576705Slukem if test -f "$output_objdir/${outputname}.def" ; then 4856*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4857*6ca3cd61Sagc finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 48581c576705Slukem else 4859*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4860*6ca3cd61Sagc finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 48611c576705Slukem fi 48621c576705Slukem ;; 48631c576705Slukem * ) 4864*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4865*6ca3cd61Sagc finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 48661c576705Slukem ;; 48671c576705Slukem esac 48681c576705Slukem ;; 48691c576705Slukem *) 4870*6ca3cd61Sagc $ECHO "$modename: unknown suffix for \`$dlsyms'" 1>&2 48711c576705Slukem exit $EXIT_FAILURE 48721c576705Slukem ;; 48731c576705Slukem esac 48741c576705Slukem else 48751c576705Slukem # We keep going just in case the user didn't refer to 48761c576705Slukem # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 48771c576705Slukem # really was required. 48781c576705Slukem 48791c576705Slukem # Nullify the symbol file. 4880*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4881*6ca3cd61Sagc finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 48821c576705Slukem fi 48831c576705Slukem 48841c576705Slukem if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 48851c576705Slukem # Replace the output file specification. 4886*6ca3cd61Sagc compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 48871c576705Slukem link_command="$compile_command$compile_rpath" 48881c576705Slukem 48891c576705Slukem # We have no uninstalled library dependencies, so finalize right now. 48901c576705Slukem $show "$link_command" 48911c576705Slukem $run eval "$link_command" 48921c576705Slukem exit_status=$? 48931c576705Slukem 48941c576705Slukem # Delete the generated files. 48951c576705Slukem if test -n "$dlsyms"; then 48961c576705Slukem $show "$rm $output_objdir/${outputname}S.${objext}" 48971c576705Slukem $run $rm "$output_objdir/${outputname}S.${objext}" 48981c576705Slukem fi 48991c576705Slukem 49001c576705Slukem exit $exit_status 49011c576705Slukem fi 49021c576705Slukem 49031c576705Slukem if test -n "$shlibpath_var"; then 49041c576705Slukem # We should set the shlibpath_var 49051c576705Slukem rpath= 49061c576705Slukem for dir in $temp_rpath; do 49071c576705Slukem case $dir in 49081c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) 49091c576705Slukem # Absolute path. 49101c576705Slukem rpath="$rpath$dir:" 49111c576705Slukem ;; 49121c576705Slukem *) 49131c576705Slukem # Relative path: add a thisdir entry. 49141c576705Slukem rpath="$rpath\$thisdir/$dir:" 49151c576705Slukem ;; 49161c576705Slukem esac 49171c576705Slukem done 49181c576705Slukem temp_rpath="$rpath" 49191c576705Slukem fi 49201c576705Slukem 49211c576705Slukem if test -n "$compile_shlibpath$finalize_shlibpath"; then 49221c576705Slukem compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 49231c576705Slukem fi 49241c576705Slukem if test -n "$finalize_shlibpath"; then 49251c576705Slukem finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 49261c576705Slukem fi 49271c576705Slukem 49281c576705Slukem compile_var= 49291c576705Slukem finalize_var= 49301c576705Slukem if test -n "$runpath_var"; then 49311c576705Slukem if test -n "$perm_rpath"; then 49321c576705Slukem # We should set the runpath_var. 49331c576705Slukem rpath= 49341c576705Slukem for dir in $perm_rpath; do 49351c576705Slukem rpath="$rpath$dir:" 49361c576705Slukem done 49371c576705Slukem compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 49381c576705Slukem fi 49391c576705Slukem if test -n "$finalize_perm_rpath"; then 49401c576705Slukem # We should set the runpath_var. 49411c576705Slukem rpath= 49421c576705Slukem for dir in $finalize_perm_rpath; do 49431c576705Slukem rpath="$rpath$dir:" 49441c576705Slukem done 49451c576705Slukem finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 49461c576705Slukem fi 49471c576705Slukem fi 49481c576705Slukem 49491c576705Slukem if test "$no_install" = yes; then 49501c576705Slukem # We don't need to create a wrapper script. 49511c576705Slukem link_command="$compile_var$compile_command$compile_rpath" 49521c576705Slukem # Replace the output file specification. 4953*6ca3cd61Sagc link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 49541c576705Slukem # Delete the old output file. 49551c576705Slukem $run $rm $output 49561c576705Slukem # Link the executable and exit 49571c576705Slukem $show "$link_command" 49581c576705Slukem $run eval "$link_command" || exit $? 49591c576705Slukem exit $EXIT_SUCCESS 49601c576705Slukem fi 49611c576705Slukem 49621c576705Slukem if test "$hardcode_action" = relink; then 49631c576705Slukem # Fast installation is not supported 49641c576705Slukem link_command="$compile_var$compile_command$compile_rpath" 49651c576705Slukem relink_command="$finalize_var$finalize_command$finalize_rpath" 49661c576705Slukem 4967*6ca3cd61Sagc $ECHO "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4968*6ca3cd61Sagc $ECHO "$modename: \`$output' will be relinked during installation" 1>&2 49691c576705Slukem else 49701c576705Slukem if test "$fast_install" != no; then 49711c576705Slukem link_command="$finalize_var$compile_command$finalize_rpath" 49721c576705Slukem if test "$fast_install" = yes; then 4973*6ca3cd61Sagc relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 49741c576705Slukem else 49751c576705Slukem # fast_install is set to needless 49761c576705Slukem relink_command= 49771c576705Slukem fi 49781c576705Slukem else 49791c576705Slukem link_command="$compile_var$compile_command$compile_rpath" 49801c576705Slukem relink_command="$finalize_var$finalize_command$finalize_rpath" 49811c576705Slukem fi 49821c576705Slukem fi 49831c576705Slukem 49841c576705Slukem # Replace the output file specification. 4985*6ca3cd61Sagc link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 49861c576705Slukem 49871c576705Slukem # Delete the old output files. 49881c576705Slukem $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 49891c576705Slukem 49901c576705Slukem $show "$link_command" 49911c576705Slukem $run eval "$link_command" || exit $? 49921c576705Slukem 49931c576705Slukem # Now create the wrapper script. 49941c576705Slukem $show "creating $output" 49951c576705Slukem 49961c576705Slukem # Quote the relink command for shipping. 49971c576705Slukem if test -n "$relink_command"; then 49981c576705Slukem # Preserve any variables that may affect compiler behavior 49991c576705Slukem for var in $variables_saved_for_relink; do 50001c576705Slukem if eval test -z \"\${$var+set}\"; then 50011c576705Slukem relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 50021c576705Slukem elif eval var_value=\$$var; test -z "$var_value"; then 50031c576705Slukem relink_command="$var=; export $var; $relink_command" 50041c576705Slukem else 5005*6ca3cd61Sagc var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"` 50061c576705Slukem relink_command="$var=\"$var_value\"; export $var; $relink_command" 50071c576705Slukem fi 50081c576705Slukem done 50091c576705Slukem relink_command="(cd `pwd`; $relink_command)" 5010*6ca3cd61Sagc relink_command=`$ECHO "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 50111c576705Slukem fi 50121c576705Slukem 5013*6ca3cd61Sagc # Quote $ECHO for shipping. 5014*6ca3cd61Sagc if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 50151c576705Slukem case $progpath in 50161c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 50171c576705Slukem *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 50181c576705Slukem esac 5019*6ca3cd61Sagc qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 50201c576705Slukem else 5021*6ca3cd61Sagc qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 50221c576705Slukem fi 50231c576705Slukem 50241c576705Slukem # Only actually do things if our run command is non-null. 50251c576705Slukem if test -z "$run"; then 50261c576705Slukem # win32 will think the script is a binary if it has 50271c576705Slukem # a .exe suffix, so we strip it off here. 50281c576705Slukem case $output in 5029*6ca3cd61Sagc *.exe) output=`$ECHO $output|${SED} 's,.exe$,,'` ;; 50301c576705Slukem esac 50311c576705Slukem # test for cygwin because mv fails w/o .exe extensions 50321c576705Slukem case $host in 50331c576705Slukem *cygwin*) 50341c576705Slukem exeext=.exe 5035*6ca3cd61Sagc outputname=`$ECHO $outputname|${SED} 's,.exe$,,'` ;; 50361c576705Slukem *) exeext= ;; 50371c576705Slukem esac 50381c576705Slukem case $host in 50391c576705Slukem *cygwin* | *mingw* ) 50401c576705Slukem output_name=`basename $output` 50411c576705Slukem output_path=`dirname $output` 50421c576705Slukem cwrappersource="$output_path/$objdir/lt-$output_name.c" 50431c576705Slukem cwrapper="$output_path/$output_name.exe" 50441c576705Slukem $rm $cwrappersource $cwrapper 50451c576705Slukem trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 50461c576705Slukem 50471c576705Slukem cat > $cwrappersource <<EOF 50481c576705Slukem 50491c576705Slukem/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 50501c576705Slukem Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 50511c576705Slukem 50521c576705Slukem The $output program cannot be directly executed until all the libtool 50531c576705Slukem libraries that it depends on are installed. 50541c576705Slukem 50551c576705Slukem This wrapper executable should never be moved out of the build directory. 50561c576705Slukem If it is, it will not operate correctly. 50571c576705Slukem 50581c576705Slukem Currently, it simply execs the wrapper *script* "/bin/sh $output", 50591c576705Slukem but could eventually absorb all of the scripts functionality and 50601c576705Slukem exec $objdir/$outputname directly. 50611c576705Slukem*/ 50621c576705SlukemEOF 50631c576705Slukem cat >> $cwrappersource<<"EOF" 50641c576705Slukem#include <stdio.h> 50651c576705Slukem#include <stdlib.h> 50661c576705Slukem#include <unistd.h> 50671c576705Slukem#include <malloc.h> 50681c576705Slukem#include <stdarg.h> 50691c576705Slukem#include <assert.h> 50701c576705Slukem#include <string.h> 50711c576705Slukem#include <ctype.h> 50721c576705Slukem#include <sys/stat.h> 50731c576705Slukem 50741c576705Slukem#if defined(PATH_MAX) 50751c576705Slukem# define LT_PATHMAX PATH_MAX 50761c576705Slukem#elif defined(MAXPATHLEN) 50771c576705Slukem# define LT_PATHMAX MAXPATHLEN 50781c576705Slukem#else 50791c576705Slukem# define LT_PATHMAX 1024 50801c576705Slukem#endif 50811c576705Slukem 50821c576705Slukem#ifndef DIR_SEPARATOR 50831c576705Slukem# define DIR_SEPARATOR '/' 50841c576705Slukem# define PATH_SEPARATOR ':' 50851c576705Slukem#endif 50861c576705Slukem 50871c576705Slukem#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 50881c576705Slukem defined (__OS2__) 50891c576705Slukem# define HAVE_DOS_BASED_FILE_SYSTEM 50901c576705Slukem# ifndef DIR_SEPARATOR_2 50911c576705Slukem# define DIR_SEPARATOR_2 '\\' 50921c576705Slukem# endif 50931c576705Slukem# ifndef PATH_SEPARATOR_2 50941c576705Slukem# define PATH_SEPARATOR_2 ';' 50951c576705Slukem# endif 50961c576705Slukem#endif 50971c576705Slukem 50981c576705Slukem#ifndef DIR_SEPARATOR_2 50991c576705Slukem# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 51001c576705Slukem#else /* DIR_SEPARATOR_2 */ 51011c576705Slukem# define IS_DIR_SEPARATOR(ch) \ 51021c576705Slukem (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 51031c576705Slukem#endif /* DIR_SEPARATOR_2 */ 51041c576705Slukem 51051c576705Slukem#ifndef PATH_SEPARATOR_2 51061c576705Slukem# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 51071c576705Slukem#else /* PATH_SEPARATOR_2 */ 51081c576705Slukem# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 51091c576705Slukem#endif /* PATH_SEPARATOR_2 */ 51101c576705Slukem 51111c576705Slukem#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 51121c576705Slukem#define XFREE(stale) do { \ 51131c576705Slukem if (stale) { free ((void *) stale); stale = 0; } \ 51141c576705Slukem} while (0) 51151c576705Slukem 51161c576705Slukem/* -DDEBUG is fairly common in CFLAGS. */ 51171c576705Slukem#undef DEBUG 51181c576705Slukem#if defined DEBUGWRAPPER 51191c576705Slukem# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 51201c576705Slukem#else 51211c576705Slukem# define DEBUG(format, ...) 51221c576705Slukem#endif 51231c576705Slukem 51241c576705Slukemconst char *program_name = NULL; 51251c576705Slukem 51261c576705Slukemvoid * xmalloc (size_t num); 51271c576705Slukemchar * xstrdup (const char *string); 51281c576705Slukemconst char * base_name (const char *name); 51291c576705Slukemchar * find_executable(const char *wrapper); 51301c576705Slukemint check_executable(const char *path); 51311c576705Slukemchar * strendzap(char *str, const char *pat); 51321c576705Slukemvoid lt_fatal (const char *message, ...); 51331c576705Slukem 51341c576705Slukemint 51351c576705Slukemmain (int argc, char *argv[]) 51361c576705Slukem{ 51371c576705Slukem char **newargz; 51381c576705Slukem int i; 51391c576705Slukem 51401c576705Slukem program_name = (char *) xstrdup (base_name (argv[0])); 51411c576705Slukem DEBUG("(main) argv[0] : %s\n",argv[0]); 51421c576705Slukem DEBUG("(main) program_name : %s\n",program_name); 51431c576705Slukem newargz = XMALLOC(char *, argc+2); 51441c576705SlukemEOF 51451c576705Slukem 51461c576705Slukem cat >> $cwrappersource <<EOF 51471c576705Slukem newargz[0] = (char *) xstrdup("$SHELL"); 51481c576705SlukemEOF 51491c576705Slukem 51501c576705Slukem cat >> $cwrappersource <<"EOF" 51511c576705Slukem newargz[1] = find_executable(argv[0]); 51521c576705Slukem if (newargz[1] == NULL) 51531c576705Slukem lt_fatal("Couldn't find %s", argv[0]); 51541c576705Slukem DEBUG("(main) found exe at : %s\n",newargz[1]); 51551c576705Slukem /* we know the script has the same name, without the .exe */ 51561c576705Slukem /* so make sure newargz[1] doesn't end in .exe */ 51571c576705Slukem strendzap(newargz[1],".exe"); 51581c576705Slukem for (i = 1; i < argc; i++) 51591c576705Slukem newargz[i+1] = xstrdup(argv[i]); 51601c576705Slukem newargz[argc+1] = NULL; 51611c576705Slukem 51621c576705Slukem for (i=0; i<argc+1; i++) 51631c576705Slukem { 51641c576705Slukem DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 51651c576705Slukem ; 51661c576705Slukem } 51671c576705Slukem 51681c576705SlukemEOF 51691c576705Slukem 51701c576705Slukem case $host_os in 51711c576705Slukem mingw*) 51721c576705Slukem cat >> $cwrappersource <<EOF 51731c576705Slukem execv("$SHELL",(char const **)newargz); 51741c576705SlukemEOF 51751c576705Slukem ;; 51761c576705Slukem *) 51771c576705Slukem cat >> $cwrappersource <<EOF 51781c576705Slukem execv("$SHELL",newargz); 51791c576705SlukemEOF 51801c576705Slukem ;; 51811c576705Slukem esac 51821c576705Slukem 51831c576705Slukem cat >> $cwrappersource <<"EOF" 51841c576705Slukem return 127; 51851c576705Slukem} 51861c576705Slukem 51871c576705Slukemvoid * 51881c576705Slukemxmalloc (size_t num) 51891c576705Slukem{ 51901c576705Slukem void * p = (void *) malloc (num); 51911c576705Slukem if (!p) 51921c576705Slukem lt_fatal ("Memory exhausted"); 51931c576705Slukem 51941c576705Slukem return p; 51951c576705Slukem} 51961c576705Slukem 51971c576705Slukemchar * 51981c576705Slukemxstrdup (const char *string) 51991c576705Slukem{ 52001c576705Slukem return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 52011c576705Slukem; 52021c576705Slukem} 52031c576705Slukem 52041c576705Slukemconst char * 52051c576705Slukembase_name (const char *name) 52061c576705Slukem{ 52071c576705Slukem const char *base; 52081c576705Slukem 52091c576705Slukem#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 52101c576705Slukem /* Skip over the disk name in MSDOS pathnames. */ 52111c576705Slukem if (isalpha ((unsigned char)name[0]) && name[1] == ':') 52121c576705Slukem name += 2; 52131c576705Slukem#endif 52141c576705Slukem 52151c576705Slukem for (base = name; *name; name++) 52161c576705Slukem if (IS_DIR_SEPARATOR (*name)) 52171c576705Slukem base = name + 1; 52181c576705Slukem return base; 52191c576705Slukem} 52201c576705Slukem 52211c576705Slukemint 52221c576705Slukemcheck_executable(const char * path) 52231c576705Slukem{ 52241c576705Slukem struct stat st; 52251c576705Slukem 52261c576705Slukem DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 52271c576705Slukem if ((!path) || (!*path)) 52281c576705Slukem return 0; 52291c576705Slukem 52301c576705Slukem if ((stat (path, &st) >= 0) && 52311c576705Slukem ( 52321c576705Slukem /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 52331c576705Slukem#if defined (S_IXOTH) 52341c576705Slukem ((st.st_mode & S_IXOTH) == S_IXOTH) || 52351c576705Slukem#endif 52361c576705Slukem#if defined (S_IXGRP) 52371c576705Slukem ((st.st_mode & S_IXGRP) == S_IXGRP) || 52381c576705Slukem#endif 52391c576705Slukem ((st.st_mode & S_IXUSR) == S_IXUSR)) 52401c576705Slukem ) 52411c576705Slukem return 1; 52421c576705Slukem else 52431c576705Slukem return 0; 52441c576705Slukem} 52451c576705Slukem 52461c576705Slukem/* Searches for the full path of the wrapper. Returns 52471c576705Slukem newly allocated full path name if found, NULL otherwise */ 52481c576705Slukemchar * 52491c576705Slukemfind_executable (const char* wrapper) 52501c576705Slukem{ 52511c576705Slukem int has_slash = 0; 52521c576705Slukem const char* p; 52531c576705Slukem const char* p_next; 52541c576705Slukem /* static buffer for getcwd */ 52551c576705Slukem char tmp[LT_PATHMAX + 1]; 52561c576705Slukem int tmp_len; 52571c576705Slukem char* concat_name; 52581c576705Slukem 52591c576705Slukem DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 52601c576705Slukem 52611c576705Slukem if ((wrapper == NULL) || (*wrapper == '\0')) 52621c576705Slukem return NULL; 52631c576705Slukem 52641c576705Slukem /* Absolute path? */ 52651c576705Slukem#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 52661c576705Slukem if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 52671c576705Slukem { 52681c576705Slukem concat_name = xstrdup (wrapper); 52691c576705Slukem if (check_executable(concat_name)) 52701c576705Slukem return concat_name; 52711c576705Slukem XFREE(concat_name); 52721c576705Slukem } 52731c576705Slukem else 52741c576705Slukem { 52751c576705Slukem#endif 52761c576705Slukem if (IS_DIR_SEPARATOR (wrapper[0])) 52771c576705Slukem { 52781c576705Slukem concat_name = xstrdup (wrapper); 52791c576705Slukem if (check_executable(concat_name)) 52801c576705Slukem return concat_name; 52811c576705Slukem XFREE(concat_name); 52821c576705Slukem } 52831c576705Slukem#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 52841c576705Slukem } 52851c576705Slukem#endif 52861c576705Slukem 52871c576705Slukem for (p = wrapper; *p; p++) 52881c576705Slukem if (*p == '/') 52891c576705Slukem { 52901c576705Slukem has_slash = 1; 52911c576705Slukem break; 52921c576705Slukem } 52931c576705Slukem if (!has_slash) 52941c576705Slukem { 52951c576705Slukem /* no slashes; search PATH */ 52961c576705Slukem const char* path = getenv ("PATH"); 52971c576705Slukem if (path != NULL) 52981c576705Slukem { 52991c576705Slukem for (p = path; *p; p = p_next) 53001c576705Slukem { 53011c576705Slukem const char* q; 53021c576705Slukem size_t p_len; 53031c576705Slukem for (q = p; *q; q++) 53041c576705Slukem if (IS_PATH_SEPARATOR(*q)) 53051c576705Slukem break; 53061c576705Slukem p_len = q - p; 53071c576705Slukem p_next = (*q == '\0' ? q : q + 1); 53081c576705Slukem if (p_len == 0) 53091c576705Slukem { 53101c576705Slukem /* empty path: current directory */ 53111c576705Slukem if (getcwd (tmp, LT_PATHMAX) == NULL) 53121c576705Slukem lt_fatal ("getcwd failed"); 53131c576705Slukem tmp_len = strlen(tmp); 53141c576705Slukem concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 53151c576705Slukem memcpy (concat_name, tmp, tmp_len); 53161c576705Slukem concat_name[tmp_len] = '/'; 53171c576705Slukem strcpy (concat_name + tmp_len + 1, wrapper); 53181c576705Slukem } 53191c576705Slukem else 53201c576705Slukem { 53211c576705Slukem concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 53221c576705Slukem memcpy (concat_name, p, p_len); 53231c576705Slukem concat_name[p_len] = '/'; 53241c576705Slukem strcpy (concat_name + p_len + 1, wrapper); 53251c576705Slukem } 53261c576705Slukem if (check_executable(concat_name)) 53271c576705Slukem return concat_name; 53281c576705Slukem XFREE(concat_name); 53291c576705Slukem } 53301c576705Slukem } 53311c576705Slukem /* not found in PATH; assume curdir */ 53321c576705Slukem } 53331c576705Slukem /* Relative path | not found in path: prepend cwd */ 53341c576705Slukem if (getcwd (tmp, LT_PATHMAX) == NULL) 53351c576705Slukem lt_fatal ("getcwd failed"); 53361c576705Slukem tmp_len = strlen(tmp); 53371c576705Slukem concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 53381c576705Slukem memcpy (concat_name, tmp, tmp_len); 53391c576705Slukem concat_name[tmp_len] = '/'; 53401c576705Slukem strcpy (concat_name + tmp_len + 1, wrapper); 53411c576705Slukem 53421c576705Slukem if (check_executable(concat_name)) 53431c576705Slukem return concat_name; 53441c576705Slukem XFREE(concat_name); 53451c576705Slukem return NULL; 53461c576705Slukem} 53471c576705Slukem 53481c576705Slukemchar * 53491c576705Slukemstrendzap(char *str, const char *pat) 53501c576705Slukem{ 53511c576705Slukem size_t len, patlen; 53521c576705Slukem 53531c576705Slukem assert(str != NULL); 53541c576705Slukem assert(pat != NULL); 53551c576705Slukem 53561c576705Slukem len = strlen(str); 53571c576705Slukem patlen = strlen(pat); 53581c576705Slukem 53591c576705Slukem if (patlen <= len) 53601c576705Slukem { 53611c576705Slukem str += len - patlen; 53621c576705Slukem if (strcmp(str, pat) == 0) 53631c576705Slukem *str = '\0'; 53641c576705Slukem } 53651c576705Slukem return str; 53661c576705Slukem} 53671c576705Slukem 53681c576705Slukemstatic void 53691c576705Slukemlt_error_core (int exit_status, const char * mode, 53701c576705Slukem const char * message, va_list ap) 53711c576705Slukem{ 53721c576705Slukem fprintf (stderr, "%s: %s: ", program_name, mode); 53731c576705Slukem vfprintf (stderr, message, ap); 53741c576705Slukem fprintf (stderr, ".\n"); 53751c576705Slukem 53761c576705Slukem if (exit_status >= 0) 53771c576705Slukem exit (exit_status); 53781c576705Slukem} 53791c576705Slukem 53801c576705Slukemvoid 53811c576705Slukemlt_fatal (const char *message, ...) 53821c576705Slukem{ 53831c576705Slukem va_list ap; 53841c576705Slukem va_start (ap, message); 53851c576705Slukem lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 53861c576705Slukem va_end (ap); 53871c576705Slukem} 53881c576705SlukemEOF 53891c576705Slukem # we should really use a build-platform specific compiler 53901c576705Slukem # here, but OTOH, the wrappers (shell script and this C one) 53911c576705Slukem # are only useful if you want to execute the "real" binary. 53921c576705Slukem # Since the "real" binary is built for $host, then this 53931c576705Slukem # wrapper might as well be built for $host, too. 53941c576705Slukem $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 53951c576705Slukem ;; 53961c576705Slukem esac 53971c576705Slukem $rm $output 53981c576705Slukem trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 53991c576705Slukem 5400*6ca3cd61Sagc $ECHO > $output "\ 54011c576705Slukem#! $SHELL 54021c576705Slukem 54031c576705Slukem# $output - temporary wrapper script for $objdir/$outputname 54041c576705Slukem# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 54051c576705Slukem# 54061c576705Slukem# The $output program cannot be directly executed until all the libtool 54071c576705Slukem# libraries that it depends on are installed. 54081c576705Slukem# 54091c576705Slukem# This wrapper script should never be moved out of the build directory. 54101c576705Slukem# If it is, it will not operate correctly. 54111c576705Slukem 54121c576705Slukem# Sed substitution that helps us do robust quoting. It backslashifies 54131c576705Slukem# metacharacters that are still active within double-quoted strings. 54141c576705SlukemXsed='${SED} -e 1s/^X//' 54151c576705Slukemsed_quote_subst='$sed_quote_subst' 54161c576705Slukem 54171c576705Slukem# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 54181c576705Slukemif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 54191c576705Slukem emulate sh 54201c576705Slukem NULLCMD=: 54211c576705Slukem # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 54221c576705Slukem # is contrary to our usage. Disable this feature. 54231c576705Slukem alias -g '\${1+\"\$@\"}'='\"\$@\"' 54241c576705Slukem setopt NO_GLOB_SUBST 54251c576705Slukemelse 54261c576705Slukem case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 54271c576705Slukemfi 54281c576705SlukemBIN_SH=xpg4; export BIN_SH # for Tru64 54291c576705SlukemDUALCASE=1; export DUALCASE # for MKS sh 54301c576705Slukem 54311c576705Slukem# The HP-UX ksh and POSIX shell print the target directory to stdout 54321c576705Slukem# if CDPATH is set. 54331c576705Slukem(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 54341c576705Slukem 54351c576705Slukemrelink_command=\"$relink_command\" 54361c576705Slukem 54371c576705Slukem# This environment variable determines our operation mode. 54381c576705Slukemif test \"\$libtool_install_magic\" = \"$magic\"; then 54391c576705Slukem # install mode needs the following variable: 54401c576705Slukem notinst_deplibs='$notinst_deplibs' 54411c576705Slukemelse 5442*6ca3cd61Sagc # When we are sourced in execute mode, \$file and \$ECHO are already set. 54431c576705Slukem if test \"\$libtool_execute_magic\" != \"$magic\"; then 54441c576705Slukem echo=\"$qecho\" 54451c576705Slukem file=\"\$0\" 54461c576705Slukem # Make sure echo works. 54471c576705Slukem if test \"X\$1\" = X--no-reexec; then 54481c576705Slukem # Discard the --no-reexec flag, and continue. 54491c576705Slukem shift 5450*6ca3cd61Sagc elif test \"X\`(\$ECHO '\t') 2>/dev/null\`\" = 'X\t'; then 5451*6ca3cd61Sagc # Yippee, \$ECHO works! 54521c576705Slukem : 54531c576705Slukem else 5454*6ca3cd61Sagc # Restart under the correct shell, and then maybe \$ECHO will work. 54551c576705Slukem exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 54561c576705Slukem fi 54571c576705Slukem fi\ 54581c576705Slukem" 5459*6ca3cd61Sagc $ECHO >> $output "\ 54601c576705Slukem 54611c576705Slukem # Find the directory that this script lives in. 5462*6ca3cd61Sagc thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 54631c576705Slukem test \"x\$thisdir\" = \"x\$file\" && thisdir=. 54641c576705Slukem 54651c576705Slukem # Follow symbolic links until we get to the real thisdir. 54661c576705Slukem file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 54671c576705Slukem while test -n \"\$file\"; do 5468*6ca3cd61Sagc destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 54691c576705Slukem 54701c576705Slukem # If there was a directory component, then change thisdir. 54711c576705Slukem if test \"x\$destdir\" != \"x\$file\"; then 54721c576705Slukem case \"\$destdir\" in 54731c576705Slukem [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 54741c576705Slukem *) thisdir=\"\$thisdir/\$destdir\" ;; 54751c576705Slukem esac 54761c576705Slukem fi 54771c576705Slukem 5478*6ca3cd61Sagc file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 54791c576705Slukem file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 54801c576705Slukem done 54811c576705Slukem 54821c576705Slukem # Try to get the absolute directory name. 54831c576705Slukem absdir=\`cd \"\$thisdir\" && pwd\` 54841c576705Slukem test -n \"\$absdir\" && thisdir=\"\$absdir\" 54851c576705Slukem" 54861c576705Slukem 54871c576705Slukem if test "$fast_install" = yes; then 5488*6ca3cd61Sagc $ECHO >> $output "\ 54891c576705Slukem program=lt-'$outputname'$exeext 54901c576705Slukem progdir=\"\$thisdir/$objdir\" 54911c576705Slukem 54921c576705Slukem if test ! -f \"\$progdir/\$program\" || \\ 54931c576705Slukem { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 54941c576705Slukem test \"X\$file\" != \"X\$progdir/\$program\"; }; then 54951c576705Slukem 54961c576705Slukem file=\"\$\$-\$program\" 54971c576705Slukem 54981c576705Slukem if test ! -d \"\$progdir\"; then 54991c576705Slukem $mkdir \"\$progdir\" 55001c576705Slukem else 55011c576705Slukem $rm \"\$progdir/\$file\" 55021c576705Slukem fi" 55031c576705Slukem 5504*6ca3cd61Sagc $ECHO >> $output "\ 55051c576705Slukem 55061c576705Slukem # relink executable if necessary 55071c576705Slukem if test -n \"\$relink_command\"; then 55081c576705Slukem if relink_command_output=\`eval \$relink_command 2>&1\`; then : 55091c576705Slukem else 5510*6ca3cd61Sagc $ECHO \"\$relink_command_output\" >&2 55111c576705Slukem $rm \"\$progdir/\$file\" 55121c576705Slukem exit $EXIT_FAILURE 55131c576705Slukem fi 55141c576705Slukem fi 55151c576705Slukem 55161c576705Slukem $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 55171c576705Slukem { $rm \"\$progdir/\$program\"; 55181c576705Slukem $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 55191c576705Slukem $rm \"\$progdir/\$file\" 55201c576705Slukem fi" 55211c576705Slukem else 5522*6ca3cd61Sagc $ECHO >> $output "\ 55231c576705Slukem program='$outputname' 55241c576705Slukem progdir=\"\$thisdir/$objdir\" 55251c576705Slukem" 55261c576705Slukem fi 55271c576705Slukem 5528*6ca3cd61Sagc $ECHO >> $output "\ 55291c576705Slukem 55301c576705Slukem if test -f \"\$progdir/\$program\"; then" 55311c576705Slukem 55321c576705Slukem # Export our shlibpath_var if we have one. 55331c576705Slukem if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5534*6ca3cd61Sagc $ECHO >> $output "\ 55351c576705Slukem # Add our own library path to $shlibpath_var 55361c576705Slukem $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 55371c576705Slukem 55381c576705Slukem # Some systems cannot cope with colon-terminated $shlibpath_var 55391c576705Slukem # The second colon is a workaround for a bug in BeOS R4 sed 5540*6ca3cd61Sagc $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 55411c576705Slukem 55421c576705Slukem export $shlibpath_var 55431c576705Slukem" 55441c576705Slukem fi 55451c576705Slukem 55461c576705Slukem # fixup the dll searchpath if we need to. 55471c576705Slukem if test -n "$dllsearchpath"; then 5548*6ca3cd61Sagc $ECHO >> $output "\ 55491c576705Slukem # Add the dll search path components to the executable PATH 55501c576705Slukem PATH=$dllsearchpath:\$PATH 55511c576705Slukem" 55521c576705Slukem fi 55531c576705Slukem 5554*6ca3cd61Sagc $ECHO >> $output "\ 55551c576705Slukem if test \"\$libtool_execute_magic\" != \"$magic\"; then 55561c576705Slukem # Run the actual program with our arguments. 55571c576705Slukem" 55581c576705Slukem case $host in 55591c576705Slukem # Backslashes separate directories on plain windows 55601c576705Slukem *-*-mingw | *-*-os2*) 5561*6ca3cd61Sagc $ECHO >> $output "\ 55621c576705Slukem exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 55631c576705Slukem" 55641c576705Slukem ;; 55651c576705Slukem 55661c576705Slukem *) 5567*6ca3cd61Sagc $ECHO >> $output "\ 55681c576705Slukem exec \"\$progdir/\$program\" \${1+\"\$@\"} 55691c576705Slukem" 55701c576705Slukem ;; 55711c576705Slukem esac 5572*6ca3cd61Sagc $ECHO >> $output "\ 5573*6ca3cd61Sagc \$ECHO \"\$0: cannot exec \$program \$*\" 55741c576705Slukem exit $EXIT_FAILURE 55751c576705Slukem fi 55761c576705Slukem else 55771c576705Slukem # The program doesn't exist. 5578*6ca3cd61Sagc \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5579*6ca3cd61Sagc \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 5580*6ca3cd61Sagc $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 55811c576705Slukem exit $EXIT_FAILURE 55821c576705Slukem fi 55831c576705Slukemfi\ 55841c576705Slukem" 55851c576705Slukem chmod +x $output 55861c576705Slukem fi 55871c576705Slukem exit $EXIT_SUCCESS 55881c576705Slukem ;; 55891c576705Slukem esac 55901c576705Slukem 55911c576705Slukem # See if we need to build an old-fashioned archive. 55921c576705Slukem for oldlib in $oldlibs; do 55931c576705Slukem 55941c576705Slukem if test "$build_libtool_libs" = convenience; then 55951c576705Slukem oldobjs="$libobjs_save" 55961c576705Slukem addlibs="$convenience" 55971c576705Slukem build_libtool_libs=no 55981c576705Slukem else 55991c576705Slukem if test "$build_libtool_libs" = module; then 56001c576705Slukem oldobjs="$libobjs_save" 56011c576705Slukem build_libtool_libs=no 56021c576705Slukem else 56031c576705Slukem oldobjs="$old_deplibs $non_pic_objects" 56041c576705Slukem fi 56051c576705Slukem addlibs="$old_convenience" 56061c576705Slukem fi 56071c576705Slukem 56081c576705Slukem if test -n "$addlibs"; then 56091c576705Slukem gentop="$output_objdir/${outputname}x" 56101c576705Slukem generated="$generated $gentop" 56111c576705Slukem 56121c576705Slukem func_extract_archives $gentop $addlibs 56131c576705Slukem oldobjs="$oldobjs $func_extract_archives_result" 56141c576705Slukem fi 56151c576705Slukem 56161c576705Slukem # Do each command in the archive commands. 56171c576705Slukem if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 56181c576705Slukem cmds=$old_archive_from_new_cmds 56191c576705Slukem else 56201c576705Slukem # POSIX demands no paths to be encoded in archives. We have 56211c576705Slukem # to avoid creating archives with duplicate basenames if we 56221c576705Slukem # might have to extract them afterwards, e.g., when creating a 56231c576705Slukem # static archive out of a convenience library, or when linking 56241c576705Slukem # the entirety of a libtool archive into another (currently 56251c576705Slukem # not supported by libtool). 56261c576705Slukem if (for obj in $oldobjs 56271c576705Slukem do 5628*6ca3cd61Sagc $ECHO "X$obj" | $Xsed -e 's%^.*/%%' 56291c576705Slukem done | sort | sort -uc >/dev/null 2>&1); then 56301c576705Slukem : 56311c576705Slukem else 5632*6ca3cd61Sagc $ECHO "copying selected object files to avoid basename conflicts..." 56331c576705Slukem 56341c576705Slukem if test -z "$gentop"; then 56351c576705Slukem gentop="$output_objdir/${outputname}x" 56361c576705Slukem generated="$generated $gentop" 56371c576705Slukem 56381c576705Slukem $show "${rm}r $gentop" 56391c576705Slukem $run ${rm}r "$gentop" 56401c576705Slukem $show "$mkdir $gentop" 56411c576705Slukem $run $mkdir "$gentop" 56421c576705Slukem exit_status=$? 56431c576705Slukem if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 56441c576705Slukem exit $exit_status 56451c576705Slukem fi 56461c576705Slukem fi 56471c576705Slukem 56481c576705Slukem save_oldobjs=$oldobjs 56491c576705Slukem oldobjs= 56501c576705Slukem counter=1 56511c576705Slukem for obj in $save_oldobjs 56521c576705Slukem do 5653*6ca3cd61Sagc objbase=`$ECHO "X$obj" | $Xsed -e 's%^.*/%%'` 56541c576705Slukem case " $oldobjs " in 56551c576705Slukem " ") oldobjs=$obj ;; 56561c576705Slukem *[\ /]"$objbase "*) 56571c576705Slukem while :; do 56581c576705Slukem # Make sure we don't pick an alternate name that also 56591c576705Slukem # overlaps. 56601c576705Slukem newobj=lt$counter-$objbase 56611c576705Slukem counter=`expr $counter + 1` 56621c576705Slukem case " $oldobjs " in 56631c576705Slukem *[\ /]"$newobj "*) ;; 56641c576705Slukem *) if test ! -f "$gentop/$newobj"; then break; fi ;; 56651c576705Slukem esac 56661c576705Slukem done 56671c576705Slukem $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 56681c576705Slukem $run ln "$obj" "$gentop/$newobj" || 56691c576705Slukem $run cp "$obj" "$gentop/$newobj" 56701c576705Slukem oldobjs="$oldobjs $gentop/$newobj" 56711c576705Slukem ;; 56721c576705Slukem *) oldobjs="$oldobjs $obj" ;; 56731c576705Slukem esac 56741c576705Slukem done 56751c576705Slukem fi 56761c576705Slukem 56771c576705Slukem eval cmds=\"$old_archive_cmds\" 56781c576705Slukem 56791c576705Slukem if len=`expr "X$cmds" : ".*"` && 56801c576705Slukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 56811c576705Slukem cmds=$old_archive_cmds 56821c576705Slukem else 56831c576705Slukem # the command line is too long to link in one step, link in parts 5684*6ca3cd61Sagc $ECHO "using piecewise archive linking..." 56851c576705Slukem save_RANLIB=$RANLIB 56861c576705Slukem RANLIB=: 56871c576705Slukem objlist= 56881c576705Slukem concat_cmds= 56891c576705Slukem save_oldobjs=$oldobjs 56901c576705Slukem 56911c576705Slukem # Is there a better way of finding the last object in the list? 56921c576705Slukem for obj in $save_oldobjs 56931c576705Slukem do 56941c576705Slukem last_oldobj=$obj 56951c576705Slukem done 56961c576705Slukem for obj in $save_oldobjs 56971c576705Slukem do 56981c576705Slukem oldobjs="$objlist $obj" 56991c576705Slukem objlist="$objlist $obj" 57001c576705Slukem eval test_cmds=\"$old_archive_cmds\" 57011c576705Slukem if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 57021c576705Slukem test "$len" -le "$max_cmd_len"; then 57031c576705Slukem : 57041c576705Slukem else 57051c576705Slukem # the above command should be used before it gets too long 57061c576705Slukem oldobjs=$objlist 57071c576705Slukem if test "$obj" = "$last_oldobj" ; then 57081c576705Slukem RANLIB=$save_RANLIB 57091c576705Slukem fi 57101c576705Slukem test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 57111c576705Slukem eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 57121c576705Slukem objlist= 57131c576705Slukem fi 57141c576705Slukem done 57151c576705Slukem RANLIB=$save_RANLIB 57161c576705Slukem oldobjs=$objlist 57171c576705Slukem if test "X$oldobjs" = "X" ; then 57181c576705Slukem eval cmds=\"\$concat_cmds\" 57191c576705Slukem else 57201c576705Slukem eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 57211c576705Slukem fi 57221c576705Slukem fi 57231c576705Slukem fi 57241c576705Slukem save_ifs="$IFS"; IFS='~' 57251c576705Slukem for cmd in $cmds; do 57261c576705Slukem eval cmd=\"$cmd\" 57271c576705Slukem IFS="$save_ifs" 57281c576705Slukem $show "$cmd" 57291c576705Slukem $run eval "$cmd" || exit $? 57301c576705Slukem done 57311c576705Slukem IFS="$save_ifs" 57321c576705Slukem done 57331c576705Slukem 57341c576705Slukem if test -n "$generated"; then 57351c576705Slukem $show "${rm}r$generated" 57361c576705Slukem $run ${rm}r$generated 57371c576705Slukem fi 57381c576705Slukem 57391c576705Slukem # Now create the libtool archive. 57401c576705Slukem case $output in 57411c576705Slukem *.la) 57421c576705Slukem old_library= 57431c576705Slukem test "$build_old_libs" = yes && old_library="$libname.$libext" 57441c576705Slukem $show "creating $output" 57451c576705Slukem 57461c576705Slukem # Preserve any variables that may affect compiler behavior 57471c576705Slukem for var in $variables_saved_for_relink; do 57481c576705Slukem if eval test -z \"\${$var+set}\"; then 57491c576705Slukem relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 57501c576705Slukem elif eval var_value=\$$var; test -z "$var_value"; then 57511c576705Slukem relink_command="$var=; export $var; $relink_command" 57521c576705Slukem else 5753*6ca3cd61Sagc var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"` 57541c576705Slukem relink_command="$var=\"$var_value\"; export $var; $relink_command" 57551c576705Slukem fi 57561c576705Slukem done 57571c576705Slukem # Quote the link command for shipping. 57581c576705Slukem relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5759*6ca3cd61Sagc relink_command=`$ECHO "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 57601c576705Slukem if test "$hardcode_automatic" = yes ; then 57611c576705Slukem relink_command= 57621c576705Slukem fi 57631c576705Slukem 57641c576705Slukem 57651c576705Slukem # Only create the output if not a dry run. 57661c576705Slukem if test -z "$run"; then 57671c576705Slukem for installed in no yes; do 57681c576705Slukem if test "$installed" = yes; then 57691c576705Slukem if test -z "$install_libdir"; then 57701c576705Slukem break 57711c576705Slukem fi 57721c576705Slukem output="$output_objdir/$outputname"i 57731c576705Slukem # Replace all uninstalled libtool libraries with the installed ones 57741c576705Slukem newdependency_libs= 57751c576705Slukem for deplib in $dependency_libs; do 57761c576705Slukem case $deplib in 57771c576705Slukem *.la) 5778*6ca3cd61Sagc name=`$ECHO "X$deplib" | $Xsed -e 's%^.*/%%'` 57791c576705Slukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 57801c576705Slukem if test -z "$libdir"; then 5781*6ca3cd61Sagc $ECHO "$modename: \`$deplib' is not a valid libtool archive" 1>&2 57821c576705Slukem exit $EXIT_FAILURE 57831c576705Slukem fi 57841c576705Slukem newdependency_libs="$newdependency_libs $libdir/$name" 57851c576705Slukem ;; 57861c576705Slukem *) newdependency_libs="$newdependency_libs $deplib" ;; 57871c576705Slukem esac 57881c576705Slukem done 57891c576705Slukem dependency_libs="$newdependency_libs" 57901c576705Slukem newdlfiles= 57911c576705Slukem for lib in $dlfiles; do 5792*6ca3cd61Sagc name=`$ECHO "X$lib" | $Xsed -e 's%^.*/%%'` 57931c576705Slukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57941c576705Slukem if test -z "$libdir"; then 5795*6ca3cd61Sagc $ECHO "$modename: \`$lib' is not a valid libtool archive" 1>&2 57961c576705Slukem exit $EXIT_FAILURE 57971c576705Slukem fi 57981c576705Slukem newdlfiles="$newdlfiles $libdir/$name" 57991c576705Slukem done 58001c576705Slukem dlfiles="$newdlfiles" 58011c576705Slukem newdlprefiles= 58021c576705Slukem for lib in $dlprefiles; do 5803*6ca3cd61Sagc name=`$ECHO "X$lib" | $Xsed -e 's%^.*/%%'` 58041c576705Slukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 58051c576705Slukem if test -z "$libdir"; then 5806*6ca3cd61Sagc $ECHO "$modename: \`$lib' is not a valid libtool archive" 1>&2 58071c576705Slukem exit $EXIT_FAILURE 58081c576705Slukem fi 58091c576705Slukem newdlprefiles="$newdlprefiles $libdir/$name" 58101c576705Slukem done 58111c576705Slukem dlprefiles="$newdlprefiles" 58121c576705Slukem else 58131c576705Slukem newdlfiles= 58141c576705Slukem for lib in $dlfiles; do 58151c576705Slukem case $lib in 58161c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 58171c576705Slukem *) abs=`pwd`"/$lib" ;; 58181c576705Slukem esac 58191c576705Slukem newdlfiles="$newdlfiles $abs" 58201c576705Slukem done 58211c576705Slukem dlfiles="$newdlfiles" 58221c576705Slukem newdlprefiles= 58231c576705Slukem for lib in $dlprefiles; do 58241c576705Slukem case $lib in 58251c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 58261c576705Slukem *) abs=`pwd`"/$lib" ;; 58271c576705Slukem esac 58281c576705Slukem newdlprefiles="$newdlprefiles $abs" 58291c576705Slukem done 58301c576705Slukem dlprefiles="$newdlprefiles" 58311c576705Slukem fi 58321c576705Slukem $rm $output 58331c576705Slukem # place dlname in correct position for cygwin 58341c576705Slukem tdlname=$dlname 58351c576705Slukem case $host,$output,$installed,$module,$dlname in 58361c576705Slukem *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 58371c576705Slukem esac 5838*6ca3cd61Sagc $ECHO > $output "\ 58391c576705Slukem# $outputname - a libtool library file 58401c576705Slukem# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 58411c576705Slukem# 58421c576705Slukem# Please DO NOT delete this file! 58431c576705Slukem# It is necessary for linking the library. 58441c576705Slukem 58451c576705Slukem# The name that we can dlopen(3). 58461c576705Slukemdlname='$tdlname' 58471c576705Slukem 58481c576705Slukem# Names of this library. 58491c576705Slukemlibrary_names='$library_names' 58501c576705Slukem 58511c576705Slukem# The name of the static archive. 58521c576705Slukemold_library='$old_library' 58531c576705Slukem 58541c576705Slukem# Libraries that this one depends upon. 58551c576705Slukemdependency_libs='$dependency_libs' 58561c576705Slukem 58571c576705Slukem# Version information for $libname. 58581c576705Slukemcurrent=$current 58591c576705Slukemage=$age 58601c576705Slukemrevision=$revision 58611c576705Slukem 58621c576705Slukem# Is this an already installed library? 58631c576705Slukeminstalled=$installed 58641c576705Slukem 58651c576705Slukem# Should we warn about portability when linking against -modules? 58661c576705Slukemshouldnotlink=$module 58671c576705Slukem 58681c576705Slukem# Files to dlopen/dlpreopen 58691c576705Slukemdlopen='$dlfiles' 58701c576705Slukemdlpreopen='$dlprefiles' 58711c576705Slukem 58721c576705Slukem# Directory that this library needs to be installed in: 58731c576705Slukemlibdir='$install_libdir'" 58741c576705Slukem if test "$installed" = no && test "$need_relink" = yes; then 5875*6ca3cd61Sagc $ECHO >> $output "\ 58761c576705Slukemrelink_command=\"$relink_command\"" 58771c576705Slukem fi 58781c576705Slukem done 58791c576705Slukem fi 58801c576705Slukem 58811c576705Slukem # Do a symbolic link so that the libtool archive can be found in 58821c576705Slukem # LD_LIBRARY_PATH before the program is installed. 58831c576705Slukem $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 58841c576705Slukem $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 58851c576705Slukem ;; 58861c576705Slukem esac 58871c576705Slukem exit $EXIT_SUCCESS 58881c576705Slukem ;; 58891c576705Slukem 58901c576705Slukem # libtool install mode 58911c576705Slukem install) 58921c576705Slukem modename="$modename: install" 58931c576705Slukem 58941c576705Slukem # There may be an optional sh(1) argument at the beginning of 58951c576705Slukem # install_prog (especially on Windows NT). 58961c576705Slukem if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 58971c576705Slukem # Allow the use of GNU shtool's install command. 5898*6ca3cd61Sagc $ECHO "X$nonopt" | grep shtool > /dev/null; then 58991c576705Slukem # Aesthetically quote it. 5900*6ca3cd61Sagc arg=`$ECHO "X$nonopt" | $Xsed -e "$sed_quote_subst"` 59011c576705Slukem case $arg in 59021c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59031c576705Slukem arg="\"$arg\"" 59041c576705Slukem ;; 59051c576705Slukem esac 59061c576705Slukem install_prog="$arg " 59071c576705Slukem arg="$1" 59081c576705Slukem shift 59091c576705Slukem else 59101c576705Slukem install_prog= 59111c576705Slukem arg=$nonopt 59121c576705Slukem fi 59131c576705Slukem 59141c576705Slukem # The real first argument should be the name of the installation program. 59151c576705Slukem # Aesthetically quote it. 5916*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"` 59171c576705Slukem case $arg in 59181c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59191c576705Slukem arg="\"$arg\"" 59201c576705Slukem ;; 59211c576705Slukem esac 59221c576705Slukem install_prog="$install_prog$arg" 59231c576705Slukem 59241c576705Slukem # We need to accept at least all the BSD install flags. 59251c576705Slukem dest= 59261c576705Slukem files= 59271c576705Slukem opts= 59281c576705Slukem prev= 59291c576705Slukem install_type= 59301c576705Slukem isdir=no 59311c576705Slukem stripme= 59321c576705Slukem for arg 59331c576705Slukem do 59341c576705Slukem if test -n "$dest"; then 59351c576705Slukem files="$files $dest" 59361c576705Slukem dest=$arg 59371c576705Slukem continue 59381c576705Slukem fi 59391c576705Slukem 59401c576705Slukem case $arg in 59411c576705Slukem -d) isdir=yes ;; 59421c576705Slukem -f) 59431c576705Slukem case " $install_prog " in 59441c576705Slukem *[\\\ /]cp\ *) ;; 59451c576705Slukem *) prev=$arg ;; 59461c576705Slukem esac 59471c576705Slukem ;; 59481c576705Slukem -g | -m | -o) prev=$arg ;; 59491c576705Slukem -s) 59501c576705Slukem stripme=" -s" 59511c576705Slukem continue 59521c576705Slukem ;; 59531c576705Slukem -*) 59541c576705Slukem ;; 59551c576705Slukem *) 59561c576705Slukem # If the previous option needed an argument, then skip it. 59571c576705Slukem if test -n "$prev"; then 59581c576705Slukem prev= 59591c576705Slukem else 59601c576705Slukem dest=$arg 59611c576705Slukem continue 59621c576705Slukem fi 59631c576705Slukem ;; 59641c576705Slukem esac 59651c576705Slukem 59661c576705Slukem # Aesthetically quote the argument. 5967*6ca3cd61Sagc arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"` 59681c576705Slukem case $arg in 59691c576705Slukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 59701c576705Slukem arg="\"$arg\"" 59711c576705Slukem ;; 59721c576705Slukem esac 59731c576705Slukem install_prog="$install_prog $arg" 59741c576705Slukem done 59751c576705Slukem 59761c576705Slukem if test -z "$install_prog"; then 5977*6ca3cd61Sagc $ECHO "$modename: you must specify an install program" 1>&2 5978*6ca3cd61Sagc $ECHO "$help" 1>&2 59791c576705Slukem exit $EXIT_FAILURE 59801c576705Slukem fi 59811c576705Slukem 59821c576705Slukem if test -n "$prev"; then 5983*6ca3cd61Sagc $ECHO "$modename: the \`$prev' option requires an argument" 1>&2 5984*6ca3cd61Sagc $ECHO "$help" 1>&2 59851c576705Slukem exit $EXIT_FAILURE 59861c576705Slukem fi 59871c576705Slukem 59881c576705Slukem if test -z "$files"; then 59891c576705Slukem if test -z "$dest"; then 5990*6ca3cd61Sagc $ECHO "$modename: no file or destination specified" 1>&2 59911c576705Slukem else 5992*6ca3cd61Sagc $ECHO "$modename: you must specify a destination" 1>&2 59931c576705Slukem fi 5994*6ca3cd61Sagc $ECHO "$help" 1>&2 59951c576705Slukem exit $EXIT_FAILURE 59961c576705Slukem fi 59971c576705Slukem 59981c576705Slukem # Canonicalise the pathname: 59991c576705Slukem # - remove foo/../ 60001c576705Slukem # - replace // 60011c576705Slukem # - remove /./ 60021c576705Slukem # - strip any trailing / 60031c576705Slukem tmp="" 60041c576705Slukem while test "$dest" != "$tmp"; do 60051c576705Slukem tmp=$dest 6006*6ca3cd61Sagc dest=`$ECHO "X$dest" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'` 60071c576705Slukem done 60081c576705Slukem 60091c576705Slukem # Check to see that the destination is a directory. 60101c576705Slukem test -d "$dest" && isdir=yes 60111c576705Slukem if test "$isdir" = yes; then 60121c576705Slukem destdir="$dest" 60131c576705Slukem destname= 60141c576705Slukem else 6015*6ca3cd61Sagc destdir=`$ECHO "X$dest" | $Xsed -e 's%/[^/]*$%%'` 60161c576705Slukem test "X$destdir" = "X$dest" && destdir=. 6017*6ca3cd61Sagc destname=`$ECHO "X$dest" | $Xsed -e 's%^.*/%%'` 60181c576705Slukem 60191c576705Slukem # Not a directory, so check to see that there is only one file specified. 60201c576705Slukem set dummy $files 60211c576705Slukem if test "$#" -gt 2; then 6022*6ca3cd61Sagc $ECHO "$modename: \`$dest' is not a directory" 1>&2 6023*6ca3cd61Sagc $ECHO "$help" 1>&2 60241c576705Slukem exit $EXIT_FAILURE 60251c576705Slukem fi 60261c576705Slukem fi 60271c576705Slukem case $destdir in 60281c576705Slukem [\\/]* | [A-Za-z]:[\\/]*) ;; 60291c576705Slukem *) 60301c576705Slukem for file in $files; do 60311c576705Slukem case $file in 60321c576705Slukem *.lo) ;; 60331c576705Slukem *) 6034*6ca3cd61Sagc $ECHO "$modename: \`$destdir' must be an absolute directory name" 1>&2 6035*6ca3cd61Sagc $ECHO "$help" 1>&2 60361c576705Slukem exit $EXIT_FAILURE 60371c576705Slukem ;; 60381c576705Slukem esac 60391c576705Slukem done 60401c576705Slukem ;; 60411c576705Slukem esac 60421c576705Slukem 60431c576705Slukem # This variable tells wrapper scripts just to set variables rather 60441c576705Slukem # than running their programs. 60451c576705Slukem libtool_install_magic="$magic" 60461c576705Slukem 60471c576705Slukem staticlibs= 60481c576705Slukem future_libdirs= 60491c576705Slukem current_libdirs= 60501c576705Slukem for file in $files; do 60511c576705Slukem 60521c576705Slukem # Do each installation. 60531c576705Slukem case $file in 60541c576705Slukem *.$libext) 60551c576705Slukem # Do the static libraries later. 60561c576705Slukem staticlibs="$staticlibs $file" 60571c576705Slukem ;; 60581c576705Slukem 60591c576705Slukem *.la) 60601c576705Slukem # Check to see that this really is a libtool archive. 60611c576705Slukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 60621c576705Slukem else 6063*6ca3cd61Sagc $ECHO "$modename: \`$file' is not a valid libtool archive" 1>&2 6064*6ca3cd61Sagc $ECHO "$help" 1>&2 60651c576705Slukem exit $EXIT_FAILURE 60661c576705Slukem fi 60671c576705Slukem 60681c576705Slukem library_names= 60691c576705Slukem old_library= 60701c576705Slukem relink_command= 60711c576705Slukem # If there is no directory component, then add one. 60721c576705Slukem case $file in 60731c576705Slukem */* | *\\*) . $file ;; 60741c576705Slukem *) . ./$file ;; 60751c576705Slukem esac 60761c576705Slukem 60771c576705Slukem # Add the libdir to current_libdirs if it is the destination. 60781c576705Slukem if test "X$destdir" = "X$libdir"; then 60791c576705Slukem case "$current_libdirs " in 60801c576705Slukem *" $libdir "*) ;; 60811c576705Slukem *) current_libdirs="$current_libdirs $libdir" ;; 60821c576705Slukem esac 60831c576705Slukem else 60841c576705Slukem # Note the libdir as a future libdir. 60851c576705Slukem case "$future_libdirs " in 60861c576705Slukem *" $libdir "*) ;; 60871c576705Slukem *) future_libdirs="$future_libdirs $libdir" ;; 60881c576705Slukem esac 60891c576705Slukem fi 60901c576705Slukem 6091*6ca3cd61Sagc dir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 60921c576705Slukem test "X$dir" = "X$file/" && dir= 60931c576705Slukem dir="$dir$objdir" 60941c576705Slukem 60951c576705Slukem if test -n "$relink_command"; then 60961c576705Slukem # Determine the prefix the user has applied to our future dir. 6097*6ca3cd61Sagc inst_prefix_dir=`$ECHO "$destdir" | $SED "s%$libdir\$%%"` 60981c576705Slukem 60991c576705Slukem # Don't allow the user to place us outside of our expected 61001c576705Slukem # location b/c this prevents finding dependent libraries that 61011c576705Slukem # are installed to the same prefix. 61021c576705Slukem # At present, this check doesn't affect windows .dll's that 61031c576705Slukem # are installed into $libdir/../bin (currently, that works fine) 61041c576705Slukem # but it's something to keep an eye on. 61051c576705Slukem if test "$inst_prefix_dir" = "$destdir"; then 6106*6ca3cd61Sagc $ECHO "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 61071c576705Slukem exit $EXIT_FAILURE 61081c576705Slukem fi 61091c576705Slukem 61101c576705Slukem if test -n "$inst_prefix_dir"; then 61111c576705Slukem # Stick the inst_prefix_dir data into the link command. 6112*6ca3cd61Sagc relink_command=`$ECHO "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 61131c576705Slukem else 6114*6ca3cd61Sagc relink_command=`$ECHO "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 61151c576705Slukem fi 61161c576705Slukem 6117*6ca3cd61Sagc $ECHO "$modename: warning: relinking \`$file'" 1>&2 61181c576705Slukem $show "$relink_command" 61191c576705Slukem if $run eval "$relink_command"; then : 61201c576705Slukem else 6121*6ca3cd61Sagc $ECHO "$modename: error: relink \`$file' with the above command before installing it" 1>&2 61221c576705Slukem exit $EXIT_FAILURE 61231c576705Slukem fi 61241c576705Slukem fi 61251c576705Slukem 61261c576705Slukem # See the names of the shared library. 61271c576705Slukem set dummy $library_names 61281c576705Slukem if test -n "$2"; then 61291c576705Slukem realname="$2" 61301c576705Slukem shift 61311c576705Slukem shift 61321c576705Slukem 61331c576705Slukem srcname="$realname" 61341c576705Slukem test -n "$relink_command" && srcname="$realname"T 61351c576705Slukem 61361c576705Slukem # Install the shared library and build the symlinks. 61371c576705Slukem $show "$install_prog $dir/$srcname $destdir/$realname" 61381c576705Slukem $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 61391c576705Slukem if test -n "$stripme" && test -n "$striplib"; then 61401c576705Slukem $show "$striplib $destdir/$realname" 61411c576705Slukem $run eval "$striplib $destdir/$realname" || exit $? 61421c576705Slukem fi 61431c576705Slukem 61441c576705Slukem if test "$#" -gt 0; then 61451c576705Slukem # Delete the old symlinks, and create new ones. 61461c576705Slukem # Try `ln -sf' first, because the `ln' binary might depend on 61471c576705Slukem # the symlink we replace! Solaris /bin/ln does not understand -f, 61481c576705Slukem # so we also need to try rm && ln -s. 61491c576705Slukem for linkname 61501c576705Slukem do 61511c576705Slukem if test "$linkname" != "$realname"; then 61521c576705Slukem $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 61531c576705Slukem $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 61541c576705Slukem fi 61551c576705Slukem done 61561c576705Slukem fi 61571c576705Slukem 61581c576705Slukem # Do each command in the postinstall commands. 61591c576705Slukem lib="$destdir/$realname" 61601c576705Slukem cmds=$postinstall_cmds 61611c576705Slukem save_ifs="$IFS"; IFS='~' 61621c576705Slukem for cmd in $cmds; do 61631c576705Slukem IFS="$save_ifs" 61641c576705Slukem eval cmd=\"$cmd\" 61651c576705Slukem $show "$cmd" 61661c576705Slukem $run eval "$cmd" || { 61671c576705Slukem lt_exit=$? 61681c576705Slukem 61691c576705Slukem # Restore the uninstalled library and exit 61701c576705Slukem if test "$mode" = relink; then 61711c576705Slukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 61721c576705Slukem fi 61731c576705Slukem 61741c576705Slukem exit $lt_exit 61751c576705Slukem } 61761c576705Slukem done 61771c576705Slukem IFS="$save_ifs" 61781c576705Slukem fi 61791c576705Slukem 61801c576705Slukem # Install the pseudo-library for information purposes. 6181*6ca3cd61Sagc name=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` 61821c576705Slukem instname="$dir/$name"i 61831c576705Slukem $show "$install_prog $instname $destdir/$name" 61841c576705Slukem $run eval "$install_prog $instname $destdir/$name" || exit $? 61851c576705Slukem 61861c576705Slukem # Maybe install the static library, too. 61871c576705Slukem test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 61881c576705Slukem ;; 61891c576705Slukem 61901c576705Slukem *.lo) 61911c576705Slukem # Install (i.e. copy) a libtool object. 61921c576705Slukem 61931c576705Slukem # Figure out destination file name, if it wasn't already specified. 61941c576705Slukem if test -n "$destname"; then 61951c576705Slukem destfile="$destdir/$destname" 61961c576705Slukem else 6197*6ca3cd61Sagc destfile=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` 61981c576705Slukem destfile="$destdir/$destfile" 61991c576705Slukem fi 62001c576705Slukem 62011c576705Slukem # Deduce the name of the destination old-style object file. 62021c576705Slukem case $destfile in 62031c576705Slukem *.lo) 6204*6ca3cd61Sagc staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"` 62051c576705Slukem ;; 62061c576705Slukem *.$objext) 62071c576705Slukem staticdest="$destfile" 62081c576705Slukem destfile= 62091c576705Slukem ;; 62101c576705Slukem *) 6211*6ca3cd61Sagc $ECHO "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6212*6ca3cd61Sagc $ECHO "$help" 1>&2 62131c576705Slukem exit $EXIT_FAILURE 62141c576705Slukem ;; 62151c576705Slukem esac 62161c576705Slukem 62171c576705Slukem # Install the libtool object if requested. 62181c576705Slukem if test -n "$destfile"; then 62191c576705Slukem $show "$install_prog $file $destfile" 62201c576705Slukem $run eval "$install_prog $file $destfile" || exit $? 62211c576705Slukem fi 62221c576705Slukem 62231c576705Slukem # Install the old object if enabled. 62241c576705Slukem if test "$build_old_libs" = yes; then 62251c576705Slukem # Deduce the name of the old-style object file. 6226*6ca3cd61Sagc staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"` 62271c576705Slukem 62281c576705Slukem $show "$install_prog $staticobj $staticdest" 62291c576705Slukem $run eval "$install_prog \$staticobj \$staticdest" || exit $? 62301c576705Slukem fi 62311c576705Slukem exit $EXIT_SUCCESS 62321c576705Slukem ;; 62331c576705Slukem 62341c576705Slukem *) 62351c576705Slukem # Figure out destination file name, if it wasn't already specified. 62361c576705Slukem if test -n "$destname"; then 62371c576705Slukem destfile="$destdir/$destname" 62381c576705Slukem else 6239*6ca3cd61Sagc destfile=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` 62401c576705Slukem destfile="$destdir/$destfile" 62411c576705Slukem fi 62421c576705Slukem 62431c576705Slukem # If the file is missing, and there is a .exe on the end, strip it 62441c576705Slukem # because it is most likely a libtool script we actually want to 62451c576705Slukem # install 62461c576705Slukem stripped_ext="" 62471c576705Slukem case $file in 62481c576705Slukem *.exe) 62491c576705Slukem if test ! -f "$file"; then 6250*6ca3cd61Sagc file=`$ECHO $file|${SED} 's,.exe$,,'` 62511c576705Slukem stripped_ext=".exe" 62521c576705Slukem fi 62531c576705Slukem ;; 62541c576705Slukem esac 62551c576705Slukem 62561c576705Slukem # Do a test to see if this is really a libtool program. 62571c576705Slukem case $host in 62581c576705Slukem *cygwin*|*mingw*) 6259*6ca3cd61Sagc wrapper=`$ECHO $file | ${SED} -e 's,.exe$,,'` 62601c576705Slukem ;; 62611c576705Slukem *) 62621c576705Slukem wrapper=$file 62631c576705Slukem ;; 62641c576705Slukem esac 62651c576705Slukem if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 62661c576705Slukem notinst_deplibs= 62671c576705Slukem relink_command= 62681c576705Slukem 62691c576705Slukem # Note that it is not necessary on cygwin/mingw to append a dot to 62701c576705Slukem # foo even if both foo and FILE.exe exist: automatic-append-.exe 62711c576705Slukem # behavior happens only for exec(3), not for open(2)! Also, sourcing 62721c576705Slukem # `FILE.' does not work on cygwin managed mounts. 62731c576705Slukem # 62741c576705Slukem # If there is no directory component, then add one. 62751c576705Slukem case $wrapper in 62761c576705Slukem */* | *\\*) . ${wrapper} ;; 62771c576705Slukem *) . ./${wrapper} ;; 62781c576705Slukem esac 62791c576705Slukem 62801c576705Slukem # Check the variables that should have been set. 62811c576705Slukem if test -z "$notinst_deplibs"; then 6282*6ca3cd61Sagc $ECHO "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 62831c576705Slukem exit $EXIT_FAILURE 62841c576705Slukem fi 62851c576705Slukem 62861c576705Slukem finalize=yes 62871c576705Slukem for lib in $notinst_deplibs; do 62881c576705Slukem # Check to see that each library is installed. 62891c576705Slukem libdir= 62901c576705Slukem if test -f "$lib"; then 62911c576705Slukem # If there is no directory component, then add one. 62921c576705Slukem case $lib in 62931c576705Slukem */* | *\\*) . $lib ;; 62941c576705Slukem *) . ./$lib ;; 62951c576705Slukem esac 62961c576705Slukem fi 6297*6ca3cd61Sagc libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 62981c576705Slukem if test -n "$libdir" && test ! -f "$libfile"; then 6299*6ca3cd61Sagc $ECHO "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 63001c576705Slukem finalize=no 63011c576705Slukem fi 63021c576705Slukem done 63031c576705Slukem 63041c576705Slukem relink_command= 63051c576705Slukem # Note that it is not necessary on cygwin/mingw to append a dot to 63061c576705Slukem # foo even if both foo and FILE.exe exist: automatic-append-.exe 63071c576705Slukem # behavior happens only for exec(3), not for open(2)! Also, sourcing 63081c576705Slukem # `FILE.' does not work on cygwin managed mounts. 63091c576705Slukem # 63101c576705Slukem # If there is no directory component, then add one. 63111c576705Slukem case $wrapper in 63121c576705Slukem */* | *\\*) . ${wrapper} ;; 63131c576705Slukem *) . ./${wrapper} ;; 63141c576705Slukem esac 63151c576705Slukem 63161c576705Slukem outputname= 63171c576705Slukem if test "$fast_install" = no && test -n "$relink_command"; then 63181c576705Slukem if test "$finalize" = yes && test -z "$run"; then 63191c576705Slukem tmpdir=`func_mktempdir` 6320*6ca3cd61Sagc file=`$ECHO "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 63211c576705Slukem outputname="$tmpdir/$file" 63221c576705Slukem # Replace the output file specification. 6323*6ca3cd61Sagc relink_command=`$ECHO "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 63241c576705Slukem 63251c576705Slukem $show "$relink_command" 63261c576705Slukem if $run eval "$relink_command"; then : 63271c576705Slukem else 6328*6ca3cd61Sagc $ECHO "$modename: error: relink \`$file' with the above command before installing it" 1>&2 63291c576705Slukem ${rm}r "$tmpdir" 63301c576705Slukem continue 63311c576705Slukem fi 63321c576705Slukem file="$outputname" 63331c576705Slukem else 6334*6ca3cd61Sagc $ECHO "$modename: warning: cannot relink \`$file'" 1>&2 63351c576705Slukem fi 63361c576705Slukem else 63371c576705Slukem # Install the binary that we compiled earlier. 6338*6ca3cd61Sagc file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 63391c576705Slukem fi 63401c576705Slukem fi 63411c576705Slukem 63421c576705Slukem # remove .exe since cygwin /usr/bin/install will append another 63431c576705Slukem # one anyway 63441c576705Slukem case $install_prog,$host in 63451c576705Slukem */usr/bin/install*,*cygwin*) 63461c576705Slukem case $file:$destfile in 63471c576705Slukem *.exe:*.exe) 63481c576705Slukem # this is ok 63491c576705Slukem ;; 63501c576705Slukem *.exe:*) 63511c576705Slukem destfile=$destfile.exe 63521c576705Slukem ;; 63531c576705Slukem *:*.exe) 6354*6ca3cd61Sagc destfile=`$ECHO $destfile | ${SED} -e 's,.exe$,,'` 63551c576705Slukem ;; 63561c576705Slukem esac 63571c576705Slukem ;; 63581c576705Slukem esac 63591c576705Slukem $show "$install_prog$stripme $file $destfile" 63601c576705Slukem $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 63611c576705Slukem test -n "$outputname" && ${rm}r "$tmpdir" 63621c576705Slukem ;; 63631c576705Slukem esac 63641c576705Slukem done 63651c576705Slukem 63661c576705Slukem for file in $staticlibs; do 6367*6ca3cd61Sagc name=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` 63681c576705Slukem 63691c576705Slukem # Set up the ranlib parameters. 63701c576705Slukem oldlib="$destdir/$name" 63711c576705Slukem 63721c576705Slukem $show "$install_prog $file $oldlib" 63731c576705Slukem $run eval "$install_prog \$file \$oldlib" || exit $? 63741c576705Slukem 63751c576705Slukem if test -n "$stripme" && test -n "$old_striplib"; then 63761c576705Slukem $show "$old_striplib $oldlib" 63771c576705Slukem $run eval "$old_striplib $oldlib" || exit $? 63781c576705Slukem fi 63791c576705Slukem 63801c576705Slukem # Do each command in the postinstall commands. 63811c576705Slukem cmds=$old_postinstall_cmds 63821c576705Slukem save_ifs="$IFS"; IFS='~' 63831c576705Slukem for cmd in $cmds; do 63841c576705Slukem IFS="$save_ifs" 63851c576705Slukem eval cmd=\"$cmd\" 63861c576705Slukem $show "$cmd" 63871c576705Slukem $run eval "$cmd" || exit $? 63881c576705Slukem done 63891c576705Slukem IFS="$save_ifs" 63901c576705Slukem done 63911c576705Slukem 63921c576705Slukem if test -n "$future_libdirs"; then 6393*6ca3cd61Sagc $ECHO "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 63941c576705Slukem fi 63951c576705Slukem 63961c576705Slukem if test -n "$current_libdirs"; then 63971c576705Slukem # Maybe just do a dry run. 63981c576705Slukem test -n "$run" && current_libdirs=" -n$current_libdirs" 63991c576705Slukem exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 64001c576705Slukem else 64011c576705Slukem exit $EXIT_SUCCESS 64021c576705Slukem fi 64031c576705Slukem ;; 64041c576705Slukem 64051c576705Slukem # libtool finish mode 64061c576705Slukem finish) 64071c576705Slukem modename="$modename: finish" 64081c576705Slukem libdirs="$nonopt" 64091c576705Slukem admincmds= 64101c576705Slukem 64111c576705Slukem if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 64121c576705Slukem for dir 64131c576705Slukem do 64141c576705Slukem libdirs="$libdirs $dir" 64151c576705Slukem done 64161c576705Slukem 64171c576705Slukem for libdir in $libdirs; do 64181c576705Slukem if test -n "$finish_cmds"; then 64191c576705Slukem # Do each command in the finish commands. 64201c576705Slukem cmds=$finish_cmds 64211c576705Slukem save_ifs="$IFS"; IFS='~' 64221c576705Slukem for cmd in $cmds; do 64231c576705Slukem IFS="$save_ifs" 64241c576705Slukem eval cmd=\"$cmd\" 64251c576705Slukem $show "$cmd" 64261c576705Slukem $run eval "$cmd" || admincmds="$admincmds 64271c576705Slukem $cmd" 64281c576705Slukem done 64291c576705Slukem IFS="$save_ifs" 64301c576705Slukem fi 64311c576705Slukem if test -n "$finish_eval"; then 64321c576705Slukem # Do the single finish_eval. 64331c576705Slukem eval cmds=\"$finish_eval\" 64341c576705Slukem $run eval "$cmds" || admincmds="$admincmds 64351c576705Slukem $cmds" 64361c576705Slukem fi 64371c576705Slukem done 64381c576705Slukem fi 64391c576705Slukem 64401c576705Slukem # Exit here if they wanted silent mode. 64411c576705Slukem test "$show" = : && exit $EXIT_SUCCESS 64421c576705Slukem 6443*6ca3cd61Sagc $ECHO "X----------------------------------------------------------------------" | $Xsed 6444*6ca3cd61Sagc $ECHO "Libraries have been installed in:" 64451c576705Slukem for libdir in $libdirs; do 6446*6ca3cd61Sagc $ECHO " $libdir" 64471c576705Slukem done 6448*6ca3cd61Sagc $ECHO 6449*6ca3cd61Sagc $ECHO "If you ever happen to want to link against installed libraries" 6450*6ca3cd61Sagc $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 6451*6ca3cd61Sagc $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 6452*6ca3cd61Sagc $ECHO "flag during linking and do at least one of the following:" 64531c576705Slukem if test -n "$shlibpath_var"; then 6454*6ca3cd61Sagc $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 6455*6ca3cd61Sagc $ECHO " during execution" 64561c576705Slukem fi 64571c576705Slukem if test -n "$runpath_var"; then 6458*6ca3cd61Sagc $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 6459*6ca3cd61Sagc $ECHO " during linking" 64601c576705Slukem fi 64611c576705Slukem if test -n "$hardcode_libdir_flag_spec"; then 64621c576705Slukem libdir=LIBDIR 64631c576705Slukem eval flag=\"$hardcode_libdir_flag_spec\" 64641c576705Slukem 6465*6ca3cd61Sagc $ECHO " - use the \`$flag' linker flag" 64661c576705Slukem fi 64671c576705Slukem if test -n "$admincmds"; then 6468*6ca3cd61Sagc $ECHO " - have your system administrator run these commands:$admincmds" 64691c576705Slukem fi 64701c576705Slukem if test -f /etc/ld.so.conf; then 6471*6ca3cd61Sagc $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 64721c576705Slukem fi 6473*6ca3cd61Sagc $ECHO 6474*6ca3cd61Sagc $ECHO "See any operating system documentation about shared libraries for" 6475*6ca3cd61Sagc $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 6476*6ca3cd61Sagc $ECHO "X----------------------------------------------------------------------" | $Xsed 64771c576705Slukem exit $EXIT_SUCCESS 64781c576705Slukem ;; 64791c576705Slukem 64801c576705Slukem # libtool execute mode 64811c576705Slukem execute) 64821c576705Slukem modename="$modename: execute" 64831c576705Slukem 64841c576705Slukem # The first argument is the command name. 64851c576705Slukem cmd="$nonopt" 64861c576705Slukem if test -z "$cmd"; then 6487*6ca3cd61Sagc $ECHO "$modename: you must specify a COMMAND" 1>&2 6488*6ca3cd61Sagc $ECHO "$help" 64891c576705Slukem exit $EXIT_FAILURE 64901c576705Slukem fi 64911c576705Slukem 64921c576705Slukem # Handle -dlopen flags immediately. 64931c576705Slukem for file in $execute_dlfiles; do 64941c576705Slukem if test ! -f "$file"; then 6495*6ca3cd61Sagc $ECHO "$modename: \`$file' is not a file" 1>&2 6496*6ca3cd61Sagc $ECHO "$help" 1>&2 64971c576705Slukem exit $EXIT_FAILURE 64981c576705Slukem fi 64991c576705Slukem 65001c576705Slukem dir= 65011c576705Slukem case $file in 65021c576705Slukem *.la) 65031c576705Slukem # Check to see that this really is a libtool archive. 65041c576705Slukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 65051c576705Slukem else 6506*6ca3cd61Sagc $ECHO "$modename: \`$lib' is not a valid libtool archive" 1>&2 6507*6ca3cd61Sagc $ECHO "$help" 1>&2 65081c576705Slukem exit $EXIT_FAILURE 65091c576705Slukem fi 65101c576705Slukem 65111c576705Slukem # Read the libtool library. 65121c576705Slukem dlname= 65131c576705Slukem library_names= 65141c576705Slukem 65151c576705Slukem # If there is no directory component, then add one. 65161c576705Slukem case $file in 65171c576705Slukem */* | *\\*) . $file ;; 65181c576705Slukem *) . ./$file ;; 65191c576705Slukem esac 65201c576705Slukem 65211c576705Slukem # Skip this library if it cannot be dlopened. 65221c576705Slukem if test -z "$dlname"; then 65231c576705Slukem # Warn if it was a shared library. 6524*6ca3cd61Sagc test -n "$library_names" && $ECHO "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 65251c576705Slukem continue 65261c576705Slukem fi 65271c576705Slukem 6528*6ca3cd61Sagc dir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'` 65291c576705Slukem test "X$dir" = "X$file" && dir=. 65301c576705Slukem 65311c576705Slukem if test -f "$dir/$objdir/$dlname"; then 65321c576705Slukem dir="$dir/$objdir" 65331c576705Slukem else 65341c576705Slukem if test ! -f "$dir/$dlname"; then 6535*6ca3cd61Sagc $ECHO "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 65361c576705Slukem exit $EXIT_FAILURE 65371c576705Slukem fi 65381c576705Slukem fi 65391c576705Slukem ;; 65401c576705Slukem 65411c576705Slukem *.lo) 65421c576705Slukem # Just add the directory containing the .lo file. 6543*6ca3cd61Sagc dir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'` 65441c576705Slukem test "X$dir" = "X$file" && dir=. 65451c576705Slukem ;; 65461c576705Slukem 65471c576705Slukem *) 6548*6ca3cd61Sagc $ECHO "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 65491c576705Slukem continue 65501c576705Slukem ;; 65511c576705Slukem esac 65521c576705Slukem 65531c576705Slukem # Get the absolute pathname. 65541c576705Slukem absdir=`cd "$dir" && pwd` 65551c576705Slukem test -n "$absdir" && dir="$absdir" 65561c576705Slukem 65571c576705Slukem # Now add the directory to shlibpath_var. 65581c576705Slukem if eval "test -z \"\$$shlibpath_var\""; then 65591c576705Slukem eval "$shlibpath_var=\"\$dir\"" 65601c576705Slukem else 65611c576705Slukem eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 65621c576705Slukem fi 65631c576705Slukem done 65641c576705Slukem 65651c576705Slukem # This variable tells wrapper scripts just to set shlibpath_var 65661c576705Slukem # rather than running their programs. 65671c576705Slukem libtool_execute_magic="$magic" 65681c576705Slukem 65691c576705Slukem # Check if any of the arguments is a wrapper script. 65701c576705Slukem args= 65711c576705Slukem for file 65721c576705Slukem do 65731c576705Slukem case $file in 65741c576705Slukem -*) ;; 65751c576705Slukem *) 65761c576705Slukem # Do a test to see if this is really a libtool program. 65771c576705Slukem if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65781c576705Slukem # If there is no directory component, then add one. 65791c576705Slukem case $file in 65801c576705Slukem */* | *\\*) . $file ;; 65811c576705Slukem *) . ./$file ;; 65821c576705Slukem esac 65831c576705Slukem 65841c576705Slukem # Transform arg to wrapped name. 65851c576705Slukem file="$progdir/$program" 65861c576705Slukem fi 65871c576705Slukem ;; 65881c576705Slukem esac 65891c576705Slukem # Quote arguments (to preserve shell metacharacters). 6590*6ca3cd61Sagc file=`$ECHO "X$file" | $Xsed -e "$sed_quote_subst"` 65911c576705Slukem args="$args \"$file\"" 65921c576705Slukem done 65931c576705Slukem 65941c576705Slukem if test -z "$run"; then 65951c576705Slukem if test -n "$shlibpath_var"; then 65961c576705Slukem # Export the shlibpath_var. 65971c576705Slukem eval "export $shlibpath_var" 65981c576705Slukem fi 65991c576705Slukem 66001c576705Slukem # Restore saved environment variables 66011c576705Slukem for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 66021c576705Slukem do 66031c576705Slukem eval "if test \"\${save_$lt_var+set}\" = set; then 66041c576705Slukem $lt_var=\$save_$lt_var; export $lt_var 66051c576705Slukem fi" 66061c576705Slukem done 66071c576705Slukem 66081c576705Slukem # Now prepare to actually exec the command. 66091c576705Slukem exec_cmd="\$cmd$args" 66101c576705Slukem else 66111c576705Slukem # Display what would be done. 66121c576705Slukem if test -n "$shlibpath_var"; then 6613*6ca3cd61Sagc eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 6614*6ca3cd61Sagc $ECHO "export $shlibpath_var" 66151c576705Slukem fi 6616*6ca3cd61Sagc $ECHO "$cmd$args" 66171c576705Slukem exit $EXIT_SUCCESS 66181c576705Slukem fi 66191c576705Slukem ;; 66201c576705Slukem 66211c576705Slukem # libtool clean and uninstall mode 66221c576705Slukem clean | uninstall) 66231c576705Slukem modename="$modename: $mode" 66241c576705Slukem rm="$nonopt" 66251c576705Slukem files= 66261c576705Slukem rmforce= 66271c576705Slukem exit_status=0 66281c576705Slukem 66291c576705Slukem # This variable tells wrapper scripts just to set variables rather 66301c576705Slukem # than running their programs. 66311c576705Slukem libtool_install_magic="$magic" 66321c576705Slukem 66331c576705Slukem for arg 66341c576705Slukem do 66351c576705Slukem case $arg in 66361c576705Slukem -f) rm="$rm $arg"; rmforce=yes ;; 66371c576705Slukem -*) rm="$rm $arg" ;; 66381c576705Slukem *) files="$files $arg" ;; 66391c576705Slukem esac 66401c576705Slukem done 66411c576705Slukem 66421c576705Slukem if test -z "$rm"; then 6643*6ca3cd61Sagc $ECHO "$modename: you must specify an RM program" 1>&2 6644*6ca3cd61Sagc $ECHO "$help" 1>&2 66451c576705Slukem exit $EXIT_FAILURE 66461c576705Slukem fi 66471c576705Slukem 66481c576705Slukem rmdirs= 66491c576705Slukem 66501c576705Slukem origobjdir="$objdir" 66511c576705Slukem for file in $files; do 6652*6ca3cd61Sagc dir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'` 66531c576705Slukem if test "X$dir" = "X$file"; then 66541c576705Slukem dir=. 66551c576705Slukem objdir="$origobjdir" 66561c576705Slukem else 66571c576705Slukem objdir="$dir/$origobjdir" 66581c576705Slukem fi 6659*6ca3cd61Sagc name=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` 66601c576705Slukem test "$mode" = uninstall && objdir="$dir" 66611c576705Slukem 66621c576705Slukem # Remember objdir for removal later, being careful to avoid duplicates 66631c576705Slukem if test "$mode" = clean; then 66641c576705Slukem case " $rmdirs " in 66651c576705Slukem *" $objdir "*) ;; 66661c576705Slukem *) rmdirs="$rmdirs $objdir" ;; 66671c576705Slukem esac 66681c576705Slukem fi 66691c576705Slukem 66701c576705Slukem # Don't error if the file doesn't exist and rm -f was used. 66711c576705Slukem if (test -L "$file") >/dev/null 2>&1 \ 66721c576705Slukem || (test -h "$file") >/dev/null 2>&1 \ 66731c576705Slukem || test -f "$file"; then 66741c576705Slukem : 66751c576705Slukem elif test -d "$file"; then 66761c576705Slukem exit_status=1 66771c576705Slukem continue 66781c576705Slukem elif test "$rmforce" = yes; then 66791c576705Slukem continue 66801c576705Slukem fi 66811c576705Slukem 66821c576705Slukem rmfiles="$file" 66831c576705Slukem 66841c576705Slukem case $name in 66851c576705Slukem *.la) 66861c576705Slukem # Possibly a libtool archive, so verify it. 66871c576705Slukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66881c576705Slukem . $dir/$name 66891c576705Slukem 66901c576705Slukem # Delete the libtool libraries and symlinks. 66911c576705Slukem for n in $library_names; do 66921c576705Slukem rmfiles="$rmfiles $objdir/$n" 66931c576705Slukem done 66941c576705Slukem test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 66951c576705Slukem 66961c576705Slukem case "$mode" in 66971c576705Slukem clean) 66981c576705Slukem case " $library_names " in 66991c576705Slukem # " " in the beginning catches empty $dlname 67001c576705Slukem *" $dlname "*) ;; 67011c576705Slukem *) rmfiles="$rmfiles $objdir/$dlname" ;; 67021c576705Slukem esac 67031c576705Slukem test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 67041c576705Slukem ;; 67051c576705Slukem uninstall) 67061c576705Slukem if test -n "$library_names"; then 67071c576705Slukem # Do each command in the postuninstall commands. 67081c576705Slukem cmds=$postuninstall_cmds 67091c576705Slukem save_ifs="$IFS"; IFS='~' 67101c576705Slukem for cmd in $cmds; do 67111c576705Slukem IFS="$save_ifs" 67121c576705Slukem eval cmd=\"$cmd\" 67131c576705Slukem $show "$cmd" 67141c576705Slukem $run eval "$cmd" 67151c576705Slukem if test "$?" -ne 0 && test "$rmforce" != yes; then 67161c576705Slukem exit_status=1 67171c576705Slukem fi 67181c576705Slukem done 67191c576705Slukem IFS="$save_ifs" 67201c576705Slukem fi 67211c576705Slukem 67221c576705Slukem if test -n "$old_library"; then 67231c576705Slukem # Do each command in the old_postuninstall commands. 67241c576705Slukem cmds=$old_postuninstall_cmds 67251c576705Slukem save_ifs="$IFS"; IFS='~' 67261c576705Slukem for cmd in $cmds; do 67271c576705Slukem IFS="$save_ifs" 67281c576705Slukem eval cmd=\"$cmd\" 67291c576705Slukem $show "$cmd" 67301c576705Slukem $run eval "$cmd" 67311c576705Slukem if test "$?" -ne 0 && test "$rmforce" != yes; then 67321c576705Slukem exit_status=1 67331c576705Slukem fi 67341c576705Slukem done 67351c576705Slukem IFS="$save_ifs" 67361c576705Slukem fi 67371c576705Slukem # FIXME: should reinstall the best remaining shared library. 67381c576705Slukem ;; 67391c576705Slukem esac 67401c576705Slukem fi 67411c576705Slukem ;; 67421c576705Slukem 67431c576705Slukem *.lo) 67441c576705Slukem # Possibly a libtool object, so verify it. 67451c576705Slukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 67461c576705Slukem 67471c576705Slukem # Read the .lo file 67481c576705Slukem . $dir/$name 67491c576705Slukem 67501c576705Slukem # Add PIC object to the list of files to remove. 67511c576705Slukem if test -n "$pic_object" \ 67521c576705Slukem && test "$pic_object" != none; then 67531c576705Slukem rmfiles="$rmfiles $dir/$pic_object" 67541c576705Slukem fi 67551c576705Slukem 67561c576705Slukem # Add non-PIC object to the list of files to remove. 67571c576705Slukem if test -n "$non_pic_object" \ 67581c576705Slukem && test "$non_pic_object" != none; then 67591c576705Slukem rmfiles="$rmfiles $dir/$non_pic_object" 67601c576705Slukem fi 67611c576705Slukem fi 67621c576705Slukem ;; 67631c576705Slukem 67641c576705Slukem *) 67651c576705Slukem if test "$mode" = clean ; then 67661c576705Slukem noexename=$name 67671c576705Slukem case $file in 67681c576705Slukem *.exe) 6769*6ca3cd61Sagc file=`$ECHO $file|${SED} 's,.exe$,,'` 6770*6ca3cd61Sagc noexename=`$ECHO $name|${SED} 's,.exe$,,'` 67711c576705Slukem # $file with .exe has already been added to rmfiles, 67721c576705Slukem # add $file without .exe 67731c576705Slukem rmfiles="$rmfiles $file" 67741c576705Slukem ;; 67751c576705Slukem esac 67761c576705Slukem # Do a test to see if this is a libtool program. 67771c576705Slukem if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 67781c576705Slukem relink_command= 67791c576705Slukem . $dir/$noexename 67801c576705Slukem 67811c576705Slukem # note $name still contains .exe if it was in $file originally 67821c576705Slukem # as does the version of $file that was added into $rmfiles 67831c576705Slukem rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 67841c576705Slukem if test "$fast_install" = yes && test -n "$relink_command"; then 67851c576705Slukem rmfiles="$rmfiles $objdir/lt-$name" 67861c576705Slukem fi 67871c576705Slukem if test "X$noexename" != "X$name" ; then 67881c576705Slukem rmfiles="$rmfiles $objdir/lt-${noexename}.c" 67891c576705Slukem fi 67901c576705Slukem fi 67911c576705Slukem fi 67921c576705Slukem ;; 67931c576705Slukem esac 67941c576705Slukem $show "$rm $rmfiles" 67951c576705Slukem $run $rm $rmfiles || exit_status=1 67961c576705Slukem done 67971c576705Slukem objdir="$origobjdir" 67981c576705Slukem 67991c576705Slukem # Try to remove the ${objdir}s in the directories where we deleted files 68001c576705Slukem for dir in $rmdirs; do 68011c576705Slukem if test -d "$dir"; then 68021c576705Slukem $show "rmdir $dir" 68031c576705Slukem $run rmdir $dir >/dev/null 2>&1 68041c576705Slukem fi 68051c576705Slukem done 68061c576705Slukem 68071c576705Slukem exit $exit_status 68081c576705Slukem ;; 68091c576705Slukem 68101c576705Slukem "") 6811*6ca3cd61Sagc $ECHO "$modename: you must specify a MODE" 1>&2 6812*6ca3cd61Sagc $ECHO "$generic_help" 1>&2 68131c576705Slukem exit $EXIT_FAILURE 68141c576705Slukem ;; 68151c576705Slukem esac 68161c576705Slukem 68171c576705Slukem if test -z "$exec_cmd"; then 6818*6ca3cd61Sagc $ECHO "$modename: invalid operation mode \`$mode'" 1>&2 6819*6ca3cd61Sagc $ECHO "$generic_help" 1>&2 68201c576705Slukem exit $EXIT_FAILURE 68211c576705Slukem fi 68221c576705Slukemfi # test -z "$show_help" 68231c576705Slukem 68241c576705Slukemif test -n "$exec_cmd"; then 68251c576705Slukem eval exec $exec_cmd 68261c576705Slukem exit $EXIT_FAILURE 68271c576705Slukemfi 68281c576705Slukem 68291c576705Slukem# We need to display help for each of the modes. 68301c576705Slukemcase $mode in 6831*6ca3cd61Sagc"") $ECHO \ 68321c576705Slukem"Usage: $modename [OPTION]... [MODE-ARG]... 68331c576705Slukem 68341c576705SlukemProvide generalized library-building support services. 68351c576705Slukem 68361c576705Slukem --config show all configuration variables 68371c576705Slukem --debug enable verbose shell tracing 68381c576705Slukem-n, --dry-run display commands without modifying any files 68391c576705Slukem --features display basic configuration information and exit 68401c576705Slukem --finish same as \`--mode=finish' 68411c576705Slukem --help display this help message and exit 68421c576705Slukem --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 68431c576705Slukem --quiet same as \`--silent' 68441c576705Slukem --silent don't print informational messages 68451c576705Slukem --tag=TAG use configuration variables from tag TAG 68461c576705Slukem --version print version information 68471c576705Slukem 68481c576705SlukemMODE must be one of the following: 68491c576705Slukem 68501c576705Slukem clean remove files from the build directory 68511c576705Slukem compile compile a source file into a libtool object 68521c576705Slukem execute automatically set library path, then run a program 68531c576705Slukem finish complete the installation of libtool libraries 68541c576705Slukem install install libraries or executables 68551c576705Slukem link create a library or an executable 68561c576705Slukem uninstall remove libraries from an installed directory 68571c576705Slukem 68581c576705SlukemMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 68591c576705Slukema more detailed description of MODE. 68601c576705Slukem 68611c576705SlukemReport bugs to <bug-libtool@gnu.org>." 68621c576705Slukem exit $EXIT_SUCCESS 68631c576705Slukem ;; 68641c576705Slukem 68651c576705Slukemclean) 6866*6ca3cd61Sagc $ECHO \ 68671c576705Slukem"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 68681c576705Slukem 68691c576705SlukemRemove files from the build directory. 68701c576705Slukem 68711c576705SlukemRM is the name of the program to use to delete files associated with each FILE 68721c576705Slukem(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 68731c576705Slukemto RM. 68741c576705Slukem 68751c576705SlukemIf FILE is a libtool library, object or program, all the files associated 68761c576705Slukemwith it are deleted. Otherwise, only FILE itself is deleted using RM." 68771c576705Slukem ;; 68781c576705Slukem 68791c576705Slukemcompile) 6880*6ca3cd61Sagc $ECHO \ 68811c576705Slukem"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 68821c576705Slukem 68831c576705SlukemCompile a source file into a libtool library object. 68841c576705Slukem 68851c576705SlukemThis mode accepts the following additional options: 68861c576705Slukem 68871c576705Slukem -o OUTPUT-FILE set the output file name to OUTPUT-FILE 68881c576705Slukem -prefer-pic try to building PIC objects only 68891c576705Slukem -prefer-non-pic try to building non-PIC objects only 68901c576705Slukem -static always build a \`.o' file suitable for static linking 68911c576705Slukem 68921c576705SlukemCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 68931c576705Slukemfrom the given SOURCEFILE. 68941c576705Slukem 68951c576705SlukemThe output file name is determined by removing the directory component from 68961c576705SlukemSOURCEFILE, then substituting the C source code suffix \`.c' with the 68971c576705Slukemlibrary object suffix, \`.lo'." 68981c576705Slukem ;; 68991c576705Slukem 69001c576705Slukemexecute) 6901*6ca3cd61Sagc $ECHO \ 69021c576705Slukem"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 69031c576705Slukem 69041c576705SlukemAutomatically set library path, then run a program. 69051c576705Slukem 69061c576705SlukemThis mode accepts the following additional options: 69071c576705Slukem 69081c576705Slukem -dlopen FILE add the directory containing FILE to the library path 69091c576705Slukem 69101c576705SlukemThis mode sets the library path environment variable according to \`-dlopen' 69111c576705Slukemflags. 69121c576705Slukem 69131c576705SlukemIf any of the ARGS are libtool executable wrappers, then they are translated 69141c576705Slukeminto their corresponding uninstalled binary, and any of their required library 69151c576705Slukemdirectories are added to the library path. 69161c576705Slukem 69171c576705SlukemThen, COMMAND is executed, with ARGS as arguments." 69181c576705Slukem ;; 69191c576705Slukem 69201c576705Slukemfinish) 6921*6ca3cd61Sagc $ECHO \ 69221c576705Slukem"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 69231c576705Slukem 69241c576705SlukemComplete the installation of libtool libraries. 69251c576705Slukem 69261c576705SlukemEach LIBDIR is a directory that contains libtool libraries. 69271c576705Slukem 69281c576705SlukemThe commands that this mode executes may require superuser privileges. Use 69291c576705Slukemthe \`--dry-run' option if you just want to see what would be executed." 69301c576705Slukem ;; 69311c576705Slukem 69321c576705Slukeminstall) 6933*6ca3cd61Sagc $ECHO \ 69341c576705Slukem"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 69351c576705Slukem 69361c576705SlukemInstall executables or libraries. 69371c576705Slukem 69381c576705SlukemINSTALL-COMMAND is the installation command. The first component should be 69391c576705Slukemeither the \`install' or \`cp' program. 69401c576705Slukem 69411c576705SlukemThe rest of the components are interpreted as arguments to that command (only 69421c576705SlukemBSD-compatible install options are recognized)." 69431c576705Slukem ;; 69441c576705Slukem 69451c576705Slukemlink) 6946*6ca3cd61Sagc $ECHO \ 69471c576705Slukem"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 69481c576705Slukem 69491c576705SlukemLink object files or libraries together to form another library, or to 69501c576705Slukemcreate an executable program. 69511c576705Slukem 69521c576705SlukemLINK-COMMAND is a command using the C compiler that you would use to create 69531c576705Slukema program from several object files. 69541c576705Slukem 69551c576705SlukemThe following components of LINK-COMMAND are treated specially: 69561c576705Slukem 69571c576705Slukem -all-static do not do any dynamic linking at all 69581c576705Slukem -avoid-version do not add a version suffix if possible 69591c576705Slukem -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 69601c576705Slukem -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 69611c576705Slukem -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 69621c576705Slukem -export-symbols SYMFILE 69631c576705Slukem try to export only the symbols listed in SYMFILE 69641c576705Slukem -export-symbols-regex REGEX 69651c576705Slukem try to export only the symbols matching REGEX 69661c576705Slukem -LLIBDIR search LIBDIR for required installed libraries 69671c576705Slukem -lNAME OUTPUT-FILE requires the installed library libNAME 69681c576705Slukem -module build a library that can dlopened 69691c576705Slukem -no-fast-install disable the fast-install mode 69701c576705Slukem -no-install link a not-installable executable 69711c576705Slukem -no-undefined declare that a library does not refer to external symbols 69721c576705Slukem -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 69731c576705Slukem -objectlist FILE Use a list of object files found in FILE to specify objects 69741c576705Slukem -precious-files-regex REGEX 69751c576705Slukem don't remove output files matching REGEX 69761c576705Slukem -release RELEASE specify package release information 69771c576705Slukem -rpath LIBDIR the created library will eventually be installed in LIBDIR 69781c576705Slukem -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 69791c576705Slukem -static do not do any dynamic linking of uninstalled libtool libraries 69801c576705Slukem -static-libtool-libs 69811c576705Slukem do not do any dynamic linking of libtool libraries 69821c576705Slukem -version-info CURRENT[:REVISION[:AGE]] 69831c576705Slukem specify library version info [each variable defaults to 0] 69841c576705Slukem 69851c576705SlukemAll other options (arguments beginning with \`-') are ignored. 69861c576705Slukem 69871c576705SlukemEvery other argument is treated as a filename. Files ending in \`.la' are 69881c576705Slukemtreated as uninstalled libtool libraries, other files are standard or library 69891c576705Slukemobject files. 69901c576705Slukem 69911c576705SlukemIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 69921c576705Slukemonly library objects (\`.lo' files) may be specified, and \`-rpath' is 69931c576705Slukemrequired, except when creating a convenience library. 69941c576705Slukem 69951c576705SlukemIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 69961c576705Slukemusing \`ar' and \`ranlib', or on Windows using \`lib'. 69971c576705Slukem 69981c576705SlukemIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 69991c576705Slukemis created, otherwise an executable program is created." 70001c576705Slukem ;; 70011c576705Slukem 70021c576705Slukemuninstall) 7003*6ca3cd61Sagc $ECHO \ 70041c576705Slukem"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 70051c576705Slukem 70061c576705SlukemRemove libraries from an installation directory. 70071c576705Slukem 70081c576705SlukemRM is the name of the program to use to delete files associated with each FILE 70091c576705Slukem(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 70101c576705Slukemto RM. 70111c576705Slukem 70121c576705SlukemIf FILE is a libtool library, all the files associated with it are deleted. 70131c576705SlukemOtherwise, only FILE itself is deleted using RM." 70141c576705Slukem ;; 70151c576705Slukem 70161c576705Slukem*) 7017*6ca3cd61Sagc $ECHO "$modename: invalid operation mode \`$mode'" 1>&2 7018*6ca3cd61Sagc $ECHO "$help" 1>&2 70191c576705Slukem exit $EXIT_FAILURE 70201c576705Slukem ;; 70211c576705Slukemesac 70221c576705Slukem 7023*6ca3cd61Sagc$ECHO 7024*6ca3cd61Sagc$ECHO "Try \`$modename --help' for more information about other modes." 70251c576705Slukem 70261c576705Slukemexit $? 70271c576705Slukem 70281c576705Slukem# The TAGs below are defined such that we never get into a situation 70291c576705Slukem# in which we disable both kinds of libraries. Given conflicting 70301c576705Slukem# choices, we go for a static library, that is the most portable, 70311c576705Slukem# since we can't tell whether shared libraries were disabled because 70321c576705Slukem# the user asked for that or because the platform doesn't support 70331c576705Slukem# them. This is particularly important on AIX, because we don't 70341c576705Slukem# support having both static and shared libraries enabled at the same 70351c576705Slukem# time on that platform, so we default to a shared-only configuration. 70361c576705Slukem# If a disable-shared tag is given, we'll fallback to a static-only 70371c576705Slukem# configuration. But we'll never go from static-only to shared-only. 70381c576705Slukem 70391c576705Slukem# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 70401c576705Slukemdisable_libs=shared 70411c576705Slukem# ### END LIBTOOL TAG CONFIG: disable-shared 70421c576705Slukem 70431c576705Slukem# ### BEGIN LIBTOOL TAG CONFIG: disable-static 70441c576705Slukemdisable_libs=static 70451c576705Slukem# ### END LIBTOOL TAG CONFIG: disable-static 70461c576705Slukem 70471c576705Slukem# Local Variables: 70481c576705Slukem# mode:shell-script 70491c576705Slukem# sh-indentation:2 70501c576705Slukem# End: 7051