ltmain.sh revision 4a041c5b
14a041c5bSmacallan# ltmain.sh - Provide generalized library-building support services. 24a041c5bSmacallan# NOTE: Changing this file will not affect anything until you rerun configure. 34a041c5bSmacallan# 44a041c5bSmacallan# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 54a041c5bSmacallan# 2007, 2008 Free Software Foundation, Inc. 64a041c5bSmacallan# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 74a041c5bSmacallan# 84a041c5bSmacallan# This program is free software; you can redistribute it and/or modify 94a041c5bSmacallan# it under the terms of the GNU General Public License as published by 104a041c5bSmacallan# the Free Software Foundation; either version 2 of the License, or 114a041c5bSmacallan# (at your option) any later version. 124a041c5bSmacallan# 134a041c5bSmacallan# This program is distributed in the hope that it will be useful, but 144a041c5bSmacallan# WITHOUT ANY WARRANTY; without even the implied warranty of 154a041c5bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 164a041c5bSmacallan# General Public License for more details. 174a041c5bSmacallan# 184a041c5bSmacallan# You should have received a copy of the GNU General Public License 194a041c5bSmacallan# along with this program; if not, write to the Free Software 204a041c5bSmacallan# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 214a041c5bSmacallan# 224a041c5bSmacallan# As a special exception to the GNU General Public License, if you 234a041c5bSmacallan# distribute this file as part of a program that contains a 244a041c5bSmacallan# configuration script generated by Autoconf, you may include it under 254a041c5bSmacallan# the same distribution terms that you use for the rest of that program. 264a041c5bSmacallan 274a041c5bSmacallanbasename="s,^.*/,,g" 284a041c5bSmacallan 294a041c5bSmacallan# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 304a041c5bSmacallan# is ksh but when the shell is invoked as "sh" and the current value of 314a041c5bSmacallan# the _XPG environment variable is not equal to 1 (one), the special 324a041c5bSmacallan# positional parameter $0, within a function call, is the name of the 334a041c5bSmacallan# function. 344a041c5bSmacallanprogpath="$0" 354a041c5bSmacallan 364a041c5bSmacallan# The name of this program: 374a041c5bSmacallanprogname=`echo "$progpath" | $SED $basename` 384a041c5bSmacallanmodename="$progname" 394a041c5bSmacallan 404a041c5bSmacallan# Global variables: 414a041c5bSmacallanEXIT_SUCCESS=0 424a041c5bSmacallanEXIT_FAILURE=1 434a041c5bSmacallan 444a041c5bSmacallanPROGRAM=ltmain.sh 454a041c5bSmacallanPACKAGE=libtool 464a041c5bSmacallanVERSION=1.5.26 474a041c5bSmacallanTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 484a041c5bSmacallan 494a041c5bSmacallan# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 504a041c5bSmacallanif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 514a041c5bSmacallan emulate sh 524a041c5bSmacallan NULLCMD=: 534a041c5bSmacallan # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 544a041c5bSmacallan # is contrary to our usage. Disable this feature. 554a041c5bSmacallan alias -g '${1+"$@"}'='"$@"' 564a041c5bSmacallan setopt NO_GLOB_SUBST 574a041c5bSmacallanelse 584a041c5bSmacallan case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 594a041c5bSmacallanfi 604a041c5bSmacallanBIN_SH=xpg4; export BIN_SH # for Tru64 614a041c5bSmacallanDUALCASE=1; export DUALCASE # for MKS sh 624a041c5bSmacallan 634a041c5bSmacallan# Check that we have a working $echo. 644a041c5bSmacallanif test "X$1" = X--no-reexec; then 654a041c5bSmacallan # Discard the --no-reexec flag, and continue. 664a041c5bSmacallan shift 674a041c5bSmacallanelif test "X$1" = X--fallback-echo; then 684a041c5bSmacallan # Avoid inline document here, it may be left over 694a041c5bSmacallan : 704a041c5bSmacallanelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 714a041c5bSmacallan # Yippee, $echo works! 724a041c5bSmacallan : 734a041c5bSmacallanelse 744a041c5bSmacallan # Restart under the correct shell, and then maybe $echo will work. 754a041c5bSmacallan exec $SHELL "$progpath" --no-reexec ${1+"$@"} 764a041c5bSmacallanfi 774a041c5bSmacallan 784a041c5bSmacallanif test "X$1" = X--fallback-echo; then 794a041c5bSmacallan # used as fallback echo 804a041c5bSmacallan shift 814a041c5bSmacallan cat <<EOF 824a041c5bSmacallan$* 834a041c5bSmacallanEOF 844a041c5bSmacallan exit $EXIT_SUCCESS 854a041c5bSmacallanfi 864a041c5bSmacallan 874a041c5bSmacallandefault_mode= 884a041c5bSmacallanhelp="Try \`$progname --help' for more information." 894a041c5bSmacallanmagic="%%%MAGIC variable%%%" 904a041c5bSmacallanmkdir="mkdir" 914a041c5bSmacallanmv="mv -f" 924a041c5bSmacallanrm="rm -f" 934a041c5bSmacallan 944a041c5bSmacallan# Sed substitution that helps us do robust quoting. It backslashifies 954a041c5bSmacallan# metacharacters that are still active within double-quoted strings. 964a041c5bSmacallanXsed="${SED}"' -e 1s/^X//' 974a041c5bSmacallansed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 984a041c5bSmacallan# test EBCDIC or ASCII 994a041c5bSmacallancase `echo X|tr X '\101'` in 1004a041c5bSmacallan A) # ASCII based system 1014a041c5bSmacallan # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 1024a041c5bSmacallan SP2NL='tr \040 \012' 1034a041c5bSmacallan NL2SP='tr \015\012 \040\040' 1044a041c5bSmacallan ;; 1054a041c5bSmacallan *) # EBCDIC based system 1064a041c5bSmacallan SP2NL='tr \100 \n' 1074a041c5bSmacallan NL2SP='tr \r\n \100\100' 1084a041c5bSmacallan ;; 1094a041c5bSmacallanesac 1104a041c5bSmacallan 1114a041c5bSmacallan# NLS nuisances. 1124a041c5bSmacallan# Only set LANG and LC_ALL to C if already set. 1134a041c5bSmacallan# These must not be set unconditionally because not all systems understand 1144a041c5bSmacallan# e.g. LANG=C (notably SCO). 1154a041c5bSmacallan# We save the old values to restore during execute mode. 1164a041c5bSmacallanlt_env= 1174a041c5bSmacallanfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1184a041c5bSmacallando 1194a041c5bSmacallan eval "if test \"\${$lt_var+set}\" = set; then 1204a041c5bSmacallan save_$lt_var=\$$lt_var 1214a041c5bSmacallan lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1224a041c5bSmacallan $lt_var=C 1234a041c5bSmacallan export $lt_var 1244a041c5bSmacallan fi" 1254a041c5bSmacallandone 1264a041c5bSmacallan 1274a041c5bSmacallanif test -n "$lt_env"; then 1284a041c5bSmacallan lt_env="env $lt_env" 1294a041c5bSmacallanfi 1304a041c5bSmacallan 1314a041c5bSmacallan# Make sure IFS has a sensible default 1324a041c5bSmacallanlt_nl=' 1334a041c5bSmacallan' 1344a041c5bSmacallanIFS=" $lt_nl" 1354a041c5bSmacallan 1364a041c5bSmacallanif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1374a041c5bSmacallan $echo "$modename: not configured to build any kind of library" 1>&2 1384a041c5bSmacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1394a041c5bSmacallan exit $EXIT_FAILURE 1404a041c5bSmacallanfi 1414a041c5bSmacallan 1424a041c5bSmacallan# Global variables. 1434a041c5bSmacallanmode=$default_mode 1444a041c5bSmacallannonopt= 1454a041c5bSmacallanprev= 1464a041c5bSmacallanprevopt= 1474a041c5bSmacallanrun= 1484a041c5bSmacallanshow="$echo" 1494a041c5bSmacallanshow_help= 1504a041c5bSmacallanexecute_dlfiles= 1514a041c5bSmacallanduplicate_deps=no 1524a041c5bSmacallanpreserve_args= 1534a041c5bSmacallanlo2o="s/\\.lo\$/.${objext}/" 1544a041c5bSmacallano2lo="s/\\.${objext}\$/.lo/" 1554a041c5bSmacallanextracted_archives= 1564a041c5bSmacallanextracted_serial=0 1574a041c5bSmacallan 1584a041c5bSmacallan##################################### 1594a041c5bSmacallan# Shell function definitions: 1604a041c5bSmacallan# This seems to be the best place for them 1614a041c5bSmacallan 1624a041c5bSmacallan# func_mktempdir [string] 1634a041c5bSmacallan# Make a temporary directory that won't clash with other running 1644a041c5bSmacallan# libtool processes, and avoids race conditions if possible. If 1654a041c5bSmacallan# given, STRING is the basename for that directory. 1664a041c5bSmacallanfunc_mktempdir () 1674a041c5bSmacallan{ 1684a041c5bSmacallan my_template="${TMPDIR-/tmp}/${1-$progname}" 1694a041c5bSmacallan 1704a041c5bSmacallan if test "$run" = ":"; then 1714a041c5bSmacallan # Return a directory name, but don't create it in dry-run mode 1724a041c5bSmacallan my_tmpdir="${my_template}-$$" 1734a041c5bSmacallan else 1744a041c5bSmacallan 1754a041c5bSmacallan # If mktemp works, use that first and foremost 1764a041c5bSmacallan my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1774a041c5bSmacallan 1784a041c5bSmacallan if test ! -d "$my_tmpdir"; then 1794a041c5bSmacallan # Failing that, at least try and use $RANDOM to avoid a race 1804a041c5bSmacallan my_tmpdir="${my_template}-${RANDOM-0}$$" 1814a041c5bSmacallan 1824a041c5bSmacallan save_mktempdir_umask=`umask` 1834a041c5bSmacallan umask 0077 1844a041c5bSmacallan $mkdir "$my_tmpdir" 1854a041c5bSmacallan umask $save_mktempdir_umask 1864a041c5bSmacallan fi 1874a041c5bSmacallan 1884a041c5bSmacallan # If we're not in dry-run mode, bomb out on failure 1894a041c5bSmacallan test -d "$my_tmpdir" || { 1904a041c5bSmacallan $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 1914a041c5bSmacallan exit $EXIT_FAILURE 1924a041c5bSmacallan } 1934a041c5bSmacallan fi 1944a041c5bSmacallan 1954a041c5bSmacallan $echo "X$my_tmpdir" | $Xsed 1964a041c5bSmacallan} 1974a041c5bSmacallan 1984a041c5bSmacallan 1994a041c5bSmacallan# func_win32_libid arg 2004a041c5bSmacallan# return the library type of file 'arg' 2014a041c5bSmacallan# 2024a041c5bSmacallan# Need a lot of goo to handle *both* DLLs and import libs 2034a041c5bSmacallan# Has to be a shell function in order to 'eat' the argument 2044a041c5bSmacallan# that is supplied when $file_magic_command is called. 2054a041c5bSmacallanfunc_win32_libid () 2064a041c5bSmacallan{ 2074a041c5bSmacallan win32_libid_type="unknown" 2084a041c5bSmacallan win32_fileres=`file -L $1 2>/dev/null` 2094a041c5bSmacallan case $win32_fileres in 2104a041c5bSmacallan *ar\ archive\ import\ library*) # definitely import 2114a041c5bSmacallan win32_libid_type="x86 archive import" 2124a041c5bSmacallan ;; 2134a041c5bSmacallan *ar\ archive*) # could be an import, or static 2144a041c5bSmacallan if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 2154a041c5bSmacallan $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2164a041c5bSmacallan win32_nmres=`eval $NM -f posix -A $1 | \ 2174a041c5bSmacallan $SED -n -e '1,100{ 2184a041c5bSmacallan / I /{ 2194a041c5bSmacallan s,.*,import, 2204a041c5bSmacallan p 2214a041c5bSmacallan q 2224a041c5bSmacallan } 2234a041c5bSmacallan }'` 2244a041c5bSmacallan case $win32_nmres in 2254a041c5bSmacallan import*) win32_libid_type="x86 archive import";; 2264a041c5bSmacallan *) win32_libid_type="x86 archive static";; 2274a041c5bSmacallan esac 2284a041c5bSmacallan fi 2294a041c5bSmacallan ;; 2304a041c5bSmacallan *DLL*) 2314a041c5bSmacallan win32_libid_type="x86 DLL" 2324a041c5bSmacallan ;; 2334a041c5bSmacallan *executable*) # but shell scripts are "executable" too... 2344a041c5bSmacallan case $win32_fileres in 2354a041c5bSmacallan *MS\ Windows\ PE\ Intel*) 2364a041c5bSmacallan win32_libid_type="x86 DLL" 2374a041c5bSmacallan ;; 2384a041c5bSmacallan esac 2394a041c5bSmacallan ;; 2404a041c5bSmacallan esac 2414a041c5bSmacallan $echo $win32_libid_type 2424a041c5bSmacallan} 2434a041c5bSmacallan 2444a041c5bSmacallan 2454a041c5bSmacallan# func_infer_tag arg 2464a041c5bSmacallan# Infer tagged configuration to use if any are available and 2474a041c5bSmacallan# if one wasn't chosen via the "--tag" command line option. 2484a041c5bSmacallan# Only attempt this if the compiler in the base compile 2494a041c5bSmacallan# command doesn't match the default compiler. 2504a041c5bSmacallan# arg is usually of the form 'gcc ...' 2514a041c5bSmacallanfunc_infer_tag () 2524a041c5bSmacallan{ 2534a041c5bSmacallan if test -n "$available_tags" && test -z "$tagname"; then 2544a041c5bSmacallan CC_quoted= 2554a041c5bSmacallan for arg in $CC; do 2564a041c5bSmacallan case $arg in 2574a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2584a041c5bSmacallan arg="\"$arg\"" 2594a041c5bSmacallan ;; 2604a041c5bSmacallan esac 2614a041c5bSmacallan CC_quoted="$CC_quoted $arg" 2624a041c5bSmacallan done 2634a041c5bSmacallan case $@ in 2644a041c5bSmacallan # Blanks in the command may have been stripped by the calling shell, 2654a041c5bSmacallan # but not from the CC environment variable when configure was run. 2664a041c5bSmacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 2674a041c5bSmacallan # Blanks at the start of $base_compile will cause this to fail 2684a041c5bSmacallan # if we don't check for them as well. 2694a041c5bSmacallan *) 2704a041c5bSmacallan for z in $available_tags; do 2714a041c5bSmacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2724a041c5bSmacallan # Evaluate the configuration. 2734a041c5bSmacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2744a041c5bSmacallan CC_quoted= 2754a041c5bSmacallan for arg in $CC; do 2764a041c5bSmacallan # Double-quote args containing other shell metacharacters. 2774a041c5bSmacallan case $arg in 2784a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2794a041c5bSmacallan arg="\"$arg\"" 2804a041c5bSmacallan ;; 2814a041c5bSmacallan esac 2824a041c5bSmacallan CC_quoted="$CC_quoted $arg" 2834a041c5bSmacallan done 2844a041c5bSmacallan case "$@ " in 2854a041c5bSmacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 2864a041c5bSmacallan # The compiler in the base compile command matches 2874a041c5bSmacallan # the one in the tagged configuration. 2884a041c5bSmacallan # Assume this is the tagged configuration we want. 2894a041c5bSmacallan tagname=$z 2904a041c5bSmacallan break 2914a041c5bSmacallan ;; 2924a041c5bSmacallan esac 2934a041c5bSmacallan fi 2944a041c5bSmacallan done 2954a041c5bSmacallan # If $tagname still isn't set, then no tagged configuration 2964a041c5bSmacallan # was found and let the user know that the "--tag" command 2974a041c5bSmacallan # line option must be used. 2984a041c5bSmacallan if test -z "$tagname"; then 2994a041c5bSmacallan $echo "$modename: unable to infer tagged configuration" 3004a041c5bSmacallan $echo "$modename: specify a tag with \`--tag'" 1>&2 3014a041c5bSmacallan exit $EXIT_FAILURE 3024a041c5bSmacallan# else 3034a041c5bSmacallan# $echo "$modename: using $tagname tagged configuration" 3044a041c5bSmacallan fi 3054a041c5bSmacallan ;; 3064a041c5bSmacallan esac 3074a041c5bSmacallan fi 3084a041c5bSmacallan} 3094a041c5bSmacallan 3104a041c5bSmacallan 3114a041c5bSmacallan# func_extract_an_archive dir oldlib 3124a041c5bSmacallanfunc_extract_an_archive () 3134a041c5bSmacallan{ 3144a041c5bSmacallan f_ex_an_ar_dir="$1"; shift 3154a041c5bSmacallan f_ex_an_ar_oldlib="$1" 3164a041c5bSmacallan 3174a041c5bSmacallan $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 3184a041c5bSmacallan $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 3194a041c5bSmacallan if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3204a041c5bSmacallan : 3214a041c5bSmacallan else 3224a041c5bSmacallan $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 3234a041c5bSmacallan exit $EXIT_FAILURE 3244a041c5bSmacallan fi 3254a041c5bSmacallan} 3264a041c5bSmacallan 3274a041c5bSmacallan# func_extract_archives gentop oldlib ... 3284a041c5bSmacallanfunc_extract_archives () 3294a041c5bSmacallan{ 3304a041c5bSmacallan my_gentop="$1"; shift 3314a041c5bSmacallan my_oldlibs=${1+"$@"} 3324a041c5bSmacallan my_oldobjs="" 3334a041c5bSmacallan my_xlib="" 3344a041c5bSmacallan my_xabs="" 3354a041c5bSmacallan my_xdir="" 3364a041c5bSmacallan my_status="" 3374a041c5bSmacallan 3384a041c5bSmacallan $show "${rm}r $my_gentop" 3394a041c5bSmacallan $run ${rm}r "$my_gentop" 3404a041c5bSmacallan $show "$mkdir $my_gentop" 3414a041c5bSmacallan $run $mkdir "$my_gentop" 3424a041c5bSmacallan my_status=$? 3434a041c5bSmacallan if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3444a041c5bSmacallan exit $my_status 3454a041c5bSmacallan fi 3464a041c5bSmacallan 3474a041c5bSmacallan for my_xlib in $my_oldlibs; do 3484a041c5bSmacallan # Extract the objects. 3494a041c5bSmacallan case $my_xlib in 3504a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3514a041c5bSmacallan *) my_xabs=`pwd`"/$my_xlib" ;; 3524a041c5bSmacallan esac 3534a041c5bSmacallan my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3544a041c5bSmacallan my_xlib_u=$my_xlib 3554a041c5bSmacallan while :; do 3564a041c5bSmacallan case " $extracted_archives " in 3574a041c5bSmacallan *" $my_xlib_u "*) 3584a041c5bSmacallan extracted_serial=`expr $extracted_serial + 1` 3594a041c5bSmacallan my_xlib_u=lt$extracted_serial-$my_xlib ;; 3604a041c5bSmacallan *) break ;; 3614a041c5bSmacallan esac 3624a041c5bSmacallan done 3634a041c5bSmacallan extracted_archives="$extracted_archives $my_xlib_u" 3644a041c5bSmacallan my_xdir="$my_gentop/$my_xlib_u" 3654a041c5bSmacallan 3664a041c5bSmacallan $show "${rm}r $my_xdir" 3674a041c5bSmacallan $run ${rm}r "$my_xdir" 3684a041c5bSmacallan $show "$mkdir $my_xdir" 3694a041c5bSmacallan $run $mkdir "$my_xdir" 3704a041c5bSmacallan exit_status=$? 3714a041c5bSmacallan if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 3724a041c5bSmacallan exit $exit_status 3734a041c5bSmacallan fi 3744a041c5bSmacallan case $host in 3754a041c5bSmacallan *-darwin*) 3764a041c5bSmacallan $show "Extracting $my_xabs" 3774a041c5bSmacallan # Do not bother doing anything if just a dry run 3784a041c5bSmacallan if test -z "$run"; then 3794a041c5bSmacallan darwin_orig_dir=`pwd` 3804a041c5bSmacallan cd $my_xdir || exit $? 3814a041c5bSmacallan darwin_archive=$my_xabs 3824a041c5bSmacallan darwin_curdir=`pwd` 3834a041c5bSmacallan darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 3844a041c5bSmacallan darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 3854a041c5bSmacallan if test -n "$darwin_arches"; then 3864a041c5bSmacallan darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 3874a041c5bSmacallan darwin_arch= 3884a041c5bSmacallan $show "$darwin_base_archive has multiple architectures $darwin_arches" 3894a041c5bSmacallan for darwin_arch in $darwin_arches ; do 3904a041c5bSmacallan mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3914a041c5bSmacallan lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3924a041c5bSmacallan cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3934a041c5bSmacallan func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3944a041c5bSmacallan cd "$darwin_curdir" 3954a041c5bSmacallan $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3964a041c5bSmacallan done # $darwin_arches 3974a041c5bSmacallan ## Okay now we have a bunch of thin objects, gotta fatten them up :) 3984a041c5bSmacallan darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 3994a041c5bSmacallan darwin_file= 4004a041c5bSmacallan darwin_files= 4014a041c5bSmacallan for darwin_file in $darwin_filelist; do 4024a041c5bSmacallan darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 4034a041c5bSmacallan lipo -create -output "$darwin_file" $darwin_files 4044a041c5bSmacallan done # $darwin_filelist 4054a041c5bSmacallan ${rm}r unfat-$$ 4064a041c5bSmacallan cd "$darwin_orig_dir" 4074a041c5bSmacallan else 4084a041c5bSmacallan cd "$darwin_orig_dir" 4094a041c5bSmacallan func_extract_an_archive "$my_xdir" "$my_xabs" 4104a041c5bSmacallan fi # $darwin_arches 4114a041c5bSmacallan fi # $run 4124a041c5bSmacallan ;; 4134a041c5bSmacallan *) 4144a041c5bSmacallan func_extract_an_archive "$my_xdir" "$my_xabs" 4154a041c5bSmacallan ;; 4164a041c5bSmacallan esac 4174a041c5bSmacallan my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 4184a041c5bSmacallan done 4194a041c5bSmacallan func_extract_archives_result="$my_oldobjs" 4204a041c5bSmacallan} 4214a041c5bSmacallan# End of Shell function definitions 4224a041c5bSmacallan##################################### 4234a041c5bSmacallan 4244a041c5bSmacallan# Darwin sucks 4254a041c5bSmacallaneval std_shrext=\"$shrext_cmds\" 4264a041c5bSmacallan 4274a041c5bSmacallandisable_libs=no 4284a041c5bSmacallan 4294a041c5bSmacallan# Parse our command line options once, thoroughly. 4304a041c5bSmacallanwhile test "$#" -gt 0 4314a041c5bSmacallando 4324a041c5bSmacallan arg="$1" 4334a041c5bSmacallan shift 4344a041c5bSmacallan 4354a041c5bSmacallan case $arg in 4364a041c5bSmacallan -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4374a041c5bSmacallan *) optarg= ;; 4384a041c5bSmacallan esac 4394a041c5bSmacallan 4404a041c5bSmacallan # If the previous option needs an argument, assign it. 4414a041c5bSmacallan if test -n "$prev"; then 4424a041c5bSmacallan case $prev in 4434a041c5bSmacallan execute_dlfiles) 4444a041c5bSmacallan execute_dlfiles="$execute_dlfiles $arg" 4454a041c5bSmacallan ;; 4464a041c5bSmacallan tag) 4474a041c5bSmacallan tagname="$arg" 4484a041c5bSmacallan preserve_args="${preserve_args}=$arg" 4494a041c5bSmacallan 4504a041c5bSmacallan # Check whether tagname contains only valid characters 4514a041c5bSmacallan case $tagname in 4524a041c5bSmacallan *[!-_A-Za-z0-9,/]*) 4534a041c5bSmacallan $echo "$progname: invalid tag name: $tagname" 1>&2 4544a041c5bSmacallan exit $EXIT_FAILURE 4554a041c5bSmacallan ;; 4564a041c5bSmacallan esac 4574a041c5bSmacallan 4584a041c5bSmacallan case $tagname in 4594a041c5bSmacallan CC) 4604a041c5bSmacallan # Don't test for the "default" C tag, as we know, it's there, but 4614a041c5bSmacallan # not specially marked. 4624a041c5bSmacallan ;; 4634a041c5bSmacallan *) 4644a041c5bSmacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 4654a041c5bSmacallan taglist="$taglist $tagname" 4664a041c5bSmacallan # Evaluate the configuration. 4674a041c5bSmacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 4684a041c5bSmacallan else 4694a041c5bSmacallan $echo "$progname: ignoring unknown tag $tagname" 1>&2 4704a041c5bSmacallan fi 4714a041c5bSmacallan ;; 4724a041c5bSmacallan esac 4734a041c5bSmacallan ;; 4744a041c5bSmacallan *) 4754a041c5bSmacallan eval "$prev=\$arg" 4764a041c5bSmacallan ;; 4774a041c5bSmacallan esac 4784a041c5bSmacallan 4794a041c5bSmacallan prev= 4804a041c5bSmacallan prevopt= 4814a041c5bSmacallan continue 4824a041c5bSmacallan fi 4834a041c5bSmacallan 4844a041c5bSmacallan # Have we seen a non-optional argument yet? 4854a041c5bSmacallan case $arg in 4864a041c5bSmacallan --help) 4874a041c5bSmacallan show_help=yes 4884a041c5bSmacallan ;; 4894a041c5bSmacallan 4904a041c5bSmacallan --version) 4914a041c5bSmacallan echo "\ 4924a041c5bSmacallan$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 4934a041c5bSmacallan 4944a041c5bSmacallanCopyright (C) 2008 Free Software Foundation, Inc. 4954a041c5bSmacallanThis is free software; see the source for copying conditions. There is NO 4964a041c5bSmacallanwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 4974a041c5bSmacallan exit $? 4984a041c5bSmacallan ;; 4994a041c5bSmacallan 5004a041c5bSmacallan --config) 5014a041c5bSmacallan ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 5024a041c5bSmacallan # Now print the configurations for the tags. 5034a041c5bSmacallan for tagname in $taglist; do 5044a041c5bSmacallan ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 5054a041c5bSmacallan done 5064a041c5bSmacallan exit $? 5074a041c5bSmacallan ;; 5084a041c5bSmacallan 5094a041c5bSmacallan --debug) 5104a041c5bSmacallan $echo "$progname: enabling shell trace mode" 5114a041c5bSmacallan set -x 5124a041c5bSmacallan preserve_args="$preserve_args $arg" 5134a041c5bSmacallan ;; 5144a041c5bSmacallan 5154a041c5bSmacallan --dry-run | -n) 5164a041c5bSmacallan run=: 5174a041c5bSmacallan ;; 5184a041c5bSmacallan 5194a041c5bSmacallan --features) 5204a041c5bSmacallan $echo "host: $host" 5214a041c5bSmacallan if test "$build_libtool_libs" = yes; then 5224a041c5bSmacallan $echo "enable shared libraries" 5234a041c5bSmacallan else 5244a041c5bSmacallan $echo "disable shared libraries" 5254a041c5bSmacallan fi 5264a041c5bSmacallan if test "$build_old_libs" = yes; then 5274a041c5bSmacallan $echo "enable static libraries" 5284a041c5bSmacallan else 5294a041c5bSmacallan $echo "disable static libraries" 5304a041c5bSmacallan fi 5314a041c5bSmacallan exit $? 5324a041c5bSmacallan ;; 5334a041c5bSmacallan 5344a041c5bSmacallan --finish) mode="finish" ;; 5354a041c5bSmacallan 5364a041c5bSmacallan --mode) prevopt="--mode" prev=mode ;; 5374a041c5bSmacallan --mode=*) mode="$optarg" ;; 5384a041c5bSmacallan 5394a041c5bSmacallan --preserve-dup-deps) duplicate_deps="yes" ;; 5404a041c5bSmacallan 5414a041c5bSmacallan --quiet | --silent) 5424a041c5bSmacallan show=: 5434a041c5bSmacallan preserve_args="$preserve_args $arg" 5444a041c5bSmacallan ;; 5454a041c5bSmacallan 5464a041c5bSmacallan --tag) 5474a041c5bSmacallan prevopt="--tag" 5484a041c5bSmacallan prev=tag 5494a041c5bSmacallan preserve_args="$preserve_args --tag" 5504a041c5bSmacallan ;; 5514a041c5bSmacallan --tag=*) 5524a041c5bSmacallan set tag "$optarg" ${1+"$@"} 5534a041c5bSmacallan shift 5544a041c5bSmacallan prev=tag 5554a041c5bSmacallan preserve_args="$preserve_args --tag" 5564a041c5bSmacallan ;; 5574a041c5bSmacallan 5584a041c5bSmacallan -dlopen) 5594a041c5bSmacallan prevopt="-dlopen" 5604a041c5bSmacallan prev=execute_dlfiles 5614a041c5bSmacallan ;; 5624a041c5bSmacallan 5634a041c5bSmacallan -*) 5644a041c5bSmacallan $echo "$modename: unrecognized option \`$arg'" 1>&2 5654a041c5bSmacallan $echo "$help" 1>&2 5664a041c5bSmacallan exit $EXIT_FAILURE 5674a041c5bSmacallan ;; 5684a041c5bSmacallan 5694a041c5bSmacallan *) 5704a041c5bSmacallan nonopt="$arg" 5714a041c5bSmacallan break 5724a041c5bSmacallan ;; 5734a041c5bSmacallan esac 5744a041c5bSmacallandone 5754a041c5bSmacallan 5764a041c5bSmacallanif test -n "$prevopt"; then 5774a041c5bSmacallan $echo "$modename: option \`$prevopt' requires an argument" 1>&2 5784a041c5bSmacallan $echo "$help" 1>&2 5794a041c5bSmacallan exit $EXIT_FAILURE 5804a041c5bSmacallanfi 5814a041c5bSmacallan 5824a041c5bSmacallancase $disable_libs in 5834a041c5bSmacallanno) 5844a041c5bSmacallan ;; 5854a041c5bSmacallanshared) 5864a041c5bSmacallan build_libtool_libs=no 5874a041c5bSmacallan build_old_libs=yes 5884a041c5bSmacallan ;; 5894a041c5bSmacallanstatic) 5904a041c5bSmacallan build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5914a041c5bSmacallan ;; 5924a041c5bSmacallanesac 5934a041c5bSmacallan 5944a041c5bSmacallan# If this variable is set in any of the actions, the command in it 5954a041c5bSmacallan# will be execed at the end. This prevents here-documents from being 5964a041c5bSmacallan# left over by shells. 5974a041c5bSmacallanexec_cmd= 5984a041c5bSmacallan 5994a041c5bSmacallanif test -z "$show_help"; then 6004a041c5bSmacallan 6014a041c5bSmacallan # Infer the operation mode. 6024a041c5bSmacallan if test -z "$mode"; then 6034a041c5bSmacallan $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 6044a041c5bSmacallan $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 6054a041c5bSmacallan case $nonopt in 6064a041c5bSmacallan *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 6074a041c5bSmacallan mode=link 6084a041c5bSmacallan for arg 6094a041c5bSmacallan do 6104a041c5bSmacallan case $arg in 6114a041c5bSmacallan -c) 6124a041c5bSmacallan mode=compile 6134a041c5bSmacallan break 6144a041c5bSmacallan ;; 6154a041c5bSmacallan esac 6164a041c5bSmacallan done 6174a041c5bSmacallan ;; 6184a041c5bSmacallan *db | *dbx | *strace | *truss) 6194a041c5bSmacallan mode=execute 6204a041c5bSmacallan ;; 6214a041c5bSmacallan *install*|cp|mv) 6224a041c5bSmacallan mode=install 6234a041c5bSmacallan ;; 6244a041c5bSmacallan *rm) 6254a041c5bSmacallan mode=uninstall 6264a041c5bSmacallan ;; 6274a041c5bSmacallan *) 6284a041c5bSmacallan # If we have no mode, but dlfiles were specified, then do execute mode. 6294a041c5bSmacallan test -n "$execute_dlfiles" && mode=execute 6304a041c5bSmacallan 6314a041c5bSmacallan # Just use the default operation mode. 6324a041c5bSmacallan if test -z "$mode"; then 6334a041c5bSmacallan if test -n "$nonopt"; then 6344a041c5bSmacallan $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6354a041c5bSmacallan else 6364a041c5bSmacallan $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6374a041c5bSmacallan fi 6384a041c5bSmacallan fi 6394a041c5bSmacallan ;; 6404a041c5bSmacallan esac 6414a041c5bSmacallan fi 6424a041c5bSmacallan 6434a041c5bSmacallan # Only execute mode is allowed to have -dlopen flags. 6444a041c5bSmacallan if test -n "$execute_dlfiles" && test "$mode" != execute; then 6454a041c5bSmacallan $echo "$modename: unrecognized option \`-dlopen'" 1>&2 6464a041c5bSmacallan $echo "$help" 1>&2 6474a041c5bSmacallan exit $EXIT_FAILURE 6484a041c5bSmacallan fi 6494a041c5bSmacallan 6504a041c5bSmacallan # Change the help message to a mode-specific one. 6514a041c5bSmacallan generic_help="$help" 6524a041c5bSmacallan help="Try \`$modename --help --mode=$mode' for more information." 6534a041c5bSmacallan 6544a041c5bSmacallan # These modes are in order of execution frequency so that they run quickly. 6554a041c5bSmacallan case $mode in 6564a041c5bSmacallan # libtool compile mode 6574a041c5bSmacallan compile) 6584a041c5bSmacallan modename="$modename: compile" 6594a041c5bSmacallan # Get the compilation command and the source file. 6604a041c5bSmacallan base_compile= 6614a041c5bSmacallan srcfile="$nonopt" # always keep a non-empty value in "srcfile" 6624a041c5bSmacallan suppress_opt=yes 6634a041c5bSmacallan suppress_output= 6644a041c5bSmacallan arg_mode=normal 6654a041c5bSmacallan libobj= 6664a041c5bSmacallan later= 6674a041c5bSmacallan 6684a041c5bSmacallan for arg 6694a041c5bSmacallan do 6704a041c5bSmacallan case $arg_mode in 6714a041c5bSmacallan arg ) 6724a041c5bSmacallan # do not "continue". Instead, add this to base_compile 6734a041c5bSmacallan lastarg="$arg" 6744a041c5bSmacallan arg_mode=normal 6754a041c5bSmacallan ;; 6764a041c5bSmacallan 6774a041c5bSmacallan target ) 6784a041c5bSmacallan libobj="$arg" 6794a041c5bSmacallan arg_mode=normal 6804a041c5bSmacallan continue 6814a041c5bSmacallan ;; 6824a041c5bSmacallan 6834a041c5bSmacallan normal ) 6844a041c5bSmacallan # Accept any command-line options. 6854a041c5bSmacallan case $arg in 6864a041c5bSmacallan -o) 6874a041c5bSmacallan if test -n "$libobj" ; then 6884a041c5bSmacallan $echo "$modename: you cannot specify \`-o' more than once" 1>&2 6894a041c5bSmacallan exit $EXIT_FAILURE 6904a041c5bSmacallan fi 6914a041c5bSmacallan arg_mode=target 6924a041c5bSmacallan continue 6934a041c5bSmacallan ;; 6944a041c5bSmacallan 6954a041c5bSmacallan -static | -prefer-pic | -prefer-non-pic) 6964a041c5bSmacallan later="$later $arg" 6974a041c5bSmacallan continue 6984a041c5bSmacallan ;; 6994a041c5bSmacallan 7004a041c5bSmacallan -no-suppress) 7014a041c5bSmacallan suppress_opt=no 7024a041c5bSmacallan continue 7034a041c5bSmacallan ;; 7044a041c5bSmacallan 7054a041c5bSmacallan -Xcompiler) 7064a041c5bSmacallan arg_mode=arg # the next one goes into the "base_compile" arg list 7074a041c5bSmacallan continue # The current "srcfile" will either be retained or 7084a041c5bSmacallan ;; # replaced later. I would guess that would be a bug. 7094a041c5bSmacallan 7104a041c5bSmacallan -Wc,*) 7114a041c5bSmacallan args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 7124a041c5bSmacallan lastarg= 7134a041c5bSmacallan save_ifs="$IFS"; IFS=',' 7144a041c5bSmacallan for arg in $args; do 7154a041c5bSmacallan IFS="$save_ifs" 7164a041c5bSmacallan 7174a041c5bSmacallan # Double-quote args containing other shell metacharacters. 7184a041c5bSmacallan # Many Bourne shells cannot handle close brackets correctly 7194a041c5bSmacallan # in scan sets, so we specify it separately. 7204a041c5bSmacallan case $arg in 7214a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7224a041c5bSmacallan arg="\"$arg\"" 7234a041c5bSmacallan ;; 7244a041c5bSmacallan esac 7254a041c5bSmacallan lastarg="$lastarg $arg" 7264a041c5bSmacallan done 7274a041c5bSmacallan IFS="$save_ifs" 7284a041c5bSmacallan lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 7294a041c5bSmacallan 7304a041c5bSmacallan # Add the arguments to base_compile. 7314a041c5bSmacallan base_compile="$base_compile $lastarg" 7324a041c5bSmacallan continue 7334a041c5bSmacallan ;; 7344a041c5bSmacallan 7354a041c5bSmacallan * ) 7364a041c5bSmacallan # Accept the current argument as the source file. 7374a041c5bSmacallan # The previous "srcfile" becomes the current argument. 7384a041c5bSmacallan # 7394a041c5bSmacallan lastarg="$srcfile" 7404a041c5bSmacallan srcfile="$arg" 7414a041c5bSmacallan ;; 7424a041c5bSmacallan esac # case $arg 7434a041c5bSmacallan ;; 7444a041c5bSmacallan esac # case $arg_mode 7454a041c5bSmacallan 7464a041c5bSmacallan # Aesthetically quote the previous argument. 7474a041c5bSmacallan lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7484a041c5bSmacallan 7494a041c5bSmacallan case $lastarg in 7504a041c5bSmacallan # Double-quote args containing other shell metacharacters. 7514a041c5bSmacallan # Many Bourne shells cannot handle close brackets correctly 7524a041c5bSmacallan # in scan sets, and some SunOS ksh mistreat backslash-escaping 7534a041c5bSmacallan # in scan sets (worked around with variable expansion), 7544a041c5bSmacallan # and furthermore cannot handle '|' '&' '(' ')' in scan sets 7554a041c5bSmacallan # at all, so we specify them separately. 7564a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7574a041c5bSmacallan lastarg="\"$lastarg\"" 7584a041c5bSmacallan ;; 7594a041c5bSmacallan esac 7604a041c5bSmacallan 7614a041c5bSmacallan base_compile="$base_compile $lastarg" 7624a041c5bSmacallan done # for arg 7634a041c5bSmacallan 7644a041c5bSmacallan case $arg_mode in 7654a041c5bSmacallan arg) 7664a041c5bSmacallan $echo "$modename: you must specify an argument for -Xcompile" 7674a041c5bSmacallan exit $EXIT_FAILURE 7684a041c5bSmacallan ;; 7694a041c5bSmacallan target) 7704a041c5bSmacallan $echo "$modename: you must specify a target with \`-o'" 1>&2 7714a041c5bSmacallan exit $EXIT_FAILURE 7724a041c5bSmacallan ;; 7734a041c5bSmacallan *) 7744a041c5bSmacallan # Get the name of the library object. 7754a041c5bSmacallan [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 7764a041c5bSmacallan ;; 7774a041c5bSmacallan esac 7784a041c5bSmacallan 7794a041c5bSmacallan # Recognize several different file suffixes. 7804a041c5bSmacallan # If the user specifies -o file.o, it is replaced with file.lo 7814a041c5bSmacallan xform='[cCFSifmso]' 7824a041c5bSmacallan case $libobj in 7834a041c5bSmacallan *.ada) xform=ada ;; 7844a041c5bSmacallan *.adb) xform=adb ;; 7854a041c5bSmacallan *.ads) xform=ads ;; 7864a041c5bSmacallan *.asm) xform=asm ;; 7874a041c5bSmacallan *.c++) xform=c++ ;; 7884a041c5bSmacallan *.cc) xform=cc ;; 7894a041c5bSmacallan *.ii) xform=ii ;; 7904a041c5bSmacallan *.class) xform=class ;; 7914a041c5bSmacallan *.cpp) xform=cpp ;; 7924a041c5bSmacallan *.cxx) xform=cxx ;; 7934a041c5bSmacallan *.[fF][09]?) xform=[fF][09]. ;; 7944a041c5bSmacallan *.for) xform=for ;; 7954a041c5bSmacallan *.java) xform=java ;; 7964a041c5bSmacallan *.obj) xform=obj ;; 7974a041c5bSmacallan *.sx) xform=sx ;; 7984a041c5bSmacallan esac 7994a041c5bSmacallan 8004a041c5bSmacallan libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 8014a041c5bSmacallan 8024a041c5bSmacallan case $libobj in 8034a041c5bSmacallan *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 8044a041c5bSmacallan *) 8054a041c5bSmacallan $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 8064a041c5bSmacallan exit $EXIT_FAILURE 8074a041c5bSmacallan ;; 8084a041c5bSmacallan esac 8094a041c5bSmacallan 8104a041c5bSmacallan func_infer_tag $base_compile 8114a041c5bSmacallan 8124a041c5bSmacallan for arg in $later; do 8134a041c5bSmacallan case $arg in 8144a041c5bSmacallan -static) 8154a041c5bSmacallan build_old_libs=yes 8164a041c5bSmacallan continue 8174a041c5bSmacallan ;; 8184a041c5bSmacallan 8194a041c5bSmacallan -prefer-pic) 8204a041c5bSmacallan pic_mode=yes 8214a041c5bSmacallan continue 8224a041c5bSmacallan ;; 8234a041c5bSmacallan 8244a041c5bSmacallan -prefer-non-pic) 8254a041c5bSmacallan pic_mode=no 8264a041c5bSmacallan continue 8274a041c5bSmacallan ;; 8284a041c5bSmacallan esac 8294a041c5bSmacallan done 8304a041c5bSmacallan 8314a041c5bSmacallan qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 8324a041c5bSmacallan case $qlibobj in 8334a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8344a041c5bSmacallan qlibobj="\"$qlibobj\"" ;; 8354a041c5bSmacallan esac 8364a041c5bSmacallan test "X$libobj" != "X$qlibobj" \ 8374a041c5bSmacallan && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 8384a041c5bSmacallan && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 8394a041c5bSmacallan objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 8404a041c5bSmacallan xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8414a041c5bSmacallan if test "X$xdir" = "X$obj"; then 8424a041c5bSmacallan xdir= 8434a041c5bSmacallan else 8444a041c5bSmacallan xdir=$xdir/ 8454a041c5bSmacallan fi 8464a041c5bSmacallan lobj=${xdir}$objdir/$objname 8474a041c5bSmacallan 8484a041c5bSmacallan if test -z "$base_compile"; then 8494a041c5bSmacallan $echo "$modename: you must specify a compilation command" 1>&2 8504a041c5bSmacallan $echo "$help" 1>&2 8514a041c5bSmacallan exit $EXIT_FAILURE 8524a041c5bSmacallan fi 8534a041c5bSmacallan 8544a041c5bSmacallan # Delete any leftover library objects. 8554a041c5bSmacallan if test "$build_old_libs" = yes; then 8564a041c5bSmacallan removelist="$obj $lobj $libobj ${libobj}T" 8574a041c5bSmacallan else 8584a041c5bSmacallan removelist="$lobj $libobj ${libobj}T" 8594a041c5bSmacallan fi 8604a041c5bSmacallan 8614a041c5bSmacallan $run $rm $removelist 8624a041c5bSmacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8634a041c5bSmacallan 8644a041c5bSmacallan # On Cygwin there's no "real" PIC flag so we must build both object types 8654a041c5bSmacallan case $host_os in 8664a041c5bSmacallan cygwin* | mingw* | pw32* | os2*) 8674a041c5bSmacallan pic_mode=default 8684a041c5bSmacallan ;; 8694a041c5bSmacallan esac 8704a041c5bSmacallan if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 8714a041c5bSmacallan # non-PIC code in shared libraries is not supported 8724a041c5bSmacallan pic_mode=default 8734a041c5bSmacallan fi 8744a041c5bSmacallan 8754a041c5bSmacallan # Calculate the filename of the output object if compiler does 8764a041c5bSmacallan # not support -o with -c 8774a041c5bSmacallan if test "$compiler_c_o" = no; then 8784a041c5bSmacallan output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 8794a041c5bSmacallan lockfile="$output_obj.lock" 8804a041c5bSmacallan removelist="$removelist $output_obj $lockfile" 8814a041c5bSmacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8824a041c5bSmacallan else 8834a041c5bSmacallan output_obj= 8844a041c5bSmacallan need_locks=no 8854a041c5bSmacallan lockfile= 8864a041c5bSmacallan fi 8874a041c5bSmacallan 8884a041c5bSmacallan # Lock this critical section if it is needed 8894a041c5bSmacallan # We use this script file to make the link, it avoids creating a new file 8904a041c5bSmacallan if test "$need_locks" = yes; then 8914a041c5bSmacallan until $run ln "$progpath" "$lockfile" 2>/dev/null; do 8924a041c5bSmacallan $show "Waiting for $lockfile to be removed" 8934a041c5bSmacallan sleep 2 8944a041c5bSmacallan done 8954a041c5bSmacallan elif test "$need_locks" = warn; then 8964a041c5bSmacallan if test -f "$lockfile"; then 8974a041c5bSmacallan $echo "\ 8984a041c5bSmacallan*** ERROR, $lockfile exists and contains: 8994a041c5bSmacallan`cat $lockfile 2>/dev/null` 9004a041c5bSmacallan 9014a041c5bSmacallanThis indicates that another process is trying to use the same 9024a041c5bSmacallantemporary object file, and libtool could not work around it because 9034a041c5bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 9044a041c5bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 9054a041c5bSmacallanavoid parallel builds (make -j) in this platform, or get a better 9064a041c5bSmacallancompiler." 9074a041c5bSmacallan 9084a041c5bSmacallan $run $rm $removelist 9094a041c5bSmacallan exit $EXIT_FAILURE 9104a041c5bSmacallan fi 9114a041c5bSmacallan $echo "$srcfile" > "$lockfile" 9124a041c5bSmacallan fi 9134a041c5bSmacallan 9144a041c5bSmacallan if test -n "$fix_srcfile_path"; then 9154a041c5bSmacallan eval srcfile=\"$fix_srcfile_path\" 9164a041c5bSmacallan fi 9174a041c5bSmacallan qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 9184a041c5bSmacallan case $qsrcfile in 9194a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 9204a041c5bSmacallan qsrcfile="\"$qsrcfile\"" ;; 9214a041c5bSmacallan esac 9224a041c5bSmacallan 9234a041c5bSmacallan $run $rm "$libobj" "${libobj}T" 9244a041c5bSmacallan 9254a041c5bSmacallan # Create a libtool object file (analogous to a ".la" file), 9264a041c5bSmacallan # but don't create it if we're doing a dry run. 9274a041c5bSmacallan test -z "$run" && cat > ${libobj}T <<EOF 9284a041c5bSmacallan# $libobj - a libtool object file 9294a041c5bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 9304a041c5bSmacallan# 9314a041c5bSmacallan# Please DO NOT delete this file! 9324a041c5bSmacallan# It is necessary for linking the library. 9334a041c5bSmacallan 9344a041c5bSmacallan# Name of the PIC object. 9354a041c5bSmacallanEOF 9364a041c5bSmacallan 9374a041c5bSmacallan # Only build a PIC object if we are building libtool libraries. 9384a041c5bSmacallan if test "$build_libtool_libs" = yes; then 9394a041c5bSmacallan # Without this assignment, base_compile gets emptied. 9404a041c5bSmacallan fbsd_hideous_sh_bug=$base_compile 9414a041c5bSmacallan 9424a041c5bSmacallan if test "$pic_mode" != no; then 9434a041c5bSmacallan command="$base_compile $qsrcfile $pic_flag" 9444a041c5bSmacallan else 9454a041c5bSmacallan # Don't build PIC code 9464a041c5bSmacallan command="$base_compile $qsrcfile" 9474a041c5bSmacallan fi 9484a041c5bSmacallan 9494a041c5bSmacallan if test ! -d "${xdir}$objdir"; then 9504a041c5bSmacallan $show "$mkdir ${xdir}$objdir" 9514a041c5bSmacallan $run $mkdir ${xdir}$objdir 9524a041c5bSmacallan exit_status=$? 9534a041c5bSmacallan if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 9544a041c5bSmacallan exit $exit_status 9554a041c5bSmacallan fi 9564a041c5bSmacallan fi 9574a041c5bSmacallan 9584a041c5bSmacallan if test -z "$output_obj"; then 9594a041c5bSmacallan # Place PIC objects in $objdir 9604a041c5bSmacallan command="$command -o $lobj" 9614a041c5bSmacallan fi 9624a041c5bSmacallan 9634a041c5bSmacallan $run $rm "$lobj" "$output_obj" 9644a041c5bSmacallan 9654a041c5bSmacallan $show "$command" 9664a041c5bSmacallan if $run eval $lt_env "$command"; then : 9674a041c5bSmacallan else 9684a041c5bSmacallan test -n "$output_obj" && $run $rm $removelist 9694a041c5bSmacallan exit $EXIT_FAILURE 9704a041c5bSmacallan fi 9714a041c5bSmacallan 9724a041c5bSmacallan if test "$need_locks" = warn && 9734a041c5bSmacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 9744a041c5bSmacallan $echo "\ 9754a041c5bSmacallan*** ERROR, $lockfile contains: 9764a041c5bSmacallan`cat $lockfile 2>/dev/null` 9774a041c5bSmacallan 9784a041c5bSmacallanbut it should contain: 9794a041c5bSmacallan$srcfile 9804a041c5bSmacallan 9814a041c5bSmacallanThis indicates that another process is trying to use the same 9824a041c5bSmacallantemporary object file, and libtool could not work around it because 9834a041c5bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 9844a041c5bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 9854a041c5bSmacallanavoid parallel builds (make -j) in this platform, or get a better 9864a041c5bSmacallancompiler." 9874a041c5bSmacallan 9884a041c5bSmacallan $run $rm $removelist 9894a041c5bSmacallan exit $EXIT_FAILURE 9904a041c5bSmacallan fi 9914a041c5bSmacallan 9924a041c5bSmacallan # Just move the object if needed, then go on to compile the next one 9934a041c5bSmacallan if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 9944a041c5bSmacallan $show "$mv $output_obj $lobj" 9954a041c5bSmacallan if $run $mv $output_obj $lobj; then : 9964a041c5bSmacallan else 9974a041c5bSmacallan error=$? 9984a041c5bSmacallan $run $rm $removelist 9994a041c5bSmacallan exit $error 10004a041c5bSmacallan fi 10014a041c5bSmacallan fi 10024a041c5bSmacallan 10034a041c5bSmacallan # Append the name of the PIC object to the libtool object file. 10044a041c5bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 10054a041c5bSmacallanpic_object='$objdir/$objname' 10064a041c5bSmacallan 10074a041c5bSmacallanEOF 10084a041c5bSmacallan 10094a041c5bSmacallan # Allow error messages only from the first compilation. 10104a041c5bSmacallan if test "$suppress_opt" = yes; then 10114a041c5bSmacallan suppress_output=' >/dev/null 2>&1' 10124a041c5bSmacallan fi 10134a041c5bSmacallan else 10144a041c5bSmacallan # No PIC object so indicate it doesn't exist in the libtool 10154a041c5bSmacallan # object file. 10164a041c5bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 10174a041c5bSmacallanpic_object=none 10184a041c5bSmacallan 10194a041c5bSmacallanEOF 10204a041c5bSmacallan fi 10214a041c5bSmacallan 10224a041c5bSmacallan # Only build a position-dependent object if we build old libraries. 10234a041c5bSmacallan if test "$build_old_libs" = yes; then 10244a041c5bSmacallan if test "$pic_mode" != yes; then 10254a041c5bSmacallan # Don't build PIC code 10264a041c5bSmacallan command="$base_compile $qsrcfile" 10274a041c5bSmacallan else 10284a041c5bSmacallan command="$base_compile $qsrcfile $pic_flag" 10294a041c5bSmacallan fi 10304a041c5bSmacallan if test "$compiler_c_o" = yes; then 10314a041c5bSmacallan command="$command -o $obj" 10324a041c5bSmacallan fi 10334a041c5bSmacallan 10344a041c5bSmacallan # Suppress compiler output if we already did a PIC compilation. 10354a041c5bSmacallan command="$command$suppress_output" 10364a041c5bSmacallan $run $rm "$obj" "$output_obj" 10374a041c5bSmacallan $show "$command" 10384a041c5bSmacallan if $run eval $lt_env "$command"; then : 10394a041c5bSmacallan else 10404a041c5bSmacallan $run $rm $removelist 10414a041c5bSmacallan exit $EXIT_FAILURE 10424a041c5bSmacallan fi 10434a041c5bSmacallan 10444a041c5bSmacallan if test "$need_locks" = warn && 10454a041c5bSmacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 10464a041c5bSmacallan $echo "\ 10474a041c5bSmacallan*** ERROR, $lockfile contains: 10484a041c5bSmacallan`cat $lockfile 2>/dev/null` 10494a041c5bSmacallan 10504a041c5bSmacallanbut it should contain: 10514a041c5bSmacallan$srcfile 10524a041c5bSmacallan 10534a041c5bSmacallanThis indicates that another process is trying to use the same 10544a041c5bSmacallantemporary object file, and libtool could not work around it because 10554a041c5bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 10564a041c5bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 10574a041c5bSmacallanavoid parallel builds (make -j) in this platform, or get a better 10584a041c5bSmacallancompiler." 10594a041c5bSmacallan 10604a041c5bSmacallan $run $rm $removelist 10614a041c5bSmacallan exit $EXIT_FAILURE 10624a041c5bSmacallan fi 10634a041c5bSmacallan 10644a041c5bSmacallan # Just move the object if needed 10654a041c5bSmacallan if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 10664a041c5bSmacallan $show "$mv $output_obj $obj" 10674a041c5bSmacallan if $run $mv $output_obj $obj; then : 10684a041c5bSmacallan else 10694a041c5bSmacallan error=$? 10704a041c5bSmacallan $run $rm $removelist 10714a041c5bSmacallan exit $error 10724a041c5bSmacallan fi 10734a041c5bSmacallan fi 10744a041c5bSmacallan 10754a041c5bSmacallan # Append the name of the non-PIC object the libtool object file. 10764a041c5bSmacallan # Only append if the libtool object file exists. 10774a041c5bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 10784a041c5bSmacallan# Name of the non-PIC object. 10794a041c5bSmacallannon_pic_object='$objname' 10804a041c5bSmacallan 10814a041c5bSmacallanEOF 10824a041c5bSmacallan else 10834a041c5bSmacallan # Append the name of the non-PIC object the libtool object file. 10844a041c5bSmacallan # Only append if the libtool object file exists. 10854a041c5bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 10864a041c5bSmacallan# Name of the non-PIC object. 10874a041c5bSmacallannon_pic_object=none 10884a041c5bSmacallan 10894a041c5bSmacallanEOF 10904a041c5bSmacallan fi 10914a041c5bSmacallan 10924a041c5bSmacallan $run $mv "${libobj}T" "${libobj}" 10934a041c5bSmacallan 10944a041c5bSmacallan # Unlock the critical section if it was locked 10954a041c5bSmacallan if test "$need_locks" != no; then 10964a041c5bSmacallan $run $rm "$lockfile" 10974a041c5bSmacallan fi 10984a041c5bSmacallan 10994a041c5bSmacallan exit $EXIT_SUCCESS 11004a041c5bSmacallan ;; 11014a041c5bSmacallan 11024a041c5bSmacallan # libtool link mode 11034a041c5bSmacallan link | relink) 11044a041c5bSmacallan modename="$modename: link" 11054a041c5bSmacallan case $host in 11064a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 11074a041c5bSmacallan # It is impossible to link a dll without this setting, and 11084a041c5bSmacallan # we shouldn't force the makefile maintainer to figure out 11094a041c5bSmacallan # which system we are compiling for in order to pass an extra 11104a041c5bSmacallan # flag for every libtool invocation. 11114a041c5bSmacallan # allow_undefined=no 11124a041c5bSmacallan 11134a041c5bSmacallan # FIXME: Unfortunately, there are problems with the above when trying 11144a041c5bSmacallan # to make a dll which has undefined symbols, in which case not 11154a041c5bSmacallan # even a static library is built. For now, we need to specify 11164a041c5bSmacallan # -no-undefined on the libtool link line when we can be certain 11174a041c5bSmacallan # that all symbols are satisfied, otherwise we get a static library. 11184a041c5bSmacallan allow_undefined=yes 11194a041c5bSmacallan ;; 11204a041c5bSmacallan *) 11214a041c5bSmacallan allow_undefined=yes 11224a041c5bSmacallan ;; 11234a041c5bSmacallan esac 11244a041c5bSmacallan libtool_args="$nonopt" 11254a041c5bSmacallan base_compile="$nonopt $@" 11264a041c5bSmacallan compile_command="$nonopt" 11274a041c5bSmacallan finalize_command="$nonopt" 11284a041c5bSmacallan 11294a041c5bSmacallan compile_rpath= 11304a041c5bSmacallan finalize_rpath= 11314a041c5bSmacallan compile_shlibpath= 11324a041c5bSmacallan finalize_shlibpath= 11334a041c5bSmacallan convenience= 11344a041c5bSmacallan old_convenience= 11354a041c5bSmacallan deplibs= 11364a041c5bSmacallan old_deplibs= 11374a041c5bSmacallan compiler_flags= 11384a041c5bSmacallan linker_flags= 11394a041c5bSmacallan dllsearchpath= 11404a041c5bSmacallan lib_search_path=`pwd` 11414a041c5bSmacallan inst_prefix_dir= 11424a041c5bSmacallan 11434a041c5bSmacallan avoid_version=no 11444a041c5bSmacallan dlfiles= 11454a041c5bSmacallan dlprefiles= 11464a041c5bSmacallan dlself=no 11474a041c5bSmacallan export_dynamic=no 11484a041c5bSmacallan export_symbols= 11494a041c5bSmacallan export_symbols_regex= 11504a041c5bSmacallan generated= 11514a041c5bSmacallan libobjs= 11524a041c5bSmacallan ltlibs= 11534a041c5bSmacallan module=no 11544a041c5bSmacallan no_install=no 11554a041c5bSmacallan objs= 11564a041c5bSmacallan non_pic_objects= 11574a041c5bSmacallan notinst_path= # paths that contain not-installed libtool libraries 11584a041c5bSmacallan precious_files_regex= 11594a041c5bSmacallan prefer_static_libs=no 11604a041c5bSmacallan preload=no 11614a041c5bSmacallan prev= 11624a041c5bSmacallan prevarg= 11634a041c5bSmacallan release= 11644a041c5bSmacallan rpath= 11654a041c5bSmacallan xrpath= 11664a041c5bSmacallan perm_rpath= 11674a041c5bSmacallan temp_rpath= 11684a041c5bSmacallan thread_safe=no 11694a041c5bSmacallan vinfo= 11704a041c5bSmacallan vinfo_number=no 11714a041c5bSmacallan single_module="${wl}-single_module" 11724a041c5bSmacallan 11734a041c5bSmacallan func_infer_tag $base_compile 11744a041c5bSmacallan 11754a041c5bSmacallan # We need to know -static, to get the right output filenames. 11764a041c5bSmacallan for arg 11774a041c5bSmacallan do 11784a041c5bSmacallan case $arg in 11794a041c5bSmacallan -all-static | -static | -static-libtool-libs) 11804a041c5bSmacallan case $arg in 11814a041c5bSmacallan -all-static) 11824a041c5bSmacallan if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 11834a041c5bSmacallan $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 11844a041c5bSmacallan fi 11854a041c5bSmacallan if test -n "$link_static_flag"; then 11864a041c5bSmacallan dlopen_self=$dlopen_self_static 11874a041c5bSmacallan fi 11884a041c5bSmacallan prefer_static_libs=yes 11894a041c5bSmacallan ;; 11904a041c5bSmacallan -static) 11914a041c5bSmacallan if test -z "$pic_flag" && test -n "$link_static_flag"; then 11924a041c5bSmacallan dlopen_self=$dlopen_self_static 11934a041c5bSmacallan fi 11944a041c5bSmacallan prefer_static_libs=built 11954a041c5bSmacallan ;; 11964a041c5bSmacallan -static-libtool-libs) 11974a041c5bSmacallan if test -z "$pic_flag" && test -n "$link_static_flag"; then 11984a041c5bSmacallan dlopen_self=$dlopen_self_static 11994a041c5bSmacallan fi 12004a041c5bSmacallan prefer_static_libs=yes 12014a041c5bSmacallan ;; 12024a041c5bSmacallan esac 12034a041c5bSmacallan build_libtool_libs=no 12044a041c5bSmacallan build_old_libs=yes 12054a041c5bSmacallan break 12064a041c5bSmacallan ;; 12074a041c5bSmacallan esac 12084a041c5bSmacallan done 12094a041c5bSmacallan 12104a041c5bSmacallan # See if our shared archives depend on static archives. 12114a041c5bSmacallan test -n "$old_archive_from_new_cmds" && build_old_libs=yes 12124a041c5bSmacallan 12134a041c5bSmacallan # Go through the arguments, transforming them on the way. 12144a041c5bSmacallan while test "$#" -gt 0; do 12154a041c5bSmacallan arg="$1" 12164a041c5bSmacallan shift 12174a041c5bSmacallan case $arg in 12184a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 12194a041c5bSmacallan qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 12204a041c5bSmacallan ;; 12214a041c5bSmacallan *) qarg=$arg ;; 12224a041c5bSmacallan esac 12234a041c5bSmacallan libtool_args="$libtool_args $qarg" 12244a041c5bSmacallan 12254a041c5bSmacallan # If the previous option needs an argument, assign it. 12264a041c5bSmacallan if test -n "$prev"; then 12274a041c5bSmacallan case $prev in 12284a041c5bSmacallan output) 12294a041c5bSmacallan compile_command="$compile_command @OUTPUT@" 12304a041c5bSmacallan finalize_command="$finalize_command @OUTPUT@" 12314a041c5bSmacallan ;; 12324a041c5bSmacallan esac 12334a041c5bSmacallan 12344a041c5bSmacallan case $prev in 12354a041c5bSmacallan dlfiles|dlprefiles) 12364a041c5bSmacallan if test "$preload" = no; then 12374a041c5bSmacallan # Add the symbol object into the linking commands. 12384a041c5bSmacallan compile_command="$compile_command @SYMFILE@" 12394a041c5bSmacallan finalize_command="$finalize_command @SYMFILE@" 12404a041c5bSmacallan preload=yes 12414a041c5bSmacallan fi 12424a041c5bSmacallan case $arg in 12434a041c5bSmacallan *.la | *.lo) ;; # We handle these cases below. 12444a041c5bSmacallan force) 12454a041c5bSmacallan if test "$dlself" = no; then 12464a041c5bSmacallan dlself=needless 12474a041c5bSmacallan export_dynamic=yes 12484a041c5bSmacallan fi 12494a041c5bSmacallan prev= 12504a041c5bSmacallan continue 12514a041c5bSmacallan ;; 12524a041c5bSmacallan self) 12534a041c5bSmacallan if test "$prev" = dlprefiles; then 12544a041c5bSmacallan dlself=yes 12554a041c5bSmacallan elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 12564a041c5bSmacallan dlself=yes 12574a041c5bSmacallan else 12584a041c5bSmacallan dlself=needless 12594a041c5bSmacallan export_dynamic=yes 12604a041c5bSmacallan fi 12614a041c5bSmacallan prev= 12624a041c5bSmacallan continue 12634a041c5bSmacallan ;; 12644a041c5bSmacallan *) 12654a041c5bSmacallan if test "$prev" = dlfiles; then 12664a041c5bSmacallan dlfiles="$dlfiles $arg" 12674a041c5bSmacallan else 12684a041c5bSmacallan dlprefiles="$dlprefiles $arg" 12694a041c5bSmacallan fi 12704a041c5bSmacallan prev= 12714a041c5bSmacallan continue 12724a041c5bSmacallan ;; 12734a041c5bSmacallan esac 12744a041c5bSmacallan ;; 12754a041c5bSmacallan expsyms) 12764a041c5bSmacallan export_symbols="$arg" 12774a041c5bSmacallan if test ! -f "$arg"; then 12784a041c5bSmacallan $echo "$modename: symbol file \`$arg' does not exist" 12794a041c5bSmacallan exit $EXIT_FAILURE 12804a041c5bSmacallan fi 12814a041c5bSmacallan prev= 12824a041c5bSmacallan continue 12834a041c5bSmacallan ;; 12844a041c5bSmacallan expsyms_regex) 12854a041c5bSmacallan export_symbols_regex="$arg" 12864a041c5bSmacallan prev= 12874a041c5bSmacallan continue 12884a041c5bSmacallan ;; 12894a041c5bSmacallan inst_prefix) 12904a041c5bSmacallan inst_prefix_dir="$arg" 12914a041c5bSmacallan prev= 12924a041c5bSmacallan continue 12934a041c5bSmacallan ;; 12944a041c5bSmacallan precious_regex) 12954a041c5bSmacallan precious_files_regex="$arg" 12964a041c5bSmacallan prev= 12974a041c5bSmacallan continue 12984a041c5bSmacallan ;; 12994a041c5bSmacallan release) 13004a041c5bSmacallan release="-$arg" 13014a041c5bSmacallan prev= 13024a041c5bSmacallan continue 13034a041c5bSmacallan ;; 13044a041c5bSmacallan objectlist) 13054a041c5bSmacallan if test -f "$arg"; then 13064a041c5bSmacallan save_arg=$arg 13074a041c5bSmacallan moreargs= 13084a041c5bSmacallan for fil in `cat $save_arg` 13094a041c5bSmacallan do 13104a041c5bSmacallan# moreargs="$moreargs $fil" 13114a041c5bSmacallan arg=$fil 13124a041c5bSmacallan # A libtool-controlled object. 13134a041c5bSmacallan 13144a041c5bSmacallan # Check to see that this really is a libtool object. 13154a041c5bSmacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 13164a041c5bSmacallan pic_object= 13174a041c5bSmacallan non_pic_object= 13184a041c5bSmacallan 13194a041c5bSmacallan # Read the .lo file 13204a041c5bSmacallan # If there is no directory component, then add one. 13214a041c5bSmacallan case $arg in 13224a041c5bSmacallan */* | *\\*) . $arg ;; 13234a041c5bSmacallan *) . ./$arg ;; 13244a041c5bSmacallan esac 13254a041c5bSmacallan 13264a041c5bSmacallan if test -z "$pic_object" || \ 13274a041c5bSmacallan test -z "$non_pic_object" || 13284a041c5bSmacallan test "$pic_object" = none && \ 13294a041c5bSmacallan test "$non_pic_object" = none; then 13304a041c5bSmacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 13314a041c5bSmacallan exit $EXIT_FAILURE 13324a041c5bSmacallan fi 13334a041c5bSmacallan 13344a041c5bSmacallan # Extract subdirectory from the argument. 13354a041c5bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13364a041c5bSmacallan if test "X$xdir" = "X$arg"; then 13374a041c5bSmacallan xdir= 13384a041c5bSmacallan else 13394a041c5bSmacallan xdir="$xdir/" 13404a041c5bSmacallan fi 13414a041c5bSmacallan 13424a041c5bSmacallan if test "$pic_object" != none; then 13434a041c5bSmacallan # Prepend the subdirectory the object is found in. 13444a041c5bSmacallan pic_object="$xdir$pic_object" 13454a041c5bSmacallan 13464a041c5bSmacallan if test "$prev" = dlfiles; then 13474a041c5bSmacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13484a041c5bSmacallan dlfiles="$dlfiles $pic_object" 13494a041c5bSmacallan prev= 13504a041c5bSmacallan continue 13514a041c5bSmacallan else 13524a041c5bSmacallan # If libtool objects are unsupported, then we need to preload. 13534a041c5bSmacallan prev=dlprefiles 13544a041c5bSmacallan fi 13554a041c5bSmacallan fi 13564a041c5bSmacallan 13574a041c5bSmacallan # CHECK ME: I think I busted this. -Ossama 13584a041c5bSmacallan if test "$prev" = dlprefiles; then 13594a041c5bSmacallan # Preload the old-style object. 13604a041c5bSmacallan dlprefiles="$dlprefiles $pic_object" 13614a041c5bSmacallan prev= 13624a041c5bSmacallan fi 13634a041c5bSmacallan 13644a041c5bSmacallan # A PIC object. 13654a041c5bSmacallan libobjs="$libobjs $pic_object" 13664a041c5bSmacallan arg="$pic_object" 13674a041c5bSmacallan fi 13684a041c5bSmacallan 13694a041c5bSmacallan # Non-PIC object. 13704a041c5bSmacallan if test "$non_pic_object" != none; then 13714a041c5bSmacallan # Prepend the subdirectory the object is found in. 13724a041c5bSmacallan non_pic_object="$xdir$non_pic_object" 13734a041c5bSmacallan 13744a041c5bSmacallan # A standard non-PIC object 13754a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 13764a041c5bSmacallan if test -z "$pic_object" || test "$pic_object" = none ; then 13774a041c5bSmacallan arg="$non_pic_object" 13784a041c5bSmacallan fi 13794a041c5bSmacallan else 13804a041c5bSmacallan # If the PIC object exists, use it instead. 13814a041c5bSmacallan # $xdir was prepended to $pic_object above. 13824a041c5bSmacallan non_pic_object="$pic_object" 13834a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 13844a041c5bSmacallan fi 13854a041c5bSmacallan else 13864a041c5bSmacallan # Only an error if not doing a dry-run. 13874a041c5bSmacallan if test -z "$run"; then 13884a041c5bSmacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 13894a041c5bSmacallan exit $EXIT_FAILURE 13904a041c5bSmacallan else 13914a041c5bSmacallan # Dry-run case. 13924a041c5bSmacallan 13934a041c5bSmacallan # Extract subdirectory from the argument. 13944a041c5bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13954a041c5bSmacallan if test "X$xdir" = "X$arg"; then 13964a041c5bSmacallan xdir= 13974a041c5bSmacallan else 13984a041c5bSmacallan xdir="$xdir/" 13994a041c5bSmacallan fi 14004a041c5bSmacallan 14014a041c5bSmacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 14024a041c5bSmacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 14034a041c5bSmacallan libobjs="$libobjs $pic_object" 14044a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 14054a041c5bSmacallan fi 14064a041c5bSmacallan fi 14074a041c5bSmacallan done 14084a041c5bSmacallan else 14094a041c5bSmacallan $echo "$modename: link input file \`$save_arg' does not exist" 14104a041c5bSmacallan exit $EXIT_FAILURE 14114a041c5bSmacallan fi 14124a041c5bSmacallan arg=$save_arg 14134a041c5bSmacallan prev= 14144a041c5bSmacallan continue 14154a041c5bSmacallan ;; 14164a041c5bSmacallan rpath | xrpath) 14174a041c5bSmacallan # We need an absolute path. 14184a041c5bSmacallan case $arg in 14194a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 14204a041c5bSmacallan *) 14214a041c5bSmacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 14224a041c5bSmacallan exit $EXIT_FAILURE 14234a041c5bSmacallan ;; 14244a041c5bSmacallan esac 14254a041c5bSmacallan if test "$prev" = rpath; then 14264a041c5bSmacallan case "$rpath " in 14274a041c5bSmacallan *" $arg "*) ;; 14284a041c5bSmacallan *) rpath="$rpath $arg" ;; 14294a041c5bSmacallan esac 14304a041c5bSmacallan else 14314a041c5bSmacallan case "$xrpath " in 14324a041c5bSmacallan *" $arg "*) ;; 14334a041c5bSmacallan *) xrpath="$xrpath $arg" ;; 14344a041c5bSmacallan esac 14354a041c5bSmacallan fi 14364a041c5bSmacallan prev= 14374a041c5bSmacallan continue 14384a041c5bSmacallan ;; 14394a041c5bSmacallan xcompiler) 14404a041c5bSmacallan compiler_flags="$compiler_flags $qarg" 14414a041c5bSmacallan prev= 14424a041c5bSmacallan compile_command="$compile_command $qarg" 14434a041c5bSmacallan finalize_command="$finalize_command $qarg" 14444a041c5bSmacallan continue 14454a041c5bSmacallan ;; 14464a041c5bSmacallan xlinker) 14474a041c5bSmacallan linker_flags="$linker_flags $qarg" 14484a041c5bSmacallan compiler_flags="$compiler_flags $wl$qarg" 14494a041c5bSmacallan prev= 14504a041c5bSmacallan compile_command="$compile_command $wl$qarg" 14514a041c5bSmacallan finalize_command="$finalize_command $wl$qarg" 14524a041c5bSmacallan continue 14534a041c5bSmacallan ;; 14544a041c5bSmacallan xcclinker) 14554a041c5bSmacallan linker_flags="$linker_flags $qarg" 14564a041c5bSmacallan compiler_flags="$compiler_flags $qarg" 14574a041c5bSmacallan prev= 14584a041c5bSmacallan compile_command="$compile_command $qarg" 14594a041c5bSmacallan finalize_command="$finalize_command $qarg" 14604a041c5bSmacallan continue 14614a041c5bSmacallan ;; 14624a041c5bSmacallan shrext) 14634a041c5bSmacallan shrext_cmds="$arg" 14644a041c5bSmacallan prev= 14654a041c5bSmacallan continue 14664a041c5bSmacallan ;; 14674a041c5bSmacallan darwin_framework|darwin_framework_skip) 14684a041c5bSmacallan test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 14694a041c5bSmacallan compile_command="$compile_command $arg" 14704a041c5bSmacallan finalize_command="$finalize_command $arg" 14714a041c5bSmacallan prev= 14724a041c5bSmacallan continue 14734a041c5bSmacallan ;; 14744a041c5bSmacallan *) 14754a041c5bSmacallan eval "$prev=\"\$arg\"" 14764a041c5bSmacallan prev= 14774a041c5bSmacallan continue 14784a041c5bSmacallan ;; 14794a041c5bSmacallan esac 14804a041c5bSmacallan fi # test -n "$prev" 14814a041c5bSmacallan 14824a041c5bSmacallan prevarg="$arg" 14834a041c5bSmacallan 14844a041c5bSmacallan case $arg in 14854a041c5bSmacallan -all-static) 14864a041c5bSmacallan if test -n "$link_static_flag"; then 14874a041c5bSmacallan compile_command="$compile_command $link_static_flag" 14884a041c5bSmacallan finalize_command="$finalize_command $link_static_flag" 14894a041c5bSmacallan fi 14904a041c5bSmacallan continue 14914a041c5bSmacallan ;; 14924a041c5bSmacallan 14934a041c5bSmacallan -allow-undefined) 14944a041c5bSmacallan # FIXME: remove this flag sometime in the future. 14954a041c5bSmacallan $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 14964a041c5bSmacallan continue 14974a041c5bSmacallan ;; 14984a041c5bSmacallan 14994a041c5bSmacallan -avoid-version) 15004a041c5bSmacallan avoid_version=yes 15014a041c5bSmacallan continue 15024a041c5bSmacallan ;; 15034a041c5bSmacallan 15044a041c5bSmacallan -dlopen) 15054a041c5bSmacallan prev=dlfiles 15064a041c5bSmacallan continue 15074a041c5bSmacallan ;; 15084a041c5bSmacallan 15094a041c5bSmacallan -dlpreopen) 15104a041c5bSmacallan prev=dlprefiles 15114a041c5bSmacallan continue 15124a041c5bSmacallan ;; 15134a041c5bSmacallan 15144a041c5bSmacallan -export-dynamic) 15154a041c5bSmacallan export_dynamic=yes 15164a041c5bSmacallan continue 15174a041c5bSmacallan ;; 15184a041c5bSmacallan 15194a041c5bSmacallan -export-symbols | -export-symbols-regex) 15204a041c5bSmacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 15214a041c5bSmacallan $echo "$modename: more than one -exported-symbols argument is not allowed" 15224a041c5bSmacallan exit $EXIT_FAILURE 15234a041c5bSmacallan fi 15244a041c5bSmacallan if test "X$arg" = "X-export-symbols"; then 15254a041c5bSmacallan prev=expsyms 15264a041c5bSmacallan else 15274a041c5bSmacallan prev=expsyms_regex 15284a041c5bSmacallan fi 15294a041c5bSmacallan continue 15304a041c5bSmacallan ;; 15314a041c5bSmacallan 15324a041c5bSmacallan -framework|-arch|-isysroot) 15334a041c5bSmacallan case " $CC " in 15344a041c5bSmacallan *" ${arg} ${1} "* | *" ${arg} ${1} "*) 15354a041c5bSmacallan prev=darwin_framework_skip ;; 15364a041c5bSmacallan *) compiler_flags="$compiler_flags $arg" 15374a041c5bSmacallan prev=darwin_framework ;; 15384a041c5bSmacallan esac 15394a041c5bSmacallan compile_command="$compile_command $arg" 15404a041c5bSmacallan finalize_command="$finalize_command $arg" 15414a041c5bSmacallan continue 15424a041c5bSmacallan ;; 15434a041c5bSmacallan 15444a041c5bSmacallan -inst-prefix-dir) 15454a041c5bSmacallan prev=inst_prefix 15464a041c5bSmacallan continue 15474a041c5bSmacallan ;; 15484a041c5bSmacallan 15494a041c5bSmacallan # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 15504a041c5bSmacallan # so, if we see these flags be careful not to treat them like -L 15514a041c5bSmacallan -L[A-Z][A-Z]*:*) 15524a041c5bSmacallan case $with_gcc/$host in 15534a041c5bSmacallan no/*-*-irix* | /*-*-irix*) 15544a041c5bSmacallan compile_command="$compile_command $arg" 15554a041c5bSmacallan finalize_command="$finalize_command $arg" 15564a041c5bSmacallan ;; 15574a041c5bSmacallan esac 15584a041c5bSmacallan continue 15594a041c5bSmacallan ;; 15604a041c5bSmacallan 15614a041c5bSmacallan -L*) 15624a041c5bSmacallan dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 15634a041c5bSmacallan # We need an absolute path. 15644a041c5bSmacallan case $dir in 15654a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 15664a041c5bSmacallan *) 15674a041c5bSmacallan absdir=`cd "$dir" && pwd` 15684a041c5bSmacallan if test -z "$absdir"; then 15694a041c5bSmacallan $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 15704a041c5bSmacallan absdir="$dir" 15714a041c5bSmacallan notinst_path="$notinst_path $dir" 15724a041c5bSmacallan fi 15734a041c5bSmacallan dir="$absdir" 15744a041c5bSmacallan ;; 15754a041c5bSmacallan esac 15764a041c5bSmacallan case "$deplibs " in 15774a041c5bSmacallan *" -L$dir "*) ;; 15784a041c5bSmacallan *) 15794a041c5bSmacallan deplibs="$deplibs -L$dir" 15804a041c5bSmacallan lib_search_path="$lib_search_path $dir" 15814a041c5bSmacallan ;; 15824a041c5bSmacallan esac 15834a041c5bSmacallan case $host in 15844a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 15854a041c5bSmacallan testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 15864a041c5bSmacallan case :$dllsearchpath: in 15874a041c5bSmacallan *":$dir:"*) ;; 15884a041c5bSmacallan *) dllsearchpath="$dllsearchpath:$dir";; 15894a041c5bSmacallan esac 15904a041c5bSmacallan case :$dllsearchpath: in 15914a041c5bSmacallan *":$testbindir:"*) ;; 15924a041c5bSmacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 15934a041c5bSmacallan esac 15944a041c5bSmacallan ;; 15954a041c5bSmacallan esac 15964a041c5bSmacallan continue 15974a041c5bSmacallan ;; 15984a041c5bSmacallan 15994a041c5bSmacallan -l*) 16004a041c5bSmacallan if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 16014a041c5bSmacallan case $host in 16024a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 16034a041c5bSmacallan # These systems don't actually have a C or math library (as such) 16044a041c5bSmacallan continue 16054a041c5bSmacallan ;; 16064a041c5bSmacallan *-*-os2*) 16074a041c5bSmacallan # These systems don't actually have a C library (as such) 16084a041c5bSmacallan test "X$arg" = "X-lc" && continue 16094a041c5bSmacallan ;; 16104a041c5bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16114a041c5bSmacallan # Do not include libc due to us having libc/libc_r. 16124a041c5bSmacallan test "X$arg" = "X-lc" && continue 16134a041c5bSmacallan ;; 16144a041c5bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 16154a041c5bSmacallan # Rhapsody C and math libraries are in the System framework 16164a041c5bSmacallan deplibs="$deplibs -framework System" 16174a041c5bSmacallan continue 16184a041c5bSmacallan ;; 16194a041c5bSmacallan *-*-sco3.2v5* | *-*-sco5v6*) 16204a041c5bSmacallan # Causes problems with __ctype 16214a041c5bSmacallan test "X$arg" = "X-lc" && continue 16224a041c5bSmacallan ;; 16234a041c5bSmacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 16244a041c5bSmacallan # Compiler inserts libc in the correct place for threads to work 16254a041c5bSmacallan test "X$arg" = "X-lc" && continue 16264a041c5bSmacallan ;; 16274a041c5bSmacallan esac 16284a041c5bSmacallan elif test "X$arg" = "X-lc_r"; then 16294a041c5bSmacallan case $host in 16304a041c5bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16314a041c5bSmacallan # Do not include libc_r directly, use -pthread flag. 16324a041c5bSmacallan continue 16334a041c5bSmacallan ;; 16344a041c5bSmacallan esac 16354a041c5bSmacallan fi 16364a041c5bSmacallan deplibs="$deplibs $arg" 16374a041c5bSmacallan continue 16384a041c5bSmacallan ;; 16394a041c5bSmacallan 16404a041c5bSmacallan # Tru64 UNIX uses -model [arg] to determine the layout of C++ 16414a041c5bSmacallan # classes, name mangling, and exception handling. 16424a041c5bSmacallan -model) 16434a041c5bSmacallan compile_command="$compile_command $arg" 16444a041c5bSmacallan compiler_flags="$compiler_flags $arg" 16454a041c5bSmacallan finalize_command="$finalize_command $arg" 16464a041c5bSmacallan prev=xcompiler 16474a041c5bSmacallan continue 16484a041c5bSmacallan ;; 16494a041c5bSmacallan 16504a041c5bSmacallan -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 16514a041c5bSmacallan compiler_flags="$compiler_flags $arg" 16524a041c5bSmacallan compile_command="$compile_command $arg" 16534a041c5bSmacallan finalize_command="$finalize_command $arg" 16544a041c5bSmacallan continue 16554a041c5bSmacallan ;; 16564a041c5bSmacallan 16574a041c5bSmacallan -multi_module) 16584a041c5bSmacallan single_module="${wl}-multi_module" 16594a041c5bSmacallan continue 16604a041c5bSmacallan ;; 16614a041c5bSmacallan 16624a041c5bSmacallan -module) 16634a041c5bSmacallan module=yes 16644a041c5bSmacallan continue 16654a041c5bSmacallan ;; 16664a041c5bSmacallan 16674a041c5bSmacallan # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 16684a041c5bSmacallan # -r[0-9][0-9]* specifies the processor on the SGI compiler 16694a041c5bSmacallan # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 16704a041c5bSmacallan # +DA*, +DD* enable 64-bit mode on the HP compiler 16714a041c5bSmacallan # -q* pass through compiler args for the IBM compiler 16724a041c5bSmacallan # -m* pass through architecture-specific compiler args for GCC 16734a041c5bSmacallan # -m*, -t[45]*, -txscale* pass through architecture-specific 16744a041c5bSmacallan # compiler args for GCC 16754a041c5bSmacallan # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 16764a041c5bSmacallan # -F/path gives path to uninstalled frameworks, gcc on darwin 16774a041c5bSmacallan # @file GCC response files 16784a041c5bSmacallan -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 16794a041c5bSmacallan -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 16804a041c5bSmacallan 16814a041c5bSmacallan # Unknown arguments in both finalize_command and compile_command need 16824a041c5bSmacallan # to be aesthetically quoted because they are evaled later. 16834a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 16844a041c5bSmacallan case $arg in 16854a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 16864a041c5bSmacallan arg="\"$arg\"" 16874a041c5bSmacallan ;; 16884a041c5bSmacallan esac 16894a041c5bSmacallan compile_command="$compile_command $arg" 16904a041c5bSmacallan finalize_command="$finalize_command $arg" 16914a041c5bSmacallan compiler_flags="$compiler_flags $arg" 16924a041c5bSmacallan continue 16934a041c5bSmacallan ;; 16944a041c5bSmacallan 16954a041c5bSmacallan -shrext) 16964a041c5bSmacallan prev=shrext 16974a041c5bSmacallan continue 16984a041c5bSmacallan ;; 16994a041c5bSmacallan 17004a041c5bSmacallan -no-fast-install) 17014a041c5bSmacallan fast_install=no 17024a041c5bSmacallan continue 17034a041c5bSmacallan ;; 17044a041c5bSmacallan 17054a041c5bSmacallan -no-install) 17064a041c5bSmacallan case $host in 17074a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 17084a041c5bSmacallan # The PATH hackery in wrapper scripts is required on Windows 17094a041c5bSmacallan # and Darwin in order for the loader to find any dlls it needs. 17104a041c5bSmacallan $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 17114a041c5bSmacallan $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 17124a041c5bSmacallan fast_install=no 17134a041c5bSmacallan ;; 17144a041c5bSmacallan *) no_install=yes ;; 17154a041c5bSmacallan esac 17164a041c5bSmacallan continue 17174a041c5bSmacallan ;; 17184a041c5bSmacallan 17194a041c5bSmacallan -no-undefined) 17204a041c5bSmacallan allow_undefined=no 17214a041c5bSmacallan continue 17224a041c5bSmacallan ;; 17234a041c5bSmacallan 17244a041c5bSmacallan -objectlist) 17254a041c5bSmacallan prev=objectlist 17264a041c5bSmacallan continue 17274a041c5bSmacallan ;; 17284a041c5bSmacallan 17294a041c5bSmacallan -o) prev=output ;; 17304a041c5bSmacallan 17314a041c5bSmacallan -precious-files-regex) 17324a041c5bSmacallan prev=precious_regex 17334a041c5bSmacallan continue 17344a041c5bSmacallan ;; 17354a041c5bSmacallan 17364a041c5bSmacallan -release) 17374a041c5bSmacallan prev=release 17384a041c5bSmacallan continue 17394a041c5bSmacallan ;; 17404a041c5bSmacallan 17414a041c5bSmacallan -rpath) 17424a041c5bSmacallan prev=rpath 17434a041c5bSmacallan continue 17444a041c5bSmacallan ;; 17454a041c5bSmacallan 17464a041c5bSmacallan -R) 17474a041c5bSmacallan prev=xrpath 17484a041c5bSmacallan continue 17494a041c5bSmacallan ;; 17504a041c5bSmacallan 17514a041c5bSmacallan -R*) 17524a041c5bSmacallan dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 17534a041c5bSmacallan # We need an absolute path. 17544a041c5bSmacallan case $dir in 17554a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 17564a041c5bSmacallan *) 17574a041c5bSmacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 17584a041c5bSmacallan exit $EXIT_FAILURE 17594a041c5bSmacallan ;; 17604a041c5bSmacallan esac 17614a041c5bSmacallan case "$xrpath " in 17624a041c5bSmacallan *" $dir "*) ;; 17634a041c5bSmacallan *) xrpath="$xrpath $dir" ;; 17644a041c5bSmacallan esac 17654a041c5bSmacallan continue 17664a041c5bSmacallan ;; 17674a041c5bSmacallan 17684a041c5bSmacallan -static | -static-libtool-libs) 17694a041c5bSmacallan # The effects of -static are defined in a previous loop. 17704a041c5bSmacallan # We used to do the same as -all-static on platforms that 17714a041c5bSmacallan # didn't have a PIC flag, but the assumption that the effects 17724a041c5bSmacallan # would be equivalent was wrong. It would break on at least 17734a041c5bSmacallan # Digital Unix and AIX. 17744a041c5bSmacallan continue 17754a041c5bSmacallan ;; 17764a041c5bSmacallan 17774a041c5bSmacallan -thread-safe) 17784a041c5bSmacallan thread_safe=yes 17794a041c5bSmacallan continue 17804a041c5bSmacallan ;; 17814a041c5bSmacallan 17824a041c5bSmacallan -version-info) 17834a041c5bSmacallan prev=vinfo 17844a041c5bSmacallan continue 17854a041c5bSmacallan ;; 17864a041c5bSmacallan -version-number) 17874a041c5bSmacallan prev=vinfo 17884a041c5bSmacallan vinfo_number=yes 17894a041c5bSmacallan continue 17904a041c5bSmacallan ;; 17914a041c5bSmacallan 17924a041c5bSmacallan -Wc,*) 17934a041c5bSmacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 17944a041c5bSmacallan arg= 17954a041c5bSmacallan save_ifs="$IFS"; IFS=',' 17964a041c5bSmacallan for flag in $args; do 17974a041c5bSmacallan IFS="$save_ifs" 17984a041c5bSmacallan case $flag in 17994a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18004a041c5bSmacallan flag="\"$flag\"" 18014a041c5bSmacallan ;; 18024a041c5bSmacallan esac 18034a041c5bSmacallan arg="$arg $wl$flag" 18044a041c5bSmacallan compiler_flags="$compiler_flags $flag" 18054a041c5bSmacallan done 18064a041c5bSmacallan IFS="$save_ifs" 18074a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18084a041c5bSmacallan ;; 18094a041c5bSmacallan 18104a041c5bSmacallan -Wl,*) 18114a041c5bSmacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 18124a041c5bSmacallan arg= 18134a041c5bSmacallan save_ifs="$IFS"; IFS=',' 18144a041c5bSmacallan for flag in $args; do 18154a041c5bSmacallan IFS="$save_ifs" 18164a041c5bSmacallan case $flag in 18174a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18184a041c5bSmacallan flag="\"$flag\"" 18194a041c5bSmacallan ;; 18204a041c5bSmacallan esac 18214a041c5bSmacallan arg="$arg $wl$flag" 18224a041c5bSmacallan compiler_flags="$compiler_flags $wl$flag" 18234a041c5bSmacallan linker_flags="$linker_flags $flag" 18244a041c5bSmacallan done 18254a041c5bSmacallan IFS="$save_ifs" 18264a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18274a041c5bSmacallan ;; 18284a041c5bSmacallan 18294a041c5bSmacallan -Xcompiler) 18304a041c5bSmacallan prev=xcompiler 18314a041c5bSmacallan continue 18324a041c5bSmacallan ;; 18334a041c5bSmacallan 18344a041c5bSmacallan -Xlinker) 18354a041c5bSmacallan prev=xlinker 18364a041c5bSmacallan continue 18374a041c5bSmacallan ;; 18384a041c5bSmacallan 18394a041c5bSmacallan -XCClinker) 18404a041c5bSmacallan prev=xcclinker 18414a041c5bSmacallan continue 18424a041c5bSmacallan ;; 18434a041c5bSmacallan 18444a041c5bSmacallan # Some other compiler flag. 18454a041c5bSmacallan -* | +*) 18464a041c5bSmacallan # Unknown arguments in both finalize_command and compile_command need 18474a041c5bSmacallan # to be aesthetically quoted because they are evaled later. 18484a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 18494a041c5bSmacallan case $arg in 18504a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18514a041c5bSmacallan arg="\"$arg\"" 18524a041c5bSmacallan ;; 18534a041c5bSmacallan esac 18544a041c5bSmacallan ;; 18554a041c5bSmacallan 18564a041c5bSmacallan *.$objext) 18574a041c5bSmacallan # A standard object. 18584a041c5bSmacallan objs="$objs $arg" 18594a041c5bSmacallan ;; 18604a041c5bSmacallan 18614a041c5bSmacallan *.lo) 18624a041c5bSmacallan # A libtool-controlled object. 18634a041c5bSmacallan 18644a041c5bSmacallan # Check to see that this really is a libtool object. 18654a041c5bSmacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 18664a041c5bSmacallan pic_object= 18674a041c5bSmacallan non_pic_object= 18684a041c5bSmacallan 18694a041c5bSmacallan # Read the .lo file 18704a041c5bSmacallan # If there is no directory component, then add one. 18714a041c5bSmacallan case $arg in 18724a041c5bSmacallan */* | *\\*) . $arg ;; 18734a041c5bSmacallan *) . ./$arg ;; 18744a041c5bSmacallan esac 18754a041c5bSmacallan 18764a041c5bSmacallan if test -z "$pic_object" || \ 18774a041c5bSmacallan test -z "$non_pic_object" || 18784a041c5bSmacallan test "$pic_object" = none && \ 18794a041c5bSmacallan test "$non_pic_object" = none; then 18804a041c5bSmacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 18814a041c5bSmacallan exit $EXIT_FAILURE 18824a041c5bSmacallan fi 18834a041c5bSmacallan 18844a041c5bSmacallan # Extract subdirectory from the argument. 18854a041c5bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18864a041c5bSmacallan if test "X$xdir" = "X$arg"; then 18874a041c5bSmacallan xdir= 18884a041c5bSmacallan else 18894a041c5bSmacallan xdir="$xdir/" 18904a041c5bSmacallan fi 18914a041c5bSmacallan 18924a041c5bSmacallan if test "$pic_object" != none; then 18934a041c5bSmacallan # Prepend the subdirectory the object is found in. 18944a041c5bSmacallan pic_object="$xdir$pic_object" 18954a041c5bSmacallan 18964a041c5bSmacallan if test "$prev" = dlfiles; then 18974a041c5bSmacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 18984a041c5bSmacallan dlfiles="$dlfiles $pic_object" 18994a041c5bSmacallan prev= 19004a041c5bSmacallan continue 19014a041c5bSmacallan else 19024a041c5bSmacallan # If libtool objects are unsupported, then we need to preload. 19034a041c5bSmacallan prev=dlprefiles 19044a041c5bSmacallan fi 19054a041c5bSmacallan fi 19064a041c5bSmacallan 19074a041c5bSmacallan # CHECK ME: I think I busted this. -Ossama 19084a041c5bSmacallan if test "$prev" = dlprefiles; then 19094a041c5bSmacallan # Preload the old-style object. 19104a041c5bSmacallan dlprefiles="$dlprefiles $pic_object" 19114a041c5bSmacallan prev= 19124a041c5bSmacallan fi 19134a041c5bSmacallan 19144a041c5bSmacallan # A PIC object. 19154a041c5bSmacallan libobjs="$libobjs $pic_object" 19164a041c5bSmacallan arg="$pic_object" 19174a041c5bSmacallan fi 19184a041c5bSmacallan 19194a041c5bSmacallan # Non-PIC object. 19204a041c5bSmacallan if test "$non_pic_object" != none; then 19214a041c5bSmacallan # Prepend the subdirectory the object is found in. 19224a041c5bSmacallan non_pic_object="$xdir$non_pic_object" 19234a041c5bSmacallan 19244a041c5bSmacallan # A standard non-PIC object 19254a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 19264a041c5bSmacallan if test -z "$pic_object" || test "$pic_object" = none ; then 19274a041c5bSmacallan arg="$non_pic_object" 19284a041c5bSmacallan fi 19294a041c5bSmacallan else 19304a041c5bSmacallan # If the PIC object exists, use it instead. 19314a041c5bSmacallan # $xdir was prepended to $pic_object above. 19324a041c5bSmacallan non_pic_object="$pic_object" 19334a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 19344a041c5bSmacallan fi 19354a041c5bSmacallan else 19364a041c5bSmacallan # Only an error if not doing a dry-run. 19374a041c5bSmacallan if test -z "$run"; then 19384a041c5bSmacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 19394a041c5bSmacallan exit $EXIT_FAILURE 19404a041c5bSmacallan else 19414a041c5bSmacallan # Dry-run case. 19424a041c5bSmacallan 19434a041c5bSmacallan # Extract subdirectory from the argument. 19444a041c5bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 19454a041c5bSmacallan if test "X$xdir" = "X$arg"; then 19464a041c5bSmacallan xdir= 19474a041c5bSmacallan else 19484a041c5bSmacallan xdir="$xdir/" 19494a041c5bSmacallan fi 19504a041c5bSmacallan 19514a041c5bSmacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 19524a041c5bSmacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 19534a041c5bSmacallan libobjs="$libobjs $pic_object" 19544a041c5bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 19554a041c5bSmacallan fi 19564a041c5bSmacallan fi 19574a041c5bSmacallan ;; 19584a041c5bSmacallan 19594a041c5bSmacallan *.$libext) 19604a041c5bSmacallan # An archive. 19614a041c5bSmacallan deplibs="$deplibs $arg" 19624a041c5bSmacallan old_deplibs="$old_deplibs $arg" 19634a041c5bSmacallan continue 19644a041c5bSmacallan ;; 19654a041c5bSmacallan 19664a041c5bSmacallan *.la) 19674a041c5bSmacallan # A libtool-controlled library. 19684a041c5bSmacallan 19694a041c5bSmacallan if test "$prev" = dlfiles; then 19704a041c5bSmacallan # This library was specified with -dlopen. 19714a041c5bSmacallan dlfiles="$dlfiles $arg" 19724a041c5bSmacallan prev= 19734a041c5bSmacallan elif test "$prev" = dlprefiles; then 19744a041c5bSmacallan # The library was specified with -dlpreopen. 19754a041c5bSmacallan dlprefiles="$dlprefiles $arg" 19764a041c5bSmacallan prev= 19774a041c5bSmacallan else 19784a041c5bSmacallan deplibs="$deplibs $arg" 19794a041c5bSmacallan fi 19804a041c5bSmacallan continue 19814a041c5bSmacallan ;; 19824a041c5bSmacallan 19834a041c5bSmacallan # Some other compiler argument. 19844a041c5bSmacallan *) 19854a041c5bSmacallan # Unknown arguments in both finalize_command and compile_command need 19864a041c5bSmacallan # to be aesthetically quoted because they are evaled later. 19874a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 19884a041c5bSmacallan case $arg in 19894a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19904a041c5bSmacallan arg="\"$arg\"" 19914a041c5bSmacallan ;; 19924a041c5bSmacallan esac 19934a041c5bSmacallan ;; 19944a041c5bSmacallan esac # arg 19954a041c5bSmacallan 19964a041c5bSmacallan # Now actually substitute the argument into the commands. 19974a041c5bSmacallan if test -n "$arg"; then 19984a041c5bSmacallan compile_command="$compile_command $arg" 19994a041c5bSmacallan finalize_command="$finalize_command $arg" 20004a041c5bSmacallan fi 20014a041c5bSmacallan done # argument parsing loop 20024a041c5bSmacallan 20034a041c5bSmacallan if test -n "$prev"; then 20044a041c5bSmacallan $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 20054a041c5bSmacallan $echo "$help" 1>&2 20064a041c5bSmacallan exit $EXIT_FAILURE 20074a041c5bSmacallan fi 20084a041c5bSmacallan 20094a041c5bSmacallan if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 20104a041c5bSmacallan eval arg=\"$export_dynamic_flag_spec\" 20114a041c5bSmacallan compile_command="$compile_command $arg" 20124a041c5bSmacallan finalize_command="$finalize_command $arg" 20134a041c5bSmacallan fi 20144a041c5bSmacallan 20154a041c5bSmacallan oldlibs= 20164a041c5bSmacallan # calculate the name of the file, without its directory 20174a041c5bSmacallan outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 20184a041c5bSmacallan libobjs_save="$libobjs" 20194a041c5bSmacallan 20204a041c5bSmacallan if test -n "$shlibpath_var"; then 20214a041c5bSmacallan # get the directories listed in $shlibpath_var 20224a041c5bSmacallan eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 20234a041c5bSmacallan else 20244a041c5bSmacallan shlib_search_path= 20254a041c5bSmacallan fi 20264a041c5bSmacallan eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 20274a041c5bSmacallan eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 20284a041c5bSmacallan 20294a041c5bSmacallan output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 20304a041c5bSmacallan if test "X$output_objdir" = "X$output"; then 20314a041c5bSmacallan output_objdir="$objdir" 20324a041c5bSmacallan else 20334a041c5bSmacallan output_objdir="$output_objdir/$objdir" 20344a041c5bSmacallan fi 20354a041c5bSmacallan # Create the object directory. 20364a041c5bSmacallan if test ! -d "$output_objdir"; then 20374a041c5bSmacallan $show "$mkdir $output_objdir" 20384a041c5bSmacallan $run $mkdir $output_objdir 20394a041c5bSmacallan exit_status=$? 20404a041c5bSmacallan if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 20414a041c5bSmacallan exit $exit_status 20424a041c5bSmacallan fi 20434a041c5bSmacallan fi 20444a041c5bSmacallan 20454a041c5bSmacallan # Determine the type of output 20464a041c5bSmacallan case $output in 20474a041c5bSmacallan "") 20484a041c5bSmacallan $echo "$modename: you must specify an output file" 1>&2 20494a041c5bSmacallan $echo "$help" 1>&2 20504a041c5bSmacallan exit $EXIT_FAILURE 20514a041c5bSmacallan ;; 20524a041c5bSmacallan *.$libext) linkmode=oldlib ;; 20534a041c5bSmacallan *.lo | *.$objext) linkmode=obj ;; 20544a041c5bSmacallan *.la) linkmode=lib ;; 20554a041c5bSmacallan *) linkmode=prog ;; # Anything else should be a program. 20564a041c5bSmacallan esac 20574a041c5bSmacallan 20584a041c5bSmacallan case $host in 20594a041c5bSmacallan *cygwin* | *mingw* | *pw32*) 20604a041c5bSmacallan # don't eliminate duplications in $postdeps and $predeps 20614a041c5bSmacallan duplicate_compiler_generated_deps=yes 20624a041c5bSmacallan ;; 20634a041c5bSmacallan *) 20644a041c5bSmacallan duplicate_compiler_generated_deps=$duplicate_deps 20654a041c5bSmacallan ;; 20664a041c5bSmacallan esac 20674a041c5bSmacallan specialdeplibs= 20684a041c5bSmacallan 20694a041c5bSmacallan libs= 20704a041c5bSmacallan # Find all interdependent deplibs by searching for libraries 20714a041c5bSmacallan # that are linked more than once (e.g. -la -lb -la) 20724a041c5bSmacallan for deplib in $deplibs; do 20734a041c5bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 20744a041c5bSmacallan case "$libs " in 20754a041c5bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 20764a041c5bSmacallan esac 20774a041c5bSmacallan fi 20784a041c5bSmacallan libs="$libs $deplib" 20794a041c5bSmacallan done 20804a041c5bSmacallan 20814a041c5bSmacallan if test "$linkmode" = lib; then 20824a041c5bSmacallan libs="$predeps $libs $compiler_lib_search_path $postdeps" 20834a041c5bSmacallan 20844a041c5bSmacallan # Compute libraries that are listed more than once in $predeps 20854a041c5bSmacallan # $postdeps and mark them as special (i.e., whose duplicates are 20864a041c5bSmacallan # not to be eliminated). 20874a041c5bSmacallan pre_post_deps= 20884a041c5bSmacallan if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 20894a041c5bSmacallan for pre_post_dep in $predeps $postdeps; do 20904a041c5bSmacallan case "$pre_post_deps " in 20914a041c5bSmacallan *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 20924a041c5bSmacallan esac 20934a041c5bSmacallan pre_post_deps="$pre_post_deps $pre_post_dep" 20944a041c5bSmacallan done 20954a041c5bSmacallan fi 20964a041c5bSmacallan pre_post_deps= 20974a041c5bSmacallan fi 20984a041c5bSmacallan 20994a041c5bSmacallan deplibs= 21004a041c5bSmacallan newdependency_libs= 21014a041c5bSmacallan newlib_search_path= 21024a041c5bSmacallan need_relink=no # whether we're linking any uninstalled libtool libraries 21034a041c5bSmacallan notinst_deplibs= # not-installed libtool libraries 21044a041c5bSmacallan case $linkmode in 21054a041c5bSmacallan lib) 21064a041c5bSmacallan passes="conv link" 21074a041c5bSmacallan for file in $dlfiles $dlprefiles; do 21084a041c5bSmacallan case $file in 21094a041c5bSmacallan *.la) ;; 21104a041c5bSmacallan *) 21114a041c5bSmacallan $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 21124a041c5bSmacallan exit $EXIT_FAILURE 21134a041c5bSmacallan ;; 21144a041c5bSmacallan esac 21154a041c5bSmacallan done 21164a041c5bSmacallan ;; 21174a041c5bSmacallan prog) 21184a041c5bSmacallan compile_deplibs= 21194a041c5bSmacallan finalize_deplibs= 21204a041c5bSmacallan alldeplibs=no 21214a041c5bSmacallan newdlfiles= 21224a041c5bSmacallan newdlprefiles= 21234a041c5bSmacallan passes="conv scan dlopen dlpreopen link" 21244a041c5bSmacallan ;; 21254a041c5bSmacallan *) passes="conv" 21264a041c5bSmacallan ;; 21274a041c5bSmacallan esac 21284a041c5bSmacallan for pass in $passes; do 21294a041c5bSmacallan if test "$linkmode,$pass" = "lib,link" || 21304a041c5bSmacallan test "$linkmode,$pass" = "prog,scan"; then 21314a041c5bSmacallan libs="$deplibs" 21324a041c5bSmacallan deplibs= 21334a041c5bSmacallan fi 21344a041c5bSmacallan if test "$linkmode" = prog; then 21354a041c5bSmacallan case $pass in 21364a041c5bSmacallan dlopen) libs="$dlfiles" ;; 21374a041c5bSmacallan dlpreopen) libs="$dlprefiles" ;; 21384a041c5bSmacallan link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 21394a041c5bSmacallan esac 21404a041c5bSmacallan fi 21414a041c5bSmacallan if test "$pass" = dlopen; then 21424a041c5bSmacallan # Collect dlpreopened libraries 21434a041c5bSmacallan save_deplibs="$deplibs" 21444a041c5bSmacallan deplibs= 21454a041c5bSmacallan fi 21464a041c5bSmacallan for deplib in $libs; do 21474a041c5bSmacallan lib= 21484a041c5bSmacallan found=no 21494a041c5bSmacallan case $deplib in 21504a041c5bSmacallan -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 21514a041c5bSmacallan if test "$linkmode,$pass" = "prog,link"; then 21524a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 21534a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 21544a041c5bSmacallan else 21554a041c5bSmacallan compiler_flags="$compiler_flags $deplib" 21564a041c5bSmacallan fi 21574a041c5bSmacallan continue 21584a041c5bSmacallan ;; 21594a041c5bSmacallan -l*) 21604a041c5bSmacallan if test "$linkmode" != lib && test "$linkmode" != prog; then 21614a041c5bSmacallan $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 21624a041c5bSmacallan continue 21634a041c5bSmacallan fi 21644a041c5bSmacallan name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21654a041c5bSmacallan if test "$linkmode" = lib; then 21664a041c5bSmacallan searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 21674a041c5bSmacallan else 21684a041c5bSmacallan searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 21694a041c5bSmacallan fi 21704a041c5bSmacallan for searchdir in $searchdirs; do 21714a041c5bSmacallan for search_ext in .la $std_shrext .so .a; do 21724a041c5bSmacallan # Search the libtool library 21734a041c5bSmacallan lib="$searchdir/lib${name}${search_ext}" 21744a041c5bSmacallan if test -f "$lib"; then 21754a041c5bSmacallan if test "$search_ext" = ".la"; then 21764a041c5bSmacallan found=yes 21774a041c5bSmacallan else 21784a041c5bSmacallan found=no 21794a041c5bSmacallan fi 21804a041c5bSmacallan break 2 21814a041c5bSmacallan fi 21824a041c5bSmacallan done 21834a041c5bSmacallan done 21844a041c5bSmacallan if test "$found" != yes; then 21854a041c5bSmacallan # deplib doesn't seem to be a libtool library 21864a041c5bSmacallan if test "$linkmode,$pass" = "prog,link"; then 21874a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 21884a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 21894a041c5bSmacallan else 21904a041c5bSmacallan deplibs="$deplib $deplibs" 21914a041c5bSmacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21924a041c5bSmacallan fi 21934a041c5bSmacallan continue 21944a041c5bSmacallan else # deplib is a libtool library 21954a041c5bSmacallan # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 21964a041c5bSmacallan # We need to do some special things here, and not later. 21974a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 21984a041c5bSmacallan case " $predeps $postdeps " in 21994a041c5bSmacallan *" $deplib "*) 22004a041c5bSmacallan if (${SED} -e '2q' $lib | 22014a041c5bSmacallan grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 22024a041c5bSmacallan library_names= 22034a041c5bSmacallan old_library= 22044a041c5bSmacallan case $lib in 22054a041c5bSmacallan */* | *\\*) . $lib ;; 22064a041c5bSmacallan *) . ./$lib ;; 22074a041c5bSmacallan esac 22084a041c5bSmacallan for l in $old_library $library_names; do 22094a041c5bSmacallan ll="$l" 22104a041c5bSmacallan done 22114a041c5bSmacallan if test "X$ll" = "X$old_library" ; then # only static version available 22124a041c5bSmacallan found=no 22134a041c5bSmacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 22144a041c5bSmacallan test "X$ladir" = "X$lib" && ladir="." 22154a041c5bSmacallan lib=$ladir/$old_library 22164a041c5bSmacallan if test "$linkmode,$pass" = "prog,link"; then 22174a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 22184a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 22194a041c5bSmacallan else 22204a041c5bSmacallan deplibs="$deplib $deplibs" 22214a041c5bSmacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 22224a041c5bSmacallan fi 22234a041c5bSmacallan continue 22244a041c5bSmacallan fi 22254a041c5bSmacallan fi 22264a041c5bSmacallan ;; 22274a041c5bSmacallan *) ;; 22284a041c5bSmacallan esac 22294a041c5bSmacallan fi 22304a041c5bSmacallan fi 22314a041c5bSmacallan ;; # -l 22324a041c5bSmacallan -L*) 22334a041c5bSmacallan case $linkmode in 22344a041c5bSmacallan lib) 22354a041c5bSmacallan deplibs="$deplib $deplibs" 22364a041c5bSmacallan test "$pass" = conv && continue 22374a041c5bSmacallan newdependency_libs="$deplib $newdependency_libs" 22384a041c5bSmacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22394a041c5bSmacallan ;; 22404a041c5bSmacallan prog) 22414a041c5bSmacallan if test "$pass" = conv; then 22424a041c5bSmacallan deplibs="$deplib $deplibs" 22434a041c5bSmacallan continue 22444a041c5bSmacallan fi 22454a041c5bSmacallan if test "$pass" = scan; then 22464a041c5bSmacallan deplibs="$deplib $deplibs" 22474a041c5bSmacallan else 22484a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 22494a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 22504a041c5bSmacallan fi 22514a041c5bSmacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22524a041c5bSmacallan ;; 22534a041c5bSmacallan *) 22544a041c5bSmacallan $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 22554a041c5bSmacallan ;; 22564a041c5bSmacallan esac # linkmode 22574a041c5bSmacallan continue 22584a041c5bSmacallan ;; # -L 22594a041c5bSmacallan -R*) 22604a041c5bSmacallan if test "$pass" = link; then 22614a041c5bSmacallan dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 22624a041c5bSmacallan # Make sure the xrpath contains only unique directories. 22634a041c5bSmacallan case "$xrpath " in 22644a041c5bSmacallan *" $dir "*) ;; 22654a041c5bSmacallan *) xrpath="$xrpath $dir" ;; 22664a041c5bSmacallan esac 22674a041c5bSmacallan fi 22684a041c5bSmacallan deplibs="$deplib $deplibs" 22694a041c5bSmacallan continue 22704a041c5bSmacallan ;; 22714a041c5bSmacallan *.la) lib="$deplib" ;; 22724a041c5bSmacallan *.$libext) 22734a041c5bSmacallan if test "$pass" = conv; then 22744a041c5bSmacallan deplibs="$deplib $deplibs" 22754a041c5bSmacallan continue 22764a041c5bSmacallan fi 22774a041c5bSmacallan case $linkmode in 22784a041c5bSmacallan lib) 22794a041c5bSmacallan valid_a_lib=no 22804a041c5bSmacallan case $deplibs_check_method in 22814a041c5bSmacallan match_pattern*) 22824a041c5bSmacallan set dummy $deplibs_check_method 22834a041c5bSmacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 22844a041c5bSmacallan if eval $echo \"$deplib\" 2>/dev/null \ 22854a041c5bSmacallan | $SED 10q \ 22864a041c5bSmacallan | $EGREP "$match_pattern_regex" > /dev/null; then 22874a041c5bSmacallan valid_a_lib=yes 22884a041c5bSmacallan fi 22894a041c5bSmacallan ;; 22904a041c5bSmacallan pass_all) 22914a041c5bSmacallan valid_a_lib=yes 22924a041c5bSmacallan ;; 22934a041c5bSmacallan esac 22944a041c5bSmacallan if test "$valid_a_lib" != yes; then 22954a041c5bSmacallan $echo 22964a041c5bSmacallan $echo "*** Warning: Trying to link with static lib archive $deplib." 22974a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 22984a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 22994a041c5bSmacallan $echo "*** shared version of the library, which you do not appear to have" 23004a041c5bSmacallan $echo "*** because the file extensions .$libext of this argument makes me believe" 23014a041c5bSmacallan $echo "*** that it is just a static archive that I should not used here." 23024a041c5bSmacallan else 23034a041c5bSmacallan $echo 23044a041c5bSmacallan $echo "*** Warning: Linking the shared library $output against the" 23054a041c5bSmacallan $echo "*** static library $deplib is not portable!" 23064a041c5bSmacallan deplibs="$deplib $deplibs" 23074a041c5bSmacallan fi 23084a041c5bSmacallan continue 23094a041c5bSmacallan ;; 23104a041c5bSmacallan prog) 23114a041c5bSmacallan if test "$pass" != link; then 23124a041c5bSmacallan deplibs="$deplib $deplibs" 23134a041c5bSmacallan else 23144a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 23154a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 23164a041c5bSmacallan fi 23174a041c5bSmacallan continue 23184a041c5bSmacallan ;; 23194a041c5bSmacallan esac # linkmode 23204a041c5bSmacallan ;; # *.$libext 23214a041c5bSmacallan *.lo | *.$objext) 23224a041c5bSmacallan if test "$pass" = conv; then 23234a041c5bSmacallan deplibs="$deplib $deplibs" 23244a041c5bSmacallan elif test "$linkmode" = prog; then 23254a041c5bSmacallan if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 23264a041c5bSmacallan # If there is no dlopen support or we're linking statically, 23274a041c5bSmacallan # we need to preload. 23284a041c5bSmacallan newdlprefiles="$newdlprefiles $deplib" 23294a041c5bSmacallan compile_deplibs="$deplib $compile_deplibs" 23304a041c5bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 23314a041c5bSmacallan else 23324a041c5bSmacallan newdlfiles="$newdlfiles $deplib" 23334a041c5bSmacallan fi 23344a041c5bSmacallan fi 23354a041c5bSmacallan continue 23364a041c5bSmacallan ;; 23374a041c5bSmacallan %DEPLIBS%) 23384a041c5bSmacallan alldeplibs=yes 23394a041c5bSmacallan continue 23404a041c5bSmacallan ;; 23414a041c5bSmacallan esac # case $deplib 23424a041c5bSmacallan if test "$found" = yes || test -f "$lib"; then : 23434a041c5bSmacallan else 23444a041c5bSmacallan $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 23454a041c5bSmacallan exit $EXIT_FAILURE 23464a041c5bSmacallan fi 23474a041c5bSmacallan 23484a041c5bSmacallan # Check to see that this really is a libtool archive. 23494a041c5bSmacallan if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 23504a041c5bSmacallan else 23514a041c5bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 23524a041c5bSmacallan exit $EXIT_FAILURE 23534a041c5bSmacallan fi 23544a041c5bSmacallan 23554a041c5bSmacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 23564a041c5bSmacallan test "X$ladir" = "X$lib" && ladir="." 23574a041c5bSmacallan 23584a041c5bSmacallan dlname= 23594a041c5bSmacallan dlopen= 23604a041c5bSmacallan dlpreopen= 23614a041c5bSmacallan libdir= 23624a041c5bSmacallan library_names= 23634a041c5bSmacallan old_library= 23644a041c5bSmacallan # If the library was installed with an old release of libtool, 23654a041c5bSmacallan # it will not redefine variables installed, or shouldnotlink 23664a041c5bSmacallan installed=yes 23674a041c5bSmacallan shouldnotlink=no 23684a041c5bSmacallan avoidtemprpath= 23694a041c5bSmacallan 23704a041c5bSmacallan 23714a041c5bSmacallan # Read the .la file 23724a041c5bSmacallan case $lib in 23734a041c5bSmacallan */* | *\\*) . $lib ;; 23744a041c5bSmacallan *) . ./$lib ;; 23754a041c5bSmacallan esac 23764a041c5bSmacallan 23774a041c5bSmacallan if test "$linkmode,$pass" = "lib,link" || 23784a041c5bSmacallan test "$linkmode,$pass" = "prog,scan" || 23794a041c5bSmacallan { test "$linkmode" != prog && test "$linkmode" != lib; }; then 23804a041c5bSmacallan test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 23814a041c5bSmacallan test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 23824a041c5bSmacallan fi 23834a041c5bSmacallan 23844a041c5bSmacallan if test "$pass" = conv; then 23854a041c5bSmacallan # Only check for convenience libraries 23864a041c5bSmacallan deplibs="$lib $deplibs" 23874a041c5bSmacallan if test -z "$libdir"; then 23884a041c5bSmacallan if test -z "$old_library"; then 23894a041c5bSmacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23904a041c5bSmacallan exit $EXIT_FAILURE 23914a041c5bSmacallan fi 23924a041c5bSmacallan # It is a libtool convenience library, so add in its objects. 23934a041c5bSmacallan convenience="$convenience $ladir/$objdir/$old_library" 23944a041c5bSmacallan old_convenience="$old_convenience $ladir/$objdir/$old_library" 23954a041c5bSmacallan tmp_libs= 23964a041c5bSmacallan for deplib in $dependency_libs; do 23974a041c5bSmacallan deplibs="$deplib $deplibs" 23984a041c5bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 23994a041c5bSmacallan case "$tmp_libs " in 24004a041c5bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 24014a041c5bSmacallan esac 24024a041c5bSmacallan fi 24034a041c5bSmacallan tmp_libs="$tmp_libs $deplib" 24044a041c5bSmacallan done 24054a041c5bSmacallan elif test "$linkmode" != prog && test "$linkmode" != lib; then 24064a041c5bSmacallan $echo "$modename: \`$lib' is not a convenience library" 1>&2 24074a041c5bSmacallan exit $EXIT_FAILURE 24084a041c5bSmacallan fi 24094a041c5bSmacallan continue 24104a041c5bSmacallan fi # $pass = conv 24114a041c5bSmacallan 24124a041c5bSmacallan 24134a041c5bSmacallan # Get the name of the library we link against. 24144a041c5bSmacallan linklib= 24154a041c5bSmacallan for l in $old_library $library_names; do 24164a041c5bSmacallan linklib="$l" 24174a041c5bSmacallan done 24184a041c5bSmacallan if test -z "$linklib"; then 24194a041c5bSmacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 24204a041c5bSmacallan exit $EXIT_FAILURE 24214a041c5bSmacallan fi 24224a041c5bSmacallan 24234a041c5bSmacallan # This library was specified with -dlopen. 24244a041c5bSmacallan if test "$pass" = dlopen; then 24254a041c5bSmacallan if test -z "$libdir"; then 24264a041c5bSmacallan $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 24274a041c5bSmacallan exit $EXIT_FAILURE 24284a041c5bSmacallan fi 24294a041c5bSmacallan if test -z "$dlname" || 24304a041c5bSmacallan test "$dlopen_support" != yes || 24314a041c5bSmacallan test "$build_libtool_libs" = no; then 24324a041c5bSmacallan # If there is no dlname, no dlopen support or we're linking 24334a041c5bSmacallan # statically, we need to preload. We also need to preload any 24344a041c5bSmacallan # dependent libraries so libltdl's deplib preloader doesn't 24354a041c5bSmacallan # bomb out in the load deplibs phase. 24364a041c5bSmacallan dlprefiles="$dlprefiles $lib $dependency_libs" 24374a041c5bSmacallan else 24384a041c5bSmacallan newdlfiles="$newdlfiles $lib" 24394a041c5bSmacallan fi 24404a041c5bSmacallan continue 24414a041c5bSmacallan fi # $pass = dlopen 24424a041c5bSmacallan 24434a041c5bSmacallan # We need an absolute path. 24444a041c5bSmacallan case $ladir in 24454a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 24464a041c5bSmacallan *) 24474a041c5bSmacallan abs_ladir=`cd "$ladir" && pwd` 24484a041c5bSmacallan if test -z "$abs_ladir"; then 24494a041c5bSmacallan $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 24504a041c5bSmacallan $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 24514a041c5bSmacallan abs_ladir="$ladir" 24524a041c5bSmacallan fi 24534a041c5bSmacallan ;; 24544a041c5bSmacallan esac 24554a041c5bSmacallan laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 24564a041c5bSmacallan 24574a041c5bSmacallan # Find the relevant object directory and library name. 24584a041c5bSmacallan if test "X$installed" = Xyes; then 24594a041c5bSmacallan if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24604a041c5bSmacallan $echo "$modename: warning: library \`$lib' was moved." 1>&2 24614a041c5bSmacallan dir="$ladir" 24624a041c5bSmacallan absdir="$abs_ladir" 24634a041c5bSmacallan libdir="$abs_ladir" 24644a041c5bSmacallan else 24654a041c5bSmacallan dir="$libdir" 24664a041c5bSmacallan absdir="$libdir" 24674a041c5bSmacallan fi 24684a041c5bSmacallan test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 24694a041c5bSmacallan else 24704a041c5bSmacallan if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24714a041c5bSmacallan dir="$ladir" 24724a041c5bSmacallan absdir="$abs_ladir" 24734a041c5bSmacallan # Remove this search path later 24744a041c5bSmacallan notinst_path="$notinst_path $abs_ladir" 24754a041c5bSmacallan else 24764a041c5bSmacallan dir="$ladir/$objdir" 24774a041c5bSmacallan absdir="$abs_ladir/$objdir" 24784a041c5bSmacallan # Remove this search path later 24794a041c5bSmacallan notinst_path="$notinst_path $abs_ladir" 24804a041c5bSmacallan fi 24814a041c5bSmacallan fi # $installed = yes 24824a041c5bSmacallan name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 24834a041c5bSmacallan 24844a041c5bSmacallan # This library was specified with -dlpreopen. 24854a041c5bSmacallan if test "$pass" = dlpreopen; then 24864a041c5bSmacallan if test -z "$libdir"; then 24874a041c5bSmacallan $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 24884a041c5bSmacallan exit $EXIT_FAILURE 24894a041c5bSmacallan fi 24904a041c5bSmacallan # Prefer using a static library (so that no silly _DYNAMIC symbols 24914a041c5bSmacallan # are required to link). 24924a041c5bSmacallan if test -n "$old_library"; then 24934a041c5bSmacallan newdlprefiles="$newdlprefiles $dir/$old_library" 24944a041c5bSmacallan # Otherwise, use the dlname, so that lt_dlopen finds it. 24954a041c5bSmacallan elif test -n "$dlname"; then 24964a041c5bSmacallan newdlprefiles="$newdlprefiles $dir/$dlname" 24974a041c5bSmacallan else 24984a041c5bSmacallan newdlprefiles="$newdlprefiles $dir/$linklib" 24994a041c5bSmacallan fi 25004a041c5bSmacallan fi # $pass = dlpreopen 25014a041c5bSmacallan 25024a041c5bSmacallan if test -z "$libdir"; then 25034a041c5bSmacallan # Link the convenience library 25044a041c5bSmacallan if test "$linkmode" = lib; then 25054a041c5bSmacallan deplibs="$dir/$old_library $deplibs" 25064a041c5bSmacallan elif test "$linkmode,$pass" = "prog,link"; then 25074a041c5bSmacallan compile_deplibs="$dir/$old_library $compile_deplibs" 25084a041c5bSmacallan finalize_deplibs="$dir/$old_library $finalize_deplibs" 25094a041c5bSmacallan else 25104a041c5bSmacallan deplibs="$lib $deplibs" # used for prog,scan pass 25114a041c5bSmacallan fi 25124a041c5bSmacallan continue 25134a041c5bSmacallan fi 25144a041c5bSmacallan 25154a041c5bSmacallan 25164a041c5bSmacallan if test "$linkmode" = prog && test "$pass" != link; then 25174a041c5bSmacallan newlib_search_path="$newlib_search_path $ladir" 25184a041c5bSmacallan deplibs="$lib $deplibs" 25194a041c5bSmacallan 25204a041c5bSmacallan linkalldeplibs=no 25214a041c5bSmacallan if test "$link_all_deplibs" != no || test -z "$library_names" || 25224a041c5bSmacallan test "$build_libtool_libs" = no; then 25234a041c5bSmacallan linkalldeplibs=yes 25244a041c5bSmacallan fi 25254a041c5bSmacallan 25264a041c5bSmacallan tmp_libs= 25274a041c5bSmacallan for deplib in $dependency_libs; do 25284a041c5bSmacallan case $deplib in 25294a041c5bSmacallan -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 25304a041c5bSmacallan esac 25314a041c5bSmacallan # Need to link against all dependency_libs? 25324a041c5bSmacallan if test "$linkalldeplibs" = yes; then 25334a041c5bSmacallan deplibs="$deplib $deplibs" 25344a041c5bSmacallan else 25354a041c5bSmacallan # Need to hardcode shared library paths 25364a041c5bSmacallan # or/and link against static libraries 25374a041c5bSmacallan newdependency_libs="$deplib $newdependency_libs" 25384a041c5bSmacallan fi 25394a041c5bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 25404a041c5bSmacallan case "$tmp_libs " in 25414a041c5bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 25424a041c5bSmacallan esac 25434a041c5bSmacallan fi 25444a041c5bSmacallan tmp_libs="$tmp_libs $deplib" 25454a041c5bSmacallan done # for deplib 25464a041c5bSmacallan continue 25474a041c5bSmacallan fi # $linkmode = prog... 25484a041c5bSmacallan 25494a041c5bSmacallan if test "$linkmode,$pass" = "prog,link"; then 25504a041c5bSmacallan if test -n "$library_names" && 25514a041c5bSmacallan { { test "$prefer_static_libs" = no || 25524a041c5bSmacallan test "$prefer_static_libs,$installed" = "built,yes"; } || 25534a041c5bSmacallan test -z "$old_library"; }; then 25544a041c5bSmacallan # We need to hardcode the library path 25554a041c5bSmacallan if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 25564a041c5bSmacallan # Make sure the rpath contains only unique directories. 25574a041c5bSmacallan case "$temp_rpath " in 25584a041c5bSmacallan *" $dir "*) ;; 25594a041c5bSmacallan *" $absdir "*) ;; 25604a041c5bSmacallan *) temp_rpath="$temp_rpath $absdir" ;; 25614a041c5bSmacallan esac 25624a041c5bSmacallan fi 25634a041c5bSmacallan 25644a041c5bSmacallan # Hardcode the library path. 25654a041c5bSmacallan # Skip directories that are in the system default run-time 25664a041c5bSmacallan # search path. 25674a041c5bSmacallan case " $sys_lib_dlsearch_path " in 25684a041c5bSmacallan *" $absdir "*) ;; 25694a041c5bSmacallan *) 25704a041c5bSmacallan case "$compile_rpath " in 25714a041c5bSmacallan *" $absdir "*) ;; 25724a041c5bSmacallan *) compile_rpath="$compile_rpath $absdir" 25734a041c5bSmacallan esac 25744a041c5bSmacallan ;; 25754a041c5bSmacallan esac 25764a041c5bSmacallan case " $sys_lib_dlsearch_path " in 25774a041c5bSmacallan *" $libdir "*) ;; 25784a041c5bSmacallan *) 25794a041c5bSmacallan case "$finalize_rpath " in 25804a041c5bSmacallan *" $libdir "*) ;; 25814a041c5bSmacallan *) finalize_rpath="$finalize_rpath $libdir" 25824a041c5bSmacallan esac 25834a041c5bSmacallan ;; 25844a041c5bSmacallan esac 25854a041c5bSmacallan fi # $linkmode,$pass = prog,link... 25864a041c5bSmacallan 25874a041c5bSmacallan if test "$alldeplibs" = yes && 25884a041c5bSmacallan { test "$deplibs_check_method" = pass_all || 25894a041c5bSmacallan { test "$build_libtool_libs" = yes && 25904a041c5bSmacallan test -n "$library_names"; }; }; then 25914a041c5bSmacallan # We only need to search for static libraries 25924a041c5bSmacallan continue 25934a041c5bSmacallan fi 25944a041c5bSmacallan fi 25954a041c5bSmacallan 25964a041c5bSmacallan link_static=no # Whether the deplib will be linked statically 25974a041c5bSmacallan use_static_libs=$prefer_static_libs 25984a041c5bSmacallan if test "$use_static_libs" = built && test "$installed" = yes ; then 25994a041c5bSmacallan use_static_libs=no 26004a041c5bSmacallan fi 26014a041c5bSmacallan if test -n "$library_names" && 26024a041c5bSmacallan { test "$use_static_libs" = no || test -z "$old_library"; }; then 26034a041c5bSmacallan if test "$installed" = no; then 26044a041c5bSmacallan notinst_deplibs="$notinst_deplibs $lib" 26054a041c5bSmacallan need_relink=yes 26064a041c5bSmacallan fi 26074a041c5bSmacallan # This is a shared library 26084a041c5bSmacallan 26094a041c5bSmacallan # Warn about portability, can't link against -module's on 26104a041c5bSmacallan # some systems (darwin) 26114a041c5bSmacallan if test "$shouldnotlink" = yes && test "$pass" = link ; then 26124a041c5bSmacallan $echo 26134a041c5bSmacallan if test "$linkmode" = prog; then 26144a041c5bSmacallan $echo "*** Warning: Linking the executable $output against the loadable module" 26154a041c5bSmacallan else 26164a041c5bSmacallan $echo "*** Warning: Linking the shared library $output against the loadable module" 26174a041c5bSmacallan fi 26184a041c5bSmacallan $echo "*** $linklib is not portable!" 26194a041c5bSmacallan fi 26204a041c5bSmacallan if test "$linkmode" = lib && 26214a041c5bSmacallan test "$hardcode_into_libs" = yes; then 26224a041c5bSmacallan # Hardcode the library path. 26234a041c5bSmacallan # Skip directories that are in the system default run-time 26244a041c5bSmacallan # search path. 26254a041c5bSmacallan case " $sys_lib_dlsearch_path " in 26264a041c5bSmacallan *" $absdir "*) ;; 26274a041c5bSmacallan *) 26284a041c5bSmacallan case "$compile_rpath " in 26294a041c5bSmacallan *" $absdir "*) ;; 26304a041c5bSmacallan *) compile_rpath="$compile_rpath $absdir" 26314a041c5bSmacallan esac 26324a041c5bSmacallan ;; 26334a041c5bSmacallan esac 26344a041c5bSmacallan case " $sys_lib_dlsearch_path " in 26354a041c5bSmacallan *" $libdir "*) ;; 26364a041c5bSmacallan *) 26374a041c5bSmacallan case "$finalize_rpath " in 26384a041c5bSmacallan *" $libdir "*) ;; 26394a041c5bSmacallan *) finalize_rpath="$finalize_rpath $libdir" 26404a041c5bSmacallan esac 26414a041c5bSmacallan ;; 26424a041c5bSmacallan esac 26434a041c5bSmacallan fi 26444a041c5bSmacallan 26454a041c5bSmacallan if test -n "$old_archive_from_expsyms_cmds"; then 26464a041c5bSmacallan # figure out the soname 26474a041c5bSmacallan set dummy $library_names 26484a041c5bSmacallan realname="$2" 26494a041c5bSmacallan shift; shift 26504a041c5bSmacallan libname=`eval \\$echo \"$libname_spec\"` 26514a041c5bSmacallan # use dlname if we got it. it's perfectly good, no? 26524a041c5bSmacallan if test -n "$dlname"; then 26534a041c5bSmacallan soname="$dlname" 26544a041c5bSmacallan elif test -n "$soname_spec"; then 26554a041c5bSmacallan # bleh windows 26564a041c5bSmacallan case $host in 26574a041c5bSmacallan *cygwin* | mingw*) 26584a041c5bSmacallan major=`expr $current - $age` 26594a041c5bSmacallan versuffix="-$major" 26604a041c5bSmacallan ;; 26614a041c5bSmacallan esac 26624a041c5bSmacallan eval soname=\"$soname_spec\" 26634a041c5bSmacallan else 26644a041c5bSmacallan soname="$realname" 26654a041c5bSmacallan fi 26664a041c5bSmacallan 26674a041c5bSmacallan # Make a new name for the extract_expsyms_cmds to use 26684a041c5bSmacallan soroot="$soname" 26694a041c5bSmacallan soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 26704a041c5bSmacallan newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 26714a041c5bSmacallan 26724a041c5bSmacallan # If the library has no export list, then create one now 26734a041c5bSmacallan if test -f "$output_objdir/$soname-def"; then : 26744a041c5bSmacallan else 26754a041c5bSmacallan $show "extracting exported symbol list from \`$soname'" 26764a041c5bSmacallan save_ifs="$IFS"; IFS='~' 26774a041c5bSmacallan cmds=$extract_expsyms_cmds 26784a041c5bSmacallan for cmd in $cmds; do 26794a041c5bSmacallan IFS="$save_ifs" 26804a041c5bSmacallan eval cmd=\"$cmd\" 26814a041c5bSmacallan $show "$cmd" 26824a041c5bSmacallan $run eval "$cmd" || exit $? 26834a041c5bSmacallan done 26844a041c5bSmacallan IFS="$save_ifs" 26854a041c5bSmacallan fi 26864a041c5bSmacallan 26874a041c5bSmacallan # Create $newlib 26884a041c5bSmacallan if test -f "$output_objdir/$newlib"; then :; else 26894a041c5bSmacallan $show "generating import library for \`$soname'" 26904a041c5bSmacallan save_ifs="$IFS"; IFS='~' 26914a041c5bSmacallan cmds=$old_archive_from_expsyms_cmds 26924a041c5bSmacallan for cmd in $cmds; do 26934a041c5bSmacallan IFS="$save_ifs" 26944a041c5bSmacallan eval cmd=\"$cmd\" 26954a041c5bSmacallan $show "$cmd" 26964a041c5bSmacallan $run eval "$cmd" || exit $? 26974a041c5bSmacallan done 26984a041c5bSmacallan IFS="$save_ifs" 26994a041c5bSmacallan fi 27004a041c5bSmacallan # make sure the library variables are pointing to the new library 27014a041c5bSmacallan dir=$output_objdir 27024a041c5bSmacallan linklib=$newlib 27034a041c5bSmacallan fi # test -n "$old_archive_from_expsyms_cmds" 27044a041c5bSmacallan 27054a041c5bSmacallan if test "$linkmode" = prog || test "$mode" != relink; then 27064a041c5bSmacallan add_shlibpath= 27074a041c5bSmacallan add_dir= 27084a041c5bSmacallan add= 27094a041c5bSmacallan lib_linked=yes 27104a041c5bSmacallan case $hardcode_action in 27114a041c5bSmacallan immediate | unsupported) 27124a041c5bSmacallan if test "$hardcode_direct" = no; then 27134a041c5bSmacallan add="$dir/$linklib" 27144a041c5bSmacallan case $host in 27154a041c5bSmacallan *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 27164a041c5bSmacallan *-*-sysv4*uw2*) add_dir="-L$dir" ;; 27174a041c5bSmacallan *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 27184a041c5bSmacallan *-*-unixware7*) add_dir="-L$dir" ;; 27194a041c5bSmacallan *-*-darwin* ) 27204a041c5bSmacallan # if the lib is a module then we can not link against 27214a041c5bSmacallan # it, someone is ignoring the new warnings I added 27224a041c5bSmacallan if /usr/bin/file -L $add 2> /dev/null | 27234a041c5bSmacallan $EGREP ": [^:]* bundle" >/dev/null ; then 27244a041c5bSmacallan $echo "** Warning, lib $linklib is a module, not a shared library" 27254a041c5bSmacallan if test -z "$old_library" ; then 27264a041c5bSmacallan $echo 27274a041c5bSmacallan $echo "** And there doesn't seem to be a static archive available" 27284a041c5bSmacallan $echo "** The link will probably fail, sorry" 27294a041c5bSmacallan else 27304a041c5bSmacallan add="$dir/$old_library" 27314a041c5bSmacallan fi 27324a041c5bSmacallan fi 27334a041c5bSmacallan esac 27344a041c5bSmacallan elif test "$hardcode_minus_L" = no; then 27354a041c5bSmacallan case $host in 27364a041c5bSmacallan *-*-sunos*) add_shlibpath="$dir" ;; 27374a041c5bSmacallan esac 27384a041c5bSmacallan add_dir="-L$dir" 27394a041c5bSmacallan add="-l$name" 27404a041c5bSmacallan elif test "$hardcode_shlibpath_var" = no; then 27414a041c5bSmacallan add_shlibpath="$dir" 27424a041c5bSmacallan add="-l$name" 27434a041c5bSmacallan else 27444a041c5bSmacallan lib_linked=no 27454a041c5bSmacallan fi 27464a041c5bSmacallan ;; 27474a041c5bSmacallan relink) 27484a041c5bSmacallan if test "$hardcode_direct" = yes; then 27494a041c5bSmacallan add="$dir/$linklib" 27504a041c5bSmacallan elif test "$hardcode_minus_L" = yes; then 27514a041c5bSmacallan add_dir="-L$dir" 27524a041c5bSmacallan # Try looking first in the location we're being installed to. 27534a041c5bSmacallan if test -n "$inst_prefix_dir"; then 27544a041c5bSmacallan case $libdir in 27554a041c5bSmacallan [\\/]*) 27564a041c5bSmacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 27574a041c5bSmacallan ;; 27584a041c5bSmacallan esac 27594a041c5bSmacallan fi 27604a041c5bSmacallan add="-l$name" 27614a041c5bSmacallan elif test "$hardcode_shlibpath_var" = yes; then 27624a041c5bSmacallan add_shlibpath="$dir" 27634a041c5bSmacallan add="-l$name" 27644a041c5bSmacallan else 27654a041c5bSmacallan lib_linked=no 27664a041c5bSmacallan fi 27674a041c5bSmacallan ;; 27684a041c5bSmacallan *) lib_linked=no ;; 27694a041c5bSmacallan esac 27704a041c5bSmacallan 27714a041c5bSmacallan if test "$lib_linked" != yes; then 27724a041c5bSmacallan $echo "$modename: configuration error: unsupported hardcode properties" 27734a041c5bSmacallan exit $EXIT_FAILURE 27744a041c5bSmacallan fi 27754a041c5bSmacallan 27764a041c5bSmacallan if test -n "$add_shlibpath"; then 27774a041c5bSmacallan case :$compile_shlibpath: in 27784a041c5bSmacallan *":$add_shlibpath:"*) ;; 27794a041c5bSmacallan *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 27804a041c5bSmacallan esac 27814a041c5bSmacallan fi 27824a041c5bSmacallan if test "$linkmode" = prog; then 27834a041c5bSmacallan test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 27844a041c5bSmacallan test -n "$add" && compile_deplibs="$add $compile_deplibs" 27854a041c5bSmacallan else 27864a041c5bSmacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 27874a041c5bSmacallan test -n "$add" && deplibs="$add $deplibs" 27884a041c5bSmacallan if test "$hardcode_direct" != yes && \ 27894a041c5bSmacallan test "$hardcode_minus_L" != yes && \ 27904a041c5bSmacallan test "$hardcode_shlibpath_var" = yes; then 27914a041c5bSmacallan case :$finalize_shlibpath: in 27924a041c5bSmacallan *":$libdir:"*) ;; 27934a041c5bSmacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27944a041c5bSmacallan esac 27954a041c5bSmacallan fi 27964a041c5bSmacallan fi 27974a041c5bSmacallan fi 27984a041c5bSmacallan 27994a041c5bSmacallan if test "$linkmode" = prog || test "$mode" = relink; then 28004a041c5bSmacallan add_shlibpath= 28014a041c5bSmacallan add_dir= 28024a041c5bSmacallan add= 28034a041c5bSmacallan # Finalize command for both is simple: just hardcode it. 28044a041c5bSmacallan if test "$hardcode_direct" = yes; then 28054a041c5bSmacallan add="$libdir/$linklib" 28064a041c5bSmacallan elif test "$hardcode_minus_L" = yes; then 28074a041c5bSmacallan add_dir="-L$libdir" 28084a041c5bSmacallan add="-l$name" 28094a041c5bSmacallan elif test "$hardcode_shlibpath_var" = yes; then 28104a041c5bSmacallan case :$finalize_shlibpath: in 28114a041c5bSmacallan *":$libdir:"*) ;; 28124a041c5bSmacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 28134a041c5bSmacallan esac 28144a041c5bSmacallan add="-l$name" 28154a041c5bSmacallan elif test "$hardcode_automatic" = yes; then 28164a041c5bSmacallan if test -n "$inst_prefix_dir" && 28174a041c5bSmacallan test -f "$inst_prefix_dir$libdir/$linklib" ; then 28184a041c5bSmacallan add="$inst_prefix_dir$libdir/$linklib" 28194a041c5bSmacallan else 28204a041c5bSmacallan add="$libdir/$linklib" 28214a041c5bSmacallan fi 28224a041c5bSmacallan else 28234a041c5bSmacallan # We cannot seem to hardcode it, guess we'll fake it. 28244a041c5bSmacallan add_dir="-L$libdir" 28254a041c5bSmacallan # Try looking first in the location we're being installed to. 28264a041c5bSmacallan if test -n "$inst_prefix_dir"; then 28274a041c5bSmacallan case $libdir in 28284a041c5bSmacallan [\\/]*) 28294a041c5bSmacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 28304a041c5bSmacallan ;; 28314a041c5bSmacallan esac 28324a041c5bSmacallan fi 28334a041c5bSmacallan add="-l$name" 28344a041c5bSmacallan fi 28354a041c5bSmacallan 28364a041c5bSmacallan if test "$linkmode" = prog; then 28374a041c5bSmacallan test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 28384a041c5bSmacallan test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 28394a041c5bSmacallan else 28404a041c5bSmacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 28414a041c5bSmacallan test -n "$add" && deplibs="$add $deplibs" 28424a041c5bSmacallan fi 28434a041c5bSmacallan fi 28444a041c5bSmacallan elif test "$linkmode" = prog; then 28454a041c5bSmacallan # Here we assume that one of hardcode_direct or hardcode_minus_L 28464a041c5bSmacallan # is not unsupported. This is valid on all known static and 28474a041c5bSmacallan # shared platforms. 28484a041c5bSmacallan if test "$hardcode_direct" != unsupported; then 28494a041c5bSmacallan test -n "$old_library" && linklib="$old_library" 28504a041c5bSmacallan compile_deplibs="$dir/$linklib $compile_deplibs" 28514a041c5bSmacallan finalize_deplibs="$dir/$linklib $finalize_deplibs" 28524a041c5bSmacallan else 28534a041c5bSmacallan compile_deplibs="-l$name -L$dir $compile_deplibs" 28544a041c5bSmacallan finalize_deplibs="-l$name -L$dir $finalize_deplibs" 28554a041c5bSmacallan fi 28564a041c5bSmacallan elif test "$build_libtool_libs" = yes; then 28574a041c5bSmacallan # Not a shared library 28584a041c5bSmacallan if test "$deplibs_check_method" != pass_all; then 28594a041c5bSmacallan # We're trying link a shared library against a static one 28604a041c5bSmacallan # but the system doesn't support it. 28614a041c5bSmacallan 28624a041c5bSmacallan # Just print a warning and add the library to dependency_libs so 28634a041c5bSmacallan # that the program can be linked against the static library. 28644a041c5bSmacallan $echo 28654a041c5bSmacallan $echo "*** Warning: This system can not link to static lib archive $lib." 28664a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 28674a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 28684a041c5bSmacallan $echo "*** shared version of the library, which you do not appear to have." 28694a041c5bSmacallan if test "$module" = yes; then 28704a041c5bSmacallan $echo "*** But as you try to build a module library, libtool will still create " 28714a041c5bSmacallan $echo "*** a static module, that should work as long as the dlopening application" 28724a041c5bSmacallan $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 28734a041c5bSmacallan if test -z "$global_symbol_pipe"; then 28744a041c5bSmacallan $echo 28754a041c5bSmacallan $echo "*** However, this would only work if libtool was able to extract symbol" 28764a041c5bSmacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 28774a041c5bSmacallan $echo "*** not find such a program. So, this module is probably useless." 28784a041c5bSmacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 28794a041c5bSmacallan fi 28804a041c5bSmacallan if test "$build_old_libs" = no; then 28814a041c5bSmacallan build_libtool_libs=module 28824a041c5bSmacallan build_old_libs=yes 28834a041c5bSmacallan else 28844a041c5bSmacallan build_libtool_libs=no 28854a041c5bSmacallan fi 28864a041c5bSmacallan fi 28874a041c5bSmacallan else 28884a041c5bSmacallan deplibs="$dir/$old_library $deplibs" 28894a041c5bSmacallan link_static=yes 28904a041c5bSmacallan fi 28914a041c5bSmacallan fi # link shared/static library? 28924a041c5bSmacallan 28934a041c5bSmacallan if test "$linkmode" = lib; then 28944a041c5bSmacallan if test -n "$dependency_libs" && 28954a041c5bSmacallan { test "$hardcode_into_libs" != yes || 28964a041c5bSmacallan test "$build_old_libs" = yes || 28974a041c5bSmacallan test "$link_static" = yes; }; then 28984a041c5bSmacallan # Extract -R from dependency_libs 28994a041c5bSmacallan temp_deplibs= 29004a041c5bSmacallan for libdir in $dependency_libs; do 29014a041c5bSmacallan case $libdir in 29024a041c5bSmacallan -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 29034a041c5bSmacallan case " $xrpath " in 29044a041c5bSmacallan *" $temp_xrpath "*) ;; 29054a041c5bSmacallan *) xrpath="$xrpath $temp_xrpath";; 29064a041c5bSmacallan esac;; 29074a041c5bSmacallan *) temp_deplibs="$temp_deplibs $libdir";; 29084a041c5bSmacallan esac 29094a041c5bSmacallan done 29104a041c5bSmacallan dependency_libs="$temp_deplibs" 29114a041c5bSmacallan fi 29124a041c5bSmacallan 29134a041c5bSmacallan newlib_search_path="$newlib_search_path $absdir" 29144a041c5bSmacallan # Link against this library 29154a041c5bSmacallan test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 29164a041c5bSmacallan # ... and its dependency_libs 29174a041c5bSmacallan tmp_libs= 29184a041c5bSmacallan for deplib in $dependency_libs; do 29194a041c5bSmacallan newdependency_libs="$deplib $newdependency_libs" 29204a041c5bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 29214a041c5bSmacallan case "$tmp_libs " in 29224a041c5bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 29234a041c5bSmacallan esac 29244a041c5bSmacallan fi 29254a041c5bSmacallan tmp_libs="$tmp_libs $deplib" 29264a041c5bSmacallan done 29274a041c5bSmacallan 29284a041c5bSmacallan if test "$link_all_deplibs" != no; then 29294a041c5bSmacallan # Add the search paths of all dependency libraries 29304a041c5bSmacallan for deplib in $dependency_libs; do 29314a041c5bSmacallan case $deplib in 29324a041c5bSmacallan -L*) path="$deplib" ;; 29334a041c5bSmacallan *.la) 29344a041c5bSmacallan dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 29354a041c5bSmacallan test "X$dir" = "X$deplib" && dir="." 29364a041c5bSmacallan # We need an absolute path. 29374a041c5bSmacallan case $dir in 29384a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 29394a041c5bSmacallan *) 29404a041c5bSmacallan absdir=`cd "$dir" && pwd` 29414a041c5bSmacallan if test -z "$absdir"; then 29424a041c5bSmacallan $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 29434a041c5bSmacallan absdir="$dir" 29444a041c5bSmacallan fi 29454a041c5bSmacallan ;; 29464a041c5bSmacallan esac 29474a041c5bSmacallan if grep "^installed=no" $deplib > /dev/null; then 29484a041c5bSmacallan path="$absdir/$objdir" 29494a041c5bSmacallan else 29504a041c5bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29514a041c5bSmacallan if test -z "$libdir"; then 29524a041c5bSmacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 29534a041c5bSmacallan exit $EXIT_FAILURE 29544a041c5bSmacallan fi 29554a041c5bSmacallan if test "$absdir" != "$libdir"; then 29564a041c5bSmacallan $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 29574a041c5bSmacallan fi 29584a041c5bSmacallan path="$absdir" 29594a041c5bSmacallan fi 29604a041c5bSmacallan depdepl= 29614a041c5bSmacallan case $host in 29624a041c5bSmacallan *-*-darwin*) 29634a041c5bSmacallan # we do not want to link against static libs, 29644a041c5bSmacallan # but need to link against shared 29654a041c5bSmacallan eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29664a041c5bSmacallan eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29674a041c5bSmacallan if test -n "$deplibrary_names" ; then 29684a041c5bSmacallan for tmp in $deplibrary_names ; do 29694a041c5bSmacallan depdepl=$tmp 29704a041c5bSmacallan done 29714a041c5bSmacallan if test -f "$deplibdir/$depdepl" ; then 29724a041c5bSmacallan depdepl="$deplibdir/$depdepl" 29734a041c5bSmacallan elif test -f "$path/$depdepl" ; then 29744a041c5bSmacallan depdepl="$path/$depdepl" 29754a041c5bSmacallan else 29764a041c5bSmacallan # Can't find it, oh well... 29774a041c5bSmacallan depdepl= 29784a041c5bSmacallan fi 29794a041c5bSmacallan # do not add paths which are already there 29804a041c5bSmacallan case " $newlib_search_path " in 29814a041c5bSmacallan *" $path "*) ;; 29824a041c5bSmacallan *) newlib_search_path="$newlib_search_path $path";; 29834a041c5bSmacallan esac 29844a041c5bSmacallan fi 29854a041c5bSmacallan path="" 29864a041c5bSmacallan ;; 29874a041c5bSmacallan *) 29884a041c5bSmacallan path="-L$path" 29894a041c5bSmacallan ;; 29904a041c5bSmacallan esac 29914a041c5bSmacallan ;; 29924a041c5bSmacallan -l*) 29934a041c5bSmacallan case $host in 29944a041c5bSmacallan *-*-darwin*) 29954a041c5bSmacallan # Again, we only want to link against shared libraries 29964a041c5bSmacallan eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 29974a041c5bSmacallan for tmp in $newlib_search_path ; do 29984a041c5bSmacallan if test -f "$tmp/lib$tmp_libs.dylib" ; then 29994a041c5bSmacallan eval depdepl="$tmp/lib$tmp_libs.dylib" 30004a041c5bSmacallan break 30014a041c5bSmacallan fi 30024a041c5bSmacallan done 30034a041c5bSmacallan path="" 30044a041c5bSmacallan ;; 30054a041c5bSmacallan *) continue ;; 30064a041c5bSmacallan esac 30074a041c5bSmacallan ;; 30084a041c5bSmacallan *) continue ;; 30094a041c5bSmacallan esac 30104a041c5bSmacallan case " $deplibs " in 30114a041c5bSmacallan *" $path "*) ;; 30124a041c5bSmacallan *) deplibs="$path $deplibs" ;; 30134a041c5bSmacallan esac 30144a041c5bSmacallan case " $deplibs " in 30154a041c5bSmacallan *" $depdepl "*) ;; 30164a041c5bSmacallan *) deplibs="$depdepl $deplibs" ;; 30174a041c5bSmacallan esac 30184a041c5bSmacallan done 30194a041c5bSmacallan fi # link_all_deplibs != no 30204a041c5bSmacallan fi # linkmode = lib 30214a041c5bSmacallan done # for deplib in $libs 30224a041c5bSmacallan dependency_libs="$newdependency_libs" 30234a041c5bSmacallan if test "$pass" = dlpreopen; then 30244a041c5bSmacallan # Link the dlpreopened libraries before other libraries 30254a041c5bSmacallan for deplib in $save_deplibs; do 30264a041c5bSmacallan deplibs="$deplib $deplibs" 30274a041c5bSmacallan done 30284a041c5bSmacallan fi 30294a041c5bSmacallan if test "$pass" != dlopen; then 30304a041c5bSmacallan if test "$pass" != conv; then 30314a041c5bSmacallan # Make sure lib_search_path contains only unique directories. 30324a041c5bSmacallan lib_search_path= 30334a041c5bSmacallan for dir in $newlib_search_path; do 30344a041c5bSmacallan case "$lib_search_path " in 30354a041c5bSmacallan *" $dir "*) ;; 30364a041c5bSmacallan *) lib_search_path="$lib_search_path $dir" ;; 30374a041c5bSmacallan esac 30384a041c5bSmacallan done 30394a041c5bSmacallan newlib_search_path= 30404a041c5bSmacallan fi 30414a041c5bSmacallan 30424a041c5bSmacallan if test "$linkmode,$pass" != "prog,link"; then 30434a041c5bSmacallan vars="deplibs" 30444a041c5bSmacallan else 30454a041c5bSmacallan vars="compile_deplibs finalize_deplibs" 30464a041c5bSmacallan fi 30474a041c5bSmacallan for var in $vars dependency_libs; do 30484a041c5bSmacallan # Add libraries to $var in reverse order 30494a041c5bSmacallan eval tmp_libs=\"\$$var\" 30504a041c5bSmacallan new_libs= 30514a041c5bSmacallan for deplib in $tmp_libs; do 30524a041c5bSmacallan # FIXME: Pedantically, this is the right thing to do, so 30534a041c5bSmacallan # that some nasty dependency loop isn't accidentally 30544a041c5bSmacallan # broken: 30554a041c5bSmacallan #new_libs="$deplib $new_libs" 30564a041c5bSmacallan # Pragmatically, this seems to cause very few problems in 30574a041c5bSmacallan # practice: 30584a041c5bSmacallan case $deplib in 30594a041c5bSmacallan -L*) new_libs="$deplib $new_libs" ;; 30604a041c5bSmacallan -R*) ;; 30614a041c5bSmacallan *) 30624a041c5bSmacallan # And here is the reason: when a library appears more 30634a041c5bSmacallan # than once as an explicit dependence of a library, or 30644a041c5bSmacallan # is implicitly linked in more than once by the 30654a041c5bSmacallan # compiler, it is considered special, and multiple 30664a041c5bSmacallan # occurrences thereof are not removed. Compare this 30674a041c5bSmacallan # with having the same library being listed as a 30684a041c5bSmacallan # dependency of multiple other libraries: in this case, 30694a041c5bSmacallan # we know (pedantically, we assume) the library does not 30704a041c5bSmacallan # need to be listed more than once, so we keep only the 30714a041c5bSmacallan # last copy. This is not always right, but it is rare 30724a041c5bSmacallan # enough that we require users that really mean to play 30734a041c5bSmacallan # such unportable linking tricks to link the library 30744a041c5bSmacallan # using -Wl,-lname, so that libtool does not consider it 30754a041c5bSmacallan # for duplicate removal. 30764a041c5bSmacallan case " $specialdeplibs " in 30774a041c5bSmacallan *" $deplib "*) new_libs="$deplib $new_libs" ;; 30784a041c5bSmacallan *) 30794a041c5bSmacallan case " $new_libs " in 30804a041c5bSmacallan *" $deplib "*) ;; 30814a041c5bSmacallan *) new_libs="$deplib $new_libs" ;; 30824a041c5bSmacallan esac 30834a041c5bSmacallan ;; 30844a041c5bSmacallan esac 30854a041c5bSmacallan ;; 30864a041c5bSmacallan esac 30874a041c5bSmacallan done 30884a041c5bSmacallan tmp_libs= 30894a041c5bSmacallan for deplib in $new_libs; do 30904a041c5bSmacallan case $deplib in 30914a041c5bSmacallan -L*) 30924a041c5bSmacallan case " $tmp_libs " in 30934a041c5bSmacallan *" $deplib "*) ;; 30944a041c5bSmacallan *) tmp_libs="$tmp_libs $deplib" ;; 30954a041c5bSmacallan esac 30964a041c5bSmacallan ;; 30974a041c5bSmacallan *) tmp_libs="$tmp_libs $deplib" ;; 30984a041c5bSmacallan esac 30994a041c5bSmacallan done 31004a041c5bSmacallan eval $var=\"$tmp_libs\" 31014a041c5bSmacallan done # for var 31024a041c5bSmacallan fi 31034a041c5bSmacallan # Last step: remove runtime libs from dependency_libs 31044a041c5bSmacallan # (they stay in deplibs) 31054a041c5bSmacallan tmp_libs= 31064a041c5bSmacallan for i in $dependency_libs ; do 31074a041c5bSmacallan case " $predeps $postdeps $compiler_lib_search_path " in 31084a041c5bSmacallan *" $i "*) 31094a041c5bSmacallan i="" 31104a041c5bSmacallan ;; 31114a041c5bSmacallan esac 31124a041c5bSmacallan if test -n "$i" ; then 31134a041c5bSmacallan tmp_libs="$tmp_libs $i" 31144a041c5bSmacallan fi 31154a041c5bSmacallan done 31164a041c5bSmacallan dependency_libs=$tmp_libs 31174a041c5bSmacallan done # for pass 31184a041c5bSmacallan if test "$linkmode" = prog; then 31194a041c5bSmacallan dlfiles="$newdlfiles" 31204a041c5bSmacallan dlprefiles="$newdlprefiles" 31214a041c5bSmacallan fi 31224a041c5bSmacallan 31234a041c5bSmacallan case $linkmode in 31244a041c5bSmacallan oldlib) 31254a041c5bSmacallan case " $deplibs" in 31264a041c5bSmacallan *\ -l* | *\ -L*) 31274a041c5bSmacallan $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 31284a041c5bSmacallan esac 31294a041c5bSmacallan 31304a041c5bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 31314a041c5bSmacallan $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 31324a041c5bSmacallan fi 31334a041c5bSmacallan 31344a041c5bSmacallan if test -n "$rpath"; then 31354a041c5bSmacallan $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 31364a041c5bSmacallan fi 31374a041c5bSmacallan 31384a041c5bSmacallan if test -n "$xrpath"; then 31394a041c5bSmacallan $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 31404a041c5bSmacallan fi 31414a041c5bSmacallan 31424a041c5bSmacallan if test -n "$vinfo"; then 31434a041c5bSmacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 31444a041c5bSmacallan fi 31454a041c5bSmacallan 31464a041c5bSmacallan if test -n "$release"; then 31474a041c5bSmacallan $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 31484a041c5bSmacallan fi 31494a041c5bSmacallan 31504a041c5bSmacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 31514a041c5bSmacallan $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 31524a041c5bSmacallan fi 31534a041c5bSmacallan 31544a041c5bSmacallan # Now set the variables for building old libraries. 31554a041c5bSmacallan build_libtool_libs=no 31564a041c5bSmacallan oldlibs="$output" 31574a041c5bSmacallan objs="$objs$old_deplibs" 31584a041c5bSmacallan ;; 31594a041c5bSmacallan 31604a041c5bSmacallan lib) 31614a041c5bSmacallan # Make sure we only generate libraries of the form `libNAME.la'. 31624a041c5bSmacallan case $outputname in 31634a041c5bSmacallan lib*) 31644a041c5bSmacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 31654a041c5bSmacallan eval shared_ext=\"$shrext_cmds\" 31664a041c5bSmacallan eval libname=\"$libname_spec\" 31674a041c5bSmacallan ;; 31684a041c5bSmacallan *) 31694a041c5bSmacallan if test "$module" = no; then 31704a041c5bSmacallan $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 31714a041c5bSmacallan $echo "$help" 1>&2 31724a041c5bSmacallan exit $EXIT_FAILURE 31734a041c5bSmacallan fi 31744a041c5bSmacallan if test "$need_lib_prefix" != no; then 31754a041c5bSmacallan # Add the "lib" prefix for modules if required 31764a041c5bSmacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31774a041c5bSmacallan eval shared_ext=\"$shrext_cmds\" 31784a041c5bSmacallan eval libname=\"$libname_spec\" 31794a041c5bSmacallan else 31804a041c5bSmacallan libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31814a041c5bSmacallan fi 31824a041c5bSmacallan ;; 31834a041c5bSmacallan esac 31844a041c5bSmacallan 31854a041c5bSmacallan if test -n "$objs"; then 31864a041c5bSmacallan if test "$deplibs_check_method" != pass_all; then 31874a041c5bSmacallan $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 31884a041c5bSmacallan exit $EXIT_FAILURE 31894a041c5bSmacallan else 31904a041c5bSmacallan $echo 31914a041c5bSmacallan $echo "*** Warning: Linking the shared library $output against the non-libtool" 31924a041c5bSmacallan $echo "*** objects $objs is not portable!" 31934a041c5bSmacallan libobjs="$libobjs $objs" 31944a041c5bSmacallan fi 31954a041c5bSmacallan fi 31964a041c5bSmacallan 31974a041c5bSmacallan if test "$dlself" != no; then 31984a041c5bSmacallan $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 31994a041c5bSmacallan fi 32004a041c5bSmacallan 32014a041c5bSmacallan set dummy $rpath 32024a041c5bSmacallan if test "$#" -gt 2; then 32034a041c5bSmacallan $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 32044a041c5bSmacallan fi 32054a041c5bSmacallan install_libdir="$2" 32064a041c5bSmacallan 32074a041c5bSmacallan oldlibs= 32084a041c5bSmacallan if test -z "$rpath"; then 32094a041c5bSmacallan if test "$build_libtool_libs" = yes; then 32104a041c5bSmacallan # Building a libtool convenience library. 32114a041c5bSmacallan # Some compilers have problems with a `.al' extension so 32124a041c5bSmacallan # convenience libraries should have the same extension an 32134a041c5bSmacallan # archive normally would. 32144a041c5bSmacallan oldlibs="$output_objdir/$libname.$libext $oldlibs" 32154a041c5bSmacallan build_libtool_libs=convenience 32164a041c5bSmacallan build_old_libs=yes 32174a041c5bSmacallan fi 32184a041c5bSmacallan 32194a041c5bSmacallan if test -n "$vinfo"; then 32204a041c5bSmacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 32214a041c5bSmacallan fi 32224a041c5bSmacallan 32234a041c5bSmacallan if test -n "$release"; then 32244a041c5bSmacallan $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 32254a041c5bSmacallan fi 32264a041c5bSmacallan else 32274a041c5bSmacallan 32284a041c5bSmacallan # Parse the version information argument. 32294a041c5bSmacallan save_ifs="$IFS"; IFS=':' 32304a041c5bSmacallan set dummy $vinfo 0 0 0 32314a041c5bSmacallan IFS="$save_ifs" 32324a041c5bSmacallan 32334a041c5bSmacallan if test -n "$8"; then 32344a041c5bSmacallan $echo "$modename: too many parameters to \`-version-info'" 1>&2 32354a041c5bSmacallan $echo "$help" 1>&2 32364a041c5bSmacallan exit $EXIT_FAILURE 32374a041c5bSmacallan fi 32384a041c5bSmacallan 32394a041c5bSmacallan # convert absolute version numbers to libtool ages 32404a041c5bSmacallan # this retains compatibility with .la files and attempts 32414a041c5bSmacallan # to make the code below a bit more comprehensible 32424a041c5bSmacallan 32434a041c5bSmacallan case $vinfo_number in 32444a041c5bSmacallan yes) 32454a041c5bSmacallan number_major="$2" 32464a041c5bSmacallan number_minor="$3" 32474a041c5bSmacallan number_revision="$4" 32484a041c5bSmacallan # 32494a041c5bSmacallan # There are really only two kinds -- those that 32504a041c5bSmacallan # use the current revision as the major version 32514a041c5bSmacallan # and those that subtract age and use age as 32524a041c5bSmacallan # a minor version. But, then there is irix 32534a041c5bSmacallan # which has an extra 1 added just for fun 32544a041c5bSmacallan # 32554a041c5bSmacallan case $version_type in 32564a041c5bSmacallan darwin|linux|osf|windows|none) 32574a041c5bSmacallan current=`expr $number_major + $number_minor` 32584a041c5bSmacallan age="$number_minor" 32594a041c5bSmacallan revision="$number_revision" 32604a041c5bSmacallan ;; 32614a041c5bSmacallan freebsd-aout|freebsd-elf|sunos) 32624a041c5bSmacallan current="$number_major" 32634a041c5bSmacallan revision="$number_minor" 32644a041c5bSmacallan age="0" 32654a041c5bSmacallan ;; 32664a041c5bSmacallan irix|nonstopux) 32674a041c5bSmacallan current=`expr $number_major + $number_minor` 32684a041c5bSmacallan age="$number_minor" 32694a041c5bSmacallan revision="$number_minor" 32704a041c5bSmacallan lt_irix_increment=no 32714a041c5bSmacallan ;; 32724a041c5bSmacallan esac 32734a041c5bSmacallan ;; 32744a041c5bSmacallan no) 32754a041c5bSmacallan current="$2" 32764a041c5bSmacallan revision="$3" 32774a041c5bSmacallan age="$4" 32784a041c5bSmacallan ;; 32794a041c5bSmacallan esac 32804a041c5bSmacallan 32814a041c5bSmacallan # Check that each of the things are valid numbers. 32824a041c5bSmacallan case $current in 32834a041c5bSmacallan 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]) ;; 32844a041c5bSmacallan *) 32854a041c5bSmacallan $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 32864a041c5bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32874a041c5bSmacallan exit $EXIT_FAILURE 32884a041c5bSmacallan ;; 32894a041c5bSmacallan esac 32904a041c5bSmacallan 32914a041c5bSmacallan case $revision in 32924a041c5bSmacallan 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]) ;; 32934a041c5bSmacallan *) 32944a041c5bSmacallan $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 32954a041c5bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32964a041c5bSmacallan exit $EXIT_FAILURE 32974a041c5bSmacallan ;; 32984a041c5bSmacallan esac 32994a041c5bSmacallan 33004a041c5bSmacallan case $age in 33014a041c5bSmacallan 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]) ;; 33024a041c5bSmacallan *) 33034a041c5bSmacallan $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 33044a041c5bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33054a041c5bSmacallan exit $EXIT_FAILURE 33064a041c5bSmacallan ;; 33074a041c5bSmacallan esac 33084a041c5bSmacallan 33094a041c5bSmacallan if test "$age" -gt "$current"; then 33104a041c5bSmacallan $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 33114a041c5bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33124a041c5bSmacallan exit $EXIT_FAILURE 33134a041c5bSmacallan fi 33144a041c5bSmacallan 33154a041c5bSmacallan # Calculate the version variables. 33164a041c5bSmacallan major= 33174a041c5bSmacallan versuffix= 33184a041c5bSmacallan verstring= 33194a041c5bSmacallan case $version_type in 33204a041c5bSmacallan none) ;; 33214a041c5bSmacallan 33224a041c5bSmacallan darwin) 33234a041c5bSmacallan # Like Linux, but with the current version available in 33244a041c5bSmacallan # verstring for coding it into the library header 33254a041c5bSmacallan major=.`expr $current - $age` 33264a041c5bSmacallan versuffix="$major.$age.$revision" 33274a041c5bSmacallan # Darwin ld doesn't like 0 for these options... 33284a041c5bSmacallan minor_current=`expr $current + 1` 33294a041c5bSmacallan xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 33304a041c5bSmacallan verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 33314a041c5bSmacallan ;; 33324a041c5bSmacallan 33334a041c5bSmacallan freebsd-aout) 33344a041c5bSmacallan major=".$current" 33354a041c5bSmacallan versuffix=".$current.$revision"; 33364a041c5bSmacallan ;; 33374a041c5bSmacallan 33384a041c5bSmacallan freebsd-elf) 33394a041c5bSmacallan major=".$current" 33404a041c5bSmacallan versuffix=".$current"; 33414a041c5bSmacallan ;; 33424a041c5bSmacallan 33434a041c5bSmacallan irix | nonstopux) 33444a041c5bSmacallan if test "X$lt_irix_increment" = "Xno"; then 33454a041c5bSmacallan major=`expr $current - $age` 33464a041c5bSmacallan else 33474a041c5bSmacallan major=`expr $current - $age + 1` 33484a041c5bSmacallan fi 33494a041c5bSmacallan case $version_type in 33504a041c5bSmacallan nonstopux) verstring_prefix=nonstopux ;; 33514a041c5bSmacallan *) verstring_prefix=sgi ;; 33524a041c5bSmacallan esac 33534a041c5bSmacallan verstring="$verstring_prefix$major.$revision" 33544a041c5bSmacallan 33554a041c5bSmacallan # Add in all the interfaces that we are compatible with. 33564a041c5bSmacallan loop=$revision 33574a041c5bSmacallan while test "$loop" -ne 0; do 33584a041c5bSmacallan iface=`expr $revision - $loop` 33594a041c5bSmacallan loop=`expr $loop - 1` 33604a041c5bSmacallan verstring="$verstring_prefix$major.$iface:$verstring" 33614a041c5bSmacallan done 33624a041c5bSmacallan 33634a041c5bSmacallan # Before this point, $major must not contain `.'. 33644a041c5bSmacallan major=.$major 33654a041c5bSmacallan versuffix="$major.$revision" 33664a041c5bSmacallan ;; 33674a041c5bSmacallan 33684a041c5bSmacallan linux) 33694a041c5bSmacallan major=.`expr $current - $age` 33704a041c5bSmacallan versuffix="$major.$age.$revision" 33714a041c5bSmacallan ;; 33724a041c5bSmacallan 33734a041c5bSmacallan osf) 33744a041c5bSmacallan major=.`expr $current - $age` 33754a041c5bSmacallan versuffix=".$current.$age.$revision" 33764a041c5bSmacallan verstring="$current.$age.$revision" 33774a041c5bSmacallan 33784a041c5bSmacallan # Add in all the interfaces that we are compatible with. 33794a041c5bSmacallan loop=$age 33804a041c5bSmacallan while test "$loop" -ne 0; do 33814a041c5bSmacallan iface=`expr $current - $loop` 33824a041c5bSmacallan loop=`expr $loop - 1` 33834a041c5bSmacallan verstring="$verstring:${iface}.0" 33844a041c5bSmacallan done 33854a041c5bSmacallan 33864a041c5bSmacallan # Make executables depend on our current version. 33874a041c5bSmacallan verstring="$verstring:${current}.0" 33884a041c5bSmacallan ;; 33894a041c5bSmacallan 33904a041c5bSmacallan sunos) 33914a041c5bSmacallan major=".$current" 33924a041c5bSmacallan versuffix=".$current.$revision" 33934a041c5bSmacallan ;; 33944a041c5bSmacallan 33954a041c5bSmacallan windows) 33964a041c5bSmacallan # Use '-' rather than '.', since we only want one 33974a041c5bSmacallan # extension on DOS 8.3 filesystems. 33984a041c5bSmacallan major=`expr $current - $age` 33994a041c5bSmacallan versuffix="-$major" 34004a041c5bSmacallan ;; 34014a041c5bSmacallan 34024a041c5bSmacallan *) 34034a041c5bSmacallan $echo "$modename: unknown library version type \`$version_type'" 1>&2 34044a041c5bSmacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 34054a041c5bSmacallan exit $EXIT_FAILURE 34064a041c5bSmacallan ;; 34074a041c5bSmacallan esac 34084a041c5bSmacallan 34094a041c5bSmacallan # Clear the version info if we defaulted, and they specified a release. 34104a041c5bSmacallan if test -z "$vinfo" && test -n "$release"; then 34114a041c5bSmacallan major= 34124a041c5bSmacallan case $version_type in 34134a041c5bSmacallan darwin) 34144a041c5bSmacallan # we can't check for "0.0" in archive_cmds due to quoting 34154a041c5bSmacallan # problems, so we reset it completely 34164a041c5bSmacallan verstring= 34174a041c5bSmacallan ;; 34184a041c5bSmacallan *) 34194a041c5bSmacallan verstring="0.0" 34204a041c5bSmacallan ;; 34214a041c5bSmacallan esac 34224a041c5bSmacallan if test "$need_version" = no; then 34234a041c5bSmacallan versuffix= 34244a041c5bSmacallan else 34254a041c5bSmacallan versuffix=".0.0" 34264a041c5bSmacallan fi 34274a041c5bSmacallan fi 34284a041c5bSmacallan 34294a041c5bSmacallan # Remove version info from name if versioning should be avoided 34304a041c5bSmacallan if test "$avoid_version" = yes && test "$need_version" = no; then 34314a041c5bSmacallan major= 34324a041c5bSmacallan versuffix= 34334a041c5bSmacallan verstring="" 34344a041c5bSmacallan fi 34354a041c5bSmacallan 34364a041c5bSmacallan # Check to see if the archive will have undefined symbols. 34374a041c5bSmacallan if test "$allow_undefined" = yes; then 34384a041c5bSmacallan if test "$allow_undefined_flag" = unsupported; then 34394a041c5bSmacallan $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 34404a041c5bSmacallan build_libtool_libs=no 34414a041c5bSmacallan build_old_libs=yes 34424a041c5bSmacallan fi 34434a041c5bSmacallan else 34444a041c5bSmacallan # Don't allow undefined symbols. 34454a041c5bSmacallan allow_undefined_flag="$no_undefined_flag" 34464a041c5bSmacallan fi 34474a041c5bSmacallan fi 34484a041c5bSmacallan 34494a041c5bSmacallan if test "$mode" != relink; then 34504a041c5bSmacallan # Remove our outputs, but don't remove object files since they 34514a041c5bSmacallan # may have been created when compiling PIC objects. 34524a041c5bSmacallan removelist= 34534a041c5bSmacallan tempremovelist=`$echo "$output_objdir/*"` 34544a041c5bSmacallan for p in $tempremovelist; do 34554a041c5bSmacallan case $p in 34564a041c5bSmacallan *.$objext) 34574a041c5bSmacallan ;; 34584a041c5bSmacallan $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 34594a041c5bSmacallan if test "X$precious_files_regex" != "X"; then 34604a041c5bSmacallan if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 34614a041c5bSmacallan then 34624a041c5bSmacallan continue 34634a041c5bSmacallan fi 34644a041c5bSmacallan fi 34654a041c5bSmacallan removelist="$removelist $p" 34664a041c5bSmacallan ;; 34674a041c5bSmacallan *) ;; 34684a041c5bSmacallan esac 34694a041c5bSmacallan done 34704a041c5bSmacallan if test -n "$removelist"; then 34714a041c5bSmacallan $show "${rm}r $removelist" 34724a041c5bSmacallan $run ${rm}r $removelist 34734a041c5bSmacallan fi 34744a041c5bSmacallan fi 34754a041c5bSmacallan 34764a041c5bSmacallan # Now set the variables for building old libraries. 34774a041c5bSmacallan if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 34784a041c5bSmacallan oldlibs="$oldlibs $output_objdir/$libname.$libext" 34794a041c5bSmacallan 34804a041c5bSmacallan # Transform .lo files to .o files. 34814a041c5bSmacallan oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 34824a041c5bSmacallan fi 34834a041c5bSmacallan 34844a041c5bSmacallan # Eliminate all temporary directories. 34854a041c5bSmacallan #for path in $notinst_path; do 34864a041c5bSmacallan # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 34874a041c5bSmacallan # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 34884a041c5bSmacallan # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 34894a041c5bSmacallan #done 34904a041c5bSmacallan 34914a041c5bSmacallan if test -n "$xrpath"; then 34924a041c5bSmacallan # If the user specified any rpath flags, then add them. 34934a041c5bSmacallan temp_xrpath= 34944a041c5bSmacallan for libdir in $xrpath; do 34954a041c5bSmacallan temp_xrpath="$temp_xrpath -R$libdir" 34964a041c5bSmacallan case "$finalize_rpath " in 34974a041c5bSmacallan *" $libdir "*) ;; 34984a041c5bSmacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 34994a041c5bSmacallan esac 35004a041c5bSmacallan done 35014a041c5bSmacallan if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 35024a041c5bSmacallan dependency_libs="$temp_xrpath $dependency_libs" 35034a041c5bSmacallan fi 35044a041c5bSmacallan fi 35054a041c5bSmacallan 35064a041c5bSmacallan # Make sure dlfiles contains only unique files that won't be dlpreopened 35074a041c5bSmacallan old_dlfiles="$dlfiles" 35084a041c5bSmacallan dlfiles= 35094a041c5bSmacallan for lib in $old_dlfiles; do 35104a041c5bSmacallan case " $dlprefiles $dlfiles " in 35114a041c5bSmacallan *" $lib "*) ;; 35124a041c5bSmacallan *) dlfiles="$dlfiles $lib" ;; 35134a041c5bSmacallan esac 35144a041c5bSmacallan done 35154a041c5bSmacallan 35164a041c5bSmacallan # Make sure dlprefiles contains only unique files 35174a041c5bSmacallan old_dlprefiles="$dlprefiles" 35184a041c5bSmacallan dlprefiles= 35194a041c5bSmacallan for lib in $old_dlprefiles; do 35204a041c5bSmacallan case "$dlprefiles " in 35214a041c5bSmacallan *" $lib "*) ;; 35224a041c5bSmacallan *) dlprefiles="$dlprefiles $lib" ;; 35234a041c5bSmacallan esac 35244a041c5bSmacallan done 35254a041c5bSmacallan 35264a041c5bSmacallan if test "$build_libtool_libs" = yes; then 35274a041c5bSmacallan if test -n "$rpath"; then 35284a041c5bSmacallan case $host in 35294a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 35304a041c5bSmacallan # these systems don't actually have a c library (as such)! 35314a041c5bSmacallan ;; 35324a041c5bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 35334a041c5bSmacallan # Rhapsody C library is in the System framework 35344a041c5bSmacallan deplibs="$deplibs -framework System" 35354a041c5bSmacallan ;; 35364a041c5bSmacallan *-*-netbsd*) 35374a041c5bSmacallan # Don't link with libc until the a.out ld.so is fixed. 35384a041c5bSmacallan ;; 35394a041c5bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 35404a041c5bSmacallan # Do not include libc due to us having libc/libc_r. 35414a041c5bSmacallan ;; 35424a041c5bSmacallan *-*-sco3.2v5* | *-*-sco5v6*) 35434a041c5bSmacallan # Causes problems with __ctype 35444a041c5bSmacallan ;; 35454a041c5bSmacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 35464a041c5bSmacallan # Compiler inserts libc in the correct place for threads to work 35474a041c5bSmacallan ;; 35484a041c5bSmacallan *) 35494a041c5bSmacallan # Add libc to deplibs on all other systems if necessary. 35504a041c5bSmacallan if test "$build_libtool_need_lc" = "yes"; then 35514a041c5bSmacallan deplibs="$deplibs -lc" 35524a041c5bSmacallan fi 35534a041c5bSmacallan ;; 35544a041c5bSmacallan esac 35554a041c5bSmacallan fi 35564a041c5bSmacallan 35574a041c5bSmacallan # Transform deplibs into only deplibs that can be linked in shared. 35584a041c5bSmacallan name_save=$name 35594a041c5bSmacallan libname_save=$libname 35604a041c5bSmacallan release_save=$release 35614a041c5bSmacallan versuffix_save=$versuffix 35624a041c5bSmacallan major_save=$major 35634a041c5bSmacallan # I'm not sure if I'm treating the release correctly. I think 35644a041c5bSmacallan # release should show up in the -l (ie -lgmp5) so we don't want to 35654a041c5bSmacallan # add it in twice. Is that correct? 35664a041c5bSmacallan release="" 35674a041c5bSmacallan versuffix="" 35684a041c5bSmacallan major="" 35694a041c5bSmacallan newdeplibs= 35704a041c5bSmacallan droppeddeps=no 35714a041c5bSmacallan case $deplibs_check_method in 35724a041c5bSmacallan pass_all) 35734a041c5bSmacallan # Don't check for shared/static. Everything works. 35744a041c5bSmacallan # This might be a little naive. We might want to check 35754a041c5bSmacallan # whether the library exists or not. But this is on 35764a041c5bSmacallan # osf3 & osf4 and I'm not really sure... Just 35774a041c5bSmacallan # implementing what was already the behavior. 35784a041c5bSmacallan newdeplibs=$deplibs 35794a041c5bSmacallan ;; 35804a041c5bSmacallan test_compile) 35814a041c5bSmacallan # This code stresses the "libraries are programs" paradigm to its 35824a041c5bSmacallan # limits. Maybe even breaks it. We compile a program, linking it 35834a041c5bSmacallan # against the deplibs as a proxy for the library. Then we can check 35844a041c5bSmacallan # whether they linked in statically or dynamically with ldd. 35854a041c5bSmacallan $rm conftest.c 35864a041c5bSmacallan cat > conftest.c <<EOF 35874a041c5bSmacallan int main() { return 0; } 35884a041c5bSmacallanEOF 35894a041c5bSmacallan $rm conftest 35904a041c5bSmacallan if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 35914a041c5bSmacallan ldd_output=`ldd conftest` 35924a041c5bSmacallan for i in $deplibs; do 35934a041c5bSmacallan name=`expr $i : '-l\(.*\)'` 35944a041c5bSmacallan # If $name is empty we are operating on a -L argument. 35954a041c5bSmacallan if test "$name" != "" && test "$name" != "0"; then 35964a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 35974a041c5bSmacallan case " $predeps $postdeps " in 35984a041c5bSmacallan *" $i "*) 35994a041c5bSmacallan newdeplibs="$newdeplibs $i" 36004a041c5bSmacallan i="" 36014a041c5bSmacallan ;; 36024a041c5bSmacallan esac 36034a041c5bSmacallan fi 36044a041c5bSmacallan if test -n "$i" ; then 36054a041c5bSmacallan libname=`eval \\$echo \"$libname_spec\"` 36064a041c5bSmacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 36074a041c5bSmacallan set dummy $deplib_matches 36084a041c5bSmacallan deplib_match=$2 36094a041c5bSmacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36104a041c5bSmacallan newdeplibs="$newdeplibs $i" 36114a041c5bSmacallan else 36124a041c5bSmacallan droppeddeps=yes 36134a041c5bSmacallan $echo 36144a041c5bSmacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 36154a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 36164a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 36174a041c5bSmacallan $echo "*** shared version of the library, which I believe you do not have" 36184a041c5bSmacallan $echo "*** because a test_compile did reveal that the linker did not use it for" 36194a041c5bSmacallan $echo "*** its dynamic dependency list that programs get resolved with at runtime." 36204a041c5bSmacallan fi 36214a041c5bSmacallan fi 36224a041c5bSmacallan else 36234a041c5bSmacallan newdeplibs="$newdeplibs $i" 36244a041c5bSmacallan fi 36254a041c5bSmacallan done 36264a041c5bSmacallan else 36274a041c5bSmacallan # Error occurred in the first compile. Let's try to salvage 36284a041c5bSmacallan # the situation: Compile a separate program for each library. 36294a041c5bSmacallan for i in $deplibs; do 36304a041c5bSmacallan name=`expr $i : '-l\(.*\)'` 36314a041c5bSmacallan # If $name is empty we are operating on a -L argument. 36324a041c5bSmacallan if test "$name" != "" && test "$name" != "0"; then 36334a041c5bSmacallan $rm conftest 36344a041c5bSmacallan if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 36354a041c5bSmacallan ldd_output=`ldd conftest` 36364a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36374a041c5bSmacallan case " $predeps $postdeps " in 36384a041c5bSmacallan *" $i "*) 36394a041c5bSmacallan newdeplibs="$newdeplibs $i" 36404a041c5bSmacallan i="" 36414a041c5bSmacallan ;; 36424a041c5bSmacallan esac 36434a041c5bSmacallan fi 36444a041c5bSmacallan if test -n "$i" ; then 36454a041c5bSmacallan libname=`eval \\$echo \"$libname_spec\"` 36464a041c5bSmacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 36474a041c5bSmacallan set dummy $deplib_matches 36484a041c5bSmacallan deplib_match=$2 36494a041c5bSmacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36504a041c5bSmacallan newdeplibs="$newdeplibs $i" 36514a041c5bSmacallan else 36524a041c5bSmacallan droppeddeps=yes 36534a041c5bSmacallan $echo 36544a041c5bSmacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 36554a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 36564a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 36574a041c5bSmacallan $echo "*** shared version of the library, which you do not appear to have" 36584a041c5bSmacallan $echo "*** because a test_compile did reveal that the linker did not use this one" 36594a041c5bSmacallan $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 36604a041c5bSmacallan fi 36614a041c5bSmacallan fi 36624a041c5bSmacallan else 36634a041c5bSmacallan droppeddeps=yes 36644a041c5bSmacallan $echo 36654a041c5bSmacallan $echo "*** Warning! Library $i is needed by this library but I was not able to" 36664a041c5bSmacallan $echo "*** make it link in! You will probably need to install it or some" 36674a041c5bSmacallan $echo "*** library that it depends on before this library will be fully" 36684a041c5bSmacallan $echo "*** functional. Installing it before continuing would be even better." 36694a041c5bSmacallan fi 36704a041c5bSmacallan else 36714a041c5bSmacallan newdeplibs="$newdeplibs $i" 36724a041c5bSmacallan fi 36734a041c5bSmacallan done 36744a041c5bSmacallan fi 36754a041c5bSmacallan ;; 36764a041c5bSmacallan file_magic*) 36774a041c5bSmacallan set dummy $deplibs_check_method 36784a041c5bSmacallan file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36794a041c5bSmacallan for a_deplib in $deplibs; do 36804a041c5bSmacallan name=`expr $a_deplib : '-l\(.*\)'` 36814a041c5bSmacallan # If $name is empty we are operating on a -L argument. 36824a041c5bSmacallan if test "$name" != "" && test "$name" != "0"; then 36834a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36844a041c5bSmacallan case " $predeps $postdeps " in 36854a041c5bSmacallan *" $a_deplib "*) 36864a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 36874a041c5bSmacallan a_deplib="" 36884a041c5bSmacallan ;; 36894a041c5bSmacallan esac 36904a041c5bSmacallan fi 36914a041c5bSmacallan if test -n "$a_deplib" ; then 36924a041c5bSmacallan libname=`eval \\$echo \"$libname_spec\"` 36934a041c5bSmacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 36944a041c5bSmacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 36954a041c5bSmacallan for potent_lib in $potential_libs; do 36964a041c5bSmacallan # Follow soft links. 36974a041c5bSmacallan if ls -lLd "$potent_lib" 2>/dev/null \ 36984a041c5bSmacallan | grep " -> " >/dev/null; then 36994a041c5bSmacallan continue 37004a041c5bSmacallan fi 37014a041c5bSmacallan # The statement above tries to avoid entering an 37024a041c5bSmacallan # endless loop below, in case of cyclic links. 37034a041c5bSmacallan # We might still enter an endless loop, since a link 37044a041c5bSmacallan # loop can be closed while we follow links, 37054a041c5bSmacallan # but so what? 37064a041c5bSmacallan potlib="$potent_lib" 37074a041c5bSmacallan while test -h "$potlib" 2>/dev/null; do 37084a041c5bSmacallan potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 37094a041c5bSmacallan case $potliblink in 37104a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 37114a041c5bSmacallan *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 37124a041c5bSmacallan esac 37134a041c5bSmacallan done 37144a041c5bSmacallan if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 37154a041c5bSmacallan | ${SED} 10q \ 37164a041c5bSmacallan | $EGREP "$file_magic_regex" > /dev/null; then 37174a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 37184a041c5bSmacallan a_deplib="" 37194a041c5bSmacallan break 2 37204a041c5bSmacallan fi 37214a041c5bSmacallan done 37224a041c5bSmacallan done 37234a041c5bSmacallan fi 37244a041c5bSmacallan if test -n "$a_deplib" ; then 37254a041c5bSmacallan droppeddeps=yes 37264a041c5bSmacallan $echo 37274a041c5bSmacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 37284a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 37294a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 37304a041c5bSmacallan $echo "*** shared version of the library, which you do not appear to have" 37314a041c5bSmacallan $echo "*** because I did check the linker path looking for a file starting" 37324a041c5bSmacallan if test -z "$potlib" ; then 37334a041c5bSmacallan $echo "*** with $libname but no candidates were found. (...for file magic test)" 37344a041c5bSmacallan else 37354a041c5bSmacallan $echo "*** with $libname and none of the candidates passed a file format test" 37364a041c5bSmacallan $echo "*** using a file magic. Last file checked: $potlib" 37374a041c5bSmacallan fi 37384a041c5bSmacallan fi 37394a041c5bSmacallan else 37404a041c5bSmacallan # Add a -L argument. 37414a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 37424a041c5bSmacallan fi 37434a041c5bSmacallan done # Gone through all deplibs. 37444a041c5bSmacallan ;; 37454a041c5bSmacallan match_pattern*) 37464a041c5bSmacallan set dummy $deplibs_check_method 37474a041c5bSmacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 37484a041c5bSmacallan for a_deplib in $deplibs; do 37494a041c5bSmacallan name=`expr $a_deplib : '-l\(.*\)'` 37504a041c5bSmacallan # If $name is empty we are operating on a -L argument. 37514a041c5bSmacallan if test -n "$name" && test "$name" != "0"; then 37524a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37534a041c5bSmacallan case " $predeps $postdeps " in 37544a041c5bSmacallan *" $a_deplib "*) 37554a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 37564a041c5bSmacallan a_deplib="" 37574a041c5bSmacallan ;; 37584a041c5bSmacallan esac 37594a041c5bSmacallan fi 37604a041c5bSmacallan if test -n "$a_deplib" ; then 37614a041c5bSmacallan libname=`eval \\$echo \"$libname_spec\"` 37624a041c5bSmacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37634a041c5bSmacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37644a041c5bSmacallan for potent_lib in $potential_libs; do 37654a041c5bSmacallan potlib="$potent_lib" # see symlink-check above in file_magic test 37664a041c5bSmacallan if eval $echo \"$potent_lib\" 2>/dev/null \ 37674a041c5bSmacallan | ${SED} 10q \ 37684a041c5bSmacallan | $EGREP "$match_pattern_regex" > /dev/null; then 37694a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 37704a041c5bSmacallan a_deplib="" 37714a041c5bSmacallan break 2 37724a041c5bSmacallan fi 37734a041c5bSmacallan done 37744a041c5bSmacallan done 37754a041c5bSmacallan fi 37764a041c5bSmacallan if test -n "$a_deplib" ; then 37774a041c5bSmacallan droppeddeps=yes 37784a041c5bSmacallan $echo 37794a041c5bSmacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 37804a041c5bSmacallan $echo "*** I have the capability to make that library automatically link in when" 37814a041c5bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 37824a041c5bSmacallan $echo "*** shared version of the library, which you do not appear to have" 37834a041c5bSmacallan $echo "*** because I did check the linker path looking for a file starting" 37844a041c5bSmacallan if test -z "$potlib" ; then 37854a041c5bSmacallan $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 37864a041c5bSmacallan else 37874a041c5bSmacallan $echo "*** with $libname and none of the candidates passed a file format test" 37884a041c5bSmacallan $echo "*** using a regex pattern. Last file checked: $potlib" 37894a041c5bSmacallan fi 37904a041c5bSmacallan fi 37914a041c5bSmacallan else 37924a041c5bSmacallan # Add a -L argument. 37934a041c5bSmacallan newdeplibs="$newdeplibs $a_deplib" 37944a041c5bSmacallan fi 37954a041c5bSmacallan done # Gone through all deplibs. 37964a041c5bSmacallan ;; 37974a041c5bSmacallan none | unknown | *) 37984a041c5bSmacallan newdeplibs="" 37994a041c5bSmacallan tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 38004a041c5bSmacallan -e 's/ -[LR][^ ]*//g'` 38014a041c5bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 38024a041c5bSmacallan for i in $predeps $postdeps ; do 38034a041c5bSmacallan # can't use Xsed below, because $i might contain '/' 38044a041c5bSmacallan tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 38054a041c5bSmacallan done 38064a041c5bSmacallan fi 38074a041c5bSmacallan if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 38084a041c5bSmacallan | grep . >/dev/null; then 38094a041c5bSmacallan $echo 38104a041c5bSmacallan if test "X$deplibs_check_method" = "Xnone"; then 38114a041c5bSmacallan $echo "*** Warning: inter-library dependencies are not supported in this platform." 38124a041c5bSmacallan else 38134a041c5bSmacallan $echo "*** Warning: inter-library dependencies are not known to be supported." 38144a041c5bSmacallan fi 38154a041c5bSmacallan $echo "*** All declared inter-library dependencies are being dropped." 38164a041c5bSmacallan droppeddeps=yes 38174a041c5bSmacallan fi 38184a041c5bSmacallan ;; 38194a041c5bSmacallan esac 38204a041c5bSmacallan versuffix=$versuffix_save 38214a041c5bSmacallan major=$major_save 38224a041c5bSmacallan release=$release_save 38234a041c5bSmacallan libname=$libname_save 38244a041c5bSmacallan name=$name_save 38254a041c5bSmacallan 38264a041c5bSmacallan case $host in 38274a041c5bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 38284a041c5bSmacallan # On Rhapsody replace the C library is the System framework 38294a041c5bSmacallan newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 38304a041c5bSmacallan ;; 38314a041c5bSmacallan esac 38324a041c5bSmacallan 38334a041c5bSmacallan if test "$droppeddeps" = yes; then 38344a041c5bSmacallan if test "$module" = yes; then 38354a041c5bSmacallan $echo 38364a041c5bSmacallan $echo "*** Warning: libtool could not satisfy all declared inter-library" 38374a041c5bSmacallan $echo "*** dependencies of module $libname. Therefore, libtool will create" 38384a041c5bSmacallan $echo "*** a static module, that should work as long as the dlopening" 38394a041c5bSmacallan $echo "*** application is linked with the -dlopen flag." 38404a041c5bSmacallan if test -z "$global_symbol_pipe"; then 38414a041c5bSmacallan $echo 38424a041c5bSmacallan $echo "*** However, this would only work if libtool was able to extract symbol" 38434a041c5bSmacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 38444a041c5bSmacallan $echo "*** not find such a program. So, this module is probably useless." 38454a041c5bSmacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 38464a041c5bSmacallan fi 38474a041c5bSmacallan if test "$build_old_libs" = no; then 38484a041c5bSmacallan oldlibs="$output_objdir/$libname.$libext" 38494a041c5bSmacallan build_libtool_libs=module 38504a041c5bSmacallan build_old_libs=yes 38514a041c5bSmacallan else 38524a041c5bSmacallan build_libtool_libs=no 38534a041c5bSmacallan fi 38544a041c5bSmacallan else 38554a041c5bSmacallan $echo "*** The inter-library dependencies that have been dropped here will be" 38564a041c5bSmacallan $echo "*** automatically added whenever a program is linked with this library" 38574a041c5bSmacallan $echo "*** or is declared to -dlopen it." 38584a041c5bSmacallan 38594a041c5bSmacallan if test "$allow_undefined" = no; then 38604a041c5bSmacallan $echo 38614a041c5bSmacallan $echo "*** Since this library must not contain undefined symbols," 38624a041c5bSmacallan $echo "*** because either the platform does not support them or" 38634a041c5bSmacallan $echo "*** it was explicitly requested with -no-undefined," 38644a041c5bSmacallan $echo "*** libtool will only create a static version of it." 38654a041c5bSmacallan if test "$build_old_libs" = no; then 38664a041c5bSmacallan oldlibs="$output_objdir/$libname.$libext" 38674a041c5bSmacallan build_libtool_libs=module 38684a041c5bSmacallan build_old_libs=yes 38694a041c5bSmacallan else 38704a041c5bSmacallan build_libtool_libs=no 38714a041c5bSmacallan fi 38724a041c5bSmacallan fi 38734a041c5bSmacallan fi 38744a041c5bSmacallan fi 38754a041c5bSmacallan # Done checking deplibs! 38764a041c5bSmacallan deplibs=$newdeplibs 38774a041c5bSmacallan fi 38784a041c5bSmacallan 38794a041c5bSmacallan 38804a041c5bSmacallan # move library search paths that coincide with paths to not yet 38814a041c5bSmacallan # installed libraries to the beginning of the library search list 38824a041c5bSmacallan new_libs= 38834a041c5bSmacallan for path in $notinst_path; do 38844a041c5bSmacallan case " $new_libs " in 38854a041c5bSmacallan *" -L$path/$objdir "*) ;; 38864a041c5bSmacallan *) 38874a041c5bSmacallan case " $deplibs " in 38884a041c5bSmacallan *" -L$path/$objdir "*) 38894a041c5bSmacallan new_libs="$new_libs -L$path/$objdir" ;; 38904a041c5bSmacallan esac 38914a041c5bSmacallan ;; 38924a041c5bSmacallan esac 38934a041c5bSmacallan done 38944a041c5bSmacallan for deplib in $deplibs; do 38954a041c5bSmacallan case $deplib in 38964a041c5bSmacallan -L*) 38974a041c5bSmacallan case " $new_libs " in 38984a041c5bSmacallan *" $deplib "*) ;; 38994a041c5bSmacallan *) new_libs="$new_libs $deplib" ;; 39004a041c5bSmacallan esac 39014a041c5bSmacallan ;; 39024a041c5bSmacallan *) new_libs="$new_libs $deplib" ;; 39034a041c5bSmacallan esac 39044a041c5bSmacallan done 39054a041c5bSmacallan deplibs="$new_libs" 39064a041c5bSmacallan 39074a041c5bSmacallan 39084a041c5bSmacallan # All the library-specific variables (install_libdir is set above). 39094a041c5bSmacallan library_names= 39104a041c5bSmacallan old_library= 39114a041c5bSmacallan dlname= 39124a041c5bSmacallan 39134a041c5bSmacallan # Test again, we may have decided not to build it any more 39144a041c5bSmacallan if test "$build_libtool_libs" = yes; then 39154a041c5bSmacallan if test "$hardcode_into_libs" = yes; then 39164a041c5bSmacallan # Hardcode the library paths 39174a041c5bSmacallan hardcode_libdirs= 39184a041c5bSmacallan dep_rpath= 39194a041c5bSmacallan rpath="$finalize_rpath" 39204a041c5bSmacallan test "$mode" != relink && rpath="$compile_rpath$rpath" 39214a041c5bSmacallan for libdir in $rpath; do 39224a041c5bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 39234a041c5bSmacallan if test -n "$hardcode_libdir_separator"; then 39244a041c5bSmacallan if test -z "$hardcode_libdirs"; then 39254a041c5bSmacallan hardcode_libdirs="$libdir" 39264a041c5bSmacallan else 39274a041c5bSmacallan # Just accumulate the unique libdirs. 39284a041c5bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 39294a041c5bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 39304a041c5bSmacallan ;; 39314a041c5bSmacallan *) 39324a041c5bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 39334a041c5bSmacallan ;; 39344a041c5bSmacallan esac 39354a041c5bSmacallan fi 39364a041c5bSmacallan else 39374a041c5bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 39384a041c5bSmacallan dep_rpath="$dep_rpath $flag" 39394a041c5bSmacallan fi 39404a041c5bSmacallan elif test -n "$runpath_var"; then 39414a041c5bSmacallan case "$perm_rpath " in 39424a041c5bSmacallan *" $libdir "*) ;; 39434a041c5bSmacallan *) perm_rpath="$perm_rpath $libdir" ;; 39444a041c5bSmacallan esac 39454a041c5bSmacallan fi 39464a041c5bSmacallan done 39474a041c5bSmacallan # Substitute the hardcoded libdirs into the rpath. 39484a041c5bSmacallan if test -n "$hardcode_libdir_separator" && 39494a041c5bSmacallan test -n "$hardcode_libdirs"; then 39504a041c5bSmacallan libdir="$hardcode_libdirs" 39514a041c5bSmacallan if test -n "$hardcode_libdir_flag_spec_ld"; then 39524a041c5bSmacallan case $archive_cmds in 39534a041c5bSmacallan *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 39544a041c5bSmacallan *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 39554a041c5bSmacallan esac 39564a041c5bSmacallan else 39574a041c5bSmacallan eval dep_rpath=\"$hardcode_libdir_flag_spec\" 39584a041c5bSmacallan fi 39594a041c5bSmacallan fi 39604a041c5bSmacallan if test -n "$runpath_var" && test -n "$perm_rpath"; then 39614a041c5bSmacallan # We should set the runpath_var. 39624a041c5bSmacallan rpath= 39634a041c5bSmacallan for dir in $perm_rpath; do 39644a041c5bSmacallan rpath="$rpath$dir:" 39654a041c5bSmacallan done 39664a041c5bSmacallan eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 39674a041c5bSmacallan fi 39684a041c5bSmacallan test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 39694a041c5bSmacallan fi 39704a041c5bSmacallan 39714a041c5bSmacallan shlibpath="$finalize_shlibpath" 39724a041c5bSmacallan test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 39734a041c5bSmacallan if test -n "$shlibpath"; then 39744a041c5bSmacallan eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 39754a041c5bSmacallan fi 39764a041c5bSmacallan 39774a041c5bSmacallan # Get the real and link names of the library. 39784a041c5bSmacallan eval shared_ext=\"$shrext_cmds\" 39794a041c5bSmacallan eval library_names=\"$library_names_spec\" 39804a041c5bSmacallan set dummy $library_names 39814a041c5bSmacallan realname="$2" 39824a041c5bSmacallan shift; shift 39834a041c5bSmacallan 39844a041c5bSmacallan if test -n "$soname_spec"; then 39854a041c5bSmacallan eval soname=\"$soname_spec\" 39864a041c5bSmacallan else 39874a041c5bSmacallan soname="$realname" 39884a041c5bSmacallan fi 39894a041c5bSmacallan if test -z "$dlname"; then 39904a041c5bSmacallan dlname=$soname 39914a041c5bSmacallan fi 39924a041c5bSmacallan 39934a041c5bSmacallan lib="$output_objdir/$realname" 39944a041c5bSmacallan linknames= 39954a041c5bSmacallan for link 39964a041c5bSmacallan do 39974a041c5bSmacallan linknames="$linknames $link" 39984a041c5bSmacallan done 39994a041c5bSmacallan 40004a041c5bSmacallan # Use standard objects if they are pic 40014a041c5bSmacallan test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 40024a041c5bSmacallan 40034a041c5bSmacallan # Prepare the list of exported symbols 40044a041c5bSmacallan if test -z "$export_symbols"; then 40054a041c5bSmacallan if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 40064a041c5bSmacallan $show "generating symbol list for \`$libname.la'" 40074a041c5bSmacallan export_symbols="$output_objdir/$libname.exp" 40084a041c5bSmacallan $run $rm $export_symbols 40094a041c5bSmacallan cmds=$export_symbols_cmds 40104a041c5bSmacallan save_ifs="$IFS"; IFS='~' 40114a041c5bSmacallan for cmd in $cmds; do 40124a041c5bSmacallan IFS="$save_ifs" 40134a041c5bSmacallan eval cmd=\"$cmd\" 40144a041c5bSmacallan if len=`expr "X$cmd" : ".*"` && 40154a041c5bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40164a041c5bSmacallan $show "$cmd" 40174a041c5bSmacallan $run eval "$cmd" || exit $? 40184a041c5bSmacallan skipped_export=false 40194a041c5bSmacallan else 40204a041c5bSmacallan # The command line is too long to execute in one step. 40214a041c5bSmacallan $show "using reloadable object file for export list..." 40224a041c5bSmacallan skipped_export=: 40234a041c5bSmacallan # Break out early, otherwise skipped_export may be 40244a041c5bSmacallan # set to false by a later but shorter cmd. 40254a041c5bSmacallan break 40264a041c5bSmacallan fi 40274a041c5bSmacallan done 40284a041c5bSmacallan IFS="$save_ifs" 40294a041c5bSmacallan if test -n "$export_symbols_regex"; then 40304a041c5bSmacallan $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 40314a041c5bSmacallan $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 40324a041c5bSmacallan $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 40334a041c5bSmacallan $run eval '$mv "${export_symbols}T" "$export_symbols"' 40344a041c5bSmacallan fi 40354a041c5bSmacallan fi 40364a041c5bSmacallan fi 40374a041c5bSmacallan 40384a041c5bSmacallan if test -n "$export_symbols" && test -n "$include_expsyms"; then 40394a041c5bSmacallan $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 40404a041c5bSmacallan fi 40414a041c5bSmacallan 40424a041c5bSmacallan tmp_deplibs= 40434a041c5bSmacallan for test_deplib in $deplibs; do 40444a041c5bSmacallan case " $convenience " in 40454a041c5bSmacallan *" $test_deplib "*) ;; 40464a041c5bSmacallan *) 40474a041c5bSmacallan tmp_deplibs="$tmp_deplibs $test_deplib" 40484a041c5bSmacallan ;; 40494a041c5bSmacallan esac 40504a041c5bSmacallan done 40514a041c5bSmacallan deplibs="$tmp_deplibs" 40524a041c5bSmacallan 40534a041c5bSmacallan if test -n "$convenience"; then 40544a041c5bSmacallan if test -n "$whole_archive_flag_spec"; then 40554a041c5bSmacallan save_libobjs=$libobjs 40564a041c5bSmacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 40574a041c5bSmacallan else 40584a041c5bSmacallan gentop="$output_objdir/${outputname}x" 40594a041c5bSmacallan generated="$generated $gentop" 40604a041c5bSmacallan 40614a041c5bSmacallan func_extract_archives $gentop $convenience 40624a041c5bSmacallan libobjs="$libobjs $func_extract_archives_result" 40634a041c5bSmacallan fi 40644a041c5bSmacallan fi 40654a041c5bSmacallan 40664a041c5bSmacallan if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 40674a041c5bSmacallan eval flag=\"$thread_safe_flag_spec\" 40684a041c5bSmacallan linker_flags="$linker_flags $flag" 40694a041c5bSmacallan fi 40704a041c5bSmacallan 40714a041c5bSmacallan # Make a backup of the uninstalled library when relinking 40724a041c5bSmacallan if test "$mode" = relink; then 40734a041c5bSmacallan $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 40744a041c5bSmacallan fi 40754a041c5bSmacallan 40764a041c5bSmacallan # Do each of the archive commands. 40774a041c5bSmacallan if test "$module" = yes && test -n "$module_cmds" ; then 40784a041c5bSmacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 40794a041c5bSmacallan eval test_cmds=\"$module_expsym_cmds\" 40804a041c5bSmacallan cmds=$module_expsym_cmds 40814a041c5bSmacallan else 40824a041c5bSmacallan eval test_cmds=\"$module_cmds\" 40834a041c5bSmacallan cmds=$module_cmds 40844a041c5bSmacallan fi 40854a041c5bSmacallan else 40864a041c5bSmacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 40874a041c5bSmacallan eval test_cmds=\"$archive_expsym_cmds\" 40884a041c5bSmacallan cmds=$archive_expsym_cmds 40894a041c5bSmacallan else 40904a041c5bSmacallan eval test_cmds=\"$archive_cmds\" 40914a041c5bSmacallan cmds=$archive_cmds 40924a041c5bSmacallan fi 40934a041c5bSmacallan fi 40944a041c5bSmacallan 40954a041c5bSmacallan if test "X$skipped_export" != "X:" && 40964a041c5bSmacallan len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 40974a041c5bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40984a041c5bSmacallan : 40994a041c5bSmacallan else 41004a041c5bSmacallan # The command line is too long to link in one step, link piecewise. 41014a041c5bSmacallan $echo "creating reloadable object files..." 41024a041c5bSmacallan 41034a041c5bSmacallan # Save the value of $output and $libobjs because we want to 41044a041c5bSmacallan # use them later. If we have whole_archive_flag_spec, we 41054a041c5bSmacallan # want to use save_libobjs as it was before 41064a041c5bSmacallan # whole_archive_flag_spec was expanded, because we can't 41074a041c5bSmacallan # assume the linker understands whole_archive_flag_spec. 41084a041c5bSmacallan # This may have to be revisited, in case too many 41094a041c5bSmacallan # convenience libraries get linked in and end up exceeding 41104a041c5bSmacallan # the spec. 41114a041c5bSmacallan if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 41124a041c5bSmacallan save_libobjs=$libobjs 41134a041c5bSmacallan fi 41144a041c5bSmacallan save_output=$output 41154a041c5bSmacallan output_la=`$echo "X$output" | $Xsed -e "$basename"` 41164a041c5bSmacallan 41174a041c5bSmacallan # Clear the reloadable object creation command queue and 41184a041c5bSmacallan # initialize k to one. 41194a041c5bSmacallan test_cmds= 41204a041c5bSmacallan concat_cmds= 41214a041c5bSmacallan objlist= 41224a041c5bSmacallan delfiles= 41234a041c5bSmacallan last_robj= 41244a041c5bSmacallan k=1 41254a041c5bSmacallan output=$output_objdir/$output_la-${k}.$objext 41264a041c5bSmacallan # Loop over the list of objects to be linked. 41274a041c5bSmacallan for obj in $save_libobjs 41284a041c5bSmacallan do 41294a041c5bSmacallan eval test_cmds=\"$reload_cmds $objlist $last_robj\" 41304a041c5bSmacallan if test "X$objlist" = X || 41314a041c5bSmacallan { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41324a041c5bSmacallan test "$len" -le "$max_cmd_len"; }; then 41334a041c5bSmacallan objlist="$objlist $obj" 41344a041c5bSmacallan else 41354a041c5bSmacallan # The command $test_cmds is almost too long, add a 41364a041c5bSmacallan # command to the queue. 41374a041c5bSmacallan if test "$k" -eq 1 ; then 41384a041c5bSmacallan # The first file doesn't have a previous command to add. 41394a041c5bSmacallan eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 41404a041c5bSmacallan else 41414a041c5bSmacallan # All subsequent reloadable object files will link in 41424a041c5bSmacallan # the last one created. 41434a041c5bSmacallan eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 41444a041c5bSmacallan fi 41454a041c5bSmacallan last_robj=$output_objdir/$output_la-${k}.$objext 41464a041c5bSmacallan k=`expr $k + 1` 41474a041c5bSmacallan output=$output_objdir/$output_la-${k}.$objext 41484a041c5bSmacallan objlist=$obj 41494a041c5bSmacallan len=1 41504a041c5bSmacallan fi 41514a041c5bSmacallan done 41524a041c5bSmacallan # Handle the remaining objects by creating one last 41534a041c5bSmacallan # reloadable object file. All subsequent reloadable object 41544a041c5bSmacallan # files will link in the last one created. 41554a041c5bSmacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 41564a041c5bSmacallan eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 41574a041c5bSmacallan 41584a041c5bSmacallan if ${skipped_export-false}; then 41594a041c5bSmacallan $show "generating symbol list for \`$libname.la'" 41604a041c5bSmacallan export_symbols="$output_objdir/$libname.exp" 41614a041c5bSmacallan $run $rm $export_symbols 41624a041c5bSmacallan libobjs=$output 41634a041c5bSmacallan # Append the command to create the export file. 41644a041c5bSmacallan eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 41654a041c5bSmacallan fi 41664a041c5bSmacallan 41674a041c5bSmacallan # Set up a command to remove the reloadable object files 41684a041c5bSmacallan # after they are used. 41694a041c5bSmacallan i=0 41704a041c5bSmacallan while test "$i" -lt "$k" 41714a041c5bSmacallan do 41724a041c5bSmacallan i=`expr $i + 1` 41734a041c5bSmacallan delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 41744a041c5bSmacallan done 41754a041c5bSmacallan 41764a041c5bSmacallan $echo "creating a temporary reloadable object file: $output" 41774a041c5bSmacallan 41784a041c5bSmacallan # Loop through the commands generated above and execute them. 41794a041c5bSmacallan save_ifs="$IFS"; IFS='~' 41804a041c5bSmacallan for cmd in $concat_cmds; do 41814a041c5bSmacallan IFS="$save_ifs" 41824a041c5bSmacallan $show "$cmd" 41834a041c5bSmacallan $run eval "$cmd" || exit $? 41844a041c5bSmacallan done 41854a041c5bSmacallan IFS="$save_ifs" 41864a041c5bSmacallan 41874a041c5bSmacallan libobjs=$output 41884a041c5bSmacallan # Restore the value of output. 41894a041c5bSmacallan output=$save_output 41904a041c5bSmacallan 41914a041c5bSmacallan if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 41924a041c5bSmacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 41934a041c5bSmacallan fi 41944a041c5bSmacallan # Expand the library linking commands again to reset the 41954a041c5bSmacallan # value of $libobjs for piecewise linking. 41964a041c5bSmacallan 41974a041c5bSmacallan # Do each of the archive commands. 41984a041c5bSmacallan if test "$module" = yes && test -n "$module_cmds" ; then 41994a041c5bSmacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 42004a041c5bSmacallan cmds=$module_expsym_cmds 42014a041c5bSmacallan else 42024a041c5bSmacallan cmds=$module_cmds 42034a041c5bSmacallan fi 42044a041c5bSmacallan else 42054a041c5bSmacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 42064a041c5bSmacallan cmds=$archive_expsym_cmds 42074a041c5bSmacallan else 42084a041c5bSmacallan cmds=$archive_cmds 42094a041c5bSmacallan fi 42104a041c5bSmacallan fi 42114a041c5bSmacallan 42124a041c5bSmacallan # Append the command to remove the reloadable object files 42134a041c5bSmacallan # to the just-reset $cmds. 42144a041c5bSmacallan eval cmds=\"\$cmds~\$rm $delfiles\" 42154a041c5bSmacallan fi 42164a041c5bSmacallan save_ifs="$IFS"; IFS='~' 42174a041c5bSmacallan for cmd in $cmds; do 42184a041c5bSmacallan IFS="$save_ifs" 42194a041c5bSmacallan eval cmd=\"$cmd\" 42204a041c5bSmacallan $show "$cmd" 42214a041c5bSmacallan $run eval "$cmd" || { 42224a041c5bSmacallan lt_exit=$? 42234a041c5bSmacallan 42244a041c5bSmacallan # Restore the uninstalled library and exit 42254a041c5bSmacallan if test "$mode" = relink; then 42264a041c5bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 42274a041c5bSmacallan fi 42284a041c5bSmacallan 42294a041c5bSmacallan exit $lt_exit 42304a041c5bSmacallan } 42314a041c5bSmacallan done 42324a041c5bSmacallan IFS="$save_ifs" 42334a041c5bSmacallan 42344a041c5bSmacallan # Restore the uninstalled library and exit 42354a041c5bSmacallan if test "$mode" = relink; then 42364a041c5bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 42374a041c5bSmacallan 42384a041c5bSmacallan if test -n "$convenience"; then 42394a041c5bSmacallan if test -z "$whole_archive_flag_spec"; then 42404a041c5bSmacallan $show "${rm}r $gentop" 42414a041c5bSmacallan $run ${rm}r "$gentop" 42424a041c5bSmacallan fi 42434a041c5bSmacallan fi 42444a041c5bSmacallan 42454a041c5bSmacallan exit $EXIT_SUCCESS 42464a041c5bSmacallan fi 42474a041c5bSmacallan 42484a041c5bSmacallan # Create links to the real library. 42494a041c5bSmacallan for linkname in $linknames; do 42504a041c5bSmacallan if test "$realname" != "$linkname"; then 42514a041c5bSmacallan $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 42524a041c5bSmacallan $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 42534a041c5bSmacallan fi 42544a041c5bSmacallan done 42554a041c5bSmacallan 42564a041c5bSmacallan # If -module or -export-dynamic was specified, set the dlname. 42574a041c5bSmacallan if test "$module" = yes || test "$export_dynamic" = yes; then 42584a041c5bSmacallan # On all known operating systems, these are identical. 42594a041c5bSmacallan dlname="$soname" 42604a041c5bSmacallan fi 42614a041c5bSmacallan fi 42624a041c5bSmacallan ;; 42634a041c5bSmacallan 42644a041c5bSmacallan obj) 42654a041c5bSmacallan case " $deplibs" in 42664a041c5bSmacallan *\ -l* | *\ -L*) 42674a041c5bSmacallan $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 42684a041c5bSmacallan esac 42694a041c5bSmacallan 42704a041c5bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 42714a041c5bSmacallan $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 42724a041c5bSmacallan fi 42734a041c5bSmacallan 42744a041c5bSmacallan if test -n "$rpath"; then 42754a041c5bSmacallan $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 42764a041c5bSmacallan fi 42774a041c5bSmacallan 42784a041c5bSmacallan if test -n "$xrpath"; then 42794a041c5bSmacallan $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 42804a041c5bSmacallan fi 42814a041c5bSmacallan 42824a041c5bSmacallan if test -n "$vinfo"; then 42834a041c5bSmacallan $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 42844a041c5bSmacallan fi 42854a041c5bSmacallan 42864a041c5bSmacallan if test -n "$release"; then 42874a041c5bSmacallan $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 42884a041c5bSmacallan fi 42894a041c5bSmacallan 42904a041c5bSmacallan case $output in 42914a041c5bSmacallan *.lo) 42924a041c5bSmacallan if test -n "$objs$old_deplibs"; then 42934a041c5bSmacallan $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 42944a041c5bSmacallan exit $EXIT_FAILURE 42954a041c5bSmacallan fi 42964a041c5bSmacallan libobj="$output" 42974a041c5bSmacallan obj=`$echo "X$output" | $Xsed -e "$lo2o"` 42984a041c5bSmacallan ;; 42994a041c5bSmacallan *) 43004a041c5bSmacallan libobj= 43014a041c5bSmacallan obj="$output" 43024a041c5bSmacallan ;; 43034a041c5bSmacallan esac 43044a041c5bSmacallan 43054a041c5bSmacallan # Delete the old objects. 43064a041c5bSmacallan $run $rm $obj $libobj 43074a041c5bSmacallan 43084a041c5bSmacallan # Objects from convenience libraries. This assumes 43094a041c5bSmacallan # single-version convenience libraries. Whenever we create 43104a041c5bSmacallan # different ones for PIC/non-PIC, this we'll have to duplicate 43114a041c5bSmacallan # the extraction. 43124a041c5bSmacallan reload_conv_objs= 43134a041c5bSmacallan gentop= 43144a041c5bSmacallan # reload_cmds runs $LD directly, so let us get rid of 43154a041c5bSmacallan # -Wl from whole_archive_flag_spec and hope we can get by with 43164a041c5bSmacallan # turning comma into space.. 43174a041c5bSmacallan wl= 43184a041c5bSmacallan 43194a041c5bSmacallan if test -n "$convenience"; then 43204a041c5bSmacallan if test -n "$whole_archive_flag_spec"; then 43214a041c5bSmacallan eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 43224a041c5bSmacallan reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 43234a041c5bSmacallan else 43244a041c5bSmacallan gentop="$output_objdir/${obj}x" 43254a041c5bSmacallan generated="$generated $gentop" 43264a041c5bSmacallan 43274a041c5bSmacallan func_extract_archives $gentop $convenience 43284a041c5bSmacallan reload_conv_objs="$reload_objs $func_extract_archives_result" 43294a041c5bSmacallan fi 43304a041c5bSmacallan fi 43314a041c5bSmacallan 43324a041c5bSmacallan # Create the old-style object. 43334a041c5bSmacallan 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 43344a041c5bSmacallan 43354a041c5bSmacallan output="$obj" 43364a041c5bSmacallan cmds=$reload_cmds 43374a041c5bSmacallan save_ifs="$IFS"; IFS='~' 43384a041c5bSmacallan for cmd in $cmds; do 43394a041c5bSmacallan IFS="$save_ifs" 43404a041c5bSmacallan eval cmd=\"$cmd\" 43414a041c5bSmacallan $show "$cmd" 43424a041c5bSmacallan $run eval "$cmd" || exit $? 43434a041c5bSmacallan done 43444a041c5bSmacallan IFS="$save_ifs" 43454a041c5bSmacallan 43464a041c5bSmacallan # Exit if we aren't doing a library object file. 43474a041c5bSmacallan if test -z "$libobj"; then 43484a041c5bSmacallan if test -n "$gentop"; then 43494a041c5bSmacallan $show "${rm}r $gentop" 43504a041c5bSmacallan $run ${rm}r $gentop 43514a041c5bSmacallan fi 43524a041c5bSmacallan 43534a041c5bSmacallan exit $EXIT_SUCCESS 43544a041c5bSmacallan fi 43554a041c5bSmacallan 43564a041c5bSmacallan if test "$build_libtool_libs" != yes; then 43574a041c5bSmacallan if test -n "$gentop"; then 43584a041c5bSmacallan $show "${rm}r $gentop" 43594a041c5bSmacallan $run ${rm}r $gentop 43604a041c5bSmacallan fi 43614a041c5bSmacallan 43624a041c5bSmacallan # Create an invalid libtool object if no PIC, so that we don't 43634a041c5bSmacallan # accidentally link it into a program. 43644a041c5bSmacallan # $show "echo timestamp > $libobj" 43654a041c5bSmacallan # $run eval "echo timestamp > $libobj" || exit $? 43664a041c5bSmacallan exit $EXIT_SUCCESS 43674a041c5bSmacallan fi 43684a041c5bSmacallan 43694a041c5bSmacallan if test -n "$pic_flag" || test "$pic_mode" != default; then 43704a041c5bSmacallan # Only do commands if we really have different PIC objects. 43714a041c5bSmacallan reload_objs="$libobjs $reload_conv_objs" 43724a041c5bSmacallan output="$libobj" 43734a041c5bSmacallan cmds=$reload_cmds 43744a041c5bSmacallan save_ifs="$IFS"; IFS='~' 43754a041c5bSmacallan for cmd in $cmds; do 43764a041c5bSmacallan IFS="$save_ifs" 43774a041c5bSmacallan eval cmd=\"$cmd\" 43784a041c5bSmacallan $show "$cmd" 43794a041c5bSmacallan $run eval "$cmd" || exit $? 43804a041c5bSmacallan done 43814a041c5bSmacallan IFS="$save_ifs" 43824a041c5bSmacallan fi 43834a041c5bSmacallan 43844a041c5bSmacallan if test -n "$gentop"; then 43854a041c5bSmacallan $show "${rm}r $gentop" 43864a041c5bSmacallan $run ${rm}r $gentop 43874a041c5bSmacallan fi 43884a041c5bSmacallan 43894a041c5bSmacallan exit $EXIT_SUCCESS 43904a041c5bSmacallan ;; 43914a041c5bSmacallan 43924a041c5bSmacallan prog) 43934a041c5bSmacallan case $host in 43944a041c5bSmacallan *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 43954a041c5bSmacallan esac 43964a041c5bSmacallan if test -n "$vinfo"; then 43974a041c5bSmacallan $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 43984a041c5bSmacallan fi 43994a041c5bSmacallan 44004a041c5bSmacallan if test -n "$release"; then 44014a041c5bSmacallan $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 44024a041c5bSmacallan fi 44034a041c5bSmacallan 44044a041c5bSmacallan if test "$preload" = yes; then 44054a041c5bSmacallan if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 44064a041c5bSmacallan test "$dlopen_self_static" = unknown; then 44074a041c5bSmacallan $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 44084a041c5bSmacallan fi 44094a041c5bSmacallan fi 44104a041c5bSmacallan 44114a041c5bSmacallan case $host in 44124a041c5bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 44134a041c5bSmacallan # On Rhapsody replace the C library is the System framework 44144a041c5bSmacallan compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44154a041c5bSmacallan finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44164a041c5bSmacallan ;; 44174a041c5bSmacallan esac 44184a041c5bSmacallan 44194a041c5bSmacallan case $host in 44204a041c5bSmacallan *darwin*) 44214a041c5bSmacallan # Don't allow lazy linking, it breaks C++ global constructors 44224a041c5bSmacallan if test "$tagname" = CXX ; then 44234a041c5bSmacallan compile_command="$compile_command ${wl}-bind_at_load" 44244a041c5bSmacallan finalize_command="$finalize_command ${wl}-bind_at_load" 44254a041c5bSmacallan fi 44264a041c5bSmacallan ;; 44274a041c5bSmacallan esac 44284a041c5bSmacallan 44294a041c5bSmacallan 44304a041c5bSmacallan # move library search paths that coincide with paths to not yet 44314a041c5bSmacallan # installed libraries to the beginning of the library search list 44324a041c5bSmacallan new_libs= 44334a041c5bSmacallan for path in $notinst_path; do 44344a041c5bSmacallan case " $new_libs " in 44354a041c5bSmacallan *" -L$path/$objdir "*) ;; 44364a041c5bSmacallan *) 44374a041c5bSmacallan case " $compile_deplibs " in 44384a041c5bSmacallan *" -L$path/$objdir "*) 44394a041c5bSmacallan new_libs="$new_libs -L$path/$objdir" ;; 44404a041c5bSmacallan esac 44414a041c5bSmacallan ;; 44424a041c5bSmacallan esac 44434a041c5bSmacallan done 44444a041c5bSmacallan for deplib in $compile_deplibs; do 44454a041c5bSmacallan case $deplib in 44464a041c5bSmacallan -L*) 44474a041c5bSmacallan case " $new_libs " in 44484a041c5bSmacallan *" $deplib "*) ;; 44494a041c5bSmacallan *) new_libs="$new_libs $deplib" ;; 44504a041c5bSmacallan esac 44514a041c5bSmacallan ;; 44524a041c5bSmacallan *) new_libs="$new_libs $deplib" ;; 44534a041c5bSmacallan esac 44544a041c5bSmacallan done 44554a041c5bSmacallan compile_deplibs="$new_libs" 44564a041c5bSmacallan 44574a041c5bSmacallan 44584a041c5bSmacallan compile_command="$compile_command $compile_deplibs" 44594a041c5bSmacallan finalize_command="$finalize_command $finalize_deplibs" 44604a041c5bSmacallan 44614a041c5bSmacallan if test -n "$rpath$xrpath"; then 44624a041c5bSmacallan # If the user specified any rpath flags, then add them. 44634a041c5bSmacallan for libdir in $rpath $xrpath; do 44644a041c5bSmacallan # This is the magic to use -rpath. 44654a041c5bSmacallan case "$finalize_rpath " in 44664a041c5bSmacallan *" $libdir "*) ;; 44674a041c5bSmacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 44684a041c5bSmacallan esac 44694a041c5bSmacallan done 44704a041c5bSmacallan fi 44714a041c5bSmacallan 44724a041c5bSmacallan # Now hardcode the library paths 44734a041c5bSmacallan rpath= 44744a041c5bSmacallan hardcode_libdirs= 44754a041c5bSmacallan for libdir in $compile_rpath $finalize_rpath; do 44764a041c5bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 44774a041c5bSmacallan if test -n "$hardcode_libdir_separator"; then 44784a041c5bSmacallan if test -z "$hardcode_libdirs"; then 44794a041c5bSmacallan hardcode_libdirs="$libdir" 44804a041c5bSmacallan else 44814a041c5bSmacallan # Just accumulate the unique libdirs. 44824a041c5bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44834a041c5bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44844a041c5bSmacallan ;; 44854a041c5bSmacallan *) 44864a041c5bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44874a041c5bSmacallan ;; 44884a041c5bSmacallan esac 44894a041c5bSmacallan fi 44904a041c5bSmacallan else 44914a041c5bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 44924a041c5bSmacallan rpath="$rpath $flag" 44934a041c5bSmacallan fi 44944a041c5bSmacallan elif test -n "$runpath_var"; then 44954a041c5bSmacallan case "$perm_rpath " in 44964a041c5bSmacallan *" $libdir "*) ;; 44974a041c5bSmacallan *) perm_rpath="$perm_rpath $libdir" ;; 44984a041c5bSmacallan esac 44994a041c5bSmacallan fi 45004a041c5bSmacallan case $host in 45014a041c5bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 45024a041c5bSmacallan testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 45034a041c5bSmacallan case :$dllsearchpath: in 45044a041c5bSmacallan *":$libdir:"*) ;; 45054a041c5bSmacallan *) dllsearchpath="$dllsearchpath:$libdir";; 45064a041c5bSmacallan esac 45074a041c5bSmacallan case :$dllsearchpath: in 45084a041c5bSmacallan *":$testbindir:"*) ;; 45094a041c5bSmacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 45104a041c5bSmacallan esac 45114a041c5bSmacallan ;; 45124a041c5bSmacallan esac 45134a041c5bSmacallan done 45144a041c5bSmacallan # Substitute the hardcoded libdirs into the rpath. 45154a041c5bSmacallan if test -n "$hardcode_libdir_separator" && 45164a041c5bSmacallan test -n "$hardcode_libdirs"; then 45174a041c5bSmacallan libdir="$hardcode_libdirs" 45184a041c5bSmacallan eval rpath=\" $hardcode_libdir_flag_spec\" 45194a041c5bSmacallan fi 45204a041c5bSmacallan compile_rpath="$rpath" 45214a041c5bSmacallan 45224a041c5bSmacallan rpath= 45234a041c5bSmacallan hardcode_libdirs= 45244a041c5bSmacallan for libdir in $finalize_rpath; do 45254a041c5bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 45264a041c5bSmacallan if test -n "$hardcode_libdir_separator"; then 45274a041c5bSmacallan if test -z "$hardcode_libdirs"; then 45284a041c5bSmacallan hardcode_libdirs="$libdir" 45294a041c5bSmacallan else 45304a041c5bSmacallan # Just accumulate the unique libdirs. 45314a041c5bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 45324a041c5bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 45334a041c5bSmacallan ;; 45344a041c5bSmacallan *) 45354a041c5bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 45364a041c5bSmacallan ;; 45374a041c5bSmacallan esac 45384a041c5bSmacallan fi 45394a041c5bSmacallan else 45404a041c5bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 45414a041c5bSmacallan rpath="$rpath $flag" 45424a041c5bSmacallan fi 45434a041c5bSmacallan elif test -n "$runpath_var"; then 45444a041c5bSmacallan case "$finalize_perm_rpath " in 45454a041c5bSmacallan *" $libdir "*) ;; 45464a041c5bSmacallan *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 45474a041c5bSmacallan esac 45484a041c5bSmacallan fi 45494a041c5bSmacallan done 45504a041c5bSmacallan # Substitute the hardcoded libdirs into the rpath. 45514a041c5bSmacallan if test -n "$hardcode_libdir_separator" && 45524a041c5bSmacallan test -n "$hardcode_libdirs"; then 45534a041c5bSmacallan libdir="$hardcode_libdirs" 45544a041c5bSmacallan eval rpath=\" $hardcode_libdir_flag_spec\" 45554a041c5bSmacallan fi 45564a041c5bSmacallan finalize_rpath="$rpath" 45574a041c5bSmacallan 45584a041c5bSmacallan if test -n "$libobjs" && test "$build_old_libs" = yes; then 45594a041c5bSmacallan # Transform all the library objects into standard objects. 45604a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45614a041c5bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45624a041c5bSmacallan fi 45634a041c5bSmacallan 45644a041c5bSmacallan dlsyms= 45654a041c5bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 45664a041c5bSmacallan if test -n "$NM" && test -n "$global_symbol_pipe"; then 45674a041c5bSmacallan dlsyms="${outputname}S.c" 45684a041c5bSmacallan else 45694a041c5bSmacallan $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 45704a041c5bSmacallan fi 45714a041c5bSmacallan fi 45724a041c5bSmacallan 45734a041c5bSmacallan if test -n "$dlsyms"; then 45744a041c5bSmacallan case $dlsyms in 45754a041c5bSmacallan "") ;; 45764a041c5bSmacallan *.c) 45774a041c5bSmacallan # Discover the nlist of each of the dlfiles. 45784a041c5bSmacallan nlist="$output_objdir/${outputname}.nm" 45794a041c5bSmacallan 45804a041c5bSmacallan $show "$rm $nlist ${nlist}S ${nlist}T" 45814a041c5bSmacallan $run $rm "$nlist" "${nlist}S" "${nlist}T" 45824a041c5bSmacallan 45834a041c5bSmacallan # Parse the name list into a source file. 45844a041c5bSmacallan $show "creating $output_objdir/$dlsyms" 45854a041c5bSmacallan 45864a041c5bSmacallan test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 45874a041c5bSmacallan/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 45884a041c5bSmacallan/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 45894a041c5bSmacallan 45904a041c5bSmacallan#ifdef __cplusplus 45914a041c5bSmacallanextern \"C\" { 45924a041c5bSmacallan#endif 45934a041c5bSmacallan 45944a041c5bSmacallan/* Prevent the only kind of declaration conflicts we can make. */ 45954a041c5bSmacallan#define lt_preloaded_symbols some_other_symbol 45964a041c5bSmacallan 45974a041c5bSmacallan/* External symbol declarations for the compiler. */\ 45984a041c5bSmacallan" 45994a041c5bSmacallan 46004a041c5bSmacallan if test "$dlself" = yes; then 46014a041c5bSmacallan $show "generating symbol list for \`$output'" 46024a041c5bSmacallan 46034a041c5bSmacallan test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 46044a041c5bSmacallan 46054a041c5bSmacallan # Add our own program objects to the symbol list. 46064a041c5bSmacallan progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 46074a041c5bSmacallan for arg in $progfiles; do 46084a041c5bSmacallan $show "extracting global C symbols from \`$arg'" 46094a041c5bSmacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46104a041c5bSmacallan done 46114a041c5bSmacallan 46124a041c5bSmacallan if test -n "$exclude_expsyms"; then 46134a041c5bSmacallan $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 46144a041c5bSmacallan $run eval '$mv "$nlist"T "$nlist"' 46154a041c5bSmacallan fi 46164a041c5bSmacallan 46174a041c5bSmacallan if test -n "$export_symbols_regex"; then 46184a041c5bSmacallan $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 46194a041c5bSmacallan $run eval '$mv "$nlist"T "$nlist"' 46204a041c5bSmacallan fi 46214a041c5bSmacallan 46224a041c5bSmacallan # Prepare the list of exported symbols 46234a041c5bSmacallan if test -z "$export_symbols"; then 46244a041c5bSmacallan export_symbols="$output_objdir/$outputname.exp" 46254a041c5bSmacallan $run $rm $export_symbols 46264a041c5bSmacallan $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 46274a041c5bSmacallan case $host in 46284a041c5bSmacallan *cygwin* | *mingw* ) 46294a041c5bSmacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46304a041c5bSmacallan $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 46314a041c5bSmacallan ;; 46324a041c5bSmacallan esac 46334a041c5bSmacallan else 46344a041c5bSmacallan $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 46354a041c5bSmacallan $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 46364a041c5bSmacallan $run eval 'mv "$nlist"T "$nlist"' 46374a041c5bSmacallan case $host in 46384a041c5bSmacallan *cygwin* | *mingw* ) 46394a041c5bSmacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46404a041c5bSmacallan $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 46414a041c5bSmacallan ;; 46424a041c5bSmacallan esac 46434a041c5bSmacallan fi 46444a041c5bSmacallan fi 46454a041c5bSmacallan 46464a041c5bSmacallan for arg in $dlprefiles; do 46474a041c5bSmacallan $show "extracting global C symbols from \`$arg'" 46484a041c5bSmacallan name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 46494a041c5bSmacallan $run eval '$echo ": $name " >> "$nlist"' 46504a041c5bSmacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46514a041c5bSmacallan done 46524a041c5bSmacallan 46534a041c5bSmacallan if test -z "$run"; then 46544a041c5bSmacallan # Make sure we have at least an empty file. 46554a041c5bSmacallan test -f "$nlist" || : > "$nlist" 46564a041c5bSmacallan 46574a041c5bSmacallan if test -n "$exclude_expsyms"; then 46584a041c5bSmacallan $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 46594a041c5bSmacallan $mv "$nlist"T "$nlist" 46604a041c5bSmacallan fi 46614a041c5bSmacallan 46624a041c5bSmacallan # Try sorting and uniquifying the output. 46634a041c5bSmacallan if grep -v "^: " < "$nlist" | 46644a041c5bSmacallan if sort -k 3 </dev/null >/dev/null 2>&1; then 46654a041c5bSmacallan sort -k 3 46664a041c5bSmacallan else 46674a041c5bSmacallan sort +2 46684a041c5bSmacallan fi | 46694a041c5bSmacallan uniq > "$nlist"S; then 46704a041c5bSmacallan : 46714a041c5bSmacallan else 46724a041c5bSmacallan grep -v "^: " < "$nlist" > "$nlist"S 46734a041c5bSmacallan fi 46744a041c5bSmacallan 46754a041c5bSmacallan if test -f "$nlist"S; then 46764a041c5bSmacallan eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 46774a041c5bSmacallan else 46784a041c5bSmacallan $echo '/* NONE */' >> "$output_objdir/$dlsyms" 46794a041c5bSmacallan fi 46804a041c5bSmacallan 46814a041c5bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 46824a041c5bSmacallan 46834a041c5bSmacallan#undef lt_preloaded_symbols 46844a041c5bSmacallan 46854a041c5bSmacallan#if defined (__STDC__) && __STDC__ 46864a041c5bSmacallan# define lt_ptr void * 46874a041c5bSmacallan#else 46884a041c5bSmacallan# define lt_ptr char * 46894a041c5bSmacallan# define const 46904a041c5bSmacallan#endif 46914a041c5bSmacallan 46924a041c5bSmacallan/* The mapping between symbol names and symbols. */ 46934a041c5bSmacallan" 46944a041c5bSmacallan 46954a041c5bSmacallan case $host in 46964a041c5bSmacallan *cygwin* | *mingw* ) 46974a041c5bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 46984a041c5bSmacallan/* DATA imports from DLLs on WIN32 can't be const, because 46994a041c5bSmacallan runtime relocations are performed -- see ld's documentation 47004a041c5bSmacallan on pseudo-relocs */ 47014a041c5bSmacallanstruct { 47024a041c5bSmacallan" 47034a041c5bSmacallan ;; 47044a041c5bSmacallan * ) 47054a041c5bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 47064a041c5bSmacallanconst struct { 47074a041c5bSmacallan" 47084a041c5bSmacallan ;; 47094a041c5bSmacallan esac 47104a041c5bSmacallan 47114a041c5bSmacallan 47124a041c5bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 47134a041c5bSmacallan const char *name; 47144a041c5bSmacallan lt_ptr address; 47154a041c5bSmacallan} 47164a041c5bSmacallanlt_preloaded_symbols[] = 47174a041c5bSmacallan{\ 47184a041c5bSmacallan" 47194a041c5bSmacallan 47204a041c5bSmacallan eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 47214a041c5bSmacallan 47224a041c5bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 47234a041c5bSmacallan {0, (lt_ptr) 0} 47244a041c5bSmacallan}; 47254a041c5bSmacallan 47264a041c5bSmacallan/* This works around a problem in FreeBSD linker */ 47274a041c5bSmacallan#ifdef FREEBSD_WORKAROUND 47284a041c5bSmacallanstatic const void *lt_preloaded_setup() { 47294a041c5bSmacallan return lt_preloaded_symbols; 47304a041c5bSmacallan} 47314a041c5bSmacallan#endif 47324a041c5bSmacallan 47334a041c5bSmacallan#ifdef __cplusplus 47344a041c5bSmacallan} 47354a041c5bSmacallan#endif\ 47364a041c5bSmacallan" 47374a041c5bSmacallan fi 47384a041c5bSmacallan 47394a041c5bSmacallan pic_flag_for_symtable= 47404a041c5bSmacallan case $host in 47414a041c5bSmacallan # compiling the symbol table file with pic_flag works around 47424a041c5bSmacallan # a FreeBSD bug that causes programs to crash when -lm is 47434a041c5bSmacallan # linked before any other PIC object. But we must not use 47444a041c5bSmacallan # pic_flag when linking with -static. The problem exists in 47454a041c5bSmacallan # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 47464a041c5bSmacallan *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 47474a041c5bSmacallan case "$compile_command " in 47484a041c5bSmacallan *" -static "*) ;; 47494a041c5bSmacallan *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 47504a041c5bSmacallan esac;; 47514a041c5bSmacallan *-*-hpux*) 47524a041c5bSmacallan case "$compile_command " in 47534a041c5bSmacallan *" -static "*) ;; 47544a041c5bSmacallan *) pic_flag_for_symtable=" $pic_flag";; 47554a041c5bSmacallan esac 47564a041c5bSmacallan esac 47574a041c5bSmacallan 47584a041c5bSmacallan # Now compile the dynamic symbol file. 47594a041c5bSmacallan $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 47604a041c5bSmacallan $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 47614a041c5bSmacallan 47624a041c5bSmacallan # Clean up the generated files. 47634a041c5bSmacallan $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 47644a041c5bSmacallan $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 47654a041c5bSmacallan 47664a041c5bSmacallan # Transform the symbol file into the correct name. 47674a041c5bSmacallan case $host in 47684a041c5bSmacallan *cygwin* | *mingw* ) 47694a041c5bSmacallan if test -f "$output_objdir/${outputname}.def" ; then 47704a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47714a041c5bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47724a041c5bSmacallan else 47734a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47744a041c5bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47754a041c5bSmacallan fi 47764a041c5bSmacallan ;; 47774a041c5bSmacallan * ) 47784a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47794a041c5bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47804a041c5bSmacallan ;; 47814a041c5bSmacallan esac 47824a041c5bSmacallan ;; 47834a041c5bSmacallan *) 47844a041c5bSmacallan $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 47854a041c5bSmacallan exit $EXIT_FAILURE 47864a041c5bSmacallan ;; 47874a041c5bSmacallan esac 47884a041c5bSmacallan else 47894a041c5bSmacallan # We keep going just in case the user didn't refer to 47904a041c5bSmacallan # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 47914a041c5bSmacallan # really was required. 47924a041c5bSmacallan 47934a041c5bSmacallan # Nullify the symbol file. 47944a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47954a041c5bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47964a041c5bSmacallan fi 47974a041c5bSmacallan 47984a041c5bSmacallan if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 47994a041c5bSmacallan # Replace the output file specification. 48004a041c5bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 48014a041c5bSmacallan link_command="$compile_command$compile_rpath" 48024a041c5bSmacallan 48034a041c5bSmacallan # We have no uninstalled library dependencies, so finalize right now. 48044a041c5bSmacallan $show "$link_command" 48054a041c5bSmacallan $run eval "$link_command" 48064a041c5bSmacallan exit_status=$? 48074a041c5bSmacallan 48084a041c5bSmacallan # Delete the generated files. 48094a041c5bSmacallan if test -n "$dlsyms"; then 48104a041c5bSmacallan $show "$rm $output_objdir/${outputname}S.${objext}" 48114a041c5bSmacallan $run $rm "$output_objdir/${outputname}S.${objext}" 48124a041c5bSmacallan fi 48134a041c5bSmacallan 48144a041c5bSmacallan exit $exit_status 48154a041c5bSmacallan fi 48164a041c5bSmacallan 48174a041c5bSmacallan if test -n "$shlibpath_var"; then 48184a041c5bSmacallan # We should set the shlibpath_var 48194a041c5bSmacallan rpath= 48204a041c5bSmacallan for dir in $temp_rpath; do 48214a041c5bSmacallan case $dir in 48224a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) 48234a041c5bSmacallan # Absolute path. 48244a041c5bSmacallan rpath="$rpath$dir:" 48254a041c5bSmacallan ;; 48264a041c5bSmacallan *) 48274a041c5bSmacallan # Relative path: add a thisdir entry. 48284a041c5bSmacallan rpath="$rpath\$thisdir/$dir:" 48294a041c5bSmacallan ;; 48304a041c5bSmacallan esac 48314a041c5bSmacallan done 48324a041c5bSmacallan temp_rpath="$rpath" 48334a041c5bSmacallan fi 48344a041c5bSmacallan 48354a041c5bSmacallan if test -n "$compile_shlibpath$finalize_shlibpath"; then 48364a041c5bSmacallan compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 48374a041c5bSmacallan fi 48384a041c5bSmacallan if test -n "$finalize_shlibpath"; then 48394a041c5bSmacallan finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 48404a041c5bSmacallan fi 48414a041c5bSmacallan 48424a041c5bSmacallan compile_var= 48434a041c5bSmacallan finalize_var= 48444a041c5bSmacallan if test -n "$runpath_var"; then 48454a041c5bSmacallan if test -n "$perm_rpath"; then 48464a041c5bSmacallan # We should set the runpath_var. 48474a041c5bSmacallan rpath= 48484a041c5bSmacallan for dir in $perm_rpath; do 48494a041c5bSmacallan rpath="$rpath$dir:" 48504a041c5bSmacallan done 48514a041c5bSmacallan compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 48524a041c5bSmacallan fi 48534a041c5bSmacallan if test -n "$finalize_perm_rpath"; then 48544a041c5bSmacallan # We should set the runpath_var. 48554a041c5bSmacallan rpath= 48564a041c5bSmacallan for dir in $finalize_perm_rpath; do 48574a041c5bSmacallan rpath="$rpath$dir:" 48584a041c5bSmacallan done 48594a041c5bSmacallan finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 48604a041c5bSmacallan fi 48614a041c5bSmacallan fi 48624a041c5bSmacallan 48634a041c5bSmacallan if test "$no_install" = yes; then 48644a041c5bSmacallan # We don't need to create a wrapper script. 48654a041c5bSmacallan link_command="$compile_var$compile_command$compile_rpath" 48664a041c5bSmacallan # Replace the output file specification. 48674a041c5bSmacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 48684a041c5bSmacallan # Delete the old output file. 48694a041c5bSmacallan $run $rm $output 48704a041c5bSmacallan # Link the executable and exit 48714a041c5bSmacallan $show "$link_command" 48724a041c5bSmacallan $run eval "$link_command" || exit $? 48734a041c5bSmacallan exit $EXIT_SUCCESS 48744a041c5bSmacallan fi 48754a041c5bSmacallan 48764a041c5bSmacallan if test "$hardcode_action" = relink; then 48774a041c5bSmacallan # Fast installation is not supported 48784a041c5bSmacallan link_command="$compile_var$compile_command$compile_rpath" 48794a041c5bSmacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 48804a041c5bSmacallan 48814a041c5bSmacallan $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 48824a041c5bSmacallan $echo "$modename: \`$output' will be relinked during installation" 1>&2 48834a041c5bSmacallan else 48844a041c5bSmacallan if test "$fast_install" != no; then 48854a041c5bSmacallan link_command="$finalize_var$compile_command$finalize_rpath" 48864a041c5bSmacallan if test "$fast_install" = yes; then 48874a041c5bSmacallan relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 48884a041c5bSmacallan else 48894a041c5bSmacallan # fast_install is set to needless 48904a041c5bSmacallan relink_command= 48914a041c5bSmacallan fi 48924a041c5bSmacallan else 48934a041c5bSmacallan link_command="$compile_var$compile_command$compile_rpath" 48944a041c5bSmacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 48954a041c5bSmacallan fi 48964a041c5bSmacallan fi 48974a041c5bSmacallan 48984a041c5bSmacallan # Replace the output file specification. 48994a041c5bSmacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 49004a041c5bSmacallan 49014a041c5bSmacallan # Delete the old output files. 49024a041c5bSmacallan $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 49034a041c5bSmacallan 49044a041c5bSmacallan $show "$link_command" 49054a041c5bSmacallan $run eval "$link_command" || exit $? 49064a041c5bSmacallan 49074a041c5bSmacallan # Now create the wrapper script. 49084a041c5bSmacallan $show "creating $output" 49094a041c5bSmacallan 49104a041c5bSmacallan # Quote the relink command for shipping. 49114a041c5bSmacallan if test -n "$relink_command"; then 49124a041c5bSmacallan # Preserve any variables that may affect compiler behavior 49134a041c5bSmacallan for var in $variables_saved_for_relink; do 49144a041c5bSmacallan if eval test -z \"\${$var+set}\"; then 49154a041c5bSmacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 49164a041c5bSmacallan elif eval var_value=\$$var; test -z "$var_value"; then 49174a041c5bSmacallan relink_command="$var=; export $var; $relink_command" 49184a041c5bSmacallan else 49194a041c5bSmacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 49204a041c5bSmacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 49214a041c5bSmacallan fi 49224a041c5bSmacallan done 49234a041c5bSmacallan relink_command="(cd `pwd`; $relink_command)" 49244a041c5bSmacallan relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 49254a041c5bSmacallan fi 49264a041c5bSmacallan 49274a041c5bSmacallan # Quote $echo for shipping. 49284a041c5bSmacallan if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 49294a041c5bSmacallan case $progpath in 49304a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 49314a041c5bSmacallan *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 49324a041c5bSmacallan esac 49334a041c5bSmacallan qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 49344a041c5bSmacallan else 49354a041c5bSmacallan qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 49364a041c5bSmacallan fi 49374a041c5bSmacallan 49384a041c5bSmacallan # Only actually do things if our run command is non-null. 49394a041c5bSmacallan if test -z "$run"; then 49404a041c5bSmacallan # win32 will think the script is a binary if it has 49414a041c5bSmacallan # a .exe suffix, so we strip it off here. 49424a041c5bSmacallan case $output in 49434a041c5bSmacallan *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 49444a041c5bSmacallan esac 49454a041c5bSmacallan # test for cygwin because mv fails w/o .exe extensions 49464a041c5bSmacallan case $host in 49474a041c5bSmacallan *cygwin*) 49484a041c5bSmacallan exeext=.exe 49494a041c5bSmacallan outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 49504a041c5bSmacallan *) exeext= ;; 49514a041c5bSmacallan esac 49524a041c5bSmacallan case $host in 49534a041c5bSmacallan *cygwin* | *mingw* ) 49544a041c5bSmacallan output_name=`basename $output` 49554a041c5bSmacallan output_path=`dirname $output` 49564a041c5bSmacallan cwrappersource="$output_path/$objdir/lt-$output_name.c" 49574a041c5bSmacallan cwrapper="$output_path/$output_name.exe" 49584a041c5bSmacallan $rm $cwrappersource $cwrapper 49594a041c5bSmacallan trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 49604a041c5bSmacallan 49614a041c5bSmacallan cat > $cwrappersource <<EOF 49624a041c5bSmacallan 49634a041c5bSmacallan/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 49644a041c5bSmacallan Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 49654a041c5bSmacallan 49664a041c5bSmacallan The $output program cannot be directly executed until all the libtool 49674a041c5bSmacallan libraries that it depends on are installed. 49684a041c5bSmacallan 49694a041c5bSmacallan This wrapper executable should never be moved out of the build directory. 49704a041c5bSmacallan If it is, it will not operate correctly. 49714a041c5bSmacallan 49724a041c5bSmacallan Currently, it simply execs the wrapper *script* "/bin/sh $output", 49734a041c5bSmacallan but could eventually absorb all of the scripts functionality and 49744a041c5bSmacallan exec $objdir/$outputname directly. 49754a041c5bSmacallan*/ 49764a041c5bSmacallanEOF 49774a041c5bSmacallan cat >> $cwrappersource<<"EOF" 49784a041c5bSmacallan#include <stdio.h> 49794a041c5bSmacallan#include <stdlib.h> 49804a041c5bSmacallan#include <unistd.h> 49814a041c5bSmacallan#include <malloc.h> 49824a041c5bSmacallan#include <stdarg.h> 49834a041c5bSmacallan#include <assert.h> 49844a041c5bSmacallan#include <string.h> 49854a041c5bSmacallan#include <ctype.h> 49864a041c5bSmacallan#include <sys/stat.h> 49874a041c5bSmacallan 49884a041c5bSmacallan#if defined(PATH_MAX) 49894a041c5bSmacallan# define LT_PATHMAX PATH_MAX 49904a041c5bSmacallan#elif defined(MAXPATHLEN) 49914a041c5bSmacallan# define LT_PATHMAX MAXPATHLEN 49924a041c5bSmacallan#else 49934a041c5bSmacallan# define LT_PATHMAX 1024 49944a041c5bSmacallan#endif 49954a041c5bSmacallan 49964a041c5bSmacallan#ifndef DIR_SEPARATOR 49974a041c5bSmacallan# define DIR_SEPARATOR '/' 49984a041c5bSmacallan# define PATH_SEPARATOR ':' 49994a041c5bSmacallan#endif 50004a041c5bSmacallan 50014a041c5bSmacallan#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 50024a041c5bSmacallan defined (__OS2__) 50034a041c5bSmacallan# define HAVE_DOS_BASED_FILE_SYSTEM 50044a041c5bSmacallan# ifndef DIR_SEPARATOR_2 50054a041c5bSmacallan# define DIR_SEPARATOR_2 '\\' 50064a041c5bSmacallan# endif 50074a041c5bSmacallan# ifndef PATH_SEPARATOR_2 50084a041c5bSmacallan# define PATH_SEPARATOR_2 ';' 50094a041c5bSmacallan# endif 50104a041c5bSmacallan#endif 50114a041c5bSmacallan 50124a041c5bSmacallan#ifndef DIR_SEPARATOR_2 50134a041c5bSmacallan# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 50144a041c5bSmacallan#else /* DIR_SEPARATOR_2 */ 50154a041c5bSmacallan# define IS_DIR_SEPARATOR(ch) \ 50164a041c5bSmacallan (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 50174a041c5bSmacallan#endif /* DIR_SEPARATOR_2 */ 50184a041c5bSmacallan 50194a041c5bSmacallan#ifndef PATH_SEPARATOR_2 50204a041c5bSmacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 50214a041c5bSmacallan#else /* PATH_SEPARATOR_2 */ 50224a041c5bSmacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 50234a041c5bSmacallan#endif /* PATH_SEPARATOR_2 */ 50244a041c5bSmacallan 50254a041c5bSmacallan#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 50264a041c5bSmacallan#define XFREE(stale) do { \ 50274a041c5bSmacallan if (stale) { free ((void *) stale); stale = 0; } \ 50284a041c5bSmacallan} while (0) 50294a041c5bSmacallan 50304a041c5bSmacallan/* -DDEBUG is fairly common in CFLAGS. */ 50314a041c5bSmacallan#undef DEBUG 50324a041c5bSmacallan#if defined DEBUGWRAPPER 50334a041c5bSmacallan# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 50344a041c5bSmacallan#else 50354a041c5bSmacallan# define DEBUG(format, ...) 50364a041c5bSmacallan#endif 50374a041c5bSmacallan 50384a041c5bSmacallanconst char *program_name = NULL; 50394a041c5bSmacallan 50404a041c5bSmacallanvoid * xmalloc (size_t num); 50414a041c5bSmacallanchar * xstrdup (const char *string); 50424a041c5bSmacallanconst char * base_name (const char *name); 50434a041c5bSmacallanchar * find_executable(const char *wrapper); 50444a041c5bSmacallanint check_executable(const char *path); 50454a041c5bSmacallanchar * strendzap(char *str, const char *pat); 50464a041c5bSmacallanvoid lt_fatal (const char *message, ...); 50474a041c5bSmacallan 50484a041c5bSmacallanint 50494a041c5bSmacallanmain (int argc, char *argv[]) 50504a041c5bSmacallan{ 50514a041c5bSmacallan char **newargz; 50524a041c5bSmacallan int i; 50534a041c5bSmacallan 50544a041c5bSmacallan program_name = (char *) xstrdup (base_name (argv[0])); 50554a041c5bSmacallan DEBUG("(main) argv[0] : %s\n",argv[0]); 50564a041c5bSmacallan DEBUG("(main) program_name : %s\n",program_name); 50574a041c5bSmacallan newargz = XMALLOC(char *, argc+2); 50584a041c5bSmacallanEOF 50594a041c5bSmacallan 50604a041c5bSmacallan cat >> $cwrappersource <<EOF 50614a041c5bSmacallan newargz[0] = (char *) xstrdup("$SHELL"); 50624a041c5bSmacallanEOF 50634a041c5bSmacallan 50644a041c5bSmacallan cat >> $cwrappersource <<"EOF" 50654a041c5bSmacallan newargz[1] = find_executable(argv[0]); 50664a041c5bSmacallan if (newargz[1] == NULL) 50674a041c5bSmacallan lt_fatal("Couldn't find %s", argv[0]); 50684a041c5bSmacallan DEBUG("(main) found exe at : %s\n",newargz[1]); 50694a041c5bSmacallan /* we know the script has the same name, without the .exe */ 50704a041c5bSmacallan /* so make sure newargz[1] doesn't end in .exe */ 50714a041c5bSmacallan strendzap(newargz[1],".exe"); 50724a041c5bSmacallan for (i = 1; i < argc; i++) 50734a041c5bSmacallan newargz[i+1] = xstrdup(argv[i]); 50744a041c5bSmacallan newargz[argc+1] = NULL; 50754a041c5bSmacallan 50764a041c5bSmacallan for (i=0; i<argc+1; i++) 50774a041c5bSmacallan { 50784a041c5bSmacallan DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 50794a041c5bSmacallan ; 50804a041c5bSmacallan } 50814a041c5bSmacallan 50824a041c5bSmacallanEOF 50834a041c5bSmacallan 50844a041c5bSmacallan case $host_os in 50854a041c5bSmacallan mingw*) 50864a041c5bSmacallan cat >> $cwrappersource <<EOF 50874a041c5bSmacallan execv("$SHELL",(char const **)newargz); 50884a041c5bSmacallanEOF 50894a041c5bSmacallan ;; 50904a041c5bSmacallan *) 50914a041c5bSmacallan cat >> $cwrappersource <<EOF 50924a041c5bSmacallan execv("$SHELL",newargz); 50934a041c5bSmacallanEOF 50944a041c5bSmacallan ;; 50954a041c5bSmacallan esac 50964a041c5bSmacallan 50974a041c5bSmacallan cat >> $cwrappersource <<"EOF" 50984a041c5bSmacallan return 127; 50994a041c5bSmacallan} 51004a041c5bSmacallan 51014a041c5bSmacallanvoid * 51024a041c5bSmacallanxmalloc (size_t num) 51034a041c5bSmacallan{ 51044a041c5bSmacallan void * p = (void *) malloc (num); 51054a041c5bSmacallan if (!p) 51064a041c5bSmacallan lt_fatal ("Memory exhausted"); 51074a041c5bSmacallan 51084a041c5bSmacallan return p; 51094a041c5bSmacallan} 51104a041c5bSmacallan 51114a041c5bSmacallanchar * 51124a041c5bSmacallanxstrdup (const char *string) 51134a041c5bSmacallan{ 51144a041c5bSmacallan return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 51154a041c5bSmacallan; 51164a041c5bSmacallan} 51174a041c5bSmacallan 51184a041c5bSmacallanconst char * 51194a041c5bSmacallanbase_name (const char *name) 51204a041c5bSmacallan{ 51214a041c5bSmacallan const char *base; 51224a041c5bSmacallan 51234a041c5bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51244a041c5bSmacallan /* Skip over the disk name in MSDOS pathnames. */ 51254a041c5bSmacallan if (isalpha ((unsigned char)name[0]) && name[1] == ':') 51264a041c5bSmacallan name += 2; 51274a041c5bSmacallan#endif 51284a041c5bSmacallan 51294a041c5bSmacallan for (base = name; *name; name++) 51304a041c5bSmacallan if (IS_DIR_SEPARATOR (*name)) 51314a041c5bSmacallan base = name + 1; 51324a041c5bSmacallan return base; 51334a041c5bSmacallan} 51344a041c5bSmacallan 51354a041c5bSmacallanint 51364a041c5bSmacallancheck_executable(const char * path) 51374a041c5bSmacallan{ 51384a041c5bSmacallan struct stat st; 51394a041c5bSmacallan 51404a041c5bSmacallan DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 51414a041c5bSmacallan if ((!path) || (!*path)) 51424a041c5bSmacallan return 0; 51434a041c5bSmacallan 51444a041c5bSmacallan if ((stat (path, &st) >= 0) && 51454a041c5bSmacallan ( 51464a041c5bSmacallan /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 51474a041c5bSmacallan#if defined (S_IXOTH) 51484a041c5bSmacallan ((st.st_mode & S_IXOTH) == S_IXOTH) || 51494a041c5bSmacallan#endif 51504a041c5bSmacallan#if defined (S_IXGRP) 51514a041c5bSmacallan ((st.st_mode & S_IXGRP) == S_IXGRP) || 51524a041c5bSmacallan#endif 51534a041c5bSmacallan ((st.st_mode & S_IXUSR) == S_IXUSR)) 51544a041c5bSmacallan ) 51554a041c5bSmacallan return 1; 51564a041c5bSmacallan else 51574a041c5bSmacallan return 0; 51584a041c5bSmacallan} 51594a041c5bSmacallan 51604a041c5bSmacallan/* Searches for the full path of the wrapper. Returns 51614a041c5bSmacallan newly allocated full path name if found, NULL otherwise */ 51624a041c5bSmacallanchar * 51634a041c5bSmacallanfind_executable (const char* wrapper) 51644a041c5bSmacallan{ 51654a041c5bSmacallan int has_slash = 0; 51664a041c5bSmacallan const char* p; 51674a041c5bSmacallan const char* p_next; 51684a041c5bSmacallan /* static buffer for getcwd */ 51694a041c5bSmacallan char tmp[LT_PATHMAX + 1]; 51704a041c5bSmacallan int tmp_len; 51714a041c5bSmacallan char* concat_name; 51724a041c5bSmacallan 51734a041c5bSmacallan DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 51744a041c5bSmacallan 51754a041c5bSmacallan if ((wrapper == NULL) || (*wrapper == '\0')) 51764a041c5bSmacallan return NULL; 51774a041c5bSmacallan 51784a041c5bSmacallan /* Absolute path? */ 51794a041c5bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51804a041c5bSmacallan if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 51814a041c5bSmacallan { 51824a041c5bSmacallan concat_name = xstrdup (wrapper); 51834a041c5bSmacallan if (check_executable(concat_name)) 51844a041c5bSmacallan return concat_name; 51854a041c5bSmacallan XFREE(concat_name); 51864a041c5bSmacallan } 51874a041c5bSmacallan else 51884a041c5bSmacallan { 51894a041c5bSmacallan#endif 51904a041c5bSmacallan if (IS_DIR_SEPARATOR (wrapper[0])) 51914a041c5bSmacallan { 51924a041c5bSmacallan concat_name = xstrdup (wrapper); 51934a041c5bSmacallan if (check_executable(concat_name)) 51944a041c5bSmacallan return concat_name; 51954a041c5bSmacallan XFREE(concat_name); 51964a041c5bSmacallan } 51974a041c5bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51984a041c5bSmacallan } 51994a041c5bSmacallan#endif 52004a041c5bSmacallan 52014a041c5bSmacallan for (p = wrapper; *p; p++) 52024a041c5bSmacallan if (*p == '/') 52034a041c5bSmacallan { 52044a041c5bSmacallan has_slash = 1; 52054a041c5bSmacallan break; 52064a041c5bSmacallan } 52074a041c5bSmacallan if (!has_slash) 52084a041c5bSmacallan { 52094a041c5bSmacallan /* no slashes; search PATH */ 52104a041c5bSmacallan const char* path = getenv ("PATH"); 52114a041c5bSmacallan if (path != NULL) 52124a041c5bSmacallan { 52134a041c5bSmacallan for (p = path; *p; p = p_next) 52144a041c5bSmacallan { 52154a041c5bSmacallan const char* q; 52164a041c5bSmacallan size_t p_len; 52174a041c5bSmacallan for (q = p; *q; q++) 52184a041c5bSmacallan if (IS_PATH_SEPARATOR(*q)) 52194a041c5bSmacallan break; 52204a041c5bSmacallan p_len = q - p; 52214a041c5bSmacallan p_next = (*q == '\0' ? q : q + 1); 52224a041c5bSmacallan if (p_len == 0) 52234a041c5bSmacallan { 52244a041c5bSmacallan /* empty path: current directory */ 52254a041c5bSmacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 52264a041c5bSmacallan lt_fatal ("getcwd failed"); 52274a041c5bSmacallan tmp_len = strlen(tmp); 52284a041c5bSmacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52294a041c5bSmacallan memcpy (concat_name, tmp, tmp_len); 52304a041c5bSmacallan concat_name[tmp_len] = '/'; 52314a041c5bSmacallan strcpy (concat_name + tmp_len + 1, wrapper); 52324a041c5bSmacallan } 52334a041c5bSmacallan else 52344a041c5bSmacallan { 52354a041c5bSmacallan concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 52364a041c5bSmacallan memcpy (concat_name, p, p_len); 52374a041c5bSmacallan concat_name[p_len] = '/'; 52384a041c5bSmacallan strcpy (concat_name + p_len + 1, wrapper); 52394a041c5bSmacallan } 52404a041c5bSmacallan if (check_executable(concat_name)) 52414a041c5bSmacallan return concat_name; 52424a041c5bSmacallan XFREE(concat_name); 52434a041c5bSmacallan } 52444a041c5bSmacallan } 52454a041c5bSmacallan /* not found in PATH; assume curdir */ 52464a041c5bSmacallan } 52474a041c5bSmacallan /* Relative path | not found in path: prepend cwd */ 52484a041c5bSmacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 52494a041c5bSmacallan lt_fatal ("getcwd failed"); 52504a041c5bSmacallan tmp_len = strlen(tmp); 52514a041c5bSmacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52524a041c5bSmacallan memcpy (concat_name, tmp, tmp_len); 52534a041c5bSmacallan concat_name[tmp_len] = '/'; 52544a041c5bSmacallan strcpy (concat_name + tmp_len + 1, wrapper); 52554a041c5bSmacallan 52564a041c5bSmacallan if (check_executable(concat_name)) 52574a041c5bSmacallan return concat_name; 52584a041c5bSmacallan XFREE(concat_name); 52594a041c5bSmacallan return NULL; 52604a041c5bSmacallan} 52614a041c5bSmacallan 52624a041c5bSmacallanchar * 52634a041c5bSmacallanstrendzap(char *str, const char *pat) 52644a041c5bSmacallan{ 52654a041c5bSmacallan size_t len, patlen; 52664a041c5bSmacallan 52674a041c5bSmacallan assert(str != NULL); 52684a041c5bSmacallan assert(pat != NULL); 52694a041c5bSmacallan 52704a041c5bSmacallan len = strlen(str); 52714a041c5bSmacallan patlen = strlen(pat); 52724a041c5bSmacallan 52734a041c5bSmacallan if (patlen <= len) 52744a041c5bSmacallan { 52754a041c5bSmacallan str += len - patlen; 52764a041c5bSmacallan if (strcmp(str, pat) == 0) 52774a041c5bSmacallan *str = '\0'; 52784a041c5bSmacallan } 52794a041c5bSmacallan return str; 52804a041c5bSmacallan} 52814a041c5bSmacallan 52824a041c5bSmacallanstatic void 52834a041c5bSmacallanlt_error_core (int exit_status, const char * mode, 52844a041c5bSmacallan const char * message, va_list ap) 52854a041c5bSmacallan{ 52864a041c5bSmacallan fprintf (stderr, "%s: %s: ", program_name, mode); 52874a041c5bSmacallan vfprintf (stderr, message, ap); 52884a041c5bSmacallan fprintf (stderr, ".\n"); 52894a041c5bSmacallan 52904a041c5bSmacallan if (exit_status >= 0) 52914a041c5bSmacallan exit (exit_status); 52924a041c5bSmacallan} 52934a041c5bSmacallan 52944a041c5bSmacallanvoid 52954a041c5bSmacallanlt_fatal (const char *message, ...) 52964a041c5bSmacallan{ 52974a041c5bSmacallan va_list ap; 52984a041c5bSmacallan va_start (ap, message); 52994a041c5bSmacallan lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 53004a041c5bSmacallan va_end (ap); 53014a041c5bSmacallan} 53024a041c5bSmacallanEOF 53034a041c5bSmacallan # we should really use a build-platform specific compiler 53044a041c5bSmacallan # here, but OTOH, the wrappers (shell script and this C one) 53054a041c5bSmacallan # are only useful if you want to execute the "real" binary. 53064a041c5bSmacallan # Since the "real" binary is built for $host, then this 53074a041c5bSmacallan # wrapper might as well be built for $host, too. 53084a041c5bSmacallan $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 53094a041c5bSmacallan ;; 53104a041c5bSmacallan esac 53114a041c5bSmacallan $rm $output 53124a041c5bSmacallan trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 53134a041c5bSmacallan 53144a041c5bSmacallan $echo > $output "\ 53154a041c5bSmacallan#! $SHELL 53164a041c5bSmacallan 53174a041c5bSmacallan# $output - temporary wrapper script for $objdir/$outputname 53184a041c5bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 53194a041c5bSmacallan# 53204a041c5bSmacallan# The $output program cannot be directly executed until all the libtool 53214a041c5bSmacallan# libraries that it depends on are installed. 53224a041c5bSmacallan# 53234a041c5bSmacallan# This wrapper script should never be moved out of the build directory. 53244a041c5bSmacallan# If it is, it will not operate correctly. 53254a041c5bSmacallan 53264a041c5bSmacallan# Sed substitution that helps us do robust quoting. It backslashifies 53274a041c5bSmacallan# metacharacters that are still active within double-quoted strings. 53284a041c5bSmacallanXsed='${SED} -e 1s/^X//' 53294a041c5bSmacallansed_quote_subst='$sed_quote_subst' 53304a041c5bSmacallan 53314a041c5bSmacallan# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53324a041c5bSmacallanif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 53334a041c5bSmacallan emulate sh 53344a041c5bSmacallan NULLCMD=: 53354a041c5bSmacallan # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 53364a041c5bSmacallan # is contrary to our usage. Disable this feature. 53374a041c5bSmacallan alias -g '\${1+\"\$@\"}'='\"\$@\"' 53384a041c5bSmacallan setopt NO_GLOB_SUBST 53394a041c5bSmacallanelse 53404a041c5bSmacallan case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 53414a041c5bSmacallanfi 53424a041c5bSmacallanBIN_SH=xpg4; export BIN_SH # for Tru64 53434a041c5bSmacallanDUALCASE=1; export DUALCASE # for MKS sh 53444a041c5bSmacallan 53454a041c5bSmacallan# The HP-UX ksh and POSIX shell print the target directory to stdout 53464a041c5bSmacallan# if CDPATH is set. 53474a041c5bSmacallan(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 53484a041c5bSmacallan 53494a041c5bSmacallanrelink_command=\"$relink_command\" 53504a041c5bSmacallan 53514a041c5bSmacallan# This environment variable determines our operation mode. 53524a041c5bSmacallanif test \"\$libtool_install_magic\" = \"$magic\"; then 53534a041c5bSmacallan # install mode needs the following variable: 53544a041c5bSmacallan notinst_deplibs='$notinst_deplibs' 53554a041c5bSmacallanelse 53564a041c5bSmacallan # When we are sourced in execute mode, \$file and \$echo are already set. 53574a041c5bSmacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 53584a041c5bSmacallan echo=\"$qecho\" 53594a041c5bSmacallan file=\"\$0\" 53604a041c5bSmacallan # Make sure echo works. 53614a041c5bSmacallan if test \"X\$1\" = X--no-reexec; then 53624a041c5bSmacallan # Discard the --no-reexec flag, and continue. 53634a041c5bSmacallan shift 53644a041c5bSmacallan elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 53654a041c5bSmacallan # Yippee, \$echo works! 53664a041c5bSmacallan : 53674a041c5bSmacallan else 53684a041c5bSmacallan # Restart under the correct shell, and then maybe \$echo will work. 53694a041c5bSmacallan exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 53704a041c5bSmacallan fi 53714a041c5bSmacallan fi\ 53724a041c5bSmacallan" 53734a041c5bSmacallan $echo >> $output "\ 53744a041c5bSmacallan 53754a041c5bSmacallan # Find the directory that this script lives in. 53764a041c5bSmacallan thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 53774a041c5bSmacallan test \"x\$thisdir\" = \"x\$file\" && thisdir=. 53784a041c5bSmacallan 53794a041c5bSmacallan # Follow symbolic links until we get to the real thisdir. 53804a041c5bSmacallan file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 53814a041c5bSmacallan while test -n \"\$file\"; do 53824a041c5bSmacallan destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 53834a041c5bSmacallan 53844a041c5bSmacallan # If there was a directory component, then change thisdir. 53854a041c5bSmacallan if test \"x\$destdir\" != \"x\$file\"; then 53864a041c5bSmacallan case \"\$destdir\" in 53874a041c5bSmacallan [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 53884a041c5bSmacallan *) thisdir=\"\$thisdir/\$destdir\" ;; 53894a041c5bSmacallan esac 53904a041c5bSmacallan fi 53914a041c5bSmacallan 53924a041c5bSmacallan file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 53934a041c5bSmacallan file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 53944a041c5bSmacallan done 53954a041c5bSmacallan 53964a041c5bSmacallan # Try to get the absolute directory name. 53974a041c5bSmacallan absdir=\`cd \"\$thisdir\" && pwd\` 53984a041c5bSmacallan test -n \"\$absdir\" && thisdir=\"\$absdir\" 53994a041c5bSmacallan" 54004a041c5bSmacallan 54014a041c5bSmacallan if test "$fast_install" = yes; then 54024a041c5bSmacallan $echo >> $output "\ 54034a041c5bSmacallan program=lt-'$outputname'$exeext 54044a041c5bSmacallan progdir=\"\$thisdir/$objdir\" 54054a041c5bSmacallan 54064a041c5bSmacallan if test ! -f \"\$progdir/\$program\" || \\ 54074a041c5bSmacallan { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 54084a041c5bSmacallan test \"X\$file\" != \"X\$progdir/\$program\"; }; then 54094a041c5bSmacallan 54104a041c5bSmacallan file=\"\$\$-\$program\" 54114a041c5bSmacallan 54124a041c5bSmacallan if test ! -d \"\$progdir\"; then 54134a041c5bSmacallan $mkdir \"\$progdir\" 54144a041c5bSmacallan else 54154a041c5bSmacallan $rm \"\$progdir/\$file\" 54164a041c5bSmacallan fi" 54174a041c5bSmacallan 54184a041c5bSmacallan $echo >> $output "\ 54194a041c5bSmacallan 54204a041c5bSmacallan # relink executable if necessary 54214a041c5bSmacallan if test -n \"\$relink_command\"; then 54224a041c5bSmacallan if relink_command_output=\`eval \$relink_command 2>&1\`; then : 54234a041c5bSmacallan else 54244a041c5bSmacallan $echo \"\$relink_command_output\" >&2 54254a041c5bSmacallan $rm \"\$progdir/\$file\" 54264a041c5bSmacallan exit $EXIT_FAILURE 54274a041c5bSmacallan fi 54284a041c5bSmacallan fi 54294a041c5bSmacallan 54304a041c5bSmacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 54314a041c5bSmacallan { $rm \"\$progdir/\$program\"; 54324a041c5bSmacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 54334a041c5bSmacallan $rm \"\$progdir/\$file\" 54344a041c5bSmacallan fi" 54354a041c5bSmacallan else 54364a041c5bSmacallan $echo >> $output "\ 54374a041c5bSmacallan program='$outputname' 54384a041c5bSmacallan progdir=\"\$thisdir/$objdir\" 54394a041c5bSmacallan" 54404a041c5bSmacallan fi 54414a041c5bSmacallan 54424a041c5bSmacallan $echo >> $output "\ 54434a041c5bSmacallan 54444a041c5bSmacallan if test -f \"\$progdir/\$program\"; then" 54454a041c5bSmacallan 54464a041c5bSmacallan # Export our shlibpath_var if we have one. 54474a041c5bSmacallan if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 54484a041c5bSmacallan $echo >> $output "\ 54494a041c5bSmacallan # Add our own library path to $shlibpath_var 54504a041c5bSmacallan $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 54514a041c5bSmacallan 54524a041c5bSmacallan # Some systems cannot cope with colon-terminated $shlibpath_var 54534a041c5bSmacallan # The second colon is a workaround for a bug in BeOS R4 sed 54544a041c5bSmacallan $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 54554a041c5bSmacallan 54564a041c5bSmacallan export $shlibpath_var 54574a041c5bSmacallan" 54584a041c5bSmacallan fi 54594a041c5bSmacallan 54604a041c5bSmacallan # fixup the dll searchpath if we need to. 54614a041c5bSmacallan if test -n "$dllsearchpath"; then 54624a041c5bSmacallan $echo >> $output "\ 54634a041c5bSmacallan # Add the dll search path components to the executable PATH 54644a041c5bSmacallan PATH=$dllsearchpath:\$PATH 54654a041c5bSmacallan" 54664a041c5bSmacallan fi 54674a041c5bSmacallan 54684a041c5bSmacallan $echo >> $output "\ 54694a041c5bSmacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 54704a041c5bSmacallan # Run the actual program with our arguments. 54714a041c5bSmacallan" 54724a041c5bSmacallan case $host in 54734a041c5bSmacallan # Backslashes separate directories on plain windows 54744a041c5bSmacallan *-*-mingw | *-*-os2*) 54754a041c5bSmacallan $echo >> $output "\ 54764a041c5bSmacallan exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 54774a041c5bSmacallan" 54784a041c5bSmacallan ;; 54794a041c5bSmacallan 54804a041c5bSmacallan *) 54814a041c5bSmacallan $echo >> $output "\ 54824a041c5bSmacallan exec \"\$progdir/\$program\" \${1+\"\$@\"} 54834a041c5bSmacallan" 54844a041c5bSmacallan ;; 54854a041c5bSmacallan esac 54864a041c5bSmacallan $echo >> $output "\ 54874a041c5bSmacallan \$echo \"\$0: cannot exec \$program \$*\" 54884a041c5bSmacallan exit $EXIT_FAILURE 54894a041c5bSmacallan fi 54904a041c5bSmacallan else 54914a041c5bSmacallan # The program doesn't exist. 54924a041c5bSmacallan \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 54934a041c5bSmacallan \$echo \"This script is just a wrapper for \$program.\" 1>&2 54944a041c5bSmacallan $echo \"See the $PACKAGE documentation for more information.\" 1>&2 54954a041c5bSmacallan exit $EXIT_FAILURE 54964a041c5bSmacallan fi 54974a041c5bSmacallanfi\ 54984a041c5bSmacallan" 54994a041c5bSmacallan chmod +x $output 55004a041c5bSmacallan fi 55014a041c5bSmacallan exit $EXIT_SUCCESS 55024a041c5bSmacallan ;; 55034a041c5bSmacallan esac 55044a041c5bSmacallan 55054a041c5bSmacallan # See if we need to build an old-fashioned archive. 55064a041c5bSmacallan for oldlib in $oldlibs; do 55074a041c5bSmacallan 55084a041c5bSmacallan if test "$build_libtool_libs" = convenience; then 55094a041c5bSmacallan oldobjs="$libobjs_save" 55104a041c5bSmacallan addlibs="$convenience" 55114a041c5bSmacallan build_libtool_libs=no 55124a041c5bSmacallan else 55134a041c5bSmacallan if test "$build_libtool_libs" = module; then 55144a041c5bSmacallan oldobjs="$libobjs_save" 55154a041c5bSmacallan build_libtool_libs=no 55164a041c5bSmacallan else 55174a041c5bSmacallan oldobjs="$old_deplibs $non_pic_objects" 55184a041c5bSmacallan fi 55194a041c5bSmacallan addlibs="$old_convenience" 55204a041c5bSmacallan fi 55214a041c5bSmacallan 55224a041c5bSmacallan if test -n "$addlibs"; then 55234a041c5bSmacallan gentop="$output_objdir/${outputname}x" 55244a041c5bSmacallan generated="$generated $gentop" 55254a041c5bSmacallan 55264a041c5bSmacallan func_extract_archives $gentop $addlibs 55274a041c5bSmacallan oldobjs="$oldobjs $func_extract_archives_result" 55284a041c5bSmacallan fi 55294a041c5bSmacallan 55304a041c5bSmacallan # Do each command in the archive commands. 55314a041c5bSmacallan if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 55324a041c5bSmacallan cmds=$old_archive_from_new_cmds 55334a041c5bSmacallan else 55344a041c5bSmacallan # POSIX demands no paths to be encoded in archives. We have 55354a041c5bSmacallan # to avoid creating archives with duplicate basenames if we 55364a041c5bSmacallan # might have to extract them afterwards, e.g., when creating a 55374a041c5bSmacallan # static archive out of a convenience library, or when linking 55384a041c5bSmacallan # the entirety of a libtool archive into another (currently 55394a041c5bSmacallan # not supported by libtool). 55404a041c5bSmacallan if (for obj in $oldobjs 55414a041c5bSmacallan do 55424a041c5bSmacallan $echo "X$obj" | $Xsed -e 's%^.*/%%' 55434a041c5bSmacallan done | sort | sort -uc >/dev/null 2>&1); then 55444a041c5bSmacallan : 55454a041c5bSmacallan else 55464a041c5bSmacallan $echo "copying selected object files to avoid basename conflicts..." 55474a041c5bSmacallan 55484a041c5bSmacallan if test -z "$gentop"; then 55494a041c5bSmacallan gentop="$output_objdir/${outputname}x" 55504a041c5bSmacallan generated="$generated $gentop" 55514a041c5bSmacallan 55524a041c5bSmacallan $show "${rm}r $gentop" 55534a041c5bSmacallan $run ${rm}r "$gentop" 55544a041c5bSmacallan $show "$mkdir $gentop" 55554a041c5bSmacallan $run $mkdir "$gentop" 55564a041c5bSmacallan exit_status=$? 55574a041c5bSmacallan if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 55584a041c5bSmacallan exit $exit_status 55594a041c5bSmacallan fi 55604a041c5bSmacallan fi 55614a041c5bSmacallan 55624a041c5bSmacallan save_oldobjs=$oldobjs 55634a041c5bSmacallan oldobjs= 55644a041c5bSmacallan counter=1 55654a041c5bSmacallan for obj in $save_oldobjs 55664a041c5bSmacallan do 55674a041c5bSmacallan objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 55684a041c5bSmacallan case " $oldobjs " in 55694a041c5bSmacallan " ") oldobjs=$obj ;; 55704a041c5bSmacallan *[\ /]"$objbase "*) 55714a041c5bSmacallan while :; do 55724a041c5bSmacallan # Make sure we don't pick an alternate name that also 55734a041c5bSmacallan # overlaps. 55744a041c5bSmacallan newobj=lt$counter-$objbase 55754a041c5bSmacallan counter=`expr $counter + 1` 55764a041c5bSmacallan case " $oldobjs " in 55774a041c5bSmacallan *[\ /]"$newobj "*) ;; 55784a041c5bSmacallan *) if test ! -f "$gentop/$newobj"; then break; fi ;; 55794a041c5bSmacallan esac 55804a041c5bSmacallan done 55814a041c5bSmacallan $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 55824a041c5bSmacallan $run ln "$obj" "$gentop/$newobj" || 55834a041c5bSmacallan $run cp "$obj" "$gentop/$newobj" 55844a041c5bSmacallan oldobjs="$oldobjs $gentop/$newobj" 55854a041c5bSmacallan ;; 55864a041c5bSmacallan *) oldobjs="$oldobjs $obj" ;; 55874a041c5bSmacallan esac 55884a041c5bSmacallan done 55894a041c5bSmacallan fi 55904a041c5bSmacallan 55914a041c5bSmacallan eval cmds=\"$old_archive_cmds\" 55924a041c5bSmacallan 55934a041c5bSmacallan if len=`expr "X$cmds" : ".*"` && 55944a041c5bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 55954a041c5bSmacallan cmds=$old_archive_cmds 55964a041c5bSmacallan else 55974a041c5bSmacallan # the command line is too long to link in one step, link in parts 55984a041c5bSmacallan $echo "using piecewise archive linking..." 55994a041c5bSmacallan save_RANLIB=$RANLIB 56004a041c5bSmacallan RANLIB=: 56014a041c5bSmacallan objlist= 56024a041c5bSmacallan concat_cmds= 56034a041c5bSmacallan save_oldobjs=$oldobjs 56044a041c5bSmacallan 56054a041c5bSmacallan # Is there a better way of finding the last object in the list? 56064a041c5bSmacallan for obj in $save_oldobjs 56074a041c5bSmacallan do 56084a041c5bSmacallan last_oldobj=$obj 56094a041c5bSmacallan done 56104a041c5bSmacallan for obj in $save_oldobjs 56114a041c5bSmacallan do 56124a041c5bSmacallan oldobjs="$objlist $obj" 56134a041c5bSmacallan objlist="$objlist $obj" 56144a041c5bSmacallan eval test_cmds=\"$old_archive_cmds\" 56154a041c5bSmacallan if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 56164a041c5bSmacallan test "$len" -le "$max_cmd_len"; then 56174a041c5bSmacallan : 56184a041c5bSmacallan else 56194a041c5bSmacallan # the above command should be used before it gets too long 56204a041c5bSmacallan oldobjs=$objlist 56214a041c5bSmacallan if test "$obj" = "$last_oldobj" ; then 56224a041c5bSmacallan RANLIB=$save_RANLIB 56234a041c5bSmacallan fi 56244a041c5bSmacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 56254a041c5bSmacallan eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 56264a041c5bSmacallan objlist= 56274a041c5bSmacallan fi 56284a041c5bSmacallan done 56294a041c5bSmacallan RANLIB=$save_RANLIB 56304a041c5bSmacallan oldobjs=$objlist 56314a041c5bSmacallan if test "X$oldobjs" = "X" ; then 56324a041c5bSmacallan eval cmds=\"\$concat_cmds\" 56334a041c5bSmacallan else 56344a041c5bSmacallan eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 56354a041c5bSmacallan fi 56364a041c5bSmacallan fi 56374a041c5bSmacallan fi 56384a041c5bSmacallan save_ifs="$IFS"; IFS='~' 56394a041c5bSmacallan for cmd in $cmds; do 56404a041c5bSmacallan eval cmd=\"$cmd\" 56414a041c5bSmacallan IFS="$save_ifs" 56424a041c5bSmacallan $show "$cmd" 56434a041c5bSmacallan $run eval "$cmd" || exit $? 56444a041c5bSmacallan done 56454a041c5bSmacallan IFS="$save_ifs" 56464a041c5bSmacallan done 56474a041c5bSmacallan 56484a041c5bSmacallan if test -n "$generated"; then 56494a041c5bSmacallan $show "${rm}r$generated" 56504a041c5bSmacallan $run ${rm}r$generated 56514a041c5bSmacallan fi 56524a041c5bSmacallan 56534a041c5bSmacallan # Now create the libtool archive. 56544a041c5bSmacallan case $output in 56554a041c5bSmacallan *.la) 56564a041c5bSmacallan old_library= 56574a041c5bSmacallan test "$build_old_libs" = yes && old_library="$libname.$libext" 56584a041c5bSmacallan $show "creating $output" 56594a041c5bSmacallan 56604a041c5bSmacallan # Preserve any variables that may affect compiler behavior 56614a041c5bSmacallan for var in $variables_saved_for_relink; do 56624a041c5bSmacallan if eval test -z \"\${$var+set}\"; then 56634a041c5bSmacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 56644a041c5bSmacallan elif eval var_value=\$$var; test -z "$var_value"; then 56654a041c5bSmacallan relink_command="$var=; export $var; $relink_command" 56664a041c5bSmacallan else 56674a041c5bSmacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 56684a041c5bSmacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 56694a041c5bSmacallan fi 56704a041c5bSmacallan done 56714a041c5bSmacallan # Quote the link command for shipping. 56724a041c5bSmacallan relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 56734a041c5bSmacallan relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 56744a041c5bSmacallan if test "$hardcode_automatic" = yes ; then 56754a041c5bSmacallan relink_command= 56764a041c5bSmacallan fi 56774a041c5bSmacallan 56784a041c5bSmacallan 56794a041c5bSmacallan # Only create the output if not a dry run. 56804a041c5bSmacallan if test -z "$run"; then 56814a041c5bSmacallan for installed in no yes; do 56824a041c5bSmacallan if test "$installed" = yes; then 56834a041c5bSmacallan if test -z "$install_libdir"; then 56844a041c5bSmacallan break 56854a041c5bSmacallan fi 56864a041c5bSmacallan output="$output_objdir/$outputname"i 56874a041c5bSmacallan # Replace all uninstalled libtool libraries with the installed ones 56884a041c5bSmacallan newdependency_libs= 56894a041c5bSmacallan for deplib in $dependency_libs; do 56904a041c5bSmacallan case $deplib in 56914a041c5bSmacallan *.la) 56924a041c5bSmacallan name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 56934a041c5bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 56944a041c5bSmacallan if test -z "$libdir"; then 56954a041c5bSmacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 56964a041c5bSmacallan exit $EXIT_FAILURE 56974a041c5bSmacallan fi 56984a041c5bSmacallan newdependency_libs="$newdependency_libs $libdir/$name" 56994a041c5bSmacallan ;; 57004a041c5bSmacallan *) newdependency_libs="$newdependency_libs $deplib" ;; 57014a041c5bSmacallan esac 57024a041c5bSmacallan done 57034a041c5bSmacallan dependency_libs="$newdependency_libs" 57044a041c5bSmacallan newdlfiles= 57054a041c5bSmacallan for lib in $dlfiles; do 57064a041c5bSmacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57074a041c5bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57084a041c5bSmacallan if test -z "$libdir"; then 57094a041c5bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57104a041c5bSmacallan exit $EXIT_FAILURE 57114a041c5bSmacallan fi 57124a041c5bSmacallan newdlfiles="$newdlfiles $libdir/$name" 57134a041c5bSmacallan done 57144a041c5bSmacallan dlfiles="$newdlfiles" 57154a041c5bSmacallan newdlprefiles= 57164a041c5bSmacallan for lib in $dlprefiles; do 57174a041c5bSmacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57184a041c5bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57194a041c5bSmacallan if test -z "$libdir"; then 57204a041c5bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57214a041c5bSmacallan exit $EXIT_FAILURE 57224a041c5bSmacallan fi 57234a041c5bSmacallan newdlprefiles="$newdlprefiles $libdir/$name" 57244a041c5bSmacallan done 57254a041c5bSmacallan dlprefiles="$newdlprefiles" 57264a041c5bSmacallan else 57274a041c5bSmacallan newdlfiles= 57284a041c5bSmacallan for lib in $dlfiles; do 57294a041c5bSmacallan case $lib in 57304a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57314a041c5bSmacallan *) abs=`pwd`"/$lib" ;; 57324a041c5bSmacallan esac 57334a041c5bSmacallan newdlfiles="$newdlfiles $abs" 57344a041c5bSmacallan done 57354a041c5bSmacallan dlfiles="$newdlfiles" 57364a041c5bSmacallan newdlprefiles= 57374a041c5bSmacallan for lib in $dlprefiles; do 57384a041c5bSmacallan case $lib in 57394a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57404a041c5bSmacallan *) abs=`pwd`"/$lib" ;; 57414a041c5bSmacallan esac 57424a041c5bSmacallan newdlprefiles="$newdlprefiles $abs" 57434a041c5bSmacallan done 57444a041c5bSmacallan dlprefiles="$newdlprefiles" 57454a041c5bSmacallan fi 57464a041c5bSmacallan $rm $output 57474a041c5bSmacallan # place dlname in correct position for cygwin 57484a041c5bSmacallan tdlname=$dlname 57494a041c5bSmacallan case $host,$output,$installed,$module,$dlname in 57504a041c5bSmacallan *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 57514a041c5bSmacallan esac 57524a041c5bSmacallan $echo > $output "\ 57534a041c5bSmacallan# $outputname - a libtool library file 57544a041c5bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 57554a041c5bSmacallan# 57564a041c5bSmacallan# Please DO NOT delete this file! 57574a041c5bSmacallan# It is necessary for linking the library. 57584a041c5bSmacallan 57594a041c5bSmacallan# The name that we can dlopen(3). 57604a041c5bSmacallandlname='$tdlname' 57614a041c5bSmacallan 57624a041c5bSmacallan# Names of this library. 57634a041c5bSmacallanlibrary_names='$library_names' 57644a041c5bSmacallan 57654a041c5bSmacallan# The name of the static archive. 57664a041c5bSmacallanold_library='$old_library' 57674a041c5bSmacallan 57684a041c5bSmacallan# Libraries that this one depends upon. 57694a041c5bSmacallandependency_libs='$dependency_libs' 57704a041c5bSmacallan 57714a041c5bSmacallan# Version information for $libname. 57724a041c5bSmacallancurrent=$current 57734a041c5bSmacallanage=$age 57744a041c5bSmacallanrevision=$revision 57754a041c5bSmacallan 57764a041c5bSmacallan# Is this an already installed library? 57774a041c5bSmacallaninstalled=$installed 57784a041c5bSmacallan 57794a041c5bSmacallan# Should we warn about portability when linking against -modules? 57804a041c5bSmacallanshouldnotlink=$module 57814a041c5bSmacallan 57824a041c5bSmacallan# Files to dlopen/dlpreopen 57834a041c5bSmacallandlopen='$dlfiles' 57844a041c5bSmacallandlpreopen='$dlprefiles' 57854a041c5bSmacallan 57864a041c5bSmacallan# Directory that this library needs to be installed in: 57874a041c5bSmacallanlibdir='$install_libdir'" 57884a041c5bSmacallan if test "$installed" = no && test "$need_relink" = yes; then 57894a041c5bSmacallan $echo >> $output "\ 57904a041c5bSmacallanrelink_command=\"$relink_command\"" 57914a041c5bSmacallan fi 57924a041c5bSmacallan done 57934a041c5bSmacallan fi 57944a041c5bSmacallan 57954a041c5bSmacallan # Do a symbolic link so that the libtool archive can be found in 57964a041c5bSmacallan # LD_LIBRARY_PATH before the program is installed. 57974a041c5bSmacallan $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 57984a041c5bSmacallan $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 57994a041c5bSmacallan ;; 58004a041c5bSmacallan esac 58014a041c5bSmacallan exit $EXIT_SUCCESS 58024a041c5bSmacallan ;; 58034a041c5bSmacallan 58044a041c5bSmacallan # libtool install mode 58054a041c5bSmacallan install) 58064a041c5bSmacallan modename="$modename: install" 58074a041c5bSmacallan 58084a041c5bSmacallan # There may be an optional sh(1) argument at the beginning of 58094a041c5bSmacallan # install_prog (especially on Windows NT). 58104a041c5bSmacallan if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 58114a041c5bSmacallan # Allow the use of GNU shtool's install command. 58124a041c5bSmacallan $echo "X$nonopt" | grep shtool > /dev/null; then 58134a041c5bSmacallan # Aesthetically quote it. 58144a041c5bSmacallan arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 58154a041c5bSmacallan case $arg in 58164a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58174a041c5bSmacallan arg="\"$arg\"" 58184a041c5bSmacallan ;; 58194a041c5bSmacallan esac 58204a041c5bSmacallan install_prog="$arg " 58214a041c5bSmacallan arg="$1" 58224a041c5bSmacallan shift 58234a041c5bSmacallan else 58244a041c5bSmacallan install_prog= 58254a041c5bSmacallan arg=$nonopt 58264a041c5bSmacallan fi 58274a041c5bSmacallan 58284a041c5bSmacallan # The real first argument should be the name of the installation program. 58294a041c5bSmacallan # Aesthetically quote it. 58304a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58314a041c5bSmacallan case $arg in 58324a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58334a041c5bSmacallan arg="\"$arg\"" 58344a041c5bSmacallan ;; 58354a041c5bSmacallan esac 58364a041c5bSmacallan install_prog="$install_prog$arg" 58374a041c5bSmacallan 58384a041c5bSmacallan # We need to accept at least all the BSD install flags. 58394a041c5bSmacallan dest= 58404a041c5bSmacallan files= 58414a041c5bSmacallan opts= 58424a041c5bSmacallan prev= 58434a041c5bSmacallan install_type= 58444a041c5bSmacallan isdir=no 58454a041c5bSmacallan stripme= 58464a041c5bSmacallan for arg 58474a041c5bSmacallan do 58484a041c5bSmacallan if test -n "$dest"; then 58494a041c5bSmacallan files="$files $dest" 58504a041c5bSmacallan dest=$arg 58514a041c5bSmacallan continue 58524a041c5bSmacallan fi 58534a041c5bSmacallan 58544a041c5bSmacallan case $arg in 58554a041c5bSmacallan -d) isdir=yes ;; 58564a041c5bSmacallan -f) 58574a041c5bSmacallan case " $install_prog " in 58584a041c5bSmacallan *[\\\ /]cp\ *) ;; 58594a041c5bSmacallan *) prev=$arg ;; 58604a041c5bSmacallan esac 58614a041c5bSmacallan ;; 58624a041c5bSmacallan -g | -m | -o) prev=$arg ;; 58634a041c5bSmacallan -s) 58644a041c5bSmacallan stripme=" -s" 58654a041c5bSmacallan continue 58664a041c5bSmacallan ;; 58674a041c5bSmacallan -*) 58684a041c5bSmacallan ;; 58694a041c5bSmacallan *) 58704a041c5bSmacallan # If the previous option needed an argument, then skip it. 58714a041c5bSmacallan if test -n "$prev"; then 58724a041c5bSmacallan prev= 58734a041c5bSmacallan else 58744a041c5bSmacallan dest=$arg 58754a041c5bSmacallan continue 58764a041c5bSmacallan fi 58774a041c5bSmacallan ;; 58784a041c5bSmacallan esac 58794a041c5bSmacallan 58804a041c5bSmacallan # Aesthetically quote the argument. 58814a041c5bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58824a041c5bSmacallan case $arg in 58834a041c5bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58844a041c5bSmacallan arg="\"$arg\"" 58854a041c5bSmacallan ;; 58864a041c5bSmacallan esac 58874a041c5bSmacallan install_prog="$install_prog $arg" 58884a041c5bSmacallan done 58894a041c5bSmacallan 58904a041c5bSmacallan if test -z "$install_prog"; then 58914a041c5bSmacallan $echo "$modename: you must specify an install program" 1>&2 58924a041c5bSmacallan $echo "$help" 1>&2 58934a041c5bSmacallan exit $EXIT_FAILURE 58944a041c5bSmacallan fi 58954a041c5bSmacallan 58964a041c5bSmacallan if test -n "$prev"; then 58974a041c5bSmacallan $echo "$modename: the \`$prev' option requires an argument" 1>&2 58984a041c5bSmacallan $echo "$help" 1>&2 58994a041c5bSmacallan exit $EXIT_FAILURE 59004a041c5bSmacallan fi 59014a041c5bSmacallan 59024a041c5bSmacallan if test -z "$files"; then 59034a041c5bSmacallan if test -z "$dest"; then 59044a041c5bSmacallan $echo "$modename: no file or destination specified" 1>&2 59054a041c5bSmacallan else 59064a041c5bSmacallan $echo "$modename: you must specify a destination" 1>&2 59074a041c5bSmacallan fi 59084a041c5bSmacallan $echo "$help" 1>&2 59094a041c5bSmacallan exit $EXIT_FAILURE 59104a041c5bSmacallan fi 59114a041c5bSmacallan 59124a041c5bSmacallan # Strip any trailing slash from the destination. 59134a041c5bSmacallan dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 59144a041c5bSmacallan 59154a041c5bSmacallan # Check to see that the destination is a directory. 59164a041c5bSmacallan test -d "$dest" && isdir=yes 59174a041c5bSmacallan if test "$isdir" = yes; then 59184a041c5bSmacallan destdir="$dest" 59194a041c5bSmacallan destname= 59204a041c5bSmacallan else 59214a041c5bSmacallan destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 59224a041c5bSmacallan test "X$destdir" = "X$dest" && destdir=. 59234a041c5bSmacallan destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 59244a041c5bSmacallan 59254a041c5bSmacallan # Not a directory, so check to see that there is only one file specified. 59264a041c5bSmacallan set dummy $files 59274a041c5bSmacallan if test "$#" -gt 2; then 59284a041c5bSmacallan $echo "$modename: \`$dest' is not a directory" 1>&2 59294a041c5bSmacallan $echo "$help" 1>&2 59304a041c5bSmacallan exit $EXIT_FAILURE 59314a041c5bSmacallan fi 59324a041c5bSmacallan fi 59334a041c5bSmacallan case $destdir in 59344a041c5bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 59354a041c5bSmacallan *) 59364a041c5bSmacallan for file in $files; do 59374a041c5bSmacallan case $file in 59384a041c5bSmacallan *.lo) ;; 59394a041c5bSmacallan *) 59404a041c5bSmacallan $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 59414a041c5bSmacallan $echo "$help" 1>&2 59424a041c5bSmacallan exit $EXIT_FAILURE 59434a041c5bSmacallan ;; 59444a041c5bSmacallan esac 59454a041c5bSmacallan done 59464a041c5bSmacallan ;; 59474a041c5bSmacallan esac 59484a041c5bSmacallan 59494a041c5bSmacallan # This variable tells wrapper scripts just to set variables rather 59504a041c5bSmacallan # than running their programs. 59514a041c5bSmacallan libtool_install_magic="$magic" 59524a041c5bSmacallan 59534a041c5bSmacallan staticlibs= 59544a041c5bSmacallan future_libdirs= 59554a041c5bSmacallan current_libdirs= 59564a041c5bSmacallan for file in $files; do 59574a041c5bSmacallan 59584a041c5bSmacallan # Do each installation. 59594a041c5bSmacallan case $file in 59604a041c5bSmacallan *.$libext) 59614a041c5bSmacallan # Do the static libraries later. 59624a041c5bSmacallan staticlibs="$staticlibs $file" 59634a041c5bSmacallan ;; 59644a041c5bSmacallan 59654a041c5bSmacallan *.la) 59664a041c5bSmacallan # Check to see that this really is a libtool archive. 59674a041c5bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 59684a041c5bSmacallan else 59694a041c5bSmacallan $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 59704a041c5bSmacallan $echo "$help" 1>&2 59714a041c5bSmacallan exit $EXIT_FAILURE 59724a041c5bSmacallan fi 59734a041c5bSmacallan 59744a041c5bSmacallan library_names= 59754a041c5bSmacallan old_library= 59764a041c5bSmacallan relink_command= 59774a041c5bSmacallan # If there is no directory component, then add one. 59784a041c5bSmacallan case $file in 59794a041c5bSmacallan */* | *\\*) . $file ;; 59804a041c5bSmacallan *) . ./$file ;; 59814a041c5bSmacallan esac 59824a041c5bSmacallan 59834a041c5bSmacallan # Add the libdir to current_libdirs if it is the destination. 59844a041c5bSmacallan if test "X$destdir" = "X$libdir"; then 59854a041c5bSmacallan case "$current_libdirs " in 59864a041c5bSmacallan *" $libdir "*) ;; 59874a041c5bSmacallan *) current_libdirs="$current_libdirs $libdir" ;; 59884a041c5bSmacallan esac 59894a041c5bSmacallan else 59904a041c5bSmacallan # Note the libdir as a future libdir. 59914a041c5bSmacallan case "$future_libdirs " in 59924a041c5bSmacallan *" $libdir "*) ;; 59934a041c5bSmacallan *) future_libdirs="$future_libdirs $libdir" ;; 59944a041c5bSmacallan esac 59954a041c5bSmacallan fi 59964a041c5bSmacallan 59974a041c5bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 59984a041c5bSmacallan test "X$dir" = "X$file/" && dir= 59994a041c5bSmacallan dir="$dir$objdir" 60004a041c5bSmacallan 60014a041c5bSmacallan if test -n "$relink_command"; then 60024a041c5bSmacallan # Determine the prefix the user has applied to our future dir. 60034a041c5bSmacallan inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 60044a041c5bSmacallan 60054a041c5bSmacallan # Don't allow the user to place us outside of our expected 60064a041c5bSmacallan # location b/c this prevents finding dependent libraries that 60074a041c5bSmacallan # are installed to the same prefix. 60084a041c5bSmacallan # At present, this check doesn't affect windows .dll's that 60094a041c5bSmacallan # are installed into $libdir/../bin (currently, that works fine) 60104a041c5bSmacallan # but it's something to keep an eye on. 60114a041c5bSmacallan if test "$inst_prefix_dir" = "$destdir"; then 60124a041c5bSmacallan $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 60134a041c5bSmacallan exit $EXIT_FAILURE 60144a041c5bSmacallan fi 60154a041c5bSmacallan 60164a041c5bSmacallan if test -n "$inst_prefix_dir"; then 60174a041c5bSmacallan # Stick the inst_prefix_dir data into the link command. 60184a041c5bSmacallan relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 60194a041c5bSmacallan else 60204a041c5bSmacallan relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 60214a041c5bSmacallan fi 60224a041c5bSmacallan 60234a041c5bSmacallan $echo "$modename: warning: relinking \`$file'" 1>&2 60244a041c5bSmacallan $show "$relink_command" 60254a041c5bSmacallan if $run eval "$relink_command"; then : 60264a041c5bSmacallan else 60274a041c5bSmacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 60284a041c5bSmacallan exit $EXIT_FAILURE 60294a041c5bSmacallan fi 60304a041c5bSmacallan fi 60314a041c5bSmacallan 60324a041c5bSmacallan # See the names of the shared library. 60334a041c5bSmacallan set dummy $library_names 60344a041c5bSmacallan if test -n "$2"; then 60354a041c5bSmacallan realname="$2" 60364a041c5bSmacallan shift 60374a041c5bSmacallan shift 60384a041c5bSmacallan 60394a041c5bSmacallan srcname="$realname" 60404a041c5bSmacallan test -n "$relink_command" && srcname="$realname"T 60414a041c5bSmacallan 60424a041c5bSmacallan # Install the shared library and build the symlinks. 60434a041c5bSmacallan $show "$install_prog $dir/$srcname $destdir/$realname" 60444a041c5bSmacallan $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 60454a041c5bSmacallan if test -n "$stripme" && test -n "$striplib"; then 60464a041c5bSmacallan $show "$striplib $destdir/$realname" 60474a041c5bSmacallan $run eval "$striplib $destdir/$realname" || exit $? 60484a041c5bSmacallan fi 60494a041c5bSmacallan 60504a041c5bSmacallan if test "$#" -gt 0; then 60514a041c5bSmacallan # Delete the old symlinks, and create new ones. 60524a041c5bSmacallan # Try `ln -sf' first, because the `ln' binary might depend on 60534a041c5bSmacallan # the symlink we replace! Solaris /bin/ln does not understand -f, 60544a041c5bSmacallan # so we also need to try rm && ln -s. 60554a041c5bSmacallan for linkname 60564a041c5bSmacallan do 60574a041c5bSmacallan if test "$linkname" != "$realname"; then 60584a041c5bSmacallan $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60594a041c5bSmacallan $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60604a041c5bSmacallan fi 60614a041c5bSmacallan done 60624a041c5bSmacallan fi 60634a041c5bSmacallan 60644a041c5bSmacallan # Do each command in the postinstall commands. 60654a041c5bSmacallan lib="$destdir/$realname" 60664a041c5bSmacallan cmds=$postinstall_cmds 60674a041c5bSmacallan save_ifs="$IFS"; IFS='~' 60684a041c5bSmacallan for cmd in $cmds; do 60694a041c5bSmacallan IFS="$save_ifs" 60704a041c5bSmacallan eval cmd=\"$cmd\" 60714a041c5bSmacallan $show "$cmd" 60724a041c5bSmacallan $run eval "$cmd" || { 60734a041c5bSmacallan lt_exit=$? 60744a041c5bSmacallan 60754a041c5bSmacallan # Restore the uninstalled library and exit 60764a041c5bSmacallan if test "$mode" = relink; then 60774a041c5bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 60784a041c5bSmacallan fi 60794a041c5bSmacallan 60804a041c5bSmacallan exit $lt_exit 60814a041c5bSmacallan } 60824a041c5bSmacallan done 60834a041c5bSmacallan IFS="$save_ifs" 60844a041c5bSmacallan fi 60854a041c5bSmacallan 60864a041c5bSmacallan # Install the pseudo-library for information purposes. 60874a041c5bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60884a041c5bSmacallan instname="$dir/$name"i 60894a041c5bSmacallan $show "$install_prog $instname $destdir/$name" 60904a041c5bSmacallan $run eval "$install_prog $instname $destdir/$name" || exit $? 60914a041c5bSmacallan 60924a041c5bSmacallan # Maybe install the static library, too. 60934a041c5bSmacallan test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 60944a041c5bSmacallan ;; 60954a041c5bSmacallan 60964a041c5bSmacallan *.lo) 60974a041c5bSmacallan # Install (i.e. copy) a libtool object. 60984a041c5bSmacallan 60994a041c5bSmacallan # Figure out destination file name, if it wasn't already specified. 61004a041c5bSmacallan if test -n "$destname"; then 61014a041c5bSmacallan destfile="$destdir/$destname" 61024a041c5bSmacallan else 61034a041c5bSmacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61044a041c5bSmacallan destfile="$destdir/$destfile" 61054a041c5bSmacallan fi 61064a041c5bSmacallan 61074a041c5bSmacallan # Deduce the name of the destination old-style object file. 61084a041c5bSmacallan case $destfile in 61094a041c5bSmacallan *.lo) 61104a041c5bSmacallan staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 61114a041c5bSmacallan ;; 61124a041c5bSmacallan *.$objext) 61134a041c5bSmacallan staticdest="$destfile" 61144a041c5bSmacallan destfile= 61154a041c5bSmacallan ;; 61164a041c5bSmacallan *) 61174a041c5bSmacallan $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 61184a041c5bSmacallan $echo "$help" 1>&2 61194a041c5bSmacallan exit $EXIT_FAILURE 61204a041c5bSmacallan ;; 61214a041c5bSmacallan esac 61224a041c5bSmacallan 61234a041c5bSmacallan # Install the libtool object if requested. 61244a041c5bSmacallan if test -n "$destfile"; then 61254a041c5bSmacallan $show "$install_prog $file $destfile" 61264a041c5bSmacallan $run eval "$install_prog $file $destfile" || exit $? 61274a041c5bSmacallan fi 61284a041c5bSmacallan 61294a041c5bSmacallan # Install the old object if enabled. 61304a041c5bSmacallan if test "$build_old_libs" = yes; then 61314a041c5bSmacallan # Deduce the name of the old-style object file. 61324a041c5bSmacallan staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 61334a041c5bSmacallan 61344a041c5bSmacallan $show "$install_prog $staticobj $staticdest" 61354a041c5bSmacallan $run eval "$install_prog \$staticobj \$staticdest" || exit $? 61364a041c5bSmacallan fi 61374a041c5bSmacallan exit $EXIT_SUCCESS 61384a041c5bSmacallan ;; 61394a041c5bSmacallan 61404a041c5bSmacallan *) 61414a041c5bSmacallan # Figure out destination file name, if it wasn't already specified. 61424a041c5bSmacallan if test -n "$destname"; then 61434a041c5bSmacallan destfile="$destdir/$destname" 61444a041c5bSmacallan else 61454a041c5bSmacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61464a041c5bSmacallan destfile="$destdir/$destfile" 61474a041c5bSmacallan fi 61484a041c5bSmacallan 61494a041c5bSmacallan # If the file is missing, and there is a .exe on the end, strip it 61504a041c5bSmacallan # because it is most likely a libtool script we actually want to 61514a041c5bSmacallan # install 61524a041c5bSmacallan stripped_ext="" 61534a041c5bSmacallan case $file in 61544a041c5bSmacallan *.exe) 61554a041c5bSmacallan if test ! -f "$file"; then 61564a041c5bSmacallan file=`$echo $file|${SED} 's,.exe$,,'` 61574a041c5bSmacallan stripped_ext=".exe" 61584a041c5bSmacallan fi 61594a041c5bSmacallan ;; 61604a041c5bSmacallan esac 61614a041c5bSmacallan 61624a041c5bSmacallan # Do a test to see if this is really a libtool program. 61634a041c5bSmacallan case $host in 61644a041c5bSmacallan *cygwin*|*mingw*) 61654a041c5bSmacallan wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 61664a041c5bSmacallan ;; 61674a041c5bSmacallan *) 61684a041c5bSmacallan wrapper=$file 61694a041c5bSmacallan ;; 61704a041c5bSmacallan esac 61714a041c5bSmacallan if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 61724a041c5bSmacallan notinst_deplibs= 61734a041c5bSmacallan relink_command= 61744a041c5bSmacallan 61754a041c5bSmacallan # Note that it is not necessary on cygwin/mingw to append a dot to 61764a041c5bSmacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 61774a041c5bSmacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 61784a041c5bSmacallan # `FILE.' does not work on cygwin managed mounts. 61794a041c5bSmacallan # 61804a041c5bSmacallan # If there is no directory component, then add one. 61814a041c5bSmacallan case $wrapper in 61824a041c5bSmacallan */* | *\\*) . ${wrapper} ;; 61834a041c5bSmacallan *) . ./${wrapper} ;; 61844a041c5bSmacallan esac 61854a041c5bSmacallan 61864a041c5bSmacallan # Check the variables that should have been set. 61874a041c5bSmacallan if test -z "$notinst_deplibs"; then 61884a041c5bSmacallan $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 61894a041c5bSmacallan exit $EXIT_FAILURE 61904a041c5bSmacallan fi 61914a041c5bSmacallan 61924a041c5bSmacallan finalize=yes 61934a041c5bSmacallan for lib in $notinst_deplibs; do 61944a041c5bSmacallan # Check to see that each library is installed. 61954a041c5bSmacallan libdir= 61964a041c5bSmacallan if test -f "$lib"; then 61974a041c5bSmacallan # If there is no directory component, then add one. 61984a041c5bSmacallan case $lib in 61994a041c5bSmacallan */* | *\\*) . $lib ;; 62004a041c5bSmacallan *) . ./$lib ;; 62014a041c5bSmacallan esac 62024a041c5bSmacallan fi 62034a041c5bSmacallan libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 62044a041c5bSmacallan if test -n "$libdir" && test ! -f "$libfile"; then 62054a041c5bSmacallan $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 62064a041c5bSmacallan finalize=no 62074a041c5bSmacallan fi 62084a041c5bSmacallan done 62094a041c5bSmacallan 62104a041c5bSmacallan relink_command= 62114a041c5bSmacallan # Note that it is not necessary on cygwin/mingw to append a dot to 62124a041c5bSmacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 62134a041c5bSmacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 62144a041c5bSmacallan # `FILE.' does not work on cygwin managed mounts. 62154a041c5bSmacallan # 62164a041c5bSmacallan # If there is no directory component, then add one. 62174a041c5bSmacallan case $wrapper in 62184a041c5bSmacallan */* | *\\*) . ${wrapper} ;; 62194a041c5bSmacallan *) . ./${wrapper} ;; 62204a041c5bSmacallan esac 62214a041c5bSmacallan 62224a041c5bSmacallan outputname= 62234a041c5bSmacallan if test "$fast_install" = no && test -n "$relink_command"; then 62244a041c5bSmacallan if test "$finalize" = yes && test -z "$run"; then 62254a041c5bSmacallan tmpdir=`func_mktempdir` 62264a041c5bSmacallan file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 62274a041c5bSmacallan outputname="$tmpdir/$file" 62284a041c5bSmacallan # Replace the output file specification. 62294a041c5bSmacallan relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 62304a041c5bSmacallan 62314a041c5bSmacallan $show "$relink_command" 62324a041c5bSmacallan if $run eval "$relink_command"; then : 62334a041c5bSmacallan else 62344a041c5bSmacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 62354a041c5bSmacallan ${rm}r "$tmpdir" 62364a041c5bSmacallan continue 62374a041c5bSmacallan fi 62384a041c5bSmacallan file="$outputname" 62394a041c5bSmacallan else 62404a041c5bSmacallan $echo "$modename: warning: cannot relink \`$file'" 1>&2 62414a041c5bSmacallan fi 62424a041c5bSmacallan else 62434a041c5bSmacallan # Install the binary that we compiled earlier. 62444a041c5bSmacallan file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 62454a041c5bSmacallan fi 62464a041c5bSmacallan fi 62474a041c5bSmacallan 62484a041c5bSmacallan # remove .exe since cygwin /usr/bin/install will append another 62494a041c5bSmacallan # one anyway 62504a041c5bSmacallan case $install_prog,$host in 62514a041c5bSmacallan */usr/bin/install*,*cygwin*) 62524a041c5bSmacallan case $file:$destfile in 62534a041c5bSmacallan *.exe:*.exe) 62544a041c5bSmacallan # this is ok 62554a041c5bSmacallan ;; 62564a041c5bSmacallan *.exe:*) 62574a041c5bSmacallan destfile=$destfile.exe 62584a041c5bSmacallan ;; 62594a041c5bSmacallan *:*.exe) 62604a041c5bSmacallan destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 62614a041c5bSmacallan ;; 62624a041c5bSmacallan esac 62634a041c5bSmacallan ;; 62644a041c5bSmacallan esac 62654a041c5bSmacallan $show "$install_prog$stripme $file $destfile" 62664a041c5bSmacallan $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 62674a041c5bSmacallan test -n "$outputname" && ${rm}r "$tmpdir" 62684a041c5bSmacallan ;; 62694a041c5bSmacallan esac 62704a041c5bSmacallan done 62714a041c5bSmacallan 62724a041c5bSmacallan for file in $staticlibs; do 62734a041c5bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 62744a041c5bSmacallan 62754a041c5bSmacallan # Set up the ranlib parameters. 62764a041c5bSmacallan oldlib="$destdir/$name" 62774a041c5bSmacallan 62784a041c5bSmacallan $show "$install_prog $file $oldlib" 62794a041c5bSmacallan $run eval "$install_prog \$file \$oldlib" || exit $? 62804a041c5bSmacallan 62814a041c5bSmacallan if test -n "$stripme" && test -n "$old_striplib"; then 62824a041c5bSmacallan $show "$old_striplib $oldlib" 62834a041c5bSmacallan $run eval "$old_striplib $oldlib" || exit $? 62844a041c5bSmacallan fi 62854a041c5bSmacallan 62864a041c5bSmacallan # Do each command in the postinstall commands. 62874a041c5bSmacallan cmds=$old_postinstall_cmds 62884a041c5bSmacallan save_ifs="$IFS"; IFS='~' 62894a041c5bSmacallan for cmd in $cmds; do 62904a041c5bSmacallan IFS="$save_ifs" 62914a041c5bSmacallan eval cmd=\"$cmd\" 62924a041c5bSmacallan $show "$cmd" 62934a041c5bSmacallan $run eval "$cmd" || exit $? 62944a041c5bSmacallan done 62954a041c5bSmacallan IFS="$save_ifs" 62964a041c5bSmacallan done 62974a041c5bSmacallan 62984a041c5bSmacallan if test -n "$future_libdirs"; then 62994a041c5bSmacallan $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 63004a041c5bSmacallan fi 63014a041c5bSmacallan 63024a041c5bSmacallan if test -n "$current_libdirs"; then 63034a041c5bSmacallan # Maybe just do a dry run. 63044a041c5bSmacallan test -n "$run" && current_libdirs=" -n$current_libdirs" 63054a041c5bSmacallan exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 63064a041c5bSmacallan else 63074a041c5bSmacallan exit $EXIT_SUCCESS 63084a041c5bSmacallan fi 63094a041c5bSmacallan ;; 63104a041c5bSmacallan 63114a041c5bSmacallan # libtool finish mode 63124a041c5bSmacallan finish) 63134a041c5bSmacallan modename="$modename: finish" 63144a041c5bSmacallan libdirs="$nonopt" 63154a041c5bSmacallan admincmds= 63164a041c5bSmacallan 63174a041c5bSmacallan if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 63184a041c5bSmacallan for dir 63194a041c5bSmacallan do 63204a041c5bSmacallan libdirs="$libdirs $dir" 63214a041c5bSmacallan done 63224a041c5bSmacallan 63234a041c5bSmacallan for libdir in $libdirs; do 63244a041c5bSmacallan if test -n "$finish_cmds"; then 63254a041c5bSmacallan # Do each command in the finish commands. 63264a041c5bSmacallan cmds=$finish_cmds 63274a041c5bSmacallan save_ifs="$IFS"; IFS='~' 63284a041c5bSmacallan for cmd in $cmds; do 63294a041c5bSmacallan IFS="$save_ifs" 63304a041c5bSmacallan eval cmd=\"$cmd\" 63314a041c5bSmacallan $show "$cmd" 63324a041c5bSmacallan $run eval "$cmd" || admincmds="$admincmds 63334a041c5bSmacallan $cmd" 63344a041c5bSmacallan done 63354a041c5bSmacallan IFS="$save_ifs" 63364a041c5bSmacallan fi 63374a041c5bSmacallan if test -n "$finish_eval"; then 63384a041c5bSmacallan # Do the single finish_eval. 63394a041c5bSmacallan eval cmds=\"$finish_eval\" 63404a041c5bSmacallan $run eval "$cmds" || admincmds="$admincmds 63414a041c5bSmacallan $cmds" 63424a041c5bSmacallan fi 63434a041c5bSmacallan done 63444a041c5bSmacallan fi 63454a041c5bSmacallan 63464a041c5bSmacallan # Exit here if they wanted silent mode. 63474a041c5bSmacallan test "$show" = : && exit $EXIT_SUCCESS 63484a041c5bSmacallan 63494a041c5bSmacallan $echo "X----------------------------------------------------------------------" | $Xsed 63504a041c5bSmacallan $echo "Libraries have been installed in:" 63514a041c5bSmacallan for libdir in $libdirs; do 63524a041c5bSmacallan $echo " $libdir" 63534a041c5bSmacallan done 63544a041c5bSmacallan $echo 63554a041c5bSmacallan $echo "If you ever happen to want to link against installed libraries" 63564a041c5bSmacallan $echo "in a given directory, LIBDIR, you must either use libtool, and" 63574a041c5bSmacallan $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 63584a041c5bSmacallan $echo "flag during linking and do at least one of the following:" 63594a041c5bSmacallan if test -n "$shlibpath_var"; then 63604a041c5bSmacallan $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 63614a041c5bSmacallan $echo " during execution" 63624a041c5bSmacallan fi 63634a041c5bSmacallan if test -n "$runpath_var"; then 63644a041c5bSmacallan $echo " - add LIBDIR to the \`$runpath_var' environment variable" 63654a041c5bSmacallan $echo " during linking" 63664a041c5bSmacallan fi 63674a041c5bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 63684a041c5bSmacallan libdir=LIBDIR 63694a041c5bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 63704a041c5bSmacallan 63714a041c5bSmacallan $echo " - use the \`$flag' linker flag" 63724a041c5bSmacallan fi 63734a041c5bSmacallan if test -n "$admincmds"; then 63744a041c5bSmacallan $echo " - have your system administrator run these commands:$admincmds" 63754a041c5bSmacallan fi 63764a041c5bSmacallan if test -f /etc/ld.so.conf; then 63774a041c5bSmacallan $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 63784a041c5bSmacallan fi 63794a041c5bSmacallan $echo 63804a041c5bSmacallan $echo "See any operating system documentation about shared libraries for" 63814a041c5bSmacallan $echo "more information, such as the ld(1) and ld.so(8) manual pages." 63824a041c5bSmacallan $echo "X----------------------------------------------------------------------" | $Xsed 63834a041c5bSmacallan exit $EXIT_SUCCESS 63844a041c5bSmacallan ;; 63854a041c5bSmacallan 63864a041c5bSmacallan # libtool execute mode 63874a041c5bSmacallan execute) 63884a041c5bSmacallan modename="$modename: execute" 63894a041c5bSmacallan 63904a041c5bSmacallan # The first argument is the command name. 63914a041c5bSmacallan cmd="$nonopt" 63924a041c5bSmacallan if test -z "$cmd"; then 63934a041c5bSmacallan $echo "$modename: you must specify a COMMAND" 1>&2 63944a041c5bSmacallan $echo "$help" 63954a041c5bSmacallan exit $EXIT_FAILURE 63964a041c5bSmacallan fi 63974a041c5bSmacallan 63984a041c5bSmacallan # Handle -dlopen flags immediately. 63994a041c5bSmacallan for file in $execute_dlfiles; do 64004a041c5bSmacallan if test ! -f "$file"; then 64014a041c5bSmacallan $echo "$modename: \`$file' is not a file" 1>&2 64024a041c5bSmacallan $echo "$help" 1>&2 64034a041c5bSmacallan exit $EXIT_FAILURE 64044a041c5bSmacallan fi 64054a041c5bSmacallan 64064a041c5bSmacallan dir= 64074a041c5bSmacallan case $file in 64084a041c5bSmacallan *.la) 64094a041c5bSmacallan # Check to see that this really is a libtool archive. 64104a041c5bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 64114a041c5bSmacallan else 64124a041c5bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 64134a041c5bSmacallan $echo "$help" 1>&2 64144a041c5bSmacallan exit $EXIT_FAILURE 64154a041c5bSmacallan fi 64164a041c5bSmacallan 64174a041c5bSmacallan # Read the libtool library. 64184a041c5bSmacallan dlname= 64194a041c5bSmacallan library_names= 64204a041c5bSmacallan 64214a041c5bSmacallan # If there is no directory component, then add one. 64224a041c5bSmacallan case $file in 64234a041c5bSmacallan */* | *\\*) . $file ;; 64244a041c5bSmacallan *) . ./$file ;; 64254a041c5bSmacallan esac 64264a041c5bSmacallan 64274a041c5bSmacallan # Skip this library if it cannot be dlopened. 64284a041c5bSmacallan if test -z "$dlname"; then 64294a041c5bSmacallan # Warn if it was a shared library. 64304a041c5bSmacallan test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 64314a041c5bSmacallan continue 64324a041c5bSmacallan fi 64334a041c5bSmacallan 64344a041c5bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64354a041c5bSmacallan test "X$dir" = "X$file" && dir=. 64364a041c5bSmacallan 64374a041c5bSmacallan if test -f "$dir/$objdir/$dlname"; then 64384a041c5bSmacallan dir="$dir/$objdir" 64394a041c5bSmacallan else 64404a041c5bSmacallan if test ! -f "$dir/$dlname"; then 64414a041c5bSmacallan $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 64424a041c5bSmacallan exit $EXIT_FAILURE 64434a041c5bSmacallan fi 64444a041c5bSmacallan fi 64454a041c5bSmacallan ;; 64464a041c5bSmacallan 64474a041c5bSmacallan *.lo) 64484a041c5bSmacallan # Just add the directory containing the .lo file. 64494a041c5bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64504a041c5bSmacallan test "X$dir" = "X$file" && dir=. 64514a041c5bSmacallan ;; 64524a041c5bSmacallan 64534a041c5bSmacallan *) 64544a041c5bSmacallan $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 64554a041c5bSmacallan continue 64564a041c5bSmacallan ;; 64574a041c5bSmacallan esac 64584a041c5bSmacallan 64594a041c5bSmacallan # Get the absolute pathname. 64604a041c5bSmacallan absdir=`cd "$dir" && pwd` 64614a041c5bSmacallan test -n "$absdir" && dir="$absdir" 64624a041c5bSmacallan 64634a041c5bSmacallan # Now add the directory to shlibpath_var. 64644a041c5bSmacallan if eval "test -z \"\$$shlibpath_var\""; then 64654a041c5bSmacallan eval "$shlibpath_var=\"\$dir\"" 64664a041c5bSmacallan else 64674a041c5bSmacallan eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 64684a041c5bSmacallan fi 64694a041c5bSmacallan done 64704a041c5bSmacallan 64714a041c5bSmacallan # This variable tells wrapper scripts just to set shlibpath_var 64724a041c5bSmacallan # rather than running their programs. 64734a041c5bSmacallan libtool_execute_magic="$magic" 64744a041c5bSmacallan 64754a041c5bSmacallan # Check if any of the arguments is a wrapper script. 64764a041c5bSmacallan args= 64774a041c5bSmacallan for file 64784a041c5bSmacallan do 64794a041c5bSmacallan case $file in 64804a041c5bSmacallan -*) ;; 64814a041c5bSmacallan *) 64824a041c5bSmacallan # Do a test to see if this is really a libtool program. 64834a041c5bSmacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 64844a041c5bSmacallan # If there is no directory component, then add one. 64854a041c5bSmacallan case $file in 64864a041c5bSmacallan */* | *\\*) . $file ;; 64874a041c5bSmacallan *) . ./$file ;; 64884a041c5bSmacallan esac 64894a041c5bSmacallan 64904a041c5bSmacallan # Transform arg to wrapped name. 64914a041c5bSmacallan file="$progdir/$program" 64924a041c5bSmacallan fi 64934a041c5bSmacallan ;; 64944a041c5bSmacallan esac 64954a041c5bSmacallan # Quote arguments (to preserve shell metacharacters). 64964a041c5bSmacallan file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 64974a041c5bSmacallan args="$args \"$file\"" 64984a041c5bSmacallan done 64994a041c5bSmacallan 65004a041c5bSmacallan if test -z "$run"; then 65014a041c5bSmacallan if test -n "$shlibpath_var"; then 65024a041c5bSmacallan # Export the shlibpath_var. 65034a041c5bSmacallan eval "export $shlibpath_var" 65044a041c5bSmacallan fi 65054a041c5bSmacallan 65064a041c5bSmacallan # Restore saved environment variables 65074a041c5bSmacallan for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 65084a041c5bSmacallan do 65094a041c5bSmacallan eval "if test \"\${save_$lt_var+set}\" = set; then 65104a041c5bSmacallan $lt_var=\$save_$lt_var; export $lt_var 65114a041c5bSmacallan fi" 65124a041c5bSmacallan done 65134a041c5bSmacallan 65144a041c5bSmacallan # Now prepare to actually exec the command. 65154a041c5bSmacallan exec_cmd="\$cmd$args" 65164a041c5bSmacallan else 65174a041c5bSmacallan # Display what would be done. 65184a041c5bSmacallan if test -n "$shlibpath_var"; then 65194a041c5bSmacallan eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 65204a041c5bSmacallan $echo "export $shlibpath_var" 65214a041c5bSmacallan fi 65224a041c5bSmacallan $echo "$cmd$args" 65234a041c5bSmacallan exit $EXIT_SUCCESS 65244a041c5bSmacallan fi 65254a041c5bSmacallan ;; 65264a041c5bSmacallan 65274a041c5bSmacallan # libtool clean and uninstall mode 65284a041c5bSmacallan clean | uninstall) 65294a041c5bSmacallan modename="$modename: $mode" 65304a041c5bSmacallan rm="$nonopt" 65314a041c5bSmacallan files= 65324a041c5bSmacallan rmforce= 65334a041c5bSmacallan exit_status=0 65344a041c5bSmacallan 65354a041c5bSmacallan # This variable tells wrapper scripts just to set variables rather 65364a041c5bSmacallan # than running their programs. 65374a041c5bSmacallan libtool_install_magic="$magic" 65384a041c5bSmacallan 65394a041c5bSmacallan for arg 65404a041c5bSmacallan do 65414a041c5bSmacallan case $arg in 65424a041c5bSmacallan -f) rm="$rm $arg"; rmforce=yes ;; 65434a041c5bSmacallan -*) rm="$rm $arg" ;; 65444a041c5bSmacallan *) files="$files $arg" ;; 65454a041c5bSmacallan esac 65464a041c5bSmacallan done 65474a041c5bSmacallan 65484a041c5bSmacallan if test -z "$rm"; then 65494a041c5bSmacallan $echo "$modename: you must specify an RM program" 1>&2 65504a041c5bSmacallan $echo "$help" 1>&2 65514a041c5bSmacallan exit $EXIT_FAILURE 65524a041c5bSmacallan fi 65534a041c5bSmacallan 65544a041c5bSmacallan rmdirs= 65554a041c5bSmacallan 65564a041c5bSmacallan origobjdir="$objdir" 65574a041c5bSmacallan for file in $files; do 65584a041c5bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 65594a041c5bSmacallan if test "X$dir" = "X$file"; then 65604a041c5bSmacallan dir=. 65614a041c5bSmacallan objdir="$origobjdir" 65624a041c5bSmacallan else 65634a041c5bSmacallan objdir="$dir/$origobjdir" 65644a041c5bSmacallan fi 65654a041c5bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 65664a041c5bSmacallan test "$mode" = uninstall && objdir="$dir" 65674a041c5bSmacallan 65684a041c5bSmacallan # Remember objdir for removal later, being careful to avoid duplicates 65694a041c5bSmacallan if test "$mode" = clean; then 65704a041c5bSmacallan case " $rmdirs " in 65714a041c5bSmacallan *" $objdir "*) ;; 65724a041c5bSmacallan *) rmdirs="$rmdirs $objdir" ;; 65734a041c5bSmacallan esac 65744a041c5bSmacallan fi 65754a041c5bSmacallan 65764a041c5bSmacallan # Don't error if the file doesn't exist and rm -f was used. 65774a041c5bSmacallan if (test -L "$file") >/dev/null 2>&1 \ 65784a041c5bSmacallan || (test -h "$file") >/dev/null 2>&1 \ 65794a041c5bSmacallan || test -f "$file"; then 65804a041c5bSmacallan : 65814a041c5bSmacallan elif test -d "$file"; then 65824a041c5bSmacallan exit_status=1 65834a041c5bSmacallan continue 65844a041c5bSmacallan elif test "$rmforce" = yes; then 65854a041c5bSmacallan continue 65864a041c5bSmacallan fi 65874a041c5bSmacallan 65884a041c5bSmacallan rmfiles="$file" 65894a041c5bSmacallan 65904a041c5bSmacallan case $name in 65914a041c5bSmacallan *.la) 65924a041c5bSmacallan # Possibly a libtool archive, so verify it. 65934a041c5bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65944a041c5bSmacallan . $dir/$name 65954a041c5bSmacallan 65964a041c5bSmacallan # Delete the libtool libraries and symlinks. 65974a041c5bSmacallan for n in $library_names; do 65984a041c5bSmacallan rmfiles="$rmfiles $objdir/$n" 65994a041c5bSmacallan done 66004a041c5bSmacallan test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 66014a041c5bSmacallan 66024a041c5bSmacallan case "$mode" in 66034a041c5bSmacallan clean) 66044a041c5bSmacallan case " $library_names " in 66054a041c5bSmacallan # " " in the beginning catches empty $dlname 66064a041c5bSmacallan *" $dlname "*) ;; 66074a041c5bSmacallan *) rmfiles="$rmfiles $objdir/$dlname" ;; 66084a041c5bSmacallan esac 66094a041c5bSmacallan test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 66104a041c5bSmacallan ;; 66114a041c5bSmacallan uninstall) 66124a041c5bSmacallan if test -n "$library_names"; then 66134a041c5bSmacallan # Do each command in the postuninstall commands. 66144a041c5bSmacallan cmds=$postuninstall_cmds 66154a041c5bSmacallan save_ifs="$IFS"; IFS='~' 66164a041c5bSmacallan for cmd in $cmds; do 66174a041c5bSmacallan IFS="$save_ifs" 66184a041c5bSmacallan eval cmd=\"$cmd\" 66194a041c5bSmacallan $show "$cmd" 66204a041c5bSmacallan $run eval "$cmd" 66214a041c5bSmacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 66224a041c5bSmacallan exit_status=1 66234a041c5bSmacallan fi 66244a041c5bSmacallan done 66254a041c5bSmacallan IFS="$save_ifs" 66264a041c5bSmacallan fi 66274a041c5bSmacallan 66284a041c5bSmacallan if test -n "$old_library"; then 66294a041c5bSmacallan # Do each command in the old_postuninstall commands. 66304a041c5bSmacallan cmds=$old_postuninstall_cmds 66314a041c5bSmacallan save_ifs="$IFS"; IFS='~' 66324a041c5bSmacallan for cmd in $cmds; do 66334a041c5bSmacallan IFS="$save_ifs" 66344a041c5bSmacallan eval cmd=\"$cmd\" 66354a041c5bSmacallan $show "$cmd" 66364a041c5bSmacallan $run eval "$cmd" 66374a041c5bSmacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 66384a041c5bSmacallan exit_status=1 66394a041c5bSmacallan fi 66404a041c5bSmacallan done 66414a041c5bSmacallan IFS="$save_ifs" 66424a041c5bSmacallan fi 66434a041c5bSmacallan # FIXME: should reinstall the best remaining shared library. 66444a041c5bSmacallan ;; 66454a041c5bSmacallan esac 66464a041c5bSmacallan fi 66474a041c5bSmacallan ;; 66484a041c5bSmacallan 66494a041c5bSmacallan *.lo) 66504a041c5bSmacallan # Possibly a libtool object, so verify it. 66514a041c5bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66524a041c5bSmacallan 66534a041c5bSmacallan # Read the .lo file 66544a041c5bSmacallan . $dir/$name 66554a041c5bSmacallan 66564a041c5bSmacallan # Add PIC object to the list of files to remove. 66574a041c5bSmacallan if test -n "$pic_object" \ 66584a041c5bSmacallan && test "$pic_object" != none; then 66594a041c5bSmacallan rmfiles="$rmfiles $dir/$pic_object" 66604a041c5bSmacallan fi 66614a041c5bSmacallan 66624a041c5bSmacallan # Add non-PIC object to the list of files to remove. 66634a041c5bSmacallan if test -n "$non_pic_object" \ 66644a041c5bSmacallan && test "$non_pic_object" != none; then 66654a041c5bSmacallan rmfiles="$rmfiles $dir/$non_pic_object" 66664a041c5bSmacallan fi 66674a041c5bSmacallan fi 66684a041c5bSmacallan ;; 66694a041c5bSmacallan 66704a041c5bSmacallan *) 66714a041c5bSmacallan if test "$mode" = clean ; then 66724a041c5bSmacallan noexename=$name 66734a041c5bSmacallan case $file in 66744a041c5bSmacallan *.exe) 66754a041c5bSmacallan file=`$echo $file|${SED} 's,.exe$,,'` 66764a041c5bSmacallan noexename=`$echo $name|${SED} 's,.exe$,,'` 66774a041c5bSmacallan # $file with .exe has already been added to rmfiles, 66784a041c5bSmacallan # add $file without .exe 66794a041c5bSmacallan rmfiles="$rmfiles $file" 66804a041c5bSmacallan ;; 66814a041c5bSmacallan esac 66824a041c5bSmacallan # Do a test to see if this is a libtool program. 66834a041c5bSmacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66844a041c5bSmacallan relink_command= 66854a041c5bSmacallan . $dir/$noexename 66864a041c5bSmacallan 66874a041c5bSmacallan # note $name still contains .exe if it was in $file originally 66884a041c5bSmacallan # as does the version of $file that was added into $rmfiles 66894a041c5bSmacallan rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 66904a041c5bSmacallan if test "$fast_install" = yes && test -n "$relink_command"; then 66914a041c5bSmacallan rmfiles="$rmfiles $objdir/lt-$name" 66924a041c5bSmacallan fi 66934a041c5bSmacallan if test "X$noexename" != "X$name" ; then 66944a041c5bSmacallan rmfiles="$rmfiles $objdir/lt-${noexename}.c" 66954a041c5bSmacallan fi 66964a041c5bSmacallan fi 66974a041c5bSmacallan fi 66984a041c5bSmacallan ;; 66994a041c5bSmacallan esac 67004a041c5bSmacallan $show "$rm $rmfiles" 67014a041c5bSmacallan $run $rm $rmfiles || exit_status=1 67024a041c5bSmacallan done 67034a041c5bSmacallan objdir="$origobjdir" 67044a041c5bSmacallan 67054a041c5bSmacallan # Try to remove the ${objdir}s in the directories where we deleted files 67064a041c5bSmacallan for dir in $rmdirs; do 67074a041c5bSmacallan if test -d "$dir"; then 67084a041c5bSmacallan $show "rmdir $dir" 67094a041c5bSmacallan $run rmdir $dir >/dev/null 2>&1 67104a041c5bSmacallan fi 67114a041c5bSmacallan done 67124a041c5bSmacallan 67134a041c5bSmacallan exit $exit_status 67144a041c5bSmacallan ;; 67154a041c5bSmacallan 67164a041c5bSmacallan "") 67174a041c5bSmacallan $echo "$modename: you must specify a MODE" 1>&2 67184a041c5bSmacallan $echo "$generic_help" 1>&2 67194a041c5bSmacallan exit $EXIT_FAILURE 67204a041c5bSmacallan ;; 67214a041c5bSmacallan esac 67224a041c5bSmacallan 67234a041c5bSmacallan if test -z "$exec_cmd"; then 67244a041c5bSmacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 67254a041c5bSmacallan $echo "$generic_help" 1>&2 67264a041c5bSmacallan exit $EXIT_FAILURE 67274a041c5bSmacallan fi 67284a041c5bSmacallanfi # test -z "$show_help" 67294a041c5bSmacallan 67304a041c5bSmacallanif test -n "$exec_cmd"; then 67314a041c5bSmacallan eval exec $exec_cmd 67324a041c5bSmacallan exit $EXIT_FAILURE 67334a041c5bSmacallanfi 67344a041c5bSmacallan 67354a041c5bSmacallan# We need to display help for each of the modes. 67364a041c5bSmacallancase $mode in 67374a041c5bSmacallan"") $echo \ 67384a041c5bSmacallan"Usage: $modename [OPTION]... [MODE-ARG]... 67394a041c5bSmacallan 67404a041c5bSmacallanProvide generalized library-building support services. 67414a041c5bSmacallan 67424a041c5bSmacallan --config show all configuration variables 67434a041c5bSmacallan --debug enable verbose shell tracing 67444a041c5bSmacallan-n, --dry-run display commands without modifying any files 67454a041c5bSmacallan --features display basic configuration information and exit 67464a041c5bSmacallan --finish same as \`--mode=finish' 67474a041c5bSmacallan --help display this help message and exit 67484a041c5bSmacallan --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 67494a041c5bSmacallan --quiet same as \`--silent' 67504a041c5bSmacallan --silent don't print informational messages 67514a041c5bSmacallan --tag=TAG use configuration variables from tag TAG 67524a041c5bSmacallan --version print version information 67534a041c5bSmacallan 67544a041c5bSmacallanMODE must be one of the following: 67554a041c5bSmacallan 67564a041c5bSmacallan clean remove files from the build directory 67574a041c5bSmacallan compile compile a source file into a libtool object 67584a041c5bSmacallan execute automatically set library path, then run a program 67594a041c5bSmacallan finish complete the installation of libtool libraries 67604a041c5bSmacallan install install libraries or executables 67614a041c5bSmacallan link create a library or an executable 67624a041c5bSmacallan uninstall remove libraries from an installed directory 67634a041c5bSmacallan 67644a041c5bSmacallanMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 67654a041c5bSmacallana more detailed description of MODE. 67664a041c5bSmacallan 67674a041c5bSmacallanReport bugs to <bug-libtool@gnu.org>." 67684a041c5bSmacallan exit $EXIT_SUCCESS 67694a041c5bSmacallan ;; 67704a041c5bSmacallan 67714a041c5bSmacallanclean) 67724a041c5bSmacallan $echo \ 67734a041c5bSmacallan"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 67744a041c5bSmacallan 67754a041c5bSmacallanRemove files from the build directory. 67764a041c5bSmacallan 67774a041c5bSmacallanRM is the name of the program to use to delete files associated with each FILE 67784a041c5bSmacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 67794a041c5bSmacallanto RM. 67804a041c5bSmacallan 67814a041c5bSmacallanIf FILE is a libtool library, object or program, all the files associated 67824a041c5bSmacallanwith it are deleted. Otherwise, only FILE itself is deleted using RM." 67834a041c5bSmacallan ;; 67844a041c5bSmacallan 67854a041c5bSmacallancompile) 67864a041c5bSmacallan $echo \ 67874a041c5bSmacallan"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 67884a041c5bSmacallan 67894a041c5bSmacallanCompile a source file into a libtool library object. 67904a041c5bSmacallan 67914a041c5bSmacallanThis mode accepts the following additional options: 67924a041c5bSmacallan 67934a041c5bSmacallan -o OUTPUT-FILE set the output file name to OUTPUT-FILE 67944a041c5bSmacallan -prefer-pic try to building PIC objects only 67954a041c5bSmacallan -prefer-non-pic try to building non-PIC objects only 67964a041c5bSmacallan -static always build a \`.o' file suitable for static linking 67974a041c5bSmacallan 67984a041c5bSmacallanCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 67994a041c5bSmacallanfrom the given SOURCEFILE. 68004a041c5bSmacallan 68014a041c5bSmacallanThe output file name is determined by removing the directory component from 68024a041c5bSmacallanSOURCEFILE, then substituting the C source code suffix \`.c' with the 68034a041c5bSmacallanlibrary object suffix, \`.lo'." 68044a041c5bSmacallan ;; 68054a041c5bSmacallan 68064a041c5bSmacallanexecute) 68074a041c5bSmacallan $echo \ 68084a041c5bSmacallan"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 68094a041c5bSmacallan 68104a041c5bSmacallanAutomatically set library path, then run a program. 68114a041c5bSmacallan 68124a041c5bSmacallanThis mode accepts the following additional options: 68134a041c5bSmacallan 68144a041c5bSmacallan -dlopen FILE add the directory containing FILE to the library path 68154a041c5bSmacallan 68164a041c5bSmacallanThis mode sets the library path environment variable according to \`-dlopen' 68174a041c5bSmacallanflags. 68184a041c5bSmacallan 68194a041c5bSmacallanIf any of the ARGS are libtool executable wrappers, then they are translated 68204a041c5bSmacallaninto their corresponding uninstalled binary, and any of their required library 68214a041c5bSmacallandirectories are added to the library path. 68224a041c5bSmacallan 68234a041c5bSmacallanThen, COMMAND is executed, with ARGS as arguments." 68244a041c5bSmacallan ;; 68254a041c5bSmacallan 68264a041c5bSmacallanfinish) 68274a041c5bSmacallan $echo \ 68284a041c5bSmacallan"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 68294a041c5bSmacallan 68304a041c5bSmacallanComplete the installation of libtool libraries. 68314a041c5bSmacallan 68324a041c5bSmacallanEach LIBDIR is a directory that contains libtool libraries. 68334a041c5bSmacallan 68344a041c5bSmacallanThe commands that this mode executes may require superuser privileges. Use 68354a041c5bSmacallanthe \`--dry-run' option if you just want to see what would be executed." 68364a041c5bSmacallan ;; 68374a041c5bSmacallan 68384a041c5bSmacallaninstall) 68394a041c5bSmacallan $echo \ 68404a041c5bSmacallan"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 68414a041c5bSmacallan 68424a041c5bSmacallanInstall executables or libraries. 68434a041c5bSmacallan 68444a041c5bSmacallanINSTALL-COMMAND is the installation command. The first component should be 68454a041c5bSmacallaneither the \`install' or \`cp' program. 68464a041c5bSmacallan 68474a041c5bSmacallanThe rest of the components are interpreted as arguments to that command (only 68484a041c5bSmacallanBSD-compatible install options are recognized)." 68494a041c5bSmacallan ;; 68504a041c5bSmacallan 68514a041c5bSmacallanlink) 68524a041c5bSmacallan $echo \ 68534a041c5bSmacallan"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 68544a041c5bSmacallan 68554a041c5bSmacallanLink object files or libraries together to form another library, or to 68564a041c5bSmacallancreate an executable program. 68574a041c5bSmacallan 68584a041c5bSmacallanLINK-COMMAND is a command using the C compiler that you would use to create 68594a041c5bSmacallana program from several object files. 68604a041c5bSmacallan 68614a041c5bSmacallanThe following components of LINK-COMMAND are treated specially: 68624a041c5bSmacallan 68634a041c5bSmacallan -all-static do not do any dynamic linking at all 68644a041c5bSmacallan -avoid-version do not add a version suffix if possible 68654a041c5bSmacallan -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 68664a041c5bSmacallan -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 68674a041c5bSmacallan -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 68684a041c5bSmacallan -export-symbols SYMFILE 68694a041c5bSmacallan try to export only the symbols listed in SYMFILE 68704a041c5bSmacallan -export-symbols-regex REGEX 68714a041c5bSmacallan try to export only the symbols matching REGEX 68724a041c5bSmacallan -LLIBDIR search LIBDIR for required installed libraries 68734a041c5bSmacallan -lNAME OUTPUT-FILE requires the installed library libNAME 68744a041c5bSmacallan -module build a library that can dlopened 68754a041c5bSmacallan -no-fast-install disable the fast-install mode 68764a041c5bSmacallan -no-install link a not-installable executable 68774a041c5bSmacallan -no-undefined declare that a library does not refer to external symbols 68784a041c5bSmacallan -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 68794a041c5bSmacallan -objectlist FILE Use a list of object files found in FILE to specify objects 68804a041c5bSmacallan -precious-files-regex REGEX 68814a041c5bSmacallan don't remove output files matching REGEX 68824a041c5bSmacallan -release RELEASE specify package release information 68834a041c5bSmacallan -rpath LIBDIR the created library will eventually be installed in LIBDIR 68844a041c5bSmacallan -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 68854a041c5bSmacallan -static do not do any dynamic linking of uninstalled libtool libraries 68864a041c5bSmacallan -static-libtool-libs 68874a041c5bSmacallan do not do any dynamic linking of libtool libraries 68884a041c5bSmacallan -version-info CURRENT[:REVISION[:AGE]] 68894a041c5bSmacallan specify library version info [each variable defaults to 0] 68904a041c5bSmacallan 68914a041c5bSmacallanAll other options (arguments beginning with \`-') are ignored. 68924a041c5bSmacallan 68934a041c5bSmacallanEvery other argument is treated as a filename. Files ending in \`.la' are 68944a041c5bSmacallantreated as uninstalled libtool libraries, other files are standard or library 68954a041c5bSmacallanobject files. 68964a041c5bSmacallan 68974a041c5bSmacallanIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 68984a041c5bSmacallanonly library objects (\`.lo' files) may be specified, and \`-rpath' is 68994a041c5bSmacallanrequired, except when creating a convenience library. 69004a041c5bSmacallan 69014a041c5bSmacallanIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 69024a041c5bSmacallanusing \`ar' and \`ranlib', or on Windows using \`lib'. 69034a041c5bSmacallan 69044a041c5bSmacallanIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 69054a041c5bSmacallanis created, otherwise an executable program is created." 69064a041c5bSmacallan ;; 69074a041c5bSmacallan 69084a041c5bSmacallanuninstall) 69094a041c5bSmacallan $echo \ 69104a041c5bSmacallan"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 69114a041c5bSmacallan 69124a041c5bSmacallanRemove libraries from an installation directory. 69134a041c5bSmacallan 69144a041c5bSmacallanRM is the name of the program to use to delete files associated with each FILE 69154a041c5bSmacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 69164a041c5bSmacallanto RM. 69174a041c5bSmacallan 69184a041c5bSmacallanIf FILE is a libtool library, all the files associated with it are deleted. 69194a041c5bSmacallanOtherwise, only FILE itself is deleted using RM." 69204a041c5bSmacallan ;; 69214a041c5bSmacallan 69224a041c5bSmacallan*) 69234a041c5bSmacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 69244a041c5bSmacallan $echo "$help" 1>&2 69254a041c5bSmacallan exit $EXIT_FAILURE 69264a041c5bSmacallan ;; 69274a041c5bSmacallanesac 69284a041c5bSmacallan 69294a041c5bSmacallan$echo 69304a041c5bSmacallan$echo "Try \`$modename --help' for more information about other modes." 69314a041c5bSmacallan 69324a041c5bSmacallanexit $? 69334a041c5bSmacallan 69344a041c5bSmacallan# The TAGs below are defined such that we never get into a situation 69354a041c5bSmacallan# in which we disable both kinds of libraries. Given conflicting 69364a041c5bSmacallan# choices, we go for a static library, that is the most portable, 69374a041c5bSmacallan# since we can't tell whether shared libraries were disabled because 69384a041c5bSmacallan# the user asked for that or because the platform doesn't support 69394a041c5bSmacallan# them. This is particularly important on AIX, because we don't 69404a041c5bSmacallan# support having both static and shared libraries enabled at the same 69414a041c5bSmacallan# time on that platform, so we default to a shared-only configuration. 69424a041c5bSmacallan# If a disable-shared tag is given, we'll fallback to a static-only 69434a041c5bSmacallan# configuration. But we'll never go from static-only to shared-only. 69444a041c5bSmacallan 69454a041c5bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 69464a041c5bSmacallandisable_libs=shared 69474a041c5bSmacallan# ### END LIBTOOL TAG CONFIG: disable-shared 69484a041c5bSmacallan 69494a041c5bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-static 69504a041c5bSmacallandisable_libs=static 69514a041c5bSmacallan# ### END LIBTOOL TAG CONFIG: disable-static 69524a041c5bSmacallan 69534a041c5bSmacallan# Local Variables: 69544a041c5bSmacallan# mode:shell-script 69554a041c5bSmacallan# sh-indentation:2 69564a041c5bSmacallan# End: 6957