ltmain.sh revision 8c9fbc29
18c9fbc29Smrg# ltmain.sh - Provide generalized library-building support services. 28c9fbc29Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 38c9fbc29Smrg# 48c9fbc29Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 58c9fbc29Smrg# Free Software Foundation, Inc. 68c9fbc29Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 78c9fbc29Smrg# 88c9fbc29Smrg# This program is free software; you can redistribute it and/or modify 98c9fbc29Smrg# it under the terms of the GNU General Public License as published by 108c9fbc29Smrg# the Free Software Foundation; either version 2 of the License, or 118c9fbc29Smrg# (at your option) any later version. 128c9fbc29Smrg# 138c9fbc29Smrg# This program is distributed in the hope that it will be useful, but 148c9fbc29Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 158c9fbc29Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168c9fbc29Smrg# General Public License for more details. 178c9fbc29Smrg# 188c9fbc29Smrg# You should have received a copy of the GNU General Public License 198c9fbc29Smrg# along with this program; if not, write to the Free Software 208c9fbc29Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 218c9fbc29Smrg# 228c9fbc29Smrg# As a special exception to the GNU General Public License, if you 238c9fbc29Smrg# distribute this file as part of a program that contains a 248c9fbc29Smrg# configuration script generated by Autoconf, you may include it under 258c9fbc29Smrg# the same distribution terms that you use for the rest of that program. 268c9fbc29Smrg 278c9fbc29Smrgbasename="s,^.*/,,g" 288c9fbc29Smrg 298c9fbc29Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 308c9fbc29Smrg# is ksh but when the shell is invoked as "sh" and the current value of 318c9fbc29Smrg# the _XPG environment variable is not equal to 1 (one), the special 328c9fbc29Smrg# positional parameter $0, within a function call, is the name of the 338c9fbc29Smrg# function. 348c9fbc29Smrgprogpath="$0" 358c9fbc29Smrg 368c9fbc29Smrg# The name of this program: 378c9fbc29Smrgprogname=`echo "$progpath" | $SED $basename` 388c9fbc29Smrgmodename="$progname" 398c9fbc29Smrg 408c9fbc29Smrg# Global variables: 418c9fbc29SmrgEXIT_SUCCESS=0 428c9fbc29SmrgEXIT_FAILURE=1 438c9fbc29Smrg 448c9fbc29SmrgPROGRAM=ltmain.sh 458c9fbc29SmrgPACKAGE=libtool 468c9fbc29SmrgVERSION=1.5.22 478c9fbc29SmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 488c9fbc29Smrg 498c9fbc29Smrg# See if we are running on zsh, and set the options which allow our 508c9fbc29Smrg# commands through without removal of \ escapes. 518c9fbc29Smrgif test -n "${ZSH_VERSION+set}" ; then 528c9fbc29Smrg setopt NO_GLOB_SUBST 538c9fbc29Smrgfi 548c9fbc29Smrg 558c9fbc29Smrg# Check that we have a working $echo. 568c9fbc29Smrgif test "X$1" = X--no-reexec; then 578c9fbc29Smrg # Discard the --no-reexec flag, and continue. 588c9fbc29Smrg shift 598c9fbc29Smrgelif test "X$1" = X--fallback-echo; then 608c9fbc29Smrg # Avoid inline document here, it may be left over 618c9fbc29Smrg : 628c9fbc29Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 638c9fbc29Smrg # Yippee, $echo works! 648c9fbc29Smrg : 658c9fbc29Smrgelse 668c9fbc29Smrg # Restart under the correct shell, and then maybe $echo will work. 678c9fbc29Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 688c9fbc29Smrgfi 698c9fbc29Smrg 708c9fbc29Smrgif test "X$1" = X--fallback-echo; then 718c9fbc29Smrg # used as fallback echo 728c9fbc29Smrg shift 738c9fbc29Smrg cat <<EOF 748c9fbc29Smrg$* 758c9fbc29SmrgEOF 768c9fbc29Smrg exit $EXIT_SUCCESS 778c9fbc29Smrgfi 788c9fbc29Smrg 798c9fbc29Smrgdefault_mode= 808c9fbc29Smrghelp="Try \`$progname --help' for more information." 818c9fbc29Smrgmagic="%%%MAGIC variable%%%" 828c9fbc29Smrgmkdir="mkdir" 838c9fbc29Smrgmv="mv -f" 848c9fbc29Smrgrm="rm -f" 858c9fbc29Smrg 868c9fbc29Smrg# Sed substitution that helps us do robust quoting. It backslashifies 878c9fbc29Smrg# metacharacters that are still active within double-quoted strings. 888c9fbc29SmrgXsed="${SED}"' -e 1s/^X//' 898c9fbc29Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 908c9fbc29Smrg# test EBCDIC or ASCII 918c9fbc29Smrgcase `echo X|tr X '\101'` in 928c9fbc29Smrg A) # ASCII based system 938c9fbc29Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 948c9fbc29Smrg SP2NL='tr \040 \012' 958c9fbc29Smrg NL2SP='tr \015\012 \040\040' 968c9fbc29Smrg ;; 978c9fbc29Smrg *) # EBCDIC based system 988c9fbc29Smrg SP2NL='tr \100 \n' 998c9fbc29Smrg NL2SP='tr \r\n \100\100' 1008c9fbc29Smrg ;; 1018c9fbc29Smrgesac 1028c9fbc29Smrg 1038c9fbc29Smrg# NLS nuisances. 1048c9fbc29Smrg# Only set LANG and LC_ALL to C if already set. 1058c9fbc29Smrg# These must not be set unconditionally because not all systems understand 1068c9fbc29Smrg# e.g. LANG=C (notably SCO). 1078c9fbc29Smrg# We save the old values to restore during execute mode. 1088c9fbc29Smrgif test "${LC_ALL+set}" = set; then 1098c9fbc29Smrg save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 1108c9fbc29Smrgfi 1118c9fbc29Smrgif test "${LANG+set}" = set; then 1128c9fbc29Smrg save_LANG="$LANG"; LANG=C; export LANG 1138c9fbc29Smrgfi 1148c9fbc29Smrg 1158c9fbc29Smrg# Make sure IFS has a sensible default 1168c9fbc29Smrglt_nl=' 1178c9fbc29Smrg' 1188c9fbc29SmrgIFS=" $lt_nl" 1198c9fbc29Smrg 1208c9fbc29Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1218c9fbc29Smrg $echo "$modename: not configured to build any kind of library" 1>&2 1228c9fbc29Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1238c9fbc29Smrg exit $EXIT_FAILURE 1248c9fbc29Smrgfi 1258c9fbc29Smrg 1268c9fbc29Smrg# Global variables. 1278c9fbc29Smrgmode=$default_mode 1288c9fbc29Smrgnonopt= 1298c9fbc29Smrgprev= 1308c9fbc29Smrgprevopt= 1318c9fbc29Smrgrun= 1328c9fbc29Smrgshow="$echo" 1338c9fbc29Smrgshow_help= 1348c9fbc29Smrgexecute_dlfiles= 1358c9fbc29Smrgduplicate_deps=no 1368c9fbc29Smrgpreserve_args= 1378c9fbc29Smrglo2o="s/\\.lo\$/.${objext}/" 1388c9fbc29Smrgo2lo="s/\\.${objext}\$/.lo/" 1398c9fbc29Smrg 1408c9fbc29Smrg##################################### 1418c9fbc29Smrg# Shell function definitions: 1428c9fbc29Smrg# This seems to be the best place for them 1438c9fbc29Smrg 1448c9fbc29Smrg# func_mktempdir [string] 1458c9fbc29Smrg# Make a temporary directory that won't clash with other running 1468c9fbc29Smrg# libtool processes, and avoids race conditions if possible. If 1478c9fbc29Smrg# given, STRING is the basename for that directory. 1488c9fbc29Smrgfunc_mktempdir () 1498c9fbc29Smrg{ 1508c9fbc29Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 1518c9fbc29Smrg 1528c9fbc29Smrg if test "$run" = ":"; then 1538c9fbc29Smrg # Return a directory name, but don't create it in dry-run mode 1548c9fbc29Smrg my_tmpdir="${my_template}-$$" 1558c9fbc29Smrg else 1568c9fbc29Smrg 1578c9fbc29Smrg # If mktemp works, use that first and foremost 1588c9fbc29Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1598c9fbc29Smrg 1608c9fbc29Smrg if test ! -d "$my_tmpdir"; then 1618c9fbc29Smrg # Failing that, at least try and use $RANDOM to avoid a race 1628c9fbc29Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 1638c9fbc29Smrg 1648c9fbc29Smrg save_mktempdir_umask=`umask` 1658c9fbc29Smrg umask 0077 1668c9fbc29Smrg $mkdir "$my_tmpdir" 1678c9fbc29Smrg umask $save_mktempdir_umask 1688c9fbc29Smrg fi 1698c9fbc29Smrg 1708c9fbc29Smrg # If we're not in dry-run mode, bomb out on failure 1718c9fbc29Smrg test -d "$my_tmpdir" || { 1728c9fbc29Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 1738c9fbc29Smrg exit $EXIT_FAILURE 1748c9fbc29Smrg } 1758c9fbc29Smrg fi 1768c9fbc29Smrg 1778c9fbc29Smrg $echo "X$my_tmpdir" | $Xsed 1788c9fbc29Smrg} 1798c9fbc29Smrg 1808c9fbc29Smrg 1818c9fbc29Smrg# func_win32_libid arg 1828c9fbc29Smrg# return the library type of file 'arg' 1838c9fbc29Smrg# 1848c9fbc29Smrg# Need a lot of goo to handle *both* DLLs and import libs 1858c9fbc29Smrg# Has to be a shell function in order to 'eat' the argument 1868c9fbc29Smrg# that is supplied when $file_magic_command is called. 1878c9fbc29Smrgfunc_win32_libid () 1888c9fbc29Smrg{ 1898c9fbc29Smrg win32_libid_type="unknown" 1908c9fbc29Smrg win32_fileres=`file -L $1 2>/dev/null` 1918c9fbc29Smrg case $win32_fileres in 1928c9fbc29Smrg *ar\ archive\ import\ library*) # definitely import 1938c9fbc29Smrg win32_libid_type="x86 archive import" 1948c9fbc29Smrg ;; 1958c9fbc29Smrg *ar\ archive*) # could be an import, or static 1968c9fbc29Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 1978c9fbc29Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 1988c9fbc29Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 1998c9fbc29Smrg $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 2008c9fbc29Smrg case $win32_nmres in 2018c9fbc29Smrg import*) win32_libid_type="x86 archive import";; 2028c9fbc29Smrg *) win32_libid_type="x86 archive static";; 2038c9fbc29Smrg esac 2048c9fbc29Smrg fi 2058c9fbc29Smrg ;; 2068c9fbc29Smrg *DLL*) 2078c9fbc29Smrg win32_libid_type="x86 DLL" 2088c9fbc29Smrg ;; 2098c9fbc29Smrg *executable*) # but shell scripts are "executable" too... 2108c9fbc29Smrg case $win32_fileres in 2118c9fbc29Smrg *MS\ Windows\ PE\ Intel*) 2128c9fbc29Smrg win32_libid_type="x86 DLL" 2138c9fbc29Smrg ;; 2148c9fbc29Smrg esac 2158c9fbc29Smrg ;; 2168c9fbc29Smrg esac 2178c9fbc29Smrg $echo $win32_libid_type 2188c9fbc29Smrg} 2198c9fbc29Smrg 2208c9fbc29Smrg 2218c9fbc29Smrg# func_infer_tag arg 2228c9fbc29Smrg# Infer tagged configuration to use if any are available and 2238c9fbc29Smrg# if one wasn't chosen via the "--tag" command line option. 2248c9fbc29Smrg# Only attempt this if the compiler in the base compile 2258c9fbc29Smrg# command doesn't match the default compiler. 2268c9fbc29Smrg# arg is usually of the form 'gcc ...' 2278c9fbc29Smrgfunc_infer_tag () 2288c9fbc29Smrg{ 2298c9fbc29Smrg if test -n "$available_tags" && test -z "$tagname"; then 2308c9fbc29Smrg CC_quoted= 2318c9fbc29Smrg for arg in $CC; do 2328c9fbc29Smrg case $arg in 2338c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2348c9fbc29Smrg arg="\"$arg\"" 2358c9fbc29Smrg ;; 2368c9fbc29Smrg esac 2378c9fbc29Smrg CC_quoted="$CC_quoted $arg" 2388c9fbc29Smrg done 2398c9fbc29Smrg case $@ in 2408c9fbc29Smrg # Blanks in the command may have been stripped by the calling shell, 2418c9fbc29Smrg # but not from the CC environment variable when configure was run. 2428c9fbc29Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 2438c9fbc29Smrg # Blanks at the start of $base_compile will cause this to fail 2448c9fbc29Smrg # if we don't check for them as well. 2458c9fbc29Smrg *) 2468c9fbc29Smrg for z in $available_tags; do 2478c9fbc29Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2488c9fbc29Smrg # Evaluate the configuration. 2498c9fbc29Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2508c9fbc29Smrg CC_quoted= 2518c9fbc29Smrg for arg in $CC; do 2528c9fbc29Smrg # Double-quote args containing other shell metacharacters. 2538c9fbc29Smrg case $arg in 2548c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2558c9fbc29Smrg arg="\"$arg\"" 2568c9fbc29Smrg ;; 2578c9fbc29Smrg esac 2588c9fbc29Smrg CC_quoted="$CC_quoted $arg" 2598c9fbc29Smrg done 2608c9fbc29Smrg case "$@ " in 2618c9fbc29Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 2628c9fbc29Smrg # The compiler in the base compile command matches 2638c9fbc29Smrg # the one in the tagged configuration. 2648c9fbc29Smrg # Assume this is the tagged configuration we want. 2658c9fbc29Smrg tagname=$z 2668c9fbc29Smrg break 2678c9fbc29Smrg ;; 2688c9fbc29Smrg esac 2698c9fbc29Smrg fi 2708c9fbc29Smrg done 2718c9fbc29Smrg # If $tagname still isn't set, then no tagged configuration 2728c9fbc29Smrg # was found and let the user know that the "--tag" command 2738c9fbc29Smrg # line option must be used. 2748c9fbc29Smrg if test -z "$tagname"; then 2758c9fbc29Smrg $echo "$modename: unable to infer tagged configuration" 2768c9fbc29Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 2778c9fbc29Smrg exit $EXIT_FAILURE 2788c9fbc29Smrg# else 2798c9fbc29Smrg# $echo "$modename: using $tagname tagged configuration" 2808c9fbc29Smrg fi 2818c9fbc29Smrg ;; 2828c9fbc29Smrg esac 2838c9fbc29Smrg fi 2848c9fbc29Smrg} 2858c9fbc29Smrg 2868c9fbc29Smrg 2878c9fbc29Smrg# func_extract_an_archive dir oldlib 2888c9fbc29Smrgfunc_extract_an_archive () 2898c9fbc29Smrg{ 2908c9fbc29Smrg f_ex_an_ar_dir="$1"; shift 2918c9fbc29Smrg f_ex_an_ar_oldlib="$1" 2928c9fbc29Smrg 2938c9fbc29Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 2948c9fbc29Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 2958c9fbc29Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 2968c9fbc29Smrg : 2978c9fbc29Smrg else 2988c9fbc29Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 2998c9fbc29Smrg exit $EXIT_FAILURE 3008c9fbc29Smrg fi 3018c9fbc29Smrg} 3028c9fbc29Smrg 3038c9fbc29Smrg# func_extract_archives gentop oldlib ... 3048c9fbc29Smrgfunc_extract_archives () 3058c9fbc29Smrg{ 3068c9fbc29Smrg my_gentop="$1"; shift 3078c9fbc29Smrg my_oldlibs=${1+"$@"} 3088c9fbc29Smrg my_oldobjs="" 3098c9fbc29Smrg my_xlib="" 3108c9fbc29Smrg my_xabs="" 3118c9fbc29Smrg my_xdir="" 3128c9fbc29Smrg my_status="" 3138c9fbc29Smrg 3148c9fbc29Smrg $show "${rm}r $my_gentop" 3158c9fbc29Smrg $run ${rm}r "$my_gentop" 3168c9fbc29Smrg $show "$mkdir $my_gentop" 3178c9fbc29Smrg $run $mkdir "$my_gentop" 3188c9fbc29Smrg my_status=$? 3198c9fbc29Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3208c9fbc29Smrg exit $my_status 3218c9fbc29Smrg fi 3228c9fbc29Smrg 3238c9fbc29Smrg for my_xlib in $my_oldlibs; do 3248c9fbc29Smrg # Extract the objects. 3258c9fbc29Smrg case $my_xlib in 3268c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3278c9fbc29Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 3288c9fbc29Smrg esac 3298c9fbc29Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3308c9fbc29Smrg my_xdir="$my_gentop/$my_xlib" 3318c9fbc29Smrg 3328c9fbc29Smrg $show "${rm}r $my_xdir" 3338c9fbc29Smrg $run ${rm}r "$my_xdir" 3348c9fbc29Smrg $show "$mkdir $my_xdir" 3358c9fbc29Smrg $run $mkdir "$my_xdir" 3368c9fbc29Smrg exit_status=$? 3378c9fbc29Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 3388c9fbc29Smrg exit $exit_status 3398c9fbc29Smrg fi 3408c9fbc29Smrg case $host in 3418c9fbc29Smrg *-darwin*) 3428c9fbc29Smrg $show "Extracting $my_xabs" 3438c9fbc29Smrg # Do not bother doing anything if just a dry run 3448c9fbc29Smrg if test -z "$run"; then 3458c9fbc29Smrg darwin_orig_dir=`pwd` 3468c9fbc29Smrg cd $my_xdir || exit $? 3478c9fbc29Smrg darwin_archive=$my_xabs 3488c9fbc29Smrg darwin_curdir=`pwd` 3498c9fbc29Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 3508c9fbc29Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 3518c9fbc29Smrg if test -n "$darwin_arches"; then 3528c9fbc29Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 3538c9fbc29Smrg darwin_arch= 3548c9fbc29Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 3558c9fbc29Smrg for darwin_arch in $darwin_arches ; do 3568c9fbc29Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3578c9fbc29Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3588c9fbc29Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3598c9fbc29Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3608c9fbc29Smrg cd "$darwin_curdir" 3618c9fbc29Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3628c9fbc29Smrg done # $darwin_arches 3638c9fbc29Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 3648c9fbc29Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 3658c9fbc29Smrg darwin_file= 3668c9fbc29Smrg darwin_files= 3678c9fbc29Smrg for darwin_file in $darwin_filelist; do 3688c9fbc29Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 3698c9fbc29Smrg lipo -create -output "$darwin_file" $darwin_files 3708c9fbc29Smrg done # $darwin_filelist 3718c9fbc29Smrg ${rm}r unfat-$$ 3728c9fbc29Smrg cd "$darwin_orig_dir" 3738c9fbc29Smrg else 3748c9fbc29Smrg cd "$darwin_orig_dir" 3758c9fbc29Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 3768c9fbc29Smrg fi # $darwin_arches 3778c9fbc29Smrg fi # $run 3788c9fbc29Smrg ;; 3798c9fbc29Smrg *) 3808c9fbc29Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 3818c9fbc29Smrg ;; 3828c9fbc29Smrg esac 3838c9fbc29Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 3848c9fbc29Smrg done 3858c9fbc29Smrg func_extract_archives_result="$my_oldobjs" 3868c9fbc29Smrg} 3878c9fbc29Smrg# End of Shell function definitions 3888c9fbc29Smrg##################################### 3898c9fbc29Smrg 3908c9fbc29Smrg# Darwin sucks 3918c9fbc29Smrgeval std_shrext=\"$shrext_cmds\" 3928c9fbc29Smrg 3938c9fbc29Smrgdisable_libs=no 3948c9fbc29Smrg 3958c9fbc29Smrg# Parse our command line options once, thoroughly. 3968c9fbc29Smrgwhile test "$#" -gt 0 3978c9fbc29Smrgdo 3988c9fbc29Smrg arg="$1" 3998c9fbc29Smrg shift 4008c9fbc29Smrg 4018c9fbc29Smrg case $arg in 4028c9fbc29Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4038c9fbc29Smrg *) optarg= ;; 4048c9fbc29Smrg esac 4058c9fbc29Smrg 4068c9fbc29Smrg # If the previous option needs an argument, assign it. 4078c9fbc29Smrg if test -n "$prev"; then 4088c9fbc29Smrg case $prev in 4098c9fbc29Smrg execute_dlfiles) 4108c9fbc29Smrg execute_dlfiles="$execute_dlfiles $arg" 4118c9fbc29Smrg ;; 4128c9fbc29Smrg tag) 4138c9fbc29Smrg tagname="$arg" 4148c9fbc29Smrg preserve_args="${preserve_args}=$arg" 4158c9fbc29Smrg 4168c9fbc29Smrg # Check whether tagname contains only valid characters 4178c9fbc29Smrg case $tagname in 4188c9fbc29Smrg *[!-_A-Za-z0-9,/]*) 4198c9fbc29Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 4208c9fbc29Smrg exit $EXIT_FAILURE 4218c9fbc29Smrg ;; 4228c9fbc29Smrg esac 4238c9fbc29Smrg 4248c9fbc29Smrg case $tagname in 4258c9fbc29Smrg CC) 4268c9fbc29Smrg # Don't test for the "default" C tag, as we know, it's there, but 4278c9fbc29Smrg # not specially marked. 4288c9fbc29Smrg ;; 4298c9fbc29Smrg *) 4308c9fbc29Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 4318c9fbc29Smrg taglist="$taglist $tagname" 4328c9fbc29Smrg # Evaluate the configuration. 4338c9fbc29Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 4348c9fbc29Smrg else 4358c9fbc29Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 4368c9fbc29Smrg fi 4378c9fbc29Smrg ;; 4388c9fbc29Smrg esac 4398c9fbc29Smrg ;; 4408c9fbc29Smrg *) 4418c9fbc29Smrg eval "$prev=\$arg" 4428c9fbc29Smrg ;; 4438c9fbc29Smrg esac 4448c9fbc29Smrg 4458c9fbc29Smrg prev= 4468c9fbc29Smrg prevopt= 4478c9fbc29Smrg continue 4488c9fbc29Smrg fi 4498c9fbc29Smrg 4508c9fbc29Smrg # Have we seen a non-optional argument yet? 4518c9fbc29Smrg case $arg in 4528c9fbc29Smrg --help) 4538c9fbc29Smrg show_help=yes 4548c9fbc29Smrg ;; 4558c9fbc29Smrg 4568c9fbc29Smrg --version) 4578c9fbc29Smrg $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 4588c9fbc29Smrg $echo 4598c9fbc29Smrg $echo "Copyright (C) 2005 Free Software Foundation, Inc." 4608c9fbc29Smrg $echo "This is free software; see the source for copying conditions. There is NO" 4618c9fbc29Smrg $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 4628c9fbc29Smrg exit $? 4638c9fbc29Smrg ;; 4648c9fbc29Smrg 4658c9fbc29Smrg --config) 4668c9fbc29Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 4678c9fbc29Smrg # Now print the configurations for the tags. 4688c9fbc29Smrg for tagname in $taglist; do 4698c9fbc29Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 4708c9fbc29Smrg done 4718c9fbc29Smrg exit $? 4728c9fbc29Smrg ;; 4738c9fbc29Smrg 4748c9fbc29Smrg --debug) 4758c9fbc29Smrg $echo "$progname: enabling shell trace mode" 4768c9fbc29Smrg set -x 4778c9fbc29Smrg preserve_args="$preserve_args $arg" 4788c9fbc29Smrg ;; 4798c9fbc29Smrg 4808c9fbc29Smrg --dry-run | -n) 4818c9fbc29Smrg run=: 4828c9fbc29Smrg ;; 4838c9fbc29Smrg 4848c9fbc29Smrg --features) 4858c9fbc29Smrg $echo "host: $host" 4868c9fbc29Smrg if test "$build_libtool_libs" = yes; then 4878c9fbc29Smrg $echo "enable shared libraries" 4888c9fbc29Smrg else 4898c9fbc29Smrg $echo "disable shared libraries" 4908c9fbc29Smrg fi 4918c9fbc29Smrg if test "$build_old_libs" = yes; then 4928c9fbc29Smrg $echo "enable static libraries" 4938c9fbc29Smrg else 4948c9fbc29Smrg $echo "disable static libraries" 4958c9fbc29Smrg fi 4968c9fbc29Smrg exit $? 4978c9fbc29Smrg ;; 4988c9fbc29Smrg 4998c9fbc29Smrg --finish) mode="finish" ;; 5008c9fbc29Smrg 5018c9fbc29Smrg --mode) prevopt="--mode" prev=mode ;; 5028c9fbc29Smrg --mode=*) mode="$optarg" ;; 5038c9fbc29Smrg 5048c9fbc29Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 5058c9fbc29Smrg 5068c9fbc29Smrg --quiet | --silent) 5078c9fbc29Smrg show=: 5088c9fbc29Smrg preserve_args="$preserve_args $arg" 5098c9fbc29Smrg ;; 5108c9fbc29Smrg 5118c9fbc29Smrg --tag) 5128c9fbc29Smrg prevopt="--tag" 5138c9fbc29Smrg prev=tag 5148c9fbc29Smrg preserve_args="$preserve_args --tag" 5158c9fbc29Smrg ;; 5168c9fbc29Smrg --tag=*) 5178c9fbc29Smrg set tag "$optarg" ${1+"$@"} 5188c9fbc29Smrg shift 5198c9fbc29Smrg prev=tag 5208c9fbc29Smrg preserve_args="$preserve_args --tag" 5218c9fbc29Smrg ;; 5228c9fbc29Smrg 5238c9fbc29Smrg -dlopen) 5248c9fbc29Smrg prevopt="-dlopen" 5258c9fbc29Smrg prev=execute_dlfiles 5268c9fbc29Smrg ;; 5278c9fbc29Smrg 5288c9fbc29Smrg -*) 5298c9fbc29Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 5308c9fbc29Smrg $echo "$help" 1>&2 5318c9fbc29Smrg exit $EXIT_FAILURE 5328c9fbc29Smrg ;; 5338c9fbc29Smrg 5348c9fbc29Smrg *) 5358c9fbc29Smrg nonopt="$arg" 5368c9fbc29Smrg break 5378c9fbc29Smrg ;; 5388c9fbc29Smrg esac 5398c9fbc29Smrgdone 5408c9fbc29Smrg 5418c9fbc29Smrgif test -n "$prevopt"; then 5428c9fbc29Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 5438c9fbc29Smrg $echo "$help" 1>&2 5448c9fbc29Smrg exit $EXIT_FAILURE 5458c9fbc29Smrgfi 5468c9fbc29Smrg 5478c9fbc29Smrgcase $disable_libs in 5488c9fbc29Smrgno) 5498c9fbc29Smrg ;; 5508c9fbc29Smrgshared) 5518c9fbc29Smrg build_libtool_libs=no 5528c9fbc29Smrg build_old_libs=yes 5538c9fbc29Smrg ;; 5548c9fbc29Smrgstatic) 5558c9fbc29Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5568c9fbc29Smrg ;; 5578c9fbc29Smrgesac 5588c9fbc29Smrg 5598c9fbc29Smrg# If this variable is set in any of the actions, the command in it 5608c9fbc29Smrg# will be execed at the end. This prevents here-documents from being 5618c9fbc29Smrg# left over by shells. 5628c9fbc29Smrgexec_cmd= 5638c9fbc29Smrg 5648c9fbc29Smrgif test -z "$show_help"; then 5658c9fbc29Smrg 5668c9fbc29Smrg # Infer the operation mode. 5678c9fbc29Smrg if test -z "$mode"; then 5688c9fbc29Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 5698c9fbc29Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 5708c9fbc29Smrg case $nonopt in 5718c9fbc29Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 5728c9fbc29Smrg mode=link 5738c9fbc29Smrg for arg 5748c9fbc29Smrg do 5758c9fbc29Smrg case $arg in 5768c9fbc29Smrg -c) 5778c9fbc29Smrg mode=compile 5788c9fbc29Smrg break 5798c9fbc29Smrg ;; 5808c9fbc29Smrg esac 5818c9fbc29Smrg done 5828c9fbc29Smrg ;; 5838c9fbc29Smrg *db | *dbx | *strace | *truss) 5848c9fbc29Smrg mode=execute 5858c9fbc29Smrg ;; 5868c9fbc29Smrg *install*|cp|mv) 5878c9fbc29Smrg mode=install 5888c9fbc29Smrg ;; 5898c9fbc29Smrg *rm) 5908c9fbc29Smrg mode=uninstall 5918c9fbc29Smrg ;; 5928c9fbc29Smrg *) 5938c9fbc29Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 5948c9fbc29Smrg test -n "$execute_dlfiles" && mode=execute 5958c9fbc29Smrg 5968c9fbc29Smrg # Just use the default operation mode. 5978c9fbc29Smrg if test -z "$mode"; then 5988c9fbc29Smrg if test -n "$nonopt"; then 5998c9fbc29Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6008c9fbc29Smrg else 6018c9fbc29Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6028c9fbc29Smrg fi 6038c9fbc29Smrg fi 6048c9fbc29Smrg ;; 6058c9fbc29Smrg esac 6068c9fbc29Smrg fi 6078c9fbc29Smrg 6088c9fbc29Smrg # Only execute mode is allowed to have -dlopen flags. 6098c9fbc29Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 6108c9fbc29Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 6118c9fbc29Smrg $echo "$help" 1>&2 6128c9fbc29Smrg exit $EXIT_FAILURE 6138c9fbc29Smrg fi 6148c9fbc29Smrg 6158c9fbc29Smrg # Change the help message to a mode-specific one. 6168c9fbc29Smrg generic_help="$help" 6178c9fbc29Smrg help="Try \`$modename --help --mode=$mode' for more information." 6188c9fbc29Smrg 6198c9fbc29Smrg # These modes are in order of execution frequency so that they run quickly. 6208c9fbc29Smrg case $mode in 6218c9fbc29Smrg # libtool compile mode 6228c9fbc29Smrg compile) 6238c9fbc29Smrg modename="$modename: compile" 6248c9fbc29Smrg # Get the compilation command and the source file. 6258c9fbc29Smrg base_compile= 6268c9fbc29Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 6278c9fbc29Smrg suppress_opt=yes 6288c9fbc29Smrg suppress_output= 6298c9fbc29Smrg arg_mode=normal 6308c9fbc29Smrg libobj= 6318c9fbc29Smrg later= 6328c9fbc29Smrg 6338c9fbc29Smrg for arg 6348c9fbc29Smrg do 6358c9fbc29Smrg case $arg_mode in 6368c9fbc29Smrg arg ) 6378c9fbc29Smrg # do not "continue". Instead, add this to base_compile 6388c9fbc29Smrg lastarg="$arg" 6398c9fbc29Smrg arg_mode=normal 6408c9fbc29Smrg ;; 6418c9fbc29Smrg 6428c9fbc29Smrg target ) 6438c9fbc29Smrg libobj="$arg" 6448c9fbc29Smrg arg_mode=normal 6458c9fbc29Smrg continue 6468c9fbc29Smrg ;; 6478c9fbc29Smrg 6488c9fbc29Smrg normal ) 6498c9fbc29Smrg # Accept any command-line options. 6508c9fbc29Smrg case $arg in 6518c9fbc29Smrg -o) 6528c9fbc29Smrg if test -n "$libobj" ; then 6538c9fbc29Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 6548c9fbc29Smrg exit $EXIT_FAILURE 6558c9fbc29Smrg fi 6568c9fbc29Smrg arg_mode=target 6578c9fbc29Smrg continue 6588c9fbc29Smrg ;; 6598c9fbc29Smrg 6608c9fbc29Smrg -static | -prefer-pic | -prefer-non-pic) 6618c9fbc29Smrg later="$later $arg" 6628c9fbc29Smrg continue 6638c9fbc29Smrg ;; 6648c9fbc29Smrg 6658c9fbc29Smrg -no-suppress) 6668c9fbc29Smrg suppress_opt=no 6678c9fbc29Smrg continue 6688c9fbc29Smrg ;; 6698c9fbc29Smrg 6708c9fbc29Smrg -Xcompiler) 6718c9fbc29Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 6728c9fbc29Smrg continue # The current "srcfile" will either be retained or 6738c9fbc29Smrg ;; # replaced later. I would guess that would be a bug. 6748c9fbc29Smrg 6758c9fbc29Smrg -Wc,*) 6768c9fbc29Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 6778c9fbc29Smrg lastarg= 6788c9fbc29Smrg save_ifs="$IFS"; IFS=',' 6798c9fbc29Smrg for arg in $args; do 6808c9fbc29Smrg IFS="$save_ifs" 6818c9fbc29Smrg 6828c9fbc29Smrg # Double-quote args containing other shell metacharacters. 6838c9fbc29Smrg # Many Bourne shells cannot handle close brackets correctly 6848c9fbc29Smrg # in scan sets, so we specify it separately. 6858c9fbc29Smrg case $arg in 6868c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 6878c9fbc29Smrg arg="\"$arg\"" 6888c9fbc29Smrg ;; 6898c9fbc29Smrg esac 6908c9fbc29Smrg lastarg="$lastarg $arg" 6918c9fbc29Smrg done 6928c9fbc29Smrg IFS="$save_ifs" 6938c9fbc29Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 6948c9fbc29Smrg 6958c9fbc29Smrg # Add the arguments to base_compile. 6968c9fbc29Smrg base_compile="$base_compile $lastarg" 6978c9fbc29Smrg continue 6988c9fbc29Smrg ;; 6998c9fbc29Smrg 7008c9fbc29Smrg * ) 7018c9fbc29Smrg # Accept the current argument as the source file. 7028c9fbc29Smrg # The previous "srcfile" becomes the current argument. 7038c9fbc29Smrg # 7048c9fbc29Smrg lastarg="$srcfile" 7058c9fbc29Smrg srcfile="$arg" 7068c9fbc29Smrg ;; 7078c9fbc29Smrg esac # case $arg 7088c9fbc29Smrg ;; 7098c9fbc29Smrg esac # case $arg_mode 7108c9fbc29Smrg 7118c9fbc29Smrg # Aesthetically quote the previous argument. 7128c9fbc29Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7138c9fbc29Smrg 7148c9fbc29Smrg case $lastarg in 7158c9fbc29Smrg # Double-quote args containing other shell metacharacters. 7168c9fbc29Smrg # Many Bourne shells cannot handle close brackets correctly 7178c9fbc29Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 7188c9fbc29Smrg # in scan sets (worked around with variable expansion), 7198c9fbc29Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 7208c9fbc29Smrg # at all, so we specify them separately. 7218c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7228c9fbc29Smrg lastarg="\"$lastarg\"" 7238c9fbc29Smrg ;; 7248c9fbc29Smrg esac 7258c9fbc29Smrg 7268c9fbc29Smrg base_compile="$base_compile $lastarg" 7278c9fbc29Smrg done # for arg 7288c9fbc29Smrg 7298c9fbc29Smrg case $arg_mode in 7308c9fbc29Smrg arg) 7318c9fbc29Smrg $echo "$modename: you must specify an argument for -Xcompile" 7328c9fbc29Smrg exit $EXIT_FAILURE 7338c9fbc29Smrg ;; 7348c9fbc29Smrg target) 7358c9fbc29Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 7368c9fbc29Smrg exit $EXIT_FAILURE 7378c9fbc29Smrg ;; 7388c9fbc29Smrg *) 7398c9fbc29Smrg # Get the name of the library object. 7408c9fbc29Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 7418c9fbc29Smrg ;; 7428c9fbc29Smrg esac 7438c9fbc29Smrg 7448c9fbc29Smrg # Recognize several different file suffixes. 7458c9fbc29Smrg # If the user specifies -o file.o, it is replaced with file.lo 7468c9fbc29Smrg xform='[cCFSifmso]' 7478c9fbc29Smrg case $libobj in 7488c9fbc29Smrg *.ada) xform=ada ;; 7498c9fbc29Smrg *.adb) xform=adb ;; 7508c9fbc29Smrg *.ads) xform=ads ;; 7518c9fbc29Smrg *.asm) xform=asm ;; 7528c9fbc29Smrg *.c++) xform=c++ ;; 7538c9fbc29Smrg *.cc) xform=cc ;; 7548c9fbc29Smrg *.ii) xform=ii ;; 7558c9fbc29Smrg *.class) xform=class ;; 7568c9fbc29Smrg *.cpp) xform=cpp ;; 7578c9fbc29Smrg *.cxx) xform=cxx ;; 7588c9fbc29Smrg *.f90) xform=f90 ;; 7598c9fbc29Smrg *.for) xform=for ;; 7608c9fbc29Smrg *.java) xform=java ;; 7618c9fbc29Smrg esac 7628c9fbc29Smrg 7638c9fbc29Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 7648c9fbc29Smrg 7658c9fbc29Smrg case $libobj in 7668c9fbc29Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 7678c9fbc29Smrg *) 7688c9fbc29Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 7698c9fbc29Smrg exit $EXIT_FAILURE 7708c9fbc29Smrg ;; 7718c9fbc29Smrg esac 7728c9fbc29Smrg 7738c9fbc29Smrg func_infer_tag $base_compile 7748c9fbc29Smrg 7758c9fbc29Smrg for arg in $later; do 7768c9fbc29Smrg case $arg in 7778c9fbc29Smrg -static) 7788c9fbc29Smrg build_old_libs=yes 7798c9fbc29Smrg continue 7808c9fbc29Smrg ;; 7818c9fbc29Smrg 7828c9fbc29Smrg -prefer-pic) 7838c9fbc29Smrg pic_mode=yes 7848c9fbc29Smrg continue 7858c9fbc29Smrg ;; 7868c9fbc29Smrg 7878c9fbc29Smrg -prefer-non-pic) 7888c9fbc29Smrg pic_mode=no 7898c9fbc29Smrg continue 7908c9fbc29Smrg ;; 7918c9fbc29Smrg esac 7928c9fbc29Smrg done 7938c9fbc29Smrg 7948c9fbc29Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 7958c9fbc29Smrg case $qlibobj in 7968c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7978c9fbc29Smrg qlibobj="\"$qlibobj\"" ;; 7988c9fbc29Smrg esac 7998c9fbc29Smrg test "X$libobj" != "X$qlibobj" \ 8008c9fbc29Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 8018c9fbc29Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 8028c9fbc29Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 8038c9fbc29Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8048c9fbc29Smrg if test "X$xdir" = "X$obj"; then 8058c9fbc29Smrg xdir= 8068c9fbc29Smrg else 8078c9fbc29Smrg xdir=$xdir/ 8088c9fbc29Smrg fi 8098c9fbc29Smrg lobj=${xdir}$objdir/$objname 8108c9fbc29Smrg 8118c9fbc29Smrg if test -z "$base_compile"; then 8128c9fbc29Smrg $echo "$modename: you must specify a compilation command" 1>&2 8138c9fbc29Smrg $echo "$help" 1>&2 8148c9fbc29Smrg exit $EXIT_FAILURE 8158c9fbc29Smrg fi 8168c9fbc29Smrg 8178c9fbc29Smrg # Delete any leftover library objects. 8188c9fbc29Smrg if test "$build_old_libs" = yes; then 8198c9fbc29Smrg removelist="$obj $lobj $libobj ${libobj}T" 8208c9fbc29Smrg else 8218c9fbc29Smrg removelist="$lobj $libobj ${libobj}T" 8228c9fbc29Smrg fi 8238c9fbc29Smrg 8248c9fbc29Smrg $run $rm $removelist 8258c9fbc29Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8268c9fbc29Smrg 8278c9fbc29Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 8288c9fbc29Smrg case $host_os in 8298c9fbc29Smrg cygwin* | mingw* | pw32* | os2*) 8308c9fbc29Smrg pic_mode=default 8318c9fbc29Smrg ;; 8328c9fbc29Smrg esac 8338c9fbc29Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 8348c9fbc29Smrg # non-PIC code in shared libraries is not supported 8358c9fbc29Smrg pic_mode=default 8368c9fbc29Smrg fi 8378c9fbc29Smrg 8388c9fbc29Smrg # Calculate the filename of the output object if compiler does 8398c9fbc29Smrg # not support -o with -c 8408c9fbc29Smrg if test "$compiler_c_o" = no; then 8418c9fbc29Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 8428c9fbc29Smrg lockfile="$output_obj.lock" 8438c9fbc29Smrg removelist="$removelist $output_obj $lockfile" 8448c9fbc29Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8458c9fbc29Smrg else 8468c9fbc29Smrg output_obj= 8478c9fbc29Smrg need_locks=no 8488c9fbc29Smrg lockfile= 8498c9fbc29Smrg fi 8508c9fbc29Smrg 8518c9fbc29Smrg # Lock this critical section if it is needed 8528c9fbc29Smrg # We use this script file to make the link, it avoids creating a new file 8538c9fbc29Smrg if test "$need_locks" = yes; then 8548c9fbc29Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 8558c9fbc29Smrg $show "Waiting for $lockfile to be removed" 8568c9fbc29Smrg sleep 2 8578c9fbc29Smrg done 8588c9fbc29Smrg elif test "$need_locks" = warn; then 8598c9fbc29Smrg if test -f "$lockfile"; then 8608c9fbc29Smrg $echo "\ 8618c9fbc29Smrg*** ERROR, $lockfile exists and contains: 8628c9fbc29Smrg`cat $lockfile 2>/dev/null` 8638c9fbc29Smrg 8648c9fbc29SmrgThis indicates that another process is trying to use the same 8658c9fbc29Smrgtemporary object file, and libtool could not work around it because 8668c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together. If you 8678c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better 8688c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better 8698c9fbc29Smrgcompiler." 8708c9fbc29Smrg 8718c9fbc29Smrg $run $rm $removelist 8728c9fbc29Smrg exit $EXIT_FAILURE 8738c9fbc29Smrg fi 8748c9fbc29Smrg $echo "$srcfile" > "$lockfile" 8758c9fbc29Smrg fi 8768c9fbc29Smrg 8778c9fbc29Smrg if test -n "$fix_srcfile_path"; then 8788c9fbc29Smrg eval srcfile=\"$fix_srcfile_path\" 8798c9fbc29Smrg fi 8808c9fbc29Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 8818c9fbc29Smrg case $qsrcfile in 8828c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8838c9fbc29Smrg qsrcfile="\"$qsrcfile\"" ;; 8848c9fbc29Smrg esac 8858c9fbc29Smrg 8868c9fbc29Smrg $run $rm "$libobj" "${libobj}T" 8878c9fbc29Smrg 8888c9fbc29Smrg # Create a libtool object file (analogous to a ".la" file), 8898c9fbc29Smrg # but don't create it if we're doing a dry run. 8908c9fbc29Smrg test -z "$run" && cat > ${libobj}T <<EOF 8918c9fbc29Smrg# $libobj - a libtool object file 8928c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 8938c9fbc29Smrg# 8948c9fbc29Smrg# Please DO NOT delete this file! 8958c9fbc29Smrg# It is necessary for linking the library. 8968c9fbc29Smrg 8978c9fbc29Smrg# Name of the PIC object. 8988c9fbc29SmrgEOF 8998c9fbc29Smrg 9008c9fbc29Smrg # Only build a PIC object if we are building libtool libraries. 9018c9fbc29Smrg if test "$build_libtool_libs" = yes; then 9028c9fbc29Smrg # Without this assignment, base_compile gets emptied. 9038c9fbc29Smrg fbsd_hideous_sh_bug=$base_compile 9048c9fbc29Smrg 9058c9fbc29Smrg if test "$pic_mode" != no; then 9068c9fbc29Smrg command="$base_compile $qsrcfile $pic_flag" 9078c9fbc29Smrg else 9088c9fbc29Smrg # Don't build PIC code 9098c9fbc29Smrg command="$base_compile $qsrcfile" 9108c9fbc29Smrg fi 9118c9fbc29Smrg 9128c9fbc29Smrg if test ! -d "${xdir}$objdir"; then 9138c9fbc29Smrg $show "$mkdir ${xdir}$objdir" 9148c9fbc29Smrg $run $mkdir ${xdir}$objdir 9158c9fbc29Smrg exit_status=$? 9168c9fbc29Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 9178c9fbc29Smrg exit $exit_status 9188c9fbc29Smrg fi 9198c9fbc29Smrg fi 9208c9fbc29Smrg 9218c9fbc29Smrg if test -z "$output_obj"; then 9228c9fbc29Smrg # Place PIC objects in $objdir 9238c9fbc29Smrg command="$command -o $lobj" 9248c9fbc29Smrg fi 9258c9fbc29Smrg 9268c9fbc29Smrg $run $rm "$lobj" "$output_obj" 9278c9fbc29Smrg 9288c9fbc29Smrg $show "$command" 9298c9fbc29Smrg if $run eval "$command"; then : 9308c9fbc29Smrg else 9318c9fbc29Smrg test -n "$output_obj" && $run $rm $removelist 9328c9fbc29Smrg exit $EXIT_FAILURE 9338c9fbc29Smrg fi 9348c9fbc29Smrg 9358c9fbc29Smrg if test "$need_locks" = warn && 9368c9fbc29Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 9378c9fbc29Smrg $echo "\ 9388c9fbc29Smrg*** ERROR, $lockfile contains: 9398c9fbc29Smrg`cat $lockfile 2>/dev/null` 9408c9fbc29Smrg 9418c9fbc29Smrgbut it should contain: 9428c9fbc29Smrg$srcfile 9438c9fbc29Smrg 9448c9fbc29SmrgThis indicates that another process is trying to use the same 9458c9fbc29Smrgtemporary object file, and libtool could not work around it because 9468c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together. If you 9478c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better 9488c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better 9498c9fbc29Smrgcompiler." 9508c9fbc29Smrg 9518c9fbc29Smrg $run $rm $removelist 9528c9fbc29Smrg exit $EXIT_FAILURE 9538c9fbc29Smrg fi 9548c9fbc29Smrg 9558c9fbc29Smrg # Just move the object if needed, then go on to compile the next one 9568c9fbc29Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 9578c9fbc29Smrg $show "$mv $output_obj $lobj" 9588c9fbc29Smrg if $run $mv $output_obj $lobj; then : 9598c9fbc29Smrg else 9608c9fbc29Smrg error=$? 9618c9fbc29Smrg $run $rm $removelist 9628c9fbc29Smrg exit $error 9638c9fbc29Smrg fi 9648c9fbc29Smrg fi 9658c9fbc29Smrg 9668c9fbc29Smrg # Append the name of the PIC object to the libtool object file. 9678c9fbc29Smrg test -z "$run" && cat >> ${libobj}T <<EOF 9688c9fbc29Smrgpic_object='$objdir/$objname' 9698c9fbc29Smrg 9708c9fbc29SmrgEOF 9718c9fbc29Smrg 9728c9fbc29Smrg # Allow error messages only from the first compilation. 9738c9fbc29Smrg if test "$suppress_opt" = yes; then 9748c9fbc29Smrg suppress_output=' >/dev/null 2>&1' 9758c9fbc29Smrg fi 9768c9fbc29Smrg else 9778c9fbc29Smrg # No PIC object so indicate it doesn't exist in the libtool 9788c9fbc29Smrg # object file. 9798c9fbc29Smrg test -z "$run" && cat >> ${libobj}T <<EOF 9808c9fbc29Smrgpic_object=none 9818c9fbc29Smrg 9828c9fbc29SmrgEOF 9838c9fbc29Smrg fi 9848c9fbc29Smrg 9858c9fbc29Smrg # Only build a position-dependent object if we build old libraries. 9868c9fbc29Smrg if test "$build_old_libs" = yes; then 9878c9fbc29Smrg if test "$pic_mode" != yes; then 9888c9fbc29Smrg # Don't build PIC code 9898c9fbc29Smrg command="$base_compile $qsrcfile" 9908c9fbc29Smrg else 9918c9fbc29Smrg command="$base_compile $qsrcfile $pic_flag" 9928c9fbc29Smrg fi 9938c9fbc29Smrg if test "$compiler_c_o" = yes; then 9948c9fbc29Smrg command="$command -o $obj" 9958c9fbc29Smrg fi 9968c9fbc29Smrg 9978c9fbc29Smrg # Suppress compiler output if we already did a PIC compilation. 9988c9fbc29Smrg command="$command$suppress_output" 9998c9fbc29Smrg $run $rm "$obj" "$output_obj" 10008c9fbc29Smrg $show "$command" 10018c9fbc29Smrg if $run eval "$command"; then : 10028c9fbc29Smrg else 10038c9fbc29Smrg $run $rm $removelist 10048c9fbc29Smrg exit $EXIT_FAILURE 10058c9fbc29Smrg fi 10068c9fbc29Smrg 10078c9fbc29Smrg if test "$need_locks" = warn && 10088c9fbc29Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 10098c9fbc29Smrg $echo "\ 10108c9fbc29Smrg*** ERROR, $lockfile contains: 10118c9fbc29Smrg`cat $lockfile 2>/dev/null` 10128c9fbc29Smrg 10138c9fbc29Smrgbut it should contain: 10148c9fbc29Smrg$srcfile 10158c9fbc29Smrg 10168c9fbc29SmrgThis indicates that another process is trying to use the same 10178c9fbc29Smrgtemporary object file, and libtool could not work around it because 10188c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together. If you 10198c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better 10208c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better 10218c9fbc29Smrgcompiler." 10228c9fbc29Smrg 10238c9fbc29Smrg $run $rm $removelist 10248c9fbc29Smrg exit $EXIT_FAILURE 10258c9fbc29Smrg fi 10268c9fbc29Smrg 10278c9fbc29Smrg # Just move the object if needed 10288c9fbc29Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 10298c9fbc29Smrg $show "$mv $output_obj $obj" 10308c9fbc29Smrg if $run $mv $output_obj $obj; then : 10318c9fbc29Smrg else 10328c9fbc29Smrg error=$? 10338c9fbc29Smrg $run $rm $removelist 10348c9fbc29Smrg exit $error 10358c9fbc29Smrg fi 10368c9fbc29Smrg fi 10378c9fbc29Smrg 10388c9fbc29Smrg # Append the name of the non-PIC object the libtool object file. 10398c9fbc29Smrg # Only append if the libtool object file exists. 10408c9fbc29Smrg test -z "$run" && cat >> ${libobj}T <<EOF 10418c9fbc29Smrg# Name of the non-PIC object. 10428c9fbc29Smrgnon_pic_object='$objname' 10438c9fbc29Smrg 10448c9fbc29SmrgEOF 10458c9fbc29Smrg else 10468c9fbc29Smrg # Append the name of the non-PIC object the libtool object file. 10478c9fbc29Smrg # Only append if the libtool object file exists. 10488c9fbc29Smrg test -z "$run" && cat >> ${libobj}T <<EOF 10498c9fbc29Smrg# Name of the non-PIC object. 10508c9fbc29Smrgnon_pic_object=none 10518c9fbc29Smrg 10528c9fbc29SmrgEOF 10538c9fbc29Smrg fi 10548c9fbc29Smrg 10558c9fbc29Smrg $run $mv "${libobj}T" "${libobj}" 10568c9fbc29Smrg 10578c9fbc29Smrg # Unlock the critical section if it was locked 10588c9fbc29Smrg if test "$need_locks" != no; then 10598c9fbc29Smrg $run $rm "$lockfile" 10608c9fbc29Smrg fi 10618c9fbc29Smrg 10628c9fbc29Smrg exit $EXIT_SUCCESS 10638c9fbc29Smrg ;; 10648c9fbc29Smrg 10658c9fbc29Smrg # libtool link mode 10668c9fbc29Smrg link | relink) 10678c9fbc29Smrg modename="$modename: link" 10688c9fbc29Smrg case $host in 10698c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 10708c9fbc29Smrg # It is impossible to link a dll without this setting, and 10718c9fbc29Smrg # we shouldn't force the makefile maintainer to figure out 10728c9fbc29Smrg # which system we are compiling for in order to pass an extra 10738c9fbc29Smrg # flag for every libtool invocation. 10748c9fbc29Smrg # allow_undefined=no 10758c9fbc29Smrg 10768c9fbc29Smrg # FIXME: Unfortunately, there are problems with the above when trying 10778c9fbc29Smrg # to make a dll which has undefined symbols, in which case not 10788c9fbc29Smrg # even a static library is built. For now, we need to specify 10798c9fbc29Smrg # -no-undefined on the libtool link line when we can be certain 10808c9fbc29Smrg # that all symbols are satisfied, otherwise we get a static library. 10818c9fbc29Smrg allow_undefined=yes 10828c9fbc29Smrg ;; 10838c9fbc29Smrg *) 10848c9fbc29Smrg allow_undefined=yes 10858c9fbc29Smrg ;; 10868c9fbc29Smrg esac 10878c9fbc29Smrg libtool_args="$nonopt" 10888c9fbc29Smrg base_compile="$nonopt $@" 10898c9fbc29Smrg compile_command="$nonopt" 10908c9fbc29Smrg finalize_command="$nonopt" 10918c9fbc29Smrg 10928c9fbc29Smrg compile_rpath= 10938c9fbc29Smrg finalize_rpath= 10948c9fbc29Smrg compile_shlibpath= 10958c9fbc29Smrg finalize_shlibpath= 10968c9fbc29Smrg convenience= 10978c9fbc29Smrg old_convenience= 10988c9fbc29Smrg deplibs= 10998c9fbc29Smrg old_deplibs= 11008c9fbc29Smrg compiler_flags= 11018c9fbc29Smrg linker_flags= 11028c9fbc29Smrg dllsearchpath= 11038c9fbc29Smrg lib_search_path=`pwd` 11048c9fbc29Smrg inst_prefix_dir= 11058c9fbc29Smrg 11068c9fbc29Smrg avoid_version=no 11078c9fbc29Smrg dlfiles= 11088c9fbc29Smrg dlprefiles= 11098c9fbc29Smrg dlself=no 11108c9fbc29Smrg export_dynamic=no 11118c9fbc29Smrg export_symbols= 11128c9fbc29Smrg export_symbols_regex= 11138c9fbc29Smrg generated= 11148c9fbc29Smrg libobjs= 11158c9fbc29Smrg ltlibs= 11168c9fbc29Smrg module=no 11178c9fbc29Smrg no_install=no 11188c9fbc29Smrg objs= 11198c9fbc29Smrg non_pic_objects= 11208c9fbc29Smrg notinst_path= # paths that contain not-installed libtool libraries 11218c9fbc29Smrg precious_files_regex= 11228c9fbc29Smrg prefer_static_libs=no 11238c9fbc29Smrg preload=no 11248c9fbc29Smrg prev= 11258c9fbc29Smrg prevarg= 11268c9fbc29Smrg release= 11278c9fbc29Smrg rpath= 11288c9fbc29Smrg xrpath= 11298c9fbc29Smrg perm_rpath= 11308c9fbc29Smrg temp_rpath= 11318c9fbc29Smrg thread_safe=no 11328c9fbc29Smrg vinfo= 11338c9fbc29Smrg vinfo_number=no 11348c9fbc29Smrg 11358c9fbc29Smrg func_infer_tag $base_compile 11368c9fbc29Smrg 11378c9fbc29Smrg # We need to know -static, to get the right output filenames. 11388c9fbc29Smrg for arg 11398c9fbc29Smrg do 11408c9fbc29Smrg case $arg in 11418c9fbc29Smrg -all-static | -static) 11428c9fbc29Smrg if test "X$arg" = "X-all-static"; then 11438c9fbc29Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 11448c9fbc29Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 11458c9fbc29Smrg fi 11468c9fbc29Smrg if test -n "$link_static_flag"; then 11478c9fbc29Smrg dlopen_self=$dlopen_self_static 11488c9fbc29Smrg fi 11498c9fbc29Smrg prefer_static_libs=yes 11508c9fbc29Smrg else 11518c9fbc29Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11528c9fbc29Smrg dlopen_self=$dlopen_self_static 11538c9fbc29Smrg fi 11548c9fbc29Smrg prefer_static_libs=built 11558c9fbc29Smrg fi 11568c9fbc29Smrg build_libtool_libs=no 11578c9fbc29Smrg build_old_libs=yes 11588c9fbc29Smrg break 11598c9fbc29Smrg ;; 11608c9fbc29Smrg esac 11618c9fbc29Smrg done 11628c9fbc29Smrg 11638c9fbc29Smrg # See if our shared archives depend on static archives. 11648c9fbc29Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 11658c9fbc29Smrg 11668c9fbc29Smrg # Go through the arguments, transforming them on the way. 11678c9fbc29Smrg while test "$#" -gt 0; do 11688c9fbc29Smrg arg="$1" 11698c9fbc29Smrg shift 11708c9fbc29Smrg case $arg in 11718c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 11728c9fbc29Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 11738c9fbc29Smrg ;; 11748c9fbc29Smrg *) qarg=$arg ;; 11758c9fbc29Smrg esac 11768c9fbc29Smrg libtool_args="$libtool_args $qarg" 11778c9fbc29Smrg 11788c9fbc29Smrg # If the previous option needs an argument, assign it. 11798c9fbc29Smrg if test -n "$prev"; then 11808c9fbc29Smrg case $prev in 11818c9fbc29Smrg output) 11828c9fbc29Smrg compile_command="$compile_command @OUTPUT@" 11838c9fbc29Smrg finalize_command="$finalize_command @OUTPUT@" 11848c9fbc29Smrg ;; 11858c9fbc29Smrg esac 11868c9fbc29Smrg 11878c9fbc29Smrg case $prev in 11888c9fbc29Smrg dlfiles|dlprefiles) 11898c9fbc29Smrg if test "$preload" = no; then 11908c9fbc29Smrg # Add the symbol object into the linking commands. 11918c9fbc29Smrg compile_command="$compile_command @SYMFILE@" 11928c9fbc29Smrg finalize_command="$finalize_command @SYMFILE@" 11938c9fbc29Smrg preload=yes 11948c9fbc29Smrg fi 11958c9fbc29Smrg case $arg in 11968c9fbc29Smrg *.la | *.lo) ;; # We handle these cases below. 11978c9fbc29Smrg force) 11988c9fbc29Smrg if test "$dlself" = no; then 11998c9fbc29Smrg dlself=needless 12008c9fbc29Smrg export_dynamic=yes 12018c9fbc29Smrg fi 12028c9fbc29Smrg prev= 12038c9fbc29Smrg continue 12048c9fbc29Smrg ;; 12058c9fbc29Smrg self) 12068c9fbc29Smrg if test "$prev" = dlprefiles; then 12078c9fbc29Smrg dlself=yes 12088c9fbc29Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 12098c9fbc29Smrg dlself=yes 12108c9fbc29Smrg else 12118c9fbc29Smrg dlself=needless 12128c9fbc29Smrg export_dynamic=yes 12138c9fbc29Smrg fi 12148c9fbc29Smrg prev= 12158c9fbc29Smrg continue 12168c9fbc29Smrg ;; 12178c9fbc29Smrg *) 12188c9fbc29Smrg if test "$prev" = dlfiles; then 12198c9fbc29Smrg dlfiles="$dlfiles $arg" 12208c9fbc29Smrg else 12218c9fbc29Smrg dlprefiles="$dlprefiles $arg" 12228c9fbc29Smrg fi 12238c9fbc29Smrg prev= 12248c9fbc29Smrg continue 12258c9fbc29Smrg ;; 12268c9fbc29Smrg esac 12278c9fbc29Smrg ;; 12288c9fbc29Smrg expsyms) 12298c9fbc29Smrg export_symbols="$arg" 12308c9fbc29Smrg if test ! -f "$arg"; then 12318c9fbc29Smrg $echo "$modename: symbol file \`$arg' does not exist" 12328c9fbc29Smrg exit $EXIT_FAILURE 12338c9fbc29Smrg fi 12348c9fbc29Smrg prev= 12358c9fbc29Smrg continue 12368c9fbc29Smrg ;; 12378c9fbc29Smrg expsyms_regex) 12388c9fbc29Smrg export_symbols_regex="$arg" 12398c9fbc29Smrg prev= 12408c9fbc29Smrg continue 12418c9fbc29Smrg ;; 12428c9fbc29Smrg inst_prefix) 12438c9fbc29Smrg inst_prefix_dir="$arg" 12448c9fbc29Smrg prev= 12458c9fbc29Smrg continue 12468c9fbc29Smrg ;; 12478c9fbc29Smrg precious_regex) 12488c9fbc29Smrg precious_files_regex="$arg" 12498c9fbc29Smrg prev= 12508c9fbc29Smrg continue 12518c9fbc29Smrg ;; 12528c9fbc29Smrg release) 12538c9fbc29Smrg release="-$arg" 12548c9fbc29Smrg prev= 12558c9fbc29Smrg continue 12568c9fbc29Smrg ;; 12578c9fbc29Smrg objectlist) 12588c9fbc29Smrg if test -f "$arg"; then 12598c9fbc29Smrg save_arg=$arg 12608c9fbc29Smrg moreargs= 12618c9fbc29Smrg for fil in `cat $save_arg` 12628c9fbc29Smrg do 12638c9fbc29Smrg# moreargs="$moreargs $fil" 12648c9fbc29Smrg arg=$fil 12658c9fbc29Smrg # A libtool-controlled object. 12668c9fbc29Smrg 12678c9fbc29Smrg # Check to see that this really is a libtool object. 12688c9fbc29Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 12698c9fbc29Smrg pic_object= 12708c9fbc29Smrg non_pic_object= 12718c9fbc29Smrg 12728c9fbc29Smrg # Read the .lo file 12738c9fbc29Smrg # If there is no directory component, then add one. 12748c9fbc29Smrg case $arg in 12758c9fbc29Smrg */* | *\\*) . $arg ;; 12768c9fbc29Smrg *) . ./$arg ;; 12778c9fbc29Smrg esac 12788c9fbc29Smrg 12798c9fbc29Smrg if test -z "$pic_object" || \ 12808c9fbc29Smrg test -z "$non_pic_object" || 12818c9fbc29Smrg test "$pic_object" = none && \ 12828c9fbc29Smrg test "$non_pic_object" = none; then 12838c9fbc29Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 12848c9fbc29Smrg exit $EXIT_FAILURE 12858c9fbc29Smrg fi 12868c9fbc29Smrg 12878c9fbc29Smrg # Extract subdirectory from the argument. 12888c9fbc29Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 12898c9fbc29Smrg if test "X$xdir" = "X$arg"; then 12908c9fbc29Smrg xdir= 12918c9fbc29Smrg else 12928c9fbc29Smrg xdir="$xdir/" 12938c9fbc29Smrg fi 12948c9fbc29Smrg 12958c9fbc29Smrg if test "$pic_object" != none; then 12968c9fbc29Smrg # Prepend the subdirectory the object is found in. 12978c9fbc29Smrg pic_object="$xdir$pic_object" 12988c9fbc29Smrg 12998c9fbc29Smrg if test "$prev" = dlfiles; then 13008c9fbc29Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13018c9fbc29Smrg dlfiles="$dlfiles $pic_object" 13028c9fbc29Smrg prev= 13038c9fbc29Smrg continue 13048c9fbc29Smrg else 13058c9fbc29Smrg # If libtool objects are unsupported, then we need to preload. 13068c9fbc29Smrg prev=dlprefiles 13078c9fbc29Smrg fi 13088c9fbc29Smrg fi 13098c9fbc29Smrg 13108c9fbc29Smrg # CHECK ME: I think I busted this. -Ossama 13118c9fbc29Smrg if test "$prev" = dlprefiles; then 13128c9fbc29Smrg # Preload the old-style object. 13138c9fbc29Smrg dlprefiles="$dlprefiles $pic_object" 13148c9fbc29Smrg prev= 13158c9fbc29Smrg fi 13168c9fbc29Smrg 13178c9fbc29Smrg # A PIC object. 13188c9fbc29Smrg libobjs="$libobjs $pic_object" 13198c9fbc29Smrg arg="$pic_object" 13208c9fbc29Smrg fi 13218c9fbc29Smrg 13228c9fbc29Smrg # Non-PIC object. 13238c9fbc29Smrg if test "$non_pic_object" != none; then 13248c9fbc29Smrg # Prepend the subdirectory the object is found in. 13258c9fbc29Smrg non_pic_object="$xdir$non_pic_object" 13268c9fbc29Smrg 13278c9fbc29Smrg # A standard non-PIC object 13288c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 13298c9fbc29Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 13308c9fbc29Smrg arg="$non_pic_object" 13318c9fbc29Smrg fi 13328c9fbc29Smrg else 13338c9fbc29Smrg # If the PIC object exists, use it instead. 13348c9fbc29Smrg # $xdir was prepended to $pic_object above. 13358c9fbc29Smrg non_pic_object="$pic_object" 13368c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 13378c9fbc29Smrg fi 13388c9fbc29Smrg else 13398c9fbc29Smrg # Only an error if not doing a dry-run. 13408c9fbc29Smrg if test -z "$run"; then 13418c9fbc29Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 13428c9fbc29Smrg exit $EXIT_FAILURE 13438c9fbc29Smrg else 13448c9fbc29Smrg # Dry-run case. 13458c9fbc29Smrg 13468c9fbc29Smrg # Extract subdirectory from the argument. 13478c9fbc29Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13488c9fbc29Smrg if test "X$xdir" = "X$arg"; then 13498c9fbc29Smrg xdir= 13508c9fbc29Smrg else 13518c9fbc29Smrg xdir="$xdir/" 13528c9fbc29Smrg fi 13538c9fbc29Smrg 13548c9fbc29Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 13558c9fbc29Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 13568c9fbc29Smrg libobjs="$libobjs $pic_object" 13578c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 13588c9fbc29Smrg fi 13598c9fbc29Smrg fi 13608c9fbc29Smrg done 13618c9fbc29Smrg else 13628c9fbc29Smrg $echo "$modename: link input file \`$save_arg' does not exist" 13638c9fbc29Smrg exit $EXIT_FAILURE 13648c9fbc29Smrg fi 13658c9fbc29Smrg arg=$save_arg 13668c9fbc29Smrg prev= 13678c9fbc29Smrg continue 13688c9fbc29Smrg ;; 13698c9fbc29Smrg rpath | xrpath) 13708c9fbc29Smrg # We need an absolute path. 13718c9fbc29Smrg case $arg in 13728c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 13738c9fbc29Smrg *) 13748c9fbc29Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 13758c9fbc29Smrg exit $EXIT_FAILURE 13768c9fbc29Smrg ;; 13778c9fbc29Smrg esac 13788c9fbc29Smrg if test "$prev" = rpath; then 13798c9fbc29Smrg case "$rpath " in 13808c9fbc29Smrg *" $arg "*) ;; 13818c9fbc29Smrg *) rpath="$rpath $arg" ;; 13828c9fbc29Smrg esac 13838c9fbc29Smrg else 13848c9fbc29Smrg case "$xrpath " in 13858c9fbc29Smrg *" $arg "*) ;; 13868c9fbc29Smrg *) xrpath="$xrpath $arg" ;; 13878c9fbc29Smrg esac 13888c9fbc29Smrg fi 13898c9fbc29Smrg prev= 13908c9fbc29Smrg continue 13918c9fbc29Smrg ;; 13928c9fbc29Smrg xcompiler) 13938c9fbc29Smrg compiler_flags="$compiler_flags $qarg" 13948c9fbc29Smrg prev= 13958c9fbc29Smrg compile_command="$compile_command $qarg" 13968c9fbc29Smrg finalize_command="$finalize_command $qarg" 13978c9fbc29Smrg continue 13988c9fbc29Smrg ;; 13998c9fbc29Smrg xlinker) 14008c9fbc29Smrg linker_flags="$linker_flags $qarg" 14018c9fbc29Smrg compiler_flags="$compiler_flags $wl$qarg" 14028c9fbc29Smrg prev= 14038c9fbc29Smrg compile_command="$compile_command $wl$qarg" 14048c9fbc29Smrg finalize_command="$finalize_command $wl$qarg" 14058c9fbc29Smrg continue 14068c9fbc29Smrg ;; 14078c9fbc29Smrg xcclinker) 14088c9fbc29Smrg linker_flags="$linker_flags $qarg" 14098c9fbc29Smrg compiler_flags="$compiler_flags $qarg" 14108c9fbc29Smrg prev= 14118c9fbc29Smrg compile_command="$compile_command $qarg" 14128c9fbc29Smrg finalize_command="$finalize_command $qarg" 14138c9fbc29Smrg continue 14148c9fbc29Smrg ;; 14158c9fbc29Smrg shrext) 14168c9fbc29Smrg shrext_cmds="$arg" 14178c9fbc29Smrg prev= 14188c9fbc29Smrg continue 14198c9fbc29Smrg ;; 14208c9fbc29Smrg darwin_framework|darwin_framework_skip) 14218c9fbc29Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 14228c9fbc29Smrg compile_command="$compile_command $arg" 14238c9fbc29Smrg finalize_command="$finalize_command $arg" 14248c9fbc29Smrg prev= 14258c9fbc29Smrg continue 14268c9fbc29Smrg ;; 14278c9fbc29Smrg *) 14288c9fbc29Smrg eval "$prev=\"\$arg\"" 14298c9fbc29Smrg prev= 14308c9fbc29Smrg continue 14318c9fbc29Smrg ;; 14328c9fbc29Smrg esac 14338c9fbc29Smrg fi # test -n "$prev" 14348c9fbc29Smrg 14358c9fbc29Smrg prevarg="$arg" 14368c9fbc29Smrg 14378c9fbc29Smrg case $arg in 14388c9fbc29Smrg -all-static) 14398c9fbc29Smrg if test -n "$link_static_flag"; then 14408c9fbc29Smrg compile_command="$compile_command $link_static_flag" 14418c9fbc29Smrg finalize_command="$finalize_command $link_static_flag" 14428c9fbc29Smrg fi 14438c9fbc29Smrg continue 14448c9fbc29Smrg ;; 14458c9fbc29Smrg 14468c9fbc29Smrg -allow-undefined) 14478c9fbc29Smrg # FIXME: remove this flag sometime in the future. 14488c9fbc29Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 14498c9fbc29Smrg continue 14508c9fbc29Smrg ;; 14518c9fbc29Smrg 14528c9fbc29Smrg -avoid-version) 14538c9fbc29Smrg avoid_version=yes 14548c9fbc29Smrg continue 14558c9fbc29Smrg ;; 14568c9fbc29Smrg 14578c9fbc29Smrg -dlopen) 14588c9fbc29Smrg prev=dlfiles 14598c9fbc29Smrg continue 14608c9fbc29Smrg ;; 14618c9fbc29Smrg 14628c9fbc29Smrg -dlpreopen) 14638c9fbc29Smrg prev=dlprefiles 14648c9fbc29Smrg continue 14658c9fbc29Smrg ;; 14668c9fbc29Smrg 14678c9fbc29Smrg -export-dynamic) 14688c9fbc29Smrg export_dynamic=yes 14698c9fbc29Smrg continue 14708c9fbc29Smrg ;; 14718c9fbc29Smrg 14728c9fbc29Smrg -export-symbols | -export-symbols-regex) 14738c9fbc29Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 14748c9fbc29Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 14758c9fbc29Smrg exit $EXIT_FAILURE 14768c9fbc29Smrg fi 14778c9fbc29Smrg if test "X$arg" = "X-export-symbols"; then 14788c9fbc29Smrg prev=expsyms 14798c9fbc29Smrg else 14808c9fbc29Smrg prev=expsyms_regex 14818c9fbc29Smrg fi 14828c9fbc29Smrg continue 14838c9fbc29Smrg ;; 14848c9fbc29Smrg 14858c9fbc29Smrg -framework|-arch|-isysroot) 14868c9fbc29Smrg case " $CC " in 14878c9fbc29Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 14888c9fbc29Smrg prev=darwin_framework_skip ;; 14898c9fbc29Smrg *) compiler_flags="$compiler_flags $arg" 14908c9fbc29Smrg prev=darwin_framework ;; 14918c9fbc29Smrg esac 14928c9fbc29Smrg compile_command="$compile_command $arg" 14938c9fbc29Smrg finalize_command="$finalize_command $arg" 14948c9fbc29Smrg continue 14958c9fbc29Smrg ;; 14968c9fbc29Smrg 14978c9fbc29Smrg -inst-prefix-dir) 14988c9fbc29Smrg prev=inst_prefix 14998c9fbc29Smrg continue 15008c9fbc29Smrg ;; 15018c9fbc29Smrg 15028c9fbc29Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 15038c9fbc29Smrg # so, if we see these flags be careful not to treat them like -L 15048c9fbc29Smrg -L[A-Z][A-Z]*:*) 15058c9fbc29Smrg case $with_gcc/$host in 15068c9fbc29Smrg no/*-*-irix* | /*-*-irix*) 15078c9fbc29Smrg compile_command="$compile_command $arg" 15088c9fbc29Smrg finalize_command="$finalize_command $arg" 15098c9fbc29Smrg ;; 15108c9fbc29Smrg esac 15118c9fbc29Smrg continue 15128c9fbc29Smrg ;; 15138c9fbc29Smrg 15148c9fbc29Smrg -L*) 15158c9fbc29Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 15168c9fbc29Smrg # We need an absolute path. 15178c9fbc29Smrg case $dir in 15188c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 15198c9fbc29Smrg *) 15208c9fbc29Smrg absdir=`cd "$dir" && pwd` 15218c9fbc29Smrg if test -z "$absdir"; then 15228c9fbc29Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 15238c9fbc29Smrg absdir="$dir" 15248c9fbc29Smrg notinst_path="$notinst_path $dir" 15258c9fbc29Smrg fi 15268c9fbc29Smrg dir="$absdir" 15278c9fbc29Smrg ;; 15288c9fbc29Smrg esac 15298c9fbc29Smrg case "$deplibs " in 15308c9fbc29Smrg *" -L$dir "*) ;; 15318c9fbc29Smrg *) 15328c9fbc29Smrg deplibs="$deplibs -L$dir" 15338c9fbc29Smrg lib_search_path="$lib_search_path $dir" 15348c9fbc29Smrg ;; 15358c9fbc29Smrg esac 15368c9fbc29Smrg case $host in 15378c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 15388c9fbc29Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 15398c9fbc29Smrg case :$dllsearchpath: in 15408c9fbc29Smrg *":$dir:"*) ;; 15418c9fbc29Smrg *) dllsearchpath="$dllsearchpath:$dir";; 15428c9fbc29Smrg esac 15438c9fbc29Smrg case :$dllsearchpath: in 15448c9fbc29Smrg *":$testbindir:"*) ;; 15458c9fbc29Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 15468c9fbc29Smrg esac 15478c9fbc29Smrg ;; 15488c9fbc29Smrg esac 15498c9fbc29Smrg continue 15508c9fbc29Smrg ;; 15518c9fbc29Smrg 15528c9fbc29Smrg -l*) 15538c9fbc29Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 15548c9fbc29Smrg case $host in 15558c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 15568c9fbc29Smrg # These systems don't actually have a C or math library (as such) 15578c9fbc29Smrg continue 15588c9fbc29Smrg ;; 15598c9fbc29Smrg *-*-os2*) 15608c9fbc29Smrg # These systems don't actually have a C library (as such) 15618c9fbc29Smrg test "X$arg" = "X-lc" && continue 15628c9fbc29Smrg ;; 15638c9fbc29Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 15648c9fbc29Smrg # Do not include libc due to us having libc/libc_r. 15658c9fbc29Smrg test "X$arg" = "X-lc" && continue 15668c9fbc29Smrg ;; 15678c9fbc29Smrg *-*-rhapsody* | *-*-darwin1.[012]) 15688c9fbc29Smrg # Rhapsody C and math libraries are in the System framework 15698c9fbc29Smrg deplibs="$deplibs -framework System" 15708c9fbc29Smrg continue 15718c9fbc29Smrg ;; 15728c9fbc29Smrg *-*-sco3.2v5* | *-*-sco5v6*) 15738c9fbc29Smrg # Causes problems with __ctype 15748c9fbc29Smrg test "X$arg" = "X-lc" && continue 15758c9fbc29Smrg ;; 15768c9fbc29Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 15778c9fbc29Smrg # Compiler inserts libc in the correct place for threads to work 15788c9fbc29Smrg test "X$arg" = "X-lc" && continue 15798c9fbc29Smrg ;; 15808c9fbc29Smrg esac 15818c9fbc29Smrg elif test "X$arg" = "X-lc_r"; then 15828c9fbc29Smrg case $host in 15838c9fbc29Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 15848c9fbc29Smrg # Do not include libc_r directly, use -pthread flag. 15858c9fbc29Smrg continue 15868c9fbc29Smrg ;; 15878c9fbc29Smrg esac 15888c9fbc29Smrg fi 15898c9fbc29Smrg deplibs="$deplibs $arg" 15908c9fbc29Smrg continue 15918c9fbc29Smrg ;; 15928c9fbc29Smrg 15938c9fbc29Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 15948c9fbc29Smrg # classes, name mangling, and exception handling. 15958c9fbc29Smrg -model) 15968c9fbc29Smrg compile_command="$compile_command $arg" 15978c9fbc29Smrg compiler_flags="$compiler_flags $arg" 15988c9fbc29Smrg finalize_command="$finalize_command $arg" 15998c9fbc29Smrg prev=xcompiler 16008c9fbc29Smrg continue 16018c9fbc29Smrg ;; 16028c9fbc29Smrg 16038c9fbc29Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 16048c9fbc29Smrg compiler_flags="$compiler_flags $arg" 16058c9fbc29Smrg compile_command="$compile_command $arg" 16068c9fbc29Smrg finalize_command="$finalize_command $arg" 16078c9fbc29Smrg continue 16088c9fbc29Smrg ;; 16098c9fbc29Smrg 16108c9fbc29Smrg -module) 16118c9fbc29Smrg module=yes 16128c9fbc29Smrg continue 16138c9fbc29Smrg ;; 16148c9fbc29Smrg 16158c9fbc29Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 16168c9fbc29Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 16178c9fbc29Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 16188c9fbc29Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 16198c9fbc29Smrg # -q* pass through compiler args for the IBM compiler 16208c9fbc29Smrg # -m* pass through architecture-specific compiler args for GCC 16218c9fbc29Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 16228c9fbc29Smrg # compiler args for GCC 16238c9fbc29Smrg # -pg pass through profiling flag for GCC 16248c9fbc29Smrg # @file GCC response files 16258c9fbc29Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 16268c9fbc29Smrg -t[45]*|-txscale*|@*) 16278c9fbc29Smrg 16288c9fbc29Smrg # Unknown arguments in both finalize_command and compile_command need 16298c9fbc29Smrg # to be aesthetically quoted because they are evaled later. 16308c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 16318c9fbc29Smrg case $arg in 16328c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 16338c9fbc29Smrg arg="\"$arg\"" 16348c9fbc29Smrg ;; 16358c9fbc29Smrg esac 16368c9fbc29Smrg compile_command="$compile_command $arg" 16378c9fbc29Smrg finalize_command="$finalize_command $arg" 16388c9fbc29Smrg compiler_flags="$compiler_flags $arg" 16398c9fbc29Smrg continue 16408c9fbc29Smrg ;; 16418c9fbc29Smrg 16428c9fbc29Smrg -shrext) 16438c9fbc29Smrg prev=shrext 16448c9fbc29Smrg continue 16458c9fbc29Smrg ;; 16468c9fbc29Smrg 16478c9fbc29Smrg -no-fast-install) 16488c9fbc29Smrg fast_install=no 16498c9fbc29Smrg continue 16508c9fbc29Smrg ;; 16518c9fbc29Smrg 16528c9fbc29Smrg -no-install) 16538c9fbc29Smrg case $host in 16548c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 16558c9fbc29Smrg # The PATH hackery in wrapper scripts is required on Windows 16568c9fbc29Smrg # in order for the loader to find any dlls it needs. 16578c9fbc29Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 16588c9fbc29Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 16598c9fbc29Smrg fast_install=no 16608c9fbc29Smrg ;; 16618c9fbc29Smrg *) no_install=yes ;; 16628c9fbc29Smrg esac 16638c9fbc29Smrg continue 16648c9fbc29Smrg ;; 16658c9fbc29Smrg 16668c9fbc29Smrg -no-undefined) 16678c9fbc29Smrg allow_undefined=no 16688c9fbc29Smrg continue 16698c9fbc29Smrg ;; 16708c9fbc29Smrg 16718c9fbc29Smrg -objectlist) 16728c9fbc29Smrg prev=objectlist 16738c9fbc29Smrg continue 16748c9fbc29Smrg ;; 16758c9fbc29Smrg 16768c9fbc29Smrg -o) prev=output ;; 16778c9fbc29Smrg 16788c9fbc29Smrg -precious-files-regex) 16798c9fbc29Smrg prev=precious_regex 16808c9fbc29Smrg continue 16818c9fbc29Smrg ;; 16828c9fbc29Smrg 16838c9fbc29Smrg -release) 16848c9fbc29Smrg prev=release 16858c9fbc29Smrg continue 16868c9fbc29Smrg ;; 16878c9fbc29Smrg 16888c9fbc29Smrg -rpath) 16898c9fbc29Smrg prev=rpath 16908c9fbc29Smrg continue 16918c9fbc29Smrg ;; 16928c9fbc29Smrg 16938c9fbc29Smrg -R) 16948c9fbc29Smrg prev=xrpath 16958c9fbc29Smrg continue 16968c9fbc29Smrg ;; 16978c9fbc29Smrg 16988c9fbc29Smrg -R*) 16998c9fbc29Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 17008c9fbc29Smrg # We need an absolute path. 17018c9fbc29Smrg case $dir in 17028c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 17038c9fbc29Smrg *) 17048c9fbc29Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 17058c9fbc29Smrg exit $EXIT_FAILURE 17068c9fbc29Smrg ;; 17078c9fbc29Smrg esac 17088c9fbc29Smrg case "$xrpath " in 17098c9fbc29Smrg *" $dir "*) ;; 17108c9fbc29Smrg *) xrpath="$xrpath $dir" ;; 17118c9fbc29Smrg esac 17128c9fbc29Smrg continue 17138c9fbc29Smrg ;; 17148c9fbc29Smrg 17158c9fbc29Smrg -static) 17168c9fbc29Smrg # The effects of -static are defined in a previous loop. 17178c9fbc29Smrg # We used to do the same as -all-static on platforms that 17188c9fbc29Smrg # didn't have a PIC flag, but the assumption that the effects 17198c9fbc29Smrg # would be equivalent was wrong. It would break on at least 17208c9fbc29Smrg # Digital Unix and AIX. 17218c9fbc29Smrg continue 17228c9fbc29Smrg ;; 17238c9fbc29Smrg 17248c9fbc29Smrg -thread-safe) 17258c9fbc29Smrg thread_safe=yes 17268c9fbc29Smrg continue 17278c9fbc29Smrg ;; 17288c9fbc29Smrg 17298c9fbc29Smrg -version-info) 17308c9fbc29Smrg prev=vinfo 17318c9fbc29Smrg continue 17328c9fbc29Smrg ;; 17338c9fbc29Smrg -version-number) 17348c9fbc29Smrg prev=vinfo 17358c9fbc29Smrg vinfo_number=yes 17368c9fbc29Smrg continue 17378c9fbc29Smrg ;; 17388c9fbc29Smrg 17398c9fbc29Smrg -Wc,*) 17408c9fbc29Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 17418c9fbc29Smrg arg= 17428c9fbc29Smrg save_ifs="$IFS"; IFS=',' 17438c9fbc29Smrg for flag in $args; do 17448c9fbc29Smrg IFS="$save_ifs" 17458c9fbc29Smrg case $flag in 17468c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 17478c9fbc29Smrg flag="\"$flag\"" 17488c9fbc29Smrg ;; 17498c9fbc29Smrg esac 17508c9fbc29Smrg arg="$arg $wl$flag" 17518c9fbc29Smrg compiler_flags="$compiler_flags $flag" 17528c9fbc29Smrg done 17538c9fbc29Smrg IFS="$save_ifs" 17548c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 17558c9fbc29Smrg ;; 17568c9fbc29Smrg 17578c9fbc29Smrg -Wl,*) 17588c9fbc29Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 17598c9fbc29Smrg arg= 17608c9fbc29Smrg save_ifs="$IFS"; IFS=',' 17618c9fbc29Smrg for flag in $args; do 17628c9fbc29Smrg IFS="$save_ifs" 17638c9fbc29Smrg case $flag in 17648c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 17658c9fbc29Smrg flag="\"$flag\"" 17668c9fbc29Smrg ;; 17678c9fbc29Smrg esac 17688c9fbc29Smrg arg="$arg $wl$flag" 17698c9fbc29Smrg compiler_flags="$compiler_flags $wl$flag" 17708c9fbc29Smrg linker_flags="$linker_flags $flag" 17718c9fbc29Smrg done 17728c9fbc29Smrg IFS="$save_ifs" 17738c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 17748c9fbc29Smrg ;; 17758c9fbc29Smrg 17768c9fbc29Smrg -Xcompiler) 17778c9fbc29Smrg prev=xcompiler 17788c9fbc29Smrg continue 17798c9fbc29Smrg ;; 17808c9fbc29Smrg 17818c9fbc29Smrg -Xlinker) 17828c9fbc29Smrg prev=xlinker 17838c9fbc29Smrg continue 17848c9fbc29Smrg ;; 17858c9fbc29Smrg 17868c9fbc29Smrg -XCClinker) 17878c9fbc29Smrg prev=xcclinker 17888c9fbc29Smrg continue 17898c9fbc29Smrg ;; 17908c9fbc29Smrg 17918c9fbc29Smrg # Some other compiler flag. 17928c9fbc29Smrg -* | +*) 17938c9fbc29Smrg # Unknown arguments in both finalize_command and compile_command need 17948c9fbc29Smrg # to be aesthetically quoted because they are evaled later. 17958c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 17968c9fbc29Smrg case $arg in 17978c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 17988c9fbc29Smrg arg="\"$arg\"" 17998c9fbc29Smrg ;; 18008c9fbc29Smrg esac 18018c9fbc29Smrg ;; 18028c9fbc29Smrg 18038c9fbc29Smrg *.$objext) 18048c9fbc29Smrg # A standard object. 18058c9fbc29Smrg objs="$objs $arg" 18068c9fbc29Smrg ;; 18078c9fbc29Smrg 18088c9fbc29Smrg *.lo) 18098c9fbc29Smrg # A libtool-controlled object. 18108c9fbc29Smrg 18118c9fbc29Smrg # Check to see that this really is a libtool object. 18128c9fbc29Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 18138c9fbc29Smrg pic_object= 18148c9fbc29Smrg non_pic_object= 18158c9fbc29Smrg 18168c9fbc29Smrg # Read the .lo file 18178c9fbc29Smrg # If there is no directory component, then add one. 18188c9fbc29Smrg case $arg in 18198c9fbc29Smrg */* | *\\*) . $arg ;; 18208c9fbc29Smrg *) . ./$arg ;; 18218c9fbc29Smrg esac 18228c9fbc29Smrg 18238c9fbc29Smrg if test -z "$pic_object" || \ 18248c9fbc29Smrg test -z "$non_pic_object" || 18258c9fbc29Smrg test "$pic_object" = none && \ 18268c9fbc29Smrg test "$non_pic_object" = none; then 18278c9fbc29Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 18288c9fbc29Smrg exit $EXIT_FAILURE 18298c9fbc29Smrg fi 18308c9fbc29Smrg 18318c9fbc29Smrg # Extract subdirectory from the argument. 18328c9fbc29Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18338c9fbc29Smrg if test "X$xdir" = "X$arg"; then 18348c9fbc29Smrg xdir= 18358c9fbc29Smrg else 18368c9fbc29Smrg xdir="$xdir/" 18378c9fbc29Smrg fi 18388c9fbc29Smrg 18398c9fbc29Smrg if test "$pic_object" != none; then 18408c9fbc29Smrg # Prepend the subdirectory the object is found in. 18418c9fbc29Smrg pic_object="$xdir$pic_object" 18428c9fbc29Smrg 18438c9fbc29Smrg if test "$prev" = dlfiles; then 18448c9fbc29Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 18458c9fbc29Smrg dlfiles="$dlfiles $pic_object" 18468c9fbc29Smrg prev= 18478c9fbc29Smrg continue 18488c9fbc29Smrg else 18498c9fbc29Smrg # If libtool objects are unsupported, then we need to preload. 18508c9fbc29Smrg prev=dlprefiles 18518c9fbc29Smrg fi 18528c9fbc29Smrg fi 18538c9fbc29Smrg 18548c9fbc29Smrg # CHECK ME: I think I busted this. -Ossama 18558c9fbc29Smrg if test "$prev" = dlprefiles; then 18568c9fbc29Smrg # Preload the old-style object. 18578c9fbc29Smrg dlprefiles="$dlprefiles $pic_object" 18588c9fbc29Smrg prev= 18598c9fbc29Smrg fi 18608c9fbc29Smrg 18618c9fbc29Smrg # A PIC object. 18628c9fbc29Smrg libobjs="$libobjs $pic_object" 18638c9fbc29Smrg arg="$pic_object" 18648c9fbc29Smrg fi 18658c9fbc29Smrg 18668c9fbc29Smrg # Non-PIC object. 18678c9fbc29Smrg if test "$non_pic_object" != none; then 18688c9fbc29Smrg # Prepend the subdirectory the object is found in. 18698c9fbc29Smrg non_pic_object="$xdir$non_pic_object" 18708c9fbc29Smrg 18718c9fbc29Smrg # A standard non-PIC object 18728c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 18738c9fbc29Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 18748c9fbc29Smrg arg="$non_pic_object" 18758c9fbc29Smrg fi 18768c9fbc29Smrg else 18778c9fbc29Smrg # If the PIC object exists, use it instead. 18788c9fbc29Smrg # $xdir was prepended to $pic_object above. 18798c9fbc29Smrg non_pic_object="$pic_object" 18808c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 18818c9fbc29Smrg fi 18828c9fbc29Smrg else 18838c9fbc29Smrg # Only an error if not doing a dry-run. 18848c9fbc29Smrg if test -z "$run"; then 18858c9fbc29Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 18868c9fbc29Smrg exit $EXIT_FAILURE 18878c9fbc29Smrg else 18888c9fbc29Smrg # Dry-run case. 18898c9fbc29Smrg 18908c9fbc29Smrg # Extract subdirectory from the argument. 18918c9fbc29Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18928c9fbc29Smrg if test "X$xdir" = "X$arg"; then 18938c9fbc29Smrg xdir= 18948c9fbc29Smrg else 18958c9fbc29Smrg xdir="$xdir/" 18968c9fbc29Smrg fi 18978c9fbc29Smrg 18988c9fbc29Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 18998c9fbc29Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 19008c9fbc29Smrg libobjs="$libobjs $pic_object" 19018c9fbc29Smrg non_pic_objects="$non_pic_objects $non_pic_object" 19028c9fbc29Smrg fi 19038c9fbc29Smrg fi 19048c9fbc29Smrg ;; 19058c9fbc29Smrg 19068c9fbc29Smrg *.$libext) 19078c9fbc29Smrg # An archive. 19088c9fbc29Smrg deplibs="$deplibs $arg" 19098c9fbc29Smrg old_deplibs="$old_deplibs $arg" 19108c9fbc29Smrg continue 19118c9fbc29Smrg ;; 19128c9fbc29Smrg 19138c9fbc29Smrg *.la) 19148c9fbc29Smrg # A libtool-controlled library. 19158c9fbc29Smrg 19168c9fbc29Smrg if test "$prev" = dlfiles; then 19178c9fbc29Smrg # This library was specified with -dlopen. 19188c9fbc29Smrg dlfiles="$dlfiles $arg" 19198c9fbc29Smrg prev= 19208c9fbc29Smrg elif test "$prev" = dlprefiles; then 19218c9fbc29Smrg # The library was specified with -dlpreopen. 19228c9fbc29Smrg dlprefiles="$dlprefiles $arg" 19238c9fbc29Smrg prev= 19248c9fbc29Smrg else 19258c9fbc29Smrg deplibs="$deplibs $arg" 19268c9fbc29Smrg fi 19278c9fbc29Smrg continue 19288c9fbc29Smrg ;; 19298c9fbc29Smrg 19308c9fbc29Smrg # Some other compiler argument. 19318c9fbc29Smrg *) 19328c9fbc29Smrg # Unknown arguments in both finalize_command and compile_command need 19338c9fbc29Smrg # to be aesthetically quoted because they are evaled later. 19348c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 19358c9fbc29Smrg case $arg in 19368c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19378c9fbc29Smrg arg="\"$arg\"" 19388c9fbc29Smrg ;; 19398c9fbc29Smrg esac 19408c9fbc29Smrg ;; 19418c9fbc29Smrg esac # arg 19428c9fbc29Smrg 19438c9fbc29Smrg # Now actually substitute the argument into the commands. 19448c9fbc29Smrg if test -n "$arg"; then 19458c9fbc29Smrg compile_command="$compile_command $arg" 19468c9fbc29Smrg finalize_command="$finalize_command $arg" 19478c9fbc29Smrg fi 19488c9fbc29Smrg done # argument parsing loop 19498c9fbc29Smrg 19508c9fbc29Smrg if test -n "$prev"; then 19518c9fbc29Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 19528c9fbc29Smrg $echo "$help" 1>&2 19538c9fbc29Smrg exit $EXIT_FAILURE 19548c9fbc29Smrg fi 19558c9fbc29Smrg 19568c9fbc29Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 19578c9fbc29Smrg eval arg=\"$export_dynamic_flag_spec\" 19588c9fbc29Smrg compile_command="$compile_command $arg" 19598c9fbc29Smrg finalize_command="$finalize_command $arg" 19608c9fbc29Smrg fi 19618c9fbc29Smrg 19628c9fbc29Smrg oldlibs= 19638c9fbc29Smrg # calculate the name of the file, without its directory 19648c9fbc29Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 19658c9fbc29Smrg libobjs_save="$libobjs" 19668c9fbc29Smrg 19678c9fbc29Smrg if test -n "$shlibpath_var"; then 19688c9fbc29Smrg # get the directories listed in $shlibpath_var 19698c9fbc29Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 19708c9fbc29Smrg else 19718c9fbc29Smrg shlib_search_path= 19728c9fbc29Smrg fi 19738c9fbc29Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 19748c9fbc29Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 19758c9fbc29Smrg 19768c9fbc29Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 19778c9fbc29Smrg if test "X$output_objdir" = "X$output"; then 19788c9fbc29Smrg output_objdir="$objdir" 19798c9fbc29Smrg else 19808c9fbc29Smrg output_objdir="$output_objdir/$objdir" 19818c9fbc29Smrg fi 19828c9fbc29Smrg # Create the object directory. 19838c9fbc29Smrg if test ! -d "$output_objdir"; then 19848c9fbc29Smrg $show "$mkdir $output_objdir" 19858c9fbc29Smrg $run $mkdir $output_objdir 19868c9fbc29Smrg exit_status=$? 19878c9fbc29Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 19888c9fbc29Smrg exit $exit_status 19898c9fbc29Smrg fi 19908c9fbc29Smrg fi 19918c9fbc29Smrg 19928c9fbc29Smrg # Determine the type of output 19938c9fbc29Smrg case $output in 19948c9fbc29Smrg "") 19958c9fbc29Smrg $echo "$modename: you must specify an output file" 1>&2 19968c9fbc29Smrg $echo "$help" 1>&2 19978c9fbc29Smrg exit $EXIT_FAILURE 19988c9fbc29Smrg ;; 19998c9fbc29Smrg *.$libext) linkmode=oldlib ;; 20008c9fbc29Smrg *.lo | *.$objext) linkmode=obj ;; 20018c9fbc29Smrg *.la) linkmode=lib ;; 20028c9fbc29Smrg *) linkmode=prog ;; # Anything else should be a program. 20038c9fbc29Smrg esac 20048c9fbc29Smrg 20058c9fbc29Smrg case $host in 20068c9fbc29Smrg *cygwin* | *mingw* | *pw32*) 20078c9fbc29Smrg # don't eliminate duplications in $postdeps and $predeps 20088c9fbc29Smrg duplicate_compiler_generated_deps=yes 20098c9fbc29Smrg ;; 20108c9fbc29Smrg *) 20118c9fbc29Smrg duplicate_compiler_generated_deps=$duplicate_deps 20128c9fbc29Smrg ;; 20138c9fbc29Smrg esac 20148c9fbc29Smrg specialdeplibs= 20158c9fbc29Smrg 20168c9fbc29Smrg libs= 20178c9fbc29Smrg # Find all interdependent deplibs by searching for libraries 20188c9fbc29Smrg # that are linked more than once (e.g. -la -lb -la) 20198c9fbc29Smrg for deplib in $deplibs; do 20208c9fbc29Smrg if test "X$duplicate_deps" = "Xyes" ; then 20218c9fbc29Smrg case "$libs " in 20228c9fbc29Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 20238c9fbc29Smrg esac 20248c9fbc29Smrg fi 20258c9fbc29Smrg libs="$libs $deplib" 20268c9fbc29Smrg done 20278c9fbc29Smrg 20288c9fbc29Smrg if test "$linkmode" = lib; then 20298c9fbc29Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 20308c9fbc29Smrg 20318c9fbc29Smrg # Compute libraries that are listed more than once in $predeps 20328c9fbc29Smrg # $postdeps and mark them as special (i.e., whose duplicates are 20338c9fbc29Smrg # not to be eliminated). 20348c9fbc29Smrg pre_post_deps= 20358c9fbc29Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 20368c9fbc29Smrg for pre_post_dep in $predeps $postdeps; do 20378c9fbc29Smrg case "$pre_post_deps " in 20388c9fbc29Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 20398c9fbc29Smrg esac 20408c9fbc29Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 20418c9fbc29Smrg done 20428c9fbc29Smrg fi 20438c9fbc29Smrg pre_post_deps= 20448c9fbc29Smrg fi 20458c9fbc29Smrg 20468c9fbc29Smrg deplibs= 20478c9fbc29Smrg newdependency_libs= 20488c9fbc29Smrg newlib_search_path= 20498c9fbc29Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 20508c9fbc29Smrg notinst_deplibs= # not-installed libtool libraries 20518c9fbc29Smrg case $linkmode in 20528c9fbc29Smrg lib) 20538c9fbc29Smrg passes="conv link" 20548c9fbc29Smrg for file in $dlfiles $dlprefiles; do 20558c9fbc29Smrg case $file in 20568c9fbc29Smrg *.la) ;; 20578c9fbc29Smrg *) 20588c9fbc29Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 20598c9fbc29Smrg exit $EXIT_FAILURE 20608c9fbc29Smrg ;; 20618c9fbc29Smrg esac 20628c9fbc29Smrg done 20638c9fbc29Smrg ;; 20648c9fbc29Smrg prog) 20658c9fbc29Smrg compile_deplibs= 20668c9fbc29Smrg finalize_deplibs= 20678c9fbc29Smrg alldeplibs=no 20688c9fbc29Smrg newdlfiles= 20698c9fbc29Smrg newdlprefiles= 20708c9fbc29Smrg passes="conv scan dlopen dlpreopen link" 20718c9fbc29Smrg ;; 20728c9fbc29Smrg *) passes="conv" 20738c9fbc29Smrg ;; 20748c9fbc29Smrg esac 20758c9fbc29Smrg for pass in $passes; do 20768c9fbc29Smrg if test "$linkmode,$pass" = "lib,link" || 20778c9fbc29Smrg test "$linkmode,$pass" = "prog,scan"; then 20788c9fbc29Smrg libs="$deplibs" 20798c9fbc29Smrg deplibs= 20808c9fbc29Smrg fi 20818c9fbc29Smrg if test "$linkmode" = prog; then 20828c9fbc29Smrg case $pass in 20838c9fbc29Smrg dlopen) libs="$dlfiles" ;; 20848c9fbc29Smrg dlpreopen) libs="$dlprefiles" ;; 20858c9fbc29Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 20868c9fbc29Smrg esac 20878c9fbc29Smrg fi 20888c9fbc29Smrg if test "$pass" = dlopen; then 20898c9fbc29Smrg # Collect dlpreopened libraries 20908c9fbc29Smrg save_deplibs="$deplibs" 20918c9fbc29Smrg deplibs= 20928c9fbc29Smrg fi 20938c9fbc29Smrg for deplib in $libs; do 20948c9fbc29Smrg lib= 20958c9fbc29Smrg found=no 20968c9fbc29Smrg case $deplib in 20978c9fbc29Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 20988c9fbc29Smrg if test "$linkmode,$pass" = "prog,link"; then 20998c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 21008c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 21018c9fbc29Smrg else 21028c9fbc29Smrg compiler_flags="$compiler_flags $deplib" 21038c9fbc29Smrg fi 21048c9fbc29Smrg continue 21058c9fbc29Smrg ;; 21068c9fbc29Smrg -l*) 21078c9fbc29Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 21088c9fbc29Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 21098c9fbc29Smrg continue 21108c9fbc29Smrg fi 21118c9fbc29Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21128c9fbc29Smrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 21138c9fbc29Smrg for search_ext in .la $std_shrext .so .a; do 21148c9fbc29Smrg # Search the libtool library 21158c9fbc29Smrg lib="$searchdir/lib${name}${search_ext}" 21168c9fbc29Smrg if test -f "$lib"; then 21178c9fbc29Smrg if test "$search_ext" = ".la"; then 21188c9fbc29Smrg found=yes 21198c9fbc29Smrg else 21208c9fbc29Smrg found=no 21218c9fbc29Smrg fi 21228c9fbc29Smrg break 2 21238c9fbc29Smrg fi 21248c9fbc29Smrg done 21258c9fbc29Smrg done 21268c9fbc29Smrg if test "$found" != yes; then 21278c9fbc29Smrg # deplib doesn't seem to be a libtool library 21288c9fbc29Smrg if test "$linkmode,$pass" = "prog,link"; then 21298c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 21308c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 21318c9fbc29Smrg else 21328c9fbc29Smrg deplibs="$deplib $deplibs" 21338c9fbc29Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21348c9fbc29Smrg fi 21358c9fbc29Smrg continue 21368c9fbc29Smrg else # deplib is a libtool library 21378c9fbc29Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 21388c9fbc29Smrg # We need to do some special things here, and not later. 21398c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 21408c9fbc29Smrg case " $predeps $postdeps " in 21418c9fbc29Smrg *" $deplib "*) 21428c9fbc29Smrg if (${SED} -e '2q' $lib | 21438c9fbc29Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 21448c9fbc29Smrg library_names= 21458c9fbc29Smrg old_library= 21468c9fbc29Smrg case $lib in 21478c9fbc29Smrg */* | *\\*) . $lib ;; 21488c9fbc29Smrg *) . ./$lib ;; 21498c9fbc29Smrg esac 21508c9fbc29Smrg for l in $old_library $library_names; do 21518c9fbc29Smrg ll="$l" 21528c9fbc29Smrg done 21538c9fbc29Smrg if test "X$ll" = "X$old_library" ; then # only static version available 21548c9fbc29Smrg found=no 21558c9fbc29Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 21568c9fbc29Smrg test "X$ladir" = "X$lib" && ladir="." 21578c9fbc29Smrg lib=$ladir/$old_library 21588c9fbc29Smrg if test "$linkmode,$pass" = "prog,link"; then 21598c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 21608c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 21618c9fbc29Smrg else 21628c9fbc29Smrg deplibs="$deplib $deplibs" 21638c9fbc29Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21648c9fbc29Smrg fi 21658c9fbc29Smrg continue 21668c9fbc29Smrg fi 21678c9fbc29Smrg fi 21688c9fbc29Smrg ;; 21698c9fbc29Smrg *) ;; 21708c9fbc29Smrg esac 21718c9fbc29Smrg fi 21728c9fbc29Smrg fi 21738c9fbc29Smrg ;; # -l 21748c9fbc29Smrg -L*) 21758c9fbc29Smrg case $linkmode in 21768c9fbc29Smrg lib) 21778c9fbc29Smrg deplibs="$deplib $deplibs" 21788c9fbc29Smrg test "$pass" = conv && continue 21798c9fbc29Smrg newdependency_libs="$deplib $newdependency_libs" 21808c9fbc29Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 21818c9fbc29Smrg ;; 21828c9fbc29Smrg prog) 21838c9fbc29Smrg if test "$pass" = conv; then 21848c9fbc29Smrg deplibs="$deplib $deplibs" 21858c9fbc29Smrg continue 21868c9fbc29Smrg fi 21878c9fbc29Smrg if test "$pass" = scan; then 21888c9fbc29Smrg deplibs="$deplib $deplibs" 21898c9fbc29Smrg else 21908c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 21918c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 21928c9fbc29Smrg fi 21938c9fbc29Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 21948c9fbc29Smrg ;; 21958c9fbc29Smrg *) 21968c9fbc29Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 21978c9fbc29Smrg ;; 21988c9fbc29Smrg esac # linkmode 21998c9fbc29Smrg continue 22008c9fbc29Smrg ;; # -L 22018c9fbc29Smrg -R*) 22028c9fbc29Smrg if test "$pass" = link; then 22038c9fbc29Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 22048c9fbc29Smrg # Make sure the xrpath contains only unique directories. 22058c9fbc29Smrg case "$xrpath " in 22068c9fbc29Smrg *" $dir "*) ;; 22078c9fbc29Smrg *) xrpath="$xrpath $dir" ;; 22088c9fbc29Smrg esac 22098c9fbc29Smrg fi 22108c9fbc29Smrg deplibs="$deplib $deplibs" 22118c9fbc29Smrg continue 22128c9fbc29Smrg ;; 22138c9fbc29Smrg *.la) lib="$deplib" ;; 22148c9fbc29Smrg *.$libext) 22158c9fbc29Smrg if test "$pass" = conv; then 22168c9fbc29Smrg deplibs="$deplib $deplibs" 22178c9fbc29Smrg continue 22188c9fbc29Smrg fi 22198c9fbc29Smrg case $linkmode in 22208c9fbc29Smrg lib) 22218c9fbc29Smrg valid_a_lib=no 22228c9fbc29Smrg case $deplibs_check_method in 22238c9fbc29Smrg match_pattern*) 22248c9fbc29Smrg set dummy $deplibs_check_method 22258c9fbc29Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 22268c9fbc29Smrg if eval $echo \"$deplib\" 2>/dev/null \ 22278c9fbc29Smrg | $SED 10q \ 22288c9fbc29Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 22298c9fbc29Smrg valid_a_lib=yes 22308c9fbc29Smrg fi 22318c9fbc29Smrg ;; 22328c9fbc29Smrg pass_all) 22338c9fbc29Smrg valid_a_lib=yes 22348c9fbc29Smrg ;; 22358c9fbc29Smrg esac 22368c9fbc29Smrg if test "$valid_a_lib" != yes; then 22378c9fbc29Smrg $echo 22388c9fbc29Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 22398c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 22408c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 22418c9fbc29Smrg $echo "*** shared version of the library, which you do not appear to have" 22428c9fbc29Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 22438c9fbc29Smrg $echo "*** that it is just a static archive that I should not used here." 22448c9fbc29Smrg else 22458c9fbc29Smrg $echo 22468c9fbc29Smrg $echo "*** Warning: Linking the shared library $output against the" 22478c9fbc29Smrg $echo "*** static library $deplib is not portable!" 22488c9fbc29Smrg deplibs="$deplib $deplibs" 22498c9fbc29Smrg fi 22508c9fbc29Smrg continue 22518c9fbc29Smrg ;; 22528c9fbc29Smrg prog) 22538c9fbc29Smrg if test "$pass" != link; then 22548c9fbc29Smrg deplibs="$deplib $deplibs" 22558c9fbc29Smrg else 22568c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 22578c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 22588c9fbc29Smrg fi 22598c9fbc29Smrg continue 22608c9fbc29Smrg ;; 22618c9fbc29Smrg esac # linkmode 22628c9fbc29Smrg ;; # *.$libext 22638c9fbc29Smrg *.lo | *.$objext) 22648c9fbc29Smrg if test "$pass" = conv; then 22658c9fbc29Smrg deplibs="$deplib $deplibs" 22668c9fbc29Smrg elif test "$linkmode" = prog; then 22678c9fbc29Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 22688c9fbc29Smrg # If there is no dlopen support or we're linking statically, 22698c9fbc29Smrg # we need to preload. 22708c9fbc29Smrg newdlprefiles="$newdlprefiles $deplib" 22718c9fbc29Smrg compile_deplibs="$deplib $compile_deplibs" 22728c9fbc29Smrg finalize_deplibs="$deplib $finalize_deplibs" 22738c9fbc29Smrg else 22748c9fbc29Smrg newdlfiles="$newdlfiles $deplib" 22758c9fbc29Smrg fi 22768c9fbc29Smrg fi 22778c9fbc29Smrg continue 22788c9fbc29Smrg ;; 22798c9fbc29Smrg %DEPLIBS%) 22808c9fbc29Smrg alldeplibs=yes 22818c9fbc29Smrg continue 22828c9fbc29Smrg ;; 22838c9fbc29Smrg esac # case $deplib 22848c9fbc29Smrg if test "$found" = yes || test -f "$lib"; then : 22858c9fbc29Smrg else 22868c9fbc29Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 22878c9fbc29Smrg exit $EXIT_FAILURE 22888c9fbc29Smrg fi 22898c9fbc29Smrg 22908c9fbc29Smrg # Check to see that this really is a libtool archive. 22918c9fbc29Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 22928c9fbc29Smrg else 22938c9fbc29Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 22948c9fbc29Smrg exit $EXIT_FAILURE 22958c9fbc29Smrg fi 22968c9fbc29Smrg 22978c9fbc29Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 22988c9fbc29Smrg test "X$ladir" = "X$lib" && ladir="." 22998c9fbc29Smrg 23008c9fbc29Smrg dlname= 23018c9fbc29Smrg dlopen= 23028c9fbc29Smrg dlpreopen= 23038c9fbc29Smrg libdir= 23048c9fbc29Smrg library_names= 23058c9fbc29Smrg old_library= 23068c9fbc29Smrg # If the library was installed with an old release of libtool, 23078c9fbc29Smrg # it will not redefine variables installed, or shouldnotlink 23088c9fbc29Smrg installed=yes 23098c9fbc29Smrg shouldnotlink=no 23108c9fbc29Smrg avoidtemprpath= 23118c9fbc29Smrg 23128c9fbc29Smrg 23138c9fbc29Smrg # Read the .la file 23148c9fbc29Smrg case $lib in 23158c9fbc29Smrg */* | *\\*) . $lib ;; 23168c9fbc29Smrg *) . ./$lib ;; 23178c9fbc29Smrg esac 23188c9fbc29Smrg 23198c9fbc29Smrg if test "$linkmode,$pass" = "lib,link" || 23208c9fbc29Smrg test "$linkmode,$pass" = "prog,scan" || 23218c9fbc29Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 23228c9fbc29Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 23238c9fbc29Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 23248c9fbc29Smrg fi 23258c9fbc29Smrg 23268c9fbc29Smrg if test "$pass" = conv; then 23278c9fbc29Smrg # Only check for convenience libraries 23288c9fbc29Smrg deplibs="$lib $deplibs" 23298c9fbc29Smrg if test -z "$libdir"; then 23308c9fbc29Smrg if test -z "$old_library"; then 23318c9fbc29Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23328c9fbc29Smrg exit $EXIT_FAILURE 23338c9fbc29Smrg fi 23348c9fbc29Smrg # It is a libtool convenience library, so add in its objects. 23358c9fbc29Smrg convenience="$convenience $ladir/$objdir/$old_library" 23368c9fbc29Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 23378c9fbc29Smrg tmp_libs= 23388c9fbc29Smrg for deplib in $dependency_libs; do 23398c9fbc29Smrg deplibs="$deplib $deplibs" 23408c9fbc29Smrg if test "X$duplicate_deps" = "Xyes" ; then 23418c9fbc29Smrg case "$tmp_libs " in 23428c9fbc29Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 23438c9fbc29Smrg esac 23448c9fbc29Smrg fi 23458c9fbc29Smrg tmp_libs="$tmp_libs $deplib" 23468c9fbc29Smrg done 23478c9fbc29Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 23488c9fbc29Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 23498c9fbc29Smrg exit $EXIT_FAILURE 23508c9fbc29Smrg fi 23518c9fbc29Smrg continue 23528c9fbc29Smrg fi # $pass = conv 23538c9fbc29Smrg 23548c9fbc29Smrg 23558c9fbc29Smrg # Get the name of the library we link against. 23568c9fbc29Smrg linklib= 23578c9fbc29Smrg for l in $old_library $library_names; do 23588c9fbc29Smrg linklib="$l" 23598c9fbc29Smrg done 23608c9fbc29Smrg if test -z "$linklib"; then 23618c9fbc29Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23628c9fbc29Smrg exit $EXIT_FAILURE 23638c9fbc29Smrg fi 23648c9fbc29Smrg 23658c9fbc29Smrg # This library was specified with -dlopen. 23668c9fbc29Smrg if test "$pass" = dlopen; then 23678c9fbc29Smrg if test -z "$libdir"; then 23688c9fbc29Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 23698c9fbc29Smrg exit $EXIT_FAILURE 23708c9fbc29Smrg fi 23718c9fbc29Smrg if test -z "$dlname" || 23728c9fbc29Smrg test "$dlopen_support" != yes || 23738c9fbc29Smrg test "$build_libtool_libs" = no; then 23748c9fbc29Smrg # If there is no dlname, no dlopen support or we're linking 23758c9fbc29Smrg # statically, we need to preload. We also need to preload any 23768c9fbc29Smrg # dependent libraries so libltdl's deplib preloader doesn't 23778c9fbc29Smrg # bomb out in the load deplibs phase. 23788c9fbc29Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 23798c9fbc29Smrg else 23808c9fbc29Smrg newdlfiles="$newdlfiles $lib" 23818c9fbc29Smrg fi 23828c9fbc29Smrg continue 23838c9fbc29Smrg fi # $pass = dlopen 23848c9fbc29Smrg 23858c9fbc29Smrg # We need an absolute path. 23868c9fbc29Smrg case $ladir in 23878c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 23888c9fbc29Smrg *) 23898c9fbc29Smrg abs_ladir=`cd "$ladir" && pwd` 23908c9fbc29Smrg if test -z "$abs_ladir"; then 23918c9fbc29Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 23928c9fbc29Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 23938c9fbc29Smrg abs_ladir="$ladir" 23948c9fbc29Smrg fi 23958c9fbc29Smrg ;; 23968c9fbc29Smrg esac 23978c9fbc29Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 23988c9fbc29Smrg 23998c9fbc29Smrg # Find the relevant object directory and library name. 24008c9fbc29Smrg if test "X$installed" = Xyes; then 24018c9fbc29Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24028c9fbc29Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 24038c9fbc29Smrg dir="$ladir" 24048c9fbc29Smrg absdir="$abs_ladir" 24058c9fbc29Smrg libdir="$abs_ladir" 24068c9fbc29Smrg else 24078c9fbc29Smrg dir="$libdir" 24088c9fbc29Smrg absdir="$libdir" 24098c9fbc29Smrg fi 24108c9fbc29Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 24118c9fbc29Smrg else 24128c9fbc29Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24138c9fbc29Smrg dir="$ladir" 24148c9fbc29Smrg absdir="$abs_ladir" 24158c9fbc29Smrg # Remove this search path later 24168c9fbc29Smrg notinst_path="$notinst_path $abs_ladir" 24178c9fbc29Smrg else 24188c9fbc29Smrg dir="$ladir/$objdir" 24198c9fbc29Smrg absdir="$abs_ladir/$objdir" 24208c9fbc29Smrg # Remove this search path later 24218c9fbc29Smrg notinst_path="$notinst_path $abs_ladir" 24228c9fbc29Smrg fi 24238c9fbc29Smrg fi # $installed = yes 24248c9fbc29Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 24258c9fbc29Smrg 24268c9fbc29Smrg # This library was specified with -dlpreopen. 24278c9fbc29Smrg if test "$pass" = dlpreopen; then 24288c9fbc29Smrg if test -z "$libdir"; then 24298c9fbc29Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 24308c9fbc29Smrg exit $EXIT_FAILURE 24318c9fbc29Smrg fi 24328c9fbc29Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 24338c9fbc29Smrg # are required to link). 24348c9fbc29Smrg if test -n "$old_library"; then 24358c9fbc29Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 24368c9fbc29Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 24378c9fbc29Smrg elif test -n "$dlname"; then 24388c9fbc29Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 24398c9fbc29Smrg else 24408c9fbc29Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 24418c9fbc29Smrg fi 24428c9fbc29Smrg fi # $pass = dlpreopen 24438c9fbc29Smrg 24448c9fbc29Smrg if test -z "$libdir"; then 24458c9fbc29Smrg # Link the convenience library 24468c9fbc29Smrg if test "$linkmode" = lib; then 24478c9fbc29Smrg deplibs="$dir/$old_library $deplibs" 24488c9fbc29Smrg elif test "$linkmode,$pass" = "prog,link"; then 24498c9fbc29Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 24508c9fbc29Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 24518c9fbc29Smrg else 24528c9fbc29Smrg deplibs="$lib $deplibs" # used for prog,scan pass 24538c9fbc29Smrg fi 24548c9fbc29Smrg continue 24558c9fbc29Smrg fi 24568c9fbc29Smrg 24578c9fbc29Smrg 24588c9fbc29Smrg if test "$linkmode" = prog && test "$pass" != link; then 24598c9fbc29Smrg newlib_search_path="$newlib_search_path $ladir" 24608c9fbc29Smrg deplibs="$lib $deplibs" 24618c9fbc29Smrg 24628c9fbc29Smrg linkalldeplibs=no 24638c9fbc29Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 24648c9fbc29Smrg test "$build_libtool_libs" = no; then 24658c9fbc29Smrg linkalldeplibs=yes 24668c9fbc29Smrg fi 24678c9fbc29Smrg 24688c9fbc29Smrg tmp_libs= 24698c9fbc29Smrg for deplib in $dependency_libs; do 24708c9fbc29Smrg case $deplib in 24718c9fbc29Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 24728c9fbc29Smrg esac 24738c9fbc29Smrg # Need to link against all dependency_libs? 24748c9fbc29Smrg if test "$linkalldeplibs" = yes; then 24758c9fbc29Smrg deplibs="$deplib $deplibs" 24768c9fbc29Smrg else 24778c9fbc29Smrg # Need to hardcode shared library paths 24788c9fbc29Smrg # or/and link against static libraries 24798c9fbc29Smrg newdependency_libs="$deplib $newdependency_libs" 24808c9fbc29Smrg fi 24818c9fbc29Smrg if test "X$duplicate_deps" = "Xyes" ; then 24828c9fbc29Smrg case "$tmp_libs " in 24838c9fbc29Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 24848c9fbc29Smrg esac 24858c9fbc29Smrg fi 24868c9fbc29Smrg tmp_libs="$tmp_libs $deplib" 24878c9fbc29Smrg done # for deplib 24888c9fbc29Smrg continue 24898c9fbc29Smrg fi # $linkmode = prog... 24908c9fbc29Smrg 24918c9fbc29Smrg if test "$linkmode,$pass" = "prog,link"; then 24928c9fbc29Smrg if test -n "$library_names" && 24938c9fbc29Smrg { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 24948c9fbc29Smrg # We need to hardcode the library path 24958c9fbc29Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 24968c9fbc29Smrg # Make sure the rpath contains only unique directories. 24978c9fbc29Smrg case "$temp_rpath " in 24988c9fbc29Smrg *" $dir "*) ;; 24998c9fbc29Smrg *" $absdir "*) ;; 25008c9fbc29Smrg *) temp_rpath="$temp_rpath $absdir" ;; 25018c9fbc29Smrg esac 25028c9fbc29Smrg fi 25038c9fbc29Smrg 25048c9fbc29Smrg # Hardcode the library path. 25058c9fbc29Smrg # Skip directories that are in the system default run-time 25068c9fbc29Smrg # search path. 25078c9fbc29Smrg case " $sys_lib_dlsearch_path " in 25088c9fbc29Smrg *" $absdir "*) ;; 25098c9fbc29Smrg *) 25108c9fbc29Smrg case "$compile_rpath " in 25118c9fbc29Smrg *" $absdir "*) ;; 25128c9fbc29Smrg *) compile_rpath="$compile_rpath $absdir" 25138c9fbc29Smrg esac 25148c9fbc29Smrg ;; 25158c9fbc29Smrg esac 25168c9fbc29Smrg case " $sys_lib_dlsearch_path " in 25178c9fbc29Smrg *" $libdir "*) ;; 25188c9fbc29Smrg *) 25198c9fbc29Smrg case "$finalize_rpath " in 25208c9fbc29Smrg *" $libdir "*) ;; 25218c9fbc29Smrg *) finalize_rpath="$finalize_rpath $libdir" 25228c9fbc29Smrg esac 25238c9fbc29Smrg ;; 25248c9fbc29Smrg esac 25258c9fbc29Smrg fi # $linkmode,$pass = prog,link... 25268c9fbc29Smrg 25278c9fbc29Smrg if test "$alldeplibs" = yes && 25288c9fbc29Smrg { test "$deplibs_check_method" = pass_all || 25298c9fbc29Smrg { test "$build_libtool_libs" = yes && 25308c9fbc29Smrg test -n "$library_names"; }; }; then 25318c9fbc29Smrg # We only need to search for static libraries 25328c9fbc29Smrg continue 25338c9fbc29Smrg fi 25348c9fbc29Smrg fi 25358c9fbc29Smrg 25368c9fbc29Smrg link_static=no # Whether the deplib will be linked statically 25378c9fbc29Smrg use_static_libs=$prefer_static_libs 25388c9fbc29Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 25398c9fbc29Smrg use_static_libs=no 25408c9fbc29Smrg fi 25418c9fbc29Smrg if test -n "$library_names" && 25428c9fbc29Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 25438c9fbc29Smrg if test "$installed" = no; then 25448c9fbc29Smrg notinst_deplibs="$notinst_deplibs $lib" 25458c9fbc29Smrg need_relink=yes 25468c9fbc29Smrg fi 25478c9fbc29Smrg # This is a shared library 25488c9fbc29Smrg 25498c9fbc29Smrg # Warn about portability, can't link against -module's on 25508c9fbc29Smrg # some systems (darwin) 25518c9fbc29Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 25528c9fbc29Smrg $echo 25538c9fbc29Smrg if test "$linkmode" = prog; then 25548c9fbc29Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 25558c9fbc29Smrg else 25568c9fbc29Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 25578c9fbc29Smrg fi 25588c9fbc29Smrg $echo "*** $linklib is not portable!" 25598c9fbc29Smrg fi 25608c9fbc29Smrg if test "$linkmode" = lib && 25618c9fbc29Smrg test "$hardcode_into_libs" = yes; then 25628c9fbc29Smrg # Hardcode the library path. 25638c9fbc29Smrg # Skip directories that are in the system default run-time 25648c9fbc29Smrg # search path. 25658c9fbc29Smrg case " $sys_lib_dlsearch_path " in 25668c9fbc29Smrg *" $absdir "*) ;; 25678c9fbc29Smrg *) 25688c9fbc29Smrg case "$compile_rpath " in 25698c9fbc29Smrg *" $absdir "*) ;; 25708c9fbc29Smrg *) compile_rpath="$compile_rpath $absdir" 25718c9fbc29Smrg esac 25728c9fbc29Smrg ;; 25738c9fbc29Smrg esac 25748c9fbc29Smrg case " $sys_lib_dlsearch_path " in 25758c9fbc29Smrg *" $libdir "*) ;; 25768c9fbc29Smrg *) 25778c9fbc29Smrg case "$finalize_rpath " in 25788c9fbc29Smrg *" $libdir "*) ;; 25798c9fbc29Smrg *) finalize_rpath="$finalize_rpath $libdir" 25808c9fbc29Smrg esac 25818c9fbc29Smrg ;; 25828c9fbc29Smrg esac 25838c9fbc29Smrg fi 25848c9fbc29Smrg 25858c9fbc29Smrg if test -n "$old_archive_from_expsyms_cmds"; then 25868c9fbc29Smrg # figure out the soname 25878c9fbc29Smrg set dummy $library_names 25888c9fbc29Smrg realname="$2" 25898c9fbc29Smrg shift; shift 25908c9fbc29Smrg libname=`eval \\$echo \"$libname_spec\"` 25918c9fbc29Smrg # use dlname if we got it. it's perfectly good, no? 25928c9fbc29Smrg if test -n "$dlname"; then 25938c9fbc29Smrg soname="$dlname" 25948c9fbc29Smrg elif test -n "$soname_spec"; then 25958c9fbc29Smrg # bleh windows 25968c9fbc29Smrg case $host in 25978c9fbc29Smrg *cygwin* | mingw*) 25988c9fbc29Smrg major=`expr $current - $age` 25998c9fbc29Smrg versuffix="-$major" 26008c9fbc29Smrg ;; 26018c9fbc29Smrg esac 26028c9fbc29Smrg eval soname=\"$soname_spec\" 26038c9fbc29Smrg else 26048c9fbc29Smrg soname="$realname" 26058c9fbc29Smrg fi 26068c9fbc29Smrg 26078c9fbc29Smrg # Make a new name for the extract_expsyms_cmds to use 26088c9fbc29Smrg soroot="$soname" 26098c9fbc29Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 26108c9fbc29Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 26118c9fbc29Smrg 26128c9fbc29Smrg # If the library has no export list, then create one now 26138c9fbc29Smrg if test -f "$output_objdir/$soname-def"; then : 26148c9fbc29Smrg else 26158c9fbc29Smrg $show "extracting exported symbol list from \`$soname'" 26168c9fbc29Smrg save_ifs="$IFS"; IFS='~' 26178c9fbc29Smrg cmds=$extract_expsyms_cmds 26188c9fbc29Smrg for cmd in $cmds; do 26198c9fbc29Smrg IFS="$save_ifs" 26208c9fbc29Smrg eval cmd=\"$cmd\" 26218c9fbc29Smrg $show "$cmd" 26228c9fbc29Smrg $run eval "$cmd" || exit $? 26238c9fbc29Smrg done 26248c9fbc29Smrg IFS="$save_ifs" 26258c9fbc29Smrg fi 26268c9fbc29Smrg 26278c9fbc29Smrg # Create $newlib 26288c9fbc29Smrg if test -f "$output_objdir/$newlib"; then :; else 26298c9fbc29Smrg $show "generating import library for \`$soname'" 26308c9fbc29Smrg save_ifs="$IFS"; IFS='~' 26318c9fbc29Smrg cmds=$old_archive_from_expsyms_cmds 26328c9fbc29Smrg for cmd in $cmds; do 26338c9fbc29Smrg IFS="$save_ifs" 26348c9fbc29Smrg eval cmd=\"$cmd\" 26358c9fbc29Smrg $show "$cmd" 26368c9fbc29Smrg $run eval "$cmd" || exit $? 26378c9fbc29Smrg done 26388c9fbc29Smrg IFS="$save_ifs" 26398c9fbc29Smrg fi 26408c9fbc29Smrg # make sure the library variables are pointing to the new library 26418c9fbc29Smrg dir=$output_objdir 26428c9fbc29Smrg linklib=$newlib 26438c9fbc29Smrg fi # test -n "$old_archive_from_expsyms_cmds" 26448c9fbc29Smrg 26458c9fbc29Smrg if test "$linkmode" = prog || test "$mode" != relink; then 26468c9fbc29Smrg add_shlibpath= 26478c9fbc29Smrg add_dir= 26488c9fbc29Smrg add= 26498c9fbc29Smrg lib_linked=yes 26508c9fbc29Smrg case $hardcode_action in 26518c9fbc29Smrg immediate | unsupported) 26528c9fbc29Smrg if test "$hardcode_direct" = no; then 26538c9fbc29Smrg add="$dir/$linklib" 26548c9fbc29Smrg case $host in 26558c9fbc29Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 26568c9fbc29Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 26578c9fbc29Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 26588c9fbc29Smrg *-*-unixware7*) add_dir="-L$dir" ;; 26598c9fbc29Smrg *-*-darwin* ) 26608c9fbc29Smrg # if the lib is a module then we can not link against 26618c9fbc29Smrg # it, someone is ignoring the new warnings I added 26628c9fbc29Smrg if /usr/bin/file -L $add 2> /dev/null | 26638c9fbc29Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 26648c9fbc29Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 26658c9fbc29Smrg if test -z "$old_library" ; then 26668c9fbc29Smrg $echo 26678c9fbc29Smrg $echo "** And there doesn't seem to be a static archive available" 26688c9fbc29Smrg $echo "** The link will probably fail, sorry" 26698c9fbc29Smrg else 26708c9fbc29Smrg add="$dir/$old_library" 26718c9fbc29Smrg fi 26728c9fbc29Smrg fi 26738c9fbc29Smrg esac 26748c9fbc29Smrg elif test "$hardcode_minus_L" = no; then 26758c9fbc29Smrg case $host in 26768c9fbc29Smrg *-*-sunos*) add_shlibpath="$dir" ;; 26778c9fbc29Smrg esac 26788c9fbc29Smrg add_dir="-L$dir" 26798c9fbc29Smrg add="-l$name" 26808c9fbc29Smrg elif test "$hardcode_shlibpath_var" = no; then 26818c9fbc29Smrg add_shlibpath="$dir" 26828c9fbc29Smrg add="-l$name" 26838c9fbc29Smrg else 26848c9fbc29Smrg lib_linked=no 26858c9fbc29Smrg fi 26868c9fbc29Smrg ;; 26878c9fbc29Smrg relink) 26888c9fbc29Smrg if test "$hardcode_direct" = yes; then 26898c9fbc29Smrg add="$dir/$linklib" 26908c9fbc29Smrg elif test "$hardcode_minus_L" = yes; then 26918c9fbc29Smrg add_dir="-L$dir" 26928c9fbc29Smrg # Try looking first in the location we're being installed to. 26938c9fbc29Smrg if test -n "$inst_prefix_dir"; then 26948c9fbc29Smrg case $libdir in 26958c9fbc29Smrg [\\/]*) 26968c9fbc29Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 26978c9fbc29Smrg ;; 26988c9fbc29Smrg esac 26998c9fbc29Smrg fi 27008c9fbc29Smrg add="-l$name" 27018c9fbc29Smrg elif test "$hardcode_shlibpath_var" = yes; then 27028c9fbc29Smrg add_shlibpath="$dir" 27038c9fbc29Smrg add="-l$name" 27048c9fbc29Smrg else 27058c9fbc29Smrg lib_linked=no 27068c9fbc29Smrg fi 27078c9fbc29Smrg ;; 27088c9fbc29Smrg *) lib_linked=no ;; 27098c9fbc29Smrg esac 27108c9fbc29Smrg 27118c9fbc29Smrg if test "$lib_linked" != yes; then 27128c9fbc29Smrg $echo "$modename: configuration error: unsupported hardcode properties" 27138c9fbc29Smrg exit $EXIT_FAILURE 27148c9fbc29Smrg fi 27158c9fbc29Smrg 27168c9fbc29Smrg if test -n "$add_shlibpath"; then 27178c9fbc29Smrg case :$compile_shlibpath: in 27188c9fbc29Smrg *":$add_shlibpath:"*) ;; 27198c9fbc29Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 27208c9fbc29Smrg esac 27218c9fbc29Smrg fi 27228c9fbc29Smrg if test "$linkmode" = prog; then 27238c9fbc29Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 27248c9fbc29Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 27258c9fbc29Smrg else 27268c9fbc29Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 27278c9fbc29Smrg test -n "$add" && deplibs="$add $deplibs" 27288c9fbc29Smrg if test "$hardcode_direct" != yes && \ 27298c9fbc29Smrg test "$hardcode_minus_L" != yes && \ 27308c9fbc29Smrg test "$hardcode_shlibpath_var" = yes; then 27318c9fbc29Smrg case :$finalize_shlibpath: in 27328c9fbc29Smrg *":$libdir:"*) ;; 27338c9fbc29Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27348c9fbc29Smrg esac 27358c9fbc29Smrg fi 27368c9fbc29Smrg fi 27378c9fbc29Smrg fi 27388c9fbc29Smrg 27398c9fbc29Smrg if test "$linkmode" = prog || test "$mode" = relink; then 27408c9fbc29Smrg add_shlibpath= 27418c9fbc29Smrg add_dir= 27428c9fbc29Smrg add= 27438c9fbc29Smrg # Finalize command for both is simple: just hardcode it. 27448c9fbc29Smrg if test "$hardcode_direct" = yes; then 27458c9fbc29Smrg add="$libdir/$linklib" 27468c9fbc29Smrg elif test "$hardcode_minus_L" = yes; then 27478c9fbc29Smrg add_dir="-L$libdir" 27488c9fbc29Smrg add="-l$name" 27498c9fbc29Smrg elif test "$hardcode_shlibpath_var" = yes; then 27508c9fbc29Smrg case :$finalize_shlibpath: in 27518c9fbc29Smrg *":$libdir:"*) ;; 27528c9fbc29Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27538c9fbc29Smrg esac 27548c9fbc29Smrg add="-l$name" 27558c9fbc29Smrg elif test "$hardcode_automatic" = yes; then 27568c9fbc29Smrg if test -n "$inst_prefix_dir" && 27578c9fbc29Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 27588c9fbc29Smrg add="$inst_prefix_dir$libdir/$linklib" 27598c9fbc29Smrg else 27608c9fbc29Smrg add="$libdir/$linklib" 27618c9fbc29Smrg fi 27628c9fbc29Smrg else 27638c9fbc29Smrg # We cannot seem to hardcode it, guess we'll fake it. 27648c9fbc29Smrg add_dir="-L$libdir" 27658c9fbc29Smrg # Try looking first in the location we're being installed to. 27668c9fbc29Smrg if test -n "$inst_prefix_dir"; then 27678c9fbc29Smrg case $libdir in 27688c9fbc29Smrg [\\/]*) 27698c9fbc29Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 27708c9fbc29Smrg ;; 27718c9fbc29Smrg esac 27728c9fbc29Smrg fi 27738c9fbc29Smrg add="-l$name" 27748c9fbc29Smrg fi 27758c9fbc29Smrg 27768c9fbc29Smrg if test "$linkmode" = prog; then 27778c9fbc29Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 27788c9fbc29Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 27798c9fbc29Smrg else 27808c9fbc29Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 27818c9fbc29Smrg test -n "$add" && deplibs="$add $deplibs" 27828c9fbc29Smrg fi 27838c9fbc29Smrg fi 27848c9fbc29Smrg elif test "$linkmode" = prog; then 27858c9fbc29Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 27868c9fbc29Smrg # is not unsupported. This is valid on all known static and 27878c9fbc29Smrg # shared platforms. 27888c9fbc29Smrg if test "$hardcode_direct" != unsupported; then 27898c9fbc29Smrg test -n "$old_library" && linklib="$old_library" 27908c9fbc29Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 27918c9fbc29Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 27928c9fbc29Smrg else 27938c9fbc29Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 27948c9fbc29Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 27958c9fbc29Smrg fi 27968c9fbc29Smrg elif test "$build_libtool_libs" = yes; then 27978c9fbc29Smrg # Not a shared library 27988c9fbc29Smrg if test "$deplibs_check_method" != pass_all; then 27998c9fbc29Smrg # We're trying link a shared library against a static one 28008c9fbc29Smrg # but the system doesn't support it. 28018c9fbc29Smrg 28028c9fbc29Smrg # Just print a warning and add the library to dependency_libs so 28038c9fbc29Smrg # that the program can be linked against the static library. 28048c9fbc29Smrg $echo 28058c9fbc29Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 28068c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 28078c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 28088c9fbc29Smrg $echo "*** shared version of the library, which you do not appear to have." 28098c9fbc29Smrg if test "$module" = yes; then 28108c9fbc29Smrg $echo "*** But as you try to build a module library, libtool will still create " 28118c9fbc29Smrg $echo "*** a static module, that should work as long as the dlopening application" 28128c9fbc29Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 28138c9fbc29Smrg if test -z "$global_symbol_pipe"; then 28148c9fbc29Smrg $echo 28158c9fbc29Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 28168c9fbc29Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 28178c9fbc29Smrg $echo "*** not find such a program. So, this module is probably useless." 28188c9fbc29Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 28198c9fbc29Smrg fi 28208c9fbc29Smrg if test "$build_old_libs" = no; then 28218c9fbc29Smrg build_libtool_libs=module 28228c9fbc29Smrg build_old_libs=yes 28238c9fbc29Smrg else 28248c9fbc29Smrg build_libtool_libs=no 28258c9fbc29Smrg fi 28268c9fbc29Smrg fi 28278c9fbc29Smrg else 28288c9fbc29Smrg deplibs="$dir/$old_library $deplibs" 28298c9fbc29Smrg link_static=yes 28308c9fbc29Smrg fi 28318c9fbc29Smrg fi # link shared/static library? 28328c9fbc29Smrg 28338c9fbc29Smrg if test "$linkmode" = lib; then 28348c9fbc29Smrg if test -n "$dependency_libs" && 28358c9fbc29Smrg { test "$hardcode_into_libs" != yes || 28368c9fbc29Smrg test "$build_old_libs" = yes || 28378c9fbc29Smrg test "$link_static" = yes; }; then 28388c9fbc29Smrg # Extract -R from dependency_libs 28398c9fbc29Smrg temp_deplibs= 28408c9fbc29Smrg for libdir in $dependency_libs; do 28418c9fbc29Smrg case $libdir in 28428c9fbc29Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 28438c9fbc29Smrg case " $xrpath " in 28448c9fbc29Smrg *" $temp_xrpath "*) ;; 28458c9fbc29Smrg *) xrpath="$xrpath $temp_xrpath";; 28468c9fbc29Smrg esac;; 28478c9fbc29Smrg *) temp_deplibs="$temp_deplibs $libdir";; 28488c9fbc29Smrg esac 28498c9fbc29Smrg done 28508c9fbc29Smrg dependency_libs="$temp_deplibs" 28518c9fbc29Smrg fi 28528c9fbc29Smrg 28538c9fbc29Smrg newlib_search_path="$newlib_search_path $absdir" 28548c9fbc29Smrg # Link against this library 28558c9fbc29Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 28568c9fbc29Smrg # ... and its dependency_libs 28578c9fbc29Smrg tmp_libs= 28588c9fbc29Smrg for deplib in $dependency_libs; do 28598c9fbc29Smrg newdependency_libs="$deplib $newdependency_libs" 28608c9fbc29Smrg if test "X$duplicate_deps" = "Xyes" ; then 28618c9fbc29Smrg case "$tmp_libs " in 28628c9fbc29Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 28638c9fbc29Smrg esac 28648c9fbc29Smrg fi 28658c9fbc29Smrg tmp_libs="$tmp_libs $deplib" 28668c9fbc29Smrg done 28678c9fbc29Smrg 28688c9fbc29Smrg if test "$link_all_deplibs" != no; then 28698c9fbc29Smrg # Add the search paths of all dependency libraries 28708c9fbc29Smrg for deplib in $dependency_libs; do 28718c9fbc29Smrg case $deplib in 28728c9fbc29Smrg -L*) path="$deplib" ;; 28738c9fbc29Smrg *.la) 28748c9fbc29Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 28758c9fbc29Smrg test "X$dir" = "X$deplib" && dir="." 28768c9fbc29Smrg # We need an absolute path. 28778c9fbc29Smrg case $dir in 28788c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 28798c9fbc29Smrg *) 28808c9fbc29Smrg absdir=`cd "$dir" && pwd` 28818c9fbc29Smrg if test -z "$absdir"; then 28828c9fbc29Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 28838c9fbc29Smrg absdir="$dir" 28848c9fbc29Smrg fi 28858c9fbc29Smrg ;; 28868c9fbc29Smrg esac 28878c9fbc29Smrg if grep "^installed=no" $deplib > /dev/null; then 28888c9fbc29Smrg path="$absdir/$objdir" 28898c9fbc29Smrg else 28908c9fbc29Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 28918c9fbc29Smrg if test -z "$libdir"; then 28928c9fbc29Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 28938c9fbc29Smrg exit $EXIT_FAILURE 28948c9fbc29Smrg fi 28958c9fbc29Smrg if test "$absdir" != "$libdir"; then 28968c9fbc29Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 28978c9fbc29Smrg fi 28988c9fbc29Smrg path="$absdir" 28998c9fbc29Smrg fi 29008c9fbc29Smrg depdepl= 29018c9fbc29Smrg case $host in 29028c9fbc29Smrg *-*-darwin*) 29038c9fbc29Smrg # we do not want to link against static libs, 29048c9fbc29Smrg # but need to link against shared 29058c9fbc29Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29068c9fbc29Smrg if test -n "$deplibrary_names" ; then 29078c9fbc29Smrg for tmp in $deplibrary_names ; do 29088c9fbc29Smrg depdepl=$tmp 29098c9fbc29Smrg done 29108c9fbc29Smrg if test -f "$path/$depdepl" ; then 29118c9fbc29Smrg depdepl="$path/$depdepl" 29128c9fbc29Smrg fi 29138c9fbc29Smrg # do not add paths which are already there 29148c9fbc29Smrg case " $newlib_search_path " in 29158c9fbc29Smrg *" $path "*) ;; 29168c9fbc29Smrg *) newlib_search_path="$newlib_search_path $path";; 29178c9fbc29Smrg esac 29188c9fbc29Smrg fi 29198c9fbc29Smrg path="" 29208c9fbc29Smrg ;; 29218c9fbc29Smrg *) 29228c9fbc29Smrg path="-L$path" 29238c9fbc29Smrg ;; 29248c9fbc29Smrg esac 29258c9fbc29Smrg ;; 29268c9fbc29Smrg -l*) 29278c9fbc29Smrg case $host in 29288c9fbc29Smrg *-*-darwin*) 29298c9fbc29Smrg # Again, we only want to link against shared libraries 29308c9fbc29Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 29318c9fbc29Smrg for tmp in $newlib_search_path ; do 29328c9fbc29Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 29338c9fbc29Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 29348c9fbc29Smrg break 29358c9fbc29Smrg fi 29368c9fbc29Smrg done 29378c9fbc29Smrg path="" 29388c9fbc29Smrg ;; 29398c9fbc29Smrg *) continue ;; 29408c9fbc29Smrg esac 29418c9fbc29Smrg ;; 29428c9fbc29Smrg *) continue ;; 29438c9fbc29Smrg esac 29448c9fbc29Smrg case " $deplibs " in 29458c9fbc29Smrg *" $path "*) ;; 29468c9fbc29Smrg *) deplibs="$path $deplibs" ;; 29478c9fbc29Smrg esac 29488c9fbc29Smrg case " $deplibs " in 29498c9fbc29Smrg *" $depdepl "*) ;; 29508c9fbc29Smrg *) deplibs="$depdepl $deplibs" ;; 29518c9fbc29Smrg esac 29528c9fbc29Smrg done 29538c9fbc29Smrg fi # link_all_deplibs != no 29548c9fbc29Smrg fi # linkmode = lib 29558c9fbc29Smrg done # for deplib in $libs 29568c9fbc29Smrg dependency_libs="$newdependency_libs" 29578c9fbc29Smrg if test "$pass" = dlpreopen; then 29588c9fbc29Smrg # Link the dlpreopened libraries before other libraries 29598c9fbc29Smrg for deplib in $save_deplibs; do 29608c9fbc29Smrg deplibs="$deplib $deplibs" 29618c9fbc29Smrg done 29628c9fbc29Smrg fi 29638c9fbc29Smrg if test "$pass" != dlopen; then 29648c9fbc29Smrg if test "$pass" != conv; then 29658c9fbc29Smrg # Make sure lib_search_path contains only unique directories. 29668c9fbc29Smrg lib_search_path= 29678c9fbc29Smrg for dir in $newlib_search_path; do 29688c9fbc29Smrg case "$lib_search_path " in 29698c9fbc29Smrg *" $dir "*) ;; 29708c9fbc29Smrg *) lib_search_path="$lib_search_path $dir" ;; 29718c9fbc29Smrg esac 29728c9fbc29Smrg done 29738c9fbc29Smrg newlib_search_path= 29748c9fbc29Smrg fi 29758c9fbc29Smrg 29768c9fbc29Smrg if test "$linkmode,$pass" != "prog,link"; then 29778c9fbc29Smrg vars="deplibs" 29788c9fbc29Smrg else 29798c9fbc29Smrg vars="compile_deplibs finalize_deplibs" 29808c9fbc29Smrg fi 29818c9fbc29Smrg for var in $vars dependency_libs; do 29828c9fbc29Smrg # Add libraries to $var in reverse order 29838c9fbc29Smrg eval tmp_libs=\"\$$var\" 29848c9fbc29Smrg new_libs= 29858c9fbc29Smrg for deplib in $tmp_libs; do 29868c9fbc29Smrg # FIXME: Pedantically, this is the right thing to do, so 29878c9fbc29Smrg # that some nasty dependency loop isn't accidentally 29888c9fbc29Smrg # broken: 29898c9fbc29Smrg #new_libs="$deplib $new_libs" 29908c9fbc29Smrg # Pragmatically, this seems to cause very few problems in 29918c9fbc29Smrg # practice: 29928c9fbc29Smrg case $deplib in 29938c9fbc29Smrg -L*) new_libs="$deplib $new_libs" ;; 29948c9fbc29Smrg -R*) ;; 29958c9fbc29Smrg *) 29968c9fbc29Smrg # And here is the reason: when a library appears more 29978c9fbc29Smrg # than once as an explicit dependence of a library, or 29988c9fbc29Smrg # is implicitly linked in more than once by the 29998c9fbc29Smrg # compiler, it is considered special, and multiple 30008c9fbc29Smrg # occurrences thereof are not removed. Compare this 30018c9fbc29Smrg # with having the same library being listed as a 30028c9fbc29Smrg # dependency of multiple other libraries: in this case, 30038c9fbc29Smrg # we know (pedantically, we assume) the library does not 30048c9fbc29Smrg # need to be listed more than once, so we keep only the 30058c9fbc29Smrg # last copy. This is not always right, but it is rare 30068c9fbc29Smrg # enough that we require users that really mean to play 30078c9fbc29Smrg # such unportable linking tricks to link the library 30088c9fbc29Smrg # using -Wl,-lname, so that libtool does not consider it 30098c9fbc29Smrg # for duplicate removal. 30108c9fbc29Smrg case " $specialdeplibs " in 30118c9fbc29Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 30128c9fbc29Smrg *) 30138c9fbc29Smrg case " $new_libs " in 30148c9fbc29Smrg *" $deplib "*) ;; 30158c9fbc29Smrg *) new_libs="$deplib $new_libs" ;; 30168c9fbc29Smrg esac 30178c9fbc29Smrg ;; 30188c9fbc29Smrg esac 30198c9fbc29Smrg ;; 30208c9fbc29Smrg esac 30218c9fbc29Smrg done 30228c9fbc29Smrg tmp_libs= 30238c9fbc29Smrg for deplib in $new_libs; do 30248c9fbc29Smrg case $deplib in 30258c9fbc29Smrg -L*) 30268c9fbc29Smrg case " $tmp_libs " in 30278c9fbc29Smrg *" $deplib "*) ;; 30288c9fbc29Smrg *) tmp_libs="$tmp_libs $deplib" ;; 30298c9fbc29Smrg esac 30308c9fbc29Smrg ;; 30318c9fbc29Smrg *) tmp_libs="$tmp_libs $deplib" ;; 30328c9fbc29Smrg esac 30338c9fbc29Smrg done 30348c9fbc29Smrg eval $var=\"$tmp_libs\" 30358c9fbc29Smrg done # for var 30368c9fbc29Smrg fi 30378c9fbc29Smrg # Last step: remove runtime libs from dependency_libs 30388c9fbc29Smrg # (they stay in deplibs) 30398c9fbc29Smrg tmp_libs= 30408c9fbc29Smrg for i in $dependency_libs ; do 30418c9fbc29Smrg case " $predeps $postdeps $compiler_lib_search_path " in 30428c9fbc29Smrg *" $i "*) 30438c9fbc29Smrg i="" 30448c9fbc29Smrg ;; 30458c9fbc29Smrg esac 30468c9fbc29Smrg if test -n "$i" ; then 30478c9fbc29Smrg tmp_libs="$tmp_libs $i" 30488c9fbc29Smrg fi 30498c9fbc29Smrg done 30508c9fbc29Smrg dependency_libs=$tmp_libs 30518c9fbc29Smrg done # for pass 30528c9fbc29Smrg if test "$linkmode" = prog; then 30538c9fbc29Smrg dlfiles="$newdlfiles" 30548c9fbc29Smrg dlprefiles="$newdlprefiles" 30558c9fbc29Smrg fi 30568c9fbc29Smrg 30578c9fbc29Smrg case $linkmode in 30588c9fbc29Smrg oldlib) 30598c9fbc29Smrg if test -n "$deplibs"; then 30608c9fbc29Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 30618c9fbc29Smrg fi 30628c9fbc29Smrg 30638c9fbc29Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 30648c9fbc29Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 30658c9fbc29Smrg fi 30668c9fbc29Smrg 30678c9fbc29Smrg if test -n "$rpath"; then 30688c9fbc29Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 30698c9fbc29Smrg fi 30708c9fbc29Smrg 30718c9fbc29Smrg if test -n "$xrpath"; then 30728c9fbc29Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 30738c9fbc29Smrg fi 30748c9fbc29Smrg 30758c9fbc29Smrg if test -n "$vinfo"; then 30768c9fbc29Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 30778c9fbc29Smrg fi 30788c9fbc29Smrg 30798c9fbc29Smrg if test -n "$release"; then 30808c9fbc29Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 30818c9fbc29Smrg fi 30828c9fbc29Smrg 30838c9fbc29Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 30848c9fbc29Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 30858c9fbc29Smrg fi 30868c9fbc29Smrg 30878c9fbc29Smrg # Now set the variables for building old libraries. 30888c9fbc29Smrg build_libtool_libs=no 30898c9fbc29Smrg oldlibs="$output" 30908c9fbc29Smrg objs="$objs$old_deplibs" 30918c9fbc29Smrg ;; 30928c9fbc29Smrg 30938c9fbc29Smrg lib) 30948c9fbc29Smrg # Make sure we only generate libraries of the form `libNAME.la'. 30958c9fbc29Smrg case $outputname in 30968c9fbc29Smrg lib*) 30978c9fbc29Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 30988c9fbc29Smrg eval shared_ext=\"$shrext_cmds\" 30998c9fbc29Smrg eval libname=\"$libname_spec\" 31008c9fbc29Smrg ;; 31018c9fbc29Smrg *) 31028c9fbc29Smrg if test "$module" = no; then 31038c9fbc29Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 31048c9fbc29Smrg $echo "$help" 1>&2 31058c9fbc29Smrg exit $EXIT_FAILURE 31068c9fbc29Smrg fi 31078c9fbc29Smrg if test "$need_lib_prefix" != no; then 31088c9fbc29Smrg # Add the "lib" prefix for modules if required 31098c9fbc29Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31108c9fbc29Smrg eval shared_ext=\"$shrext_cmds\" 31118c9fbc29Smrg eval libname=\"$libname_spec\" 31128c9fbc29Smrg else 31138c9fbc29Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31148c9fbc29Smrg fi 31158c9fbc29Smrg ;; 31168c9fbc29Smrg esac 31178c9fbc29Smrg 31188c9fbc29Smrg if test -n "$objs"; then 31198c9fbc29Smrg if test "$deplibs_check_method" != pass_all; then 31208c9fbc29Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 31218c9fbc29Smrg exit $EXIT_FAILURE 31228c9fbc29Smrg else 31238c9fbc29Smrg $echo 31248c9fbc29Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 31258c9fbc29Smrg $echo "*** objects $objs is not portable!" 31268c9fbc29Smrg libobjs="$libobjs $objs" 31278c9fbc29Smrg fi 31288c9fbc29Smrg fi 31298c9fbc29Smrg 31308c9fbc29Smrg if test "$dlself" != no; then 31318c9fbc29Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 31328c9fbc29Smrg fi 31338c9fbc29Smrg 31348c9fbc29Smrg set dummy $rpath 31358c9fbc29Smrg if test "$#" -gt 2; then 31368c9fbc29Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 31378c9fbc29Smrg fi 31388c9fbc29Smrg install_libdir="$2" 31398c9fbc29Smrg 31408c9fbc29Smrg oldlibs= 31418c9fbc29Smrg if test -z "$rpath"; then 31428c9fbc29Smrg if test "$build_libtool_libs" = yes; then 31438c9fbc29Smrg # Building a libtool convenience library. 31448c9fbc29Smrg # Some compilers have problems with a `.al' extension so 31458c9fbc29Smrg # convenience libraries should have the same extension an 31468c9fbc29Smrg # archive normally would. 31478c9fbc29Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 31488c9fbc29Smrg build_libtool_libs=convenience 31498c9fbc29Smrg build_old_libs=yes 31508c9fbc29Smrg fi 31518c9fbc29Smrg 31528c9fbc29Smrg if test -n "$vinfo"; then 31538c9fbc29Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 31548c9fbc29Smrg fi 31558c9fbc29Smrg 31568c9fbc29Smrg if test -n "$release"; then 31578c9fbc29Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 31588c9fbc29Smrg fi 31598c9fbc29Smrg else 31608c9fbc29Smrg 31618c9fbc29Smrg # Parse the version information argument. 31628c9fbc29Smrg save_ifs="$IFS"; IFS=':' 31638c9fbc29Smrg set dummy $vinfo 0 0 0 31648c9fbc29Smrg IFS="$save_ifs" 31658c9fbc29Smrg 31668c9fbc29Smrg if test -n "$8"; then 31678c9fbc29Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 31688c9fbc29Smrg $echo "$help" 1>&2 31698c9fbc29Smrg exit $EXIT_FAILURE 31708c9fbc29Smrg fi 31718c9fbc29Smrg 31728c9fbc29Smrg # convert absolute version numbers to libtool ages 31738c9fbc29Smrg # this retains compatibility with .la files and attempts 31748c9fbc29Smrg # to make the code below a bit more comprehensible 31758c9fbc29Smrg 31768c9fbc29Smrg case $vinfo_number in 31778c9fbc29Smrg yes) 31788c9fbc29Smrg number_major="$2" 31798c9fbc29Smrg number_minor="$3" 31808c9fbc29Smrg number_revision="$4" 31818c9fbc29Smrg # 31828c9fbc29Smrg # There are really only two kinds -- those that 31838c9fbc29Smrg # use the current revision as the major version 31848c9fbc29Smrg # and those that subtract age and use age as 31858c9fbc29Smrg # a minor version. But, then there is irix 31868c9fbc29Smrg # which has an extra 1 added just for fun 31878c9fbc29Smrg # 31888c9fbc29Smrg case $version_type in 31898c9fbc29Smrg darwin|linux|osf|windows) 31908c9fbc29Smrg current=`expr $number_major + $number_minor` 31918c9fbc29Smrg age="$number_minor" 31928c9fbc29Smrg revision="$number_revision" 31938c9fbc29Smrg ;; 31948c9fbc29Smrg freebsd-aout|freebsd-elf|sunos) 31958c9fbc29Smrg current="$number_major" 31968c9fbc29Smrg revision="$number_minor" 31978c9fbc29Smrg age="0" 31988c9fbc29Smrg ;; 31998c9fbc29Smrg irix|nonstopux) 32008c9fbc29Smrg current=`expr $number_major + $number_minor - 1` 32018c9fbc29Smrg age="$number_minor" 32028c9fbc29Smrg revision="$number_minor" 32038c9fbc29Smrg ;; 32048c9fbc29Smrg esac 32058c9fbc29Smrg ;; 32068c9fbc29Smrg no) 32078c9fbc29Smrg current="$2" 32088c9fbc29Smrg revision="$3" 32098c9fbc29Smrg age="$4" 32108c9fbc29Smrg ;; 32118c9fbc29Smrg esac 32128c9fbc29Smrg 32138c9fbc29Smrg # Check that each of the things are valid numbers. 32148c9fbc29Smrg case $current in 32158c9fbc29Smrg 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]) ;; 32168c9fbc29Smrg *) 32178c9fbc29Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 32188c9fbc29Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32198c9fbc29Smrg exit $EXIT_FAILURE 32208c9fbc29Smrg ;; 32218c9fbc29Smrg esac 32228c9fbc29Smrg 32238c9fbc29Smrg case $revision in 32248c9fbc29Smrg 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]) ;; 32258c9fbc29Smrg *) 32268c9fbc29Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 32278c9fbc29Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32288c9fbc29Smrg exit $EXIT_FAILURE 32298c9fbc29Smrg ;; 32308c9fbc29Smrg esac 32318c9fbc29Smrg 32328c9fbc29Smrg case $age in 32338c9fbc29Smrg 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]) ;; 32348c9fbc29Smrg *) 32358c9fbc29Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 32368c9fbc29Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32378c9fbc29Smrg exit $EXIT_FAILURE 32388c9fbc29Smrg ;; 32398c9fbc29Smrg esac 32408c9fbc29Smrg 32418c9fbc29Smrg if test "$age" -gt "$current"; then 32428c9fbc29Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 32438c9fbc29Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32448c9fbc29Smrg exit $EXIT_FAILURE 32458c9fbc29Smrg fi 32468c9fbc29Smrg 32478c9fbc29Smrg # Calculate the version variables. 32488c9fbc29Smrg major= 32498c9fbc29Smrg versuffix= 32508c9fbc29Smrg verstring= 32518c9fbc29Smrg case $version_type in 32528c9fbc29Smrg none) ;; 32538c9fbc29Smrg 32548c9fbc29Smrg darwin) 32558c9fbc29Smrg # Like Linux, but with the current version available in 32568c9fbc29Smrg # verstring for coding it into the library header 32578c9fbc29Smrg major=.`expr $current - $age` 32588c9fbc29Smrg versuffix="$major.$age.$revision" 32598c9fbc29Smrg # Darwin ld doesn't like 0 for these options... 32608c9fbc29Smrg minor_current=`expr $current + 1` 32618c9fbc29Smrg verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 32628c9fbc29Smrg ;; 32638c9fbc29Smrg 32648c9fbc29Smrg freebsd-aout) 32658c9fbc29Smrg major=".$current" 32668c9fbc29Smrg versuffix=".$current.$revision"; 32678c9fbc29Smrg ;; 32688c9fbc29Smrg 32698c9fbc29Smrg freebsd-elf) 32708c9fbc29Smrg major=".$current" 32718c9fbc29Smrg versuffix=".$current"; 32728c9fbc29Smrg ;; 32738c9fbc29Smrg 32748c9fbc29Smrg irix | nonstopux) 32758c9fbc29Smrg major=`expr $current - $age + 1` 32768c9fbc29Smrg 32778c9fbc29Smrg case $version_type in 32788c9fbc29Smrg nonstopux) verstring_prefix=nonstopux ;; 32798c9fbc29Smrg *) verstring_prefix=sgi ;; 32808c9fbc29Smrg esac 32818c9fbc29Smrg verstring="$verstring_prefix$major.$revision" 32828c9fbc29Smrg 32838c9fbc29Smrg # Add in all the interfaces that we are compatible with. 32848c9fbc29Smrg loop=$revision 32858c9fbc29Smrg while test "$loop" -ne 0; do 32868c9fbc29Smrg iface=`expr $revision - $loop` 32878c9fbc29Smrg loop=`expr $loop - 1` 32888c9fbc29Smrg verstring="$verstring_prefix$major.$iface:$verstring" 32898c9fbc29Smrg done 32908c9fbc29Smrg 32918c9fbc29Smrg # Before this point, $major must not contain `.'. 32928c9fbc29Smrg major=.$major 32938c9fbc29Smrg versuffix="$major.$revision" 32948c9fbc29Smrg ;; 32958c9fbc29Smrg 32968c9fbc29Smrg linux) 32978c9fbc29Smrg major=.`expr $current - $age` 32988c9fbc29Smrg versuffix="$major.$age.$revision" 32998c9fbc29Smrg ;; 33008c9fbc29Smrg 33018c9fbc29Smrg osf) 33028c9fbc29Smrg major=.`expr $current - $age` 33038c9fbc29Smrg versuffix=".$current.$age.$revision" 33048c9fbc29Smrg verstring="$current.$age.$revision" 33058c9fbc29Smrg 33068c9fbc29Smrg # Add in all the interfaces that we are compatible with. 33078c9fbc29Smrg loop=$age 33088c9fbc29Smrg while test "$loop" -ne 0; do 33098c9fbc29Smrg iface=`expr $current - $loop` 33108c9fbc29Smrg loop=`expr $loop - 1` 33118c9fbc29Smrg verstring="$verstring:${iface}.0" 33128c9fbc29Smrg done 33138c9fbc29Smrg 33148c9fbc29Smrg # Make executables depend on our current version. 33158c9fbc29Smrg verstring="$verstring:${current}.0" 33168c9fbc29Smrg ;; 33178c9fbc29Smrg 33188c9fbc29Smrg sunos) 33198c9fbc29Smrg major=".$current" 33208c9fbc29Smrg versuffix=".$current.$revision" 33218c9fbc29Smrg ;; 33228c9fbc29Smrg 33238c9fbc29Smrg windows) 33248c9fbc29Smrg # Use '-' rather than '.', since we only want one 33258c9fbc29Smrg # extension on DOS 8.3 filesystems. 33268c9fbc29Smrg major=`expr $current - $age` 33278c9fbc29Smrg versuffix="-$major" 33288c9fbc29Smrg ;; 33298c9fbc29Smrg 33308c9fbc29Smrg *) 33318c9fbc29Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 33328c9fbc29Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 33338c9fbc29Smrg exit $EXIT_FAILURE 33348c9fbc29Smrg ;; 33358c9fbc29Smrg esac 33368c9fbc29Smrg 33378c9fbc29Smrg # Clear the version info if we defaulted, and they specified a release. 33388c9fbc29Smrg if test -z "$vinfo" && test -n "$release"; then 33398c9fbc29Smrg major= 33408c9fbc29Smrg case $version_type in 33418c9fbc29Smrg darwin) 33428c9fbc29Smrg # we can't check for "0.0" in archive_cmds due to quoting 33438c9fbc29Smrg # problems, so we reset it completely 33448c9fbc29Smrg verstring= 33458c9fbc29Smrg ;; 33468c9fbc29Smrg *) 33478c9fbc29Smrg verstring="0.0" 33488c9fbc29Smrg ;; 33498c9fbc29Smrg esac 33508c9fbc29Smrg if test "$need_version" = no; then 33518c9fbc29Smrg versuffix= 33528c9fbc29Smrg else 33538c9fbc29Smrg versuffix=".0.0" 33548c9fbc29Smrg fi 33558c9fbc29Smrg fi 33568c9fbc29Smrg 33578c9fbc29Smrg # Remove version info from name if versioning should be avoided 33588c9fbc29Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 33598c9fbc29Smrg major= 33608c9fbc29Smrg versuffix= 33618c9fbc29Smrg verstring="" 33628c9fbc29Smrg fi 33638c9fbc29Smrg 33648c9fbc29Smrg # Check to see if the archive will have undefined symbols. 33658c9fbc29Smrg if test "$allow_undefined" = yes; then 33668c9fbc29Smrg if test "$allow_undefined_flag" = unsupported; then 33678c9fbc29Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 33688c9fbc29Smrg build_libtool_libs=no 33698c9fbc29Smrg build_old_libs=yes 33708c9fbc29Smrg fi 33718c9fbc29Smrg else 33728c9fbc29Smrg # Don't allow undefined symbols. 33738c9fbc29Smrg allow_undefined_flag="$no_undefined_flag" 33748c9fbc29Smrg fi 33758c9fbc29Smrg fi 33768c9fbc29Smrg 33778c9fbc29Smrg if test "$mode" != relink; then 33788c9fbc29Smrg # Remove our outputs, but don't remove object files since they 33798c9fbc29Smrg # may have been created when compiling PIC objects. 33808c9fbc29Smrg removelist= 33818c9fbc29Smrg tempremovelist=`$echo "$output_objdir/*"` 33828c9fbc29Smrg for p in $tempremovelist; do 33838c9fbc29Smrg case $p in 33848c9fbc29Smrg *.$objext) 33858c9fbc29Smrg ;; 33868c9fbc29Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 33878c9fbc29Smrg if test "X$precious_files_regex" != "X"; then 33888c9fbc29Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 33898c9fbc29Smrg then 33908c9fbc29Smrg continue 33918c9fbc29Smrg fi 33928c9fbc29Smrg fi 33938c9fbc29Smrg removelist="$removelist $p" 33948c9fbc29Smrg ;; 33958c9fbc29Smrg *) ;; 33968c9fbc29Smrg esac 33978c9fbc29Smrg done 33988c9fbc29Smrg if test -n "$removelist"; then 33998c9fbc29Smrg $show "${rm}r $removelist" 34008c9fbc29Smrg $run ${rm}r $removelist 34018c9fbc29Smrg fi 34028c9fbc29Smrg fi 34038c9fbc29Smrg 34048c9fbc29Smrg # Now set the variables for building old libraries. 34058c9fbc29Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 34068c9fbc29Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 34078c9fbc29Smrg 34088c9fbc29Smrg # Transform .lo files to .o files. 34098c9fbc29Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 34108c9fbc29Smrg fi 34118c9fbc29Smrg 34128c9fbc29Smrg # Eliminate all temporary directories. 34138c9fbc29Smrg for path in $notinst_path; do 34148c9fbc29Smrg lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 34158c9fbc29Smrg deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 34168c9fbc29Smrg dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 34178c9fbc29Smrg done 34188c9fbc29Smrg 34198c9fbc29Smrg if test -n "$xrpath"; then 34208c9fbc29Smrg # If the user specified any rpath flags, then add them. 34218c9fbc29Smrg temp_xrpath= 34228c9fbc29Smrg for libdir in $xrpath; do 34238c9fbc29Smrg temp_xrpath="$temp_xrpath -R$libdir" 34248c9fbc29Smrg case "$finalize_rpath " in 34258c9fbc29Smrg *" $libdir "*) ;; 34268c9fbc29Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 34278c9fbc29Smrg esac 34288c9fbc29Smrg done 34298c9fbc29Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 34308c9fbc29Smrg dependency_libs="$temp_xrpath $dependency_libs" 34318c9fbc29Smrg fi 34328c9fbc29Smrg fi 34338c9fbc29Smrg 34348c9fbc29Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 34358c9fbc29Smrg old_dlfiles="$dlfiles" 34368c9fbc29Smrg dlfiles= 34378c9fbc29Smrg for lib in $old_dlfiles; do 34388c9fbc29Smrg case " $dlprefiles $dlfiles " in 34398c9fbc29Smrg *" $lib "*) ;; 34408c9fbc29Smrg *) dlfiles="$dlfiles $lib" ;; 34418c9fbc29Smrg esac 34428c9fbc29Smrg done 34438c9fbc29Smrg 34448c9fbc29Smrg # Make sure dlprefiles contains only unique files 34458c9fbc29Smrg old_dlprefiles="$dlprefiles" 34468c9fbc29Smrg dlprefiles= 34478c9fbc29Smrg for lib in $old_dlprefiles; do 34488c9fbc29Smrg case "$dlprefiles " in 34498c9fbc29Smrg *" $lib "*) ;; 34508c9fbc29Smrg *) dlprefiles="$dlprefiles $lib" ;; 34518c9fbc29Smrg esac 34528c9fbc29Smrg done 34538c9fbc29Smrg 34548c9fbc29Smrg if test "$build_libtool_libs" = yes; then 34558c9fbc29Smrg if test -n "$rpath"; then 34568c9fbc29Smrg case $host in 34578c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 34588c9fbc29Smrg # these systems don't actually have a c library (as such)! 34598c9fbc29Smrg ;; 34608c9fbc29Smrg *-*-rhapsody* | *-*-darwin1.[012]) 34618c9fbc29Smrg # Rhapsody C library is in the System framework 34628c9fbc29Smrg deplibs="$deplibs -framework System" 34638c9fbc29Smrg ;; 34648c9fbc29Smrg *-*-netbsd*) 34658c9fbc29Smrg # Don't link with libc until the a.out ld.so is fixed. 34668c9fbc29Smrg ;; 34678c9fbc29Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 34688c9fbc29Smrg # Do not include libc due to us having libc/libc_r. 34698c9fbc29Smrg ;; 34708c9fbc29Smrg *-*-sco3.2v5* | *-*-sco5v6*) 34718c9fbc29Smrg # Causes problems with __ctype 34728c9fbc29Smrg ;; 34738c9fbc29Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 34748c9fbc29Smrg # Compiler inserts libc in the correct place for threads to work 34758c9fbc29Smrg ;; 34768c9fbc29Smrg *) 34778c9fbc29Smrg # Add libc to deplibs on all other systems if necessary. 34788c9fbc29Smrg if test "$build_libtool_need_lc" = "yes"; then 34798c9fbc29Smrg deplibs="$deplibs -lc" 34808c9fbc29Smrg fi 34818c9fbc29Smrg ;; 34828c9fbc29Smrg esac 34838c9fbc29Smrg fi 34848c9fbc29Smrg 34858c9fbc29Smrg # Transform deplibs into only deplibs that can be linked in shared. 34868c9fbc29Smrg name_save=$name 34878c9fbc29Smrg libname_save=$libname 34888c9fbc29Smrg release_save=$release 34898c9fbc29Smrg versuffix_save=$versuffix 34908c9fbc29Smrg major_save=$major 34918c9fbc29Smrg # I'm not sure if I'm treating the release correctly. I think 34928c9fbc29Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 34938c9fbc29Smrg # add it in twice. Is that correct? 34948c9fbc29Smrg release="" 34958c9fbc29Smrg versuffix="" 34968c9fbc29Smrg major="" 34978c9fbc29Smrg newdeplibs= 34988c9fbc29Smrg droppeddeps=no 34998c9fbc29Smrg case $deplibs_check_method in 35008c9fbc29Smrg pass_all) 35018c9fbc29Smrg # Don't check for shared/static. Everything works. 35028c9fbc29Smrg # This might be a little naive. We might want to check 35038c9fbc29Smrg # whether the library exists or not. But this is on 35048c9fbc29Smrg # osf3 & osf4 and I'm not really sure... Just 35058c9fbc29Smrg # implementing what was already the behavior. 35068c9fbc29Smrg newdeplibs=$deplibs 35078c9fbc29Smrg ;; 35088c9fbc29Smrg test_compile) 35098c9fbc29Smrg # This code stresses the "libraries are programs" paradigm to its 35108c9fbc29Smrg # limits. Maybe even breaks it. We compile a program, linking it 35118c9fbc29Smrg # against the deplibs as a proxy for the library. Then we can check 35128c9fbc29Smrg # whether they linked in statically or dynamically with ldd. 35138c9fbc29Smrg $rm conftest.c 35148c9fbc29Smrg cat > conftest.c <<EOF 35158c9fbc29Smrg int main() { return 0; } 35168c9fbc29SmrgEOF 35178c9fbc29Smrg $rm conftest 35188c9fbc29Smrg $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 35198c9fbc29Smrg if test "$?" -eq 0 ; then 35208c9fbc29Smrg ldd_output=`ldd conftest` 35218c9fbc29Smrg for i in $deplibs; do 35228c9fbc29Smrg name=`expr $i : '-l\(.*\)'` 35238c9fbc29Smrg # If $name is empty we are operating on a -L argument. 35248c9fbc29Smrg if test "$name" != "" && test "$name" -ne "0"; then 35258c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 35268c9fbc29Smrg case " $predeps $postdeps " in 35278c9fbc29Smrg *" $i "*) 35288c9fbc29Smrg newdeplibs="$newdeplibs $i" 35298c9fbc29Smrg i="" 35308c9fbc29Smrg ;; 35318c9fbc29Smrg esac 35328c9fbc29Smrg fi 35338c9fbc29Smrg if test -n "$i" ; then 35348c9fbc29Smrg libname=`eval \\$echo \"$libname_spec\"` 35358c9fbc29Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 35368c9fbc29Smrg set dummy $deplib_matches 35378c9fbc29Smrg deplib_match=$2 35388c9fbc29Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 35398c9fbc29Smrg newdeplibs="$newdeplibs $i" 35408c9fbc29Smrg else 35418c9fbc29Smrg droppeddeps=yes 35428c9fbc29Smrg $echo 35438c9fbc29Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 35448c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 35458c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 35468c9fbc29Smrg $echo "*** shared version of the library, which I believe you do not have" 35478c9fbc29Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 35488c9fbc29Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 35498c9fbc29Smrg fi 35508c9fbc29Smrg fi 35518c9fbc29Smrg else 35528c9fbc29Smrg newdeplibs="$newdeplibs $i" 35538c9fbc29Smrg fi 35548c9fbc29Smrg done 35558c9fbc29Smrg else 35568c9fbc29Smrg # Error occurred in the first compile. Let's try to salvage 35578c9fbc29Smrg # the situation: Compile a separate program for each library. 35588c9fbc29Smrg for i in $deplibs; do 35598c9fbc29Smrg name=`expr $i : '-l\(.*\)'` 35608c9fbc29Smrg # If $name is empty we are operating on a -L argument. 35618c9fbc29Smrg if test "$name" != "" && test "$name" != "0"; then 35628c9fbc29Smrg $rm conftest 35638c9fbc29Smrg $LTCC $LTCFLAGS -o conftest conftest.c $i 35648c9fbc29Smrg # Did it work? 35658c9fbc29Smrg if test "$?" -eq 0 ; then 35668c9fbc29Smrg ldd_output=`ldd conftest` 35678c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 35688c9fbc29Smrg case " $predeps $postdeps " in 35698c9fbc29Smrg *" $i "*) 35708c9fbc29Smrg newdeplibs="$newdeplibs $i" 35718c9fbc29Smrg i="" 35728c9fbc29Smrg ;; 35738c9fbc29Smrg esac 35748c9fbc29Smrg fi 35758c9fbc29Smrg if test -n "$i" ; then 35768c9fbc29Smrg libname=`eval \\$echo \"$libname_spec\"` 35778c9fbc29Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 35788c9fbc29Smrg set dummy $deplib_matches 35798c9fbc29Smrg deplib_match=$2 35808c9fbc29Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 35818c9fbc29Smrg newdeplibs="$newdeplibs $i" 35828c9fbc29Smrg else 35838c9fbc29Smrg droppeddeps=yes 35848c9fbc29Smrg $echo 35858c9fbc29Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 35868c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 35878c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 35888c9fbc29Smrg $echo "*** shared version of the library, which you do not appear to have" 35898c9fbc29Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 35908c9fbc29Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 35918c9fbc29Smrg fi 35928c9fbc29Smrg fi 35938c9fbc29Smrg else 35948c9fbc29Smrg droppeddeps=yes 35958c9fbc29Smrg $echo 35968c9fbc29Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 35978c9fbc29Smrg $echo "*** make it link in! You will probably need to install it or some" 35988c9fbc29Smrg $echo "*** library that it depends on before this library will be fully" 35998c9fbc29Smrg $echo "*** functional. Installing it before continuing would be even better." 36008c9fbc29Smrg fi 36018c9fbc29Smrg else 36028c9fbc29Smrg newdeplibs="$newdeplibs $i" 36038c9fbc29Smrg fi 36048c9fbc29Smrg done 36058c9fbc29Smrg fi 36068c9fbc29Smrg ;; 36078c9fbc29Smrg file_magic*) 36088c9fbc29Smrg set dummy $deplibs_check_method 36098c9fbc29Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36108c9fbc29Smrg for a_deplib in $deplibs; do 36118c9fbc29Smrg name=`expr $a_deplib : '-l\(.*\)'` 36128c9fbc29Smrg # If $name is empty we are operating on a -L argument. 36138c9fbc29Smrg if test "$name" != "" && test "$name" != "0"; then 36148c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36158c9fbc29Smrg case " $predeps $postdeps " in 36168c9fbc29Smrg *" $a_deplib "*) 36178c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 36188c9fbc29Smrg a_deplib="" 36198c9fbc29Smrg ;; 36208c9fbc29Smrg esac 36218c9fbc29Smrg fi 36228c9fbc29Smrg if test -n "$a_deplib" ; then 36238c9fbc29Smrg libname=`eval \\$echo \"$libname_spec\"` 36248c9fbc29Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 36258c9fbc29Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 36268c9fbc29Smrg for potent_lib in $potential_libs; do 36278c9fbc29Smrg # Follow soft links. 36288c9fbc29Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 36298c9fbc29Smrg | grep " -> " >/dev/null; then 36308c9fbc29Smrg continue 36318c9fbc29Smrg fi 36328c9fbc29Smrg # The statement above tries to avoid entering an 36338c9fbc29Smrg # endless loop below, in case of cyclic links. 36348c9fbc29Smrg # We might still enter an endless loop, since a link 36358c9fbc29Smrg # loop can be closed while we follow links, 36368c9fbc29Smrg # but so what? 36378c9fbc29Smrg potlib="$potent_lib" 36388c9fbc29Smrg while test -h "$potlib" 2>/dev/null; do 36398c9fbc29Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 36408c9fbc29Smrg case $potliblink in 36418c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 36428c9fbc29Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 36438c9fbc29Smrg esac 36448c9fbc29Smrg done 36458c9fbc29Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 36468c9fbc29Smrg | ${SED} 10q \ 36478c9fbc29Smrg | $EGREP "$file_magic_regex" > /dev/null; then 36488c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 36498c9fbc29Smrg a_deplib="" 36508c9fbc29Smrg break 2 36518c9fbc29Smrg fi 36528c9fbc29Smrg done 36538c9fbc29Smrg done 36548c9fbc29Smrg fi 36558c9fbc29Smrg if test -n "$a_deplib" ; then 36568c9fbc29Smrg droppeddeps=yes 36578c9fbc29Smrg $echo 36588c9fbc29Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 36598c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 36608c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 36618c9fbc29Smrg $echo "*** shared version of the library, which you do not appear to have" 36628c9fbc29Smrg $echo "*** because I did check the linker path looking for a file starting" 36638c9fbc29Smrg if test -z "$potlib" ; then 36648c9fbc29Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 36658c9fbc29Smrg else 36668c9fbc29Smrg $echo "*** with $libname and none of the candidates passed a file format test" 36678c9fbc29Smrg $echo "*** using a file magic. Last file checked: $potlib" 36688c9fbc29Smrg fi 36698c9fbc29Smrg fi 36708c9fbc29Smrg else 36718c9fbc29Smrg # Add a -L argument. 36728c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 36738c9fbc29Smrg fi 36748c9fbc29Smrg done # Gone through all deplibs. 36758c9fbc29Smrg ;; 36768c9fbc29Smrg match_pattern*) 36778c9fbc29Smrg set dummy $deplibs_check_method 36788c9fbc29Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36798c9fbc29Smrg for a_deplib in $deplibs; do 36808c9fbc29Smrg name=`expr $a_deplib : '-l\(.*\)'` 36818c9fbc29Smrg # If $name is empty we are operating on a -L argument. 36828c9fbc29Smrg if test -n "$name" && test "$name" != "0"; then 36838c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36848c9fbc29Smrg case " $predeps $postdeps " in 36858c9fbc29Smrg *" $a_deplib "*) 36868c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 36878c9fbc29Smrg a_deplib="" 36888c9fbc29Smrg ;; 36898c9fbc29Smrg esac 36908c9fbc29Smrg fi 36918c9fbc29Smrg if test -n "$a_deplib" ; then 36928c9fbc29Smrg libname=`eval \\$echo \"$libname_spec\"` 36938c9fbc29Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 36948c9fbc29Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 36958c9fbc29Smrg for potent_lib in $potential_libs; do 36968c9fbc29Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 36978c9fbc29Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 36988c9fbc29Smrg | ${SED} 10q \ 36998c9fbc29Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 37008c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 37018c9fbc29Smrg a_deplib="" 37028c9fbc29Smrg break 2 37038c9fbc29Smrg fi 37048c9fbc29Smrg done 37058c9fbc29Smrg done 37068c9fbc29Smrg fi 37078c9fbc29Smrg if test -n "$a_deplib" ; then 37088c9fbc29Smrg droppeddeps=yes 37098c9fbc29Smrg $echo 37108c9fbc29Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 37118c9fbc29Smrg $echo "*** I have the capability to make that library automatically link in when" 37128c9fbc29Smrg $echo "*** you link to this library. But I can only do this if you have a" 37138c9fbc29Smrg $echo "*** shared version of the library, which you do not appear to have" 37148c9fbc29Smrg $echo "*** because I did check the linker path looking for a file starting" 37158c9fbc29Smrg if test -z "$potlib" ; then 37168c9fbc29Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 37178c9fbc29Smrg else 37188c9fbc29Smrg $echo "*** with $libname and none of the candidates passed a file format test" 37198c9fbc29Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 37208c9fbc29Smrg fi 37218c9fbc29Smrg fi 37228c9fbc29Smrg else 37238c9fbc29Smrg # Add a -L argument. 37248c9fbc29Smrg newdeplibs="$newdeplibs $a_deplib" 37258c9fbc29Smrg fi 37268c9fbc29Smrg done # Gone through all deplibs. 37278c9fbc29Smrg ;; 37288c9fbc29Smrg none | unknown | *) 37298c9fbc29Smrg newdeplibs="" 37308c9fbc29Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 37318c9fbc29Smrg -e 's/ -[LR][^ ]*//g'` 37328c9fbc29Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37338c9fbc29Smrg for i in $predeps $postdeps ; do 37348c9fbc29Smrg # can't use Xsed below, because $i might contain '/' 37358c9fbc29Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 37368c9fbc29Smrg done 37378c9fbc29Smrg fi 37388c9fbc29Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 37398c9fbc29Smrg | grep . >/dev/null; then 37408c9fbc29Smrg $echo 37418c9fbc29Smrg if test "X$deplibs_check_method" = "Xnone"; then 37428c9fbc29Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 37438c9fbc29Smrg else 37448c9fbc29Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 37458c9fbc29Smrg fi 37468c9fbc29Smrg $echo "*** All declared inter-library dependencies are being dropped." 37478c9fbc29Smrg droppeddeps=yes 37488c9fbc29Smrg fi 37498c9fbc29Smrg ;; 37508c9fbc29Smrg esac 37518c9fbc29Smrg versuffix=$versuffix_save 37528c9fbc29Smrg major=$major_save 37538c9fbc29Smrg release=$release_save 37548c9fbc29Smrg libname=$libname_save 37558c9fbc29Smrg name=$name_save 37568c9fbc29Smrg 37578c9fbc29Smrg case $host in 37588c9fbc29Smrg *-*-rhapsody* | *-*-darwin1.[012]) 37598c9fbc29Smrg # On Rhapsody replace the C library is the System framework 37608c9fbc29Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 37618c9fbc29Smrg ;; 37628c9fbc29Smrg esac 37638c9fbc29Smrg 37648c9fbc29Smrg if test "$droppeddeps" = yes; then 37658c9fbc29Smrg if test "$module" = yes; then 37668c9fbc29Smrg $echo 37678c9fbc29Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 37688c9fbc29Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 37698c9fbc29Smrg $echo "*** a static module, that should work as long as the dlopening" 37708c9fbc29Smrg $echo "*** application is linked with the -dlopen flag." 37718c9fbc29Smrg if test -z "$global_symbol_pipe"; then 37728c9fbc29Smrg $echo 37738c9fbc29Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 37748c9fbc29Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 37758c9fbc29Smrg $echo "*** not find such a program. So, this module is probably useless." 37768c9fbc29Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 37778c9fbc29Smrg fi 37788c9fbc29Smrg if test "$build_old_libs" = no; then 37798c9fbc29Smrg oldlibs="$output_objdir/$libname.$libext" 37808c9fbc29Smrg build_libtool_libs=module 37818c9fbc29Smrg build_old_libs=yes 37828c9fbc29Smrg else 37838c9fbc29Smrg build_libtool_libs=no 37848c9fbc29Smrg fi 37858c9fbc29Smrg else 37868c9fbc29Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 37878c9fbc29Smrg $echo "*** automatically added whenever a program is linked with this library" 37888c9fbc29Smrg $echo "*** or is declared to -dlopen it." 37898c9fbc29Smrg 37908c9fbc29Smrg if test "$allow_undefined" = no; then 37918c9fbc29Smrg $echo 37928c9fbc29Smrg $echo "*** Since this library must not contain undefined symbols," 37938c9fbc29Smrg $echo "*** because either the platform does not support them or" 37948c9fbc29Smrg $echo "*** it was explicitly requested with -no-undefined," 37958c9fbc29Smrg $echo "*** libtool will only create a static version of it." 37968c9fbc29Smrg if test "$build_old_libs" = no; then 37978c9fbc29Smrg oldlibs="$output_objdir/$libname.$libext" 37988c9fbc29Smrg build_libtool_libs=module 37998c9fbc29Smrg build_old_libs=yes 38008c9fbc29Smrg else 38018c9fbc29Smrg build_libtool_libs=no 38028c9fbc29Smrg fi 38038c9fbc29Smrg fi 38048c9fbc29Smrg fi 38058c9fbc29Smrg fi 38068c9fbc29Smrg # Done checking deplibs! 38078c9fbc29Smrg deplibs=$newdeplibs 38088c9fbc29Smrg fi 38098c9fbc29Smrg 38108c9fbc29Smrg 38118c9fbc29Smrg # move library search paths that coincide with paths to not yet 38128c9fbc29Smrg # installed libraries to the beginning of the library search list 38138c9fbc29Smrg new_libs= 38148c9fbc29Smrg for path in $notinst_path; do 38158c9fbc29Smrg case " $new_libs " in 38168c9fbc29Smrg *" -L$path/$objdir "*) ;; 38178c9fbc29Smrg *) 38188c9fbc29Smrg case " $deplibs " in 38198c9fbc29Smrg *" -L$path/$objdir "*) 38208c9fbc29Smrg new_libs="$new_libs -L$path/$objdir" ;; 38218c9fbc29Smrg esac 38228c9fbc29Smrg ;; 38238c9fbc29Smrg esac 38248c9fbc29Smrg done 38258c9fbc29Smrg for deplib in $deplibs; do 38268c9fbc29Smrg case $deplib in 38278c9fbc29Smrg -L*) 38288c9fbc29Smrg case " $new_libs " in 38298c9fbc29Smrg *" $deplib "*) ;; 38308c9fbc29Smrg *) new_libs="$new_libs $deplib" ;; 38318c9fbc29Smrg esac 38328c9fbc29Smrg ;; 38338c9fbc29Smrg *) new_libs="$new_libs $deplib" ;; 38348c9fbc29Smrg esac 38358c9fbc29Smrg done 38368c9fbc29Smrg deplibs="$new_libs" 38378c9fbc29Smrg 38388c9fbc29Smrg 38398c9fbc29Smrg # All the library-specific variables (install_libdir is set above). 38408c9fbc29Smrg library_names= 38418c9fbc29Smrg old_library= 38428c9fbc29Smrg dlname= 38438c9fbc29Smrg 38448c9fbc29Smrg # Test again, we may have decided not to build it any more 38458c9fbc29Smrg if test "$build_libtool_libs" = yes; then 38468c9fbc29Smrg if test "$hardcode_into_libs" = yes; then 38478c9fbc29Smrg # Hardcode the library paths 38488c9fbc29Smrg hardcode_libdirs= 38498c9fbc29Smrg dep_rpath= 38508c9fbc29Smrg rpath="$finalize_rpath" 38518c9fbc29Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 38528c9fbc29Smrg for libdir in $rpath; do 38538c9fbc29Smrg if test -n "$hardcode_libdir_flag_spec"; then 38548c9fbc29Smrg if test -n "$hardcode_libdir_separator"; then 38558c9fbc29Smrg if test -z "$hardcode_libdirs"; then 38568c9fbc29Smrg hardcode_libdirs="$libdir" 38578c9fbc29Smrg else 38588c9fbc29Smrg # Just accumulate the unique libdirs. 38598c9fbc29Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 38608c9fbc29Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 38618c9fbc29Smrg ;; 38628c9fbc29Smrg *) 38638c9fbc29Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 38648c9fbc29Smrg ;; 38658c9fbc29Smrg esac 38668c9fbc29Smrg fi 38678c9fbc29Smrg else 38688c9fbc29Smrg eval flag=\"$hardcode_libdir_flag_spec\" 38698c9fbc29Smrg dep_rpath="$dep_rpath $flag" 38708c9fbc29Smrg fi 38718c9fbc29Smrg elif test -n "$runpath_var"; then 38728c9fbc29Smrg case "$perm_rpath " in 38738c9fbc29Smrg *" $libdir "*) ;; 38748c9fbc29Smrg *) perm_rpath="$perm_rpath $libdir" ;; 38758c9fbc29Smrg esac 38768c9fbc29Smrg fi 38778c9fbc29Smrg done 38788c9fbc29Smrg # Substitute the hardcoded libdirs into the rpath. 38798c9fbc29Smrg if test -n "$hardcode_libdir_separator" && 38808c9fbc29Smrg test -n "$hardcode_libdirs"; then 38818c9fbc29Smrg libdir="$hardcode_libdirs" 38828c9fbc29Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 38838c9fbc29Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 38848c9fbc29Smrg else 38858c9fbc29Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 38868c9fbc29Smrg fi 38878c9fbc29Smrg fi 38888c9fbc29Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 38898c9fbc29Smrg # We should set the runpath_var. 38908c9fbc29Smrg rpath= 38918c9fbc29Smrg for dir in $perm_rpath; do 38928c9fbc29Smrg rpath="$rpath$dir:" 38938c9fbc29Smrg done 38948c9fbc29Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 38958c9fbc29Smrg fi 38968c9fbc29Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 38978c9fbc29Smrg fi 38988c9fbc29Smrg 38998c9fbc29Smrg shlibpath="$finalize_shlibpath" 39008c9fbc29Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 39018c9fbc29Smrg if test -n "$shlibpath"; then 39028c9fbc29Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 39038c9fbc29Smrg fi 39048c9fbc29Smrg 39058c9fbc29Smrg # Get the real and link names of the library. 39068c9fbc29Smrg eval shared_ext=\"$shrext_cmds\" 39078c9fbc29Smrg eval library_names=\"$library_names_spec\" 39088c9fbc29Smrg set dummy $library_names 39098c9fbc29Smrg realname="$2" 39108c9fbc29Smrg shift; shift 39118c9fbc29Smrg 39128c9fbc29Smrg if test -n "$soname_spec"; then 39138c9fbc29Smrg eval soname=\"$soname_spec\" 39148c9fbc29Smrg else 39158c9fbc29Smrg soname="$realname" 39168c9fbc29Smrg fi 39178c9fbc29Smrg if test -z "$dlname"; then 39188c9fbc29Smrg dlname=$soname 39198c9fbc29Smrg fi 39208c9fbc29Smrg 39218c9fbc29Smrg lib="$output_objdir/$realname" 39228c9fbc29Smrg linknames= 39238c9fbc29Smrg for link 39248c9fbc29Smrg do 39258c9fbc29Smrg linknames="$linknames $link" 39268c9fbc29Smrg done 39278c9fbc29Smrg 39288c9fbc29Smrg # Use standard objects if they are pic 39298c9fbc29Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 39308c9fbc29Smrg 39318c9fbc29Smrg # Prepare the list of exported symbols 39328c9fbc29Smrg if test -z "$export_symbols"; then 39338c9fbc29Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 39348c9fbc29Smrg $show "generating symbol list for \`$libname.la'" 39358c9fbc29Smrg export_symbols="$output_objdir/$libname.exp" 39368c9fbc29Smrg $run $rm $export_symbols 39378c9fbc29Smrg cmds=$export_symbols_cmds 39388c9fbc29Smrg save_ifs="$IFS"; IFS='~' 39398c9fbc29Smrg for cmd in $cmds; do 39408c9fbc29Smrg IFS="$save_ifs" 39418c9fbc29Smrg eval cmd=\"$cmd\" 39428c9fbc29Smrg if len=`expr "X$cmd" : ".*"` && 39438c9fbc29Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 39448c9fbc29Smrg $show "$cmd" 39458c9fbc29Smrg $run eval "$cmd" || exit $? 39468c9fbc29Smrg skipped_export=false 39478c9fbc29Smrg else 39488c9fbc29Smrg # The command line is too long to execute in one step. 39498c9fbc29Smrg $show "using reloadable object file for export list..." 39508c9fbc29Smrg skipped_export=: 39518c9fbc29Smrg # Break out early, otherwise skipped_export may be 39528c9fbc29Smrg # set to false by a later but shorter cmd. 39538c9fbc29Smrg break 39548c9fbc29Smrg fi 39558c9fbc29Smrg done 39568c9fbc29Smrg IFS="$save_ifs" 39578c9fbc29Smrg if test -n "$export_symbols_regex"; then 39588c9fbc29Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 39598c9fbc29Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 39608c9fbc29Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 39618c9fbc29Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 39628c9fbc29Smrg fi 39638c9fbc29Smrg fi 39648c9fbc29Smrg fi 39658c9fbc29Smrg 39668c9fbc29Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 39678c9fbc29Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 39688c9fbc29Smrg fi 39698c9fbc29Smrg 39708c9fbc29Smrg tmp_deplibs= 39718c9fbc29Smrg for test_deplib in $deplibs; do 39728c9fbc29Smrg case " $convenience " in 39738c9fbc29Smrg *" $test_deplib "*) ;; 39748c9fbc29Smrg *) 39758c9fbc29Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 39768c9fbc29Smrg ;; 39778c9fbc29Smrg esac 39788c9fbc29Smrg done 39798c9fbc29Smrg deplibs="$tmp_deplibs" 39808c9fbc29Smrg 39818c9fbc29Smrg if test -n "$convenience"; then 39828c9fbc29Smrg if test -n "$whole_archive_flag_spec"; then 39838c9fbc29Smrg save_libobjs=$libobjs 39848c9fbc29Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 39858c9fbc29Smrg else 39868c9fbc29Smrg gentop="$output_objdir/${outputname}x" 39878c9fbc29Smrg generated="$generated $gentop" 39888c9fbc29Smrg 39898c9fbc29Smrg func_extract_archives $gentop $convenience 39908c9fbc29Smrg libobjs="$libobjs $func_extract_archives_result" 39918c9fbc29Smrg fi 39928c9fbc29Smrg fi 39938c9fbc29Smrg 39948c9fbc29Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 39958c9fbc29Smrg eval flag=\"$thread_safe_flag_spec\" 39968c9fbc29Smrg linker_flags="$linker_flags $flag" 39978c9fbc29Smrg fi 39988c9fbc29Smrg 39998c9fbc29Smrg # Make a backup of the uninstalled library when relinking 40008c9fbc29Smrg if test "$mode" = relink; then 40018c9fbc29Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 40028c9fbc29Smrg fi 40038c9fbc29Smrg 40048c9fbc29Smrg # Do each of the archive commands. 40058c9fbc29Smrg if test "$module" = yes && test -n "$module_cmds" ; then 40068c9fbc29Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 40078c9fbc29Smrg eval test_cmds=\"$module_expsym_cmds\" 40088c9fbc29Smrg cmds=$module_expsym_cmds 40098c9fbc29Smrg else 40108c9fbc29Smrg eval test_cmds=\"$module_cmds\" 40118c9fbc29Smrg cmds=$module_cmds 40128c9fbc29Smrg fi 40138c9fbc29Smrg else 40148c9fbc29Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 40158c9fbc29Smrg eval test_cmds=\"$archive_expsym_cmds\" 40168c9fbc29Smrg cmds=$archive_expsym_cmds 40178c9fbc29Smrg else 40188c9fbc29Smrg eval test_cmds=\"$archive_cmds\" 40198c9fbc29Smrg cmds=$archive_cmds 40208c9fbc29Smrg fi 40218c9fbc29Smrg fi 40228c9fbc29Smrg 40238c9fbc29Smrg if test "X$skipped_export" != "X:" && 40248c9fbc29Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 40258c9fbc29Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40268c9fbc29Smrg : 40278c9fbc29Smrg else 40288c9fbc29Smrg # The command line is too long to link in one step, link piecewise. 40298c9fbc29Smrg $echo "creating reloadable object files..." 40308c9fbc29Smrg 40318c9fbc29Smrg # Save the value of $output and $libobjs because we want to 40328c9fbc29Smrg # use them later. If we have whole_archive_flag_spec, we 40338c9fbc29Smrg # want to use save_libobjs as it was before 40348c9fbc29Smrg # whole_archive_flag_spec was expanded, because we can't 40358c9fbc29Smrg # assume the linker understands whole_archive_flag_spec. 40368c9fbc29Smrg # This may have to be revisited, in case too many 40378c9fbc29Smrg # convenience libraries get linked in and end up exceeding 40388c9fbc29Smrg # the spec. 40398c9fbc29Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 40408c9fbc29Smrg save_libobjs=$libobjs 40418c9fbc29Smrg fi 40428c9fbc29Smrg save_output=$output 40438c9fbc29Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 40448c9fbc29Smrg 40458c9fbc29Smrg # Clear the reloadable object creation command queue and 40468c9fbc29Smrg # initialize k to one. 40478c9fbc29Smrg test_cmds= 40488c9fbc29Smrg concat_cmds= 40498c9fbc29Smrg objlist= 40508c9fbc29Smrg delfiles= 40518c9fbc29Smrg last_robj= 40528c9fbc29Smrg k=1 40538c9fbc29Smrg output=$output_objdir/$output_la-${k}.$objext 40548c9fbc29Smrg # Loop over the list of objects to be linked. 40558c9fbc29Smrg for obj in $save_libobjs 40568c9fbc29Smrg do 40578c9fbc29Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 40588c9fbc29Smrg if test "X$objlist" = X || 40598c9fbc29Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 40608c9fbc29Smrg test "$len" -le "$max_cmd_len"; }; then 40618c9fbc29Smrg objlist="$objlist $obj" 40628c9fbc29Smrg else 40638c9fbc29Smrg # The command $test_cmds is almost too long, add a 40648c9fbc29Smrg # command to the queue. 40658c9fbc29Smrg if test "$k" -eq 1 ; then 40668c9fbc29Smrg # The first file doesn't have a previous command to add. 40678c9fbc29Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 40688c9fbc29Smrg else 40698c9fbc29Smrg # All subsequent reloadable object files will link in 40708c9fbc29Smrg # the last one created. 40718c9fbc29Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 40728c9fbc29Smrg fi 40738c9fbc29Smrg last_robj=$output_objdir/$output_la-${k}.$objext 40748c9fbc29Smrg k=`expr $k + 1` 40758c9fbc29Smrg output=$output_objdir/$output_la-${k}.$objext 40768c9fbc29Smrg objlist=$obj 40778c9fbc29Smrg len=1 40788c9fbc29Smrg fi 40798c9fbc29Smrg done 40808c9fbc29Smrg # Handle the remaining objects by creating one last 40818c9fbc29Smrg # reloadable object file. All subsequent reloadable object 40828c9fbc29Smrg # files will link in the last one created. 40838c9fbc29Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 40848c9fbc29Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 40858c9fbc29Smrg 40868c9fbc29Smrg if ${skipped_export-false}; then 40878c9fbc29Smrg $show "generating symbol list for \`$libname.la'" 40888c9fbc29Smrg export_symbols="$output_objdir/$libname.exp" 40898c9fbc29Smrg $run $rm $export_symbols 40908c9fbc29Smrg libobjs=$output 40918c9fbc29Smrg # Append the command to create the export file. 40928c9fbc29Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 40938c9fbc29Smrg fi 40948c9fbc29Smrg 40958c9fbc29Smrg # Set up a command to remove the reloadable object files 40968c9fbc29Smrg # after they are used. 40978c9fbc29Smrg i=0 40988c9fbc29Smrg while test "$i" -lt "$k" 40998c9fbc29Smrg do 41008c9fbc29Smrg i=`expr $i + 1` 41018c9fbc29Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 41028c9fbc29Smrg done 41038c9fbc29Smrg 41048c9fbc29Smrg $echo "creating a temporary reloadable object file: $output" 41058c9fbc29Smrg 41068c9fbc29Smrg # Loop through the commands generated above and execute them. 41078c9fbc29Smrg save_ifs="$IFS"; IFS='~' 41088c9fbc29Smrg for cmd in $concat_cmds; do 41098c9fbc29Smrg IFS="$save_ifs" 41108c9fbc29Smrg $show "$cmd" 41118c9fbc29Smrg $run eval "$cmd" || exit $? 41128c9fbc29Smrg done 41138c9fbc29Smrg IFS="$save_ifs" 41148c9fbc29Smrg 41158c9fbc29Smrg libobjs=$output 41168c9fbc29Smrg # Restore the value of output. 41178c9fbc29Smrg output=$save_output 41188c9fbc29Smrg 41198c9fbc29Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 41208c9fbc29Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 41218c9fbc29Smrg fi 41228c9fbc29Smrg # Expand the library linking commands again to reset the 41238c9fbc29Smrg # value of $libobjs for piecewise linking. 41248c9fbc29Smrg 41258c9fbc29Smrg # Do each of the archive commands. 41268c9fbc29Smrg if test "$module" = yes && test -n "$module_cmds" ; then 41278c9fbc29Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 41288c9fbc29Smrg cmds=$module_expsym_cmds 41298c9fbc29Smrg else 41308c9fbc29Smrg cmds=$module_cmds 41318c9fbc29Smrg fi 41328c9fbc29Smrg else 41338c9fbc29Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 41348c9fbc29Smrg cmds=$archive_expsym_cmds 41358c9fbc29Smrg else 41368c9fbc29Smrg cmds=$archive_cmds 41378c9fbc29Smrg fi 41388c9fbc29Smrg fi 41398c9fbc29Smrg 41408c9fbc29Smrg # Append the command to remove the reloadable object files 41418c9fbc29Smrg # to the just-reset $cmds. 41428c9fbc29Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 41438c9fbc29Smrg fi 41448c9fbc29Smrg save_ifs="$IFS"; IFS='~' 41458c9fbc29Smrg for cmd in $cmds; do 41468c9fbc29Smrg IFS="$save_ifs" 41478c9fbc29Smrg eval cmd=\"$cmd\" 41488c9fbc29Smrg $show "$cmd" 41498c9fbc29Smrg $run eval "$cmd" || { 41508c9fbc29Smrg lt_exit=$? 41518c9fbc29Smrg 41528c9fbc29Smrg # Restore the uninstalled library and exit 41538c9fbc29Smrg if test "$mode" = relink; then 41548c9fbc29Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 41558c9fbc29Smrg fi 41568c9fbc29Smrg 41578c9fbc29Smrg exit $lt_exit 41588c9fbc29Smrg } 41598c9fbc29Smrg done 41608c9fbc29Smrg IFS="$save_ifs" 41618c9fbc29Smrg 41628c9fbc29Smrg # Restore the uninstalled library and exit 41638c9fbc29Smrg if test "$mode" = relink; then 41648c9fbc29Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 41658c9fbc29Smrg 41668c9fbc29Smrg if test -n "$convenience"; then 41678c9fbc29Smrg if test -z "$whole_archive_flag_spec"; then 41688c9fbc29Smrg $show "${rm}r $gentop" 41698c9fbc29Smrg $run ${rm}r "$gentop" 41708c9fbc29Smrg fi 41718c9fbc29Smrg fi 41728c9fbc29Smrg 41738c9fbc29Smrg exit $EXIT_SUCCESS 41748c9fbc29Smrg fi 41758c9fbc29Smrg 41768c9fbc29Smrg # Create links to the real library. 41778c9fbc29Smrg for linkname in $linknames; do 41788c9fbc29Smrg if test "$realname" != "$linkname"; then 41798c9fbc29Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 41808c9fbc29Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 41818c9fbc29Smrg fi 41828c9fbc29Smrg done 41838c9fbc29Smrg 41848c9fbc29Smrg # If -module or -export-dynamic was specified, set the dlname. 41858c9fbc29Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 41868c9fbc29Smrg # On all known operating systems, these are identical. 41878c9fbc29Smrg dlname="$soname" 41888c9fbc29Smrg fi 41898c9fbc29Smrg fi 41908c9fbc29Smrg ;; 41918c9fbc29Smrg 41928c9fbc29Smrg obj) 41938c9fbc29Smrg if test -n "$deplibs"; then 41948c9fbc29Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 41958c9fbc29Smrg fi 41968c9fbc29Smrg 41978c9fbc29Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 41988c9fbc29Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 41998c9fbc29Smrg fi 42008c9fbc29Smrg 42018c9fbc29Smrg if test -n "$rpath"; then 42028c9fbc29Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 42038c9fbc29Smrg fi 42048c9fbc29Smrg 42058c9fbc29Smrg if test -n "$xrpath"; then 42068c9fbc29Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 42078c9fbc29Smrg fi 42088c9fbc29Smrg 42098c9fbc29Smrg if test -n "$vinfo"; then 42108c9fbc29Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 42118c9fbc29Smrg fi 42128c9fbc29Smrg 42138c9fbc29Smrg if test -n "$release"; then 42148c9fbc29Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 42158c9fbc29Smrg fi 42168c9fbc29Smrg 42178c9fbc29Smrg case $output in 42188c9fbc29Smrg *.lo) 42198c9fbc29Smrg if test -n "$objs$old_deplibs"; then 42208c9fbc29Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 42218c9fbc29Smrg exit $EXIT_FAILURE 42228c9fbc29Smrg fi 42238c9fbc29Smrg libobj="$output" 42248c9fbc29Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 42258c9fbc29Smrg ;; 42268c9fbc29Smrg *) 42278c9fbc29Smrg libobj= 42288c9fbc29Smrg obj="$output" 42298c9fbc29Smrg ;; 42308c9fbc29Smrg esac 42318c9fbc29Smrg 42328c9fbc29Smrg # Delete the old objects. 42338c9fbc29Smrg $run $rm $obj $libobj 42348c9fbc29Smrg 42358c9fbc29Smrg # Objects from convenience libraries. This assumes 42368c9fbc29Smrg # single-version convenience libraries. Whenever we create 42378c9fbc29Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 42388c9fbc29Smrg # the extraction. 42398c9fbc29Smrg reload_conv_objs= 42408c9fbc29Smrg gentop= 42418c9fbc29Smrg # reload_cmds runs $LD directly, so let us get rid of 42428c9fbc29Smrg # -Wl from whole_archive_flag_spec 42438c9fbc29Smrg wl= 42448c9fbc29Smrg 42458c9fbc29Smrg if test -n "$convenience"; then 42468c9fbc29Smrg if test -n "$whole_archive_flag_spec"; then 42478c9fbc29Smrg eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 42488c9fbc29Smrg else 42498c9fbc29Smrg gentop="$output_objdir/${obj}x" 42508c9fbc29Smrg generated="$generated $gentop" 42518c9fbc29Smrg 42528c9fbc29Smrg func_extract_archives $gentop $convenience 42538c9fbc29Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 42548c9fbc29Smrg fi 42558c9fbc29Smrg fi 42568c9fbc29Smrg 42578c9fbc29Smrg # Create the old-style object. 42588c9fbc29Smrg 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 42598c9fbc29Smrg 42608c9fbc29Smrg output="$obj" 42618c9fbc29Smrg cmds=$reload_cmds 42628c9fbc29Smrg save_ifs="$IFS"; IFS='~' 42638c9fbc29Smrg for cmd in $cmds; do 42648c9fbc29Smrg IFS="$save_ifs" 42658c9fbc29Smrg eval cmd=\"$cmd\" 42668c9fbc29Smrg $show "$cmd" 42678c9fbc29Smrg $run eval "$cmd" || exit $? 42688c9fbc29Smrg done 42698c9fbc29Smrg IFS="$save_ifs" 42708c9fbc29Smrg 42718c9fbc29Smrg # Exit if we aren't doing a library object file. 42728c9fbc29Smrg if test -z "$libobj"; then 42738c9fbc29Smrg if test -n "$gentop"; then 42748c9fbc29Smrg $show "${rm}r $gentop" 42758c9fbc29Smrg $run ${rm}r $gentop 42768c9fbc29Smrg fi 42778c9fbc29Smrg 42788c9fbc29Smrg exit $EXIT_SUCCESS 42798c9fbc29Smrg fi 42808c9fbc29Smrg 42818c9fbc29Smrg if test "$build_libtool_libs" != yes; then 42828c9fbc29Smrg if test -n "$gentop"; then 42838c9fbc29Smrg $show "${rm}r $gentop" 42848c9fbc29Smrg $run ${rm}r $gentop 42858c9fbc29Smrg fi 42868c9fbc29Smrg 42878c9fbc29Smrg # Create an invalid libtool object if no PIC, so that we don't 42888c9fbc29Smrg # accidentally link it into a program. 42898c9fbc29Smrg # $show "echo timestamp > $libobj" 42908c9fbc29Smrg # $run eval "echo timestamp > $libobj" || exit $? 42918c9fbc29Smrg exit $EXIT_SUCCESS 42928c9fbc29Smrg fi 42938c9fbc29Smrg 42948c9fbc29Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 42958c9fbc29Smrg # Only do commands if we really have different PIC objects. 42968c9fbc29Smrg reload_objs="$libobjs $reload_conv_objs" 42978c9fbc29Smrg output="$libobj" 42988c9fbc29Smrg cmds=$reload_cmds 42998c9fbc29Smrg save_ifs="$IFS"; IFS='~' 43008c9fbc29Smrg for cmd in $cmds; do 43018c9fbc29Smrg IFS="$save_ifs" 43028c9fbc29Smrg eval cmd=\"$cmd\" 43038c9fbc29Smrg $show "$cmd" 43048c9fbc29Smrg $run eval "$cmd" || exit $? 43058c9fbc29Smrg done 43068c9fbc29Smrg IFS="$save_ifs" 43078c9fbc29Smrg fi 43088c9fbc29Smrg 43098c9fbc29Smrg if test -n "$gentop"; then 43108c9fbc29Smrg $show "${rm}r $gentop" 43118c9fbc29Smrg $run ${rm}r $gentop 43128c9fbc29Smrg fi 43138c9fbc29Smrg 43148c9fbc29Smrg exit $EXIT_SUCCESS 43158c9fbc29Smrg ;; 43168c9fbc29Smrg 43178c9fbc29Smrg prog) 43188c9fbc29Smrg case $host in 43198c9fbc29Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 43208c9fbc29Smrg esac 43218c9fbc29Smrg if test -n "$vinfo"; then 43228c9fbc29Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 43238c9fbc29Smrg fi 43248c9fbc29Smrg 43258c9fbc29Smrg if test -n "$release"; then 43268c9fbc29Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 43278c9fbc29Smrg fi 43288c9fbc29Smrg 43298c9fbc29Smrg if test "$preload" = yes; then 43308c9fbc29Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 43318c9fbc29Smrg test "$dlopen_self_static" = unknown; then 43328c9fbc29Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 43338c9fbc29Smrg fi 43348c9fbc29Smrg fi 43358c9fbc29Smrg 43368c9fbc29Smrg case $host in 43378c9fbc29Smrg *-*-rhapsody* | *-*-darwin1.[012]) 43388c9fbc29Smrg # On Rhapsody replace the C library is the System framework 43398c9fbc29Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 43408c9fbc29Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 43418c9fbc29Smrg ;; 43428c9fbc29Smrg esac 43438c9fbc29Smrg 43448c9fbc29Smrg case $host in 43458c9fbc29Smrg *darwin*) 43468c9fbc29Smrg # Don't allow lazy linking, it breaks C++ global constructors 43478c9fbc29Smrg if test "$tagname" = CXX ; then 43488c9fbc29Smrg compile_command="$compile_command ${wl}-bind_at_load" 43498c9fbc29Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 43508c9fbc29Smrg fi 43518c9fbc29Smrg ;; 43528c9fbc29Smrg esac 43538c9fbc29Smrg 43548c9fbc29Smrg 43558c9fbc29Smrg # move library search paths that coincide with paths to not yet 43568c9fbc29Smrg # installed libraries to the beginning of the library search list 43578c9fbc29Smrg new_libs= 43588c9fbc29Smrg for path in $notinst_path; do 43598c9fbc29Smrg case " $new_libs " in 43608c9fbc29Smrg *" -L$path/$objdir "*) ;; 43618c9fbc29Smrg *) 43628c9fbc29Smrg case " $compile_deplibs " in 43638c9fbc29Smrg *" -L$path/$objdir "*) 43648c9fbc29Smrg new_libs="$new_libs -L$path/$objdir" ;; 43658c9fbc29Smrg esac 43668c9fbc29Smrg ;; 43678c9fbc29Smrg esac 43688c9fbc29Smrg done 43698c9fbc29Smrg for deplib in $compile_deplibs; do 43708c9fbc29Smrg case $deplib in 43718c9fbc29Smrg -L*) 43728c9fbc29Smrg case " $new_libs " in 43738c9fbc29Smrg *" $deplib "*) ;; 43748c9fbc29Smrg *) new_libs="$new_libs $deplib" ;; 43758c9fbc29Smrg esac 43768c9fbc29Smrg ;; 43778c9fbc29Smrg *) new_libs="$new_libs $deplib" ;; 43788c9fbc29Smrg esac 43798c9fbc29Smrg done 43808c9fbc29Smrg compile_deplibs="$new_libs" 43818c9fbc29Smrg 43828c9fbc29Smrg 43838c9fbc29Smrg compile_command="$compile_command $compile_deplibs" 43848c9fbc29Smrg finalize_command="$finalize_command $finalize_deplibs" 43858c9fbc29Smrg 43868c9fbc29Smrg if test -n "$rpath$xrpath"; then 43878c9fbc29Smrg # If the user specified any rpath flags, then add them. 43888c9fbc29Smrg for libdir in $rpath $xrpath; do 43898c9fbc29Smrg # This is the magic to use -rpath. 43908c9fbc29Smrg case "$finalize_rpath " in 43918c9fbc29Smrg *" $libdir "*) ;; 43928c9fbc29Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 43938c9fbc29Smrg esac 43948c9fbc29Smrg done 43958c9fbc29Smrg fi 43968c9fbc29Smrg 43978c9fbc29Smrg # Now hardcode the library paths 43988c9fbc29Smrg rpath= 43998c9fbc29Smrg hardcode_libdirs= 44008c9fbc29Smrg for libdir in $compile_rpath $finalize_rpath; do 44018c9fbc29Smrg if test -n "$hardcode_libdir_flag_spec"; then 44028c9fbc29Smrg if test -n "$hardcode_libdir_separator"; then 44038c9fbc29Smrg if test -z "$hardcode_libdirs"; then 44048c9fbc29Smrg hardcode_libdirs="$libdir" 44058c9fbc29Smrg else 44068c9fbc29Smrg # Just accumulate the unique libdirs. 44078c9fbc29Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44088c9fbc29Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44098c9fbc29Smrg ;; 44108c9fbc29Smrg *) 44118c9fbc29Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44128c9fbc29Smrg ;; 44138c9fbc29Smrg esac 44148c9fbc29Smrg fi 44158c9fbc29Smrg else 44168c9fbc29Smrg eval flag=\"$hardcode_libdir_flag_spec\" 44178c9fbc29Smrg rpath="$rpath $flag" 44188c9fbc29Smrg fi 44198c9fbc29Smrg elif test -n "$runpath_var"; then 44208c9fbc29Smrg case "$perm_rpath " in 44218c9fbc29Smrg *" $libdir "*) ;; 44228c9fbc29Smrg *) perm_rpath="$perm_rpath $libdir" ;; 44238c9fbc29Smrg esac 44248c9fbc29Smrg fi 44258c9fbc29Smrg case $host in 44268c9fbc29Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 44278c9fbc29Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 44288c9fbc29Smrg case :$dllsearchpath: in 44298c9fbc29Smrg *":$libdir:"*) ;; 44308c9fbc29Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 44318c9fbc29Smrg esac 44328c9fbc29Smrg case :$dllsearchpath: in 44338c9fbc29Smrg *":$testbindir:"*) ;; 44348c9fbc29Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 44358c9fbc29Smrg esac 44368c9fbc29Smrg ;; 44378c9fbc29Smrg esac 44388c9fbc29Smrg done 44398c9fbc29Smrg # Substitute the hardcoded libdirs into the rpath. 44408c9fbc29Smrg if test -n "$hardcode_libdir_separator" && 44418c9fbc29Smrg test -n "$hardcode_libdirs"; then 44428c9fbc29Smrg libdir="$hardcode_libdirs" 44438c9fbc29Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 44448c9fbc29Smrg fi 44458c9fbc29Smrg compile_rpath="$rpath" 44468c9fbc29Smrg 44478c9fbc29Smrg rpath= 44488c9fbc29Smrg hardcode_libdirs= 44498c9fbc29Smrg for libdir in $finalize_rpath; do 44508c9fbc29Smrg if test -n "$hardcode_libdir_flag_spec"; then 44518c9fbc29Smrg if test -n "$hardcode_libdir_separator"; then 44528c9fbc29Smrg if test -z "$hardcode_libdirs"; then 44538c9fbc29Smrg hardcode_libdirs="$libdir" 44548c9fbc29Smrg else 44558c9fbc29Smrg # Just accumulate the unique libdirs. 44568c9fbc29Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44578c9fbc29Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44588c9fbc29Smrg ;; 44598c9fbc29Smrg *) 44608c9fbc29Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44618c9fbc29Smrg ;; 44628c9fbc29Smrg esac 44638c9fbc29Smrg fi 44648c9fbc29Smrg else 44658c9fbc29Smrg eval flag=\"$hardcode_libdir_flag_spec\" 44668c9fbc29Smrg rpath="$rpath $flag" 44678c9fbc29Smrg fi 44688c9fbc29Smrg elif test -n "$runpath_var"; then 44698c9fbc29Smrg case "$finalize_perm_rpath " in 44708c9fbc29Smrg *" $libdir "*) ;; 44718c9fbc29Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 44728c9fbc29Smrg esac 44738c9fbc29Smrg fi 44748c9fbc29Smrg done 44758c9fbc29Smrg # Substitute the hardcoded libdirs into the rpath. 44768c9fbc29Smrg if test -n "$hardcode_libdir_separator" && 44778c9fbc29Smrg test -n "$hardcode_libdirs"; then 44788c9fbc29Smrg libdir="$hardcode_libdirs" 44798c9fbc29Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 44808c9fbc29Smrg fi 44818c9fbc29Smrg finalize_rpath="$rpath" 44828c9fbc29Smrg 44838c9fbc29Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 44848c9fbc29Smrg # Transform all the library objects into standard objects. 44858c9fbc29Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 44868c9fbc29Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 44878c9fbc29Smrg fi 44888c9fbc29Smrg 44898c9fbc29Smrg dlsyms= 44908c9fbc29Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 44918c9fbc29Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 44928c9fbc29Smrg dlsyms="${outputname}S.c" 44938c9fbc29Smrg else 44948c9fbc29Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 44958c9fbc29Smrg fi 44968c9fbc29Smrg fi 44978c9fbc29Smrg 44988c9fbc29Smrg if test -n "$dlsyms"; then 44998c9fbc29Smrg case $dlsyms in 45008c9fbc29Smrg "") ;; 45018c9fbc29Smrg *.c) 45028c9fbc29Smrg # Discover the nlist of each of the dlfiles. 45038c9fbc29Smrg nlist="$output_objdir/${outputname}.nm" 45048c9fbc29Smrg 45058c9fbc29Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 45068c9fbc29Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 45078c9fbc29Smrg 45088c9fbc29Smrg # Parse the name list into a source file. 45098c9fbc29Smrg $show "creating $output_objdir/$dlsyms" 45108c9fbc29Smrg 45118c9fbc29Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 45128c9fbc29Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 45138c9fbc29Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 45148c9fbc29Smrg 45158c9fbc29Smrg#ifdef __cplusplus 45168c9fbc29Smrgextern \"C\" { 45178c9fbc29Smrg#endif 45188c9fbc29Smrg 45198c9fbc29Smrg/* Prevent the only kind of declaration conflicts we can make. */ 45208c9fbc29Smrg#define lt_preloaded_symbols some_other_symbol 45218c9fbc29Smrg 45228c9fbc29Smrg/* External symbol declarations for the compiler. */\ 45238c9fbc29Smrg" 45248c9fbc29Smrg 45258c9fbc29Smrg if test "$dlself" = yes; then 45268c9fbc29Smrg $show "generating symbol list for \`$output'" 45278c9fbc29Smrg 45288c9fbc29Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 45298c9fbc29Smrg 45308c9fbc29Smrg # Add our own program objects to the symbol list. 45318c9fbc29Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45328c9fbc29Smrg for arg in $progfiles; do 45338c9fbc29Smrg $show "extracting global C symbols from \`$arg'" 45348c9fbc29Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 45358c9fbc29Smrg done 45368c9fbc29Smrg 45378c9fbc29Smrg if test -n "$exclude_expsyms"; then 45388c9fbc29Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 45398c9fbc29Smrg $run eval '$mv "$nlist"T "$nlist"' 45408c9fbc29Smrg fi 45418c9fbc29Smrg 45428c9fbc29Smrg if test -n "$export_symbols_regex"; then 45438c9fbc29Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 45448c9fbc29Smrg $run eval '$mv "$nlist"T "$nlist"' 45458c9fbc29Smrg fi 45468c9fbc29Smrg 45478c9fbc29Smrg # Prepare the list of exported symbols 45488c9fbc29Smrg if test -z "$export_symbols"; then 45498c9fbc29Smrg export_symbols="$output_objdir/$outputname.exp" 45508c9fbc29Smrg $run $rm $export_symbols 45518c9fbc29Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 45528c9fbc29Smrg case $host in 45538c9fbc29Smrg *cygwin* | *mingw* ) 45548c9fbc29Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 45558c9fbc29Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 45568c9fbc29Smrg ;; 45578c9fbc29Smrg esac 45588c9fbc29Smrg else 45598c9fbc29Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 45608c9fbc29Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 45618c9fbc29Smrg $run eval 'mv "$nlist"T "$nlist"' 45628c9fbc29Smrg case $host in 45638c9fbc29Smrg *cygwin* | *mingw* ) 45648c9fbc29Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 45658c9fbc29Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 45668c9fbc29Smrg ;; 45678c9fbc29Smrg esac 45688c9fbc29Smrg fi 45698c9fbc29Smrg fi 45708c9fbc29Smrg 45718c9fbc29Smrg for arg in $dlprefiles; do 45728c9fbc29Smrg $show "extracting global C symbols from \`$arg'" 45738c9fbc29Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 45748c9fbc29Smrg $run eval '$echo ": $name " >> "$nlist"' 45758c9fbc29Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 45768c9fbc29Smrg done 45778c9fbc29Smrg 45788c9fbc29Smrg if test -z "$run"; then 45798c9fbc29Smrg # Make sure we have at least an empty file. 45808c9fbc29Smrg test -f "$nlist" || : > "$nlist" 45818c9fbc29Smrg 45828c9fbc29Smrg if test -n "$exclude_expsyms"; then 45838c9fbc29Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 45848c9fbc29Smrg $mv "$nlist"T "$nlist" 45858c9fbc29Smrg fi 45868c9fbc29Smrg 45878c9fbc29Smrg # Try sorting and uniquifying the output. 45888c9fbc29Smrg if grep -v "^: " < "$nlist" | 45898c9fbc29Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 45908c9fbc29Smrg sort -k 3 45918c9fbc29Smrg else 45928c9fbc29Smrg sort +2 45938c9fbc29Smrg fi | 45948c9fbc29Smrg uniq > "$nlist"S; then 45958c9fbc29Smrg : 45968c9fbc29Smrg else 45978c9fbc29Smrg grep -v "^: " < "$nlist" > "$nlist"S 45988c9fbc29Smrg fi 45998c9fbc29Smrg 46008c9fbc29Smrg if test -f "$nlist"S; then 46018c9fbc29Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 46028c9fbc29Smrg else 46038c9fbc29Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 46048c9fbc29Smrg fi 46058c9fbc29Smrg 46068c9fbc29Smrg $echo >> "$output_objdir/$dlsyms" "\ 46078c9fbc29Smrg 46088c9fbc29Smrg#undef lt_preloaded_symbols 46098c9fbc29Smrg 46108c9fbc29Smrg#if defined (__STDC__) && __STDC__ 46118c9fbc29Smrg# define lt_ptr void * 46128c9fbc29Smrg#else 46138c9fbc29Smrg# define lt_ptr char * 46148c9fbc29Smrg# define const 46158c9fbc29Smrg#endif 46168c9fbc29Smrg 46178c9fbc29Smrg/* The mapping between symbol names and symbols. */ 46188c9fbc29Smrg" 46198c9fbc29Smrg 46208c9fbc29Smrg case $host in 46218c9fbc29Smrg *cygwin* | *mingw* ) 46228c9fbc29Smrg $echo >> "$output_objdir/$dlsyms" "\ 46238c9fbc29Smrg/* DATA imports from DLLs on WIN32 can't be const, because 46248c9fbc29Smrg runtime relocations are performed -- see ld's documentation 46258c9fbc29Smrg on pseudo-relocs */ 46268c9fbc29Smrgstruct { 46278c9fbc29Smrg" 46288c9fbc29Smrg ;; 46298c9fbc29Smrg * ) 46308c9fbc29Smrg $echo >> "$output_objdir/$dlsyms" "\ 46318c9fbc29Smrgconst struct { 46328c9fbc29Smrg" 46338c9fbc29Smrg ;; 46348c9fbc29Smrg esac 46358c9fbc29Smrg 46368c9fbc29Smrg 46378c9fbc29Smrg $echo >> "$output_objdir/$dlsyms" "\ 46388c9fbc29Smrg const char *name; 46398c9fbc29Smrg lt_ptr address; 46408c9fbc29Smrg} 46418c9fbc29Smrglt_preloaded_symbols[] = 46428c9fbc29Smrg{\ 46438c9fbc29Smrg" 46448c9fbc29Smrg 46458c9fbc29Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 46468c9fbc29Smrg 46478c9fbc29Smrg $echo >> "$output_objdir/$dlsyms" "\ 46488c9fbc29Smrg {0, (lt_ptr) 0} 46498c9fbc29Smrg}; 46508c9fbc29Smrg 46518c9fbc29Smrg/* This works around a problem in FreeBSD linker */ 46528c9fbc29Smrg#ifdef FREEBSD_WORKAROUND 46538c9fbc29Smrgstatic const void *lt_preloaded_setup() { 46548c9fbc29Smrg return lt_preloaded_symbols; 46558c9fbc29Smrg} 46568c9fbc29Smrg#endif 46578c9fbc29Smrg 46588c9fbc29Smrg#ifdef __cplusplus 46598c9fbc29Smrg} 46608c9fbc29Smrg#endif\ 46618c9fbc29Smrg" 46628c9fbc29Smrg fi 46638c9fbc29Smrg 46648c9fbc29Smrg pic_flag_for_symtable= 46658c9fbc29Smrg case $host in 46668c9fbc29Smrg # compiling the symbol table file with pic_flag works around 46678c9fbc29Smrg # a FreeBSD bug that causes programs to crash when -lm is 46688c9fbc29Smrg # linked before any other PIC object. But we must not use 46698c9fbc29Smrg # pic_flag when linking with -static. The problem exists in 46708c9fbc29Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 46718c9fbc29Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 46728c9fbc29Smrg case "$compile_command " in 46738c9fbc29Smrg *" -static "*) ;; 46748c9fbc29Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 46758c9fbc29Smrg esac;; 46768c9fbc29Smrg *-*-hpux*) 46778c9fbc29Smrg case "$compile_command " in 46788c9fbc29Smrg *" -static "*) ;; 46798c9fbc29Smrg *) pic_flag_for_symtable=" $pic_flag";; 46808c9fbc29Smrg esac 46818c9fbc29Smrg esac 46828c9fbc29Smrg 46838c9fbc29Smrg # Now compile the dynamic symbol file. 46848c9fbc29Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 46858c9fbc29Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 46868c9fbc29Smrg 46878c9fbc29Smrg # Clean up the generated files. 46888c9fbc29Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 46898c9fbc29Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 46908c9fbc29Smrg 46918c9fbc29Smrg # Transform the symbol file into the correct name. 46928c9fbc29Smrg case $host in 46938c9fbc29Smrg *cygwin* | *mingw* ) 46948c9fbc29Smrg if test -f "$output_objdir/${outputname}.def" ; then 46958c9fbc29Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 46968c9fbc29Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 46978c9fbc29Smrg else 46988c9fbc29Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 46998c9fbc29Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 47008c9fbc29Smrg fi 47018c9fbc29Smrg ;; 47028c9fbc29Smrg * ) 47038c9fbc29Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 47048c9fbc29Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 47058c9fbc29Smrg ;; 47068c9fbc29Smrg esac 47078c9fbc29Smrg ;; 47088c9fbc29Smrg *) 47098c9fbc29Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 47108c9fbc29Smrg exit $EXIT_FAILURE 47118c9fbc29Smrg ;; 47128c9fbc29Smrg esac 47138c9fbc29Smrg else 47148c9fbc29Smrg # We keep going just in case the user didn't refer to 47158c9fbc29Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 47168c9fbc29Smrg # really was required. 47178c9fbc29Smrg 47188c9fbc29Smrg # Nullify the symbol file. 47198c9fbc29Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 47208c9fbc29Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 47218c9fbc29Smrg fi 47228c9fbc29Smrg 47238c9fbc29Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 47248c9fbc29Smrg # Replace the output file specification. 47258c9fbc29Smrg compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 47268c9fbc29Smrg link_command="$compile_command$compile_rpath" 47278c9fbc29Smrg 47288c9fbc29Smrg # We have no uninstalled library dependencies, so finalize right now. 47298c9fbc29Smrg $show "$link_command" 47308c9fbc29Smrg $run eval "$link_command" 47318c9fbc29Smrg exit_status=$? 47328c9fbc29Smrg 47338c9fbc29Smrg # Delete the generated files. 47348c9fbc29Smrg if test -n "$dlsyms"; then 47358c9fbc29Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 47368c9fbc29Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 47378c9fbc29Smrg fi 47388c9fbc29Smrg 47398c9fbc29Smrg exit $exit_status 47408c9fbc29Smrg fi 47418c9fbc29Smrg 47428c9fbc29Smrg if test -n "$shlibpath_var"; then 47438c9fbc29Smrg # We should set the shlibpath_var 47448c9fbc29Smrg rpath= 47458c9fbc29Smrg for dir in $temp_rpath; do 47468c9fbc29Smrg case $dir in 47478c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) 47488c9fbc29Smrg # Absolute path. 47498c9fbc29Smrg rpath="$rpath$dir:" 47508c9fbc29Smrg ;; 47518c9fbc29Smrg *) 47528c9fbc29Smrg # Relative path: add a thisdir entry. 47538c9fbc29Smrg rpath="$rpath\$thisdir/$dir:" 47548c9fbc29Smrg ;; 47558c9fbc29Smrg esac 47568c9fbc29Smrg done 47578c9fbc29Smrg temp_rpath="$rpath" 47588c9fbc29Smrg fi 47598c9fbc29Smrg 47608c9fbc29Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 47618c9fbc29Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 47628c9fbc29Smrg fi 47638c9fbc29Smrg if test -n "$finalize_shlibpath"; then 47648c9fbc29Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 47658c9fbc29Smrg fi 47668c9fbc29Smrg 47678c9fbc29Smrg compile_var= 47688c9fbc29Smrg finalize_var= 47698c9fbc29Smrg if test -n "$runpath_var"; then 47708c9fbc29Smrg if test -n "$perm_rpath"; then 47718c9fbc29Smrg # We should set the runpath_var. 47728c9fbc29Smrg rpath= 47738c9fbc29Smrg for dir in $perm_rpath; do 47748c9fbc29Smrg rpath="$rpath$dir:" 47758c9fbc29Smrg done 47768c9fbc29Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 47778c9fbc29Smrg fi 47788c9fbc29Smrg if test -n "$finalize_perm_rpath"; then 47798c9fbc29Smrg # We should set the runpath_var. 47808c9fbc29Smrg rpath= 47818c9fbc29Smrg for dir in $finalize_perm_rpath; do 47828c9fbc29Smrg rpath="$rpath$dir:" 47838c9fbc29Smrg done 47848c9fbc29Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 47858c9fbc29Smrg fi 47868c9fbc29Smrg fi 47878c9fbc29Smrg 47888c9fbc29Smrg if test "$no_install" = yes; then 47898c9fbc29Smrg # We don't need to create a wrapper script. 47908c9fbc29Smrg link_command="$compile_var$compile_command$compile_rpath" 47918c9fbc29Smrg # Replace the output file specification. 47928c9fbc29Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 47938c9fbc29Smrg # Delete the old output file. 47948c9fbc29Smrg $run $rm $output 47958c9fbc29Smrg # Link the executable and exit 47968c9fbc29Smrg $show "$link_command" 47978c9fbc29Smrg $run eval "$link_command" || exit $? 47988c9fbc29Smrg exit $EXIT_SUCCESS 47998c9fbc29Smrg fi 48008c9fbc29Smrg 48018c9fbc29Smrg if test "$hardcode_action" = relink; then 48028c9fbc29Smrg # Fast installation is not supported 48038c9fbc29Smrg link_command="$compile_var$compile_command$compile_rpath" 48048c9fbc29Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48058c9fbc29Smrg 48068c9fbc29Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 48078c9fbc29Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 48088c9fbc29Smrg else 48098c9fbc29Smrg if test "$fast_install" != no; then 48108c9fbc29Smrg link_command="$finalize_var$compile_command$finalize_rpath" 48118c9fbc29Smrg if test "$fast_install" = yes; then 48128c9fbc29Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 48138c9fbc29Smrg else 48148c9fbc29Smrg # fast_install is set to needless 48158c9fbc29Smrg relink_command= 48168c9fbc29Smrg fi 48178c9fbc29Smrg else 48188c9fbc29Smrg link_command="$compile_var$compile_command$compile_rpath" 48198c9fbc29Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48208c9fbc29Smrg fi 48218c9fbc29Smrg fi 48228c9fbc29Smrg 48238c9fbc29Smrg # Replace the output file specification. 48248c9fbc29Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 48258c9fbc29Smrg 48268c9fbc29Smrg # Delete the old output files. 48278c9fbc29Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 48288c9fbc29Smrg 48298c9fbc29Smrg $show "$link_command" 48308c9fbc29Smrg $run eval "$link_command" || exit $? 48318c9fbc29Smrg 48328c9fbc29Smrg # Now create the wrapper script. 48338c9fbc29Smrg $show "creating $output" 48348c9fbc29Smrg 48358c9fbc29Smrg # Quote the relink command for shipping. 48368c9fbc29Smrg if test -n "$relink_command"; then 48378c9fbc29Smrg # Preserve any variables that may affect compiler behavior 48388c9fbc29Smrg for var in $variables_saved_for_relink; do 48398c9fbc29Smrg if eval test -z \"\${$var+set}\"; then 48408c9fbc29Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 48418c9fbc29Smrg elif eval var_value=\$$var; test -z "$var_value"; then 48428c9fbc29Smrg relink_command="$var=; export $var; $relink_command" 48438c9fbc29Smrg else 48448c9fbc29Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 48458c9fbc29Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 48468c9fbc29Smrg fi 48478c9fbc29Smrg done 48488c9fbc29Smrg relink_command="(cd `pwd`; $relink_command)" 48498c9fbc29Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 48508c9fbc29Smrg fi 48518c9fbc29Smrg 48528c9fbc29Smrg # Quote $echo for shipping. 48538c9fbc29Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 48548c9fbc29Smrg case $progpath in 48558c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 48568c9fbc29Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 48578c9fbc29Smrg esac 48588c9fbc29Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 48598c9fbc29Smrg else 48608c9fbc29Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 48618c9fbc29Smrg fi 48628c9fbc29Smrg 48638c9fbc29Smrg # Only actually do things if our run command is non-null. 48648c9fbc29Smrg if test -z "$run"; then 48658c9fbc29Smrg # win32 will think the script is a binary if it has 48668c9fbc29Smrg # a .exe suffix, so we strip it off here. 48678c9fbc29Smrg case $output in 48688c9fbc29Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 48698c9fbc29Smrg esac 48708c9fbc29Smrg # test for cygwin because mv fails w/o .exe extensions 48718c9fbc29Smrg case $host in 48728c9fbc29Smrg *cygwin*) 48738c9fbc29Smrg exeext=.exe 48748c9fbc29Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 48758c9fbc29Smrg *) exeext= ;; 48768c9fbc29Smrg esac 48778c9fbc29Smrg case $host in 48788c9fbc29Smrg *cygwin* | *mingw* ) 48798c9fbc29Smrg output_name=`basename $output` 48808c9fbc29Smrg output_path=`dirname $output` 48818c9fbc29Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 48828c9fbc29Smrg cwrapper="$output_path/$output_name.exe" 48838c9fbc29Smrg $rm $cwrappersource $cwrapper 48848c9fbc29Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 48858c9fbc29Smrg 48868c9fbc29Smrg cat > $cwrappersource <<EOF 48878c9fbc29Smrg 48888c9fbc29Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 48898c9fbc29Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 48908c9fbc29Smrg 48918c9fbc29Smrg The $output program cannot be directly executed until all the libtool 48928c9fbc29Smrg libraries that it depends on are installed. 48938c9fbc29Smrg 48948c9fbc29Smrg This wrapper executable should never be moved out of the build directory. 48958c9fbc29Smrg If it is, it will not operate correctly. 48968c9fbc29Smrg 48978c9fbc29Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 48988c9fbc29Smrg but could eventually absorb all of the scripts functionality and 48998c9fbc29Smrg exec $objdir/$outputname directly. 49008c9fbc29Smrg*/ 49018c9fbc29SmrgEOF 49028c9fbc29Smrg cat >> $cwrappersource<<"EOF" 49038c9fbc29Smrg#include <stdio.h> 49048c9fbc29Smrg#include <stdlib.h> 49058c9fbc29Smrg#include <unistd.h> 49068c9fbc29Smrg#include <malloc.h> 49078c9fbc29Smrg#include <stdarg.h> 49088c9fbc29Smrg#include <assert.h> 49098c9fbc29Smrg#include <string.h> 49108c9fbc29Smrg#include <ctype.h> 49118c9fbc29Smrg#include <sys/stat.h> 49128c9fbc29Smrg 49138c9fbc29Smrg#if defined(PATH_MAX) 49148c9fbc29Smrg# define LT_PATHMAX PATH_MAX 49158c9fbc29Smrg#elif defined(MAXPATHLEN) 49168c9fbc29Smrg# define LT_PATHMAX MAXPATHLEN 49178c9fbc29Smrg#else 49188c9fbc29Smrg# define LT_PATHMAX 1024 49198c9fbc29Smrg#endif 49208c9fbc29Smrg 49218c9fbc29Smrg#ifndef DIR_SEPARATOR 49228c9fbc29Smrg# define DIR_SEPARATOR '/' 49238c9fbc29Smrg# define PATH_SEPARATOR ':' 49248c9fbc29Smrg#endif 49258c9fbc29Smrg 49268c9fbc29Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 49278c9fbc29Smrg defined (__OS2__) 49288c9fbc29Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 49298c9fbc29Smrg# ifndef DIR_SEPARATOR_2 49308c9fbc29Smrg# define DIR_SEPARATOR_2 '\\' 49318c9fbc29Smrg# endif 49328c9fbc29Smrg# ifndef PATH_SEPARATOR_2 49338c9fbc29Smrg# define PATH_SEPARATOR_2 ';' 49348c9fbc29Smrg# endif 49358c9fbc29Smrg#endif 49368c9fbc29Smrg 49378c9fbc29Smrg#ifndef DIR_SEPARATOR_2 49388c9fbc29Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 49398c9fbc29Smrg#else /* DIR_SEPARATOR_2 */ 49408c9fbc29Smrg# define IS_DIR_SEPARATOR(ch) \ 49418c9fbc29Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 49428c9fbc29Smrg#endif /* DIR_SEPARATOR_2 */ 49438c9fbc29Smrg 49448c9fbc29Smrg#ifndef PATH_SEPARATOR_2 49458c9fbc29Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 49468c9fbc29Smrg#else /* PATH_SEPARATOR_2 */ 49478c9fbc29Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 49488c9fbc29Smrg#endif /* PATH_SEPARATOR_2 */ 49498c9fbc29Smrg 49508c9fbc29Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 49518c9fbc29Smrg#define XFREE(stale) do { \ 49528c9fbc29Smrg if (stale) { free ((void *) stale); stale = 0; } \ 49538c9fbc29Smrg} while (0) 49548c9fbc29Smrg 49558c9fbc29Smrg/* -DDEBUG is fairly common in CFLAGS. */ 49568c9fbc29Smrg#undef DEBUG 49578c9fbc29Smrg#if defined DEBUGWRAPPER 49588c9fbc29Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 49598c9fbc29Smrg#else 49608c9fbc29Smrg# define DEBUG(format, ...) 49618c9fbc29Smrg#endif 49628c9fbc29Smrg 49638c9fbc29Smrgconst char *program_name = NULL; 49648c9fbc29Smrg 49658c9fbc29Smrgvoid * xmalloc (size_t num); 49668c9fbc29Smrgchar * xstrdup (const char *string); 49678c9fbc29Smrgconst char * base_name (const char *name); 49688c9fbc29Smrgchar * find_executable(const char *wrapper); 49698c9fbc29Smrgint check_executable(const char *path); 49708c9fbc29Smrgchar * strendzap(char *str, const char *pat); 49718c9fbc29Smrgvoid lt_fatal (const char *message, ...); 49728c9fbc29Smrg 49738c9fbc29Smrgint 49748c9fbc29Smrgmain (int argc, char *argv[]) 49758c9fbc29Smrg{ 49768c9fbc29Smrg char **newargz; 49778c9fbc29Smrg int i; 49788c9fbc29Smrg 49798c9fbc29Smrg program_name = (char *) xstrdup (base_name (argv[0])); 49808c9fbc29Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 49818c9fbc29Smrg DEBUG("(main) program_name : %s\n",program_name); 49828c9fbc29Smrg newargz = XMALLOC(char *, argc+2); 49838c9fbc29SmrgEOF 49848c9fbc29Smrg 49858c9fbc29Smrg cat >> $cwrappersource <<EOF 49868c9fbc29Smrg newargz[0] = (char *) xstrdup("$SHELL"); 49878c9fbc29SmrgEOF 49888c9fbc29Smrg 49898c9fbc29Smrg cat >> $cwrappersource <<"EOF" 49908c9fbc29Smrg newargz[1] = find_executable(argv[0]); 49918c9fbc29Smrg if (newargz[1] == NULL) 49928c9fbc29Smrg lt_fatal("Couldn't find %s", argv[0]); 49938c9fbc29Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 49948c9fbc29Smrg /* we know the script has the same name, without the .exe */ 49958c9fbc29Smrg /* so make sure newargz[1] doesn't end in .exe */ 49968c9fbc29Smrg strendzap(newargz[1],".exe"); 49978c9fbc29Smrg for (i = 1; i < argc; i++) 49988c9fbc29Smrg newargz[i+1] = xstrdup(argv[i]); 49998c9fbc29Smrg newargz[argc+1] = NULL; 50008c9fbc29Smrg 50018c9fbc29Smrg for (i=0; i<argc+1; i++) 50028c9fbc29Smrg { 50038c9fbc29Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 50048c9fbc29Smrg ; 50058c9fbc29Smrg } 50068c9fbc29Smrg 50078c9fbc29SmrgEOF 50088c9fbc29Smrg 50098c9fbc29Smrg case $host_os in 50108c9fbc29Smrg mingw*) 50118c9fbc29Smrg cat >> $cwrappersource <<EOF 50128c9fbc29Smrg execv("$SHELL",(char const **)newargz); 50138c9fbc29SmrgEOF 50148c9fbc29Smrg ;; 50158c9fbc29Smrg *) 50168c9fbc29Smrg cat >> $cwrappersource <<EOF 50178c9fbc29Smrg execv("$SHELL",newargz); 50188c9fbc29SmrgEOF 50198c9fbc29Smrg ;; 50208c9fbc29Smrg esac 50218c9fbc29Smrg 50228c9fbc29Smrg cat >> $cwrappersource <<"EOF" 50238c9fbc29Smrg return 127; 50248c9fbc29Smrg} 50258c9fbc29Smrg 50268c9fbc29Smrgvoid * 50278c9fbc29Smrgxmalloc (size_t num) 50288c9fbc29Smrg{ 50298c9fbc29Smrg void * p = (void *) malloc (num); 50308c9fbc29Smrg if (!p) 50318c9fbc29Smrg lt_fatal ("Memory exhausted"); 50328c9fbc29Smrg 50338c9fbc29Smrg return p; 50348c9fbc29Smrg} 50358c9fbc29Smrg 50368c9fbc29Smrgchar * 50378c9fbc29Smrgxstrdup (const char *string) 50388c9fbc29Smrg{ 50398c9fbc29Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 50408c9fbc29Smrg; 50418c9fbc29Smrg} 50428c9fbc29Smrg 50438c9fbc29Smrgconst char * 50448c9fbc29Smrgbase_name (const char *name) 50458c9fbc29Smrg{ 50468c9fbc29Smrg const char *base; 50478c9fbc29Smrg 50488c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 50498c9fbc29Smrg /* Skip over the disk name in MSDOS pathnames. */ 50508c9fbc29Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 50518c9fbc29Smrg name += 2; 50528c9fbc29Smrg#endif 50538c9fbc29Smrg 50548c9fbc29Smrg for (base = name; *name; name++) 50558c9fbc29Smrg if (IS_DIR_SEPARATOR (*name)) 50568c9fbc29Smrg base = name + 1; 50578c9fbc29Smrg return base; 50588c9fbc29Smrg} 50598c9fbc29Smrg 50608c9fbc29Smrgint 50618c9fbc29Smrgcheck_executable(const char * path) 50628c9fbc29Smrg{ 50638c9fbc29Smrg struct stat st; 50648c9fbc29Smrg 50658c9fbc29Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 50668c9fbc29Smrg if ((!path) || (!*path)) 50678c9fbc29Smrg return 0; 50688c9fbc29Smrg 50698c9fbc29Smrg if ((stat (path, &st) >= 0) && 50708c9fbc29Smrg ( 50718c9fbc29Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 50728c9fbc29Smrg#if defined (S_IXOTH) 50738c9fbc29Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 50748c9fbc29Smrg#endif 50758c9fbc29Smrg#if defined (S_IXGRP) 50768c9fbc29Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 50778c9fbc29Smrg#endif 50788c9fbc29Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 50798c9fbc29Smrg ) 50808c9fbc29Smrg return 1; 50818c9fbc29Smrg else 50828c9fbc29Smrg return 0; 50838c9fbc29Smrg} 50848c9fbc29Smrg 50858c9fbc29Smrg/* Searches for the full path of the wrapper. Returns 50868c9fbc29Smrg newly allocated full path name if found, NULL otherwise */ 50878c9fbc29Smrgchar * 50888c9fbc29Smrgfind_executable (const char* wrapper) 50898c9fbc29Smrg{ 50908c9fbc29Smrg int has_slash = 0; 50918c9fbc29Smrg const char* p; 50928c9fbc29Smrg const char* p_next; 50938c9fbc29Smrg /* static buffer for getcwd */ 50948c9fbc29Smrg char tmp[LT_PATHMAX + 1]; 50958c9fbc29Smrg int tmp_len; 50968c9fbc29Smrg char* concat_name; 50978c9fbc29Smrg 50988c9fbc29Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 50998c9fbc29Smrg 51008c9fbc29Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 51018c9fbc29Smrg return NULL; 51028c9fbc29Smrg 51038c9fbc29Smrg /* Absolute path? */ 51048c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51058c9fbc29Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 51068c9fbc29Smrg { 51078c9fbc29Smrg concat_name = xstrdup (wrapper); 51088c9fbc29Smrg if (check_executable(concat_name)) 51098c9fbc29Smrg return concat_name; 51108c9fbc29Smrg XFREE(concat_name); 51118c9fbc29Smrg } 51128c9fbc29Smrg else 51138c9fbc29Smrg { 51148c9fbc29Smrg#endif 51158c9fbc29Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 51168c9fbc29Smrg { 51178c9fbc29Smrg concat_name = xstrdup (wrapper); 51188c9fbc29Smrg if (check_executable(concat_name)) 51198c9fbc29Smrg return concat_name; 51208c9fbc29Smrg XFREE(concat_name); 51218c9fbc29Smrg } 51228c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51238c9fbc29Smrg } 51248c9fbc29Smrg#endif 51258c9fbc29Smrg 51268c9fbc29Smrg for (p = wrapper; *p; p++) 51278c9fbc29Smrg if (*p == '/') 51288c9fbc29Smrg { 51298c9fbc29Smrg has_slash = 1; 51308c9fbc29Smrg break; 51318c9fbc29Smrg } 51328c9fbc29Smrg if (!has_slash) 51338c9fbc29Smrg { 51348c9fbc29Smrg /* no slashes; search PATH */ 51358c9fbc29Smrg const char* path = getenv ("PATH"); 51368c9fbc29Smrg if (path != NULL) 51378c9fbc29Smrg { 51388c9fbc29Smrg for (p = path; *p; p = p_next) 51398c9fbc29Smrg { 51408c9fbc29Smrg const char* q; 51418c9fbc29Smrg size_t p_len; 51428c9fbc29Smrg for (q = p; *q; q++) 51438c9fbc29Smrg if (IS_PATH_SEPARATOR(*q)) 51448c9fbc29Smrg break; 51458c9fbc29Smrg p_len = q - p; 51468c9fbc29Smrg p_next = (*q == '\0' ? q : q + 1); 51478c9fbc29Smrg if (p_len == 0) 51488c9fbc29Smrg { 51498c9fbc29Smrg /* empty path: current directory */ 51508c9fbc29Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 51518c9fbc29Smrg lt_fatal ("getcwd failed"); 51528c9fbc29Smrg tmp_len = strlen(tmp); 51538c9fbc29Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 51548c9fbc29Smrg memcpy (concat_name, tmp, tmp_len); 51558c9fbc29Smrg concat_name[tmp_len] = '/'; 51568c9fbc29Smrg strcpy (concat_name + tmp_len + 1, wrapper); 51578c9fbc29Smrg } 51588c9fbc29Smrg else 51598c9fbc29Smrg { 51608c9fbc29Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 51618c9fbc29Smrg memcpy (concat_name, p, p_len); 51628c9fbc29Smrg concat_name[p_len] = '/'; 51638c9fbc29Smrg strcpy (concat_name + p_len + 1, wrapper); 51648c9fbc29Smrg } 51658c9fbc29Smrg if (check_executable(concat_name)) 51668c9fbc29Smrg return concat_name; 51678c9fbc29Smrg XFREE(concat_name); 51688c9fbc29Smrg } 51698c9fbc29Smrg } 51708c9fbc29Smrg /* not found in PATH; assume curdir */ 51718c9fbc29Smrg } 51728c9fbc29Smrg /* Relative path | not found in path: prepend cwd */ 51738c9fbc29Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 51748c9fbc29Smrg lt_fatal ("getcwd failed"); 51758c9fbc29Smrg tmp_len = strlen(tmp); 51768c9fbc29Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 51778c9fbc29Smrg memcpy (concat_name, tmp, tmp_len); 51788c9fbc29Smrg concat_name[tmp_len] = '/'; 51798c9fbc29Smrg strcpy (concat_name + tmp_len + 1, wrapper); 51808c9fbc29Smrg 51818c9fbc29Smrg if (check_executable(concat_name)) 51828c9fbc29Smrg return concat_name; 51838c9fbc29Smrg XFREE(concat_name); 51848c9fbc29Smrg return NULL; 51858c9fbc29Smrg} 51868c9fbc29Smrg 51878c9fbc29Smrgchar * 51888c9fbc29Smrgstrendzap(char *str, const char *pat) 51898c9fbc29Smrg{ 51908c9fbc29Smrg size_t len, patlen; 51918c9fbc29Smrg 51928c9fbc29Smrg assert(str != NULL); 51938c9fbc29Smrg assert(pat != NULL); 51948c9fbc29Smrg 51958c9fbc29Smrg len = strlen(str); 51968c9fbc29Smrg patlen = strlen(pat); 51978c9fbc29Smrg 51988c9fbc29Smrg if (patlen <= len) 51998c9fbc29Smrg { 52008c9fbc29Smrg str += len - patlen; 52018c9fbc29Smrg if (strcmp(str, pat) == 0) 52028c9fbc29Smrg *str = '\0'; 52038c9fbc29Smrg } 52048c9fbc29Smrg return str; 52058c9fbc29Smrg} 52068c9fbc29Smrg 52078c9fbc29Smrgstatic void 52088c9fbc29Smrglt_error_core (int exit_status, const char * mode, 52098c9fbc29Smrg const char * message, va_list ap) 52108c9fbc29Smrg{ 52118c9fbc29Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 52128c9fbc29Smrg vfprintf (stderr, message, ap); 52138c9fbc29Smrg fprintf (stderr, ".\n"); 52148c9fbc29Smrg 52158c9fbc29Smrg if (exit_status >= 0) 52168c9fbc29Smrg exit (exit_status); 52178c9fbc29Smrg} 52188c9fbc29Smrg 52198c9fbc29Smrgvoid 52208c9fbc29Smrglt_fatal (const char *message, ...) 52218c9fbc29Smrg{ 52228c9fbc29Smrg va_list ap; 52238c9fbc29Smrg va_start (ap, message); 52248c9fbc29Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 52258c9fbc29Smrg va_end (ap); 52268c9fbc29Smrg} 52278c9fbc29SmrgEOF 52288c9fbc29Smrg # we should really use a build-platform specific compiler 52298c9fbc29Smrg # here, but OTOH, the wrappers (shell script and this C one) 52308c9fbc29Smrg # are only useful if you want to execute the "real" binary. 52318c9fbc29Smrg # Since the "real" binary is built for $host, then this 52328c9fbc29Smrg # wrapper might as well be built for $host, too. 52338c9fbc29Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 52348c9fbc29Smrg ;; 52358c9fbc29Smrg esac 52368c9fbc29Smrg $rm $output 52378c9fbc29Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 52388c9fbc29Smrg 52398c9fbc29Smrg $echo > $output "\ 52408c9fbc29Smrg#! $SHELL 52418c9fbc29Smrg 52428c9fbc29Smrg# $output - temporary wrapper script for $objdir/$outputname 52438c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 52448c9fbc29Smrg# 52458c9fbc29Smrg# The $output program cannot be directly executed until all the libtool 52468c9fbc29Smrg# libraries that it depends on are installed. 52478c9fbc29Smrg# 52488c9fbc29Smrg# This wrapper script should never be moved out of the build directory. 52498c9fbc29Smrg# If it is, it will not operate correctly. 52508c9fbc29Smrg 52518c9fbc29Smrg# Sed substitution that helps us do robust quoting. It backslashifies 52528c9fbc29Smrg# metacharacters that are still active within double-quoted strings. 52538c9fbc29SmrgXsed='${SED} -e 1s/^X//' 52548c9fbc29Smrgsed_quote_subst='$sed_quote_subst' 52558c9fbc29Smrg 52568c9fbc29Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 52578c9fbc29Smrg# if CDPATH is set. 52588c9fbc29Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 52598c9fbc29Smrg 52608c9fbc29Smrgrelink_command=\"$relink_command\" 52618c9fbc29Smrg 52628c9fbc29Smrg# This environment variable determines our operation mode. 52638c9fbc29Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 52648c9fbc29Smrg # install mode needs the following variable: 52658c9fbc29Smrg notinst_deplibs='$notinst_deplibs' 52668c9fbc29Smrgelse 52678c9fbc29Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 52688c9fbc29Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 52698c9fbc29Smrg echo=\"$qecho\" 52708c9fbc29Smrg file=\"\$0\" 52718c9fbc29Smrg # Make sure echo works. 52728c9fbc29Smrg if test \"X\$1\" = X--no-reexec; then 52738c9fbc29Smrg # Discard the --no-reexec flag, and continue. 52748c9fbc29Smrg shift 52758c9fbc29Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 52768c9fbc29Smrg # Yippee, \$echo works! 52778c9fbc29Smrg : 52788c9fbc29Smrg else 52798c9fbc29Smrg # Restart under the correct shell, and then maybe \$echo will work. 52808c9fbc29Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 52818c9fbc29Smrg fi 52828c9fbc29Smrg fi\ 52838c9fbc29Smrg" 52848c9fbc29Smrg $echo >> $output "\ 52858c9fbc29Smrg 52868c9fbc29Smrg # Find the directory that this script lives in. 52878c9fbc29Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 52888c9fbc29Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 52898c9fbc29Smrg 52908c9fbc29Smrg # Follow symbolic links until we get to the real thisdir. 52918c9fbc29Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 52928c9fbc29Smrg while test -n \"\$file\"; do 52938c9fbc29Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 52948c9fbc29Smrg 52958c9fbc29Smrg # If there was a directory component, then change thisdir. 52968c9fbc29Smrg if test \"x\$destdir\" != \"x\$file\"; then 52978c9fbc29Smrg case \"\$destdir\" in 52988c9fbc29Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 52998c9fbc29Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 53008c9fbc29Smrg esac 53018c9fbc29Smrg fi 53028c9fbc29Smrg 53038c9fbc29Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 53048c9fbc29Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 53058c9fbc29Smrg done 53068c9fbc29Smrg 53078c9fbc29Smrg # Try to get the absolute directory name. 53088c9fbc29Smrg absdir=\`cd \"\$thisdir\" && pwd\` 53098c9fbc29Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 53108c9fbc29Smrg" 53118c9fbc29Smrg 53128c9fbc29Smrg if test "$fast_install" = yes; then 53138c9fbc29Smrg $echo >> $output "\ 53148c9fbc29Smrg program=lt-'$outputname'$exeext 53158c9fbc29Smrg progdir=\"\$thisdir/$objdir\" 53168c9fbc29Smrg 53178c9fbc29Smrg if test ! -f \"\$progdir/\$program\" || \\ 53188c9fbc29Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 53198c9fbc29Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 53208c9fbc29Smrg 53218c9fbc29Smrg file=\"\$\$-\$program\" 53228c9fbc29Smrg 53238c9fbc29Smrg if test ! -d \"\$progdir\"; then 53248c9fbc29Smrg $mkdir \"\$progdir\" 53258c9fbc29Smrg else 53268c9fbc29Smrg $rm \"\$progdir/\$file\" 53278c9fbc29Smrg fi" 53288c9fbc29Smrg 53298c9fbc29Smrg $echo >> $output "\ 53308c9fbc29Smrg 53318c9fbc29Smrg # relink executable if necessary 53328c9fbc29Smrg if test -n \"\$relink_command\"; then 53338c9fbc29Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 53348c9fbc29Smrg else 53358c9fbc29Smrg $echo \"\$relink_command_output\" >&2 53368c9fbc29Smrg $rm \"\$progdir/\$file\" 53378c9fbc29Smrg exit $EXIT_FAILURE 53388c9fbc29Smrg fi 53398c9fbc29Smrg fi 53408c9fbc29Smrg 53418c9fbc29Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 53428c9fbc29Smrg { $rm \"\$progdir/\$program\"; 53438c9fbc29Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 53448c9fbc29Smrg $rm \"\$progdir/\$file\" 53458c9fbc29Smrg fi" 53468c9fbc29Smrg else 53478c9fbc29Smrg $echo >> $output "\ 53488c9fbc29Smrg program='$outputname' 53498c9fbc29Smrg progdir=\"\$thisdir/$objdir\" 53508c9fbc29Smrg" 53518c9fbc29Smrg fi 53528c9fbc29Smrg 53538c9fbc29Smrg $echo >> $output "\ 53548c9fbc29Smrg 53558c9fbc29Smrg if test -f \"\$progdir/\$program\"; then" 53568c9fbc29Smrg 53578c9fbc29Smrg # Export our shlibpath_var if we have one. 53588c9fbc29Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 53598c9fbc29Smrg $echo >> $output "\ 53608c9fbc29Smrg # Add our own library path to $shlibpath_var 53618c9fbc29Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 53628c9fbc29Smrg 53638c9fbc29Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 53648c9fbc29Smrg # The second colon is a workaround for a bug in BeOS R4 sed 53658c9fbc29Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 53668c9fbc29Smrg 53678c9fbc29Smrg export $shlibpath_var 53688c9fbc29Smrg" 53698c9fbc29Smrg fi 53708c9fbc29Smrg 53718c9fbc29Smrg # fixup the dll searchpath if we need to. 53728c9fbc29Smrg if test -n "$dllsearchpath"; then 53738c9fbc29Smrg $echo >> $output "\ 53748c9fbc29Smrg # Add the dll search path components to the executable PATH 53758c9fbc29Smrg PATH=$dllsearchpath:\$PATH 53768c9fbc29Smrg" 53778c9fbc29Smrg fi 53788c9fbc29Smrg 53798c9fbc29Smrg $echo >> $output "\ 53808c9fbc29Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 53818c9fbc29Smrg # Run the actual program with our arguments. 53828c9fbc29Smrg" 53838c9fbc29Smrg case $host in 53848c9fbc29Smrg # Backslashes separate directories on plain windows 53858c9fbc29Smrg *-*-mingw | *-*-os2*) 53868c9fbc29Smrg $echo >> $output "\ 53878c9fbc29Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 53888c9fbc29Smrg" 53898c9fbc29Smrg ;; 53908c9fbc29Smrg 53918c9fbc29Smrg *) 53928c9fbc29Smrg $echo >> $output "\ 53938c9fbc29Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 53948c9fbc29Smrg" 53958c9fbc29Smrg ;; 53968c9fbc29Smrg esac 53978c9fbc29Smrg $echo >> $output "\ 53988c9fbc29Smrg \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 53998c9fbc29Smrg exit $EXIT_FAILURE 54008c9fbc29Smrg fi 54018c9fbc29Smrg else 54028c9fbc29Smrg # The program doesn't exist. 54038c9fbc29Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 54048c9fbc29Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 54058c9fbc29Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 54068c9fbc29Smrg exit $EXIT_FAILURE 54078c9fbc29Smrg fi 54088c9fbc29Smrgfi\ 54098c9fbc29Smrg" 54108c9fbc29Smrg chmod +x $output 54118c9fbc29Smrg fi 54128c9fbc29Smrg exit $EXIT_SUCCESS 54138c9fbc29Smrg ;; 54148c9fbc29Smrg esac 54158c9fbc29Smrg 54168c9fbc29Smrg # See if we need to build an old-fashioned archive. 54178c9fbc29Smrg for oldlib in $oldlibs; do 54188c9fbc29Smrg 54198c9fbc29Smrg if test "$build_libtool_libs" = convenience; then 54208c9fbc29Smrg oldobjs="$libobjs_save" 54218c9fbc29Smrg addlibs="$convenience" 54228c9fbc29Smrg build_libtool_libs=no 54238c9fbc29Smrg else 54248c9fbc29Smrg if test "$build_libtool_libs" = module; then 54258c9fbc29Smrg oldobjs="$libobjs_save" 54268c9fbc29Smrg build_libtool_libs=no 54278c9fbc29Smrg else 54288c9fbc29Smrg oldobjs="$old_deplibs $non_pic_objects" 54298c9fbc29Smrg fi 54308c9fbc29Smrg addlibs="$old_convenience" 54318c9fbc29Smrg fi 54328c9fbc29Smrg 54338c9fbc29Smrg if test -n "$addlibs"; then 54348c9fbc29Smrg gentop="$output_objdir/${outputname}x" 54358c9fbc29Smrg generated="$generated $gentop" 54368c9fbc29Smrg 54378c9fbc29Smrg func_extract_archives $gentop $addlibs 54388c9fbc29Smrg oldobjs="$oldobjs $func_extract_archives_result" 54398c9fbc29Smrg fi 54408c9fbc29Smrg 54418c9fbc29Smrg # Do each command in the archive commands. 54428c9fbc29Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 54438c9fbc29Smrg cmds=$old_archive_from_new_cmds 54448c9fbc29Smrg else 54458c9fbc29Smrg # POSIX demands no paths to be encoded in archives. We have 54468c9fbc29Smrg # to avoid creating archives with duplicate basenames if we 54478c9fbc29Smrg # might have to extract them afterwards, e.g., when creating a 54488c9fbc29Smrg # static archive out of a convenience library, or when linking 54498c9fbc29Smrg # the entirety of a libtool archive into another (currently 54508c9fbc29Smrg # not supported by libtool). 54518c9fbc29Smrg if (for obj in $oldobjs 54528c9fbc29Smrg do 54538c9fbc29Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 54548c9fbc29Smrg done | sort | sort -uc >/dev/null 2>&1); then 54558c9fbc29Smrg : 54568c9fbc29Smrg else 54578c9fbc29Smrg $echo "copying selected object files to avoid basename conflicts..." 54588c9fbc29Smrg 54598c9fbc29Smrg if test -z "$gentop"; then 54608c9fbc29Smrg gentop="$output_objdir/${outputname}x" 54618c9fbc29Smrg generated="$generated $gentop" 54628c9fbc29Smrg 54638c9fbc29Smrg $show "${rm}r $gentop" 54648c9fbc29Smrg $run ${rm}r "$gentop" 54658c9fbc29Smrg $show "$mkdir $gentop" 54668c9fbc29Smrg $run $mkdir "$gentop" 54678c9fbc29Smrg exit_status=$? 54688c9fbc29Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 54698c9fbc29Smrg exit $exit_status 54708c9fbc29Smrg fi 54718c9fbc29Smrg fi 54728c9fbc29Smrg 54738c9fbc29Smrg save_oldobjs=$oldobjs 54748c9fbc29Smrg oldobjs= 54758c9fbc29Smrg counter=1 54768c9fbc29Smrg for obj in $save_oldobjs 54778c9fbc29Smrg do 54788c9fbc29Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 54798c9fbc29Smrg case " $oldobjs " in 54808c9fbc29Smrg " ") oldobjs=$obj ;; 54818c9fbc29Smrg *[\ /]"$objbase "*) 54828c9fbc29Smrg while :; do 54838c9fbc29Smrg # Make sure we don't pick an alternate name that also 54848c9fbc29Smrg # overlaps. 54858c9fbc29Smrg newobj=lt$counter-$objbase 54868c9fbc29Smrg counter=`expr $counter + 1` 54878c9fbc29Smrg case " $oldobjs " in 54888c9fbc29Smrg *[\ /]"$newobj "*) ;; 54898c9fbc29Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 54908c9fbc29Smrg esac 54918c9fbc29Smrg done 54928c9fbc29Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 54938c9fbc29Smrg $run ln "$obj" "$gentop/$newobj" || 54948c9fbc29Smrg $run cp "$obj" "$gentop/$newobj" 54958c9fbc29Smrg oldobjs="$oldobjs $gentop/$newobj" 54968c9fbc29Smrg ;; 54978c9fbc29Smrg *) oldobjs="$oldobjs $obj" ;; 54988c9fbc29Smrg esac 54998c9fbc29Smrg done 55008c9fbc29Smrg fi 55018c9fbc29Smrg 55028c9fbc29Smrg eval cmds=\"$old_archive_cmds\" 55038c9fbc29Smrg 55048c9fbc29Smrg if len=`expr "X$cmds" : ".*"` && 55058c9fbc29Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 55068c9fbc29Smrg cmds=$old_archive_cmds 55078c9fbc29Smrg else 55088c9fbc29Smrg # the command line is too long to link in one step, link in parts 55098c9fbc29Smrg $echo "using piecewise archive linking..." 55108c9fbc29Smrg save_RANLIB=$RANLIB 55118c9fbc29Smrg RANLIB=: 55128c9fbc29Smrg objlist= 55138c9fbc29Smrg concat_cmds= 55148c9fbc29Smrg save_oldobjs=$oldobjs 55158c9fbc29Smrg 55168c9fbc29Smrg # Is there a better way of finding the last object in the list? 55178c9fbc29Smrg for obj in $save_oldobjs 55188c9fbc29Smrg do 55198c9fbc29Smrg last_oldobj=$obj 55208c9fbc29Smrg done 55218c9fbc29Smrg for obj in $save_oldobjs 55228c9fbc29Smrg do 55238c9fbc29Smrg oldobjs="$objlist $obj" 55248c9fbc29Smrg objlist="$objlist $obj" 55258c9fbc29Smrg eval test_cmds=\"$old_archive_cmds\" 55268c9fbc29Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 55278c9fbc29Smrg test "$len" -le "$max_cmd_len"; then 55288c9fbc29Smrg : 55298c9fbc29Smrg else 55308c9fbc29Smrg # the above command should be used before it gets too long 55318c9fbc29Smrg oldobjs=$objlist 55328c9fbc29Smrg if test "$obj" = "$last_oldobj" ; then 55338c9fbc29Smrg RANLIB=$save_RANLIB 55348c9fbc29Smrg fi 55358c9fbc29Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 55368c9fbc29Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 55378c9fbc29Smrg objlist= 55388c9fbc29Smrg fi 55398c9fbc29Smrg done 55408c9fbc29Smrg RANLIB=$save_RANLIB 55418c9fbc29Smrg oldobjs=$objlist 55428c9fbc29Smrg if test "X$oldobjs" = "X" ; then 55438c9fbc29Smrg eval cmds=\"\$concat_cmds\" 55448c9fbc29Smrg else 55458c9fbc29Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 55468c9fbc29Smrg fi 55478c9fbc29Smrg fi 55488c9fbc29Smrg fi 55498c9fbc29Smrg save_ifs="$IFS"; IFS='~' 55508c9fbc29Smrg for cmd in $cmds; do 55518c9fbc29Smrg eval cmd=\"$cmd\" 55528c9fbc29Smrg IFS="$save_ifs" 55538c9fbc29Smrg $show "$cmd" 55548c9fbc29Smrg $run eval "$cmd" || exit $? 55558c9fbc29Smrg done 55568c9fbc29Smrg IFS="$save_ifs" 55578c9fbc29Smrg done 55588c9fbc29Smrg 55598c9fbc29Smrg if test -n "$generated"; then 55608c9fbc29Smrg $show "${rm}r$generated" 55618c9fbc29Smrg $run ${rm}r$generated 55628c9fbc29Smrg fi 55638c9fbc29Smrg 55648c9fbc29Smrg # Now create the libtool archive. 55658c9fbc29Smrg case $output in 55668c9fbc29Smrg *.la) 55678c9fbc29Smrg old_library= 55688c9fbc29Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 55698c9fbc29Smrg $show "creating $output" 55708c9fbc29Smrg 55718c9fbc29Smrg # Preserve any variables that may affect compiler behavior 55728c9fbc29Smrg for var in $variables_saved_for_relink; do 55738c9fbc29Smrg if eval test -z \"\${$var+set}\"; then 55748c9fbc29Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 55758c9fbc29Smrg elif eval var_value=\$$var; test -z "$var_value"; then 55768c9fbc29Smrg relink_command="$var=; export $var; $relink_command" 55778c9fbc29Smrg else 55788c9fbc29Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 55798c9fbc29Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 55808c9fbc29Smrg fi 55818c9fbc29Smrg done 55828c9fbc29Smrg # Quote the link command for shipping. 55838c9fbc29Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 55848c9fbc29Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 55858c9fbc29Smrg if test "$hardcode_automatic" = yes ; then 55868c9fbc29Smrg relink_command= 55878c9fbc29Smrg fi 55888c9fbc29Smrg 55898c9fbc29Smrg 55908c9fbc29Smrg # Only create the output if not a dry run. 55918c9fbc29Smrg if test -z "$run"; then 55928c9fbc29Smrg for installed in no yes; do 55938c9fbc29Smrg if test "$installed" = yes; then 55948c9fbc29Smrg if test -z "$install_libdir"; then 55958c9fbc29Smrg break 55968c9fbc29Smrg fi 55978c9fbc29Smrg output="$output_objdir/$outputname"i 55988c9fbc29Smrg # Replace all uninstalled libtool libraries with the installed ones 55998c9fbc29Smrg newdependency_libs= 56008c9fbc29Smrg for deplib in $dependency_libs; do 56018c9fbc29Smrg case $deplib in 56028c9fbc29Smrg *.la) 56038c9fbc29Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 56048c9fbc29Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 56058c9fbc29Smrg if test -z "$libdir"; then 56068c9fbc29Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 56078c9fbc29Smrg exit $EXIT_FAILURE 56088c9fbc29Smrg fi 56098c9fbc29Smrg newdependency_libs="$newdependency_libs $libdir/$name" 56108c9fbc29Smrg ;; 56118c9fbc29Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 56128c9fbc29Smrg esac 56138c9fbc29Smrg done 56148c9fbc29Smrg dependency_libs="$newdependency_libs" 56158c9fbc29Smrg newdlfiles= 56168c9fbc29Smrg for lib in $dlfiles; do 56178c9fbc29Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 56188c9fbc29Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 56198c9fbc29Smrg if test -z "$libdir"; then 56208c9fbc29Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 56218c9fbc29Smrg exit $EXIT_FAILURE 56228c9fbc29Smrg fi 56238c9fbc29Smrg newdlfiles="$newdlfiles $libdir/$name" 56248c9fbc29Smrg done 56258c9fbc29Smrg dlfiles="$newdlfiles" 56268c9fbc29Smrg newdlprefiles= 56278c9fbc29Smrg for lib in $dlprefiles; do 56288c9fbc29Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 56298c9fbc29Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 56308c9fbc29Smrg if test -z "$libdir"; then 56318c9fbc29Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 56328c9fbc29Smrg exit $EXIT_FAILURE 56338c9fbc29Smrg fi 56348c9fbc29Smrg newdlprefiles="$newdlprefiles $libdir/$name" 56358c9fbc29Smrg done 56368c9fbc29Smrg dlprefiles="$newdlprefiles" 56378c9fbc29Smrg else 56388c9fbc29Smrg newdlfiles= 56398c9fbc29Smrg for lib in $dlfiles; do 56408c9fbc29Smrg case $lib in 56418c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 56428c9fbc29Smrg *) abs=`pwd`"/$lib" ;; 56438c9fbc29Smrg esac 56448c9fbc29Smrg newdlfiles="$newdlfiles $abs" 56458c9fbc29Smrg done 56468c9fbc29Smrg dlfiles="$newdlfiles" 56478c9fbc29Smrg newdlprefiles= 56488c9fbc29Smrg for lib in $dlprefiles; do 56498c9fbc29Smrg case $lib in 56508c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 56518c9fbc29Smrg *) abs=`pwd`"/$lib" ;; 56528c9fbc29Smrg esac 56538c9fbc29Smrg newdlprefiles="$newdlprefiles $abs" 56548c9fbc29Smrg done 56558c9fbc29Smrg dlprefiles="$newdlprefiles" 56568c9fbc29Smrg fi 56578c9fbc29Smrg $rm $output 56588c9fbc29Smrg # place dlname in correct position for cygwin 56598c9fbc29Smrg tdlname=$dlname 56608c9fbc29Smrg case $host,$output,$installed,$module,$dlname in 56618c9fbc29Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 56628c9fbc29Smrg esac 56638c9fbc29Smrg $echo > $output "\ 56648c9fbc29Smrg# $outputname - a libtool library file 56658c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 56668c9fbc29Smrg# 56678c9fbc29Smrg# Please DO NOT delete this file! 56688c9fbc29Smrg# It is necessary for linking the library. 56698c9fbc29Smrg 56708c9fbc29Smrg# The name that we can dlopen(3). 56718c9fbc29Smrgdlname='$tdlname' 56728c9fbc29Smrg 56738c9fbc29Smrg# Names of this library. 56748c9fbc29Smrglibrary_names='$library_names' 56758c9fbc29Smrg 56768c9fbc29Smrg# The name of the static archive. 56778c9fbc29Smrgold_library='$old_library' 56788c9fbc29Smrg 56798c9fbc29Smrg# Libraries that this one depends upon. 56808c9fbc29Smrgdependency_libs='$dependency_libs' 56818c9fbc29Smrg 56828c9fbc29Smrg# Version information for $libname. 56838c9fbc29Smrgcurrent=$current 56848c9fbc29Smrgage=$age 56858c9fbc29Smrgrevision=$revision 56868c9fbc29Smrg 56878c9fbc29Smrg# Is this an already installed library? 56888c9fbc29Smrginstalled=$installed 56898c9fbc29Smrg 56908c9fbc29Smrg# Should we warn about portability when linking against -modules? 56918c9fbc29Smrgshouldnotlink=$module 56928c9fbc29Smrg 56938c9fbc29Smrg# Files to dlopen/dlpreopen 56948c9fbc29Smrgdlopen='$dlfiles' 56958c9fbc29Smrgdlpreopen='$dlprefiles' 56968c9fbc29Smrg 56978c9fbc29Smrg# Directory that this library needs to be installed in: 56988c9fbc29Smrglibdir='$install_libdir'" 56998c9fbc29Smrg if test "$installed" = no && test "$need_relink" = yes; then 57008c9fbc29Smrg $echo >> $output "\ 57018c9fbc29Smrgrelink_command=\"$relink_command\"" 57028c9fbc29Smrg fi 57038c9fbc29Smrg done 57048c9fbc29Smrg fi 57058c9fbc29Smrg 57068c9fbc29Smrg # Do a symbolic link so that the libtool archive can be found in 57078c9fbc29Smrg # LD_LIBRARY_PATH before the program is installed. 57088c9fbc29Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 57098c9fbc29Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 57108c9fbc29Smrg ;; 57118c9fbc29Smrg esac 57128c9fbc29Smrg exit $EXIT_SUCCESS 57138c9fbc29Smrg ;; 57148c9fbc29Smrg 57158c9fbc29Smrg # libtool install mode 57168c9fbc29Smrg install) 57178c9fbc29Smrg modename="$modename: install" 57188c9fbc29Smrg 57198c9fbc29Smrg # There may be an optional sh(1) argument at the beginning of 57208c9fbc29Smrg # install_prog (especially on Windows NT). 57218c9fbc29Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 57228c9fbc29Smrg # Allow the use of GNU shtool's install command. 57238c9fbc29Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 57248c9fbc29Smrg # Aesthetically quote it. 57258c9fbc29Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 57268c9fbc29Smrg case $arg in 57278c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 57288c9fbc29Smrg arg="\"$arg\"" 57298c9fbc29Smrg ;; 57308c9fbc29Smrg esac 57318c9fbc29Smrg install_prog="$arg " 57328c9fbc29Smrg arg="$1" 57338c9fbc29Smrg shift 57348c9fbc29Smrg else 57358c9fbc29Smrg install_prog= 57368c9fbc29Smrg arg=$nonopt 57378c9fbc29Smrg fi 57388c9fbc29Smrg 57398c9fbc29Smrg # The real first argument should be the name of the installation program. 57408c9fbc29Smrg # Aesthetically quote it. 57418c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 57428c9fbc29Smrg case $arg in 57438c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 57448c9fbc29Smrg arg="\"$arg\"" 57458c9fbc29Smrg ;; 57468c9fbc29Smrg esac 57478c9fbc29Smrg install_prog="$install_prog$arg" 57488c9fbc29Smrg 57498c9fbc29Smrg # We need to accept at least all the BSD install flags. 57508c9fbc29Smrg dest= 57518c9fbc29Smrg files= 57528c9fbc29Smrg opts= 57538c9fbc29Smrg prev= 57548c9fbc29Smrg install_type= 57558c9fbc29Smrg isdir=no 57568c9fbc29Smrg stripme= 57578c9fbc29Smrg for arg 57588c9fbc29Smrg do 57598c9fbc29Smrg if test -n "$dest"; then 57608c9fbc29Smrg files="$files $dest" 57618c9fbc29Smrg dest=$arg 57628c9fbc29Smrg continue 57638c9fbc29Smrg fi 57648c9fbc29Smrg 57658c9fbc29Smrg case $arg in 57668c9fbc29Smrg -d) isdir=yes ;; 57678c9fbc29Smrg -f) 57688c9fbc29Smrg case " $install_prog " in 57698c9fbc29Smrg *[\\\ /]cp\ *) ;; 57708c9fbc29Smrg *) prev=$arg ;; 57718c9fbc29Smrg esac 57728c9fbc29Smrg ;; 57738c9fbc29Smrg -g | -m | -o) prev=$arg ;; 57748c9fbc29Smrg -s) 57758c9fbc29Smrg stripme=" -s" 57768c9fbc29Smrg continue 57778c9fbc29Smrg ;; 57788c9fbc29Smrg -*) 57798c9fbc29Smrg ;; 57808c9fbc29Smrg *) 57818c9fbc29Smrg # If the previous option needed an argument, then skip it. 57828c9fbc29Smrg if test -n "$prev"; then 57838c9fbc29Smrg prev= 57848c9fbc29Smrg else 57858c9fbc29Smrg dest=$arg 57868c9fbc29Smrg continue 57878c9fbc29Smrg fi 57888c9fbc29Smrg ;; 57898c9fbc29Smrg esac 57908c9fbc29Smrg 57918c9fbc29Smrg # Aesthetically quote the argument. 57928c9fbc29Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 57938c9fbc29Smrg case $arg in 57948c9fbc29Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 57958c9fbc29Smrg arg="\"$arg\"" 57968c9fbc29Smrg ;; 57978c9fbc29Smrg esac 57988c9fbc29Smrg install_prog="$install_prog $arg" 57998c9fbc29Smrg done 58008c9fbc29Smrg 58018c9fbc29Smrg if test -z "$install_prog"; then 58028c9fbc29Smrg $echo "$modename: you must specify an install program" 1>&2 58038c9fbc29Smrg $echo "$help" 1>&2 58048c9fbc29Smrg exit $EXIT_FAILURE 58058c9fbc29Smrg fi 58068c9fbc29Smrg 58078c9fbc29Smrg if test -n "$prev"; then 58088c9fbc29Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 58098c9fbc29Smrg $echo "$help" 1>&2 58108c9fbc29Smrg exit $EXIT_FAILURE 58118c9fbc29Smrg fi 58128c9fbc29Smrg 58138c9fbc29Smrg if test -z "$files"; then 58148c9fbc29Smrg if test -z "$dest"; then 58158c9fbc29Smrg $echo "$modename: no file or destination specified" 1>&2 58168c9fbc29Smrg else 58178c9fbc29Smrg $echo "$modename: you must specify a destination" 1>&2 58188c9fbc29Smrg fi 58198c9fbc29Smrg $echo "$help" 1>&2 58208c9fbc29Smrg exit $EXIT_FAILURE 58218c9fbc29Smrg fi 58228c9fbc29Smrg 58238c9fbc29Smrg # Strip any trailing slash from the destination. 58248c9fbc29Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 58258c9fbc29Smrg 58268c9fbc29Smrg # Check to see that the destination is a directory. 58278c9fbc29Smrg test -d "$dest" && isdir=yes 58288c9fbc29Smrg if test "$isdir" = yes; then 58298c9fbc29Smrg destdir="$dest" 58308c9fbc29Smrg destname= 58318c9fbc29Smrg else 58328c9fbc29Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 58338c9fbc29Smrg test "X$destdir" = "X$dest" && destdir=. 58348c9fbc29Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 58358c9fbc29Smrg 58368c9fbc29Smrg # Not a directory, so check to see that there is only one file specified. 58378c9fbc29Smrg set dummy $files 58388c9fbc29Smrg if test "$#" -gt 2; then 58398c9fbc29Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 58408c9fbc29Smrg $echo "$help" 1>&2 58418c9fbc29Smrg exit $EXIT_FAILURE 58428c9fbc29Smrg fi 58438c9fbc29Smrg fi 58448c9fbc29Smrg case $destdir in 58458c9fbc29Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 58468c9fbc29Smrg *) 58478c9fbc29Smrg for file in $files; do 58488c9fbc29Smrg case $file in 58498c9fbc29Smrg *.lo) ;; 58508c9fbc29Smrg *) 58518c9fbc29Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 58528c9fbc29Smrg $echo "$help" 1>&2 58538c9fbc29Smrg exit $EXIT_FAILURE 58548c9fbc29Smrg ;; 58558c9fbc29Smrg esac 58568c9fbc29Smrg done 58578c9fbc29Smrg ;; 58588c9fbc29Smrg esac 58598c9fbc29Smrg 58608c9fbc29Smrg # This variable tells wrapper scripts just to set variables rather 58618c9fbc29Smrg # than running their programs. 58628c9fbc29Smrg libtool_install_magic="$magic" 58638c9fbc29Smrg 58648c9fbc29Smrg staticlibs= 58658c9fbc29Smrg future_libdirs= 58668c9fbc29Smrg current_libdirs= 58678c9fbc29Smrg for file in $files; do 58688c9fbc29Smrg 58698c9fbc29Smrg # Do each installation. 58708c9fbc29Smrg case $file in 58718c9fbc29Smrg *.$libext) 58728c9fbc29Smrg # Do the static libraries later. 58738c9fbc29Smrg staticlibs="$staticlibs $file" 58748c9fbc29Smrg ;; 58758c9fbc29Smrg 58768c9fbc29Smrg *.la) 58778c9fbc29Smrg # Check to see that this really is a libtool archive. 58788c9fbc29Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 58798c9fbc29Smrg else 58808c9fbc29Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 58818c9fbc29Smrg $echo "$help" 1>&2 58828c9fbc29Smrg exit $EXIT_FAILURE 58838c9fbc29Smrg fi 58848c9fbc29Smrg 58858c9fbc29Smrg library_names= 58868c9fbc29Smrg old_library= 58878c9fbc29Smrg relink_command= 58888c9fbc29Smrg # If there is no directory component, then add one. 58898c9fbc29Smrg case $file in 58908c9fbc29Smrg */* | *\\*) . $file ;; 58918c9fbc29Smrg *) . ./$file ;; 58928c9fbc29Smrg esac 58938c9fbc29Smrg 58948c9fbc29Smrg # Add the libdir to current_libdirs if it is the destination. 58958c9fbc29Smrg if test "X$destdir" = "X$libdir"; then 58968c9fbc29Smrg case "$current_libdirs " in 58978c9fbc29Smrg *" $libdir "*) ;; 58988c9fbc29Smrg *) current_libdirs="$current_libdirs $libdir" ;; 58998c9fbc29Smrg esac 59008c9fbc29Smrg else 59018c9fbc29Smrg # Note the libdir as a future libdir. 59028c9fbc29Smrg case "$future_libdirs " in 59038c9fbc29Smrg *" $libdir "*) ;; 59048c9fbc29Smrg *) future_libdirs="$future_libdirs $libdir" ;; 59058c9fbc29Smrg esac 59068c9fbc29Smrg fi 59078c9fbc29Smrg 59088c9fbc29Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 59098c9fbc29Smrg test "X$dir" = "X$file/" && dir= 59108c9fbc29Smrg dir="$dir$objdir" 59118c9fbc29Smrg 59128c9fbc29Smrg if test -n "$relink_command"; then 59138c9fbc29Smrg # Determine the prefix the user has applied to our future dir. 59148c9fbc29Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 59158c9fbc29Smrg 59168c9fbc29Smrg # Don't allow the user to place us outside of our expected 59178c9fbc29Smrg # location b/c this prevents finding dependent libraries that 59188c9fbc29Smrg # are installed to the same prefix. 59198c9fbc29Smrg # At present, this check doesn't affect windows .dll's that 59208c9fbc29Smrg # are installed into $libdir/../bin (currently, that works fine) 59218c9fbc29Smrg # but it's something to keep an eye on. 59228c9fbc29Smrg if test "$inst_prefix_dir" = "$destdir"; then 59238c9fbc29Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 59248c9fbc29Smrg exit $EXIT_FAILURE 59258c9fbc29Smrg fi 59268c9fbc29Smrg 59278c9fbc29Smrg if test -n "$inst_prefix_dir"; then 59288c9fbc29Smrg # Stick the inst_prefix_dir data into the link command. 59298c9fbc29Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 59308c9fbc29Smrg else 59318c9fbc29Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 59328c9fbc29Smrg fi 59338c9fbc29Smrg 59348c9fbc29Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 59358c9fbc29Smrg $show "$relink_command" 59368c9fbc29Smrg if $run eval "$relink_command"; then : 59378c9fbc29Smrg else 59388c9fbc29Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 59398c9fbc29Smrg exit $EXIT_FAILURE 59408c9fbc29Smrg fi 59418c9fbc29Smrg fi 59428c9fbc29Smrg 59438c9fbc29Smrg # See the names of the shared library. 59448c9fbc29Smrg set dummy $library_names 59458c9fbc29Smrg if test -n "$2"; then 59468c9fbc29Smrg realname="$2" 59478c9fbc29Smrg shift 59488c9fbc29Smrg shift 59498c9fbc29Smrg 59508c9fbc29Smrg srcname="$realname" 59518c9fbc29Smrg test -n "$relink_command" && srcname="$realname"T 59528c9fbc29Smrg 59538c9fbc29Smrg # Install the shared library and build the symlinks. 59548c9fbc29Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 59558c9fbc29Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 59568c9fbc29Smrg if test -n "$stripme" && test -n "$striplib"; then 59578c9fbc29Smrg $show "$striplib $destdir/$realname" 59588c9fbc29Smrg $run eval "$striplib $destdir/$realname" || exit $? 59598c9fbc29Smrg fi 59608c9fbc29Smrg 59618c9fbc29Smrg if test "$#" -gt 0; then 59628c9fbc29Smrg # Delete the old symlinks, and create new ones. 59638c9fbc29Smrg # Try `ln -sf' first, because the `ln' binary might depend on 59648c9fbc29Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 59658c9fbc29Smrg # so we also need to try rm && ln -s. 59668c9fbc29Smrg for linkname 59678c9fbc29Smrg do 59688c9fbc29Smrg if test "$linkname" != "$realname"; then 59698c9fbc29Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 59708c9fbc29Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 59718c9fbc29Smrg fi 59728c9fbc29Smrg done 59738c9fbc29Smrg fi 59748c9fbc29Smrg 59758c9fbc29Smrg # Do each command in the postinstall commands. 59768c9fbc29Smrg lib="$destdir/$realname" 59778c9fbc29Smrg cmds=$postinstall_cmds 59788c9fbc29Smrg save_ifs="$IFS"; IFS='~' 59798c9fbc29Smrg for cmd in $cmds; do 59808c9fbc29Smrg IFS="$save_ifs" 59818c9fbc29Smrg eval cmd=\"$cmd\" 59828c9fbc29Smrg $show "$cmd" 59838c9fbc29Smrg $run eval "$cmd" || { 59848c9fbc29Smrg lt_exit=$? 59858c9fbc29Smrg 59868c9fbc29Smrg # Restore the uninstalled library and exit 59878c9fbc29Smrg if test "$mode" = relink; then 59888c9fbc29Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 59898c9fbc29Smrg fi 59908c9fbc29Smrg 59918c9fbc29Smrg exit $lt_exit 59928c9fbc29Smrg } 59938c9fbc29Smrg done 59948c9fbc29Smrg IFS="$save_ifs" 59958c9fbc29Smrg fi 59968c9fbc29Smrg 59978c9fbc29Smrg # Install the pseudo-library for information purposes. 59988c9fbc29Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 59998c9fbc29Smrg instname="$dir/$name"i 60008c9fbc29Smrg $show "$install_prog $instname $destdir/$name" 60018c9fbc29Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 60028c9fbc29Smrg 60038c9fbc29Smrg # Maybe install the static library, too. 60048c9fbc29Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 60058c9fbc29Smrg ;; 60068c9fbc29Smrg 60078c9fbc29Smrg *.lo) 60088c9fbc29Smrg # Install (i.e. copy) a libtool object. 60098c9fbc29Smrg 60108c9fbc29Smrg # Figure out destination file name, if it wasn't already specified. 60118c9fbc29Smrg if test -n "$destname"; then 60128c9fbc29Smrg destfile="$destdir/$destname" 60138c9fbc29Smrg else 60148c9fbc29Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60158c9fbc29Smrg destfile="$destdir/$destfile" 60168c9fbc29Smrg fi 60178c9fbc29Smrg 60188c9fbc29Smrg # Deduce the name of the destination old-style object file. 60198c9fbc29Smrg case $destfile in 60208c9fbc29Smrg *.lo) 60218c9fbc29Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 60228c9fbc29Smrg ;; 60238c9fbc29Smrg *.$objext) 60248c9fbc29Smrg staticdest="$destfile" 60258c9fbc29Smrg destfile= 60268c9fbc29Smrg ;; 60278c9fbc29Smrg *) 60288c9fbc29Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 60298c9fbc29Smrg $echo "$help" 1>&2 60308c9fbc29Smrg exit $EXIT_FAILURE 60318c9fbc29Smrg ;; 60328c9fbc29Smrg esac 60338c9fbc29Smrg 60348c9fbc29Smrg # Install the libtool object if requested. 60358c9fbc29Smrg if test -n "$destfile"; then 60368c9fbc29Smrg $show "$install_prog $file $destfile" 60378c9fbc29Smrg $run eval "$install_prog $file $destfile" || exit $? 60388c9fbc29Smrg fi 60398c9fbc29Smrg 60408c9fbc29Smrg # Install the old object if enabled. 60418c9fbc29Smrg if test "$build_old_libs" = yes; then 60428c9fbc29Smrg # Deduce the name of the old-style object file. 60438c9fbc29Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 60448c9fbc29Smrg 60458c9fbc29Smrg $show "$install_prog $staticobj $staticdest" 60468c9fbc29Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 60478c9fbc29Smrg fi 60488c9fbc29Smrg exit $EXIT_SUCCESS 60498c9fbc29Smrg ;; 60508c9fbc29Smrg 60518c9fbc29Smrg *) 60528c9fbc29Smrg # Figure out destination file name, if it wasn't already specified. 60538c9fbc29Smrg if test -n "$destname"; then 60548c9fbc29Smrg destfile="$destdir/$destname" 60558c9fbc29Smrg else 60568c9fbc29Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60578c9fbc29Smrg destfile="$destdir/$destfile" 60588c9fbc29Smrg fi 60598c9fbc29Smrg 60608c9fbc29Smrg # If the file is missing, and there is a .exe on the end, strip it 60618c9fbc29Smrg # because it is most likely a libtool script we actually want to 60628c9fbc29Smrg # install 60638c9fbc29Smrg stripped_ext="" 60648c9fbc29Smrg case $file in 60658c9fbc29Smrg *.exe) 60668c9fbc29Smrg if test ! -f "$file"; then 60678c9fbc29Smrg file=`$echo $file|${SED} 's,.exe$,,'` 60688c9fbc29Smrg stripped_ext=".exe" 60698c9fbc29Smrg fi 60708c9fbc29Smrg ;; 60718c9fbc29Smrg esac 60728c9fbc29Smrg 60738c9fbc29Smrg # Do a test to see if this is really a libtool program. 60748c9fbc29Smrg case $host in 60758c9fbc29Smrg *cygwin*|*mingw*) 60768c9fbc29Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 60778c9fbc29Smrg ;; 60788c9fbc29Smrg *) 60798c9fbc29Smrg wrapper=$file 60808c9fbc29Smrg ;; 60818c9fbc29Smrg esac 60828c9fbc29Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 60838c9fbc29Smrg notinst_deplibs= 60848c9fbc29Smrg relink_command= 60858c9fbc29Smrg 60868c9fbc29Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 60878c9fbc29Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 60888c9fbc29Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 60898c9fbc29Smrg # `FILE.' does not work on cygwin managed mounts. 60908c9fbc29Smrg # 60918c9fbc29Smrg # If there is no directory component, then add one. 60928c9fbc29Smrg case $wrapper in 60938c9fbc29Smrg */* | *\\*) . ${wrapper} ;; 60948c9fbc29Smrg *) . ./${wrapper} ;; 60958c9fbc29Smrg esac 60968c9fbc29Smrg 60978c9fbc29Smrg # Check the variables that should have been set. 60988c9fbc29Smrg if test -z "$notinst_deplibs"; then 60998c9fbc29Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 61008c9fbc29Smrg exit $EXIT_FAILURE 61018c9fbc29Smrg fi 61028c9fbc29Smrg 61038c9fbc29Smrg finalize=yes 61048c9fbc29Smrg for lib in $notinst_deplibs; do 61058c9fbc29Smrg # Check to see that each library is installed. 61068c9fbc29Smrg libdir= 61078c9fbc29Smrg if test -f "$lib"; then 61088c9fbc29Smrg # If there is no directory component, then add one. 61098c9fbc29Smrg case $lib in 61108c9fbc29Smrg */* | *\\*) . $lib ;; 61118c9fbc29Smrg *) . ./$lib ;; 61128c9fbc29Smrg esac 61138c9fbc29Smrg fi 61148c9fbc29Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 61158c9fbc29Smrg if test -n "$libdir" && test ! -f "$libfile"; then 61168c9fbc29Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 61178c9fbc29Smrg finalize=no 61188c9fbc29Smrg fi 61198c9fbc29Smrg done 61208c9fbc29Smrg 61218c9fbc29Smrg relink_command= 61228c9fbc29Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 61238c9fbc29Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 61248c9fbc29Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 61258c9fbc29Smrg # `FILE.' does not work on cygwin managed mounts. 61268c9fbc29Smrg # 61278c9fbc29Smrg # If there is no directory component, then add one. 61288c9fbc29Smrg case $wrapper in 61298c9fbc29Smrg */* | *\\*) . ${wrapper} ;; 61308c9fbc29Smrg *) . ./${wrapper} ;; 61318c9fbc29Smrg esac 61328c9fbc29Smrg 61338c9fbc29Smrg outputname= 61348c9fbc29Smrg if test "$fast_install" = no && test -n "$relink_command"; then 61358c9fbc29Smrg if test "$finalize" = yes && test -z "$run"; then 61368c9fbc29Smrg tmpdir=`func_mktempdir` 61378c9fbc29Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 61388c9fbc29Smrg outputname="$tmpdir/$file" 61398c9fbc29Smrg # Replace the output file specification. 61408c9fbc29Smrg relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 61418c9fbc29Smrg 61428c9fbc29Smrg $show "$relink_command" 61438c9fbc29Smrg if $run eval "$relink_command"; then : 61448c9fbc29Smrg else 61458c9fbc29Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 61468c9fbc29Smrg ${rm}r "$tmpdir" 61478c9fbc29Smrg continue 61488c9fbc29Smrg fi 61498c9fbc29Smrg file="$outputname" 61508c9fbc29Smrg else 61518c9fbc29Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 61528c9fbc29Smrg fi 61538c9fbc29Smrg else 61548c9fbc29Smrg # Install the binary that we compiled earlier. 61558c9fbc29Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 61568c9fbc29Smrg fi 61578c9fbc29Smrg fi 61588c9fbc29Smrg 61598c9fbc29Smrg # remove .exe since cygwin /usr/bin/install will append another 61608c9fbc29Smrg # one anyway 61618c9fbc29Smrg case $install_prog,$host in 61628c9fbc29Smrg */usr/bin/install*,*cygwin*) 61638c9fbc29Smrg case $file:$destfile in 61648c9fbc29Smrg *.exe:*.exe) 61658c9fbc29Smrg # this is ok 61668c9fbc29Smrg ;; 61678c9fbc29Smrg *.exe:*) 61688c9fbc29Smrg destfile=$destfile.exe 61698c9fbc29Smrg ;; 61708c9fbc29Smrg *:*.exe) 61718c9fbc29Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 61728c9fbc29Smrg ;; 61738c9fbc29Smrg esac 61748c9fbc29Smrg ;; 61758c9fbc29Smrg esac 61768c9fbc29Smrg $show "$install_prog$stripme $file $destfile" 61778c9fbc29Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 61788c9fbc29Smrg test -n "$outputname" && ${rm}r "$tmpdir" 61798c9fbc29Smrg ;; 61808c9fbc29Smrg esac 61818c9fbc29Smrg done 61828c9fbc29Smrg 61838c9fbc29Smrg for file in $staticlibs; do 61848c9fbc29Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61858c9fbc29Smrg 61868c9fbc29Smrg # Set up the ranlib parameters. 61878c9fbc29Smrg oldlib="$destdir/$name" 61888c9fbc29Smrg 61898c9fbc29Smrg $show "$install_prog $file $oldlib" 61908c9fbc29Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 61918c9fbc29Smrg 61928c9fbc29Smrg if test -n "$stripme" && test -n "$old_striplib"; then 61938c9fbc29Smrg $show "$old_striplib $oldlib" 61948c9fbc29Smrg $run eval "$old_striplib $oldlib" || exit $? 61958c9fbc29Smrg fi 61968c9fbc29Smrg 61978c9fbc29Smrg # Do each command in the postinstall commands. 61988c9fbc29Smrg cmds=$old_postinstall_cmds 61998c9fbc29Smrg save_ifs="$IFS"; IFS='~' 62008c9fbc29Smrg for cmd in $cmds; do 62018c9fbc29Smrg IFS="$save_ifs" 62028c9fbc29Smrg eval cmd=\"$cmd\" 62038c9fbc29Smrg $show "$cmd" 62048c9fbc29Smrg $run eval "$cmd" || exit $? 62058c9fbc29Smrg done 62068c9fbc29Smrg IFS="$save_ifs" 62078c9fbc29Smrg done 62088c9fbc29Smrg 62098c9fbc29Smrg if test -n "$future_libdirs"; then 62108c9fbc29Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 62118c9fbc29Smrg fi 62128c9fbc29Smrg 62138c9fbc29Smrg if test -n "$current_libdirs"; then 62148c9fbc29Smrg # Maybe just do a dry run. 62158c9fbc29Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 62168c9fbc29Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 62178c9fbc29Smrg else 62188c9fbc29Smrg exit $EXIT_SUCCESS 62198c9fbc29Smrg fi 62208c9fbc29Smrg ;; 62218c9fbc29Smrg 62228c9fbc29Smrg # libtool finish mode 62238c9fbc29Smrg finish) 62248c9fbc29Smrg modename="$modename: finish" 62258c9fbc29Smrg libdirs="$nonopt" 62268c9fbc29Smrg admincmds= 62278c9fbc29Smrg 62288c9fbc29Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 62298c9fbc29Smrg for dir 62308c9fbc29Smrg do 62318c9fbc29Smrg libdirs="$libdirs $dir" 62328c9fbc29Smrg done 62338c9fbc29Smrg 62348c9fbc29Smrg for libdir in $libdirs; do 62358c9fbc29Smrg if test -n "$finish_cmds"; then 62368c9fbc29Smrg # Do each command in the finish commands. 62378c9fbc29Smrg cmds=$finish_cmds 62388c9fbc29Smrg save_ifs="$IFS"; IFS='~' 62398c9fbc29Smrg for cmd in $cmds; do 62408c9fbc29Smrg IFS="$save_ifs" 62418c9fbc29Smrg eval cmd=\"$cmd\" 62428c9fbc29Smrg $show "$cmd" 62438c9fbc29Smrg $run eval "$cmd" || admincmds="$admincmds 62448c9fbc29Smrg $cmd" 62458c9fbc29Smrg done 62468c9fbc29Smrg IFS="$save_ifs" 62478c9fbc29Smrg fi 62488c9fbc29Smrg if test -n "$finish_eval"; then 62498c9fbc29Smrg # Do the single finish_eval. 62508c9fbc29Smrg eval cmds=\"$finish_eval\" 62518c9fbc29Smrg $run eval "$cmds" || admincmds="$admincmds 62528c9fbc29Smrg $cmds" 62538c9fbc29Smrg fi 62548c9fbc29Smrg done 62558c9fbc29Smrg fi 62568c9fbc29Smrg 62578c9fbc29Smrg # Exit here if they wanted silent mode. 62588c9fbc29Smrg test "$show" = : && exit $EXIT_SUCCESS 62598c9fbc29Smrg 62608c9fbc29Smrg $echo "X----------------------------------------------------------------------" | $Xsed 62618c9fbc29Smrg $echo "Libraries have been installed in:" 62628c9fbc29Smrg for libdir in $libdirs; do 62638c9fbc29Smrg $echo " $libdir" 62648c9fbc29Smrg done 62658c9fbc29Smrg $echo 62668c9fbc29Smrg $echo "If you ever happen to want to link against installed libraries" 62678c9fbc29Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 62688c9fbc29Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 62698c9fbc29Smrg $echo "flag during linking and do at least one of the following:" 62708c9fbc29Smrg if test -n "$shlibpath_var"; then 62718c9fbc29Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 62728c9fbc29Smrg $echo " during execution" 62738c9fbc29Smrg fi 62748c9fbc29Smrg if test -n "$runpath_var"; then 62758c9fbc29Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 62768c9fbc29Smrg $echo " during linking" 62778c9fbc29Smrg fi 62788c9fbc29Smrg if test -n "$hardcode_libdir_flag_spec"; then 62798c9fbc29Smrg libdir=LIBDIR 62808c9fbc29Smrg eval flag=\"$hardcode_libdir_flag_spec\" 62818c9fbc29Smrg 62828c9fbc29Smrg $echo " - use the \`$flag' linker flag" 62838c9fbc29Smrg fi 62848c9fbc29Smrg if test -n "$admincmds"; then 62858c9fbc29Smrg $echo " - have your system administrator run these commands:$admincmds" 62868c9fbc29Smrg fi 62878c9fbc29Smrg if test -f /etc/ld.so.conf; then 62888c9fbc29Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 62898c9fbc29Smrg fi 62908c9fbc29Smrg $echo 62918c9fbc29Smrg $echo "See any operating system documentation about shared libraries for" 62928c9fbc29Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 62938c9fbc29Smrg $echo "X----------------------------------------------------------------------" | $Xsed 62948c9fbc29Smrg exit $EXIT_SUCCESS 62958c9fbc29Smrg ;; 62968c9fbc29Smrg 62978c9fbc29Smrg # libtool execute mode 62988c9fbc29Smrg execute) 62998c9fbc29Smrg modename="$modename: execute" 63008c9fbc29Smrg 63018c9fbc29Smrg # The first argument is the command name. 63028c9fbc29Smrg cmd="$nonopt" 63038c9fbc29Smrg if test -z "$cmd"; then 63048c9fbc29Smrg $echo "$modename: you must specify a COMMAND" 1>&2 63058c9fbc29Smrg $echo "$help" 63068c9fbc29Smrg exit $EXIT_FAILURE 63078c9fbc29Smrg fi 63088c9fbc29Smrg 63098c9fbc29Smrg # Handle -dlopen flags immediately. 63108c9fbc29Smrg for file in $execute_dlfiles; do 63118c9fbc29Smrg if test ! -f "$file"; then 63128c9fbc29Smrg $echo "$modename: \`$file' is not a file" 1>&2 63138c9fbc29Smrg $echo "$help" 1>&2 63148c9fbc29Smrg exit $EXIT_FAILURE 63158c9fbc29Smrg fi 63168c9fbc29Smrg 63178c9fbc29Smrg dir= 63188c9fbc29Smrg case $file in 63198c9fbc29Smrg *.la) 63208c9fbc29Smrg # Check to see that this really is a libtool archive. 63218c9fbc29Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 63228c9fbc29Smrg else 63238c9fbc29Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 63248c9fbc29Smrg $echo "$help" 1>&2 63258c9fbc29Smrg exit $EXIT_FAILURE 63268c9fbc29Smrg fi 63278c9fbc29Smrg 63288c9fbc29Smrg # Read the libtool library. 63298c9fbc29Smrg dlname= 63308c9fbc29Smrg library_names= 63318c9fbc29Smrg 63328c9fbc29Smrg # If there is no directory component, then add one. 63338c9fbc29Smrg case $file in 63348c9fbc29Smrg */* | *\\*) . $file ;; 63358c9fbc29Smrg *) . ./$file ;; 63368c9fbc29Smrg esac 63378c9fbc29Smrg 63388c9fbc29Smrg # Skip this library if it cannot be dlopened. 63398c9fbc29Smrg if test -z "$dlname"; then 63408c9fbc29Smrg # Warn if it was a shared library. 63418c9fbc29Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 63428c9fbc29Smrg continue 63438c9fbc29Smrg fi 63448c9fbc29Smrg 63458c9fbc29Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 63468c9fbc29Smrg test "X$dir" = "X$file" && dir=. 63478c9fbc29Smrg 63488c9fbc29Smrg if test -f "$dir/$objdir/$dlname"; then 63498c9fbc29Smrg dir="$dir/$objdir" 63508c9fbc29Smrg else 63518c9fbc29Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 63528c9fbc29Smrg exit $EXIT_FAILURE 63538c9fbc29Smrg fi 63548c9fbc29Smrg ;; 63558c9fbc29Smrg 63568c9fbc29Smrg *.lo) 63578c9fbc29Smrg # Just add the directory containing the .lo file. 63588c9fbc29Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 63598c9fbc29Smrg test "X$dir" = "X$file" && dir=. 63608c9fbc29Smrg ;; 63618c9fbc29Smrg 63628c9fbc29Smrg *) 63638c9fbc29Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 63648c9fbc29Smrg continue 63658c9fbc29Smrg ;; 63668c9fbc29Smrg esac 63678c9fbc29Smrg 63688c9fbc29Smrg # Get the absolute pathname. 63698c9fbc29Smrg absdir=`cd "$dir" && pwd` 63708c9fbc29Smrg test -n "$absdir" && dir="$absdir" 63718c9fbc29Smrg 63728c9fbc29Smrg # Now add the directory to shlibpath_var. 63738c9fbc29Smrg if eval "test -z \"\$$shlibpath_var\""; then 63748c9fbc29Smrg eval "$shlibpath_var=\"\$dir\"" 63758c9fbc29Smrg else 63768c9fbc29Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 63778c9fbc29Smrg fi 63788c9fbc29Smrg done 63798c9fbc29Smrg 63808c9fbc29Smrg # This variable tells wrapper scripts just to set shlibpath_var 63818c9fbc29Smrg # rather than running their programs. 63828c9fbc29Smrg libtool_execute_magic="$magic" 63838c9fbc29Smrg 63848c9fbc29Smrg # Check if any of the arguments is a wrapper script. 63858c9fbc29Smrg args= 63868c9fbc29Smrg for file 63878c9fbc29Smrg do 63888c9fbc29Smrg case $file in 63898c9fbc29Smrg -*) ;; 63908c9fbc29Smrg *) 63918c9fbc29Smrg # Do a test to see if this is really a libtool program. 63928c9fbc29Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 63938c9fbc29Smrg # If there is no directory component, then add one. 63948c9fbc29Smrg case $file in 63958c9fbc29Smrg */* | *\\*) . $file ;; 63968c9fbc29Smrg *) . ./$file ;; 63978c9fbc29Smrg esac 63988c9fbc29Smrg 63998c9fbc29Smrg # Transform arg to wrapped name. 64008c9fbc29Smrg file="$progdir/$program" 64018c9fbc29Smrg fi 64028c9fbc29Smrg ;; 64038c9fbc29Smrg esac 64048c9fbc29Smrg # Quote arguments (to preserve shell metacharacters). 64058c9fbc29Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 64068c9fbc29Smrg args="$args \"$file\"" 64078c9fbc29Smrg done 64088c9fbc29Smrg 64098c9fbc29Smrg if test -z "$run"; then 64108c9fbc29Smrg if test -n "$shlibpath_var"; then 64118c9fbc29Smrg # Export the shlibpath_var. 64128c9fbc29Smrg eval "export $shlibpath_var" 64138c9fbc29Smrg fi 64148c9fbc29Smrg 64158c9fbc29Smrg # Restore saved environment variables 64168c9fbc29Smrg if test "${save_LC_ALL+set}" = set; then 64178c9fbc29Smrg LC_ALL="$save_LC_ALL"; export LC_ALL 64188c9fbc29Smrg fi 64198c9fbc29Smrg if test "${save_LANG+set}" = set; then 64208c9fbc29Smrg LANG="$save_LANG"; export LANG 64218c9fbc29Smrg fi 64228c9fbc29Smrg 64238c9fbc29Smrg # Now prepare to actually exec the command. 64248c9fbc29Smrg exec_cmd="\$cmd$args" 64258c9fbc29Smrg else 64268c9fbc29Smrg # Display what would be done. 64278c9fbc29Smrg if test -n "$shlibpath_var"; then 64288c9fbc29Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 64298c9fbc29Smrg $echo "export $shlibpath_var" 64308c9fbc29Smrg fi 64318c9fbc29Smrg $echo "$cmd$args" 64328c9fbc29Smrg exit $EXIT_SUCCESS 64338c9fbc29Smrg fi 64348c9fbc29Smrg ;; 64358c9fbc29Smrg 64368c9fbc29Smrg # libtool clean and uninstall mode 64378c9fbc29Smrg clean | uninstall) 64388c9fbc29Smrg modename="$modename: $mode" 64398c9fbc29Smrg rm="$nonopt" 64408c9fbc29Smrg files= 64418c9fbc29Smrg rmforce= 64428c9fbc29Smrg exit_status=0 64438c9fbc29Smrg 64448c9fbc29Smrg # This variable tells wrapper scripts just to set variables rather 64458c9fbc29Smrg # than running their programs. 64468c9fbc29Smrg libtool_install_magic="$magic" 64478c9fbc29Smrg 64488c9fbc29Smrg for arg 64498c9fbc29Smrg do 64508c9fbc29Smrg case $arg in 64518c9fbc29Smrg -f) rm="$rm $arg"; rmforce=yes ;; 64528c9fbc29Smrg -*) rm="$rm $arg" ;; 64538c9fbc29Smrg *) files="$files $arg" ;; 64548c9fbc29Smrg esac 64558c9fbc29Smrg done 64568c9fbc29Smrg 64578c9fbc29Smrg if test -z "$rm"; then 64588c9fbc29Smrg $echo "$modename: you must specify an RM program" 1>&2 64598c9fbc29Smrg $echo "$help" 1>&2 64608c9fbc29Smrg exit $EXIT_FAILURE 64618c9fbc29Smrg fi 64628c9fbc29Smrg 64638c9fbc29Smrg rmdirs= 64648c9fbc29Smrg 64658c9fbc29Smrg origobjdir="$objdir" 64668c9fbc29Smrg for file in $files; do 64678c9fbc29Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64688c9fbc29Smrg if test "X$dir" = "X$file"; then 64698c9fbc29Smrg dir=. 64708c9fbc29Smrg objdir="$origobjdir" 64718c9fbc29Smrg else 64728c9fbc29Smrg objdir="$dir/$origobjdir" 64738c9fbc29Smrg fi 64748c9fbc29Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 64758c9fbc29Smrg test "$mode" = uninstall && objdir="$dir" 64768c9fbc29Smrg 64778c9fbc29Smrg # Remember objdir for removal later, being careful to avoid duplicates 64788c9fbc29Smrg if test "$mode" = clean; then 64798c9fbc29Smrg case " $rmdirs " in 64808c9fbc29Smrg *" $objdir "*) ;; 64818c9fbc29Smrg *) rmdirs="$rmdirs $objdir" ;; 64828c9fbc29Smrg esac 64838c9fbc29Smrg fi 64848c9fbc29Smrg 64858c9fbc29Smrg # Don't error if the file doesn't exist and rm -f was used. 64868c9fbc29Smrg if (test -L "$file") >/dev/null 2>&1 \ 64878c9fbc29Smrg || (test -h "$file") >/dev/null 2>&1 \ 64888c9fbc29Smrg || test -f "$file"; then 64898c9fbc29Smrg : 64908c9fbc29Smrg elif test -d "$file"; then 64918c9fbc29Smrg exit_status=1 64928c9fbc29Smrg continue 64938c9fbc29Smrg elif test "$rmforce" = yes; then 64948c9fbc29Smrg continue 64958c9fbc29Smrg fi 64968c9fbc29Smrg 64978c9fbc29Smrg rmfiles="$file" 64988c9fbc29Smrg 64998c9fbc29Smrg case $name in 65008c9fbc29Smrg *.la) 65018c9fbc29Smrg # Possibly a libtool archive, so verify it. 65028c9fbc29Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65038c9fbc29Smrg . $dir/$name 65048c9fbc29Smrg 65058c9fbc29Smrg # Delete the libtool libraries and symlinks. 65068c9fbc29Smrg for n in $library_names; do 65078c9fbc29Smrg rmfiles="$rmfiles $objdir/$n" 65088c9fbc29Smrg done 65098c9fbc29Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 65108c9fbc29Smrg 65118c9fbc29Smrg case "$mode" in 65128c9fbc29Smrg clean) 65138c9fbc29Smrg case " $library_names " in 65148c9fbc29Smrg # " " in the beginning catches empty $dlname 65158c9fbc29Smrg *" $dlname "*) ;; 65168c9fbc29Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 65178c9fbc29Smrg esac 65188c9fbc29Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 65198c9fbc29Smrg ;; 65208c9fbc29Smrg uninstall) 65218c9fbc29Smrg if test -n "$library_names"; then 65228c9fbc29Smrg # Do each command in the postuninstall commands. 65238c9fbc29Smrg cmds=$postuninstall_cmds 65248c9fbc29Smrg save_ifs="$IFS"; IFS='~' 65258c9fbc29Smrg for cmd in $cmds; do 65268c9fbc29Smrg IFS="$save_ifs" 65278c9fbc29Smrg eval cmd=\"$cmd\" 65288c9fbc29Smrg $show "$cmd" 65298c9fbc29Smrg $run eval "$cmd" 65308c9fbc29Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 65318c9fbc29Smrg exit_status=1 65328c9fbc29Smrg fi 65338c9fbc29Smrg done 65348c9fbc29Smrg IFS="$save_ifs" 65358c9fbc29Smrg fi 65368c9fbc29Smrg 65378c9fbc29Smrg if test -n "$old_library"; then 65388c9fbc29Smrg # Do each command in the old_postuninstall commands. 65398c9fbc29Smrg cmds=$old_postuninstall_cmds 65408c9fbc29Smrg save_ifs="$IFS"; IFS='~' 65418c9fbc29Smrg for cmd in $cmds; do 65428c9fbc29Smrg IFS="$save_ifs" 65438c9fbc29Smrg eval cmd=\"$cmd\" 65448c9fbc29Smrg $show "$cmd" 65458c9fbc29Smrg $run eval "$cmd" 65468c9fbc29Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 65478c9fbc29Smrg exit_status=1 65488c9fbc29Smrg fi 65498c9fbc29Smrg done 65508c9fbc29Smrg IFS="$save_ifs" 65518c9fbc29Smrg fi 65528c9fbc29Smrg # FIXME: should reinstall the best remaining shared library. 65538c9fbc29Smrg ;; 65548c9fbc29Smrg esac 65558c9fbc29Smrg fi 65568c9fbc29Smrg ;; 65578c9fbc29Smrg 65588c9fbc29Smrg *.lo) 65598c9fbc29Smrg # Possibly a libtool object, so verify it. 65608c9fbc29Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65618c9fbc29Smrg 65628c9fbc29Smrg # Read the .lo file 65638c9fbc29Smrg . $dir/$name 65648c9fbc29Smrg 65658c9fbc29Smrg # Add PIC object to the list of files to remove. 65668c9fbc29Smrg if test -n "$pic_object" \ 65678c9fbc29Smrg && test "$pic_object" != none; then 65688c9fbc29Smrg rmfiles="$rmfiles $dir/$pic_object" 65698c9fbc29Smrg fi 65708c9fbc29Smrg 65718c9fbc29Smrg # Add non-PIC object to the list of files to remove. 65728c9fbc29Smrg if test -n "$non_pic_object" \ 65738c9fbc29Smrg && test "$non_pic_object" != none; then 65748c9fbc29Smrg rmfiles="$rmfiles $dir/$non_pic_object" 65758c9fbc29Smrg fi 65768c9fbc29Smrg fi 65778c9fbc29Smrg ;; 65788c9fbc29Smrg 65798c9fbc29Smrg *) 65808c9fbc29Smrg if test "$mode" = clean ; then 65818c9fbc29Smrg noexename=$name 65828c9fbc29Smrg case $file in 65838c9fbc29Smrg *.exe) 65848c9fbc29Smrg file=`$echo $file|${SED} 's,.exe$,,'` 65858c9fbc29Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 65868c9fbc29Smrg # $file with .exe has already been added to rmfiles, 65878c9fbc29Smrg # add $file without .exe 65888c9fbc29Smrg rmfiles="$rmfiles $file" 65898c9fbc29Smrg ;; 65908c9fbc29Smrg esac 65918c9fbc29Smrg # Do a test to see if this is a libtool program. 65928c9fbc29Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65938c9fbc29Smrg relink_command= 65948c9fbc29Smrg . $dir/$noexename 65958c9fbc29Smrg 65968c9fbc29Smrg # note $name still contains .exe if it was in $file originally 65978c9fbc29Smrg # as does the version of $file that was added into $rmfiles 65988c9fbc29Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 65998c9fbc29Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 66008c9fbc29Smrg rmfiles="$rmfiles $objdir/lt-$name" 66018c9fbc29Smrg fi 66028c9fbc29Smrg if test "X$noexename" != "X$name" ; then 66038c9fbc29Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 66048c9fbc29Smrg fi 66058c9fbc29Smrg fi 66068c9fbc29Smrg fi 66078c9fbc29Smrg ;; 66088c9fbc29Smrg esac 66098c9fbc29Smrg $show "$rm $rmfiles" 66108c9fbc29Smrg $run $rm $rmfiles || exit_status=1 66118c9fbc29Smrg done 66128c9fbc29Smrg objdir="$origobjdir" 66138c9fbc29Smrg 66148c9fbc29Smrg # Try to remove the ${objdir}s in the directories where we deleted files 66158c9fbc29Smrg for dir in $rmdirs; do 66168c9fbc29Smrg if test -d "$dir"; then 66178c9fbc29Smrg $show "rmdir $dir" 66188c9fbc29Smrg $run rmdir $dir >/dev/null 2>&1 66198c9fbc29Smrg fi 66208c9fbc29Smrg done 66218c9fbc29Smrg 66228c9fbc29Smrg exit $exit_status 66238c9fbc29Smrg ;; 66248c9fbc29Smrg 66258c9fbc29Smrg "") 66268c9fbc29Smrg $echo "$modename: you must specify a MODE" 1>&2 66278c9fbc29Smrg $echo "$generic_help" 1>&2 66288c9fbc29Smrg exit $EXIT_FAILURE 66298c9fbc29Smrg ;; 66308c9fbc29Smrg esac 66318c9fbc29Smrg 66328c9fbc29Smrg if test -z "$exec_cmd"; then 66338c9fbc29Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 66348c9fbc29Smrg $echo "$generic_help" 1>&2 66358c9fbc29Smrg exit $EXIT_FAILURE 66368c9fbc29Smrg fi 66378c9fbc29Smrgfi # test -z "$show_help" 66388c9fbc29Smrg 66398c9fbc29Smrgif test -n "$exec_cmd"; then 66408c9fbc29Smrg eval exec $exec_cmd 66418c9fbc29Smrg exit $EXIT_FAILURE 66428c9fbc29Smrgfi 66438c9fbc29Smrg 66448c9fbc29Smrg# We need to display help for each of the modes. 66458c9fbc29Smrgcase $mode in 66468c9fbc29Smrg"") $echo \ 66478c9fbc29Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 66488c9fbc29Smrg 66498c9fbc29SmrgProvide generalized library-building support services. 66508c9fbc29Smrg 66518c9fbc29Smrg --config show all configuration variables 66528c9fbc29Smrg --debug enable verbose shell tracing 66538c9fbc29Smrg-n, --dry-run display commands without modifying any files 66548c9fbc29Smrg --features display basic configuration information and exit 66558c9fbc29Smrg --finish same as \`--mode=finish' 66568c9fbc29Smrg --help display this help message and exit 66578c9fbc29Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 66588c9fbc29Smrg --quiet same as \`--silent' 66598c9fbc29Smrg --silent don't print informational messages 66608c9fbc29Smrg --tag=TAG use configuration variables from tag TAG 66618c9fbc29Smrg --version print version information 66628c9fbc29Smrg 66638c9fbc29SmrgMODE must be one of the following: 66648c9fbc29Smrg 66658c9fbc29Smrg clean remove files from the build directory 66668c9fbc29Smrg compile compile a source file into a libtool object 66678c9fbc29Smrg execute automatically set library path, then run a program 66688c9fbc29Smrg finish complete the installation of libtool libraries 66698c9fbc29Smrg install install libraries or executables 66708c9fbc29Smrg link create a library or an executable 66718c9fbc29Smrg uninstall remove libraries from an installed directory 66728c9fbc29Smrg 66738c9fbc29SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 66748c9fbc29Smrga more detailed description of MODE. 66758c9fbc29Smrg 66768c9fbc29SmrgReport bugs to <bug-libtool@gnu.org>." 66778c9fbc29Smrg exit $EXIT_SUCCESS 66788c9fbc29Smrg ;; 66798c9fbc29Smrg 66808c9fbc29Smrgclean) 66818c9fbc29Smrg $echo \ 66828c9fbc29Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 66838c9fbc29Smrg 66848c9fbc29SmrgRemove files from the build directory. 66858c9fbc29Smrg 66868c9fbc29SmrgRM is the name of the program to use to delete files associated with each FILE 66878c9fbc29Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 66888c9fbc29Smrgto RM. 66898c9fbc29Smrg 66908c9fbc29SmrgIf FILE is a libtool library, object or program, all the files associated 66918c9fbc29Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 66928c9fbc29Smrg ;; 66938c9fbc29Smrg 66948c9fbc29Smrgcompile) 66958c9fbc29Smrg $echo \ 66968c9fbc29Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 66978c9fbc29Smrg 66988c9fbc29SmrgCompile a source file into a libtool library object. 66998c9fbc29Smrg 67008c9fbc29SmrgThis mode accepts the following additional options: 67018c9fbc29Smrg 67028c9fbc29Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 67038c9fbc29Smrg -prefer-pic try to building PIC objects only 67048c9fbc29Smrg -prefer-non-pic try to building non-PIC objects only 67058c9fbc29Smrg -static always build a \`.o' file suitable for static linking 67068c9fbc29Smrg 67078c9fbc29SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 67088c9fbc29Smrgfrom the given SOURCEFILE. 67098c9fbc29Smrg 67108c9fbc29SmrgThe output file name is determined by removing the directory component from 67118c9fbc29SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 67128c9fbc29Smrglibrary object suffix, \`.lo'." 67138c9fbc29Smrg ;; 67148c9fbc29Smrg 67158c9fbc29Smrgexecute) 67168c9fbc29Smrg $echo \ 67178c9fbc29Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 67188c9fbc29Smrg 67198c9fbc29SmrgAutomatically set library path, then run a program. 67208c9fbc29Smrg 67218c9fbc29SmrgThis mode accepts the following additional options: 67228c9fbc29Smrg 67238c9fbc29Smrg -dlopen FILE add the directory containing FILE to the library path 67248c9fbc29Smrg 67258c9fbc29SmrgThis mode sets the library path environment variable according to \`-dlopen' 67268c9fbc29Smrgflags. 67278c9fbc29Smrg 67288c9fbc29SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 67298c9fbc29Smrginto their corresponding uninstalled binary, and any of their required library 67308c9fbc29Smrgdirectories are added to the library path. 67318c9fbc29Smrg 67328c9fbc29SmrgThen, COMMAND is executed, with ARGS as arguments." 67338c9fbc29Smrg ;; 67348c9fbc29Smrg 67358c9fbc29Smrgfinish) 67368c9fbc29Smrg $echo \ 67378c9fbc29Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 67388c9fbc29Smrg 67398c9fbc29SmrgComplete the installation of libtool libraries. 67408c9fbc29Smrg 67418c9fbc29SmrgEach LIBDIR is a directory that contains libtool libraries. 67428c9fbc29Smrg 67438c9fbc29SmrgThe commands that this mode executes may require superuser privileges. Use 67448c9fbc29Smrgthe \`--dry-run' option if you just want to see what would be executed." 67458c9fbc29Smrg ;; 67468c9fbc29Smrg 67478c9fbc29Smrginstall) 67488c9fbc29Smrg $echo \ 67498c9fbc29Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 67508c9fbc29Smrg 67518c9fbc29SmrgInstall executables or libraries. 67528c9fbc29Smrg 67538c9fbc29SmrgINSTALL-COMMAND is the installation command. The first component should be 67548c9fbc29Smrgeither the \`install' or \`cp' program. 67558c9fbc29Smrg 67568c9fbc29SmrgThe rest of the components are interpreted as arguments to that command (only 67578c9fbc29SmrgBSD-compatible install options are recognized)." 67588c9fbc29Smrg ;; 67598c9fbc29Smrg 67608c9fbc29Smrglink) 67618c9fbc29Smrg $echo \ 67628c9fbc29Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 67638c9fbc29Smrg 67648c9fbc29SmrgLink object files or libraries together to form another library, or to 67658c9fbc29Smrgcreate an executable program. 67668c9fbc29Smrg 67678c9fbc29SmrgLINK-COMMAND is a command using the C compiler that you would use to create 67688c9fbc29Smrga program from several object files. 67698c9fbc29Smrg 67708c9fbc29SmrgThe following components of LINK-COMMAND are treated specially: 67718c9fbc29Smrg 67728c9fbc29Smrg -all-static do not do any dynamic linking at all 67738c9fbc29Smrg -avoid-version do not add a version suffix if possible 67748c9fbc29Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 67758c9fbc29Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 67768c9fbc29Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 67778c9fbc29Smrg -export-symbols SYMFILE 67788c9fbc29Smrg try to export only the symbols listed in SYMFILE 67798c9fbc29Smrg -export-symbols-regex REGEX 67808c9fbc29Smrg try to export only the symbols matching REGEX 67818c9fbc29Smrg -LLIBDIR search LIBDIR for required installed libraries 67828c9fbc29Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 67838c9fbc29Smrg -module build a library that can dlopened 67848c9fbc29Smrg -no-fast-install disable the fast-install mode 67858c9fbc29Smrg -no-install link a not-installable executable 67868c9fbc29Smrg -no-undefined declare that a library does not refer to external symbols 67878c9fbc29Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 67888c9fbc29Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 67898c9fbc29Smrg -precious-files-regex REGEX 67908c9fbc29Smrg don't remove output files matching REGEX 67918c9fbc29Smrg -release RELEASE specify package release information 67928c9fbc29Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 67938c9fbc29Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 67948c9fbc29Smrg -static do not do any dynamic linking of libtool libraries 67958c9fbc29Smrg -version-info CURRENT[:REVISION[:AGE]] 67968c9fbc29Smrg specify library version info [each variable defaults to 0] 67978c9fbc29Smrg 67988c9fbc29SmrgAll other options (arguments beginning with \`-') are ignored. 67998c9fbc29Smrg 68008c9fbc29SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 68018c9fbc29Smrgtreated as uninstalled libtool libraries, other files are standard or library 68028c9fbc29Smrgobject files. 68038c9fbc29Smrg 68048c9fbc29SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 68058c9fbc29Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 68068c9fbc29Smrgrequired, except when creating a convenience library. 68078c9fbc29Smrg 68088c9fbc29SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 68098c9fbc29Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 68108c9fbc29Smrg 68118c9fbc29SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 68128c9fbc29Smrgis created, otherwise an executable program is created." 68138c9fbc29Smrg ;; 68148c9fbc29Smrg 68158c9fbc29Smrguninstall) 68168c9fbc29Smrg $echo \ 68178c9fbc29Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 68188c9fbc29Smrg 68198c9fbc29SmrgRemove libraries from an installation directory. 68208c9fbc29Smrg 68218c9fbc29SmrgRM is the name of the program to use to delete files associated with each FILE 68228c9fbc29Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 68238c9fbc29Smrgto RM. 68248c9fbc29Smrg 68258c9fbc29SmrgIf FILE is a libtool library, all the files associated with it are deleted. 68268c9fbc29SmrgOtherwise, only FILE itself is deleted using RM." 68278c9fbc29Smrg ;; 68288c9fbc29Smrg 68298c9fbc29Smrg*) 68308c9fbc29Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 68318c9fbc29Smrg $echo "$help" 1>&2 68328c9fbc29Smrg exit $EXIT_FAILURE 68338c9fbc29Smrg ;; 68348c9fbc29Smrgesac 68358c9fbc29Smrg 68368c9fbc29Smrg$echo 68378c9fbc29Smrg$echo "Try \`$modename --help' for more information about other modes." 68388c9fbc29Smrg 68398c9fbc29Smrgexit $? 68408c9fbc29Smrg 68418c9fbc29Smrg# The TAGs below are defined such that we never get into a situation 68428c9fbc29Smrg# in which we disable both kinds of libraries. Given conflicting 68438c9fbc29Smrg# choices, we go for a static library, that is the most portable, 68448c9fbc29Smrg# since we can't tell whether shared libraries were disabled because 68458c9fbc29Smrg# the user asked for that or because the platform doesn't support 68468c9fbc29Smrg# them. This is particularly important on AIX, because we don't 68478c9fbc29Smrg# support having both static and shared libraries enabled at the same 68488c9fbc29Smrg# time on that platform, so we default to a shared-only configuration. 68498c9fbc29Smrg# If a disable-shared tag is given, we'll fallback to a static-only 68508c9fbc29Smrg# configuration. But we'll never go from static-only to shared-only. 68518c9fbc29Smrg 68528c9fbc29Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 68538c9fbc29Smrgdisable_libs=shared 68548c9fbc29Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 68558c9fbc29Smrg 68568c9fbc29Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 68578c9fbc29Smrgdisable_libs=static 68588c9fbc29Smrg# ### END LIBTOOL TAG CONFIG: disable-static 68598c9fbc29Smrg 68608c9fbc29Smrg# Local Variables: 68618c9fbc29Smrg# mode:shell-script 68628c9fbc29Smrg# sh-indentation:2 68638c9fbc29Smrg# End: 6864