ltmain.sh revision 42d69509
14456fccdSmrg# ltmain.sh - Provide generalized library-building support services. 24456fccdSmrg# NOTE: Changing this file will not affect anything until you rerun configure. 34456fccdSmrg# 442d69509Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 542d69509Smrg# 2007, 2008 Free Software Foundation, Inc. 64456fccdSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 74456fccdSmrg# 84456fccdSmrg# This program is free software; you can redistribute it and/or modify 94456fccdSmrg# it under the terms of the GNU General Public License as published by 104456fccdSmrg# the Free Software Foundation; either version 2 of the License, or 114456fccdSmrg# (at your option) any later version. 124456fccdSmrg# 134456fccdSmrg# This program is distributed in the hope that it will be useful, but 144456fccdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 154456fccdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 164456fccdSmrg# General Public License for more details. 174456fccdSmrg# 184456fccdSmrg# You should have received a copy of the GNU General Public License 194456fccdSmrg# along with this program; if not, write to the Free Software 204456fccdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 214456fccdSmrg# 224456fccdSmrg# As a special exception to the GNU General Public License, if you 234456fccdSmrg# distribute this file as part of a program that contains a 244456fccdSmrg# configuration script generated by Autoconf, you may include it under 254456fccdSmrg# the same distribution terms that you use for the rest of that program. 264456fccdSmrg 274456fccdSmrgbasename="s,^.*/,,g" 284456fccdSmrg 294456fccdSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 304456fccdSmrg# is ksh but when the shell is invoked as "sh" and the current value of 314456fccdSmrg# the _XPG environment variable is not equal to 1 (one), the special 324456fccdSmrg# positional parameter $0, within a function call, is the name of the 334456fccdSmrg# function. 344456fccdSmrgprogpath="$0" 354456fccdSmrg 364456fccdSmrg# The name of this program: 374456fccdSmrgprogname=`echo "$progpath" | $SED $basename` 384456fccdSmrgmodename="$progname" 394456fccdSmrg 404456fccdSmrg# Global variables: 414456fccdSmrgEXIT_SUCCESS=0 424456fccdSmrgEXIT_FAILURE=1 434456fccdSmrg 444456fccdSmrgPROGRAM=ltmain.sh 454456fccdSmrgPACKAGE=libtool 4642d69509SmrgVERSION=1.5.26 4742d69509SmrgTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)" 4842d69509Smrg 4942d69509Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5042d69509Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 5142d69509Smrg emulate sh 5242d69509Smrg NULLCMD=: 5342d69509Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 5442d69509Smrg # is contrary to our usage. Disable this feature. 5542d69509Smrg alias -g '${1+"$@"}'='"$@"' 564456fccdSmrg setopt NO_GLOB_SUBST 5742d69509Smrgelse 5842d69509Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 594456fccdSmrgfi 6042d69509SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 6142d69509SmrgDUALCASE=1; export DUALCASE # for MKS sh 624456fccdSmrg 634456fccdSmrg# Check that we have a working $echo. 644456fccdSmrgif test "X$1" = X--no-reexec; then 654456fccdSmrg # Discard the --no-reexec flag, and continue. 664456fccdSmrg shift 674456fccdSmrgelif test "X$1" = X--fallback-echo; then 684456fccdSmrg # Avoid inline document here, it may be left over 694456fccdSmrg : 704456fccdSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 714456fccdSmrg # Yippee, $echo works! 724456fccdSmrg : 734456fccdSmrgelse 744456fccdSmrg # Restart under the correct shell, and then maybe $echo will work. 754456fccdSmrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 764456fccdSmrgfi 774456fccdSmrg 784456fccdSmrgif test "X$1" = X--fallback-echo; then 794456fccdSmrg # used as fallback echo 804456fccdSmrg shift 814456fccdSmrg cat <<EOF 824456fccdSmrg$* 834456fccdSmrgEOF 844456fccdSmrg exit $EXIT_SUCCESS 854456fccdSmrgfi 864456fccdSmrg 874456fccdSmrgdefault_mode= 884456fccdSmrghelp="Try \`$progname --help' for more information." 894456fccdSmrgmagic="%%%MAGIC variable%%%" 904456fccdSmrgmkdir="mkdir" 914456fccdSmrgmv="mv -f" 924456fccdSmrgrm="rm -f" 934456fccdSmrg 944456fccdSmrg# Sed substitution that helps us do robust quoting. It backslashifies 954456fccdSmrg# metacharacters that are still active within double-quoted strings. 964456fccdSmrgXsed="${SED}"' -e 1s/^X//' 974456fccdSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 984456fccdSmrg# test EBCDIC or ASCII 994456fccdSmrgcase `echo X|tr X '\101'` in 1004456fccdSmrg A) # ASCII based system 1014456fccdSmrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 1024456fccdSmrg SP2NL='tr \040 \012' 1034456fccdSmrg NL2SP='tr \015\012 \040\040' 1044456fccdSmrg ;; 1054456fccdSmrg *) # EBCDIC based system 1064456fccdSmrg SP2NL='tr \100 \n' 1074456fccdSmrg NL2SP='tr \r\n \100\100' 1084456fccdSmrg ;; 1094456fccdSmrgesac 1104456fccdSmrg 1114456fccdSmrg# NLS nuisances. 1124456fccdSmrg# Only set LANG and LC_ALL to C if already set. 1134456fccdSmrg# These must not be set unconditionally because not all systems understand 1144456fccdSmrg# e.g. LANG=C (notably SCO). 1154456fccdSmrg# We save the old values to restore during execute mode. 11642d69509Smrglt_env= 11742d69509Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11842d69509Smrgdo 11942d69509Smrg eval "if test \"\${$lt_var+set}\" = set; then 12042d69509Smrg save_$lt_var=\$$lt_var 12142d69509Smrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 12242d69509Smrg $lt_var=C 12342d69509Smrg export $lt_var 12442d69509Smrg fi" 12542d69509Smrgdone 12642d69509Smrg 12742d69509Smrgif test -n "$lt_env"; then 12842d69509Smrg lt_env="env $lt_env" 1294456fccdSmrgfi 1304456fccdSmrg 1314456fccdSmrg# Make sure IFS has a sensible default 1324456fccdSmrglt_nl=' 1334456fccdSmrg' 1344456fccdSmrgIFS=" $lt_nl" 1354456fccdSmrg 1364456fccdSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1374456fccdSmrg $echo "$modename: not configured to build any kind of library" 1>&2 1384456fccdSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1394456fccdSmrg exit $EXIT_FAILURE 1404456fccdSmrgfi 1414456fccdSmrg 1424456fccdSmrg# Global variables. 1434456fccdSmrgmode=$default_mode 1444456fccdSmrgnonopt= 1454456fccdSmrgprev= 1464456fccdSmrgprevopt= 1474456fccdSmrgrun= 1484456fccdSmrgshow="$echo" 1494456fccdSmrgshow_help= 1504456fccdSmrgexecute_dlfiles= 1514456fccdSmrgduplicate_deps=no 1524456fccdSmrgpreserve_args= 1534456fccdSmrglo2o="s/\\.lo\$/.${objext}/" 1544456fccdSmrgo2lo="s/\\.${objext}\$/.lo/" 15542d69509Smrgextracted_archives= 15642d69509Smrgextracted_serial=0 1574456fccdSmrg 1584456fccdSmrg##################################### 1594456fccdSmrg# Shell function definitions: 1604456fccdSmrg# This seems to be the best place for them 1614456fccdSmrg 1624456fccdSmrg# func_mktempdir [string] 1634456fccdSmrg# Make a temporary directory that won't clash with other running 1644456fccdSmrg# libtool processes, and avoids race conditions if possible. If 1654456fccdSmrg# given, STRING is the basename for that directory. 1664456fccdSmrgfunc_mktempdir () 1674456fccdSmrg{ 1684456fccdSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 1694456fccdSmrg 1704456fccdSmrg if test "$run" = ":"; then 1714456fccdSmrg # Return a directory name, but don't create it in dry-run mode 1724456fccdSmrg my_tmpdir="${my_template}-$$" 1734456fccdSmrg else 1744456fccdSmrg 1754456fccdSmrg # If mktemp works, use that first and foremost 1764456fccdSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1774456fccdSmrg 1784456fccdSmrg if test ! -d "$my_tmpdir"; then 1794456fccdSmrg # Failing that, at least try and use $RANDOM to avoid a race 1804456fccdSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 1814456fccdSmrg 1824456fccdSmrg save_mktempdir_umask=`umask` 1834456fccdSmrg umask 0077 1844456fccdSmrg $mkdir "$my_tmpdir" 1854456fccdSmrg umask $save_mktempdir_umask 1864456fccdSmrg fi 1874456fccdSmrg 1884456fccdSmrg # If we're not in dry-run mode, bomb out on failure 1894456fccdSmrg test -d "$my_tmpdir" || { 1904456fccdSmrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 1914456fccdSmrg exit $EXIT_FAILURE 1924456fccdSmrg } 1934456fccdSmrg fi 1944456fccdSmrg 1954456fccdSmrg $echo "X$my_tmpdir" | $Xsed 1964456fccdSmrg} 1974456fccdSmrg 1984456fccdSmrg 1994456fccdSmrg# func_win32_libid arg 2004456fccdSmrg# return the library type of file 'arg' 2014456fccdSmrg# 2024456fccdSmrg# Need a lot of goo to handle *both* DLLs and import libs 2034456fccdSmrg# Has to be a shell function in order to 'eat' the argument 2044456fccdSmrg# that is supplied when $file_magic_command is called. 2054456fccdSmrgfunc_win32_libid () 2064456fccdSmrg{ 2074456fccdSmrg win32_libid_type="unknown" 2084456fccdSmrg win32_fileres=`file -L $1 2>/dev/null` 2094456fccdSmrg case $win32_fileres in 2104456fccdSmrg *ar\ archive\ import\ library*) # definitely import 2114456fccdSmrg win32_libid_type="x86 archive import" 2124456fccdSmrg ;; 2134456fccdSmrg *ar\ archive*) # could be an import, or static 2144456fccdSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 2154456fccdSmrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2164456fccdSmrg win32_nmres=`eval $NM -f posix -A $1 | \ 21742d69509Smrg $SED -n -e '1,100{ 21842d69509Smrg / I /{ 21942d69509Smrg s,.*,import, 22042d69509Smrg p 22142d69509Smrg q 22242d69509Smrg } 22342d69509Smrg }'` 2244456fccdSmrg case $win32_nmres in 2254456fccdSmrg import*) win32_libid_type="x86 archive import";; 2264456fccdSmrg *) win32_libid_type="x86 archive static";; 2274456fccdSmrg esac 2284456fccdSmrg fi 2294456fccdSmrg ;; 2304456fccdSmrg *DLL*) 2314456fccdSmrg win32_libid_type="x86 DLL" 2324456fccdSmrg ;; 2334456fccdSmrg *executable*) # but shell scripts are "executable" too... 2344456fccdSmrg case $win32_fileres in 2354456fccdSmrg *MS\ Windows\ PE\ Intel*) 2364456fccdSmrg win32_libid_type="x86 DLL" 2374456fccdSmrg ;; 2384456fccdSmrg esac 2394456fccdSmrg ;; 2404456fccdSmrg esac 2414456fccdSmrg $echo $win32_libid_type 2424456fccdSmrg} 2434456fccdSmrg 2444456fccdSmrg 2454456fccdSmrg# func_infer_tag arg 2464456fccdSmrg# Infer tagged configuration to use if any are available and 2474456fccdSmrg# if one wasn't chosen via the "--tag" command line option. 2484456fccdSmrg# Only attempt this if the compiler in the base compile 2494456fccdSmrg# command doesn't match the default compiler. 2504456fccdSmrg# arg is usually of the form 'gcc ...' 2514456fccdSmrgfunc_infer_tag () 2524456fccdSmrg{ 2534456fccdSmrg if test -n "$available_tags" && test -z "$tagname"; then 2544456fccdSmrg CC_quoted= 2554456fccdSmrg for arg in $CC; do 2564456fccdSmrg case $arg in 2574456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2584456fccdSmrg arg="\"$arg\"" 2594456fccdSmrg ;; 2604456fccdSmrg esac 2614456fccdSmrg CC_quoted="$CC_quoted $arg" 2624456fccdSmrg done 2634456fccdSmrg case $@ in 2644456fccdSmrg # Blanks in the command may have been stripped by the calling shell, 2654456fccdSmrg # but not from the CC environment variable when configure was run. 2664456fccdSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 2674456fccdSmrg # Blanks at the start of $base_compile will cause this to fail 2684456fccdSmrg # if we don't check for them as well. 2694456fccdSmrg *) 2704456fccdSmrg for z in $available_tags; do 2714456fccdSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2724456fccdSmrg # Evaluate the configuration. 2734456fccdSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2744456fccdSmrg CC_quoted= 2754456fccdSmrg for arg in $CC; do 2764456fccdSmrg # Double-quote args containing other shell metacharacters. 2774456fccdSmrg case $arg in 2784456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2794456fccdSmrg arg="\"$arg\"" 2804456fccdSmrg ;; 2814456fccdSmrg esac 2824456fccdSmrg CC_quoted="$CC_quoted $arg" 2834456fccdSmrg done 2844456fccdSmrg case "$@ " in 2854456fccdSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 2864456fccdSmrg # The compiler in the base compile command matches 2874456fccdSmrg # the one in the tagged configuration. 2884456fccdSmrg # Assume this is the tagged configuration we want. 2894456fccdSmrg tagname=$z 2904456fccdSmrg break 2914456fccdSmrg ;; 2924456fccdSmrg esac 2934456fccdSmrg fi 2944456fccdSmrg done 2954456fccdSmrg # If $tagname still isn't set, then no tagged configuration 2964456fccdSmrg # was found and let the user know that the "--tag" command 2974456fccdSmrg # line option must be used. 2984456fccdSmrg if test -z "$tagname"; then 2994456fccdSmrg $echo "$modename: unable to infer tagged configuration" 3004456fccdSmrg $echo "$modename: specify a tag with \`--tag'" 1>&2 3014456fccdSmrg exit $EXIT_FAILURE 3024456fccdSmrg# else 3034456fccdSmrg# $echo "$modename: using $tagname tagged configuration" 3044456fccdSmrg fi 3054456fccdSmrg ;; 3064456fccdSmrg esac 3074456fccdSmrg fi 3084456fccdSmrg} 3094456fccdSmrg 3104456fccdSmrg 3114456fccdSmrg# func_extract_an_archive dir oldlib 3124456fccdSmrgfunc_extract_an_archive () 3134456fccdSmrg{ 3144456fccdSmrg f_ex_an_ar_dir="$1"; shift 3154456fccdSmrg f_ex_an_ar_oldlib="$1" 3164456fccdSmrg 3174456fccdSmrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 3184456fccdSmrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 3194456fccdSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3204456fccdSmrg : 3214456fccdSmrg else 3224456fccdSmrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 3234456fccdSmrg exit $EXIT_FAILURE 3244456fccdSmrg fi 3254456fccdSmrg} 3264456fccdSmrg 3274456fccdSmrg# func_extract_archives gentop oldlib ... 3284456fccdSmrgfunc_extract_archives () 3294456fccdSmrg{ 3304456fccdSmrg my_gentop="$1"; shift 3314456fccdSmrg my_oldlibs=${1+"$@"} 3324456fccdSmrg my_oldobjs="" 3334456fccdSmrg my_xlib="" 3344456fccdSmrg my_xabs="" 3354456fccdSmrg my_xdir="" 3364456fccdSmrg my_status="" 3374456fccdSmrg 3384456fccdSmrg $show "${rm}r $my_gentop" 3394456fccdSmrg $run ${rm}r "$my_gentop" 3404456fccdSmrg $show "$mkdir $my_gentop" 3414456fccdSmrg $run $mkdir "$my_gentop" 3424456fccdSmrg my_status=$? 3434456fccdSmrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3444456fccdSmrg exit $my_status 3454456fccdSmrg fi 3464456fccdSmrg 3474456fccdSmrg for my_xlib in $my_oldlibs; do 3484456fccdSmrg # Extract the objects. 3494456fccdSmrg case $my_xlib in 3504456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3514456fccdSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 3524456fccdSmrg esac 3534456fccdSmrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 35442d69509Smrg my_xlib_u=$my_xlib 35542d69509Smrg while :; do 35642d69509Smrg case " $extracted_archives " in 35742d69509Smrg *" $my_xlib_u "*) 35842d69509Smrg extracted_serial=`expr $extracted_serial + 1` 35942d69509Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 36042d69509Smrg *) break ;; 36142d69509Smrg esac 36242d69509Smrg done 36342d69509Smrg extracted_archives="$extracted_archives $my_xlib_u" 36442d69509Smrg my_xdir="$my_gentop/$my_xlib_u" 3654456fccdSmrg 3664456fccdSmrg $show "${rm}r $my_xdir" 3674456fccdSmrg $run ${rm}r "$my_xdir" 3684456fccdSmrg $show "$mkdir $my_xdir" 3694456fccdSmrg $run $mkdir "$my_xdir" 3704456fccdSmrg exit_status=$? 3714456fccdSmrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 3724456fccdSmrg exit $exit_status 3734456fccdSmrg fi 3744456fccdSmrg case $host in 3754456fccdSmrg *-darwin*) 3764456fccdSmrg $show "Extracting $my_xabs" 3774456fccdSmrg # Do not bother doing anything if just a dry run 3784456fccdSmrg if test -z "$run"; then 3794456fccdSmrg darwin_orig_dir=`pwd` 3804456fccdSmrg cd $my_xdir || exit $? 3814456fccdSmrg darwin_archive=$my_xabs 3824456fccdSmrg darwin_curdir=`pwd` 3834456fccdSmrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 3844456fccdSmrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 3854456fccdSmrg if test -n "$darwin_arches"; then 3864456fccdSmrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 3874456fccdSmrg darwin_arch= 3884456fccdSmrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 3894456fccdSmrg for darwin_arch in $darwin_arches ; do 3904456fccdSmrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3914456fccdSmrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3924456fccdSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3934456fccdSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3944456fccdSmrg cd "$darwin_curdir" 3954456fccdSmrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3964456fccdSmrg done # $darwin_arches 3974456fccdSmrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 3984456fccdSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 3994456fccdSmrg darwin_file= 4004456fccdSmrg darwin_files= 4014456fccdSmrg for darwin_file in $darwin_filelist; do 4024456fccdSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 4034456fccdSmrg lipo -create -output "$darwin_file" $darwin_files 4044456fccdSmrg done # $darwin_filelist 4054456fccdSmrg ${rm}r unfat-$$ 4064456fccdSmrg cd "$darwin_orig_dir" 4074456fccdSmrg else 4084456fccdSmrg cd "$darwin_orig_dir" 4094456fccdSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 4104456fccdSmrg fi # $darwin_arches 4114456fccdSmrg fi # $run 4124456fccdSmrg ;; 4134456fccdSmrg *) 4144456fccdSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 4154456fccdSmrg ;; 4164456fccdSmrg esac 4174456fccdSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 4184456fccdSmrg done 4194456fccdSmrg func_extract_archives_result="$my_oldobjs" 4204456fccdSmrg} 4214456fccdSmrg# End of Shell function definitions 4224456fccdSmrg##################################### 4234456fccdSmrg 4244456fccdSmrg# Darwin sucks 4254456fccdSmrgeval std_shrext=\"$shrext_cmds\" 4264456fccdSmrg 4274456fccdSmrgdisable_libs=no 4284456fccdSmrg 4294456fccdSmrg# Parse our command line options once, thoroughly. 4304456fccdSmrgwhile test "$#" -gt 0 4314456fccdSmrgdo 4324456fccdSmrg arg="$1" 4334456fccdSmrg shift 4344456fccdSmrg 4354456fccdSmrg case $arg in 4364456fccdSmrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4374456fccdSmrg *) optarg= ;; 4384456fccdSmrg esac 4394456fccdSmrg 4404456fccdSmrg # If the previous option needs an argument, assign it. 4414456fccdSmrg if test -n "$prev"; then 4424456fccdSmrg case $prev in 4434456fccdSmrg execute_dlfiles) 4444456fccdSmrg execute_dlfiles="$execute_dlfiles $arg" 4454456fccdSmrg ;; 4464456fccdSmrg tag) 4474456fccdSmrg tagname="$arg" 4484456fccdSmrg preserve_args="${preserve_args}=$arg" 4494456fccdSmrg 4504456fccdSmrg # Check whether tagname contains only valid characters 4514456fccdSmrg case $tagname in 4524456fccdSmrg *[!-_A-Za-z0-9,/]*) 4534456fccdSmrg $echo "$progname: invalid tag name: $tagname" 1>&2 4544456fccdSmrg exit $EXIT_FAILURE 4554456fccdSmrg ;; 4564456fccdSmrg esac 4574456fccdSmrg 4584456fccdSmrg case $tagname in 4594456fccdSmrg CC) 4604456fccdSmrg # Don't test for the "default" C tag, as we know, it's there, but 4614456fccdSmrg # not specially marked. 4624456fccdSmrg ;; 4634456fccdSmrg *) 4644456fccdSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 4654456fccdSmrg taglist="$taglist $tagname" 4664456fccdSmrg # Evaluate the configuration. 4674456fccdSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 4684456fccdSmrg else 4694456fccdSmrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 4704456fccdSmrg fi 4714456fccdSmrg ;; 4724456fccdSmrg esac 4734456fccdSmrg ;; 4744456fccdSmrg *) 4754456fccdSmrg eval "$prev=\$arg" 4764456fccdSmrg ;; 4774456fccdSmrg esac 4784456fccdSmrg 4794456fccdSmrg prev= 4804456fccdSmrg prevopt= 4814456fccdSmrg continue 4824456fccdSmrg fi 4834456fccdSmrg 4844456fccdSmrg # Have we seen a non-optional argument yet? 4854456fccdSmrg case $arg in 4864456fccdSmrg --help) 4874456fccdSmrg show_help=yes 4884456fccdSmrg ;; 4894456fccdSmrg 4904456fccdSmrg --version) 49142d69509Smrg echo "\ 49242d69509Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 49342d69509Smrg 49442d69509SmrgCopyright (C) 2008 Free Software Foundation, Inc. 49542d69509SmrgThis is free software; see the source for copying conditions. There is NO 49642d69509Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 4974456fccdSmrg exit $? 4984456fccdSmrg ;; 4994456fccdSmrg 5004456fccdSmrg --config) 5014456fccdSmrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 5024456fccdSmrg # Now print the configurations for the tags. 5034456fccdSmrg for tagname in $taglist; do 5044456fccdSmrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 5054456fccdSmrg done 5064456fccdSmrg exit $? 5074456fccdSmrg ;; 5084456fccdSmrg 5094456fccdSmrg --debug) 5104456fccdSmrg $echo "$progname: enabling shell trace mode" 5114456fccdSmrg set -x 5124456fccdSmrg preserve_args="$preserve_args $arg" 5134456fccdSmrg ;; 5144456fccdSmrg 5154456fccdSmrg --dry-run | -n) 5164456fccdSmrg run=: 5174456fccdSmrg ;; 5184456fccdSmrg 5194456fccdSmrg --features) 5204456fccdSmrg $echo "host: $host" 5214456fccdSmrg if test "$build_libtool_libs" = yes; then 5224456fccdSmrg $echo "enable shared libraries" 5234456fccdSmrg else 5244456fccdSmrg $echo "disable shared libraries" 5254456fccdSmrg fi 5264456fccdSmrg if test "$build_old_libs" = yes; then 5274456fccdSmrg $echo "enable static libraries" 5284456fccdSmrg else 5294456fccdSmrg $echo "disable static libraries" 5304456fccdSmrg fi 5314456fccdSmrg exit $? 5324456fccdSmrg ;; 5334456fccdSmrg 5344456fccdSmrg --finish) mode="finish" ;; 5354456fccdSmrg 5364456fccdSmrg --mode) prevopt="--mode" prev=mode ;; 5374456fccdSmrg --mode=*) mode="$optarg" ;; 5384456fccdSmrg 5394456fccdSmrg --preserve-dup-deps) duplicate_deps="yes" ;; 5404456fccdSmrg 5414456fccdSmrg --quiet | --silent) 5424456fccdSmrg show=: 5434456fccdSmrg preserve_args="$preserve_args $arg" 5444456fccdSmrg ;; 5454456fccdSmrg 5464456fccdSmrg --tag) 5474456fccdSmrg prevopt="--tag" 5484456fccdSmrg prev=tag 5494456fccdSmrg preserve_args="$preserve_args --tag" 5504456fccdSmrg ;; 5514456fccdSmrg --tag=*) 5524456fccdSmrg set tag "$optarg" ${1+"$@"} 5534456fccdSmrg shift 5544456fccdSmrg prev=tag 5554456fccdSmrg preserve_args="$preserve_args --tag" 5564456fccdSmrg ;; 5574456fccdSmrg 5584456fccdSmrg -dlopen) 5594456fccdSmrg prevopt="-dlopen" 5604456fccdSmrg prev=execute_dlfiles 5614456fccdSmrg ;; 5624456fccdSmrg 5634456fccdSmrg -*) 5644456fccdSmrg $echo "$modename: unrecognized option \`$arg'" 1>&2 5654456fccdSmrg $echo "$help" 1>&2 5664456fccdSmrg exit $EXIT_FAILURE 5674456fccdSmrg ;; 5684456fccdSmrg 5694456fccdSmrg *) 5704456fccdSmrg nonopt="$arg" 5714456fccdSmrg break 5724456fccdSmrg ;; 5734456fccdSmrg esac 5744456fccdSmrgdone 5754456fccdSmrg 5764456fccdSmrgif test -n "$prevopt"; then 5774456fccdSmrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 5784456fccdSmrg $echo "$help" 1>&2 5794456fccdSmrg exit $EXIT_FAILURE 5804456fccdSmrgfi 5814456fccdSmrg 5824456fccdSmrgcase $disable_libs in 5834456fccdSmrgno) 5844456fccdSmrg ;; 5854456fccdSmrgshared) 5864456fccdSmrg build_libtool_libs=no 5874456fccdSmrg build_old_libs=yes 5884456fccdSmrg ;; 5894456fccdSmrgstatic) 5904456fccdSmrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5914456fccdSmrg ;; 5924456fccdSmrgesac 5934456fccdSmrg 5944456fccdSmrg# If this variable is set in any of the actions, the command in it 5954456fccdSmrg# will be execed at the end. This prevents here-documents from being 5964456fccdSmrg# left over by shells. 5974456fccdSmrgexec_cmd= 5984456fccdSmrg 5994456fccdSmrgif test -z "$show_help"; then 6004456fccdSmrg 6014456fccdSmrg # Infer the operation mode. 6024456fccdSmrg if test -z "$mode"; then 6034456fccdSmrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 6044456fccdSmrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 6054456fccdSmrg case $nonopt in 6064456fccdSmrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 6074456fccdSmrg mode=link 6084456fccdSmrg for arg 6094456fccdSmrg do 6104456fccdSmrg case $arg in 6114456fccdSmrg -c) 6124456fccdSmrg mode=compile 6134456fccdSmrg break 6144456fccdSmrg ;; 6154456fccdSmrg esac 6164456fccdSmrg done 6174456fccdSmrg ;; 6184456fccdSmrg *db | *dbx | *strace | *truss) 6194456fccdSmrg mode=execute 6204456fccdSmrg ;; 6214456fccdSmrg *install*|cp|mv) 6224456fccdSmrg mode=install 6234456fccdSmrg ;; 6244456fccdSmrg *rm) 6254456fccdSmrg mode=uninstall 6264456fccdSmrg ;; 6274456fccdSmrg *) 6284456fccdSmrg # If we have no mode, but dlfiles were specified, then do execute mode. 6294456fccdSmrg test -n "$execute_dlfiles" && mode=execute 6304456fccdSmrg 6314456fccdSmrg # Just use the default operation mode. 6324456fccdSmrg if test -z "$mode"; then 6334456fccdSmrg if test -n "$nonopt"; then 6344456fccdSmrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6354456fccdSmrg else 6364456fccdSmrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6374456fccdSmrg fi 6384456fccdSmrg fi 6394456fccdSmrg ;; 6404456fccdSmrg esac 6414456fccdSmrg fi 6424456fccdSmrg 6434456fccdSmrg # Only execute mode is allowed to have -dlopen flags. 6444456fccdSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 6454456fccdSmrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 6464456fccdSmrg $echo "$help" 1>&2 6474456fccdSmrg exit $EXIT_FAILURE 6484456fccdSmrg fi 6494456fccdSmrg 6504456fccdSmrg # Change the help message to a mode-specific one. 6514456fccdSmrg generic_help="$help" 6524456fccdSmrg help="Try \`$modename --help --mode=$mode' for more information." 6534456fccdSmrg 6544456fccdSmrg # These modes are in order of execution frequency so that they run quickly. 6554456fccdSmrg case $mode in 6564456fccdSmrg # libtool compile mode 6574456fccdSmrg compile) 6584456fccdSmrg modename="$modename: compile" 6594456fccdSmrg # Get the compilation command and the source file. 6604456fccdSmrg base_compile= 6614456fccdSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 6624456fccdSmrg suppress_opt=yes 6634456fccdSmrg suppress_output= 6644456fccdSmrg arg_mode=normal 6654456fccdSmrg libobj= 6664456fccdSmrg later= 6674456fccdSmrg 6684456fccdSmrg for arg 6694456fccdSmrg do 6704456fccdSmrg case $arg_mode in 6714456fccdSmrg arg ) 6724456fccdSmrg # do not "continue". Instead, add this to base_compile 6734456fccdSmrg lastarg="$arg" 6744456fccdSmrg arg_mode=normal 6754456fccdSmrg ;; 6764456fccdSmrg 6774456fccdSmrg target ) 6784456fccdSmrg libobj="$arg" 6794456fccdSmrg arg_mode=normal 6804456fccdSmrg continue 6814456fccdSmrg ;; 6824456fccdSmrg 6834456fccdSmrg normal ) 6844456fccdSmrg # Accept any command-line options. 6854456fccdSmrg case $arg in 6864456fccdSmrg -o) 6874456fccdSmrg if test -n "$libobj" ; then 6884456fccdSmrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 6894456fccdSmrg exit $EXIT_FAILURE 6904456fccdSmrg fi 6914456fccdSmrg arg_mode=target 6924456fccdSmrg continue 6934456fccdSmrg ;; 6944456fccdSmrg 6954456fccdSmrg -static | -prefer-pic | -prefer-non-pic) 6964456fccdSmrg later="$later $arg" 6974456fccdSmrg continue 6984456fccdSmrg ;; 6994456fccdSmrg 7004456fccdSmrg -no-suppress) 7014456fccdSmrg suppress_opt=no 7024456fccdSmrg continue 7034456fccdSmrg ;; 7044456fccdSmrg 7054456fccdSmrg -Xcompiler) 7064456fccdSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 7074456fccdSmrg continue # The current "srcfile" will either be retained or 7084456fccdSmrg ;; # replaced later. I would guess that would be a bug. 7094456fccdSmrg 7104456fccdSmrg -Wc,*) 7114456fccdSmrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 7124456fccdSmrg lastarg= 7134456fccdSmrg save_ifs="$IFS"; IFS=',' 7144456fccdSmrg for arg in $args; do 7154456fccdSmrg IFS="$save_ifs" 7164456fccdSmrg 7174456fccdSmrg # Double-quote args containing other shell metacharacters. 7184456fccdSmrg # Many Bourne shells cannot handle close brackets correctly 7194456fccdSmrg # in scan sets, so we specify it separately. 7204456fccdSmrg case $arg in 7214456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7224456fccdSmrg arg="\"$arg\"" 7234456fccdSmrg ;; 7244456fccdSmrg esac 7254456fccdSmrg lastarg="$lastarg $arg" 7264456fccdSmrg done 7274456fccdSmrg IFS="$save_ifs" 7284456fccdSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 7294456fccdSmrg 7304456fccdSmrg # Add the arguments to base_compile. 7314456fccdSmrg base_compile="$base_compile $lastarg" 7324456fccdSmrg continue 7334456fccdSmrg ;; 7344456fccdSmrg 7354456fccdSmrg * ) 7364456fccdSmrg # Accept the current argument as the source file. 7374456fccdSmrg # The previous "srcfile" becomes the current argument. 7384456fccdSmrg # 7394456fccdSmrg lastarg="$srcfile" 7404456fccdSmrg srcfile="$arg" 7414456fccdSmrg ;; 7424456fccdSmrg esac # case $arg 7434456fccdSmrg ;; 7444456fccdSmrg esac # case $arg_mode 7454456fccdSmrg 7464456fccdSmrg # Aesthetically quote the previous argument. 7474456fccdSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7484456fccdSmrg 7494456fccdSmrg case $lastarg in 7504456fccdSmrg # Double-quote args containing other shell metacharacters. 7514456fccdSmrg # Many Bourne shells cannot handle close brackets correctly 7524456fccdSmrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 7534456fccdSmrg # in scan sets (worked around with variable expansion), 7544456fccdSmrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 7554456fccdSmrg # at all, so we specify them separately. 7564456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7574456fccdSmrg lastarg="\"$lastarg\"" 7584456fccdSmrg ;; 7594456fccdSmrg esac 7604456fccdSmrg 7614456fccdSmrg base_compile="$base_compile $lastarg" 7624456fccdSmrg done # for arg 7634456fccdSmrg 7644456fccdSmrg case $arg_mode in 7654456fccdSmrg arg) 7664456fccdSmrg $echo "$modename: you must specify an argument for -Xcompile" 7674456fccdSmrg exit $EXIT_FAILURE 7684456fccdSmrg ;; 7694456fccdSmrg target) 7704456fccdSmrg $echo "$modename: you must specify a target with \`-o'" 1>&2 7714456fccdSmrg exit $EXIT_FAILURE 7724456fccdSmrg ;; 7734456fccdSmrg *) 7744456fccdSmrg # Get the name of the library object. 7754456fccdSmrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 7764456fccdSmrg ;; 7774456fccdSmrg esac 7784456fccdSmrg 7794456fccdSmrg # Recognize several different file suffixes. 7804456fccdSmrg # If the user specifies -o file.o, it is replaced with file.lo 7814456fccdSmrg xform='[cCFSifmso]' 7824456fccdSmrg case $libobj in 7834456fccdSmrg *.ada) xform=ada ;; 7844456fccdSmrg *.adb) xform=adb ;; 7854456fccdSmrg *.ads) xform=ads ;; 7864456fccdSmrg *.asm) xform=asm ;; 7874456fccdSmrg *.c++) xform=c++ ;; 7884456fccdSmrg *.cc) xform=cc ;; 7894456fccdSmrg *.ii) xform=ii ;; 7904456fccdSmrg *.class) xform=class ;; 7914456fccdSmrg *.cpp) xform=cpp ;; 7924456fccdSmrg *.cxx) xform=cxx ;; 79342d69509Smrg *.[fF][09]?) xform=[fF][09]. ;; 7944456fccdSmrg *.for) xform=for ;; 7954456fccdSmrg *.java) xform=java ;; 79642d69509Smrg *.obj) xform=obj ;; 79742d69509Smrg *.sx) xform=sx ;; 7984456fccdSmrg esac 7994456fccdSmrg 8004456fccdSmrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 8014456fccdSmrg 8024456fccdSmrg case $libobj in 8034456fccdSmrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 8044456fccdSmrg *) 8054456fccdSmrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 8064456fccdSmrg exit $EXIT_FAILURE 8074456fccdSmrg ;; 8084456fccdSmrg esac 8094456fccdSmrg 8104456fccdSmrg func_infer_tag $base_compile 8114456fccdSmrg 8124456fccdSmrg for arg in $later; do 8134456fccdSmrg case $arg in 8144456fccdSmrg -static) 8154456fccdSmrg build_old_libs=yes 8164456fccdSmrg continue 8174456fccdSmrg ;; 8184456fccdSmrg 8194456fccdSmrg -prefer-pic) 8204456fccdSmrg pic_mode=yes 8214456fccdSmrg continue 8224456fccdSmrg ;; 8234456fccdSmrg 8244456fccdSmrg -prefer-non-pic) 8254456fccdSmrg pic_mode=no 8264456fccdSmrg continue 8274456fccdSmrg ;; 8284456fccdSmrg esac 8294456fccdSmrg done 8304456fccdSmrg 8314456fccdSmrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 8324456fccdSmrg case $qlibobj in 8334456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8344456fccdSmrg qlibobj="\"$qlibobj\"" ;; 8354456fccdSmrg esac 8364456fccdSmrg test "X$libobj" != "X$qlibobj" \ 8374456fccdSmrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 8384456fccdSmrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 8394456fccdSmrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 8404456fccdSmrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8414456fccdSmrg if test "X$xdir" = "X$obj"; then 8424456fccdSmrg xdir= 8434456fccdSmrg else 8444456fccdSmrg xdir=$xdir/ 8454456fccdSmrg fi 8464456fccdSmrg lobj=${xdir}$objdir/$objname 8474456fccdSmrg 8484456fccdSmrg if test -z "$base_compile"; then 8494456fccdSmrg $echo "$modename: you must specify a compilation command" 1>&2 8504456fccdSmrg $echo "$help" 1>&2 8514456fccdSmrg exit $EXIT_FAILURE 8524456fccdSmrg fi 8534456fccdSmrg 8544456fccdSmrg # Delete any leftover library objects. 8554456fccdSmrg if test "$build_old_libs" = yes; then 8564456fccdSmrg removelist="$obj $lobj $libobj ${libobj}T" 8574456fccdSmrg else 8584456fccdSmrg removelist="$lobj $libobj ${libobj}T" 8594456fccdSmrg fi 8604456fccdSmrg 8614456fccdSmrg $run $rm $removelist 8624456fccdSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8634456fccdSmrg 8644456fccdSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 8654456fccdSmrg case $host_os in 8664456fccdSmrg cygwin* | mingw* | pw32* | os2*) 8674456fccdSmrg pic_mode=default 8684456fccdSmrg ;; 8694456fccdSmrg esac 8704456fccdSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 8714456fccdSmrg # non-PIC code in shared libraries is not supported 8724456fccdSmrg pic_mode=default 8734456fccdSmrg fi 8744456fccdSmrg 8754456fccdSmrg # Calculate the filename of the output object if compiler does 8764456fccdSmrg # not support -o with -c 8774456fccdSmrg if test "$compiler_c_o" = no; then 8784456fccdSmrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 8794456fccdSmrg lockfile="$output_obj.lock" 8804456fccdSmrg removelist="$removelist $output_obj $lockfile" 8814456fccdSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8824456fccdSmrg else 8834456fccdSmrg output_obj= 8844456fccdSmrg need_locks=no 8854456fccdSmrg lockfile= 8864456fccdSmrg fi 8874456fccdSmrg 8884456fccdSmrg # Lock this critical section if it is needed 8894456fccdSmrg # We use this script file to make the link, it avoids creating a new file 8904456fccdSmrg if test "$need_locks" = yes; then 8914456fccdSmrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 8924456fccdSmrg $show "Waiting for $lockfile to be removed" 8934456fccdSmrg sleep 2 8944456fccdSmrg done 8954456fccdSmrg elif test "$need_locks" = warn; then 8964456fccdSmrg if test -f "$lockfile"; then 8974456fccdSmrg $echo "\ 8984456fccdSmrg*** ERROR, $lockfile exists and contains: 8994456fccdSmrg`cat $lockfile 2>/dev/null` 9004456fccdSmrg 9014456fccdSmrgThis indicates that another process is trying to use the same 9024456fccdSmrgtemporary object file, and libtool could not work around it because 9034456fccdSmrgyour compiler does not support \`-c' and \`-o' together. If you 9044456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better 9054456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better 9064456fccdSmrgcompiler." 9074456fccdSmrg 9084456fccdSmrg $run $rm $removelist 9094456fccdSmrg exit $EXIT_FAILURE 9104456fccdSmrg fi 9114456fccdSmrg $echo "$srcfile" > "$lockfile" 9124456fccdSmrg fi 9134456fccdSmrg 9144456fccdSmrg if test -n "$fix_srcfile_path"; then 9154456fccdSmrg eval srcfile=\"$fix_srcfile_path\" 9164456fccdSmrg fi 9174456fccdSmrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 9184456fccdSmrg case $qsrcfile in 9194456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 9204456fccdSmrg qsrcfile="\"$qsrcfile\"" ;; 9214456fccdSmrg esac 9224456fccdSmrg 9234456fccdSmrg $run $rm "$libobj" "${libobj}T" 9244456fccdSmrg 9254456fccdSmrg # Create a libtool object file (analogous to a ".la" file), 9264456fccdSmrg # but don't create it if we're doing a dry run. 9274456fccdSmrg test -z "$run" && cat > ${libobj}T <<EOF 9284456fccdSmrg# $libobj - a libtool object file 9294456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 9304456fccdSmrg# 9314456fccdSmrg# Please DO NOT delete this file! 9324456fccdSmrg# It is necessary for linking the library. 9334456fccdSmrg 9344456fccdSmrg# Name of the PIC object. 9354456fccdSmrgEOF 9364456fccdSmrg 9374456fccdSmrg # Only build a PIC object if we are building libtool libraries. 9384456fccdSmrg if test "$build_libtool_libs" = yes; then 9394456fccdSmrg # Without this assignment, base_compile gets emptied. 9404456fccdSmrg fbsd_hideous_sh_bug=$base_compile 9414456fccdSmrg 9424456fccdSmrg if test "$pic_mode" != no; then 9434456fccdSmrg command="$base_compile $qsrcfile $pic_flag" 9444456fccdSmrg else 9454456fccdSmrg # Don't build PIC code 9464456fccdSmrg command="$base_compile $qsrcfile" 9474456fccdSmrg fi 9484456fccdSmrg 9494456fccdSmrg if test ! -d "${xdir}$objdir"; then 9504456fccdSmrg $show "$mkdir ${xdir}$objdir" 9514456fccdSmrg $run $mkdir ${xdir}$objdir 9524456fccdSmrg exit_status=$? 9534456fccdSmrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 9544456fccdSmrg exit $exit_status 9554456fccdSmrg fi 9564456fccdSmrg fi 9574456fccdSmrg 9584456fccdSmrg if test -z "$output_obj"; then 9594456fccdSmrg # Place PIC objects in $objdir 9604456fccdSmrg command="$command -o $lobj" 9614456fccdSmrg fi 9624456fccdSmrg 9634456fccdSmrg $run $rm "$lobj" "$output_obj" 9644456fccdSmrg 9654456fccdSmrg $show "$command" 96642d69509Smrg if $run eval $lt_env "$command"; then : 9674456fccdSmrg else 9684456fccdSmrg test -n "$output_obj" && $run $rm $removelist 9694456fccdSmrg exit $EXIT_FAILURE 9704456fccdSmrg fi 9714456fccdSmrg 9724456fccdSmrg if test "$need_locks" = warn && 9734456fccdSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 9744456fccdSmrg $echo "\ 9754456fccdSmrg*** ERROR, $lockfile contains: 9764456fccdSmrg`cat $lockfile 2>/dev/null` 9774456fccdSmrg 9784456fccdSmrgbut it should contain: 9794456fccdSmrg$srcfile 9804456fccdSmrg 9814456fccdSmrgThis indicates that another process is trying to use the same 9824456fccdSmrgtemporary object file, and libtool could not work around it because 9834456fccdSmrgyour compiler does not support \`-c' and \`-o' together. If you 9844456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better 9854456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better 9864456fccdSmrgcompiler." 9874456fccdSmrg 9884456fccdSmrg $run $rm $removelist 9894456fccdSmrg exit $EXIT_FAILURE 9904456fccdSmrg fi 9914456fccdSmrg 9924456fccdSmrg # Just move the object if needed, then go on to compile the next one 9934456fccdSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 9944456fccdSmrg $show "$mv $output_obj $lobj" 9954456fccdSmrg if $run $mv $output_obj $lobj; then : 9964456fccdSmrg else 9974456fccdSmrg error=$? 9984456fccdSmrg $run $rm $removelist 9994456fccdSmrg exit $error 10004456fccdSmrg fi 10014456fccdSmrg fi 10024456fccdSmrg 10034456fccdSmrg # Append the name of the PIC object to the libtool object file. 10044456fccdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10054456fccdSmrgpic_object='$objdir/$objname' 10064456fccdSmrg 10074456fccdSmrgEOF 10084456fccdSmrg 10094456fccdSmrg # Allow error messages only from the first compilation. 10104456fccdSmrg if test "$suppress_opt" = yes; then 10114456fccdSmrg suppress_output=' >/dev/null 2>&1' 10124456fccdSmrg fi 10134456fccdSmrg else 10144456fccdSmrg # No PIC object so indicate it doesn't exist in the libtool 10154456fccdSmrg # object file. 10164456fccdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10174456fccdSmrgpic_object=none 10184456fccdSmrg 10194456fccdSmrgEOF 10204456fccdSmrg fi 10214456fccdSmrg 10224456fccdSmrg # Only build a position-dependent object if we build old libraries. 10234456fccdSmrg if test "$build_old_libs" = yes; then 10244456fccdSmrg if test "$pic_mode" != yes; then 10254456fccdSmrg # Don't build PIC code 10264456fccdSmrg command="$base_compile $qsrcfile" 10274456fccdSmrg else 10284456fccdSmrg command="$base_compile $qsrcfile $pic_flag" 10294456fccdSmrg fi 10304456fccdSmrg if test "$compiler_c_o" = yes; then 10314456fccdSmrg command="$command -o $obj" 10324456fccdSmrg fi 10334456fccdSmrg 10344456fccdSmrg # Suppress compiler output if we already did a PIC compilation. 10354456fccdSmrg command="$command$suppress_output" 10364456fccdSmrg $run $rm "$obj" "$output_obj" 10374456fccdSmrg $show "$command" 103842d69509Smrg if $run eval $lt_env "$command"; then : 10394456fccdSmrg else 10404456fccdSmrg $run $rm $removelist 10414456fccdSmrg exit $EXIT_FAILURE 10424456fccdSmrg fi 10434456fccdSmrg 10444456fccdSmrg if test "$need_locks" = warn && 10454456fccdSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 10464456fccdSmrg $echo "\ 10474456fccdSmrg*** ERROR, $lockfile contains: 10484456fccdSmrg`cat $lockfile 2>/dev/null` 10494456fccdSmrg 10504456fccdSmrgbut it should contain: 10514456fccdSmrg$srcfile 10524456fccdSmrg 10534456fccdSmrgThis indicates that another process is trying to use the same 10544456fccdSmrgtemporary object file, and libtool could not work around it because 10554456fccdSmrgyour compiler does not support \`-c' and \`-o' together. If you 10564456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better 10574456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better 10584456fccdSmrgcompiler." 10594456fccdSmrg 10604456fccdSmrg $run $rm $removelist 10614456fccdSmrg exit $EXIT_FAILURE 10624456fccdSmrg fi 10634456fccdSmrg 10644456fccdSmrg # Just move the object if needed 10654456fccdSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 10664456fccdSmrg $show "$mv $output_obj $obj" 10674456fccdSmrg if $run $mv $output_obj $obj; then : 10684456fccdSmrg else 10694456fccdSmrg error=$? 10704456fccdSmrg $run $rm $removelist 10714456fccdSmrg exit $error 10724456fccdSmrg fi 10734456fccdSmrg fi 10744456fccdSmrg 10754456fccdSmrg # Append the name of the non-PIC object the libtool object file. 10764456fccdSmrg # Only append if the libtool object file exists. 10774456fccdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10784456fccdSmrg# Name of the non-PIC object. 10794456fccdSmrgnon_pic_object='$objname' 10804456fccdSmrg 10814456fccdSmrgEOF 10824456fccdSmrg else 10834456fccdSmrg # Append the name of the non-PIC object the libtool object file. 10844456fccdSmrg # Only append if the libtool object file exists. 10854456fccdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10864456fccdSmrg# Name of the non-PIC object. 10874456fccdSmrgnon_pic_object=none 10884456fccdSmrg 10894456fccdSmrgEOF 10904456fccdSmrg fi 10914456fccdSmrg 10924456fccdSmrg $run $mv "${libobj}T" "${libobj}" 10934456fccdSmrg 10944456fccdSmrg # Unlock the critical section if it was locked 10954456fccdSmrg if test "$need_locks" != no; then 10964456fccdSmrg $run $rm "$lockfile" 10974456fccdSmrg fi 10984456fccdSmrg 10994456fccdSmrg exit $EXIT_SUCCESS 11004456fccdSmrg ;; 11014456fccdSmrg 11024456fccdSmrg # libtool link mode 11034456fccdSmrg link | relink) 11044456fccdSmrg modename="$modename: link" 11054456fccdSmrg case $host in 11064456fccdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 11074456fccdSmrg # It is impossible to link a dll without this setting, and 11084456fccdSmrg # we shouldn't force the makefile maintainer to figure out 11094456fccdSmrg # which system we are compiling for in order to pass an extra 11104456fccdSmrg # flag for every libtool invocation. 11114456fccdSmrg # allow_undefined=no 11124456fccdSmrg 11134456fccdSmrg # FIXME: Unfortunately, there are problems with the above when trying 11144456fccdSmrg # to make a dll which has undefined symbols, in which case not 11154456fccdSmrg # even a static library is built. For now, we need to specify 11164456fccdSmrg # -no-undefined on the libtool link line when we can be certain 11174456fccdSmrg # that all symbols are satisfied, otherwise we get a static library. 11184456fccdSmrg allow_undefined=yes 11194456fccdSmrg ;; 11204456fccdSmrg *) 11214456fccdSmrg allow_undefined=yes 11224456fccdSmrg ;; 11234456fccdSmrg esac 11244456fccdSmrg libtool_args="$nonopt" 11254456fccdSmrg base_compile="$nonopt $@" 11264456fccdSmrg compile_command="$nonopt" 11274456fccdSmrg finalize_command="$nonopt" 11284456fccdSmrg 11294456fccdSmrg compile_rpath= 11304456fccdSmrg finalize_rpath= 11314456fccdSmrg compile_shlibpath= 11324456fccdSmrg finalize_shlibpath= 11334456fccdSmrg convenience= 11344456fccdSmrg old_convenience= 11354456fccdSmrg deplibs= 11364456fccdSmrg old_deplibs= 11374456fccdSmrg compiler_flags= 11384456fccdSmrg linker_flags= 11394456fccdSmrg dllsearchpath= 11404456fccdSmrg lib_search_path=`pwd` 11414456fccdSmrg inst_prefix_dir= 11424456fccdSmrg 11434456fccdSmrg avoid_version=no 11444456fccdSmrg dlfiles= 11454456fccdSmrg dlprefiles= 11464456fccdSmrg dlself=no 11474456fccdSmrg export_dynamic=no 11484456fccdSmrg export_symbols= 11494456fccdSmrg export_symbols_regex= 11504456fccdSmrg generated= 11514456fccdSmrg libobjs= 11524456fccdSmrg ltlibs= 11534456fccdSmrg module=no 11544456fccdSmrg no_install=no 11554456fccdSmrg objs= 11564456fccdSmrg non_pic_objects= 11574456fccdSmrg notinst_path= # paths that contain not-installed libtool libraries 11584456fccdSmrg precious_files_regex= 11594456fccdSmrg prefer_static_libs=no 11604456fccdSmrg preload=no 11614456fccdSmrg prev= 11624456fccdSmrg prevarg= 11634456fccdSmrg release= 11644456fccdSmrg rpath= 11654456fccdSmrg xrpath= 11664456fccdSmrg perm_rpath= 11674456fccdSmrg temp_rpath= 11684456fccdSmrg thread_safe=no 11694456fccdSmrg vinfo= 11704456fccdSmrg vinfo_number=no 117142d69509Smrg single_module="${wl}-single_module" 11724456fccdSmrg 11734456fccdSmrg func_infer_tag $base_compile 11744456fccdSmrg 11754456fccdSmrg # We need to know -static, to get the right output filenames. 11764456fccdSmrg for arg 11774456fccdSmrg do 11784456fccdSmrg case $arg in 117942d69509Smrg -all-static | -static | -static-libtool-libs) 118042d69509Smrg case $arg in 118142d69509Smrg -all-static) 11824456fccdSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 11834456fccdSmrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 11844456fccdSmrg fi 11854456fccdSmrg if test -n "$link_static_flag"; then 11864456fccdSmrg dlopen_self=$dlopen_self_static 11874456fccdSmrg fi 11884456fccdSmrg prefer_static_libs=yes 118942d69509Smrg ;; 119042d69509Smrg -static) 11914456fccdSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11924456fccdSmrg dlopen_self=$dlopen_self_static 11934456fccdSmrg fi 11944456fccdSmrg prefer_static_libs=built 119542d69509Smrg ;; 119642d69509Smrg -static-libtool-libs) 119742d69509Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 119842d69509Smrg dlopen_self=$dlopen_self_static 119942d69509Smrg fi 120042d69509Smrg prefer_static_libs=yes 120142d69509Smrg ;; 120242d69509Smrg esac 12034456fccdSmrg build_libtool_libs=no 12044456fccdSmrg build_old_libs=yes 12054456fccdSmrg break 12064456fccdSmrg ;; 12074456fccdSmrg esac 12084456fccdSmrg done 12094456fccdSmrg 12104456fccdSmrg # See if our shared archives depend on static archives. 12114456fccdSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 12124456fccdSmrg 12134456fccdSmrg # Go through the arguments, transforming them on the way. 12144456fccdSmrg while test "$#" -gt 0; do 12154456fccdSmrg arg="$1" 12164456fccdSmrg shift 12174456fccdSmrg case $arg in 12184456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 12194456fccdSmrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 12204456fccdSmrg ;; 12214456fccdSmrg *) qarg=$arg ;; 12224456fccdSmrg esac 12234456fccdSmrg libtool_args="$libtool_args $qarg" 12244456fccdSmrg 12254456fccdSmrg # If the previous option needs an argument, assign it. 12264456fccdSmrg if test -n "$prev"; then 12274456fccdSmrg case $prev in 12284456fccdSmrg output) 12294456fccdSmrg compile_command="$compile_command @OUTPUT@" 12304456fccdSmrg finalize_command="$finalize_command @OUTPUT@" 12314456fccdSmrg ;; 12324456fccdSmrg esac 12334456fccdSmrg 12344456fccdSmrg case $prev in 12354456fccdSmrg dlfiles|dlprefiles) 12364456fccdSmrg if test "$preload" = no; then 12374456fccdSmrg # Add the symbol object into the linking commands. 12384456fccdSmrg compile_command="$compile_command @SYMFILE@" 12394456fccdSmrg finalize_command="$finalize_command @SYMFILE@" 12404456fccdSmrg preload=yes 12414456fccdSmrg fi 12424456fccdSmrg case $arg in 12434456fccdSmrg *.la | *.lo) ;; # We handle these cases below. 12444456fccdSmrg force) 12454456fccdSmrg if test "$dlself" = no; then 12464456fccdSmrg dlself=needless 12474456fccdSmrg export_dynamic=yes 12484456fccdSmrg fi 12494456fccdSmrg prev= 12504456fccdSmrg continue 12514456fccdSmrg ;; 12524456fccdSmrg self) 12534456fccdSmrg if test "$prev" = dlprefiles; then 12544456fccdSmrg dlself=yes 12554456fccdSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 12564456fccdSmrg dlself=yes 12574456fccdSmrg else 12584456fccdSmrg dlself=needless 12594456fccdSmrg export_dynamic=yes 12604456fccdSmrg fi 12614456fccdSmrg prev= 12624456fccdSmrg continue 12634456fccdSmrg ;; 12644456fccdSmrg *) 12654456fccdSmrg if test "$prev" = dlfiles; then 12664456fccdSmrg dlfiles="$dlfiles $arg" 12674456fccdSmrg else 12684456fccdSmrg dlprefiles="$dlprefiles $arg" 12694456fccdSmrg fi 12704456fccdSmrg prev= 12714456fccdSmrg continue 12724456fccdSmrg ;; 12734456fccdSmrg esac 12744456fccdSmrg ;; 12754456fccdSmrg expsyms) 12764456fccdSmrg export_symbols="$arg" 12774456fccdSmrg if test ! -f "$arg"; then 12784456fccdSmrg $echo "$modename: symbol file \`$arg' does not exist" 12794456fccdSmrg exit $EXIT_FAILURE 12804456fccdSmrg fi 12814456fccdSmrg prev= 12824456fccdSmrg continue 12834456fccdSmrg ;; 12844456fccdSmrg expsyms_regex) 12854456fccdSmrg export_symbols_regex="$arg" 12864456fccdSmrg prev= 12874456fccdSmrg continue 12884456fccdSmrg ;; 12894456fccdSmrg inst_prefix) 12904456fccdSmrg inst_prefix_dir="$arg" 12914456fccdSmrg prev= 12924456fccdSmrg continue 12934456fccdSmrg ;; 12944456fccdSmrg precious_regex) 12954456fccdSmrg precious_files_regex="$arg" 12964456fccdSmrg prev= 12974456fccdSmrg continue 12984456fccdSmrg ;; 12994456fccdSmrg release) 13004456fccdSmrg release="-$arg" 13014456fccdSmrg prev= 13024456fccdSmrg continue 13034456fccdSmrg ;; 13044456fccdSmrg objectlist) 13054456fccdSmrg if test -f "$arg"; then 13064456fccdSmrg save_arg=$arg 13074456fccdSmrg moreargs= 13084456fccdSmrg for fil in `cat $save_arg` 13094456fccdSmrg do 13104456fccdSmrg# moreargs="$moreargs $fil" 13114456fccdSmrg arg=$fil 13124456fccdSmrg # A libtool-controlled object. 13134456fccdSmrg 13144456fccdSmrg # Check to see that this really is a libtool object. 13154456fccdSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 13164456fccdSmrg pic_object= 13174456fccdSmrg non_pic_object= 13184456fccdSmrg 13194456fccdSmrg # Read the .lo file 13204456fccdSmrg # If there is no directory component, then add one. 13214456fccdSmrg case $arg in 13224456fccdSmrg */* | *\\*) . $arg ;; 13234456fccdSmrg *) . ./$arg ;; 13244456fccdSmrg esac 13254456fccdSmrg 13264456fccdSmrg if test -z "$pic_object" || \ 13274456fccdSmrg test -z "$non_pic_object" || 13284456fccdSmrg test "$pic_object" = none && \ 13294456fccdSmrg test "$non_pic_object" = none; then 13304456fccdSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 13314456fccdSmrg exit $EXIT_FAILURE 13324456fccdSmrg fi 13334456fccdSmrg 13344456fccdSmrg # Extract subdirectory from the argument. 13354456fccdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13364456fccdSmrg if test "X$xdir" = "X$arg"; then 13374456fccdSmrg xdir= 13384456fccdSmrg else 13394456fccdSmrg xdir="$xdir/" 13404456fccdSmrg fi 13414456fccdSmrg 13424456fccdSmrg if test "$pic_object" != none; then 13434456fccdSmrg # Prepend the subdirectory the object is found in. 13444456fccdSmrg pic_object="$xdir$pic_object" 13454456fccdSmrg 13464456fccdSmrg if test "$prev" = dlfiles; then 13474456fccdSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13484456fccdSmrg dlfiles="$dlfiles $pic_object" 13494456fccdSmrg prev= 13504456fccdSmrg continue 13514456fccdSmrg else 13524456fccdSmrg # If libtool objects are unsupported, then we need to preload. 13534456fccdSmrg prev=dlprefiles 13544456fccdSmrg fi 13554456fccdSmrg fi 13564456fccdSmrg 13574456fccdSmrg # CHECK ME: I think I busted this. -Ossama 13584456fccdSmrg if test "$prev" = dlprefiles; then 13594456fccdSmrg # Preload the old-style object. 13604456fccdSmrg dlprefiles="$dlprefiles $pic_object" 13614456fccdSmrg prev= 13624456fccdSmrg fi 13634456fccdSmrg 13644456fccdSmrg # A PIC object. 13654456fccdSmrg libobjs="$libobjs $pic_object" 13664456fccdSmrg arg="$pic_object" 13674456fccdSmrg fi 13684456fccdSmrg 13694456fccdSmrg # Non-PIC object. 13704456fccdSmrg if test "$non_pic_object" != none; then 13714456fccdSmrg # Prepend the subdirectory the object is found in. 13724456fccdSmrg non_pic_object="$xdir$non_pic_object" 13734456fccdSmrg 13744456fccdSmrg # A standard non-PIC object 13754456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 13764456fccdSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 13774456fccdSmrg arg="$non_pic_object" 13784456fccdSmrg fi 13794456fccdSmrg else 13804456fccdSmrg # If the PIC object exists, use it instead. 13814456fccdSmrg # $xdir was prepended to $pic_object above. 13824456fccdSmrg non_pic_object="$pic_object" 13834456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 13844456fccdSmrg fi 13854456fccdSmrg else 13864456fccdSmrg # Only an error if not doing a dry-run. 13874456fccdSmrg if test -z "$run"; then 13884456fccdSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 13894456fccdSmrg exit $EXIT_FAILURE 13904456fccdSmrg else 13914456fccdSmrg # Dry-run case. 13924456fccdSmrg 13934456fccdSmrg # Extract subdirectory from the argument. 13944456fccdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13954456fccdSmrg if test "X$xdir" = "X$arg"; then 13964456fccdSmrg xdir= 13974456fccdSmrg else 13984456fccdSmrg xdir="$xdir/" 13994456fccdSmrg fi 14004456fccdSmrg 14014456fccdSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 14024456fccdSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 14034456fccdSmrg libobjs="$libobjs $pic_object" 14044456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 14054456fccdSmrg fi 14064456fccdSmrg fi 14074456fccdSmrg done 14084456fccdSmrg else 14094456fccdSmrg $echo "$modename: link input file \`$save_arg' does not exist" 14104456fccdSmrg exit $EXIT_FAILURE 14114456fccdSmrg fi 14124456fccdSmrg arg=$save_arg 14134456fccdSmrg prev= 14144456fccdSmrg continue 14154456fccdSmrg ;; 14164456fccdSmrg rpath | xrpath) 14174456fccdSmrg # We need an absolute path. 14184456fccdSmrg case $arg in 14194456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 14204456fccdSmrg *) 14214456fccdSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 14224456fccdSmrg exit $EXIT_FAILURE 14234456fccdSmrg ;; 14244456fccdSmrg esac 14254456fccdSmrg if test "$prev" = rpath; then 14264456fccdSmrg case "$rpath " in 14274456fccdSmrg *" $arg "*) ;; 14284456fccdSmrg *) rpath="$rpath $arg" ;; 14294456fccdSmrg esac 14304456fccdSmrg else 14314456fccdSmrg case "$xrpath " in 14324456fccdSmrg *" $arg "*) ;; 14334456fccdSmrg *) xrpath="$xrpath $arg" ;; 14344456fccdSmrg esac 14354456fccdSmrg fi 14364456fccdSmrg prev= 14374456fccdSmrg continue 14384456fccdSmrg ;; 14394456fccdSmrg xcompiler) 14404456fccdSmrg compiler_flags="$compiler_flags $qarg" 14414456fccdSmrg prev= 14424456fccdSmrg compile_command="$compile_command $qarg" 14434456fccdSmrg finalize_command="$finalize_command $qarg" 14444456fccdSmrg continue 14454456fccdSmrg ;; 14464456fccdSmrg xlinker) 14474456fccdSmrg linker_flags="$linker_flags $qarg" 14484456fccdSmrg compiler_flags="$compiler_flags $wl$qarg" 14494456fccdSmrg prev= 14504456fccdSmrg compile_command="$compile_command $wl$qarg" 14514456fccdSmrg finalize_command="$finalize_command $wl$qarg" 14524456fccdSmrg continue 14534456fccdSmrg ;; 14544456fccdSmrg xcclinker) 14554456fccdSmrg linker_flags="$linker_flags $qarg" 14564456fccdSmrg compiler_flags="$compiler_flags $qarg" 14574456fccdSmrg prev= 14584456fccdSmrg compile_command="$compile_command $qarg" 14594456fccdSmrg finalize_command="$finalize_command $qarg" 14604456fccdSmrg continue 14614456fccdSmrg ;; 14624456fccdSmrg shrext) 14634456fccdSmrg shrext_cmds="$arg" 14644456fccdSmrg prev= 14654456fccdSmrg continue 14664456fccdSmrg ;; 14674456fccdSmrg darwin_framework|darwin_framework_skip) 14684456fccdSmrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 14694456fccdSmrg compile_command="$compile_command $arg" 14704456fccdSmrg finalize_command="$finalize_command $arg" 14714456fccdSmrg prev= 14724456fccdSmrg continue 14734456fccdSmrg ;; 14744456fccdSmrg *) 14754456fccdSmrg eval "$prev=\"\$arg\"" 14764456fccdSmrg prev= 14774456fccdSmrg continue 14784456fccdSmrg ;; 14794456fccdSmrg esac 14804456fccdSmrg fi # test -n "$prev" 14814456fccdSmrg 14824456fccdSmrg prevarg="$arg" 14834456fccdSmrg 14844456fccdSmrg case $arg in 14854456fccdSmrg -all-static) 14864456fccdSmrg if test -n "$link_static_flag"; then 14874456fccdSmrg compile_command="$compile_command $link_static_flag" 14884456fccdSmrg finalize_command="$finalize_command $link_static_flag" 14894456fccdSmrg fi 14904456fccdSmrg continue 14914456fccdSmrg ;; 14924456fccdSmrg 14934456fccdSmrg -allow-undefined) 14944456fccdSmrg # FIXME: remove this flag sometime in the future. 14954456fccdSmrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 14964456fccdSmrg continue 14974456fccdSmrg ;; 14984456fccdSmrg 14994456fccdSmrg -avoid-version) 15004456fccdSmrg avoid_version=yes 15014456fccdSmrg continue 15024456fccdSmrg ;; 15034456fccdSmrg 15044456fccdSmrg -dlopen) 15054456fccdSmrg prev=dlfiles 15064456fccdSmrg continue 15074456fccdSmrg ;; 15084456fccdSmrg 15094456fccdSmrg -dlpreopen) 15104456fccdSmrg prev=dlprefiles 15114456fccdSmrg continue 15124456fccdSmrg ;; 15134456fccdSmrg 15144456fccdSmrg -export-dynamic) 15154456fccdSmrg export_dynamic=yes 15164456fccdSmrg continue 15174456fccdSmrg ;; 15184456fccdSmrg 15194456fccdSmrg -export-symbols | -export-symbols-regex) 15204456fccdSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 15214456fccdSmrg $echo "$modename: more than one -exported-symbols argument is not allowed" 15224456fccdSmrg exit $EXIT_FAILURE 15234456fccdSmrg fi 15244456fccdSmrg if test "X$arg" = "X-export-symbols"; then 15254456fccdSmrg prev=expsyms 15264456fccdSmrg else 15274456fccdSmrg prev=expsyms_regex 15284456fccdSmrg fi 15294456fccdSmrg continue 15304456fccdSmrg ;; 15314456fccdSmrg 15324456fccdSmrg -framework|-arch|-isysroot) 15334456fccdSmrg case " $CC " in 15344456fccdSmrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 15354456fccdSmrg prev=darwin_framework_skip ;; 15364456fccdSmrg *) compiler_flags="$compiler_flags $arg" 15374456fccdSmrg prev=darwin_framework ;; 15384456fccdSmrg esac 15394456fccdSmrg compile_command="$compile_command $arg" 15404456fccdSmrg finalize_command="$finalize_command $arg" 15414456fccdSmrg continue 15424456fccdSmrg ;; 15434456fccdSmrg 15444456fccdSmrg -inst-prefix-dir) 15454456fccdSmrg prev=inst_prefix 15464456fccdSmrg continue 15474456fccdSmrg ;; 15484456fccdSmrg 15494456fccdSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 15504456fccdSmrg # so, if we see these flags be careful not to treat them like -L 15514456fccdSmrg -L[A-Z][A-Z]*:*) 15524456fccdSmrg case $with_gcc/$host in 15534456fccdSmrg no/*-*-irix* | /*-*-irix*) 15544456fccdSmrg compile_command="$compile_command $arg" 15554456fccdSmrg finalize_command="$finalize_command $arg" 15564456fccdSmrg ;; 15574456fccdSmrg esac 15584456fccdSmrg continue 15594456fccdSmrg ;; 15604456fccdSmrg 15614456fccdSmrg -L*) 15624456fccdSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 15634456fccdSmrg # We need an absolute path. 15644456fccdSmrg case $dir in 15654456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 15664456fccdSmrg *) 15674456fccdSmrg absdir=`cd "$dir" && pwd` 15684456fccdSmrg if test -z "$absdir"; then 15694456fccdSmrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 15704456fccdSmrg absdir="$dir" 15714456fccdSmrg notinst_path="$notinst_path $dir" 15724456fccdSmrg fi 15734456fccdSmrg dir="$absdir" 15744456fccdSmrg ;; 15754456fccdSmrg esac 15764456fccdSmrg case "$deplibs " in 15774456fccdSmrg *" -L$dir "*) ;; 15784456fccdSmrg *) 15794456fccdSmrg deplibs="$deplibs -L$dir" 15804456fccdSmrg lib_search_path="$lib_search_path $dir" 15814456fccdSmrg ;; 15824456fccdSmrg esac 15834456fccdSmrg case $host in 15844456fccdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 15854456fccdSmrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 15864456fccdSmrg case :$dllsearchpath: in 15874456fccdSmrg *":$dir:"*) ;; 15884456fccdSmrg *) dllsearchpath="$dllsearchpath:$dir";; 15894456fccdSmrg esac 15904456fccdSmrg case :$dllsearchpath: in 15914456fccdSmrg *":$testbindir:"*) ;; 15924456fccdSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 15934456fccdSmrg esac 15944456fccdSmrg ;; 15954456fccdSmrg esac 15964456fccdSmrg continue 15974456fccdSmrg ;; 15984456fccdSmrg 15994456fccdSmrg -l*) 16004456fccdSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 16014456fccdSmrg case $host in 16024456fccdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 16034456fccdSmrg # These systems don't actually have a C or math library (as such) 16044456fccdSmrg continue 16054456fccdSmrg ;; 16064456fccdSmrg *-*-os2*) 16074456fccdSmrg # These systems don't actually have a C library (as such) 16084456fccdSmrg test "X$arg" = "X-lc" && continue 16094456fccdSmrg ;; 16104456fccdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16114456fccdSmrg # Do not include libc due to us having libc/libc_r. 16124456fccdSmrg test "X$arg" = "X-lc" && continue 16134456fccdSmrg ;; 16144456fccdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 16154456fccdSmrg # Rhapsody C and math libraries are in the System framework 16164456fccdSmrg deplibs="$deplibs -framework System" 16174456fccdSmrg continue 16184456fccdSmrg ;; 16194456fccdSmrg *-*-sco3.2v5* | *-*-sco5v6*) 16204456fccdSmrg # Causes problems with __ctype 16214456fccdSmrg test "X$arg" = "X-lc" && continue 16224456fccdSmrg ;; 16234456fccdSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 16244456fccdSmrg # Compiler inserts libc in the correct place for threads to work 16254456fccdSmrg test "X$arg" = "X-lc" && continue 16264456fccdSmrg ;; 16274456fccdSmrg esac 16284456fccdSmrg elif test "X$arg" = "X-lc_r"; then 16294456fccdSmrg case $host in 16304456fccdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16314456fccdSmrg # Do not include libc_r directly, use -pthread flag. 16324456fccdSmrg continue 16334456fccdSmrg ;; 16344456fccdSmrg esac 16354456fccdSmrg fi 16364456fccdSmrg deplibs="$deplibs $arg" 16374456fccdSmrg continue 16384456fccdSmrg ;; 16394456fccdSmrg 16404456fccdSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 16414456fccdSmrg # classes, name mangling, and exception handling. 16424456fccdSmrg -model) 16434456fccdSmrg compile_command="$compile_command $arg" 16444456fccdSmrg compiler_flags="$compiler_flags $arg" 16454456fccdSmrg finalize_command="$finalize_command $arg" 16464456fccdSmrg prev=xcompiler 16474456fccdSmrg continue 16484456fccdSmrg ;; 16494456fccdSmrg 165042d69509Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 16514456fccdSmrg compiler_flags="$compiler_flags $arg" 16524456fccdSmrg compile_command="$compile_command $arg" 16534456fccdSmrg finalize_command="$finalize_command $arg" 16544456fccdSmrg continue 16554456fccdSmrg ;; 16564456fccdSmrg 165742d69509Smrg -multi_module) 165842d69509Smrg single_module="${wl}-multi_module" 165942d69509Smrg continue 166042d69509Smrg ;; 166142d69509Smrg 16624456fccdSmrg -module) 16634456fccdSmrg module=yes 16644456fccdSmrg continue 16654456fccdSmrg ;; 16664456fccdSmrg 16674456fccdSmrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 16684456fccdSmrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 16694456fccdSmrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 16704456fccdSmrg # +DA*, +DD* enable 64-bit mode on the HP compiler 16714456fccdSmrg # -q* pass through compiler args for the IBM compiler 16724456fccdSmrg # -m* pass through architecture-specific compiler args for GCC 16734456fccdSmrg # -m*, -t[45]*, -txscale* pass through architecture-specific 16744456fccdSmrg # compiler args for GCC 167542d69509Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 167642d69509Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 16774456fccdSmrg # @file GCC response files 167842d69509Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 167942d69509Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 16804456fccdSmrg 16814456fccdSmrg # Unknown arguments in both finalize_command and compile_command need 16824456fccdSmrg # to be aesthetically quoted because they are evaled later. 16834456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 16844456fccdSmrg case $arg in 16854456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 16864456fccdSmrg arg="\"$arg\"" 16874456fccdSmrg ;; 16884456fccdSmrg esac 16894456fccdSmrg compile_command="$compile_command $arg" 16904456fccdSmrg finalize_command="$finalize_command $arg" 16914456fccdSmrg compiler_flags="$compiler_flags $arg" 16924456fccdSmrg continue 16934456fccdSmrg ;; 16944456fccdSmrg 16954456fccdSmrg -shrext) 16964456fccdSmrg prev=shrext 16974456fccdSmrg continue 16984456fccdSmrg ;; 16994456fccdSmrg 17004456fccdSmrg -no-fast-install) 17014456fccdSmrg fast_install=no 17024456fccdSmrg continue 17034456fccdSmrg ;; 17044456fccdSmrg 17054456fccdSmrg -no-install) 17064456fccdSmrg case $host in 170742d69509Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 17084456fccdSmrg # The PATH hackery in wrapper scripts is required on Windows 170942d69509Smrg # and Darwin in order for the loader to find any dlls it needs. 17104456fccdSmrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 17114456fccdSmrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 17124456fccdSmrg fast_install=no 17134456fccdSmrg ;; 17144456fccdSmrg *) no_install=yes ;; 17154456fccdSmrg esac 17164456fccdSmrg continue 17174456fccdSmrg ;; 17184456fccdSmrg 17194456fccdSmrg -no-undefined) 17204456fccdSmrg allow_undefined=no 17214456fccdSmrg continue 17224456fccdSmrg ;; 17234456fccdSmrg 17244456fccdSmrg -objectlist) 17254456fccdSmrg prev=objectlist 17264456fccdSmrg continue 17274456fccdSmrg ;; 17284456fccdSmrg 17294456fccdSmrg -o) prev=output ;; 17304456fccdSmrg 17314456fccdSmrg -precious-files-regex) 17324456fccdSmrg prev=precious_regex 17334456fccdSmrg continue 17344456fccdSmrg ;; 17354456fccdSmrg 17364456fccdSmrg -release) 17374456fccdSmrg prev=release 17384456fccdSmrg continue 17394456fccdSmrg ;; 17404456fccdSmrg 17414456fccdSmrg -rpath) 17424456fccdSmrg prev=rpath 17434456fccdSmrg continue 17444456fccdSmrg ;; 17454456fccdSmrg 17464456fccdSmrg -R) 17474456fccdSmrg prev=xrpath 17484456fccdSmrg continue 17494456fccdSmrg ;; 17504456fccdSmrg 17514456fccdSmrg -R*) 17524456fccdSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 17534456fccdSmrg # We need an absolute path. 17544456fccdSmrg case $dir in 17554456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 17564456fccdSmrg *) 17574456fccdSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 17584456fccdSmrg exit $EXIT_FAILURE 17594456fccdSmrg ;; 17604456fccdSmrg esac 17614456fccdSmrg case "$xrpath " in 17624456fccdSmrg *" $dir "*) ;; 17634456fccdSmrg *) xrpath="$xrpath $dir" ;; 17644456fccdSmrg esac 17654456fccdSmrg continue 17664456fccdSmrg ;; 17674456fccdSmrg 176842d69509Smrg -static | -static-libtool-libs) 17694456fccdSmrg # The effects of -static are defined in a previous loop. 17704456fccdSmrg # We used to do the same as -all-static on platforms that 17714456fccdSmrg # didn't have a PIC flag, but the assumption that the effects 17724456fccdSmrg # would be equivalent was wrong. It would break on at least 17734456fccdSmrg # Digital Unix and AIX. 17744456fccdSmrg continue 17754456fccdSmrg ;; 17764456fccdSmrg 17774456fccdSmrg -thread-safe) 17784456fccdSmrg thread_safe=yes 17794456fccdSmrg continue 17804456fccdSmrg ;; 17814456fccdSmrg 17824456fccdSmrg -version-info) 17834456fccdSmrg prev=vinfo 17844456fccdSmrg continue 17854456fccdSmrg ;; 17864456fccdSmrg -version-number) 17874456fccdSmrg prev=vinfo 17884456fccdSmrg vinfo_number=yes 17894456fccdSmrg continue 17904456fccdSmrg ;; 17914456fccdSmrg 17924456fccdSmrg -Wc,*) 17934456fccdSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 17944456fccdSmrg arg= 17954456fccdSmrg save_ifs="$IFS"; IFS=',' 17964456fccdSmrg for flag in $args; do 17974456fccdSmrg IFS="$save_ifs" 17984456fccdSmrg case $flag in 17994456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18004456fccdSmrg flag="\"$flag\"" 18014456fccdSmrg ;; 18024456fccdSmrg esac 18034456fccdSmrg arg="$arg $wl$flag" 18044456fccdSmrg compiler_flags="$compiler_flags $flag" 18054456fccdSmrg done 18064456fccdSmrg IFS="$save_ifs" 18074456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18084456fccdSmrg ;; 18094456fccdSmrg 18104456fccdSmrg -Wl,*) 18114456fccdSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 18124456fccdSmrg arg= 18134456fccdSmrg save_ifs="$IFS"; IFS=',' 18144456fccdSmrg for flag in $args; do 18154456fccdSmrg IFS="$save_ifs" 18164456fccdSmrg case $flag in 18174456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18184456fccdSmrg flag="\"$flag\"" 18194456fccdSmrg ;; 18204456fccdSmrg esac 18214456fccdSmrg arg="$arg $wl$flag" 18224456fccdSmrg compiler_flags="$compiler_flags $wl$flag" 18234456fccdSmrg linker_flags="$linker_flags $flag" 18244456fccdSmrg done 18254456fccdSmrg IFS="$save_ifs" 18264456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18274456fccdSmrg ;; 18284456fccdSmrg 18294456fccdSmrg -Xcompiler) 18304456fccdSmrg prev=xcompiler 18314456fccdSmrg continue 18324456fccdSmrg ;; 18334456fccdSmrg 18344456fccdSmrg -Xlinker) 18354456fccdSmrg prev=xlinker 18364456fccdSmrg continue 18374456fccdSmrg ;; 18384456fccdSmrg 18394456fccdSmrg -XCClinker) 18404456fccdSmrg prev=xcclinker 18414456fccdSmrg continue 18424456fccdSmrg ;; 18434456fccdSmrg 18444456fccdSmrg # Some other compiler flag. 18454456fccdSmrg -* | +*) 18464456fccdSmrg # Unknown arguments in both finalize_command and compile_command need 18474456fccdSmrg # to be aesthetically quoted because they are evaled later. 18484456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 18494456fccdSmrg case $arg in 18504456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18514456fccdSmrg arg="\"$arg\"" 18524456fccdSmrg ;; 18534456fccdSmrg esac 18544456fccdSmrg ;; 18554456fccdSmrg 18564456fccdSmrg *.$objext) 18574456fccdSmrg # A standard object. 18584456fccdSmrg objs="$objs $arg" 18594456fccdSmrg ;; 18604456fccdSmrg 18614456fccdSmrg *.lo) 18624456fccdSmrg # A libtool-controlled object. 18634456fccdSmrg 18644456fccdSmrg # Check to see that this really is a libtool object. 18654456fccdSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 18664456fccdSmrg pic_object= 18674456fccdSmrg non_pic_object= 18684456fccdSmrg 18694456fccdSmrg # Read the .lo file 18704456fccdSmrg # If there is no directory component, then add one. 18714456fccdSmrg case $arg in 18724456fccdSmrg */* | *\\*) . $arg ;; 18734456fccdSmrg *) . ./$arg ;; 18744456fccdSmrg esac 18754456fccdSmrg 18764456fccdSmrg if test -z "$pic_object" || \ 18774456fccdSmrg test -z "$non_pic_object" || 18784456fccdSmrg test "$pic_object" = none && \ 18794456fccdSmrg test "$non_pic_object" = none; then 18804456fccdSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 18814456fccdSmrg exit $EXIT_FAILURE 18824456fccdSmrg fi 18834456fccdSmrg 18844456fccdSmrg # Extract subdirectory from the argument. 18854456fccdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18864456fccdSmrg if test "X$xdir" = "X$arg"; then 18874456fccdSmrg xdir= 18884456fccdSmrg else 18894456fccdSmrg xdir="$xdir/" 18904456fccdSmrg fi 18914456fccdSmrg 18924456fccdSmrg if test "$pic_object" != none; then 18934456fccdSmrg # Prepend the subdirectory the object is found in. 18944456fccdSmrg pic_object="$xdir$pic_object" 18954456fccdSmrg 18964456fccdSmrg if test "$prev" = dlfiles; then 18974456fccdSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 18984456fccdSmrg dlfiles="$dlfiles $pic_object" 18994456fccdSmrg prev= 19004456fccdSmrg continue 19014456fccdSmrg else 19024456fccdSmrg # If libtool objects are unsupported, then we need to preload. 19034456fccdSmrg prev=dlprefiles 19044456fccdSmrg fi 19054456fccdSmrg fi 19064456fccdSmrg 19074456fccdSmrg # CHECK ME: I think I busted this. -Ossama 19084456fccdSmrg if test "$prev" = dlprefiles; then 19094456fccdSmrg # Preload the old-style object. 19104456fccdSmrg dlprefiles="$dlprefiles $pic_object" 19114456fccdSmrg prev= 19124456fccdSmrg fi 19134456fccdSmrg 19144456fccdSmrg # A PIC object. 19154456fccdSmrg libobjs="$libobjs $pic_object" 19164456fccdSmrg arg="$pic_object" 19174456fccdSmrg fi 19184456fccdSmrg 19194456fccdSmrg # Non-PIC object. 19204456fccdSmrg if test "$non_pic_object" != none; then 19214456fccdSmrg # Prepend the subdirectory the object is found in. 19224456fccdSmrg non_pic_object="$xdir$non_pic_object" 19234456fccdSmrg 19244456fccdSmrg # A standard non-PIC object 19254456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19264456fccdSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 19274456fccdSmrg arg="$non_pic_object" 19284456fccdSmrg fi 19294456fccdSmrg else 19304456fccdSmrg # If the PIC object exists, use it instead. 19314456fccdSmrg # $xdir was prepended to $pic_object above. 19324456fccdSmrg non_pic_object="$pic_object" 19334456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19344456fccdSmrg fi 19354456fccdSmrg else 19364456fccdSmrg # Only an error if not doing a dry-run. 19374456fccdSmrg if test -z "$run"; then 19384456fccdSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 19394456fccdSmrg exit $EXIT_FAILURE 19404456fccdSmrg else 19414456fccdSmrg # Dry-run case. 19424456fccdSmrg 19434456fccdSmrg # Extract subdirectory from the argument. 19444456fccdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 19454456fccdSmrg if test "X$xdir" = "X$arg"; then 19464456fccdSmrg xdir= 19474456fccdSmrg else 19484456fccdSmrg xdir="$xdir/" 19494456fccdSmrg fi 19504456fccdSmrg 19514456fccdSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 19524456fccdSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 19534456fccdSmrg libobjs="$libobjs $pic_object" 19544456fccdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19554456fccdSmrg fi 19564456fccdSmrg fi 19574456fccdSmrg ;; 19584456fccdSmrg 19594456fccdSmrg *.$libext) 19604456fccdSmrg # An archive. 19614456fccdSmrg deplibs="$deplibs $arg" 19624456fccdSmrg old_deplibs="$old_deplibs $arg" 19634456fccdSmrg continue 19644456fccdSmrg ;; 19654456fccdSmrg 19664456fccdSmrg *.la) 19674456fccdSmrg # A libtool-controlled library. 19684456fccdSmrg 19694456fccdSmrg if test "$prev" = dlfiles; then 19704456fccdSmrg # This library was specified with -dlopen. 19714456fccdSmrg dlfiles="$dlfiles $arg" 19724456fccdSmrg prev= 19734456fccdSmrg elif test "$prev" = dlprefiles; then 19744456fccdSmrg # The library was specified with -dlpreopen. 19754456fccdSmrg dlprefiles="$dlprefiles $arg" 19764456fccdSmrg prev= 19774456fccdSmrg else 19784456fccdSmrg deplibs="$deplibs $arg" 19794456fccdSmrg fi 19804456fccdSmrg continue 19814456fccdSmrg ;; 19824456fccdSmrg 19834456fccdSmrg # Some other compiler argument. 19844456fccdSmrg *) 19854456fccdSmrg # Unknown arguments in both finalize_command and compile_command need 19864456fccdSmrg # to be aesthetically quoted because they are evaled later. 19874456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 19884456fccdSmrg case $arg in 19894456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19904456fccdSmrg arg="\"$arg\"" 19914456fccdSmrg ;; 19924456fccdSmrg esac 19934456fccdSmrg ;; 19944456fccdSmrg esac # arg 19954456fccdSmrg 19964456fccdSmrg # Now actually substitute the argument into the commands. 19974456fccdSmrg if test -n "$arg"; then 19984456fccdSmrg compile_command="$compile_command $arg" 19994456fccdSmrg finalize_command="$finalize_command $arg" 20004456fccdSmrg fi 20014456fccdSmrg done # argument parsing loop 20024456fccdSmrg 20034456fccdSmrg if test -n "$prev"; then 20044456fccdSmrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 20054456fccdSmrg $echo "$help" 1>&2 20064456fccdSmrg exit $EXIT_FAILURE 20074456fccdSmrg fi 20084456fccdSmrg 20094456fccdSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 20104456fccdSmrg eval arg=\"$export_dynamic_flag_spec\" 20114456fccdSmrg compile_command="$compile_command $arg" 20124456fccdSmrg finalize_command="$finalize_command $arg" 20134456fccdSmrg fi 20144456fccdSmrg 20154456fccdSmrg oldlibs= 20164456fccdSmrg # calculate the name of the file, without its directory 20174456fccdSmrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 20184456fccdSmrg libobjs_save="$libobjs" 20194456fccdSmrg 20204456fccdSmrg if test -n "$shlibpath_var"; then 20214456fccdSmrg # get the directories listed in $shlibpath_var 20224456fccdSmrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 20234456fccdSmrg else 20244456fccdSmrg shlib_search_path= 20254456fccdSmrg fi 20264456fccdSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 20274456fccdSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 20284456fccdSmrg 20294456fccdSmrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 20304456fccdSmrg if test "X$output_objdir" = "X$output"; then 20314456fccdSmrg output_objdir="$objdir" 20324456fccdSmrg else 20334456fccdSmrg output_objdir="$output_objdir/$objdir" 20344456fccdSmrg fi 20354456fccdSmrg # Create the object directory. 20364456fccdSmrg if test ! -d "$output_objdir"; then 20374456fccdSmrg $show "$mkdir $output_objdir" 20384456fccdSmrg $run $mkdir $output_objdir 20394456fccdSmrg exit_status=$? 20404456fccdSmrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 20414456fccdSmrg exit $exit_status 20424456fccdSmrg fi 20434456fccdSmrg fi 20444456fccdSmrg 20454456fccdSmrg # Determine the type of output 20464456fccdSmrg case $output in 20474456fccdSmrg "") 20484456fccdSmrg $echo "$modename: you must specify an output file" 1>&2 20494456fccdSmrg $echo "$help" 1>&2 20504456fccdSmrg exit $EXIT_FAILURE 20514456fccdSmrg ;; 20524456fccdSmrg *.$libext) linkmode=oldlib ;; 20534456fccdSmrg *.lo | *.$objext) linkmode=obj ;; 20544456fccdSmrg *.la) linkmode=lib ;; 20554456fccdSmrg *) linkmode=prog ;; # Anything else should be a program. 20564456fccdSmrg esac 20574456fccdSmrg 20584456fccdSmrg case $host in 20594456fccdSmrg *cygwin* | *mingw* | *pw32*) 20604456fccdSmrg # don't eliminate duplications in $postdeps and $predeps 20614456fccdSmrg duplicate_compiler_generated_deps=yes 20624456fccdSmrg ;; 20634456fccdSmrg *) 20644456fccdSmrg duplicate_compiler_generated_deps=$duplicate_deps 20654456fccdSmrg ;; 20664456fccdSmrg esac 20674456fccdSmrg specialdeplibs= 20684456fccdSmrg 20694456fccdSmrg libs= 20704456fccdSmrg # Find all interdependent deplibs by searching for libraries 20714456fccdSmrg # that are linked more than once (e.g. -la -lb -la) 20724456fccdSmrg for deplib in $deplibs; do 20734456fccdSmrg if test "X$duplicate_deps" = "Xyes" ; then 20744456fccdSmrg case "$libs " in 20754456fccdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 20764456fccdSmrg esac 20774456fccdSmrg fi 20784456fccdSmrg libs="$libs $deplib" 20794456fccdSmrg done 20804456fccdSmrg 20814456fccdSmrg if test "$linkmode" = lib; then 20824456fccdSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 20834456fccdSmrg 20844456fccdSmrg # Compute libraries that are listed more than once in $predeps 20854456fccdSmrg # $postdeps and mark them as special (i.e., whose duplicates are 20864456fccdSmrg # not to be eliminated). 20874456fccdSmrg pre_post_deps= 20884456fccdSmrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 20894456fccdSmrg for pre_post_dep in $predeps $postdeps; do 20904456fccdSmrg case "$pre_post_deps " in 20914456fccdSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 20924456fccdSmrg esac 20934456fccdSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 20944456fccdSmrg done 20954456fccdSmrg fi 20964456fccdSmrg pre_post_deps= 20974456fccdSmrg fi 20984456fccdSmrg 20994456fccdSmrg deplibs= 21004456fccdSmrg newdependency_libs= 21014456fccdSmrg newlib_search_path= 21024456fccdSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 21034456fccdSmrg notinst_deplibs= # not-installed libtool libraries 21044456fccdSmrg case $linkmode in 21054456fccdSmrg lib) 21064456fccdSmrg passes="conv link" 21074456fccdSmrg for file in $dlfiles $dlprefiles; do 21084456fccdSmrg case $file in 21094456fccdSmrg *.la) ;; 21104456fccdSmrg *) 21114456fccdSmrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 21124456fccdSmrg exit $EXIT_FAILURE 21134456fccdSmrg ;; 21144456fccdSmrg esac 21154456fccdSmrg done 21164456fccdSmrg ;; 21174456fccdSmrg prog) 21184456fccdSmrg compile_deplibs= 21194456fccdSmrg finalize_deplibs= 21204456fccdSmrg alldeplibs=no 21214456fccdSmrg newdlfiles= 21224456fccdSmrg newdlprefiles= 21234456fccdSmrg passes="conv scan dlopen dlpreopen link" 21244456fccdSmrg ;; 21254456fccdSmrg *) passes="conv" 21264456fccdSmrg ;; 21274456fccdSmrg esac 21284456fccdSmrg for pass in $passes; do 21294456fccdSmrg if test "$linkmode,$pass" = "lib,link" || 21304456fccdSmrg test "$linkmode,$pass" = "prog,scan"; then 21314456fccdSmrg libs="$deplibs" 21324456fccdSmrg deplibs= 21334456fccdSmrg fi 21344456fccdSmrg if test "$linkmode" = prog; then 21354456fccdSmrg case $pass in 21364456fccdSmrg dlopen) libs="$dlfiles" ;; 21374456fccdSmrg dlpreopen) libs="$dlprefiles" ;; 213842d69509Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 21394456fccdSmrg esac 21404456fccdSmrg fi 21414456fccdSmrg if test "$pass" = dlopen; then 21424456fccdSmrg # Collect dlpreopened libraries 21434456fccdSmrg save_deplibs="$deplibs" 21444456fccdSmrg deplibs= 21454456fccdSmrg fi 21464456fccdSmrg for deplib in $libs; do 21474456fccdSmrg lib= 21484456fccdSmrg found=no 21494456fccdSmrg case $deplib in 215042d69509Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 21514456fccdSmrg if test "$linkmode,$pass" = "prog,link"; then 21524456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 21534456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 21544456fccdSmrg else 21554456fccdSmrg compiler_flags="$compiler_flags $deplib" 21564456fccdSmrg fi 21574456fccdSmrg continue 21584456fccdSmrg ;; 21594456fccdSmrg -l*) 21604456fccdSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 21614456fccdSmrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 21624456fccdSmrg continue 21634456fccdSmrg fi 21644456fccdSmrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 216542d69509Smrg if test "$linkmode" = lib; then 216642d69509Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 216742d69509Smrg else 216842d69509Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 216942d69509Smrg fi 217042d69509Smrg for searchdir in $searchdirs; do 21714456fccdSmrg for search_ext in .la $std_shrext .so .a; do 21724456fccdSmrg # Search the libtool library 21734456fccdSmrg lib="$searchdir/lib${name}${search_ext}" 21744456fccdSmrg if test -f "$lib"; then 21754456fccdSmrg if test "$search_ext" = ".la"; then 21764456fccdSmrg found=yes 21774456fccdSmrg else 21784456fccdSmrg found=no 21794456fccdSmrg fi 21804456fccdSmrg break 2 21814456fccdSmrg fi 21824456fccdSmrg done 21834456fccdSmrg done 21844456fccdSmrg if test "$found" != yes; then 21854456fccdSmrg # deplib doesn't seem to be a libtool library 21864456fccdSmrg if test "$linkmode,$pass" = "prog,link"; then 21874456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 21884456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 21894456fccdSmrg else 21904456fccdSmrg deplibs="$deplib $deplibs" 21914456fccdSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21924456fccdSmrg fi 21934456fccdSmrg continue 21944456fccdSmrg else # deplib is a libtool library 21954456fccdSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 21964456fccdSmrg # We need to do some special things here, and not later. 21974456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 21984456fccdSmrg case " $predeps $postdeps " in 21994456fccdSmrg *" $deplib "*) 22004456fccdSmrg if (${SED} -e '2q' $lib | 22014456fccdSmrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 22024456fccdSmrg library_names= 22034456fccdSmrg old_library= 22044456fccdSmrg case $lib in 22054456fccdSmrg */* | *\\*) . $lib ;; 22064456fccdSmrg *) . ./$lib ;; 22074456fccdSmrg esac 22084456fccdSmrg for l in $old_library $library_names; do 22094456fccdSmrg ll="$l" 22104456fccdSmrg done 22114456fccdSmrg if test "X$ll" = "X$old_library" ; then # only static version available 22124456fccdSmrg found=no 22134456fccdSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 22144456fccdSmrg test "X$ladir" = "X$lib" && ladir="." 22154456fccdSmrg lib=$ladir/$old_library 22164456fccdSmrg if test "$linkmode,$pass" = "prog,link"; then 22174456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 22184456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 22194456fccdSmrg else 22204456fccdSmrg deplibs="$deplib $deplibs" 22214456fccdSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 22224456fccdSmrg fi 22234456fccdSmrg continue 22244456fccdSmrg fi 22254456fccdSmrg fi 22264456fccdSmrg ;; 22274456fccdSmrg *) ;; 22284456fccdSmrg esac 22294456fccdSmrg fi 22304456fccdSmrg fi 22314456fccdSmrg ;; # -l 22324456fccdSmrg -L*) 22334456fccdSmrg case $linkmode in 22344456fccdSmrg lib) 22354456fccdSmrg deplibs="$deplib $deplibs" 22364456fccdSmrg test "$pass" = conv && continue 22374456fccdSmrg newdependency_libs="$deplib $newdependency_libs" 22384456fccdSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22394456fccdSmrg ;; 22404456fccdSmrg prog) 22414456fccdSmrg if test "$pass" = conv; then 22424456fccdSmrg deplibs="$deplib $deplibs" 22434456fccdSmrg continue 22444456fccdSmrg fi 22454456fccdSmrg if test "$pass" = scan; then 22464456fccdSmrg deplibs="$deplib $deplibs" 22474456fccdSmrg else 22484456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 22494456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 22504456fccdSmrg fi 22514456fccdSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22524456fccdSmrg ;; 22534456fccdSmrg *) 22544456fccdSmrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 22554456fccdSmrg ;; 22564456fccdSmrg esac # linkmode 22574456fccdSmrg continue 22584456fccdSmrg ;; # -L 22594456fccdSmrg -R*) 22604456fccdSmrg if test "$pass" = link; then 22614456fccdSmrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 22624456fccdSmrg # Make sure the xrpath contains only unique directories. 22634456fccdSmrg case "$xrpath " in 22644456fccdSmrg *" $dir "*) ;; 22654456fccdSmrg *) xrpath="$xrpath $dir" ;; 22664456fccdSmrg esac 22674456fccdSmrg fi 22684456fccdSmrg deplibs="$deplib $deplibs" 22694456fccdSmrg continue 22704456fccdSmrg ;; 22714456fccdSmrg *.la) lib="$deplib" ;; 22724456fccdSmrg *.$libext) 22734456fccdSmrg if test "$pass" = conv; then 22744456fccdSmrg deplibs="$deplib $deplibs" 22754456fccdSmrg continue 22764456fccdSmrg fi 22774456fccdSmrg case $linkmode in 22784456fccdSmrg lib) 22794456fccdSmrg valid_a_lib=no 22804456fccdSmrg case $deplibs_check_method in 22814456fccdSmrg match_pattern*) 22824456fccdSmrg set dummy $deplibs_check_method 22834456fccdSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 22844456fccdSmrg if eval $echo \"$deplib\" 2>/dev/null \ 22854456fccdSmrg | $SED 10q \ 22864456fccdSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 22874456fccdSmrg valid_a_lib=yes 22884456fccdSmrg fi 22894456fccdSmrg ;; 22904456fccdSmrg pass_all) 22914456fccdSmrg valid_a_lib=yes 22924456fccdSmrg ;; 22934456fccdSmrg esac 22944456fccdSmrg if test "$valid_a_lib" != yes; then 22954456fccdSmrg $echo 22964456fccdSmrg $echo "*** Warning: Trying to link with static lib archive $deplib." 22974456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 22984456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 22994456fccdSmrg $echo "*** shared version of the library, which you do not appear to have" 23004456fccdSmrg $echo "*** because the file extensions .$libext of this argument makes me believe" 23014456fccdSmrg $echo "*** that it is just a static archive that I should not used here." 23024456fccdSmrg else 23034456fccdSmrg $echo 23044456fccdSmrg $echo "*** Warning: Linking the shared library $output against the" 23054456fccdSmrg $echo "*** static library $deplib is not portable!" 23064456fccdSmrg deplibs="$deplib $deplibs" 23074456fccdSmrg fi 23084456fccdSmrg continue 23094456fccdSmrg ;; 23104456fccdSmrg prog) 23114456fccdSmrg if test "$pass" != link; then 23124456fccdSmrg deplibs="$deplib $deplibs" 23134456fccdSmrg else 23144456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 23154456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 23164456fccdSmrg fi 23174456fccdSmrg continue 23184456fccdSmrg ;; 23194456fccdSmrg esac # linkmode 23204456fccdSmrg ;; # *.$libext 23214456fccdSmrg *.lo | *.$objext) 23224456fccdSmrg if test "$pass" = conv; then 23234456fccdSmrg deplibs="$deplib $deplibs" 23244456fccdSmrg elif test "$linkmode" = prog; then 23254456fccdSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 23264456fccdSmrg # If there is no dlopen support or we're linking statically, 23274456fccdSmrg # we need to preload. 23284456fccdSmrg newdlprefiles="$newdlprefiles $deplib" 23294456fccdSmrg compile_deplibs="$deplib $compile_deplibs" 23304456fccdSmrg finalize_deplibs="$deplib $finalize_deplibs" 23314456fccdSmrg else 23324456fccdSmrg newdlfiles="$newdlfiles $deplib" 23334456fccdSmrg fi 23344456fccdSmrg fi 23354456fccdSmrg continue 23364456fccdSmrg ;; 23374456fccdSmrg %DEPLIBS%) 23384456fccdSmrg alldeplibs=yes 23394456fccdSmrg continue 23404456fccdSmrg ;; 23414456fccdSmrg esac # case $deplib 23424456fccdSmrg if test "$found" = yes || test -f "$lib"; then : 23434456fccdSmrg else 23444456fccdSmrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 23454456fccdSmrg exit $EXIT_FAILURE 23464456fccdSmrg fi 23474456fccdSmrg 23484456fccdSmrg # Check to see that this really is a libtool archive. 23494456fccdSmrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 23504456fccdSmrg else 23514456fccdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 23524456fccdSmrg exit $EXIT_FAILURE 23534456fccdSmrg fi 23544456fccdSmrg 23554456fccdSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 23564456fccdSmrg test "X$ladir" = "X$lib" && ladir="." 23574456fccdSmrg 23584456fccdSmrg dlname= 23594456fccdSmrg dlopen= 23604456fccdSmrg dlpreopen= 23614456fccdSmrg libdir= 23624456fccdSmrg library_names= 23634456fccdSmrg old_library= 23644456fccdSmrg # If the library was installed with an old release of libtool, 23654456fccdSmrg # it will not redefine variables installed, or shouldnotlink 23664456fccdSmrg installed=yes 23674456fccdSmrg shouldnotlink=no 23684456fccdSmrg avoidtemprpath= 23694456fccdSmrg 23704456fccdSmrg 23714456fccdSmrg # Read the .la file 23724456fccdSmrg case $lib in 23734456fccdSmrg */* | *\\*) . $lib ;; 23744456fccdSmrg *) . ./$lib ;; 23754456fccdSmrg esac 23764456fccdSmrg 23774456fccdSmrg if test "$linkmode,$pass" = "lib,link" || 23784456fccdSmrg test "$linkmode,$pass" = "prog,scan" || 23794456fccdSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 23804456fccdSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 23814456fccdSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 23824456fccdSmrg fi 23834456fccdSmrg 23844456fccdSmrg if test "$pass" = conv; then 23854456fccdSmrg # Only check for convenience libraries 23864456fccdSmrg deplibs="$lib $deplibs" 23874456fccdSmrg if test -z "$libdir"; then 23884456fccdSmrg if test -z "$old_library"; then 23894456fccdSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23904456fccdSmrg exit $EXIT_FAILURE 23914456fccdSmrg fi 23924456fccdSmrg # It is a libtool convenience library, so add in its objects. 23934456fccdSmrg convenience="$convenience $ladir/$objdir/$old_library" 23944456fccdSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 23954456fccdSmrg tmp_libs= 23964456fccdSmrg for deplib in $dependency_libs; do 23974456fccdSmrg deplibs="$deplib $deplibs" 23984456fccdSmrg if test "X$duplicate_deps" = "Xyes" ; then 23994456fccdSmrg case "$tmp_libs " in 24004456fccdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 24014456fccdSmrg esac 24024456fccdSmrg fi 24034456fccdSmrg tmp_libs="$tmp_libs $deplib" 24044456fccdSmrg done 24054456fccdSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 24064456fccdSmrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 24074456fccdSmrg exit $EXIT_FAILURE 24084456fccdSmrg fi 24094456fccdSmrg continue 24104456fccdSmrg fi # $pass = conv 24114456fccdSmrg 24124456fccdSmrg 24134456fccdSmrg # Get the name of the library we link against. 24144456fccdSmrg linklib= 24154456fccdSmrg for l in $old_library $library_names; do 24164456fccdSmrg linklib="$l" 24174456fccdSmrg done 24184456fccdSmrg if test -z "$linklib"; then 24194456fccdSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 24204456fccdSmrg exit $EXIT_FAILURE 24214456fccdSmrg fi 24224456fccdSmrg 24234456fccdSmrg # This library was specified with -dlopen. 24244456fccdSmrg if test "$pass" = dlopen; then 24254456fccdSmrg if test -z "$libdir"; then 24264456fccdSmrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 24274456fccdSmrg exit $EXIT_FAILURE 24284456fccdSmrg fi 24294456fccdSmrg if test -z "$dlname" || 24304456fccdSmrg test "$dlopen_support" != yes || 24314456fccdSmrg test "$build_libtool_libs" = no; then 24324456fccdSmrg # If there is no dlname, no dlopen support or we're linking 24334456fccdSmrg # statically, we need to preload. We also need to preload any 24344456fccdSmrg # dependent libraries so libltdl's deplib preloader doesn't 24354456fccdSmrg # bomb out in the load deplibs phase. 24364456fccdSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 24374456fccdSmrg else 24384456fccdSmrg newdlfiles="$newdlfiles $lib" 24394456fccdSmrg fi 24404456fccdSmrg continue 24414456fccdSmrg fi # $pass = dlopen 24424456fccdSmrg 24434456fccdSmrg # We need an absolute path. 24444456fccdSmrg case $ladir in 24454456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 24464456fccdSmrg *) 24474456fccdSmrg abs_ladir=`cd "$ladir" && pwd` 24484456fccdSmrg if test -z "$abs_ladir"; then 24494456fccdSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 24504456fccdSmrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 24514456fccdSmrg abs_ladir="$ladir" 24524456fccdSmrg fi 24534456fccdSmrg ;; 24544456fccdSmrg esac 24554456fccdSmrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 24564456fccdSmrg 24574456fccdSmrg # Find the relevant object directory and library name. 24584456fccdSmrg if test "X$installed" = Xyes; then 24594456fccdSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24604456fccdSmrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 24614456fccdSmrg dir="$ladir" 24624456fccdSmrg absdir="$abs_ladir" 24634456fccdSmrg libdir="$abs_ladir" 24644456fccdSmrg else 24654456fccdSmrg dir="$libdir" 24664456fccdSmrg absdir="$libdir" 24674456fccdSmrg fi 24684456fccdSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 24694456fccdSmrg else 24704456fccdSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24714456fccdSmrg dir="$ladir" 24724456fccdSmrg absdir="$abs_ladir" 24734456fccdSmrg # Remove this search path later 24744456fccdSmrg notinst_path="$notinst_path $abs_ladir" 24754456fccdSmrg else 24764456fccdSmrg dir="$ladir/$objdir" 24774456fccdSmrg absdir="$abs_ladir/$objdir" 24784456fccdSmrg # Remove this search path later 24794456fccdSmrg notinst_path="$notinst_path $abs_ladir" 24804456fccdSmrg fi 24814456fccdSmrg fi # $installed = yes 24824456fccdSmrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 24834456fccdSmrg 24844456fccdSmrg # This library was specified with -dlpreopen. 24854456fccdSmrg if test "$pass" = dlpreopen; then 24864456fccdSmrg if test -z "$libdir"; then 24874456fccdSmrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 24884456fccdSmrg exit $EXIT_FAILURE 24894456fccdSmrg fi 24904456fccdSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 24914456fccdSmrg # are required to link). 24924456fccdSmrg if test -n "$old_library"; then 24934456fccdSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 24944456fccdSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 24954456fccdSmrg elif test -n "$dlname"; then 24964456fccdSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 24974456fccdSmrg else 24984456fccdSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 24994456fccdSmrg fi 25004456fccdSmrg fi # $pass = dlpreopen 25014456fccdSmrg 25024456fccdSmrg if test -z "$libdir"; then 25034456fccdSmrg # Link the convenience library 25044456fccdSmrg if test "$linkmode" = lib; then 25054456fccdSmrg deplibs="$dir/$old_library $deplibs" 25064456fccdSmrg elif test "$linkmode,$pass" = "prog,link"; then 25074456fccdSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 25084456fccdSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 25094456fccdSmrg else 25104456fccdSmrg deplibs="$lib $deplibs" # used for prog,scan pass 25114456fccdSmrg fi 25124456fccdSmrg continue 25134456fccdSmrg fi 25144456fccdSmrg 25154456fccdSmrg 25164456fccdSmrg if test "$linkmode" = prog && test "$pass" != link; then 25174456fccdSmrg newlib_search_path="$newlib_search_path $ladir" 25184456fccdSmrg deplibs="$lib $deplibs" 25194456fccdSmrg 25204456fccdSmrg linkalldeplibs=no 25214456fccdSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 25224456fccdSmrg test "$build_libtool_libs" = no; then 25234456fccdSmrg linkalldeplibs=yes 25244456fccdSmrg fi 25254456fccdSmrg 25264456fccdSmrg tmp_libs= 25274456fccdSmrg for deplib in $dependency_libs; do 25284456fccdSmrg case $deplib in 25294456fccdSmrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 25304456fccdSmrg esac 25314456fccdSmrg # Need to link against all dependency_libs? 25324456fccdSmrg if test "$linkalldeplibs" = yes; then 25334456fccdSmrg deplibs="$deplib $deplibs" 25344456fccdSmrg else 25354456fccdSmrg # Need to hardcode shared library paths 25364456fccdSmrg # or/and link against static libraries 25374456fccdSmrg newdependency_libs="$deplib $newdependency_libs" 25384456fccdSmrg fi 25394456fccdSmrg if test "X$duplicate_deps" = "Xyes" ; then 25404456fccdSmrg case "$tmp_libs " in 25414456fccdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 25424456fccdSmrg esac 25434456fccdSmrg fi 25444456fccdSmrg tmp_libs="$tmp_libs $deplib" 25454456fccdSmrg done # for deplib 25464456fccdSmrg continue 25474456fccdSmrg fi # $linkmode = prog... 25484456fccdSmrg 25494456fccdSmrg if test "$linkmode,$pass" = "prog,link"; then 25504456fccdSmrg if test -n "$library_names" && 255142d69509Smrg { { test "$prefer_static_libs" = no || 255242d69509Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 255342d69509Smrg test -z "$old_library"; }; then 25544456fccdSmrg # We need to hardcode the library path 25554456fccdSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 25564456fccdSmrg # Make sure the rpath contains only unique directories. 25574456fccdSmrg case "$temp_rpath " in 25584456fccdSmrg *" $dir "*) ;; 25594456fccdSmrg *" $absdir "*) ;; 25604456fccdSmrg *) temp_rpath="$temp_rpath $absdir" ;; 25614456fccdSmrg esac 25624456fccdSmrg fi 25634456fccdSmrg 25644456fccdSmrg # Hardcode the library path. 25654456fccdSmrg # Skip directories that are in the system default run-time 25664456fccdSmrg # search path. 25674456fccdSmrg case " $sys_lib_dlsearch_path " in 25684456fccdSmrg *" $absdir "*) ;; 25694456fccdSmrg *) 25704456fccdSmrg case "$compile_rpath " in 25714456fccdSmrg *" $absdir "*) ;; 25724456fccdSmrg *) compile_rpath="$compile_rpath $absdir" 25734456fccdSmrg esac 25744456fccdSmrg ;; 25754456fccdSmrg esac 25764456fccdSmrg case " $sys_lib_dlsearch_path " in 25774456fccdSmrg *" $libdir "*) ;; 25784456fccdSmrg *) 25794456fccdSmrg case "$finalize_rpath " in 25804456fccdSmrg *" $libdir "*) ;; 25814456fccdSmrg *) finalize_rpath="$finalize_rpath $libdir" 25824456fccdSmrg esac 25834456fccdSmrg ;; 25844456fccdSmrg esac 25854456fccdSmrg fi # $linkmode,$pass = prog,link... 25864456fccdSmrg 25874456fccdSmrg if test "$alldeplibs" = yes && 25884456fccdSmrg { test "$deplibs_check_method" = pass_all || 25894456fccdSmrg { test "$build_libtool_libs" = yes && 25904456fccdSmrg test -n "$library_names"; }; }; then 25914456fccdSmrg # We only need to search for static libraries 25924456fccdSmrg continue 25934456fccdSmrg fi 25944456fccdSmrg fi 25954456fccdSmrg 25964456fccdSmrg link_static=no # Whether the deplib will be linked statically 25974456fccdSmrg use_static_libs=$prefer_static_libs 25984456fccdSmrg if test "$use_static_libs" = built && test "$installed" = yes ; then 25994456fccdSmrg use_static_libs=no 26004456fccdSmrg fi 26014456fccdSmrg if test -n "$library_names" && 26024456fccdSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 26034456fccdSmrg if test "$installed" = no; then 26044456fccdSmrg notinst_deplibs="$notinst_deplibs $lib" 26054456fccdSmrg need_relink=yes 26064456fccdSmrg fi 26074456fccdSmrg # This is a shared library 26084456fccdSmrg 26094456fccdSmrg # Warn about portability, can't link against -module's on 26104456fccdSmrg # some systems (darwin) 26114456fccdSmrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 26124456fccdSmrg $echo 26134456fccdSmrg if test "$linkmode" = prog; then 26144456fccdSmrg $echo "*** Warning: Linking the executable $output against the loadable module" 26154456fccdSmrg else 26164456fccdSmrg $echo "*** Warning: Linking the shared library $output against the loadable module" 26174456fccdSmrg fi 26184456fccdSmrg $echo "*** $linklib is not portable!" 26194456fccdSmrg fi 26204456fccdSmrg if test "$linkmode" = lib && 26214456fccdSmrg test "$hardcode_into_libs" = yes; then 26224456fccdSmrg # Hardcode the library path. 26234456fccdSmrg # Skip directories that are in the system default run-time 26244456fccdSmrg # search path. 26254456fccdSmrg case " $sys_lib_dlsearch_path " in 26264456fccdSmrg *" $absdir "*) ;; 26274456fccdSmrg *) 26284456fccdSmrg case "$compile_rpath " in 26294456fccdSmrg *" $absdir "*) ;; 26304456fccdSmrg *) compile_rpath="$compile_rpath $absdir" 26314456fccdSmrg esac 26324456fccdSmrg ;; 26334456fccdSmrg esac 26344456fccdSmrg case " $sys_lib_dlsearch_path " in 26354456fccdSmrg *" $libdir "*) ;; 26364456fccdSmrg *) 26374456fccdSmrg case "$finalize_rpath " in 26384456fccdSmrg *" $libdir "*) ;; 26394456fccdSmrg *) finalize_rpath="$finalize_rpath $libdir" 26404456fccdSmrg esac 26414456fccdSmrg ;; 26424456fccdSmrg esac 26434456fccdSmrg fi 26444456fccdSmrg 26454456fccdSmrg if test -n "$old_archive_from_expsyms_cmds"; then 26464456fccdSmrg # figure out the soname 26474456fccdSmrg set dummy $library_names 26484456fccdSmrg realname="$2" 26494456fccdSmrg shift; shift 26504456fccdSmrg libname=`eval \\$echo \"$libname_spec\"` 26514456fccdSmrg # use dlname if we got it. it's perfectly good, no? 26524456fccdSmrg if test -n "$dlname"; then 26534456fccdSmrg soname="$dlname" 26544456fccdSmrg elif test -n "$soname_spec"; then 26554456fccdSmrg # bleh windows 26564456fccdSmrg case $host in 26574456fccdSmrg *cygwin* | mingw*) 26584456fccdSmrg major=`expr $current - $age` 26594456fccdSmrg versuffix="-$major" 26604456fccdSmrg ;; 26614456fccdSmrg esac 26624456fccdSmrg eval soname=\"$soname_spec\" 26634456fccdSmrg else 26644456fccdSmrg soname="$realname" 26654456fccdSmrg fi 26664456fccdSmrg 26674456fccdSmrg # Make a new name for the extract_expsyms_cmds to use 26684456fccdSmrg soroot="$soname" 26694456fccdSmrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 26704456fccdSmrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 26714456fccdSmrg 26724456fccdSmrg # If the library has no export list, then create one now 26734456fccdSmrg if test -f "$output_objdir/$soname-def"; then : 26744456fccdSmrg else 26754456fccdSmrg $show "extracting exported symbol list from \`$soname'" 26764456fccdSmrg save_ifs="$IFS"; IFS='~' 26774456fccdSmrg cmds=$extract_expsyms_cmds 26784456fccdSmrg for cmd in $cmds; do 26794456fccdSmrg IFS="$save_ifs" 26804456fccdSmrg eval cmd=\"$cmd\" 26814456fccdSmrg $show "$cmd" 26824456fccdSmrg $run eval "$cmd" || exit $? 26834456fccdSmrg done 26844456fccdSmrg IFS="$save_ifs" 26854456fccdSmrg fi 26864456fccdSmrg 26874456fccdSmrg # Create $newlib 26884456fccdSmrg if test -f "$output_objdir/$newlib"; then :; else 26894456fccdSmrg $show "generating import library for \`$soname'" 26904456fccdSmrg save_ifs="$IFS"; IFS='~' 26914456fccdSmrg cmds=$old_archive_from_expsyms_cmds 26924456fccdSmrg for cmd in $cmds; do 26934456fccdSmrg IFS="$save_ifs" 26944456fccdSmrg eval cmd=\"$cmd\" 26954456fccdSmrg $show "$cmd" 26964456fccdSmrg $run eval "$cmd" || exit $? 26974456fccdSmrg done 26984456fccdSmrg IFS="$save_ifs" 26994456fccdSmrg fi 27004456fccdSmrg # make sure the library variables are pointing to the new library 27014456fccdSmrg dir=$output_objdir 27024456fccdSmrg linklib=$newlib 27034456fccdSmrg fi # test -n "$old_archive_from_expsyms_cmds" 27044456fccdSmrg 27054456fccdSmrg if test "$linkmode" = prog || test "$mode" != relink; then 27064456fccdSmrg add_shlibpath= 27074456fccdSmrg add_dir= 27084456fccdSmrg add= 27094456fccdSmrg lib_linked=yes 27104456fccdSmrg case $hardcode_action in 27114456fccdSmrg immediate | unsupported) 27124456fccdSmrg if test "$hardcode_direct" = no; then 27134456fccdSmrg add="$dir/$linklib" 27144456fccdSmrg case $host in 27154456fccdSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 27164456fccdSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 27174456fccdSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 27184456fccdSmrg *-*-unixware7*) add_dir="-L$dir" ;; 27194456fccdSmrg *-*-darwin* ) 27204456fccdSmrg # if the lib is a module then we can not link against 27214456fccdSmrg # it, someone is ignoring the new warnings I added 27224456fccdSmrg if /usr/bin/file -L $add 2> /dev/null | 27234456fccdSmrg $EGREP ": [^:]* bundle" >/dev/null ; then 27244456fccdSmrg $echo "** Warning, lib $linklib is a module, not a shared library" 27254456fccdSmrg if test -z "$old_library" ; then 27264456fccdSmrg $echo 27274456fccdSmrg $echo "** And there doesn't seem to be a static archive available" 27284456fccdSmrg $echo "** The link will probably fail, sorry" 27294456fccdSmrg else 27304456fccdSmrg add="$dir/$old_library" 27314456fccdSmrg fi 27324456fccdSmrg fi 27334456fccdSmrg esac 27344456fccdSmrg elif test "$hardcode_minus_L" = no; then 27354456fccdSmrg case $host in 27364456fccdSmrg *-*-sunos*) add_shlibpath="$dir" ;; 27374456fccdSmrg esac 27384456fccdSmrg add_dir="-L$dir" 27394456fccdSmrg add="-l$name" 27404456fccdSmrg elif test "$hardcode_shlibpath_var" = no; then 27414456fccdSmrg add_shlibpath="$dir" 27424456fccdSmrg add="-l$name" 27434456fccdSmrg else 27444456fccdSmrg lib_linked=no 27454456fccdSmrg fi 27464456fccdSmrg ;; 27474456fccdSmrg relink) 27484456fccdSmrg if test "$hardcode_direct" = yes; then 27494456fccdSmrg add="$dir/$linklib" 27504456fccdSmrg elif test "$hardcode_minus_L" = yes; then 27514456fccdSmrg add_dir="-L$dir" 27524456fccdSmrg # Try looking first in the location we're being installed to. 27534456fccdSmrg if test -n "$inst_prefix_dir"; then 27544456fccdSmrg case $libdir in 27554456fccdSmrg [\\/]*) 27564456fccdSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 27574456fccdSmrg ;; 27584456fccdSmrg esac 27594456fccdSmrg fi 27604456fccdSmrg add="-l$name" 27614456fccdSmrg elif test "$hardcode_shlibpath_var" = yes; then 27624456fccdSmrg add_shlibpath="$dir" 27634456fccdSmrg add="-l$name" 27644456fccdSmrg else 27654456fccdSmrg lib_linked=no 27664456fccdSmrg fi 27674456fccdSmrg ;; 27684456fccdSmrg *) lib_linked=no ;; 27694456fccdSmrg esac 27704456fccdSmrg 27714456fccdSmrg if test "$lib_linked" != yes; then 27724456fccdSmrg $echo "$modename: configuration error: unsupported hardcode properties" 27734456fccdSmrg exit $EXIT_FAILURE 27744456fccdSmrg fi 27754456fccdSmrg 27764456fccdSmrg if test -n "$add_shlibpath"; then 27774456fccdSmrg case :$compile_shlibpath: in 27784456fccdSmrg *":$add_shlibpath:"*) ;; 27794456fccdSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 27804456fccdSmrg esac 27814456fccdSmrg fi 27824456fccdSmrg if test "$linkmode" = prog; then 27834456fccdSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 27844456fccdSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 27854456fccdSmrg else 27864456fccdSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 27874456fccdSmrg test -n "$add" && deplibs="$add $deplibs" 27884456fccdSmrg if test "$hardcode_direct" != yes && \ 27894456fccdSmrg test "$hardcode_minus_L" != yes && \ 27904456fccdSmrg test "$hardcode_shlibpath_var" = yes; then 27914456fccdSmrg case :$finalize_shlibpath: in 27924456fccdSmrg *":$libdir:"*) ;; 27934456fccdSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27944456fccdSmrg esac 27954456fccdSmrg fi 27964456fccdSmrg fi 27974456fccdSmrg fi 27984456fccdSmrg 27994456fccdSmrg if test "$linkmode" = prog || test "$mode" = relink; then 28004456fccdSmrg add_shlibpath= 28014456fccdSmrg add_dir= 28024456fccdSmrg add= 28034456fccdSmrg # Finalize command for both is simple: just hardcode it. 28044456fccdSmrg if test "$hardcode_direct" = yes; then 28054456fccdSmrg add="$libdir/$linklib" 28064456fccdSmrg elif test "$hardcode_minus_L" = yes; then 28074456fccdSmrg add_dir="-L$libdir" 28084456fccdSmrg add="-l$name" 28094456fccdSmrg elif test "$hardcode_shlibpath_var" = yes; then 28104456fccdSmrg case :$finalize_shlibpath: in 28114456fccdSmrg *":$libdir:"*) ;; 28124456fccdSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 28134456fccdSmrg esac 28144456fccdSmrg add="-l$name" 28154456fccdSmrg elif test "$hardcode_automatic" = yes; then 28164456fccdSmrg if test -n "$inst_prefix_dir" && 28174456fccdSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 28184456fccdSmrg add="$inst_prefix_dir$libdir/$linklib" 28194456fccdSmrg else 28204456fccdSmrg add="$libdir/$linklib" 28214456fccdSmrg fi 28224456fccdSmrg else 28234456fccdSmrg # We cannot seem to hardcode it, guess we'll fake it. 28244456fccdSmrg add_dir="-L$libdir" 28254456fccdSmrg # Try looking first in the location we're being installed to. 28264456fccdSmrg if test -n "$inst_prefix_dir"; then 28274456fccdSmrg case $libdir in 28284456fccdSmrg [\\/]*) 28294456fccdSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 28304456fccdSmrg ;; 28314456fccdSmrg esac 28324456fccdSmrg fi 28334456fccdSmrg add="-l$name" 28344456fccdSmrg fi 28354456fccdSmrg 28364456fccdSmrg if test "$linkmode" = prog; then 28374456fccdSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 28384456fccdSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 28394456fccdSmrg else 28404456fccdSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 28414456fccdSmrg test -n "$add" && deplibs="$add $deplibs" 28424456fccdSmrg fi 28434456fccdSmrg fi 28444456fccdSmrg elif test "$linkmode" = prog; then 28454456fccdSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 28464456fccdSmrg # is not unsupported. This is valid on all known static and 28474456fccdSmrg # shared platforms. 28484456fccdSmrg if test "$hardcode_direct" != unsupported; then 28494456fccdSmrg test -n "$old_library" && linklib="$old_library" 28504456fccdSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 28514456fccdSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 28524456fccdSmrg else 28534456fccdSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 28544456fccdSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 28554456fccdSmrg fi 28564456fccdSmrg elif test "$build_libtool_libs" = yes; then 28574456fccdSmrg # Not a shared library 28584456fccdSmrg if test "$deplibs_check_method" != pass_all; then 28594456fccdSmrg # We're trying link a shared library against a static one 28604456fccdSmrg # but the system doesn't support it. 28614456fccdSmrg 28624456fccdSmrg # Just print a warning and add the library to dependency_libs so 28634456fccdSmrg # that the program can be linked against the static library. 28644456fccdSmrg $echo 28654456fccdSmrg $echo "*** Warning: This system can not link to static lib archive $lib." 28664456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 28674456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 28684456fccdSmrg $echo "*** shared version of the library, which you do not appear to have." 28694456fccdSmrg if test "$module" = yes; then 28704456fccdSmrg $echo "*** But as you try to build a module library, libtool will still create " 28714456fccdSmrg $echo "*** a static module, that should work as long as the dlopening application" 28724456fccdSmrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 28734456fccdSmrg if test -z "$global_symbol_pipe"; then 28744456fccdSmrg $echo 28754456fccdSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 28764456fccdSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 28774456fccdSmrg $echo "*** not find such a program. So, this module is probably useless." 28784456fccdSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 28794456fccdSmrg fi 28804456fccdSmrg if test "$build_old_libs" = no; then 28814456fccdSmrg build_libtool_libs=module 28824456fccdSmrg build_old_libs=yes 28834456fccdSmrg else 28844456fccdSmrg build_libtool_libs=no 28854456fccdSmrg fi 28864456fccdSmrg fi 28874456fccdSmrg else 28884456fccdSmrg deplibs="$dir/$old_library $deplibs" 28894456fccdSmrg link_static=yes 28904456fccdSmrg fi 28914456fccdSmrg fi # link shared/static library? 28924456fccdSmrg 28934456fccdSmrg if test "$linkmode" = lib; then 28944456fccdSmrg if test -n "$dependency_libs" && 28954456fccdSmrg { test "$hardcode_into_libs" != yes || 28964456fccdSmrg test "$build_old_libs" = yes || 28974456fccdSmrg test "$link_static" = yes; }; then 28984456fccdSmrg # Extract -R from dependency_libs 28994456fccdSmrg temp_deplibs= 29004456fccdSmrg for libdir in $dependency_libs; do 29014456fccdSmrg case $libdir in 29024456fccdSmrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 29034456fccdSmrg case " $xrpath " in 29044456fccdSmrg *" $temp_xrpath "*) ;; 29054456fccdSmrg *) xrpath="$xrpath $temp_xrpath";; 29064456fccdSmrg esac;; 29074456fccdSmrg *) temp_deplibs="$temp_deplibs $libdir";; 29084456fccdSmrg esac 29094456fccdSmrg done 29104456fccdSmrg dependency_libs="$temp_deplibs" 29114456fccdSmrg fi 29124456fccdSmrg 29134456fccdSmrg newlib_search_path="$newlib_search_path $absdir" 29144456fccdSmrg # Link against this library 29154456fccdSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 29164456fccdSmrg # ... and its dependency_libs 29174456fccdSmrg tmp_libs= 29184456fccdSmrg for deplib in $dependency_libs; do 29194456fccdSmrg newdependency_libs="$deplib $newdependency_libs" 29204456fccdSmrg if test "X$duplicate_deps" = "Xyes" ; then 29214456fccdSmrg case "$tmp_libs " in 29224456fccdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 29234456fccdSmrg esac 29244456fccdSmrg fi 29254456fccdSmrg tmp_libs="$tmp_libs $deplib" 29264456fccdSmrg done 29274456fccdSmrg 29284456fccdSmrg if test "$link_all_deplibs" != no; then 29294456fccdSmrg # Add the search paths of all dependency libraries 29304456fccdSmrg for deplib in $dependency_libs; do 29314456fccdSmrg case $deplib in 29324456fccdSmrg -L*) path="$deplib" ;; 29334456fccdSmrg *.la) 29344456fccdSmrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 29354456fccdSmrg test "X$dir" = "X$deplib" && dir="." 29364456fccdSmrg # We need an absolute path. 29374456fccdSmrg case $dir in 29384456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 29394456fccdSmrg *) 29404456fccdSmrg absdir=`cd "$dir" && pwd` 29414456fccdSmrg if test -z "$absdir"; then 29424456fccdSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 29434456fccdSmrg absdir="$dir" 29444456fccdSmrg fi 29454456fccdSmrg ;; 29464456fccdSmrg esac 29474456fccdSmrg if grep "^installed=no" $deplib > /dev/null; then 29484456fccdSmrg path="$absdir/$objdir" 29494456fccdSmrg else 29504456fccdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29514456fccdSmrg if test -z "$libdir"; then 29524456fccdSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 29534456fccdSmrg exit $EXIT_FAILURE 29544456fccdSmrg fi 29554456fccdSmrg if test "$absdir" != "$libdir"; then 29564456fccdSmrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 29574456fccdSmrg fi 29584456fccdSmrg path="$absdir" 29594456fccdSmrg fi 29604456fccdSmrg depdepl= 29614456fccdSmrg case $host in 29624456fccdSmrg *-*-darwin*) 29634456fccdSmrg # we do not want to link against static libs, 29644456fccdSmrg # but need to link against shared 29654456fccdSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 296642d69509Smrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29674456fccdSmrg if test -n "$deplibrary_names" ; then 29684456fccdSmrg for tmp in $deplibrary_names ; do 29694456fccdSmrg depdepl=$tmp 29704456fccdSmrg done 297142d69509Smrg if test -f "$deplibdir/$depdepl" ; then 297242d69509Smrg depdepl="$deplibdir/$depdepl" 297342d69509Smrg elif test -f "$path/$depdepl" ; then 29744456fccdSmrg depdepl="$path/$depdepl" 297542d69509Smrg else 297642d69509Smrg # Can't find it, oh well... 297742d69509Smrg depdepl= 29784456fccdSmrg fi 29794456fccdSmrg # do not add paths which are already there 29804456fccdSmrg case " $newlib_search_path " in 29814456fccdSmrg *" $path "*) ;; 29824456fccdSmrg *) newlib_search_path="$newlib_search_path $path";; 29834456fccdSmrg esac 29844456fccdSmrg fi 29854456fccdSmrg path="" 29864456fccdSmrg ;; 29874456fccdSmrg *) 29884456fccdSmrg path="-L$path" 29894456fccdSmrg ;; 29904456fccdSmrg esac 29914456fccdSmrg ;; 29924456fccdSmrg -l*) 29934456fccdSmrg case $host in 29944456fccdSmrg *-*-darwin*) 29954456fccdSmrg # Again, we only want to link against shared libraries 29964456fccdSmrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 29974456fccdSmrg for tmp in $newlib_search_path ; do 29984456fccdSmrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 29994456fccdSmrg eval depdepl="$tmp/lib$tmp_libs.dylib" 30004456fccdSmrg break 30014456fccdSmrg fi 30024456fccdSmrg done 30034456fccdSmrg path="" 30044456fccdSmrg ;; 30054456fccdSmrg *) continue ;; 30064456fccdSmrg esac 30074456fccdSmrg ;; 30084456fccdSmrg *) continue ;; 30094456fccdSmrg esac 30104456fccdSmrg case " $deplibs " in 30114456fccdSmrg *" $path "*) ;; 30124456fccdSmrg *) deplibs="$path $deplibs" ;; 30134456fccdSmrg esac 30144456fccdSmrg case " $deplibs " in 30154456fccdSmrg *" $depdepl "*) ;; 30164456fccdSmrg *) deplibs="$depdepl $deplibs" ;; 30174456fccdSmrg esac 30184456fccdSmrg done 30194456fccdSmrg fi # link_all_deplibs != no 30204456fccdSmrg fi # linkmode = lib 30214456fccdSmrg done # for deplib in $libs 30224456fccdSmrg dependency_libs="$newdependency_libs" 30234456fccdSmrg if test "$pass" = dlpreopen; then 30244456fccdSmrg # Link the dlpreopened libraries before other libraries 30254456fccdSmrg for deplib in $save_deplibs; do 30264456fccdSmrg deplibs="$deplib $deplibs" 30274456fccdSmrg done 30284456fccdSmrg fi 30294456fccdSmrg if test "$pass" != dlopen; then 30304456fccdSmrg if test "$pass" != conv; then 30314456fccdSmrg # Make sure lib_search_path contains only unique directories. 30324456fccdSmrg lib_search_path= 30334456fccdSmrg for dir in $newlib_search_path; do 30344456fccdSmrg case "$lib_search_path " in 30354456fccdSmrg *" $dir "*) ;; 30364456fccdSmrg *) lib_search_path="$lib_search_path $dir" ;; 30374456fccdSmrg esac 30384456fccdSmrg done 30394456fccdSmrg newlib_search_path= 30404456fccdSmrg fi 30414456fccdSmrg 30424456fccdSmrg if test "$linkmode,$pass" != "prog,link"; then 30434456fccdSmrg vars="deplibs" 30444456fccdSmrg else 30454456fccdSmrg vars="compile_deplibs finalize_deplibs" 30464456fccdSmrg fi 30474456fccdSmrg for var in $vars dependency_libs; do 30484456fccdSmrg # Add libraries to $var in reverse order 30494456fccdSmrg eval tmp_libs=\"\$$var\" 30504456fccdSmrg new_libs= 30514456fccdSmrg for deplib in $tmp_libs; do 30524456fccdSmrg # FIXME: Pedantically, this is the right thing to do, so 30534456fccdSmrg # that some nasty dependency loop isn't accidentally 30544456fccdSmrg # broken: 30554456fccdSmrg #new_libs="$deplib $new_libs" 30564456fccdSmrg # Pragmatically, this seems to cause very few problems in 30574456fccdSmrg # practice: 30584456fccdSmrg case $deplib in 30594456fccdSmrg -L*) new_libs="$deplib $new_libs" ;; 30604456fccdSmrg -R*) ;; 30614456fccdSmrg *) 30624456fccdSmrg # And here is the reason: when a library appears more 30634456fccdSmrg # than once as an explicit dependence of a library, or 30644456fccdSmrg # is implicitly linked in more than once by the 30654456fccdSmrg # compiler, it is considered special, and multiple 30664456fccdSmrg # occurrences thereof are not removed. Compare this 30674456fccdSmrg # with having the same library being listed as a 30684456fccdSmrg # dependency of multiple other libraries: in this case, 30694456fccdSmrg # we know (pedantically, we assume) the library does not 30704456fccdSmrg # need to be listed more than once, so we keep only the 30714456fccdSmrg # last copy. This is not always right, but it is rare 30724456fccdSmrg # enough that we require users that really mean to play 30734456fccdSmrg # such unportable linking tricks to link the library 30744456fccdSmrg # using -Wl,-lname, so that libtool does not consider it 30754456fccdSmrg # for duplicate removal. 30764456fccdSmrg case " $specialdeplibs " in 30774456fccdSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 30784456fccdSmrg *) 30794456fccdSmrg case " $new_libs " in 30804456fccdSmrg *" $deplib "*) ;; 30814456fccdSmrg *) new_libs="$deplib $new_libs" ;; 30824456fccdSmrg esac 30834456fccdSmrg ;; 30844456fccdSmrg esac 30854456fccdSmrg ;; 30864456fccdSmrg esac 30874456fccdSmrg done 30884456fccdSmrg tmp_libs= 30894456fccdSmrg for deplib in $new_libs; do 30904456fccdSmrg case $deplib in 30914456fccdSmrg -L*) 30924456fccdSmrg case " $tmp_libs " in 30934456fccdSmrg *" $deplib "*) ;; 30944456fccdSmrg *) tmp_libs="$tmp_libs $deplib" ;; 30954456fccdSmrg esac 30964456fccdSmrg ;; 30974456fccdSmrg *) tmp_libs="$tmp_libs $deplib" ;; 30984456fccdSmrg esac 30994456fccdSmrg done 31004456fccdSmrg eval $var=\"$tmp_libs\" 31014456fccdSmrg done # for var 31024456fccdSmrg fi 31034456fccdSmrg # Last step: remove runtime libs from dependency_libs 31044456fccdSmrg # (they stay in deplibs) 31054456fccdSmrg tmp_libs= 31064456fccdSmrg for i in $dependency_libs ; do 31074456fccdSmrg case " $predeps $postdeps $compiler_lib_search_path " in 31084456fccdSmrg *" $i "*) 31094456fccdSmrg i="" 31104456fccdSmrg ;; 31114456fccdSmrg esac 31124456fccdSmrg if test -n "$i" ; then 31134456fccdSmrg tmp_libs="$tmp_libs $i" 31144456fccdSmrg fi 31154456fccdSmrg done 31164456fccdSmrg dependency_libs=$tmp_libs 31174456fccdSmrg done # for pass 31184456fccdSmrg if test "$linkmode" = prog; then 31194456fccdSmrg dlfiles="$newdlfiles" 31204456fccdSmrg dlprefiles="$newdlprefiles" 31214456fccdSmrg fi 31224456fccdSmrg 31234456fccdSmrg case $linkmode in 31244456fccdSmrg oldlib) 312542d69509Smrg case " $deplibs" in 312642d69509Smrg *\ -l* | *\ -L*) 312742d69509Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 312842d69509Smrg esac 31294456fccdSmrg 31304456fccdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 31314456fccdSmrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 31324456fccdSmrg fi 31334456fccdSmrg 31344456fccdSmrg if test -n "$rpath"; then 31354456fccdSmrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 31364456fccdSmrg fi 31374456fccdSmrg 31384456fccdSmrg if test -n "$xrpath"; then 31394456fccdSmrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 31404456fccdSmrg fi 31414456fccdSmrg 31424456fccdSmrg if test -n "$vinfo"; then 31434456fccdSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 31444456fccdSmrg fi 31454456fccdSmrg 31464456fccdSmrg if test -n "$release"; then 31474456fccdSmrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 31484456fccdSmrg fi 31494456fccdSmrg 31504456fccdSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 31514456fccdSmrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 31524456fccdSmrg fi 31534456fccdSmrg 31544456fccdSmrg # Now set the variables for building old libraries. 31554456fccdSmrg build_libtool_libs=no 31564456fccdSmrg oldlibs="$output" 31574456fccdSmrg objs="$objs$old_deplibs" 31584456fccdSmrg ;; 31594456fccdSmrg 31604456fccdSmrg lib) 31614456fccdSmrg # Make sure we only generate libraries of the form `libNAME.la'. 31624456fccdSmrg case $outputname in 31634456fccdSmrg lib*) 31644456fccdSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 31654456fccdSmrg eval shared_ext=\"$shrext_cmds\" 31664456fccdSmrg eval libname=\"$libname_spec\" 31674456fccdSmrg ;; 31684456fccdSmrg *) 31694456fccdSmrg if test "$module" = no; then 31704456fccdSmrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 31714456fccdSmrg $echo "$help" 1>&2 31724456fccdSmrg exit $EXIT_FAILURE 31734456fccdSmrg fi 31744456fccdSmrg if test "$need_lib_prefix" != no; then 31754456fccdSmrg # Add the "lib" prefix for modules if required 31764456fccdSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31774456fccdSmrg eval shared_ext=\"$shrext_cmds\" 31784456fccdSmrg eval libname=\"$libname_spec\" 31794456fccdSmrg else 31804456fccdSmrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31814456fccdSmrg fi 31824456fccdSmrg ;; 31834456fccdSmrg esac 31844456fccdSmrg 31854456fccdSmrg if test -n "$objs"; then 31864456fccdSmrg if test "$deplibs_check_method" != pass_all; then 31874456fccdSmrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 31884456fccdSmrg exit $EXIT_FAILURE 31894456fccdSmrg else 31904456fccdSmrg $echo 31914456fccdSmrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 31924456fccdSmrg $echo "*** objects $objs is not portable!" 31934456fccdSmrg libobjs="$libobjs $objs" 31944456fccdSmrg fi 31954456fccdSmrg fi 31964456fccdSmrg 31974456fccdSmrg if test "$dlself" != no; then 31984456fccdSmrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 31994456fccdSmrg fi 32004456fccdSmrg 32014456fccdSmrg set dummy $rpath 32024456fccdSmrg if test "$#" -gt 2; then 32034456fccdSmrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 32044456fccdSmrg fi 32054456fccdSmrg install_libdir="$2" 32064456fccdSmrg 32074456fccdSmrg oldlibs= 32084456fccdSmrg if test -z "$rpath"; then 32094456fccdSmrg if test "$build_libtool_libs" = yes; then 32104456fccdSmrg # Building a libtool convenience library. 32114456fccdSmrg # Some compilers have problems with a `.al' extension so 32124456fccdSmrg # convenience libraries should have the same extension an 32134456fccdSmrg # archive normally would. 32144456fccdSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 32154456fccdSmrg build_libtool_libs=convenience 32164456fccdSmrg build_old_libs=yes 32174456fccdSmrg fi 32184456fccdSmrg 32194456fccdSmrg if test -n "$vinfo"; then 32204456fccdSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 32214456fccdSmrg fi 32224456fccdSmrg 32234456fccdSmrg if test -n "$release"; then 32244456fccdSmrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 32254456fccdSmrg fi 32264456fccdSmrg else 32274456fccdSmrg 32284456fccdSmrg # Parse the version information argument. 32294456fccdSmrg save_ifs="$IFS"; IFS=':' 32304456fccdSmrg set dummy $vinfo 0 0 0 32314456fccdSmrg IFS="$save_ifs" 32324456fccdSmrg 32334456fccdSmrg if test -n "$8"; then 32344456fccdSmrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 32354456fccdSmrg $echo "$help" 1>&2 32364456fccdSmrg exit $EXIT_FAILURE 32374456fccdSmrg fi 32384456fccdSmrg 32394456fccdSmrg # convert absolute version numbers to libtool ages 32404456fccdSmrg # this retains compatibility with .la files and attempts 32414456fccdSmrg # to make the code below a bit more comprehensible 32424456fccdSmrg 32434456fccdSmrg case $vinfo_number in 32444456fccdSmrg yes) 32454456fccdSmrg number_major="$2" 32464456fccdSmrg number_minor="$3" 32474456fccdSmrg number_revision="$4" 32484456fccdSmrg # 32494456fccdSmrg # There are really only two kinds -- those that 32504456fccdSmrg # use the current revision as the major version 32514456fccdSmrg # and those that subtract age and use age as 32524456fccdSmrg # a minor version. But, then there is irix 32534456fccdSmrg # which has an extra 1 added just for fun 32544456fccdSmrg # 32554456fccdSmrg case $version_type in 325642d69509Smrg darwin|linux|osf|windows|none) 32574456fccdSmrg current=`expr $number_major + $number_minor` 32584456fccdSmrg age="$number_minor" 32594456fccdSmrg revision="$number_revision" 32604456fccdSmrg ;; 32614456fccdSmrg freebsd-aout|freebsd-elf|sunos) 32624456fccdSmrg current="$number_major" 32634456fccdSmrg revision="$number_minor" 32644456fccdSmrg age="0" 32654456fccdSmrg ;; 32664456fccdSmrg irix|nonstopux) 326742d69509Smrg current=`expr $number_major + $number_minor` 32684456fccdSmrg age="$number_minor" 32694456fccdSmrg revision="$number_minor" 327042d69509Smrg lt_irix_increment=no 32714456fccdSmrg ;; 32724456fccdSmrg esac 32734456fccdSmrg ;; 32744456fccdSmrg no) 32754456fccdSmrg current="$2" 32764456fccdSmrg revision="$3" 32774456fccdSmrg age="$4" 32784456fccdSmrg ;; 32794456fccdSmrg esac 32804456fccdSmrg 32814456fccdSmrg # Check that each of the things are valid numbers. 32824456fccdSmrg case $current in 32834456fccdSmrg 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]) ;; 32844456fccdSmrg *) 32854456fccdSmrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 32864456fccdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32874456fccdSmrg exit $EXIT_FAILURE 32884456fccdSmrg ;; 32894456fccdSmrg esac 32904456fccdSmrg 32914456fccdSmrg case $revision in 32924456fccdSmrg 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]) ;; 32934456fccdSmrg *) 32944456fccdSmrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 32954456fccdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32964456fccdSmrg exit $EXIT_FAILURE 32974456fccdSmrg ;; 32984456fccdSmrg esac 32994456fccdSmrg 33004456fccdSmrg case $age in 33014456fccdSmrg 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]) ;; 33024456fccdSmrg *) 33034456fccdSmrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 33044456fccdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33054456fccdSmrg exit $EXIT_FAILURE 33064456fccdSmrg ;; 33074456fccdSmrg esac 33084456fccdSmrg 33094456fccdSmrg if test "$age" -gt "$current"; then 33104456fccdSmrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 33114456fccdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 33124456fccdSmrg exit $EXIT_FAILURE 33134456fccdSmrg fi 33144456fccdSmrg 33154456fccdSmrg # Calculate the version variables. 33164456fccdSmrg major= 33174456fccdSmrg versuffix= 33184456fccdSmrg verstring= 33194456fccdSmrg case $version_type in 33204456fccdSmrg none) ;; 33214456fccdSmrg 33224456fccdSmrg darwin) 33234456fccdSmrg # Like Linux, but with the current version available in 33244456fccdSmrg # verstring for coding it into the library header 33254456fccdSmrg major=.`expr $current - $age` 33264456fccdSmrg versuffix="$major.$age.$revision" 33274456fccdSmrg # Darwin ld doesn't like 0 for these options... 33284456fccdSmrg minor_current=`expr $current + 1` 332942d69509Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 333042d69509Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 33314456fccdSmrg ;; 33324456fccdSmrg 33334456fccdSmrg freebsd-aout) 33344456fccdSmrg major=".$current" 33354456fccdSmrg versuffix=".$current.$revision"; 33364456fccdSmrg ;; 33374456fccdSmrg 33384456fccdSmrg freebsd-elf) 33394456fccdSmrg major=".$current" 33404456fccdSmrg versuffix=".$current"; 33414456fccdSmrg ;; 33424456fccdSmrg 33434456fccdSmrg irix | nonstopux) 334442d69509Smrg if test "X$lt_irix_increment" = "Xno"; then 334542d69509Smrg major=`expr $current - $age` 334642d69509Smrg else 334742d69509Smrg major=`expr $current - $age + 1` 334842d69509Smrg fi 33494456fccdSmrg case $version_type in 33504456fccdSmrg nonstopux) verstring_prefix=nonstopux ;; 33514456fccdSmrg *) verstring_prefix=sgi ;; 33524456fccdSmrg esac 33534456fccdSmrg verstring="$verstring_prefix$major.$revision" 33544456fccdSmrg 33554456fccdSmrg # Add in all the interfaces that we are compatible with. 33564456fccdSmrg loop=$revision 33574456fccdSmrg while test "$loop" -ne 0; do 33584456fccdSmrg iface=`expr $revision - $loop` 33594456fccdSmrg loop=`expr $loop - 1` 33604456fccdSmrg verstring="$verstring_prefix$major.$iface:$verstring" 33614456fccdSmrg done 33624456fccdSmrg 33634456fccdSmrg # Before this point, $major must not contain `.'. 33644456fccdSmrg major=.$major 33654456fccdSmrg versuffix="$major.$revision" 33664456fccdSmrg ;; 33674456fccdSmrg 33684456fccdSmrg linux) 33694456fccdSmrg major=.`expr $current - $age` 33704456fccdSmrg versuffix="$major.$age.$revision" 33714456fccdSmrg ;; 33724456fccdSmrg 33734456fccdSmrg osf) 33744456fccdSmrg major=.`expr $current - $age` 33754456fccdSmrg versuffix=".$current.$age.$revision" 33764456fccdSmrg verstring="$current.$age.$revision" 33774456fccdSmrg 33784456fccdSmrg # Add in all the interfaces that we are compatible with. 33794456fccdSmrg loop=$age 33804456fccdSmrg while test "$loop" -ne 0; do 33814456fccdSmrg iface=`expr $current - $loop` 33824456fccdSmrg loop=`expr $loop - 1` 33834456fccdSmrg verstring="$verstring:${iface}.0" 33844456fccdSmrg done 33854456fccdSmrg 33864456fccdSmrg # Make executables depend on our current version. 33874456fccdSmrg verstring="$verstring:${current}.0" 33884456fccdSmrg ;; 33894456fccdSmrg 33904456fccdSmrg sunos) 33914456fccdSmrg major=".$current" 33924456fccdSmrg versuffix=".$current.$revision" 33934456fccdSmrg ;; 33944456fccdSmrg 33954456fccdSmrg windows) 33964456fccdSmrg # Use '-' rather than '.', since we only want one 33974456fccdSmrg # extension on DOS 8.3 filesystems. 33984456fccdSmrg major=`expr $current - $age` 33994456fccdSmrg versuffix="-$major" 34004456fccdSmrg ;; 34014456fccdSmrg 34024456fccdSmrg *) 34034456fccdSmrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 34044456fccdSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 34054456fccdSmrg exit $EXIT_FAILURE 34064456fccdSmrg ;; 34074456fccdSmrg esac 34084456fccdSmrg 34094456fccdSmrg # Clear the version info if we defaulted, and they specified a release. 34104456fccdSmrg if test -z "$vinfo" && test -n "$release"; then 34114456fccdSmrg major= 34124456fccdSmrg case $version_type in 34134456fccdSmrg darwin) 34144456fccdSmrg # we can't check for "0.0" in archive_cmds due to quoting 34154456fccdSmrg # problems, so we reset it completely 34164456fccdSmrg verstring= 34174456fccdSmrg ;; 34184456fccdSmrg *) 34194456fccdSmrg verstring="0.0" 34204456fccdSmrg ;; 34214456fccdSmrg esac 34224456fccdSmrg if test "$need_version" = no; then 34234456fccdSmrg versuffix= 34244456fccdSmrg else 34254456fccdSmrg versuffix=".0.0" 34264456fccdSmrg fi 34274456fccdSmrg fi 34284456fccdSmrg 34294456fccdSmrg # Remove version info from name if versioning should be avoided 34304456fccdSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 34314456fccdSmrg major= 34324456fccdSmrg versuffix= 34334456fccdSmrg verstring="" 34344456fccdSmrg fi 34354456fccdSmrg 34364456fccdSmrg # Check to see if the archive will have undefined symbols. 34374456fccdSmrg if test "$allow_undefined" = yes; then 34384456fccdSmrg if test "$allow_undefined_flag" = unsupported; then 34394456fccdSmrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 34404456fccdSmrg build_libtool_libs=no 34414456fccdSmrg build_old_libs=yes 34424456fccdSmrg fi 34434456fccdSmrg else 34444456fccdSmrg # Don't allow undefined symbols. 34454456fccdSmrg allow_undefined_flag="$no_undefined_flag" 34464456fccdSmrg fi 34474456fccdSmrg fi 34484456fccdSmrg 34494456fccdSmrg if test "$mode" != relink; then 34504456fccdSmrg # Remove our outputs, but don't remove object files since they 34514456fccdSmrg # may have been created when compiling PIC objects. 34524456fccdSmrg removelist= 34534456fccdSmrg tempremovelist=`$echo "$output_objdir/*"` 34544456fccdSmrg for p in $tempremovelist; do 34554456fccdSmrg case $p in 34564456fccdSmrg *.$objext) 34574456fccdSmrg ;; 34584456fccdSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 34594456fccdSmrg if test "X$precious_files_regex" != "X"; then 34604456fccdSmrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 34614456fccdSmrg then 34624456fccdSmrg continue 34634456fccdSmrg fi 34644456fccdSmrg fi 34654456fccdSmrg removelist="$removelist $p" 34664456fccdSmrg ;; 34674456fccdSmrg *) ;; 34684456fccdSmrg esac 34694456fccdSmrg done 34704456fccdSmrg if test -n "$removelist"; then 34714456fccdSmrg $show "${rm}r $removelist" 34724456fccdSmrg $run ${rm}r $removelist 34734456fccdSmrg fi 34744456fccdSmrg fi 34754456fccdSmrg 34764456fccdSmrg # Now set the variables for building old libraries. 34774456fccdSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 34784456fccdSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 34794456fccdSmrg 34804456fccdSmrg # Transform .lo files to .o files. 34814456fccdSmrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 34824456fccdSmrg fi 34834456fccdSmrg 34844456fccdSmrg # Eliminate all temporary directories. 348542d69509Smrg #for path in $notinst_path; do 348642d69509Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 348742d69509Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 348842d69509Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 348942d69509Smrg #done 34904456fccdSmrg 34914456fccdSmrg if test -n "$xrpath"; then 34924456fccdSmrg # If the user specified any rpath flags, then add them. 34934456fccdSmrg temp_xrpath= 34944456fccdSmrg for libdir in $xrpath; do 34954456fccdSmrg temp_xrpath="$temp_xrpath -R$libdir" 34964456fccdSmrg case "$finalize_rpath " in 34974456fccdSmrg *" $libdir "*) ;; 34984456fccdSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 34994456fccdSmrg esac 35004456fccdSmrg done 35014456fccdSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 35024456fccdSmrg dependency_libs="$temp_xrpath $dependency_libs" 35034456fccdSmrg fi 35044456fccdSmrg fi 35054456fccdSmrg 35064456fccdSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 35074456fccdSmrg old_dlfiles="$dlfiles" 35084456fccdSmrg dlfiles= 35094456fccdSmrg for lib in $old_dlfiles; do 35104456fccdSmrg case " $dlprefiles $dlfiles " in 35114456fccdSmrg *" $lib "*) ;; 35124456fccdSmrg *) dlfiles="$dlfiles $lib" ;; 35134456fccdSmrg esac 35144456fccdSmrg done 35154456fccdSmrg 35164456fccdSmrg # Make sure dlprefiles contains only unique files 35174456fccdSmrg old_dlprefiles="$dlprefiles" 35184456fccdSmrg dlprefiles= 35194456fccdSmrg for lib in $old_dlprefiles; do 35204456fccdSmrg case "$dlprefiles " in 35214456fccdSmrg *" $lib "*) ;; 35224456fccdSmrg *) dlprefiles="$dlprefiles $lib" ;; 35234456fccdSmrg esac 35244456fccdSmrg done 35254456fccdSmrg 35264456fccdSmrg if test "$build_libtool_libs" = yes; then 35274456fccdSmrg if test -n "$rpath"; then 35284456fccdSmrg case $host in 35294456fccdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 35304456fccdSmrg # these systems don't actually have a c library (as such)! 35314456fccdSmrg ;; 35324456fccdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 35334456fccdSmrg # Rhapsody C library is in the System framework 35344456fccdSmrg deplibs="$deplibs -framework System" 35354456fccdSmrg ;; 35364456fccdSmrg *-*-netbsd*) 35374456fccdSmrg # Don't link with libc until the a.out ld.so is fixed. 35384456fccdSmrg ;; 35394456fccdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 35404456fccdSmrg # Do not include libc due to us having libc/libc_r. 35414456fccdSmrg ;; 35424456fccdSmrg *-*-sco3.2v5* | *-*-sco5v6*) 35434456fccdSmrg # Causes problems with __ctype 35444456fccdSmrg ;; 35454456fccdSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 35464456fccdSmrg # Compiler inserts libc in the correct place for threads to work 35474456fccdSmrg ;; 35484456fccdSmrg *) 35494456fccdSmrg # Add libc to deplibs on all other systems if necessary. 35504456fccdSmrg if test "$build_libtool_need_lc" = "yes"; then 35514456fccdSmrg deplibs="$deplibs -lc" 35524456fccdSmrg fi 35534456fccdSmrg ;; 35544456fccdSmrg esac 35554456fccdSmrg fi 35564456fccdSmrg 35574456fccdSmrg # Transform deplibs into only deplibs that can be linked in shared. 35584456fccdSmrg name_save=$name 35594456fccdSmrg libname_save=$libname 35604456fccdSmrg release_save=$release 35614456fccdSmrg versuffix_save=$versuffix 35624456fccdSmrg major_save=$major 35634456fccdSmrg # I'm not sure if I'm treating the release correctly. I think 35644456fccdSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 35654456fccdSmrg # add it in twice. Is that correct? 35664456fccdSmrg release="" 35674456fccdSmrg versuffix="" 35684456fccdSmrg major="" 35694456fccdSmrg newdeplibs= 35704456fccdSmrg droppeddeps=no 35714456fccdSmrg case $deplibs_check_method in 35724456fccdSmrg pass_all) 35734456fccdSmrg # Don't check for shared/static. Everything works. 35744456fccdSmrg # This might be a little naive. We might want to check 35754456fccdSmrg # whether the library exists or not. But this is on 35764456fccdSmrg # osf3 & osf4 and I'm not really sure... Just 35774456fccdSmrg # implementing what was already the behavior. 35784456fccdSmrg newdeplibs=$deplibs 35794456fccdSmrg ;; 35804456fccdSmrg test_compile) 35814456fccdSmrg # This code stresses the "libraries are programs" paradigm to its 35824456fccdSmrg # limits. Maybe even breaks it. We compile a program, linking it 35834456fccdSmrg # against the deplibs as a proxy for the library. Then we can check 35844456fccdSmrg # whether they linked in statically or dynamically with ldd. 35854456fccdSmrg $rm conftest.c 35864456fccdSmrg cat > conftest.c <<EOF 35874456fccdSmrg int main() { return 0; } 35884456fccdSmrgEOF 35894456fccdSmrg $rm conftest 359042d69509Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 35914456fccdSmrg ldd_output=`ldd conftest` 35924456fccdSmrg for i in $deplibs; do 35934456fccdSmrg name=`expr $i : '-l\(.*\)'` 35944456fccdSmrg # If $name is empty we are operating on a -L argument. 359542d69509Smrg if test "$name" != "" && test "$name" != "0"; then 35964456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 35974456fccdSmrg case " $predeps $postdeps " in 35984456fccdSmrg *" $i "*) 35994456fccdSmrg newdeplibs="$newdeplibs $i" 36004456fccdSmrg i="" 36014456fccdSmrg ;; 36024456fccdSmrg esac 36034456fccdSmrg fi 36044456fccdSmrg if test -n "$i" ; then 36054456fccdSmrg libname=`eval \\$echo \"$libname_spec\"` 36064456fccdSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 36074456fccdSmrg set dummy $deplib_matches 36084456fccdSmrg deplib_match=$2 36094456fccdSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36104456fccdSmrg newdeplibs="$newdeplibs $i" 36114456fccdSmrg else 36124456fccdSmrg droppeddeps=yes 36134456fccdSmrg $echo 36144456fccdSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 36154456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 36164456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 36174456fccdSmrg $echo "*** shared version of the library, which I believe you do not have" 36184456fccdSmrg $echo "*** because a test_compile did reveal that the linker did not use it for" 36194456fccdSmrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 36204456fccdSmrg fi 36214456fccdSmrg fi 36224456fccdSmrg else 36234456fccdSmrg newdeplibs="$newdeplibs $i" 36244456fccdSmrg fi 36254456fccdSmrg done 36264456fccdSmrg else 36274456fccdSmrg # Error occurred in the first compile. Let's try to salvage 36284456fccdSmrg # the situation: Compile a separate program for each library. 36294456fccdSmrg for i in $deplibs; do 36304456fccdSmrg name=`expr $i : '-l\(.*\)'` 36314456fccdSmrg # If $name is empty we are operating on a -L argument. 36324456fccdSmrg if test "$name" != "" && test "$name" != "0"; then 36334456fccdSmrg $rm conftest 363442d69509Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 36354456fccdSmrg ldd_output=`ldd conftest` 36364456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36374456fccdSmrg case " $predeps $postdeps " in 36384456fccdSmrg *" $i "*) 36394456fccdSmrg newdeplibs="$newdeplibs $i" 36404456fccdSmrg i="" 36414456fccdSmrg ;; 36424456fccdSmrg esac 36434456fccdSmrg fi 36444456fccdSmrg if test -n "$i" ; then 36454456fccdSmrg libname=`eval \\$echo \"$libname_spec\"` 36464456fccdSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 36474456fccdSmrg set dummy $deplib_matches 36484456fccdSmrg deplib_match=$2 36494456fccdSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36504456fccdSmrg newdeplibs="$newdeplibs $i" 36514456fccdSmrg else 36524456fccdSmrg droppeddeps=yes 36534456fccdSmrg $echo 36544456fccdSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 36554456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 36564456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 36574456fccdSmrg $echo "*** shared version of the library, which you do not appear to have" 36584456fccdSmrg $echo "*** because a test_compile did reveal that the linker did not use this one" 36594456fccdSmrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 36604456fccdSmrg fi 36614456fccdSmrg fi 36624456fccdSmrg else 36634456fccdSmrg droppeddeps=yes 36644456fccdSmrg $echo 36654456fccdSmrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 366642d69509Smrg $echo "*** make it link in! You will probably need to install it or some" 36674456fccdSmrg $echo "*** library that it depends on before this library will be fully" 36684456fccdSmrg $echo "*** functional. Installing it before continuing would be even better." 36694456fccdSmrg fi 36704456fccdSmrg else 36714456fccdSmrg newdeplibs="$newdeplibs $i" 36724456fccdSmrg fi 36734456fccdSmrg done 36744456fccdSmrg fi 36754456fccdSmrg ;; 36764456fccdSmrg file_magic*) 36774456fccdSmrg set dummy $deplibs_check_method 36784456fccdSmrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36794456fccdSmrg for a_deplib in $deplibs; do 36804456fccdSmrg name=`expr $a_deplib : '-l\(.*\)'` 36814456fccdSmrg # If $name is empty we are operating on a -L argument. 36824456fccdSmrg if test "$name" != "" && test "$name" != "0"; then 36834456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36844456fccdSmrg case " $predeps $postdeps " in 36854456fccdSmrg *" $a_deplib "*) 36864456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 36874456fccdSmrg a_deplib="" 36884456fccdSmrg ;; 36894456fccdSmrg esac 36904456fccdSmrg fi 36914456fccdSmrg if test -n "$a_deplib" ; then 36924456fccdSmrg libname=`eval \\$echo \"$libname_spec\"` 36934456fccdSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 36944456fccdSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 36954456fccdSmrg for potent_lib in $potential_libs; do 36964456fccdSmrg # Follow soft links. 36974456fccdSmrg if ls -lLd "$potent_lib" 2>/dev/null \ 36984456fccdSmrg | grep " -> " >/dev/null; then 36994456fccdSmrg continue 37004456fccdSmrg fi 37014456fccdSmrg # The statement above tries to avoid entering an 37024456fccdSmrg # endless loop below, in case of cyclic links. 37034456fccdSmrg # We might still enter an endless loop, since a link 37044456fccdSmrg # loop can be closed while we follow links, 37054456fccdSmrg # but so what? 37064456fccdSmrg potlib="$potent_lib" 37074456fccdSmrg while test -h "$potlib" 2>/dev/null; do 37084456fccdSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 37094456fccdSmrg case $potliblink in 37104456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 37114456fccdSmrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 37124456fccdSmrg esac 37134456fccdSmrg done 37144456fccdSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 37154456fccdSmrg | ${SED} 10q \ 37164456fccdSmrg | $EGREP "$file_magic_regex" > /dev/null; then 37174456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 37184456fccdSmrg a_deplib="" 37194456fccdSmrg break 2 37204456fccdSmrg fi 37214456fccdSmrg done 37224456fccdSmrg done 37234456fccdSmrg fi 37244456fccdSmrg if test -n "$a_deplib" ; then 37254456fccdSmrg droppeddeps=yes 37264456fccdSmrg $echo 37274456fccdSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 37284456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 37294456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 37304456fccdSmrg $echo "*** shared version of the library, which you do not appear to have" 37314456fccdSmrg $echo "*** because I did check the linker path looking for a file starting" 37324456fccdSmrg if test -z "$potlib" ; then 37334456fccdSmrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 37344456fccdSmrg else 37354456fccdSmrg $echo "*** with $libname and none of the candidates passed a file format test" 37364456fccdSmrg $echo "*** using a file magic. Last file checked: $potlib" 37374456fccdSmrg fi 37384456fccdSmrg fi 37394456fccdSmrg else 37404456fccdSmrg # Add a -L argument. 37414456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 37424456fccdSmrg fi 37434456fccdSmrg done # Gone through all deplibs. 37444456fccdSmrg ;; 37454456fccdSmrg match_pattern*) 37464456fccdSmrg set dummy $deplibs_check_method 37474456fccdSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 37484456fccdSmrg for a_deplib in $deplibs; do 37494456fccdSmrg name=`expr $a_deplib : '-l\(.*\)'` 37504456fccdSmrg # If $name is empty we are operating on a -L argument. 37514456fccdSmrg if test -n "$name" && test "$name" != "0"; then 37524456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37534456fccdSmrg case " $predeps $postdeps " in 37544456fccdSmrg *" $a_deplib "*) 37554456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 37564456fccdSmrg a_deplib="" 37574456fccdSmrg ;; 37584456fccdSmrg esac 37594456fccdSmrg fi 37604456fccdSmrg if test -n "$a_deplib" ; then 37614456fccdSmrg libname=`eval \\$echo \"$libname_spec\"` 37624456fccdSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37634456fccdSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37644456fccdSmrg for potent_lib in $potential_libs; do 37654456fccdSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 37664456fccdSmrg if eval $echo \"$potent_lib\" 2>/dev/null \ 37674456fccdSmrg | ${SED} 10q \ 37684456fccdSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 37694456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 37704456fccdSmrg a_deplib="" 37714456fccdSmrg break 2 37724456fccdSmrg fi 37734456fccdSmrg done 37744456fccdSmrg done 37754456fccdSmrg fi 37764456fccdSmrg if test -n "$a_deplib" ; then 37774456fccdSmrg droppeddeps=yes 37784456fccdSmrg $echo 37794456fccdSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 37804456fccdSmrg $echo "*** I have the capability to make that library automatically link in when" 37814456fccdSmrg $echo "*** you link to this library. But I can only do this if you have a" 37824456fccdSmrg $echo "*** shared version of the library, which you do not appear to have" 37834456fccdSmrg $echo "*** because I did check the linker path looking for a file starting" 37844456fccdSmrg if test -z "$potlib" ; then 37854456fccdSmrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 37864456fccdSmrg else 37874456fccdSmrg $echo "*** with $libname and none of the candidates passed a file format test" 37884456fccdSmrg $echo "*** using a regex pattern. Last file checked: $potlib" 37894456fccdSmrg fi 37904456fccdSmrg fi 37914456fccdSmrg else 37924456fccdSmrg # Add a -L argument. 37934456fccdSmrg newdeplibs="$newdeplibs $a_deplib" 37944456fccdSmrg fi 37954456fccdSmrg done # Gone through all deplibs. 37964456fccdSmrg ;; 37974456fccdSmrg none | unknown | *) 37984456fccdSmrg newdeplibs="" 37994456fccdSmrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 38004456fccdSmrg -e 's/ -[LR][^ ]*//g'` 38014456fccdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 38024456fccdSmrg for i in $predeps $postdeps ; do 38034456fccdSmrg # can't use Xsed below, because $i might contain '/' 38044456fccdSmrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 38054456fccdSmrg done 38064456fccdSmrg fi 38074456fccdSmrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 38084456fccdSmrg | grep . >/dev/null; then 38094456fccdSmrg $echo 38104456fccdSmrg if test "X$deplibs_check_method" = "Xnone"; then 38114456fccdSmrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 38124456fccdSmrg else 38134456fccdSmrg $echo "*** Warning: inter-library dependencies are not known to be supported." 38144456fccdSmrg fi 38154456fccdSmrg $echo "*** All declared inter-library dependencies are being dropped." 38164456fccdSmrg droppeddeps=yes 38174456fccdSmrg fi 38184456fccdSmrg ;; 38194456fccdSmrg esac 38204456fccdSmrg versuffix=$versuffix_save 38214456fccdSmrg major=$major_save 38224456fccdSmrg release=$release_save 38234456fccdSmrg libname=$libname_save 38244456fccdSmrg name=$name_save 38254456fccdSmrg 38264456fccdSmrg case $host in 38274456fccdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 38284456fccdSmrg # On Rhapsody replace the C library is the System framework 38294456fccdSmrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 38304456fccdSmrg ;; 38314456fccdSmrg esac 38324456fccdSmrg 38334456fccdSmrg if test "$droppeddeps" = yes; then 38344456fccdSmrg if test "$module" = yes; then 38354456fccdSmrg $echo 38364456fccdSmrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 38374456fccdSmrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 38384456fccdSmrg $echo "*** a static module, that should work as long as the dlopening" 38394456fccdSmrg $echo "*** application is linked with the -dlopen flag." 38404456fccdSmrg if test -z "$global_symbol_pipe"; then 38414456fccdSmrg $echo 38424456fccdSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 38434456fccdSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 38444456fccdSmrg $echo "*** not find such a program. So, this module is probably useless." 38454456fccdSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 38464456fccdSmrg fi 38474456fccdSmrg if test "$build_old_libs" = no; then 38484456fccdSmrg oldlibs="$output_objdir/$libname.$libext" 38494456fccdSmrg build_libtool_libs=module 38504456fccdSmrg build_old_libs=yes 38514456fccdSmrg else 38524456fccdSmrg build_libtool_libs=no 38534456fccdSmrg fi 38544456fccdSmrg else 38554456fccdSmrg $echo "*** The inter-library dependencies that have been dropped here will be" 38564456fccdSmrg $echo "*** automatically added whenever a program is linked with this library" 38574456fccdSmrg $echo "*** or is declared to -dlopen it." 38584456fccdSmrg 38594456fccdSmrg if test "$allow_undefined" = no; then 38604456fccdSmrg $echo 38614456fccdSmrg $echo "*** Since this library must not contain undefined symbols," 38624456fccdSmrg $echo "*** because either the platform does not support them or" 38634456fccdSmrg $echo "*** it was explicitly requested with -no-undefined," 38644456fccdSmrg $echo "*** libtool will only create a static version of it." 38654456fccdSmrg if test "$build_old_libs" = no; then 38664456fccdSmrg oldlibs="$output_objdir/$libname.$libext" 38674456fccdSmrg build_libtool_libs=module 38684456fccdSmrg build_old_libs=yes 38694456fccdSmrg else 38704456fccdSmrg build_libtool_libs=no 38714456fccdSmrg fi 38724456fccdSmrg fi 38734456fccdSmrg fi 38744456fccdSmrg fi 38754456fccdSmrg # Done checking deplibs! 38764456fccdSmrg deplibs=$newdeplibs 38774456fccdSmrg fi 38784456fccdSmrg 38794456fccdSmrg 38804456fccdSmrg # move library search paths that coincide with paths to not yet 38814456fccdSmrg # installed libraries to the beginning of the library search list 38824456fccdSmrg new_libs= 38834456fccdSmrg for path in $notinst_path; do 38844456fccdSmrg case " $new_libs " in 38854456fccdSmrg *" -L$path/$objdir "*) ;; 38864456fccdSmrg *) 38874456fccdSmrg case " $deplibs " in 38884456fccdSmrg *" -L$path/$objdir "*) 38894456fccdSmrg new_libs="$new_libs -L$path/$objdir" ;; 38904456fccdSmrg esac 38914456fccdSmrg ;; 38924456fccdSmrg esac 38934456fccdSmrg done 38944456fccdSmrg for deplib in $deplibs; do 38954456fccdSmrg case $deplib in 38964456fccdSmrg -L*) 38974456fccdSmrg case " $new_libs " in 38984456fccdSmrg *" $deplib "*) ;; 38994456fccdSmrg *) new_libs="$new_libs $deplib" ;; 39004456fccdSmrg esac 39014456fccdSmrg ;; 39024456fccdSmrg *) new_libs="$new_libs $deplib" ;; 39034456fccdSmrg esac 39044456fccdSmrg done 39054456fccdSmrg deplibs="$new_libs" 39064456fccdSmrg 39074456fccdSmrg 39084456fccdSmrg # All the library-specific variables (install_libdir is set above). 39094456fccdSmrg library_names= 39104456fccdSmrg old_library= 39114456fccdSmrg dlname= 39124456fccdSmrg 39134456fccdSmrg # Test again, we may have decided not to build it any more 39144456fccdSmrg if test "$build_libtool_libs" = yes; then 39154456fccdSmrg if test "$hardcode_into_libs" = yes; then 39164456fccdSmrg # Hardcode the library paths 39174456fccdSmrg hardcode_libdirs= 39184456fccdSmrg dep_rpath= 39194456fccdSmrg rpath="$finalize_rpath" 39204456fccdSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 39214456fccdSmrg for libdir in $rpath; do 39224456fccdSmrg if test -n "$hardcode_libdir_flag_spec"; then 39234456fccdSmrg if test -n "$hardcode_libdir_separator"; then 39244456fccdSmrg if test -z "$hardcode_libdirs"; then 39254456fccdSmrg hardcode_libdirs="$libdir" 39264456fccdSmrg else 39274456fccdSmrg # Just accumulate the unique libdirs. 39284456fccdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 39294456fccdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 39304456fccdSmrg ;; 39314456fccdSmrg *) 39324456fccdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 39334456fccdSmrg ;; 39344456fccdSmrg esac 39354456fccdSmrg fi 39364456fccdSmrg else 39374456fccdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 39384456fccdSmrg dep_rpath="$dep_rpath $flag" 39394456fccdSmrg fi 39404456fccdSmrg elif test -n "$runpath_var"; then 39414456fccdSmrg case "$perm_rpath " in 39424456fccdSmrg *" $libdir "*) ;; 39434456fccdSmrg *) perm_rpath="$perm_rpath $libdir" ;; 39444456fccdSmrg esac 39454456fccdSmrg fi 39464456fccdSmrg done 39474456fccdSmrg # Substitute the hardcoded libdirs into the rpath. 39484456fccdSmrg if test -n "$hardcode_libdir_separator" && 39494456fccdSmrg test -n "$hardcode_libdirs"; then 39504456fccdSmrg libdir="$hardcode_libdirs" 39514456fccdSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 395242d69509Smrg case $archive_cmds in 395342d69509Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 395442d69509Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 395542d69509Smrg esac 39564456fccdSmrg else 39574456fccdSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 39584456fccdSmrg fi 39594456fccdSmrg fi 39604456fccdSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 39614456fccdSmrg # We should set the runpath_var. 39624456fccdSmrg rpath= 39634456fccdSmrg for dir in $perm_rpath; do 39644456fccdSmrg rpath="$rpath$dir:" 39654456fccdSmrg done 39664456fccdSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 39674456fccdSmrg fi 39684456fccdSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 39694456fccdSmrg fi 39704456fccdSmrg 39714456fccdSmrg shlibpath="$finalize_shlibpath" 39724456fccdSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 39734456fccdSmrg if test -n "$shlibpath"; then 39744456fccdSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 39754456fccdSmrg fi 39764456fccdSmrg 39774456fccdSmrg # Get the real and link names of the library. 39784456fccdSmrg eval shared_ext=\"$shrext_cmds\" 39794456fccdSmrg eval library_names=\"$library_names_spec\" 39804456fccdSmrg set dummy $library_names 39814456fccdSmrg realname="$2" 39824456fccdSmrg shift; shift 39834456fccdSmrg 39844456fccdSmrg if test -n "$soname_spec"; then 39854456fccdSmrg eval soname=\"$soname_spec\" 39864456fccdSmrg else 39874456fccdSmrg soname="$realname" 39884456fccdSmrg fi 39894456fccdSmrg if test -z "$dlname"; then 39904456fccdSmrg dlname=$soname 39914456fccdSmrg fi 39924456fccdSmrg 39934456fccdSmrg lib="$output_objdir/$realname" 39944456fccdSmrg linknames= 39954456fccdSmrg for link 39964456fccdSmrg do 39974456fccdSmrg linknames="$linknames $link" 39984456fccdSmrg done 39994456fccdSmrg 40004456fccdSmrg # Use standard objects if they are pic 40014456fccdSmrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 40024456fccdSmrg 40034456fccdSmrg # Prepare the list of exported symbols 40044456fccdSmrg if test -z "$export_symbols"; then 40054456fccdSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 40064456fccdSmrg $show "generating symbol list for \`$libname.la'" 40074456fccdSmrg export_symbols="$output_objdir/$libname.exp" 40084456fccdSmrg $run $rm $export_symbols 40094456fccdSmrg cmds=$export_symbols_cmds 40104456fccdSmrg save_ifs="$IFS"; IFS='~' 40114456fccdSmrg for cmd in $cmds; do 40124456fccdSmrg IFS="$save_ifs" 40134456fccdSmrg eval cmd=\"$cmd\" 40144456fccdSmrg if len=`expr "X$cmd" : ".*"` && 40154456fccdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40164456fccdSmrg $show "$cmd" 40174456fccdSmrg $run eval "$cmd" || exit $? 40184456fccdSmrg skipped_export=false 40194456fccdSmrg else 40204456fccdSmrg # The command line is too long to execute in one step. 40214456fccdSmrg $show "using reloadable object file for export list..." 40224456fccdSmrg skipped_export=: 40234456fccdSmrg # Break out early, otherwise skipped_export may be 40244456fccdSmrg # set to false by a later but shorter cmd. 40254456fccdSmrg break 40264456fccdSmrg fi 40274456fccdSmrg done 40284456fccdSmrg IFS="$save_ifs" 40294456fccdSmrg if test -n "$export_symbols_regex"; then 40304456fccdSmrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 40314456fccdSmrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 40324456fccdSmrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 40334456fccdSmrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 40344456fccdSmrg fi 40354456fccdSmrg fi 40364456fccdSmrg fi 40374456fccdSmrg 40384456fccdSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 40394456fccdSmrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 40404456fccdSmrg fi 40414456fccdSmrg 40424456fccdSmrg tmp_deplibs= 40434456fccdSmrg for test_deplib in $deplibs; do 40444456fccdSmrg case " $convenience " in 40454456fccdSmrg *" $test_deplib "*) ;; 40464456fccdSmrg *) 40474456fccdSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 40484456fccdSmrg ;; 40494456fccdSmrg esac 40504456fccdSmrg done 40514456fccdSmrg deplibs="$tmp_deplibs" 40524456fccdSmrg 40534456fccdSmrg if test -n "$convenience"; then 40544456fccdSmrg if test -n "$whole_archive_flag_spec"; then 40554456fccdSmrg save_libobjs=$libobjs 40564456fccdSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 40574456fccdSmrg else 40584456fccdSmrg gentop="$output_objdir/${outputname}x" 40594456fccdSmrg generated="$generated $gentop" 40604456fccdSmrg 40614456fccdSmrg func_extract_archives $gentop $convenience 40624456fccdSmrg libobjs="$libobjs $func_extract_archives_result" 40634456fccdSmrg fi 40644456fccdSmrg fi 40654456fccdSmrg 40664456fccdSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 40674456fccdSmrg eval flag=\"$thread_safe_flag_spec\" 40684456fccdSmrg linker_flags="$linker_flags $flag" 40694456fccdSmrg fi 40704456fccdSmrg 40714456fccdSmrg # Make a backup of the uninstalled library when relinking 40724456fccdSmrg if test "$mode" = relink; then 40734456fccdSmrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 40744456fccdSmrg fi 40754456fccdSmrg 40764456fccdSmrg # Do each of the archive commands. 40774456fccdSmrg if test "$module" = yes && test -n "$module_cmds" ; then 40784456fccdSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 40794456fccdSmrg eval test_cmds=\"$module_expsym_cmds\" 40804456fccdSmrg cmds=$module_expsym_cmds 40814456fccdSmrg else 40824456fccdSmrg eval test_cmds=\"$module_cmds\" 40834456fccdSmrg cmds=$module_cmds 40844456fccdSmrg fi 40854456fccdSmrg else 40864456fccdSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 40874456fccdSmrg eval test_cmds=\"$archive_expsym_cmds\" 40884456fccdSmrg cmds=$archive_expsym_cmds 40894456fccdSmrg else 40904456fccdSmrg eval test_cmds=\"$archive_cmds\" 40914456fccdSmrg cmds=$archive_cmds 40924456fccdSmrg fi 40934456fccdSmrg fi 40944456fccdSmrg 40954456fccdSmrg if test "X$skipped_export" != "X:" && 40964456fccdSmrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 40974456fccdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40984456fccdSmrg : 40994456fccdSmrg else 41004456fccdSmrg # The command line is too long to link in one step, link piecewise. 41014456fccdSmrg $echo "creating reloadable object files..." 41024456fccdSmrg 41034456fccdSmrg # Save the value of $output and $libobjs because we want to 41044456fccdSmrg # use them later. If we have whole_archive_flag_spec, we 41054456fccdSmrg # want to use save_libobjs as it was before 41064456fccdSmrg # whole_archive_flag_spec was expanded, because we can't 41074456fccdSmrg # assume the linker understands whole_archive_flag_spec. 41084456fccdSmrg # This may have to be revisited, in case too many 41094456fccdSmrg # convenience libraries get linked in and end up exceeding 41104456fccdSmrg # the spec. 41114456fccdSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 41124456fccdSmrg save_libobjs=$libobjs 41134456fccdSmrg fi 41144456fccdSmrg save_output=$output 41154456fccdSmrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 41164456fccdSmrg 41174456fccdSmrg # Clear the reloadable object creation command queue and 41184456fccdSmrg # initialize k to one. 41194456fccdSmrg test_cmds= 41204456fccdSmrg concat_cmds= 41214456fccdSmrg objlist= 41224456fccdSmrg delfiles= 41234456fccdSmrg last_robj= 41244456fccdSmrg k=1 41254456fccdSmrg output=$output_objdir/$output_la-${k}.$objext 41264456fccdSmrg # Loop over the list of objects to be linked. 41274456fccdSmrg for obj in $save_libobjs 41284456fccdSmrg do 41294456fccdSmrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 41304456fccdSmrg if test "X$objlist" = X || 41314456fccdSmrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41324456fccdSmrg test "$len" -le "$max_cmd_len"; }; then 41334456fccdSmrg objlist="$objlist $obj" 41344456fccdSmrg else 41354456fccdSmrg # The command $test_cmds is almost too long, add a 41364456fccdSmrg # command to the queue. 41374456fccdSmrg if test "$k" -eq 1 ; then 41384456fccdSmrg # The first file doesn't have a previous command to add. 41394456fccdSmrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 41404456fccdSmrg else 41414456fccdSmrg # All subsequent reloadable object files will link in 41424456fccdSmrg # the last one created. 41434456fccdSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 41444456fccdSmrg fi 41454456fccdSmrg last_robj=$output_objdir/$output_la-${k}.$objext 41464456fccdSmrg k=`expr $k + 1` 41474456fccdSmrg output=$output_objdir/$output_la-${k}.$objext 41484456fccdSmrg objlist=$obj 41494456fccdSmrg len=1 41504456fccdSmrg fi 41514456fccdSmrg done 41524456fccdSmrg # Handle the remaining objects by creating one last 41534456fccdSmrg # reloadable object file. All subsequent reloadable object 41544456fccdSmrg # files will link in the last one created. 41554456fccdSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 41564456fccdSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 41574456fccdSmrg 41584456fccdSmrg if ${skipped_export-false}; then 41594456fccdSmrg $show "generating symbol list for \`$libname.la'" 41604456fccdSmrg export_symbols="$output_objdir/$libname.exp" 41614456fccdSmrg $run $rm $export_symbols 41624456fccdSmrg libobjs=$output 41634456fccdSmrg # Append the command to create the export file. 41644456fccdSmrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 41654456fccdSmrg fi 41664456fccdSmrg 41674456fccdSmrg # Set up a command to remove the reloadable object files 41684456fccdSmrg # after they are used. 41694456fccdSmrg i=0 41704456fccdSmrg while test "$i" -lt "$k" 41714456fccdSmrg do 41724456fccdSmrg i=`expr $i + 1` 41734456fccdSmrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 41744456fccdSmrg done 41754456fccdSmrg 41764456fccdSmrg $echo "creating a temporary reloadable object file: $output" 41774456fccdSmrg 41784456fccdSmrg # Loop through the commands generated above and execute them. 41794456fccdSmrg save_ifs="$IFS"; IFS='~' 41804456fccdSmrg for cmd in $concat_cmds; do 41814456fccdSmrg IFS="$save_ifs" 41824456fccdSmrg $show "$cmd" 41834456fccdSmrg $run eval "$cmd" || exit $? 41844456fccdSmrg done 41854456fccdSmrg IFS="$save_ifs" 41864456fccdSmrg 41874456fccdSmrg libobjs=$output 41884456fccdSmrg # Restore the value of output. 41894456fccdSmrg output=$save_output 41904456fccdSmrg 41914456fccdSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 41924456fccdSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 41934456fccdSmrg fi 41944456fccdSmrg # Expand the library linking commands again to reset the 41954456fccdSmrg # value of $libobjs for piecewise linking. 41964456fccdSmrg 41974456fccdSmrg # Do each of the archive commands. 41984456fccdSmrg if test "$module" = yes && test -n "$module_cmds" ; then 41994456fccdSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 42004456fccdSmrg cmds=$module_expsym_cmds 42014456fccdSmrg else 42024456fccdSmrg cmds=$module_cmds 42034456fccdSmrg fi 42044456fccdSmrg else 42054456fccdSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 42064456fccdSmrg cmds=$archive_expsym_cmds 42074456fccdSmrg else 42084456fccdSmrg cmds=$archive_cmds 42094456fccdSmrg fi 42104456fccdSmrg fi 42114456fccdSmrg 42124456fccdSmrg # Append the command to remove the reloadable object files 42134456fccdSmrg # to the just-reset $cmds. 42144456fccdSmrg eval cmds=\"\$cmds~\$rm $delfiles\" 42154456fccdSmrg fi 42164456fccdSmrg save_ifs="$IFS"; IFS='~' 42174456fccdSmrg for cmd in $cmds; do 42184456fccdSmrg IFS="$save_ifs" 42194456fccdSmrg eval cmd=\"$cmd\" 42204456fccdSmrg $show "$cmd" 42214456fccdSmrg $run eval "$cmd" || { 42224456fccdSmrg lt_exit=$? 42234456fccdSmrg 42244456fccdSmrg # Restore the uninstalled library and exit 42254456fccdSmrg if test "$mode" = relink; then 42264456fccdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 42274456fccdSmrg fi 42284456fccdSmrg 42294456fccdSmrg exit $lt_exit 42304456fccdSmrg } 42314456fccdSmrg done 42324456fccdSmrg IFS="$save_ifs" 42334456fccdSmrg 42344456fccdSmrg # Restore the uninstalled library and exit 42354456fccdSmrg if test "$mode" = relink; then 42364456fccdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 42374456fccdSmrg 42384456fccdSmrg if test -n "$convenience"; then 42394456fccdSmrg if test -z "$whole_archive_flag_spec"; then 42404456fccdSmrg $show "${rm}r $gentop" 42414456fccdSmrg $run ${rm}r "$gentop" 42424456fccdSmrg fi 42434456fccdSmrg fi 42444456fccdSmrg 42454456fccdSmrg exit $EXIT_SUCCESS 42464456fccdSmrg fi 42474456fccdSmrg 42484456fccdSmrg # Create links to the real library. 42494456fccdSmrg for linkname in $linknames; do 42504456fccdSmrg if test "$realname" != "$linkname"; then 42514456fccdSmrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 42524456fccdSmrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 42534456fccdSmrg fi 42544456fccdSmrg done 42554456fccdSmrg 42564456fccdSmrg # If -module or -export-dynamic was specified, set the dlname. 42574456fccdSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 42584456fccdSmrg # On all known operating systems, these are identical. 42594456fccdSmrg dlname="$soname" 42604456fccdSmrg fi 42614456fccdSmrg fi 42624456fccdSmrg ;; 42634456fccdSmrg 42644456fccdSmrg obj) 426542d69509Smrg case " $deplibs" in 426642d69509Smrg *\ -l* | *\ -L*) 426742d69509Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 426842d69509Smrg esac 42694456fccdSmrg 42704456fccdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 42714456fccdSmrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 42724456fccdSmrg fi 42734456fccdSmrg 42744456fccdSmrg if test -n "$rpath"; then 42754456fccdSmrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 42764456fccdSmrg fi 42774456fccdSmrg 42784456fccdSmrg if test -n "$xrpath"; then 42794456fccdSmrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 42804456fccdSmrg fi 42814456fccdSmrg 42824456fccdSmrg if test -n "$vinfo"; then 42834456fccdSmrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 42844456fccdSmrg fi 42854456fccdSmrg 42864456fccdSmrg if test -n "$release"; then 42874456fccdSmrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 42884456fccdSmrg fi 42894456fccdSmrg 42904456fccdSmrg case $output in 42914456fccdSmrg *.lo) 42924456fccdSmrg if test -n "$objs$old_deplibs"; then 42934456fccdSmrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 42944456fccdSmrg exit $EXIT_FAILURE 42954456fccdSmrg fi 42964456fccdSmrg libobj="$output" 42974456fccdSmrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 42984456fccdSmrg ;; 42994456fccdSmrg *) 43004456fccdSmrg libobj= 43014456fccdSmrg obj="$output" 43024456fccdSmrg ;; 43034456fccdSmrg esac 43044456fccdSmrg 43054456fccdSmrg # Delete the old objects. 43064456fccdSmrg $run $rm $obj $libobj 43074456fccdSmrg 43084456fccdSmrg # Objects from convenience libraries. This assumes 43094456fccdSmrg # single-version convenience libraries. Whenever we create 43104456fccdSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 43114456fccdSmrg # the extraction. 43124456fccdSmrg reload_conv_objs= 43134456fccdSmrg gentop= 43144456fccdSmrg # reload_cmds runs $LD directly, so let us get rid of 431542d69509Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 431642d69509Smrg # turning comma into space.. 43174456fccdSmrg wl= 43184456fccdSmrg 43194456fccdSmrg if test -n "$convenience"; then 43204456fccdSmrg if test -n "$whole_archive_flag_spec"; then 432142d69509Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 432242d69509Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 43234456fccdSmrg else 43244456fccdSmrg gentop="$output_objdir/${obj}x" 43254456fccdSmrg generated="$generated $gentop" 43264456fccdSmrg 43274456fccdSmrg func_extract_archives $gentop $convenience 43284456fccdSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 43294456fccdSmrg fi 43304456fccdSmrg fi 43314456fccdSmrg 43324456fccdSmrg # Create the old-style object. 43334456fccdSmrg 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 43344456fccdSmrg 43354456fccdSmrg output="$obj" 43364456fccdSmrg cmds=$reload_cmds 43374456fccdSmrg save_ifs="$IFS"; IFS='~' 43384456fccdSmrg for cmd in $cmds; do 43394456fccdSmrg IFS="$save_ifs" 43404456fccdSmrg eval cmd=\"$cmd\" 43414456fccdSmrg $show "$cmd" 43424456fccdSmrg $run eval "$cmd" || exit $? 43434456fccdSmrg done 43444456fccdSmrg IFS="$save_ifs" 43454456fccdSmrg 43464456fccdSmrg # Exit if we aren't doing a library object file. 43474456fccdSmrg if test -z "$libobj"; then 43484456fccdSmrg if test -n "$gentop"; then 43494456fccdSmrg $show "${rm}r $gentop" 43504456fccdSmrg $run ${rm}r $gentop 43514456fccdSmrg fi 43524456fccdSmrg 43534456fccdSmrg exit $EXIT_SUCCESS 43544456fccdSmrg fi 43554456fccdSmrg 43564456fccdSmrg if test "$build_libtool_libs" != yes; then 43574456fccdSmrg if test -n "$gentop"; then 43584456fccdSmrg $show "${rm}r $gentop" 43594456fccdSmrg $run ${rm}r $gentop 43604456fccdSmrg fi 43614456fccdSmrg 43624456fccdSmrg # Create an invalid libtool object if no PIC, so that we don't 43634456fccdSmrg # accidentally link it into a program. 43644456fccdSmrg # $show "echo timestamp > $libobj" 43654456fccdSmrg # $run eval "echo timestamp > $libobj" || exit $? 43664456fccdSmrg exit $EXIT_SUCCESS 43674456fccdSmrg fi 43684456fccdSmrg 43694456fccdSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 43704456fccdSmrg # Only do commands if we really have different PIC objects. 43714456fccdSmrg reload_objs="$libobjs $reload_conv_objs" 43724456fccdSmrg output="$libobj" 43734456fccdSmrg cmds=$reload_cmds 43744456fccdSmrg save_ifs="$IFS"; IFS='~' 43754456fccdSmrg for cmd in $cmds; do 43764456fccdSmrg IFS="$save_ifs" 43774456fccdSmrg eval cmd=\"$cmd\" 43784456fccdSmrg $show "$cmd" 43794456fccdSmrg $run eval "$cmd" || exit $? 43804456fccdSmrg done 43814456fccdSmrg IFS="$save_ifs" 43824456fccdSmrg fi 43834456fccdSmrg 43844456fccdSmrg if test -n "$gentop"; then 43854456fccdSmrg $show "${rm}r $gentop" 43864456fccdSmrg $run ${rm}r $gentop 43874456fccdSmrg fi 43884456fccdSmrg 43894456fccdSmrg exit $EXIT_SUCCESS 43904456fccdSmrg ;; 43914456fccdSmrg 43924456fccdSmrg prog) 43934456fccdSmrg case $host in 43944456fccdSmrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 43954456fccdSmrg esac 43964456fccdSmrg if test -n "$vinfo"; then 43974456fccdSmrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 43984456fccdSmrg fi 43994456fccdSmrg 44004456fccdSmrg if test -n "$release"; then 44014456fccdSmrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 44024456fccdSmrg fi 44034456fccdSmrg 44044456fccdSmrg if test "$preload" = yes; then 44054456fccdSmrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 44064456fccdSmrg test "$dlopen_self_static" = unknown; then 44074456fccdSmrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 44084456fccdSmrg fi 44094456fccdSmrg fi 44104456fccdSmrg 44114456fccdSmrg case $host in 44124456fccdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 44134456fccdSmrg # On Rhapsody replace the C library is the System framework 44144456fccdSmrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44154456fccdSmrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 44164456fccdSmrg ;; 44174456fccdSmrg esac 44184456fccdSmrg 44194456fccdSmrg case $host in 44204456fccdSmrg *darwin*) 44214456fccdSmrg # Don't allow lazy linking, it breaks C++ global constructors 44224456fccdSmrg if test "$tagname" = CXX ; then 44234456fccdSmrg compile_command="$compile_command ${wl}-bind_at_load" 44244456fccdSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 44254456fccdSmrg fi 44264456fccdSmrg ;; 44274456fccdSmrg esac 44284456fccdSmrg 44294456fccdSmrg 44304456fccdSmrg # move library search paths that coincide with paths to not yet 44314456fccdSmrg # installed libraries to the beginning of the library search list 44324456fccdSmrg new_libs= 44334456fccdSmrg for path in $notinst_path; do 44344456fccdSmrg case " $new_libs " in 44354456fccdSmrg *" -L$path/$objdir "*) ;; 44364456fccdSmrg *) 44374456fccdSmrg case " $compile_deplibs " in 44384456fccdSmrg *" -L$path/$objdir "*) 44394456fccdSmrg new_libs="$new_libs -L$path/$objdir" ;; 44404456fccdSmrg esac 44414456fccdSmrg ;; 44424456fccdSmrg esac 44434456fccdSmrg done 44444456fccdSmrg for deplib in $compile_deplibs; do 44454456fccdSmrg case $deplib in 44464456fccdSmrg -L*) 44474456fccdSmrg case " $new_libs " in 44484456fccdSmrg *" $deplib "*) ;; 44494456fccdSmrg *) new_libs="$new_libs $deplib" ;; 44504456fccdSmrg esac 44514456fccdSmrg ;; 44524456fccdSmrg *) new_libs="$new_libs $deplib" ;; 44534456fccdSmrg esac 44544456fccdSmrg done 44554456fccdSmrg compile_deplibs="$new_libs" 44564456fccdSmrg 44574456fccdSmrg 44584456fccdSmrg compile_command="$compile_command $compile_deplibs" 44594456fccdSmrg finalize_command="$finalize_command $finalize_deplibs" 44604456fccdSmrg 44614456fccdSmrg if test -n "$rpath$xrpath"; then 44624456fccdSmrg # If the user specified any rpath flags, then add them. 44634456fccdSmrg for libdir in $rpath $xrpath; do 44644456fccdSmrg # This is the magic to use -rpath. 44654456fccdSmrg case "$finalize_rpath " in 44664456fccdSmrg *" $libdir "*) ;; 44674456fccdSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 44684456fccdSmrg esac 44694456fccdSmrg done 44704456fccdSmrg fi 44714456fccdSmrg 44724456fccdSmrg # Now hardcode the library paths 44734456fccdSmrg rpath= 44744456fccdSmrg hardcode_libdirs= 44754456fccdSmrg for libdir in $compile_rpath $finalize_rpath; do 44764456fccdSmrg if test -n "$hardcode_libdir_flag_spec"; then 44774456fccdSmrg if test -n "$hardcode_libdir_separator"; then 44784456fccdSmrg if test -z "$hardcode_libdirs"; then 44794456fccdSmrg hardcode_libdirs="$libdir" 44804456fccdSmrg else 44814456fccdSmrg # Just accumulate the unique libdirs. 44824456fccdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44834456fccdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44844456fccdSmrg ;; 44854456fccdSmrg *) 44864456fccdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44874456fccdSmrg ;; 44884456fccdSmrg esac 44894456fccdSmrg fi 44904456fccdSmrg else 44914456fccdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 44924456fccdSmrg rpath="$rpath $flag" 44934456fccdSmrg fi 44944456fccdSmrg elif test -n "$runpath_var"; then 44954456fccdSmrg case "$perm_rpath " in 44964456fccdSmrg *" $libdir "*) ;; 44974456fccdSmrg *) perm_rpath="$perm_rpath $libdir" ;; 44984456fccdSmrg esac 44994456fccdSmrg fi 45004456fccdSmrg case $host in 45014456fccdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 45024456fccdSmrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 45034456fccdSmrg case :$dllsearchpath: in 45044456fccdSmrg *":$libdir:"*) ;; 45054456fccdSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 45064456fccdSmrg esac 45074456fccdSmrg case :$dllsearchpath: in 45084456fccdSmrg *":$testbindir:"*) ;; 45094456fccdSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 45104456fccdSmrg esac 45114456fccdSmrg ;; 45124456fccdSmrg esac 45134456fccdSmrg done 45144456fccdSmrg # Substitute the hardcoded libdirs into the rpath. 45154456fccdSmrg if test -n "$hardcode_libdir_separator" && 45164456fccdSmrg test -n "$hardcode_libdirs"; then 45174456fccdSmrg libdir="$hardcode_libdirs" 45184456fccdSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 45194456fccdSmrg fi 45204456fccdSmrg compile_rpath="$rpath" 45214456fccdSmrg 45224456fccdSmrg rpath= 45234456fccdSmrg hardcode_libdirs= 45244456fccdSmrg for libdir in $finalize_rpath; do 45254456fccdSmrg if test -n "$hardcode_libdir_flag_spec"; then 45264456fccdSmrg if test -n "$hardcode_libdir_separator"; then 45274456fccdSmrg if test -z "$hardcode_libdirs"; then 45284456fccdSmrg hardcode_libdirs="$libdir" 45294456fccdSmrg else 45304456fccdSmrg # Just accumulate the unique libdirs. 45314456fccdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 45324456fccdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 45334456fccdSmrg ;; 45344456fccdSmrg *) 45354456fccdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 45364456fccdSmrg ;; 45374456fccdSmrg esac 45384456fccdSmrg fi 45394456fccdSmrg else 45404456fccdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 45414456fccdSmrg rpath="$rpath $flag" 45424456fccdSmrg fi 45434456fccdSmrg elif test -n "$runpath_var"; then 45444456fccdSmrg case "$finalize_perm_rpath " in 45454456fccdSmrg *" $libdir "*) ;; 45464456fccdSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 45474456fccdSmrg esac 45484456fccdSmrg fi 45494456fccdSmrg done 45504456fccdSmrg # Substitute the hardcoded libdirs into the rpath. 45514456fccdSmrg if test -n "$hardcode_libdir_separator" && 45524456fccdSmrg test -n "$hardcode_libdirs"; then 45534456fccdSmrg libdir="$hardcode_libdirs" 45544456fccdSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 45554456fccdSmrg fi 45564456fccdSmrg finalize_rpath="$rpath" 45574456fccdSmrg 45584456fccdSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 45594456fccdSmrg # Transform all the library objects into standard objects. 45604456fccdSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45614456fccdSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45624456fccdSmrg fi 45634456fccdSmrg 45644456fccdSmrg dlsyms= 45654456fccdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 45664456fccdSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 45674456fccdSmrg dlsyms="${outputname}S.c" 45684456fccdSmrg else 45694456fccdSmrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 45704456fccdSmrg fi 45714456fccdSmrg fi 45724456fccdSmrg 45734456fccdSmrg if test -n "$dlsyms"; then 45744456fccdSmrg case $dlsyms in 45754456fccdSmrg "") ;; 45764456fccdSmrg *.c) 45774456fccdSmrg # Discover the nlist of each of the dlfiles. 45784456fccdSmrg nlist="$output_objdir/${outputname}.nm" 45794456fccdSmrg 45804456fccdSmrg $show "$rm $nlist ${nlist}S ${nlist}T" 45814456fccdSmrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 45824456fccdSmrg 45834456fccdSmrg # Parse the name list into a source file. 45844456fccdSmrg $show "creating $output_objdir/$dlsyms" 45854456fccdSmrg 45864456fccdSmrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 45874456fccdSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 45884456fccdSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 45894456fccdSmrg 45904456fccdSmrg#ifdef __cplusplus 45914456fccdSmrgextern \"C\" { 45924456fccdSmrg#endif 45934456fccdSmrg 45944456fccdSmrg/* Prevent the only kind of declaration conflicts we can make. */ 45954456fccdSmrg#define lt_preloaded_symbols some_other_symbol 45964456fccdSmrg 45974456fccdSmrg/* External symbol declarations for the compiler. */\ 45984456fccdSmrg" 45994456fccdSmrg 46004456fccdSmrg if test "$dlself" = yes; then 46014456fccdSmrg $show "generating symbol list for \`$output'" 46024456fccdSmrg 46034456fccdSmrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 46044456fccdSmrg 46054456fccdSmrg # Add our own program objects to the symbol list. 46064456fccdSmrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 46074456fccdSmrg for arg in $progfiles; do 46084456fccdSmrg $show "extracting global C symbols from \`$arg'" 46094456fccdSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46104456fccdSmrg done 46114456fccdSmrg 46124456fccdSmrg if test -n "$exclude_expsyms"; then 46134456fccdSmrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 46144456fccdSmrg $run eval '$mv "$nlist"T "$nlist"' 46154456fccdSmrg fi 46164456fccdSmrg 46174456fccdSmrg if test -n "$export_symbols_regex"; then 46184456fccdSmrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 46194456fccdSmrg $run eval '$mv "$nlist"T "$nlist"' 46204456fccdSmrg fi 46214456fccdSmrg 46224456fccdSmrg # Prepare the list of exported symbols 46234456fccdSmrg if test -z "$export_symbols"; then 46244456fccdSmrg export_symbols="$output_objdir/$outputname.exp" 46254456fccdSmrg $run $rm $export_symbols 46264456fccdSmrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 46274456fccdSmrg case $host in 46284456fccdSmrg *cygwin* | *mingw* ) 46294456fccdSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46304456fccdSmrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 46314456fccdSmrg ;; 46324456fccdSmrg esac 46334456fccdSmrg else 46344456fccdSmrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 46354456fccdSmrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 46364456fccdSmrg $run eval 'mv "$nlist"T "$nlist"' 46374456fccdSmrg case $host in 46384456fccdSmrg *cygwin* | *mingw* ) 46394456fccdSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46404456fccdSmrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 46414456fccdSmrg ;; 46424456fccdSmrg esac 46434456fccdSmrg fi 46444456fccdSmrg fi 46454456fccdSmrg 46464456fccdSmrg for arg in $dlprefiles; do 46474456fccdSmrg $show "extracting global C symbols from \`$arg'" 46484456fccdSmrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 46494456fccdSmrg $run eval '$echo ": $name " >> "$nlist"' 46504456fccdSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46514456fccdSmrg done 46524456fccdSmrg 46534456fccdSmrg if test -z "$run"; then 46544456fccdSmrg # Make sure we have at least an empty file. 46554456fccdSmrg test -f "$nlist" || : > "$nlist" 46564456fccdSmrg 46574456fccdSmrg if test -n "$exclude_expsyms"; then 46584456fccdSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 46594456fccdSmrg $mv "$nlist"T "$nlist" 46604456fccdSmrg fi 46614456fccdSmrg 46624456fccdSmrg # Try sorting and uniquifying the output. 46634456fccdSmrg if grep -v "^: " < "$nlist" | 46644456fccdSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 46654456fccdSmrg sort -k 3 46664456fccdSmrg else 46674456fccdSmrg sort +2 46684456fccdSmrg fi | 46694456fccdSmrg uniq > "$nlist"S; then 46704456fccdSmrg : 46714456fccdSmrg else 46724456fccdSmrg grep -v "^: " < "$nlist" > "$nlist"S 46734456fccdSmrg fi 46744456fccdSmrg 46754456fccdSmrg if test -f "$nlist"S; then 46764456fccdSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 46774456fccdSmrg else 46784456fccdSmrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 46794456fccdSmrg fi 46804456fccdSmrg 46814456fccdSmrg $echo >> "$output_objdir/$dlsyms" "\ 46824456fccdSmrg 46834456fccdSmrg#undef lt_preloaded_symbols 46844456fccdSmrg 46854456fccdSmrg#if defined (__STDC__) && __STDC__ 46864456fccdSmrg# define lt_ptr void * 46874456fccdSmrg#else 46884456fccdSmrg# define lt_ptr char * 46894456fccdSmrg# define const 46904456fccdSmrg#endif 46914456fccdSmrg 46924456fccdSmrg/* The mapping between symbol names and symbols. */ 46934456fccdSmrg" 46944456fccdSmrg 46954456fccdSmrg case $host in 46964456fccdSmrg *cygwin* | *mingw* ) 46974456fccdSmrg $echo >> "$output_objdir/$dlsyms" "\ 46984456fccdSmrg/* DATA imports from DLLs on WIN32 can't be const, because 46994456fccdSmrg runtime relocations are performed -- see ld's documentation 47004456fccdSmrg on pseudo-relocs */ 47014456fccdSmrgstruct { 47024456fccdSmrg" 47034456fccdSmrg ;; 47044456fccdSmrg * ) 47054456fccdSmrg $echo >> "$output_objdir/$dlsyms" "\ 47064456fccdSmrgconst struct { 47074456fccdSmrg" 47084456fccdSmrg ;; 47094456fccdSmrg esac 47104456fccdSmrg 47114456fccdSmrg 47124456fccdSmrg $echo >> "$output_objdir/$dlsyms" "\ 47134456fccdSmrg const char *name; 47144456fccdSmrg lt_ptr address; 47154456fccdSmrg} 47164456fccdSmrglt_preloaded_symbols[] = 47174456fccdSmrg{\ 47184456fccdSmrg" 47194456fccdSmrg 47204456fccdSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 47214456fccdSmrg 47224456fccdSmrg $echo >> "$output_objdir/$dlsyms" "\ 47234456fccdSmrg {0, (lt_ptr) 0} 47244456fccdSmrg}; 47254456fccdSmrg 47264456fccdSmrg/* This works around a problem in FreeBSD linker */ 47274456fccdSmrg#ifdef FREEBSD_WORKAROUND 47284456fccdSmrgstatic const void *lt_preloaded_setup() { 47294456fccdSmrg return lt_preloaded_symbols; 47304456fccdSmrg} 47314456fccdSmrg#endif 47324456fccdSmrg 47334456fccdSmrg#ifdef __cplusplus 47344456fccdSmrg} 47354456fccdSmrg#endif\ 47364456fccdSmrg" 47374456fccdSmrg fi 47384456fccdSmrg 47394456fccdSmrg pic_flag_for_symtable= 47404456fccdSmrg case $host in 47414456fccdSmrg # compiling the symbol table file with pic_flag works around 47424456fccdSmrg # a FreeBSD bug that causes programs to crash when -lm is 47434456fccdSmrg # linked before any other PIC object. But we must not use 47444456fccdSmrg # pic_flag when linking with -static. The problem exists in 47454456fccdSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 47464456fccdSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 47474456fccdSmrg case "$compile_command " in 47484456fccdSmrg *" -static "*) ;; 47494456fccdSmrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 47504456fccdSmrg esac;; 47514456fccdSmrg *-*-hpux*) 47524456fccdSmrg case "$compile_command " in 47534456fccdSmrg *" -static "*) ;; 47544456fccdSmrg *) pic_flag_for_symtable=" $pic_flag";; 47554456fccdSmrg esac 47564456fccdSmrg esac 47574456fccdSmrg 47584456fccdSmrg # Now compile the dynamic symbol file. 47594456fccdSmrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 47604456fccdSmrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 47614456fccdSmrg 47624456fccdSmrg # Clean up the generated files. 47634456fccdSmrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 47644456fccdSmrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 47654456fccdSmrg 47664456fccdSmrg # Transform the symbol file into the correct name. 47674456fccdSmrg case $host in 47684456fccdSmrg *cygwin* | *mingw* ) 47694456fccdSmrg if test -f "$output_objdir/${outputname}.def" ; then 477042d69509Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 477142d69509Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47724456fccdSmrg else 477342d69509Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 477442d69509Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47754456fccdSmrg fi 47764456fccdSmrg ;; 47774456fccdSmrg * ) 477842d69509Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 477942d69509Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47804456fccdSmrg ;; 47814456fccdSmrg esac 47824456fccdSmrg ;; 47834456fccdSmrg *) 47844456fccdSmrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 47854456fccdSmrg exit $EXIT_FAILURE 47864456fccdSmrg ;; 47874456fccdSmrg esac 47884456fccdSmrg else 47894456fccdSmrg # We keep going just in case the user didn't refer to 47904456fccdSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 47914456fccdSmrg # really was required. 47924456fccdSmrg 47934456fccdSmrg # Nullify the symbol file. 479442d69509Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 479542d69509Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47964456fccdSmrg fi 47974456fccdSmrg 47984456fccdSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 47994456fccdSmrg # Replace the output file specification. 480042d69509Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 48014456fccdSmrg link_command="$compile_command$compile_rpath" 48024456fccdSmrg 48034456fccdSmrg # We have no uninstalled library dependencies, so finalize right now. 48044456fccdSmrg $show "$link_command" 48054456fccdSmrg $run eval "$link_command" 48064456fccdSmrg exit_status=$? 48074456fccdSmrg 48084456fccdSmrg # Delete the generated files. 48094456fccdSmrg if test -n "$dlsyms"; then 48104456fccdSmrg $show "$rm $output_objdir/${outputname}S.${objext}" 48114456fccdSmrg $run $rm "$output_objdir/${outputname}S.${objext}" 48124456fccdSmrg fi 48134456fccdSmrg 48144456fccdSmrg exit $exit_status 48154456fccdSmrg fi 48164456fccdSmrg 48174456fccdSmrg if test -n "$shlibpath_var"; then 48184456fccdSmrg # We should set the shlibpath_var 48194456fccdSmrg rpath= 48204456fccdSmrg for dir in $temp_rpath; do 48214456fccdSmrg case $dir in 48224456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) 48234456fccdSmrg # Absolute path. 48244456fccdSmrg rpath="$rpath$dir:" 48254456fccdSmrg ;; 48264456fccdSmrg *) 48274456fccdSmrg # Relative path: add a thisdir entry. 48284456fccdSmrg rpath="$rpath\$thisdir/$dir:" 48294456fccdSmrg ;; 48304456fccdSmrg esac 48314456fccdSmrg done 48324456fccdSmrg temp_rpath="$rpath" 48334456fccdSmrg fi 48344456fccdSmrg 48354456fccdSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 48364456fccdSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 48374456fccdSmrg fi 48384456fccdSmrg if test -n "$finalize_shlibpath"; then 48394456fccdSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 48404456fccdSmrg fi 48414456fccdSmrg 48424456fccdSmrg compile_var= 48434456fccdSmrg finalize_var= 48444456fccdSmrg if test -n "$runpath_var"; then 48454456fccdSmrg if test -n "$perm_rpath"; then 48464456fccdSmrg # We should set the runpath_var. 48474456fccdSmrg rpath= 48484456fccdSmrg for dir in $perm_rpath; do 48494456fccdSmrg rpath="$rpath$dir:" 48504456fccdSmrg done 48514456fccdSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 48524456fccdSmrg fi 48534456fccdSmrg if test -n "$finalize_perm_rpath"; then 48544456fccdSmrg # We should set the runpath_var. 48554456fccdSmrg rpath= 48564456fccdSmrg for dir in $finalize_perm_rpath; do 48574456fccdSmrg rpath="$rpath$dir:" 48584456fccdSmrg done 48594456fccdSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 48604456fccdSmrg fi 48614456fccdSmrg fi 48624456fccdSmrg 48634456fccdSmrg if test "$no_install" = yes; then 48644456fccdSmrg # We don't need to create a wrapper script. 48654456fccdSmrg link_command="$compile_var$compile_command$compile_rpath" 48664456fccdSmrg # Replace the output file specification. 48674456fccdSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 48684456fccdSmrg # Delete the old output file. 48694456fccdSmrg $run $rm $output 48704456fccdSmrg # Link the executable and exit 48714456fccdSmrg $show "$link_command" 48724456fccdSmrg $run eval "$link_command" || exit $? 48734456fccdSmrg exit $EXIT_SUCCESS 48744456fccdSmrg fi 48754456fccdSmrg 48764456fccdSmrg if test "$hardcode_action" = relink; then 48774456fccdSmrg # Fast installation is not supported 48784456fccdSmrg link_command="$compile_var$compile_command$compile_rpath" 48794456fccdSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48804456fccdSmrg 48814456fccdSmrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 48824456fccdSmrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 48834456fccdSmrg else 48844456fccdSmrg if test "$fast_install" != no; then 48854456fccdSmrg link_command="$finalize_var$compile_command$finalize_rpath" 48864456fccdSmrg if test "$fast_install" = yes; then 488742d69509Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 48884456fccdSmrg else 48894456fccdSmrg # fast_install is set to needless 48904456fccdSmrg relink_command= 48914456fccdSmrg fi 48924456fccdSmrg else 48934456fccdSmrg link_command="$compile_var$compile_command$compile_rpath" 48944456fccdSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48954456fccdSmrg fi 48964456fccdSmrg fi 48974456fccdSmrg 48984456fccdSmrg # Replace the output file specification. 48994456fccdSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 49004456fccdSmrg 49014456fccdSmrg # Delete the old output files. 49024456fccdSmrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 49034456fccdSmrg 49044456fccdSmrg $show "$link_command" 49054456fccdSmrg $run eval "$link_command" || exit $? 49064456fccdSmrg 49074456fccdSmrg # Now create the wrapper script. 49084456fccdSmrg $show "creating $output" 49094456fccdSmrg 49104456fccdSmrg # Quote the relink command for shipping. 49114456fccdSmrg if test -n "$relink_command"; then 49124456fccdSmrg # Preserve any variables that may affect compiler behavior 49134456fccdSmrg for var in $variables_saved_for_relink; do 49144456fccdSmrg if eval test -z \"\${$var+set}\"; then 49154456fccdSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 49164456fccdSmrg elif eval var_value=\$$var; test -z "$var_value"; then 49174456fccdSmrg relink_command="$var=; export $var; $relink_command" 49184456fccdSmrg else 49194456fccdSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 49204456fccdSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 49214456fccdSmrg fi 49224456fccdSmrg done 49234456fccdSmrg relink_command="(cd `pwd`; $relink_command)" 492442d69509Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 49254456fccdSmrg fi 49264456fccdSmrg 49274456fccdSmrg # Quote $echo for shipping. 49284456fccdSmrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 49294456fccdSmrg case $progpath in 49304456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 49314456fccdSmrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 49324456fccdSmrg esac 49334456fccdSmrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 49344456fccdSmrg else 49354456fccdSmrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 49364456fccdSmrg fi 49374456fccdSmrg 49384456fccdSmrg # Only actually do things if our run command is non-null. 49394456fccdSmrg if test -z "$run"; then 49404456fccdSmrg # win32 will think the script is a binary if it has 49414456fccdSmrg # a .exe suffix, so we strip it off here. 49424456fccdSmrg case $output in 49434456fccdSmrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 49444456fccdSmrg esac 49454456fccdSmrg # test for cygwin because mv fails w/o .exe extensions 49464456fccdSmrg case $host in 49474456fccdSmrg *cygwin*) 49484456fccdSmrg exeext=.exe 49494456fccdSmrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 49504456fccdSmrg *) exeext= ;; 49514456fccdSmrg esac 49524456fccdSmrg case $host in 49534456fccdSmrg *cygwin* | *mingw* ) 49544456fccdSmrg output_name=`basename $output` 49554456fccdSmrg output_path=`dirname $output` 49564456fccdSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 49574456fccdSmrg cwrapper="$output_path/$output_name.exe" 49584456fccdSmrg $rm $cwrappersource $cwrapper 49594456fccdSmrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 49604456fccdSmrg 49614456fccdSmrg cat > $cwrappersource <<EOF 49624456fccdSmrg 49634456fccdSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 49644456fccdSmrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 49654456fccdSmrg 49664456fccdSmrg The $output program cannot be directly executed until all the libtool 49674456fccdSmrg libraries that it depends on are installed. 49684456fccdSmrg 49694456fccdSmrg This wrapper executable should never be moved out of the build directory. 49704456fccdSmrg If it is, it will not operate correctly. 49714456fccdSmrg 49724456fccdSmrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 49734456fccdSmrg but could eventually absorb all of the scripts functionality and 49744456fccdSmrg exec $objdir/$outputname directly. 49754456fccdSmrg*/ 49764456fccdSmrgEOF 49774456fccdSmrg cat >> $cwrappersource<<"EOF" 49784456fccdSmrg#include <stdio.h> 49794456fccdSmrg#include <stdlib.h> 49804456fccdSmrg#include <unistd.h> 49814456fccdSmrg#include <malloc.h> 49824456fccdSmrg#include <stdarg.h> 49834456fccdSmrg#include <assert.h> 49844456fccdSmrg#include <string.h> 49854456fccdSmrg#include <ctype.h> 49864456fccdSmrg#include <sys/stat.h> 49874456fccdSmrg 49884456fccdSmrg#if defined(PATH_MAX) 49894456fccdSmrg# define LT_PATHMAX PATH_MAX 49904456fccdSmrg#elif defined(MAXPATHLEN) 49914456fccdSmrg# define LT_PATHMAX MAXPATHLEN 49924456fccdSmrg#else 49934456fccdSmrg# define LT_PATHMAX 1024 49944456fccdSmrg#endif 49954456fccdSmrg 49964456fccdSmrg#ifndef DIR_SEPARATOR 49974456fccdSmrg# define DIR_SEPARATOR '/' 49984456fccdSmrg# define PATH_SEPARATOR ':' 49994456fccdSmrg#endif 50004456fccdSmrg 50014456fccdSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 50024456fccdSmrg defined (__OS2__) 50034456fccdSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 50044456fccdSmrg# ifndef DIR_SEPARATOR_2 50054456fccdSmrg# define DIR_SEPARATOR_2 '\\' 50064456fccdSmrg# endif 50074456fccdSmrg# ifndef PATH_SEPARATOR_2 50084456fccdSmrg# define PATH_SEPARATOR_2 ';' 50094456fccdSmrg# endif 50104456fccdSmrg#endif 50114456fccdSmrg 50124456fccdSmrg#ifndef DIR_SEPARATOR_2 50134456fccdSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 50144456fccdSmrg#else /* DIR_SEPARATOR_2 */ 50154456fccdSmrg# define IS_DIR_SEPARATOR(ch) \ 50164456fccdSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 50174456fccdSmrg#endif /* DIR_SEPARATOR_2 */ 50184456fccdSmrg 50194456fccdSmrg#ifndef PATH_SEPARATOR_2 50204456fccdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 50214456fccdSmrg#else /* PATH_SEPARATOR_2 */ 50224456fccdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 50234456fccdSmrg#endif /* PATH_SEPARATOR_2 */ 50244456fccdSmrg 50254456fccdSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 50264456fccdSmrg#define XFREE(stale) do { \ 50274456fccdSmrg if (stale) { free ((void *) stale); stale = 0; } \ 50284456fccdSmrg} while (0) 50294456fccdSmrg 50304456fccdSmrg/* -DDEBUG is fairly common in CFLAGS. */ 50314456fccdSmrg#undef DEBUG 50324456fccdSmrg#if defined DEBUGWRAPPER 50334456fccdSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 50344456fccdSmrg#else 50354456fccdSmrg# define DEBUG(format, ...) 50364456fccdSmrg#endif 50374456fccdSmrg 50384456fccdSmrgconst char *program_name = NULL; 50394456fccdSmrg 50404456fccdSmrgvoid * xmalloc (size_t num); 50414456fccdSmrgchar * xstrdup (const char *string); 50424456fccdSmrgconst char * base_name (const char *name); 50434456fccdSmrgchar * find_executable(const char *wrapper); 50444456fccdSmrgint check_executable(const char *path); 50454456fccdSmrgchar * strendzap(char *str, const char *pat); 50464456fccdSmrgvoid lt_fatal (const char *message, ...); 50474456fccdSmrg 50484456fccdSmrgint 50494456fccdSmrgmain (int argc, char *argv[]) 50504456fccdSmrg{ 50514456fccdSmrg char **newargz; 50524456fccdSmrg int i; 50534456fccdSmrg 50544456fccdSmrg program_name = (char *) xstrdup (base_name (argv[0])); 50554456fccdSmrg DEBUG("(main) argv[0] : %s\n",argv[0]); 50564456fccdSmrg DEBUG("(main) program_name : %s\n",program_name); 50574456fccdSmrg newargz = XMALLOC(char *, argc+2); 50584456fccdSmrgEOF 50594456fccdSmrg 50604456fccdSmrg cat >> $cwrappersource <<EOF 50614456fccdSmrg newargz[0] = (char *) xstrdup("$SHELL"); 50624456fccdSmrgEOF 50634456fccdSmrg 50644456fccdSmrg cat >> $cwrappersource <<"EOF" 50654456fccdSmrg newargz[1] = find_executable(argv[0]); 50664456fccdSmrg if (newargz[1] == NULL) 50674456fccdSmrg lt_fatal("Couldn't find %s", argv[0]); 50684456fccdSmrg DEBUG("(main) found exe at : %s\n",newargz[1]); 50694456fccdSmrg /* we know the script has the same name, without the .exe */ 50704456fccdSmrg /* so make sure newargz[1] doesn't end in .exe */ 50714456fccdSmrg strendzap(newargz[1],".exe"); 50724456fccdSmrg for (i = 1; i < argc; i++) 50734456fccdSmrg newargz[i+1] = xstrdup(argv[i]); 50744456fccdSmrg newargz[argc+1] = NULL; 50754456fccdSmrg 50764456fccdSmrg for (i=0; i<argc+1; i++) 50774456fccdSmrg { 50784456fccdSmrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 50794456fccdSmrg ; 50804456fccdSmrg } 50814456fccdSmrg 50824456fccdSmrgEOF 50834456fccdSmrg 50844456fccdSmrg case $host_os in 50854456fccdSmrg mingw*) 50864456fccdSmrg cat >> $cwrappersource <<EOF 50874456fccdSmrg execv("$SHELL",(char const **)newargz); 50884456fccdSmrgEOF 50894456fccdSmrg ;; 50904456fccdSmrg *) 50914456fccdSmrg cat >> $cwrappersource <<EOF 50924456fccdSmrg execv("$SHELL",newargz); 50934456fccdSmrgEOF 50944456fccdSmrg ;; 50954456fccdSmrg esac 50964456fccdSmrg 50974456fccdSmrg cat >> $cwrappersource <<"EOF" 50984456fccdSmrg return 127; 50994456fccdSmrg} 51004456fccdSmrg 51014456fccdSmrgvoid * 51024456fccdSmrgxmalloc (size_t num) 51034456fccdSmrg{ 51044456fccdSmrg void * p = (void *) malloc (num); 51054456fccdSmrg if (!p) 51064456fccdSmrg lt_fatal ("Memory exhausted"); 51074456fccdSmrg 51084456fccdSmrg return p; 51094456fccdSmrg} 51104456fccdSmrg 51114456fccdSmrgchar * 51124456fccdSmrgxstrdup (const char *string) 51134456fccdSmrg{ 51144456fccdSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 51154456fccdSmrg; 51164456fccdSmrg} 51174456fccdSmrg 51184456fccdSmrgconst char * 51194456fccdSmrgbase_name (const char *name) 51204456fccdSmrg{ 51214456fccdSmrg const char *base; 51224456fccdSmrg 51234456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51244456fccdSmrg /* Skip over the disk name in MSDOS pathnames. */ 51254456fccdSmrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 51264456fccdSmrg name += 2; 51274456fccdSmrg#endif 51284456fccdSmrg 51294456fccdSmrg for (base = name; *name; name++) 51304456fccdSmrg if (IS_DIR_SEPARATOR (*name)) 51314456fccdSmrg base = name + 1; 51324456fccdSmrg return base; 51334456fccdSmrg} 51344456fccdSmrg 51354456fccdSmrgint 51364456fccdSmrgcheck_executable(const char * path) 51374456fccdSmrg{ 51384456fccdSmrg struct stat st; 51394456fccdSmrg 51404456fccdSmrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 51414456fccdSmrg if ((!path) || (!*path)) 51424456fccdSmrg return 0; 51434456fccdSmrg 51444456fccdSmrg if ((stat (path, &st) >= 0) && 51454456fccdSmrg ( 51464456fccdSmrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 51474456fccdSmrg#if defined (S_IXOTH) 51484456fccdSmrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 51494456fccdSmrg#endif 51504456fccdSmrg#if defined (S_IXGRP) 51514456fccdSmrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 51524456fccdSmrg#endif 51534456fccdSmrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 51544456fccdSmrg ) 51554456fccdSmrg return 1; 51564456fccdSmrg else 51574456fccdSmrg return 0; 51584456fccdSmrg} 51594456fccdSmrg 51604456fccdSmrg/* Searches for the full path of the wrapper. Returns 51614456fccdSmrg newly allocated full path name if found, NULL otherwise */ 51624456fccdSmrgchar * 51634456fccdSmrgfind_executable (const char* wrapper) 51644456fccdSmrg{ 51654456fccdSmrg int has_slash = 0; 51664456fccdSmrg const char* p; 51674456fccdSmrg const char* p_next; 51684456fccdSmrg /* static buffer for getcwd */ 51694456fccdSmrg char tmp[LT_PATHMAX + 1]; 51704456fccdSmrg int tmp_len; 51714456fccdSmrg char* concat_name; 51724456fccdSmrg 51734456fccdSmrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 51744456fccdSmrg 51754456fccdSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 51764456fccdSmrg return NULL; 51774456fccdSmrg 51784456fccdSmrg /* Absolute path? */ 51794456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51804456fccdSmrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 51814456fccdSmrg { 51824456fccdSmrg concat_name = xstrdup (wrapper); 51834456fccdSmrg if (check_executable(concat_name)) 51844456fccdSmrg return concat_name; 51854456fccdSmrg XFREE(concat_name); 51864456fccdSmrg } 51874456fccdSmrg else 51884456fccdSmrg { 51894456fccdSmrg#endif 51904456fccdSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 51914456fccdSmrg { 51924456fccdSmrg concat_name = xstrdup (wrapper); 51934456fccdSmrg if (check_executable(concat_name)) 51944456fccdSmrg return concat_name; 51954456fccdSmrg XFREE(concat_name); 51964456fccdSmrg } 51974456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51984456fccdSmrg } 51994456fccdSmrg#endif 52004456fccdSmrg 52014456fccdSmrg for (p = wrapper; *p; p++) 52024456fccdSmrg if (*p == '/') 52034456fccdSmrg { 52044456fccdSmrg has_slash = 1; 52054456fccdSmrg break; 52064456fccdSmrg } 52074456fccdSmrg if (!has_slash) 52084456fccdSmrg { 52094456fccdSmrg /* no slashes; search PATH */ 52104456fccdSmrg const char* path = getenv ("PATH"); 52114456fccdSmrg if (path != NULL) 52124456fccdSmrg { 52134456fccdSmrg for (p = path; *p; p = p_next) 52144456fccdSmrg { 52154456fccdSmrg const char* q; 52164456fccdSmrg size_t p_len; 52174456fccdSmrg for (q = p; *q; q++) 52184456fccdSmrg if (IS_PATH_SEPARATOR(*q)) 52194456fccdSmrg break; 52204456fccdSmrg p_len = q - p; 52214456fccdSmrg p_next = (*q == '\0' ? q : q + 1); 52224456fccdSmrg if (p_len == 0) 52234456fccdSmrg { 52244456fccdSmrg /* empty path: current directory */ 52254456fccdSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 52264456fccdSmrg lt_fatal ("getcwd failed"); 52274456fccdSmrg tmp_len = strlen(tmp); 52284456fccdSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52294456fccdSmrg memcpy (concat_name, tmp, tmp_len); 52304456fccdSmrg concat_name[tmp_len] = '/'; 52314456fccdSmrg strcpy (concat_name + tmp_len + 1, wrapper); 52324456fccdSmrg } 52334456fccdSmrg else 52344456fccdSmrg { 52354456fccdSmrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 52364456fccdSmrg memcpy (concat_name, p, p_len); 52374456fccdSmrg concat_name[p_len] = '/'; 52384456fccdSmrg strcpy (concat_name + p_len + 1, wrapper); 52394456fccdSmrg } 52404456fccdSmrg if (check_executable(concat_name)) 52414456fccdSmrg return concat_name; 52424456fccdSmrg XFREE(concat_name); 52434456fccdSmrg } 52444456fccdSmrg } 52454456fccdSmrg /* not found in PATH; assume curdir */ 52464456fccdSmrg } 52474456fccdSmrg /* Relative path | not found in path: prepend cwd */ 52484456fccdSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 52494456fccdSmrg lt_fatal ("getcwd failed"); 52504456fccdSmrg tmp_len = strlen(tmp); 52514456fccdSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52524456fccdSmrg memcpy (concat_name, tmp, tmp_len); 52534456fccdSmrg concat_name[tmp_len] = '/'; 52544456fccdSmrg strcpy (concat_name + tmp_len + 1, wrapper); 52554456fccdSmrg 52564456fccdSmrg if (check_executable(concat_name)) 52574456fccdSmrg return concat_name; 52584456fccdSmrg XFREE(concat_name); 52594456fccdSmrg return NULL; 52604456fccdSmrg} 52614456fccdSmrg 52624456fccdSmrgchar * 52634456fccdSmrgstrendzap(char *str, const char *pat) 52644456fccdSmrg{ 52654456fccdSmrg size_t len, patlen; 52664456fccdSmrg 52674456fccdSmrg assert(str != NULL); 52684456fccdSmrg assert(pat != NULL); 52694456fccdSmrg 52704456fccdSmrg len = strlen(str); 52714456fccdSmrg patlen = strlen(pat); 52724456fccdSmrg 52734456fccdSmrg if (patlen <= len) 52744456fccdSmrg { 52754456fccdSmrg str += len - patlen; 52764456fccdSmrg if (strcmp(str, pat) == 0) 52774456fccdSmrg *str = '\0'; 52784456fccdSmrg } 52794456fccdSmrg return str; 52804456fccdSmrg} 52814456fccdSmrg 52824456fccdSmrgstatic void 52834456fccdSmrglt_error_core (int exit_status, const char * mode, 52844456fccdSmrg const char * message, va_list ap) 52854456fccdSmrg{ 52864456fccdSmrg fprintf (stderr, "%s: %s: ", program_name, mode); 52874456fccdSmrg vfprintf (stderr, message, ap); 52884456fccdSmrg fprintf (stderr, ".\n"); 52894456fccdSmrg 52904456fccdSmrg if (exit_status >= 0) 52914456fccdSmrg exit (exit_status); 52924456fccdSmrg} 52934456fccdSmrg 52944456fccdSmrgvoid 52954456fccdSmrglt_fatal (const char *message, ...) 52964456fccdSmrg{ 52974456fccdSmrg va_list ap; 52984456fccdSmrg va_start (ap, message); 52994456fccdSmrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 53004456fccdSmrg va_end (ap); 53014456fccdSmrg} 53024456fccdSmrgEOF 53034456fccdSmrg # we should really use a build-platform specific compiler 53044456fccdSmrg # here, but OTOH, the wrappers (shell script and this C one) 53054456fccdSmrg # are only useful if you want to execute the "real" binary. 53064456fccdSmrg # Since the "real" binary is built for $host, then this 53074456fccdSmrg # wrapper might as well be built for $host, too. 53084456fccdSmrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 53094456fccdSmrg ;; 53104456fccdSmrg esac 53114456fccdSmrg $rm $output 53124456fccdSmrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 53134456fccdSmrg 53144456fccdSmrg $echo > $output "\ 53154456fccdSmrg#! $SHELL 53164456fccdSmrg 53174456fccdSmrg# $output - temporary wrapper script for $objdir/$outputname 53184456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 53194456fccdSmrg# 53204456fccdSmrg# The $output program cannot be directly executed until all the libtool 53214456fccdSmrg# libraries that it depends on are installed. 53224456fccdSmrg# 53234456fccdSmrg# This wrapper script should never be moved out of the build directory. 53244456fccdSmrg# If it is, it will not operate correctly. 53254456fccdSmrg 53264456fccdSmrg# Sed substitution that helps us do robust quoting. It backslashifies 53274456fccdSmrg# metacharacters that are still active within double-quoted strings. 53284456fccdSmrgXsed='${SED} -e 1s/^X//' 53294456fccdSmrgsed_quote_subst='$sed_quote_subst' 53304456fccdSmrg 533142d69509Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 533242d69509Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 533342d69509Smrg emulate sh 533442d69509Smrg NULLCMD=: 533542d69509Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 533642d69509Smrg # is contrary to our usage. Disable this feature. 533742d69509Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 533842d69509Smrg setopt NO_GLOB_SUBST 533942d69509Smrgelse 534042d69509Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 534142d69509Smrgfi 534242d69509SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 534342d69509SmrgDUALCASE=1; export DUALCASE # for MKS sh 534442d69509Smrg 53454456fccdSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 53464456fccdSmrg# if CDPATH is set. 53474456fccdSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 53484456fccdSmrg 53494456fccdSmrgrelink_command=\"$relink_command\" 53504456fccdSmrg 53514456fccdSmrg# This environment variable determines our operation mode. 53524456fccdSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 53534456fccdSmrg # install mode needs the following variable: 53544456fccdSmrg notinst_deplibs='$notinst_deplibs' 53554456fccdSmrgelse 53564456fccdSmrg # When we are sourced in execute mode, \$file and \$echo are already set. 53574456fccdSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 53584456fccdSmrg echo=\"$qecho\" 53594456fccdSmrg file=\"\$0\" 53604456fccdSmrg # Make sure echo works. 53614456fccdSmrg if test \"X\$1\" = X--no-reexec; then 53624456fccdSmrg # Discard the --no-reexec flag, and continue. 53634456fccdSmrg shift 53644456fccdSmrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 53654456fccdSmrg # Yippee, \$echo works! 53664456fccdSmrg : 53674456fccdSmrg else 53684456fccdSmrg # Restart under the correct shell, and then maybe \$echo will work. 53694456fccdSmrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 53704456fccdSmrg fi 53714456fccdSmrg fi\ 53724456fccdSmrg" 53734456fccdSmrg $echo >> $output "\ 53744456fccdSmrg 53754456fccdSmrg # Find the directory that this script lives in. 53764456fccdSmrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 53774456fccdSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 53784456fccdSmrg 53794456fccdSmrg # Follow symbolic links until we get to the real thisdir. 53804456fccdSmrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 53814456fccdSmrg while test -n \"\$file\"; do 53824456fccdSmrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 53834456fccdSmrg 53844456fccdSmrg # If there was a directory component, then change thisdir. 53854456fccdSmrg if test \"x\$destdir\" != \"x\$file\"; then 53864456fccdSmrg case \"\$destdir\" in 53874456fccdSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 53884456fccdSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 53894456fccdSmrg esac 53904456fccdSmrg fi 53914456fccdSmrg 53924456fccdSmrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 53934456fccdSmrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 53944456fccdSmrg done 53954456fccdSmrg 53964456fccdSmrg # Try to get the absolute directory name. 53974456fccdSmrg absdir=\`cd \"\$thisdir\" && pwd\` 53984456fccdSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 53994456fccdSmrg" 54004456fccdSmrg 54014456fccdSmrg if test "$fast_install" = yes; then 54024456fccdSmrg $echo >> $output "\ 54034456fccdSmrg program=lt-'$outputname'$exeext 54044456fccdSmrg progdir=\"\$thisdir/$objdir\" 54054456fccdSmrg 54064456fccdSmrg if test ! -f \"\$progdir/\$program\" || \\ 54074456fccdSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 54084456fccdSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 54094456fccdSmrg 54104456fccdSmrg file=\"\$\$-\$program\" 54114456fccdSmrg 54124456fccdSmrg if test ! -d \"\$progdir\"; then 54134456fccdSmrg $mkdir \"\$progdir\" 54144456fccdSmrg else 54154456fccdSmrg $rm \"\$progdir/\$file\" 54164456fccdSmrg fi" 54174456fccdSmrg 54184456fccdSmrg $echo >> $output "\ 54194456fccdSmrg 54204456fccdSmrg # relink executable if necessary 54214456fccdSmrg if test -n \"\$relink_command\"; then 54224456fccdSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 54234456fccdSmrg else 54244456fccdSmrg $echo \"\$relink_command_output\" >&2 54254456fccdSmrg $rm \"\$progdir/\$file\" 54264456fccdSmrg exit $EXIT_FAILURE 54274456fccdSmrg fi 54284456fccdSmrg fi 54294456fccdSmrg 54304456fccdSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 54314456fccdSmrg { $rm \"\$progdir/\$program\"; 54324456fccdSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 54334456fccdSmrg $rm \"\$progdir/\$file\" 54344456fccdSmrg fi" 54354456fccdSmrg else 54364456fccdSmrg $echo >> $output "\ 54374456fccdSmrg program='$outputname' 54384456fccdSmrg progdir=\"\$thisdir/$objdir\" 54394456fccdSmrg" 54404456fccdSmrg fi 54414456fccdSmrg 54424456fccdSmrg $echo >> $output "\ 54434456fccdSmrg 54444456fccdSmrg if test -f \"\$progdir/\$program\"; then" 54454456fccdSmrg 54464456fccdSmrg # Export our shlibpath_var if we have one. 54474456fccdSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 54484456fccdSmrg $echo >> $output "\ 54494456fccdSmrg # Add our own library path to $shlibpath_var 54504456fccdSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 54514456fccdSmrg 54524456fccdSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 54534456fccdSmrg # The second colon is a workaround for a bug in BeOS R4 sed 54544456fccdSmrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 54554456fccdSmrg 54564456fccdSmrg export $shlibpath_var 54574456fccdSmrg" 54584456fccdSmrg fi 54594456fccdSmrg 54604456fccdSmrg # fixup the dll searchpath if we need to. 54614456fccdSmrg if test -n "$dllsearchpath"; then 54624456fccdSmrg $echo >> $output "\ 54634456fccdSmrg # Add the dll search path components to the executable PATH 54644456fccdSmrg PATH=$dllsearchpath:\$PATH 54654456fccdSmrg" 54664456fccdSmrg fi 54674456fccdSmrg 54684456fccdSmrg $echo >> $output "\ 54694456fccdSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 54704456fccdSmrg # Run the actual program with our arguments. 54714456fccdSmrg" 54724456fccdSmrg case $host in 54734456fccdSmrg # Backslashes separate directories on plain windows 54744456fccdSmrg *-*-mingw | *-*-os2*) 54754456fccdSmrg $echo >> $output "\ 54764456fccdSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 54774456fccdSmrg" 54784456fccdSmrg ;; 54794456fccdSmrg 54804456fccdSmrg *) 54814456fccdSmrg $echo >> $output "\ 54824456fccdSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 54834456fccdSmrg" 54844456fccdSmrg ;; 54854456fccdSmrg esac 54864456fccdSmrg $echo >> $output "\ 548742d69509Smrg \$echo \"\$0: cannot exec \$program \$*\" 54884456fccdSmrg exit $EXIT_FAILURE 54894456fccdSmrg fi 54904456fccdSmrg else 54914456fccdSmrg # The program doesn't exist. 54924456fccdSmrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 54934456fccdSmrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 54944456fccdSmrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 54954456fccdSmrg exit $EXIT_FAILURE 54964456fccdSmrg fi 54974456fccdSmrgfi\ 54984456fccdSmrg" 54994456fccdSmrg chmod +x $output 55004456fccdSmrg fi 55014456fccdSmrg exit $EXIT_SUCCESS 55024456fccdSmrg ;; 55034456fccdSmrg esac 55044456fccdSmrg 55054456fccdSmrg # See if we need to build an old-fashioned archive. 55064456fccdSmrg for oldlib in $oldlibs; do 55074456fccdSmrg 55084456fccdSmrg if test "$build_libtool_libs" = convenience; then 55094456fccdSmrg oldobjs="$libobjs_save" 55104456fccdSmrg addlibs="$convenience" 55114456fccdSmrg build_libtool_libs=no 55124456fccdSmrg else 55134456fccdSmrg if test "$build_libtool_libs" = module; then 55144456fccdSmrg oldobjs="$libobjs_save" 55154456fccdSmrg build_libtool_libs=no 55164456fccdSmrg else 55174456fccdSmrg oldobjs="$old_deplibs $non_pic_objects" 55184456fccdSmrg fi 55194456fccdSmrg addlibs="$old_convenience" 55204456fccdSmrg fi 55214456fccdSmrg 55224456fccdSmrg if test -n "$addlibs"; then 55234456fccdSmrg gentop="$output_objdir/${outputname}x" 55244456fccdSmrg generated="$generated $gentop" 55254456fccdSmrg 55264456fccdSmrg func_extract_archives $gentop $addlibs 55274456fccdSmrg oldobjs="$oldobjs $func_extract_archives_result" 55284456fccdSmrg fi 55294456fccdSmrg 55304456fccdSmrg # Do each command in the archive commands. 55314456fccdSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 55324456fccdSmrg cmds=$old_archive_from_new_cmds 55334456fccdSmrg else 55344456fccdSmrg # POSIX demands no paths to be encoded in archives. We have 55354456fccdSmrg # to avoid creating archives with duplicate basenames if we 55364456fccdSmrg # might have to extract them afterwards, e.g., when creating a 55374456fccdSmrg # static archive out of a convenience library, or when linking 55384456fccdSmrg # the entirety of a libtool archive into another (currently 55394456fccdSmrg # not supported by libtool). 55404456fccdSmrg if (for obj in $oldobjs 55414456fccdSmrg do 55424456fccdSmrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 55434456fccdSmrg done | sort | sort -uc >/dev/null 2>&1); then 55444456fccdSmrg : 55454456fccdSmrg else 55464456fccdSmrg $echo "copying selected object files to avoid basename conflicts..." 55474456fccdSmrg 55484456fccdSmrg if test -z "$gentop"; then 55494456fccdSmrg gentop="$output_objdir/${outputname}x" 55504456fccdSmrg generated="$generated $gentop" 55514456fccdSmrg 55524456fccdSmrg $show "${rm}r $gentop" 55534456fccdSmrg $run ${rm}r "$gentop" 55544456fccdSmrg $show "$mkdir $gentop" 55554456fccdSmrg $run $mkdir "$gentop" 55564456fccdSmrg exit_status=$? 55574456fccdSmrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 55584456fccdSmrg exit $exit_status 55594456fccdSmrg fi 55604456fccdSmrg fi 55614456fccdSmrg 55624456fccdSmrg save_oldobjs=$oldobjs 55634456fccdSmrg oldobjs= 55644456fccdSmrg counter=1 55654456fccdSmrg for obj in $save_oldobjs 55664456fccdSmrg do 55674456fccdSmrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 55684456fccdSmrg case " $oldobjs " in 55694456fccdSmrg " ") oldobjs=$obj ;; 55704456fccdSmrg *[\ /]"$objbase "*) 55714456fccdSmrg while :; do 55724456fccdSmrg # Make sure we don't pick an alternate name that also 55734456fccdSmrg # overlaps. 55744456fccdSmrg newobj=lt$counter-$objbase 55754456fccdSmrg counter=`expr $counter + 1` 55764456fccdSmrg case " $oldobjs " in 55774456fccdSmrg *[\ /]"$newobj "*) ;; 55784456fccdSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 55794456fccdSmrg esac 55804456fccdSmrg done 55814456fccdSmrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 55824456fccdSmrg $run ln "$obj" "$gentop/$newobj" || 55834456fccdSmrg $run cp "$obj" "$gentop/$newobj" 55844456fccdSmrg oldobjs="$oldobjs $gentop/$newobj" 55854456fccdSmrg ;; 55864456fccdSmrg *) oldobjs="$oldobjs $obj" ;; 55874456fccdSmrg esac 55884456fccdSmrg done 55894456fccdSmrg fi 55904456fccdSmrg 55914456fccdSmrg eval cmds=\"$old_archive_cmds\" 55924456fccdSmrg 55934456fccdSmrg if len=`expr "X$cmds" : ".*"` && 55944456fccdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 55954456fccdSmrg cmds=$old_archive_cmds 55964456fccdSmrg else 55974456fccdSmrg # the command line is too long to link in one step, link in parts 55984456fccdSmrg $echo "using piecewise archive linking..." 55994456fccdSmrg save_RANLIB=$RANLIB 56004456fccdSmrg RANLIB=: 56014456fccdSmrg objlist= 56024456fccdSmrg concat_cmds= 56034456fccdSmrg save_oldobjs=$oldobjs 56044456fccdSmrg 56054456fccdSmrg # Is there a better way of finding the last object in the list? 56064456fccdSmrg for obj in $save_oldobjs 56074456fccdSmrg do 56084456fccdSmrg last_oldobj=$obj 56094456fccdSmrg done 56104456fccdSmrg for obj in $save_oldobjs 56114456fccdSmrg do 56124456fccdSmrg oldobjs="$objlist $obj" 56134456fccdSmrg objlist="$objlist $obj" 56144456fccdSmrg eval test_cmds=\"$old_archive_cmds\" 56154456fccdSmrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 56164456fccdSmrg test "$len" -le "$max_cmd_len"; then 56174456fccdSmrg : 56184456fccdSmrg else 56194456fccdSmrg # the above command should be used before it gets too long 56204456fccdSmrg oldobjs=$objlist 56214456fccdSmrg if test "$obj" = "$last_oldobj" ; then 56224456fccdSmrg RANLIB=$save_RANLIB 56234456fccdSmrg fi 56244456fccdSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 56254456fccdSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 56264456fccdSmrg objlist= 56274456fccdSmrg fi 56284456fccdSmrg done 56294456fccdSmrg RANLIB=$save_RANLIB 56304456fccdSmrg oldobjs=$objlist 56314456fccdSmrg if test "X$oldobjs" = "X" ; then 56324456fccdSmrg eval cmds=\"\$concat_cmds\" 56334456fccdSmrg else 56344456fccdSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 56354456fccdSmrg fi 56364456fccdSmrg fi 56374456fccdSmrg fi 56384456fccdSmrg save_ifs="$IFS"; IFS='~' 56394456fccdSmrg for cmd in $cmds; do 56404456fccdSmrg eval cmd=\"$cmd\" 56414456fccdSmrg IFS="$save_ifs" 56424456fccdSmrg $show "$cmd" 56434456fccdSmrg $run eval "$cmd" || exit $? 56444456fccdSmrg done 56454456fccdSmrg IFS="$save_ifs" 56464456fccdSmrg done 56474456fccdSmrg 56484456fccdSmrg if test -n "$generated"; then 56494456fccdSmrg $show "${rm}r$generated" 56504456fccdSmrg $run ${rm}r$generated 56514456fccdSmrg fi 56524456fccdSmrg 56534456fccdSmrg # Now create the libtool archive. 56544456fccdSmrg case $output in 56554456fccdSmrg *.la) 56564456fccdSmrg old_library= 56574456fccdSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 56584456fccdSmrg $show "creating $output" 56594456fccdSmrg 56604456fccdSmrg # Preserve any variables that may affect compiler behavior 56614456fccdSmrg for var in $variables_saved_for_relink; do 56624456fccdSmrg if eval test -z \"\${$var+set}\"; then 56634456fccdSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 56644456fccdSmrg elif eval var_value=\$$var; test -z "$var_value"; then 56654456fccdSmrg relink_command="$var=; export $var; $relink_command" 56664456fccdSmrg else 56674456fccdSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 56684456fccdSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 56694456fccdSmrg fi 56704456fccdSmrg done 56714456fccdSmrg # Quote the link command for shipping. 56724456fccdSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 567342d69509Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 56744456fccdSmrg if test "$hardcode_automatic" = yes ; then 56754456fccdSmrg relink_command= 56764456fccdSmrg fi 56774456fccdSmrg 56784456fccdSmrg 56794456fccdSmrg # Only create the output if not a dry run. 56804456fccdSmrg if test -z "$run"; then 56814456fccdSmrg for installed in no yes; do 56824456fccdSmrg if test "$installed" = yes; then 56834456fccdSmrg if test -z "$install_libdir"; then 56844456fccdSmrg break 56854456fccdSmrg fi 56864456fccdSmrg output="$output_objdir/$outputname"i 56874456fccdSmrg # Replace all uninstalled libtool libraries with the installed ones 56884456fccdSmrg newdependency_libs= 56894456fccdSmrg for deplib in $dependency_libs; do 56904456fccdSmrg case $deplib in 56914456fccdSmrg *.la) 56924456fccdSmrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 56934456fccdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 56944456fccdSmrg if test -z "$libdir"; then 56954456fccdSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 56964456fccdSmrg exit $EXIT_FAILURE 56974456fccdSmrg fi 56984456fccdSmrg newdependency_libs="$newdependency_libs $libdir/$name" 56994456fccdSmrg ;; 57004456fccdSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 57014456fccdSmrg esac 57024456fccdSmrg done 57034456fccdSmrg dependency_libs="$newdependency_libs" 57044456fccdSmrg newdlfiles= 57054456fccdSmrg for lib in $dlfiles; do 57064456fccdSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57074456fccdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57084456fccdSmrg if test -z "$libdir"; then 57094456fccdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57104456fccdSmrg exit $EXIT_FAILURE 57114456fccdSmrg fi 57124456fccdSmrg newdlfiles="$newdlfiles $libdir/$name" 57134456fccdSmrg done 57144456fccdSmrg dlfiles="$newdlfiles" 57154456fccdSmrg newdlprefiles= 57164456fccdSmrg for lib in $dlprefiles; do 57174456fccdSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 57184456fccdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 57194456fccdSmrg if test -z "$libdir"; then 57204456fccdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 57214456fccdSmrg exit $EXIT_FAILURE 57224456fccdSmrg fi 57234456fccdSmrg newdlprefiles="$newdlprefiles $libdir/$name" 57244456fccdSmrg done 57254456fccdSmrg dlprefiles="$newdlprefiles" 57264456fccdSmrg else 57274456fccdSmrg newdlfiles= 57284456fccdSmrg for lib in $dlfiles; do 57294456fccdSmrg case $lib in 57304456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57314456fccdSmrg *) abs=`pwd`"/$lib" ;; 57324456fccdSmrg esac 57334456fccdSmrg newdlfiles="$newdlfiles $abs" 57344456fccdSmrg done 57354456fccdSmrg dlfiles="$newdlfiles" 57364456fccdSmrg newdlprefiles= 57374456fccdSmrg for lib in $dlprefiles; do 57384456fccdSmrg case $lib in 57394456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57404456fccdSmrg *) abs=`pwd`"/$lib" ;; 57414456fccdSmrg esac 57424456fccdSmrg newdlprefiles="$newdlprefiles $abs" 57434456fccdSmrg done 57444456fccdSmrg dlprefiles="$newdlprefiles" 57454456fccdSmrg fi 57464456fccdSmrg $rm $output 57474456fccdSmrg # place dlname in correct position for cygwin 57484456fccdSmrg tdlname=$dlname 57494456fccdSmrg case $host,$output,$installed,$module,$dlname in 57504456fccdSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 57514456fccdSmrg esac 57524456fccdSmrg $echo > $output "\ 57534456fccdSmrg# $outputname - a libtool library file 57544456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 57554456fccdSmrg# 57564456fccdSmrg# Please DO NOT delete this file! 57574456fccdSmrg# It is necessary for linking the library. 57584456fccdSmrg 57594456fccdSmrg# The name that we can dlopen(3). 57604456fccdSmrgdlname='$tdlname' 57614456fccdSmrg 57624456fccdSmrg# Names of this library. 57634456fccdSmrglibrary_names='$library_names' 57644456fccdSmrg 57654456fccdSmrg# The name of the static archive. 57664456fccdSmrgold_library='$old_library' 57674456fccdSmrg 57684456fccdSmrg# Libraries that this one depends upon. 57694456fccdSmrgdependency_libs='$dependency_libs' 57704456fccdSmrg 57714456fccdSmrg# Version information for $libname. 57724456fccdSmrgcurrent=$current 57734456fccdSmrgage=$age 57744456fccdSmrgrevision=$revision 57754456fccdSmrg 57764456fccdSmrg# Is this an already installed library? 57774456fccdSmrginstalled=$installed 57784456fccdSmrg 57794456fccdSmrg# Should we warn about portability when linking against -modules? 57804456fccdSmrgshouldnotlink=$module 57814456fccdSmrg 57824456fccdSmrg# Files to dlopen/dlpreopen 57834456fccdSmrgdlopen='$dlfiles' 57844456fccdSmrgdlpreopen='$dlprefiles' 57854456fccdSmrg 57864456fccdSmrg# Directory that this library needs to be installed in: 57874456fccdSmrglibdir='$install_libdir'" 57884456fccdSmrg if test "$installed" = no && test "$need_relink" = yes; then 57894456fccdSmrg $echo >> $output "\ 57904456fccdSmrgrelink_command=\"$relink_command\"" 57914456fccdSmrg fi 57924456fccdSmrg done 57934456fccdSmrg fi 57944456fccdSmrg 57954456fccdSmrg # Do a symbolic link so that the libtool archive can be found in 57964456fccdSmrg # LD_LIBRARY_PATH before the program is installed. 57974456fccdSmrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 57984456fccdSmrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 57994456fccdSmrg ;; 58004456fccdSmrg esac 58014456fccdSmrg exit $EXIT_SUCCESS 58024456fccdSmrg ;; 58034456fccdSmrg 58044456fccdSmrg # libtool install mode 58054456fccdSmrg install) 58064456fccdSmrg modename="$modename: install" 58074456fccdSmrg 58084456fccdSmrg # There may be an optional sh(1) argument at the beginning of 58094456fccdSmrg # install_prog (especially on Windows NT). 58104456fccdSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 58114456fccdSmrg # Allow the use of GNU shtool's install command. 58124456fccdSmrg $echo "X$nonopt" | grep shtool > /dev/null; then 58134456fccdSmrg # Aesthetically quote it. 58144456fccdSmrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 58154456fccdSmrg case $arg in 58164456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58174456fccdSmrg arg="\"$arg\"" 58184456fccdSmrg ;; 58194456fccdSmrg esac 58204456fccdSmrg install_prog="$arg " 58214456fccdSmrg arg="$1" 58224456fccdSmrg shift 58234456fccdSmrg else 58244456fccdSmrg install_prog= 58254456fccdSmrg arg=$nonopt 58264456fccdSmrg fi 58274456fccdSmrg 58284456fccdSmrg # The real first argument should be the name of the installation program. 58294456fccdSmrg # Aesthetically quote it. 58304456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58314456fccdSmrg case $arg in 58324456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58334456fccdSmrg arg="\"$arg\"" 58344456fccdSmrg ;; 58354456fccdSmrg esac 58364456fccdSmrg install_prog="$install_prog$arg" 58374456fccdSmrg 58384456fccdSmrg # We need to accept at least all the BSD install flags. 58394456fccdSmrg dest= 58404456fccdSmrg files= 58414456fccdSmrg opts= 58424456fccdSmrg prev= 58434456fccdSmrg install_type= 58444456fccdSmrg isdir=no 58454456fccdSmrg stripme= 58464456fccdSmrg for arg 58474456fccdSmrg do 58484456fccdSmrg if test -n "$dest"; then 58494456fccdSmrg files="$files $dest" 58504456fccdSmrg dest=$arg 58514456fccdSmrg continue 58524456fccdSmrg fi 58534456fccdSmrg 58544456fccdSmrg case $arg in 58554456fccdSmrg -d) isdir=yes ;; 58564456fccdSmrg -f) 58574456fccdSmrg case " $install_prog " in 58584456fccdSmrg *[\\\ /]cp\ *) ;; 58594456fccdSmrg *) prev=$arg ;; 58604456fccdSmrg esac 58614456fccdSmrg ;; 58624456fccdSmrg -g | -m | -o) prev=$arg ;; 58634456fccdSmrg -s) 58644456fccdSmrg stripme=" -s" 58654456fccdSmrg continue 58664456fccdSmrg ;; 58674456fccdSmrg -*) 58684456fccdSmrg ;; 58694456fccdSmrg *) 58704456fccdSmrg # If the previous option needed an argument, then skip it. 58714456fccdSmrg if test -n "$prev"; then 58724456fccdSmrg prev= 58734456fccdSmrg else 58744456fccdSmrg dest=$arg 58754456fccdSmrg continue 58764456fccdSmrg fi 58774456fccdSmrg ;; 58784456fccdSmrg esac 58794456fccdSmrg 58804456fccdSmrg # Aesthetically quote the argument. 58814456fccdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58824456fccdSmrg case $arg in 58834456fccdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58844456fccdSmrg arg="\"$arg\"" 58854456fccdSmrg ;; 58864456fccdSmrg esac 58874456fccdSmrg install_prog="$install_prog $arg" 58884456fccdSmrg done 58894456fccdSmrg 58904456fccdSmrg if test -z "$install_prog"; then 58914456fccdSmrg $echo "$modename: you must specify an install program" 1>&2 58924456fccdSmrg $echo "$help" 1>&2 58934456fccdSmrg exit $EXIT_FAILURE 58944456fccdSmrg fi 58954456fccdSmrg 58964456fccdSmrg if test -n "$prev"; then 58974456fccdSmrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 58984456fccdSmrg $echo "$help" 1>&2 58994456fccdSmrg exit $EXIT_FAILURE 59004456fccdSmrg fi 59014456fccdSmrg 59024456fccdSmrg if test -z "$files"; then 59034456fccdSmrg if test -z "$dest"; then 59044456fccdSmrg $echo "$modename: no file or destination specified" 1>&2 59054456fccdSmrg else 59064456fccdSmrg $echo "$modename: you must specify a destination" 1>&2 59074456fccdSmrg fi 59084456fccdSmrg $echo "$help" 1>&2 59094456fccdSmrg exit $EXIT_FAILURE 59104456fccdSmrg fi 59114456fccdSmrg 59124456fccdSmrg # Strip any trailing slash from the destination. 59134456fccdSmrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 59144456fccdSmrg 59154456fccdSmrg # Check to see that the destination is a directory. 59164456fccdSmrg test -d "$dest" && isdir=yes 59174456fccdSmrg if test "$isdir" = yes; then 59184456fccdSmrg destdir="$dest" 59194456fccdSmrg destname= 59204456fccdSmrg else 59214456fccdSmrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 59224456fccdSmrg test "X$destdir" = "X$dest" && destdir=. 59234456fccdSmrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 59244456fccdSmrg 59254456fccdSmrg # Not a directory, so check to see that there is only one file specified. 59264456fccdSmrg set dummy $files 59274456fccdSmrg if test "$#" -gt 2; then 59284456fccdSmrg $echo "$modename: \`$dest' is not a directory" 1>&2 59294456fccdSmrg $echo "$help" 1>&2 59304456fccdSmrg exit $EXIT_FAILURE 59314456fccdSmrg fi 59324456fccdSmrg fi 59334456fccdSmrg case $destdir in 59344456fccdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 59354456fccdSmrg *) 59364456fccdSmrg for file in $files; do 59374456fccdSmrg case $file in 59384456fccdSmrg *.lo) ;; 59394456fccdSmrg *) 59404456fccdSmrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 59414456fccdSmrg $echo "$help" 1>&2 59424456fccdSmrg exit $EXIT_FAILURE 59434456fccdSmrg ;; 59444456fccdSmrg esac 59454456fccdSmrg done 59464456fccdSmrg ;; 59474456fccdSmrg esac 59484456fccdSmrg 59494456fccdSmrg # This variable tells wrapper scripts just to set variables rather 59504456fccdSmrg # than running their programs. 59514456fccdSmrg libtool_install_magic="$magic" 59524456fccdSmrg 59534456fccdSmrg staticlibs= 59544456fccdSmrg future_libdirs= 59554456fccdSmrg current_libdirs= 59564456fccdSmrg for file in $files; do 59574456fccdSmrg 59584456fccdSmrg # Do each installation. 59594456fccdSmrg case $file in 59604456fccdSmrg *.$libext) 59614456fccdSmrg # Do the static libraries later. 59624456fccdSmrg staticlibs="$staticlibs $file" 59634456fccdSmrg ;; 59644456fccdSmrg 59654456fccdSmrg *.la) 59664456fccdSmrg # Check to see that this really is a libtool archive. 59674456fccdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 59684456fccdSmrg else 59694456fccdSmrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 59704456fccdSmrg $echo "$help" 1>&2 59714456fccdSmrg exit $EXIT_FAILURE 59724456fccdSmrg fi 59734456fccdSmrg 59744456fccdSmrg library_names= 59754456fccdSmrg old_library= 59764456fccdSmrg relink_command= 59774456fccdSmrg # If there is no directory component, then add one. 59784456fccdSmrg case $file in 59794456fccdSmrg */* | *\\*) . $file ;; 59804456fccdSmrg *) . ./$file ;; 59814456fccdSmrg esac 59824456fccdSmrg 59834456fccdSmrg # Add the libdir to current_libdirs if it is the destination. 59844456fccdSmrg if test "X$destdir" = "X$libdir"; then 59854456fccdSmrg case "$current_libdirs " in 59864456fccdSmrg *" $libdir "*) ;; 59874456fccdSmrg *) current_libdirs="$current_libdirs $libdir" ;; 59884456fccdSmrg esac 59894456fccdSmrg else 59904456fccdSmrg # Note the libdir as a future libdir. 59914456fccdSmrg case "$future_libdirs " in 59924456fccdSmrg *" $libdir "*) ;; 59934456fccdSmrg *) future_libdirs="$future_libdirs $libdir" ;; 59944456fccdSmrg esac 59954456fccdSmrg fi 59964456fccdSmrg 59974456fccdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 59984456fccdSmrg test "X$dir" = "X$file/" && dir= 59994456fccdSmrg dir="$dir$objdir" 60004456fccdSmrg 60014456fccdSmrg if test -n "$relink_command"; then 60024456fccdSmrg # Determine the prefix the user has applied to our future dir. 60034456fccdSmrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 60044456fccdSmrg 60054456fccdSmrg # Don't allow the user to place us outside of our expected 60064456fccdSmrg # location b/c this prevents finding dependent libraries that 60074456fccdSmrg # are installed to the same prefix. 60084456fccdSmrg # At present, this check doesn't affect windows .dll's that 60094456fccdSmrg # are installed into $libdir/../bin (currently, that works fine) 60104456fccdSmrg # but it's something to keep an eye on. 60114456fccdSmrg if test "$inst_prefix_dir" = "$destdir"; then 60124456fccdSmrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 60134456fccdSmrg exit $EXIT_FAILURE 60144456fccdSmrg fi 60154456fccdSmrg 60164456fccdSmrg if test -n "$inst_prefix_dir"; then 60174456fccdSmrg # Stick the inst_prefix_dir data into the link command. 601842d69509Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 60194456fccdSmrg else 602042d69509Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 60214456fccdSmrg fi 60224456fccdSmrg 60234456fccdSmrg $echo "$modename: warning: relinking \`$file'" 1>&2 60244456fccdSmrg $show "$relink_command" 60254456fccdSmrg if $run eval "$relink_command"; then : 60264456fccdSmrg else 60274456fccdSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 60284456fccdSmrg exit $EXIT_FAILURE 60294456fccdSmrg fi 60304456fccdSmrg fi 60314456fccdSmrg 60324456fccdSmrg # See the names of the shared library. 60334456fccdSmrg set dummy $library_names 60344456fccdSmrg if test -n "$2"; then 60354456fccdSmrg realname="$2" 60364456fccdSmrg shift 60374456fccdSmrg shift 60384456fccdSmrg 60394456fccdSmrg srcname="$realname" 60404456fccdSmrg test -n "$relink_command" && srcname="$realname"T 60414456fccdSmrg 60424456fccdSmrg # Install the shared library and build the symlinks. 60434456fccdSmrg $show "$install_prog $dir/$srcname $destdir/$realname" 60444456fccdSmrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 60454456fccdSmrg if test -n "$stripme" && test -n "$striplib"; then 60464456fccdSmrg $show "$striplib $destdir/$realname" 60474456fccdSmrg $run eval "$striplib $destdir/$realname" || exit $? 60484456fccdSmrg fi 60494456fccdSmrg 60504456fccdSmrg if test "$#" -gt 0; then 60514456fccdSmrg # Delete the old symlinks, and create new ones. 60524456fccdSmrg # Try `ln -sf' first, because the `ln' binary might depend on 60534456fccdSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 60544456fccdSmrg # so we also need to try rm && ln -s. 60554456fccdSmrg for linkname 60564456fccdSmrg do 60574456fccdSmrg if test "$linkname" != "$realname"; then 60584456fccdSmrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60594456fccdSmrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60604456fccdSmrg fi 60614456fccdSmrg done 60624456fccdSmrg fi 60634456fccdSmrg 60644456fccdSmrg # Do each command in the postinstall commands. 60654456fccdSmrg lib="$destdir/$realname" 60664456fccdSmrg cmds=$postinstall_cmds 60674456fccdSmrg save_ifs="$IFS"; IFS='~' 60684456fccdSmrg for cmd in $cmds; do 60694456fccdSmrg IFS="$save_ifs" 60704456fccdSmrg eval cmd=\"$cmd\" 60714456fccdSmrg $show "$cmd" 60724456fccdSmrg $run eval "$cmd" || { 60734456fccdSmrg lt_exit=$? 60744456fccdSmrg 60754456fccdSmrg # Restore the uninstalled library and exit 60764456fccdSmrg if test "$mode" = relink; then 60774456fccdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 60784456fccdSmrg fi 60794456fccdSmrg 60804456fccdSmrg exit $lt_exit 60814456fccdSmrg } 60824456fccdSmrg done 60834456fccdSmrg IFS="$save_ifs" 60844456fccdSmrg fi 60854456fccdSmrg 60864456fccdSmrg # Install the pseudo-library for information purposes. 60874456fccdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60884456fccdSmrg instname="$dir/$name"i 60894456fccdSmrg $show "$install_prog $instname $destdir/$name" 60904456fccdSmrg $run eval "$install_prog $instname $destdir/$name" || exit $? 60914456fccdSmrg 60924456fccdSmrg # Maybe install the static library, too. 60934456fccdSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 60944456fccdSmrg ;; 60954456fccdSmrg 60964456fccdSmrg *.lo) 60974456fccdSmrg # Install (i.e. copy) a libtool object. 60984456fccdSmrg 60994456fccdSmrg # Figure out destination file name, if it wasn't already specified. 61004456fccdSmrg if test -n "$destname"; then 61014456fccdSmrg destfile="$destdir/$destname" 61024456fccdSmrg else 61034456fccdSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61044456fccdSmrg destfile="$destdir/$destfile" 61054456fccdSmrg fi 61064456fccdSmrg 61074456fccdSmrg # Deduce the name of the destination old-style object file. 61084456fccdSmrg case $destfile in 61094456fccdSmrg *.lo) 61104456fccdSmrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 61114456fccdSmrg ;; 61124456fccdSmrg *.$objext) 61134456fccdSmrg staticdest="$destfile" 61144456fccdSmrg destfile= 61154456fccdSmrg ;; 61164456fccdSmrg *) 61174456fccdSmrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 61184456fccdSmrg $echo "$help" 1>&2 61194456fccdSmrg exit $EXIT_FAILURE 61204456fccdSmrg ;; 61214456fccdSmrg esac 61224456fccdSmrg 61234456fccdSmrg # Install the libtool object if requested. 61244456fccdSmrg if test -n "$destfile"; then 61254456fccdSmrg $show "$install_prog $file $destfile" 61264456fccdSmrg $run eval "$install_prog $file $destfile" || exit $? 61274456fccdSmrg fi 61284456fccdSmrg 61294456fccdSmrg # Install the old object if enabled. 61304456fccdSmrg if test "$build_old_libs" = yes; then 61314456fccdSmrg # Deduce the name of the old-style object file. 61324456fccdSmrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 61334456fccdSmrg 61344456fccdSmrg $show "$install_prog $staticobj $staticdest" 61354456fccdSmrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 61364456fccdSmrg fi 61374456fccdSmrg exit $EXIT_SUCCESS 61384456fccdSmrg ;; 61394456fccdSmrg 61404456fccdSmrg *) 61414456fccdSmrg # Figure out destination file name, if it wasn't already specified. 61424456fccdSmrg if test -n "$destname"; then 61434456fccdSmrg destfile="$destdir/$destname" 61444456fccdSmrg else 61454456fccdSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61464456fccdSmrg destfile="$destdir/$destfile" 61474456fccdSmrg fi 61484456fccdSmrg 61494456fccdSmrg # If the file is missing, and there is a .exe on the end, strip it 61504456fccdSmrg # because it is most likely a libtool script we actually want to 61514456fccdSmrg # install 61524456fccdSmrg stripped_ext="" 61534456fccdSmrg case $file in 61544456fccdSmrg *.exe) 61554456fccdSmrg if test ! -f "$file"; then 61564456fccdSmrg file=`$echo $file|${SED} 's,.exe$,,'` 61574456fccdSmrg stripped_ext=".exe" 61584456fccdSmrg fi 61594456fccdSmrg ;; 61604456fccdSmrg esac 61614456fccdSmrg 61624456fccdSmrg # Do a test to see if this is really a libtool program. 61634456fccdSmrg case $host in 61644456fccdSmrg *cygwin*|*mingw*) 61654456fccdSmrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 61664456fccdSmrg ;; 61674456fccdSmrg *) 61684456fccdSmrg wrapper=$file 61694456fccdSmrg ;; 61704456fccdSmrg esac 61714456fccdSmrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 61724456fccdSmrg notinst_deplibs= 61734456fccdSmrg relink_command= 61744456fccdSmrg 61754456fccdSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 61764456fccdSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 61774456fccdSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 61784456fccdSmrg # `FILE.' does not work on cygwin managed mounts. 61794456fccdSmrg # 61804456fccdSmrg # If there is no directory component, then add one. 61814456fccdSmrg case $wrapper in 61824456fccdSmrg */* | *\\*) . ${wrapper} ;; 61834456fccdSmrg *) . ./${wrapper} ;; 61844456fccdSmrg esac 61854456fccdSmrg 61864456fccdSmrg # Check the variables that should have been set. 61874456fccdSmrg if test -z "$notinst_deplibs"; then 61884456fccdSmrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 61894456fccdSmrg exit $EXIT_FAILURE 61904456fccdSmrg fi 61914456fccdSmrg 61924456fccdSmrg finalize=yes 61934456fccdSmrg for lib in $notinst_deplibs; do 61944456fccdSmrg # Check to see that each library is installed. 61954456fccdSmrg libdir= 61964456fccdSmrg if test -f "$lib"; then 61974456fccdSmrg # If there is no directory component, then add one. 61984456fccdSmrg case $lib in 61994456fccdSmrg */* | *\\*) . $lib ;; 62004456fccdSmrg *) . ./$lib ;; 62014456fccdSmrg esac 62024456fccdSmrg fi 62034456fccdSmrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 62044456fccdSmrg if test -n "$libdir" && test ! -f "$libfile"; then 62054456fccdSmrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 62064456fccdSmrg finalize=no 62074456fccdSmrg fi 62084456fccdSmrg done 62094456fccdSmrg 62104456fccdSmrg relink_command= 62114456fccdSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 62124456fccdSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 62134456fccdSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 62144456fccdSmrg # `FILE.' does not work on cygwin managed mounts. 62154456fccdSmrg # 62164456fccdSmrg # If there is no directory component, then add one. 62174456fccdSmrg case $wrapper in 62184456fccdSmrg */* | *\\*) . ${wrapper} ;; 62194456fccdSmrg *) . ./${wrapper} ;; 62204456fccdSmrg esac 62214456fccdSmrg 62224456fccdSmrg outputname= 62234456fccdSmrg if test "$fast_install" = no && test -n "$relink_command"; then 62244456fccdSmrg if test "$finalize" = yes && test -z "$run"; then 62254456fccdSmrg tmpdir=`func_mktempdir` 62264456fccdSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 62274456fccdSmrg outputname="$tmpdir/$file" 62284456fccdSmrg # Replace the output file specification. 622942d69509Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 62304456fccdSmrg 62314456fccdSmrg $show "$relink_command" 62324456fccdSmrg if $run eval "$relink_command"; then : 62334456fccdSmrg else 62344456fccdSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 62354456fccdSmrg ${rm}r "$tmpdir" 62364456fccdSmrg continue 62374456fccdSmrg fi 62384456fccdSmrg file="$outputname" 62394456fccdSmrg else 62404456fccdSmrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 62414456fccdSmrg fi 62424456fccdSmrg else 62434456fccdSmrg # Install the binary that we compiled earlier. 62444456fccdSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 62454456fccdSmrg fi 62464456fccdSmrg fi 62474456fccdSmrg 62484456fccdSmrg # remove .exe since cygwin /usr/bin/install will append another 62494456fccdSmrg # one anyway 62504456fccdSmrg case $install_prog,$host in 62514456fccdSmrg */usr/bin/install*,*cygwin*) 62524456fccdSmrg case $file:$destfile in 62534456fccdSmrg *.exe:*.exe) 62544456fccdSmrg # this is ok 62554456fccdSmrg ;; 62564456fccdSmrg *.exe:*) 62574456fccdSmrg destfile=$destfile.exe 62584456fccdSmrg ;; 62594456fccdSmrg *:*.exe) 62604456fccdSmrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 62614456fccdSmrg ;; 62624456fccdSmrg esac 62634456fccdSmrg ;; 62644456fccdSmrg esac 62654456fccdSmrg $show "$install_prog$stripme $file $destfile" 62664456fccdSmrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 62674456fccdSmrg test -n "$outputname" && ${rm}r "$tmpdir" 62684456fccdSmrg ;; 62694456fccdSmrg esac 62704456fccdSmrg done 62714456fccdSmrg 62724456fccdSmrg for file in $staticlibs; do 62734456fccdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 62744456fccdSmrg 62754456fccdSmrg # Set up the ranlib parameters. 62764456fccdSmrg oldlib="$destdir/$name" 62774456fccdSmrg 62784456fccdSmrg $show "$install_prog $file $oldlib" 62794456fccdSmrg $run eval "$install_prog \$file \$oldlib" || exit $? 62804456fccdSmrg 62814456fccdSmrg if test -n "$stripme" && test -n "$old_striplib"; then 62824456fccdSmrg $show "$old_striplib $oldlib" 62834456fccdSmrg $run eval "$old_striplib $oldlib" || exit $? 62844456fccdSmrg fi 62854456fccdSmrg 62864456fccdSmrg # Do each command in the postinstall commands. 62874456fccdSmrg cmds=$old_postinstall_cmds 62884456fccdSmrg save_ifs="$IFS"; IFS='~' 62894456fccdSmrg for cmd in $cmds; do 62904456fccdSmrg IFS="$save_ifs" 62914456fccdSmrg eval cmd=\"$cmd\" 62924456fccdSmrg $show "$cmd" 62934456fccdSmrg $run eval "$cmd" || exit $? 62944456fccdSmrg done 62954456fccdSmrg IFS="$save_ifs" 62964456fccdSmrg done 62974456fccdSmrg 62984456fccdSmrg if test -n "$future_libdirs"; then 62994456fccdSmrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 63004456fccdSmrg fi 63014456fccdSmrg 63024456fccdSmrg if test -n "$current_libdirs"; then 63034456fccdSmrg # Maybe just do a dry run. 63044456fccdSmrg test -n "$run" && current_libdirs=" -n$current_libdirs" 63054456fccdSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 63064456fccdSmrg else 63074456fccdSmrg exit $EXIT_SUCCESS 63084456fccdSmrg fi 63094456fccdSmrg ;; 63104456fccdSmrg 63114456fccdSmrg # libtool finish mode 63124456fccdSmrg finish) 63134456fccdSmrg modename="$modename: finish" 63144456fccdSmrg libdirs="$nonopt" 63154456fccdSmrg admincmds= 63164456fccdSmrg 63174456fccdSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 63184456fccdSmrg for dir 63194456fccdSmrg do 63204456fccdSmrg libdirs="$libdirs $dir" 63214456fccdSmrg done 63224456fccdSmrg 63234456fccdSmrg for libdir in $libdirs; do 63244456fccdSmrg if test -n "$finish_cmds"; then 63254456fccdSmrg # Do each command in the finish commands. 63264456fccdSmrg cmds=$finish_cmds 63274456fccdSmrg save_ifs="$IFS"; IFS='~' 63284456fccdSmrg for cmd in $cmds; do 63294456fccdSmrg IFS="$save_ifs" 63304456fccdSmrg eval cmd=\"$cmd\" 63314456fccdSmrg $show "$cmd" 63324456fccdSmrg $run eval "$cmd" || admincmds="$admincmds 63334456fccdSmrg $cmd" 63344456fccdSmrg done 63354456fccdSmrg IFS="$save_ifs" 63364456fccdSmrg fi 63374456fccdSmrg if test -n "$finish_eval"; then 63384456fccdSmrg # Do the single finish_eval. 63394456fccdSmrg eval cmds=\"$finish_eval\" 63404456fccdSmrg $run eval "$cmds" || admincmds="$admincmds 63414456fccdSmrg $cmds" 63424456fccdSmrg fi 63434456fccdSmrg done 63444456fccdSmrg fi 63454456fccdSmrg 63464456fccdSmrg # Exit here if they wanted silent mode. 63474456fccdSmrg test "$show" = : && exit $EXIT_SUCCESS 63484456fccdSmrg 63494456fccdSmrg $echo "X----------------------------------------------------------------------" | $Xsed 63504456fccdSmrg $echo "Libraries have been installed in:" 63514456fccdSmrg for libdir in $libdirs; do 63524456fccdSmrg $echo " $libdir" 63534456fccdSmrg done 63544456fccdSmrg $echo 63554456fccdSmrg $echo "If you ever happen to want to link against installed libraries" 63564456fccdSmrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 63574456fccdSmrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 63584456fccdSmrg $echo "flag during linking and do at least one of the following:" 63594456fccdSmrg if test -n "$shlibpath_var"; then 63604456fccdSmrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 63614456fccdSmrg $echo " during execution" 63624456fccdSmrg fi 63634456fccdSmrg if test -n "$runpath_var"; then 63644456fccdSmrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 63654456fccdSmrg $echo " during linking" 63664456fccdSmrg fi 63674456fccdSmrg if test -n "$hardcode_libdir_flag_spec"; then 63684456fccdSmrg libdir=LIBDIR 63694456fccdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 63704456fccdSmrg 63714456fccdSmrg $echo " - use the \`$flag' linker flag" 63724456fccdSmrg fi 63734456fccdSmrg if test -n "$admincmds"; then 63744456fccdSmrg $echo " - have your system administrator run these commands:$admincmds" 63754456fccdSmrg fi 63764456fccdSmrg if test -f /etc/ld.so.conf; then 63774456fccdSmrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 63784456fccdSmrg fi 63794456fccdSmrg $echo 63804456fccdSmrg $echo "See any operating system documentation about shared libraries for" 63814456fccdSmrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 63824456fccdSmrg $echo "X----------------------------------------------------------------------" | $Xsed 63834456fccdSmrg exit $EXIT_SUCCESS 63844456fccdSmrg ;; 63854456fccdSmrg 63864456fccdSmrg # libtool execute mode 63874456fccdSmrg execute) 63884456fccdSmrg modename="$modename: execute" 63894456fccdSmrg 63904456fccdSmrg # The first argument is the command name. 63914456fccdSmrg cmd="$nonopt" 63924456fccdSmrg if test -z "$cmd"; then 63934456fccdSmrg $echo "$modename: you must specify a COMMAND" 1>&2 63944456fccdSmrg $echo "$help" 63954456fccdSmrg exit $EXIT_FAILURE 63964456fccdSmrg fi 63974456fccdSmrg 63984456fccdSmrg # Handle -dlopen flags immediately. 63994456fccdSmrg for file in $execute_dlfiles; do 64004456fccdSmrg if test ! -f "$file"; then 64014456fccdSmrg $echo "$modename: \`$file' is not a file" 1>&2 64024456fccdSmrg $echo "$help" 1>&2 64034456fccdSmrg exit $EXIT_FAILURE 64044456fccdSmrg fi 64054456fccdSmrg 64064456fccdSmrg dir= 64074456fccdSmrg case $file in 64084456fccdSmrg *.la) 64094456fccdSmrg # Check to see that this really is a libtool archive. 64104456fccdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 64114456fccdSmrg else 64124456fccdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 64134456fccdSmrg $echo "$help" 1>&2 64144456fccdSmrg exit $EXIT_FAILURE 64154456fccdSmrg fi 64164456fccdSmrg 64174456fccdSmrg # Read the libtool library. 64184456fccdSmrg dlname= 64194456fccdSmrg library_names= 64204456fccdSmrg 64214456fccdSmrg # If there is no directory component, then add one. 64224456fccdSmrg case $file in 64234456fccdSmrg */* | *\\*) . $file ;; 64244456fccdSmrg *) . ./$file ;; 64254456fccdSmrg esac 64264456fccdSmrg 64274456fccdSmrg # Skip this library if it cannot be dlopened. 64284456fccdSmrg if test -z "$dlname"; then 64294456fccdSmrg # Warn if it was a shared library. 64304456fccdSmrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 64314456fccdSmrg continue 64324456fccdSmrg fi 64334456fccdSmrg 64344456fccdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64354456fccdSmrg test "X$dir" = "X$file" && dir=. 64364456fccdSmrg 64374456fccdSmrg if test -f "$dir/$objdir/$dlname"; then 64384456fccdSmrg dir="$dir/$objdir" 64394456fccdSmrg else 644042d69509Smrg if test ! -f "$dir/$dlname"; then 644142d69509Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 644242d69509Smrg exit $EXIT_FAILURE 644342d69509Smrg fi 64444456fccdSmrg fi 64454456fccdSmrg ;; 64464456fccdSmrg 64474456fccdSmrg *.lo) 64484456fccdSmrg # Just add the directory containing the .lo file. 64494456fccdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64504456fccdSmrg test "X$dir" = "X$file" && dir=. 64514456fccdSmrg ;; 64524456fccdSmrg 64534456fccdSmrg *) 64544456fccdSmrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 64554456fccdSmrg continue 64564456fccdSmrg ;; 64574456fccdSmrg esac 64584456fccdSmrg 64594456fccdSmrg # Get the absolute pathname. 64604456fccdSmrg absdir=`cd "$dir" && pwd` 64614456fccdSmrg test -n "$absdir" && dir="$absdir" 64624456fccdSmrg 64634456fccdSmrg # Now add the directory to shlibpath_var. 64644456fccdSmrg if eval "test -z \"\$$shlibpath_var\""; then 64654456fccdSmrg eval "$shlibpath_var=\"\$dir\"" 64664456fccdSmrg else 64674456fccdSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 64684456fccdSmrg fi 64694456fccdSmrg done 64704456fccdSmrg 64714456fccdSmrg # This variable tells wrapper scripts just to set shlibpath_var 64724456fccdSmrg # rather than running their programs. 64734456fccdSmrg libtool_execute_magic="$magic" 64744456fccdSmrg 64754456fccdSmrg # Check if any of the arguments is a wrapper script. 64764456fccdSmrg args= 64774456fccdSmrg for file 64784456fccdSmrg do 64794456fccdSmrg case $file in 64804456fccdSmrg -*) ;; 64814456fccdSmrg *) 64824456fccdSmrg # Do a test to see if this is really a libtool program. 64834456fccdSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 64844456fccdSmrg # If there is no directory component, then add one. 64854456fccdSmrg case $file in 64864456fccdSmrg */* | *\\*) . $file ;; 64874456fccdSmrg *) . ./$file ;; 64884456fccdSmrg esac 64894456fccdSmrg 64904456fccdSmrg # Transform arg to wrapped name. 64914456fccdSmrg file="$progdir/$program" 64924456fccdSmrg fi 64934456fccdSmrg ;; 64944456fccdSmrg esac 64954456fccdSmrg # Quote arguments (to preserve shell metacharacters). 64964456fccdSmrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 64974456fccdSmrg args="$args \"$file\"" 64984456fccdSmrg done 64994456fccdSmrg 65004456fccdSmrg if test -z "$run"; then 65014456fccdSmrg if test -n "$shlibpath_var"; then 65024456fccdSmrg # Export the shlibpath_var. 65034456fccdSmrg eval "export $shlibpath_var" 65044456fccdSmrg fi 65054456fccdSmrg 65064456fccdSmrg # Restore saved environment variables 650742d69509Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 650842d69509Smrg do 650942d69509Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 651042d69509Smrg $lt_var=\$save_$lt_var; export $lt_var 651142d69509Smrg fi" 651242d69509Smrg done 65134456fccdSmrg 65144456fccdSmrg # Now prepare to actually exec the command. 65154456fccdSmrg exec_cmd="\$cmd$args" 65164456fccdSmrg else 65174456fccdSmrg # Display what would be done. 65184456fccdSmrg if test -n "$shlibpath_var"; then 65194456fccdSmrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 65204456fccdSmrg $echo "export $shlibpath_var" 65214456fccdSmrg fi 65224456fccdSmrg $echo "$cmd$args" 65234456fccdSmrg exit $EXIT_SUCCESS 65244456fccdSmrg fi 65254456fccdSmrg ;; 65264456fccdSmrg 65274456fccdSmrg # libtool clean and uninstall mode 65284456fccdSmrg clean | uninstall) 65294456fccdSmrg modename="$modename: $mode" 65304456fccdSmrg rm="$nonopt" 65314456fccdSmrg files= 65324456fccdSmrg rmforce= 65334456fccdSmrg exit_status=0 65344456fccdSmrg 65354456fccdSmrg # This variable tells wrapper scripts just to set variables rather 65364456fccdSmrg # than running their programs. 65374456fccdSmrg libtool_install_magic="$magic" 65384456fccdSmrg 65394456fccdSmrg for arg 65404456fccdSmrg do 65414456fccdSmrg case $arg in 65424456fccdSmrg -f) rm="$rm $arg"; rmforce=yes ;; 65434456fccdSmrg -*) rm="$rm $arg" ;; 65444456fccdSmrg *) files="$files $arg" ;; 65454456fccdSmrg esac 65464456fccdSmrg done 65474456fccdSmrg 65484456fccdSmrg if test -z "$rm"; then 65494456fccdSmrg $echo "$modename: you must specify an RM program" 1>&2 65504456fccdSmrg $echo "$help" 1>&2 65514456fccdSmrg exit $EXIT_FAILURE 65524456fccdSmrg fi 65534456fccdSmrg 65544456fccdSmrg rmdirs= 65554456fccdSmrg 65564456fccdSmrg origobjdir="$objdir" 65574456fccdSmrg for file in $files; do 65584456fccdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 65594456fccdSmrg if test "X$dir" = "X$file"; then 65604456fccdSmrg dir=. 65614456fccdSmrg objdir="$origobjdir" 65624456fccdSmrg else 65634456fccdSmrg objdir="$dir/$origobjdir" 65644456fccdSmrg fi 65654456fccdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 65664456fccdSmrg test "$mode" = uninstall && objdir="$dir" 65674456fccdSmrg 65684456fccdSmrg # Remember objdir for removal later, being careful to avoid duplicates 65694456fccdSmrg if test "$mode" = clean; then 65704456fccdSmrg case " $rmdirs " in 65714456fccdSmrg *" $objdir "*) ;; 65724456fccdSmrg *) rmdirs="$rmdirs $objdir" ;; 65734456fccdSmrg esac 65744456fccdSmrg fi 65754456fccdSmrg 65764456fccdSmrg # Don't error if the file doesn't exist and rm -f was used. 65774456fccdSmrg if (test -L "$file") >/dev/null 2>&1 \ 65784456fccdSmrg || (test -h "$file") >/dev/null 2>&1 \ 65794456fccdSmrg || test -f "$file"; then 65804456fccdSmrg : 65814456fccdSmrg elif test -d "$file"; then 65824456fccdSmrg exit_status=1 65834456fccdSmrg continue 65844456fccdSmrg elif test "$rmforce" = yes; then 65854456fccdSmrg continue 65864456fccdSmrg fi 65874456fccdSmrg 65884456fccdSmrg rmfiles="$file" 65894456fccdSmrg 65904456fccdSmrg case $name in 65914456fccdSmrg *.la) 65924456fccdSmrg # Possibly a libtool archive, so verify it. 65934456fccdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65944456fccdSmrg . $dir/$name 65954456fccdSmrg 65964456fccdSmrg # Delete the libtool libraries and symlinks. 65974456fccdSmrg for n in $library_names; do 65984456fccdSmrg rmfiles="$rmfiles $objdir/$n" 65994456fccdSmrg done 66004456fccdSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 66014456fccdSmrg 66024456fccdSmrg case "$mode" in 66034456fccdSmrg clean) 66044456fccdSmrg case " $library_names " in 66054456fccdSmrg # " " in the beginning catches empty $dlname 66064456fccdSmrg *" $dlname "*) ;; 66074456fccdSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 66084456fccdSmrg esac 66094456fccdSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 66104456fccdSmrg ;; 66114456fccdSmrg uninstall) 66124456fccdSmrg if test -n "$library_names"; then 66134456fccdSmrg # Do each command in the postuninstall commands. 66144456fccdSmrg cmds=$postuninstall_cmds 66154456fccdSmrg save_ifs="$IFS"; IFS='~' 66164456fccdSmrg for cmd in $cmds; do 66174456fccdSmrg IFS="$save_ifs" 66184456fccdSmrg eval cmd=\"$cmd\" 66194456fccdSmrg $show "$cmd" 66204456fccdSmrg $run eval "$cmd" 66214456fccdSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 66224456fccdSmrg exit_status=1 66234456fccdSmrg fi 66244456fccdSmrg done 66254456fccdSmrg IFS="$save_ifs" 66264456fccdSmrg fi 66274456fccdSmrg 66284456fccdSmrg if test -n "$old_library"; then 66294456fccdSmrg # Do each command in the old_postuninstall commands. 66304456fccdSmrg cmds=$old_postuninstall_cmds 66314456fccdSmrg save_ifs="$IFS"; IFS='~' 66324456fccdSmrg for cmd in $cmds; do 66334456fccdSmrg IFS="$save_ifs" 66344456fccdSmrg eval cmd=\"$cmd\" 66354456fccdSmrg $show "$cmd" 66364456fccdSmrg $run eval "$cmd" 66374456fccdSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 66384456fccdSmrg exit_status=1 66394456fccdSmrg fi 66404456fccdSmrg done 66414456fccdSmrg IFS="$save_ifs" 66424456fccdSmrg fi 66434456fccdSmrg # FIXME: should reinstall the best remaining shared library. 66444456fccdSmrg ;; 66454456fccdSmrg esac 66464456fccdSmrg fi 66474456fccdSmrg ;; 66484456fccdSmrg 66494456fccdSmrg *.lo) 66504456fccdSmrg # Possibly a libtool object, so verify it. 66514456fccdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66524456fccdSmrg 66534456fccdSmrg # Read the .lo file 66544456fccdSmrg . $dir/$name 66554456fccdSmrg 66564456fccdSmrg # Add PIC object to the list of files to remove. 66574456fccdSmrg if test -n "$pic_object" \ 66584456fccdSmrg && test "$pic_object" != none; then 66594456fccdSmrg rmfiles="$rmfiles $dir/$pic_object" 66604456fccdSmrg fi 66614456fccdSmrg 66624456fccdSmrg # Add non-PIC object to the list of files to remove. 66634456fccdSmrg if test -n "$non_pic_object" \ 66644456fccdSmrg && test "$non_pic_object" != none; then 66654456fccdSmrg rmfiles="$rmfiles $dir/$non_pic_object" 66664456fccdSmrg fi 66674456fccdSmrg fi 66684456fccdSmrg ;; 66694456fccdSmrg 66704456fccdSmrg *) 66714456fccdSmrg if test "$mode" = clean ; then 66724456fccdSmrg noexename=$name 66734456fccdSmrg case $file in 66744456fccdSmrg *.exe) 66754456fccdSmrg file=`$echo $file|${SED} 's,.exe$,,'` 66764456fccdSmrg noexename=`$echo $name|${SED} 's,.exe$,,'` 66774456fccdSmrg # $file with .exe has already been added to rmfiles, 66784456fccdSmrg # add $file without .exe 66794456fccdSmrg rmfiles="$rmfiles $file" 66804456fccdSmrg ;; 66814456fccdSmrg esac 66824456fccdSmrg # Do a test to see if this is a libtool program. 66834456fccdSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66844456fccdSmrg relink_command= 66854456fccdSmrg . $dir/$noexename 66864456fccdSmrg 66874456fccdSmrg # note $name still contains .exe if it was in $file originally 66884456fccdSmrg # as does the version of $file that was added into $rmfiles 66894456fccdSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 66904456fccdSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 66914456fccdSmrg rmfiles="$rmfiles $objdir/lt-$name" 66924456fccdSmrg fi 66934456fccdSmrg if test "X$noexename" != "X$name" ; then 66944456fccdSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 66954456fccdSmrg fi 66964456fccdSmrg fi 66974456fccdSmrg fi 66984456fccdSmrg ;; 66994456fccdSmrg esac 67004456fccdSmrg $show "$rm $rmfiles" 67014456fccdSmrg $run $rm $rmfiles || exit_status=1 67024456fccdSmrg done 67034456fccdSmrg objdir="$origobjdir" 67044456fccdSmrg 67054456fccdSmrg # Try to remove the ${objdir}s in the directories where we deleted files 67064456fccdSmrg for dir in $rmdirs; do 67074456fccdSmrg if test -d "$dir"; then 67084456fccdSmrg $show "rmdir $dir" 67094456fccdSmrg $run rmdir $dir >/dev/null 2>&1 67104456fccdSmrg fi 67114456fccdSmrg done 67124456fccdSmrg 67134456fccdSmrg exit $exit_status 67144456fccdSmrg ;; 67154456fccdSmrg 67164456fccdSmrg "") 67174456fccdSmrg $echo "$modename: you must specify a MODE" 1>&2 67184456fccdSmrg $echo "$generic_help" 1>&2 67194456fccdSmrg exit $EXIT_FAILURE 67204456fccdSmrg ;; 67214456fccdSmrg esac 67224456fccdSmrg 67234456fccdSmrg if test -z "$exec_cmd"; then 67244456fccdSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 67254456fccdSmrg $echo "$generic_help" 1>&2 67264456fccdSmrg exit $EXIT_FAILURE 67274456fccdSmrg fi 67284456fccdSmrgfi # test -z "$show_help" 67294456fccdSmrg 67304456fccdSmrgif test -n "$exec_cmd"; then 67314456fccdSmrg eval exec $exec_cmd 67324456fccdSmrg exit $EXIT_FAILURE 67334456fccdSmrgfi 67344456fccdSmrg 67354456fccdSmrg# We need to display help for each of the modes. 67364456fccdSmrgcase $mode in 67374456fccdSmrg"") $echo \ 67384456fccdSmrg"Usage: $modename [OPTION]... [MODE-ARG]... 67394456fccdSmrg 67404456fccdSmrgProvide generalized library-building support services. 67414456fccdSmrg 67424456fccdSmrg --config show all configuration variables 67434456fccdSmrg --debug enable verbose shell tracing 67444456fccdSmrg-n, --dry-run display commands without modifying any files 67454456fccdSmrg --features display basic configuration information and exit 67464456fccdSmrg --finish same as \`--mode=finish' 67474456fccdSmrg --help display this help message and exit 67484456fccdSmrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 67494456fccdSmrg --quiet same as \`--silent' 67504456fccdSmrg --silent don't print informational messages 67514456fccdSmrg --tag=TAG use configuration variables from tag TAG 67524456fccdSmrg --version print version information 67534456fccdSmrg 67544456fccdSmrgMODE must be one of the following: 67554456fccdSmrg 67564456fccdSmrg clean remove files from the build directory 67574456fccdSmrg compile compile a source file into a libtool object 67584456fccdSmrg execute automatically set library path, then run a program 67594456fccdSmrg finish complete the installation of libtool libraries 67604456fccdSmrg install install libraries or executables 67614456fccdSmrg link create a library or an executable 67624456fccdSmrg uninstall remove libraries from an installed directory 67634456fccdSmrg 67644456fccdSmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 67654456fccdSmrga more detailed description of MODE. 67664456fccdSmrg 67674456fccdSmrgReport bugs to <bug-libtool@gnu.org>." 67684456fccdSmrg exit $EXIT_SUCCESS 67694456fccdSmrg ;; 67704456fccdSmrg 67714456fccdSmrgclean) 67724456fccdSmrg $echo \ 67734456fccdSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 67744456fccdSmrg 67754456fccdSmrgRemove files from the build directory. 67764456fccdSmrg 67774456fccdSmrgRM is the name of the program to use to delete files associated with each FILE 67784456fccdSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 67794456fccdSmrgto RM. 67804456fccdSmrg 67814456fccdSmrgIf FILE is a libtool library, object or program, all the files associated 67824456fccdSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 67834456fccdSmrg ;; 67844456fccdSmrg 67854456fccdSmrgcompile) 67864456fccdSmrg $echo \ 67874456fccdSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 67884456fccdSmrg 67894456fccdSmrgCompile a source file into a libtool library object. 67904456fccdSmrg 67914456fccdSmrgThis mode accepts the following additional options: 67924456fccdSmrg 67934456fccdSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 67944456fccdSmrg -prefer-pic try to building PIC objects only 67954456fccdSmrg -prefer-non-pic try to building non-PIC objects only 67964456fccdSmrg -static always build a \`.o' file suitable for static linking 67974456fccdSmrg 67984456fccdSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 67994456fccdSmrgfrom the given SOURCEFILE. 68004456fccdSmrg 68014456fccdSmrgThe output file name is determined by removing the directory component from 68024456fccdSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 68034456fccdSmrglibrary object suffix, \`.lo'." 68044456fccdSmrg ;; 68054456fccdSmrg 68064456fccdSmrgexecute) 68074456fccdSmrg $echo \ 68084456fccdSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 68094456fccdSmrg 68104456fccdSmrgAutomatically set library path, then run a program. 68114456fccdSmrg 68124456fccdSmrgThis mode accepts the following additional options: 68134456fccdSmrg 68144456fccdSmrg -dlopen FILE add the directory containing FILE to the library path 68154456fccdSmrg 68164456fccdSmrgThis mode sets the library path environment variable according to \`-dlopen' 68174456fccdSmrgflags. 68184456fccdSmrg 68194456fccdSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 68204456fccdSmrginto their corresponding uninstalled binary, and any of their required library 68214456fccdSmrgdirectories are added to the library path. 68224456fccdSmrg 68234456fccdSmrgThen, COMMAND is executed, with ARGS as arguments." 68244456fccdSmrg ;; 68254456fccdSmrg 68264456fccdSmrgfinish) 68274456fccdSmrg $echo \ 68284456fccdSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 68294456fccdSmrg 68304456fccdSmrgComplete the installation of libtool libraries. 68314456fccdSmrg 68324456fccdSmrgEach LIBDIR is a directory that contains libtool libraries. 68334456fccdSmrg 68344456fccdSmrgThe commands that this mode executes may require superuser privileges. Use 68354456fccdSmrgthe \`--dry-run' option if you just want to see what would be executed." 68364456fccdSmrg ;; 68374456fccdSmrg 68384456fccdSmrginstall) 68394456fccdSmrg $echo \ 68404456fccdSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 68414456fccdSmrg 68424456fccdSmrgInstall executables or libraries. 68434456fccdSmrg 68444456fccdSmrgINSTALL-COMMAND is the installation command. The first component should be 68454456fccdSmrgeither the \`install' or \`cp' program. 68464456fccdSmrg 68474456fccdSmrgThe rest of the components are interpreted as arguments to that command (only 68484456fccdSmrgBSD-compatible install options are recognized)." 68494456fccdSmrg ;; 68504456fccdSmrg 68514456fccdSmrglink) 68524456fccdSmrg $echo \ 68534456fccdSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 68544456fccdSmrg 68554456fccdSmrgLink object files or libraries together to form another library, or to 68564456fccdSmrgcreate an executable program. 68574456fccdSmrg 68584456fccdSmrgLINK-COMMAND is a command using the C compiler that you would use to create 68594456fccdSmrga program from several object files. 68604456fccdSmrg 68614456fccdSmrgThe following components of LINK-COMMAND are treated specially: 68624456fccdSmrg 68634456fccdSmrg -all-static do not do any dynamic linking at all 68644456fccdSmrg -avoid-version do not add a version suffix if possible 68654456fccdSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 68664456fccdSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 68674456fccdSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 68684456fccdSmrg -export-symbols SYMFILE 686942d69509Smrg try to export only the symbols listed in SYMFILE 68704456fccdSmrg -export-symbols-regex REGEX 687142d69509Smrg try to export only the symbols matching REGEX 68724456fccdSmrg -LLIBDIR search LIBDIR for required installed libraries 68734456fccdSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 68744456fccdSmrg -module build a library that can dlopened 68754456fccdSmrg -no-fast-install disable the fast-install mode 68764456fccdSmrg -no-install link a not-installable executable 68774456fccdSmrg -no-undefined declare that a library does not refer to external symbols 68784456fccdSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 68794456fccdSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 68804456fccdSmrg -precious-files-regex REGEX 68814456fccdSmrg don't remove output files matching REGEX 68824456fccdSmrg -release RELEASE specify package release information 68834456fccdSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 68844456fccdSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 688542d69509Smrg -static do not do any dynamic linking of uninstalled libtool libraries 688642d69509Smrg -static-libtool-libs 688742d69509Smrg do not do any dynamic linking of libtool libraries 68884456fccdSmrg -version-info CURRENT[:REVISION[:AGE]] 688942d69509Smrg specify library version info [each variable defaults to 0] 68904456fccdSmrg 68914456fccdSmrgAll other options (arguments beginning with \`-') are ignored. 68924456fccdSmrg 68934456fccdSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 68944456fccdSmrgtreated as uninstalled libtool libraries, other files are standard or library 68954456fccdSmrgobject files. 68964456fccdSmrg 68974456fccdSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 68984456fccdSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 68994456fccdSmrgrequired, except when creating a convenience library. 69004456fccdSmrg 69014456fccdSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 69024456fccdSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 69034456fccdSmrg 69044456fccdSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 69054456fccdSmrgis created, otherwise an executable program is created." 69064456fccdSmrg ;; 69074456fccdSmrg 69084456fccdSmrguninstall) 69094456fccdSmrg $echo \ 69104456fccdSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 69114456fccdSmrg 69124456fccdSmrgRemove libraries from an installation directory. 69134456fccdSmrg 69144456fccdSmrgRM is the name of the program to use to delete files associated with each FILE 69154456fccdSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 69164456fccdSmrgto RM. 69174456fccdSmrg 69184456fccdSmrgIf FILE is a libtool library, all the files associated with it are deleted. 69194456fccdSmrgOtherwise, only FILE itself is deleted using RM." 69204456fccdSmrg ;; 69214456fccdSmrg 69224456fccdSmrg*) 69234456fccdSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 69244456fccdSmrg $echo "$help" 1>&2 69254456fccdSmrg exit $EXIT_FAILURE 69264456fccdSmrg ;; 69274456fccdSmrgesac 69284456fccdSmrg 69294456fccdSmrg$echo 69304456fccdSmrg$echo "Try \`$modename --help' for more information about other modes." 69314456fccdSmrg 69324456fccdSmrgexit $? 69334456fccdSmrg 69344456fccdSmrg# The TAGs below are defined such that we never get into a situation 69354456fccdSmrg# in which we disable both kinds of libraries. Given conflicting 69364456fccdSmrg# choices, we go for a static library, that is the most portable, 69374456fccdSmrg# since we can't tell whether shared libraries were disabled because 69384456fccdSmrg# the user asked for that or because the platform doesn't support 69394456fccdSmrg# them. This is particularly important on AIX, because we don't 69404456fccdSmrg# support having both static and shared libraries enabled at the same 69414456fccdSmrg# time on that platform, so we default to a shared-only configuration. 69424456fccdSmrg# If a disable-shared tag is given, we'll fallback to a static-only 69434456fccdSmrg# configuration. But we'll never go from static-only to shared-only. 69444456fccdSmrg 69454456fccdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 69464456fccdSmrgdisable_libs=shared 69474456fccdSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 69484456fccdSmrg 69494456fccdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 69504456fccdSmrgdisable_libs=static 69514456fccdSmrg# ### END LIBTOOL TAG CONFIG: disable-static 69524456fccdSmrg 69534456fccdSmrg# Local Variables: 69544456fccdSmrg# mode:shell-script 69554456fccdSmrg# sh-indentation:2 69564456fccdSmrg# End: 6957