ltmain.sh revision 41b2f0bd
141b2f0bdSmrg# ltmain.sh - Provide generalized library-building support services. 241b2f0bdSmrg# NOTE: Changing this file will not affect anything until you rerun configure. 341b2f0bdSmrg# 441b2f0bdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 541b2f0bdSmrg# Free Software Foundation, Inc. 641b2f0bdSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 741b2f0bdSmrg# 841b2f0bdSmrg# This program is free software; you can redistribute it and/or modify 941b2f0bdSmrg# it under the terms of the GNU General Public License as published by 1041b2f0bdSmrg# the Free Software Foundation; either version 2 of the License, or 1141b2f0bdSmrg# (at your option) any later version. 1241b2f0bdSmrg# 1341b2f0bdSmrg# This program is distributed in the hope that it will be useful, but 1441b2f0bdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1541b2f0bdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1641b2f0bdSmrg# General Public License for more details. 1741b2f0bdSmrg# 1841b2f0bdSmrg# You should have received a copy of the GNU General Public License 1941b2f0bdSmrg# along with this program; if not, write to the Free Software 2041b2f0bdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2141b2f0bdSmrg# 2241b2f0bdSmrg# As a special exception to the GNU General Public License, if you 2341b2f0bdSmrg# distribute this file as part of a program that contains a 2441b2f0bdSmrg# configuration script generated by Autoconf, you may include it under 2541b2f0bdSmrg# the same distribution terms that you use for the rest of that program. 2641b2f0bdSmrg 2741b2f0bdSmrgbasename="s,^.*/,,g" 2841b2f0bdSmrg 2941b2f0bdSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 3041b2f0bdSmrg# is ksh but when the shell is invoked as "sh" and the current value of 3141b2f0bdSmrg# the _XPG environment variable is not equal to 1 (one), the special 3241b2f0bdSmrg# positional parameter $0, within a function call, is the name of the 3341b2f0bdSmrg# function. 3441b2f0bdSmrgprogpath="$0" 3541b2f0bdSmrg 3641b2f0bdSmrg# The name of this program: 3741b2f0bdSmrgprogname=`echo "$progpath" | $SED $basename` 3841b2f0bdSmrgmodename="$progname" 3941b2f0bdSmrg 4041b2f0bdSmrg# Global variables: 4141b2f0bdSmrgEXIT_SUCCESS=0 4241b2f0bdSmrgEXIT_FAILURE=1 4341b2f0bdSmrg 4441b2f0bdSmrgPROGRAM=ltmain.sh 4541b2f0bdSmrgPACKAGE=libtool 4641b2f0bdSmrgVERSION=1.5.22 4741b2f0bdSmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 4841b2f0bdSmrg 4941b2f0bdSmrg# See if we are running on zsh, and set the options which allow our 5041b2f0bdSmrg# commands through without removal of \ escapes. 5141b2f0bdSmrgif test -n "${ZSH_VERSION+set}" ; then 5241b2f0bdSmrg setopt NO_GLOB_SUBST 5341b2f0bdSmrgfi 5441b2f0bdSmrg 5541b2f0bdSmrg# Check that we have a working $echo. 5641b2f0bdSmrgif test "X$1" = X--no-reexec; then 5741b2f0bdSmrg # Discard the --no-reexec flag, and continue. 5841b2f0bdSmrg shift 5941b2f0bdSmrgelif test "X$1" = X--fallback-echo; then 6041b2f0bdSmrg # Avoid inline document here, it may be left over 6141b2f0bdSmrg : 6241b2f0bdSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 6341b2f0bdSmrg # Yippee, $echo works! 6441b2f0bdSmrg : 6541b2f0bdSmrgelse 6641b2f0bdSmrg # Restart under the correct shell, and then maybe $echo will work. 6741b2f0bdSmrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 6841b2f0bdSmrgfi 6941b2f0bdSmrg 7041b2f0bdSmrgif test "X$1" = X--fallback-echo; then 7141b2f0bdSmrg # used as fallback echo 7241b2f0bdSmrg shift 7341b2f0bdSmrg cat <<EOF 7441b2f0bdSmrg$* 7541b2f0bdSmrgEOF 7641b2f0bdSmrg exit $EXIT_SUCCESS 7741b2f0bdSmrgfi 7841b2f0bdSmrg 7941b2f0bdSmrgdefault_mode= 8041b2f0bdSmrghelp="Try \`$progname --help' for more information." 8141b2f0bdSmrgmagic="%%%MAGIC variable%%%" 8241b2f0bdSmrgmkdir="mkdir" 8341b2f0bdSmrgmv="mv -f" 8441b2f0bdSmrgrm="rm -f" 8541b2f0bdSmrg 8641b2f0bdSmrg# Sed substitution that helps us do robust quoting. It backslashifies 8741b2f0bdSmrg# metacharacters that are still active within double-quoted strings. 8841b2f0bdSmrgXsed="${SED}"' -e 1s/^X//' 8941b2f0bdSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 9041b2f0bdSmrg# test EBCDIC or ASCII 9141b2f0bdSmrgcase `echo X|tr X '\101'` in 9241b2f0bdSmrg A) # ASCII based system 9341b2f0bdSmrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 9441b2f0bdSmrg SP2NL='tr \040 \012' 9541b2f0bdSmrg NL2SP='tr \015\012 \040\040' 9641b2f0bdSmrg ;; 9741b2f0bdSmrg *) # EBCDIC based system 9841b2f0bdSmrg SP2NL='tr \100 \n' 9941b2f0bdSmrg NL2SP='tr \r\n \100\100' 10041b2f0bdSmrg ;; 10141b2f0bdSmrgesac 10241b2f0bdSmrg 10341b2f0bdSmrg# NLS nuisances. 10441b2f0bdSmrg# Only set LANG and LC_ALL to C if already set. 10541b2f0bdSmrg# These must not be set unconditionally because not all systems understand 10641b2f0bdSmrg# e.g. LANG=C (notably SCO). 10741b2f0bdSmrg# We save the old values to restore during execute mode. 10841b2f0bdSmrgif test "${LC_ALL+set}" = set; then 10941b2f0bdSmrg save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 11041b2f0bdSmrgfi 11141b2f0bdSmrgif test "${LANG+set}" = set; then 11241b2f0bdSmrg save_LANG="$LANG"; LANG=C; export LANG 11341b2f0bdSmrgfi 11441b2f0bdSmrg 11541b2f0bdSmrg# Make sure IFS has a sensible default 11641b2f0bdSmrglt_nl=' 11741b2f0bdSmrg' 11841b2f0bdSmrgIFS=" $lt_nl" 11941b2f0bdSmrg 12041b2f0bdSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 12141b2f0bdSmrg $echo "$modename: not configured to build any kind of library" 1>&2 12241b2f0bdSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 12341b2f0bdSmrg exit $EXIT_FAILURE 12441b2f0bdSmrgfi 12541b2f0bdSmrg 12641b2f0bdSmrg# Global variables. 12741b2f0bdSmrgmode=$default_mode 12841b2f0bdSmrgnonopt= 12941b2f0bdSmrgprev= 13041b2f0bdSmrgprevopt= 13141b2f0bdSmrgrun= 13241b2f0bdSmrgshow="$echo" 13341b2f0bdSmrgshow_help= 13441b2f0bdSmrgexecute_dlfiles= 13541b2f0bdSmrgduplicate_deps=no 13641b2f0bdSmrgpreserve_args= 13741b2f0bdSmrglo2o="s/\\.lo\$/.${objext}/" 13841b2f0bdSmrgo2lo="s/\\.${objext}\$/.lo/" 13941b2f0bdSmrg 14041b2f0bdSmrg##################################### 14141b2f0bdSmrg# Shell function definitions: 14241b2f0bdSmrg# This seems to be the best place for them 14341b2f0bdSmrg 14441b2f0bdSmrg# func_mktempdir [string] 14541b2f0bdSmrg# Make a temporary directory that won't clash with other running 14641b2f0bdSmrg# libtool processes, and avoids race conditions if possible. If 14741b2f0bdSmrg# given, STRING is the basename for that directory. 14841b2f0bdSmrgfunc_mktempdir () 14941b2f0bdSmrg{ 15041b2f0bdSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 15141b2f0bdSmrg 15241b2f0bdSmrg if test "$run" = ":"; then 15341b2f0bdSmrg # Return a directory name, but don't create it in dry-run mode 15441b2f0bdSmrg my_tmpdir="${my_template}-$$" 15541b2f0bdSmrg else 15641b2f0bdSmrg 15741b2f0bdSmrg # If mktemp works, use that first and foremost 15841b2f0bdSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 15941b2f0bdSmrg 16041b2f0bdSmrg if test ! -d "$my_tmpdir"; then 16141b2f0bdSmrg # Failing that, at least try and use $RANDOM to avoid a race 16241b2f0bdSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 16341b2f0bdSmrg 16441b2f0bdSmrg save_mktempdir_umask=`umask` 16541b2f0bdSmrg umask 0077 16641b2f0bdSmrg $mkdir "$my_tmpdir" 16741b2f0bdSmrg umask $save_mktempdir_umask 16841b2f0bdSmrg fi 16941b2f0bdSmrg 17041b2f0bdSmrg # If we're not in dry-run mode, bomb out on failure 17141b2f0bdSmrg test -d "$my_tmpdir" || { 17241b2f0bdSmrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 17341b2f0bdSmrg exit $EXIT_FAILURE 17441b2f0bdSmrg } 17541b2f0bdSmrg fi 17641b2f0bdSmrg 17741b2f0bdSmrg $echo "X$my_tmpdir" | $Xsed 17841b2f0bdSmrg} 17941b2f0bdSmrg 18041b2f0bdSmrg 18141b2f0bdSmrg# func_win32_libid arg 18241b2f0bdSmrg# return the library type of file 'arg' 18341b2f0bdSmrg# 18441b2f0bdSmrg# Need a lot of goo to handle *both* DLLs and import libs 18541b2f0bdSmrg# Has to be a shell function in order to 'eat' the argument 18641b2f0bdSmrg# that is supplied when $file_magic_command is called. 18741b2f0bdSmrgfunc_win32_libid () 18841b2f0bdSmrg{ 18941b2f0bdSmrg win32_libid_type="unknown" 19041b2f0bdSmrg win32_fileres=`file -L $1 2>/dev/null` 19141b2f0bdSmrg case $win32_fileres in 19241b2f0bdSmrg *ar\ archive\ import\ library*) # definitely import 19341b2f0bdSmrg win32_libid_type="x86 archive import" 19441b2f0bdSmrg ;; 19541b2f0bdSmrg *ar\ archive*) # could be an import, or static 19641b2f0bdSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 19741b2f0bdSmrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 19841b2f0bdSmrg win32_nmres=`eval $NM -f posix -A $1 | \ 19941b2f0bdSmrg $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 20041b2f0bdSmrg case $win32_nmres in 20141b2f0bdSmrg import*) win32_libid_type="x86 archive import";; 20241b2f0bdSmrg *) win32_libid_type="x86 archive static";; 20341b2f0bdSmrg esac 20441b2f0bdSmrg fi 20541b2f0bdSmrg ;; 20641b2f0bdSmrg *DLL*) 20741b2f0bdSmrg win32_libid_type="x86 DLL" 20841b2f0bdSmrg ;; 20941b2f0bdSmrg *executable*) # but shell scripts are "executable" too... 21041b2f0bdSmrg case $win32_fileres in 21141b2f0bdSmrg *MS\ Windows\ PE\ Intel*) 21241b2f0bdSmrg win32_libid_type="x86 DLL" 21341b2f0bdSmrg ;; 21441b2f0bdSmrg esac 21541b2f0bdSmrg ;; 21641b2f0bdSmrg esac 21741b2f0bdSmrg $echo $win32_libid_type 21841b2f0bdSmrg} 21941b2f0bdSmrg 22041b2f0bdSmrg 22141b2f0bdSmrg# func_infer_tag arg 22241b2f0bdSmrg# Infer tagged configuration to use if any are available and 22341b2f0bdSmrg# if one wasn't chosen via the "--tag" command line option. 22441b2f0bdSmrg# Only attempt this if the compiler in the base compile 22541b2f0bdSmrg# command doesn't match the default compiler. 22641b2f0bdSmrg# arg is usually of the form 'gcc ...' 22741b2f0bdSmrgfunc_infer_tag () 22841b2f0bdSmrg{ 22941b2f0bdSmrg if test -n "$available_tags" && test -z "$tagname"; then 23041b2f0bdSmrg CC_quoted= 23141b2f0bdSmrg for arg in $CC; do 23241b2f0bdSmrg case $arg in 23341b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 23441b2f0bdSmrg arg="\"$arg\"" 23541b2f0bdSmrg ;; 23641b2f0bdSmrg esac 23741b2f0bdSmrg CC_quoted="$CC_quoted $arg" 23841b2f0bdSmrg done 23941b2f0bdSmrg case $@ in 24041b2f0bdSmrg # Blanks in the command may have been stripped by the calling shell, 24141b2f0bdSmrg # but not from the CC environment variable when configure was run. 24241b2f0bdSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 24341b2f0bdSmrg # Blanks at the start of $base_compile will cause this to fail 24441b2f0bdSmrg # if we don't check for them as well. 24541b2f0bdSmrg *) 24641b2f0bdSmrg for z in $available_tags; do 24741b2f0bdSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 24841b2f0bdSmrg # Evaluate the configuration. 24941b2f0bdSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 25041b2f0bdSmrg CC_quoted= 25141b2f0bdSmrg for arg in $CC; do 25241b2f0bdSmrg # Double-quote args containing other shell metacharacters. 25341b2f0bdSmrg case $arg in 25441b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 25541b2f0bdSmrg arg="\"$arg\"" 25641b2f0bdSmrg ;; 25741b2f0bdSmrg esac 25841b2f0bdSmrg CC_quoted="$CC_quoted $arg" 25941b2f0bdSmrg done 26041b2f0bdSmrg case "$@ " in 26141b2f0bdSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 26241b2f0bdSmrg # The compiler in the base compile command matches 26341b2f0bdSmrg # the one in the tagged configuration. 26441b2f0bdSmrg # Assume this is the tagged configuration we want. 26541b2f0bdSmrg tagname=$z 26641b2f0bdSmrg break 26741b2f0bdSmrg ;; 26841b2f0bdSmrg esac 26941b2f0bdSmrg fi 27041b2f0bdSmrg done 27141b2f0bdSmrg # If $tagname still isn't set, then no tagged configuration 27241b2f0bdSmrg # was found and let the user know that the "--tag" command 27341b2f0bdSmrg # line option must be used. 27441b2f0bdSmrg if test -z "$tagname"; then 27541b2f0bdSmrg $echo "$modename: unable to infer tagged configuration" 27641b2f0bdSmrg $echo "$modename: specify a tag with \`--tag'" 1>&2 27741b2f0bdSmrg exit $EXIT_FAILURE 27841b2f0bdSmrg# else 27941b2f0bdSmrg# $echo "$modename: using $tagname tagged configuration" 28041b2f0bdSmrg fi 28141b2f0bdSmrg ;; 28241b2f0bdSmrg esac 28341b2f0bdSmrg fi 28441b2f0bdSmrg} 28541b2f0bdSmrg 28641b2f0bdSmrg 28741b2f0bdSmrg# func_extract_an_archive dir oldlib 28841b2f0bdSmrgfunc_extract_an_archive () 28941b2f0bdSmrg{ 29041b2f0bdSmrg f_ex_an_ar_dir="$1"; shift 29141b2f0bdSmrg f_ex_an_ar_oldlib="$1" 29241b2f0bdSmrg 29341b2f0bdSmrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 29441b2f0bdSmrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 29541b2f0bdSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 29641b2f0bdSmrg : 29741b2f0bdSmrg else 29841b2f0bdSmrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 29941b2f0bdSmrg exit $EXIT_FAILURE 30041b2f0bdSmrg fi 30141b2f0bdSmrg} 30241b2f0bdSmrg 30341b2f0bdSmrg# func_extract_archives gentop oldlib ... 30441b2f0bdSmrgfunc_extract_archives () 30541b2f0bdSmrg{ 30641b2f0bdSmrg my_gentop="$1"; shift 30741b2f0bdSmrg my_oldlibs=${1+"$@"} 30841b2f0bdSmrg my_oldobjs="" 30941b2f0bdSmrg my_xlib="" 31041b2f0bdSmrg my_xabs="" 31141b2f0bdSmrg my_xdir="" 31241b2f0bdSmrg my_status="" 31341b2f0bdSmrg 31441b2f0bdSmrg $show "${rm}r $my_gentop" 31541b2f0bdSmrg $run ${rm}r "$my_gentop" 31641b2f0bdSmrg $show "$mkdir $my_gentop" 31741b2f0bdSmrg $run $mkdir "$my_gentop" 31841b2f0bdSmrg my_status=$? 31941b2f0bdSmrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 32041b2f0bdSmrg exit $my_status 32141b2f0bdSmrg fi 32241b2f0bdSmrg 32341b2f0bdSmrg for my_xlib in $my_oldlibs; do 32441b2f0bdSmrg # Extract the objects. 32541b2f0bdSmrg case $my_xlib in 32641b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 32741b2f0bdSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 32841b2f0bdSmrg esac 32941b2f0bdSmrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 33041b2f0bdSmrg my_xdir="$my_gentop/$my_xlib" 33141b2f0bdSmrg 33241b2f0bdSmrg $show "${rm}r $my_xdir" 33341b2f0bdSmrg $run ${rm}r "$my_xdir" 33441b2f0bdSmrg $show "$mkdir $my_xdir" 33541b2f0bdSmrg $run $mkdir "$my_xdir" 33641b2f0bdSmrg exit_status=$? 33741b2f0bdSmrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 33841b2f0bdSmrg exit $exit_status 33941b2f0bdSmrg fi 34041b2f0bdSmrg case $host in 34141b2f0bdSmrg *-darwin*) 34241b2f0bdSmrg $show "Extracting $my_xabs" 34341b2f0bdSmrg # Do not bother doing anything if just a dry run 34441b2f0bdSmrg if test -z "$run"; then 34541b2f0bdSmrg darwin_orig_dir=`pwd` 34641b2f0bdSmrg cd $my_xdir || exit $? 34741b2f0bdSmrg darwin_archive=$my_xabs 34841b2f0bdSmrg darwin_curdir=`pwd` 34941b2f0bdSmrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 35041b2f0bdSmrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 35141b2f0bdSmrg if test -n "$darwin_arches"; then 35241b2f0bdSmrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 35341b2f0bdSmrg darwin_arch= 35441b2f0bdSmrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 35541b2f0bdSmrg for darwin_arch in $darwin_arches ; do 35641b2f0bdSmrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 35741b2f0bdSmrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 35841b2f0bdSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 35941b2f0bdSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 36041b2f0bdSmrg cd "$darwin_curdir" 36141b2f0bdSmrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 36241b2f0bdSmrg done # $darwin_arches 36341b2f0bdSmrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 36441b2f0bdSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 36541b2f0bdSmrg darwin_file= 36641b2f0bdSmrg darwin_files= 36741b2f0bdSmrg for darwin_file in $darwin_filelist; do 36841b2f0bdSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 36941b2f0bdSmrg lipo -create -output "$darwin_file" $darwin_files 37041b2f0bdSmrg done # $darwin_filelist 37141b2f0bdSmrg ${rm}r unfat-$$ 37241b2f0bdSmrg cd "$darwin_orig_dir" 37341b2f0bdSmrg else 37441b2f0bdSmrg cd "$darwin_orig_dir" 37541b2f0bdSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 37641b2f0bdSmrg fi # $darwin_arches 37741b2f0bdSmrg fi # $run 37841b2f0bdSmrg ;; 37941b2f0bdSmrg *) 38041b2f0bdSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 38141b2f0bdSmrg ;; 38241b2f0bdSmrg esac 38341b2f0bdSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 38441b2f0bdSmrg done 38541b2f0bdSmrg func_extract_archives_result="$my_oldobjs" 38641b2f0bdSmrg} 38741b2f0bdSmrg# End of Shell function definitions 38841b2f0bdSmrg##################################### 38941b2f0bdSmrg 39041b2f0bdSmrg# Darwin sucks 39141b2f0bdSmrgeval std_shrext=\"$shrext_cmds\" 39241b2f0bdSmrg 39341b2f0bdSmrgdisable_libs=no 39441b2f0bdSmrg 39541b2f0bdSmrg# Parse our command line options once, thoroughly. 39641b2f0bdSmrgwhile test "$#" -gt 0 39741b2f0bdSmrgdo 39841b2f0bdSmrg arg="$1" 39941b2f0bdSmrg shift 40041b2f0bdSmrg 40141b2f0bdSmrg case $arg in 40241b2f0bdSmrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 40341b2f0bdSmrg *) optarg= ;; 40441b2f0bdSmrg esac 40541b2f0bdSmrg 40641b2f0bdSmrg # If the previous option needs an argument, assign it. 40741b2f0bdSmrg if test -n "$prev"; then 40841b2f0bdSmrg case $prev in 40941b2f0bdSmrg execute_dlfiles) 41041b2f0bdSmrg execute_dlfiles="$execute_dlfiles $arg" 41141b2f0bdSmrg ;; 41241b2f0bdSmrg tag) 41341b2f0bdSmrg tagname="$arg" 41441b2f0bdSmrg preserve_args="${preserve_args}=$arg" 41541b2f0bdSmrg 41641b2f0bdSmrg # Check whether tagname contains only valid characters 41741b2f0bdSmrg case $tagname in 41841b2f0bdSmrg *[!-_A-Za-z0-9,/]*) 41941b2f0bdSmrg $echo "$progname: invalid tag name: $tagname" 1>&2 42041b2f0bdSmrg exit $EXIT_FAILURE 42141b2f0bdSmrg ;; 42241b2f0bdSmrg esac 42341b2f0bdSmrg 42441b2f0bdSmrg case $tagname in 42541b2f0bdSmrg CC) 42641b2f0bdSmrg # Don't test for the "default" C tag, as we know, it's there, but 42741b2f0bdSmrg # not specially marked. 42841b2f0bdSmrg ;; 42941b2f0bdSmrg *) 43041b2f0bdSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 43141b2f0bdSmrg taglist="$taglist $tagname" 43241b2f0bdSmrg # Evaluate the configuration. 43341b2f0bdSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 43441b2f0bdSmrg else 43541b2f0bdSmrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 43641b2f0bdSmrg fi 43741b2f0bdSmrg ;; 43841b2f0bdSmrg esac 43941b2f0bdSmrg ;; 44041b2f0bdSmrg *) 44141b2f0bdSmrg eval "$prev=\$arg" 44241b2f0bdSmrg ;; 44341b2f0bdSmrg esac 44441b2f0bdSmrg 44541b2f0bdSmrg prev= 44641b2f0bdSmrg prevopt= 44741b2f0bdSmrg continue 44841b2f0bdSmrg fi 44941b2f0bdSmrg 45041b2f0bdSmrg # Have we seen a non-optional argument yet? 45141b2f0bdSmrg case $arg in 45241b2f0bdSmrg --help) 45341b2f0bdSmrg show_help=yes 45441b2f0bdSmrg ;; 45541b2f0bdSmrg 45641b2f0bdSmrg --version) 45741b2f0bdSmrg $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 45841b2f0bdSmrg $echo 45941b2f0bdSmrg $echo "Copyright (C) 2005 Free Software Foundation, Inc." 46041b2f0bdSmrg $echo "This is free software; see the source for copying conditions. There is NO" 46141b2f0bdSmrg $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 46241b2f0bdSmrg exit $? 46341b2f0bdSmrg ;; 46441b2f0bdSmrg 46541b2f0bdSmrg --config) 46641b2f0bdSmrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 46741b2f0bdSmrg # Now print the configurations for the tags. 46841b2f0bdSmrg for tagname in $taglist; do 46941b2f0bdSmrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 47041b2f0bdSmrg done 47141b2f0bdSmrg exit $? 47241b2f0bdSmrg ;; 47341b2f0bdSmrg 47441b2f0bdSmrg --debug) 47541b2f0bdSmrg $echo "$progname: enabling shell trace mode" 47641b2f0bdSmrg set -x 47741b2f0bdSmrg preserve_args="$preserve_args $arg" 47841b2f0bdSmrg ;; 47941b2f0bdSmrg 48041b2f0bdSmrg --dry-run | -n) 48141b2f0bdSmrg run=: 48241b2f0bdSmrg ;; 48341b2f0bdSmrg 48441b2f0bdSmrg --features) 48541b2f0bdSmrg $echo "host: $host" 48641b2f0bdSmrg if test "$build_libtool_libs" = yes; then 48741b2f0bdSmrg $echo "enable shared libraries" 48841b2f0bdSmrg else 48941b2f0bdSmrg $echo "disable shared libraries" 49041b2f0bdSmrg fi 49141b2f0bdSmrg if test "$build_old_libs" = yes; then 49241b2f0bdSmrg $echo "enable static libraries" 49341b2f0bdSmrg else 49441b2f0bdSmrg $echo "disable static libraries" 49541b2f0bdSmrg fi 49641b2f0bdSmrg exit $? 49741b2f0bdSmrg ;; 49841b2f0bdSmrg 49941b2f0bdSmrg --finish) mode="finish" ;; 50041b2f0bdSmrg 50141b2f0bdSmrg --mode) prevopt="--mode" prev=mode ;; 50241b2f0bdSmrg --mode=*) mode="$optarg" ;; 50341b2f0bdSmrg 50441b2f0bdSmrg --preserve-dup-deps) duplicate_deps="yes" ;; 50541b2f0bdSmrg 50641b2f0bdSmrg --quiet | --silent) 50741b2f0bdSmrg show=: 50841b2f0bdSmrg preserve_args="$preserve_args $arg" 50941b2f0bdSmrg ;; 51041b2f0bdSmrg 51141b2f0bdSmrg --tag) 51241b2f0bdSmrg prevopt="--tag" 51341b2f0bdSmrg prev=tag 51441b2f0bdSmrg preserve_args="$preserve_args --tag" 51541b2f0bdSmrg ;; 51641b2f0bdSmrg --tag=*) 51741b2f0bdSmrg set tag "$optarg" ${1+"$@"} 51841b2f0bdSmrg shift 51941b2f0bdSmrg prev=tag 52041b2f0bdSmrg preserve_args="$preserve_args --tag" 52141b2f0bdSmrg ;; 52241b2f0bdSmrg 52341b2f0bdSmrg -dlopen) 52441b2f0bdSmrg prevopt="-dlopen" 52541b2f0bdSmrg prev=execute_dlfiles 52641b2f0bdSmrg ;; 52741b2f0bdSmrg 52841b2f0bdSmrg -*) 52941b2f0bdSmrg $echo "$modename: unrecognized option \`$arg'" 1>&2 53041b2f0bdSmrg $echo "$help" 1>&2 53141b2f0bdSmrg exit $EXIT_FAILURE 53241b2f0bdSmrg ;; 53341b2f0bdSmrg 53441b2f0bdSmrg *) 53541b2f0bdSmrg nonopt="$arg" 53641b2f0bdSmrg break 53741b2f0bdSmrg ;; 53841b2f0bdSmrg esac 53941b2f0bdSmrgdone 54041b2f0bdSmrg 54141b2f0bdSmrgif test -n "$prevopt"; then 54241b2f0bdSmrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 54341b2f0bdSmrg $echo "$help" 1>&2 54441b2f0bdSmrg exit $EXIT_FAILURE 54541b2f0bdSmrgfi 54641b2f0bdSmrg 54741b2f0bdSmrgcase $disable_libs in 54841b2f0bdSmrgno) 54941b2f0bdSmrg ;; 55041b2f0bdSmrgshared) 55141b2f0bdSmrg build_libtool_libs=no 55241b2f0bdSmrg build_old_libs=yes 55341b2f0bdSmrg ;; 55441b2f0bdSmrgstatic) 55541b2f0bdSmrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 55641b2f0bdSmrg ;; 55741b2f0bdSmrgesac 55841b2f0bdSmrg 55941b2f0bdSmrg# If this variable is set in any of the actions, the command in it 56041b2f0bdSmrg# will be execed at the end. This prevents here-documents from being 56141b2f0bdSmrg# left over by shells. 56241b2f0bdSmrgexec_cmd= 56341b2f0bdSmrg 56441b2f0bdSmrgif test -z "$show_help"; then 56541b2f0bdSmrg 56641b2f0bdSmrg # Infer the operation mode. 56741b2f0bdSmrg if test -z "$mode"; then 56841b2f0bdSmrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 56941b2f0bdSmrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 57041b2f0bdSmrg case $nonopt in 57141b2f0bdSmrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 57241b2f0bdSmrg mode=link 57341b2f0bdSmrg for arg 57441b2f0bdSmrg do 57541b2f0bdSmrg case $arg in 57641b2f0bdSmrg -c) 57741b2f0bdSmrg mode=compile 57841b2f0bdSmrg break 57941b2f0bdSmrg ;; 58041b2f0bdSmrg esac 58141b2f0bdSmrg done 58241b2f0bdSmrg ;; 58341b2f0bdSmrg *db | *dbx | *strace | *truss) 58441b2f0bdSmrg mode=execute 58541b2f0bdSmrg ;; 58641b2f0bdSmrg *install*|cp|mv) 58741b2f0bdSmrg mode=install 58841b2f0bdSmrg ;; 58941b2f0bdSmrg *rm) 59041b2f0bdSmrg mode=uninstall 59141b2f0bdSmrg ;; 59241b2f0bdSmrg *) 59341b2f0bdSmrg # If we have no mode, but dlfiles were specified, then do execute mode. 59441b2f0bdSmrg test -n "$execute_dlfiles" && mode=execute 59541b2f0bdSmrg 59641b2f0bdSmrg # Just use the default operation mode. 59741b2f0bdSmrg if test -z "$mode"; then 59841b2f0bdSmrg if test -n "$nonopt"; then 59941b2f0bdSmrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 60041b2f0bdSmrg else 60141b2f0bdSmrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 60241b2f0bdSmrg fi 60341b2f0bdSmrg fi 60441b2f0bdSmrg ;; 60541b2f0bdSmrg esac 60641b2f0bdSmrg fi 60741b2f0bdSmrg 60841b2f0bdSmrg # Only execute mode is allowed to have -dlopen flags. 60941b2f0bdSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 61041b2f0bdSmrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 61141b2f0bdSmrg $echo "$help" 1>&2 61241b2f0bdSmrg exit $EXIT_FAILURE 61341b2f0bdSmrg fi 61441b2f0bdSmrg 61541b2f0bdSmrg # Change the help message to a mode-specific one. 61641b2f0bdSmrg generic_help="$help" 61741b2f0bdSmrg help="Try \`$modename --help --mode=$mode' for more information." 61841b2f0bdSmrg 61941b2f0bdSmrg # These modes are in order of execution frequency so that they run quickly. 62041b2f0bdSmrg case $mode in 62141b2f0bdSmrg # libtool compile mode 62241b2f0bdSmrg compile) 62341b2f0bdSmrg modename="$modename: compile" 62441b2f0bdSmrg # Get the compilation command and the source file. 62541b2f0bdSmrg base_compile= 62641b2f0bdSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 62741b2f0bdSmrg suppress_opt=yes 62841b2f0bdSmrg suppress_output= 62941b2f0bdSmrg arg_mode=normal 63041b2f0bdSmrg libobj= 63141b2f0bdSmrg later= 63241b2f0bdSmrg 63341b2f0bdSmrg for arg 63441b2f0bdSmrg do 63541b2f0bdSmrg case $arg_mode in 63641b2f0bdSmrg arg ) 63741b2f0bdSmrg # do not "continue". Instead, add this to base_compile 63841b2f0bdSmrg lastarg="$arg" 63941b2f0bdSmrg arg_mode=normal 64041b2f0bdSmrg ;; 64141b2f0bdSmrg 64241b2f0bdSmrg target ) 64341b2f0bdSmrg libobj="$arg" 64441b2f0bdSmrg arg_mode=normal 64541b2f0bdSmrg continue 64641b2f0bdSmrg ;; 64741b2f0bdSmrg 64841b2f0bdSmrg normal ) 64941b2f0bdSmrg # Accept any command-line options. 65041b2f0bdSmrg case $arg in 65141b2f0bdSmrg -o) 65241b2f0bdSmrg if test -n "$libobj" ; then 65341b2f0bdSmrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 65441b2f0bdSmrg exit $EXIT_FAILURE 65541b2f0bdSmrg fi 65641b2f0bdSmrg arg_mode=target 65741b2f0bdSmrg continue 65841b2f0bdSmrg ;; 65941b2f0bdSmrg 66041b2f0bdSmrg -static | -prefer-pic | -prefer-non-pic) 66141b2f0bdSmrg later="$later $arg" 66241b2f0bdSmrg continue 66341b2f0bdSmrg ;; 66441b2f0bdSmrg 66541b2f0bdSmrg -no-suppress) 66641b2f0bdSmrg suppress_opt=no 66741b2f0bdSmrg continue 66841b2f0bdSmrg ;; 66941b2f0bdSmrg 67041b2f0bdSmrg -Xcompiler) 67141b2f0bdSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 67241b2f0bdSmrg continue # The current "srcfile" will either be retained or 67341b2f0bdSmrg ;; # replaced later. I would guess that would be a bug. 67441b2f0bdSmrg 67541b2f0bdSmrg -Wc,*) 67641b2f0bdSmrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 67741b2f0bdSmrg lastarg= 67841b2f0bdSmrg save_ifs="$IFS"; IFS=',' 67941b2f0bdSmrg for arg in $args; do 68041b2f0bdSmrg IFS="$save_ifs" 68141b2f0bdSmrg 68241b2f0bdSmrg # Double-quote args containing other shell metacharacters. 68341b2f0bdSmrg # Many Bourne shells cannot handle close brackets correctly 68441b2f0bdSmrg # in scan sets, so we specify it separately. 68541b2f0bdSmrg case $arg in 68641b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 68741b2f0bdSmrg arg="\"$arg\"" 68841b2f0bdSmrg ;; 68941b2f0bdSmrg esac 69041b2f0bdSmrg lastarg="$lastarg $arg" 69141b2f0bdSmrg done 69241b2f0bdSmrg IFS="$save_ifs" 69341b2f0bdSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 69441b2f0bdSmrg 69541b2f0bdSmrg # Add the arguments to base_compile. 69641b2f0bdSmrg base_compile="$base_compile $lastarg" 69741b2f0bdSmrg continue 69841b2f0bdSmrg ;; 69941b2f0bdSmrg 70041b2f0bdSmrg * ) 70141b2f0bdSmrg # Accept the current argument as the source file. 70241b2f0bdSmrg # The previous "srcfile" becomes the current argument. 70341b2f0bdSmrg # 70441b2f0bdSmrg lastarg="$srcfile" 70541b2f0bdSmrg srcfile="$arg" 70641b2f0bdSmrg ;; 70741b2f0bdSmrg esac # case $arg 70841b2f0bdSmrg ;; 70941b2f0bdSmrg esac # case $arg_mode 71041b2f0bdSmrg 71141b2f0bdSmrg # Aesthetically quote the previous argument. 71241b2f0bdSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 71341b2f0bdSmrg 71441b2f0bdSmrg case $lastarg in 71541b2f0bdSmrg # Double-quote args containing other shell metacharacters. 71641b2f0bdSmrg # Many Bourne shells cannot handle close brackets correctly 71741b2f0bdSmrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 71841b2f0bdSmrg # in scan sets (worked around with variable expansion), 71941b2f0bdSmrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 72041b2f0bdSmrg # at all, so we specify them separately. 72141b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 72241b2f0bdSmrg lastarg="\"$lastarg\"" 72341b2f0bdSmrg ;; 72441b2f0bdSmrg esac 72541b2f0bdSmrg 72641b2f0bdSmrg base_compile="$base_compile $lastarg" 72741b2f0bdSmrg done # for arg 72841b2f0bdSmrg 72941b2f0bdSmrg case $arg_mode in 73041b2f0bdSmrg arg) 73141b2f0bdSmrg $echo "$modename: you must specify an argument for -Xcompile" 73241b2f0bdSmrg exit $EXIT_FAILURE 73341b2f0bdSmrg ;; 73441b2f0bdSmrg target) 73541b2f0bdSmrg $echo "$modename: you must specify a target with \`-o'" 1>&2 73641b2f0bdSmrg exit $EXIT_FAILURE 73741b2f0bdSmrg ;; 73841b2f0bdSmrg *) 73941b2f0bdSmrg # Get the name of the library object. 74041b2f0bdSmrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 74141b2f0bdSmrg ;; 74241b2f0bdSmrg esac 74341b2f0bdSmrg 74441b2f0bdSmrg # Recognize several different file suffixes. 74541b2f0bdSmrg # If the user specifies -o file.o, it is replaced with file.lo 74641b2f0bdSmrg xform='[cCFSifmso]' 74741b2f0bdSmrg case $libobj in 74841b2f0bdSmrg *.ada) xform=ada ;; 74941b2f0bdSmrg *.adb) xform=adb ;; 75041b2f0bdSmrg *.ads) xform=ads ;; 75141b2f0bdSmrg *.asm) xform=asm ;; 75241b2f0bdSmrg *.c++) xform=c++ ;; 75341b2f0bdSmrg *.cc) xform=cc ;; 75441b2f0bdSmrg *.ii) xform=ii ;; 75541b2f0bdSmrg *.class) xform=class ;; 75641b2f0bdSmrg *.cpp) xform=cpp ;; 75741b2f0bdSmrg *.cxx) xform=cxx ;; 75841b2f0bdSmrg *.f90) xform=f90 ;; 75941b2f0bdSmrg *.for) xform=for ;; 76041b2f0bdSmrg *.java) xform=java ;; 76141b2f0bdSmrg esac 76241b2f0bdSmrg 76341b2f0bdSmrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 76441b2f0bdSmrg 76541b2f0bdSmrg case $libobj in 76641b2f0bdSmrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 76741b2f0bdSmrg *) 76841b2f0bdSmrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 76941b2f0bdSmrg exit $EXIT_FAILURE 77041b2f0bdSmrg ;; 77141b2f0bdSmrg esac 77241b2f0bdSmrg 77341b2f0bdSmrg func_infer_tag $base_compile 77441b2f0bdSmrg 77541b2f0bdSmrg for arg in $later; do 77641b2f0bdSmrg case $arg in 77741b2f0bdSmrg -static) 77841b2f0bdSmrg build_old_libs=yes 77941b2f0bdSmrg continue 78041b2f0bdSmrg ;; 78141b2f0bdSmrg 78241b2f0bdSmrg -prefer-pic) 78341b2f0bdSmrg pic_mode=yes 78441b2f0bdSmrg continue 78541b2f0bdSmrg ;; 78641b2f0bdSmrg 78741b2f0bdSmrg -prefer-non-pic) 78841b2f0bdSmrg pic_mode=no 78941b2f0bdSmrg continue 79041b2f0bdSmrg ;; 79141b2f0bdSmrg esac 79241b2f0bdSmrg done 79341b2f0bdSmrg 79441b2f0bdSmrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 79541b2f0bdSmrg case $qlibobj in 79641b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 79741b2f0bdSmrg qlibobj="\"$qlibobj\"" ;; 79841b2f0bdSmrg esac 79941b2f0bdSmrg test "X$libobj" != "X$qlibobj" \ 80041b2f0bdSmrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 80141b2f0bdSmrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 80241b2f0bdSmrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 80341b2f0bdSmrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 80441b2f0bdSmrg if test "X$xdir" = "X$obj"; then 80541b2f0bdSmrg xdir= 80641b2f0bdSmrg else 80741b2f0bdSmrg xdir=$xdir/ 80841b2f0bdSmrg fi 80941b2f0bdSmrg lobj=${xdir}$objdir/$objname 81041b2f0bdSmrg 81141b2f0bdSmrg if test -z "$base_compile"; then 81241b2f0bdSmrg $echo "$modename: you must specify a compilation command" 1>&2 81341b2f0bdSmrg $echo "$help" 1>&2 81441b2f0bdSmrg exit $EXIT_FAILURE 81541b2f0bdSmrg fi 81641b2f0bdSmrg 81741b2f0bdSmrg # Delete any leftover library objects. 81841b2f0bdSmrg if test "$build_old_libs" = yes; then 81941b2f0bdSmrg removelist="$obj $lobj $libobj ${libobj}T" 82041b2f0bdSmrg else 82141b2f0bdSmrg removelist="$lobj $libobj ${libobj}T" 82241b2f0bdSmrg fi 82341b2f0bdSmrg 82441b2f0bdSmrg $run $rm $removelist 82541b2f0bdSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 82641b2f0bdSmrg 82741b2f0bdSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 82841b2f0bdSmrg case $host_os in 82941b2f0bdSmrg cygwin* | mingw* | pw32* | os2*) 83041b2f0bdSmrg pic_mode=default 83141b2f0bdSmrg ;; 83241b2f0bdSmrg esac 83341b2f0bdSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 83441b2f0bdSmrg # non-PIC code in shared libraries is not supported 83541b2f0bdSmrg pic_mode=default 83641b2f0bdSmrg fi 83741b2f0bdSmrg 83841b2f0bdSmrg # Calculate the filename of the output object if compiler does 83941b2f0bdSmrg # not support -o with -c 84041b2f0bdSmrg if test "$compiler_c_o" = no; then 84141b2f0bdSmrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 84241b2f0bdSmrg lockfile="$output_obj.lock" 84341b2f0bdSmrg removelist="$removelist $output_obj $lockfile" 84441b2f0bdSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 84541b2f0bdSmrg else 84641b2f0bdSmrg output_obj= 84741b2f0bdSmrg need_locks=no 84841b2f0bdSmrg lockfile= 84941b2f0bdSmrg fi 85041b2f0bdSmrg 85141b2f0bdSmrg # Lock this critical section if it is needed 85241b2f0bdSmrg # We use this script file to make the link, it avoids creating a new file 85341b2f0bdSmrg if test "$need_locks" = yes; then 85441b2f0bdSmrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 85541b2f0bdSmrg $show "Waiting for $lockfile to be removed" 85641b2f0bdSmrg sleep 2 85741b2f0bdSmrg done 85841b2f0bdSmrg elif test "$need_locks" = warn; then 85941b2f0bdSmrg if test -f "$lockfile"; then 86041b2f0bdSmrg $echo "\ 86141b2f0bdSmrg*** ERROR, $lockfile exists and contains: 86241b2f0bdSmrg`cat $lockfile 2>/dev/null` 86341b2f0bdSmrg 86441b2f0bdSmrgThis indicates that another process is trying to use the same 86541b2f0bdSmrgtemporary object file, and libtool could not work around it because 86641b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together. If you 86741b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better 86841b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better 86941b2f0bdSmrgcompiler." 87041b2f0bdSmrg 87141b2f0bdSmrg $run $rm $removelist 87241b2f0bdSmrg exit $EXIT_FAILURE 87341b2f0bdSmrg fi 87441b2f0bdSmrg $echo "$srcfile" > "$lockfile" 87541b2f0bdSmrg fi 87641b2f0bdSmrg 87741b2f0bdSmrg if test -n "$fix_srcfile_path"; then 87841b2f0bdSmrg eval srcfile=\"$fix_srcfile_path\" 87941b2f0bdSmrg fi 88041b2f0bdSmrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 88141b2f0bdSmrg case $qsrcfile in 88241b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 88341b2f0bdSmrg qsrcfile="\"$qsrcfile\"" ;; 88441b2f0bdSmrg esac 88541b2f0bdSmrg 88641b2f0bdSmrg $run $rm "$libobj" "${libobj}T" 88741b2f0bdSmrg 88841b2f0bdSmrg # Create a libtool object file (analogous to a ".la" file), 88941b2f0bdSmrg # but don't create it if we're doing a dry run. 89041b2f0bdSmrg test -z "$run" && cat > ${libobj}T <<EOF 89141b2f0bdSmrg# $libobj - a libtool object file 89241b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 89341b2f0bdSmrg# 89441b2f0bdSmrg# Please DO NOT delete this file! 89541b2f0bdSmrg# It is necessary for linking the library. 89641b2f0bdSmrg 89741b2f0bdSmrg# Name of the PIC object. 89841b2f0bdSmrgEOF 89941b2f0bdSmrg 90041b2f0bdSmrg # Only build a PIC object if we are building libtool libraries. 90141b2f0bdSmrg if test "$build_libtool_libs" = yes; then 90241b2f0bdSmrg # Without this assignment, base_compile gets emptied. 90341b2f0bdSmrg fbsd_hideous_sh_bug=$base_compile 90441b2f0bdSmrg 90541b2f0bdSmrg if test "$pic_mode" != no; then 90641b2f0bdSmrg command="$base_compile $qsrcfile $pic_flag" 90741b2f0bdSmrg else 90841b2f0bdSmrg # Don't build PIC code 90941b2f0bdSmrg command="$base_compile $qsrcfile" 91041b2f0bdSmrg fi 91141b2f0bdSmrg 91241b2f0bdSmrg if test ! -d "${xdir}$objdir"; then 91341b2f0bdSmrg $show "$mkdir ${xdir}$objdir" 91441b2f0bdSmrg $run $mkdir ${xdir}$objdir 91541b2f0bdSmrg exit_status=$? 91641b2f0bdSmrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 91741b2f0bdSmrg exit $exit_status 91841b2f0bdSmrg fi 91941b2f0bdSmrg fi 92041b2f0bdSmrg 92141b2f0bdSmrg if test -z "$output_obj"; then 92241b2f0bdSmrg # Place PIC objects in $objdir 92341b2f0bdSmrg command="$command -o $lobj" 92441b2f0bdSmrg fi 92541b2f0bdSmrg 92641b2f0bdSmrg $run $rm "$lobj" "$output_obj" 92741b2f0bdSmrg 92841b2f0bdSmrg $show "$command" 92941b2f0bdSmrg if $run eval "$command"; then : 93041b2f0bdSmrg else 93141b2f0bdSmrg test -n "$output_obj" && $run $rm $removelist 93241b2f0bdSmrg exit $EXIT_FAILURE 93341b2f0bdSmrg fi 93441b2f0bdSmrg 93541b2f0bdSmrg if test "$need_locks" = warn && 93641b2f0bdSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 93741b2f0bdSmrg $echo "\ 93841b2f0bdSmrg*** ERROR, $lockfile contains: 93941b2f0bdSmrg`cat $lockfile 2>/dev/null` 94041b2f0bdSmrg 94141b2f0bdSmrgbut it should contain: 94241b2f0bdSmrg$srcfile 94341b2f0bdSmrg 94441b2f0bdSmrgThis indicates that another process is trying to use the same 94541b2f0bdSmrgtemporary object file, and libtool could not work around it because 94641b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together. If you 94741b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better 94841b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better 94941b2f0bdSmrgcompiler." 95041b2f0bdSmrg 95141b2f0bdSmrg $run $rm $removelist 95241b2f0bdSmrg exit $EXIT_FAILURE 95341b2f0bdSmrg fi 95441b2f0bdSmrg 95541b2f0bdSmrg # Just move the object if needed, then go on to compile the next one 95641b2f0bdSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 95741b2f0bdSmrg $show "$mv $output_obj $lobj" 95841b2f0bdSmrg if $run $mv $output_obj $lobj; then : 95941b2f0bdSmrg else 96041b2f0bdSmrg error=$? 96141b2f0bdSmrg $run $rm $removelist 96241b2f0bdSmrg exit $error 96341b2f0bdSmrg fi 96441b2f0bdSmrg fi 96541b2f0bdSmrg 96641b2f0bdSmrg # Append the name of the PIC object to the libtool object file. 96741b2f0bdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 96841b2f0bdSmrgpic_object='$objdir/$objname' 96941b2f0bdSmrg 97041b2f0bdSmrgEOF 97141b2f0bdSmrg 97241b2f0bdSmrg # Allow error messages only from the first compilation. 97341b2f0bdSmrg if test "$suppress_opt" = yes; then 97441b2f0bdSmrg suppress_output=' >/dev/null 2>&1' 97541b2f0bdSmrg fi 97641b2f0bdSmrg else 97741b2f0bdSmrg # No PIC object so indicate it doesn't exist in the libtool 97841b2f0bdSmrg # object file. 97941b2f0bdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 98041b2f0bdSmrgpic_object=none 98141b2f0bdSmrg 98241b2f0bdSmrgEOF 98341b2f0bdSmrg fi 98441b2f0bdSmrg 98541b2f0bdSmrg # Only build a position-dependent object if we build old libraries. 98641b2f0bdSmrg if test "$build_old_libs" = yes; then 98741b2f0bdSmrg if test "$pic_mode" != yes; then 98841b2f0bdSmrg # Don't build PIC code 98941b2f0bdSmrg command="$base_compile $qsrcfile" 99041b2f0bdSmrg else 99141b2f0bdSmrg command="$base_compile $qsrcfile $pic_flag" 99241b2f0bdSmrg fi 99341b2f0bdSmrg if test "$compiler_c_o" = yes; then 99441b2f0bdSmrg command="$command -o $obj" 99541b2f0bdSmrg fi 99641b2f0bdSmrg 99741b2f0bdSmrg # Suppress compiler output if we already did a PIC compilation. 99841b2f0bdSmrg command="$command$suppress_output" 99941b2f0bdSmrg $run $rm "$obj" "$output_obj" 100041b2f0bdSmrg $show "$command" 100141b2f0bdSmrg if $run eval "$command"; then : 100241b2f0bdSmrg else 100341b2f0bdSmrg $run $rm $removelist 100441b2f0bdSmrg exit $EXIT_FAILURE 100541b2f0bdSmrg fi 100641b2f0bdSmrg 100741b2f0bdSmrg if test "$need_locks" = warn && 100841b2f0bdSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 100941b2f0bdSmrg $echo "\ 101041b2f0bdSmrg*** ERROR, $lockfile contains: 101141b2f0bdSmrg`cat $lockfile 2>/dev/null` 101241b2f0bdSmrg 101341b2f0bdSmrgbut it should contain: 101441b2f0bdSmrg$srcfile 101541b2f0bdSmrg 101641b2f0bdSmrgThis indicates that another process is trying to use the same 101741b2f0bdSmrgtemporary object file, and libtool could not work around it because 101841b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together. If you 101941b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better 102041b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better 102141b2f0bdSmrgcompiler." 102241b2f0bdSmrg 102341b2f0bdSmrg $run $rm $removelist 102441b2f0bdSmrg exit $EXIT_FAILURE 102541b2f0bdSmrg fi 102641b2f0bdSmrg 102741b2f0bdSmrg # Just move the object if needed 102841b2f0bdSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 102941b2f0bdSmrg $show "$mv $output_obj $obj" 103041b2f0bdSmrg if $run $mv $output_obj $obj; then : 103141b2f0bdSmrg else 103241b2f0bdSmrg error=$? 103341b2f0bdSmrg $run $rm $removelist 103441b2f0bdSmrg exit $error 103541b2f0bdSmrg fi 103641b2f0bdSmrg fi 103741b2f0bdSmrg 103841b2f0bdSmrg # Append the name of the non-PIC object the libtool object file. 103941b2f0bdSmrg # Only append if the libtool object file exists. 104041b2f0bdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 104141b2f0bdSmrg# Name of the non-PIC object. 104241b2f0bdSmrgnon_pic_object='$objname' 104341b2f0bdSmrg 104441b2f0bdSmrgEOF 104541b2f0bdSmrg else 104641b2f0bdSmrg # Append the name of the non-PIC object the libtool object file. 104741b2f0bdSmrg # Only append if the libtool object file exists. 104841b2f0bdSmrg test -z "$run" && cat >> ${libobj}T <<EOF 104941b2f0bdSmrg# Name of the non-PIC object. 105041b2f0bdSmrgnon_pic_object=none 105141b2f0bdSmrg 105241b2f0bdSmrgEOF 105341b2f0bdSmrg fi 105441b2f0bdSmrg 105541b2f0bdSmrg $run $mv "${libobj}T" "${libobj}" 105641b2f0bdSmrg 105741b2f0bdSmrg # Unlock the critical section if it was locked 105841b2f0bdSmrg if test "$need_locks" != no; then 105941b2f0bdSmrg $run $rm "$lockfile" 106041b2f0bdSmrg fi 106141b2f0bdSmrg 106241b2f0bdSmrg exit $EXIT_SUCCESS 106341b2f0bdSmrg ;; 106441b2f0bdSmrg 106541b2f0bdSmrg # libtool link mode 106641b2f0bdSmrg link | relink) 106741b2f0bdSmrg modename="$modename: link" 106841b2f0bdSmrg case $host in 106941b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 107041b2f0bdSmrg # It is impossible to link a dll without this setting, and 107141b2f0bdSmrg # we shouldn't force the makefile maintainer to figure out 107241b2f0bdSmrg # which system we are compiling for in order to pass an extra 107341b2f0bdSmrg # flag for every libtool invocation. 107441b2f0bdSmrg # allow_undefined=no 107541b2f0bdSmrg 107641b2f0bdSmrg # FIXME: Unfortunately, there are problems with the above when trying 107741b2f0bdSmrg # to make a dll which has undefined symbols, in which case not 107841b2f0bdSmrg # even a static library is built. For now, we need to specify 107941b2f0bdSmrg # -no-undefined on the libtool link line when we can be certain 108041b2f0bdSmrg # that all symbols are satisfied, otherwise we get a static library. 108141b2f0bdSmrg allow_undefined=yes 108241b2f0bdSmrg ;; 108341b2f0bdSmrg *) 108441b2f0bdSmrg allow_undefined=yes 108541b2f0bdSmrg ;; 108641b2f0bdSmrg esac 108741b2f0bdSmrg libtool_args="$nonopt" 108841b2f0bdSmrg base_compile="$nonopt $@" 108941b2f0bdSmrg compile_command="$nonopt" 109041b2f0bdSmrg finalize_command="$nonopt" 109141b2f0bdSmrg 109241b2f0bdSmrg compile_rpath= 109341b2f0bdSmrg finalize_rpath= 109441b2f0bdSmrg compile_shlibpath= 109541b2f0bdSmrg finalize_shlibpath= 109641b2f0bdSmrg convenience= 109741b2f0bdSmrg old_convenience= 109841b2f0bdSmrg deplibs= 109941b2f0bdSmrg old_deplibs= 110041b2f0bdSmrg compiler_flags= 110141b2f0bdSmrg linker_flags= 110241b2f0bdSmrg dllsearchpath= 110341b2f0bdSmrg lib_search_path=`pwd` 110441b2f0bdSmrg inst_prefix_dir= 110541b2f0bdSmrg 110641b2f0bdSmrg avoid_version=no 110741b2f0bdSmrg dlfiles= 110841b2f0bdSmrg dlprefiles= 110941b2f0bdSmrg dlself=no 111041b2f0bdSmrg export_dynamic=no 111141b2f0bdSmrg export_symbols= 111241b2f0bdSmrg export_symbols_regex= 111341b2f0bdSmrg generated= 111441b2f0bdSmrg libobjs= 111541b2f0bdSmrg ltlibs= 111641b2f0bdSmrg module=no 111741b2f0bdSmrg no_install=no 111841b2f0bdSmrg objs= 111941b2f0bdSmrg non_pic_objects= 112041b2f0bdSmrg notinst_path= # paths that contain not-installed libtool libraries 112141b2f0bdSmrg precious_files_regex= 112241b2f0bdSmrg prefer_static_libs=no 112341b2f0bdSmrg preload=no 112441b2f0bdSmrg prev= 112541b2f0bdSmrg prevarg= 112641b2f0bdSmrg release= 112741b2f0bdSmrg rpath= 112841b2f0bdSmrg xrpath= 112941b2f0bdSmrg perm_rpath= 113041b2f0bdSmrg temp_rpath= 113141b2f0bdSmrg thread_safe=no 113241b2f0bdSmrg vinfo= 113341b2f0bdSmrg vinfo_number=no 113441b2f0bdSmrg 113541b2f0bdSmrg func_infer_tag $base_compile 113641b2f0bdSmrg 113741b2f0bdSmrg # We need to know -static, to get the right output filenames. 113841b2f0bdSmrg for arg 113941b2f0bdSmrg do 114041b2f0bdSmrg case $arg in 114141b2f0bdSmrg -all-static | -static) 114241b2f0bdSmrg if test "X$arg" = "X-all-static"; then 114341b2f0bdSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 114441b2f0bdSmrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 114541b2f0bdSmrg fi 114641b2f0bdSmrg if test -n "$link_static_flag"; then 114741b2f0bdSmrg dlopen_self=$dlopen_self_static 114841b2f0bdSmrg fi 114941b2f0bdSmrg prefer_static_libs=yes 115041b2f0bdSmrg else 115141b2f0bdSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 115241b2f0bdSmrg dlopen_self=$dlopen_self_static 115341b2f0bdSmrg fi 115441b2f0bdSmrg prefer_static_libs=built 115541b2f0bdSmrg fi 115641b2f0bdSmrg build_libtool_libs=no 115741b2f0bdSmrg build_old_libs=yes 115841b2f0bdSmrg break 115941b2f0bdSmrg ;; 116041b2f0bdSmrg esac 116141b2f0bdSmrg done 116241b2f0bdSmrg 116341b2f0bdSmrg # See if our shared archives depend on static archives. 116441b2f0bdSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 116541b2f0bdSmrg 116641b2f0bdSmrg # Go through the arguments, transforming them on the way. 116741b2f0bdSmrg while test "$#" -gt 0; do 116841b2f0bdSmrg arg="$1" 116941b2f0bdSmrg shift 117041b2f0bdSmrg case $arg in 117141b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 117241b2f0bdSmrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 117341b2f0bdSmrg ;; 117441b2f0bdSmrg *) qarg=$arg ;; 117541b2f0bdSmrg esac 117641b2f0bdSmrg libtool_args="$libtool_args $qarg" 117741b2f0bdSmrg 117841b2f0bdSmrg # If the previous option needs an argument, assign it. 117941b2f0bdSmrg if test -n "$prev"; then 118041b2f0bdSmrg case $prev in 118141b2f0bdSmrg output) 118241b2f0bdSmrg compile_command="$compile_command @OUTPUT@" 118341b2f0bdSmrg finalize_command="$finalize_command @OUTPUT@" 118441b2f0bdSmrg ;; 118541b2f0bdSmrg esac 118641b2f0bdSmrg 118741b2f0bdSmrg case $prev in 118841b2f0bdSmrg dlfiles|dlprefiles) 118941b2f0bdSmrg if test "$preload" = no; then 119041b2f0bdSmrg # Add the symbol object into the linking commands. 119141b2f0bdSmrg compile_command="$compile_command @SYMFILE@" 119241b2f0bdSmrg finalize_command="$finalize_command @SYMFILE@" 119341b2f0bdSmrg preload=yes 119441b2f0bdSmrg fi 119541b2f0bdSmrg case $arg in 119641b2f0bdSmrg *.la | *.lo) ;; # We handle these cases below. 119741b2f0bdSmrg force) 119841b2f0bdSmrg if test "$dlself" = no; then 119941b2f0bdSmrg dlself=needless 120041b2f0bdSmrg export_dynamic=yes 120141b2f0bdSmrg fi 120241b2f0bdSmrg prev= 120341b2f0bdSmrg continue 120441b2f0bdSmrg ;; 120541b2f0bdSmrg self) 120641b2f0bdSmrg if test "$prev" = dlprefiles; then 120741b2f0bdSmrg dlself=yes 120841b2f0bdSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 120941b2f0bdSmrg dlself=yes 121041b2f0bdSmrg else 121141b2f0bdSmrg dlself=needless 121241b2f0bdSmrg export_dynamic=yes 121341b2f0bdSmrg fi 121441b2f0bdSmrg prev= 121541b2f0bdSmrg continue 121641b2f0bdSmrg ;; 121741b2f0bdSmrg *) 121841b2f0bdSmrg if test "$prev" = dlfiles; then 121941b2f0bdSmrg dlfiles="$dlfiles $arg" 122041b2f0bdSmrg else 122141b2f0bdSmrg dlprefiles="$dlprefiles $arg" 122241b2f0bdSmrg fi 122341b2f0bdSmrg prev= 122441b2f0bdSmrg continue 122541b2f0bdSmrg ;; 122641b2f0bdSmrg esac 122741b2f0bdSmrg ;; 122841b2f0bdSmrg expsyms) 122941b2f0bdSmrg export_symbols="$arg" 123041b2f0bdSmrg if test ! -f "$arg"; then 123141b2f0bdSmrg $echo "$modename: symbol file \`$arg' does not exist" 123241b2f0bdSmrg exit $EXIT_FAILURE 123341b2f0bdSmrg fi 123441b2f0bdSmrg prev= 123541b2f0bdSmrg continue 123641b2f0bdSmrg ;; 123741b2f0bdSmrg expsyms_regex) 123841b2f0bdSmrg export_symbols_regex="$arg" 123941b2f0bdSmrg prev= 124041b2f0bdSmrg continue 124141b2f0bdSmrg ;; 124241b2f0bdSmrg inst_prefix) 124341b2f0bdSmrg inst_prefix_dir="$arg" 124441b2f0bdSmrg prev= 124541b2f0bdSmrg continue 124641b2f0bdSmrg ;; 124741b2f0bdSmrg precious_regex) 124841b2f0bdSmrg precious_files_regex="$arg" 124941b2f0bdSmrg prev= 125041b2f0bdSmrg continue 125141b2f0bdSmrg ;; 125241b2f0bdSmrg release) 125341b2f0bdSmrg release="-$arg" 125441b2f0bdSmrg prev= 125541b2f0bdSmrg continue 125641b2f0bdSmrg ;; 125741b2f0bdSmrg objectlist) 125841b2f0bdSmrg if test -f "$arg"; then 125941b2f0bdSmrg save_arg=$arg 126041b2f0bdSmrg moreargs= 126141b2f0bdSmrg for fil in `cat $save_arg` 126241b2f0bdSmrg do 126341b2f0bdSmrg# moreargs="$moreargs $fil" 126441b2f0bdSmrg arg=$fil 126541b2f0bdSmrg # A libtool-controlled object. 126641b2f0bdSmrg 126741b2f0bdSmrg # Check to see that this really is a libtool object. 126841b2f0bdSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 126941b2f0bdSmrg pic_object= 127041b2f0bdSmrg non_pic_object= 127141b2f0bdSmrg 127241b2f0bdSmrg # Read the .lo file 127341b2f0bdSmrg # If there is no directory component, then add one. 127441b2f0bdSmrg case $arg in 127541b2f0bdSmrg */* | *\\*) . $arg ;; 127641b2f0bdSmrg *) . ./$arg ;; 127741b2f0bdSmrg esac 127841b2f0bdSmrg 127941b2f0bdSmrg if test -z "$pic_object" || \ 128041b2f0bdSmrg test -z "$non_pic_object" || 128141b2f0bdSmrg test "$pic_object" = none && \ 128241b2f0bdSmrg test "$non_pic_object" = none; then 128341b2f0bdSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 128441b2f0bdSmrg exit $EXIT_FAILURE 128541b2f0bdSmrg fi 128641b2f0bdSmrg 128741b2f0bdSmrg # Extract subdirectory from the argument. 128841b2f0bdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 128941b2f0bdSmrg if test "X$xdir" = "X$arg"; then 129041b2f0bdSmrg xdir= 129141b2f0bdSmrg else 129241b2f0bdSmrg xdir="$xdir/" 129341b2f0bdSmrg fi 129441b2f0bdSmrg 129541b2f0bdSmrg if test "$pic_object" != none; then 129641b2f0bdSmrg # Prepend the subdirectory the object is found in. 129741b2f0bdSmrg pic_object="$xdir$pic_object" 129841b2f0bdSmrg 129941b2f0bdSmrg if test "$prev" = dlfiles; then 130041b2f0bdSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 130141b2f0bdSmrg dlfiles="$dlfiles $pic_object" 130241b2f0bdSmrg prev= 130341b2f0bdSmrg continue 130441b2f0bdSmrg else 130541b2f0bdSmrg # If libtool objects are unsupported, then we need to preload. 130641b2f0bdSmrg prev=dlprefiles 130741b2f0bdSmrg fi 130841b2f0bdSmrg fi 130941b2f0bdSmrg 131041b2f0bdSmrg # CHECK ME: I think I busted this. -Ossama 131141b2f0bdSmrg if test "$prev" = dlprefiles; then 131241b2f0bdSmrg # Preload the old-style object. 131341b2f0bdSmrg dlprefiles="$dlprefiles $pic_object" 131441b2f0bdSmrg prev= 131541b2f0bdSmrg fi 131641b2f0bdSmrg 131741b2f0bdSmrg # A PIC object. 131841b2f0bdSmrg libobjs="$libobjs $pic_object" 131941b2f0bdSmrg arg="$pic_object" 132041b2f0bdSmrg fi 132141b2f0bdSmrg 132241b2f0bdSmrg # Non-PIC object. 132341b2f0bdSmrg if test "$non_pic_object" != none; then 132441b2f0bdSmrg # Prepend the subdirectory the object is found in. 132541b2f0bdSmrg non_pic_object="$xdir$non_pic_object" 132641b2f0bdSmrg 132741b2f0bdSmrg # A standard non-PIC object 132841b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 132941b2f0bdSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 133041b2f0bdSmrg arg="$non_pic_object" 133141b2f0bdSmrg fi 133241b2f0bdSmrg else 133341b2f0bdSmrg # If the PIC object exists, use it instead. 133441b2f0bdSmrg # $xdir was prepended to $pic_object above. 133541b2f0bdSmrg non_pic_object="$pic_object" 133641b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 133741b2f0bdSmrg fi 133841b2f0bdSmrg else 133941b2f0bdSmrg # Only an error if not doing a dry-run. 134041b2f0bdSmrg if test -z "$run"; then 134141b2f0bdSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 134241b2f0bdSmrg exit $EXIT_FAILURE 134341b2f0bdSmrg else 134441b2f0bdSmrg # Dry-run case. 134541b2f0bdSmrg 134641b2f0bdSmrg # Extract subdirectory from the argument. 134741b2f0bdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 134841b2f0bdSmrg if test "X$xdir" = "X$arg"; then 134941b2f0bdSmrg xdir= 135041b2f0bdSmrg else 135141b2f0bdSmrg xdir="$xdir/" 135241b2f0bdSmrg fi 135341b2f0bdSmrg 135441b2f0bdSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 135541b2f0bdSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 135641b2f0bdSmrg libobjs="$libobjs $pic_object" 135741b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 135841b2f0bdSmrg fi 135941b2f0bdSmrg fi 136041b2f0bdSmrg done 136141b2f0bdSmrg else 136241b2f0bdSmrg $echo "$modename: link input file \`$save_arg' does not exist" 136341b2f0bdSmrg exit $EXIT_FAILURE 136441b2f0bdSmrg fi 136541b2f0bdSmrg arg=$save_arg 136641b2f0bdSmrg prev= 136741b2f0bdSmrg continue 136841b2f0bdSmrg ;; 136941b2f0bdSmrg rpath | xrpath) 137041b2f0bdSmrg # We need an absolute path. 137141b2f0bdSmrg case $arg in 137241b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 137341b2f0bdSmrg *) 137441b2f0bdSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 137541b2f0bdSmrg exit $EXIT_FAILURE 137641b2f0bdSmrg ;; 137741b2f0bdSmrg esac 137841b2f0bdSmrg if test "$prev" = rpath; then 137941b2f0bdSmrg case "$rpath " in 138041b2f0bdSmrg *" $arg "*) ;; 138141b2f0bdSmrg *) rpath="$rpath $arg" ;; 138241b2f0bdSmrg esac 138341b2f0bdSmrg else 138441b2f0bdSmrg case "$xrpath " in 138541b2f0bdSmrg *" $arg "*) ;; 138641b2f0bdSmrg *) xrpath="$xrpath $arg" ;; 138741b2f0bdSmrg esac 138841b2f0bdSmrg fi 138941b2f0bdSmrg prev= 139041b2f0bdSmrg continue 139141b2f0bdSmrg ;; 139241b2f0bdSmrg xcompiler) 139341b2f0bdSmrg compiler_flags="$compiler_flags $qarg" 139441b2f0bdSmrg prev= 139541b2f0bdSmrg compile_command="$compile_command $qarg" 139641b2f0bdSmrg finalize_command="$finalize_command $qarg" 139741b2f0bdSmrg continue 139841b2f0bdSmrg ;; 139941b2f0bdSmrg xlinker) 140041b2f0bdSmrg linker_flags="$linker_flags $qarg" 140141b2f0bdSmrg compiler_flags="$compiler_flags $wl$qarg" 140241b2f0bdSmrg prev= 140341b2f0bdSmrg compile_command="$compile_command $wl$qarg" 140441b2f0bdSmrg finalize_command="$finalize_command $wl$qarg" 140541b2f0bdSmrg continue 140641b2f0bdSmrg ;; 140741b2f0bdSmrg xcclinker) 140841b2f0bdSmrg linker_flags="$linker_flags $qarg" 140941b2f0bdSmrg compiler_flags="$compiler_flags $qarg" 141041b2f0bdSmrg prev= 141141b2f0bdSmrg compile_command="$compile_command $qarg" 141241b2f0bdSmrg finalize_command="$finalize_command $qarg" 141341b2f0bdSmrg continue 141441b2f0bdSmrg ;; 141541b2f0bdSmrg shrext) 141641b2f0bdSmrg shrext_cmds="$arg" 141741b2f0bdSmrg prev= 141841b2f0bdSmrg continue 141941b2f0bdSmrg ;; 142041b2f0bdSmrg darwin_framework|darwin_framework_skip) 142141b2f0bdSmrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 142241b2f0bdSmrg compile_command="$compile_command $arg" 142341b2f0bdSmrg finalize_command="$finalize_command $arg" 142441b2f0bdSmrg prev= 142541b2f0bdSmrg continue 142641b2f0bdSmrg ;; 142741b2f0bdSmrg *) 142841b2f0bdSmrg eval "$prev=\"\$arg\"" 142941b2f0bdSmrg prev= 143041b2f0bdSmrg continue 143141b2f0bdSmrg ;; 143241b2f0bdSmrg esac 143341b2f0bdSmrg fi # test -n "$prev" 143441b2f0bdSmrg 143541b2f0bdSmrg prevarg="$arg" 143641b2f0bdSmrg 143741b2f0bdSmrg case $arg in 143841b2f0bdSmrg -all-static) 143941b2f0bdSmrg if test -n "$link_static_flag"; then 144041b2f0bdSmrg compile_command="$compile_command $link_static_flag" 144141b2f0bdSmrg finalize_command="$finalize_command $link_static_flag" 144241b2f0bdSmrg fi 144341b2f0bdSmrg continue 144441b2f0bdSmrg ;; 144541b2f0bdSmrg 144641b2f0bdSmrg -allow-undefined) 144741b2f0bdSmrg # FIXME: remove this flag sometime in the future. 144841b2f0bdSmrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 144941b2f0bdSmrg continue 145041b2f0bdSmrg ;; 145141b2f0bdSmrg 145241b2f0bdSmrg -avoid-version) 145341b2f0bdSmrg avoid_version=yes 145441b2f0bdSmrg continue 145541b2f0bdSmrg ;; 145641b2f0bdSmrg 145741b2f0bdSmrg -dlopen) 145841b2f0bdSmrg prev=dlfiles 145941b2f0bdSmrg continue 146041b2f0bdSmrg ;; 146141b2f0bdSmrg 146241b2f0bdSmrg -dlpreopen) 146341b2f0bdSmrg prev=dlprefiles 146441b2f0bdSmrg continue 146541b2f0bdSmrg ;; 146641b2f0bdSmrg 146741b2f0bdSmrg -export-dynamic) 146841b2f0bdSmrg export_dynamic=yes 146941b2f0bdSmrg continue 147041b2f0bdSmrg ;; 147141b2f0bdSmrg 147241b2f0bdSmrg -export-symbols | -export-symbols-regex) 147341b2f0bdSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 147441b2f0bdSmrg $echo "$modename: more than one -exported-symbols argument is not allowed" 147541b2f0bdSmrg exit $EXIT_FAILURE 147641b2f0bdSmrg fi 147741b2f0bdSmrg if test "X$arg" = "X-export-symbols"; then 147841b2f0bdSmrg prev=expsyms 147941b2f0bdSmrg else 148041b2f0bdSmrg prev=expsyms_regex 148141b2f0bdSmrg fi 148241b2f0bdSmrg continue 148341b2f0bdSmrg ;; 148441b2f0bdSmrg 148541b2f0bdSmrg -framework|-arch|-isysroot) 148641b2f0bdSmrg case " $CC " in 148741b2f0bdSmrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 148841b2f0bdSmrg prev=darwin_framework_skip ;; 148941b2f0bdSmrg *) compiler_flags="$compiler_flags $arg" 149041b2f0bdSmrg prev=darwin_framework ;; 149141b2f0bdSmrg esac 149241b2f0bdSmrg compile_command="$compile_command $arg" 149341b2f0bdSmrg finalize_command="$finalize_command $arg" 149441b2f0bdSmrg continue 149541b2f0bdSmrg ;; 149641b2f0bdSmrg 149741b2f0bdSmrg -inst-prefix-dir) 149841b2f0bdSmrg prev=inst_prefix 149941b2f0bdSmrg continue 150041b2f0bdSmrg ;; 150141b2f0bdSmrg 150241b2f0bdSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 150341b2f0bdSmrg # so, if we see these flags be careful not to treat them like -L 150441b2f0bdSmrg -L[A-Z][A-Z]*:*) 150541b2f0bdSmrg case $with_gcc/$host in 150641b2f0bdSmrg no/*-*-irix* | /*-*-irix*) 150741b2f0bdSmrg compile_command="$compile_command $arg" 150841b2f0bdSmrg finalize_command="$finalize_command $arg" 150941b2f0bdSmrg ;; 151041b2f0bdSmrg esac 151141b2f0bdSmrg continue 151241b2f0bdSmrg ;; 151341b2f0bdSmrg 151441b2f0bdSmrg -L*) 151541b2f0bdSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 151641b2f0bdSmrg # We need an absolute path. 151741b2f0bdSmrg case $dir in 151841b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 151941b2f0bdSmrg *) 152041b2f0bdSmrg absdir=`cd "$dir" && pwd` 152141b2f0bdSmrg if test -z "$absdir"; then 152241b2f0bdSmrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 152341b2f0bdSmrg absdir="$dir" 152441b2f0bdSmrg notinst_path="$notinst_path $dir" 152541b2f0bdSmrg fi 152641b2f0bdSmrg dir="$absdir" 152741b2f0bdSmrg ;; 152841b2f0bdSmrg esac 152941b2f0bdSmrg case "$deplibs " in 153041b2f0bdSmrg *" -L$dir "*) ;; 153141b2f0bdSmrg *) 153241b2f0bdSmrg deplibs="$deplibs -L$dir" 153341b2f0bdSmrg lib_search_path="$lib_search_path $dir" 153441b2f0bdSmrg ;; 153541b2f0bdSmrg esac 153641b2f0bdSmrg case $host in 153741b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 153841b2f0bdSmrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 153941b2f0bdSmrg case :$dllsearchpath: in 154041b2f0bdSmrg *":$dir:"*) ;; 154141b2f0bdSmrg *) dllsearchpath="$dllsearchpath:$dir";; 154241b2f0bdSmrg esac 154341b2f0bdSmrg case :$dllsearchpath: in 154441b2f0bdSmrg *":$testbindir:"*) ;; 154541b2f0bdSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 154641b2f0bdSmrg esac 154741b2f0bdSmrg ;; 154841b2f0bdSmrg esac 154941b2f0bdSmrg continue 155041b2f0bdSmrg ;; 155141b2f0bdSmrg 155241b2f0bdSmrg -l*) 155341b2f0bdSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 155441b2f0bdSmrg case $host in 155541b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 155641b2f0bdSmrg # These systems don't actually have a C or math library (as such) 155741b2f0bdSmrg continue 155841b2f0bdSmrg ;; 155941b2f0bdSmrg *-*-os2*) 156041b2f0bdSmrg # These systems don't actually have a C library (as such) 156141b2f0bdSmrg test "X$arg" = "X-lc" && continue 156241b2f0bdSmrg ;; 156341b2f0bdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 156441b2f0bdSmrg # Do not include libc due to us having libc/libc_r. 156541b2f0bdSmrg test "X$arg" = "X-lc" && continue 156641b2f0bdSmrg ;; 156741b2f0bdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 156841b2f0bdSmrg # Rhapsody C and math libraries are in the System framework 156941b2f0bdSmrg deplibs="$deplibs -framework System" 157041b2f0bdSmrg continue 157141b2f0bdSmrg ;; 157241b2f0bdSmrg *-*-sco3.2v5* | *-*-sco5v6*) 157341b2f0bdSmrg # Causes problems with __ctype 157441b2f0bdSmrg test "X$arg" = "X-lc" && continue 157541b2f0bdSmrg ;; 157641b2f0bdSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 157741b2f0bdSmrg # Compiler inserts libc in the correct place for threads to work 157841b2f0bdSmrg test "X$arg" = "X-lc" && continue 157941b2f0bdSmrg ;; 158041b2f0bdSmrg esac 158141b2f0bdSmrg elif test "X$arg" = "X-lc_r"; then 158241b2f0bdSmrg case $host in 158341b2f0bdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 158441b2f0bdSmrg # Do not include libc_r directly, use -pthread flag. 158541b2f0bdSmrg continue 158641b2f0bdSmrg ;; 158741b2f0bdSmrg esac 158841b2f0bdSmrg fi 158941b2f0bdSmrg deplibs="$deplibs $arg" 159041b2f0bdSmrg continue 159141b2f0bdSmrg ;; 159241b2f0bdSmrg 159341b2f0bdSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 159441b2f0bdSmrg # classes, name mangling, and exception handling. 159541b2f0bdSmrg -model) 159641b2f0bdSmrg compile_command="$compile_command $arg" 159741b2f0bdSmrg compiler_flags="$compiler_flags $arg" 159841b2f0bdSmrg finalize_command="$finalize_command $arg" 159941b2f0bdSmrg prev=xcompiler 160041b2f0bdSmrg continue 160141b2f0bdSmrg ;; 160241b2f0bdSmrg 160341b2f0bdSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 160441b2f0bdSmrg compiler_flags="$compiler_flags $arg" 160541b2f0bdSmrg compile_command="$compile_command $arg" 160641b2f0bdSmrg finalize_command="$finalize_command $arg" 160741b2f0bdSmrg continue 160841b2f0bdSmrg ;; 160941b2f0bdSmrg 161041b2f0bdSmrg -module) 161141b2f0bdSmrg module=yes 161241b2f0bdSmrg continue 161341b2f0bdSmrg ;; 161441b2f0bdSmrg 161541b2f0bdSmrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 161641b2f0bdSmrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 161741b2f0bdSmrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 161841b2f0bdSmrg # +DA*, +DD* enable 64-bit mode on the HP compiler 161941b2f0bdSmrg # -q* pass through compiler args for the IBM compiler 162041b2f0bdSmrg # -m* pass through architecture-specific compiler args for GCC 162141b2f0bdSmrg # -m*, -t[45]*, -txscale* pass through architecture-specific 162241b2f0bdSmrg # compiler args for GCC 162341b2f0bdSmrg # -pg pass through profiling flag for GCC 162441b2f0bdSmrg # @file GCC response files 162541b2f0bdSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 162641b2f0bdSmrg -t[45]*|-txscale*|@*) 162741b2f0bdSmrg 162841b2f0bdSmrg # Unknown arguments in both finalize_command and compile_command need 162941b2f0bdSmrg # to be aesthetically quoted because they are evaled later. 163041b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 163141b2f0bdSmrg case $arg in 163241b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 163341b2f0bdSmrg arg="\"$arg\"" 163441b2f0bdSmrg ;; 163541b2f0bdSmrg esac 163641b2f0bdSmrg compile_command="$compile_command $arg" 163741b2f0bdSmrg finalize_command="$finalize_command $arg" 163841b2f0bdSmrg compiler_flags="$compiler_flags $arg" 163941b2f0bdSmrg continue 164041b2f0bdSmrg ;; 164141b2f0bdSmrg 164241b2f0bdSmrg -shrext) 164341b2f0bdSmrg prev=shrext 164441b2f0bdSmrg continue 164541b2f0bdSmrg ;; 164641b2f0bdSmrg 164741b2f0bdSmrg -no-fast-install) 164841b2f0bdSmrg fast_install=no 164941b2f0bdSmrg continue 165041b2f0bdSmrg ;; 165141b2f0bdSmrg 165241b2f0bdSmrg -no-install) 165341b2f0bdSmrg case $host in 165441b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 165541b2f0bdSmrg # The PATH hackery in wrapper scripts is required on Windows 165641b2f0bdSmrg # in order for the loader to find any dlls it needs. 165741b2f0bdSmrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 165841b2f0bdSmrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 165941b2f0bdSmrg fast_install=no 166041b2f0bdSmrg ;; 166141b2f0bdSmrg *) no_install=yes ;; 166241b2f0bdSmrg esac 166341b2f0bdSmrg continue 166441b2f0bdSmrg ;; 166541b2f0bdSmrg 166641b2f0bdSmrg -no-undefined) 166741b2f0bdSmrg allow_undefined=no 166841b2f0bdSmrg continue 166941b2f0bdSmrg ;; 167041b2f0bdSmrg 167141b2f0bdSmrg -objectlist) 167241b2f0bdSmrg prev=objectlist 167341b2f0bdSmrg continue 167441b2f0bdSmrg ;; 167541b2f0bdSmrg 167641b2f0bdSmrg -o) prev=output ;; 167741b2f0bdSmrg 167841b2f0bdSmrg -precious-files-regex) 167941b2f0bdSmrg prev=precious_regex 168041b2f0bdSmrg continue 168141b2f0bdSmrg ;; 168241b2f0bdSmrg 168341b2f0bdSmrg -release) 168441b2f0bdSmrg prev=release 168541b2f0bdSmrg continue 168641b2f0bdSmrg ;; 168741b2f0bdSmrg 168841b2f0bdSmrg -rpath) 168941b2f0bdSmrg prev=rpath 169041b2f0bdSmrg continue 169141b2f0bdSmrg ;; 169241b2f0bdSmrg 169341b2f0bdSmrg -R) 169441b2f0bdSmrg prev=xrpath 169541b2f0bdSmrg continue 169641b2f0bdSmrg ;; 169741b2f0bdSmrg 169841b2f0bdSmrg -R*) 169941b2f0bdSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 170041b2f0bdSmrg # We need an absolute path. 170141b2f0bdSmrg case $dir in 170241b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 170341b2f0bdSmrg *) 170441b2f0bdSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 170541b2f0bdSmrg exit $EXIT_FAILURE 170641b2f0bdSmrg ;; 170741b2f0bdSmrg esac 170841b2f0bdSmrg case "$xrpath " in 170941b2f0bdSmrg *" $dir "*) ;; 171041b2f0bdSmrg *) xrpath="$xrpath $dir" ;; 171141b2f0bdSmrg esac 171241b2f0bdSmrg continue 171341b2f0bdSmrg ;; 171441b2f0bdSmrg 171541b2f0bdSmrg -static) 171641b2f0bdSmrg # The effects of -static are defined in a previous loop. 171741b2f0bdSmrg # We used to do the same as -all-static on platforms that 171841b2f0bdSmrg # didn't have a PIC flag, but the assumption that the effects 171941b2f0bdSmrg # would be equivalent was wrong. It would break on at least 172041b2f0bdSmrg # Digital Unix and AIX. 172141b2f0bdSmrg continue 172241b2f0bdSmrg ;; 172341b2f0bdSmrg 172441b2f0bdSmrg -thread-safe) 172541b2f0bdSmrg thread_safe=yes 172641b2f0bdSmrg continue 172741b2f0bdSmrg ;; 172841b2f0bdSmrg 172941b2f0bdSmrg -version-info) 173041b2f0bdSmrg prev=vinfo 173141b2f0bdSmrg continue 173241b2f0bdSmrg ;; 173341b2f0bdSmrg -version-number) 173441b2f0bdSmrg prev=vinfo 173541b2f0bdSmrg vinfo_number=yes 173641b2f0bdSmrg continue 173741b2f0bdSmrg ;; 173841b2f0bdSmrg 173941b2f0bdSmrg -Wc,*) 174041b2f0bdSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 174141b2f0bdSmrg arg= 174241b2f0bdSmrg save_ifs="$IFS"; IFS=',' 174341b2f0bdSmrg for flag in $args; do 174441b2f0bdSmrg IFS="$save_ifs" 174541b2f0bdSmrg case $flag in 174641b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 174741b2f0bdSmrg flag="\"$flag\"" 174841b2f0bdSmrg ;; 174941b2f0bdSmrg esac 175041b2f0bdSmrg arg="$arg $wl$flag" 175141b2f0bdSmrg compiler_flags="$compiler_flags $flag" 175241b2f0bdSmrg done 175341b2f0bdSmrg IFS="$save_ifs" 175441b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 175541b2f0bdSmrg ;; 175641b2f0bdSmrg 175741b2f0bdSmrg -Wl,*) 175841b2f0bdSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 175941b2f0bdSmrg arg= 176041b2f0bdSmrg save_ifs="$IFS"; IFS=',' 176141b2f0bdSmrg for flag in $args; do 176241b2f0bdSmrg IFS="$save_ifs" 176341b2f0bdSmrg case $flag in 176441b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 176541b2f0bdSmrg flag="\"$flag\"" 176641b2f0bdSmrg ;; 176741b2f0bdSmrg esac 176841b2f0bdSmrg arg="$arg $wl$flag" 176941b2f0bdSmrg compiler_flags="$compiler_flags $wl$flag" 177041b2f0bdSmrg linker_flags="$linker_flags $flag" 177141b2f0bdSmrg done 177241b2f0bdSmrg IFS="$save_ifs" 177341b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 177441b2f0bdSmrg ;; 177541b2f0bdSmrg 177641b2f0bdSmrg -Xcompiler) 177741b2f0bdSmrg prev=xcompiler 177841b2f0bdSmrg continue 177941b2f0bdSmrg ;; 178041b2f0bdSmrg 178141b2f0bdSmrg -Xlinker) 178241b2f0bdSmrg prev=xlinker 178341b2f0bdSmrg continue 178441b2f0bdSmrg ;; 178541b2f0bdSmrg 178641b2f0bdSmrg -XCClinker) 178741b2f0bdSmrg prev=xcclinker 178841b2f0bdSmrg continue 178941b2f0bdSmrg ;; 179041b2f0bdSmrg 179141b2f0bdSmrg # Some other compiler flag. 179241b2f0bdSmrg -* | +*) 179341b2f0bdSmrg # Unknown arguments in both finalize_command and compile_command need 179441b2f0bdSmrg # to be aesthetically quoted because they are evaled later. 179541b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 179641b2f0bdSmrg case $arg in 179741b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 179841b2f0bdSmrg arg="\"$arg\"" 179941b2f0bdSmrg ;; 180041b2f0bdSmrg esac 180141b2f0bdSmrg ;; 180241b2f0bdSmrg 180341b2f0bdSmrg *.$objext) 180441b2f0bdSmrg # A standard object. 180541b2f0bdSmrg objs="$objs $arg" 180641b2f0bdSmrg ;; 180741b2f0bdSmrg 180841b2f0bdSmrg *.lo) 180941b2f0bdSmrg # A libtool-controlled object. 181041b2f0bdSmrg 181141b2f0bdSmrg # Check to see that this really is a libtool object. 181241b2f0bdSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 181341b2f0bdSmrg pic_object= 181441b2f0bdSmrg non_pic_object= 181541b2f0bdSmrg 181641b2f0bdSmrg # Read the .lo file 181741b2f0bdSmrg # If there is no directory component, then add one. 181841b2f0bdSmrg case $arg in 181941b2f0bdSmrg */* | *\\*) . $arg ;; 182041b2f0bdSmrg *) . ./$arg ;; 182141b2f0bdSmrg esac 182241b2f0bdSmrg 182341b2f0bdSmrg if test -z "$pic_object" || \ 182441b2f0bdSmrg test -z "$non_pic_object" || 182541b2f0bdSmrg test "$pic_object" = none && \ 182641b2f0bdSmrg test "$non_pic_object" = none; then 182741b2f0bdSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 182841b2f0bdSmrg exit $EXIT_FAILURE 182941b2f0bdSmrg fi 183041b2f0bdSmrg 183141b2f0bdSmrg # Extract subdirectory from the argument. 183241b2f0bdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 183341b2f0bdSmrg if test "X$xdir" = "X$arg"; then 183441b2f0bdSmrg xdir= 183541b2f0bdSmrg else 183641b2f0bdSmrg xdir="$xdir/" 183741b2f0bdSmrg fi 183841b2f0bdSmrg 183941b2f0bdSmrg if test "$pic_object" != none; then 184041b2f0bdSmrg # Prepend the subdirectory the object is found in. 184141b2f0bdSmrg pic_object="$xdir$pic_object" 184241b2f0bdSmrg 184341b2f0bdSmrg if test "$prev" = dlfiles; then 184441b2f0bdSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 184541b2f0bdSmrg dlfiles="$dlfiles $pic_object" 184641b2f0bdSmrg prev= 184741b2f0bdSmrg continue 184841b2f0bdSmrg else 184941b2f0bdSmrg # If libtool objects are unsupported, then we need to preload. 185041b2f0bdSmrg prev=dlprefiles 185141b2f0bdSmrg fi 185241b2f0bdSmrg fi 185341b2f0bdSmrg 185441b2f0bdSmrg # CHECK ME: I think I busted this. -Ossama 185541b2f0bdSmrg if test "$prev" = dlprefiles; then 185641b2f0bdSmrg # Preload the old-style object. 185741b2f0bdSmrg dlprefiles="$dlprefiles $pic_object" 185841b2f0bdSmrg prev= 185941b2f0bdSmrg fi 186041b2f0bdSmrg 186141b2f0bdSmrg # A PIC object. 186241b2f0bdSmrg libobjs="$libobjs $pic_object" 186341b2f0bdSmrg arg="$pic_object" 186441b2f0bdSmrg fi 186541b2f0bdSmrg 186641b2f0bdSmrg # Non-PIC object. 186741b2f0bdSmrg if test "$non_pic_object" != none; then 186841b2f0bdSmrg # Prepend the subdirectory the object is found in. 186941b2f0bdSmrg non_pic_object="$xdir$non_pic_object" 187041b2f0bdSmrg 187141b2f0bdSmrg # A standard non-PIC object 187241b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 187341b2f0bdSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 187441b2f0bdSmrg arg="$non_pic_object" 187541b2f0bdSmrg fi 187641b2f0bdSmrg else 187741b2f0bdSmrg # If the PIC object exists, use it instead. 187841b2f0bdSmrg # $xdir was prepended to $pic_object above. 187941b2f0bdSmrg non_pic_object="$pic_object" 188041b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 188141b2f0bdSmrg fi 188241b2f0bdSmrg else 188341b2f0bdSmrg # Only an error if not doing a dry-run. 188441b2f0bdSmrg if test -z "$run"; then 188541b2f0bdSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 188641b2f0bdSmrg exit $EXIT_FAILURE 188741b2f0bdSmrg else 188841b2f0bdSmrg # Dry-run case. 188941b2f0bdSmrg 189041b2f0bdSmrg # Extract subdirectory from the argument. 189141b2f0bdSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 189241b2f0bdSmrg if test "X$xdir" = "X$arg"; then 189341b2f0bdSmrg xdir= 189441b2f0bdSmrg else 189541b2f0bdSmrg xdir="$xdir/" 189641b2f0bdSmrg fi 189741b2f0bdSmrg 189841b2f0bdSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 189941b2f0bdSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 190041b2f0bdSmrg libobjs="$libobjs $pic_object" 190141b2f0bdSmrg non_pic_objects="$non_pic_objects $non_pic_object" 190241b2f0bdSmrg fi 190341b2f0bdSmrg fi 190441b2f0bdSmrg ;; 190541b2f0bdSmrg 190641b2f0bdSmrg *.$libext) 190741b2f0bdSmrg # An archive. 190841b2f0bdSmrg deplibs="$deplibs $arg" 190941b2f0bdSmrg old_deplibs="$old_deplibs $arg" 191041b2f0bdSmrg continue 191141b2f0bdSmrg ;; 191241b2f0bdSmrg 191341b2f0bdSmrg *.la) 191441b2f0bdSmrg # A libtool-controlled library. 191541b2f0bdSmrg 191641b2f0bdSmrg if test "$prev" = dlfiles; then 191741b2f0bdSmrg # This library was specified with -dlopen. 191841b2f0bdSmrg dlfiles="$dlfiles $arg" 191941b2f0bdSmrg prev= 192041b2f0bdSmrg elif test "$prev" = dlprefiles; then 192141b2f0bdSmrg # The library was specified with -dlpreopen. 192241b2f0bdSmrg dlprefiles="$dlprefiles $arg" 192341b2f0bdSmrg prev= 192441b2f0bdSmrg else 192541b2f0bdSmrg deplibs="$deplibs $arg" 192641b2f0bdSmrg fi 192741b2f0bdSmrg continue 192841b2f0bdSmrg ;; 192941b2f0bdSmrg 193041b2f0bdSmrg # Some other compiler argument. 193141b2f0bdSmrg *) 193241b2f0bdSmrg # Unknown arguments in both finalize_command and compile_command need 193341b2f0bdSmrg # to be aesthetically quoted because they are evaled later. 193441b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 193541b2f0bdSmrg case $arg in 193641b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 193741b2f0bdSmrg arg="\"$arg\"" 193841b2f0bdSmrg ;; 193941b2f0bdSmrg esac 194041b2f0bdSmrg ;; 194141b2f0bdSmrg esac # arg 194241b2f0bdSmrg 194341b2f0bdSmrg # Now actually substitute the argument into the commands. 194441b2f0bdSmrg if test -n "$arg"; then 194541b2f0bdSmrg compile_command="$compile_command $arg" 194641b2f0bdSmrg finalize_command="$finalize_command $arg" 194741b2f0bdSmrg fi 194841b2f0bdSmrg done # argument parsing loop 194941b2f0bdSmrg 195041b2f0bdSmrg if test -n "$prev"; then 195141b2f0bdSmrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 195241b2f0bdSmrg $echo "$help" 1>&2 195341b2f0bdSmrg exit $EXIT_FAILURE 195441b2f0bdSmrg fi 195541b2f0bdSmrg 195641b2f0bdSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 195741b2f0bdSmrg eval arg=\"$export_dynamic_flag_spec\" 195841b2f0bdSmrg compile_command="$compile_command $arg" 195941b2f0bdSmrg finalize_command="$finalize_command $arg" 196041b2f0bdSmrg fi 196141b2f0bdSmrg 196241b2f0bdSmrg oldlibs= 196341b2f0bdSmrg # calculate the name of the file, without its directory 196441b2f0bdSmrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 196541b2f0bdSmrg libobjs_save="$libobjs" 196641b2f0bdSmrg 196741b2f0bdSmrg if test -n "$shlibpath_var"; then 196841b2f0bdSmrg # get the directories listed in $shlibpath_var 196941b2f0bdSmrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 197041b2f0bdSmrg else 197141b2f0bdSmrg shlib_search_path= 197241b2f0bdSmrg fi 197341b2f0bdSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 197441b2f0bdSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 197541b2f0bdSmrg 197641b2f0bdSmrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 197741b2f0bdSmrg if test "X$output_objdir" = "X$output"; then 197841b2f0bdSmrg output_objdir="$objdir" 197941b2f0bdSmrg else 198041b2f0bdSmrg output_objdir="$output_objdir/$objdir" 198141b2f0bdSmrg fi 198241b2f0bdSmrg # Create the object directory. 198341b2f0bdSmrg if test ! -d "$output_objdir"; then 198441b2f0bdSmrg $show "$mkdir $output_objdir" 198541b2f0bdSmrg $run $mkdir $output_objdir 198641b2f0bdSmrg exit_status=$? 198741b2f0bdSmrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 198841b2f0bdSmrg exit $exit_status 198941b2f0bdSmrg fi 199041b2f0bdSmrg fi 199141b2f0bdSmrg 199241b2f0bdSmrg # Determine the type of output 199341b2f0bdSmrg case $output in 199441b2f0bdSmrg "") 199541b2f0bdSmrg $echo "$modename: you must specify an output file" 1>&2 199641b2f0bdSmrg $echo "$help" 1>&2 199741b2f0bdSmrg exit $EXIT_FAILURE 199841b2f0bdSmrg ;; 199941b2f0bdSmrg *.$libext) linkmode=oldlib ;; 200041b2f0bdSmrg *.lo | *.$objext) linkmode=obj ;; 200141b2f0bdSmrg *.la) linkmode=lib ;; 200241b2f0bdSmrg *) linkmode=prog ;; # Anything else should be a program. 200341b2f0bdSmrg esac 200441b2f0bdSmrg 200541b2f0bdSmrg case $host in 200641b2f0bdSmrg *cygwin* | *mingw* | *pw32*) 200741b2f0bdSmrg # don't eliminate duplications in $postdeps and $predeps 200841b2f0bdSmrg duplicate_compiler_generated_deps=yes 200941b2f0bdSmrg ;; 201041b2f0bdSmrg *) 201141b2f0bdSmrg duplicate_compiler_generated_deps=$duplicate_deps 201241b2f0bdSmrg ;; 201341b2f0bdSmrg esac 201441b2f0bdSmrg specialdeplibs= 201541b2f0bdSmrg 201641b2f0bdSmrg libs= 201741b2f0bdSmrg # Find all interdependent deplibs by searching for libraries 201841b2f0bdSmrg # that are linked more than once (e.g. -la -lb -la) 201941b2f0bdSmrg for deplib in $deplibs; do 202041b2f0bdSmrg if test "X$duplicate_deps" = "Xyes" ; then 202141b2f0bdSmrg case "$libs " in 202241b2f0bdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 202341b2f0bdSmrg esac 202441b2f0bdSmrg fi 202541b2f0bdSmrg libs="$libs $deplib" 202641b2f0bdSmrg done 202741b2f0bdSmrg 202841b2f0bdSmrg if test "$linkmode" = lib; then 202941b2f0bdSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 203041b2f0bdSmrg 203141b2f0bdSmrg # Compute libraries that are listed more than once in $predeps 203241b2f0bdSmrg # $postdeps and mark them as special (i.e., whose duplicates are 203341b2f0bdSmrg # not to be eliminated). 203441b2f0bdSmrg pre_post_deps= 203541b2f0bdSmrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 203641b2f0bdSmrg for pre_post_dep in $predeps $postdeps; do 203741b2f0bdSmrg case "$pre_post_deps " in 203841b2f0bdSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 203941b2f0bdSmrg esac 204041b2f0bdSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 204141b2f0bdSmrg done 204241b2f0bdSmrg fi 204341b2f0bdSmrg pre_post_deps= 204441b2f0bdSmrg fi 204541b2f0bdSmrg 204641b2f0bdSmrg deplibs= 204741b2f0bdSmrg newdependency_libs= 204841b2f0bdSmrg newlib_search_path= 204941b2f0bdSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 205041b2f0bdSmrg notinst_deplibs= # not-installed libtool libraries 205141b2f0bdSmrg case $linkmode in 205241b2f0bdSmrg lib) 205341b2f0bdSmrg passes="conv link" 205441b2f0bdSmrg for file in $dlfiles $dlprefiles; do 205541b2f0bdSmrg case $file in 205641b2f0bdSmrg *.la) ;; 205741b2f0bdSmrg *) 205841b2f0bdSmrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 205941b2f0bdSmrg exit $EXIT_FAILURE 206041b2f0bdSmrg ;; 206141b2f0bdSmrg esac 206241b2f0bdSmrg done 206341b2f0bdSmrg ;; 206441b2f0bdSmrg prog) 206541b2f0bdSmrg compile_deplibs= 206641b2f0bdSmrg finalize_deplibs= 206741b2f0bdSmrg alldeplibs=no 206841b2f0bdSmrg newdlfiles= 206941b2f0bdSmrg newdlprefiles= 207041b2f0bdSmrg passes="conv scan dlopen dlpreopen link" 207141b2f0bdSmrg ;; 207241b2f0bdSmrg *) passes="conv" 207341b2f0bdSmrg ;; 207441b2f0bdSmrg esac 207541b2f0bdSmrg for pass in $passes; do 207641b2f0bdSmrg if test "$linkmode,$pass" = "lib,link" || 207741b2f0bdSmrg test "$linkmode,$pass" = "prog,scan"; then 207841b2f0bdSmrg libs="$deplibs" 207941b2f0bdSmrg deplibs= 208041b2f0bdSmrg fi 208141b2f0bdSmrg if test "$linkmode" = prog; then 208241b2f0bdSmrg case $pass in 208341b2f0bdSmrg dlopen) libs="$dlfiles" ;; 208441b2f0bdSmrg dlpreopen) libs="$dlprefiles" ;; 208541b2f0bdSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 208641b2f0bdSmrg esac 208741b2f0bdSmrg fi 208841b2f0bdSmrg if test "$pass" = dlopen; then 208941b2f0bdSmrg # Collect dlpreopened libraries 209041b2f0bdSmrg save_deplibs="$deplibs" 209141b2f0bdSmrg deplibs= 209241b2f0bdSmrg fi 209341b2f0bdSmrg for deplib in $libs; do 209441b2f0bdSmrg lib= 209541b2f0bdSmrg found=no 209641b2f0bdSmrg case $deplib in 209741b2f0bdSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 209841b2f0bdSmrg if test "$linkmode,$pass" = "prog,link"; then 209941b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 210041b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 210141b2f0bdSmrg else 210241b2f0bdSmrg compiler_flags="$compiler_flags $deplib" 210341b2f0bdSmrg fi 210441b2f0bdSmrg continue 210541b2f0bdSmrg ;; 210641b2f0bdSmrg -l*) 210741b2f0bdSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 210841b2f0bdSmrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 210941b2f0bdSmrg continue 211041b2f0bdSmrg fi 211141b2f0bdSmrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 211241b2f0bdSmrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 211341b2f0bdSmrg for search_ext in .la $std_shrext .so .a; do 211441b2f0bdSmrg # Search the libtool library 211541b2f0bdSmrg lib="$searchdir/lib${name}${search_ext}" 211641b2f0bdSmrg if test -f "$lib"; then 211741b2f0bdSmrg if test "$search_ext" = ".la"; then 211841b2f0bdSmrg found=yes 211941b2f0bdSmrg else 212041b2f0bdSmrg found=no 212141b2f0bdSmrg fi 212241b2f0bdSmrg break 2 212341b2f0bdSmrg fi 212441b2f0bdSmrg done 212541b2f0bdSmrg done 212641b2f0bdSmrg if test "$found" != yes; then 212741b2f0bdSmrg # deplib doesn't seem to be a libtool library 212841b2f0bdSmrg if test "$linkmode,$pass" = "prog,link"; then 212941b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 213041b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 213141b2f0bdSmrg else 213241b2f0bdSmrg deplibs="$deplib $deplibs" 213341b2f0bdSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 213441b2f0bdSmrg fi 213541b2f0bdSmrg continue 213641b2f0bdSmrg else # deplib is a libtool library 213741b2f0bdSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 213841b2f0bdSmrg # We need to do some special things here, and not later. 213941b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 214041b2f0bdSmrg case " $predeps $postdeps " in 214141b2f0bdSmrg *" $deplib "*) 214241b2f0bdSmrg if (${SED} -e '2q' $lib | 214341b2f0bdSmrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 214441b2f0bdSmrg library_names= 214541b2f0bdSmrg old_library= 214641b2f0bdSmrg case $lib in 214741b2f0bdSmrg */* | *\\*) . $lib ;; 214841b2f0bdSmrg *) . ./$lib ;; 214941b2f0bdSmrg esac 215041b2f0bdSmrg for l in $old_library $library_names; do 215141b2f0bdSmrg ll="$l" 215241b2f0bdSmrg done 215341b2f0bdSmrg if test "X$ll" = "X$old_library" ; then # only static version available 215441b2f0bdSmrg found=no 215541b2f0bdSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 215641b2f0bdSmrg test "X$ladir" = "X$lib" && ladir="." 215741b2f0bdSmrg lib=$ladir/$old_library 215841b2f0bdSmrg if test "$linkmode,$pass" = "prog,link"; then 215941b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 216041b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 216141b2f0bdSmrg else 216241b2f0bdSmrg deplibs="$deplib $deplibs" 216341b2f0bdSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 216441b2f0bdSmrg fi 216541b2f0bdSmrg continue 216641b2f0bdSmrg fi 216741b2f0bdSmrg fi 216841b2f0bdSmrg ;; 216941b2f0bdSmrg *) ;; 217041b2f0bdSmrg esac 217141b2f0bdSmrg fi 217241b2f0bdSmrg fi 217341b2f0bdSmrg ;; # -l 217441b2f0bdSmrg -L*) 217541b2f0bdSmrg case $linkmode in 217641b2f0bdSmrg lib) 217741b2f0bdSmrg deplibs="$deplib $deplibs" 217841b2f0bdSmrg test "$pass" = conv && continue 217941b2f0bdSmrg newdependency_libs="$deplib $newdependency_libs" 218041b2f0bdSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 218141b2f0bdSmrg ;; 218241b2f0bdSmrg prog) 218341b2f0bdSmrg if test "$pass" = conv; then 218441b2f0bdSmrg deplibs="$deplib $deplibs" 218541b2f0bdSmrg continue 218641b2f0bdSmrg fi 218741b2f0bdSmrg if test "$pass" = scan; then 218841b2f0bdSmrg deplibs="$deplib $deplibs" 218941b2f0bdSmrg else 219041b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 219141b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 219241b2f0bdSmrg fi 219341b2f0bdSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 219441b2f0bdSmrg ;; 219541b2f0bdSmrg *) 219641b2f0bdSmrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 219741b2f0bdSmrg ;; 219841b2f0bdSmrg esac # linkmode 219941b2f0bdSmrg continue 220041b2f0bdSmrg ;; # -L 220141b2f0bdSmrg -R*) 220241b2f0bdSmrg if test "$pass" = link; then 220341b2f0bdSmrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 220441b2f0bdSmrg # Make sure the xrpath contains only unique directories. 220541b2f0bdSmrg case "$xrpath " in 220641b2f0bdSmrg *" $dir "*) ;; 220741b2f0bdSmrg *) xrpath="$xrpath $dir" ;; 220841b2f0bdSmrg esac 220941b2f0bdSmrg fi 221041b2f0bdSmrg deplibs="$deplib $deplibs" 221141b2f0bdSmrg continue 221241b2f0bdSmrg ;; 221341b2f0bdSmrg *.la) lib="$deplib" ;; 221441b2f0bdSmrg *.$libext) 221541b2f0bdSmrg if test "$pass" = conv; then 221641b2f0bdSmrg deplibs="$deplib $deplibs" 221741b2f0bdSmrg continue 221841b2f0bdSmrg fi 221941b2f0bdSmrg case $linkmode in 222041b2f0bdSmrg lib) 222141b2f0bdSmrg valid_a_lib=no 222241b2f0bdSmrg case $deplibs_check_method in 222341b2f0bdSmrg match_pattern*) 222441b2f0bdSmrg set dummy $deplibs_check_method 222541b2f0bdSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 222641b2f0bdSmrg if eval $echo \"$deplib\" 2>/dev/null \ 222741b2f0bdSmrg | $SED 10q \ 222841b2f0bdSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 222941b2f0bdSmrg valid_a_lib=yes 223041b2f0bdSmrg fi 223141b2f0bdSmrg ;; 223241b2f0bdSmrg pass_all) 223341b2f0bdSmrg valid_a_lib=yes 223441b2f0bdSmrg ;; 223541b2f0bdSmrg esac 223641b2f0bdSmrg if test "$valid_a_lib" != yes; then 223741b2f0bdSmrg $echo 223841b2f0bdSmrg $echo "*** Warning: Trying to link with static lib archive $deplib." 223941b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 224041b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 224141b2f0bdSmrg $echo "*** shared version of the library, which you do not appear to have" 224241b2f0bdSmrg $echo "*** because the file extensions .$libext of this argument makes me believe" 224341b2f0bdSmrg $echo "*** that it is just a static archive that I should not used here." 224441b2f0bdSmrg else 224541b2f0bdSmrg $echo 224641b2f0bdSmrg $echo "*** Warning: Linking the shared library $output against the" 224741b2f0bdSmrg $echo "*** static library $deplib is not portable!" 224841b2f0bdSmrg deplibs="$deplib $deplibs" 224941b2f0bdSmrg fi 225041b2f0bdSmrg continue 225141b2f0bdSmrg ;; 225241b2f0bdSmrg prog) 225341b2f0bdSmrg if test "$pass" != link; then 225441b2f0bdSmrg deplibs="$deplib $deplibs" 225541b2f0bdSmrg else 225641b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 225741b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 225841b2f0bdSmrg fi 225941b2f0bdSmrg continue 226041b2f0bdSmrg ;; 226141b2f0bdSmrg esac # linkmode 226241b2f0bdSmrg ;; # *.$libext 226341b2f0bdSmrg *.lo | *.$objext) 226441b2f0bdSmrg if test "$pass" = conv; then 226541b2f0bdSmrg deplibs="$deplib $deplibs" 226641b2f0bdSmrg elif test "$linkmode" = prog; then 226741b2f0bdSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 226841b2f0bdSmrg # If there is no dlopen support or we're linking statically, 226941b2f0bdSmrg # we need to preload. 227041b2f0bdSmrg newdlprefiles="$newdlprefiles $deplib" 227141b2f0bdSmrg compile_deplibs="$deplib $compile_deplibs" 227241b2f0bdSmrg finalize_deplibs="$deplib $finalize_deplibs" 227341b2f0bdSmrg else 227441b2f0bdSmrg newdlfiles="$newdlfiles $deplib" 227541b2f0bdSmrg fi 227641b2f0bdSmrg fi 227741b2f0bdSmrg continue 227841b2f0bdSmrg ;; 227941b2f0bdSmrg %DEPLIBS%) 228041b2f0bdSmrg alldeplibs=yes 228141b2f0bdSmrg continue 228241b2f0bdSmrg ;; 228341b2f0bdSmrg esac # case $deplib 228441b2f0bdSmrg if test "$found" = yes || test -f "$lib"; then : 228541b2f0bdSmrg else 228641b2f0bdSmrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 228741b2f0bdSmrg exit $EXIT_FAILURE 228841b2f0bdSmrg fi 228941b2f0bdSmrg 229041b2f0bdSmrg # Check to see that this really is a libtool archive. 229141b2f0bdSmrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 229241b2f0bdSmrg else 229341b2f0bdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 229441b2f0bdSmrg exit $EXIT_FAILURE 229541b2f0bdSmrg fi 229641b2f0bdSmrg 229741b2f0bdSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 229841b2f0bdSmrg test "X$ladir" = "X$lib" && ladir="." 229941b2f0bdSmrg 230041b2f0bdSmrg dlname= 230141b2f0bdSmrg dlopen= 230241b2f0bdSmrg dlpreopen= 230341b2f0bdSmrg libdir= 230441b2f0bdSmrg library_names= 230541b2f0bdSmrg old_library= 230641b2f0bdSmrg # If the library was installed with an old release of libtool, 230741b2f0bdSmrg # it will not redefine variables installed, or shouldnotlink 230841b2f0bdSmrg installed=yes 230941b2f0bdSmrg shouldnotlink=no 231041b2f0bdSmrg avoidtemprpath= 231141b2f0bdSmrg 231241b2f0bdSmrg 231341b2f0bdSmrg # Read the .la file 231441b2f0bdSmrg case $lib in 231541b2f0bdSmrg */* | *\\*) . $lib ;; 231641b2f0bdSmrg *) . ./$lib ;; 231741b2f0bdSmrg esac 231841b2f0bdSmrg 231941b2f0bdSmrg if test "$linkmode,$pass" = "lib,link" || 232041b2f0bdSmrg test "$linkmode,$pass" = "prog,scan" || 232141b2f0bdSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 232241b2f0bdSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 232341b2f0bdSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 232441b2f0bdSmrg fi 232541b2f0bdSmrg 232641b2f0bdSmrg if test "$pass" = conv; then 232741b2f0bdSmrg # Only check for convenience libraries 232841b2f0bdSmrg deplibs="$lib $deplibs" 232941b2f0bdSmrg if test -z "$libdir"; then 233041b2f0bdSmrg if test -z "$old_library"; then 233141b2f0bdSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 233241b2f0bdSmrg exit $EXIT_FAILURE 233341b2f0bdSmrg fi 233441b2f0bdSmrg # It is a libtool convenience library, so add in its objects. 233541b2f0bdSmrg convenience="$convenience $ladir/$objdir/$old_library" 233641b2f0bdSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 233741b2f0bdSmrg tmp_libs= 233841b2f0bdSmrg for deplib in $dependency_libs; do 233941b2f0bdSmrg deplibs="$deplib $deplibs" 234041b2f0bdSmrg if test "X$duplicate_deps" = "Xyes" ; then 234141b2f0bdSmrg case "$tmp_libs " in 234241b2f0bdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 234341b2f0bdSmrg esac 234441b2f0bdSmrg fi 234541b2f0bdSmrg tmp_libs="$tmp_libs $deplib" 234641b2f0bdSmrg done 234741b2f0bdSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 234841b2f0bdSmrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 234941b2f0bdSmrg exit $EXIT_FAILURE 235041b2f0bdSmrg fi 235141b2f0bdSmrg continue 235241b2f0bdSmrg fi # $pass = conv 235341b2f0bdSmrg 235441b2f0bdSmrg 235541b2f0bdSmrg # Get the name of the library we link against. 235641b2f0bdSmrg linklib= 235741b2f0bdSmrg for l in $old_library $library_names; do 235841b2f0bdSmrg linklib="$l" 235941b2f0bdSmrg done 236041b2f0bdSmrg if test -z "$linklib"; then 236141b2f0bdSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 236241b2f0bdSmrg exit $EXIT_FAILURE 236341b2f0bdSmrg fi 236441b2f0bdSmrg 236541b2f0bdSmrg # This library was specified with -dlopen. 236641b2f0bdSmrg if test "$pass" = dlopen; then 236741b2f0bdSmrg if test -z "$libdir"; then 236841b2f0bdSmrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 236941b2f0bdSmrg exit $EXIT_FAILURE 237041b2f0bdSmrg fi 237141b2f0bdSmrg if test -z "$dlname" || 237241b2f0bdSmrg test "$dlopen_support" != yes || 237341b2f0bdSmrg test "$build_libtool_libs" = no; then 237441b2f0bdSmrg # If there is no dlname, no dlopen support or we're linking 237541b2f0bdSmrg # statically, we need to preload. We also need to preload any 237641b2f0bdSmrg # dependent libraries so libltdl's deplib preloader doesn't 237741b2f0bdSmrg # bomb out in the load deplibs phase. 237841b2f0bdSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 237941b2f0bdSmrg else 238041b2f0bdSmrg newdlfiles="$newdlfiles $lib" 238141b2f0bdSmrg fi 238241b2f0bdSmrg continue 238341b2f0bdSmrg fi # $pass = dlopen 238441b2f0bdSmrg 238541b2f0bdSmrg # We need an absolute path. 238641b2f0bdSmrg case $ladir in 238741b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 238841b2f0bdSmrg *) 238941b2f0bdSmrg abs_ladir=`cd "$ladir" && pwd` 239041b2f0bdSmrg if test -z "$abs_ladir"; then 239141b2f0bdSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 239241b2f0bdSmrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 239341b2f0bdSmrg abs_ladir="$ladir" 239441b2f0bdSmrg fi 239541b2f0bdSmrg ;; 239641b2f0bdSmrg esac 239741b2f0bdSmrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 239841b2f0bdSmrg 239941b2f0bdSmrg # Find the relevant object directory and library name. 240041b2f0bdSmrg if test "X$installed" = Xyes; then 240141b2f0bdSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 240241b2f0bdSmrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 240341b2f0bdSmrg dir="$ladir" 240441b2f0bdSmrg absdir="$abs_ladir" 240541b2f0bdSmrg libdir="$abs_ladir" 240641b2f0bdSmrg else 240741b2f0bdSmrg dir="$libdir" 240841b2f0bdSmrg absdir="$libdir" 240941b2f0bdSmrg fi 241041b2f0bdSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 241141b2f0bdSmrg else 241241b2f0bdSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 241341b2f0bdSmrg dir="$ladir" 241441b2f0bdSmrg absdir="$abs_ladir" 241541b2f0bdSmrg # Remove this search path later 241641b2f0bdSmrg notinst_path="$notinst_path $abs_ladir" 241741b2f0bdSmrg else 241841b2f0bdSmrg dir="$ladir/$objdir" 241941b2f0bdSmrg absdir="$abs_ladir/$objdir" 242041b2f0bdSmrg # Remove this search path later 242141b2f0bdSmrg notinst_path="$notinst_path $abs_ladir" 242241b2f0bdSmrg fi 242341b2f0bdSmrg fi # $installed = yes 242441b2f0bdSmrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 242541b2f0bdSmrg 242641b2f0bdSmrg # This library was specified with -dlpreopen. 242741b2f0bdSmrg if test "$pass" = dlpreopen; then 242841b2f0bdSmrg if test -z "$libdir"; then 242941b2f0bdSmrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 243041b2f0bdSmrg exit $EXIT_FAILURE 243141b2f0bdSmrg fi 243241b2f0bdSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 243341b2f0bdSmrg # are required to link). 243441b2f0bdSmrg if test -n "$old_library"; then 243541b2f0bdSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 243641b2f0bdSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 243741b2f0bdSmrg elif test -n "$dlname"; then 243841b2f0bdSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 243941b2f0bdSmrg else 244041b2f0bdSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 244141b2f0bdSmrg fi 244241b2f0bdSmrg fi # $pass = dlpreopen 244341b2f0bdSmrg 244441b2f0bdSmrg if test -z "$libdir"; then 244541b2f0bdSmrg # Link the convenience library 244641b2f0bdSmrg if test "$linkmode" = lib; then 244741b2f0bdSmrg deplibs="$dir/$old_library $deplibs" 244841b2f0bdSmrg elif test "$linkmode,$pass" = "prog,link"; then 244941b2f0bdSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 245041b2f0bdSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 245141b2f0bdSmrg else 245241b2f0bdSmrg deplibs="$lib $deplibs" # used for prog,scan pass 245341b2f0bdSmrg fi 245441b2f0bdSmrg continue 245541b2f0bdSmrg fi 245641b2f0bdSmrg 245741b2f0bdSmrg 245841b2f0bdSmrg if test "$linkmode" = prog && test "$pass" != link; then 245941b2f0bdSmrg newlib_search_path="$newlib_search_path $ladir" 246041b2f0bdSmrg deplibs="$lib $deplibs" 246141b2f0bdSmrg 246241b2f0bdSmrg linkalldeplibs=no 246341b2f0bdSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 246441b2f0bdSmrg test "$build_libtool_libs" = no; then 246541b2f0bdSmrg linkalldeplibs=yes 246641b2f0bdSmrg fi 246741b2f0bdSmrg 246841b2f0bdSmrg tmp_libs= 246941b2f0bdSmrg for deplib in $dependency_libs; do 247041b2f0bdSmrg case $deplib in 247141b2f0bdSmrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 247241b2f0bdSmrg esac 247341b2f0bdSmrg # Need to link against all dependency_libs? 247441b2f0bdSmrg if test "$linkalldeplibs" = yes; then 247541b2f0bdSmrg deplibs="$deplib $deplibs" 247641b2f0bdSmrg else 247741b2f0bdSmrg # Need to hardcode shared library paths 247841b2f0bdSmrg # or/and link against static libraries 247941b2f0bdSmrg newdependency_libs="$deplib $newdependency_libs" 248041b2f0bdSmrg fi 248141b2f0bdSmrg if test "X$duplicate_deps" = "Xyes" ; then 248241b2f0bdSmrg case "$tmp_libs " in 248341b2f0bdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 248441b2f0bdSmrg esac 248541b2f0bdSmrg fi 248641b2f0bdSmrg tmp_libs="$tmp_libs $deplib" 248741b2f0bdSmrg done # for deplib 248841b2f0bdSmrg continue 248941b2f0bdSmrg fi # $linkmode = prog... 249041b2f0bdSmrg 249141b2f0bdSmrg if test "$linkmode,$pass" = "prog,link"; then 249241b2f0bdSmrg if test -n "$library_names" && 249341b2f0bdSmrg { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 249441b2f0bdSmrg # We need to hardcode the library path 249541b2f0bdSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 249641b2f0bdSmrg # Make sure the rpath contains only unique directories. 249741b2f0bdSmrg case "$temp_rpath " in 249841b2f0bdSmrg *" $dir "*) ;; 249941b2f0bdSmrg *" $absdir "*) ;; 250041b2f0bdSmrg *) temp_rpath="$temp_rpath $absdir" ;; 250141b2f0bdSmrg esac 250241b2f0bdSmrg fi 250341b2f0bdSmrg 250441b2f0bdSmrg # Hardcode the library path. 250541b2f0bdSmrg # Skip directories that are in the system default run-time 250641b2f0bdSmrg # search path. 250741b2f0bdSmrg case " $sys_lib_dlsearch_path " in 250841b2f0bdSmrg *" $absdir "*) ;; 250941b2f0bdSmrg *) 251041b2f0bdSmrg case "$compile_rpath " in 251141b2f0bdSmrg *" $absdir "*) ;; 251241b2f0bdSmrg *) compile_rpath="$compile_rpath $absdir" 251341b2f0bdSmrg esac 251441b2f0bdSmrg ;; 251541b2f0bdSmrg esac 251641b2f0bdSmrg case " $sys_lib_dlsearch_path " in 251741b2f0bdSmrg *" $libdir "*) ;; 251841b2f0bdSmrg *) 251941b2f0bdSmrg case "$finalize_rpath " in 252041b2f0bdSmrg *" $libdir "*) ;; 252141b2f0bdSmrg *) finalize_rpath="$finalize_rpath $libdir" 252241b2f0bdSmrg esac 252341b2f0bdSmrg ;; 252441b2f0bdSmrg esac 252541b2f0bdSmrg fi # $linkmode,$pass = prog,link... 252641b2f0bdSmrg 252741b2f0bdSmrg if test "$alldeplibs" = yes && 252841b2f0bdSmrg { test "$deplibs_check_method" = pass_all || 252941b2f0bdSmrg { test "$build_libtool_libs" = yes && 253041b2f0bdSmrg test -n "$library_names"; }; }; then 253141b2f0bdSmrg # We only need to search for static libraries 253241b2f0bdSmrg continue 253341b2f0bdSmrg fi 253441b2f0bdSmrg fi 253541b2f0bdSmrg 253641b2f0bdSmrg link_static=no # Whether the deplib will be linked statically 253741b2f0bdSmrg use_static_libs=$prefer_static_libs 253841b2f0bdSmrg if test "$use_static_libs" = built && test "$installed" = yes ; then 253941b2f0bdSmrg use_static_libs=no 254041b2f0bdSmrg fi 254141b2f0bdSmrg if test -n "$library_names" && 254241b2f0bdSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 254341b2f0bdSmrg if test "$installed" = no; then 254441b2f0bdSmrg notinst_deplibs="$notinst_deplibs $lib" 254541b2f0bdSmrg need_relink=yes 254641b2f0bdSmrg fi 254741b2f0bdSmrg # This is a shared library 254841b2f0bdSmrg 254941b2f0bdSmrg # Warn about portability, can't link against -module's on 255041b2f0bdSmrg # some systems (darwin) 255141b2f0bdSmrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 255241b2f0bdSmrg $echo 255341b2f0bdSmrg if test "$linkmode" = prog; then 255441b2f0bdSmrg $echo "*** Warning: Linking the executable $output against the loadable module" 255541b2f0bdSmrg else 255641b2f0bdSmrg $echo "*** Warning: Linking the shared library $output against the loadable module" 255741b2f0bdSmrg fi 255841b2f0bdSmrg $echo "*** $linklib is not portable!" 255941b2f0bdSmrg fi 256041b2f0bdSmrg if test "$linkmode" = lib && 256141b2f0bdSmrg test "$hardcode_into_libs" = yes; then 256241b2f0bdSmrg # Hardcode the library path. 256341b2f0bdSmrg # Skip directories that are in the system default run-time 256441b2f0bdSmrg # search path. 256541b2f0bdSmrg case " $sys_lib_dlsearch_path " in 256641b2f0bdSmrg *" $absdir "*) ;; 256741b2f0bdSmrg *) 256841b2f0bdSmrg case "$compile_rpath " in 256941b2f0bdSmrg *" $absdir "*) ;; 257041b2f0bdSmrg *) compile_rpath="$compile_rpath $absdir" 257141b2f0bdSmrg esac 257241b2f0bdSmrg ;; 257341b2f0bdSmrg esac 257441b2f0bdSmrg case " $sys_lib_dlsearch_path " in 257541b2f0bdSmrg *" $libdir "*) ;; 257641b2f0bdSmrg *) 257741b2f0bdSmrg case "$finalize_rpath " in 257841b2f0bdSmrg *" $libdir "*) ;; 257941b2f0bdSmrg *) finalize_rpath="$finalize_rpath $libdir" 258041b2f0bdSmrg esac 258141b2f0bdSmrg ;; 258241b2f0bdSmrg esac 258341b2f0bdSmrg fi 258441b2f0bdSmrg 258541b2f0bdSmrg if test -n "$old_archive_from_expsyms_cmds"; then 258641b2f0bdSmrg # figure out the soname 258741b2f0bdSmrg set dummy $library_names 258841b2f0bdSmrg realname="$2" 258941b2f0bdSmrg shift; shift 259041b2f0bdSmrg libname=`eval \\$echo \"$libname_spec\"` 259141b2f0bdSmrg # use dlname if we got it. it's perfectly good, no? 259241b2f0bdSmrg if test -n "$dlname"; then 259341b2f0bdSmrg soname="$dlname" 259441b2f0bdSmrg elif test -n "$soname_spec"; then 259541b2f0bdSmrg # bleh windows 259641b2f0bdSmrg case $host in 259741b2f0bdSmrg *cygwin* | mingw*) 259841b2f0bdSmrg major=`expr $current - $age` 259941b2f0bdSmrg versuffix="-$major" 260041b2f0bdSmrg ;; 260141b2f0bdSmrg esac 260241b2f0bdSmrg eval soname=\"$soname_spec\" 260341b2f0bdSmrg else 260441b2f0bdSmrg soname="$realname" 260541b2f0bdSmrg fi 260641b2f0bdSmrg 260741b2f0bdSmrg # Make a new name for the extract_expsyms_cmds to use 260841b2f0bdSmrg soroot="$soname" 260941b2f0bdSmrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 261041b2f0bdSmrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 261141b2f0bdSmrg 261241b2f0bdSmrg # If the library has no export list, then create one now 261341b2f0bdSmrg if test -f "$output_objdir/$soname-def"; then : 261441b2f0bdSmrg else 261541b2f0bdSmrg $show "extracting exported symbol list from \`$soname'" 261641b2f0bdSmrg save_ifs="$IFS"; IFS='~' 261741b2f0bdSmrg cmds=$extract_expsyms_cmds 261841b2f0bdSmrg for cmd in $cmds; do 261941b2f0bdSmrg IFS="$save_ifs" 262041b2f0bdSmrg eval cmd=\"$cmd\" 262141b2f0bdSmrg $show "$cmd" 262241b2f0bdSmrg $run eval "$cmd" || exit $? 262341b2f0bdSmrg done 262441b2f0bdSmrg IFS="$save_ifs" 262541b2f0bdSmrg fi 262641b2f0bdSmrg 262741b2f0bdSmrg # Create $newlib 262841b2f0bdSmrg if test -f "$output_objdir/$newlib"; then :; else 262941b2f0bdSmrg $show "generating import library for \`$soname'" 263041b2f0bdSmrg save_ifs="$IFS"; IFS='~' 263141b2f0bdSmrg cmds=$old_archive_from_expsyms_cmds 263241b2f0bdSmrg for cmd in $cmds; do 263341b2f0bdSmrg IFS="$save_ifs" 263441b2f0bdSmrg eval cmd=\"$cmd\" 263541b2f0bdSmrg $show "$cmd" 263641b2f0bdSmrg $run eval "$cmd" || exit $? 263741b2f0bdSmrg done 263841b2f0bdSmrg IFS="$save_ifs" 263941b2f0bdSmrg fi 264041b2f0bdSmrg # make sure the library variables are pointing to the new library 264141b2f0bdSmrg dir=$output_objdir 264241b2f0bdSmrg linklib=$newlib 264341b2f0bdSmrg fi # test -n "$old_archive_from_expsyms_cmds" 264441b2f0bdSmrg 264541b2f0bdSmrg if test "$linkmode" = prog || test "$mode" != relink; then 264641b2f0bdSmrg add_shlibpath= 264741b2f0bdSmrg add_dir= 264841b2f0bdSmrg add= 264941b2f0bdSmrg lib_linked=yes 265041b2f0bdSmrg case $hardcode_action in 265141b2f0bdSmrg immediate | unsupported) 265241b2f0bdSmrg if test "$hardcode_direct" = no; then 265341b2f0bdSmrg add="$dir/$linklib" 265441b2f0bdSmrg case $host in 265541b2f0bdSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 265641b2f0bdSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 265741b2f0bdSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 265841b2f0bdSmrg *-*-unixware7*) add_dir="-L$dir" ;; 265941b2f0bdSmrg *-*-darwin* ) 266041b2f0bdSmrg # if the lib is a module then we can not link against 266141b2f0bdSmrg # it, someone is ignoring the new warnings I added 266241b2f0bdSmrg if /usr/bin/file -L $add 2> /dev/null | 266341b2f0bdSmrg $EGREP ": [^:]* bundle" >/dev/null ; then 266441b2f0bdSmrg $echo "** Warning, lib $linklib is a module, not a shared library" 266541b2f0bdSmrg if test -z "$old_library" ; then 266641b2f0bdSmrg $echo 266741b2f0bdSmrg $echo "** And there doesn't seem to be a static archive available" 266841b2f0bdSmrg $echo "** The link will probably fail, sorry" 266941b2f0bdSmrg else 267041b2f0bdSmrg add="$dir/$old_library" 267141b2f0bdSmrg fi 267241b2f0bdSmrg fi 267341b2f0bdSmrg esac 267441b2f0bdSmrg elif test "$hardcode_minus_L" = no; then 267541b2f0bdSmrg case $host in 267641b2f0bdSmrg *-*-sunos*) add_shlibpath="$dir" ;; 267741b2f0bdSmrg esac 267841b2f0bdSmrg add_dir="-L$dir" 267941b2f0bdSmrg add="-l$name" 268041b2f0bdSmrg elif test "$hardcode_shlibpath_var" = no; then 268141b2f0bdSmrg add_shlibpath="$dir" 268241b2f0bdSmrg add="-l$name" 268341b2f0bdSmrg else 268441b2f0bdSmrg lib_linked=no 268541b2f0bdSmrg fi 268641b2f0bdSmrg ;; 268741b2f0bdSmrg relink) 268841b2f0bdSmrg if test "$hardcode_direct" = yes; then 268941b2f0bdSmrg add="$dir/$linklib" 269041b2f0bdSmrg elif test "$hardcode_minus_L" = yes; then 269141b2f0bdSmrg add_dir="-L$dir" 269241b2f0bdSmrg # Try looking first in the location we're being installed to. 269341b2f0bdSmrg if test -n "$inst_prefix_dir"; then 269441b2f0bdSmrg case $libdir in 269541b2f0bdSmrg [\\/]*) 269641b2f0bdSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 269741b2f0bdSmrg ;; 269841b2f0bdSmrg esac 269941b2f0bdSmrg fi 270041b2f0bdSmrg add="-l$name" 270141b2f0bdSmrg elif test "$hardcode_shlibpath_var" = yes; then 270241b2f0bdSmrg add_shlibpath="$dir" 270341b2f0bdSmrg add="-l$name" 270441b2f0bdSmrg else 270541b2f0bdSmrg lib_linked=no 270641b2f0bdSmrg fi 270741b2f0bdSmrg ;; 270841b2f0bdSmrg *) lib_linked=no ;; 270941b2f0bdSmrg esac 271041b2f0bdSmrg 271141b2f0bdSmrg if test "$lib_linked" != yes; then 271241b2f0bdSmrg $echo "$modename: configuration error: unsupported hardcode properties" 271341b2f0bdSmrg exit $EXIT_FAILURE 271441b2f0bdSmrg fi 271541b2f0bdSmrg 271641b2f0bdSmrg if test -n "$add_shlibpath"; then 271741b2f0bdSmrg case :$compile_shlibpath: in 271841b2f0bdSmrg *":$add_shlibpath:"*) ;; 271941b2f0bdSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 272041b2f0bdSmrg esac 272141b2f0bdSmrg fi 272241b2f0bdSmrg if test "$linkmode" = prog; then 272341b2f0bdSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 272441b2f0bdSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 272541b2f0bdSmrg else 272641b2f0bdSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 272741b2f0bdSmrg test -n "$add" && deplibs="$add $deplibs" 272841b2f0bdSmrg if test "$hardcode_direct" != yes && \ 272941b2f0bdSmrg test "$hardcode_minus_L" != yes && \ 273041b2f0bdSmrg test "$hardcode_shlibpath_var" = yes; then 273141b2f0bdSmrg case :$finalize_shlibpath: in 273241b2f0bdSmrg *":$libdir:"*) ;; 273341b2f0bdSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 273441b2f0bdSmrg esac 273541b2f0bdSmrg fi 273641b2f0bdSmrg fi 273741b2f0bdSmrg fi 273841b2f0bdSmrg 273941b2f0bdSmrg if test "$linkmode" = prog || test "$mode" = relink; then 274041b2f0bdSmrg add_shlibpath= 274141b2f0bdSmrg add_dir= 274241b2f0bdSmrg add= 274341b2f0bdSmrg # Finalize command for both is simple: just hardcode it. 274441b2f0bdSmrg if test "$hardcode_direct" = yes; then 274541b2f0bdSmrg add="$libdir/$linklib" 274641b2f0bdSmrg elif test "$hardcode_minus_L" = yes; then 274741b2f0bdSmrg add_dir="-L$libdir" 274841b2f0bdSmrg add="-l$name" 274941b2f0bdSmrg elif test "$hardcode_shlibpath_var" = yes; then 275041b2f0bdSmrg case :$finalize_shlibpath: in 275141b2f0bdSmrg *":$libdir:"*) ;; 275241b2f0bdSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 275341b2f0bdSmrg esac 275441b2f0bdSmrg add="-l$name" 275541b2f0bdSmrg elif test "$hardcode_automatic" = yes; then 275641b2f0bdSmrg if test -n "$inst_prefix_dir" && 275741b2f0bdSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 275841b2f0bdSmrg add="$inst_prefix_dir$libdir/$linklib" 275941b2f0bdSmrg else 276041b2f0bdSmrg add="$libdir/$linklib" 276141b2f0bdSmrg fi 276241b2f0bdSmrg else 276341b2f0bdSmrg # We cannot seem to hardcode it, guess we'll fake it. 276441b2f0bdSmrg add_dir="-L$libdir" 276541b2f0bdSmrg # Try looking first in the location we're being installed to. 276641b2f0bdSmrg if test -n "$inst_prefix_dir"; then 276741b2f0bdSmrg case $libdir in 276841b2f0bdSmrg [\\/]*) 276941b2f0bdSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 277041b2f0bdSmrg ;; 277141b2f0bdSmrg esac 277241b2f0bdSmrg fi 277341b2f0bdSmrg add="-l$name" 277441b2f0bdSmrg fi 277541b2f0bdSmrg 277641b2f0bdSmrg if test "$linkmode" = prog; then 277741b2f0bdSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 277841b2f0bdSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 277941b2f0bdSmrg else 278041b2f0bdSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 278141b2f0bdSmrg test -n "$add" && deplibs="$add $deplibs" 278241b2f0bdSmrg fi 278341b2f0bdSmrg fi 278441b2f0bdSmrg elif test "$linkmode" = prog; then 278541b2f0bdSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 278641b2f0bdSmrg # is not unsupported. This is valid on all known static and 278741b2f0bdSmrg # shared platforms. 278841b2f0bdSmrg if test "$hardcode_direct" != unsupported; then 278941b2f0bdSmrg test -n "$old_library" && linklib="$old_library" 279041b2f0bdSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 279141b2f0bdSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 279241b2f0bdSmrg else 279341b2f0bdSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 279441b2f0bdSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 279541b2f0bdSmrg fi 279641b2f0bdSmrg elif test "$build_libtool_libs" = yes; then 279741b2f0bdSmrg # Not a shared library 279841b2f0bdSmrg if test "$deplibs_check_method" != pass_all; then 279941b2f0bdSmrg # We're trying link a shared library against a static one 280041b2f0bdSmrg # but the system doesn't support it. 280141b2f0bdSmrg 280241b2f0bdSmrg # Just print a warning and add the library to dependency_libs so 280341b2f0bdSmrg # that the program can be linked against the static library. 280441b2f0bdSmrg $echo 280541b2f0bdSmrg $echo "*** Warning: This system can not link to static lib archive $lib." 280641b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 280741b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 280841b2f0bdSmrg $echo "*** shared version of the library, which you do not appear to have." 280941b2f0bdSmrg if test "$module" = yes; then 281041b2f0bdSmrg $echo "*** But as you try to build a module library, libtool will still create " 281141b2f0bdSmrg $echo "*** a static module, that should work as long as the dlopening application" 281241b2f0bdSmrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 281341b2f0bdSmrg if test -z "$global_symbol_pipe"; then 281441b2f0bdSmrg $echo 281541b2f0bdSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 281641b2f0bdSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 281741b2f0bdSmrg $echo "*** not find such a program. So, this module is probably useless." 281841b2f0bdSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 281941b2f0bdSmrg fi 282041b2f0bdSmrg if test "$build_old_libs" = no; then 282141b2f0bdSmrg build_libtool_libs=module 282241b2f0bdSmrg build_old_libs=yes 282341b2f0bdSmrg else 282441b2f0bdSmrg build_libtool_libs=no 282541b2f0bdSmrg fi 282641b2f0bdSmrg fi 282741b2f0bdSmrg else 282841b2f0bdSmrg deplibs="$dir/$old_library $deplibs" 282941b2f0bdSmrg link_static=yes 283041b2f0bdSmrg fi 283141b2f0bdSmrg fi # link shared/static library? 283241b2f0bdSmrg 283341b2f0bdSmrg if test "$linkmode" = lib; then 283441b2f0bdSmrg if test -n "$dependency_libs" && 283541b2f0bdSmrg { test "$hardcode_into_libs" != yes || 283641b2f0bdSmrg test "$build_old_libs" = yes || 283741b2f0bdSmrg test "$link_static" = yes; }; then 283841b2f0bdSmrg # Extract -R from dependency_libs 283941b2f0bdSmrg temp_deplibs= 284041b2f0bdSmrg for libdir in $dependency_libs; do 284141b2f0bdSmrg case $libdir in 284241b2f0bdSmrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 284341b2f0bdSmrg case " $xrpath " in 284441b2f0bdSmrg *" $temp_xrpath "*) ;; 284541b2f0bdSmrg *) xrpath="$xrpath $temp_xrpath";; 284641b2f0bdSmrg esac;; 284741b2f0bdSmrg *) temp_deplibs="$temp_deplibs $libdir";; 284841b2f0bdSmrg esac 284941b2f0bdSmrg done 285041b2f0bdSmrg dependency_libs="$temp_deplibs" 285141b2f0bdSmrg fi 285241b2f0bdSmrg 285341b2f0bdSmrg newlib_search_path="$newlib_search_path $absdir" 285441b2f0bdSmrg # Link against this library 285541b2f0bdSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 285641b2f0bdSmrg # ... and its dependency_libs 285741b2f0bdSmrg tmp_libs= 285841b2f0bdSmrg for deplib in $dependency_libs; do 285941b2f0bdSmrg newdependency_libs="$deplib $newdependency_libs" 286041b2f0bdSmrg if test "X$duplicate_deps" = "Xyes" ; then 286141b2f0bdSmrg case "$tmp_libs " in 286241b2f0bdSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 286341b2f0bdSmrg esac 286441b2f0bdSmrg fi 286541b2f0bdSmrg tmp_libs="$tmp_libs $deplib" 286641b2f0bdSmrg done 286741b2f0bdSmrg 286841b2f0bdSmrg if test "$link_all_deplibs" != no; then 286941b2f0bdSmrg # Add the search paths of all dependency libraries 287041b2f0bdSmrg for deplib in $dependency_libs; do 287141b2f0bdSmrg case $deplib in 287241b2f0bdSmrg -L*) path="$deplib" ;; 287341b2f0bdSmrg *.la) 287441b2f0bdSmrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 287541b2f0bdSmrg test "X$dir" = "X$deplib" && dir="." 287641b2f0bdSmrg # We need an absolute path. 287741b2f0bdSmrg case $dir in 287841b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 287941b2f0bdSmrg *) 288041b2f0bdSmrg absdir=`cd "$dir" && pwd` 288141b2f0bdSmrg if test -z "$absdir"; then 288241b2f0bdSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 288341b2f0bdSmrg absdir="$dir" 288441b2f0bdSmrg fi 288541b2f0bdSmrg ;; 288641b2f0bdSmrg esac 288741b2f0bdSmrg if grep "^installed=no" $deplib > /dev/null; then 288841b2f0bdSmrg path="$absdir/$objdir" 288941b2f0bdSmrg else 289041b2f0bdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 289141b2f0bdSmrg if test -z "$libdir"; then 289241b2f0bdSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 289341b2f0bdSmrg exit $EXIT_FAILURE 289441b2f0bdSmrg fi 289541b2f0bdSmrg if test "$absdir" != "$libdir"; then 289641b2f0bdSmrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 289741b2f0bdSmrg fi 289841b2f0bdSmrg path="$absdir" 289941b2f0bdSmrg fi 290041b2f0bdSmrg depdepl= 290141b2f0bdSmrg case $host in 290241b2f0bdSmrg *-*-darwin*) 290341b2f0bdSmrg # we do not want to link against static libs, 290441b2f0bdSmrg # but need to link against shared 290541b2f0bdSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 290641b2f0bdSmrg if test -n "$deplibrary_names" ; then 290741b2f0bdSmrg for tmp in $deplibrary_names ; do 290841b2f0bdSmrg depdepl=$tmp 290941b2f0bdSmrg done 291041b2f0bdSmrg if test -f "$path/$depdepl" ; then 291141b2f0bdSmrg depdepl="$path/$depdepl" 291241b2f0bdSmrg fi 291341b2f0bdSmrg # do not add paths which are already there 291441b2f0bdSmrg case " $newlib_search_path " in 291541b2f0bdSmrg *" $path "*) ;; 291641b2f0bdSmrg *) newlib_search_path="$newlib_search_path $path";; 291741b2f0bdSmrg esac 291841b2f0bdSmrg fi 291941b2f0bdSmrg path="" 292041b2f0bdSmrg ;; 292141b2f0bdSmrg *) 292241b2f0bdSmrg path="-L$path" 292341b2f0bdSmrg ;; 292441b2f0bdSmrg esac 292541b2f0bdSmrg ;; 292641b2f0bdSmrg -l*) 292741b2f0bdSmrg case $host in 292841b2f0bdSmrg *-*-darwin*) 292941b2f0bdSmrg # Again, we only want to link against shared libraries 293041b2f0bdSmrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 293141b2f0bdSmrg for tmp in $newlib_search_path ; do 293241b2f0bdSmrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 293341b2f0bdSmrg eval depdepl="$tmp/lib$tmp_libs.dylib" 293441b2f0bdSmrg break 293541b2f0bdSmrg fi 293641b2f0bdSmrg done 293741b2f0bdSmrg path="" 293841b2f0bdSmrg ;; 293941b2f0bdSmrg *) continue ;; 294041b2f0bdSmrg esac 294141b2f0bdSmrg ;; 294241b2f0bdSmrg *) continue ;; 294341b2f0bdSmrg esac 294441b2f0bdSmrg case " $deplibs " in 294541b2f0bdSmrg *" $path "*) ;; 294641b2f0bdSmrg *) deplibs="$path $deplibs" ;; 294741b2f0bdSmrg esac 294841b2f0bdSmrg case " $deplibs " in 294941b2f0bdSmrg *" $depdepl "*) ;; 295041b2f0bdSmrg *) deplibs="$depdepl $deplibs" ;; 295141b2f0bdSmrg esac 295241b2f0bdSmrg done 295341b2f0bdSmrg fi # link_all_deplibs != no 295441b2f0bdSmrg fi # linkmode = lib 295541b2f0bdSmrg done # for deplib in $libs 295641b2f0bdSmrg dependency_libs="$newdependency_libs" 295741b2f0bdSmrg if test "$pass" = dlpreopen; then 295841b2f0bdSmrg # Link the dlpreopened libraries before other libraries 295941b2f0bdSmrg for deplib in $save_deplibs; do 296041b2f0bdSmrg deplibs="$deplib $deplibs" 296141b2f0bdSmrg done 296241b2f0bdSmrg fi 296341b2f0bdSmrg if test "$pass" != dlopen; then 296441b2f0bdSmrg if test "$pass" != conv; then 296541b2f0bdSmrg # Make sure lib_search_path contains only unique directories. 296641b2f0bdSmrg lib_search_path= 296741b2f0bdSmrg for dir in $newlib_search_path; do 296841b2f0bdSmrg case "$lib_search_path " in 296941b2f0bdSmrg *" $dir "*) ;; 297041b2f0bdSmrg *) lib_search_path="$lib_search_path $dir" ;; 297141b2f0bdSmrg esac 297241b2f0bdSmrg done 297341b2f0bdSmrg newlib_search_path= 297441b2f0bdSmrg fi 297541b2f0bdSmrg 297641b2f0bdSmrg if test "$linkmode,$pass" != "prog,link"; then 297741b2f0bdSmrg vars="deplibs" 297841b2f0bdSmrg else 297941b2f0bdSmrg vars="compile_deplibs finalize_deplibs" 298041b2f0bdSmrg fi 298141b2f0bdSmrg for var in $vars dependency_libs; do 298241b2f0bdSmrg # Add libraries to $var in reverse order 298341b2f0bdSmrg eval tmp_libs=\"\$$var\" 298441b2f0bdSmrg new_libs= 298541b2f0bdSmrg for deplib in $tmp_libs; do 298641b2f0bdSmrg # FIXME: Pedantically, this is the right thing to do, so 298741b2f0bdSmrg # that some nasty dependency loop isn't accidentally 298841b2f0bdSmrg # broken: 298941b2f0bdSmrg #new_libs="$deplib $new_libs" 299041b2f0bdSmrg # Pragmatically, this seems to cause very few problems in 299141b2f0bdSmrg # practice: 299241b2f0bdSmrg case $deplib in 299341b2f0bdSmrg -L*) new_libs="$deplib $new_libs" ;; 299441b2f0bdSmrg -R*) ;; 299541b2f0bdSmrg *) 299641b2f0bdSmrg # And here is the reason: when a library appears more 299741b2f0bdSmrg # than once as an explicit dependence of a library, or 299841b2f0bdSmrg # is implicitly linked in more than once by the 299941b2f0bdSmrg # compiler, it is considered special, and multiple 300041b2f0bdSmrg # occurrences thereof are not removed. Compare this 300141b2f0bdSmrg # with having the same library being listed as a 300241b2f0bdSmrg # dependency of multiple other libraries: in this case, 300341b2f0bdSmrg # we know (pedantically, we assume) the library does not 300441b2f0bdSmrg # need to be listed more than once, so we keep only the 300541b2f0bdSmrg # last copy. This is not always right, but it is rare 300641b2f0bdSmrg # enough that we require users that really mean to play 300741b2f0bdSmrg # such unportable linking tricks to link the library 300841b2f0bdSmrg # using -Wl,-lname, so that libtool does not consider it 300941b2f0bdSmrg # for duplicate removal. 301041b2f0bdSmrg case " $specialdeplibs " in 301141b2f0bdSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 301241b2f0bdSmrg *) 301341b2f0bdSmrg case " $new_libs " in 301441b2f0bdSmrg *" $deplib "*) ;; 301541b2f0bdSmrg *) new_libs="$deplib $new_libs" ;; 301641b2f0bdSmrg esac 301741b2f0bdSmrg ;; 301841b2f0bdSmrg esac 301941b2f0bdSmrg ;; 302041b2f0bdSmrg esac 302141b2f0bdSmrg done 302241b2f0bdSmrg tmp_libs= 302341b2f0bdSmrg for deplib in $new_libs; do 302441b2f0bdSmrg case $deplib in 302541b2f0bdSmrg -L*) 302641b2f0bdSmrg case " $tmp_libs " in 302741b2f0bdSmrg *" $deplib "*) ;; 302841b2f0bdSmrg *) tmp_libs="$tmp_libs $deplib" ;; 302941b2f0bdSmrg esac 303041b2f0bdSmrg ;; 303141b2f0bdSmrg *) tmp_libs="$tmp_libs $deplib" ;; 303241b2f0bdSmrg esac 303341b2f0bdSmrg done 303441b2f0bdSmrg eval $var=\"$tmp_libs\" 303541b2f0bdSmrg done # for var 303641b2f0bdSmrg fi 303741b2f0bdSmrg # Last step: remove runtime libs from dependency_libs 303841b2f0bdSmrg # (they stay in deplibs) 303941b2f0bdSmrg tmp_libs= 304041b2f0bdSmrg for i in $dependency_libs ; do 304141b2f0bdSmrg case " $predeps $postdeps $compiler_lib_search_path " in 304241b2f0bdSmrg *" $i "*) 304341b2f0bdSmrg i="" 304441b2f0bdSmrg ;; 304541b2f0bdSmrg esac 304641b2f0bdSmrg if test -n "$i" ; then 304741b2f0bdSmrg tmp_libs="$tmp_libs $i" 304841b2f0bdSmrg fi 304941b2f0bdSmrg done 305041b2f0bdSmrg dependency_libs=$tmp_libs 305141b2f0bdSmrg done # for pass 305241b2f0bdSmrg if test "$linkmode" = prog; then 305341b2f0bdSmrg dlfiles="$newdlfiles" 305441b2f0bdSmrg dlprefiles="$newdlprefiles" 305541b2f0bdSmrg fi 305641b2f0bdSmrg 305741b2f0bdSmrg case $linkmode in 305841b2f0bdSmrg oldlib) 305941b2f0bdSmrg if test -n "$deplibs"; then 306041b2f0bdSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 306141b2f0bdSmrg fi 306241b2f0bdSmrg 306341b2f0bdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 306441b2f0bdSmrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 306541b2f0bdSmrg fi 306641b2f0bdSmrg 306741b2f0bdSmrg if test -n "$rpath"; then 306841b2f0bdSmrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 306941b2f0bdSmrg fi 307041b2f0bdSmrg 307141b2f0bdSmrg if test -n "$xrpath"; then 307241b2f0bdSmrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 307341b2f0bdSmrg fi 307441b2f0bdSmrg 307541b2f0bdSmrg if test -n "$vinfo"; then 307641b2f0bdSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 307741b2f0bdSmrg fi 307841b2f0bdSmrg 307941b2f0bdSmrg if test -n "$release"; then 308041b2f0bdSmrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 308141b2f0bdSmrg fi 308241b2f0bdSmrg 308341b2f0bdSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 308441b2f0bdSmrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 308541b2f0bdSmrg fi 308641b2f0bdSmrg 308741b2f0bdSmrg # Now set the variables for building old libraries. 308841b2f0bdSmrg build_libtool_libs=no 308941b2f0bdSmrg oldlibs="$output" 309041b2f0bdSmrg objs="$objs$old_deplibs" 309141b2f0bdSmrg ;; 309241b2f0bdSmrg 309341b2f0bdSmrg lib) 309441b2f0bdSmrg # Make sure we only generate libraries of the form `libNAME.la'. 309541b2f0bdSmrg case $outputname in 309641b2f0bdSmrg lib*) 309741b2f0bdSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 309841b2f0bdSmrg eval shared_ext=\"$shrext_cmds\" 309941b2f0bdSmrg eval libname=\"$libname_spec\" 310041b2f0bdSmrg ;; 310141b2f0bdSmrg *) 310241b2f0bdSmrg if test "$module" = no; then 310341b2f0bdSmrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 310441b2f0bdSmrg $echo "$help" 1>&2 310541b2f0bdSmrg exit $EXIT_FAILURE 310641b2f0bdSmrg fi 310741b2f0bdSmrg if test "$need_lib_prefix" != no; then 310841b2f0bdSmrg # Add the "lib" prefix for modules if required 310941b2f0bdSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 311041b2f0bdSmrg eval shared_ext=\"$shrext_cmds\" 311141b2f0bdSmrg eval libname=\"$libname_spec\" 311241b2f0bdSmrg else 311341b2f0bdSmrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 311441b2f0bdSmrg fi 311541b2f0bdSmrg ;; 311641b2f0bdSmrg esac 311741b2f0bdSmrg 311841b2f0bdSmrg if test -n "$objs"; then 311941b2f0bdSmrg if test "$deplibs_check_method" != pass_all; then 312041b2f0bdSmrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 312141b2f0bdSmrg exit $EXIT_FAILURE 312241b2f0bdSmrg else 312341b2f0bdSmrg $echo 312441b2f0bdSmrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 312541b2f0bdSmrg $echo "*** objects $objs is not portable!" 312641b2f0bdSmrg libobjs="$libobjs $objs" 312741b2f0bdSmrg fi 312841b2f0bdSmrg fi 312941b2f0bdSmrg 313041b2f0bdSmrg if test "$dlself" != no; then 313141b2f0bdSmrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 313241b2f0bdSmrg fi 313341b2f0bdSmrg 313441b2f0bdSmrg set dummy $rpath 313541b2f0bdSmrg if test "$#" -gt 2; then 313641b2f0bdSmrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 313741b2f0bdSmrg fi 313841b2f0bdSmrg install_libdir="$2" 313941b2f0bdSmrg 314041b2f0bdSmrg oldlibs= 314141b2f0bdSmrg if test -z "$rpath"; then 314241b2f0bdSmrg if test "$build_libtool_libs" = yes; then 314341b2f0bdSmrg # Building a libtool convenience library. 314441b2f0bdSmrg # Some compilers have problems with a `.al' extension so 314541b2f0bdSmrg # convenience libraries should have the same extension an 314641b2f0bdSmrg # archive normally would. 314741b2f0bdSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 314841b2f0bdSmrg build_libtool_libs=convenience 314941b2f0bdSmrg build_old_libs=yes 315041b2f0bdSmrg fi 315141b2f0bdSmrg 315241b2f0bdSmrg if test -n "$vinfo"; then 315341b2f0bdSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 315441b2f0bdSmrg fi 315541b2f0bdSmrg 315641b2f0bdSmrg if test -n "$release"; then 315741b2f0bdSmrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 315841b2f0bdSmrg fi 315941b2f0bdSmrg else 316041b2f0bdSmrg 316141b2f0bdSmrg # Parse the version information argument. 316241b2f0bdSmrg save_ifs="$IFS"; IFS=':' 316341b2f0bdSmrg set dummy $vinfo 0 0 0 316441b2f0bdSmrg IFS="$save_ifs" 316541b2f0bdSmrg 316641b2f0bdSmrg if test -n "$8"; then 316741b2f0bdSmrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 316841b2f0bdSmrg $echo "$help" 1>&2 316941b2f0bdSmrg exit $EXIT_FAILURE 317041b2f0bdSmrg fi 317141b2f0bdSmrg 317241b2f0bdSmrg # convert absolute version numbers to libtool ages 317341b2f0bdSmrg # this retains compatibility with .la files and attempts 317441b2f0bdSmrg # to make the code below a bit more comprehensible 317541b2f0bdSmrg 317641b2f0bdSmrg case $vinfo_number in 317741b2f0bdSmrg yes) 317841b2f0bdSmrg number_major="$2" 317941b2f0bdSmrg number_minor="$3" 318041b2f0bdSmrg number_revision="$4" 318141b2f0bdSmrg # 318241b2f0bdSmrg # There are really only two kinds -- those that 318341b2f0bdSmrg # use the current revision as the major version 318441b2f0bdSmrg # and those that subtract age and use age as 318541b2f0bdSmrg # a minor version. But, then there is irix 318641b2f0bdSmrg # which has an extra 1 added just for fun 318741b2f0bdSmrg # 318841b2f0bdSmrg case $version_type in 318941b2f0bdSmrg darwin|linux|osf|windows) 319041b2f0bdSmrg current=`expr $number_major + $number_minor` 319141b2f0bdSmrg age="$number_minor" 319241b2f0bdSmrg revision="$number_revision" 319341b2f0bdSmrg ;; 319441b2f0bdSmrg freebsd-aout|freebsd-elf|sunos) 319541b2f0bdSmrg current="$number_major" 319641b2f0bdSmrg revision="$number_minor" 319741b2f0bdSmrg age="0" 319841b2f0bdSmrg ;; 319941b2f0bdSmrg irix|nonstopux) 320041b2f0bdSmrg current=`expr $number_major + $number_minor - 1` 320141b2f0bdSmrg age="$number_minor" 320241b2f0bdSmrg revision="$number_minor" 320341b2f0bdSmrg ;; 320441b2f0bdSmrg esac 320541b2f0bdSmrg ;; 320641b2f0bdSmrg no) 320741b2f0bdSmrg current="$2" 320841b2f0bdSmrg revision="$3" 320941b2f0bdSmrg age="$4" 321041b2f0bdSmrg ;; 321141b2f0bdSmrg esac 321241b2f0bdSmrg 321341b2f0bdSmrg # Check that each of the things are valid numbers. 321441b2f0bdSmrg case $current in 321541b2f0bdSmrg 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]) ;; 321641b2f0bdSmrg *) 321741b2f0bdSmrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 321841b2f0bdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 321941b2f0bdSmrg exit $EXIT_FAILURE 322041b2f0bdSmrg ;; 322141b2f0bdSmrg esac 322241b2f0bdSmrg 322341b2f0bdSmrg case $revision in 322441b2f0bdSmrg 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]) ;; 322541b2f0bdSmrg *) 322641b2f0bdSmrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 322741b2f0bdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 322841b2f0bdSmrg exit $EXIT_FAILURE 322941b2f0bdSmrg ;; 323041b2f0bdSmrg esac 323141b2f0bdSmrg 323241b2f0bdSmrg case $age in 323341b2f0bdSmrg 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]) ;; 323441b2f0bdSmrg *) 323541b2f0bdSmrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 323641b2f0bdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 323741b2f0bdSmrg exit $EXIT_FAILURE 323841b2f0bdSmrg ;; 323941b2f0bdSmrg esac 324041b2f0bdSmrg 324141b2f0bdSmrg if test "$age" -gt "$current"; then 324241b2f0bdSmrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 324341b2f0bdSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 324441b2f0bdSmrg exit $EXIT_FAILURE 324541b2f0bdSmrg fi 324641b2f0bdSmrg 324741b2f0bdSmrg # Calculate the version variables. 324841b2f0bdSmrg major= 324941b2f0bdSmrg versuffix= 325041b2f0bdSmrg verstring= 325141b2f0bdSmrg case $version_type in 325241b2f0bdSmrg none) ;; 325341b2f0bdSmrg 325441b2f0bdSmrg darwin) 325541b2f0bdSmrg # Like Linux, but with the current version available in 325641b2f0bdSmrg # verstring for coding it into the library header 325741b2f0bdSmrg major=.`expr $current - $age` 325841b2f0bdSmrg versuffix="$major.$age.$revision" 325941b2f0bdSmrg # Darwin ld doesn't like 0 for these options... 326041b2f0bdSmrg minor_current=`expr $current + 1` 326141b2f0bdSmrg verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 326241b2f0bdSmrg ;; 326341b2f0bdSmrg 326441b2f0bdSmrg freebsd-aout) 326541b2f0bdSmrg major=".$current" 326641b2f0bdSmrg versuffix=".$current.$revision"; 326741b2f0bdSmrg ;; 326841b2f0bdSmrg 326941b2f0bdSmrg freebsd-elf) 327041b2f0bdSmrg major=".$current" 327141b2f0bdSmrg versuffix=".$current"; 327241b2f0bdSmrg ;; 327341b2f0bdSmrg 327441b2f0bdSmrg irix | nonstopux) 327541b2f0bdSmrg major=`expr $current - $age + 1` 327641b2f0bdSmrg 327741b2f0bdSmrg case $version_type in 327841b2f0bdSmrg nonstopux) verstring_prefix=nonstopux ;; 327941b2f0bdSmrg *) verstring_prefix=sgi ;; 328041b2f0bdSmrg esac 328141b2f0bdSmrg verstring="$verstring_prefix$major.$revision" 328241b2f0bdSmrg 328341b2f0bdSmrg # Add in all the interfaces that we are compatible with. 328441b2f0bdSmrg loop=$revision 328541b2f0bdSmrg while test "$loop" -ne 0; do 328641b2f0bdSmrg iface=`expr $revision - $loop` 328741b2f0bdSmrg loop=`expr $loop - 1` 328841b2f0bdSmrg verstring="$verstring_prefix$major.$iface:$verstring" 328941b2f0bdSmrg done 329041b2f0bdSmrg 329141b2f0bdSmrg # Before this point, $major must not contain `.'. 329241b2f0bdSmrg major=.$major 329341b2f0bdSmrg versuffix="$major.$revision" 329441b2f0bdSmrg ;; 329541b2f0bdSmrg 329641b2f0bdSmrg linux) 329741b2f0bdSmrg major=.`expr $current - $age` 329841b2f0bdSmrg versuffix="$major.$age.$revision" 329941b2f0bdSmrg ;; 330041b2f0bdSmrg 330141b2f0bdSmrg osf) 330241b2f0bdSmrg major=.`expr $current - $age` 330341b2f0bdSmrg versuffix=".$current.$age.$revision" 330441b2f0bdSmrg verstring="$current.$age.$revision" 330541b2f0bdSmrg 330641b2f0bdSmrg # Add in all the interfaces that we are compatible with. 330741b2f0bdSmrg loop=$age 330841b2f0bdSmrg while test "$loop" -ne 0; do 330941b2f0bdSmrg iface=`expr $current - $loop` 331041b2f0bdSmrg loop=`expr $loop - 1` 331141b2f0bdSmrg verstring="$verstring:${iface}.0" 331241b2f0bdSmrg done 331341b2f0bdSmrg 331441b2f0bdSmrg # Make executables depend on our current version. 331541b2f0bdSmrg verstring="$verstring:${current}.0" 331641b2f0bdSmrg ;; 331741b2f0bdSmrg 331841b2f0bdSmrg sunos) 331941b2f0bdSmrg major=".$current" 332041b2f0bdSmrg versuffix=".$current.$revision" 332141b2f0bdSmrg ;; 332241b2f0bdSmrg 332341b2f0bdSmrg windows) 332441b2f0bdSmrg # Use '-' rather than '.', since we only want one 332541b2f0bdSmrg # extension on DOS 8.3 filesystems. 332641b2f0bdSmrg major=`expr $current - $age` 332741b2f0bdSmrg versuffix="-$major" 332841b2f0bdSmrg ;; 332941b2f0bdSmrg 333041b2f0bdSmrg *) 333141b2f0bdSmrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 333241b2f0bdSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 333341b2f0bdSmrg exit $EXIT_FAILURE 333441b2f0bdSmrg ;; 333541b2f0bdSmrg esac 333641b2f0bdSmrg 333741b2f0bdSmrg # Clear the version info if we defaulted, and they specified a release. 333841b2f0bdSmrg if test -z "$vinfo" && test -n "$release"; then 333941b2f0bdSmrg major= 334041b2f0bdSmrg case $version_type in 334141b2f0bdSmrg darwin) 334241b2f0bdSmrg # we can't check for "0.0" in archive_cmds due to quoting 334341b2f0bdSmrg # problems, so we reset it completely 334441b2f0bdSmrg verstring= 334541b2f0bdSmrg ;; 334641b2f0bdSmrg *) 334741b2f0bdSmrg verstring="0.0" 334841b2f0bdSmrg ;; 334941b2f0bdSmrg esac 335041b2f0bdSmrg if test "$need_version" = no; then 335141b2f0bdSmrg versuffix= 335241b2f0bdSmrg else 335341b2f0bdSmrg versuffix=".0.0" 335441b2f0bdSmrg fi 335541b2f0bdSmrg fi 335641b2f0bdSmrg 335741b2f0bdSmrg # Remove version info from name if versioning should be avoided 335841b2f0bdSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 335941b2f0bdSmrg major= 336041b2f0bdSmrg versuffix= 336141b2f0bdSmrg verstring="" 336241b2f0bdSmrg fi 336341b2f0bdSmrg 336441b2f0bdSmrg # Check to see if the archive will have undefined symbols. 336541b2f0bdSmrg if test "$allow_undefined" = yes; then 336641b2f0bdSmrg if test "$allow_undefined_flag" = unsupported; then 336741b2f0bdSmrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 336841b2f0bdSmrg build_libtool_libs=no 336941b2f0bdSmrg build_old_libs=yes 337041b2f0bdSmrg fi 337141b2f0bdSmrg else 337241b2f0bdSmrg # Don't allow undefined symbols. 337341b2f0bdSmrg allow_undefined_flag="$no_undefined_flag" 337441b2f0bdSmrg fi 337541b2f0bdSmrg fi 337641b2f0bdSmrg 337741b2f0bdSmrg if test "$mode" != relink; then 337841b2f0bdSmrg # Remove our outputs, but don't remove object files since they 337941b2f0bdSmrg # may have been created when compiling PIC objects. 338041b2f0bdSmrg removelist= 338141b2f0bdSmrg tempremovelist=`$echo "$output_objdir/*"` 338241b2f0bdSmrg for p in $tempremovelist; do 338341b2f0bdSmrg case $p in 338441b2f0bdSmrg *.$objext) 338541b2f0bdSmrg ;; 338641b2f0bdSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 338741b2f0bdSmrg if test "X$precious_files_regex" != "X"; then 338841b2f0bdSmrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 338941b2f0bdSmrg then 339041b2f0bdSmrg continue 339141b2f0bdSmrg fi 339241b2f0bdSmrg fi 339341b2f0bdSmrg removelist="$removelist $p" 339441b2f0bdSmrg ;; 339541b2f0bdSmrg *) ;; 339641b2f0bdSmrg esac 339741b2f0bdSmrg done 339841b2f0bdSmrg if test -n "$removelist"; then 339941b2f0bdSmrg $show "${rm}r $removelist" 340041b2f0bdSmrg $run ${rm}r $removelist 340141b2f0bdSmrg fi 340241b2f0bdSmrg fi 340341b2f0bdSmrg 340441b2f0bdSmrg # Now set the variables for building old libraries. 340541b2f0bdSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 340641b2f0bdSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 340741b2f0bdSmrg 340841b2f0bdSmrg # Transform .lo files to .o files. 340941b2f0bdSmrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 341041b2f0bdSmrg fi 341141b2f0bdSmrg 341241b2f0bdSmrg # Eliminate all temporary directories. 341341b2f0bdSmrg for path in $notinst_path; do 341441b2f0bdSmrg lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 341541b2f0bdSmrg deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 341641b2f0bdSmrg dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 341741b2f0bdSmrg done 341841b2f0bdSmrg 341941b2f0bdSmrg if test -n "$xrpath"; then 342041b2f0bdSmrg # If the user specified any rpath flags, then add them. 342141b2f0bdSmrg temp_xrpath= 342241b2f0bdSmrg for libdir in $xrpath; do 342341b2f0bdSmrg temp_xrpath="$temp_xrpath -R$libdir" 342441b2f0bdSmrg case "$finalize_rpath " in 342541b2f0bdSmrg *" $libdir "*) ;; 342641b2f0bdSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 342741b2f0bdSmrg esac 342841b2f0bdSmrg done 342941b2f0bdSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 343041b2f0bdSmrg dependency_libs="$temp_xrpath $dependency_libs" 343141b2f0bdSmrg fi 343241b2f0bdSmrg fi 343341b2f0bdSmrg 343441b2f0bdSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 343541b2f0bdSmrg old_dlfiles="$dlfiles" 343641b2f0bdSmrg dlfiles= 343741b2f0bdSmrg for lib in $old_dlfiles; do 343841b2f0bdSmrg case " $dlprefiles $dlfiles " in 343941b2f0bdSmrg *" $lib "*) ;; 344041b2f0bdSmrg *) dlfiles="$dlfiles $lib" ;; 344141b2f0bdSmrg esac 344241b2f0bdSmrg done 344341b2f0bdSmrg 344441b2f0bdSmrg # Make sure dlprefiles contains only unique files 344541b2f0bdSmrg old_dlprefiles="$dlprefiles" 344641b2f0bdSmrg dlprefiles= 344741b2f0bdSmrg for lib in $old_dlprefiles; do 344841b2f0bdSmrg case "$dlprefiles " in 344941b2f0bdSmrg *" $lib "*) ;; 345041b2f0bdSmrg *) dlprefiles="$dlprefiles $lib" ;; 345141b2f0bdSmrg esac 345241b2f0bdSmrg done 345341b2f0bdSmrg 345441b2f0bdSmrg if test "$build_libtool_libs" = yes; then 345541b2f0bdSmrg if test -n "$rpath"; then 345641b2f0bdSmrg case $host in 345741b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 345841b2f0bdSmrg # these systems don't actually have a c library (as such)! 345941b2f0bdSmrg ;; 346041b2f0bdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 346141b2f0bdSmrg # Rhapsody C library is in the System framework 346241b2f0bdSmrg deplibs="$deplibs -framework System" 346341b2f0bdSmrg ;; 346441b2f0bdSmrg *-*-netbsd*) 346541b2f0bdSmrg # Don't link with libc until the a.out ld.so is fixed. 346641b2f0bdSmrg ;; 346741b2f0bdSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 346841b2f0bdSmrg # Do not include libc due to us having libc/libc_r. 346941b2f0bdSmrg ;; 347041b2f0bdSmrg *-*-sco3.2v5* | *-*-sco5v6*) 347141b2f0bdSmrg # Causes problems with __ctype 347241b2f0bdSmrg ;; 347341b2f0bdSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 347441b2f0bdSmrg # Compiler inserts libc in the correct place for threads to work 347541b2f0bdSmrg ;; 347641b2f0bdSmrg *) 347741b2f0bdSmrg # Add libc to deplibs on all other systems if necessary. 347841b2f0bdSmrg if test "$build_libtool_need_lc" = "yes"; then 347941b2f0bdSmrg deplibs="$deplibs -lc" 348041b2f0bdSmrg fi 348141b2f0bdSmrg ;; 348241b2f0bdSmrg esac 348341b2f0bdSmrg fi 348441b2f0bdSmrg 348541b2f0bdSmrg # Transform deplibs into only deplibs that can be linked in shared. 348641b2f0bdSmrg name_save=$name 348741b2f0bdSmrg libname_save=$libname 348841b2f0bdSmrg release_save=$release 348941b2f0bdSmrg versuffix_save=$versuffix 349041b2f0bdSmrg major_save=$major 349141b2f0bdSmrg # I'm not sure if I'm treating the release correctly. I think 349241b2f0bdSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 349341b2f0bdSmrg # add it in twice. Is that correct? 349441b2f0bdSmrg release="" 349541b2f0bdSmrg versuffix="" 349641b2f0bdSmrg major="" 349741b2f0bdSmrg newdeplibs= 349841b2f0bdSmrg droppeddeps=no 349941b2f0bdSmrg case $deplibs_check_method in 350041b2f0bdSmrg pass_all) 350141b2f0bdSmrg # Don't check for shared/static. Everything works. 350241b2f0bdSmrg # This might be a little naive. We might want to check 350341b2f0bdSmrg # whether the library exists or not. But this is on 350441b2f0bdSmrg # osf3 & osf4 and I'm not really sure... Just 350541b2f0bdSmrg # implementing what was already the behavior. 350641b2f0bdSmrg newdeplibs=$deplibs 350741b2f0bdSmrg ;; 350841b2f0bdSmrg test_compile) 350941b2f0bdSmrg # This code stresses the "libraries are programs" paradigm to its 351041b2f0bdSmrg # limits. Maybe even breaks it. We compile a program, linking it 351141b2f0bdSmrg # against the deplibs as a proxy for the library. Then we can check 351241b2f0bdSmrg # whether they linked in statically or dynamically with ldd. 351341b2f0bdSmrg $rm conftest.c 351441b2f0bdSmrg cat > conftest.c <<EOF 351541b2f0bdSmrg int main() { return 0; } 351641b2f0bdSmrgEOF 351741b2f0bdSmrg $rm conftest 351841b2f0bdSmrg $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 351941b2f0bdSmrg if test "$?" -eq 0 ; then 352041b2f0bdSmrg ldd_output=`ldd conftest` 352141b2f0bdSmrg for i in $deplibs; do 352241b2f0bdSmrg name=`expr $i : '-l\(.*\)'` 352341b2f0bdSmrg # If $name is empty we are operating on a -L argument. 352441b2f0bdSmrg if test "$name" != "" && test "$name" -ne "0"; then 352541b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 352641b2f0bdSmrg case " $predeps $postdeps " in 352741b2f0bdSmrg *" $i "*) 352841b2f0bdSmrg newdeplibs="$newdeplibs $i" 352941b2f0bdSmrg i="" 353041b2f0bdSmrg ;; 353141b2f0bdSmrg esac 353241b2f0bdSmrg fi 353341b2f0bdSmrg if test -n "$i" ; then 353441b2f0bdSmrg libname=`eval \\$echo \"$libname_spec\"` 353541b2f0bdSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 353641b2f0bdSmrg set dummy $deplib_matches 353741b2f0bdSmrg deplib_match=$2 353841b2f0bdSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 353941b2f0bdSmrg newdeplibs="$newdeplibs $i" 354041b2f0bdSmrg else 354141b2f0bdSmrg droppeddeps=yes 354241b2f0bdSmrg $echo 354341b2f0bdSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 354441b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 354541b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 354641b2f0bdSmrg $echo "*** shared version of the library, which I believe you do not have" 354741b2f0bdSmrg $echo "*** because a test_compile did reveal that the linker did not use it for" 354841b2f0bdSmrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 354941b2f0bdSmrg fi 355041b2f0bdSmrg fi 355141b2f0bdSmrg else 355241b2f0bdSmrg newdeplibs="$newdeplibs $i" 355341b2f0bdSmrg fi 355441b2f0bdSmrg done 355541b2f0bdSmrg else 355641b2f0bdSmrg # Error occurred in the first compile. Let's try to salvage 355741b2f0bdSmrg # the situation: Compile a separate program for each library. 355841b2f0bdSmrg for i in $deplibs; do 355941b2f0bdSmrg name=`expr $i : '-l\(.*\)'` 356041b2f0bdSmrg # If $name is empty we are operating on a -L argument. 356141b2f0bdSmrg if test "$name" != "" && test "$name" != "0"; then 356241b2f0bdSmrg $rm conftest 356341b2f0bdSmrg $LTCC $LTCFLAGS -o conftest conftest.c $i 356441b2f0bdSmrg # Did it work? 356541b2f0bdSmrg if test "$?" -eq 0 ; then 356641b2f0bdSmrg ldd_output=`ldd conftest` 356741b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 356841b2f0bdSmrg case " $predeps $postdeps " in 356941b2f0bdSmrg *" $i "*) 357041b2f0bdSmrg newdeplibs="$newdeplibs $i" 357141b2f0bdSmrg i="" 357241b2f0bdSmrg ;; 357341b2f0bdSmrg esac 357441b2f0bdSmrg fi 357541b2f0bdSmrg if test -n "$i" ; then 357641b2f0bdSmrg libname=`eval \\$echo \"$libname_spec\"` 357741b2f0bdSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 357841b2f0bdSmrg set dummy $deplib_matches 357941b2f0bdSmrg deplib_match=$2 358041b2f0bdSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 358141b2f0bdSmrg newdeplibs="$newdeplibs $i" 358241b2f0bdSmrg else 358341b2f0bdSmrg droppeddeps=yes 358441b2f0bdSmrg $echo 358541b2f0bdSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 358641b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 358741b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 358841b2f0bdSmrg $echo "*** shared version of the library, which you do not appear to have" 358941b2f0bdSmrg $echo "*** because a test_compile did reveal that the linker did not use this one" 359041b2f0bdSmrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 359141b2f0bdSmrg fi 359241b2f0bdSmrg fi 359341b2f0bdSmrg else 359441b2f0bdSmrg droppeddeps=yes 359541b2f0bdSmrg $echo 359641b2f0bdSmrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 359741b2f0bdSmrg $echo "*** make it link in! You will probably need to install it or some" 359841b2f0bdSmrg $echo "*** library that it depends on before this library will be fully" 359941b2f0bdSmrg $echo "*** functional. Installing it before continuing would be even better." 360041b2f0bdSmrg fi 360141b2f0bdSmrg else 360241b2f0bdSmrg newdeplibs="$newdeplibs $i" 360341b2f0bdSmrg fi 360441b2f0bdSmrg done 360541b2f0bdSmrg fi 360641b2f0bdSmrg ;; 360741b2f0bdSmrg file_magic*) 360841b2f0bdSmrg set dummy $deplibs_check_method 360941b2f0bdSmrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 361041b2f0bdSmrg for a_deplib in $deplibs; do 361141b2f0bdSmrg name=`expr $a_deplib : '-l\(.*\)'` 361241b2f0bdSmrg # If $name is empty we are operating on a -L argument. 361341b2f0bdSmrg if test "$name" != "" && test "$name" != "0"; then 361441b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 361541b2f0bdSmrg case " $predeps $postdeps " in 361641b2f0bdSmrg *" $a_deplib "*) 361741b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 361841b2f0bdSmrg a_deplib="" 361941b2f0bdSmrg ;; 362041b2f0bdSmrg esac 362141b2f0bdSmrg fi 362241b2f0bdSmrg if test -n "$a_deplib" ; then 362341b2f0bdSmrg libname=`eval \\$echo \"$libname_spec\"` 362441b2f0bdSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 362541b2f0bdSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 362641b2f0bdSmrg for potent_lib in $potential_libs; do 362741b2f0bdSmrg # Follow soft links. 362841b2f0bdSmrg if ls -lLd "$potent_lib" 2>/dev/null \ 362941b2f0bdSmrg | grep " -> " >/dev/null; then 363041b2f0bdSmrg continue 363141b2f0bdSmrg fi 363241b2f0bdSmrg # The statement above tries to avoid entering an 363341b2f0bdSmrg # endless loop below, in case of cyclic links. 363441b2f0bdSmrg # We might still enter an endless loop, since a link 363541b2f0bdSmrg # loop can be closed while we follow links, 363641b2f0bdSmrg # but so what? 363741b2f0bdSmrg potlib="$potent_lib" 363841b2f0bdSmrg while test -h "$potlib" 2>/dev/null; do 363941b2f0bdSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 364041b2f0bdSmrg case $potliblink in 364141b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 364241b2f0bdSmrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 364341b2f0bdSmrg esac 364441b2f0bdSmrg done 364541b2f0bdSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 364641b2f0bdSmrg | ${SED} 10q \ 364741b2f0bdSmrg | $EGREP "$file_magic_regex" > /dev/null; then 364841b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 364941b2f0bdSmrg a_deplib="" 365041b2f0bdSmrg break 2 365141b2f0bdSmrg fi 365241b2f0bdSmrg done 365341b2f0bdSmrg done 365441b2f0bdSmrg fi 365541b2f0bdSmrg if test -n "$a_deplib" ; then 365641b2f0bdSmrg droppeddeps=yes 365741b2f0bdSmrg $echo 365841b2f0bdSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 365941b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 366041b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 366141b2f0bdSmrg $echo "*** shared version of the library, which you do not appear to have" 366241b2f0bdSmrg $echo "*** because I did check the linker path looking for a file starting" 366341b2f0bdSmrg if test -z "$potlib" ; then 366441b2f0bdSmrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 366541b2f0bdSmrg else 366641b2f0bdSmrg $echo "*** with $libname and none of the candidates passed a file format test" 366741b2f0bdSmrg $echo "*** using a file magic. Last file checked: $potlib" 366841b2f0bdSmrg fi 366941b2f0bdSmrg fi 367041b2f0bdSmrg else 367141b2f0bdSmrg # Add a -L argument. 367241b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 367341b2f0bdSmrg fi 367441b2f0bdSmrg done # Gone through all deplibs. 367541b2f0bdSmrg ;; 367641b2f0bdSmrg match_pattern*) 367741b2f0bdSmrg set dummy $deplibs_check_method 367841b2f0bdSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 367941b2f0bdSmrg for a_deplib in $deplibs; do 368041b2f0bdSmrg name=`expr $a_deplib : '-l\(.*\)'` 368141b2f0bdSmrg # If $name is empty we are operating on a -L argument. 368241b2f0bdSmrg if test -n "$name" && test "$name" != "0"; then 368341b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 368441b2f0bdSmrg case " $predeps $postdeps " in 368541b2f0bdSmrg *" $a_deplib "*) 368641b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 368741b2f0bdSmrg a_deplib="" 368841b2f0bdSmrg ;; 368941b2f0bdSmrg esac 369041b2f0bdSmrg fi 369141b2f0bdSmrg if test -n "$a_deplib" ; then 369241b2f0bdSmrg libname=`eval \\$echo \"$libname_spec\"` 369341b2f0bdSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 369441b2f0bdSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 369541b2f0bdSmrg for potent_lib in $potential_libs; do 369641b2f0bdSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 369741b2f0bdSmrg if eval $echo \"$potent_lib\" 2>/dev/null \ 369841b2f0bdSmrg | ${SED} 10q \ 369941b2f0bdSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 370041b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 370141b2f0bdSmrg a_deplib="" 370241b2f0bdSmrg break 2 370341b2f0bdSmrg fi 370441b2f0bdSmrg done 370541b2f0bdSmrg done 370641b2f0bdSmrg fi 370741b2f0bdSmrg if test -n "$a_deplib" ; then 370841b2f0bdSmrg droppeddeps=yes 370941b2f0bdSmrg $echo 371041b2f0bdSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 371141b2f0bdSmrg $echo "*** I have the capability to make that library automatically link in when" 371241b2f0bdSmrg $echo "*** you link to this library. But I can only do this if you have a" 371341b2f0bdSmrg $echo "*** shared version of the library, which you do not appear to have" 371441b2f0bdSmrg $echo "*** because I did check the linker path looking for a file starting" 371541b2f0bdSmrg if test -z "$potlib" ; then 371641b2f0bdSmrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 371741b2f0bdSmrg else 371841b2f0bdSmrg $echo "*** with $libname and none of the candidates passed a file format test" 371941b2f0bdSmrg $echo "*** using a regex pattern. Last file checked: $potlib" 372041b2f0bdSmrg fi 372141b2f0bdSmrg fi 372241b2f0bdSmrg else 372341b2f0bdSmrg # Add a -L argument. 372441b2f0bdSmrg newdeplibs="$newdeplibs $a_deplib" 372541b2f0bdSmrg fi 372641b2f0bdSmrg done # Gone through all deplibs. 372741b2f0bdSmrg ;; 372841b2f0bdSmrg none | unknown | *) 372941b2f0bdSmrg newdeplibs="" 373041b2f0bdSmrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 373141b2f0bdSmrg -e 's/ -[LR][^ ]*//g'` 373241b2f0bdSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 373341b2f0bdSmrg for i in $predeps $postdeps ; do 373441b2f0bdSmrg # can't use Xsed below, because $i might contain '/' 373541b2f0bdSmrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 373641b2f0bdSmrg done 373741b2f0bdSmrg fi 373841b2f0bdSmrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 373941b2f0bdSmrg | grep . >/dev/null; then 374041b2f0bdSmrg $echo 374141b2f0bdSmrg if test "X$deplibs_check_method" = "Xnone"; then 374241b2f0bdSmrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 374341b2f0bdSmrg else 374441b2f0bdSmrg $echo "*** Warning: inter-library dependencies are not known to be supported." 374541b2f0bdSmrg fi 374641b2f0bdSmrg $echo "*** All declared inter-library dependencies are being dropped." 374741b2f0bdSmrg droppeddeps=yes 374841b2f0bdSmrg fi 374941b2f0bdSmrg ;; 375041b2f0bdSmrg esac 375141b2f0bdSmrg versuffix=$versuffix_save 375241b2f0bdSmrg major=$major_save 375341b2f0bdSmrg release=$release_save 375441b2f0bdSmrg libname=$libname_save 375541b2f0bdSmrg name=$name_save 375641b2f0bdSmrg 375741b2f0bdSmrg case $host in 375841b2f0bdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 375941b2f0bdSmrg # On Rhapsody replace the C library is the System framework 376041b2f0bdSmrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 376141b2f0bdSmrg ;; 376241b2f0bdSmrg esac 376341b2f0bdSmrg 376441b2f0bdSmrg if test "$droppeddeps" = yes; then 376541b2f0bdSmrg if test "$module" = yes; then 376641b2f0bdSmrg $echo 376741b2f0bdSmrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 376841b2f0bdSmrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 376941b2f0bdSmrg $echo "*** a static module, that should work as long as the dlopening" 377041b2f0bdSmrg $echo "*** application is linked with the -dlopen flag." 377141b2f0bdSmrg if test -z "$global_symbol_pipe"; then 377241b2f0bdSmrg $echo 377341b2f0bdSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 377441b2f0bdSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 377541b2f0bdSmrg $echo "*** not find such a program. So, this module is probably useless." 377641b2f0bdSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 377741b2f0bdSmrg fi 377841b2f0bdSmrg if test "$build_old_libs" = no; then 377941b2f0bdSmrg oldlibs="$output_objdir/$libname.$libext" 378041b2f0bdSmrg build_libtool_libs=module 378141b2f0bdSmrg build_old_libs=yes 378241b2f0bdSmrg else 378341b2f0bdSmrg build_libtool_libs=no 378441b2f0bdSmrg fi 378541b2f0bdSmrg else 378641b2f0bdSmrg $echo "*** The inter-library dependencies that have been dropped here will be" 378741b2f0bdSmrg $echo "*** automatically added whenever a program is linked with this library" 378841b2f0bdSmrg $echo "*** or is declared to -dlopen it." 378941b2f0bdSmrg 379041b2f0bdSmrg if test "$allow_undefined" = no; then 379141b2f0bdSmrg $echo 379241b2f0bdSmrg $echo "*** Since this library must not contain undefined symbols," 379341b2f0bdSmrg $echo "*** because either the platform does not support them or" 379441b2f0bdSmrg $echo "*** it was explicitly requested with -no-undefined," 379541b2f0bdSmrg $echo "*** libtool will only create a static version of it." 379641b2f0bdSmrg if test "$build_old_libs" = no; then 379741b2f0bdSmrg oldlibs="$output_objdir/$libname.$libext" 379841b2f0bdSmrg build_libtool_libs=module 379941b2f0bdSmrg build_old_libs=yes 380041b2f0bdSmrg else 380141b2f0bdSmrg build_libtool_libs=no 380241b2f0bdSmrg fi 380341b2f0bdSmrg fi 380441b2f0bdSmrg fi 380541b2f0bdSmrg fi 380641b2f0bdSmrg # Done checking deplibs! 380741b2f0bdSmrg deplibs=$newdeplibs 380841b2f0bdSmrg fi 380941b2f0bdSmrg 381041b2f0bdSmrg 381141b2f0bdSmrg # move library search paths that coincide with paths to not yet 381241b2f0bdSmrg # installed libraries to the beginning of the library search list 381341b2f0bdSmrg new_libs= 381441b2f0bdSmrg for path in $notinst_path; do 381541b2f0bdSmrg case " $new_libs " in 381641b2f0bdSmrg *" -L$path/$objdir "*) ;; 381741b2f0bdSmrg *) 381841b2f0bdSmrg case " $deplibs " in 381941b2f0bdSmrg *" -L$path/$objdir "*) 382041b2f0bdSmrg new_libs="$new_libs -L$path/$objdir" ;; 382141b2f0bdSmrg esac 382241b2f0bdSmrg ;; 382341b2f0bdSmrg esac 382441b2f0bdSmrg done 382541b2f0bdSmrg for deplib in $deplibs; do 382641b2f0bdSmrg case $deplib in 382741b2f0bdSmrg -L*) 382841b2f0bdSmrg case " $new_libs " in 382941b2f0bdSmrg *" $deplib "*) ;; 383041b2f0bdSmrg *) new_libs="$new_libs $deplib" ;; 383141b2f0bdSmrg esac 383241b2f0bdSmrg ;; 383341b2f0bdSmrg *) new_libs="$new_libs $deplib" ;; 383441b2f0bdSmrg esac 383541b2f0bdSmrg done 383641b2f0bdSmrg deplibs="$new_libs" 383741b2f0bdSmrg 383841b2f0bdSmrg 383941b2f0bdSmrg # All the library-specific variables (install_libdir is set above). 384041b2f0bdSmrg library_names= 384141b2f0bdSmrg old_library= 384241b2f0bdSmrg dlname= 384341b2f0bdSmrg 384441b2f0bdSmrg # Test again, we may have decided not to build it any more 384541b2f0bdSmrg if test "$build_libtool_libs" = yes; then 384641b2f0bdSmrg if test "$hardcode_into_libs" = yes; then 384741b2f0bdSmrg # Hardcode the library paths 384841b2f0bdSmrg hardcode_libdirs= 384941b2f0bdSmrg dep_rpath= 385041b2f0bdSmrg rpath="$finalize_rpath" 385141b2f0bdSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 385241b2f0bdSmrg for libdir in $rpath; do 385341b2f0bdSmrg if test -n "$hardcode_libdir_flag_spec"; then 385441b2f0bdSmrg if test -n "$hardcode_libdir_separator"; then 385541b2f0bdSmrg if test -z "$hardcode_libdirs"; then 385641b2f0bdSmrg hardcode_libdirs="$libdir" 385741b2f0bdSmrg else 385841b2f0bdSmrg # Just accumulate the unique libdirs. 385941b2f0bdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 386041b2f0bdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 386141b2f0bdSmrg ;; 386241b2f0bdSmrg *) 386341b2f0bdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 386441b2f0bdSmrg ;; 386541b2f0bdSmrg esac 386641b2f0bdSmrg fi 386741b2f0bdSmrg else 386841b2f0bdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 386941b2f0bdSmrg dep_rpath="$dep_rpath $flag" 387041b2f0bdSmrg fi 387141b2f0bdSmrg elif test -n "$runpath_var"; then 387241b2f0bdSmrg case "$perm_rpath " in 387341b2f0bdSmrg *" $libdir "*) ;; 387441b2f0bdSmrg *) perm_rpath="$perm_rpath $libdir" ;; 387541b2f0bdSmrg esac 387641b2f0bdSmrg fi 387741b2f0bdSmrg done 387841b2f0bdSmrg # Substitute the hardcoded libdirs into the rpath. 387941b2f0bdSmrg if test -n "$hardcode_libdir_separator" && 388041b2f0bdSmrg test -n "$hardcode_libdirs"; then 388141b2f0bdSmrg libdir="$hardcode_libdirs" 388241b2f0bdSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 388341b2f0bdSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 388441b2f0bdSmrg else 388541b2f0bdSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 388641b2f0bdSmrg fi 388741b2f0bdSmrg fi 388841b2f0bdSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 388941b2f0bdSmrg # We should set the runpath_var. 389041b2f0bdSmrg rpath= 389141b2f0bdSmrg for dir in $perm_rpath; do 389241b2f0bdSmrg rpath="$rpath$dir:" 389341b2f0bdSmrg done 389441b2f0bdSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 389541b2f0bdSmrg fi 389641b2f0bdSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 389741b2f0bdSmrg fi 389841b2f0bdSmrg 389941b2f0bdSmrg shlibpath="$finalize_shlibpath" 390041b2f0bdSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 390141b2f0bdSmrg if test -n "$shlibpath"; then 390241b2f0bdSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 390341b2f0bdSmrg fi 390441b2f0bdSmrg 390541b2f0bdSmrg # Get the real and link names of the library. 390641b2f0bdSmrg eval shared_ext=\"$shrext_cmds\" 390741b2f0bdSmrg eval library_names=\"$library_names_spec\" 390841b2f0bdSmrg set dummy $library_names 390941b2f0bdSmrg realname="$2" 391041b2f0bdSmrg shift; shift 391141b2f0bdSmrg 391241b2f0bdSmrg if test -n "$soname_spec"; then 391341b2f0bdSmrg eval soname=\"$soname_spec\" 391441b2f0bdSmrg else 391541b2f0bdSmrg soname="$realname" 391641b2f0bdSmrg fi 391741b2f0bdSmrg if test -z "$dlname"; then 391841b2f0bdSmrg dlname=$soname 391941b2f0bdSmrg fi 392041b2f0bdSmrg 392141b2f0bdSmrg lib="$output_objdir/$realname" 392241b2f0bdSmrg linknames= 392341b2f0bdSmrg for link 392441b2f0bdSmrg do 392541b2f0bdSmrg linknames="$linknames $link" 392641b2f0bdSmrg done 392741b2f0bdSmrg 392841b2f0bdSmrg # Use standard objects if they are pic 392941b2f0bdSmrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 393041b2f0bdSmrg 393141b2f0bdSmrg # Prepare the list of exported symbols 393241b2f0bdSmrg if test -z "$export_symbols"; then 393341b2f0bdSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 393441b2f0bdSmrg $show "generating symbol list for \`$libname.la'" 393541b2f0bdSmrg export_symbols="$output_objdir/$libname.exp" 393641b2f0bdSmrg $run $rm $export_symbols 393741b2f0bdSmrg cmds=$export_symbols_cmds 393841b2f0bdSmrg save_ifs="$IFS"; IFS='~' 393941b2f0bdSmrg for cmd in $cmds; do 394041b2f0bdSmrg IFS="$save_ifs" 394141b2f0bdSmrg eval cmd=\"$cmd\" 394241b2f0bdSmrg if len=`expr "X$cmd" : ".*"` && 394341b2f0bdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 394441b2f0bdSmrg $show "$cmd" 394541b2f0bdSmrg $run eval "$cmd" || exit $? 394641b2f0bdSmrg skipped_export=false 394741b2f0bdSmrg else 394841b2f0bdSmrg # The command line is too long to execute in one step. 394941b2f0bdSmrg $show "using reloadable object file for export list..." 395041b2f0bdSmrg skipped_export=: 395141b2f0bdSmrg # Break out early, otherwise skipped_export may be 395241b2f0bdSmrg # set to false by a later but shorter cmd. 395341b2f0bdSmrg break 395441b2f0bdSmrg fi 395541b2f0bdSmrg done 395641b2f0bdSmrg IFS="$save_ifs" 395741b2f0bdSmrg if test -n "$export_symbols_regex"; then 395841b2f0bdSmrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 395941b2f0bdSmrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 396041b2f0bdSmrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 396141b2f0bdSmrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 396241b2f0bdSmrg fi 396341b2f0bdSmrg fi 396441b2f0bdSmrg fi 396541b2f0bdSmrg 396641b2f0bdSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 396741b2f0bdSmrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 396841b2f0bdSmrg fi 396941b2f0bdSmrg 397041b2f0bdSmrg tmp_deplibs= 397141b2f0bdSmrg for test_deplib in $deplibs; do 397241b2f0bdSmrg case " $convenience " in 397341b2f0bdSmrg *" $test_deplib "*) ;; 397441b2f0bdSmrg *) 397541b2f0bdSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 397641b2f0bdSmrg ;; 397741b2f0bdSmrg esac 397841b2f0bdSmrg done 397941b2f0bdSmrg deplibs="$tmp_deplibs" 398041b2f0bdSmrg 398141b2f0bdSmrg if test -n "$convenience"; then 398241b2f0bdSmrg if test -n "$whole_archive_flag_spec"; then 398341b2f0bdSmrg save_libobjs=$libobjs 398441b2f0bdSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 398541b2f0bdSmrg else 398641b2f0bdSmrg gentop="$output_objdir/${outputname}x" 398741b2f0bdSmrg generated="$generated $gentop" 398841b2f0bdSmrg 398941b2f0bdSmrg func_extract_archives $gentop $convenience 399041b2f0bdSmrg libobjs="$libobjs $func_extract_archives_result" 399141b2f0bdSmrg fi 399241b2f0bdSmrg fi 399341b2f0bdSmrg 399441b2f0bdSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 399541b2f0bdSmrg eval flag=\"$thread_safe_flag_spec\" 399641b2f0bdSmrg linker_flags="$linker_flags $flag" 399741b2f0bdSmrg fi 399841b2f0bdSmrg 399941b2f0bdSmrg # Make a backup of the uninstalled library when relinking 400041b2f0bdSmrg if test "$mode" = relink; then 400141b2f0bdSmrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 400241b2f0bdSmrg fi 400341b2f0bdSmrg 400441b2f0bdSmrg # Do each of the archive commands. 400541b2f0bdSmrg if test "$module" = yes && test -n "$module_cmds" ; then 400641b2f0bdSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 400741b2f0bdSmrg eval test_cmds=\"$module_expsym_cmds\" 400841b2f0bdSmrg cmds=$module_expsym_cmds 400941b2f0bdSmrg else 401041b2f0bdSmrg eval test_cmds=\"$module_cmds\" 401141b2f0bdSmrg cmds=$module_cmds 401241b2f0bdSmrg fi 401341b2f0bdSmrg else 401441b2f0bdSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 401541b2f0bdSmrg eval test_cmds=\"$archive_expsym_cmds\" 401641b2f0bdSmrg cmds=$archive_expsym_cmds 401741b2f0bdSmrg else 401841b2f0bdSmrg eval test_cmds=\"$archive_cmds\" 401941b2f0bdSmrg cmds=$archive_cmds 402041b2f0bdSmrg fi 402141b2f0bdSmrg fi 402241b2f0bdSmrg 402341b2f0bdSmrg if test "X$skipped_export" != "X:" && 402441b2f0bdSmrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 402541b2f0bdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 402641b2f0bdSmrg : 402741b2f0bdSmrg else 402841b2f0bdSmrg # The command line is too long to link in one step, link piecewise. 402941b2f0bdSmrg $echo "creating reloadable object files..." 403041b2f0bdSmrg 403141b2f0bdSmrg # Save the value of $output and $libobjs because we want to 403241b2f0bdSmrg # use them later. If we have whole_archive_flag_spec, we 403341b2f0bdSmrg # want to use save_libobjs as it was before 403441b2f0bdSmrg # whole_archive_flag_spec was expanded, because we can't 403541b2f0bdSmrg # assume the linker understands whole_archive_flag_spec. 403641b2f0bdSmrg # This may have to be revisited, in case too many 403741b2f0bdSmrg # convenience libraries get linked in and end up exceeding 403841b2f0bdSmrg # the spec. 403941b2f0bdSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 404041b2f0bdSmrg save_libobjs=$libobjs 404141b2f0bdSmrg fi 404241b2f0bdSmrg save_output=$output 404341b2f0bdSmrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 404441b2f0bdSmrg 404541b2f0bdSmrg # Clear the reloadable object creation command queue and 404641b2f0bdSmrg # initialize k to one. 404741b2f0bdSmrg test_cmds= 404841b2f0bdSmrg concat_cmds= 404941b2f0bdSmrg objlist= 405041b2f0bdSmrg delfiles= 405141b2f0bdSmrg last_robj= 405241b2f0bdSmrg k=1 405341b2f0bdSmrg output=$output_objdir/$output_la-${k}.$objext 405441b2f0bdSmrg # Loop over the list of objects to be linked. 405541b2f0bdSmrg for obj in $save_libobjs 405641b2f0bdSmrg do 405741b2f0bdSmrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 405841b2f0bdSmrg if test "X$objlist" = X || 405941b2f0bdSmrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 406041b2f0bdSmrg test "$len" -le "$max_cmd_len"; }; then 406141b2f0bdSmrg objlist="$objlist $obj" 406241b2f0bdSmrg else 406341b2f0bdSmrg # The command $test_cmds is almost too long, add a 406441b2f0bdSmrg # command to the queue. 406541b2f0bdSmrg if test "$k" -eq 1 ; then 406641b2f0bdSmrg # The first file doesn't have a previous command to add. 406741b2f0bdSmrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 406841b2f0bdSmrg else 406941b2f0bdSmrg # All subsequent reloadable object files will link in 407041b2f0bdSmrg # the last one created. 407141b2f0bdSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 407241b2f0bdSmrg fi 407341b2f0bdSmrg last_robj=$output_objdir/$output_la-${k}.$objext 407441b2f0bdSmrg k=`expr $k + 1` 407541b2f0bdSmrg output=$output_objdir/$output_la-${k}.$objext 407641b2f0bdSmrg objlist=$obj 407741b2f0bdSmrg len=1 407841b2f0bdSmrg fi 407941b2f0bdSmrg done 408041b2f0bdSmrg # Handle the remaining objects by creating one last 408141b2f0bdSmrg # reloadable object file. All subsequent reloadable object 408241b2f0bdSmrg # files will link in the last one created. 408341b2f0bdSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 408441b2f0bdSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 408541b2f0bdSmrg 408641b2f0bdSmrg if ${skipped_export-false}; then 408741b2f0bdSmrg $show "generating symbol list for \`$libname.la'" 408841b2f0bdSmrg export_symbols="$output_objdir/$libname.exp" 408941b2f0bdSmrg $run $rm $export_symbols 409041b2f0bdSmrg libobjs=$output 409141b2f0bdSmrg # Append the command to create the export file. 409241b2f0bdSmrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 409341b2f0bdSmrg fi 409441b2f0bdSmrg 409541b2f0bdSmrg # Set up a command to remove the reloadable object files 409641b2f0bdSmrg # after they are used. 409741b2f0bdSmrg i=0 409841b2f0bdSmrg while test "$i" -lt "$k" 409941b2f0bdSmrg do 410041b2f0bdSmrg i=`expr $i + 1` 410141b2f0bdSmrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 410241b2f0bdSmrg done 410341b2f0bdSmrg 410441b2f0bdSmrg $echo "creating a temporary reloadable object file: $output" 410541b2f0bdSmrg 410641b2f0bdSmrg # Loop through the commands generated above and execute them. 410741b2f0bdSmrg save_ifs="$IFS"; IFS='~' 410841b2f0bdSmrg for cmd in $concat_cmds; do 410941b2f0bdSmrg IFS="$save_ifs" 411041b2f0bdSmrg $show "$cmd" 411141b2f0bdSmrg $run eval "$cmd" || exit $? 411241b2f0bdSmrg done 411341b2f0bdSmrg IFS="$save_ifs" 411441b2f0bdSmrg 411541b2f0bdSmrg libobjs=$output 411641b2f0bdSmrg # Restore the value of output. 411741b2f0bdSmrg output=$save_output 411841b2f0bdSmrg 411941b2f0bdSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 412041b2f0bdSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 412141b2f0bdSmrg fi 412241b2f0bdSmrg # Expand the library linking commands again to reset the 412341b2f0bdSmrg # value of $libobjs for piecewise linking. 412441b2f0bdSmrg 412541b2f0bdSmrg # Do each of the archive commands. 412641b2f0bdSmrg if test "$module" = yes && test -n "$module_cmds" ; then 412741b2f0bdSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 412841b2f0bdSmrg cmds=$module_expsym_cmds 412941b2f0bdSmrg else 413041b2f0bdSmrg cmds=$module_cmds 413141b2f0bdSmrg fi 413241b2f0bdSmrg else 413341b2f0bdSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 413441b2f0bdSmrg cmds=$archive_expsym_cmds 413541b2f0bdSmrg else 413641b2f0bdSmrg cmds=$archive_cmds 413741b2f0bdSmrg fi 413841b2f0bdSmrg fi 413941b2f0bdSmrg 414041b2f0bdSmrg # Append the command to remove the reloadable object files 414141b2f0bdSmrg # to the just-reset $cmds. 414241b2f0bdSmrg eval cmds=\"\$cmds~\$rm $delfiles\" 414341b2f0bdSmrg fi 414441b2f0bdSmrg save_ifs="$IFS"; IFS='~' 414541b2f0bdSmrg for cmd in $cmds; do 414641b2f0bdSmrg IFS="$save_ifs" 414741b2f0bdSmrg eval cmd=\"$cmd\" 414841b2f0bdSmrg $show "$cmd" 414941b2f0bdSmrg $run eval "$cmd" || { 415041b2f0bdSmrg lt_exit=$? 415141b2f0bdSmrg 415241b2f0bdSmrg # Restore the uninstalled library and exit 415341b2f0bdSmrg if test "$mode" = relink; then 415441b2f0bdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 415541b2f0bdSmrg fi 415641b2f0bdSmrg 415741b2f0bdSmrg exit $lt_exit 415841b2f0bdSmrg } 415941b2f0bdSmrg done 416041b2f0bdSmrg IFS="$save_ifs" 416141b2f0bdSmrg 416241b2f0bdSmrg # Restore the uninstalled library and exit 416341b2f0bdSmrg if test "$mode" = relink; then 416441b2f0bdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 416541b2f0bdSmrg 416641b2f0bdSmrg if test -n "$convenience"; then 416741b2f0bdSmrg if test -z "$whole_archive_flag_spec"; then 416841b2f0bdSmrg $show "${rm}r $gentop" 416941b2f0bdSmrg $run ${rm}r "$gentop" 417041b2f0bdSmrg fi 417141b2f0bdSmrg fi 417241b2f0bdSmrg 417341b2f0bdSmrg exit $EXIT_SUCCESS 417441b2f0bdSmrg fi 417541b2f0bdSmrg 417641b2f0bdSmrg # Create links to the real library. 417741b2f0bdSmrg for linkname in $linknames; do 417841b2f0bdSmrg if test "$realname" != "$linkname"; then 417941b2f0bdSmrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 418041b2f0bdSmrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 418141b2f0bdSmrg fi 418241b2f0bdSmrg done 418341b2f0bdSmrg 418441b2f0bdSmrg # If -module or -export-dynamic was specified, set the dlname. 418541b2f0bdSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 418641b2f0bdSmrg # On all known operating systems, these are identical. 418741b2f0bdSmrg dlname="$soname" 418841b2f0bdSmrg fi 418941b2f0bdSmrg fi 419041b2f0bdSmrg ;; 419141b2f0bdSmrg 419241b2f0bdSmrg obj) 419341b2f0bdSmrg if test -n "$deplibs"; then 419441b2f0bdSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 419541b2f0bdSmrg fi 419641b2f0bdSmrg 419741b2f0bdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 419841b2f0bdSmrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 419941b2f0bdSmrg fi 420041b2f0bdSmrg 420141b2f0bdSmrg if test -n "$rpath"; then 420241b2f0bdSmrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 420341b2f0bdSmrg fi 420441b2f0bdSmrg 420541b2f0bdSmrg if test -n "$xrpath"; then 420641b2f0bdSmrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 420741b2f0bdSmrg fi 420841b2f0bdSmrg 420941b2f0bdSmrg if test -n "$vinfo"; then 421041b2f0bdSmrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 421141b2f0bdSmrg fi 421241b2f0bdSmrg 421341b2f0bdSmrg if test -n "$release"; then 421441b2f0bdSmrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 421541b2f0bdSmrg fi 421641b2f0bdSmrg 421741b2f0bdSmrg case $output in 421841b2f0bdSmrg *.lo) 421941b2f0bdSmrg if test -n "$objs$old_deplibs"; then 422041b2f0bdSmrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 422141b2f0bdSmrg exit $EXIT_FAILURE 422241b2f0bdSmrg fi 422341b2f0bdSmrg libobj="$output" 422441b2f0bdSmrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 422541b2f0bdSmrg ;; 422641b2f0bdSmrg *) 422741b2f0bdSmrg libobj= 422841b2f0bdSmrg obj="$output" 422941b2f0bdSmrg ;; 423041b2f0bdSmrg esac 423141b2f0bdSmrg 423241b2f0bdSmrg # Delete the old objects. 423341b2f0bdSmrg $run $rm $obj $libobj 423441b2f0bdSmrg 423541b2f0bdSmrg # Objects from convenience libraries. This assumes 423641b2f0bdSmrg # single-version convenience libraries. Whenever we create 423741b2f0bdSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 423841b2f0bdSmrg # the extraction. 423941b2f0bdSmrg reload_conv_objs= 424041b2f0bdSmrg gentop= 424141b2f0bdSmrg # reload_cmds runs $LD directly, so let us get rid of 424241b2f0bdSmrg # -Wl from whole_archive_flag_spec 424341b2f0bdSmrg wl= 424441b2f0bdSmrg 424541b2f0bdSmrg if test -n "$convenience"; then 424641b2f0bdSmrg if test -n "$whole_archive_flag_spec"; then 424741b2f0bdSmrg eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 424841b2f0bdSmrg else 424941b2f0bdSmrg gentop="$output_objdir/${obj}x" 425041b2f0bdSmrg generated="$generated $gentop" 425141b2f0bdSmrg 425241b2f0bdSmrg func_extract_archives $gentop $convenience 425341b2f0bdSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 425441b2f0bdSmrg fi 425541b2f0bdSmrg fi 425641b2f0bdSmrg 425741b2f0bdSmrg # Create the old-style object. 425841b2f0bdSmrg 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 425941b2f0bdSmrg 426041b2f0bdSmrg output="$obj" 426141b2f0bdSmrg cmds=$reload_cmds 426241b2f0bdSmrg save_ifs="$IFS"; IFS='~' 426341b2f0bdSmrg for cmd in $cmds; do 426441b2f0bdSmrg IFS="$save_ifs" 426541b2f0bdSmrg eval cmd=\"$cmd\" 426641b2f0bdSmrg $show "$cmd" 426741b2f0bdSmrg $run eval "$cmd" || exit $? 426841b2f0bdSmrg done 426941b2f0bdSmrg IFS="$save_ifs" 427041b2f0bdSmrg 427141b2f0bdSmrg # Exit if we aren't doing a library object file. 427241b2f0bdSmrg if test -z "$libobj"; then 427341b2f0bdSmrg if test -n "$gentop"; then 427441b2f0bdSmrg $show "${rm}r $gentop" 427541b2f0bdSmrg $run ${rm}r $gentop 427641b2f0bdSmrg fi 427741b2f0bdSmrg 427841b2f0bdSmrg exit $EXIT_SUCCESS 427941b2f0bdSmrg fi 428041b2f0bdSmrg 428141b2f0bdSmrg if test "$build_libtool_libs" != yes; then 428241b2f0bdSmrg if test -n "$gentop"; then 428341b2f0bdSmrg $show "${rm}r $gentop" 428441b2f0bdSmrg $run ${rm}r $gentop 428541b2f0bdSmrg fi 428641b2f0bdSmrg 428741b2f0bdSmrg # Create an invalid libtool object if no PIC, so that we don't 428841b2f0bdSmrg # accidentally link it into a program. 428941b2f0bdSmrg # $show "echo timestamp > $libobj" 429041b2f0bdSmrg # $run eval "echo timestamp > $libobj" || exit $? 429141b2f0bdSmrg exit $EXIT_SUCCESS 429241b2f0bdSmrg fi 429341b2f0bdSmrg 429441b2f0bdSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 429541b2f0bdSmrg # Only do commands if we really have different PIC objects. 429641b2f0bdSmrg reload_objs="$libobjs $reload_conv_objs" 429741b2f0bdSmrg output="$libobj" 429841b2f0bdSmrg cmds=$reload_cmds 429941b2f0bdSmrg save_ifs="$IFS"; IFS='~' 430041b2f0bdSmrg for cmd in $cmds; do 430141b2f0bdSmrg IFS="$save_ifs" 430241b2f0bdSmrg eval cmd=\"$cmd\" 430341b2f0bdSmrg $show "$cmd" 430441b2f0bdSmrg $run eval "$cmd" || exit $? 430541b2f0bdSmrg done 430641b2f0bdSmrg IFS="$save_ifs" 430741b2f0bdSmrg fi 430841b2f0bdSmrg 430941b2f0bdSmrg if test -n "$gentop"; then 431041b2f0bdSmrg $show "${rm}r $gentop" 431141b2f0bdSmrg $run ${rm}r $gentop 431241b2f0bdSmrg fi 431341b2f0bdSmrg 431441b2f0bdSmrg exit $EXIT_SUCCESS 431541b2f0bdSmrg ;; 431641b2f0bdSmrg 431741b2f0bdSmrg prog) 431841b2f0bdSmrg case $host in 431941b2f0bdSmrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 432041b2f0bdSmrg esac 432141b2f0bdSmrg if test -n "$vinfo"; then 432241b2f0bdSmrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 432341b2f0bdSmrg fi 432441b2f0bdSmrg 432541b2f0bdSmrg if test -n "$release"; then 432641b2f0bdSmrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 432741b2f0bdSmrg fi 432841b2f0bdSmrg 432941b2f0bdSmrg if test "$preload" = yes; then 433041b2f0bdSmrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 433141b2f0bdSmrg test "$dlopen_self_static" = unknown; then 433241b2f0bdSmrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 433341b2f0bdSmrg fi 433441b2f0bdSmrg fi 433541b2f0bdSmrg 433641b2f0bdSmrg case $host in 433741b2f0bdSmrg *-*-rhapsody* | *-*-darwin1.[012]) 433841b2f0bdSmrg # On Rhapsody replace the C library is the System framework 433941b2f0bdSmrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 434041b2f0bdSmrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 434141b2f0bdSmrg ;; 434241b2f0bdSmrg esac 434341b2f0bdSmrg 434441b2f0bdSmrg case $host in 434541b2f0bdSmrg *darwin*) 434641b2f0bdSmrg # Don't allow lazy linking, it breaks C++ global constructors 434741b2f0bdSmrg if test "$tagname" = CXX ; then 434841b2f0bdSmrg compile_command="$compile_command ${wl}-bind_at_load" 434941b2f0bdSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 435041b2f0bdSmrg fi 435141b2f0bdSmrg ;; 435241b2f0bdSmrg esac 435341b2f0bdSmrg 435441b2f0bdSmrg 435541b2f0bdSmrg # move library search paths that coincide with paths to not yet 435641b2f0bdSmrg # installed libraries to the beginning of the library search list 435741b2f0bdSmrg new_libs= 435841b2f0bdSmrg for path in $notinst_path; do 435941b2f0bdSmrg case " $new_libs " in 436041b2f0bdSmrg *" -L$path/$objdir "*) ;; 436141b2f0bdSmrg *) 436241b2f0bdSmrg case " $compile_deplibs " in 436341b2f0bdSmrg *" -L$path/$objdir "*) 436441b2f0bdSmrg new_libs="$new_libs -L$path/$objdir" ;; 436541b2f0bdSmrg esac 436641b2f0bdSmrg ;; 436741b2f0bdSmrg esac 436841b2f0bdSmrg done 436941b2f0bdSmrg for deplib in $compile_deplibs; do 437041b2f0bdSmrg case $deplib in 437141b2f0bdSmrg -L*) 437241b2f0bdSmrg case " $new_libs " in 437341b2f0bdSmrg *" $deplib "*) ;; 437441b2f0bdSmrg *) new_libs="$new_libs $deplib" ;; 437541b2f0bdSmrg esac 437641b2f0bdSmrg ;; 437741b2f0bdSmrg *) new_libs="$new_libs $deplib" ;; 437841b2f0bdSmrg esac 437941b2f0bdSmrg done 438041b2f0bdSmrg compile_deplibs="$new_libs" 438141b2f0bdSmrg 438241b2f0bdSmrg 438341b2f0bdSmrg compile_command="$compile_command $compile_deplibs" 438441b2f0bdSmrg finalize_command="$finalize_command $finalize_deplibs" 438541b2f0bdSmrg 438641b2f0bdSmrg if test -n "$rpath$xrpath"; then 438741b2f0bdSmrg # If the user specified any rpath flags, then add them. 438841b2f0bdSmrg for libdir in $rpath $xrpath; do 438941b2f0bdSmrg # This is the magic to use -rpath. 439041b2f0bdSmrg case "$finalize_rpath " in 439141b2f0bdSmrg *" $libdir "*) ;; 439241b2f0bdSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 439341b2f0bdSmrg esac 439441b2f0bdSmrg done 439541b2f0bdSmrg fi 439641b2f0bdSmrg 439741b2f0bdSmrg # Now hardcode the library paths 439841b2f0bdSmrg rpath= 439941b2f0bdSmrg hardcode_libdirs= 440041b2f0bdSmrg for libdir in $compile_rpath $finalize_rpath; do 440141b2f0bdSmrg if test -n "$hardcode_libdir_flag_spec"; then 440241b2f0bdSmrg if test -n "$hardcode_libdir_separator"; then 440341b2f0bdSmrg if test -z "$hardcode_libdirs"; then 440441b2f0bdSmrg hardcode_libdirs="$libdir" 440541b2f0bdSmrg else 440641b2f0bdSmrg # Just accumulate the unique libdirs. 440741b2f0bdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 440841b2f0bdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 440941b2f0bdSmrg ;; 441041b2f0bdSmrg *) 441141b2f0bdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 441241b2f0bdSmrg ;; 441341b2f0bdSmrg esac 441441b2f0bdSmrg fi 441541b2f0bdSmrg else 441641b2f0bdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 441741b2f0bdSmrg rpath="$rpath $flag" 441841b2f0bdSmrg fi 441941b2f0bdSmrg elif test -n "$runpath_var"; then 442041b2f0bdSmrg case "$perm_rpath " in 442141b2f0bdSmrg *" $libdir "*) ;; 442241b2f0bdSmrg *) perm_rpath="$perm_rpath $libdir" ;; 442341b2f0bdSmrg esac 442441b2f0bdSmrg fi 442541b2f0bdSmrg case $host in 442641b2f0bdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 442741b2f0bdSmrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 442841b2f0bdSmrg case :$dllsearchpath: in 442941b2f0bdSmrg *":$libdir:"*) ;; 443041b2f0bdSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 443141b2f0bdSmrg esac 443241b2f0bdSmrg case :$dllsearchpath: in 443341b2f0bdSmrg *":$testbindir:"*) ;; 443441b2f0bdSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 443541b2f0bdSmrg esac 443641b2f0bdSmrg ;; 443741b2f0bdSmrg esac 443841b2f0bdSmrg done 443941b2f0bdSmrg # Substitute the hardcoded libdirs into the rpath. 444041b2f0bdSmrg if test -n "$hardcode_libdir_separator" && 444141b2f0bdSmrg test -n "$hardcode_libdirs"; then 444241b2f0bdSmrg libdir="$hardcode_libdirs" 444341b2f0bdSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 444441b2f0bdSmrg fi 444541b2f0bdSmrg compile_rpath="$rpath" 444641b2f0bdSmrg 444741b2f0bdSmrg rpath= 444841b2f0bdSmrg hardcode_libdirs= 444941b2f0bdSmrg for libdir in $finalize_rpath; do 445041b2f0bdSmrg if test -n "$hardcode_libdir_flag_spec"; then 445141b2f0bdSmrg if test -n "$hardcode_libdir_separator"; then 445241b2f0bdSmrg if test -z "$hardcode_libdirs"; then 445341b2f0bdSmrg hardcode_libdirs="$libdir" 445441b2f0bdSmrg else 445541b2f0bdSmrg # Just accumulate the unique libdirs. 445641b2f0bdSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 445741b2f0bdSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 445841b2f0bdSmrg ;; 445941b2f0bdSmrg *) 446041b2f0bdSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 446141b2f0bdSmrg ;; 446241b2f0bdSmrg esac 446341b2f0bdSmrg fi 446441b2f0bdSmrg else 446541b2f0bdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 446641b2f0bdSmrg rpath="$rpath $flag" 446741b2f0bdSmrg fi 446841b2f0bdSmrg elif test -n "$runpath_var"; then 446941b2f0bdSmrg case "$finalize_perm_rpath " in 447041b2f0bdSmrg *" $libdir "*) ;; 447141b2f0bdSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 447241b2f0bdSmrg esac 447341b2f0bdSmrg fi 447441b2f0bdSmrg done 447541b2f0bdSmrg # Substitute the hardcoded libdirs into the rpath. 447641b2f0bdSmrg if test -n "$hardcode_libdir_separator" && 447741b2f0bdSmrg test -n "$hardcode_libdirs"; then 447841b2f0bdSmrg libdir="$hardcode_libdirs" 447941b2f0bdSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 448041b2f0bdSmrg fi 448141b2f0bdSmrg finalize_rpath="$rpath" 448241b2f0bdSmrg 448341b2f0bdSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 448441b2f0bdSmrg # Transform all the library objects into standard objects. 448541b2f0bdSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 448641b2f0bdSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 448741b2f0bdSmrg fi 448841b2f0bdSmrg 448941b2f0bdSmrg dlsyms= 449041b2f0bdSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 449141b2f0bdSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 449241b2f0bdSmrg dlsyms="${outputname}S.c" 449341b2f0bdSmrg else 449441b2f0bdSmrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 449541b2f0bdSmrg fi 449641b2f0bdSmrg fi 449741b2f0bdSmrg 449841b2f0bdSmrg if test -n "$dlsyms"; then 449941b2f0bdSmrg case $dlsyms in 450041b2f0bdSmrg "") ;; 450141b2f0bdSmrg *.c) 450241b2f0bdSmrg # Discover the nlist of each of the dlfiles. 450341b2f0bdSmrg nlist="$output_objdir/${outputname}.nm" 450441b2f0bdSmrg 450541b2f0bdSmrg $show "$rm $nlist ${nlist}S ${nlist}T" 450641b2f0bdSmrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 450741b2f0bdSmrg 450841b2f0bdSmrg # Parse the name list into a source file. 450941b2f0bdSmrg $show "creating $output_objdir/$dlsyms" 451041b2f0bdSmrg 451141b2f0bdSmrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 451241b2f0bdSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 451341b2f0bdSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 451441b2f0bdSmrg 451541b2f0bdSmrg#ifdef __cplusplus 451641b2f0bdSmrgextern \"C\" { 451741b2f0bdSmrg#endif 451841b2f0bdSmrg 451941b2f0bdSmrg/* Prevent the only kind of declaration conflicts we can make. */ 452041b2f0bdSmrg#define lt_preloaded_symbols some_other_symbol 452141b2f0bdSmrg 452241b2f0bdSmrg/* External symbol declarations for the compiler. */\ 452341b2f0bdSmrg" 452441b2f0bdSmrg 452541b2f0bdSmrg if test "$dlself" = yes; then 452641b2f0bdSmrg $show "generating symbol list for \`$output'" 452741b2f0bdSmrg 452841b2f0bdSmrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 452941b2f0bdSmrg 453041b2f0bdSmrg # Add our own program objects to the symbol list. 453141b2f0bdSmrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 453241b2f0bdSmrg for arg in $progfiles; do 453341b2f0bdSmrg $show "extracting global C symbols from \`$arg'" 453441b2f0bdSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 453541b2f0bdSmrg done 453641b2f0bdSmrg 453741b2f0bdSmrg if test -n "$exclude_expsyms"; then 453841b2f0bdSmrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 453941b2f0bdSmrg $run eval '$mv "$nlist"T "$nlist"' 454041b2f0bdSmrg fi 454141b2f0bdSmrg 454241b2f0bdSmrg if test -n "$export_symbols_regex"; then 454341b2f0bdSmrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 454441b2f0bdSmrg $run eval '$mv "$nlist"T "$nlist"' 454541b2f0bdSmrg fi 454641b2f0bdSmrg 454741b2f0bdSmrg # Prepare the list of exported symbols 454841b2f0bdSmrg if test -z "$export_symbols"; then 454941b2f0bdSmrg export_symbols="$output_objdir/$outputname.exp" 455041b2f0bdSmrg $run $rm $export_symbols 455141b2f0bdSmrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 455241b2f0bdSmrg case $host in 455341b2f0bdSmrg *cygwin* | *mingw* ) 455441b2f0bdSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 455541b2f0bdSmrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 455641b2f0bdSmrg ;; 455741b2f0bdSmrg esac 455841b2f0bdSmrg else 455941b2f0bdSmrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 456041b2f0bdSmrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 456141b2f0bdSmrg $run eval 'mv "$nlist"T "$nlist"' 456241b2f0bdSmrg case $host in 456341b2f0bdSmrg *cygwin* | *mingw* ) 456441b2f0bdSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 456541b2f0bdSmrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 456641b2f0bdSmrg ;; 456741b2f0bdSmrg esac 456841b2f0bdSmrg fi 456941b2f0bdSmrg fi 457041b2f0bdSmrg 457141b2f0bdSmrg for arg in $dlprefiles; do 457241b2f0bdSmrg $show "extracting global C symbols from \`$arg'" 457341b2f0bdSmrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 457441b2f0bdSmrg $run eval '$echo ": $name " >> "$nlist"' 457541b2f0bdSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 457641b2f0bdSmrg done 457741b2f0bdSmrg 457841b2f0bdSmrg if test -z "$run"; then 457941b2f0bdSmrg # Make sure we have at least an empty file. 458041b2f0bdSmrg test -f "$nlist" || : > "$nlist" 458141b2f0bdSmrg 458241b2f0bdSmrg if test -n "$exclude_expsyms"; then 458341b2f0bdSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 458441b2f0bdSmrg $mv "$nlist"T "$nlist" 458541b2f0bdSmrg fi 458641b2f0bdSmrg 458741b2f0bdSmrg # Try sorting and uniquifying the output. 458841b2f0bdSmrg if grep -v "^: " < "$nlist" | 458941b2f0bdSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 459041b2f0bdSmrg sort -k 3 459141b2f0bdSmrg else 459241b2f0bdSmrg sort +2 459341b2f0bdSmrg fi | 459441b2f0bdSmrg uniq > "$nlist"S; then 459541b2f0bdSmrg : 459641b2f0bdSmrg else 459741b2f0bdSmrg grep -v "^: " < "$nlist" > "$nlist"S 459841b2f0bdSmrg fi 459941b2f0bdSmrg 460041b2f0bdSmrg if test -f "$nlist"S; then 460141b2f0bdSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 460241b2f0bdSmrg else 460341b2f0bdSmrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 460441b2f0bdSmrg fi 460541b2f0bdSmrg 460641b2f0bdSmrg $echo >> "$output_objdir/$dlsyms" "\ 460741b2f0bdSmrg 460841b2f0bdSmrg#undef lt_preloaded_symbols 460941b2f0bdSmrg 461041b2f0bdSmrg#if defined (__STDC__) && __STDC__ 461141b2f0bdSmrg# define lt_ptr void * 461241b2f0bdSmrg#else 461341b2f0bdSmrg# define lt_ptr char * 461441b2f0bdSmrg# define const 461541b2f0bdSmrg#endif 461641b2f0bdSmrg 461741b2f0bdSmrg/* The mapping between symbol names and symbols. */ 461841b2f0bdSmrg" 461941b2f0bdSmrg 462041b2f0bdSmrg case $host in 462141b2f0bdSmrg *cygwin* | *mingw* ) 462241b2f0bdSmrg $echo >> "$output_objdir/$dlsyms" "\ 462341b2f0bdSmrg/* DATA imports from DLLs on WIN32 can't be const, because 462441b2f0bdSmrg runtime relocations are performed -- see ld's documentation 462541b2f0bdSmrg on pseudo-relocs */ 462641b2f0bdSmrgstruct { 462741b2f0bdSmrg" 462841b2f0bdSmrg ;; 462941b2f0bdSmrg * ) 463041b2f0bdSmrg $echo >> "$output_objdir/$dlsyms" "\ 463141b2f0bdSmrgconst struct { 463241b2f0bdSmrg" 463341b2f0bdSmrg ;; 463441b2f0bdSmrg esac 463541b2f0bdSmrg 463641b2f0bdSmrg 463741b2f0bdSmrg $echo >> "$output_objdir/$dlsyms" "\ 463841b2f0bdSmrg const char *name; 463941b2f0bdSmrg lt_ptr address; 464041b2f0bdSmrg} 464141b2f0bdSmrglt_preloaded_symbols[] = 464241b2f0bdSmrg{\ 464341b2f0bdSmrg" 464441b2f0bdSmrg 464541b2f0bdSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 464641b2f0bdSmrg 464741b2f0bdSmrg $echo >> "$output_objdir/$dlsyms" "\ 464841b2f0bdSmrg {0, (lt_ptr) 0} 464941b2f0bdSmrg}; 465041b2f0bdSmrg 465141b2f0bdSmrg/* This works around a problem in FreeBSD linker */ 465241b2f0bdSmrg#ifdef FREEBSD_WORKAROUND 465341b2f0bdSmrgstatic const void *lt_preloaded_setup() { 465441b2f0bdSmrg return lt_preloaded_symbols; 465541b2f0bdSmrg} 465641b2f0bdSmrg#endif 465741b2f0bdSmrg 465841b2f0bdSmrg#ifdef __cplusplus 465941b2f0bdSmrg} 466041b2f0bdSmrg#endif\ 466141b2f0bdSmrg" 466241b2f0bdSmrg fi 466341b2f0bdSmrg 466441b2f0bdSmrg pic_flag_for_symtable= 466541b2f0bdSmrg case $host in 466641b2f0bdSmrg # compiling the symbol table file with pic_flag works around 466741b2f0bdSmrg # a FreeBSD bug that causes programs to crash when -lm is 466841b2f0bdSmrg # linked before any other PIC object. But we must not use 466941b2f0bdSmrg # pic_flag when linking with -static. The problem exists in 467041b2f0bdSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 467141b2f0bdSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 467241b2f0bdSmrg case "$compile_command " in 467341b2f0bdSmrg *" -static "*) ;; 467441b2f0bdSmrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 467541b2f0bdSmrg esac;; 467641b2f0bdSmrg *-*-hpux*) 467741b2f0bdSmrg case "$compile_command " in 467841b2f0bdSmrg *" -static "*) ;; 467941b2f0bdSmrg *) pic_flag_for_symtable=" $pic_flag";; 468041b2f0bdSmrg esac 468141b2f0bdSmrg esac 468241b2f0bdSmrg 468341b2f0bdSmrg # Now compile the dynamic symbol file. 468441b2f0bdSmrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 468541b2f0bdSmrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 468641b2f0bdSmrg 468741b2f0bdSmrg # Clean up the generated files. 468841b2f0bdSmrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 468941b2f0bdSmrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 469041b2f0bdSmrg 469141b2f0bdSmrg # Transform the symbol file into the correct name. 469241b2f0bdSmrg case $host in 469341b2f0bdSmrg *cygwin* | *mingw* ) 469441b2f0bdSmrg if test -f "$output_objdir/${outputname}.def" ; then 469541b2f0bdSmrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 469641b2f0bdSmrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 469741b2f0bdSmrg else 469841b2f0bdSmrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 469941b2f0bdSmrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 470041b2f0bdSmrg fi 470141b2f0bdSmrg ;; 470241b2f0bdSmrg * ) 470341b2f0bdSmrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 470441b2f0bdSmrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 470541b2f0bdSmrg ;; 470641b2f0bdSmrg esac 470741b2f0bdSmrg ;; 470841b2f0bdSmrg *) 470941b2f0bdSmrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 471041b2f0bdSmrg exit $EXIT_FAILURE 471141b2f0bdSmrg ;; 471241b2f0bdSmrg esac 471341b2f0bdSmrg else 471441b2f0bdSmrg # We keep going just in case the user didn't refer to 471541b2f0bdSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 471641b2f0bdSmrg # really was required. 471741b2f0bdSmrg 471841b2f0bdSmrg # Nullify the symbol file. 471941b2f0bdSmrg compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 472041b2f0bdSmrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 472141b2f0bdSmrg fi 472241b2f0bdSmrg 472341b2f0bdSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 472441b2f0bdSmrg # Replace the output file specification. 472541b2f0bdSmrg compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 472641b2f0bdSmrg link_command="$compile_command$compile_rpath" 472741b2f0bdSmrg 472841b2f0bdSmrg # We have no uninstalled library dependencies, so finalize right now. 472941b2f0bdSmrg $show "$link_command" 473041b2f0bdSmrg $run eval "$link_command" 473141b2f0bdSmrg exit_status=$? 473241b2f0bdSmrg 473341b2f0bdSmrg # Delete the generated files. 473441b2f0bdSmrg if test -n "$dlsyms"; then 473541b2f0bdSmrg $show "$rm $output_objdir/${outputname}S.${objext}" 473641b2f0bdSmrg $run $rm "$output_objdir/${outputname}S.${objext}" 473741b2f0bdSmrg fi 473841b2f0bdSmrg 473941b2f0bdSmrg exit $exit_status 474041b2f0bdSmrg fi 474141b2f0bdSmrg 474241b2f0bdSmrg if test -n "$shlibpath_var"; then 474341b2f0bdSmrg # We should set the shlibpath_var 474441b2f0bdSmrg rpath= 474541b2f0bdSmrg for dir in $temp_rpath; do 474641b2f0bdSmrg case $dir in 474741b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) 474841b2f0bdSmrg # Absolute path. 474941b2f0bdSmrg rpath="$rpath$dir:" 475041b2f0bdSmrg ;; 475141b2f0bdSmrg *) 475241b2f0bdSmrg # Relative path: add a thisdir entry. 475341b2f0bdSmrg rpath="$rpath\$thisdir/$dir:" 475441b2f0bdSmrg ;; 475541b2f0bdSmrg esac 475641b2f0bdSmrg done 475741b2f0bdSmrg temp_rpath="$rpath" 475841b2f0bdSmrg fi 475941b2f0bdSmrg 476041b2f0bdSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 476141b2f0bdSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 476241b2f0bdSmrg fi 476341b2f0bdSmrg if test -n "$finalize_shlibpath"; then 476441b2f0bdSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 476541b2f0bdSmrg fi 476641b2f0bdSmrg 476741b2f0bdSmrg compile_var= 476841b2f0bdSmrg finalize_var= 476941b2f0bdSmrg if test -n "$runpath_var"; then 477041b2f0bdSmrg if test -n "$perm_rpath"; then 477141b2f0bdSmrg # We should set the runpath_var. 477241b2f0bdSmrg rpath= 477341b2f0bdSmrg for dir in $perm_rpath; do 477441b2f0bdSmrg rpath="$rpath$dir:" 477541b2f0bdSmrg done 477641b2f0bdSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 477741b2f0bdSmrg fi 477841b2f0bdSmrg if test -n "$finalize_perm_rpath"; then 477941b2f0bdSmrg # We should set the runpath_var. 478041b2f0bdSmrg rpath= 478141b2f0bdSmrg for dir in $finalize_perm_rpath; do 478241b2f0bdSmrg rpath="$rpath$dir:" 478341b2f0bdSmrg done 478441b2f0bdSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 478541b2f0bdSmrg fi 478641b2f0bdSmrg fi 478741b2f0bdSmrg 478841b2f0bdSmrg if test "$no_install" = yes; then 478941b2f0bdSmrg # We don't need to create a wrapper script. 479041b2f0bdSmrg link_command="$compile_var$compile_command$compile_rpath" 479141b2f0bdSmrg # Replace the output file specification. 479241b2f0bdSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 479341b2f0bdSmrg # Delete the old output file. 479441b2f0bdSmrg $run $rm $output 479541b2f0bdSmrg # Link the executable and exit 479641b2f0bdSmrg $show "$link_command" 479741b2f0bdSmrg $run eval "$link_command" || exit $? 479841b2f0bdSmrg exit $EXIT_SUCCESS 479941b2f0bdSmrg fi 480041b2f0bdSmrg 480141b2f0bdSmrg if test "$hardcode_action" = relink; then 480241b2f0bdSmrg # Fast installation is not supported 480341b2f0bdSmrg link_command="$compile_var$compile_command$compile_rpath" 480441b2f0bdSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 480541b2f0bdSmrg 480641b2f0bdSmrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 480741b2f0bdSmrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 480841b2f0bdSmrg else 480941b2f0bdSmrg if test "$fast_install" != no; then 481041b2f0bdSmrg link_command="$finalize_var$compile_command$finalize_rpath" 481141b2f0bdSmrg if test "$fast_install" = yes; then 481241b2f0bdSmrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 481341b2f0bdSmrg else 481441b2f0bdSmrg # fast_install is set to needless 481541b2f0bdSmrg relink_command= 481641b2f0bdSmrg fi 481741b2f0bdSmrg else 481841b2f0bdSmrg link_command="$compile_var$compile_command$compile_rpath" 481941b2f0bdSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 482041b2f0bdSmrg fi 482141b2f0bdSmrg fi 482241b2f0bdSmrg 482341b2f0bdSmrg # Replace the output file specification. 482441b2f0bdSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 482541b2f0bdSmrg 482641b2f0bdSmrg # Delete the old output files. 482741b2f0bdSmrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 482841b2f0bdSmrg 482941b2f0bdSmrg $show "$link_command" 483041b2f0bdSmrg $run eval "$link_command" || exit $? 483141b2f0bdSmrg 483241b2f0bdSmrg # Now create the wrapper script. 483341b2f0bdSmrg $show "creating $output" 483441b2f0bdSmrg 483541b2f0bdSmrg # Quote the relink command for shipping. 483641b2f0bdSmrg if test -n "$relink_command"; then 483741b2f0bdSmrg # Preserve any variables that may affect compiler behavior 483841b2f0bdSmrg for var in $variables_saved_for_relink; do 483941b2f0bdSmrg if eval test -z \"\${$var+set}\"; then 484041b2f0bdSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 484141b2f0bdSmrg elif eval var_value=\$$var; test -z "$var_value"; then 484241b2f0bdSmrg relink_command="$var=; export $var; $relink_command" 484341b2f0bdSmrg else 484441b2f0bdSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 484541b2f0bdSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 484641b2f0bdSmrg fi 484741b2f0bdSmrg done 484841b2f0bdSmrg relink_command="(cd `pwd`; $relink_command)" 484941b2f0bdSmrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 485041b2f0bdSmrg fi 485141b2f0bdSmrg 485241b2f0bdSmrg # Quote $echo for shipping. 485341b2f0bdSmrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 485441b2f0bdSmrg case $progpath in 485541b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 485641b2f0bdSmrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 485741b2f0bdSmrg esac 485841b2f0bdSmrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 485941b2f0bdSmrg else 486041b2f0bdSmrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 486141b2f0bdSmrg fi 486241b2f0bdSmrg 486341b2f0bdSmrg # Only actually do things if our run command is non-null. 486441b2f0bdSmrg if test -z "$run"; then 486541b2f0bdSmrg # win32 will think the script is a binary if it has 486641b2f0bdSmrg # a .exe suffix, so we strip it off here. 486741b2f0bdSmrg case $output in 486841b2f0bdSmrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 486941b2f0bdSmrg esac 487041b2f0bdSmrg # test for cygwin because mv fails w/o .exe extensions 487141b2f0bdSmrg case $host in 487241b2f0bdSmrg *cygwin*) 487341b2f0bdSmrg exeext=.exe 487441b2f0bdSmrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 487541b2f0bdSmrg *) exeext= ;; 487641b2f0bdSmrg esac 487741b2f0bdSmrg case $host in 487841b2f0bdSmrg *cygwin* | *mingw* ) 487941b2f0bdSmrg output_name=`basename $output` 488041b2f0bdSmrg output_path=`dirname $output` 488141b2f0bdSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 488241b2f0bdSmrg cwrapper="$output_path/$output_name.exe" 488341b2f0bdSmrg $rm $cwrappersource $cwrapper 488441b2f0bdSmrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 488541b2f0bdSmrg 488641b2f0bdSmrg cat > $cwrappersource <<EOF 488741b2f0bdSmrg 488841b2f0bdSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 488941b2f0bdSmrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 489041b2f0bdSmrg 489141b2f0bdSmrg The $output program cannot be directly executed until all the libtool 489241b2f0bdSmrg libraries that it depends on are installed. 489341b2f0bdSmrg 489441b2f0bdSmrg This wrapper executable should never be moved out of the build directory. 489541b2f0bdSmrg If it is, it will not operate correctly. 489641b2f0bdSmrg 489741b2f0bdSmrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 489841b2f0bdSmrg but could eventually absorb all of the scripts functionality and 489941b2f0bdSmrg exec $objdir/$outputname directly. 490041b2f0bdSmrg*/ 490141b2f0bdSmrgEOF 490241b2f0bdSmrg cat >> $cwrappersource<<"EOF" 490341b2f0bdSmrg#include <stdio.h> 490441b2f0bdSmrg#include <stdlib.h> 490541b2f0bdSmrg#include <unistd.h> 490641b2f0bdSmrg#include <malloc.h> 490741b2f0bdSmrg#include <stdarg.h> 490841b2f0bdSmrg#include <assert.h> 490941b2f0bdSmrg#include <string.h> 491041b2f0bdSmrg#include <ctype.h> 491141b2f0bdSmrg#include <sys/stat.h> 491241b2f0bdSmrg 491341b2f0bdSmrg#if defined(PATH_MAX) 491441b2f0bdSmrg# define LT_PATHMAX PATH_MAX 491541b2f0bdSmrg#elif defined(MAXPATHLEN) 491641b2f0bdSmrg# define LT_PATHMAX MAXPATHLEN 491741b2f0bdSmrg#else 491841b2f0bdSmrg# define LT_PATHMAX 1024 491941b2f0bdSmrg#endif 492041b2f0bdSmrg 492141b2f0bdSmrg#ifndef DIR_SEPARATOR 492241b2f0bdSmrg# define DIR_SEPARATOR '/' 492341b2f0bdSmrg# define PATH_SEPARATOR ':' 492441b2f0bdSmrg#endif 492541b2f0bdSmrg 492641b2f0bdSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 492741b2f0bdSmrg defined (__OS2__) 492841b2f0bdSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 492941b2f0bdSmrg# ifndef DIR_SEPARATOR_2 493041b2f0bdSmrg# define DIR_SEPARATOR_2 '\\' 493141b2f0bdSmrg# endif 493241b2f0bdSmrg# ifndef PATH_SEPARATOR_2 493341b2f0bdSmrg# define PATH_SEPARATOR_2 ';' 493441b2f0bdSmrg# endif 493541b2f0bdSmrg#endif 493641b2f0bdSmrg 493741b2f0bdSmrg#ifndef DIR_SEPARATOR_2 493841b2f0bdSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 493941b2f0bdSmrg#else /* DIR_SEPARATOR_2 */ 494041b2f0bdSmrg# define IS_DIR_SEPARATOR(ch) \ 494141b2f0bdSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 494241b2f0bdSmrg#endif /* DIR_SEPARATOR_2 */ 494341b2f0bdSmrg 494441b2f0bdSmrg#ifndef PATH_SEPARATOR_2 494541b2f0bdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 494641b2f0bdSmrg#else /* PATH_SEPARATOR_2 */ 494741b2f0bdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 494841b2f0bdSmrg#endif /* PATH_SEPARATOR_2 */ 494941b2f0bdSmrg 495041b2f0bdSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 495141b2f0bdSmrg#define XFREE(stale) do { \ 495241b2f0bdSmrg if (stale) { free ((void *) stale); stale = 0; } \ 495341b2f0bdSmrg} while (0) 495441b2f0bdSmrg 495541b2f0bdSmrg/* -DDEBUG is fairly common in CFLAGS. */ 495641b2f0bdSmrg#undef DEBUG 495741b2f0bdSmrg#if defined DEBUGWRAPPER 495841b2f0bdSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 495941b2f0bdSmrg#else 496041b2f0bdSmrg# define DEBUG(format, ...) 496141b2f0bdSmrg#endif 496241b2f0bdSmrg 496341b2f0bdSmrgconst char *program_name = NULL; 496441b2f0bdSmrg 496541b2f0bdSmrgvoid * xmalloc (size_t num); 496641b2f0bdSmrgchar * xstrdup (const char *string); 496741b2f0bdSmrgconst char * base_name (const char *name); 496841b2f0bdSmrgchar * find_executable(const char *wrapper); 496941b2f0bdSmrgint check_executable(const char *path); 497041b2f0bdSmrgchar * strendzap(char *str, const char *pat); 497141b2f0bdSmrgvoid lt_fatal (const char *message, ...); 497241b2f0bdSmrg 497341b2f0bdSmrgint 497441b2f0bdSmrgmain (int argc, char *argv[]) 497541b2f0bdSmrg{ 497641b2f0bdSmrg char **newargz; 497741b2f0bdSmrg int i; 497841b2f0bdSmrg 497941b2f0bdSmrg program_name = (char *) xstrdup (base_name (argv[0])); 498041b2f0bdSmrg DEBUG("(main) argv[0] : %s\n",argv[0]); 498141b2f0bdSmrg DEBUG("(main) program_name : %s\n",program_name); 498241b2f0bdSmrg newargz = XMALLOC(char *, argc+2); 498341b2f0bdSmrgEOF 498441b2f0bdSmrg 498541b2f0bdSmrg cat >> $cwrappersource <<EOF 498641b2f0bdSmrg newargz[0] = (char *) xstrdup("$SHELL"); 498741b2f0bdSmrgEOF 498841b2f0bdSmrg 498941b2f0bdSmrg cat >> $cwrappersource <<"EOF" 499041b2f0bdSmrg newargz[1] = find_executable(argv[0]); 499141b2f0bdSmrg if (newargz[1] == NULL) 499241b2f0bdSmrg lt_fatal("Couldn't find %s", argv[0]); 499341b2f0bdSmrg DEBUG("(main) found exe at : %s\n",newargz[1]); 499441b2f0bdSmrg /* we know the script has the same name, without the .exe */ 499541b2f0bdSmrg /* so make sure newargz[1] doesn't end in .exe */ 499641b2f0bdSmrg strendzap(newargz[1],".exe"); 499741b2f0bdSmrg for (i = 1; i < argc; i++) 499841b2f0bdSmrg newargz[i+1] = xstrdup(argv[i]); 499941b2f0bdSmrg newargz[argc+1] = NULL; 500041b2f0bdSmrg 500141b2f0bdSmrg for (i=0; i<argc+1; i++) 500241b2f0bdSmrg { 500341b2f0bdSmrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 500441b2f0bdSmrg ; 500541b2f0bdSmrg } 500641b2f0bdSmrg 500741b2f0bdSmrgEOF 500841b2f0bdSmrg 500941b2f0bdSmrg case $host_os in 501041b2f0bdSmrg mingw*) 501141b2f0bdSmrg cat >> $cwrappersource <<EOF 501241b2f0bdSmrg execv("$SHELL",(char const **)newargz); 501341b2f0bdSmrgEOF 501441b2f0bdSmrg ;; 501541b2f0bdSmrg *) 501641b2f0bdSmrg cat >> $cwrappersource <<EOF 501741b2f0bdSmrg execv("$SHELL",newargz); 501841b2f0bdSmrgEOF 501941b2f0bdSmrg ;; 502041b2f0bdSmrg esac 502141b2f0bdSmrg 502241b2f0bdSmrg cat >> $cwrappersource <<"EOF" 502341b2f0bdSmrg return 127; 502441b2f0bdSmrg} 502541b2f0bdSmrg 502641b2f0bdSmrgvoid * 502741b2f0bdSmrgxmalloc (size_t num) 502841b2f0bdSmrg{ 502941b2f0bdSmrg void * p = (void *) malloc (num); 503041b2f0bdSmrg if (!p) 503141b2f0bdSmrg lt_fatal ("Memory exhausted"); 503241b2f0bdSmrg 503341b2f0bdSmrg return p; 503441b2f0bdSmrg} 503541b2f0bdSmrg 503641b2f0bdSmrgchar * 503741b2f0bdSmrgxstrdup (const char *string) 503841b2f0bdSmrg{ 503941b2f0bdSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 504041b2f0bdSmrg; 504141b2f0bdSmrg} 504241b2f0bdSmrg 504341b2f0bdSmrgconst char * 504441b2f0bdSmrgbase_name (const char *name) 504541b2f0bdSmrg{ 504641b2f0bdSmrg const char *base; 504741b2f0bdSmrg 504841b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 504941b2f0bdSmrg /* Skip over the disk name in MSDOS pathnames. */ 505041b2f0bdSmrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 505141b2f0bdSmrg name += 2; 505241b2f0bdSmrg#endif 505341b2f0bdSmrg 505441b2f0bdSmrg for (base = name; *name; name++) 505541b2f0bdSmrg if (IS_DIR_SEPARATOR (*name)) 505641b2f0bdSmrg base = name + 1; 505741b2f0bdSmrg return base; 505841b2f0bdSmrg} 505941b2f0bdSmrg 506041b2f0bdSmrgint 506141b2f0bdSmrgcheck_executable(const char * path) 506241b2f0bdSmrg{ 506341b2f0bdSmrg struct stat st; 506441b2f0bdSmrg 506541b2f0bdSmrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 506641b2f0bdSmrg if ((!path) || (!*path)) 506741b2f0bdSmrg return 0; 506841b2f0bdSmrg 506941b2f0bdSmrg if ((stat (path, &st) >= 0) && 507041b2f0bdSmrg ( 507141b2f0bdSmrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 507241b2f0bdSmrg#if defined (S_IXOTH) 507341b2f0bdSmrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 507441b2f0bdSmrg#endif 507541b2f0bdSmrg#if defined (S_IXGRP) 507641b2f0bdSmrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 507741b2f0bdSmrg#endif 507841b2f0bdSmrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 507941b2f0bdSmrg ) 508041b2f0bdSmrg return 1; 508141b2f0bdSmrg else 508241b2f0bdSmrg return 0; 508341b2f0bdSmrg} 508441b2f0bdSmrg 508541b2f0bdSmrg/* Searches for the full path of the wrapper. Returns 508641b2f0bdSmrg newly allocated full path name if found, NULL otherwise */ 508741b2f0bdSmrgchar * 508841b2f0bdSmrgfind_executable (const char* wrapper) 508941b2f0bdSmrg{ 509041b2f0bdSmrg int has_slash = 0; 509141b2f0bdSmrg const char* p; 509241b2f0bdSmrg const char* p_next; 509341b2f0bdSmrg /* static buffer for getcwd */ 509441b2f0bdSmrg char tmp[LT_PATHMAX + 1]; 509541b2f0bdSmrg int tmp_len; 509641b2f0bdSmrg char* concat_name; 509741b2f0bdSmrg 509841b2f0bdSmrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 509941b2f0bdSmrg 510041b2f0bdSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 510141b2f0bdSmrg return NULL; 510241b2f0bdSmrg 510341b2f0bdSmrg /* Absolute path? */ 510441b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 510541b2f0bdSmrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 510641b2f0bdSmrg { 510741b2f0bdSmrg concat_name = xstrdup (wrapper); 510841b2f0bdSmrg if (check_executable(concat_name)) 510941b2f0bdSmrg return concat_name; 511041b2f0bdSmrg XFREE(concat_name); 511141b2f0bdSmrg } 511241b2f0bdSmrg else 511341b2f0bdSmrg { 511441b2f0bdSmrg#endif 511541b2f0bdSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 511641b2f0bdSmrg { 511741b2f0bdSmrg concat_name = xstrdup (wrapper); 511841b2f0bdSmrg if (check_executable(concat_name)) 511941b2f0bdSmrg return concat_name; 512041b2f0bdSmrg XFREE(concat_name); 512141b2f0bdSmrg } 512241b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 512341b2f0bdSmrg } 512441b2f0bdSmrg#endif 512541b2f0bdSmrg 512641b2f0bdSmrg for (p = wrapper; *p; p++) 512741b2f0bdSmrg if (*p == '/') 512841b2f0bdSmrg { 512941b2f0bdSmrg has_slash = 1; 513041b2f0bdSmrg break; 513141b2f0bdSmrg } 513241b2f0bdSmrg if (!has_slash) 513341b2f0bdSmrg { 513441b2f0bdSmrg /* no slashes; search PATH */ 513541b2f0bdSmrg const char* path = getenv ("PATH"); 513641b2f0bdSmrg if (path != NULL) 513741b2f0bdSmrg { 513841b2f0bdSmrg for (p = path; *p; p = p_next) 513941b2f0bdSmrg { 514041b2f0bdSmrg const char* q; 514141b2f0bdSmrg size_t p_len; 514241b2f0bdSmrg for (q = p; *q; q++) 514341b2f0bdSmrg if (IS_PATH_SEPARATOR(*q)) 514441b2f0bdSmrg break; 514541b2f0bdSmrg p_len = q - p; 514641b2f0bdSmrg p_next = (*q == '\0' ? q : q + 1); 514741b2f0bdSmrg if (p_len == 0) 514841b2f0bdSmrg { 514941b2f0bdSmrg /* empty path: current directory */ 515041b2f0bdSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 515141b2f0bdSmrg lt_fatal ("getcwd failed"); 515241b2f0bdSmrg tmp_len = strlen(tmp); 515341b2f0bdSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 515441b2f0bdSmrg memcpy (concat_name, tmp, tmp_len); 515541b2f0bdSmrg concat_name[tmp_len] = '/'; 515641b2f0bdSmrg strcpy (concat_name + tmp_len + 1, wrapper); 515741b2f0bdSmrg } 515841b2f0bdSmrg else 515941b2f0bdSmrg { 516041b2f0bdSmrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 516141b2f0bdSmrg memcpy (concat_name, p, p_len); 516241b2f0bdSmrg concat_name[p_len] = '/'; 516341b2f0bdSmrg strcpy (concat_name + p_len + 1, wrapper); 516441b2f0bdSmrg } 516541b2f0bdSmrg if (check_executable(concat_name)) 516641b2f0bdSmrg return concat_name; 516741b2f0bdSmrg XFREE(concat_name); 516841b2f0bdSmrg } 516941b2f0bdSmrg } 517041b2f0bdSmrg /* not found in PATH; assume curdir */ 517141b2f0bdSmrg } 517241b2f0bdSmrg /* Relative path | not found in path: prepend cwd */ 517341b2f0bdSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 517441b2f0bdSmrg lt_fatal ("getcwd failed"); 517541b2f0bdSmrg tmp_len = strlen(tmp); 517641b2f0bdSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 517741b2f0bdSmrg memcpy (concat_name, tmp, tmp_len); 517841b2f0bdSmrg concat_name[tmp_len] = '/'; 517941b2f0bdSmrg strcpy (concat_name + tmp_len + 1, wrapper); 518041b2f0bdSmrg 518141b2f0bdSmrg if (check_executable(concat_name)) 518241b2f0bdSmrg return concat_name; 518341b2f0bdSmrg XFREE(concat_name); 518441b2f0bdSmrg return NULL; 518541b2f0bdSmrg} 518641b2f0bdSmrg 518741b2f0bdSmrgchar * 518841b2f0bdSmrgstrendzap(char *str, const char *pat) 518941b2f0bdSmrg{ 519041b2f0bdSmrg size_t len, patlen; 519141b2f0bdSmrg 519241b2f0bdSmrg assert(str != NULL); 519341b2f0bdSmrg assert(pat != NULL); 519441b2f0bdSmrg 519541b2f0bdSmrg len = strlen(str); 519641b2f0bdSmrg patlen = strlen(pat); 519741b2f0bdSmrg 519841b2f0bdSmrg if (patlen <= len) 519941b2f0bdSmrg { 520041b2f0bdSmrg str += len - patlen; 520141b2f0bdSmrg if (strcmp(str, pat) == 0) 520241b2f0bdSmrg *str = '\0'; 520341b2f0bdSmrg } 520441b2f0bdSmrg return str; 520541b2f0bdSmrg} 520641b2f0bdSmrg 520741b2f0bdSmrgstatic void 520841b2f0bdSmrglt_error_core (int exit_status, const char * mode, 520941b2f0bdSmrg const char * message, va_list ap) 521041b2f0bdSmrg{ 521141b2f0bdSmrg fprintf (stderr, "%s: %s: ", program_name, mode); 521241b2f0bdSmrg vfprintf (stderr, message, ap); 521341b2f0bdSmrg fprintf (stderr, ".\n"); 521441b2f0bdSmrg 521541b2f0bdSmrg if (exit_status >= 0) 521641b2f0bdSmrg exit (exit_status); 521741b2f0bdSmrg} 521841b2f0bdSmrg 521941b2f0bdSmrgvoid 522041b2f0bdSmrglt_fatal (const char *message, ...) 522141b2f0bdSmrg{ 522241b2f0bdSmrg va_list ap; 522341b2f0bdSmrg va_start (ap, message); 522441b2f0bdSmrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 522541b2f0bdSmrg va_end (ap); 522641b2f0bdSmrg} 522741b2f0bdSmrgEOF 522841b2f0bdSmrg # we should really use a build-platform specific compiler 522941b2f0bdSmrg # here, but OTOH, the wrappers (shell script and this C one) 523041b2f0bdSmrg # are only useful if you want to execute the "real" binary. 523141b2f0bdSmrg # Since the "real" binary is built for $host, then this 523241b2f0bdSmrg # wrapper might as well be built for $host, too. 523341b2f0bdSmrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 523441b2f0bdSmrg ;; 523541b2f0bdSmrg esac 523641b2f0bdSmrg $rm $output 523741b2f0bdSmrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 523841b2f0bdSmrg 523941b2f0bdSmrg $echo > $output "\ 524041b2f0bdSmrg#! $SHELL 524141b2f0bdSmrg 524241b2f0bdSmrg# $output - temporary wrapper script for $objdir/$outputname 524341b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 524441b2f0bdSmrg# 524541b2f0bdSmrg# The $output program cannot be directly executed until all the libtool 524641b2f0bdSmrg# libraries that it depends on are installed. 524741b2f0bdSmrg# 524841b2f0bdSmrg# This wrapper script should never be moved out of the build directory. 524941b2f0bdSmrg# If it is, it will not operate correctly. 525041b2f0bdSmrg 525141b2f0bdSmrg# Sed substitution that helps us do robust quoting. It backslashifies 525241b2f0bdSmrg# metacharacters that are still active within double-quoted strings. 525341b2f0bdSmrgXsed='${SED} -e 1s/^X//' 525441b2f0bdSmrgsed_quote_subst='$sed_quote_subst' 525541b2f0bdSmrg 525641b2f0bdSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 525741b2f0bdSmrg# if CDPATH is set. 525841b2f0bdSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 525941b2f0bdSmrg 526041b2f0bdSmrgrelink_command=\"$relink_command\" 526141b2f0bdSmrg 526241b2f0bdSmrg# This environment variable determines our operation mode. 526341b2f0bdSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 526441b2f0bdSmrg # install mode needs the following variable: 526541b2f0bdSmrg notinst_deplibs='$notinst_deplibs' 526641b2f0bdSmrgelse 526741b2f0bdSmrg # When we are sourced in execute mode, \$file and \$echo are already set. 526841b2f0bdSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 526941b2f0bdSmrg echo=\"$qecho\" 527041b2f0bdSmrg file=\"\$0\" 527141b2f0bdSmrg # Make sure echo works. 527241b2f0bdSmrg if test \"X\$1\" = X--no-reexec; then 527341b2f0bdSmrg # Discard the --no-reexec flag, and continue. 527441b2f0bdSmrg shift 527541b2f0bdSmrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 527641b2f0bdSmrg # Yippee, \$echo works! 527741b2f0bdSmrg : 527841b2f0bdSmrg else 527941b2f0bdSmrg # Restart under the correct shell, and then maybe \$echo will work. 528041b2f0bdSmrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 528141b2f0bdSmrg fi 528241b2f0bdSmrg fi\ 528341b2f0bdSmrg" 528441b2f0bdSmrg $echo >> $output "\ 528541b2f0bdSmrg 528641b2f0bdSmrg # Find the directory that this script lives in. 528741b2f0bdSmrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 528841b2f0bdSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 528941b2f0bdSmrg 529041b2f0bdSmrg # Follow symbolic links until we get to the real thisdir. 529141b2f0bdSmrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 529241b2f0bdSmrg while test -n \"\$file\"; do 529341b2f0bdSmrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 529441b2f0bdSmrg 529541b2f0bdSmrg # If there was a directory component, then change thisdir. 529641b2f0bdSmrg if test \"x\$destdir\" != \"x\$file\"; then 529741b2f0bdSmrg case \"\$destdir\" in 529841b2f0bdSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 529941b2f0bdSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 530041b2f0bdSmrg esac 530141b2f0bdSmrg fi 530241b2f0bdSmrg 530341b2f0bdSmrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 530441b2f0bdSmrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 530541b2f0bdSmrg done 530641b2f0bdSmrg 530741b2f0bdSmrg # Try to get the absolute directory name. 530841b2f0bdSmrg absdir=\`cd \"\$thisdir\" && pwd\` 530941b2f0bdSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 531041b2f0bdSmrg" 531141b2f0bdSmrg 531241b2f0bdSmrg if test "$fast_install" = yes; then 531341b2f0bdSmrg $echo >> $output "\ 531441b2f0bdSmrg program=lt-'$outputname'$exeext 531541b2f0bdSmrg progdir=\"\$thisdir/$objdir\" 531641b2f0bdSmrg 531741b2f0bdSmrg if test ! -f \"\$progdir/\$program\" || \\ 531841b2f0bdSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 531941b2f0bdSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 532041b2f0bdSmrg 532141b2f0bdSmrg file=\"\$\$-\$program\" 532241b2f0bdSmrg 532341b2f0bdSmrg if test ! -d \"\$progdir\"; then 532441b2f0bdSmrg $mkdir \"\$progdir\" 532541b2f0bdSmrg else 532641b2f0bdSmrg $rm \"\$progdir/\$file\" 532741b2f0bdSmrg fi" 532841b2f0bdSmrg 532941b2f0bdSmrg $echo >> $output "\ 533041b2f0bdSmrg 533141b2f0bdSmrg # relink executable if necessary 533241b2f0bdSmrg if test -n \"\$relink_command\"; then 533341b2f0bdSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 533441b2f0bdSmrg else 533541b2f0bdSmrg $echo \"\$relink_command_output\" >&2 533641b2f0bdSmrg $rm \"\$progdir/\$file\" 533741b2f0bdSmrg exit $EXIT_FAILURE 533841b2f0bdSmrg fi 533941b2f0bdSmrg fi 534041b2f0bdSmrg 534141b2f0bdSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 534241b2f0bdSmrg { $rm \"\$progdir/\$program\"; 534341b2f0bdSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 534441b2f0bdSmrg $rm \"\$progdir/\$file\" 534541b2f0bdSmrg fi" 534641b2f0bdSmrg else 534741b2f0bdSmrg $echo >> $output "\ 534841b2f0bdSmrg program='$outputname' 534941b2f0bdSmrg progdir=\"\$thisdir/$objdir\" 535041b2f0bdSmrg" 535141b2f0bdSmrg fi 535241b2f0bdSmrg 535341b2f0bdSmrg $echo >> $output "\ 535441b2f0bdSmrg 535541b2f0bdSmrg if test -f \"\$progdir/\$program\"; then" 535641b2f0bdSmrg 535741b2f0bdSmrg # Export our shlibpath_var if we have one. 535841b2f0bdSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 535941b2f0bdSmrg $echo >> $output "\ 536041b2f0bdSmrg # Add our own library path to $shlibpath_var 536141b2f0bdSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 536241b2f0bdSmrg 536341b2f0bdSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 536441b2f0bdSmrg # The second colon is a workaround for a bug in BeOS R4 sed 536541b2f0bdSmrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 536641b2f0bdSmrg 536741b2f0bdSmrg export $shlibpath_var 536841b2f0bdSmrg" 536941b2f0bdSmrg fi 537041b2f0bdSmrg 537141b2f0bdSmrg # fixup the dll searchpath if we need to. 537241b2f0bdSmrg if test -n "$dllsearchpath"; then 537341b2f0bdSmrg $echo >> $output "\ 537441b2f0bdSmrg # Add the dll search path components to the executable PATH 537541b2f0bdSmrg PATH=$dllsearchpath:\$PATH 537641b2f0bdSmrg" 537741b2f0bdSmrg fi 537841b2f0bdSmrg 537941b2f0bdSmrg $echo >> $output "\ 538041b2f0bdSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 538141b2f0bdSmrg # Run the actual program with our arguments. 538241b2f0bdSmrg" 538341b2f0bdSmrg case $host in 538441b2f0bdSmrg # Backslashes separate directories on plain windows 538541b2f0bdSmrg *-*-mingw | *-*-os2*) 538641b2f0bdSmrg $echo >> $output "\ 538741b2f0bdSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 538841b2f0bdSmrg" 538941b2f0bdSmrg ;; 539041b2f0bdSmrg 539141b2f0bdSmrg *) 539241b2f0bdSmrg $echo >> $output "\ 539341b2f0bdSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 539441b2f0bdSmrg" 539541b2f0bdSmrg ;; 539641b2f0bdSmrg esac 539741b2f0bdSmrg $echo >> $output "\ 539841b2f0bdSmrg \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 539941b2f0bdSmrg exit $EXIT_FAILURE 540041b2f0bdSmrg fi 540141b2f0bdSmrg else 540241b2f0bdSmrg # The program doesn't exist. 540341b2f0bdSmrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 540441b2f0bdSmrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 540541b2f0bdSmrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 540641b2f0bdSmrg exit $EXIT_FAILURE 540741b2f0bdSmrg fi 540841b2f0bdSmrgfi\ 540941b2f0bdSmrg" 541041b2f0bdSmrg chmod +x $output 541141b2f0bdSmrg fi 541241b2f0bdSmrg exit $EXIT_SUCCESS 541341b2f0bdSmrg ;; 541441b2f0bdSmrg esac 541541b2f0bdSmrg 541641b2f0bdSmrg # See if we need to build an old-fashioned archive. 541741b2f0bdSmrg for oldlib in $oldlibs; do 541841b2f0bdSmrg 541941b2f0bdSmrg if test "$build_libtool_libs" = convenience; then 542041b2f0bdSmrg oldobjs="$libobjs_save" 542141b2f0bdSmrg addlibs="$convenience" 542241b2f0bdSmrg build_libtool_libs=no 542341b2f0bdSmrg else 542441b2f0bdSmrg if test "$build_libtool_libs" = module; then 542541b2f0bdSmrg oldobjs="$libobjs_save" 542641b2f0bdSmrg build_libtool_libs=no 542741b2f0bdSmrg else 542841b2f0bdSmrg oldobjs="$old_deplibs $non_pic_objects" 542941b2f0bdSmrg fi 543041b2f0bdSmrg addlibs="$old_convenience" 543141b2f0bdSmrg fi 543241b2f0bdSmrg 543341b2f0bdSmrg if test -n "$addlibs"; then 543441b2f0bdSmrg gentop="$output_objdir/${outputname}x" 543541b2f0bdSmrg generated="$generated $gentop" 543641b2f0bdSmrg 543741b2f0bdSmrg func_extract_archives $gentop $addlibs 543841b2f0bdSmrg oldobjs="$oldobjs $func_extract_archives_result" 543941b2f0bdSmrg fi 544041b2f0bdSmrg 544141b2f0bdSmrg # Do each command in the archive commands. 544241b2f0bdSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 544341b2f0bdSmrg cmds=$old_archive_from_new_cmds 544441b2f0bdSmrg else 544541b2f0bdSmrg # POSIX demands no paths to be encoded in archives. We have 544641b2f0bdSmrg # to avoid creating archives with duplicate basenames if we 544741b2f0bdSmrg # might have to extract them afterwards, e.g., when creating a 544841b2f0bdSmrg # static archive out of a convenience library, or when linking 544941b2f0bdSmrg # the entirety of a libtool archive into another (currently 545041b2f0bdSmrg # not supported by libtool). 545141b2f0bdSmrg if (for obj in $oldobjs 545241b2f0bdSmrg do 545341b2f0bdSmrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 545441b2f0bdSmrg done | sort | sort -uc >/dev/null 2>&1); then 545541b2f0bdSmrg : 545641b2f0bdSmrg else 545741b2f0bdSmrg $echo "copying selected object files to avoid basename conflicts..." 545841b2f0bdSmrg 545941b2f0bdSmrg if test -z "$gentop"; then 546041b2f0bdSmrg gentop="$output_objdir/${outputname}x" 546141b2f0bdSmrg generated="$generated $gentop" 546241b2f0bdSmrg 546341b2f0bdSmrg $show "${rm}r $gentop" 546441b2f0bdSmrg $run ${rm}r "$gentop" 546541b2f0bdSmrg $show "$mkdir $gentop" 546641b2f0bdSmrg $run $mkdir "$gentop" 546741b2f0bdSmrg exit_status=$? 546841b2f0bdSmrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 546941b2f0bdSmrg exit $exit_status 547041b2f0bdSmrg fi 547141b2f0bdSmrg fi 547241b2f0bdSmrg 547341b2f0bdSmrg save_oldobjs=$oldobjs 547441b2f0bdSmrg oldobjs= 547541b2f0bdSmrg counter=1 547641b2f0bdSmrg for obj in $save_oldobjs 547741b2f0bdSmrg do 547841b2f0bdSmrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 547941b2f0bdSmrg case " $oldobjs " in 548041b2f0bdSmrg " ") oldobjs=$obj ;; 548141b2f0bdSmrg *[\ /]"$objbase "*) 548241b2f0bdSmrg while :; do 548341b2f0bdSmrg # Make sure we don't pick an alternate name that also 548441b2f0bdSmrg # overlaps. 548541b2f0bdSmrg newobj=lt$counter-$objbase 548641b2f0bdSmrg counter=`expr $counter + 1` 548741b2f0bdSmrg case " $oldobjs " in 548841b2f0bdSmrg *[\ /]"$newobj "*) ;; 548941b2f0bdSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 549041b2f0bdSmrg esac 549141b2f0bdSmrg done 549241b2f0bdSmrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 549341b2f0bdSmrg $run ln "$obj" "$gentop/$newobj" || 549441b2f0bdSmrg $run cp "$obj" "$gentop/$newobj" 549541b2f0bdSmrg oldobjs="$oldobjs $gentop/$newobj" 549641b2f0bdSmrg ;; 549741b2f0bdSmrg *) oldobjs="$oldobjs $obj" ;; 549841b2f0bdSmrg esac 549941b2f0bdSmrg done 550041b2f0bdSmrg fi 550141b2f0bdSmrg 550241b2f0bdSmrg eval cmds=\"$old_archive_cmds\" 550341b2f0bdSmrg 550441b2f0bdSmrg if len=`expr "X$cmds" : ".*"` && 550541b2f0bdSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 550641b2f0bdSmrg cmds=$old_archive_cmds 550741b2f0bdSmrg else 550841b2f0bdSmrg # the command line is too long to link in one step, link in parts 550941b2f0bdSmrg $echo "using piecewise archive linking..." 551041b2f0bdSmrg save_RANLIB=$RANLIB 551141b2f0bdSmrg RANLIB=: 551241b2f0bdSmrg objlist= 551341b2f0bdSmrg concat_cmds= 551441b2f0bdSmrg save_oldobjs=$oldobjs 551541b2f0bdSmrg 551641b2f0bdSmrg # Is there a better way of finding the last object in the list? 551741b2f0bdSmrg for obj in $save_oldobjs 551841b2f0bdSmrg do 551941b2f0bdSmrg last_oldobj=$obj 552041b2f0bdSmrg done 552141b2f0bdSmrg for obj in $save_oldobjs 552241b2f0bdSmrg do 552341b2f0bdSmrg oldobjs="$objlist $obj" 552441b2f0bdSmrg objlist="$objlist $obj" 552541b2f0bdSmrg eval test_cmds=\"$old_archive_cmds\" 552641b2f0bdSmrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 552741b2f0bdSmrg test "$len" -le "$max_cmd_len"; then 552841b2f0bdSmrg : 552941b2f0bdSmrg else 553041b2f0bdSmrg # the above command should be used before it gets too long 553141b2f0bdSmrg oldobjs=$objlist 553241b2f0bdSmrg if test "$obj" = "$last_oldobj" ; then 553341b2f0bdSmrg RANLIB=$save_RANLIB 553441b2f0bdSmrg fi 553541b2f0bdSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 553641b2f0bdSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 553741b2f0bdSmrg objlist= 553841b2f0bdSmrg fi 553941b2f0bdSmrg done 554041b2f0bdSmrg RANLIB=$save_RANLIB 554141b2f0bdSmrg oldobjs=$objlist 554241b2f0bdSmrg if test "X$oldobjs" = "X" ; then 554341b2f0bdSmrg eval cmds=\"\$concat_cmds\" 554441b2f0bdSmrg else 554541b2f0bdSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 554641b2f0bdSmrg fi 554741b2f0bdSmrg fi 554841b2f0bdSmrg fi 554941b2f0bdSmrg save_ifs="$IFS"; IFS='~' 555041b2f0bdSmrg for cmd in $cmds; do 555141b2f0bdSmrg eval cmd=\"$cmd\" 555241b2f0bdSmrg IFS="$save_ifs" 555341b2f0bdSmrg $show "$cmd" 555441b2f0bdSmrg $run eval "$cmd" || exit $? 555541b2f0bdSmrg done 555641b2f0bdSmrg IFS="$save_ifs" 555741b2f0bdSmrg done 555841b2f0bdSmrg 555941b2f0bdSmrg if test -n "$generated"; then 556041b2f0bdSmrg $show "${rm}r$generated" 556141b2f0bdSmrg $run ${rm}r$generated 556241b2f0bdSmrg fi 556341b2f0bdSmrg 556441b2f0bdSmrg # Now create the libtool archive. 556541b2f0bdSmrg case $output in 556641b2f0bdSmrg *.la) 556741b2f0bdSmrg old_library= 556841b2f0bdSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 556941b2f0bdSmrg $show "creating $output" 557041b2f0bdSmrg 557141b2f0bdSmrg # Preserve any variables that may affect compiler behavior 557241b2f0bdSmrg for var in $variables_saved_for_relink; do 557341b2f0bdSmrg if eval test -z \"\${$var+set}\"; then 557441b2f0bdSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 557541b2f0bdSmrg elif eval var_value=\$$var; test -z "$var_value"; then 557641b2f0bdSmrg relink_command="$var=; export $var; $relink_command" 557741b2f0bdSmrg else 557841b2f0bdSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 557941b2f0bdSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 558041b2f0bdSmrg fi 558141b2f0bdSmrg done 558241b2f0bdSmrg # Quote the link command for shipping. 558341b2f0bdSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 558441b2f0bdSmrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 558541b2f0bdSmrg if test "$hardcode_automatic" = yes ; then 558641b2f0bdSmrg relink_command= 558741b2f0bdSmrg fi 558841b2f0bdSmrg 558941b2f0bdSmrg 559041b2f0bdSmrg # Only create the output if not a dry run. 559141b2f0bdSmrg if test -z "$run"; then 559241b2f0bdSmrg for installed in no yes; do 559341b2f0bdSmrg if test "$installed" = yes; then 559441b2f0bdSmrg if test -z "$install_libdir"; then 559541b2f0bdSmrg break 559641b2f0bdSmrg fi 559741b2f0bdSmrg output="$output_objdir/$outputname"i 559841b2f0bdSmrg # Replace all uninstalled libtool libraries with the installed ones 559941b2f0bdSmrg newdependency_libs= 560041b2f0bdSmrg for deplib in $dependency_libs; do 560141b2f0bdSmrg case $deplib in 560241b2f0bdSmrg *.la) 560341b2f0bdSmrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 560441b2f0bdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 560541b2f0bdSmrg if test -z "$libdir"; then 560641b2f0bdSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 560741b2f0bdSmrg exit $EXIT_FAILURE 560841b2f0bdSmrg fi 560941b2f0bdSmrg newdependency_libs="$newdependency_libs $libdir/$name" 561041b2f0bdSmrg ;; 561141b2f0bdSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 561241b2f0bdSmrg esac 561341b2f0bdSmrg done 561441b2f0bdSmrg dependency_libs="$newdependency_libs" 561541b2f0bdSmrg newdlfiles= 561641b2f0bdSmrg for lib in $dlfiles; do 561741b2f0bdSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 561841b2f0bdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 561941b2f0bdSmrg if test -z "$libdir"; then 562041b2f0bdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 562141b2f0bdSmrg exit $EXIT_FAILURE 562241b2f0bdSmrg fi 562341b2f0bdSmrg newdlfiles="$newdlfiles $libdir/$name" 562441b2f0bdSmrg done 562541b2f0bdSmrg dlfiles="$newdlfiles" 562641b2f0bdSmrg newdlprefiles= 562741b2f0bdSmrg for lib in $dlprefiles; do 562841b2f0bdSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 562941b2f0bdSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 563041b2f0bdSmrg if test -z "$libdir"; then 563141b2f0bdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 563241b2f0bdSmrg exit $EXIT_FAILURE 563341b2f0bdSmrg fi 563441b2f0bdSmrg newdlprefiles="$newdlprefiles $libdir/$name" 563541b2f0bdSmrg done 563641b2f0bdSmrg dlprefiles="$newdlprefiles" 563741b2f0bdSmrg else 563841b2f0bdSmrg newdlfiles= 563941b2f0bdSmrg for lib in $dlfiles; do 564041b2f0bdSmrg case $lib in 564141b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 564241b2f0bdSmrg *) abs=`pwd`"/$lib" ;; 564341b2f0bdSmrg esac 564441b2f0bdSmrg newdlfiles="$newdlfiles $abs" 564541b2f0bdSmrg done 564641b2f0bdSmrg dlfiles="$newdlfiles" 564741b2f0bdSmrg newdlprefiles= 564841b2f0bdSmrg for lib in $dlprefiles; do 564941b2f0bdSmrg case $lib in 565041b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 565141b2f0bdSmrg *) abs=`pwd`"/$lib" ;; 565241b2f0bdSmrg esac 565341b2f0bdSmrg newdlprefiles="$newdlprefiles $abs" 565441b2f0bdSmrg done 565541b2f0bdSmrg dlprefiles="$newdlprefiles" 565641b2f0bdSmrg fi 565741b2f0bdSmrg $rm $output 565841b2f0bdSmrg # place dlname in correct position for cygwin 565941b2f0bdSmrg tdlname=$dlname 566041b2f0bdSmrg case $host,$output,$installed,$module,$dlname in 566141b2f0bdSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 566241b2f0bdSmrg esac 566341b2f0bdSmrg $echo > $output "\ 566441b2f0bdSmrg# $outputname - a libtool library file 566541b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 566641b2f0bdSmrg# 566741b2f0bdSmrg# Please DO NOT delete this file! 566841b2f0bdSmrg# It is necessary for linking the library. 566941b2f0bdSmrg 567041b2f0bdSmrg# The name that we can dlopen(3). 567141b2f0bdSmrgdlname='$tdlname' 567241b2f0bdSmrg 567341b2f0bdSmrg# Names of this library. 567441b2f0bdSmrglibrary_names='$library_names' 567541b2f0bdSmrg 567641b2f0bdSmrg# The name of the static archive. 567741b2f0bdSmrgold_library='$old_library' 567841b2f0bdSmrg 567941b2f0bdSmrg# Libraries that this one depends upon. 568041b2f0bdSmrgdependency_libs='$dependency_libs' 568141b2f0bdSmrg 568241b2f0bdSmrg# Version information for $libname. 568341b2f0bdSmrgcurrent=$current 568441b2f0bdSmrgage=$age 568541b2f0bdSmrgrevision=$revision 568641b2f0bdSmrg 568741b2f0bdSmrg# Is this an already installed library? 568841b2f0bdSmrginstalled=$installed 568941b2f0bdSmrg 569041b2f0bdSmrg# Should we warn about portability when linking against -modules? 569141b2f0bdSmrgshouldnotlink=$module 569241b2f0bdSmrg 569341b2f0bdSmrg# Files to dlopen/dlpreopen 569441b2f0bdSmrgdlopen='$dlfiles' 569541b2f0bdSmrgdlpreopen='$dlprefiles' 569641b2f0bdSmrg 569741b2f0bdSmrg# Directory that this library needs to be installed in: 569841b2f0bdSmrglibdir='$install_libdir'" 569941b2f0bdSmrg if test "$installed" = no && test "$need_relink" = yes; then 570041b2f0bdSmrg $echo >> $output "\ 570141b2f0bdSmrgrelink_command=\"$relink_command\"" 570241b2f0bdSmrg fi 570341b2f0bdSmrg done 570441b2f0bdSmrg fi 570541b2f0bdSmrg 570641b2f0bdSmrg # Do a symbolic link so that the libtool archive can be found in 570741b2f0bdSmrg # LD_LIBRARY_PATH before the program is installed. 570841b2f0bdSmrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 570941b2f0bdSmrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 571041b2f0bdSmrg ;; 571141b2f0bdSmrg esac 571241b2f0bdSmrg exit $EXIT_SUCCESS 571341b2f0bdSmrg ;; 571441b2f0bdSmrg 571541b2f0bdSmrg # libtool install mode 571641b2f0bdSmrg install) 571741b2f0bdSmrg modename="$modename: install" 571841b2f0bdSmrg 571941b2f0bdSmrg # There may be an optional sh(1) argument at the beginning of 572041b2f0bdSmrg # install_prog (especially on Windows NT). 572141b2f0bdSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 572241b2f0bdSmrg # Allow the use of GNU shtool's install command. 572341b2f0bdSmrg $echo "X$nonopt" | grep shtool > /dev/null; then 572441b2f0bdSmrg # Aesthetically quote it. 572541b2f0bdSmrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 572641b2f0bdSmrg case $arg in 572741b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 572841b2f0bdSmrg arg="\"$arg\"" 572941b2f0bdSmrg ;; 573041b2f0bdSmrg esac 573141b2f0bdSmrg install_prog="$arg " 573241b2f0bdSmrg arg="$1" 573341b2f0bdSmrg shift 573441b2f0bdSmrg else 573541b2f0bdSmrg install_prog= 573641b2f0bdSmrg arg=$nonopt 573741b2f0bdSmrg fi 573841b2f0bdSmrg 573941b2f0bdSmrg # The real first argument should be the name of the installation program. 574041b2f0bdSmrg # Aesthetically quote it. 574141b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 574241b2f0bdSmrg case $arg in 574341b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 574441b2f0bdSmrg arg="\"$arg\"" 574541b2f0bdSmrg ;; 574641b2f0bdSmrg esac 574741b2f0bdSmrg install_prog="$install_prog$arg" 574841b2f0bdSmrg 574941b2f0bdSmrg # We need to accept at least all the BSD install flags. 575041b2f0bdSmrg dest= 575141b2f0bdSmrg files= 575241b2f0bdSmrg opts= 575341b2f0bdSmrg prev= 575441b2f0bdSmrg install_type= 575541b2f0bdSmrg isdir=no 575641b2f0bdSmrg stripme= 575741b2f0bdSmrg for arg 575841b2f0bdSmrg do 575941b2f0bdSmrg if test -n "$dest"; then 576041b2f0bdSmrg files="$files $dest" 576141b2f0bdSmrg dest=$arg 576241b2f0bdSmrg continue 576341b2f0bdSmrg fi 576441b2f0bdSmrg 576541b2f0bdSmrg case $arg in 576641b2f0bdSmrg -d) isdir=yes ;; 576741b2f0bdSmrg -f) 576841b2f0bdSmrg case " $install_prog " in 576941b2f0bdSmrg *[\\\ /]cp\ *) ;; 577041b2f0bdSmrg *) prev=$arg ;; 577141b2f0bdSmrg esac 577241b2f0bdSmrg ;; 577341b2f0bdSmrg -g | -m | -o) prev=$arg ;; 577441b2f0bdSmrg -s) 577541b2f0bdSmrg stripme=" -s" 577641b2f0bdSmrg continue 577741b2f0bdSmrg ;; 577841b2f0bdSmrg -*) 577941b2f0bdSmrg ;; 578041b2f0bdSmrg *) 578141b2f0bdSmrg # If the previous option needed an argument, then skip it. 578241b2f0bdSmrg if test -n "$prev"; then 578341b2f0bdSmrg prev= 578441b2f0bdSmrg else 578541b2f0bdSmrg dest=$arg 578641b2f0bdSmrg continue 578741b2f0bdSmrg fi 578841b2f0bdSmrg ;; 578941b2f0bdSmrg esac 579041b2f0bdSmrg 579141b2f0bdSmrg # Aesthetically quote the argument. 579241b2f0bdSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 579341b2f0bdSmrg case $arg in 579441b2f0bdSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 579541b2f0bdSmrg arg="\"$arg\"" 579641b2f0bdSmrg ;; 579741b2f0bdSmrg esac 579841b2f0bdSmrg install_prog="$install_prog $arg" 579941b2f0bdSmrg done 580041b2f0bdSmrg 580141b2f0bdSmrg if test -z "$install_prog"; then 580241b2f0bdSmrg $echo "$modename: you must specify an install program" 1>&2 580341b2f0bdSmrg $echo "$help" 1>&2 580441b2f0bdSmrg exit $EXIT_FAILURE 580541b2f0bdSmrg fi 580641b2f0bdSmrg 580741b2f0bdSmrg if test -n "$prev"; then 580841b2f0bdSmrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 580941b2f0bdSmrg $echo "$help" 1>&2 581041b2f0bdSmrg exit $EXIT_FAILURE 581141b2f0bdSmrg fi 581241b2f0bdSmrg 581341b2f0bdSmrg if test -z "$files"; then 581441b2f0bdSmrg if test -z "$dest"; then 581541b2f0bdSmrg $echo "$modename: no file or destination specified" 1>&2 581641b2f0bdSmrg else 581741b2f0bdSmrg $echo "$modename: you must specify a destination" 1>&2 581841b2f0bdSmrg fi 581941b2f0bdSmrg $echo "$help" 1>&2 582041b2f0bdSmrg exit $EXIT_FAILURE 582141b2f0bdSmrg fi 582241b2f0bdSmrg 582341b2f0bdSmrg # Strip any trailing slash from the destination. 582441b2f0bdSmrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 582541b2f0bdSmrg 582641b2f0bdSmrg # Check to see that the destination is a directory. 582741b2f0bdSmrg test -d "$dest" && isdir=yes 582841b2f0bdSmrg if test "$isdir" = yes; then 582941b2f0bdSmrg destdir="$dest" 583041b2f0bdSmrg destname= 583141b2f0bdSmrg else 583241b2f0bdSmrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 583341b2f0bdSmrg test "X$destdir" = "X$dest" && destdir=. 583441b2f0bdSmrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 583541b2f0bdSmrg 583641b2f0bdSmrg # Not a directory, so check to see that there is only one file specified. 583741b2f0bdSmrg set dummy $files 583841b2f0bdSmrg if test "$#" -gt 2; then 583941b2f0bdSmrg $echo "$modename: \`$dest' is not a directory" 1>&2 584041b2f0bdSmrg $echo "$help" 1>&2 584141b2f0bdSmrg exit $EXIT_FAILURE 584241b2f0bdSmrg fi 584341b2f0bdSmrg fi 584441b2f0bdSmrg case $destdir in 584541b2f0bdSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 584641b2f0bdSmrg *) 584741b2f0bdSmrg for file in $files; do 584841b2f0bdSmrg case $file in 584941b2f0bdSmrg *.lo) ;; 585041b2f0bdSmrg *) 585141b2f0bdSmrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 585241b2f0bdSmrg $echo "$help" 1>&2 585341b2f0bdSmrg exit $EXIT_FAILURE 585441b2f0bdSmrg ;; 585541b2f0bdSmrg esac 585641b2f0bdSmrg done 585741b2f0bdSmrg ;; 585841b2f0bdSmrg esac 585941b2f0bdSmrg 586041b2f0bdSmrg # This variable tells wrapper scripts just to set variables rather 586141b2f0bdSmrg # than running their programs. 586241b2f0bdSmrg libtool_install_magic="$magic" 586341b2f0bdSmrg 586441b2f0bdSmrg staticlibs= 586541b2f0bdSmrg future_libdirs= 586641b2f0bdSmrg current_libdirs= 586741b2f0bdSmrg for file in $files; do 586841b2f0bdSmrg 586941b2f0bdSmrg # Do each installation. 587041b2f0bdSmrg case $file in 587141b2f0bdSmrg *.$libext) 587241b2f0bdSmrg # Do the static libraries later. 587341b2f0bdSmrg staticlibs="$staticlibs $file" 587441b2f0bdSmrg ;; 587541b2f0bdSmrg 587641b2f0bdSmrg *.la) 587741b2f0bdSmrg # Check to see that this really is a libtool archive. 587841b2f0bdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 587941b2f0bdSmrg else 588041b2f0bdSmrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 588141b2f0bdSmrg $echo "$help" 1>&2 588241b2f0bdSmrg exit $EXIT_FAILURE 588341b2f0bdSmrg fi 588441b2f0bdSmrg 588541b2f0bdSmrg library_names= 588641b2f0bdSmrg old_library= 588741b2f0bdSmrg relink_command= 588841b2f0bdSmrg # If there is no directory component, then add one. 588941b2f0bdSmrg case $file in 589041b2f0bdSmrg */* | *\\*) . $file ;; 589141b2f0bdSmrg *) . ./$file ;; 589241b2f0bdSmrg esac 589341b2f0bdSmrg 589441b2f0bdSmrg # Add the libdir to current_libdirs if it is the destination. 589541b2f0bdSmrg if test "X$destdir" = "X$libdir"; then 589641b2f0bdSmrg case "$current_libdirs " in 589741b2f0bdSmrg *" $libdir "*) ;; 589841b2f0bdSmrg *) current_libdirs="$current_libdirs $libdir" ;; 589941b2f0bdSmrg esac 590041b2f0bdSmrg else 590141b2f0bdSmrg # Note the libdir as a future libdir. 590241b2f0bdSmrg case "$future_libdirs " in 590341b2f0bdSmrg *" $libdir "*) ;; 590441b2f0bdSmrg *) future_libdirs="$future_libdirs $libdir" ;; 590541b2f0bdSmrg esac 590641b2f0bdSmrg fi 590741b2f0bdSmrg 590841b2f0bdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 590941b2f0bdSmrg test "X$dir" = "X$file/" && dir= 591041b2f0bdSmrg dir="$dir$objdir" 591141b2f0bdSmrg 591241b2f0bdSmrg if test -n "$relink_command"; then 591341b2f0bdSmrg # Determine the prefix the user has applied to our future dir. 591441b2f0bdSmrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 591541b2f0bdSmrg 591641b2f0bdSmrg # Don't allow the user to place us outside of our expected 591741b2f0bdSmrg # location b/c this prevents finding dependent libraries that 591841b2f0bdSmrg # are installed to the same prefix. 591941b2f0bdSmrg # At present, this check doesn't affect windows .dll's that 592041b2f0bdSmrg # are installed into $libdir/../bin (currently, that works fine) 592141b2f0bdSmrg # but it's something to keep an eye on. 592241b2f0bdSmrg if test "$inst_prefix_dir" = "$destdir"; then 592341b2f0bdSmrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 592441b2f0bdSmrg exit $EXIT_FAILURE 592541b2f0bdSmrg fi 592641b2f0bdSmrg 592741b2f0bdSmrg if test -n "$inst_prefix_dir"; then 592841b2f0bdSmrg # Stick the inst_prefix_dir data into the link command. 592941b2f0bdSmrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 593041b2f0bdSmrg else 593141b2f0bdSmrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 593241b2f0bdSmrg fi 593341b2f0bdSmrg 593441b2f0bdSmrg $echo "$modename: warning: relinking \`$file'" 1>&2 593541b2f0bdSmrg $show "$relink_command" 593641b2f0bdSmrg if $run eval "$relink_command"; then : 593741b2f0bdSmrg else 593841b2f0bdSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 593941b2f0bdSmrg exit $EXIT_FAILURE 594041b2f0bdSmrg fi 594141b2f0bdSmrg fi 594241b2f0bdSmrg 594341b2f0bdSmrg # See the names of the shared library. 594441b2f0bdSmrg set dummy $library_names 594541b2f0bdSmrg if test -n "$2"; then 594641b2f0bdSmrg realname="$2" 594741b2f0bdSmrg shift 594841b2f0bdSmrg shift 594941b2f0bdSmrg 595041b2f0bdSmrg srcname="$realname" 595141b2f0bdSmrg test -n "$relink_command" && srcname="$realname"T 595241b2f0bdSmrg 595341b2f0bdSmrg # Install the shared library and build the symlinks. 595441b2f0bdSmrg $show "$install_prog $dir/$srcname $destdir/$realname" 595541b2f0bdSmrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 595641b2f0bdSmrg if test -n "$stripme" && test -n "$striplib"; then 595741b2f0bdSmrg $show "$striplib $destdir/$realname" 595841b2f0bdSmrg $run eval "$striplib $destdir/$realname" || exit $? 595941b2f0bdSmrg fi 596041b2f0bdSmrg 596141b2f0bdSmrg if test "$#" -gt 0; then 596241b2f0bdSmrg # Delete the old symlinks, and create new ones. 596341b2f0bdSmrg # Try `ln -sf' first, because the `ln' binary might depend on 596441b2f0bdSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 596541b2f0bdSmrg # so we also need to try rm && ln -s. 596641b2f0bdSmrg for linkname 596741b2f0bdSmrg do 596841b2f0bdSmrg if test "$linkname" != "$realname"; then 596941b2f0bdSmrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 597041b2f0bdSmrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 597141b2f0bdSmrg fi 597241b2f0bdSmrg done 597341b2f0bdSmrg fi 597441b2f0bdSmrg 597541b2f0bdSmrg # Do each command in the postinstall commands. 597641b2f0bdSmrg lib="$destdir/$realname" 597741b2f0bdSmrg cmds=$postinstall_cmds 597841b2f0bdSmrg save_ifs="$IFS"; IFS='~' 597941b2f0bdSmrg for cmd in $cmds; do 598041b2f0bdSmrg IFS="$save_ifs" 598141b2f0bdSmrg eval cmd=\"$cmd\" 598241b2f0bdSmrg $show "$cmd" 598341b2f0bdSmrg $run eval "$cmd" || { 598441b2f0bdSmrg lt_exit=$? 598541b2f0bdSmrg 598641b2f0bdSmrg # Restore the uninstalled library and exit 598741b2f0bdSmrg if test "$mode" = relink; then 598841b2f0bdSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 598941b2f0bdSmrg fi 599041b2f0bdSmrg 599141b2f0bdSmrg exit $lt_exit 599241b2f0bdSmrg } 599341b2f0bdSmrg done 599441b2f0bdSmrg IFS="$save_ifs" 599541b2f0bdSmrg fi 599641b2f0bdSmrg 599741b2f0bdSmrg # Install the pseudo-library for information purposes. 599841b2f0bdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 599941b2f0bdSmrg instname="$dir/$name"i 600041b2f0bdSmrg $show "$install_prog $instname $destdir/$name" 600141b2f0bdSmrg $run eval "$install_prog $instname $destdir/$name" || exit $? 600241b2f0bdSmrg 600341b2f0bdSmrg # Maybe install the static library, too. 600441b2f0bdSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 600541b2f0bdSmrg ;; 600641b2f0bdSmrg 600741b2f0bdSmrg *.lo) 600841b2f0bdSmrg # Install (i.e. copy) a libtool object. 600941b2f0bdSmrg 601041b2f0bdSmrg # Figure out destination file name, if it wasn't already specified. 601141b2f0bdSmrg if test -n "$destname"; then 601241b2f0bdSmrg destfile="$destdir/$destname" 601341b2f0bdSmrg else 601441b2f0bdSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 601541b2f0bdSmrg destfile="$destdir/$destfile" 601641b2f0bdSmrg fi 601741b2f0bdSmrg 601841b2f0bdSmrg # Deduce the name of the destination old-style object file. 601941b2f0bdSmrg case $destfile in 602041b2f0bdSmrg *.lo) 602141b2f0bdSmrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 602241b2f0bdSmrg ;; 602341b2f0bdSmrg *.$objext) 602441b2f0bdSmrg staticdest="$destfile" 602541b2f0bdSmrg destfile= 602641b2f0bdSmrg ;; 602741b2f0bdSmrg *) 602841b2f0bdSmrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 602941b2f0bdSmrg $echo "$help" 1>&2 603041b2f0bdSmrg exit $EXIT_FAILURE 603141b2f0bdSmrg ;; 603241b2f0bdSmrg esac 603341b2f0bdSmrg 603441b2f0bdSmrg # Install the libtool object if requested. 603541b2f0bdSmrg if test -n "$destfile"; then 603641b2f0bdSmrg $show "$install_prog $file $destfile" 603741b2f0bdSmrg $run eval "$install_prog $file $destfile" || exit $? 603841b2f0bdSmrg fi 603941b2f0bdSmrg 604041b2f0bdSmrg # Install the old object if enabled. 604141b2f0bdSmrg if test "$build_old_libs" = yes; then 604241b2f0bdSmrg # Deduce the name of the old-style object file. 604341b2f0bdSmrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 604441b2f0bdSmrg 604541b2f0bdSmrg $show "$install_prog $staticobj $staticdest" 604641b2f0bdSmrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 604741b2f0bdSmrg fi 604841b2f0bdSmrg exit $EXIT_SUCCESS 604941b2f0bdSmrg ;; 605041b2f0bdSmrg 605141b2f0bdSmrg *) 605241b2f0bdSmrg # Figure out destination file name, if it wasn't already specified. 605341b2f0bdSmrg if test -n "$destname"; then 605441b2f0bdSmrg destfile="$destdir/$destname" 605541b2f0bdSmrg else 605641b2f0bdSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 605741b2f0bdSmrg destfile="$destdir/$destfile" 605841b2f0bdSmrg fi 605941b2f0bdSmrg 606041b2f0bdSmrg # If the file is missing, and there is a .exe on the end, strip it 606141b2f0bdSmrg # because it is most likely a libtool script we actually want to 606241b2f0bdSmrg # install 606341b2f0bdSmrg stripped_ext="" 606441b2f0bdSmrg case $file in 606541b2f0bdSmrg *.exe) 606641b2f0bdSmrg if test ! -f "$file"; then 606741b2f0bdSmrg file=`$echo $file|${SED} 's,.exe$,,'` 606841b2f0bdSmrg stripped_ext=".exe" 606941b2f0bdSmrg fi 607041b2f0bdSmrg ;; 607141b2f0bdSmrg esac 607241b2f0bdSmrg 607341b2f0bdSmrg # Do a test to see if this is really a libtool program. 607441b2f0bdSmrg case $host in 607541b2f0bdSmrg *cygwin*|*mingw*) 607641b2f0bdSmrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 607741b2f0bdSmrg ;; 607841b2f0bdSmrg *) 607941b2f0bdSmrg wrapper=$file 608041b2f0bdSmrg ;; 608141b2f0bdSmrg esac 608241b2f0bdSmrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 608341b2f0bdSmrg notinst_deplibs= 608441b2f0bdSmrg relink_command= 608541b2f0bdSmrg 608641b2f0bdSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 608741b2f0bdSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 608841b2f0bdSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 608941b2f0bdSmrg # `FILE.' does not work on cygwin managed mounts. 609041b2f0bdSmrg # 609141b2f0bdSmrg # If there is no directory component, then add one. 609241b2f0bdSmrg case $wrapper in 609341b2f0bdSmrg */* | *\\*) . ${wrapper} ;; 609441b2f0bdSmrg *) . ./${wrapper} ;; 609541b2f0bdSmrg esac 609641b2f0bdSmrg 609741b2f0bdSmrg # Check the variables that should have been set. 609841b2f0bdSmrg if test -z "$notinst_deplibs"; then 609941b2f0bdSmrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 610041b2f0bdSmrg exit $EXIT_FAILURE 610141b2f0bdSmrg fi 610241b2f0bdSmrg 610341b2f0bdSmrg finalize=yes 610441b2f0bdSmrg for lib in $notinst_deplibs; do 610541b2f0bdSmrg # Check to see that each library is installed. 610641b2f0bdSmrg libdir= 610741b2f0bdSmrg if test -f "$lib"; then 610841b2f0bdSmrg # If there is no directory component, then add one. 610941b2f0bdSmrg case $lib in 611041b2f0bdSmrg */* | *\\*) . $lib ;; 611141b2f0bdSmrg *) . ./$lib ;; 611241b2f0bdSmrg esac 611341b2f0bdSmrg fi 611441b2f0bdSmrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 611541b2f0bdSmrg if test -n "$libdir" && test ! -f "$libfile"; then 611641b2f0bdSmrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 611741b2f0bdSmrg finalize=no 611841b2f0bdSmrg fi 611941b2f0bdSmrg done 612041b2f0bdSmrg 612141b2f0bdSmrg relink_command= 612241b2f0bdSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 612341b2f0bdSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 612441b2f0bdSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 612541b2f0bdSmrg # `FILE.' does not work on cygwin managed mounts. 612641b2f0bdSmrg # 612741b2f0bdSmrg # If there is no directory component, then add one. 612841b2f0bdSmrg case $wrapper in 612941b2f0bdSmrg */* | *\\*) . ${wrapper} ;; 613041b2f0bdSmrg *) . ./${wrapper} ;; 613141b2f0bdSmrg esac 613241b2f0bdSmrg 613341b2f0bdSmrg outputname= 613441b2f0bdSmrg if test "$fast_install" = no && test -n "$relink_command"; then 613541b2f0bdSmrg if test "$finalize" = yes && test -z "$run"; then 613641b2f0bdSmrg tmpdir=`func_mktempdir` 613741b2f0bdSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 613841b2f0bdSmrg outputname="$tmpdir/$file" 613941b2f0bdSmrg # Replace the output file specification. 614041b2f0bdSmrg relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 614141b2f0bdSmrg 614241b2f0bdSmrg $show "$relink_command" 614341b2f0bdSmrg if $run eval "$relink_command"; then : 614441b2f0bdSmrg else 614541b2f0bdSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 614641b2f0bdSmrg ${rm}r "$tmpdir" 614741b2f0bdSmrg continue 614841b2f0bdSmrg fi 614941b2f0bdSmrg file="$outputname" 615041b2f0bdSmrg else 615141b2f0bdSmrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 615241b2f0bdSmrg fi 615341b2f0bdSmrg else 615441b2f0bdSmrg # Install the binary that we compiled earlier. 615541b2f0bdSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 615641b2f0bdSmrg fi 615741b2f0bdSmrg fi 615841b2f0bdSmrg 615941b2f0bdSmrg # remove .exe since cygwin /usr/bin/install will append another 616041b2f0bdSmrg # one anyway 616141b2f0bdSmrg case $install_prog,$host in 616241b2f0bdSmrg */usr/bin/install*,*cygwin*) 616341b2f0bdSmrg case $file:$destfile in 616441b2f0bdSmrg *.exe:*.exe) 616541b2f0bdSmrg # this is ok 616641b2f0bdSmrg ;; 616741b2f0bdSmrg *.exe:*) 616841b2f0bdSmrg destfile=$destfile.exe 616941b2f0bdSmrg ;; 617041b2f0bdSmrg *:*.exe) 617141b2f0bdSmrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 617241b2f0bdSmrg ;; 617341b2f0bdSmrg esac 617441b2f0bdSmrg ;; 617541b2f0bdSmrg esac 617641b2f0bdSmrg $show "$install_prog$stripme $file $destfile" 617741b2f0bdSmrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 617841b2f0bdSmrg test -n "$outputname" && ${rm}r "$tmpdir" 617941b2f0bdSmrg ;; 618041b2f0bdSmrg esac 618141b2f0bdSmrg done 618241b2f0bdSmrg 618341b2f0bdSmrg for file in $staticlibs; do 618441b2f0bdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 618541b2f0bdSmrg 618641b2f0bdSmrg # Set up the ranlib parameters. 618741b2f0bdSmrg oldlib="$destdir/$name" 618841b2f0bdSmrg 618941b2f0bdSmrg $show "$install_prog $file $oldlib" 619041b2f0bdSmrg $run eval "$install_prog \$file \$oldlib" || exit $? 619141b2f0bdSmrg 619241b2f0bdSmrg if test -n "$stripme" && test -n "$old_striplib"; then 619341b2f0bdSmrg $show "$old_striplib $oldlib" 619441b2f0bdSmrg $run eval "$old_striplib $oldlib" || exit $? 619541b2f0bdSmrg fi 619641b2f0bdSmrg 619741b2f0bdSmrg # Do each command in the postinstall commands. 619841b2f0bdSmrg cmds=$old_postinstall_cmds 619941b2f0bdSmrg save_ifs="$IFS"; IFS='~' 620041b2f0bdSmrg for cmd in $cmds; do 620141b2f0bdSmrg IFS="$save_ifs" 620241b2f0bdSmrg eval cmd=\"$cmd\" 620341b2f0bdSmrg $show "$cmd" 620441b2f0bdSmrg $run eval "$cmd" || exit $? 620541b2f0bdSmrg done 620641b2f0bdSmrg IFS="$save_ifs" 620741b2f0bdSmrg done 620841b2f0bdSmrg 620941b2f0bdSmrg if test -n "$future_libdirs"; then 621041b2f0bdSmrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 621141b2f0bdSmrg fi 621241b2f0bdSmrg 621341b2f0bdSmrg if test -n "$current_libdirs"; then 621441b2f0bdSmrg # Maybe just do a dry run. 621541b2f0bdSmrg test -n "$run" && current_libdirs=" -n$current_libdirs" 621641b2f0bdSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 621741b2f0bdSmrg else 621841b2f0bdSmrg exit $EXIT_SUCCESS 621941b2f0bdSmrg fi 622041b2f0bdSmrg ;; 622141b2f0bdSmrg 622241b2f0bdSmrg # libtool finish mode 622341b2f0bdSmrg finish) 622441b2f0bdSmrg modename="$modename: finish" 622541b2f0bdSmrg libdirs="$nonopt" 622641b2f0bdSmrg admincmds= 622741b2f0bdSmrg 622841b2f0bdSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 622941b2f0bdSmrg for dir 623041b2f0bdSmrg do 623141b2f0bdSmrg libdirs="$libdirs $dir" 623241b2f0bdSmrg done 623341b2f0bdSmrg 623441b2f0bdSmrg for libdir in $libdirs; do 623541b2f0bdSmrg if test -n "$finish_cmds"; then 623641b2f0bdSmrg # Do each command in the finish commands. 623741b2f0bdSmrg cmds=$finish_cmds 623841b2f0bdSmrg save_ifs="$IFS"; IFS='~' 623941b2f0bdSmrg for cmd in $cmds; do 624041b2f0bdSmrg IFS="$save_ifs" 624141b2f0bdSmrg eval cmd=\"$cmd\" 624241b2f0bdSmrg $show "$cmd" 624341b2f0bdSmrg $run eval "$cmd" || admincmds="$admincmds 624441b2f0bdSmrg $cmd" 624541b2f0bdSmrg done 624641b2f0bdSmrg IFS="$save_ifs" 624741b2f0bdSmrg fi 624841b2f0bdSmrg if test -n "$finish_eval"; then 624941b2f0bdSmrg # Do the single finish_eval. 625041b2f0bdSmrg eval cmds=\"$finish_eval\" 625141b2f0bdSmrg $run eval "$cmds" || admincmds="$admincmds 625241b2f0bdSmrg $cmds" 625341b2f0bdSmrg fi 625441b2f0bdSmrg done 625541b2f0bdSmrg fi 625641b2f0bdSmrg 625741b2f0bdSmrg # Exit here if they wanted silent mode. 625841b2f0bdSmrg test "$show" = : && exit $EXIT_SUCCESS 625941b2f0bdSmrg 626041b2f0bdSmrg $echo "X----------------------------------------------------------------------" | $Xsed 626141b2f0bdSmrg $echo "Libraries have been installed in:" 626241b2f0bdSmrg for libdir in $libdirs; do 626341b2f0bdSmrg $echo " $libdir" 626441b2f0bdSmrg done 626541b2f0bdSmrg $echo 626641b2f0bdSmrg $echo "If you ever happen to want to link against installed libraries" 626741b2f0bdSmrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 626841b2f0bdSmrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 626941b2f0bdSmrg $echo "flag during linking and do at least one of the following:" 627041b2f0bdSmrg if test -n "$shlibpath_var"; then 627141b2f0bdSmrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 627241b2f0bdSmrg $echo " during execution" 627341b2f0bdSmrg fi 627441b2f0bdSmrg if test -n "$runpath_var"; then 627541b2f0bdSmrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 627641b2f0bdSmrg $echo " during linking" 627741b2f0bdSmrg fi 627841b2f0bdSmrg if test -n "$hardcode_libdir_flag_spec"; then 627941b2f0bdSmrg libdir=LIBDIR 628041b2f0bdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 628141b2f0bdSmrg 628241b2f0bdSmrg $echo " - use the \`$flag' linker flag" 628341b2f0bdSmrg fi 628441b2f0bdSmrg if test -n "$admincmds"; then 628541b2f0bdSmrg $echo " - have your system administrator run these commands:$admincmds" 628641b2f0bdSmrg fi 628741b2f0bdSmrg if test -f /etc/ld.so.conf; then 628841b2f0bdSmrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 628941b2f0bdSmrg fi 629041b2f0bdSmrg $echo 629141b2f0bdSmrg $echo "See any operating system documentation about shared libraries for" 629241b2f0bdSmrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 629341b2f0bdSmrg $echo "X----------------------------------------------------------------------" | $Xsed 629441b2f0bdSmrg exit $EXIT_SUCCESS 629541b2f0bdSmrg ;; 629641b2f0bdSmrg 629741b2f0bdSmrg # libtool execute mode 629841b2f0bdSmrg execute) 629941b2f0bdSmrg modename="$modename: execute" 630041b2f0bdSmrg 630141b2f0bdSmrg # The first argument is the command name. 630241b2f0bdSmrg cmd="$nonopt" 630341b2f0bdSmrg if test -z "$cmd"; then 630441b2f0bdSmrg $echo "$modename: you must specify a COMMAND" 1>&2 630541b2f0bdSmrg $echo "$help" 630641b2f0bdSmrg exit $EXIT_FAILURE 630741b2f0bdSmrg fi 630841b2f0bdSmrg 630941b2f0bdSmrg # Handle -dlopen flags immediately. 631041b2f0bdSmrg for file in $execute_dlfiles; do 631141b2f0bdSmrg if test ! -f "$file"; then 631241b2f0bdSmrg $echo "$modename: \`$file' is not a file" 1>&2 631341b2f0bdSmrg $echo "$help" 1>&2 631441b2f0bdSmrg exit $EXIT_FAILURE 631541b2f0bdSmrg fi 631641b2f0bdSmrg 631741b2f0bdSmrg dir= 631841b2f0bdSmrg case $file in 631941b2f0bdSmrg *.la) 632041b2f0bdSmrg # Check to see that this really is a libtool archive. 632141b2f0bdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 632241b2f0bdSmrg else 632341b2f0bdSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 632441b2f0bdSmrg $echo "$help" 1>&2 632541b2f0bdSmrg exit $EXIT_FAILURE 632641b2f0bdSmrg fi 632741b2f0bdSmrg 632841b2f0bdSmrg # Read the libtool library. 632941b2f0bdSmrg dlname= 633041b2f0bdSmrg library_names= 633141b2f0bdSmrg 633241b2f0bdSmrg # If there is no directory component, then add one. 633341b2f0bdSmrg case $file in 633441b2f0bdSmrg */* | *\\*) . $file ;; 633541b2f0bdSmrg *) . ./$file ;; 633641b2f0bdSmrg esac 633741b2f0bdSmrg 633841b2f0bdSmrg # Skip this library if it cannot be dlopened. 633941b2f0bdSmrg if test -z "$dlname"; then 634041b2f0bdSmrg # Warn if it was a shared library. 634141b2f0bdSmrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 634241b2f0bdSmrg continue 634341b2f0bdSmrg fi 634441b2f0bdSmrg 634541b2f0bdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 634641b2f0bdSmrg test "X$dir" = "X$file" && dir=. 634741b2f0bdSmrg 634841b2f0bdSmrg if test -f "$dir/$objdir/$dlname"; then 634941b2f0bdSmrg dir="$dir/$objdir" 635041b2f0bdSmrg else 635141b2f0bdSmrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 635241b2f0bdSmrg exit $EXIT_FAILURE 635341b2f0bdSmrg fi 635441b2f0bdSmrg ;; 635541b2f0bdSmrg 635641b2f0bdSmrg *.lo) 635741b2f0bdSmrg # Just add the directory containing the .lo file. 635841b2f0bdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 635941b2f0bdSmrg test "X$dir" = "X$file" && dir=. 636041b2f0bdSmrg ;; 636141b2f0bdSmrg 636241b2f0bdSmrg *) 636341b2f0bdSmrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 636441b2f0bdSmrg continue 636541b2f0bdSmrg ;; 636641b2f0bdSmrg esac 636741b2f0bdSmrg 636841b2f0bdSmrg # Get the absolute pathname. 636941b2f0bdSmrg absdir=`cd "$dir" && pwd` 637041b2f0bdSmrg test -n "$absdir" && dir="$absdir" 637141b2f0bdSmrg 637241b2f0bdSmrg # Now add the directory to shlibpath_var. 637341b2f0bdSmrg if eval "test -z \"\$$shlibpath_var\""; then 637441b2f0bdSmrg eval "$shlibpath_var=\"\$dir\"" 637541b2f0bdSmrg else 637641b2f0bdSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 637741b2f0bdSmrg fi 637841b2f0bdSmrg done 637941b2f0bdSmrg 638041b2f0bdSmrg # This variable tells wrapper scripts just to set shlibpath_var 638141b2f0bdSmrg # rather than running their programs. 638241b2f0bdSmrg libtool_execute_magic="$magic" 638341b2f0bdSmrg 638441b2f0bdSmrg # Check if any of the arguments is a wrapper script. 638541b2f0bdSmrg args= 638641b2f0bdSmrg for file 638741b2f0bdSmrg do 638841b2f0bdSmrg case $file in 638941b2f0bdSmrg -*) ;; 639041b2f0bdSmrg *) 639141b2f0bdSmrg # Do a test to see if this is really a libtool program. 639241b2f0bdSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 639341b2f0bdSmrg # If there is no directory component, then add one. 639441b2f0bdSmrg case $file in 639541b2f0bdSmrg */* | *\\*) . $file ;; 639641b2f0bdSmrg *) . ./$file ;; 639741b2f0bdSmrg esac 639841b2f0bdSmrg 639941b2f0bdSmrg # Transform arg to wrapped name. 640041b2f0bdSmrg file="$progdir/$program" 640141b2f0bdSmrg fi 640241b2f0bdSmrg ;; 640341b2f0bdSmrg esac 640441b2f0bdSmrg # Quote arguments (to preserve shell metacharacters). 640541b2f0bdSmrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 640641b2f0bdSmrg args="$args \"$file\"" 640741b2f0bdSmrg done 640841b2f0bdSmrg 640941b2f0bdSmrg if test -z "$run"; then 641041b2f0bdSmrg if test -n "$shlibpath_var"; then 641141b2f0bdSmrg # Export the shlibpath_var. 641241b2f0bdSmrg eval "export $shlibpath_var" 641341b2f0bdSmrg fi 641441b2f0bdSmrg 641541b2f0bdSmrg # Restore saved environment variables 641641b2f0bdSmrg if test "${save_LC_ALL+set}" = set; then 641741b2f0bdSmrg LC_ALL="$save_LC_ALL"; export LC_ALL 641841b2f0bdSmrg fi 641941b2f0bdSmrg if test "${save_LANG+set}" = set; then 642041b2f0bdSmrg LANG="$save_LANG"; export LANG 642141b2f0bdSmrg fi 642241b2f0bdSmrg 642341b2f0bdSmrg # Now prepare to actually exec the command. 642441b2f0bdSmrg exec_cmd="\$cmd$args" 642541b2f0bdSmrg else 642641b2f0bdSmrg # Display what would be done. 642741b2f0bdSmrg if test -n "$shlibpath_var"; then 642841b2f0bdSmrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 642941b2f0bdSmrg $echo "export $shlibpath_var" 643041b2f0bdSmrg fi 643141b2f0bdSmrg $echo "$cmd$args" 643241b2f0bdSmrg exit $EXIT_SUCCESS 643341b2f0bdSmrg fi 643441b2f0bdSmrg ;; 643541b2f0bdSmrg 643641b2f0bdSmrg # libtool clean and uninstall mode 643741b2f0bdSmrg clean | uninstall) 643841b2f0bdSmrg modename="$modename: $mode" 643941b2f0bdSmrg rm="$nonopt" 644041b2f0bdSmrg files= 644141b2f0bdSmrg rmforce= 644241b2f0bdSmrg exit_status=0 644341b2f0bdSmrg 644441b2f0bdSmrg # This variable tells wrapper scripts just to set variables rather 644541b2f0bdSmrg # than running their programs. 644641b2f0bdSmrg libtool_install_magic="$magic" 644741b2f0bdSmrg 644841b2f0bdSmrg for arg 644941b2f0bdSmrg do 645041b2f0bdSmrg case $arg in 645141b2f0bdSmrg -f) rm="$rm $arg"; rmforce=yes ;; 645241b2f0bdSmrg -*) rm="$rm $arg" ;; 645341b2f0bdSmrg *) files="$files $arg" ;; 645441b2f0bdSmrg esac 645541b2f0bdSmrg done 645641b2f0bdSmrg 645741b2f0bdSmrg if test -z "$rm"; then 645841b2f0bdSmrg $echo "$modename: you must specify an RM program" 1>&2 645941b2f0bdSmrg $echo "$help" 1>&2 646041b2f0bdSmrg exit $EXIT_FAILURE 646141b2f0bdSmrg fi 646241b2f0bdSmrg 646341b2f0bdSmrg rmdirs= 646441b2f0bdSmrg 646541b2f0bdSmrg origobjdir="$objdir" 646641b2f0bdSmrg for file in $files; do 646741b2f0bdSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 646841b2f0bdSmrg if test "X$dir" = "X$file"; then 646941b2f0bdSmrg dir=. 647041b2f0bdSmrg objdir="$origobjdir" 647141b2f0bdSmrg else 647241b2f0bdSmrg objdir="$dir/$origobjdir" 647341b2f0bdSmrg fi 647441b2f0bdSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 647541b2f0bdSmrg test "$mode" = uninstall && objdir="$dir" 647641b2f0bdSmrg 647741b2f0bdSmrg # Remember objdir for removal later, being careful to avoid duplicates 647841b2f0bdSmrg if test "$mode" = clean; then 647941b2f0bdSmrg case " $rmdirs " in 648041b2f0bdSmrg *" $objdir "*) ;; 648141b2f0bdSmrg *) rmdirs="$rmdirs $objdir" ;; 648241b2f0bdSmrg esac 648341b2f0bdSmrg fi 648441b2f0bdSmrg 648541b2f0bdSmrg # Don't error if the file doesn't exist and rm -f was used. 648641b2f0bdSmrg if (test -L "$file") >/dev/null 2>&1 \ 648741b2f0bdSmrg || (test -h "$file") >/dev/null 2>&1 \ 648841b2f0bdSmrg || test -f "$file"; then 648941b2f0bdSmrg : 649041b2f0bdSmrg elif test -d "$file"; then 649141b2f0bdSmrg exit_status=1 649241b2f0bdSmrg continue 649341b2f0bdSmrg elif test "$rmforce" = yes; then 649441b2f0bdSmrg continue 649541b2f0bdSmrg fi 649641b2f0bdSmrg 649741b2f0bdSmrg rmfiles="$file" 649841b2f0bdSmrg 649941b2f0bdSmrg case $name in 650041b2f0bdSmrg *.la) 650141b2f0bdSmrg # Possibly a libtool archive, so verify it. 650241b2f0bdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 650341b2f0bdSmrg . $dir/$name 650441b2f0bdSmrg 650541b2f0bdSmrg # Delete the libtool libraries and symlinks. 650641b2f0bdSmrg for n in $library_names; do 650741b2f0bdSmrg rmfiles="$rmfiles $objdir/$n" 650841b2f0bdSmrg done 650941b2f0bdSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 651041b2f0bdSmrg 651141b2f0bdSmrg case "$mode" in 651241b2f0bdSmrg clean) 651341b2f0bdSmrg case " $library_names " in 651441b2f0bdSmrg # " " in the beginning catches empty $dlname 651541b2f0bdSmrg *" $dlname "*) ;; 651641b2f0bdSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 651741b2f0bdSmrg esac 651841b2f0bdSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 651941b2f0bdSmrg ;; 652041b2f0bdSmrg uninstall) 652141b2f0bdSmrg if test -n "$library_names"; then 652241b2f0bdSmrg # Do each command in the postuninstall commands. 652341b2f0bdSmrg cmds=$postuninstall_cmds 652441b2f0bdSmrg save_ifs="$IFS"; IFS='~' 652541b2f0bdSmrg for cmd in $cmds; do 652641b2f0bdSmrg IFS="$save_ifs" 652741b2f0bdSmrg eval cmd=\"$cmd\" 652841b2f0bdSmrg $show "$cmd" 652941b2f0bdSmrg $run eval "$cmd" 653041b2f0bdSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 653141b2f0bdSmrg exit_status=1 653241b2f0bdSmrg fi 653341b2f0bdSmrg done 653441b2f0bdSmrg IFS="$save_ifs" 653541b2f0bdSmrg fi 653641b2f0bdSmrg 653741b2f0bdSmrg if test -n "$old_library"; then 653841b2f0bdSmrg # Do each command in the old_postuninstall commands. 653941b2f0bdSmrg cmds=$old_postuninstall_cmds 654041b2f0bdSmrg save_ifs="$IFS"; IFS='~' 654141b2f0bdSmrg for cmd in $cmds; do 654241b2f0bdSmrg IFS="$save_ifs" 654341b2f0bdSmrg eval cmd=\"$cmd\" 654441b2f0bdSmrg $show "$cmd" 654541b2f0bdSmrg $run eval "$cmd" 654641b2f0bdSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 654741b2f0bdSmrg exit_status=1 654841b2f0bdSmrg fi 654941b2f0bdSmrg done 655041b2f0bdSmrg IFS="$save_ifs" 655141b2f0bdSmrg fi 655241b2f0bdSmrg # FIXME: should reinstall the best remaining shared library. 655341b2f0bdSmrg ;; 655441b2f0bdSmrg esac 655541b2f0bdSmrg fi 655641b2f0bdSmrg ;; 655741b2f0bdSmrg 655841b2f0bdSmrg *.lo) 655941b2f0bdSmrg # Possibly a libtool object, so verify it. 656041b2f0bdSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 656141b2f0bdSmrg 656241b2f0bdSmrg # Read the .lo file 656341b2f0bdSmrg . $dir/$name 656441b2f0bdSmrg 656541b2f0bdSmrg # Add PIC object to the list of files to remove. 656641b2f0bdSmrg if test -n "$pic_object" \ 656741b2f0bdSmrg && test "$pic_object" != none; then 656841b2f0bdSmrg rmfiles="$rmfiles $dir/$pic_object" 656941b2f0bdSmrg fi 657041b2f0bdSmrg 657141b2f0bdSmrg # Add non-PIC object to the list of files to remove. 657241b2f0bdSmrg if test -n "$non_pic_object" \ 657341b2f0bdSmrg && test "$non_pic_object" != none; then 657441b2f0bdSmrg rmfiles="$rmfiles $dir/$non_pic_object" 657541b2f0bdSmrg fi 657641b2f0bdSmrg fi 657741b2f0bdSmrg ;; 657841b2f0bdSmrg 657941b2f0bdSmrg *) 658041b2f0bdSmrg if test "$mode" = clean ; then 658141b2f0bdSmrg noexename=$name 658241b2f0bdSmrg case $file in 658341b2f0bdSmrg *.exe) 658441b2f0bdSmrg file=`$echo $file|${SED} 's,.exe$,,'` 658541b2f0bdSmrg noexename=`$echo $name|${SED} 's,.exe$,,'` 658641b2f0bdSmrg # $file with .exe has already been added to rmfiles, 658741b2f0bdSmrg # add $file without .exe 658841b2f0bdSmrg rmfiles="$rmfiles $file" 658941b2f0bdSmrg ;; 659041b2f0bdSmrg esac 659141b2f0bdSmrg # Do a test to see if this is a libtool program. 659241b2f0bdSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 659341b2f0bdSmrg relink_command= 659441b2f0bdSmrg . $dir/$noexename 659541b2f0bdSmrg 659641b2f0bdSmrg # note $name still contains .exe if it was in $file originally 659741b2f0bdSmrg # as does the version of $file that was added into $rmfiles 659841b2f0bdSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 659941b2f0bdSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 660041b2f0bdSmrg rmfiles="$rmfiles $objdir/lt-$name" 660141b2f0bdSmrg fi 660241b2f0bdSmrg if test "X$noexename" != "X$name" ; then 660341b2f0bdSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 660441b2f0bdSmrg fi 660541b2f0bdSmrg fi 660641b2f0bdSmrg fi 660741b2f0bdSmrg ;; 660841b2f0bdSmrg esac 660941b2f0bdSmrg $show "$rm $rmfiles" 661041b2f0bdSmrg $run $rm $rmfiles || exit_status=1 661141b2f0bdSmrg done 661241b2f0bdSmrg objdir="$origobjdir" 661341b2f0bdSmrg 661441b2f0bdSmrg # Try to remove the ${objdir}s in the directories where we deleted files 661541b2f0bdSmrg for dir in $rmdirs; do 661641b2f0bdSmrg if test -d "$dir"; then 661741b2f0bdSmrg $show "rmdir $dir" 661841b2f0bdSmrg $run rmdir $dir >/dev/null 2>&1 661941b2f0bdSmrg fi 662041b2f0bdSmrg done 662141b2f0bdSmrg 662241b2f0bdSmrg exit $exit_status 662341b2f0bdSmrg ;; 662441b2f0bdSmrg 662541b2f0bdSmrg "") 662641b2f0bdSmrg $echo "$modename: you must specify a MODE" 1>&2 662741b2f0bdSmrg $echo "$generic_help" 1>&2 662841b2f0bdSmrg exit $EXIT_FAILURE 662941b2f0bdSmrg ;; 663041b2f0bdSmrg esac 663141b2f0bdSmrg 663241b2f0bdSmrg if test -z "$exec_cmd"; then 663341b2f0bdSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 663441b2f0bdSmrg $echo "$generic_help" 1>&2 663541b2f0bdSmrg exit $EXIT_FAILURE 663641b2f0bdSmrg fi 663741b2f0bdSmrgfi # test -z "$show_help" 663841b2f0bdSmrg 663941b2f0bdSmrgif test -n "$exec_cmd"; then 664041b2f0bdSmrg eval exec $exec_cmd 664141b2f0bdSmrg exit $EXIT_FAILURE 664241b2f0bdSmrgfi 664341b2f0bdSmrg 664441b2f0bdSmrg# We need to display help for each of the modes. 664541b2f0bdSmrgcase $mode in 664641b2f0bdSmrg"") $echo \ 664741b2f0bdSmrg"Usage: $modename [OPTION]... [MODE-ARG]... 664841b2f0bdSmrg 664941b2f0bdSmrgProvide generalized library-building support services. 665041b2f0bdSmrg 665141b2f0bdSmrg --config show all configuration variables 665241b2f0bdSmrg --debug enable verbose shell tracing 665341b2f0bdSmrg-n, --dry-run display commands without modifying any files 665441b2f0bdSmrg --features display basic configuration information and exit 665541b2f0bdSmrg --finish same as \`--mode=finish' 665641b2f0bdSmrg --help display this help message and exit 665741b2f0bdSmrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 665841b2f0bdSmrg --quiet same as \`--silent' 665941b2f0bdSmrg --silent don't print informational messages 666041b2f0bdSmrg --tag=TAG use configuration variables from tag TAG 666141b2f0bdSmrg --version print version information 666241b2f0bdSmrg 666341b2f0bdSmrgMODE must be one of the following: 666441b2f0bdSmrg 666541b2f0bdSmrg clean remove files from the build directory 666641b2f0bdSmrg compile compile a source file into a libtool object 666741b2f0bdSmrg execute automatically set library path, then run a program 666841b2f0bdSmrg finish complete the installation of libtool libraries 666941b2f0bdSmrg install install libraries or executables 667041b2f0bdSmrg link create a library or an executable 667141b2f0bdSmrg uninstall remove libraries from an installed directory 667241b2f0bdSmrg 667341b2f0bdSmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 667441b2f0bdSmrga more detailed description of MODE. 667541b2f0bdSmrg 667641b2f0bdSmrgReport bugs to <bug-libtool@gnu.org>." 667741b2f0bdSmrg exit $EXIT_SUCCESS 667841b2f0bdSmrg ;; 667941b2f0bdSmrg 668041b2f0bdSmrgclean) 668141b2f0bdSmrg $echo \ 668241b2f0bdSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 668341b2f0bdSmrg 668441b2f0bdSmrgRemove files from the build directory. 668541b2f0bdSmrg 668641b2f0bdSmrgRM is the name of the program to use to delete files associated with each FILE 668741b2f0bdSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 668841b2f0bdSmrgto RM. 668941b2f0bdSmrg 669041b2f0bdSmrgIf FILE is a libtool library, object or program, all the files associated 669141b2f0bdSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 669241b2f0bdSmrg ;; 669341b2f0bdSmrg 669441b2f0bdSmrgcompile) 669541b2f0bdSmrg $echo \ 669641b2f0bdSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 669741b2f0bdSmrg 669841b2f0bdSmrgCompile a source file into a libtool library object. 669941b2f0bdSmrg 670041b2f0bdSmrgThis mode accepts the following additional options: 670141b2f0bdSmrg 670241b2f0bdSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 670341b2f0bdSmrg -prefer-pic try to building PIC objects only 670441b2f0bdSmrg -prefer-non-pic try to building non-PIC objects only 670541b2f0bdSmrg -static always build a \`.o' file suitable for static linking 670641b2f0bdSmrg 670741b2f0bdSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 670841b2f0bdSmrgfrom the given SOURCEFILE. 670941b2f0bdSmrg 671041b2f0bdSmrgThe output file name is determined by removing the directory component from 671141b2f0bdSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 671241b2f0bdSmrglibrary object suffix, \`.lo'." 671341b2f0bdSmrg ;; 671441b2f0bdSmrg 671541b2f0bdSmrgexecute) 671641b2f0bdSmrg $echo \ 671741b2f0bdSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 671841b2f0bdSmrg 671941b2f0bdSmrgAutomatically set library path, then run a program. 672041b2f0bdSmrg 672141b2f0bdSmrgThis mode accepts the following additional options: 672241b2f0bdSmrg 672341b2f0bdSmrg -dlopen FILE add the directory containing FILE to the library path 672441b2f0bdSmrg 672541b2f0bdSmrgThis mode sets the library path environment variable according to \`-dlopen' 672641b2f0bdSmrgflags. 672741b2f0bdSmrg 672841b2f0bdSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 672941b2f0bdSmrginto their corresponding uninstalled binary, and any of their required library 673041b2f0bdSmrgdirectories are added to the library path. 673141b2f0bdSmrg 673241b2f0bdSmrgThen, COMMAND is executed, with ARGS as arguments." 673341b2f0bdSmrg ;; 673441b2f0bdSmrg 673541b2f0bdSmrgfinish) 673641b2f0bdSmrg $echo \ 673741b2f0bdSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 673841b2f0bdSmrg 673941b2f0bdSmrgComplete the installation of libtool libraries. 674041b2f0bdSmrg 674141b2f0bdSmrgEach LIBDIR is a directory that contains libtool libraries. 674241b2f0bdSmrg 674341b2f0bdSmrgThe commands that this mode executes may require superuser privileges. Use 674441b2f0bdSmrgthe \`--dry-run' option if you just want to see what would be executed." 674541b2f0bdSmrg ;; 674641b2f0bdSmrg 674741b2f0bdSmrginstall) 674841b2f0bdSmrg $echo \ 674941b2f0bdSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 675041b2f0bdSmrg 675141b2f0bdSmrgInstall executables or libraries. 675241b2f0bdSmrg 675341b2f0bdSmrgINSTALL-COMMAND is the installation command. The first component should be 675441b2f0bdSmrgeither the \`install' or \`cp' program. 675541b2f0bdSmrg 675641b2f0bdSmrgThe rest of the components are interpreted as arguments to that command (only 675741b2f0bdSmrgBSD-compatible install options are recognized)." 675841b2f0bdSmrg ;; 675941b2f0bdSmrg 676041b2f0bdSmrglink) 676141b2f0bdSmrg $echo \ 676241b2f0bdSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 676341b2f0bdSmrg 676441b2f0bdSmrgLink object files or libraries together to form another library, or to 676541b2f0bdSmrgcreate an executable program. 676641b2f0bdSmrg 676741b2f0bdSmrgLINK-COMMAND is a command using the C compiler that you would use to create 676841b2f0bdSmrga program from several object files. 676941b2f0bdSmrg 677041b2f0bdSmrgThe following components of LINK-COMMAND are treated specially: 677141b2f0bdSmrg 677241b2f0bdSmrg -all-static do not do any dynamic linking at all 677341b2f0bdSmrg -avoid-version do not add a version suffix if possible 677441b2f0bdSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 677541b2f0bdSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 677641b2f0bdSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 677741b2f0bdSmrg -export-symbols SYMFILE 677841b2f0bdSmrg try to export only the symbols listed in SYMFILE 677941b2f0bdSmrg -export-symbols-regex REGEX 678041b2f0bdSmrg try to export only the symbols matching REGEX 678141b2f0bdSmrg -LLIBDIR search LIBDIR for required installed libraries 678241b2f0bdSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 678341b2f0bdSmrg -module build a library that can dlopened 678441b2f0bdSmrg -no-fast-install disable the fast-install mode 678541b2f0bdSmrg -no-install link a not-installable executable 678641b2f0bdSmrg -no-undefined declare that a library does not refer to external symbols 678741b2f0bdSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 678841b2f0bdSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 678941b2f0bdSmrg -precious-files-regex REGEX 679041b2f0bdSmrg don't remove output files matching REGEX 679141b2f0bdSmrg -release RELEASE specify package release information 679241b2f0bdSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 679341b2f0bdSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 679441b2f0bdSmrg -static do not do any dynamic linking of libtool libraries 679541b2f0bdSmrg -version-info CURRENT[:REVISION[:AGE]] 679641b2f0bdSmrg specify library version info [each variable defaults to 0] 679741b2f0bdSmrg 679841b2f0bdSmrgAll other options (arguments beginning with \`-') are ignored. 679941b2f0bdSmrg 680041b2f0bdSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 680141b2f0bdSmrgtreated as uninstalled libtool libraries, other files are standard or library 680241b2f0bdSmrgobject files. 680341b2f0bdSmrg 680441b2f0bdSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 680541b2f0bdSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 680641b2f0bdSmrgrequired, except when creating a convenience library. 680741b2f0bdSmrg 680841b2f0bdSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 680941b2f0bdSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 681041b2f0bdSmrg 681141b2f0bdSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 681241b2f0bdSmrgis created, otherwise an executable program is created." 681341b2f0bdSmrg ;; 681441b2f0bdSmrg 681541b2f0bdSmrguninstall) 681641b2f0bdSmrg $echo \ 681741b2f0bdSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 681841b2f0bdSmrg 681941b2f0bdSmrgRemove libraries from an installation directory. 682041b2f0bdSmrg 682141b2f0bdSmrgRM is the name of the program to use to delete files associated with each FILE 682241b2f0bdSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 682341b2f0bdSmrgto RM. 682441b2f0bdSmrg 682541b2f0bdSmrgIf FILE is a libtool library, all the files associated with it are deleted. 682641b2f0bdSmrgOtherwise, only FILE itself is deleted using RM." 682741b2f0bdSmrg ;; 682841b2f0bdSmrg 682941b2f0bdSmrg*) 683041b2f0bdSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 683141b2f0bdSmrg $echo "$help" 1>&2 683241b2f0bdSmrg exit $EXIT_FAILURE 683341b2f0bdSmrg ;; 683441b2f0bdSmrgesac 683541b2f0bdSmrg 683641b2f0bdSmrg$echo 683741b2f0bdSmrg$echo "Try \`$modename --help' for more information about other modes." 683841b2f0bdSmrg 683941b2f0bdSmrgexit $? 684041b2f0bdSmrg 684141b2f0bdSmrg# The TAGs below are defined such that we never get into a situation 684241b2f0bdSmrg# in which we disable both kinds of libraries. Given conflicting 684341b2f0bdSmrg# choices, we go for a static library, that is the most portable, 684441b2f0bdSmrg# since we can't tell whether shared libraries were disabled because 684541b2f0bdSmrg# the user asked for that or because the platform doesn't support 684641b2f0bdSmrg# them. This is particularly important on AIX, because we don't 684741b2f0bdSmrg# support having both static and shared libraries enabled at the same 684841b2f0bdSmrg# time on that platform, so we default to a shared-only configuration. 684941b2f0bdSmrg# If a disable-shared tag is given, we'll fallback to a static-only 685041b2f0bdSmrg# configuration. But we'll never go from static-only to shared-only. 685141b2f0bdSmrg 685241b2f0bdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 685341b2f0bdSmrgdisable_libs=shared 685441b2f0bdSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 685541b2f0bdSmrg 685641b2f0bdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 685741b2f0bdSmrgdisable_libs=static 685841b2f0bdSmrg# ### END LIBTOOL TAG CONFIG: disable-static 685941b2f0bdSmrg 686041b2f0bdSmrg# Local Variables: 686141b2f0bdSmrg# mode:shell-script 686241b2f0bdSmrg# sh-indentation:2 686341b2f0bdSmrg# End: 6864