ltmain.sh revision 2a51b5be
132b578d3Smrg# ltmain.sh - Provide generalized library-building support services. 232b578d3Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 332b578d3Smrg# 42a51b5beSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 52a51b5beSmrg# 2007, 2008 Free Software Foundation, Inc. 632b578d3Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 732b578d3Smrg# 832b578d3Smrg# This program is free software; you can redistribute it and/or modify 932b578d3Smrg# it under the terms of the GNU General Public License as published by 1032b578d3Smrg# the Free Software Foundation; either version 2 of the License, or 1132b578d3Smrg# (at your option) any later version. 1232b578d3Smrg# 1332b578d3Smrg# This program is distributed in the hope that it will be useful, but 1432b578d3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1532b578d3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1632b578d3Smrg# General Public License for more details. 1732b578d3Smrg# 1832b578d3Smrg# You should have received a copy of the GNU General Public License 1932b578d3Smrg# along with this program; if not, write to the Free Software 2032b578d3Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2132b578d3Smrg# 2232b578d3Smrg# As a special exception to the GNU General Public License, if you 2332b578d3Smrg# distribute this file as part of a program that contains a 2432b578d3Smrg# configuration script generated by Autoconf, you may include it under 2532b578d3Smrg# the same distribution terms that you use for the rest of that program. 2632b578d3Smrg 2732b578d3Smrgbasename="s,^.*/,,g" 2832b578d3Smrg 2932b578d3Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 3032b578d3Smrg# is ksh but when the shell is invoked as "sh" and the current value of 3132b578d3Smrg# the _XPG environment variable is not equal to 1 (one), the special 3232b578d3Smrg# positional parameter $0, within a function call, is the name of the 3332b578d3Smrg# function. 3432b578d3Smrgprogpath="$0" 3532b578d3Smrg 3632b578d3Smrg# The name of this program: 3732b578d3Smrgprogname=`echo "$progpath" | $SED $basename` 3832b578d3Smrgmodename="$progname" 3932b578d3Smrg 4032b578d3Smrg# Global variables: 4132b578d3SmrgEXIT_SUCCESS=0 4232b578d3SmrgEXIT_FAILURE=1 4332b578d3Smrg 4432b578d3SmrgPROGRAM=ltmain.sh 4532b578d3SmrgPACKAGE=libtool 462a51b5beSmrgVERSION=1.5.26 472a51b5beSmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 482a51b5beSmrg 492a51b5beSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 502a51b5beSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 512a51b5beSmrg emulate sh 522a51b5beSmrg NULLCMD=: 532a51b5beSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 542a51b5beSmrg # is contrary to our usage. Disable this feature. 552a51b5beSmrg alias -g '${1+"$@"}'='"$@"' 5632b578d3Smrg setopt NO_GLOB_SUBST 572a51b5beSmrgelse 582a51b5beSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 5932b578d3Smrgfi 602a51b5beSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 612a51b5beSmrgDUALCASE=1; export DUALCASE # for MKS sh 6232b578d3Smrg 6332b578d3Smrg# Check that we have a working $echo. 6432b578d3Smrgif test "X$1" = X--no-reexec; then 6532b578d3Smrg # Discard the --no-reexec flag, and continue. 6632b578d3Smrg shift 6732b578d3Smrgelif test "X$1" = X--fallback-echo; then 6832b578d3Smrg # Avoid inline document here, it may be left over 6932b578d3Smrg : 7032b578d3Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 7132b578d3Smrg # Yippee, $echo works! 7232b578d3Smrg : 7332b578d3Smrgelse 7432b578d3Smrg # Restart under the correct shell, and then maybe $echo will work. 7532b578d3Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 7632b578d3Smrgfi 7732b578d3Smrg 7832b578d3Smrgif test "X$1" = X--fallback-echo; then 7932b578d3Smrg # used as fallback echo 8032b578d3Smrg shift 8132b578d3Smrg cat <<EOF 8232b578d3Smrg$* 8332b578d3SmrgEOF 8432b578d3Smrg exit $EXIT_SUCCESS 8532b578d3Smrgfi 8632b578d3Smrg 8732b578d3Smrgdefault_mode= 8832b578d3Smrghelp="Try \`$progname --help' for more information." 8932b578d3Smrgmagic="%%%MAGIC variable%%%" 9032b578d3Smrgmkdir="mkdir" 9132b578d3Smrgmv="mv -f" 9232b578d3Smrgrm="rm -f" 9332b578d3Smrg 9432b578d3Smrg# Sed substitution that helps us do robust quoting. It backslashifies 9532b578d3Smrg# metacharacters that are still active within double-quoted strings. 9632b578d3SmrgXsed="${SED}"' -e 1s/^X//' 9732b578d3Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 9832b578d3Smrg# test EBCDIC or ASCII 9932b578d3Smrgcase `echo X|tr X '\101'` in 10032b578d3Smrg A) # ASCII based system 10132b578d3Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 10232b578d3Smrg SP2NL='tr \040 \012' 10332b578d3Smrg NL2SP='tr \015\012 \040\040' 10432b578d3Smrg ;; 10532b578d3Smrg *) # EBCDIC based system 10632b578d3Smrg SP2NL='tr \100 \n' 10732b578d3Smrg NL2SP='tr \r\n \100\100' 10832b578d3Smrg ;; 10932b578d3Smrgesac 11032b578d3Smrg 11132b578d3Smrg# NLS nuisances. 11232b578d3Smrg# Only set LANG and LC_ALL to C if already set. 11332b578d3Smrg# These must not be set unconditionally because not all systems understand 11432b578d3Smrg# e.g. LANG=C (notably SCO). 11532b578d3Smrg# We save the old values to restore during execute mode. 1162a51b5beSmrglt_env= 1172a51b5beSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1182a51b5beSmrgdo 1192a51b5beSmrg eval "if test \"\${$lt_var+set}\" = set; then 1202a51b5beSmrg save_$lt_var=\$$lt_var 1212a51b5beSmrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1222a51b5beSmrg $lt_var=C 1232a51b5beSmrg export $lt_var 1242a51b5beSmrg fi" 1252a51b5beSmrgdone 1262a51b5beSmrg 1272a51b5beSmrgif test -n "$lt_env"; then 1282a51b5beSmrg lt_env="env $lt_env" 129d31dbc53Smrgfi 13032b578d3Smrg 13132b578d3Smrg# Make sure IFS has a sensible default 13232b578d3Smrglt_nl=' 13332b578d3Smrg' 13432b578d3SmrgIFS=" $lt_nl" 13532b578d3Smrg 13632b578d3Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 13732b578d3Smrg $echo "$modename: not configured to build any kind of library" 1>&2 13832b578d3Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 13932b578d3Smrg exit $EXIT_FAILURE 14032b578d3Smrgfi 14132b578d3Smrg 14232b578d3Smrg# Global variables. 14332b578d3Smrgmode=$default_mode 14432b578d3Smrgnonopt= 14532b578d3Smrgprev= 14632b578d3Smrgprevopt= 14732b578d3Smrgrun= 14832b578d3Smrgshow="$echo" 14932b578d3Smrgshow_help= 15032b578d3Smrgexecute_dlfiles= 15132b578d3Smrgduplicate_deps=no 15232b578d3Smrgpreserve_args= 15332b578d3Smrglo2o="s/\\.lo\$/.${objext}/" 15432b578d3Smrgo2lo="s/\\.${objext}\$/.lo/" 1552a51b5beSmrgextracted_archives= 1562a51b5beSmrgextracted_serial=0 15732b578d3Smrg 15832b578d3Smrg##################################### 15932b578d3Smrg# Shell function definitions: 16032b578d3Smrg# This seems to be the best place for them 16132b578d3Smrg 16232b578d3Smrg# func_mktempdir [string] 16332b578d3Smrg# Make a temporary directory that won't clash with other running 16432b578d3Smrg# libtool processes, and avoids race conditions if possible. If 16532b578d3Smrg# given, STRING is the basename for that directory. 16632b578d3Smrgfunc_mktempdir () 16732b578d3Smrg{ 16832b578d3Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 16932b578d3Smrg 17032b578d3Smrg if test "$run" = ":"; then 17132b578d3Smrg # Return a directory name, but don't create it in dry-run mode 17232b578d3Smrg my_tmpdir="${my_template}-$$" 17332b578d3Smrg else 17432b578d3Smrg 17532b578d3Smrg # If mktemp works, use that first and foremost 17632b578d3Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 17732b578d3Smrg 17832b578d3Smrg if test ! -d "$my_tmpdir"; then 17932b578d3Smrg # Failing that, at least try and use $RANDOM to avoid a race 18032b578d3Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 18132b578d3Smrg 18232b578d3Smrg save_mktempdir_umask=`umask` 18332b578d3Smrg umask 0077 18432b578d3Smrg $mkdir "$my_tmpdir" 18532b578d3Smrg umask $save_mktempdir_umask 18632b578d3Smrg fi 18732b578d3Smrg 18832b578d3Smrg # If we're not in dry-run mode, bomb out on failure 18932b578d3Smrg test -d "$my_tmpdir" || { 19032b578d3Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 19132b578d3Smrg exit $EXIT_FAILURE 19232b578d3Smrg } 19332b578d3Smrg fi 19432b578d3Smrg 19532b578d3Smrg $echo "X$my_tmpdir" | $Xsed 19632b578d3Smrg} 19732b578d3Smrg 19832b578d3Smrg 19932b578d3Smrg# func_win32_libid arg 20032b578d3Smrg# return the library type of file 'arg' 20132b578d3Smrg# 20232b578d3Smrg# Need a lot of goo to handle *both* DLLs and import libs 20332b578d3Smrg# Has to be a shell function in order to 'eat' the argument 20432b578d3Smrg# that is supplied when $file_magic_command is called. 20532b578d3Smrgfunc_win32_libid () 20632b578d3Smrg{ 20732b578d3Smrg win32_libid_type="unknown" 20832b578d3Smrg win32_fileres=`file -L $1 2>/dev/null` 20932b578d3Smrg case $win32_fileres in 21032b578d3Smrg *ar\ archive\ import\ library*) # definitely import 21132b578d3Smrg win32_libid_type="x86 archive import" 21232b578d3Smrg ;; 21332b578d3Smrg *ar\ archive*) # could be an import, or static 21432b578d3Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 21532b578d3Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 21632b578d3Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 2172a51b5beSmrg $SED -n -e '1,100{ 2182a51b5beSmrg / I /{ 2192a51b5beSmrg s,.*,import, 2202a51b5beSmrg p 2212a51b5beSmrg q 2222a51b5beSmrg } 2232a51b5beSmrg }'` 22432b578d3Smrg case $win32_nmres in 22532b578d3Smrg import*) win32_libid_type="x86 archive import";; 22632b578d3Smrg *) win32_libid_type="x86 archive static";; 22732b578d3Smrg esac 22832b578d3Smrg fi 22932b578d3Smrg ;; 23032b578d3Smrg *DLL*) 23132b578d3Smrg win32_libid_type="x86 DLL" 23232b578d3Smrg ;; 23332b578d3Smrg *executable*) # but shell scripts are "executable" too... 23432b578d3Smrg case $win32_fileres in 23532b578d3Smrg *MS\ Windows\ PE\ Intel*) 23632b578d3Smrg win32_libid_type="x86 DLL" 23732b578d3Smrg ;; 23832b578d3Smrg esac 23932b578d3Smrg ;; 24032b578d3Smrg esac 24132b578d3Smrg $echo $win32_libid_type 24232b578d3Smrg} 24332b578d3Smrg 24432b578d3Smrg 24532b578d3Smrg# func_infer_tag arg 24632b578d3Smrg# Infer tagged configuration to use if any are available and 24732b578d3Smrg# if one wasn't chosen via the "--tag" command line option. 24832b578d3Smrg# Only attempt this if the compiler in the base compile 24932b578d3Smrg# command doesn't match the default compiler. 25032b578d3Smrg# arg is usually of the form 'gcc ...' 25132b578d3Smrgfunc_infer_tag () 25232b578d3Smrg{ 25332b578d3Smrg if test -n "$available_tags" && test -z "$tagname"; then 25432b578d3Smrg CC_quoted= 25532b578d3Smrg for arg in $CC; do 25632b578d3Smrg case $arg in 25732b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 25832b578d3Smrg arg="\"$arg\"" 25932b578d3Smrg ;; 26032b578d3Smrg esac 26132b578d3Smrg CC_quoted="$CC_quoted $arg" 26232b578d3Smrg done 26332b578d3Smrg case $@ in 26432b578d3Smrg # Blanks in the command may have been stripped by the calling shell, 26532b578d3Smrg # but not from the CC environment variable when configure was run. 26632b578d3Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 26732b578d3Smrg # Blanks at the start of $base_compile will cause this to fail 26832b578d3Smrg # if we don't check for them as well. 26932b578d3Smrg *) 27032b578d3Smrg for z in $available_tags; do 27132b578d3Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 27232b578d3Smrg # Evaluate the configuration. 27332b578d3Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 27432b578d3Smrg CC_quoted= 27532b578d3Smrg for arg in $CC; do 27632b578d3Smrg # Double-quote args containing other shell metacharacters. 27732b578d3Smrg case $arg in 27832b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 27932b578d3Smrg arg="\"$arg\"" 28032b578d3Smrg ;; 28132b578d3Smrg esac 28232b578d3Smrg CC_quoted="$CC_quoted $arg" 28332b578d3Smrg done 28432b578d3Smrg case "$@ " in 28532b578d3Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 28632b578d3Smrg # The compiler in the base compile command matches 28732b578d3Smrg # the one in the tagged configuration. 28832b578d3Smrg # Assume this is the tagged configuration we want. 28932b578d3Smrg tagname=$z 29032b578d3Smrg break 29132b578d3Smrg ;; 29232b578d3Smrg esac 29332b578d3Smrg fi 29432b578d3Smrg done 29532b578d3Smrg # If $tagname still isn't set, then no tagged configuration 29632b578d3Smrg # was found and let the user know that the "--tag" command 29732b578d3Smrg # line option must be used. 29832b578d3Smrg if test -z "$tagname"; then 29932b578d3Smrg $echo "$modename: unable to infer tagged configuration" 30032b578d3Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 30132b578d3Smrg exit $EXIT_FAILURE 30232b578d3Smrg# else 30332b578d3Smrg# $echo "$modename: using $tagname tagged configuration" 30432b578d3Smrg fi 30532b578d3Smrg ;; 30632b578d3Smrg esac 30732b578d3Smrg fi 30832b578d3Smrg} 30932b578d3Smrg 31032b578d3Smrg 31132b578d3Smrg# func_extract_an_archive dir oldlib 31232b578d3Smrgfunc_extract_an_archive () 31332b578d3Smrg{ 31432b578d3Smrg f_ex_an_ar_dir="$1"; shift 31532b578d3Smrg f_ex_an_ar_oldlib="$1" 31632b578d3Smrg 31732b578d3Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 31832b578d3Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 31932b578d3Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 32032b578d3Smrg : 32132b578d3Smrg else 32232b578d3Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 32332b578d3Smrg exit $EXIT_FAILURE 32432b578d3Smrg fi 32532b578d3Smrg} 32632b578d3Smrg 32732b578d3Smrg# func_extract_archives gentop oldlib ... 32832b578d3Smrgfunc_extract_archives () 32932b578d3Smrg{ 33032b578d3Smrg my_gentop="$1"; shift 33132b578d3Smrg my_oldlibs=${1+"$@"} 33232b578d3Smrg my_oldobjs="" 33332b578d3Smrg my_xlib="" 33432b578d3Smrg my_xabs="" 33532b578d3Smrg my_xdir="" 33632b578d3Smrg my_status="" 33732b578d3Smrg 33832b578d3Smrg $show "${rm}r $my_gentop" 33932b578d3Smrg $run ${rm}r "$my_gentop" 34032b578d3Smrg $show "$mkdir $my_gentop" 34132b578d3Smrg $run $mkdir "$my_gentop" 34232b578d3Smrg my_status=$? 34332b578d3Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 34432b578d3Smrg exit $my_status 34532b578d3Smrg fi 34632b578d3Smrg 34732b578d3Smrg for my_xlib in $my_oldlibs; do 34832b578d3Smrg # Extract the objects. 34932b578d3Smrg case $my_xlib in 35032b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 35132b578d3Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 35232b578d3Smrg esac 35332b578d3Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3542a51b5beSmrg my_xlib_u=$my_xlib 3552a51b5beSmrg while :; do 3562a51b5beSmrg case " $extracted_archives " in 3572a51b5beSmrg *" $my_xlib_u "*) 3582a51b5beSmrg extracted_serial=`expr $extracted_serial + 1` 3592a51b5beSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3602a51b5beSmrg *) break ;; 3612a51b5beSmrg esac 3622a51b5beSmrg done 3632a51b5beSmrg extracted_archives="$extracted_archives $my_xlib_u" 3642a51b5beSmrg my_xdir="$my_gentop/$my_xlib_u" 36532b578d3Smrg 36632b578d3Smrg $show "${rm}r $my_xdir" 36732b578d3Smrg $run ${rm}r "$my_xdir" 36832b578d3Smrg $show "$mkdir $my_xdir" 36932b578d3Smrg $run $mkdir "$my_xdir" 37032b578d3Smrg exit_status=$? 37132b578d3Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 37232b578d3Smrg exit $exit_status 37332b578d3Smrg fi 37432b578d3Smrg case $host in 37532b578d3Smrg *-darwin*) 37632b578d3Smrg $show "Extracting $my_xabs" 37732b578d3Smrg # Do not bother doing anything if just a dry run 37832b578d3Smrg if test -z "$run"; then 37932b578d3Smrg darwin_orig_dir=`pwd` 38032b578d3Smrg cd $my_xdir || exit $? 38132b578d3Smrg darwin_archive=$my_xabs 38232b578d3Smrg darwin_curdir=`pwd` 38332b578d3Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 38432b578d3Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 38532b578d3Smrg if test -n "$darwin_arches"; then 38632b578d3Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 38732b578d3Smrg darwin_arch= 38832b578d3Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 38932b578d3Smrg for darwin_arch in $darwin_arches ; do 39032b578d3Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 39132b578d3Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 39232b578d3Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 39332b578d3Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 39432b578d3Smrg cd "$darwin_curdir" 39532b578d3Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 39632b578d3Smrg done # $darwin_arches 39732b578d3Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 39832b578d3Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 39932b578d3Smrg darwin_file= 40032b578d3Smrg darwin_files= 40132b578d3Smrg for darwin_file in $darwin_filelist; do 40232b578d3Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 40332b578d3Smrg lipo -create -output "$darwin_file" $darwin_files 40432b578d3Smrg done # $darwin_filelist 40532b578d3Smrg ${rm}r unfat-$$ 40632b578d3Smrg cd "$darwin_orig_dir" 40732b578d3Smrg else 40832b578d3Smrg cd "$darwin_orig_dir" 40932b578d3Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 41032b578d3Smrg fi # $darwin_arches 41132b578d3Smrg fi # $run 41232b578d3Smrg ;; 41332b578d3Smrg *) 41432b578d3Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 41532b578d3Smrg ;; 41632b578d3Smrg esac 41732b578d3Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 41832b578d3Smrg done 41932b578d3Smrg func_extract_archives_result="$my_oldobjs" 42032b578d3Smrg} 42132b578d3Smrg# End of Shell function definitions 42232b578d3Smrg##################################### 42332b578d3Smrg 42432b578d3Smrg# Darwin sucks 42532b578d3Smrgeval std_shrext=\"$shrext_cmds\" 42632b578d3Smrg 42732b578d3Smrgdisable_libs=no 42832b578d3Smrg 42932b578d3Smrg# Parse our command line options once, thoroughly. 43032b578d3Smrgwhile test "$#" -gt 0 43132b578d3Smrgdo 43232b578d3Smrg arg="$1" 43332b578d3Smrg shift 43432b578d3Smrg 43532b578d3Smrg case $arg in 43632b578d3Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 43732b578d3Smrg *) optarg= ;; 43832b578d3Smrg esac 43932b578d3Smrg 44032b578d3Smrg # If the previous option needs an argument, assign it. 44132b578d3Smrg if test -n "$prev"; then 44232b578d3Smrg case $prev in 44332b578d3Smrg execute_dlfiles) 44432b578d3Smrg execute_dlfiles="$execute_dlfiles $arg" 44532b578d3Smrg ;; 44632b578d3Smrg tag) 44732b578d3Smrg tagname="$arg" 44832b578d3Smrg preserve_args="${preserve_args}=$arg" 44932b578d3Smrg 45032b578d3Smrg # Check whether tagname contains only valid characters 45132b578d3Smrg case $tagname in 45232b578d3Smrg *[!-_A-Za-z0-9,/]*) 45332b578d3Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 45432b578d3Smrg exit $EXIT_FAILURE 45532b578d3Smrg ;; 45632b578d3Smrg esac 45732b578d3Smrg 45832b578d3Smrg case $tagname in 45932b578d3Smrg CC) 46032b578d3Smrg # Don't test for the "default" C tag, as we know, it's there, but 46132b578d3Smrg # not specially marked. 46232b578d3Smrg ;; 46332b578d3Smrg *) 46432b578d3Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 46532b578d3Smrg taglist="$taglist $tagname" 46632b578d3Smrg # Evaluate the configuration. 46732b578d3Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 46832b578d3Smrg else 46932b578d3Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 47032b578d3Smrg fi 47132b578d3Smrg ;; 47232b578d3Smrg esac 47332b578d3Smrg ;; 47432b578d3Smrg *) 47532b578d3Smrg eval "$prev=\$arg" 47632b578d3Smrg ;; 47732b578d3Smrg esac 47832b578d3Smrg 47932b578d3Smrg prev= 48032b578d3Smrg prevopt= 48132b578d3Smrg continue 48232b578d3Smrg fi 48332b578d3Smrg 48432b578d3Smrg # Have we seen a non-optional argument yet? 48532b578d3Smrg case $arg in 48632b578d3Smrg --help) 48732b578d3Smrg show_help=yes 48832b578d3Smrg ;; 48932b578d3Smrg 49032b578d3Smrg --version) 4912a51b5beSmrg echo "\ 4922a51b5beSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 4932a51b5beSmrg 4942a51b5beSmrgCopyright (C) 2008 Free Software Foundation, Inc. 4952a51b5beSmrgThis is free software; see the source for copying conditions. There is NO 4962a51b5beSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 49732b578d3Smrg exit $? 49832b578d3Smrg ;; 49932b578d3Smrg 50032b578d3Smrg --config) 50132b578d3Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 50232b578d3Smrg # Now print the configurations for the tags. 50332b578d3Smrg for tagname in $taglist; do 50432b578d3Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 50532b578d3Smrg done 50632b578d3Smrg exit $? 50732b578d3Smrg ;; 50832b578d3Smrg 50932b578d3Smrg --debug) 51032b578d3Smrg $echo "$progname: enabling shell trace mode" 51132b578d3Smrg set -x 51232b578d3Smrg preserve_args="$preserve_args $arg" 51332b578d3Smrg ;; 51432b578d3Smrg 51532b578d3Smrg --dry-run | -n) 51632b578d3Smrg run=: 51732b578d3Smrg ;; 51832b578d3Smrg 51932b578d3Smrg --features) 52032b578d3Smrg $echo "host: $host" 52132b578d3Smrg if test "$build_libtool_libs" = yes; then 52232b578d3Smrg $echo "enable shared libraries" 52332b578d3Smrg else 52432b578d3Smrg $echo "disable shared libraries" 52532b578d3Smrg fi 52632b578d3Smrg if test "$build_old_libs" = yes; then 52732b578d3Smrg $echo "enable static libraries" 52832b578d3Smrg else 52932b578d3Smrg $echo "disable static libraries" 53032b578d3Smrg fi 53132b578d3Smrg exit $? 53232b578d3Smrg ;; 53332b578d3Smrg 53432b578d3Smrg --finish) mode="finish" ;; 53532b578d3Smrg 53632b578d3Smrg --mode) prevopt="--mode" prev=mode ;; 53732b578d3Smrg --mode=*) mode="$optarg" ;; 53832b578d3Smrg 53932b578d3Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 54032b578d3Smrg 54132b578d3Smrg --quiet | --silent) 54232b578d3Smrg show=: 54332b578d3Smrg preserve_args="$preserve_args $arg" 54432b578d3Smrg ;; 54532b578d3Smrg 54632b578d3Smrg --tag) 54732b578d3Smrg prevopt="--tag" 54832b578d3Smrg prev=tag 54932b578d3Smrg preserve_args="$preserve_args --tag" 55032b578d3Smrg ;; 55132b578d3Smrg --tag=*) 55232b578d3Smrg set tag "$optarg" ${1+"$@"} 55332b578d3Smrg shift 55432b578d3Smrg prev=tag 55532b578d3Smrg preserve_args="$preserve_args --tag" 55632b578d3Smrg ;; 55732b578d3Smrg 55832b578d3Smrg -dlopen) 55932b578d3Smrg prevopt="-dlopen" 56032b578d3Smrg prev=execute_dlfiles 56132b578d3Smrg ;; 56232b578d3Smrg 56332b578d3Smrg -*) 56432b578d3Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 56532b578d3Smrg $echo "$help" 1>&2 56632b578d3Smrg exit $EXIT_FAILURE 56732b578d3Smrg ;; 56832b578d3Smrg 56932b578d3Smrg *) 57032b578d3Smrg nonopt="$arg" 57132b578d3Smrg break 57232b578d3Smrg ;; 57332b578d3Smrg esac 57432b578d3Smrgdone 57532b578d3Smrg 57632b578d3Smrgif test -n "$prevopt"; then 57732b578d3Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 57832b578d3Smrg $echo "$help" 1>&2 57932b578d3Smrg exit $EXIT_FAILURE 58032b578d3Smrgfi 58132b578d3Smrg 58232b578d3Smrgcase $disable_libs in 58332b578d3Smrgno) 58432b578d3Smrg ;; 58532b578d3Smrgshared) 58632b578d3Smrg build_libtool_libs=no 58732b578d3Smrg build_old_libs=yes 58832b578d3Smrg ;; 58932b578d3Smrgstatic) 59032b578d3Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 59132b578d3Smrg ;; 59232b578d3Smrgesac 59332b578d3Smrg 59432b578d3Smrg# If this variable is set in any of the actions, the command in it 59532b578d3Smrg# will be execed at the end. This prevents here-documents from being 59632b578d3Smrg# left over by shells. 59732b578d3Smrgexec_cmd= 59832b578d3Smrg 59932b578d3Smrgif test -z "$show_help"; then 60032b578d3Smrg 60132b578d3Smrg # Infer the operation mode. 60232b578d3Smrg if test -z "$mode"; then 60332b578d3Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 60432b578d3Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 60532b578d3Smrg case $nonopt in 60632b578d3Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 60732b578d3Smrg mode=link 60832b578d3Smrg for arg 60932b578d3Smrg do 61032b578d3Smrg case $arg in 61132b578d3Smrg -c) 61232b578d3Smrg mode=compile 61332b578d3Smrg break 61432b578d3Smrg ;; 61532b578d3Smrg esac 61632b578d3Smrg done 61732b578d3Smrg ;; 61832b578d3Smrg *db | *dbx | *strace | *truss) 61932b578d3Smrg mode=execute 62032b578d3Smrg ;; 62132b578d3Smrg *install*|cp|mv) 62232b578d3Smrg mode=install 62332b578d3Smrg ;; 62432b578d3Smrg *rm) 62532b578d3Smrg mode=uninstall 62632b578d3Smrg ;; 62732b578d3Smrg *) 62832b578d3Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 62932b578d3Smrg test -n "$execute_dlfiles" && mode=execute 63032b578d3Smrg 63132b578d3Smrg # Just use the default operation mode. 63232b578d3Smrg if test -z "$mode"; then 63332b578d3Smrg if test -n "$nonopt"; then 63432b578d3Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 63532b578d3Smrg else 63632b578d3Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 63732b578d3Smrg fi 63832b578d3Smrg fi 63932b578d3Smrg ;; 64032b578d3Smrg esac 64132b578d3Smrg fi 64232b578d3Smrg 64332b578d3Smrg # Only execute mode is allowed to have -dlopen flags. 64432b578d3Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 64532b578d3Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 64632b578d3Smrg $echo "$help" 1>&2 64732b578d3Smrg exit $EXIT_FAILURE 64832b578d3Smrg fi 64932b578d3Smrg 65032b578d3Smrg # Change the help message to a mode-specific one. 65132b578d3Smrg generic_help="$help" 65232b578d3Smrg help="Try \`$modename --help --mode=$mode' for more information." 65332b578d3Smrg 65432b578d3Smrg # These modes are in order of execution frequency so that they run quickly. 65532b578d3Smrg case $mode in 65632b578d3Smrg # libtool compile mode 65732b578d3Smrg compile) 65832b578d3Smrg modename="$modename: compile" 65932b578d3Smrg # Get the compilation command and the source file. 66032b578d3Smrg base_compile= 66132b578d3Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 66232b578d3Smrg suppress_opt=yes 66332b578d3Smrg suppress_output= 66432b578d3Smrg arg_mode=normal 66532b578d3Smrg libobj= 66632b578d3Smrg later= 66732b578d3Smrg 66832b578d3Smrg for arg 66932b578d3Smrg do 67032b578d3Smrg case $arg_mode in 67132b578d3Smrg arg ) 67232b578d3Smrg # do not "continue". Instead, add this to base_compile 67332b578d3Smrg lastarg="$arg" 67432b578d3Smrg arg_mode=normal 67532b578d3Smrg ;; 67632b578d3Smrg 67732b578d3Smrg target ) 67832b578d3Smrg libobj="$arg" 67932b578d3Smrg arg_mode=normal 68032b578d3Smrg continue 68132b578d3Smrg ;; 68232b578d3Smrg 68332b578d3Smrg normal ) 68432b578d3Smrg # Accept any command-line options. 68532b578d3Smrg case $arg in 68632b578d3Smrg -o) 68732b578d3Smrg if test -n "$libobj" ; then 68832b578d3Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 68932b578d3Smrg exit $EXIT_FAILURE 69032b578d3Smrg fi 69132b578d3Smrg arg_mode=target 69232b578d3Smrg continue 69332b578d3Smrg ;; 69432b578d3Smrg 69532b578d3Smrg -static | -prefer-pic | -prefer-non-pic) 69632b578d3Smrg later="$later $arg" 69732b578d3Smrg continue 69832b578d3Smrg ;; 69932b578d3Smrg 70032b578d3Smrg -no-suppress) 70132b578d3Smrg suppress_opt=no 70232b578d3Smrg continue 70332b578d3Smrg ;; 70432b578d3Smrg 70532b578d3Smrg -Xcompiler) 70632b578d3Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 70732b578d3Smrg continue # The current "srcfile" will either be retained or 70832b578d3Smrg ;; # replaced later. I would guess that would be a bug. 70932b578d3Smrg 71032b578d3Smrg -Wc,*) 71132b578d3Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 71232b578d3Smrg lastarg= 71332b578d3Smrg save_ifs="$IFS"; IFS=',' 71432b578d3Smrg for arg in $args; do 71532b578d3Smrg IFS="$save_ifs" 71632b578d3Smrg 71732b578d3Smrg # Double-quote args containing other shell metacharacters. 71832b578d3Smrg # Many Bourne shells cannot handle close brackets correctly 71932b578d3Smrg # in scan sets, so we specify it separately. 72032b578d3Smrg case $arg in 72132b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 72232b578d3Smrg arg="\"$arg\"" 72332b578d3Smrg ;; 72432b578d3Smrg esac 72532b578d3Smrg lastarg="$lastarg $arg" 72632b578d3Smrg done 72732b578d3Smrg IFS="$save_ifs" 72832b578d3Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 72932b578d3Smrg 73032b578d3Smrg # Add the arguments to base_compile. 73132b578d3Smrg base_compile="$base_compile $lastarg" 73232b578d3Smrg continue 73332b578d3Smrg ;; 73432b578d3Smrg 73532b578d3Smrg * ) 73632b578d3Smrg # Accept the current argument as the source file. 73732b578d3Smrg # The previous "srcfile" becomes the current argument. 73832b578d3Smrg # 73932b578d3Smrg lastarg="$srcfile" 74032b578d3Smrg srcfile="$arg" 74132b578d3Smrg ;; 74232b578d3Smrg esac # case $arg 74332b578d3Smrg ;; 74432b578d3Smrg esac # case $arg_mode 74532b578d3Smrg 74632b578d3Smrg # Aesthetically quote the previous argument. 74732b578d3Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 74832b578d3Smrg 74932b578d3Smrg case $lastarg in 75032b578d3Smrg # Double-quote args containing other shell metacharacters. 75132b578d3Smrg # Many Bourne shells cannot handle close brackets correctly 75232b578d3Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 75332b578d3Smrg # in scan sets (worked around with variable expansion), 75432b578d3Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 75532b578d3Smrg # at all, so we specify them separately. 75632b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 75732b578d3Smrg lastarg="\"$lastarg\"" 75832b578d3Smrg ;; 75932b578d3Smrg esac 76032b578d3Smrg 76132b578d3Smrg base_compile="$base_compile $lastarg" 76232b578d3Smrg done # for arg 76332b578d3Smrg 76432b578d3Smrg case $arg_mode in 76532b578d3Smrg arg) 76632b578d3Smrg $echo "$modename: you must specify an argument for -Xcompile" 76732b578d3Smrg exit $EXIT_FAILURE 76832b578d3Smrg ;; 76932b578d3Smrg target) 77032b578d3Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 77132b578d3Smrg exit $EXIT_FAILURE 77232b578d3Smrg ;; 77332b578d3Smrg *) 77432b578d3Smrg # Get the name of the library object. 77532b578d3Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 77632b578d3Smrg ;; 77732b578d3Smrg esac 77832b578d3Smrg 77932b578d3Smrg # Recognize several different file suffixes. 78032b578d3Smrg # If the user specifies -o file.o, it is replaced with file.lo 78132b578d3Smrg xform='[cCFSifmso]' 78232b578d3Smrg case $libobj in 78332b578d3Smrg *.ada) xform=ada ;; 78432b578d3Smrg *.adb) xform=adb ;; 78532b578d3Smrg *.ads) xform=ads ;; 78632b578d3Smrg *.asm) xform=asm ;; 78732b578d3Smrg *.c++) xform=c++ ;; 78832b578d3Smrg *.cc) xform=cc ;; 78932b578d3Smrg *.ii) xform=ii ;; 79032b578d3Smrg *.class) xform=class ;; 79132b578d3Smrg *.cpp) xform=cpp ;; 79232b578d3Smrg *.cxx) xform=cxx ;; 7932a51b5beSmrg *.[fF][09]?) xform=[fF][09]. ;; 79432b578d3Smrg *.for) xform=for ;; 79532b578d3Smrg *.java) xform=java ;; 7962a51b5beSmrg *.obj) xform=obj ;; 7972a51b5beSmrg *.sx) xform=sx ;; 79832b578d3Smrg esac 79932b578d3Smrg 80032b578d3Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 80132b578d3Smrg 80232b578d3Smrg case $libobj in 80332b578d3Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 80432b578d3Smrg *) 80532b578d3Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 80632b578d3Smrg exit $EXIT_FAILURE 80732b578d3Smrg ;; 80832b578d3Smrg esac 80932b578d3Smrg 81032b578d3Smrg func_infer_tag $base_compile 81132b578d3Smrg 81232b578d3Smrg for arg in $later; do 81332b578d3Smrg case $arg in 81432b578d3Smrg -static) 81532b578d3Smrg build_old_libs=yes 81632b578d3Smrg continue 81732b578d3Smrg ;; 81832b578d3Smrg 81932b578d3Smrg -prefer-pic) 82032b578d3Smrg pic_mode=yes 82132b578d3Smrg continue 82232b578d3Smrg ;; 82332b578d3Smrg 82432b578d3Smrg -prefer-non-pic) 82532b578d3Smrg pic_mode=no 82632b578d3Smrg continue 82732b578d3Smrg ;; 82832b578d3Smrg esac 82932b578d3Smrg done 83032b578d3Smrg 83132b578d3Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 83232b578d3Smrg case $qlibobj in 83332b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 83432b578d3Smrg qlibobj="\"$qlibobj\"" ;; 83532b578d3Smrg esac 83632b578d3Smrg test "X$libobj" != "X$qlibobj" \ 83732b578d3Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 83832b578d3Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 83932b578d3Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 84032b578d3Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 84132b578d3Smrg if test "X$xdir" = "X$obj"; then 84232b578d3Smrg xdir= 84332b578d3Smrg else 84432b578d3Smrg xdir=$xdir/ 84532b578d3Smrg fi 84632b578d3Smrg lobj=${xdir}$objdir/$objname 84732b578d3Smrg 84832b578d3Smrg if test -z "$base_compile"; then 84932b578d3Smrg $echo "$modename: you must specify a compilation command" 1>&2 85032b578d3Smrg $echo "$help" 1>&2 85132b578d3Smrg exit $EXIT_FAILURE 85232b578d3Smrg fi 85332b578d3Smrg 85432b578d3Smrg # Delete any leftover library objects. 85532b578d3Smrg if test "$build_old_libs" = yes; then 85632b578d3Smrg removelist="$obj $lobj $libobj ${libobj}T" 85732b578d3Smrg else 85832b578d3Smrg removelist="$lobj $libobj ${libobj}T" 85932b578d3Smrg fi 86032b578d3Smrg 86132b578d3Smrg $run $rm $removelist 86232b578d3Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 86332b578d3Smrg 86432b578d3Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 86532b578d3Smrg case $host_os in 86632b578d3Smrg cygwin* | mingw* | pw32* | os2*) 86732b578d3Smrg pic_mode=default 86832b578d3Smrg ;; 86932b578d3Smrg esac 87032b578d3Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 87132b578d3Smrg # non-PIC code in shared libraries is not supported 87232b578d3Smrg pic_mode=default 87332b578d3Smrg fi 87432b578d3Smrg 87532b578d3Smrg # Calculate the filename of the output object if compiler does 87632b578d3Smrg # not support -o with -c 87732b578d3Smrg if test "$compiler_c_o" = no; then 87832b578d3Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 87932b578d3Smrg lockfile="$output_obj.lock" 88032b578d3Smrg removelist="$removelist $output_obj $lockfile" 88132b578d3Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 88232b578d3Smrg else 88332b578d3Smrg output_obj= 88432b578d3Smrg need_locks=no 88532b578d3Smrg lockfile= 88632b578d3Smrg fi 88732b578d3Smrg 88832b578d3Smrg # Lock this critical section if it is needed 88932b578d3Smrg # We use this script file to make the link, it avoids creating a new file 89032b578d3Smrg if test "$need_locks" = yes; then 89132b578d3Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 89232b578d3Smrg $show "Waiting for $lockfile to be removed" 89332b578d3Smrg sleep 2 89432b578d3Smrg done 89532b578d3Smrg elif test "$need_locks" = warn; then 89632b578d3Smrg if test -f "$lockfile"; then 89732b578d3Smrg $echo "\ 89832b578d3Smrg*** ERROR, $lockfile exists and contains: 89932b578d3Smrg`cat $lockfile 2>/dev/null` 90032b578d3Smrg 90132b578d3SmrgThis indicates that another process is trying to use the same 90232b578d3Smrgtemporary object file, and libtool could not work around it because 90332b578d3Smrgyour compiler does not support \`-c' and \`-o' together. If you 90432b578d3Smrgrepeat this compilation, it may succeed, by chance, but you had better 90532b578d3Smrgavoid parallel builds (make -j) in this platform, or get a better 90632b578d3Smrgcompiler." 90732b578d3Smrg 90832b578d3Smrg $run $rm $removelist 90932b578d3Smrg exit $EXIT_FAILURE 91032b578d3Smrg fi 91132b578d3Smrg $echo "$srcfile" > "$lockfile" 91232b578d3Smrg fi 91332b578d3Smrg 91432b578d3Smrg if test -n "$fix_srcfile_path"; then 91532b578d3Smrg eval srcfile=\"$fix_srcfile_path\" 91632b578d3Smrg fi 91732b578d3Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 91832b578d3Smrg case $qsrcfile in 91932b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 92032b578d3Smrg qsrcfile="\"$qsrcfile\"" ;; 92132b578d3Smrg esac 92232b578d3Smrg 92332b578d3Smrg $run $rm "$libobj" "${libobj}T" 92432b578d3Smrg 92532b578d3Smrg # Create a libtool object file (analogous to a ".la" file), 92632b578d3Smrg # but don't create it if we're doing a dry run. 92732b578d3Smrg test -z "$run" && cat > ${libobj}T <<EOF 92832b578d3Smrg# $libobj - a libtool object file 92932b578d3Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 93032b578d3Smrg# 93132b578d3Smrg# Please DO NOT delete this file! 93232b578d3Smrg# It is necessary for linking the library. 93332b578d3Smrg 93432b578d3Smrg# Name of the PIC object. 93532b578d3SmrgEOF 93632b578d3Smrg 93732b578d3Smrg # Only build a PIC object if we are building libtool libraries. 93832b578d3Smrg if test "$build_libtool_libs" = yes; then 93932b578d3Smrg # Without this assignment, base_compile gets emptied. 94032b578d3Smrg fbsd_hideous_sh_bug=$base_compile 94132b578d3Smrg 94232b578d3Smrg if test "$pic_mode" != no; then 94332b578d3Smrg command="$base_compile $qsrcfile $pic_flag" 94432b578d3Smrg else 94532b578d3Smrg # Don't build PIC code 94632b578d3Smrg command="$base_compile $qsrcfile" 94732b578d3Smrg fi 94832b578d3Smrg 94932b578d3Smrg if test ! -d "${xdir}$objdir"; then 95032b578d3Smrg $show "$mkdir ${xdir}$objdir" 95132b578d3Smrg $run $mkdir ${xdir}$objdir 95232b578d3Smrg exit_status=$? 95332b578d3Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 95432b578d3Smrg exit $exit_status 95532b578d3Smrg fi 95632b578d3Smrg fi 95732b578d3Smrg 95832b578d3Smrg if test -z "$output_obj"; then 95932b578d3Smrg # Place PIC objects in $objdir 96032b578d3Smrg command="$command -o $lobj" 96132b578d3Smrg fi 96232b578d3Smrg 96332b578d3Smrg $run $rm "$lobj" "$output_obj" 96432b578d3Smrg 96532b578d3Smrg $show "$command" 9662a51b5beSmrg if $run eval $lt_env "$command"; then : 96732b578d3Smrg else 96832b578d3Smrg test -n "$output_obj" && $run $rm $removelist 96932b578d3Smrg exit $EXIT_FAILURE 97032b578d3Smrg fi 97132b578d3Smrg 97232b578d3Smrg if test "$need_locks" = warn && 97332b578d3Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 97432b578d3Smrg $echo "\ 97532b578d3Smrg*** ERROR, $lockfile contains: 97632b578d3Smrg`cat $lockfile 2>/dev/null` 97732b578d3Smrg 97832b578d3Smrgbut it should contain: 97932b578d3Smrg$srcfile 98032b578d3Smrg 98132b578d3SmrgThis indicates that another process is trying to use the same 98232b578d3Smrgtemporary object file, and libtool could not work around it because 98332b578d3Smrgyour compiler does not support \`-c' and \`-o' together. If you 98432b578d3Smrgrepeat this compilation, it may succeed, by chance, but you had better 98532b578d3Smrgavoid parallel builds (make -j) in this platform, or get a better 98632b578d3Smrgcompiler." 98732b578d3Smrg 98832b578d3Smrg $run $rm $removelist 98932b578d3Smrg exit $EXIT_FAILURE 99032b578d3Smrg fi 99132b578d3Smrg 99232b578d3Smrg # Just move the object if needed, then go on to compile the next one 99332b578d3Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 99432b578d3Smrg $show "$mv $output_obj $lobj" 99532b578d3Smrg if $run $mv $output_obj $lobj; then : 99632b578d3Smrg else 99732b578d3Smrg error=$? 99832b578d3Smrg $run $rm $removelist 99932b578d3Smrg exit $error 100032b578d3Smrg fi 100132b578d3Smrg fi 100232b578d3Smrg 100332b578d3Smrg # Append the name of the PIC object to the libtool object file. 100432b578d3Smrg test -z "$run" && cat >> ${libobj}T <<EOF 100532b578d3Smrgpic_object='$objdir/$objname' 100632b578d3Smrg 100732b578d3SmrgEOF 100832b578d3Smrg 100932b578d3Smrg # Allow error messages only from the first compilation. 101032b578d3Smrg if test "$suppress_opt" = yes; then 101132b578d3Smrg suppress_output=' >/dev/null 2>&1' 101232b578d3Smrg fi 101332b578d3Smrg else 101432b578d3Smrg # No PIC object so indicate it doesn't exist in the libtool 101532b578d3Smrg # object file. 101632b578d3Smrg test -z "$run" && cat >> ${libobj}T <<EOF 101732b578d3Smrgpic_object=none 101832b578d3Smrg 101932b578d3SmrgEOF 102032b578d3Smrg fi 102132b578d3Smrg 102232b578d3Smrg # Only build a position-dependent object if we build old libraries. 102332b578d3Smrg if test "$build_old_libs" = yes; then 102432b578d3Smrg if test "$pic_mode" != yes; then 102532b578d3Smrg # Don't build PIC code 102632b578d3Smrg command="$base_compile $qsrcfile" 102732b578d3Smrg else 102832b578d3Smrg command="$base_compile $qsrcfile $pic_flag" 102932b578d3Smrg fi 103032b578d3Smrg if test "$compiler_c_o" = yes; then 103132b578d3Smrg command="$command -o $obj" 103232b578d3Smrg fi 103332b578d3Smrg 103432b578d3Smrg # Suppress compiler output if we already did a PIC compilation. 103532b578d3Smrg command="$command$suppress_output" 103632b578d3Smrg $run $rm "$obj" "$output_obj" 103732b578d3Smrg $show "$command" 10382a51b5beSmrg if $run eval $lt_env "$command"; then : 103932b578d3Smrg else 104032b578d3Smrg $run $rm $removelist 104132b578d3Smrg exit $EXIT_FAILURE 104232b578d3Smrg fi 104332b578d3Smrg 104432b578d3Smrg if test "$need_locks" = warn && 104532b578d3Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 104632b578d3Smrg $echo "\ 104732b578d3Smrg*** ERROR, $lockfile contains: 104832b578d3Smrg`cat $lockfile 2>/dev/null` 104932b578d3Smrg 105032b578d3Smrgbut it should contain: 105132b578d3Smrg$srcfile 105232b578d3Smrg 105332b578d3SmrgThis indicates that another process is trying to use the same 105432b578d3Smrgtemporary object file, and libtool could not work around it because 105532b578d3Smrgyour compiler does not support \`-c' and \`-o' together. If you 105632b578d3Smrgrepeat this compilation, it may succeed, by chance, but you had better 105732b578d3Smrgavoid parallel builds (make -j) in this platform, or get a better 105832b578d3Smrgcompiler." 105932b578d3Smrg 106032b578d3Smrg $run $rm $removelist 106132b578d3Smrg exit $EXIT_FAILURE 106232b578d3Smrg fi 106332b578d3Smrg 106432b578d3Smrg # Just move the object if needed 106532b578d3Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 106632b578d3Smrg $show "$mv $output_obj $obj" 106732b578d3Smrg if $run $mv $output_obj $obj; then : 106832b578d3Smrg else 106932b578d3Smrg error=$? 107032b578d3Smrg $run $rm $removelist 107132b578d3Smrg exit $error 107232b578d3Smrg fi 107332b578d3Smrg fi 107432b578d3Smrg 107532b578d3Smrg # Append the name of the non-PIC object the libtool object file. 107632b578d3Smrg # Only append if the libtool object file exists. 107732b578d3Smrg test -z "$run" && cat >> ${libobj}T <<EOF 107832b578d3Smrg# Name of the non-PIC object. 107932b578d3Smrgnon_pic_object='$objname' 108032b578d3Smrg 108132b578d3SmrgEOF 108232b578d3Smrg else 108332b578d3Smrg # Append the name of the non-PIC object the libtool object file. 108432b578d3Smrg # Only append if the libtool object file exists. 108532b578d3Smrg test -z "$run" && cat >> ${libobj}T <<EOF 108632b578d3Smrg# Name of the non-PIC object. 108732b578d3Smrgnon_pic_object=none 108832b578d3Smrg 108932b578d3SmrgEOF 109032b578d3Smrg fi 109132b578d3Smrg 109232b578d3Smrg $run $mv "${libobj}T" "${libobj}" 109332b578d3Smrg 109432b578d3Smrg # Unlock the critical section if it was locked 109532b578d3Smrg if test "$need_locks" != no; then 109632b578d3Smrg $run $rm "$lockfile" 109732b578d3Smrg fi 109832b578d3Smrg 109932b578d3Smrg exit $EXIT_SUCCESS 110032b578d3Smrg ;; 110132b578d3Smrg 110232b578d3Smrg # libtool link mode 110332b578d3Smrg link | relink) 110432b578d3Smrg modename="$modename: link" 110532b578d3Smrg case $host in 110632b578d3Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 110732b578d3Smrg # It is impossible to link a dll without this setting, and 110832b578d3Smrg # we shouldn't force the makefile maintainer to figure out 110932b578d3Smrg # which system we are compiling for in order to pass an extra 111032b578d3Smrg # flag for every libtool invocation. 111132b578d3Smrg # allow_undefined=no 111232b578d3Smrg 111332b578d3Smrg # FIXME: Unfortunately, there are problems with the above when trying 111432b578d3Smrg # to make a dll which has undefined symbols, in which case not 111532b578d3Smrg # even a static library is built. For now, we need to specify 111632b578d3Smrg # -no-undefined on the libtool link line when we can be certain 111732b578d3Smrg # that all symbols are satisfied, otherwise we get a static library. 111832b578d3Smrg allow_undefined=yes 111932b578d3Smrg ;; 112032b578d3Smrg *) 112132b578d3Smrg allow_undefined=yes 112232b578d3Smrg ;; 112332b578d3Smrg esac 112432b578d3Smrg libtool_args="$nonopt" 112532b578d3Smrg base_compile="$nonopt $@" 112632b578d3Smrg compile_command="$nonopt" 112732b578d3Smrg finalize_command="$nonopt" 112832b578d3Smrg 112932b578d3Smrg compile_rpath= 113032b578d3Smrg finalize_rpath= 113132b578d3Smrg compile_shlibpath= 113232b578d3Smrg finalize_shlibpath= 113332b578d3Smrg convenience= 113432b578d3Smrg old_convenience= 113532b578d3Smrg deplibs= 113632b578d3Smrg old_deplibs= 113732b578d3Smrg compiler_flags= 113832b578d3Smrg linker_flags= 113932b578d3Smrg dllsearchpath= 114032b578d3Smrg lib_search_path=`pwd` 114132b578d3Smrg inst_prefix_dir= 114232b578d3Smrg 114332b578d3Smrg avoid_version=no 114432b578d3Smrg dlfiles= 114532b578d3Smrg dlprefiles= 114632b578d3Smrg dlself=no 114732b578d3Smrg export_dynamic=no 114832b578d3Smrg export_symbols= 114932b578d3Smrg export_symbols_regex= 115032b578d3Smrg generated= 115132b578d3Smrg libobjs= 115232b578d3Smrg ltlibs= 115332b578d3Smrg module=no 115432b578d3Smrg no_install=no 115532b578d3Smrg objs= 115632b578d3Smrg non_pic_objects= 115732b578d3Smrg notinst_path= # paths that contain not-installed libtool libraries 115832b578d3Smrg precious_files_regex= 115932b578d3Smrg prefer_static_libs=no 116032b578d3Smrg preload=no 116132b578d3Smrg prev= 116232b578d3Smrg prevarg= 116332b578d3Smrg release= 116432b578d3Smrg rpath= 116532b578d3Smrg xrpath= 116632b578d3Smrg perm_rpath= 116732b578d3Smrg temp_rpath= 116832b578d3Smrg thread_safe=no 116932b578d3Smrg vinfo= 117032b578d3Smrg vinfo_number=no 11712a51b5beSmrg single_module="${wl}-single_module" 117232b578d3Smrg 117332b578d3Smrg func_infer_tag $base_compile 117432b578d3Smrg 117532b578d3Smrg # We need to know -static, to get the right output filenames. 117632b578d3Smrg for arg 117732b578d3Smrg do 117832b578d3Smrg case $arg in 11792a51b5beSmrg -all-static | -static | -static-libtool-libs) 11802a51b5beSmrg case $arg in 11812a51b5beSmrg -all-static) 118232b578d3Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 118332b578d3Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 118432b578d3Smrg fi 118532b578d3Smrg if test -n "$link_static_flag"; then 118632b578d3Smrg dlopen_self=$dlopen_self_static 118732b578d3Smrg fi 118832b578d3Smrg prefer_static_libs=yes 11892a51b5beSmrg ;; 11902a51b5beSmrg -static) 119132b578d3Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 119232b578d3Smrg dlopen_self=$dlopen_self_static 119332b578d3Smrg fi 119432b578d3Smrg prefer_static_libs=built 11952a51b5beSmrg ;; 11962a51b5beSmrg -static-libtool-libs) 11972a51b5beSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11982a51b5beSmrg dlopen_self=$dlopen_self_static 11992a51b5beSmrg fi 12002a51b5beSmrg prefer_static_libs=yes 12012a51b5beSmrg ;; 12022a51b5beSmrg esac 120332b578d3Smrg build_libtool_libs=no 120432b578d3Smrg build_old_libs=yes 120532b578d3Smrg break 120632b578d3Smrg ;; 120732b578d3Smrg esac 120832b578d3Smrg done 120932b578d3Smrg 121032b578d3Smrg # See if our shared archives depend on static archives. 121132b578d3Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 121232b578d3Smrg 121332b578d3Smrg # Go through the arguments, transforming them on the way. 121432b578d3Smrg while test "$#" -gt 0; do 121532b578d3Smrg arg="$1" 121632b578d3Smrg shift 121732b578d3Smrg case $arg in 121832b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 121932b578d3Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 122032b578d3Smrg ;; 122132b578d3Smrg *) qarg=$arg ;; 122232b578d3Smrg esac 122332b578d3Smrg libtool_args="$libtool_args $qarg" 122432b578d3Smrg 122532b578d3Smrg # If the previous option needs an argument, assign it. 122632b578d3Smrg if test -n "$prev"; then 122732b578d3Smrg case $prev in 122832b578d3Smrg output) 122932b578d3Smrg compile_command="$compile_command @OUTPUT@" 123032b578d3Smrg finalize_command="$finalize_command @OUTPUT@" 123132b578d3Smrg ;; 123232b578d3Smrg esac 123332b578d3Smrg 123432b578d3Smrg case $prev in 123532b578d3Smrg dlfiles|dlprefiles) 123632b578d3Smrg if test "$preload" = no; then 123732b578d3Smrg # Add the symbol object into the linking commands. 123832b578d3Smrg compile_command="$compile_command @SYMFILE@" 123932b578d3Smrg finalize_command="$finalize_command @SYMFILE@" 124032b578d3Smrg preload=yes 124132b578d3Smrg fi 124232b578d3Smrg case $arg in 124332b578d3Smrg *.la | *.lo) ;; # We handle these cases below. 124432b578d3Smrg force) 124532b578d3Smrg if test "$dlself" = no; then 124632b578d3Smrg dlself=needless 124732b578d3Smrg export_dynamic=yes 124832b578d3Smrg fi 124932b578d3Smrg prev= 125032b578d3Smrg continue 125132b578d3Smrg ;; 125232b578d3Smrg self) 125332b578d3Smrg if test "$prev" = dlprefiles; then 125432b578d3Smrg dlself=yes 125532b578d3Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 125632b578d3Smrg dlself=yes 125732b578d3Smrg else 125832b578d3Smrg dlself=needless 125932b578d3Smrg export_dynamic=yes 126032b578d3Smrg fi 126132b578d3Smrg prev= 126232b578d3Smrg continue 126332b578d3Smrg ;; 126432b578d3Smrg *) 126532b578d3Smrg if test "$prev" = dlfiles; then 126632b578d3Smrg dlfiles="$dlfiles $arg" 126732b578d3Smrg else 126832b578d3Smrg dlprefiles="$dlprefiles $arg" 126932b578d3Smrg fi 127032b578d3Smrg prev= 127132b578d3Smrg continue 127232b578d3Smrg ;; 127332b578d3Smrg esac 127432b578d3Smrg ;; 127532b578d3Smrg expsyms) 127632b578d3Smrg export_symbols="$arg" 127732b578d3Smrg if test ! -f "$arg"; then 127832b578d3Smrg $echo "$modename: symbol file \`$arg' does not exist" 127932b578d3Smrg exit $EXIT_FAILURE 128032b578d3Smrg fi 128132b578d3Smrg prev= 128232b578d3Smrg continue 128332b578d3Smrg ;; 128432b578d3Smrg expsyms_regex) 128532b578d3Smrg export_symbols_regex="$arg" 128632b578d3Smrg prev= 128732b578d3Smrg continue 128832b578d3Smrg ;; 128932b578d3Smrg inst_prefix) 129032b578d3Smrg inst_prefix_dir="$arg" 129132b578d3Smrg prev= 129232b578d3Smrg continue 129332b578d3Smrg ;; 129432b578d3Smrg precious_regex) 129532b578d3Smrg precious_files_regex="$arg" 129632b578d3Smrg prev= 129732b578d3Smrg continue 129832b578d3Smrg ;; 129932b578d3Smrg release) 130032b578d3Smrg release="-$arg" 130132b578d3Smrg prev= 130232b578d3Smrg continue 130332b578d3Smrg ;; 130432b578d3Smrg objectlist) 130532b578d3Smrg if test -f "$arg"; then 130632b578d3Smrg save_arg=$arg 130732b578d3Smrg moreargs= 130832b578d3Smrg for fil in `cat $save_arg` 130932b578d3Smrg do 131032b578d3Smrg# moreargs="$moreargs $fil" 131132b578d3Smrg arg=$fil 131232b578d3Smrg # A libtool-controlled object. 131332b578d3Smrg 131432b578d3Smrg # Check to see that this really is a libtool object. 131532b578d3Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 131632b578d3Smrg pic_object= 131732b578d3Smrg non_pic_object= 131832b578d3Smrg 131932b578d3Smrg # Read the .lo file 132032b578d3Smrg # If there is no directory component, then add one. 132132b578d3Smrg case $arg in 132232b578d3Smrg */* | *\\*) . $arg ;; 132332b578d3Smrg *) . ./$arg ;; 132432b578d3Smrg esac 132532b578d3Smrg 132632b578d3Smrg if test -z "$pic_object" || \ 132732b578d3Smrg test -z "$non_pic_object" || 132832b578d3Smrg test "$pic_object" = none && \ 132932b578d3Smrg test "$non_pic_object" = none; then 133032b578d3Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 133132b578d3Smrg exit $EXIT_FAILURE 133232b578d3Smrg fi 133332b578d3Smrg 133432b578d3Smrg # Extract subdirectory from the argument. 133532b578d3Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 133632b578d3Smrg if test "X$xdir" = "X$arg"; then 133732b578d3Smrg xdir= 133832b578d3Smrg else 133932b578d3Smrg xdir="$xdir/" 134032b578d3Smrg fi 134132b578d3Smrg 134232b578d3Smrg if test "$pic_object" != none; then 134332b578d3Smrg # Prepend the subdirectory the object is found in. 134432b578d3Smrg pic_object="$xdir$pic_object" 134532b578d3Smrg 134632b578d3Smrg if test "$prev" = dlfiles; then 134732b578d3Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 134832b578d3Smrg dlfiles="$dlfiles $pic_object" 134932b578d3Smrg prev= 135032b578d3Smrg continue 135132b578d3Smrg else 135232b578d3Smrg # If libtool objects are unsupported, then we need to preload. 135332b578d3Smrg prev=dlprefiles 135432b578d3Smrg fi 135532b578d3Smrg fi 135632b578d3Smrg 135732b578d3Smrg # CHECK ME: I think I busted this. -Ossama 135832b578d3Smrg if test "$prev" = dlprefiles; then 135932b578d3Smrg # Preload the old-style object. 136032b578d3Smrg dlprefiles="$dlprefiles $pic_object" 136132b578d3Smrg prev= 136232b578d3Smrg fi 136332b578d3Smrg 136432b578d3Smrg # A PIC object. 136532b578d3Smrg libobjs="$libobjs $pic_object" 136632b578d3Smrg arg="$pic_object" 136732b578d3Smrg fi 136832b578d3Smrg 136932b578d3Smrg # Non-PIC object. 137032b578d3Smrg if test "$non_pic_object" != none; then 137132b578d3Smrg # Prepend the subdirectory the object is found in. 137232b578d3Smrg non_pic_object="$xdir$non_pic_object" 137332b578d3Smrg 137432b578d3Smrg # A standard non-PIC object 137532b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 137632b578d3Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 137732b578d3Smrg arg="$non_pic_object" 137832b578d3Smrg fi 137932b578d3Smrg else 138032b578d3Smrg # If the PIC object exists, use it instead. 138132b578d3Smrg # $xdir was prepended to $pic_object above. 138232b578d3Smrg non_pic_object="$pic_object" 138332b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 138432b578d3Smrg fi 138532b578d3Smrg else 138632b578d3Smrg # Only an error if not doing a dry-run. 138732b578d3Smrg if test -z "$run"; then 138832b578d3Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 138932b578d3Smrg exit $EXIT_FAILURE 139032b578d3Smrg else 139132b578d3Smrg # Dry-run case. 139232b578d3Smrg 139332b578d3Smrg # Extract subdirectory from the argument. 139432b578d3Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 139532b578d3Smrg if test "X$xdir" = "X$arg"; then 139632b578d3Smrg xdir= 139732b578d3Smrg else 139832b578d3Smrg xdir="$xdir/" 139932b578d3Smrg fi 140032b578d3Smrg 140132b578d3Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 140232b578d3Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 140332b578d3Smrg libobjs="$libobjs $pic_object" 140432b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 140532b578d3Smrg fi 140632b578d3Smrg fi 140732b578d3Smrg done 140832b578d3Smrg else 140932b578d3Smrg $echo "$modename: link input file \`$save_arg' does not exist" 141032b578d3Smrg exit $EXIT_FAILURE 141132b578d3Smrg fi 141232b578d3Smrg arg=$save_arg 141332b578d3Smrg prev= 141432b578d3Smrg continue 141532b578d3Smrg ;; 141632b578d3Smrg rpath | xrpath) 141732b578d3Smrg # We need an absolute path. 141832b578d3Smrg case $arg in 141932b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 142032b578d3Smrg *) 142132b578d3Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 142232b578d3Smrg exit $EXIT_FAILURE 142332b578d3Smrg ;; 142432b578d3Smrg esac 142532b578d3Smrg if test "$prev" = rpath; then 142632b578d3Smrg case "$rpath " in 142732b578d3Smrg *" $arg "*) ;; 142832b578d3Smrg *) rpath="$rpath $arg" ;; 142932b578d3Smrg esac 143032b578d3Smrg else 143132b578d3Smrg case "$xrpath " in 143232b578d3Smrg *" $arg "*) ;; 143332b578d3Smrg *) xrpath="$xrpath $arg" ;; 143432b578d3Smrg esac 143532b578d3Smrg fi 143632b578d3Smrg prev= 143732b578d3Smrg continue 143832b578d3Smrg ;; 143932b578d3Smrg xcompiler) 144032b578d3Smrg compiler_flags="$compiler_flags $qarg" 144132b578d3Smrg prev= 144232b578d3Smrg compile_command="$compile_command $qarg" 144332b578d3Smrg finalize_command="$finalize_command $qarg" 144432b578d3Smrg continue 144532b578d3Smrg ;; 144632b578d3Smrg xlinker) 144732b578d3Smrg linker_flags="$linker_flags $qarg" 144832b578d3Smrg compiler_flags="$compiler_flags $wl$qarg" 144932b578d3Smrg prev= 145032b578d3Smrg compile_command="$compile_command $wl$qarg" 145132b578d3Smrg finalize_command="$finalize_command $wl$qarg" 145232b578d3Smrg continue 145332b578d3Smrg ;; 145432b578d3Smrg xcclinker) 145532b578d3Smrg linker_flags="$linker_flags $qarg" 145632b578d3Smrg compiler_flags="$compiler_flags $qarg" 145732b578d3Smrg prev= 145832b578d3Smrg compile_command="$compile_command $qarg" 145932b578d3Smrg finalize_command="$finalize_command $qarg" 146032b578d3Smrg continue 146132b578d3Smrg ;; 146232b578d3Smrg shrext) 146332b578d3Smrg shrext_cmds="$arg" 146432b578d3Smrg prev= 146532b578d3Smrg continue 146632b578d3Smrg ;; 146732b578d3Smrg darwin_framework|darwin_framework_skip) 146832b578d3Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 146932b578d3Smrg compile_command="$compile_command $arg" 147032b578d3Smrg finalize_command="$finalize_command $arg" 147132b578d3Smrg prev= 147232b578d3Smrg continue 147332b578d3Smrg ;; 147432b578d3Smrg *) 147532b578d3Smrg eval "$prev=\"\$arg\"" 147632b578d3Smrg prev= 147732b578d3Smrg continue 147832b578d3Smrg ;; 147932b578d3Smrg esac 148032b578d3Smrg fi # test -n "$prev" 148132b578d3Smrg 148232b578d3Smrg prevarg="$arg" 148332b578d3Smrg 148432b578d3Smrg case $arg in 148532b578d3Smrg -all-static) 148632b578d3Smrg if test -n "$link_static_flag"; then 148732b578d3Smrg compile_command="$compile_command $link_static_flag" 148832b578d3Smrg finalize_command="$finalize_command $link_static_flag" 148932b578d3Smrg fi 149032b578d3Smrg continue 149132b578d3Smrg ;; 149232b578d3Smrg 149332b578d3Smrg -allow-undefined) 149432b578d3Smrg # FIXME: remove this flag sometime in the future. 149532b578d3Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 149632b578d3Smrg continue 149732b578d3Smrg ;; 149832b578d3Smrg 149932b578d3Smrg -avoid-version) 150032b578d3Smrg avoid_version=yes 150132b578d3Smrg continue 150232b578d3Smrg ;; 150332b578d3Smrg 150432b578d3Smrg -dlopen) 150532b578d3Smrg prev=dlfiles 150632b578d3Smrg continue 150732b578d3Smrg ;; 150832b578d3Smrg 150932b578d3Smrg -dlpreopen) 151032b578d3Smrg prev=dlprefiles 151132b578d3Smrg continue 151232b578d3Smrg ;; 151332b578d3Smrg 151432b578d3Smrg -export-dynamic) 151532b578d3Smrg export_dynamic=yes 151632b578d3Smrg continue 151732b578d3Smrg ;; 151832b578d3Smrg 151932b578d3Smrg -export-symbols | -export-symbols-regex) 152032b578d3Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 152132b578d3Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 152232b578d3Smrg exit $EXIT_FAILURE 152332b578d3Smrg fi 152432b578d3Smrg if test "X$arg" = "X-export-symbols"; then 152532b578d3Smrg prev=expsyms 152632b578d3Smrg else 152732b578d3Smrg prev=expsyms_regex 152832b578d3Smrg fi 152932b578d3Smrg continue 153032b578d3Smrg ;; 153132b578d3Smrg 153232b578d3Smrg -framework|-arch|-isysroot) 153332b578d3Smrg case " $CC " in 153432b578d3Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 153532b578d3Smrg prev=darwin_framework_skip ;; 153632b578d3Smrg *) compiler_flags="$compiler_flags $arg" 153732b578d3Smrg prev=darwin_framework ;; 153832b578d3Smrg esac 153932b578d3Smrg compile_command="$compile_command $arg" 154032b578d3Smrg finalize_command="$finalize_command $arg" 154132b578d3Smrg continue 154232b578d3Smrg ;; 154332b578d3Smrg 154432b578d3Smrg -inst-prefix-dir) 154532b578d3Smrg prev=inst_prefix 154632b578d3Smrg continue 154732b578d3Smrg ;; 154832b578d3Smrg 154932b578d3Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 155032b578d3Smrg # so, if we see these flags be careful not to treat them like -L 155132b578d3Smrg -L[A-Z][A-Z]*:*) 155232b578d3Smrg case $with_gcc/$host in 155332b578d3Smrg no/*-*-irix* | /*-*-irix*) 155432b578d3Smrg compile_command="$compile_command $arg" 155532b578d3Smrg finalize_command="$finalize_command $arg" 155632b578d3Smrg ;; 155732b578d3Smrg esac 155832b578d3Smrg continue 155932b578d3Smrg ;; 156032b578d3Smrg 156132b578d3Smrg -L*) 156232b578d3Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 156332b578d3Smrg # We need an absolute path. 156432b578d3Smrg case $dir in 156532b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 156632b578d3Smrg *) 156732b578d3Smrg absdir=`cd "$dir" && pwd` 156832b578d3Smrg if test -z "$absdir"; then 156932b578d3Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 157032b578d3Smrg absdir="$dir" 157132b578d3Smrg notinst_path="$notinst_path $dir" 157232b578d3Smrg fi 157332b578d3Smrg dir="$absdir" 157432b578d3Smrg ;; 157532b578d3Smrg esac 157632b578d3Smrg case "$deplibs " in 157732b578d3Smrg *" -L$dir "*) ;; 157832b578d3Smrg *) 157932b578d3Smrg deplibs="$deplibs -L$dir" 158032b578d3Smrg lib_search_path="$lib_search_path $dir" 158132b578d3Smrg ;; 158232b578d3Smrg esac 158332b578d3Smrg case $host in 158432b578d3Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 158532b578d3Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 158632b578d3Smrg case :$dllsearchpath: in 158732b578d3Smrg *":$dir:"*) ;; 158832b578d3Smrg *) dllsearchpath="$dllsearchpath:$dir";; 158932b578d3Smrg esac 159032b578d3Smrg case :$dllsearchpath: in 159132b578d3Smrg *":$testbindir:"*) ;; 159232b578d3Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 159332b578d3Smrg esac 159432b578d3Smrg ;; 159532b578d3Smrg esac 159632b578d3Smrg continue 159732b578d3Smrg ;; 159832b578d3Smrg 159932b578d3Smrg -l*) 160032b578d3Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 160132b578d3Smrg case $host in 160232b578d3Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 160332b578d3Smrg # These systems don't actually have a C or math library (as such) 160432b578d3Smrg continue 160532b578d3Smrg ;; 160632b578d3Smrg *-*-os2*) 160732b578d3Smrg # These systems don't actually have a C library (as such) 160832b578d3Smrg test "X$arg" = "X-lc" && continue 160932b578d3Smrg ;; 161032b578d3Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 161132b578d3Smrg # Do not include libc due to us having libc/libc_r. 161232b578d3Smrg test "X$arg" = "X-lc" && continue 161332b578d3Smrg ;; 161432b578d3Smrg *-*-rhapsody* | *-*-darwin1.[012]) 161532b578d3Smrg # Rhapsody C and math libraries are in the System framework 161632b578d3Smrg deplibs="$deplibs -framework System" 161732b578d3Smrg continue 161832b578d3Smrg ;; 161932b578d3Smrg *-*-sco3.2v5* | *-*-sco5v6*) 162032b578d3Smrg # Causes problems with __ctype 162132b578d3Smrg test "X$arg" = "X-lc" && continue 162232b578d3Smrg ;; 162332b578d3Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 162432b578d3Smrg # Compiler inserts libc in the correct place for threads to work 162532b578d3Smrg test "X$arg" = "X-lc" && continue 162632b578d3Smrg ;; 162732b578d3Smrg esac 162832b578d3Smrg elif test "X$arg" = "X-lc_r"; then 162932b578d3Smrg case $host in 163032b578d3Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 163132b578d3Smrg # Do not include libc_r directly, use -pthread flag. 163232b578d3Smrg continue 163332b578d3Smrg ;; 163432b578d3Smrg esac 163532b578d3Smrg fi 163632b578d3Smrg deplibs="$deplibs $arg" 163732b578d3Smrg continue 163832b578d3Smrg ;; 163932b578d3Smrg 164032b578d3Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 164132b578d3Smrg # classes, name mangling, and exception handling. 164232b578d3Smrg -model) 164332b578d3Smrg compile_command="$compile_command $arg" 164432b578d3Smrg compiler_flags="$compiler_flags $arg" 164532b578d3Smrg finalize_command="$finalize_command $arg" 164632b578d3Smrg prev=xcompiler 164732b578d3Smrg continue 164832b578d3Smrg ;; 164932b578d3Smrg 16502a51b5beSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 165132b578d3Smrg compiler_flags="$compiler_flags $arg" 165232b578d3Smrg compile_command="$compile_command $arg" 165332b578d3Smrg finalize_command="$finalize_command $arg" 165432b578d3Smrg continue 165532b578d3Smrg ;; 165632b578d3Smrg 16572a51b5beSmrg -multi_module) 16582a51b5beSmrg single_module="${wl}-multi_module" 16592a51b5beSmrg continue 16602a51b5beSmrg ;; 16612a51b5beSmrg 166232b578d3Smrg -module) 166332b578d3Smrg module=yes 166432b578d3Smrg continue 166532b578d3Smrg ;; 166632b578d3Smrg 166732b578d3Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 166832b578d3Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 166932b578d3Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 167032b578d3Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 167132b578d3Smrg # -q* pass through compiler args for the IBM compiler 167232b578d3Smrg # -m* pass through architecture-specific compiler args for GCC 167332b578d3Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 167432b578d3Smrg # compiler args for GCC 16752a51b5beSmrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 16762a51b5beSmrg # -F/path gives path to uninstalled frameworks, gcc on darwin 167732b578d3Smrg # @file GCC response files 16782a51b5beSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 16792a51b5beSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 168032b578d3Smrg 168132b578d3Smrg # Unknown arguments in both finalize_command and compile_command need 168232b578d3Smrg # to be aesthetically quoted because they are evaled later. 168332b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 168432b578d3Smrg case $arg in 168532b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 168632b578d3Smrg arg="\"$arg\"" 168732b578d3Smrg ;; 168832b578d3Smrg esac 168932b578d3Smrg compile_command="$compile_command $arg" 169032b578d3Smrg finalize_command="$finalize_command $arg" 169132b578d3Smrg compiler_flags="$compiler_flags $arg" 169232b578d3Smrg continue 169332b578d3Smrg ;; 169432b578d3Smrg 169532b578d3Smrg -shrext) 169632b578d3Smrg prev=shrext 169732b578d3Smrg continue 169832b578d3Smrg ;; 169932b578d3Smrg 170032b578d3Smrg -no-fast-install) 170132b578d3Smrg fast_install=no 170232b578d3Smrg continue 170332b578d3Smrg ;; 170432b578d3Smrg 170532b578d3Smrg -no-install) 170632b578d3Smrg case $host in 17072a51b5beSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 170832b578d3Smrg # The PATH hackery in wrapper scripts is required on Windows 17092a51b5beSmrg # and Darwin in order for the loader to find any dlls it needs. 171032b578d3Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 171132b578d3Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 171232b578d3Smrg fast_install=no 171332b578d3Smrg ;; 171432b578d3Smrg *) no_install=yes ;; 171532b578d3Smrg esac 171632b578d3Smrg continue 171732b578d3Smrg ;; 171832b578d3Smrg 171932b578d3Smrg -no-undefined) 172032b578d3Smrg allow_undefined=no 172132b578d3Smrg continue 172232b578d3Smrg ;; 172332b578d3Smrg 172432b578d3Smrg -objectlist) 172532b578d3Smrg prev=objectlist 172632b578d3Smrg continue 172732b578d3Smrg ;; 172832b578d3Smrg 172932b578d3Smrg -o) prev=output ;; 173032b578d3Smrg 173132b578d3Smrg -precious-files-regex) 173232b578d3Smrg prev=precious_regex 173332b578d3Smrg continue 173432b578d3Smrg ;; 173532b578d3Smrg 173632b578d3Smrg -release) 173732b578d3Smrg prev=release 173832b578d3Smrg continue 173932b578d3Smrg ;; 174032b578d3Smrg 174132b578d3Smrg -rpath) 174232b578d3Smrg prev=rpath 174332b578d3Smrg continue 174432b578d3Smrg ;; 174532b578d3Smrg 174632b578d3Smrg -R) 174732b578d3Smrg prev=xrpath 174832b578d3Smrg continue 174932b578d3Smrg ;; 175032b578d3Smrg 175132b578d3Smrg -R*) 175232b578d3Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 175332b578d3Smrg # We need an absolute path. 175432b578d3Smrg case $dir in 175532b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 175632b578d3Smrg *) 175732b578d3Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 175832b578d3Smrg exit $EXIT_FAILURE 175932b578d3Smrg ;; 176032b578d3Smrg esac 176132b578d3Smrg case "$xrpath " in 176232b578d3Smrg *" $dir "*) ;; 176332b578d3Smrg *) xrpath="$xrpath $dir" ;; 176432b578d3Smrg esac 176532b578d3Smrg continue 176632b578d3Smrg ;; 176732b578d3Smrg 17682a51b5beSmrg -static | -static-libtool-libs) 176932b578d3Smrg # The effects of -static are defined in a previous loop. 177032b578d3Smrg # We used to do the same as -all-static on platforms that 177132b578d3Smrg # didn't have a PIC flag, but the assumption that the effects 177232b578d3Smrg # would be equivalent was wrong. It would break on at least 177332b578d3Smrg # Digital Unix and AIX. 177432b578d3Smrg continue 177532b578d3Smrg ;; 177632b578d3Smrg 177732b578d3Smrg -thread-safe) 177832b578d3Smrg thread_safe=yes 177932b578d3Smrg continue 178032b578d3Smrg ;; 178132b578d3Smrg 178232b578d3Smrg -version-info) 178332b578d3Smrg prev=vinfo 178432b578d3Smrg continue 178532b578d3Smrg ;; 178632b578d3Smrg -version-number) 178732b578d3Smrg prev=vinfo 178832b578d3Smrg vinfo_number=yes 178932b578d3Smrg continue 179032b578d3Smrg ;; 179132b578d3Smrg 179232b578d3Smrg -Wc,*) 179332b578d3Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 179432b578d3Smrg arg= 179532b578d3Smrg save_ifs="$IFS"; IFS=',' 179632b578d3Smrg for flag in $args; do 179732b578d3Smrg IFS="$save_ifs" 179832b578d3Smrg case $flag in 179932b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 180032b578d3Smrg flag="\"$flag\"" 180132b578d3Smrg ;; 180232b578d3Smrg esac 180332b578d3Smrg arg="$arg $wl$flag" 180432b578d3Smrg compiler_flags="$compiler_flags $flag" 180532b578d3Smrg done 180632b578d3Smrg IFS="$save_ifs" 180732b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 180832b578d3Smrg ;; 180932b578d3Smrg 181032b578d3Smrg -Wl,*) 181132b578d3Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 181232b578d3Smrg arg= 181332b578d3Smrg save_ifs="$IFS"; IFS=',' 181432b578d3Smrg for flag in $args; do 181532b578d3Smrg IFS="$save_ifs" 181632b578d3Smrg case $flag in 181732b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 181832b578d3Smrg flag="\"$flag\"" 181932b578d3Smrg ;; 182032b578d3Smrg esac 182132b578d3Smrg arg="$arg $wl$flag" 182232b578d3Smrg compiler_flags="$compiler_flags $wl$flag" 182332b578d3Smrg linker_flags="$linker_flags $flag" 182432b578d3Smrg done 182532b578d3Smrg IFS="$save_ifs" 182632b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 182732b578d3Smrg ;; 182832b578d3Smrg 182932b578d3Smrg -Xcompiler) 183032b578d3Smrg prev=xcompiler 183132b578d3Smrg continue 183232b578d3Smrg ;; 183332b578d3Smrg 183432b578d3Smrg -Xlinker) 183532b578d3Smrg prev=xlinker 183632b578d3Smrg continue 183732b578d3Smrg ;; 183832b578d3Smrg 183932b578d3Smrg -XCClinker) 184032b578d3Smrg prev=xcclinker 184132b578d3Smrg continue 184232b578d3Smrg ;; 184332b578d3Smrg 184432b578d3Smrg # Some other compiler flag. 184532b578d3Smrg -* | +*) 184632b578d3Smrg # Unknown arguments in both finalize_command and compile_command need 184732b578d3Smrg # to be aesthetically quoted because they are evaled later. 184832b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 184932b578d3Smrg case $arg in 185032b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 185132b578d3Smrg arg="\"$arg\"" 185232b578d3Smrg ;; 185332b578d3Smrg esac 185432b578d3Smrg ;; 185532b578d3Smrg 185632b578d3Smrg *.$objext) 185732b578d3Smrg # A standard object. 185832b578d3Smrg objs="$objs $arg" 185932b578d3Smrg ;; 186032b578d3Smrg 186132b578d3Smrg *.lo) 186232b578d3Smrg # A libtool-controlled object. 186332b578d3Smrg 186432b578d3Smrg # Check to see that this really is a libtool object. 186532b578d3Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 186632b578d3Smrg pic_object= 186732b578d3Smrg non_pic_object= 186832b578d3Smrg 186932b578d3Smrg # Read the .lo file 187032b578d3Smrg # If there is no directory component, then add one. 187132b578d3Smrg case $arg in 187232b578d3Smrg */* | *\\*) . $arg ;; 187332b578d3Smrg *) . ./$arg ;; 187432b578d3Smrg esac 187532b578d3Smrg 187632b578d3Smrg if test -z "$pic_object" || \ 187732b578d3Smrg test -z "$non_pic_object" || 187832b578d3Smrg test "$pic_object" = none && \ 187932b578d3Smrg test "$non_pic_object" = none; then 188032b578d3Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 188132b578d3Smrg exit $EXIT_FAILURE 188232b578d3Smrg fi 188332b578d3Smrg 188432b578d3Smrg # Extract subdirectory from the argument. 188532b578d3Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 188632b578d3Smrg if test "X$xdir" = "X$arg"; then 188732b578d3Smrg xdir= 188832b578d3Smrg else 188932b578d3Smrg xdir="$xdir/" 189032b578d3Smrg fi 189132b578d3Smrg 189232b578d3Smrg if test "$pic_object" != none; then 189332b578d3Smrg # Prepend the subdirectory the object is found in. 189432b578d3Smrg pic_object="$xdir$pic_object" 189532b578d3Smrg 189632b578d3Smrg if test "$prev" = dlfiles; then 189732b578d3Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 189832b578d3Smrg dlfiles="$dlfiles $pic_object" 189932b578d3Smrg prev= 190032b578d3Smrg continue 190132b578d3Smrg else 190232b578d3Smrg # If libtool objects are unsupported, then we need to preload. 190332b578d3Smrg prev=dlprefiles 190432b578d3Smrg fi 190532b578d3Smrg fi 190632b578d3Smrg 190732b578d3Smrg # CHECK ME: I think I busted this. -Ossama 190832b578d3Smrg if test "$prev" = dlprefiles; then 190932b578d3Smrg # Preload the old-style object. 191032b578d3Smrg dlprefiles="$dlprefiles $pic_object" 191132b578d3Smrg prev= 191232b578d3Smrg fi 191332b578d3Smrg 191432b578d3Smrg # A PIC object. 191532b578d3Smrg libobjs="$libobjs $pic_object" 191632b578d3Smrg arg="$pic_object" 191732b578d3Smrg fi 191832b578d3Smrg 191932b578d3Smrg # Non-PIC object. 192032b578d3Smrg if test "$non_pic_object" != none; then 192132b578d3Smrg # Prepend the subdirectory the object is found in. 192232b578d3Smrg non_pic_object="$xdir$non_pic_object" 192332b578d3Smrg 192432b578d3Smrg # A standard non-PIC object 192532b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 192632b578d3Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 192732b578d3Smrg arg="$non_pic_object" 192832b578d3Smrg fi 192932b578d3Smrg else 193032b578d3Smrg # If the PIC object exists, use it instead. 193132b578d3Smrg # $xdir was prepended to $pic_object above. 193232b578d3Smrg non_pic_object="$pic_object" 193332b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 193432b578d3Smrg fi 193532b578d3Smrg else 193632b578d3Smrg # Only an error if not doing a dry-run. 193732b578d3Smrg if test -z "$run"; then 193832b578d3Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 193932b578d3Smrg exit $EXIT_FAILURE 194032b578d3Smrg else 194132b578d3Smrg # Dry-run case. 194232b578d3Smrg 194332b578d3Smrg # Extract subdirectory from the argument. 194432b578d3Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 194532b578d3Smrg if test "X$xdir" = "X$arg"; then 194632b578d3Smrg xdir= 194732b578d3Smrg else 194832b578d3Smrg xdir="$xdir/" 194932b578d3Smrg fi 195032b578d3Smrg 195132b578d3Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 195232b578d3Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 195332b578d3Smrg libobjs="$libobjs $pic_object" 195432b578d3Smrg non_pic_objects="$non_pic_objects $non_pic_object" 195532b578d3Smrg fi 195632b578d3Smrg fi 195732b578d3Smrg ;; 195832b578d3Smrg 195932b578d3Smrg *.$libext) 196032b578d3Smrg # An archive. 196132b578d3Smrg deplibs="$deplibs $arg" 196232b578d3Smrg old_deplibs="$old_deplibs $arg" 196332b578d3Smrg continue 196432b578d3Smrg ;; 196532b578d3Smrg 196632b578d3Smrg *.la) 196732b578d3Smrg # A libtool-controlled library. 196832b578d3Smrg 196932b578d3Smrg if test "$prev" = dlfiles; then 197032b578d3Smrg # This library was specified with -dlopen. 197132b578d3Smrg dlfiles="$dlfiles $arg" 197232b578d3Smrg prev= 197332b578d3Smrg elif test "$prev" = dlprefiles; then 197432b578d3Smrg # The library was specified with -dlpreopen. 197532b578d3Smrg dlprefiles="$dlprefiles $arg" 197632b578d3Smrg prev= 197732b578d3Smrg else 197832b578d3Smrg deplibs="$deplibs $arg" 197932b578d3Smrg fi 198032b578d3Smrg continue 198132b578d3Smrg ;; 198232b578d3Smrg 198332b578d3Smrg # Some other compiler argument. 198432b578d3Smrg *) 198532b578d3Smrg # Unknown arguments in both finalize_command and compile_command need 198632b578d3Smrg # to be aesthetically quoted because they are evaled later. 198732b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 198832b578d3Smrg case $arg in 198932b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 199032b578d3Smrg arg="\"$arg\"" 199132b578d3Smrg ;; 199232b578d3Smrg esac 199332b578d3Smrg ;; 199432b578d3Smrg esac # arg 199532b578d3Smrg 199632b578d3Smrg # Now actually substitute the argument into the commands. 199732b578d3Smrg if test -n "$arg"; then 199832b578d3Smrg compile_command="$compile_command $arg" 199932b578d3Smrg finalize_command="$finalize_command $arg" 200032b578d3Smrg fi 200132b578d3Smrg done # argument parsing loop 200232b578d3Smrg 200332b578d3Smrg if test -n "$prev"; then 200432b578d3Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 200532b578d3Smrg $echo "$help" 1>&2 200632b578d3Smrg exit $EXIT_FAILURE 200732b578d3Smrg fi 200832b578d3Smrg 200932b578d3Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 201032b578d3Smrg eval arg=\"$export_dynamic_flag_spec\" 201132b578d3Smrg compile_command="$compile_command $arg" 201232b578d3Smrg finalize_command="$finalize_command $arg" 201332b578d3Smrg fi 201432b578d3Smrg 201532b578d3Smrg oldlibs= 201632b578d3Smrg # calculate the name of the file, without its directory 201732b578d3Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 201832b578d3Smrg libobjs_save="$libobjs" 201932b578d3Smrg 202032b578d3Smrg if test -n "$shlibpath_var"; then 202132b578d3Smrg # get the directories listed in $shlibpath_var 202232b578d3Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 202332b578d3Smrg else 202432b578d3Smrg shlib_search_path= 202532b578d3Smrg fi 202632b578d3Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 202732b578d3Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 202832b578d3Smrg 202932b578d3Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 203032b578d3Smrg if test "X$output_objdir" = "X$output"; then 203132b578d3Smrg output_objdir="$objdir" 203232b578d3Smrg else 203332b578d3Smrg output_objdir="$output_objdir/$objdir" 203432b578d3Smrg fi 203532b578d3Smrg # Create the object directory. 203632b578d3Smrg if test ! -d "$output_objdir"; then 203732b578d3Smrg $show "$mkdir $output_objdir" 203832b578d3Smrg $run $mkdir $output_objdir 203932b578d3Smrg exit_status=$? 204032b578d3Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 204132b578d3Smrg exit $exit_status 204232b578d3Smrg fi 204332b578d3Smrg fi 204432b578d3Smrg 204532b578d3Smrg # Determine the type of output 204632b578d3Smrg case $output in 204732b578d3Smrg "") 204832b578d3Smrg $echo "$modename: you must specify an output file" 1>&2 204932b578d3Smrg $echo "$help" 1>&2 205032b578d3Smrg exit $EXIT_FAILURE 205132b578d3Smrg ;; 205232b578d3Smrg *.$libext) linkmode=oldlib ;; 205332b578d3Smrg *.lo | *.$objext) linkmode=obj ;; 205432b578d3Smrg *.la) linkmode=lib ;; 205532b578d3Smrg *) linkmode=prog ;; # Anything else should be a program. 205632b578d3Smrg esac 205732b578d3Smrg 205832b578d3Smrg case $host in 205932b578d3Smrg *cygwin* | *mingw* | *pw32*) 206032b578d3Smrg # don't eliminate duplications in $postdeps and $predeps 206132b578d3Smrg duplicate_compiler_generated_deps=yes 206232b578d3Smrg ;; 206332b578d3Smrg *) 206432b578d3Smrg duplicate_compiler_generated_deps=$duplicate_deps 206532b578d3Smrg ;; 206632b578d3Smrg esac 206732b578d3Smrg specialdeplibs= 206832b578d3Smrg 206932b578d3Smrg libs= 207032b578d3Smrg # Find all interdependent deplibs by searching for libraries 207132b578d3Smrg # that are linked more than once (e.g. -la -lb -la) 207232b578d3Smrg for deplib in $deplibs; do 207332b578d3Smrg if test "X$duplicate_deps" = "Xyes" ; then 207432b578d3Smrg case "$libs " in 207532b578d3Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 207632b578d3Smrg esac 207732b578d3Smrg fi 207832b578d3Smrg libs="$libs $deplib" 207932b578d3Smrg done 208032b578d3Smrg 208132b578d3Smrg if test "$linkmode" = lib; then 208232b578d3Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 208332b578d3Smrg 208432b578d3Smrg # Compute libraries that are listed more than once in $predeps 208532b578d3Smrg # $postdeps and mark them as special (i.e., whose duplicates are 208632b578d3Smrg # not to be eliminated). 208732b578d3Smrg pre_post_deps= 208832b578d3Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 208932b578d3Smrg for pre_post_dep in $predeps $postdeps; do 209032b578d3Smrg case "$pre_post_deps " in 209132b578d3Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 209232b578d3Smrg esac 209332b578d3Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 209432b578d3Smrg done 209532b578d3Smrg fi 209632b578d3Smrg pre_post_deps= 209732b578d3Smrg fi 209832b578d3Smrg 209932b578d3Smrg deplibs= 210032b578d3Smrg newdependency_libs= 210132b578d3Smrg newlib_search_path= 210232b578d3Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 210332b578d3Smrg notinst_deplibs= # not-installed libtool libraries 210432b578d3Smrg case $linkmode in 210532b578d3Smrg lib) 210632b578d3Smrg passes="conv link" 210732b578d3Smrg for file in $dlfiles $dlprefiles; do 210832b578d3Smrg case $file in 210932b578d3Smrg *.la) ;; 211032b578d3Smrg *) 211132b578d3Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 211232b578d3Smrg exit $EXIT_FAILURE 211332b578d3Smrg ;; 211432b578d3Smrg esac 211532b578d3Smrg done 211632b578d3Smrg ;; 211732b578d3Smrg prog) 211832b578d3Smrg compile_deplibs= 211932b578d3Smrg finalize_deplibs= 212032b578d3Smrg alldeplibs=no 212132b578d3Smrg newdlfiles= 212232b578d3Smrg newdlprefiles= 212332b578d3Smrg passes="conv scan dlopen dlpreopen link" 212432b578d3Smrg ;; 212532b578d3Smrg *) passes="conv" 212632b578d3Smrg ;; 212732b578d3Smrg esac 212832b578d3Smrg for pass in $passes; do 212932b578d3Smrg if test "$linkmode,$pass" = "lib,link" || 213032b578d3Smrg test "$linkmode,$pass" = "prog,scan"; then 213132b578d3Smrg libs="$deplibs" 213232b578d3Smrg deplibs= 213332b578d3Smrg fi 213432b578d3Smrg if test "$linkmode" = prog; then 213532b578d3Smrg case $pass in 213632b578d3Smrg dlopen) libs="$dlfiles" ;; 213732b578d3Smrg dlpreopen) libs="$dlprefiles" ;; 213832b578d3Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 213932b578d3Smrg esac 214032b578d3Smrg fi 214132b578d3Smrg if test "$pass" = dlopen; then 214232b578d3Smrg # Collect dlpreopened libraries 214332b578d3Smrg save_deplibs="$deplibs" 214432b578d3Smrg deplibs= 214532b578d3Smrg fi 214632b578d3Smrg for deplib in $libs; do 214732b578d3Smrg lib= 214832b578d3Smrg found=no 214932b578d3Smrg case $deplib in 21502a51b5beSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 215132b578d3Smrg if test "$linkmode,$pass" = "prog,link"; then 215232b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 215332b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 215432b578d3Smrg else 215532b578d3Smrg compiler_flags="$compiler_flags $deplib" 215632b578d3Smrg fi 215732b578d3Smrg continue 215832b578d3Smrg ;; 215932b578d3Smrg -l*) 216032b578d3Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 216132b578d3Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 216232b578d3Smrg continue 216332b578d3Smrg fi 216432b578d3Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21652a51b5beSmrg if test "$linkmode" = lib; then 21662a51b5beSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 21672a51b5beSmrg else 21682a51b5beSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 21692a51b5beSmrg fi 21702a51b5beSmrg for searchdir in $searchdirs; do 217132b578d3Smrg for search_ext in .la $std_shrext .so .a; do 217232b578d3Smrg # Search the libtool library 217332b578d3Smrg lib="$searchdir/lib${name}${search_ext}" 217432b578d3Smrg if test -f "$lib"; then 217532b578d3Smrg if test "$search_ext" = ".la"; then 217632b578d3Smrg found=yes 217732b578d3Smrg else 217832b578d3Smrg found=no 217932b578d3Smrg fi 218032b578d3Smrg break 2 218132b578d3Smrg fi 218232b578d3Smrg done 218332b578d3Smrg done 218432b578d3Smrg if test "$found" != yes; then 218532b578d3Smrg # deplib doesn't seem to be a libtool library 218632b578d3Smrg if test "$linkmode,$pass" = "prog,link"; then 218732b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 218832b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 218932b578d3Smrg else 219032b578d3Smrg deplibs="$deplib $deplibs" 219132b578d3Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 219232b578d3Smrg fi 219332b578d3Smrg continue 219432b578d3Smrg else # deplib is a libtool library 219532b578d3Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 219632b578d3Smrg # We need to do some special things here, and not later. 219732b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 219832b578d3Smrg case " $predeps $postdeps " in 219932b578d3Smrg *" $deplib "*) 220032b578d3Smrg if (${SED} -e '2q' $lib | 220132b578d3Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 220232b578d3Smrg library_names= 220332b578d3Smrg old_library= 220432b578d3Smrg case $lib in 220532b578d3Smrg */* | *\\*) . $lib ;; 220632b578d3Smrg *) . ./$lib ;; 220732b578d3Smrg esac 220832b578d3Smrg for l in $old_library $library_names; do 220932b578d3Smrg ll="$l" 221032b578d3Smrg done 221132b578d3Smrg if test "X$ll" = "X$old_library" ; then # only static version available 221232b578d3Smrg found=no 221332b578d3Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 221432b578d3Smrg test "X$ladir" = "X$lib" && ladir="." 221532b578d3Smrg lib=$ladir/$old_library 221632b578d3Smrg if test "$linkmode,$pass" = "prog,link"; then 221732b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 221832b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 221932b578d3Smrg else 222032b578d3Smrg deplibs="$deplib $deplibs" 222132b578d3Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 222232b578d3Smrg fi 222332b578d3Smrg continue 222432b578d3Smrg fi 222532b578d3Smrg fi 222632b578d3Smrg ;; 222732b578d3Smrg *) ;; 222832b578d3Smrg esac 222932b578d3Smrg fi 223032b578d3Smrg fi 223132b578d3Smrg ;; # -l 223232b578d3Smrg -L*) 223332b578d3Smrg case $linkmode in 223432b578d3Smrg lib) 223532b578d3Smrg deplibs="$deplib $deplibs" 223632b578d3Smrg test "$pass" = conv && continue 223732b578d3Smrg newdependency_libs="$deplib $newdependency_libs" 223832b578d3Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 223932b578d3Smrg ;; 224032b578d3Smrg prog) 224132b578d3Smrg if test "$pass" = conv; then 224232b578d3Smrg deplibs="$deplib $deplibs" 224332b578d3Smrg continue 224432b578d3Smrg fi 224532b578d3Smrg if test "$pass" = scan; then 224632b578d3Smrg deplibs="$deplib $deplibs" 224732b578d3Smrg else 224832b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 224932b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 225032b578d3Smrg fi 225132b578d3Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 225232b578d3Smrg ;; 225332b578d3Smrg *) 225432b578d3Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 225532b578d3Smrg ;; 225632b578d3Smrg esac # linkmode 225732b578d3Smrg continue 225832b578d3Smrg ;; # -L 225932b578d3Smrg -R*) 226032b578d3Smrg if test "$pass" = link; then 226132b578d3Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 226232b578d3Smrg # Make sure the xrpath contains only unique directories. 226332b578d3Smrg case "$xrpath " in 226432b578d3Smrg *" $dir "*) ;; 226532b578d3Smrg *) xrpath="$xrpath $dir" ;; 226632b578d3Smrg esac 226732b578d3Smrg fi 226832b578d3Smrg deplibs="$deplib $deplibs" 226932b578d3Smrg continue 227032b578d3Smrg ;; 227132b578d3Smrg *.la) lib="$deplib" ;; 227232b578d3Smrg *.$libext) 227332b578d3Smrg if test "$pass" = conv; then 227432b578d3Smrg deplibs="$deplib $deplibs" 227532b578d3Smrg continue 227632b578d3Smrg fi 227732b578d3Smrg case $linkmode in 227832b578d3Smrg lib) 227932b578d3Smrg valid_a_lib=no 228032b578d3Smrg case $deplibs_check_method in 228132b578d3Smrg match_pattern*) 228232b578d3Smrg set dummy $deplibs_check_method 228332b578d3Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 228432b578d3Smrg if eval $echo \"$deplib\" 2>/dev/null \ 228532b578d3Smrg | $SED 10q \ 228632b578d3Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 228732b578d3Smrg valid_a_lib=yes 228832b578d3Smrg fi 228932b578d3Smrg ;; 229032b578d3Smrg pass_all) 229132b578d3Smrg valid_a_lib=yes 229232b578d3Smrg ;; 229332b578d3Smrg esac 229432b578d3Smrg if test "$valid_a_lib" != yes; then 229532b578d3Smrg $echo 229632b578d3Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 229732b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 229832b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 229932b578d3Smrg $echo "*** shared version of the library, which you do not appear to have" 230032b578d3Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 230132b578d3Smrg $echo "*** that it is just a static archive that I should not used here." 230232b578d3Smrg else 230332b578d3Smrg $echo 230432b578d3Smrg $echo "*** Warning: Linking the shared library $output against the" 230532b578d3Smrg $echo "*** static library $deplib is not portable!" 230632b578d3Smrg deplibs="$deplib $deplibs" 230732b578d3Smrg fi 230832b578d3Smrg continue 230932b578d3Smrg ;; 231032b578d3Smrg prog) 231132b578d3Smrg if test "$pass" != link; then 231232b578d3Smrg deplibs="$deplib $deplibs" 231332b578d3Smrg else 231432b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 231532b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 231632b578d3Smrg fi 231732b578d3Smrg continue 231832b578d3Smrg ;; 231932b578d3Smrg esac # linkmode 232032b578d3Smrg ;; # *.$libext 232132b578d3Smrg *.lo | *.$objext) 232232b578d3Smrg if test "$pass" = conv; then 232332b578d3Smrg deplibs="$deplib $deplibs" 232432b578d3Smrg elif test "$linkmode" = prog; then 232532b578d3Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 232632b578d3Smrg # If there is no dlopen support or we're linking statically, 232732b578d3Smrg # we need to preload. 232832b578d3Smrg newdlprefiles="$newdlprefiles $deplib" 232932b578d3Smrg compile_deplibs="$deplib $compile_deplibs" 233032b578d3Smrg finalize_deplibs="$deplib $finalize_deplibs" 233132b578d3Smrg else 233232b578d3Smrg newdlfiles="$newdlfiles $deplib" 233332b578d3Smrg fi 233432b578d3Smrg fi 233532b578d3Smrg continue 233632b578d3Smrg ;; 233732b578d3Smrg %DEPLIBS%) 233832b578d3Smrg alldeplibs=yes 233932b578d3Smrg continue 234032b578d3Smrg ;; 234132b578d3Smrg esac # case $deplib 234232b578d3Smrg if test "$found" = yes || test -f "$lib"; then : 234332b578d3Smrg else 234432b578d3Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 234532b578d3Smrg exit $EXIT_FAILURE 234632b578d3Smrg fi 234732b578d3Smrg 234832b578d3Smrg # Check to see that this really is a libtool archive. 234932b578d3Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 235032b578d3Smrg else 235132b578d3Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 235232b578d3Smrg exit $EXIT_FAILURE 235332b578d3Smrg fi 235432b578d3Smrg 235532b578d3Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 235632b578d3Smrg test "X$ladir" = "X$lib" && ladir="." 235732b578d3Smrg 235832b578d3Smrg dlname= 235932b578d3Smrg dlopen= 236032b578d3Smrg dlpreopen= 236132b578d3Smrg libdir= 236232b578d3Smrg library_names= 236332b578d3Smrg old_library= 236432b578d3Smrg # If the library was installed with an old release of libtool, 236532b578d3Smrg # it will not redefine variables installed, or shouldnotlink 236632b578d3Smrg installed=yes 236732b578d3Smrg shouldnotlink=no 236832b578d3Smrg avoidtemprpath= 236932b578d3Smrg 237032b578d3Smrg 237132b578d3Smrg # Read the .la file 237232b578d3Smrg case $lib in 237332b578d3Smrg */* | *\\*) . $lib ;; 237432b578d3Smrg *) . ./$lib ;; 237532b578d3Smrg esac 237632b578d3Smrg 237732b578d3Smrg if test "$linkmode,$pass" = "lib,link" || 237832b578d3Smrg test "$linkmode,$pass" = "prog,scan" || 237932b578d3Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 238032b578d3Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 238132b578d3Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 238232b578d3Smrg fi 238332b578d3Smrg 238432b578d3Smrg if test "$pass" = conv; then 238532b578d3Smrg # Only check for convenience libraries 238632b578d3Smrg deplibs="$lib $deplibs" 238732b578d3Smrg if test -z "$libdir"; then 238832b578d3Smrg if test -z "$old_library"; then 238932b578d3Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 239032b578d3Smrg exit $EXIT_FAILURE 239132b578d3Smrg fi 239232b578d3Smrg # It is a libtool convenience library, so add in its objects. 239332b578d3Smrg convenience="$convenience $ladir/$objdir/$old_library" 239432b578d3Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 239532b578d3Smrg tmp_libs= 239632b578d3Smrg for deplib in $dependency_libs; do 239732b578d3Smrg deplibs="$deplib $deplibs" 239832b578d3Smrg if test "X$duplicate_deps" = "Xyes" ; then 239932b578d3Smrg case "$tmp_libs " in 240032b578d3Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 240132b578d3Smrg esac 240232b578d3Smrg fi 240332b578d3Smrg tmp_libs="$tmp_libs $deplib" 240432b578d3Smrg done 240532b578d3Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 240632b578d3Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 240732b578d3Smrg exit $EXIT_FAILURE 240832b578d3Smrg fi 240932b578d3Smrg continue 241032b578d3Smrg fi # $pass = conv 241132b578d3Smrg 241232b578d3Smrg 241332b578d3Smrg # Get the name of the library we link against. 241432b578d3Smrg linklib= 241532b578d3Smrg for l in $old_library $library_names; do 241632b578d3Smrg linklib="$l" 241732b578d3Smrg done 241832b578d3Smrg if test -z "$linklib"; then 241932b578d3Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 242032b578d3Smrg exit $EXIT_FAILURE 242132b578d3Smrg fi 242232b578d3Smrg 242332b578d3Smrg # This library was specified with -dlopen. 242432b578d3Smrg if test "$pass" = dlopen; then 242532b578d3Smrg if test -z "$libdir"; then 242632b578d3Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 242732b578d3Smrg exit $EXIT_FAILURE 242832b578d3Smrg fi 242932b578d3Smrg if test -z "$dlname" || 243032b578d3Smrg test "$dlopen_support" != yes || 243132b578d3Smrg test "$build_libtool_libs" = no; then 243232b578d3Smrg # If there is no dlname, no dlopen support or we're linking 243332b578d3Smrg # statically, we need to preload. We also need to preload any 243432b578d3Smrg # dependent libraries so libltdl's deplib preloader doesn't 243532b578d3Smrg # bomb out in the load deplibs phase. 243632b578d3Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 243732b578d3Smrg else 243832b578d3Smrg newdlfiles="$newdlfiles $lib" 243932b578d3Smrg fi 244032b578d3Smrg continue 244132b578d3Smrg fi # $pass = dlopen 244232b578d3Smrg 244332b578d3Smrg # We need an absolute path. 244432b578d3Smrg case $ladir in 244532b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 244632b578d3Smrg *) 244732b578d3Smrg abs_ladir=`cd "$ladir" && pwd` 244832b578d3Smrg if test -z "$abs_ladir"; then 244932b578d3Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 245032b578d3Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 245132b578d3Smrg abs_ladir="$ladir" 245232b578d3Smrg fi 245332b578d3Smrg ;; 245432b578d3Smrg esac 245532b578d3Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 245632b578d3Smrg 245732b578d3Smrg # Find the relevant object directory and library name. 245832b578d3Smrg if test "X$installed" = Xyes; then 245932b578d3Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 246032b578d3Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 246132b578d3Smrg dir="$ladir" 246232b578d3Smrg absdir="$abs_ladir" 246332b578d3Smrg libdir="$abs_ladir" 246432b578d3Smrg else 246532b578d3Smrg dir="$libdir" 246632b578d3Smrg absdir="$libdir" 246732b578d3Smrg fi 246832b578d3Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 246932b578d3Smrg else 247032b578d3Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 247132b578d3Smrg dir="$ladir" 247232b578d3Smrg absdir="$abs_ladir" 247332b578d3Smrg # Remove this search path later 247432b578d3Smrg notinst_path="$notinst_path $abs_ladir" 247532b578d3Smrg else 247632b578d3Smrg dir="$ladir/$objdir" 247732b578d3Smrg absdir="$abs_ladir/$objdir" 247832b578d3Smrg # Remove this search path later 247932b578d3Smrg notinst_path="$notinst_path $abs_ladir" 248032b578d3Smrg fi 248132b578d3Smrg fi # $installed = yes 248232b578d3Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 248332b578d3Smrg 248432b578d3Smrg # This library was specified with -dlpreopen. 248532b578d3Smrg if test "$pass" = dlpreopen; then 248632b578d3Smrg if test -z "$libdir"; then 248732b578d3Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 248832b578d3Smrg exit $EXIT_FAILURE 248932b578d3Smrg fi 249032b578d3Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 249132b578d3Smrg # are required to link). 249232b578d3Smrg if test -n "$old_library"; then 249332b578d3Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 249432b578d3Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 249532b578d3Smrg elif test -n "$dlname"; then 249632b578d3Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 249732b578d3Smrg else 249832b578d3Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 249932b578d3Smrg fi 250032b578d3Smrg fi # $pass = dlpreopen 250132b578d3Smrg 250232b578d3Smrg if test -z "$libdir"; then 250332b578d3Smrg # Link the convenience library 250432b578d3Smrg if test "$linkmode" = lib; then 250532b578d3Smrg deplibs="$dir/$old_library $deplibs" 250632b578d3Smrg elif test "$linkmode,$pass" = "prog,link"; then 250732b578d3Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 250832b578d3Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 250932b578d3Smrg else 251032b578d3Smrg deplibs="$lib $deplibs" # used for prog,scan pass 251132b578d3Smrg fi 251232b578d3Smrg continue 251332b578d3Smrg fi 251432b578d3Smrg 251532b578d3Smrg 251632b578d3Smrg if test "$linkmode" = prog && test "$pass" != link; then 251732b578d3Smrg newlib_search_path="$newlib_search_path $ladir" 251832b578d3Smrg deplibs="$lib $deplibs" 251932b578d3Smrg 252032b578d3Smrg linkalldeplibs=no 252132b578d3Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 252232b578d3Smrg test "$build_libtool_libs" = no; then 252332b578d3Smrg linkalldeplibs=yes 252432b578d3Smrg fi 252532b578d3Smrg 252632b578d3Smrg tmp_libs= 252732b578d3Smrg for deplib in $dependency_libs; do 252832b578d3Smrg case $deplib in 252932b578d3Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 253032b578d3Smrg esac 253132b578d3Smrg # Need to link against all dependency_libs? 253232b578d3Smrg if test "$linkalldeplibs" = yes; then 253332b578d3Smrg deplibs="$deplib $deplibs" 253432b578d3Smrg else 253532b578d3Smrg # Need to hardcode shared library paths 253632b578d3Smrg # or/and link against static libraries 253732b578d3Smrg newdependency_libs="$deplib $newdependency_libs" 253832b578d3Smrg fi 253932b578d3Smrg if test "X$duplicate_deps" = "Xyes" ; then 254032b578d3Smrg case "$tmp_libs " in 254132b578d3Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 254232b578d3Smrg esac 254332b578d3Smrg fi 254432b578d3Smrg tmp_libs="$tmp_libs $deplib" 254532b578d3Smrg done # for deplib 254632b578d3Smrg continue 254732b578d3Smrg fi # $linkmode = prog... 254832b578d3Smrg 254932b578d3Smrg if test "$linkmode,$pass" = "prog,link"; then 255032b578d3Smrg if test -n "$library_names" && 25512a51b5beSmrg { { test "$prefer_static_libs" = no || 25522a51b5beSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 25532a51b5beSmrg test -z "$old_library"; }; then 255432b578d3Smrg # We need to hardcode the library path 255532b578d3Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 255632b578d3Smrg # Make sure the rpath contains only unique directories. 255732b578d3Smrg case "$temp_rpath " in 255832b578d3Smrg *" $dir "*) ;; 255932b578d3Smrg *" $absdir "*) ;; 256032b578d3Smrg *) temp_rpath="$temp_rpath $absdir" ;; 256132b578d3Smrg esac 256232b578d3Smrg fi 256332b578d3Smrg 256432b578d3Smrg # Hardcode the library path. 256532b578d3Smrg # Skip directories that are in the system default run-time 256632b578d3Smrg # search path. 256732b578d3Smrg case " $sys_lib_dlsearch_path " in 256832b578d3Smrg *" $absdir "*) ;; 256932b578d3Smrg *) 257032b578d3Smrg case "$compile_rpath " in 257132b578d3Smrg *" $absdir "*) ;; 257232b578d3Smrg *) compile_rpath="$compile_rpath $absdir" 257332b578d3Smrg esac 257432b578d3Smrg ;; 257532b578d3Smrg esac 257632b578d3Smrg case " $sys_lib_dlsearch_path " in 257732b578d3Smrg *" $libdir "*) ;; 257832b578d3Smrg *) 257932b578d3Smrg case "$finalize_rpath " in 258032b578d3Smrg *" $libdir "*) ;; 258132b578d3Smrg *) finalize_rpath="$finalize_rpath $libdir" 258232b578d3Smrg esac 258332b578d3Smrg ;; 258432b578d3Smrg esac 258532b578d3Smrg fi # $linkmode,$pass = prog,link... 258632b578d3Smrg 258732b578d3Smrg if test "$alldeplibs" = yes && 258832b578d3Smrg { test "$deplibs_check_method" = pass_all || 258932b578d3Smrg { test "$build_libtool_libs" = yes && 259032b578d3Smrg test -n "$library_names"; }; }; then 259132b578d3Smrg # We only need to search for static libraries 259232b578d3Smrg continue 259332b578d3Smrg fi 259432b578d3Smrg fi 259532b578d3Smrg 259632b578d3Smrg link_static=no # Whether the deplib will be linked statically 259732b578d3Smrg use_static_libs=$prefer_static_libs 259832b578d3Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 259932b578d3Smrg use_static_libs=no 260032b578d3Smrg fi 260132b578d3Smrg if test -n "$library_names" && 260232b578d3Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 260332b578d3Smrg if test "$installed" = no; then 260432b578d3Smrg notinst_deplibs="$notinst_deplibs $lib" 260532b578d3Smrg need_relink=yes 260632b578d3Smrg fi 260732b578d3Smrg # This is a shared library 260832b578d3Smrg 260932b578d3Smrg # Warn about portability, can't link against -module's on 261032b578d3Smrg # some systems (darwin) 261132b578d3Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 261232b578d3Smrg $echo 261332b578d3Smrg if test "$linkmode" = prog; then 261432b578d3Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 261532b578d3Smrg else 261632b578d3Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 261732b578d3Smrg fi 261832b578d3Smrg $echo "*** $linklib is not portable!" 261932b578d3Smrg fi 262032b578d3Smrg if test "$linkmode" = lib && 262132b578d3Smrg test "$hardcode_into_libs" = yes; then 262232b578d3Smrg # Hardcode the library path. 262332b578d3Smrg # Skip directories that are in the system default run-time 262432b578d3Smrg # search path. 262532b578d3Smrg case " $sys_lib_dlsearch_path " in 262632b578d3Smrg *" $absdir "*) ;; 262732b578d3Smrg *) 262832b578d3Smrg case "$compile_rpath " in 262932b578d3Smrg *" $absdir "*) ;; 263032b578d3Smrg *) compile_rpath="$compile_rpath $absdir" 263132b578d3Smrg esac 263232b578d3Smrg ;; 263332b578d3Smrg esac 263432b578d3Smrg case " $sys_lib_dlsearch_path " in 263532b578d3Smrg *" $libdir "*) ;; 263632b578d3Smrg *) 263732b578d3Smrg case "$finalize_rpath " in 263832b578d3Smrg *" $libdir "*) ;; 263932b578d3Smrg *) finalize_rpath="$finalize_rpath $libdir" 264032b578d3Smrg esac 264132b578d3Smrg ;; 264232b578d3Smrg esac 264332b578d3Smrg fi 264432b578d3Smrg 264532b578d3Smrg if test -n "$old_archive_from_expsyms_cmds"; then 264632b578d3Smrg # figure out the soname 264732b578d3Smrg set dummy $library_names 264832b578d3Smrg realname="$2" 264932b578d3Smrg shift; shift 265032b578d3Smrg libname=`eval \\$echo \"$libname_spec\"` 265132b578d3Smrg # use dlname if we got it. it's perfectly good, no? 265232b578d3Smrg if test -n "$dlname"; then 265332b578d3Smrg soname="$dlname" 265432b578d3Smrg elif test -n "$soname_spec"; then 265532b578d3Smrg # bleh windows 265632b578d3Smrg case $host in 265732b578d3Smrg *cygwin* | mingw*) 265832b578d3Smrg major=`expr $current - $age` 265932b578d3Smrg versuffix="-$major" 266032b578d3Smrg ;; 266132b578d3Smrg esac 266232b578d3Smrg eval soname=\"$soname_spec\" 266332b578d3Smrg else 266432b578d3Smrg soname="$realname" 266532b578d3Smrg fi 266632b578d3Smrg 266732b578d3Smrg # Make a new name for the extract_expsyms_cmds to use 266832b578d3Smrg soroot="$soname" 266932b578d3Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 267032b578d3Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 267132b578d3Smrg 267232b578d3Smrg # If the library has no export list, then create one now 267332b578d3Smrg if test -f "$output_objdir/$soname-def"; then : 267432b578d3Smrg else 267532b578d3Smrg $show "extracting exported symbol list from \`$soname'" 267632b578d3Smrg save_ifs="$IFS"; IFS='~' 267732b578d3Smrg cmds=$extract_expsyms_cmds 267832b578d3Smrg for cmd in $cmds; do 267932b578d3Smrg IFS="$save_ifs" 268032b578d3Smrg eval cmd=\"$cmd\" 268132b578d3Smrg $show "$cmd" 268232b578d3Smrg $run eval "$cmd" || exit $? 268332b578d3Smrg done 268432b578d3Smrg IFS="$save_ifs" 268532b578d3Smrg fi 268632b578d3Smrg 268732b578d3Smrg # Create $newlib 268832b578d3Smrg if test -f "$output_objdir/$newlib"; then :; else 268932b578d3Smrg $show "generating import library for \`$soname'" 269032b578d3Smrg save_ifs="$IFS"; IFS='~' 269132b578d3Smrg cmds=$old_archive_from_expsyms_cmds 269232b578d3Smrg for cmd in $cmds; do 269332b578d3Smrg IFS="$save_ifs" 269432b578d3Smrg eval cmd=\"$cmd\" 269532b578d3Smrg $show "$cmd" 269632b578d3Smrg $run eval "$cmd" || exit $? 269732b578d3Smrg done 269832b578d3Smrg IFS="$save_ifs" 269932b578d3Smrg fi 270032b578d3Smrg # make sure the library variables are pointing to the new library 270132b578d3Smrg dir=$output_objdir 270232b578d3Smrg linklib=$newlib 270332b578d3Smrg fi # test -n "$old_archive_from_expsyms_cmds" 270432b578d3Smrg 270532b578d3Smrg if test "$linkmode" = prog || test "$mode" != relink; then 270632b578d3Smrg add_shlibpath= 270732b578d3Smrg add_dir= 270832b578d3Smrg add= 270932b578d3Smrg lib_linked=yes 271032b578d3Smrg case $hardcode_action in 271132b578d3Smrg immediate | unsupported) 271232b578d3Smrg if test "$hardcode_direct" = no; then 271332b578d3Smrg add="$dir/$linklib" 271432b578d3Smrg case $host in 271532b578d3Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 271632b578d3Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 271732b578d3Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 271832b578d3Smrg *-*-unixware7*) add_dir="-L$dir" ;; 271932b578d3Smrg *-*-darwin* ) 272032b578d3Smrg # if the lib is a module then we can not link against 272132b578d3Smrg # it, someone is ignoring the new warnings I added 272232b578d3Smrg if /usr/bin/file -L $add 2> /dev/null | 272332b578d3Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 272432b578d3Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 272532b578d3Smrg if test -z "$old_library" ; then 272632b578d3Smrg $echo 272732b578d3Smrg $echo "** And there doesn't seem to be a static archive available" 272832b578d3Smrg $echo "** The link will probably fail, sorry" 272932b578d3Smrg else 273032b578d3Smrg add="$dir/$old_library" 273132b578d3Smrg fi 273232b578d3Smrg fi 273332b578d3Smrg esac 273432b578d3Smrg elif test "$hardcode_minus_L" = no; then 273532b578d3Smrg case $host in 273632b578d3Smrg *-*-sunos*) add_shlibpath="$dir" ;; 273732b578d3Smrg esac 273832b578d3Smrg add_dir="-L$dir" 273932b578d3Smrg add="-l$name" 274032b578d3Smrg elif test "$hardcode_shlibpath_var" = no; then 274132b578d3Smrg add_shlibpath="$dir" 274232b578d3Smrg add="-l$name" 274332b578d3Smrg else 274432b578d3Smrg lib_linked=no 274532b578d3Smrg fi 274632b578d3Smrg ;; 274732b578d3Smrg relink) 274832b578d3Smrg if test "$hardcode_direct" = yes; then 274932b578d3Smrg add="$dir/$linklib" 275032b578d3Smrg elif test "$hardcode_minus_L" = yes; then 275132b578d3Smrg add_dir="-L$dir" 275232b578d3Smrg # Try looking first in the location we're being installed to. 275332b578d3Smrg if test -n "$inst_prefix_dir"; then 275432b578d3Smrg case $libdir in 275532b578d3Smrg [\\/]*) 275632b578d3Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 275732b578d3Smrg ;; 275832b578d3Smrg esac 275932b578d3Smrg fi 276032b578d3Smrg add="-l$name" 276132b578d3Smrg elif test "$hardcode_shlibpath_var" = yes; then 276232b578d3Smrg add_shlibpath="$dir" 276332b578d3Smrg add="-l$name" 276432b578d3Smrg else 276532b578d3Smrg lib_linked=no 276632b578d3Smrg fi 276732b578d3Smrg ;; 276832b578d3Smrg *) lib_linked=no ;; 276932b578d3Smrg esac 277032b578d3Smrg 277132b578d3Smrg if test "$lib_linked" != yes; then 277232b578d3Smrg $echo "$modename: configuration error: unsupported hardcode properties" 277332b578d3Smrg exit $EXIT_FAILURE 277432b578d3Smrg fi 277532b578d3Smrg 277632b578d3Smrg if test -n "$add_shlibpath"; then 277732b578d3Smrg case :$compile_shlibpath: in 277832b578d3Smrg *":$add_shlibpath:"*) ;; 277932b578d3Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 278032b578d3Smrg esac 278132b578d3Smrg fi 278232b578d3Smrg if test "$linkmode" = prog; then 278332b578d3Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 278432b578d3Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 278532b578d3Smrg else 278632b578d3Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 278732b578d3Smrg test -n "$add" && deplibs="$add $deplibs" 278832b578d3Smrg if test "$hardcode_direct" != yes && \ 278932b578d3Smrg test "$hardcode_minus_L" != yes && \ 279032b578d3Smrg test "$hardcode_shlibpath_var" = yes; then 279132b578d3Smrg case :$finalize_shlibpath: in 279232b578d3Smrg *":$libdir:"*) ;; 279332b578d3Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 279432b578d3Smrg esac 279532b578d3Smrg fi 279632b578d3Smrg fi 279732b578d3Smrg fi 279832b578d3Smrg 279932b578d3Smrg if test "$linkmode" = prog || test "$mode" = relink; then 280032b578d3Smrg add_shlibpath= 280132b578d3Smrg add_dir= 280232b578d3Smrg add= 280332b578d3Smrg # Finalize command for both is simple: just hardcode it. 280432b578d3Smrg if test "$hardcode_direct" = yes; then 280532b578d3Smrg add="$libdir/$linklib" 280632b578d3Smrg elif test "$hardcode_minus_L" = yes; then 280732b578d3Smrg add_dir="-L$libdir" 280832b578d3Smrg add="-l$name" 280932b578d3Smrg elif test "$hardcode_shlibpath_var" = yes; then 281032b578d3Smrg case :$finalize_shlibpath: in 281132b578d3Smrg *":$libdir:"*) ;; 281232b578d3Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 281332b578d3Smrg esac 281432b578d3Smrg add="-l$name" 281532b578d3Smrg elif test "$hardcode_automatic" = yes; then 281632b578d3Smrg if test -n "$inst_prefix_dir" && 281732b578d3Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 281832b578d3Smrg add="$inst_prefix_dir$libdir/$linklib" 281932b578d3Smrg else 282032b578d3Smrg add="$libdir/$linklib" 282132b578d3Smrg fi 282232b578d3Smrg else 282332b578d3Smrg # We cannot seem to hardcode it, guess we'll fake it. 282432b578d3Smrg add_dir="-L$libdir" 282532b578d3Smrg # Try looking first in the location we're being installed to. 282632b578d3Smrg if test -n "$inst_prefix_dir"; then 282732b578d3Smrg case $libdir in 282832b578d3Smrg [\\/]*) 282932b578d3Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 283032b578d3Smrg ;; 283132b578d3Smrg esac 283232b578d3Smrg fi 283332b578d3Smrg add="-l$name" 283432b578d3Smrg fi 283532b578d3Smrg 283632b578d3Smrg if test "$linkmode" = prog; then 283732b578d3Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 283832b578d3Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 283932b578d3Smrg else 284032b578d3Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 284132b578d3Smrg test -n "$add" && deplibs="$add $deplibs" 284232b578d3Smrg fi 284332b578d3Smrg fi 284432b578d3Smrg elif test "$linkmode" = prog; then 284532b578d3Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 284632b578d3Smrg # is not unsupported. This is valid on all known static and 284732b578d3Smrg # shared platforms. 284832b578d3Smrg if test "$hardcode_direct" != unsupported; then 284932b578d3Smrg test -n "$old_library" && linklib="$old_library" 285032b578d3Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 285132b578d3Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 285232b578d3Smrg else 285332b578d3Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 285432b578d3Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 285532b578d3Smrg fi 285632b578d3Smrg elif test "$build_libtool_libs" = yes; then 285732b578d3Smrg # Not a shared library 285832b578d3Smrg if test "$deplibs_check_method" != pass_all; then 285932b578d3Smrg # We're trying link a shared library against a static one 286032b578d3Smrg # but the system doesn't support it. 286132b578d3Smrg 286232b578d3Smrg # Just print a warning and add the library to dependency_libs so 286332b578d3Smrg # that the program can be linked against the static library. 286432b578d3Smrg $echo 286532b578d3Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 286632b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 286732b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 286832b578d3Smrg $echo "*** shared version of the library, which you do not appear to have." 286932b578d3Smrg if test "$module" = yes; then 287032b578d3Smrg $echo "*** But as you try to build a module library, libtool will still create " 287132b578d3Smrg $echo "*** a static module, that should work as long as the dlopening application" 287232b578d3Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 287332b578d3Smrg if test -z "$global_symbol_pipe"; then 287432b578d3Smrg $echo 287532b578d3Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 287632b578d3Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 287732b578d3Smrg $echo "*** not find such a program. So, this module is probably useless." 287832b578d3Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 287932b578d3Smrg fi 288032b578d3Smrg if test "$build_old_libs" = no; then 288132b578d3Smrg build_libtool_libs=module 288232b578d3Smrg build_old_libs=yes 288332b578d3Smrg else 288432b578d3Smrg build_libtool_libs=no 288532b578d3Smrg fi 288632b578d3Smrg fi 288732b578d3Smrg else 288832b578d3Smrg deplibs="$dir/$old_library $deplibs" 288932b578d3Smrg link_static=yes 289032b578d3Smrg fi 289132b578d3Smrg fi # link shared/static library? 289232b578d3Smrg 289332b578d3Smrg if test "$linkmode" = lib; then 289432b578d3Smrg if test -n "$dependency_libs" && 289532b578d3Smrg { test "$hardcode_into_libs" != yes || 289632b578d3Smrg test "$build_old_libs" = yes || 289732b578d3Smrg test "$link_static" = yes; }; then 289832b578d3Smrg # Extract -R from dependency_libs 289932b578d3Smrg temp_deplibs= 290032b578d3Smrg for libdir in $dependency_libs; do 290132b578d3Smrg case $libdir in 290232b578d3Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 290332b578d3Smrg case " $xrpath " in 290432b578d3Smrg *" $temp_xrpath "*) ;; 290532b578d3Smrg *) xrpath="$xrpath $temp_xrpath";; 290632b578d3Smrg esac;; 290732b578d3Smrg *) temp_deplibs="$temp_deplibs $libdir";; 290832b578d3Smrg esac 290932b578d3Smrg done 291032b578d3Smrg dependency_libs="$temp_deplibs" 291132b578d3Smrg fi 291232b578d3Smrg 291332b578d3Smrg newlib_search_path="$newlib_search_path $absdir" 291432b578d3Smrg # Link against this library 291532b578d3Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 291632b578d3Smrg # ... and its dependency_libs 291732b578d3Smrg tmp_libs= 291832b578d3Smrg for deplib in $dependency_libs; do 291932b578d3Smrg newdependency_libs="$deplib $newdependency_libs" 292032b578d3Smrg if test "X$duplicate_deps" = "Xyes" ; then 292132b578d3Smrg case "$tmp_libs " in 292232b578d3Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 292332b578d3Smrg esac 292432b578d3Smrg fi 292532b578d3Smrg tmp_libs="$tmp_libs $deplib" 292632b578d3Smrg done 292732b578d3Smrg 292832b578d3Smrg if test "$link_all_deplibs" != no; then 292932b578d3Smrg # Add the search paths of all dependency libraries 293032b578d3Smrg for deplib in $dependency_libs; do 293132b578d3Smrg case $deplib in 293232b578d3Smrg -L*) path="$deplib" ;; 293332b578d3Smrg *.la) 293432b578d3Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 293532b578d3Smrg test "X$dir" = "X$deplib" && dir="." 293632b578d3Smrg # We need an absolute path. 293732b578d3Smrg case $dir in 293832b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 293932b578d3Smrg *) 294032b578d3Smrg absdir=`cd "$dir" && pwd` 294132b578d3Smrg if test -z "$absdir"; then 294232b578d3Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 294332b578d3Smrg absdir="$dir" 294432b578d3Smrg fi 294532b578d3Smrg ;; 294632b578d3Smrg esac 294732b578d3Smrg if grep "^installed=no" $deplib > /dev/null; then 294832b578d3Smrg path="$absdir/$objdir" 294932b578d3Smrg else 295032b578d3Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 295132b578d3Smrg if test -z "$libdir"; then 295232b578d3Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 295332b578d3Smrg exit $EXIT_FAILURE 295432b578d3Smrg fi 295532b578d3Smrg if test "$absdir" != "$libdir"; then 295632b578d3Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 295732b578d3Smrg fi 295832b578d3Smrg path="$absdir" 295932b578d3Smrg fi 296032b578d3Smrg depdepl= 296132b578d3Smrg case $host in 296232b578d3Smrg *-*-darwin*) 296332b578d3Smrg # we do not want to link against static libs, 296432b578d3Smrg # but need to link against shared 296532b578d3Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29662a51b5beSmrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 296732b578d3Smrg if test -n "$deplibrary_names" ; then 296832b578d3Smrg for tmp in $deplibrary_names ; do 296932b578d3Smrg depdepl=$tmp 297032b578d3Smrg done 29712a51b5beSmrg if test -f "$deplibdir/$depdepl" ; then 29722a51b5beSmrg depdepl="$deplibdir/$depdepl" 29732a51b5beSmrg elif test -f "$path/$depdepl" ; then 297432b578d3Smrg depdepl="$path/$depdepl" 29752a51b5beSmrg else 29762a51b5beSmrg # Can't find it, oh well... 29772a51b5beSmrg depdepl= 297832b578d3Smrg fi 297932b578d3Smrg # do not add paths which are already there 298032b578d3Smrg case " $newlib_search_path " in 298132b578d3Smrg *" $path "*) ;; 298232b578d3Smrg *) newlib_search_path="$newlib_search_path $path";; 298332b578d3Smrg esac 298432b578d3Smrg fi 298532b578d3Smrg path="" 298632b578d3Smrg ;; 298732b578d3Smrg *) 298832b578d3Smrg path="-L$path" 298932b578d3Smrg ;; 299032b578d3Smrg esac 299132b578d3Smrg ;; 299232b578d3Smrg -l*) 299332b578d3Smrg case $host in 299432b578d3Smrg *-*-darwin*) 299532b578d3Smrg # Again, we only want to link against shared libraries 299632b578d3Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 299732b578d3Smrg for tmp in $newlib_search_path ; do 299832b578d3Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 299932b578d3Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 300032b578d3Smrg break 300132b578d3Smrg fi 300232b578d3Smrg done 300332b578d3Smrg path="" 300432b578d3Smrg ;; 300532b578d3Smrg *) continue ;; 300632b578d3Smrg esac 300732b578d3Smrg ;; 300832b578d3Smrg *) continue ;; 300932b578d3Smrg esac 301032b578d3Smrg case " $deplibs " in 301132b578d3Smrg *" $path "*) ;; 301232b578d3Smrg *) deplibs="$path $deplibs" ;; 301332b578d3Smrg esac 301432b578d3Smrg case " $deplibs " in 301532b578d3Smrg *" $depdepl "*) ;; 301632b578d3Smrg *) deplibs="$depdepl $deplibs" ;; 301732b578d3Smrg esac 301832b578d3Smrg done 301932b578d3Smrg fi # link_all_deplibs != no 302032b578d3Smrg fi # linkmode = lib 302132b578d3Smrg done # for deplib in $libs 302232b578d3Smrg dependency_libs="$newdependency_libs" 302332b578d3Smrg if test "$pass" = dlpreopen; then 302432b578d3Smrg # Link the dlpreopened libraries before other libraries 302532b578d3Smrg for deplib in $save_deplibs; do 302632b578d3Smrg deplibs="$deplib $deplibs" 302732b578d3Smrg done 302832b578d3Smrg fi 302932b578d3Smrg if test "$pass" != dlopen; then 303032b578d3Smrg if test "$pass" != conv; then 303132b578d3Smrg # Make sure lib_search_path contains only unique directories. 303232b578d3Smrg lib_search_path= 303332b578d3Smrg for dir in $newlib_search_path; do 303432b578d3Smrg case "$lib_search_path " in 303532b578d3Smrg *" $dir "*) ;; 303632b578d3Smrg *) lib_search_path="$lib_search_path $dir" ;; 303732b578d3Smrg esac 303832b578d3Smrg done 303932b578d3Smrg newlib_search_path= 304032b578d3Smrg fi 304132b578d3Smrg 304232b578d3Smrg if test "$linkmode,$pass" != "prog,link"; then 304332b578d3Smrg vars="deplibs" 304432b578d3Smrg else 304532b578d3Smrg vars="compile_deplibs finalize_deplibs" 304632b578d3Smrg fi 304732b578d3Smrg for var in $vars dependency_libs; do 304832b578d3Smrg # Add libraries to $var in reverse order 304932b578d3Smrg eval tmp_libs=\"\$$var\" 305032b578d3Smrg new_libs= 305132b578d3Smrg for deplib in $tmp_libs; do 305232b578d3Smrg # FIXME: Pedantically, this is the right thing to do, so 305332b578d3Smrg # that some nasty dependency loop isn't accidentally 305432b578d3Smrg # broken: 305532b578d3Smrg #new_libs="$deplib $new_libs" 305632b578d3Smrg # Pragmatically, this seems to cause very few problems in 305732b578d3Smrg # practice: 305832b578d3Smrg case $deplib in 305932b578d3Smrg -L*) new_libs="$deplib $new_libs" ;; 306032b578d3Smrg -R*) ;; 306132b578d3Smrg *) 306232b578d3Smrg # And here is the reason: when a library appears more 306332b578d3Smrg # than once as an explicit dependence of a library, or 306432b578d3Smrg # is implicitly linked in more than once by the 306532b578d3Smrg # compiler, it is considered special, and multiple 306632b578d3Smrg # occurrences thereof are not removed. Compare this 306732b578d3Smrg # with having the same library being listed as a 306832b578d3Smrg # dependency of multiple other libraries: in this case, 306932b578d3Smrg # we know (pedantically, we assume) the library does not 307032b578d3Smrg # need to be listed more than once, so we keep only the 307132b578d3Smrg # last copy. This is not always right, but it is rare 307232b578d3Smrg # enough that we require users that really mean to play 307332b578d3Smrg # such unportable linking tricks to link the library 307432b578d3Smrg # using -Wl,-lname, so that libtool does not consider it 307532b578d3Smrg # for duplicate removal. 307632b578d3Smrg case " $specialdeplibs " in 307732b578d3Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 307832b578d3Smrg *) 307932b578d3Smrg case " $new_libs " in 308032b578d3Smrg *" $deplib "*) ;; 308132b578d3Smrg *) new_libs="$deplib $new_libs" ;; 308232b578d3Smrg esac 308332b578d3Smrg ;; 308432b578d3Smrg esac 308532b578d3Smrg ;; 308632b578d3Smrg esac 308732b578d3Smrg done 308832b578d3Smrg tmp_libs= 308932b578d3Smrg for deplib in $new_libs; do 309032b578d3Smrg case $deplib in 309132b578d3Smrg -L*) 309232b578d3Smrg case " $tmp_libs " in 309332b578d3Smrg *" $deplib "*) ;; 309432b578d3Smrg *) tmp_libs="$tmp_libs $deplib" ;; 309532b578d3Smrg esac 309632b578d3Smrg ;; 309732b578d3Smrg *) tmp_libs="$tmp_libs $deplib" ;; 309832b578d3Smrg esac 309932b578d3Smrg done 310032b578d3Smrg eval $var=\"$tmp_libs\" 310132b578d3Smrg done # for var 310232b578d3Smrg fi 310332b578d3Smrg # Last step: remove runtime libs from dependency_libs 310432b578d3Smrg # (they stay in deplibs) 310532b578d3Smrg tmp_libs= 310632b578d3Smrg for i in $dependency_libs ; do 310732b578d3Smrg case " $predeps $postdeps $compiler_lib_search_path " in 310832b578d3Smrg *" $i "*) 310932b578d3Smrg i="" 311032b578d3Smrg ;; 311132b578d3Smrg esac 311232b578d3Smrg if test -n "$i" ; then 311332b578d3Smrg tmp_libs="$tmp_libs $i" 311432b578d3Smrg fi 311532b578d3Smrg done 311632b578d3Smrg dependency_libs=$tmp_libs 311732b578d3Smrg done # for pass 311832b578d3Smrg if test "$linkmode" = prog; then 311932b578d3Smrg dlfiles="$newdlfiles" 312032b578d3Smrg dlprefiles="$newdlprefiles" 312132b578d3Smrg fi 312232b578d3Smrg 312332b578d3Smrg case $linkmode in 312432b578d3Smrg oldlib) 31252a51b5beSmrg case " $deplibs" in 31262a51b5beSmrg *\ -l* | *\ -L*) 31272a51b5beSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 31282a51b5beSmrg esac 312932b578d3Smrg 313032b578d3Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 313132b578d3Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 313232b578d3Smrg fi 313332b578d3Smrg 313432b578d3Smrg if test -n "$rpath"; then 313532b578d3Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 313632b578d3Smrg fi 313732b578d3Smrg 313832b578d3Smrg if test -n "$xrpath"; then 313932b578d3Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 314032b578d3Smrg fi 314132b578d3Smrg 314232b578d3Smrg if test -n "$vinfo"; then 314332b578d3Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 314432b578d3Smrg fi 314532b578d3Smrg 314632b578d3Smrg if test -n "$release"; then 314732b578d3Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 314832b578d3Smrg fi 314932b578d3Smrg 315032b578d3Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 315132b578d3Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 315232b578d3Smrg fi 315332b578d3Smrg 315432b578d3Smrg # Now set the variables for building old libraries. 315532b578d3Smrg build_libtool_libs=no 315632b578d3Smrg oldlibs="$output" 315732b578d3Smrg objs="$objs$old_deplibs" 315832b578d3Smrg ;; 315932b578d3Smrg 316032b578d3Smrg lib) 316132b578d3Smrg # Make sure we only generate libraries of the form `libNAME.la'. 316232b578d3Smrg case $outputname in 316332b578d3Smrg lib*) 316432b578d3Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 316532b578d3Smrg eval shared_ext=\"$shrext_cmds\" 316632b578d3Smrg eval libname=\"$libname_spec\" 316732b578d3Smrg ;; 316832b578d3Smrg *) 316932b578d3Smrg if test "$module" = no; then 317032b578d3Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 317132b578d3Smrg $echo "$help" 1>&2 317232b578d3Smrg exit $EXIT_FAILURE 317332b578d3Smrg fi 317432b578d3Smrg if test "$need_lib_prefix" != no; then 317532b578d3Smrg # Add the "lib" prefix for modules if required 317632b578d3Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 317732b578d3Smrg eval shared_ext=\"$shrext_cmds\" 317832b578d3Smrg eval libname=\"$libname_spec\" 317932b578d3Smrg else 318032b578d3Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 318132b578d3Smrg fi 318232b578d3Smrg ;; 318332b578d3Smrg esac 318432b578d3Smrg 318532b578d3Smrg if test -n "$objs"; then 318632b578d3Smrg if test "$deplibs_check_method" != pass_all; then 318732b578d3Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 318832b578d3Smrg exit $EXIT_FAILURE 318932b578d3Smrg else 319032b578d3Smrg $echo 319132b578d3Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 319232b578d3Smrg $echo "*** objects $objs is not portable!" 319332b578d3Smrg libobjs="$libobjs $objs" 319432b578d3Smrg fi 319532b578d3Smrg fi 319632b578d3Smrg 319732b578d3Smrg if test "$dlself" != no; then 319832b578d3Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 319932b578d3Smrg fi 320032b578d3Smrg 320132b578d3Smrg set dummy $rpath 320232b578d3Smrg if test "$#" -gt 2; then 320332b578d3Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 320432b578d3Smrg fi 320532b578d3Smrg install_libdir="$2" 320632b578d3Smrg 320732b578d3Smrg oldlibs= 320832b578d3Smrg if test -z "$rpath"; then 320932b578d3Smrg if test "$build_libtool_libs" = yes; then 321032b578d3Smrg # Building a libtool convenience library. 321132b578d3Smrg # Some compilers have problems with a `.al' extension so 321232b578d3Smrg # convenience libraries should have the same extension an 321332b578d3Smrg # archive normally would. 321432b578d3Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 321532b578d3Smrg build_libtool_libs=convenience 321632b578d3Smrg build_old_libs=yes 321732b578d3Smrg fi 321832b578d3Smrg 321932b578d3Smrg if test -n "$vinfo"; then 322032b578d3Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 322132b578d3Smrg fi 322232b578d3Smrg 322332b578d3Smrg if test -n "$release"; then 322432b578d3Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 322532b578d3Smrg fi 322632b578d3Smrg else 322732b578d3Smrg 322832b578d3Smrg # Parse the version information argument. 322932b578d3Smrg save_ifs="$IFS"; IFS=':' 323032b578d3Smrg set dummy $vinfo 0 0 0 323132b578d3Smrg IFS="$save_ifs" 323232b578d3Smrg 323332b578d3Smrg if test -n "$8"; then 323432b578d3Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 323532b578d3Smrg $echo "$help" 1>&2 323632b578d3Smrg exit $EXIT_FAILURE 323732b578d3Smrg fi 323832b578d3Smrg 323932b578d3Smrg # convert absolute version numbers to libtool ages 324032b578d3Smrg # this retains compatibility with .la files and attempts 324132b578d3Smrg # to make the code below a bit more comprehensible 324232b578d3Smrg 324332b578d3Smrg case $vinfo_number in 324432b578d3Smrg yes) 324532b578d3Smrg number_major="$2" 324632b578d3Smrg number_minor="$3" 324732b578d3Smrg number_revision="$4" 324832b578d3Smrg # 324932b578d3Smrg # There are really only two kinds -- those that 325032b578d3Smrg # use the current revision as the major version 325132b578d3Smrg # and those that subtract age and use age as 325232b578d3Smrg # a minor version. But, then there is irix 325332b578d3Smrg # which has an extra 1 added just for fun 325432b578d3Smrg # 325532b578d3Smrg case $version_type in 32562a51b5beSmrg darwin|linux|osf|windows|none) 325732b578d3Smrg current=`expr $number_major + $number_minor` 325832b578d3Smrg age="$number_minor" 325932b578d3Smrg revision="$number_revision" 326032b578d3Smrg ;; 326132b578d3Smrg freebsd-aout|freebsd-elf|sunos) 326232b578d3Smrg current="$number_major" 326332b578d3Smrg revision="$number_minor" 326432b578d3Smrg age="0" 326532b578d3Smrg ;; 326632b578d3Smrg irix|nonstopux) 32672a51b5beSmrg current=`expr $number_major + $number_minor` 326832b578d3Smrg age="$number_minor" 326932b578d3Smrg revision="$number_minor" 32702a51b5beSmrg lt_irix_increment=no 327132b578d3Smrg ;; 327232b578d3Smrg esac 327332b578d3Smrg ;; 327432b578d3Smrg no) 327532b578d3Smrg current="$2" 327632b578d3Smrg revision="$3" 327732b578d3Smrg age="$4" 327832b578d3Smrg ;; 327932b578d3Smrg esac 328032b578d3Smrg 328132b578d3Smrg # Check that each of the things are valid numbers. 328232b578d3Smrg case $current in 328332b578d3Smrg 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]) ;; 328432b578d3Smrg *) 328532b578d3Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 328632b578d3Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 328732b578d3Smrg exit $EXIT_FAILURE 328832b578d3Smrg ;; 328932b578d3Smrg esac 329032b578d3Smrg 329132b578d3Smrg case $revision in 329232b578d3Smrg 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]) ;; 329332b578d3Smrg *) 329432b578d3Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 329532b578d3Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 329632b578d3Smrg exit $EXIT_FAILURE 329732b578d3Smrg ;; 329832b578d3Smrg esac 329932b578d3Smrg 330032b578d3Smrg case $age in 330132b578d3Smrg 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]) ;; 330232b578d3Smrg *) 330332b578d3Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 330432b578d3Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 330532b578d3Smrg exit $EXIT_FAILURE 330632b578d3Smrg ;; 330732b578d3Smrg esac 330832b578d3Smrg 330932b578d3Smrg if test "$age" -gt "$current"; then 331032b578d3Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 331132b578d3Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 331232b578d3Smrg exit $EXIT_FAILURE 331332b578d3Smrg fi 331432b578d3Smrg 331532b578d3Smrg # Calculate the version variables. 331632b578d3Smrg major= 331732b578d3Smrg versuffix= 331832b578d3Smrg verstring= 331932b578d3Smrg case $version_type in 332032b578d3Smrg none) ;; 332132b578d3Smrg 332232b578d3Smrg darwin) 332332b578d3Smrg # Like Linux, but with the current version available in 332432b578d3Smrg # verstring for coding it into the library header 332532b578d3Smrg major=.`expr $current - $age` 332632b578d3Smrg versuffix="$major.$age.$revision" 332732b578d3Smrg # Darwin ld doesn't like 0 for these options... 332832b578d3Smrg minor_current=`expr $current + 1` 33292a51b5beSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 33302a51b5beSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 333132b578d3Smrg ;; 333232b578d3Smrg 333332b578d3Smrg freebsd-aout) 333432b578d3Smrg major=".$current" 333532b578d3Smrg versuffix=".$current.$revision"; 333632b578d3Smrg ;; 333732b578d3Smrg 333832b578d3Smrg freebsd-elf) 333932b578d3Smrg major=".$current" 334032b578d3Smrg versuffix=".$current"; 334132b578d3Smrg ;; 334232b578d3Smrg 334332b578d3Smrg irix | nonstopux) 33442a51b5beSmrg if test "X$lt_irix_increment" = "Xno"; then 33452a51b5beSmrg major=`expr $current - $age` 33462a51b5beSmrg else 33472a51b5beSmrg major=`expr $current - $age + 1` 33482a51b5beSmrg fi 334932b578d3Smrg case $version_type in 335032b578d3Smrg nonstopux) verstring_prefix=nonstopux ;; 335132b578d3Smrg *) verstring_prefix=sgi ;; 335232b578d3Smrg esac 335332b578d3Smrg verstring="$verstring_prefix$major.$revision" 335432b578d3Smrg 335532b578d3Smrg # Add in all the interfaces that we are compatible with. 335632b578d3Smrg loop=$revision 335732b578d3Smrg while test "$loop" -ne 0; do 335832b578d3Smrg iface=`expr $revision - $loop` 335932b578d3Smrg loop=`expr $loop - 1` 336032b578d3Smrg verstring="$verstring_prefix$major.$iface:$verstring" 336132b578d3Smrg done 336232b578d3Smrg 336332b578d3Smrg # Before this point, $major must not contain `.'. 336432b578d3Smrg major=.$major 336532b578d3Smrg versuffix="$major.$revision" 336632b578d3Smrg ;; 336732b578d3Smrg 336832b578d3Smrg linux) 336932b578d3Smrg major=.`expr $current - $age` 337032b578d3Smrg versuffix="$major.$age.$revision" 337132b578d3Smrg ;; 337232b578d3Smrg 337332b578d3Smrg osf) 337432b578d3Smrg major=.`expr $current - $age` 337532b578d3Smrg versuffix=".$current.$age.$revision" 337632b578d3Smrg verstring="$current.$age.$revision" 337732b578d3Smrg 337832b578d3Smrg # Add in all the interfaces that we are compatible with. 337932b578d3Smrg loop=$age 338032b578d3Smrg while test "$loop" -ne 0; do 338132b578d3Smrg iface=`expr $current - $loop` 338232b578d3Smrg loop=`expr $loop - 1` 338332b578d3Smrg verstring="$verstring:${iface}.0" 338432b578d3Smrg done 338532b578d3Smrg 338632b578d3Smrg # Make executables depend on our current version. 338732b578d3Smrg verstring="$verstring:${current}.0" 338832b578d3Smrg ;; 338932b578d3Smrg 339032b578d3Smrg sunos) 339132b578d3Smrg major=".$current" 339232b578d3Smrg versuffix=".$current.$revision" 339332b578d3Smrg ;; 339432b578d3Smrg 339532b578d3Smrg windows) 339632b578d3Smrg # Use '-' rather than '.', since we only want one 339732b578d3Smrg # extension on DOS 8.3 filesystems. 339832b578d3Smrg major=`expr $current - $age` 339932b578d3Smrg versuffix="-$major" 340032b578d3Smrg ;; 340132b578d3Smrg 340232b578d3Smrg *) 340332b578d3Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 340432b578d3Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 340532b578d3Smrg exit $EXIT_FAILURE 340632b578d3Smrg ;; 340732b578d3Smrg esac 340832b578d3Smrg 340932b578d3Smrg # Clear the version info if we defaulted, and they specified a release. 341032b578d3Smrg if test -z "$vinfo" && test -n "$release"; then 341132b578d3Smrg major= 341232b578d3Smrg case $version_type in 341332b578d3Smrg darwin) 341432b578d3Smrg # we can't check for "0.0" in archive_cmds due to quoting 341532b578d3Smrg # problems, so we reset it completely 341632b578d3Smrg verstring= 341732b578d3Smrg ;; 341832b578d3Smrg *) 341932b578d3Smrg verstring="0.0" 342032b578d3Smrg ;; 342132b578d3Smrg esac 342232b578d3Smrg if test "$need_version" = no; then 342332b578d3Smrg versuffix= 342432b578d3Smrg else 342532b578d3Smrg versuffix=".0.0" 342632b578d3Smrg fi 342732b578d3Smrg fi 342832b578d3Smrg 342932b578d3Smrg # Remove version info from name if versioning should be avoided 343032b578d3Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 343132b578d3Smrg major= 343232b578d3Smrg versuffix= 343332b578d3Smrg verstring="" 343432b578d3Smrg fi 343532b578d3Smrg 343632b578d3Smrg # Check to see if the archive will have undefined symbols. 343732b578d3Smrg if test "$allow_undefined" = yes; then 343832b578d3Smrg if test "$allow_undefined_flag" = unsupported; then 343932b578d3Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 344032b578d3Smrg build_libtool_libs=no 344132b578d3Smrg build_old_libs=yes 344232b578d3Smrg fi 344332b578d3Smrg else 344432b578d3Smrg # Don't allow undefined symbols. 344532b578d3Smrg allow_undefined_flag="$no_undefined_flag" 344632b578d3Smrg fi 344732b578d3Smrg fi 344832b578d3Smrg 344932b578d3Smrg if test "$mode" != relink; then 345032b578d3Smrg # Remove our outputs, but don't remove object files since they 345132b578d3Smrg # may have been created when compiling PIC objects. 345232b578d3Smrg removelist= 345332b578d3Smrg tempremovelist=`$echo "$output_objdir/*"` 345432b578d3Smrg for p in $tempremovelist; do 345532b578d3Smrg case $p in 345632b578d3Smrg *.$objext) 345732b578d3Smrg ;; 345832b578d3Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 345932b578d3Smrg if test "X$precious_files_regex" != "X"; then 346032b578d3Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 346132b578d3Smrg then 346232b578d3Smrg continue 346332b578d3Smrg fi 346432b578d3Smrg fi 346532b578d3Smrg removelist="$removelist $p" 346632b578d3Smrg ;; 346732b578d3Smrg *) ;; 346832b578d3Smrg esac 346932b578d3Smrg done 347032b578d3Smrg if test -n "$removelist"; then 347132b578d3Smrg $show "${rm}r $removelist" 347232b578d3Smrg $run ${rm}r $removelist 347332b578d3Smrg fi 347432b578d3Smrg fi 347532b578d3Smrg 347632b578d3Smrg # Now set the variables for building old libraries. 347732b578d3Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 347832b578d3Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 347932b578d3Smrg 348032b578d3Smrg # Transform .lo files to .o files. 348132b578d3Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 348232b578d3Smrg fi 348332b578d3Smrg 348432b578d3Smrg # Eliminate all temporary directories. 34852a51b5beSmrg #for path in $notinst_path; do 34862a51b5beSmrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 34872a51b5beSmrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 34882a51b5beSmrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 34892a51b5beSmrg #done 349032b578d3Smrg 349132b578d3Smrg if test -n "$xrpath"; then 349232b578d3Smrg # If the user specified any rpath flags, then add them. 349332b578d3Smrg temp_xrpath= 349432b578d3Smrg for libdir in $xrpath; do 349532b578d3Smrg temp_xrpath="$temp_xrpath -R$libdir" 349632b578d3Smrg case "$finalize_rpath " in 349732b578d3Smrg *" $libdir "*) ;; 349832b578d3Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 349932b578d3Smrg esac 350032b578d3Smrg done 350132b578d3Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 350232b578d3Smrg dependency_libs="$temp_xrpath $dependency_libs" 350332b578d3Smrg fi 350432b578d3Smrg fi 350532b578d3Smrg 350632b578d3Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 350732b578d3Smrg old_dlfiles="$dlfiles" 350832b578d3Smrg dlfiles= 350932b578d3Smrg for lib in $old_dlfiles; do 351032b578d3Smrg case " $dlprefiles $dlfiles " in 351132b578d3Smrg *" $lib "*) ;; 351232b578d3Smrg *) dlfiles="$dlfiles $lib" ;; 351332b578d3Smrg esac 351432b578d3Smrg done 351532b578d3Smrg 351632b578d3Smrg # Make sure dlprefiles contains only unique files 351732b578d3Smrg old_dlprefiles="$dlprefiles" 351832b578d3Smrg dlprefiles= 351932b578d3Smrg for lib in $old_dlprefiles; do 352032b578d3Smrg case "$dlprefiles " in 352132b578d3Smrg *" $lib "*) ;; 352232b578d3Smrg *) dlprefiles="$dlprefiles $lib" ;; 352332b578d3Smrg esac 352432b578d3Smrg done 352532b578d3Smrg 352632b578d3Smrg if test "$build_libtool_libs" = yes; then 352732b578d3Smrg if test -n "$rpath"; then 352832b578d3Smrg case $host in 352932b578d3Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 353032b578d3Smrg # these systems don't actually have a c library (as such)! 353132b578d3Smrg ;; 353232b578d3Smrg *-*-rhapsody* | *-*-darwin1.[012]) 353332b578d3Smrg # Rhapsody C library is in the System framework 353432b578d3Smrg deplibs="$deplibs -framework System" 353532b578d3Smrg ;; 353632b578d3Smrg *-*-netbsd*) 353732b578d3Smrg # Don't link with libc until the a.out ld.so is fixed. 353832b578d3Smrg ;; 353932b578d3Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 354032b578d3Smrg # Do not include libc due to us having libc/libc_r. 354132b578d3Smrg ;; 354232b578d3Smrg *-*-sco3.2v5* | *-*-sco5v6*) 354332b578d3Smrg # Causes problems with __ctype 354432b578d3Smrg ;; 354532b578d3Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 354632b578d3Smrg # Compiler inserts libc in the correct place for threads to work 354732b578d3Smrg ;; 354832b578d3Smrg *) 354932b578d3Smrg # Add libc to deplibs on all other systems if necessary. 355032b578d3Smrg if test "$build_libtool_need_lc" = "yes"; then 355132b578d3Smrg deplibs="$deplibs -lc" 355232b578d3Smrg fi 355332b578d3Smrg ;; 355432b578d3Smrg esac 355532b578d3Smrg fi 355632b578d3Smrg 355732b578d3Smrg # Transform deplibs into only deplibs that can be linked in shared. 355832b578d3Smrg name_save=$name 355932b578d3Smrg libname_save=$libname 356032b578d3Smrg release_save=$release 356132b578d3Smrg versuffix_save=$versuffix 356232b578d3Smrg major_save=$major 356332b578d3Smrg # I'm not sure if I'm treating the release correctly. I think 356432b578d3Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 356532b578d3Smrg # add it in twice. Is that correct? 356632b578d3Smrg release="" 356732b578d3Smrg versuffix="" 356832b578d3Smrg major="" 356932b578d3Smrg newdeplibs= 357032b578d3Smrg droppeddeps=no 357132b578d3Smrg case $deplibs_check_method in 357232b578d3Smrg pass_all) 357332b578d3Smrg # Don't check for shared/static. Everything works. 357432b578d3Smrg # This might be a little naive. We might want to check 357532b578d3Smrg # whether the library exists or not. But this is on 357632b578d3Smrg # osf3 & osf4 and I'm not really sure... Just 357732b578d3Smrg # implementing what was already the behavior. 357832b578d3Smrg newdeplibs=$deplibs 357932b578d3Smrg ;; 358032b578d3Smrg test_compile) 358132b578d3Smrg # This code stresses the "libraries are programs" paradigm to its 358232b578d3Smrg # limits. Maybe even breaks it. We compile a program, linking it 358332b578d3Smrg # against the deplibs as a proxy for the library. Then we can check 358432b578d3Smrg # whether they linked in statically or dynamically with ldd. 358532b578d3Smrg $rm conftest.c 358632b578d3Smrg cat > conftest.c <<EOF 358732b578d3Smrg int main() { return 0; } 358832b578d3SmrgEOF 358932b578d3Smrg $rm conftest 35902a51b5beSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 359132b578d3Smrg ldd_output=`ldd conftest` 359232b578d3Smrg for i in $deplibs; do 359332b578d3Smrg name=`expr $i : '-l\(.*\)'` 359432b578d3Smrg # If $name is empty we are operating on a -L argument. 35952a51b5beSmrg if test "$name" != "" && test "$name" != "0"; then 359632b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 359732b578d3Smrg case " $predeps $postdeps " in 359832b578d3Smrg *" $i "*) 359932b578d3Smrg newdeplibs="$newdeplibs $i" 360032b578d3Smrg i="" 360132b578d3Smrg ;; 360232b578d3Smrg esac 360332b578d3Smrg fi 360432b578d3Smrg if test -n "$i" ; then 360532b578d3Smrg libname=`eval \\$echo \"$libname_spec\"` 360632b578d3Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 360732b578d3Smrg set dummy $deplib_matches 360832b578d3Smrg deplib_match=$2 360932b578d3Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 361032b578d3Smrg newdeplibs="$newdeplibs $i" 361132b578d3Smrg else 361232b578d3Smrg droppeddeps=yes 361332b578d3Smrg $echo 361432b578d3Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 361532b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 361632b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 361732b578d3Smrg $echo "*** shared version of the library, which I believe you do not have" 361832b578d3Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 361932b578d3Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 362032b578d3Smrg fi 362132b578d3Smrg fi 362232b578d3Smrg else 362332b578d3Smrg newdeplibs="$newdeplibs $i" 362432b578d3Smrg fi 362532b578d3Smrg done 362632b578d3Smrg else 362732b578d3Smrg # Error occurred in the first compile. Let's try to salvage 362832b578d3Smrg # the situation: Compile a separate program for each library. 362932b578d3Smrg for i in $deplibs; do 363032b578d3Smrg name=`expr $i : '-l\(.*\)'` 363132b578d3Smrg # If $name is empty we are operating on a -L argument. 363232b578d3Smrg if test "$name" != "" && test "$name" != "0"; then 363332b578d3Smrg $rm conftest 36342a51b5beSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 363532b578d3Smrg ldd_output=`ldd conftest` 363632b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 363732b578d3Smrg case " $predeps $postdeps " in 363832b578d3Smrg *" $i "*) 363932b578d3Smrg newdeplibs="$newdeplibs $i" 364032b578d3Smrg i="" 364132b578d3Smrg ;; 364232b578d3Smrg esac 364332b578d3Smrg fi 364432b578d3Smrg if test -n "$i" ; then 364532b578d3Smrg libname=`eval \\$echo \"$libname_spec\"` 364632b578d3Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 364732b578d3Smrg set dummy $deplib_matches 364832b578d3Smrg deplib_match=$2 364932b578d3Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 365032b578d3Smrg newdeplibs="$newdeplibs $i" 365132b578d3Smrg else 365232b578d3Smrg droppeddeps=yes 365332b578d3Smrg $echo 365432b578d3Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 365532b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 365632b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 365732b578d3Smrg $echo "*** shared version of the library, which you do not appear to have" 365832b578d3Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 365932b578d3Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 366032b578d3Smrg fi 366132b578d3Smrg fi 366232b578d3Smrg else 366332b578d3Smrg droppeddeps=yes 366432b578d3Smrg $echo 366532b578d3Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 36662a51b5beSmrg $echo "*** make it link in! You will probably need to install it or some" 366732b578d3Smrg $echo "*** library that it depends on before this library will be fully" 366832b578d3Smrg $echo "*** functional. Installing it before continuing would be even better." 366932b578d3Smrg fi 367032b578d3Smrg else 367132b578d3Smrg newdeplibs="$newdeplibs $i" 367232b578d3Smrg fi 367332b578d3Smrg done 367432b578d3Smrg fi 367532b578d3Smrg ;; 367632b578d3Smrg file_magic*) 367732b578d3Smrg set dummy $deplibs_check_method 367832b578d3Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 367932b578d3Smrg for a_deplib in $deplibs; do 368032b578d3Smrg name=`expr $a_deplib : '-l\(.*\)'` 368132b578d3Smrg # If $name is empty we are operating on a -L argument. 368232b578d3Smrg if test "$name" != "" && test "$name" != "0"; then 368332b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 368432b578d3Smrg case " $predeps $postdeps " in 368532b578d3Smrg *" $a_deplib "*) 368632b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 368732b578d3Smrg a_deplib="" 368832b578d3Smrg ;; 368932b578d3Smrg esac 369032b578d3Smrg fi 369132b578d3Smrg if test -n "$a_deplib" ; then 369232b578d3Smrg libname=`eval \\$echo \"$libname_spec\"` 369332b578d3Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 369432b578d3Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 369532b578d3Smrg for potent_lib in $potential_libs; do 369632b578d3Smrg # Follow soft links. 369732b578d3Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 369832b578d3Smrg | grep " -> " >/dev/null; then 369932b578d3Smrg continue 370032b578d3Smrg fi 370132b578d3Smrg # The statement above tries to avoid entering an 370232b578d3Smrg # endless loop below, in case of cyclic links. 370332b578d3Smrg # We might still enter an endless loop, since a link 370432b578d3Smrg # loop can be closed while we follow links, 370532b578d3Smrg # but so what? 370632b578d3Smrg potlib="$potent_lib" 370732b578d3Smrg while test -h "$potlib" 2>/dev/null; do 370832b578d3Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 370932b578d3Smrg case $potliblink in 371032b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 371132b578d3Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 371232b578d3Smrg esac 371332b578d3Smrg done 371432b578d3Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 371532b578d3Smrg | ${SED} 10q \ 371632b578d3Smrg | $EGREP "$file_magic_regex" > /dev/null; then 371732b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 371832b578d3Smrg a_deplib="" 371932b578d3Smrg break 2 372032b578d3Smrg fi 372132b578d3Smrg done 372232b578d3Smrg done 372332b578d3Smrg fi 372432b578d3Smrg if test -n "$a_deplib" ; then 372532b578d3Smrg droppeddeps=yes 372632b578d3Smrg $echo 372732b578d3Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 372832b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 372932b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 373032b578d3Smrg $echo "*** shared version of the library, which you do not appear to have" 373132b578d3Smrg $echo "*** because I did check the linker path looking for a file starting" 373232b578d3Smrg if test -z "$potlib" ; then 373332b578d3Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 373432b578d3Smrg else 373532b578d3Smrg $echo "*** with $libname and none of the candidates passed a file format test" 373632b578d3Smrg $echo "*** using a file magic. Last file checked: $potlib" 373732b578d3Smrg fi 373832b578d3Smrg fi 373932b578d3Smrg else 374032b578d3Smrg # Add a -L argument. 374132b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 374232b578d3Smrg fi 374332b578d3Smrg done # Gone through all deplibs. 374432b578d3Smrg ;; 374532b578d3Smrg match_pattern*) 374632b578d3Smrg set dummy $deplibs_check_method 374732b578d3Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 374832b578d3Smrg for a_deplib in $deplibs; do 374932b578d3Smrg name=`expr $a_deplib : '-l\(.*\)'` 375032b578d3Smrg # If $name is empty we are operating on a -L argument. 375132b578d3Smrg if test -n "$name" && test "$name" != "0"; then 375232b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 375332b578d3Smrg case " $predeps $postdeps " in 375432b578d3Smrg *" $a_deplib "*) 375532b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 375632b578d3Smrg a_deplib="" 375732b578d3Smrg ;; 375832b578d3Smrg esac 375932b578d3Smrg fi 376032b578d3Smrg if test -n "$a_deplib" ; then 376132b578d3Smrg libname=`eval \\$echo \"$libname_spec\"` 376232b578d3Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 376332b578d3Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 376432b578d3Smrg for potent_lib in $potential_libs; do 376532b578d3Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 376632b578d3Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 376732b578d3Smrg | ${SED} 10q \ 376832b578d3Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 376932b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 377032b578d3Smrg a_deplib="" 377132b578d3Smrg break 2 377232b578d3Smrg fi 377332b578d3Smrg done 377432b578d3Smrg done 377532b578d3Smrg fi 377632b578d3Smrg if test -n "$a_deplib" ; then 377732b578d3Smrg droppeddeps=yes 377832b578d3Smrg $echo 377932b578d3Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 378032b578d3Smrg $echo "*** I have the capability to make that library automatically link in when" 378132b578d3Smrg $echo "*** you link to this library. But I can only do this if you have a" 378232b578d3Smrg $echo "*** shared version of the library, which you do not appear to have" 378332b578d3Smrg $echo "*** because I did check the linker path looking for a file starting" 378432b578d3Smrg if test -z "$potlib" ; then 378532b578d3Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 378632b578d3Smrg else 378732b578d3Smrg $echo "*** with $libname and none of the candidates passed a file format test" 378832b578d3Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 378932b578d3Smrg fi 379032b578d3Smrg fi 379132b578d3Smrg else 379232b578d3Smrg # Add a -L argument. 379332b578d3Smrg newdeplibs="$newdeplibs $a_deplib" 379432b578d3Smrg fi 379532b578d3Smrg done # Gone through all deplibs. 379632b578d3Smrg ;; 379732b578d3Smrg none | unknown | *) 379832b578d3Smrg newdeplibs="" 379932b578d3Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 380032b578d3Smrg -e 's/ -[LR][^ ]*//g'` 380132b578d3Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 380232b578d3Smrg for i in $predeps $postdeps ; do 380332b578d3Smrg # can't use Xsed below, because $i might contain '/' 380432b578d3Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 380532b578d3Smrg done 380632b578d3Smrg fi 380732b578d3Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 380832b578d3Smrg | grep . >/dev/null; then 380932b578d3Smrg $echo 381032b578d3Smrg if test "X$deplibs_check_method" = "Xnone"; then 381132b578d3Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 381232b578d3Smrg else 381332b578d3Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 381432b578d3Smrg fi 381532b578d3Smrg $echo "*** All declared inter-library dependencies are being dropped." 381632b578d3Smrg droppeddeps=yes 381732b578d3Smrg fi 381832b578d3Smrg ;; 381932b578d3Smrg esac 382032b578d3Smrg versuffix=$versuffix_save 382132b578d3Smrg major=$major_save 382232b578d3Smrg release=$release_save 382332b578d3Smrg libname=$libname_save 382432b578d3Smrg name=$name_save 382532b578d3Smrg 382632b578d3Smrg case $host in 382732b578d3Smrg *-*-rhapsody* | *-*-darwin1.[012]) 382832b578d3Smrg # On Rhapsody replace the C library is the System framework 382932b578d3Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 383032b578d3Smrg ;; 383132b578d3Smrg esac 383232b578d3Smrg 383332b578d3Smrg if test "$droppeddeps" = yes; then 383432b578d3Smrg if test "$module" = yes; then 383532b578d3Smrg $echo 383632b578d3Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 383732b578d3Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 383832b578d3Smrg $echo "*** a static module, that should work as long as the dlopening" 383932b578d3Smrg $echo "*** application is linked with the -dlopen flag." 384032b578d3Smrg if test -z "$global_symbol_pipe"; then 384132b578d3Smrg $echo 384232b578d3Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 384332b578d3Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 384432b578d3Smrg $echo "*** not find such a program. So, this module is probably useless." 384532b578d3Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 384632b578d3Smrg fi 384732b578d3Smrg if test "$build_old_libs" = no; then 384832b578d3Smrg oldlibs="$output_objdir/$libname.$libext" 384932b578d3Smrg build_libtool_libs=module 385032b578d3Smrg build_old_libs=yes 385132b578d3Smrg else 385232b578d3Smrg build_libtool_libs=no 385332b578d3Smrg fi 385432b578d3Smrg else 385532b578d3Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 385632b578d3Smrg $echo "*** automatically added whenever a program is linked with this library" 385732b578d3Smrg $echo "*** or is declared to -dlopen it." 385832b578d3Smrg 385932b578d3Smrg if test "$allow_undefined" = no; then 386032b578d3Smrg $echo 386132b578d3Smrg $echo "*** Since this library must not contain undefined symbols," 386232b578d3Smrg $echo "*** because either the platform does not support them or" 386332b578d3Smrg $echo "*** it was explicitly requested with -no-undefined," 386432b578d3Smrg $echo "*** libtool will only create a static version of it." 386532b578d3Smrg if test "$build_old_libs" = no; then 386632b578d3Smrg oldlibs="$output_objdir/$libname.$libext" 386732b578d3Smrg build_libtool_libs=module 386832b578d3Smrg build_old_libs=yes 386932b578d3Smrg else 387032b578d3Smrg build_libtool_libs=no 387132b578d3Smrg fi 387232b578d3Smrg fi 387332b578d3Smrg fi 387432b578d3Smrg fi 387532b578d3Smrg # Done checking deplibs! 387632b578d3Smrg deplibs=$newdeplibs 387732b578d3Smrg fi 387832b578d3Smrg 387932b578d3Smrg 388032b578d3Smrg # move library search paths that coincide with paths to not yet 388132b578d3Smrg # installed libraries to the beginning of the library search list 388232b578d3Smrg new_libs= 388332b578d3Smrg for path in $notinst_path; do 388432b578d3Smrg case " $new_libs " in 388532b578d3Smrg *" -L$path/$objdir "*) ;; 388632b578d3Smrg *) 388732b578d3Smrg case " $deplibs " in 388832b578d3Smrg *" -L$path/$objdir "*) 388932b578d3Smrg new_libs="$new_libs -L$path/$objdir" ;; 389032b578d3Smrg esac 389132b578d3Smrg ;; 389232b578d3Smrg esac 389332b578d3Smrg done 389432b578d3Smrg for deplib in $deplibs; do 389532b578d3Smrg case $deplib in 389632b578d3Smrg -L*) 389732b578d3Smrg case " $new_libs " in 389832b578d3Smrg *" $deplib "*) ;; 389932b578d3Smrg *) new_libs="$new_libs $deplib" ;; 390032b578d3Smrg esac 390132b578d3Smrg ;; 390232b578d3Smrg *) new_libs="$new_libs $deplib" ;; 390332b578d3Smrg esac 390432b578d3Smrg done 390532b578d3Smrg deplibs="$new_libs" 390632b578d3Smrg 390732b578d3Smrg 390832b578d3Smrg # All the library-specific variables (install_libdir is set above). 390932b578d3Smrg library_names= 391032b578d3Smrg old_library= 391132b578d3Smrg dlname= 391232b578d3Smrg 391332b578d3Smrg # Test again, we may have decided not to build it any more 391432b578d3Smrg if test "$build_libtool_libs" = yes; then 391532b578d3Smrg if test "$hardcode_into_libs" = yes; then 391632b578d3Smrg # Hardcode the library paths 391732b578d3Smrg hardcode_libdirs= 391832b578d3Smrg dep_rpath= 391932b578d3Smrg rpath="$finalize_rpath" 392032b578d3Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 392132b578d3Smrg for libdir in $rpath; do 392232b578d3Smrg if test -n "$hardcode_libdir_flag_spec"; then 392332b578d3Smrg if test -n "$hardcode_libdir_separator"; then 392432b578d3Smrg if test -z "$hardcode_libdirs"; then 392532b578d3Smrg hardcode_libdirs="$libdir" 392632b578d3Smrg else 392732b578d3Smrg # Just accumulate the unique libdirs. 392832b578d3Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 392932b578d3Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 393032b578d3Smrg ;; 393132b578d3Smrg *) 393232b578d3Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 393332b578d3Smrg ;; 393432b578d3Smrg esac 393532b578d3Smrg fi 393632b578d3Smrg else 393732b578d3Smrg eval flag=\"$hardcode_libdir_flag_spec\" 393832b578d3Smrg dep_rpath="$dep_rpath $flag" 393932b578d3Smrg fi 394032b578d3Smrg elif test -n "$runpath_var"; then 394132b578d3Smrg case "$perm_rpath " in 394232b578d3Smrg *" $libdir "*) ;; 394332b578d3Smrg *) perm_rpath="$perm_rpath $libdir" ;; 394432b578d3Smrg esac 394532b578d3Smrg fi 394632b578d3Smrg done 394732b578d3Smrg # Substitute the hardcoded libdirs into the rpath. 394832b578d3Smrg if test -n "$hardcode_libdir_separator" && 394932b578d3Smrg test -n "$hardcode_libdirs"; then 395032b578d3Smrg libdir="$hardcode_libdirs" 395132b578d3Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 39522a51b5beSmrg case $archive_cmds in 39532a51b5beSmrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 39542a51b5beSmrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 39552a51b5beSmrg esac 395632b578d3Smrg else 395732b578d3Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 395832b578d3Smrg fi 395932b578d3Smrg fi 396032b578d3Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 396132b578d3Smrg # We should set the runpath_var. 396232b578d3Smrg rpath= 396332b578d3Smrg for dir in $perm_rpath; do 396432b578d3Smrg rpath="$rpath$dir:" 396532b578d3Smrg done 396632b578d3Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 396732b578d3Smrg fi 396832b578d3Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 396932b578d3Smrg fi 397032b578d3Smrg 397132b578d3Smrg shlibpath="$finalize_shlibpath" 397232b578d3Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 397332b578d3Smrg if test -n "$shlibpath"; then 397432b578d3Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 397532b578d3Smrg fi 397632b578d3Smrg 397732b578d3Smrg # Get the real and link names of the library. 397832b578d3Smrg eval shared_ext=\"$shrext_cmds\" 397932b578d3Smrg eval library_names=\"$library_names_spec\" 398032b578d3Smrg set dummy $library_names 398132b578d3Smrg realname="$2" 398232b578d3Smrg shift; shift 398332b578d3Smrg 398432b578d3Smrg if test -n "$soname_spec"; then 398532b578d3Smrg eval soname=\"$soname_spec\" 398632b578d3Smrg else 398732b578d3Smrg soname="$realname" 398832b578d3Smrg fi 398932b578d3Smrg if test -z "$dlname"; then 399032b578d3Smrg dlname=$soname 399132b578d3Smrg fi 399232b578d3Smrg 399332b578d3Smrg lib="$output_objdir/$realname" 399432b578d3Smrg linknames= 399532b578d3Smrg for link 399632b578d3Smrg do 399732b578d3Smrg linknames="$linknames $link" 399832b578d3Smrg done 399932b578d3Smrg 400032b578d3Smrg # Use standard objects if they are pic 400132b578d3Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 400232b578d3Smrg 400332b578d3Smrg # Prepare the list of exported symbols 400432b578d3Smrg if test -z "$export_symbols"; then 400532b578d3Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 400632b578d3Smrg $show "generating symbol list for \`$libname.la'" 400732b578d3Smrg export_symbols="$output_objdir/$libname.exp" 400832b578d3Smrg $run $rm $export_symbols 400932b578d3Smrg cmds=$export_symbols_cmds 401032b578d3Smrg save_ifs="$IFS"; IFS='~' 401132b578d3Smrg for cmd in $cmds; do 401232b578d3Smrg IFS="$save_ifs" 401332b578d3Smrg eval cmd=\"$cmd\" 401432b578d3Smrg if len=`expr "X$cmd" : ".*"` && 401532b578d3Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 401632b578d3Smrg $show "$cmd" 401732b578d3Smrg $run eval "$cmd" || exit $? 401832b578d3Smrg skipped_export=false 401932b578d3Smrg else 402032b578d3Smrg # The command line is too long to execute in one step. 402132b578d3Smrg $show "using reloadable object file for export list..." 402232b578d3Smrg skipped_export=: 402332b578d3Smrg # Break out early, otherwise skipped_export may be 402432b578d3Smrg # set to false by a later but shorter cmd. 402532b578d3Smrg break 402632b578d3Smrg fi 402732b578d3Smrg done 402832b578d3Smrg IFS="$save_ifs" 402932b578d3Smrg if test -n "$export_symbols_regex"; then 403032b578d3Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 403132b578d3Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 403232b578d3Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 403332b578d3Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 403432b578d3Smrg fi 403532b578d3Smrg fi 403632b578d3Smrg fi 403732b578d3Smrg 403832b578d3Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 403932b578d3Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 404032b578d3Smrg fi 404132b578d3Smrg 404232b578d3Smrg tmp_deplibs= 404332b578d3Smrg for test_deplib in $deplibs; do 404432b578d3Smrg case " $convenience " in 404532b578d3Smrg *" $test_deplib "*) ;; 404632b578d3Smrg *) 404732b578d3Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 404832b578d3Smrg ;; 404932b578d3Smrg esac 405032b578d3Smrg done 405132b578d3Smrg deplibs="$tmp_deplibs" 405232b578d3Smrg 405332b578d3Smrg if test -n "$convenience"; then 405432b578d3Smrg if test -n "$whole_archive_flag_spec"; then 405532b578d3Smrg save_libobjs=$libobjs 405632b578d3Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 405732b578d3Smrg else 405832b578d3Smrg gentop="$output_objdir/${outputname}x" 405932b578d3Smrg generated="$generated $gentop" 406032b578d3Smrg 406132b578d3Smrg func_extract_archives $gentop $convenience 406232b578d3Smrg libobjs="$libobjs $func_extract_archives_result" 406332b578d3Smrg fi 406432b578d3Smrg fi 406532b578d3Smrg 406632b578d3Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 406732b578d3Smrg eval flag=\"$thread_safe_flag_spec\" 406832b578d3Smrg linker_flags="$linker_flags $flag" 406932b578d3Smrg fi 407032b578d3Smrg 407132b578d3Smrg # Make a backup of the uninstalled library when relinking 407232b578d3Smrg if test "$mode" = relink; then 407332b578d3Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 407432b578d3Smrg fi 407532b578d3Smrg 407632b578d3Smrg # Do each of the archive commands. 407732b578d3Smrg if test "$module" = yes && test -n "$module_cmds" ; then 407832b578d3Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 407932b578d3Smrg eval test_cmds=\"$module_expsym_cmds\" 408032b578d3Smrg cmds=$module_expsym_cmds 408132b578d3Smrg else 408232b578d3Smrg eval test_cmds=\"$module_cmds\" 408332b578d3Smrg cmds=$module_cmds 408432b578d3Smrg fi 408532b578d3Smrg else 408632b578d3Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 408732b578d3Smrg eval test_cmds=\"$archive_expsym_cmds\" 408832b578d3Smrg cmds=$archive_expsym_cmds 408932b578d3Smrg else 409032b578d3Smrg eval test_cmds=\"$archive_cmds\" 409132b578d3Smrg cmds=$archive_cmds 409232b578d3Smrg fi 409332b578d3Smrg fi 409432b578d3Smrg 409532b578d3Smrg if test "X$skipped_export" != "X:" && 409632b578d3Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 409732b578d3Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 409832b578d3Smrg : 409932b578d3Smrg else 410032b578d3Smrg # The command line is too long to link in one step, link piecewise. 410132b578d3Smrg $echo "creating reloadable object files..." 410232b578d3Smrg 410332b578d3Smrg # Save the value of $output and $libobjs because we want to 410432b578d3Smrg # use them later. If we have whole_archive_flag_spec, we 410532b578d3Smrg # want to use save_libobjs as it was before 410632b578d3Smrg # whole_archive_flag_spec was expanded, because we can't 410732b578d3Smrg # assume the linker understands whole_archive_flag_spec. 410832b578d3Smrg # This may have to be revisited, in case too many 410932b578d3Smrg # convenience libraries get linked in and end up exceeding 411032b578d3Smrg # the spec. 411132b578d3Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 411232b578d3Smrg save_libobjs=$libobjs 411332b578d3Smrg fi 411432b578d3Smrg save_output=$output 411532b578d3Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 411632b578d3Smrg 411732b578d3Smrg # Clear the reloadable object creation command queue and 411832b578d3Smrg # initialize k to one. 411932b578d3Smrg test_cmds= 412032b578d3Smrg concat_cmds= 412132b578d3Smrg objlist= 412232b578d3Smrg delfiles= 412332b578d3Smrg last_robj= 412432b578d3Smrg k=1 412532b578d3Smrg output=$output_objdir/$output_la-${k}.$objext 412632b578d3Smrg # Loop over the list of objects to be linked. 412732b578d3Smrg for obj in $save_libobjs 412832b578d3Smrg do 412932b578d3Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 413032b578d3Smrg if test "X$objlist" = X || 413132b578d3Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 413232b578d3Smrg test "$len" -le "$max_cmd_len"; }; then 413332b578d3Smrg objlist="$objlist $obj" 413432b578d3Smrg else 413532b578d3Smrg # The command $test_cmds is almost too long, add a 413632b578d3Smrg # command to the queue. 413732b578d3Smrg if test "$k" -eq 1 ; then 413832b578d3Smrg # The first file doesn't have a previous command to add. 413932b578d3Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 414032b578d3Smrg else 414132b578d3Smrg # All subsequent reloadable object files will link in 414232b578d3Smrg # the last one created. 414332b578d3Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 414432b578d3Smrg fi 414532b578d3Smrg last_robj=$output_objdir/$output_la-${k}.$objext 414632b578d3Smrg k=`expr $k + 1` 414732b578d3Smrg output=$output_objdir/$output_la-${k}.$objext 414832b578d3Smrg objlist=$obj 414932b578d3Smrg len=1 415032b578d3Smrg fi 415132b578d3Smrg done 415232b578d3Smrg # Handle the remaining objects by creating one last 415332b578d3Smrg # reloadable object file. All subsequent reloadable object 415432b578d3Smrg # files will link in the last one created. 415532b578d3Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 415632b578d3Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 415732b578d3Smrg 415832b578d3Smrg if ${skipped_export-false}; then 415932b578d3Smrg $show "generating symbol list for \`$libname.la'" 416032b578d3Smrg export_symbols="$output_objdir/$libname.exp" 416132b578d3Smrg $run $rm $export_symbols 416232b578d3Smrg libobjs=$output 416332b578d3Smrg # Append the command to create the export file. 416432b578d3Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 416532b578d3Smrg fi 416632b578d3Smrg 416732b578d3Smrg # Set up a command to remove the reloadable object files 416832b578d3Smrg # after they are used. 416932b578d3Smrg i=0 417032b578d3Smrg while test "$i" -lt "$k" 417132b578d3Smrg do 417232b578d3Smrg i=`expr $i + 1` 417332b578d3Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 417432b578d3Smrg done 417532b578d3Smrg 417632b578d3Smrg $echo "creating a temporary reloadable object file: $output" 417732b578d3Smrg 417832b578d3Smrg # Loop through the commands generated above and execute them. 417932b578d3Smrg save_ifs="$IFS"; IFS='~' 418032b578d3Smrg for cmd in $concat_cmds; do 418132b578d3Smrg IFS="$save_ifs" 418232b578d3Smrg $show "$cmd" 418332b578d3Smrg $run eval "$cmd" || exit $? 418432b578d3Smrg done 418532b578d3Smrg IFS="$save_ifs" 418632b578d3Smrg 418732b578d3Smrg libobjs=$output 418832b578d3Smrg # Restore the value of output. 418932b578d3Smrg output=$save_output 419032b578d3Smrg 419132b578d3Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 419232b578d3Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 419332b578d3Smrg fi 419432b578d3Smrg # Expand the library linking commands again to reset the 419532b578d3Smrg # value of $libobjs for piecewise linking. 419632b578d3Smrg 419732b578d3Smrg # Do each of the archive commands. 419832b578d3Smrg if test "$module" = yes && test -n "$module_cmds" ; then 419932b578d3Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 420032b578d3Smrg cmds=$module_expsym_cmds 420132b578d3Smrg else 420232b578d3Smrg cmds=$module_cmds 420332b578d3Smrg fi 420432b578d3Smrg else 420532b578d3Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 420632b578d3Smrg cmds=$archive_expsym_cmds 420732b578d3Smrg else 420832b578d3Smrg cmds=$archive_cmds 420932b578d3Smrg fi 421032b578d3Smrg fi 421132b578d3Smrg 421232b578d3Smrg # Append the command to remove the reloadable object files 421332b578d3Smrg # to the just-reset $cmds. 421432b578d3Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 421532b578d3Smrg fi 421632b578d3Smrg save_ifs="$IFS"; IFS='~' 421732b578d3Smrg for cmd in $cmds; do 421832b578d3Smrg IFS="$save_ifs" 421932b578d3Smrg eval cmd=\"$cmd\" 422032b578d3Smrg $show "$cmd" 422132b578d3Smrg $run eval "$cmd" || { 422232b578d3Smrg lt_exit=$? 422332b578d3Smrg 422432b578d3Smrg # Restore the uninstalled library and exit 422532b578d3Smrg if test "$mode" = relink; then 422632b578d3Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 422732b578d3Smrg fi 422832b578d3Smrg 422932b578d3Smrg exit $lt_exit 423032b578d3Smrg } 423132b578d3Smrg done 423232b578d3Smrg IFS="$save_ifs" 423332b578d3Smrg 423432b578d3Smrg # Restore the uninstalled library and exit 423532b578d3Smrg if test "$mode" = relink; then 423632b578d3Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 423732b578d3Smrg 423832b578d3Smrg if test -n "$convenience"; then 423932b578d3Smrg if test -z "$whole_archive_flag_spec"; then 424032b578d3Smrg $show "${rm}r $gentop" 424132b578d3Smrg $run ${rm}r "$gentop" 424232b578d3Smrg fi 424332b578d3Smrg fi 424432b578d3Smrg 424532b578d3Smrg exit $EXIT_SUCCESS 424632b578d3Smrg fi 424732b578d3Smrg 424832b578d3Smrg # Create links to the real library. 424932b578d3Smrg for linkname in $linknames; do 425032b578d3Smrg if test "$realname" != "$linkname"; then 425132b578d3Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 425232b578d3Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 425332b578d3Smrg fi 425432b578d3Smrg done 425532b578d3Smrg 425632b578d3Smrg # If -module or -export-dynamic was specified, set the dlname. 425732b578d3Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 425832b578d3Smrg # On all known operating systems, these are identical. 425932b578d3Smrg dlname="$soname" 426032b578d3Smrg fi 426132b578d3Smrg fi 426232b578d3Smrg ;; 426332b578d3Smrg 426432b578d3Smrg obj) 42652a51b5beSmrg case " $deplibs" in 42662a51b5beSmrg *\ -l* | *\ -L*) 42672a51b5beSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 42682a51b5beSmrg esac 426932b578d3Smrg 427032b578d3Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 427132b578d3Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 427232b578d3Smrg fi 427332b578d3Smrg 427432b578d3Smrg if test -n "$rpath"; then 427532b578d3Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 427632b578d3Smrg fi 427732b578d3Smrg 427832b578d3Smrg if test -n "$xrpath"; then 427932b578d3Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 428032b578d3Smrg fi 428132b578d3Smrg 428232b578d3Smrg if test -n "$vinfo"; then 428332b578d3Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 428432b578d3Smrg fi 428532b578d3Smrg 428632b578d3Smrg if test -n "$release"; then 428732b578d3Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 428832b578d3Smrg fi 428932b578d3Smrg 429032b578d3Smrg case $output in 429132b578d3Smrg *.lo) 429232b578d3Smrg if test -n "$objs$old_deplibs"; then 429332b578d3Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 429432b578d3Smrg exit $EXIT_FAILURE 429532b578d3Smrg fi 429632b578d3Smrg libobj="$output" 429732b578d3Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 429832b578d3Smrg ;; 429932b578d3Smrg *) 430032b578d3Smrg libobj= 430132b578d3Smrg obj="$output" 430232b578d3Smrg ;; 430332b578d3Smrg esac 430432b578d3Smrg 430532b578d3Smrg # Delete the old objects. 430632b578d3Smrg $run $rm $obj $libobj 430732b578d3Smrg 430832b578d3Smrg # Objects from convenience libraries. This assumes 430932b578d3Smrg # single-version convenience libraries. Whenever we create 431032b578d3Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 431132b578d3Smrg # the extraction. 431232b578d3Smrg reload_conv_objs= 431332b578d3Smrg gentop= 431432b578d3Smrg # reload_cmds runs $LD directly, so let us get rid of 43152a51b5beSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 43162a51b5beSmrg # turning comma into space.. 431732b578d3Smrg wl= 431832b578d3Smrg 431932b578d3Smrg if test -n "$convenience"; then 432032b578d3Smrg if test -n "$whole_archive_flag_spec"; then 43212a51b5beSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 43222a51b5beSmrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 432332b578d3Smrg else 432432b578d3Smrg gentop="$output_objdir/${obj}x" 432532b578d3Smrg generated="$generated $gentop" 432632b578d3Smrg 432732b578d3Smrg func_extract_archives $gentop $convenience 432832b578d3Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 432932b578d3Smrg fi 433032b578d3Smrg fi 433132b578d3Smrg 433232b578d3Smrg # Create the old-style object. 433332b578d3Smrg 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 433432b578d3Smrg 433532b578d3Smrg output="$obj" 433632b578d3Smrg cmds=$reload_cmds 433732b578d3Smrg save_ifs="$IFS"; IFS='~' 433832b578d3Smrg for cmd in $cmds; do 433932b578d3Smrg IFS="$save_ifs" 434032b578d3Smrg eval cmd=\"$cmd\" 434132b578d3Smrg $show "$cmd" 434232b578d3Smrg $run eval "$cmd" || exit $? 434332b578d3Smrg done 434432b578d3Smrg IFS="$save_ifs" 434532b578d3Smrg 434632b578d3Smrg # Exit if we aren't doing a library object file. 434732b578d3Smrg if test -z "$libobj"; then 434832b578d3Smrg if test -n "$gentop"; then 434932b578d3Smrg $show "${rm}r $gentop" 435032b578d3Smrg $run ${rm}r $gentop 435132b578d3Smrg fi 435232b578d3Smrg 435332b578d3Smrg exit $EXIT_SUCCESS 435432b578d3Smrg fi 435532b578d3Smrg 435632b578d3Smrg if test "$build_libtool_libs" != yes; then 435732b578d3Smrg if test -n "$gentop"; then 435832b578d3Smrg $show "${rm}r $gentop" 435932b578d3Smrg $run ${rm}r $gentop 436032b578d3Smrg fi 436132b578d3Smrg 436232b578d3Smrg # Create an invalid libtool object if no PIC, so that we don't 436332b578d3Smrg # accidentally link it into a program. 436432b578d3Smrg # $show "echo timestamp > $libobj" 436532b578d3Smrg # $run eval "echo timestamp > $libobj" || exit $? 436632b578d3Smrg exit $EXIT_SUCCESS 436732b578d3Smrg fi 436832b578d3Smrg 436932b578d3Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 437032b578d3Smrg # Only do commands if we really have different PIC objects. 437132b578d3Smrg reload_objs="$libobjs $reload_conv_objs" 437232b578d3Smrg output="$libobj" 437332b578d3Smrg cmds=$reload_cmds 437432b578d3Smrg save_ifs="$IFS"; IFS='~' 437532b578d3Smrg for cmd in $cmds; do 437632b578d3Smrg IFS="$save_ifs" 437732b578d3Smrg eval cmd=\"$cmd\" 437832b578d3Smrg $show "$cmd" 437932b578d3Smrg $run eval "$cmd" || exit $? 438032b578d3Smrg done 438132b578d3Smrg IFS="$save_ifs" 438232b578d3Smrg fi 438332b578d3Smrg 438432b578d3Smrg if test -n "$gentop"; then 438532b578d3Smrg $show "${rm}r $gentop" 438632b578d3Smrg $run ${rm}r $gentop 438732b578d3Smrg fi 438832b578d3Smrg 438932b578d3Smrg exit $EXIT_SUCCESS 439032b578d3Smrg ;; 439132b578d3Smrg 439232b578d3Smrg prog) 439332b578d3Smrg case $host in 439432b578d3Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 439532b578d3Smrg esac 439632b578d3Smrg if test -n "$vinfo"; then 439732b578d3Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 439832b578d3Smrg fi 439932b578d3Smrg 440032b578d3Smrg if test -n "$release"; then 440132b578d3Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 440232b578d3Smrg fi 440332b578d3Smrg 440432b578d3Smrg if test "$preload" = yes; then 440532b578d3Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 440632b578d3Smrg test "$dlopen_self_static" = unknown; then 440732b578d3Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 440832b578d3Smrg fi 440932b578d3Smrg fi 441032b578d3Smrg 441132b578d3Smrg case $host in 441232b578d3Smrg *-*-rhapsody* | *-*-darwin1.[012]) 441332b578d3Smrg # On Rhapsody replace the C library is the System framework 441432b578d3Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 441532b578d3Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 441632b578d3Smrg ;; 441732b578d3Smrg esac 441832b578d3Smrg 441932b578d3Smrg case $host in 442032b578d3Smrg *darwin*) 442132b578d3Smrg # Don't allow lazy linking, it breaks C++ global constructors 442232b578d3Smrg if test "$tagname" = CXX ; then 442332b578d3Smrg compile_command="$compile_command ${wl}-bind_at_load" 442432b578d3Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 442532b578d3Smrg fi 442632b578d3Smrg ;; 442732b578d3Smrg esac 442832b578d3Smrg 442932b578d3Smrg 443032b578d3Smrg # move library search paths that coincide with paths to not yet 443132b578d3Smrg # installed libraries to the beginning of the library search list 443232b578d3Smrg new_libs= 443332b578d3Smrg for path in $notinst_path; do 443432b578d3Smrg case " $new_libs " in 443532b578d3Smrg *" -L$path/$objdir "*) ;; 443632b578d3Smrg *) 443732b578d3Smrg case " $compile_deplibs " in 443832b578d3Smrg *" -L$path/$objdir "*) 443932b578d3Smrg new_libs="$new_libs -L$path/$objdir" ;; 444032b578d3Smrg esac 444132b578d3Smrg ;; 444232b578d3Smrg esac 444332b578d3Smrg done 444432b578d3Smrg for deplib in $compile_deplibs; do 444532b578d3Smrg case $deplib in 444632b578d3Smrg -L*) 444732b578d3Smrg case " $new_libs " in 444832b578d3Smrg *" $deplib "*) ;; 444932b578d3Smrg *) new_libs="$new_libs $deplib" ;; 445032b578d3Smrg esac 445132b578d3Smrg ;; 445232b578d3Smrg *) new_libs="$new_libs $deplib" ;; 445332b578d3Smrg esac 445432b578d3Smrg done 445532b578d3Smrg compile_deplibs="$new_libs" 445632b578d3Smrg 445732b578d3Smrg 445832b578d3Smrg compile_command="$compile_command $compile_deplibs" 445932b578d3Smrg finalize_command="$finalize_command $finalize_deplibs" 446032b578d3Smrg 446132b578d3Smrg if test -n "$rpath$xrpath"; then 446232b578d3Smrg # If the user specified any rpath flags, then add them. 446332b578d3Smrg for libdir in $rpath $xrpath; do 446432b578d3Smrg # This is the magic to use -rpath. 446532b578d3Smrg case "$finalize_rpath " in 446632b578d3Smrg *" $libdir "*) ;; 446732b578d3Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 446832b578d3Smrg esac 446932b578d3Smrg done 447032b578d3Smrg fi 447132b578d3Smrg 447232b578d3Smrg # Now hardcode the library paths 447332b578d3Smrg rpath= 447432b578d3Smrg hardcode_libdirs= 447532b578d3Smrg for libdir in $compile_rpath $finalize_rpath; do 447632b578d3Smrg if test -n "$hardcode_libdir_flag_spec"; then 447732b578d3Smrg if test -n "$hardcode_libdir_separator"; then 447832b578d3Smrg if test -z "$hardcode_libdirs"; then 447932b578d3Smrg hardcode_libdirs="$libdir" 448032b578d3Smrg else 448132b578d3Smrg # Just accumulate the unique libdirs. 448232b578d3Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 448332b578d3Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 448432b578d3Smrg ;; 448532b578d3Smrg *) 448632b578d3Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 448732b578d3Smrg ;; 448832b578d3Smrg esac 448932b578d3Smrg fi 449032b578d3Smrg else 449132b578d3Smrg eval flag=\"$hardcode_libdir_flag_spec\" 449232b578d3Smrg rpath="$rpath $flag" 449332b578d3Smrg fi 449432b578d3Smrg elif test -n "$runpath_var"; then 449532b578d3Smrg case "$perm_rpath " in 449632b578d3Smrg *" $libdir "*) ;; 449732b578d3Smrg *) perm_rpath="$perm_rpath $libdir" ;; 449832b578d3Smrg esac 449932b578d3Smrg fi 450032b578d3Smrg case $host in 450132b578d3Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 450232b578d3Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 450332b578d3Smrg case :$dllsearchpath: in 450432b578d3Smrg *":$libdir:"*) ;; 450532b578d3Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 450632b578d3Smrg esac 450732b578d3Smrg case :$dllsearchpath: in 450832b578d3Smrg *":$testbindir:"*) ;; 450932b578d3Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 451032b578d3Smrg esac 451132b578d3Smrg ;; 451232b578d3Smrg esac 451332b578d3Smrg done 451432b578d3Smrg # Substitute the hardcoded libdirs into the rpath. 451532b578d3Smrg if test -n "$hardcode_libdir_separator" && 451632b578d3Smrg test -n "$hardcode_libdirs"; then 451732b578d3Smrg libdir="$hardcode_libdirs" 451832b578d3Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 451932b578d3Smrg fi 452032b578d3Smrg compile_rpath="$rpath" 452132b578d3Smrg 452232b578d3Smrg rpath= 452332b578d3Smrg hardcode_libdirs= 452432b578d3Smrg for libdir in $finalize_rpath; do 452532b578d3Smrg if test -n "$hardcode_libdir_flag_spec"; then 452632b578d3Smrg if test -n "$hardcode_libdir_separator"; then 452732b578d3Smrg if test -z "$hardcode_libdirs"; then 452832b578d3Smrg hardcode_libdirs="$libdir" 452932b578d3Smrg else 453032b578d3Smrg # Just accumulate the unique libdirs. 453132b578d3Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 453232b578d3Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 453332b578d3Smrg ;; 453432b578d3Smrg *) 453532b578d3Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 453632b578d3Smrg ;; 453732b578d3Smrg esac 453832b578d3Smrg fi 453932b578d3Smrg else 454032b578d3Smrg eval flag=\"$hardcode_libdir_flag_spec\" 454132b578d3Smrg rpath="$rpath $flag" 454232b578d3Smrg fi 454332b578d3Smrg elif test -n "$runpath_var"; then 454432b578d3Smrg case "$finalize_perm_rpath " in 454532b578d3Smrg *" $libdir "*) ;; 454632b578d3Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 454732b578d3Smrg esac 454832b578d3Smrg fi 454932b578d3Smrg done 455032b578d3Smrg # Substitute the hardcoded libdirs into the rpath. 455132b578d3Smrg if test -n "$hardcode_libdir_separator" && 455232b578d3Smrg test -n "$hardcode_libdirs"; then 455332b578d3Smrg libdir="$hardcode_libdirs" 455432b578d3Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 455532b578d3Smrg fi 455632b578d3Smrg finalize_rpath="$rpath" 455732b578d3Smrg 455832b578d3Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 455932b578d3Smrg # Transform all the library objects into standard objects. 456032b578d3Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 456132b578d3Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 456232b578d3Smrg fi 456332b578d3Smrg 456432b578d3Smrg dlsyms= 456532b578d3Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 456632b578d3Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 456732b578d3Smrg dlsyms="${outputname}S.c" 456832b578d3Smrg else 456932b578d3Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 457032b578d3Smrg fi 457132b578d3Smrg fi 457232b578d3Smrg 457332b578d3Smrg if test -n "$dlsyms"; then 457432b578d3Smrg case $dlsyms in 457532b578d3Smrg "") ;; 457632b578d3Smrg *.c) 457732b578d3Smrg # Discover the nlist of each of the dlfiles. 457832b578d3Smrg nlist="$output_objdir/${outputname}.nm" 457932b578d3Smrg 458032b578d3Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 458132b578d3Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 458232b578d3Smrg 458332b578d3Smrg # Parse the name list into a source file. 458432b578d3Smrg $show "creating $output_objdir/$dlsyms" 458532b578d3Smrg 458632b578d3Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 458732b578d3Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 458832b578d3Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 458932b578d3Smrg 459032b578d3Smrg#ifdef __cplusplus 459132b578d3Smrgextern \"C\" { 459232b578d3Smrg#endif 459332b578d3Smrg 459432b578d3Smrg/* Prevent the only kind of declaration conflicts we can make. */ 459532b578d3Smrg#define lt_preloaded_symbols some_other_symbol 459632b578d3Smrg 459732b578d3Smrg/* External symbol declarations for the compiler. */\ 459832b578d3Smrg" 459932b578d3Smrg 460032b578d3Smrg if test "$dlself" = yes; then 460132b578d3Smrg $show "generating symbol list for \`$output'" 460232b578d3Smrg 460332b578d3Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 460432b578d3Smrg 460532b578d3Smrg # Add our own program objects to the symbol list. 460632b578d3Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 460732b578d3Smrg for arg in $progfiles; do 460832b578d3Smrg $show "extracting global C symbols from \`$arg'" 460932b578d3Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 461032b578d3Smrg done 461132b578d3Smrg 461232b578d3Smrg if test -n "$exclude_expsyms"; then 461332b578d3Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 461432b578d3Smrg $run eval '$mv "$nlist"T "$nlist"' 461532b578d3Smrg fi 461632b578d3Smrg 461732b578d3Smrg if test -n "$export_symbols_regex"; then 461832b578d3Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 461932b578d3Smrg $run eval '$mv "$nlist"T "$nlist"' 462032b578d3Smrg fi 462132b578d3Smrg 462232b578d3Smrg # Prepare the list of exported symbols 462332b578d3Smrg if test -z "$export_symbols"; then 462432b578d3Smrg export_symbols="$output_objdir/$outputname.exp" 462532b578d3Smrg $run $rm $export_symbols 462632b578d3Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 462732b578d3Smrg case $host in 462832b578d3Smrg *cygwin* | *mingw* ) 462932b578d3Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 463032b578d3Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 463132b578d3Smrg ;; 463232b578d3Smrg esac 463332b578d3Smrg else 463432b578d3Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 463532b578d3Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 463632b578d3Smrg $run eval 'mv "$nlist"T "$nlist"' 463732b578d3Smrg case $host in 463832b578d3Smrg *cygwin* | *mingw* ) 463932b578d3Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 464032b578d3Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 464132b578d3Smrg ;; 464232b578d3Smrg esac 464332b578d3Smrg fi 464432b578d3Smrg fi 464532b578d3Smrg 464632b578d3Smrg for arg in $dlprefiles; do 464732b578d3Smrg $show "extracting global C symbols from \`$arg'" 464832b578d3Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 464932b578d3Smrg $run eval '$echo ": $name " >> "$nlist"' 465032b578d3Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 465132b578d3Smrg done 465232b578d3Smrg 465332b578d3Smrg if test -z "$run"; then 465432b578d3Smrg # Make sure we have at least an empty file. 465532b578d3Smrg test -f "$nlist" || : > "$nlist" 465632b578d3Smrg 465732b578d3Smrg if test -n "$exclude_expsyms"; then 465832b578d3Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 465932b578d3Smrg $mv "$nlist"T "$nlist" 466032b578d3Smrg fi 466132b578d3Smrg 466232b578d3Smrg # Try sorting and uniquifying the output. 466332b578d3Smrg if grep -v "^: " < "$nlist" | 466432b578d3Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 466532b578d3Smrg sort -k 3 466632b578d3Smrg else 466732b578d3Smrg sort +2 466832b578d3Smrg fi | 466932b578d3Smrg uniq > "$nlist"S; then 467032b578d3Smrg : 467132b578d3Smrg else 467232b578d3Smrg grep -v "^: " < "$nlist" > "$nlist"S 467332b578d3Smrg fi 467432b578d3Smrg 467532b578d3Smrg if test -f "$nlist"S; then 467632b578d3Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 467732b578d3Smrg else 467832b578d3Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 467932b578d3Smrg fi 468032b578d3Smrg 468132b578d3Smrg $echo >> "$output_objdir/$dlsyms" "\ 468232b578d3Smrg 468332b578d3Smrg#undef lt_preloaded_symbols 468432b578d3Smrg 468532b578d3Smrg#if defined (__STDC__) && __STDC__ 468632b578d3Smrg# define lt_ptr void * 468732b578d3Smrg#else 468832b578d3Smrg# define lt_ptr char * 468932b578d3Smrg# define const 469032b578d3Smrg#endif 469132b578d3Smrg 469232b578d3Smrg/* The mapping between symbol names and symbols. */ 469332b578d3Smrg" 469432b578d3Smrg 469532b578d3Smrg case $host in 469632b578d3Smrg *cygwin* | *mingw* ) 469732b578d3Smrg $echo >> "$output_objdir/$dlsyms" "\ 469832b578d3Smrg/* DATA imports from DLLs on WIN32 can't be const, because 469932b578d3Smrg runtime relocations are performed -- see ld's documentation 470032b578d3Smrg on pseudo-relocs */ 470132b578d3Smrgstruct { 470232b578d3Smrg" 470332b578d3Smrg ;; 470432b578d3Smrg * ) 470532b578d3Smrg $echo >> "$output_objdir/$dlsyms" "\ 470632b578d3Smrgconst struct { 470732b578d3Smrg" 470832b578d3Smrg ;; 470932b578d3Smrg esac 471032b578d3Smrg 471132b578d3Smrg 471232b578d3Smrg $echo >> "$output_objdir/$dlsyms" "\ 471332b578d3Smrg const char *name; 471432b578d3Smrg lt_ptr address; 471532b578d3Smrg} 471632b578d3Smrglt_preloaded_symbols[] = 471732b578d3Smrg{\ 471832b578d3Smrg" 471932b578d3Smrg 472032b578d3Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 472132b578d3Smrg 472232b578d3Smrg $echo >> "$output_objdir/$dlsyms" "\ 472332b578d3Smrg {0, (lt_ptr) 0} 472432b578d3Smrg}; 472532b578d3Smrg 472632b578d3Smrg/* This works around a problem in FreeBSD linker */ 472732b578d3Smrg#ifdef FREEBSD_WORKAROUND 472832b578d3Smrgstatic const void *lt_preloaded_setup() { 472932b578d3Smrg return lt_preloaded_symbols; 473032b578d3Smrg} 473132b578d3Smrg#endif 473232b578d3Smrg 473332b578d3Smrg#ifdef __cplusplus 473432b578d3Smrg} 473532b578d3Smrg#endif\ 473632b578d3Smrg" 473732b578d3Smrg fi 473832b578d3Smrg 473932b578d3Smrg pic_flag_for_symtable= 474032b578d3Smrg case $host in 474132b578d3Smrg # compiling the symbol table file with pic_flag works around 474232b578d3Smrg # a FreeBSD bug that causes programs to crash when -lm is 474332b578d3Smrg # linked before any other PIC object. But we must not use 474432b578d3Smrg # pic_flag when linking with -static. The problem exists in 474532b578d3Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 474632b578d3Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 474732b578d3Smrg case "$compile_command " in 474832b578d3Smrg *" -static "*) ;; 474932b578d3Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 475032b578d3Smrg esac;; 475132b578d3Smrg *-*-hpux*) 475232b578d3Smrg case "$compile_command " in 475332b578d3Smrg *" -static "*) ;; 475432b578d3Smrg *) pic_flag_for_symtable=" $pic_flag";; 475532b578d3Smrg esac 475632b578d3Smrg esac 475732b578d3Smrg 475832b578d3Smrg # Now compile the dynamic symbol file. 475932b578d3Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 476032b578d3Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 476132b578d3Smrg 476232b578d3Smrg # Clean up the generated files. 476332b578d3Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 476432b578d3Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 476532b578d3Smrg 476632b578d3Smrg # Transform the symbol file into the correct name. 476732b578d3Smrg case $host in 476832b578d3Smrg *cygwin* | *mingw* ) 476932b578d3Smrg if test -f "$output_objdir/${outputname}.def" ; then 47702a51b5beSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47712a51b5beSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 477232b578d3Smrg else 47732a51b5beSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47742a51b5beSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 477532b578d3Smrg fi 477632b578d3Smrg ;; 477732b578d3Smrg * ) 47782a51b5beSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47792a51b5beSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 478032b578d3Smrg ;; 478132b578d3Smrg esac 478232b578d3Smrg ;; 478332b578d3Smrg *) 478432b578d3Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 478532b578d3Smrg exit $EXIT_FAILURE 478632b578d3Smrg ;; 478732b578d3Smrg esac 478832b578d3Smrg else 478932b578d3Smrg # We keep going just in case the user didn't refer to 479032b578d3Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 479132b578d3Smrg # really was required. 479232b578d3Smrg 479332b578d3Smrg # Nullify the symbol file. 47942a51b5beSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47952a51b5beSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 479632b578d3Smrg fi 479732b578d3Smrg 479832b578d3Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 479932b578d3Smrg # Replace the output file specification. 48002a51b5beSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 480132b578d3Smrg link_command="$compile_command$compile_rpath" 480232b578d3Smrg 480332b578d3Smrg # We have no uninstalled library dependencies, so finalize right now. 480432b578d3Smrg $show "$link_command" 480532b578d3Smrg $run eval "$link_command" 480632b578d3Smrg exit_status=$? 480732b578d3Smrg 480832b578d3Smrg # Delete the generated files. 480932b578d3Smrg if test -n "$dlsyms"; then 481032b578d3Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 481132b578d3Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 481232b578d3Smrg fi 481332b578d3Smrg 481432b578d3Smrg exit $exit_status 481532b578d3Smrg fi 481632b578d3Smrg 481732b578d3Smrg if test -n "$shlibpath_var"; then 481832b578d3Smrg # We should set the shlibpath_var 481932b578d3Smrg rpath= 482032b578d3Smrg for dir in $temp_rpath; do 482132b578d3Smrg case $dir in 482232b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) 482332b578d3Smrg # Absolute path. 482432b578d3Smrg rpath="$rpath$dir:" 482532b578d3Smrg ;; 482632b578d3Smrg *) 482732b578d3Smrg # Relative path: add a thisdir entry. 482832b578d3Smrg rpath="$rpath\$thisdir/$dir:" 482932b578d3Smrg ;; 483032b578d3Smrg esac 483132b578d3Smrg done 483232b578d3Smrg temp_rpath="$rpath" 483332b578d3Smrg fi 483432b578d3Smrg 483532b578d3Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 483632b578d3Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 483732b578d3Smrg fi 483832b578d3Smrg if test -n "$finalize_shlibpath"; then 483932b578d3Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 484032b578d3Smrg fi 484132b578d3Smrg 484232b578d3Smrg compile_var= 484332b578d3Smrg finalize_var= 484432b578d3Smrg if test -n "$runpath_var"; then 484532b578d3Smrg if test -n "$perm_rpath"; then 484632b578d3Smrg # We should set the runpath_var. 484732b578d3Smrg rpath= 484832b578d3Smrg for dir in $perm_rpath; do 484932b578d3Smrg rpath="$rpath$dir:" 485032b578d3Smrg done 485132b578d3Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 485232b578d3Smrg fi 485332b578d3Smrg if test -n "$finalize_perm_rpath"; then 485432b578d3Smrg # We should set the runpath_var. 485532b578d3Smrg rpath= 485632b578d3Smrg for dir in $finalize_perm_rpath; do 485732b578d3Smrg rpath="$rpath$dir:" 485832b578d3Smrg done 485932b578d3Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 486032b578d3Smrg fi 486132b578d3Smrg fi 486232b578d3Smrg 486332b578d3Smrg if test "$no_install" = yes; then 486432b578d3Smrg # We don't need to create a wrapper script. 486532b578d3Smrg link_command="$compile_var$compile_command$compile_rpath" 486632b578d3Smrg # Replace the output file specification. 486732b578d3Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 486832b578d3Smrg # Delete the old output file. 486932b578d3Smrg $run $rm $output 487032b578d3Smrg # Link the executable and exit 487132b578d3Smrg $show "$link_command" 487232b578d3Smrg $run eval "$link_command" || exit $? 487332b578d3Smrg exit $EXIT_SUCCESS 487432b578d3Smrg fi 487532b578d3Smrg 487632b578d3Smrg if test "$hardcode_action" = relink; then 487732b578d3Smrg # Fast installation is not supported 487832b578d3Smrg link_command="$compile_var$compile_command$compile_rpath" 487932b578d3Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 488032b578d3Smrg 488132b578d3Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 488232b578d3Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 488332b578d3Smrg else 488432b578d3Smrg if test "$fast_install" != no; then 488532b578d3Smrg link_command="$finalize_var$compile_command$finalize_rpath" 488632b578d3Smrg if test "$fast_install" = yes; then 48872a51b5beSmrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 488832b578d3Smrg else 488932b578d3Smrg # fast_install is set to needless 489032b578d3Smrg relink_command= 489132b578d3Smrg fi 489232b578d3Smrg else 489332b578d3Smrg link_command="$compile_var$compile_command$compile_rpath" 489432b578d3Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 489532b578d3Smrg fi 489632b578d3Smrg fi 489732b578d3Smrg 489832b578d3Smrg # Replace the output file specification. 489932b578d3Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 490032b578d3Smrg 490132b578d3Smrg # Delete the old output files. 490232b578d3Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 490332b578d3Smrg 490432b578d3Smrg $show "$link_command" 490532b578d3Smrg $run eval "$link_command" || exit $? 490632b578d3Smrg 490732b578d3Smrg # Now create the wrapper script. 490832b578d3Smrg $show "creating $output" 490932b578d3Smrg 491032b578d3Smrg # Quote the relink command for shipping. 491132b578d3Smrg if test -n "$relink_command"; then 491232b578d3Smrg # Preserve any variables that may affect compiler behavior 491332b578d3Smrg for var in $variables_saved_for_relink; do 491432b578d3Smrg if eval test -z \"\${$var+set}\"; then 491532b578d3Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 491632b578d3Smrg elif eval var_value=\$$var; test -z "$var_value"; then 491732b578d3Smrg relink_command="$var=; export $var; $relink_command" 491832b578d3Smrg else 491932b578d3Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 492032b578d3Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 492132b578d3Smrg fi 492232b578d3Smrg done 492332b578d3Smrg relink_command="(cd `pwd`; $relink_command)" 49242a51b5beSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 492532b578d3Smrg fi 492632b578d3Smrg 492732b578d3Smrg # Quote $echo for shipping. 492832b578d3Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 492932b578d3Smrg case $progpath in 493032b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 493132b578d3Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 493232b578d3Smrg esac 493332b578d3Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 493432b578d3Smrg else 493532b578d3Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 493632b578d3Smrg fi 493732b578d3Smrg 493832b578d3Smrg # Only actually do things if our run command is non-null. 493932b578d3Smrg if test -z "$run"; then 494032b578d3Smrg # win32 will think the script is a binary if it has 494132b578d3Smrg # a .exe suffix, so we strip it off here. 494232b578d3Smrg case $output in 494332b578d3Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 494432b578d3Smrg esac 494532b578d3Smrg # test for cygwin because mv fails w/o .exe extensions 494632b578d3Smrg case $host in 494732b578d3Smrg *cygwin*) 494832b578d3Smrg exeext=.exe 494932b578d3Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 495032b578d3Smrg *) exeext= ;; 495132b578d3Smrg esac 495232b578d3Smrg case $host in 495332b578d3Smrg *cygwin* | *mingw* ) 495432b578d3Smrg output_name=`basename $output` 495532b578d3Smrg output_path=`dirname $output` 495632b578d3Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 495732b578d3Smrg cwrapper="$output_path/$output_name.exe" 495832b578d3Smrg $rm $cwrappersource $cwrapper 495932b578d3Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 496032b578d3Smrg 496132b578d3Smrg cat > $cwrappersource <<EOF 496232b578d3Smrg 496332b578d3Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 496432b578d3Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 496532b578d3Smrg 496632b578d3Smrg The $output program cannot be directly executed until all the libtool 496732b578d3Smrg libraries that it depends on are installed. 496832b578d3Smrg 496932b578d3Smrg This wrapper executable should never be moved out of the build directory. 497032b578d3Smrg If it is, it will not operate correctly. 497132b578d3Smrg 497232b578d3Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 497332b578d3Smrg but could eventually absorb all of the scripts functionality and 497432b578d3Smrg exec $objdir/$outputname directly. 497532b578d3Smrg*/ 497632b578d3SmrgEOF 497732b578d3Smrg cat >> $cwrappersource<<"EOF" 497832b578d3Smrg#include <stdio.h> 497932b578d3Smrg#include <stdlib.h> 498032b578d3Smrg#include <unistd.h> 498132b578d3Smrg#include <malloc.h> 498232b578d3Smrg#include <stdarg.h> 498332b578d3Smrg#include <assert.h> 498432b578d3Smrg#include <string.h> 498532b578d3Smrg#include <ctype.h> 498632b578d3Smrg#include <sys/stat.h> 498732b578d3Smrg 498832b578d3Smrg#if defined(PATH_MAX) 498932b578d3Smrg# define LT_PATHMAX PATH_MAX 499032b578d3Smrg#elif defined(MAXPATHLEN) 499132b578d3Smrg# define LT_PATHMAX MAXPATHLEN 499232b578d3Smrg#else 499332b578d3Smrg# define LT_PATHMAX 1024 499432b578d3Smrg#endif 499532b578d3Smrg 499632b578d3Smrg#ifndef DIR_SEPARATOR 499732b578d3Smrg# define DIR_SEPARATOR '/' 499832b578d3Smrg# define PATH_SEPARATOR ':' 499932b578d3Smrg#endif 500032b578d3Smrg 500132b578d3Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 500232b578d3Smrg defined (__OS2__) 500332b578d3Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 500432b578d3Smrg# ifndef DIR_SEPARATOR_2 500532b578d3Smrg# define DIR_SEPARATOR_2 '\\' 500632b578d3Smrg# endif 500732b578d3Smrg# ifndef PATH_SEPARATOR_2 500832b578d3Smrg# define PATH_SEPARATOR_2 ';' 500932b578d3Smrg# endif 501032b578d3Smrg#endif 501132b578d3Smrg 501232b578d3Smrg#ifndef DIR_SEPARATOR_2 501332b578d3Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 501432b578d3Smrg#else /* DIR_SEPARATOR_2 */ 501532b578d3Smrg# define IS_DIR_SEPARATOR(ch) \ 501632b578d3Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 501732b578d3Smrg#endif /* DIR_SEPARATOR_2 */ 501832b578d3Smrg 501932b578d3Smrg#ifndef PATH_SEPARATOR_2 502032b578d3Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 502132b578d3Smrg#else /* PATH_SEPARATOR_2 */ 502232b578d3Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 502332b578d3Smrg#endif /* PATH_SEPARATOR_2 */ 502432b578d3Smrg 502532b578d3Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 502632b578d3Smrg#define XFREE(stale) do { \ 502732b578d3Smrg if (stale) { free ((void *) stale); stale = 0; } \ 502832b578d3Smrg} while (0) 502932b578d3Smrg 503032b578d3Smrg/* -DDEBUG is fairly common in CFLAGS. */ 503132b578d3Smrg#undef DEBUG 503232b578d3Smrg#if defined DEBUGWRAPPER 503332b578d3Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 503432b578d3Smrg#else 503532b578d3Smrg# define DEBUG(format, ...) 503632b578d3Smrg#endif 503732b578d3Smrg 503832b578d3Smrgconst char *program_name = NULL; 503932b578d3Smrg 504032b578d3Smrgvoid * xmalloc (size_t num); 504132b578d3Smrgchar * xstrdup (const char *string); 504232b578d3Smrgconst char * base_name (const char *name); 504332b578d3Smrgchar * find_executable(const char *wrapper); 504432b578d3Smrgint check_executable(const char *path); 504532b578d3Smrgchar * strendzap(char *str, const char *pat); 504632b578d3Smrgvoid lt_fatal (const char *message, ...); 504732b578d3Smrg 504832b578d3Smrgint 504932b578d3Smrgmain (int argc, char *argv[]) 505032b578d3Smrg{ 505132b578d3Smrg char **newargz; 505232b578d3Smrg int i; 505332b578d3Smrg 505432b578d3Smrg program_name = (char *) xstrdup (base_name (argv[0])); 505532b578d3Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 505632b578d3Smrg DEBUG("(main) program_name : %s\n",program_name); 505732b578d3Smrg newargz = XMALLOC(char *, argc+2); 505832b578d3SmrgEOF 505932b578d3Smrg 506032b578d3Smrg cat >> $cwrappersource <<EOF 506132b578d3Smrg newargz[0] = (char *) xstrdup("$SHELL"); 506232b578d3SmrgEOF 506332b578d3Smrg 506432b578d3Smrg cat >> $cwrappersource <<"EOF" 506532b578d3Smrg newargz[1] = find_executable(argv[0]); 506632b578d3Smrg if (newargz[1] == NULL) 506732b578d3Smrg lt_fatal("Couldn't find %s", argv[0]); 506832b578d3Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 506932b578d3Smrg /* we know the script has the same name, without the .exe */ 507032b578d3Smrg /* so make sure newargz[1] doesn't end in .exe */ 507132b578d3Smrg strendzap(newargz[1],".exe"); 507232b578d3Smrg for (i = 1; i < argc; i++) 507332b578d3Smrg newargz[i+1] = xstrdup(argv[i]); 507432b578d3Smrg newargz[argc+1] = NULL; 507532b578d3Smrg 507632b578d3Smrg for (i=0; i<argc+1; i++) 507732b578d3Smrg { 507832b578d3Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 507932b578d3Smrg ; 508032b578d3Smrg } 508132b578d3Smrg 508232b578d3SmrgEOF 508332b578d3Smrg 508432b578d3Smrg case $host_os in 508532b578d3Smrg mingw*) 508632b578d3Smrg cat >> $cwrappersource <<EOF 508732b578d3Smrg execv("$SHELL",(char const **)newargz); 508832b578d3SmrgEOF 508932b578d3Smrg ;; 509032b578d3Smrg *) 509132b578d3Smrg cat >> $cwrappersource <<EOF 509232b578d3Smrg execv("$SHELL",newargz); 509332b578d3SmrgEOF 509432b578d3Smrg ;; 509532b578d3Smrg esac 509632b578d3Smrg 509732b578d3Smrg cat >> $cwrappersource <<"EOF" 509832b578d3Smrg return 127; 509932b578d3Smrg} 510032b578d3Smrg 510132b578d3Smrgvoid * 510232b578d3Smrgxmalloc (size_t num) 510332b578d3Smrg{ 510432b578d3Smrg void * p = (void *) malloc (num); 510532b578d3Smrg if (!p) 510632b578d3Smrg lt_fatal ("Memory exhausted"); 510732b578d3Smrg 510832b578d3Smrg return p; 510932b578d3Smrg} 511032b578d3Smrg 511132b578d3Smrgchar * 511232b578d3Smrgxstrdup (const char *string) 511332b578d3Smrg{ 511432b578d3Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 511532b578d3Smrg; 511632b578d3Smrg} 511732b578d3Smrg 511832b578d3Smrgconst char * 511932b578d3Smrgbase_name (const char *name) 512032b578d3Smrg{ 512132b578d3Smrg const char *base; 512232b578d3Smrg 512332b578d3Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 512432b578d3Smrg /* Skip over the disk name in MSDOS pathnames. */ 512532b578d3Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 512632b578d3Smrg name += 2; 512732b578d3Smrg#endif 512832b578d3Smrg 512932b578d3Smrg for (base = name; *name; name++) 513032b578d3Smrg if (IS_DIR_SEPARATOR (*name)) 513132b578d3Smrg base = name + 1; 513232b578d3Smrg return base; 513332b578d3Smrg} 513432b578d3Smrg 513532b578d3Smrgint 513632b578d3Smrgcheck_executable(const char * path) 513732b578d3Smrg{ 513832b578d3Smrg struct stat st; 513932b578d3Smrg 514032b578d3Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 514132b578d3Smrg if ((!path) || (!*path)) 514232b578d3Smrg return 0; 514332b578d3Smrg 514432b578d3Smrg if ((stat (path, &st) >= 0) && 514532b578d3Smrg ( 514632b578d3Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 514732b578d3Smrg#if defined (S_IXOTH) 514832b578d3Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 514932b578d3Smrg#endif 515032b578d3Smrg#if defined (S_IXGRP) 515132b578d3Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 515232b578d3Smrg#endif 515332b578d3Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 515432b578d3Smrg ) 515532b578d3Smrg return 1; 515632b578d3Smrg else 515732b578d3Smrg return 0; 515832b578d3Smrg} 515932b578d3Smrg 516032b578d3Smrg/* Searches for the full path of the wrapper. Returns 516132b578d3Smrg newly allocated full path name if found, NULL otherwise */ 516232b578d3Smrgchar * 516332b578d3Smrgfind_executable (const char* wrapper) 516432b578d3Smrg{ 516532b578d3Smrg int has_slash = 0; 516632b578d3Smrg const char* p; 516732b578d3Smrg const char* p_next; 516832b578d3Smrg /* static buffer for getcwd */ 516932b578d3Smrg char tmp[LT_PATHMAX + 1]; 517032b578d3Smrg int tmp_len; 517132b578d3Smrg char* concat_name; 517232b578d3Smrg 517332b578d3Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 517432b578d3Smrg 517532b578d3Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 517632b578d3Smrg return NULL; 517732b578d3Smrg 517832b578d3Smrg /* Absolute path? */ 517932b578d3Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 518032b578d3Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 518132b578d3Smrg { 518232b578d3Smrg concat_name = xstrdup (wrapper); 518332b578d3Smrg if (check_executable(concat_name)) 518432b578d3Smrg return concat_name; 518532b578d3Smrg XFREE(concat_name); 518632b578d3Smrg } 518732b578d3Smrg else 518832b578d3Smrg { 518932b578d3Smrg#endif 519032b578d3Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 519132b578d3Smrg { 519232b578d3Smrg concat_name = xstrdup (wrapper); 519332b578d3Smrg if (check_executable(concat_name)) 519432b578d3Smrg return concat_name; 519532b578d3Smrg XFREE(concat_name); 519632b578d3Smrg } 519732b578d3Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 519832b578d3Smrg } 519932b578d3Smrg#endif 520032b578d3Smrg 520132b578d3Smrg for (p = wrapper; *p; p++) 520232b578d3Smrg if (*p == '/') 520332b578d3Smrg { 520432b578d3Smrg has_slash = 1; 520532b578d3Smrg break; 520632b578d3Smrg } 520732b578d3Smrg if (!has_slash) 520832b578d3Smrg { 520932b578d3Smrg /* no slashes; search PATH */ 521032b578d3Smrg const char* path = getenv ("PATH"); 521132b578d3Smrg if (path != NULL) 521232b578d3Smrg { 521332b578d3Smrg for (p = path; *p; p = p_next) 521432b578d3Smrg { 521532b578d3Smrg const char* q; 521632b578d3Smrg size_t p_len; 521732b578d3Smrg for (q = p; *q; q++) 521832b578d3Smrg if (IS_PATH_SEPARATOR(*q)) 521932b578d3Smrg break; 522032b578d3Smrg p_len = q - p; 522132b578d3Smrg p_next = (*q == '\0' ? q : q + 1); 522232b578d3Smrg if (p_len == 0) 522332b578d3Smrg { 522432b578d3Smrg /* empty path: current directory */ 522532b578d3Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 522632b578d3Smrg lt_fatal ("getcwd failed"); 522732b578d3Smrg tmp_len = strlen(tmp); 522832b578d3Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 522932b578d3Smrg memcpy (concat_name, tmp, tmp_len); 523032b578d3Smrg concat_name[tmp_len] = '/'; 523132b578d3Smrg strcpy (concat_name + tmp_len + 1, wrapper); 523232b578d3Smrg } 523332b578d3Smrg else 523432b578d3Smrg { 523532b578d3Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 523632b578d3Smrg memcpy (concat_name, p, p_len); 523732b578d3Smrg concat_name[p_len] = '/'; 523832b578d3Smrg strcpy (concat_name + p_len + 1, wrapper); 523932b578d3Smrg } 524032b578d3Smrg if (check_executable(concat_name)) 524132b578d3Smrg return concat_name; 524232b578d3Smrg XFREE(concat_name); 524332b578d3Smrg } 524432b578d3Smrg } 524532b578d3Smrg /* not found in PATH; assume curdir */ 524632b578d3Smrg } 524732b578d3Smrg /* Relative path | not found in path: prepend cwd */ 524832b578d3Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 524932b578d3Smrg lt_fatal ("getcwd failed"); 525032b578d3Smrg tmp_len = strlen(tmp); 525132b578d3Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 525232b578d3Smrg memcpy (concat_name, tmp, tmp_len); 525332b578d3Smrg concat_name[tmp_len] = '/'; 525432b578d3Smrg strcpy (concat_name + tmp_len + 1, wrapper); 525532b578d3Smrg 525632b578d3Smrg if (check_executable(concat_name)) 525732b578d3Smrg return concat_name; 525832b578d3Smrg XFREE(concat_name); 525932b578d3Smrg return NULL; 526032b578d3Smrg} 526132b578d3Smrg 526232b578d3Smrgchar * 526332b578d3Smrgstrendzap(char *str, const char *pat) 526432b578d3Smrg{ 526532b578d3Smrg size_t len, patlen; 526632b578d3Smrg 526732b578d3Smrg assert(str != NULL); 526832b578d3Smrg assert(pat != NULL); 526932b578d3Smrg 527032b578d3Smrg len = strlen(str); 527132b578d3Smrg patlen = strlen(pat); 527232b578d3Smrg 527332b578d3Smrg if (patlen <= len) 527432b578d3Smrg { 527532b578d3Smrg str += len - patlen; 527632b578d3Smrg if (strcmp(str, pat) == 0) 527732b578d3Smrg *str = '\0'; 527832b578d3Smrg } 527932b578d3Smrg return str; 528032b578d3Smrg} 528132b578d3Smrg 528232b578d3Smrgstatic void 528332b578d3Smrglt_error_core (int exit_status, const char * mode, 528432b578d3Smrg const char * message, va_list ap) 528532b578d3Smrg{ 528632b578d3Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 528732b578d3Smrg vfprintf (stderr, message, ap); 528832b578d3Smrg fprintf (stderr, ".\n"); 528932b578d3Smrg 529032b578d3Smrg if (exit_status >= 0) 529132b578d3Smrg exit (exit_status); 529232b578d3Smrg} 529332b578d3Smrg 529432b578d3Smrgvoid 529532b578d3Smrglt_fatal (const char *message, ...) 529632b578d3Smrg{ 529732b578d3Smrg va_list ap; 529832b578d3Smrg va_start (ap, message); 529932b578d3Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 530032b578d3Smrg va_end (ap); 530132b578d3Smrg} 530232b578d3SmrgEOF 530332b578d3Smrg # we should really use a build-platform specific compiler 530432b578d3Smrg # here, but OTOH, the wrappers (shell script and this C one) 530532b578d3Smrg # are only useful if you want to execute the "real" binary. 530632b578d3Smrg # Since the "real" binary is built for $host, then this 530732b578d3Smrg # wrapper might as well be built for $host, too. 530832b578d3Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 530932b578d3Smrg ;; 531032b578d3Smrg esac 531132b578d3Smrg $rm $output 531232b578d3Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 531332b578d3Smrg 531432b578d3Smrg $echo > $output "\ 531532b578d3Smrg#! $SHELL 531632b578d3Smrg 531732b578d3Smrg# $output - temporary wrapper script for $objdir/$outputname 531832b578d3Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 531932b578d3Smrg# 532032b578d3Smrg# The $output program cannot be directly executed until all the libtool 532132b578d3Smrg# libraries that it depends on are installed. 532232b578d3Smrg# 532332b578d3Smrg# This wrapper script should never be moved out of the build directory. 532432b578d3Smrg# If it is, it will not operate correctly. 532532b578d3Smrg 532632b578d3Smrg# Sed substitution that helps us do robust quoting. It backslashifies 532732b578d3Smrg# metacharacters that are still active within double-quoted strings. 532832b578d3SmrgXsed='${SED} -e 1s/^X//' 532932b578d3Smrgsed_quote_subst='$sed_quote_subst' 533032b578d3Smrg 53312a51b5beSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53322a51b5beSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 53332a51b5beSmrg emulate sh 53342a51b5beSmrg NULLCMD=: 53352a51b5beSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 53362a51b5beSmrg # is contrary to our usage. Disable this feature. 53372a51b5beSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 53382a51b5beSmrg setopt NO_GLOB_SUBST 53392a51b5beSmrgelse 53402a51b5beSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 53412a51b5beSmrgfi 53422a51b5beSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 53432a51b5beSmrgDUALCASE=1; export DUALCASE # for MKS sh 53442a51b5beSmrg 534532b578d3Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 534632b578d3Smrg# if CDPATH is set. 534732b578d3Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 534832b578d3Smrg 534932b578d3Smrgrelink_command=\"$relink_command\" 535032b578d3Smrg 535132b578d3Smrg# This environment variable determines our operation mode. 535232b578d3Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 535332b578d3Smrg # install mode needs the following variable: 535432b578d3Smrg notinst_deplibs='$notinst_deplibs' 535532b578d3Smrgelse 535632b578d3Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 535732b578d3Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 535832b578d3Smrg echo=\"$qecho\" 535932b578d3Smrg file=\"\$0\" 536032b578d3Smrg # Make sure echo works. 536132b578d3Smrg if test \"X\$1\" = X--no-reexec; then 536232b578d3Smrg # Discard the --no-reexec flag, and continue. 536332b578d3Smrg shift 536432b578d3Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 536532b578d3Smrg # Yippee, \$echo works! 536632b578d3Smrg : 536732b578d3Smrg else 536832b578d3Smrg # Restart under the correct shell, and then maybe \$echo will work. 536932b578d3Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 537032b578d3Smrg fi 537132b578d3Smrg fi\ 537232b578d3Smrg" 537332b578d3Smrg $echo >> $output "\ 537432b578d3Smrg 537532b578d3Smrg # Find the directory that this script lives in. 537632b578d3Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 537732b578d3Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 537832b578d3Smrg 537932b578d3Smrg # Follow symbolic links until we get to the real thisdir. 538032b578d3Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 538132b578d3Smrg while test -n \"\$file\"; do 538232b578d3Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 538332b578d3Smrg 538432b578d3Smrg # If there was a directory component, then change thisdir. 538532b578d3Smrg if test \"x\$destdir\" != \"x\$file\"; then 538632b578d3Smrg case \"\$destdir\" in 538732b578d3Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 538832b578d3Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 538932b578d3Smrg esac 539032b578d3Smrg fi 539132b578d3Smrg 539232b578d3Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 539332b578d3Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 539432b578d3Smrg done 539532b578d3Smrg 539632b578d3Smrg # Try to get the absolute directory name. 539732b578d3Smrg absdir=\`cd \"\$thisdir\" && pwd\` 539832b578d3Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 539932b578d3Smrg" 540032b578d3Smrg 540132b578d3Smrg if test "$fast_install" = yes; then 540232b578d3Smrg $echo >> $output "\ 540332b578d3Smrg program=lt-'$outputname'$exeext 540432b578d3Smrg progdir=\"\$thisdir/$objdir\" 540532b578d3Smrg 540632b578d3Smrg if test ! -f \"\$progdir/\$program\" || \\ 540732b578d3Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 540832b578d3Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 540932b578d3Smrg 541032b578d3Smrg file=\"\$\$-\$program\" 541132b578d3Smrg 541232b578d3Smrg if test ! -d \"\$progdir\"; then 541332b578d3Smrg $mkdir \"\$progdir\" 541432b578d3Smrg else 541532b578d3Smrg $rm \"\$progdir/\$file\" 541632b578d3Smrg fi" 541732b578d3Smrg 541832b578d3Smrg $echo >> $output "\ 541932b578d3Smrg 542032b578d3Smrg # relink executable if necessary 542132b578d3Smrg if test -n \"\$relink_command\"; then 542232b578d3Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 542332b578d3Smrg else 542432b578d3Smrg $echo \"\$relink_command_output\" >&2 542532b578d3Smrg $rm \"\$progdir/\$file\" 542632b578d3Smrg exit $EXIT_FAILURE 542732b578d3Smrg fi 542832b578d3Smrg fi 542932b578d3Smrg 543032b578d3Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 543132b578d3Smrg { $rm \"\$progdir/\$program\"; 543232b578d3Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 543332b578d3Smrg $rm \"\$progdir/\$file\" 543432b578d3Smrg fi" 543532b578d3Smrg else 543632b578d3Smrg $echo >> $output "\ 543732b578d3Smrg program='$outputname' 543832b578d3Smrg progdir=\"\$thisdir/$objdir\" 543932b578d3Smrg" 544032b578d3Smrg fi 544132b578d3Smrg 544232b578d3Smrg $echo >> $output "\ 544332b578d3Smrg 544432b578d3Smrg if test -f \"\$progdir/\$program\"; then" 544532b578d3Smrg 544632b578d3Smrg # Export our shlibpath_var if we have one. 544732b578d3Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 544832b578d3Smrg $echo >> $output "\ 544932b578d3Smrg # Add our own library path to $shlibpath_var 545032b578d3Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 545132b578d3Smrg 545232b578d3Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 545332b578d3Smrg # The second colon is a workaround for a bug in BeOS R4 sed 545432b578d3Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 545532b578d3Smrg 545632b578d3Smrg export $shlibpath_var 545732b578d3Smrg" 545832b578d3Smrg fi 545932b578d3Smrg 546032b578d3Smrg # fixup the dll searchpath if we need to. 546132b578d3Smrg if test -n "$dllsearchpath"; then 546232b578d3Smrg $echo >> $output "\ 546332b578d3Smrg # Add the dll search path components to the executable PATH 546432b578d3Smrg PATH=$dllsearchpath:\$PATH 546532b578d3Smrg" 546632b578d3Smrg fi 546732b578d3Smrg 546832b578d3Smrg $echo >> $output "\ 546932b578d3Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 547032b578d3Smrg # Run the actual program with our arguments. 547132b578d3Smrg" 547232b578d3Smrg case $host in 547332b578d3Smrg # Backslashes separate directories on plain windows 547432b578d3Smrg *-*-mingw | *-*-os2*) 547532b578d3Smrg $echo >> $output "\ 547632b578d3Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 547732b578d3Smrg" 547832b578d3Smrg ;; 547932b578d3Smrg 548032b578d3Smrg *) 548132b578d3Smrg $echo >> $output "\ 548232b578d3Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 548332b578d3Smrg" 548432b578d3Smrg ;; 548532b578d3Smrg esac 548632b578d3Smrg $echo >> $output "\ 54872a51b5beSmrg \$echo \"\$0: cannot exec \$program \$*\" 548832b578d3Smrg exit $EXIT_FAILURE 548932b578d3Smrg fi 549032b578d3Smrg else 549132b578d3Smrg # The program doesn't exist. 549232b578d3Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 549332b578d3Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 549432b578d3Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 549532b578d3Smrg exit $EXIT_FAILURE 549632b578d3Smrg fi 549732b578d3Smrgfi\ 549832b578d3Smrg" 549932b578d3Smrg chmod +x $output 550032b578d3Smrg fi 550132b578d3Smrg exit $EXIT_SUCCESS 550232b578d3Smrg ;; 550332b578d3Smrg esac 550432b578d3Smrg 550532b578d3Smrg # See if we need to build an old-fashioned archive. 550632b578d3Smrg for oldlib in $oldlibs; do 550732b578d3Smrg 550832b578d3Smrg if test "$build_libtool_libs" = convenience; then 550932b578d3Smrg oldobjs="$libobjs_save" 551032b578d3Smrg addlibs="$convenience" 551132b578d3Smrg build_libtool_libs=no 551232b578d3Smrg else 551332b578d3Smrg if test "$build_libtool_libs" = module; then 551432b578d3Smrg oldobjs="$libobjs_save" 551532b578d3Smrg build_libtool_libs=no 551632b578d3Smrg else 551732b578d3Smrg oldobjs="$old_deplibs $non_pic_objects" 551832b578d3Smrg fi 551932b578d3Smrg addlibs="$old_convenience" 552032b578d3Smrg fi 552132b578d3Smrg 552232b578d3Smrg if test -n "$addlibs"; then 552332b578d3Smrg gentop="$output_objdir/${outputname}x" 552432b578d3Smrg generated="$generated $gentop" 552532b578d3Smrg 552632b578d3Smrg func_extract_archives $gentop $addlibs 552732b578d3Smrg oldobjs="$oldobjs $func_extract_archives_result" 552832b578d3Smrg fi 552932b578d3Smrg 553032b578d3Smrg # Do each command in the archive commands. 553132b578d3Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 553232b578d3Smrg cmds=$old_archive_from_new_cmds 553332b578d3Smrg else 553432b578d3Smrg # POSIX demands no paths to be encoded in archives. We have 553532b578d3Smrg # to avoid creating archives with duplicate basenames if we 553632b578d3Smrg # might have to extract them afterwards, e.g., when creating a 553732b578d3Smrg # static archive out of a convenience library, or when linking 553832b578d3Smrg # the entirety of a libtool archive into another (currently 553932b578d3Smrg # not supported by libtool). 554032b578d3Smrg if (for obj in $oldobjs 554132b578d3Smrg do 554232b578d3Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 554332b578d3Smrg done | sort | sort -uc >/dev/null 2>&1); then 554432b578d3Smrg : 554532b578d3Smrg else 554632b578d3Smrg $echo "copying selected object files to avoid basename conflicts..." 554732b578d3Smrg 554832b578d3Smrg if test -z "$gentop"; then 554932b578d3Smrg gentop="$output_objdir/${outputname}x" 555032b578d3Smrg generated="$generated $gentop" 555132b578d3Smrg 555232b578d3Smrg $show "${rm}r $gentop" 555332b578d3Smrg $run ${rm}r "$gentop" 555432b578d3Smrg $show "$mkdir $gentop" 555532b578d3Smrg $run $mkdir "$gentop" 555632b578d3Smrg exit_status=$? 555732b578d3Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 555832b578d3Smrg exit $exit_status 555932b578d3Smrg fi 556032b578d3Smrg fi 556132b578d3Smrg 556232b578d3Smrg save_oldobjs=$oldobjs 556332b578d3Smrg oldobjs= 556432b578d3Smrg counter=1 556532b578d3Smrg for obj in $save_oldobjs 556632b578d3Smrg do 556732b578d3Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 556832b578d3Smrg case " $oldobjs " in 556932b578d3Smrg " ") oldobjs=$obj ;; 557032b578d3Smrg *[\ /]"$objbase "*) 557132b578d3Smrg while :; do 557232b578d3Smrg # Make sure we don't pick an alternate name that also 557332b578d3Smrg # overlaps. 557432b578d3Smrg newobj=lt$counter-$objbase 557532b578d3Smrg counter=`expr $counter + 1` 557632b578d3Smrg case " $oldobjs " in 557732b578d3Smrg *[\ /]"$newobj "*) ;; 557832b578d3Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 557932b578d3Smrg esac 558032b578d3Smrg done 558132b578d3Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 558232b578d3Smrg $run ln "$obj" "$gentop/$newobj" || 558332b578d3Smrg $run cp "$obj" "$gentop/$newobj" 558432b578d3Smrg oldobjs="$oldobjs $gentop/$newobj" 558532b578d3Smrg ;; 558632b578d3Smrg *) oldobjs="$oldobjs $obj" ;; 558732b578d3Smrg esac 558832b578d3Smrg done 558932b578d3Smrg fi 559032b578d3Smrg 559132b578d3Smrg eval cmds=\"$old_archive_cmds\" 559232b578d3Smrg 559332b578d3Smrg if len=`expr "X$cmds" : ".*"` && 559432b578d3Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 559532b578d3Smrg cmds=$old_archive_cmds 559632b578d3Smrg else 559732b578d3Smrg # the command line is too long to link in one step, link in parts 559832b578d3Smrg $echo "using piecewise archive linking..." 559932b578d3Smrg save_RANLIB=$RANLIB 560032b578d3Smrg RANLIB=: 560132b578d3Smrg objlist= 560232b578d3Smrg concat_cmds= 560332b578d3Smrg save_oldobjs=$oldobjs 560432b578d3Smrg 560532b578d3Smrg # Is there a better way of finding the last object in the list? 560632b578d3Smrg for obj in $save_oldobjs 560732b578d3Smrg do 560832b578d3Smrg last_oldobj=$obj 560932b578d3Smrg done 561032b578d3Smrg for obj in $save_oldobjs 561132b578d3Smrg do 561232b578d3Smrg oldobjs="$objlist $obj" 561332b578d3Smrg objlist="$objlist $obj" 561432b578d3Smrg eval test_cmds=\"$old_archive_cmds\" 561532b578d3Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 561632b578d3Smrg test "$len" -le "$max_cmd_len"; then 561732b578d3Smrg : 561832b578d3Smrg else 561932b578d3Smrg # the above command should be used before it gets too long 562032b578d3Smrg oldobjs=$objlist 562132b578d3Smrg if test "$obj" = "$last_oldobj" ; then 562232b578d3Smrg RANLIB=$save_RANLIB 562332b578d3Smrg fi 562432b578d3Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 562532b578d3Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 562632b578d3Smrg objlist= 562732b578d3Smrg fi 562832b578d3Smrg done 562932b578d3Smrg RANLIB=$save_RANLIB 563032b578d3Smrg oldobjs=$objlist 563132b578d3Smrg if test "X$oldobjs" = "X" ; then 563232b578d3Smrg eval cmds=\"\$concat_cmds\" 563332b578d3Smrg else 563432b578d3Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 563532b578d3Smrg fi 563632b578d3Smrg fi 563732b578d3Smrg fi 563832b578d3Smrg save_ifs="$IFS"; IFS='~' 563932b578d3Smrg for cmd in $cmds; do 564032b578d3Smrg eval cmd=\"$cmd\" 564132b578d3Smrg IFS="$save_ifs" 564232b578d3Smrg $show "$cmd" 564332b578d3Smrg $run eval "$cmd" || exit $? 564432b578d3Smrg done 564532b578d3Smrg IFS="$save_ifs" 564632b578d3Smrg done 564732b578d3Smrg 564832b578d3Smrg if test -n "$generated"; then 564932b578d3Smrg $show "${rm}r$generated" 565032b578d3Smrg $run ${rm}r$generated 565132b578d3Smrg fi 565232b578d3Smrg 565332b578d3Smrg # Now create the libtool archive. 565432b578d3Smrg case $output in 565532b578d3Smrg *.la) 565632b578d3Smrg old_library= 565732b578d3Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 565832b578d3Smrg $show "creating $output" 565932b578d3Smrg 566032b578d3Smrg # Preserve any variables that may affect compiler behavior 566132b578d3Smrg for var in $variables_saved_for_relink; do 566232b578d3Smrg if eval test -z \"\${$var+set}\"; then 566332b578d3Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 566432b578d3Smrg elif eval var_value=\$$var; test -z "$var_value"; then 566532b578d3Smrg relink_command="$var=; export $var; $relink_command" 566632b578d3Smrg else 566732b578d3Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 566832b578d3Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 566932b578d3Smrg fi 567032b578d3Smrg done 567132b578d3Smrg # Quote the link command for shipping. 567232b578d3Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 56732a51b5beSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 567432b578d3Smrg if test "$hardcode_automatic" = yes ; then 567532b578d3Smrg relink_command= 567632b578d3Smrg fi 567732b578d3Smrg 567832b578d3Smrg 567932b578d3Smrg # Only create the output if not a dry run. 568032b578d3Smrg if test -z "$run"; then 568132b578d3Smrg for installed in no yes; do 568232b578d3Smrg if test "$installed" = yes; then 568332b578d3Smrg if test -z "$install_libdir"; then 568432b578d3Smrg break 568532b578d3Smrg fi 568632b578d3Smrg output="$output_objdir/$outputname"i 568732b578d3Smrg # Replace all uninstalled libtool libraries with the installed ones 568832b578d3Smrg newdependency_libs= 568932b578d3Smrg for deplib in $dependency_libs; do 569032b578d3Smrg case $deplib in 569132b578d3Smrg *.la) 569232b578d3Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 569332b578d3Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 569432b578d3Smrg if test -z "$libdir"; then 569532b578d3Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 569632b578d3Smrg exit $EXIT_FAILURE 569732b578d3Smrg fi 569832b578d3Smrg newdependency_libs="$newdependency_libs $libdir/$name" 569932b578d3Smrg ;; 570032b578d3Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 570132b578d3Smrg esac 570232b578d3Smrg done 570332b578d3Smrg dependency_libs="$newdependency_libs" 570432b578d3Smrg newdlfiles= 570532b578d3Smrg for lib in $dlfiles; do 570632b578d3Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 570732b578d3Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 570832b578d3Smrg if test -z "$libdir"; then 570932b578d3Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 571032b578d3Smrg exit $EXIT_FAILURE 571132b578d3Smrg fi 571232b578d3Smrg newdlfiles="$newdlfiles $libdir/$name" 571332b578d3Smrg done 571432b578d3Smrg dlfiles="$newdlfiles" 571532b578d3Smrg newdlprefiles= 571632b578d3Smrg for lib in $dlprefiles; do 571732b578d3Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 571832b578d3Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 571932b578d3Smrg if test -z "$libdir"; then 572032b578d3Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 572132b578d3Smrg exit $EXIT_FAILURE 572232b578d3Smrg fi 572332b578d3Smrg newdlprefiles="$newdlprefiles $libdir/$name" 572432b578d3Smrg done 572532b578d3Smrg dlprefiles="$newdlprefiles" 572632b578d3Smrg else 572732b578d3Smrg newdlfiles= 572832b578d3Smrg for lib in $dlfiles; do 572932b578d3Smrg case $lib in 573032b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 573132b578d3Smrg *) abs=`pwd`"/$lib" ;; 573232b578d3Smrg esac 573332b578d3Smrg newdlfiles="$newdlfiles $abs" 573432b578d3Smrg done 573532b578d3Smrg dlfiles="$newdlfiles" 573632b578d3Smrg newdlprefiles= 573732b578d3Smrg for lib in $dlprefiles; do 573832b578d3Smrg case $lib in 573932b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 574032b578d3Smrg *) abs=`pwd`"/$lib" ;; 574132b578d3Smrg esac 574232b578d3Smrg newdlprefiles="$newdlprefiles $abs" 574332b578d3Smrg done 574432b578d3Smrg dlprefiles="$newdlprefiles" 574532b578d3Smrg fi 574632b578d3Smrg $rm $output 574732b578d3Smrg # place dlname in correct position for cygwin 574832b578d3Smrg tdlname=$dlname 574932b578d3Smrg case $host,$output,$installed,$module,$dlname in 575032b578d3Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 575132b578d3Smrg esac 575232b578d3Smrg $echo > $output "\ 575332b578d3Smrg# $outputname - a libtool library file 575432b578d3Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 575532b578d3Smrg# 575632b578d3Smrg# Please DO NOT delete this file! 575732b578d3Smrg# It is necessary for linking the library. 575832b578d3Smrg 575932b578d3Smrg# The name that we can dlopen(3). 576032b578d3Smrgdlname='$tdlname' 576132b578d3Smrg 576232b578d3Smrg# Names of this library. 576332b578d3Smrglibrary_names='$library_names' 576432b578d3Smrg 576532b578d3Smrg# The name of the static archive. 576632b578d3Smrgold_library='$old_library' 576732b578d3Smrg 576832b578d3Smrg# Libraries that this one depends upon. 576932b578d3Smrgdependency_libs='$dependency_libs' 577032b578d3Smrg 577132b578d3Smrg# Version information for $libname. 577232b578d3Smrgcurrent=$current 577332b578d3Smrgage=$age 577432b578d3Smrgrevision=$revision 577532b578d3Smrg 577632b578d3Smrg# Is this an already installed library? 577732b578d3Smrginstalled=$installed 577832b578d3Smrg 577932b578d3Smrg# Should we warn about portability when linking against -modules? 578032b578d3Smrgshouldnotlink=$module 578132b578d3Smrg 578232b578d3Smrg# Files to dlopen/dlpreopen 578332b578d3Smrgdlopen='$dlfiles' 578432b578d3Smrgdlpreopen='$dlprefiles' 578532b578d3Smrg 578632b578d3Smrg# Directory that this library needs to be installed in: 578732b578d3Smrglibdir='$install_libdir'" 578832b578d3Smrg if test "$installed" = no && test "$need_relink" = yes; then 578932b578d3Smrg $echo >> $output "\ 579032b578d3Smrgrelink_command=\"$relink_command\"" 579132b578d3Smrg fi 579232b578d3Smrg done 579332b578d3Smrg fi 579432b578d3Smrg 579532b578d3Smrg # Do a symbolic link so that the libtool archive can be found in 579632b578d3Smrg # LD_LIBRARY_PATH before the program is installed. 579732b578d3Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 579832b578d3Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 579932b578d3Smrg ;; 580032b578d3Smrg esac 580132b578d3Smrg exit $EXIT_SUCCESS 580232b578d3Smrg ;; 580332b578d3Smrg 580432b578d3Smrg # libtool install mode 580532b578d3Smrg install) 580632b578d3Smrg modename="$modename: install" 580732b578d3Smrg 580832b578d3Smrg # There may be an optional sh(1) argument at the beginning of 580932b578d3Smrg # install_prog (especially on Windows NT). 581032b578d3Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 581132b578d3Smrg # Allow the use of GNU shtool's install command. 581232b578d3Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 581332b578d3Smrg # Aesthetically quote it. 581432b578d3Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 581532b578d3Smrg case $arg in 581632b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 581732b578d3Smrg arg="\"$arg\"" 581832b578d3Smrg ;; 581932b578d3Smrg esac 582032b578d3Smrg install_prog="$arg " 582132b578d3Smrg arg="$1" 582232b578d3Smrg shift 582332b578d3Smrg else 582432b578d3Smrg install_prog= 582532b578d3Smrg arg=$nonopt 582632b578d3Smrg fi 582732b578d3Smrg 582832b578d3Smrg # The real first argument should be the name of the installation program. 582932b578d3Smrg # Aesthetically quote it. 583032b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 583132b578d3Smrg case $arg in 583232b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 583332b578d3Smrg arg="\"$arg\"" 583432b578d3Smrg ;; 583532b578d3Smrg esac 583632b578d3Smrg install_prog="$install_prog$arg" 583732b578d3Smrg 583832b578d3Smrg # We need to accept at least all the BSD install flags. 583932b578d3Smrg dest= 584032b578d3Smrg files= 584132b578d3Smrg opts= 584232b578d3Smrg prev= 584332b578d3Smrg install_type= 584432b578d3Smrg isdir=no 584532b578d3Smrg stripme= 584632b578d3Smrg for arg 584732b578d3Smrg do 584832b578d3Smrg if test -n "$dest"; then 584932b578d3Smrg files="$files $dest" 585032b578d3Smrg dest=$arg 585132b578d3Smrg continue 585232b578d3Smrg fi 585332b578d3Smrg 585432b578d3Smrg case $arg in 585532b578d3Smrg -d) isdir=yes ;; 585632b578d3Smrg -f) 585732b578d3Smrg case " $install_prog " in 585832b578d3Smrg *[\\\ /]cp\ *) ;; 585932b578d3Smrg *) prev=$arg ;; 586032b578d3Smrg esac 586132b578d3Smrg ;; 586232b578d3Smrg -g | -m | -o) prev=$arg ;; 586332b578d3Smrg -s) 586432b578d3Smrg stripme=" -s" 586532b578d3Smrg continue 586632b578d3Smrg ;; 586732b578d3Smrg -*) 586832b578d3Smrg ;; 586932b578d3Smrg *) 587032b578d3Smrg # If the previous option needed an argument, then skip it. 587132b578d3Smrg if test -n "$prev"; then 587232b578d3Smrg prev= 587332b578d3Smrg else 587432b578d3Smrg dest=$arg 587532b578d3Smrg continue 587632b578d3Smrg fi 587732b578d3Smrg ;; 587832b578d3Smrg esac 587932b578d3Smrg 588032b578d3Smrg # Aesthetically quote the argument. 588132b578d3Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 588232b578d3Smrg case $arg in 588332b578d3Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 588432b578d3Smrg arg="\"$arg\"" 588532b578d3Smrg ;; 588632b578d3Smrg esac 588732b578d3Smrg install_prog="$install_prog $arg" 588832b578d3Smrg done 588932b578d3Smrg 589032b578d3Smrg if test -z "$install_prog"; then 589132b578d3Smrg $echo "$modename: you must specify an install program" 1>&2 589232b578d3Smrg $echo "$help" 1>&2 589332b578d3Smrg exit $EXIT_FAILURE 589432b578d3Smrg fi 589532b578d3Smrg 589632b578d3Smrg if test -n "$prev"; then 589732b578d3Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 589832b578d3Smrg $echo "$help" 1>&2 589932b578d3Smrg exit $EXIT_FAILURE 590032b578d3Smrg fi 590132b578d3Smrg 590232b578d3Smrg if test -z "$files"; then 590332b578d3Smrg if test -z "$dest"; then 590432b578d3Smrg $echo "$modename: no file or destination specified" 1>&2 590532b578d3Smrg else 590632b578d3Smrg $echo "$modename: you must specify a destination" 1>&2 590732b578d3Smrg fi 590832b578d3Smrg $echo "$help" 1>&2 590932b578d3Smrg exit $EXIT_FAILURE 591032b578d3Smrg fi 591132b578d3Smrg 591232b578d3Smrg # Strip any trailing slash from the destination. 591332b578d3Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 591432b578d3Smrg 591532b578d3Smrg # Check to see that the destination is a directory. 591632b578d3Smrg test -d "$dest" && isdir=yes 591732b578d3Smrg if test "$isdir" = yes; then 591832b578d3Smrg destdir="$dest" 591932b578d3Smrg destname= 592032b578d3Smrg else 592132b578d3Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 592232b578d3Smrg test "X$destdir" = "X$dest" && destdir=. 592332b578d3Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 592432b578d3Smrg 592532b578d3Smrg # Not a directory, so check to see that there is only one file specified. 592632b578d3Smrg set dummy $files 592732b578d3Smrg if test "$#" -gt 2; then 592832b578d3Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 592932b578d3Smrg $echo "$help" 1>&2 593032b578d3Smrg exit $EXIT_FAILURE 593132b578d3Smrg fi 593232b578d3Smrg fi 593332b578d3Smrg case $destdir in 593432b578d3Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 593532b578d3Smrg *) 593632b578d3Smrg for file in $files; do 593732b578d3Smrg case $file in 593832b578d3Smrg *.lo) ;; 593932b578d3Smrg *) 594032b578d3Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 594132b578d3Smrg $echo "$help" 1>&2 594232b578d3Smrg exit $EXIT_FAILURE 594332b578d3Smrg ;; 594432b578d3Smrg esac 594532b578d3Smrg done 594632b578d3Smrg ;; 594732b578d3Smrg esac 594832b578d3Smrg 594932b578d3Smrg # This variable tells wrapper scripts just to set variables rather 595032b578d3Smrg # than running their programs. 595132b578d3Smrg libtool_install_magic="$magic" 595232b578d3Smrg 595332b578d3Smrg staticlibs= 595432b578d3Smrg future_libdirs= 595532b578d3Smrg current_libdirs= 595632b578d3Smrg for file in $files; do 595732b578d3Smrg 595832b578d3Smrg # Do each installation. 595932b578d3Smrg case $file in 596032b578d3Smrg *.$libext) 596132b578d3Smrg # Do the static libraries later. 596232b578d3Smrg staticlibs="$staticlibs $file" 596332b578d3Smrg ;; 596432b578d3Smrg 596532b578d3Smrg *.la) 596632b578d3Smrg # Check to see that this really is a libtool archive. 596732b578d3Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 596832b578d3Smrg else 596932b578d3Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 597032b578d3Smrg $echo "$help" 1>&2 597132b578d3Smrg exit $EXIT_FAILURE 597232b578d3Smrg fi 597332b578d3Smrg 597432b578d3Smrg library_names= 597532b578d3Smrg old_library= 597632b578d3Smrg relink_command= 597732b578d3Smrg # If there is no directory component, then add one. 597832b578d3Smrg case $file in 597932b578d3Smrg */* | *\\*) . $file ;; 598032b578d3Smrg *) . ./$file ;; 598132b578d3Smrg esac 598232b578d3Smrg 598332b578d3Smrg # Add the libdir to current_libdirs if it is the destination. 598432b578d3Smrg if test "X$destdir" = "X$libdir"; then 598532b578d3Smrg case "$current_libdirs " in 598632b578d3Smrg *" $libdir "*) ;; 598732b578d3Smrg *) current_libdirs="$current_libdirs $libdir" ;; 598832b578d3Smrg esac 598932b578d3Smrg else 599032b578d3Smrg # Note the libdir as a future libdir. 599132b578d3Smrg case "$future_libdirs " in 599232b578d3Smrg *" $libdir "*) ;; 599332b578d3Smrg *) future_libdirs="$future_libdirs $libdir" ;; 599432b578d3Smrg esac 599532b578d3Smrg fi 599632b578d3Smrg 599732b578d3Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 599832b578d3Smrg test "X$dir" = "X$file/" && dir= 599932b578d3Smrg dir="$dir$objdir" 600032b578d3Smrg 600132b578d3Smrg if test -n "$relink_command"; then 600232b578d3Smrg # Determine the prefix the user has applied to our future dir. 600332b578d3Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 600432b578d3Smrg 600532b578d3Smrg # Don't allow the user to place us outside of our expected 600632b578d3Smrg # location b/c this prevents finding dependent libraries that 600732b578d3Smrg # are installed to the same prefix. 600832b578d3Smrg # At present, this check doesn't affect windows .dll's that 600932b578d3Smrg # are installed into $libdir/../bin (currently, that works fine) 601032b578d3Smrg # but it's something to keep an eye on. 601132b578d3Smrg if test "$inst_prefix_dir" = "$destdir"; then 601232b578d3Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 601332b578d3Smrg exit $EXIT_FAILURE 601432b578d3Smrg fi 601532b578d3Smrg 601632b578d3Smrg if test -n "$inst_prefix_dir"; then 601732b578d3Smrg # Stick the inst_prefix_dir data into the link command. 60182a51b5beSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 601932b578d3Smrg else 60202a51b5beSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 602132b578d3Smrg fi 602232b578d3Smrg 602332b578d3Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 602432b578d3Smrg $show "$relink_command" 602532b578d3Smrg if $run eval "$relink_command"; then : 602632b578d3Smrg else 602732b578d3Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 602832b578d3Smrg exit $EXIT_FAILURE 602932b578d3Smrg fi 603032b578d3Smrg fi 603132b578d3Smrg 603232b578d3Smrg # See the names of the shared library. 603332b578d3Smrg set dummy $library_names 603432b578d3Smrg if test -n "$2"; then 603532b578d3Smrg realname="$2" 603632b578d3Smrg shift 603732b578d3Smrg shift 603832b578d3Smrg 603932b578d3Smrg srcname="$realname" 604032b578d3Smrg test -n "$relink_command" && srcname="$realname"T 604132b578d3Smrg 604232b578d3Smrg # Install the shared library and build the symlinks. 604332b578d3Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 604432b578d3Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 604532b578d3Smrg if test -n "$stripme" && test -n "$striplib"; then 604632b578d3Smrg $show "$striplib $destdir/$realname" 604732b578d3Smrg $run eval "$striplib $destdir/$realname" || exit $? 604832b578d3Smrg fi 604932b578d3Smrg 605032b578d3Smrg if test "$#" -gt 0; then 605132b578d3Smrg # Delete the old symlinks, and create new ones. 605232b578d3Smrg # Try `ln -sf' first, because the `ln' binary might depend on 605332b578d3Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 605432b578d3Smrg # so we also need to try rm && ln -s. 605532b578d3Smrg for linkname 605632b578d3Smrg do 605732b578d3Smrg if test "$linkname" != "$realname"; then 605832b578d3Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 605932b578d3Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 606032b578d3Smrg fi 606132b578d3Smrg done 606232b578d3Smrg fi 606332b578d3Smrg 606432b578d3Smrg # Do each command in the postinstall commands. 606532b578d3Smrg lib="$destdir/$realname" 606632b578d3Smrg cmds=$postinstall_cmds 606732b578d3Smrg save_ifs="$IFS"; IFS='~' 606832b578d3Smrg for cmd in $cmds; do 606932b578d3Smrg IFS="$save_ifs" 607032b578d3Smrg eval cmd=\"$cmd\" 607132b578d3Smrg $show "$cmd" 607232b578d3Smrg $run eval "$cmd" || { 607332b578d3Smrg lt_exit=$? 607432b578d3Smrg 607532b578d3Smrg # Restore the uninstalled library and exit 607632b578d3Smrg if test "$mode" = relink; then 607732b578d3Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 607832b578d3Smrg fi 607932b578d3Smrg 608032b578d3Smrg exit $lt_exit 608132b578d3Smrg } 608232b578d3Smrg done 608332b578d3Smrg IFS="$save_ifs" 608432b578d3Smrg fi 608532b578d3Smrg 608632b578d3Smrg # Install the pseudo-library for information purposes. 608732b578d3Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 608832b578d3Smrg instname="$dir/$name"i 608932b578d3Smrg $show "$install_prog $instname $destdir/$name" 609032b578d3Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 609132b578d3Smrg 609232b578d3Smrg # Maybe install the static library, too. 609332b578d3Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 609432b578d3Smrg ;; 609532b578d3Smrg 609632b578d3Smrg *.lo) 609732b578d3Smrg # Install (i.e. copy) a libtool object. 609832b578d3Smrg 609932b578d3Smrg # Figure out destination file name, if it wasn't already specified. 610032b578d3Smrg if test -n "$destname"; then 610132b578d3Smrg destfile="$destdir/$destname" 610232b578d3Smrg else 610332b578d3Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 610432b578d3Smrg destfile="$destdir/$destfile" 610532b578d3Smrg fi 610632b578d3Smrg 610732b578d3Smrg # Deduce the name of the destination old-style object file. 610832b578d3Smrg case $destfile in 610932b578d3Smrg *.lo) 611032b578d3Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 611132b578d3Smrg ;; 611232b578d3Smrg *.$objext) 611332b578d3Smrg staticdest="$destfile" 611432b578d3Smrg destfile= 611532b578d3Smrg ;; 611632b578d3Smrg *) 611732b578d3Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 611832b578d3Smrg $echo "$help" 1>&2 611932b578d3Smrg exit $EXIT_FAILURE 612032b578d3Smrg ;; 612132b578d3Smrg esac 612232b578d3Smrg 612332b578d3Smrg # Install the libtool object if requested. 612432b578d3Smrg if test -n "$destfile"; then 612532b578d3Smrg $show "$install_prog $file $destfile" 612632b578d3Smrg $run eval "$install_prog $file $destfile" || exit $? 612732b578d3Smrg fi 612832b578d3Smrg 612932b578d3Smrg # Install the old object if enabled. 613032b578d3Smrg if test "$build_old_libs" = yes; then 613132b578d3Smrg # Deduce the name of the old-style object file. 613232b578d3Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 613332b578d3Smrg 613432b578d3Smrg $show "$install_prog $staticobj $staticdest" 613532b578d3Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 613632b578d3Smrg fi 613732b578d3Smrg exit $EXIT_SUCCESS 613832b578d3Smrg ;; 613932b578d3Smrg 614032b578d3Smrg *) 614132b578d3Smrg # Figure out destination file name, if it wasn't already specified. 614232b578d3Smrg if test -n "$destname"; then 614332b578d3Smrg destfile="$destdir/$destname" 614432b578d3Smrg else 614532b578d3Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 614632b578d3Smrg destfile="$destdir/$destfile" 614732b578d3Smrg fi 614832b578d3Smrg 614932b578d3Smrg # If the file is missing, and there is a .exe on the end, strip it 615032b578d3Smrg # because it is most likely a libtool script we actually want to 615132b578d3Smrg # install 615232b578d3Smrg stripped_ext="" 615332b578d3Smrg case $file in 615432b578d3Smrg *.exe) 615532b578d3Smrg if test ! -f "$file"; then 615632b578d3Smrg file=`$echo $file|${SED} 's,.exe$,,'` 615732b578d3Smrg stripped_ext=".exe" 615832b578d3Smrg fi 615932b578d3Smrg ;; 616032b578d3Smrg esac 616132b578d3Smrg 616232b578d3Smrg # Do a test to see if this is really a libtool program. 616332b578d3Smrg case $host in 616432b578d3Smrg *cygwin*|*mingw*) 616532b578d3Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 616632b578d3Smrg ;; 616732b578d3Smrg *) 616832b578d3Smrg wrapper=$file 616932b578d3Smrg ;; 617032b578d3Smrg esac 617132b578d3Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 617232b578d3Smrg notinst_deplibs= 617332b578d3Smrg relink_command= 617432b578d3Smrg 617532b578d3Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 617632b578d3Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 617732b578d3Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 617832b578d3Smrg # `FILE.' does not work on cygwin managed mounts. 617932b578d3Smrg # 618032b578d3Smrg # If there is no directory component, then add one. 618132b578d3Smrg case $wrapper in 618232b578d3Smrg */* | *\\*) . ${wrapper} ;; 618332b578d3Smrg *) . ./${wrapper} ;; 618432b578d3Smrg esac 618532b578d3Smrg 618632b578d3Smrg # Check the variables that should have been set. 618732b578d3Smrg if test -z "$notinst_deplibs"; then 618832b578d3Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 618932b578d3Smrg exit $EXIT_FAILURE 619032b578d3Smrg fi 619132b578d3Smrg 619232b578d3Smrg finalize=yes 619332b578d3Smrg for lib in $notinst_deplibs; do 619432b578d3Smrg # Check to see that each library is installed. 619532b578d3Smrg libdir= 619632b578d3Smrg if test -f "$lib"; then 619732b578d3Smrg # If there is no directory component, then add one. 619832b578d3Smrg case $lib in 619932b578d3Smrg */* | *\\*) . $lib ;; 620032b578d3Smrg *) . ./$lib ;; 620132b578d3Smrg esac 620232b578d3Smrg fi 620332b578d3Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 620432b578d3Smrg if test -n "$libdir" && test ! -f "$libfile"; then 620532b578d3Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 620632b578d3Smrg finalize=no 620732b578d3Smrg fi 620832b578d3Smrg done 620932b578d3Smrg 621032b578d3Smrg relink_command= 621132b578d3Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 621232b578d3Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 621332b578d3Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 621432b578d3Smrg # `FILE.' does not work on cygwin managed mounts. 621532b578d3Smrg # 621632b578d3Smrg # If there is no directory component, then add one. 621732b578d3Smrg case $wrapper in 621832b578d3Smrg */* | *\\*) . ${wrapper} ;; 621932b578d3Smrg *) . ./${wrapper} ;; 622032b578d3Smrg esac 622132b578d3Smrg 622232b578d3Smrg outputname= 622332b578d3Smrg if test "$fast_install" = no && test -n "$relink_command"; then 622432b578d3Smrg if test "$finalize" = yes && test -z "$run"; then 622532b578d3Smrg tmpdir=`func_mktempdir` 622632b578d3Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 622732b578d3Smrg outputname="$tmpdir/$file" 622832b578d3Smrg # Replace the output file specification. 62292a51b5beSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 623032b578d3Smrg 623132b578d3Smrg $show "$relink_command" 623232b578d3Smrg if $run eval "$relink_command"; then : 623332b578d3Smrg else 623432b578d3Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 623532b578d3Smrg ${rm}r "$tmpdir" 623632b578d3Smrg continue 623732b578d3Smrg fi 623832b578d3Smrg file="$outputname" 623932b578d3Smrg else 624032b578d3Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 624132b578d3Smrg fi 624232b578d3Smrg else 624332b578d3Smrg # Install the binary that we compiled earlier. 624432b578d3Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 624532b578d3Smrg fi 624632b578d3Smrg fi 624732b578d3Smrg 624832b578d3Smrg # remove .exe since cygwin /usr/bin/install will append another 624932b578d3Smrg # one anyway 625032b578d3Smrg case $install_prog,$host in 625132b578d3Smrg */usr/bin/install*,*cygwin*) 625232b578d3Smrg case $file:$destfile in 625332b578d3Smrg *.exe:*.exe) 625432b578d3Smrg # this is ok 625532b578d3Smrg ;; 625632b578d3Smrg *.exe:*) 625732b578d3Smrg destfile=$destfile.exe 625832b578d3Smrg ;; 625932b578d3Smrg *:*.exe) 626032b578d3Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 626132b578d3Smrg ;; 626232b578d3Smrg esac 626332b578d3Smrg ;; 626432b578d3Smrg esac 626532b578d3Smrg $show "$install_prog$stripme $file $destfile" 626632b578d3Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 626732b578d3Smrg test -n "$outputname" && ${rm}r "$tmpdir" 626832b578d3Smrg ;; 626932b578d3Smrg esac 627032b578d3Smrg done 627132b578d3Smrg 627232b578d3Smrg for file in $staticlibs; do 627332b578d3Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 627432b578d3Smrg 627532b578d3Smrg # Set up the ranlib parameters. 627632b578d3Smrg oldlib="$destdir/$name" 627732b578d3Smrg 627832b578d3Smrg $show "$install_prog $file $oldlib" 627932b578d3Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 628032b578d3Smrg 628132b578d3Smrg if test -n "$stripme" && test -n "$old_striplib"; then 628232b578d3Smrg $show "$old_striplib $oldlib" 628332b578d3Smrg $run eval "$old_striplib $oldlib" || exit $? 628432b578d3Smrg fi 628532b578d3Smrg 628632b578d3Smrg # Do each command in the postinstall commands. 628732b578d3Smrg cmds=$old_postinstall_cmds 628832b578d3Smrg save_ifs="$IFS"; IFS='~' 628932b578d3Smrg for cmd in $cmds; do 629032b578d3Smrg IFS="$save_ifs" 629132b578d3Smrg eval cmd=\"$cmd\" 629232b578d3Smrg $show "$cmd" 629332b578d3Smrg $run eval "$cmd" || exit $? 629432b578d3Smrg done 629532b578d3Smrg IFS="$save_ifs" 629632b578d3Smrg done 629732b578d3Smrg 629832b578d3Smrg if test -n "$future_libdirs"; then 629932b578d3Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 630032b578d3Smrg fi 630132b578d3Smrg 630232b578d3Smrg if test -n "$current_libdirs"; then 630332b578d3Smrg # Maybe just do a dry run. 630432b578d3Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 630532b578d3Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 630632b578d3Smrg else 630732b578d3Smrg exit $EXIT_SUCCESS 630832b578d3Smrg fi 630932b578d3Smrg ;; 631032b578d3Smrg 631132b578d3Smrg # libtool finish mode 631232b578d3Smrg finish) 631332b578d3Smrg modename="$modename: finish" 631432b578d3Smrg libdirs="$nonopt" 631532b578d3Smrg admincmds= 631632b578d3Smrg 631732b578d3Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 631832b578d3Smrg for dir 631932b578d3Smrg do 632032b578d3Smrg libdirs="$libdirs $dir" 632132b578d3Smrg done 632232b578d3Smrg 632332b578d3Smrg for libdir in $libdirs; do 632432b578d3Smrg if test -n "$finish_cmds"; then 632532b578d3Smrg # Do each command in the finish commands. 632632b578d3Smrg cmds=$finish_cmds 632732b578d3Smrg save_ifs="$IFS"; IFS='~' 632832b578d3Smrg for cmd in $cmds; do 632932b578d3Smrg IFS="$save_ifs" 633032b578d3Smrg eval cmd=\"$cmd\" 633132b578d3Smrg $show "$cmd" 633232b578d3Smrg $run eval "$cmd" || admincmds="$admincmds 633332b578d3Smrg $cmd" 633432b578d3Smrg done 633532b578d3Smrg IFS="$save_ifs" 633632b578d3Smrg fi 633732b578d3Smrg if test -n "$finish_eval"; then 633832b578d3Smrg # Do the single finish_eval. 633932b578d3Smrg eval cmds=\"$finish_eval\" 634032b578d3Smrg $run eval "$cmds" || admincmds="$admincmds 634132b578d3Smrg $cmds" 634232b578d3Smrg fi 634332b578d3Smrg done 634432b578d3Smrg fi 634532b578d3Smrg 634632b578d3Smrg # Exit here if they wanted silent mode. 634732b578d3Smrg test "$show" = : && exit $EXIT_SUCCESS 634832b578d3Smrg 634932b578d3Smrg $echo "X----------------------------------------------------------------------" | $Xsed 635032b578d3Smrg $echo "Libraries have been installed in:" 635132b578d3Smrg for libdir in $libdirs; do 635232b578d3Smrg $echo " $libdir" 635332b578d3Smrg done 635432b578d3Smrg $echo 635532b578d3Smrg $echo "If you ever happen to want to link against installed libraries" 635632b578d3Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 635732b578d3Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 635832b578d3Smrg $echo "flag during linking and do at least one of the following:" 635932b578d3Smrg if test -n "$shlibpath_var"; then 636032b578d3Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 636132b578d3Smrg $echo " during execution" 636232b578d3Smrg fi 636332b578d3Smrg if test -n "$runpath_var"; then 636432b578d3Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 636532b578d3Smrg $echo " during linking" 636632b578d3Smrg fi 636732b578d3Smrg if test -n "$hardcode_libdir_flag_spec"; then 636832b578d3Smrg libdir=LIBDIR 636932b578d3Smrg eval flag=\"$hardcode_libdir_flag_spec\" 637032b578d3Smrg 637132b578d3Smrg $echo " - use the \`$flag' linker flag" 637232b578d3Smrg fi 637332b578d3Smrg if test -n "$admincmds"; then 637432b578d3Smrg $echo " - have your system administrator run these commands:$admincmds" 637532b578d3Smrg fi 637632b578d3Smrg if test -f /etc/ld.so.conf; then 637732b578d3Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 637832b578d3Smrg fi 637932b578d3Smrg $echo 638032b578d3Smrg $echo "See any operating system documentation about shared libraries for" 638132b578d3Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 638232b578d3Smrg $echo "X----------------------------------------------------------------------" | $Xsed 638332b578d3Smrg exit $EXIT_SUCCESS 638432b578d3Smrg ;; 638532b578d3Smrg 638632b578d3Smrg # libtool execute mode 638732b578d3Smrg execute) 638832b578d3Smrg modename="$modename: execute" 638932b578d3Smrg 639032b578d3Smrg # The first argument is the command name. 639132b578d3Smrg cmd="$nonopt" 639232b578d3Smrg if test -z "$cmd"; then 639332b578d3Smrg $echo "$modename: you must specify a COMMAND" 1>&2 639432b578d3Smrg $echo "$help" 639532b578d3Smrg exit $EXIT_FAILURE 639632b578d3Smrg fi 639732b578d3Smrg 639832b578d3Smrg # Handle -dlopen flags immediately. 639932b578d3Smrg for file in $execute_dlfiles; do 640032b578d3Smrg if test ! -f "$file"; then 640132b578d3Smrg $echo "$modename: \`$file' is not a file" 1>&2 640232b578d3Smrg $echo "$help" 1>&2 640332b578d3Smrg exit $EXIT_FAILURE 640432b578d3Smrg fi 640532b578d3Smrg 640632b578d3Smrg dir= 640732b578d3Smrg case $file in 640832b578d3Smrg *.la) 640932b578d3Smrg # Check to see that this really is a libtool archive. 641032b578d3Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 641132b578d3Smrg else 641232b578d3Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 641332b578d3Smrg $echo "$help" 1>&2 641432b578d3Smrg exit $EXIT_FAILURE 641532b578d3Smrg fi 641632b578d3Smrg 641732b578d3Smrg # Read the libtool library. 641832b578d3Smrg dlname= 641932b578d3Smrg library_names= 642032b578d3Smrg 642132b578d3Smrg # If there is no directory component, then add one. 642232b578d3Smrg case $file in 642332b578d3Smrg */* | *\\*) . $file ;; 642432b578d3Smrg *) . ./$file ;; 642532b578d3Smrg esac 642632b578d3Smrg 642732b578d3Smrg # Skip this library if it cannot be dlopened. 642832b578d3Smrg if test -z "$dlname"; then 642932b578d3Smrg # Warn if it was a shared library. 643032b578d3Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 643132b578d3Smrg continue 643232b578d3Smrg fi 643332b578d3Smrg 643432b578d3Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 643532b578d3Smrg test "X$dir" = "X$file" && dir=. 643632b578d3Smrg 643732b578d3Smrg if test -f "$dir/$objdir/$dlname"; then 643832b578d3Smrg dir="$dir/$objdir" 643932b578d3Smrg else 64402a51b5beSmrg if test ! -f "$dir/$dlname"; then 64412a51b5beSmrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 64422a51b5beSmrg exit $EXIT_FAILURE 64432a51b5beSmrg fi 644432b578d3Smrg fi 644532b578d3Smrg ;; 644632b578d3Smrg 644732b578d3Smrg *.lo) 644832b578d3Smrg # Just add the directory containing the .lo file. 644932b578d3Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 645032b578d3Smrg test "X$dir" = "X$file" && dir=. 645132b578d3Smrg ;; 645232b578d3Smrg 645332b578d3Smrg *) 645432b578d3Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 645532b578d3Smrg continue 645632b578d3Smrg ;; 645732b578d3Smrg esac 645832b578d3Smrg 645932b578d3Smrg # Get the absolute pathname. 646032b578d3Smrg absdir=`cd "$dir" && pwd` 646132b578d3Smrg test -n "$absdir" && dir="$absdir" 646232b578d3Smrg 646332b578d3Smrg # Now add the directory to shlibpath_var. 646432b578d3Smrg if eval "test -z \"\$$shlibpath_var\""; then 646532b578d3Smrg eval "$shlibpath_var=\"\$dir\"" 646632b578d3Smrg else 646732b578d3Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 646832b578d3Smrg fi 646932b578d3Smrg done 647032b578d3Smrg 647132b578d3Smrg # This variable tells wrapper scripts just to set shlibpath_var 647232b578d3Smrg # rather than running their programs. 647332b578d3Smrg libtool_execute_magic="$magic" 647432b578d3Smrg 647532b578d3Smrg # Check if any of the arguments is a wrapper script. 647632b578d3Smrg args= 647732b578d3Smrg for file 647832b578d3Smrg do 647932b578d3Smrg case $file in 648032b578d3Smrg -*) ;; 648132b578d3Smrg *) 648232b578d3Smrg # Do a test to see if this is really a libtool program. 648332b578d3Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 648432b578d3Smrg # If there is no directory component, then add one. 648532b578d3Smrg case $file in 648632b578d3Smrg */* | *\\*) . $file ;; 648732b578d3Smrg *) . ./$file ;; 648832b578d3Smrg esac 648932b578d3Smrg 649032b578d3Smrg # Transform arg to wrapped name. 649132b578d3Smrg file="$progdir/$program" 649232b578d3Smrg fi 649332b578d3Smrg ;; 649432b578d3Smrg esac 649532b578d3Smrg # Quote arguments (to preserve shell metacharacters). 649632b578d3Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 649732b578d3Smrg args="$args \"$file\"" 649832b578d3Smrg done 649932b578d3Smrg 650032b578d3Smrg if test -z "$run"; then 650132b578d3Smrg if test -n "$shlibpath_var"; then 650232b578d3Smrg # Export the shlibpath_var. 650332b578d3Smrg eval "export $shlibpath_var" 650432b578d3Smrg fi 650532b578d3Smrg 650632b578d3Smrg # Restore saved environment variables 65072a51b5beSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 65082a51b5beSmrg do 65092a51b5beSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 65102a51b5beSmrg $lt_var=\$save_$lt_var; export $lt_var 65112a51b5beSmrg fi" 65122a51b5beSmrg done 651332b578d3Smrg 651432b578d3Smrg # Now prepare to actually exec the command. 651532b578d3Smrg exec_cmd="\$cmd$args" 651632b578d3Smrg else 651732b578d3Smrg # Display what would be done. 651832b578d3Smrg if test -n "$shlibpath_var"; then 651932b578d3Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 652032b578d3Smrg $echo "export $shlibpath_var" 652132b578d3Smrg fi 652232b578d3Smrg $echo "$cmd$args" 652332b578d3Smrg exit $EXIT_SUCCESS 652432b578d3Smrg fi 652532b578d3Smrg ;; 652632b578d3Smrg 652732b578d3Smrg # libtool clean and uninstall mode 652832b578d3Smrg clean | uninstall) 652932b578d3Smrg modename="$modename: $mode" 653032b578d3Smrg rm="$nonopt" 653132b578d3Smrg files= 653232b578d3Smrg rmforce= 653332b578d3Smrg exit_status=0 653432b578d3Smrg 653532b578d3Smrg # This variable tells wrapper scripts just to set variables rather 653632b578d3Smrg # than running their programs. 653732b578d3Smrg libtool_install_magic="$magic" 653832b578d3Smrg 653932b578d3Smrg for arg 654032b578d3Smrg do 654132b578d3Smrg case $arg in 654232b578d3Smrg -f) rm="$rm $arg"; rmforce=yes ;; 654332b578d3Smrg -*) rm="$rm $arg" ;; 654432b578d3Smrg *) files="$files $arg" ;; 654532b578d3Smrg esac 654632b578d3Smrg done 654732b578d3Smrg 654832b578d3Smrg if test -z "$rm"; then 654932b578d3Smrg $echo "$modename: you must specify an RM program" 1>&2 655032b578d3Smrg $echo "$help" 1>&2 655132b578d3Smrg exit $EXIT_FAILURE 655232b578d3Smrg fi 655332b578d3Smrg 655432b578d3Smrg rmdirs= 655532b578d3Smrg 655632b578d3Smrg origobjdir="$objdir" 655732b578d3Smrg for file in $files; do 655832b578d3Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 655932b578d3Smrg if test "X$dir" = "X$file"; then 656032b578d3Smrg dir=. 656132b578d3Smrg objdir="$origobjdir" 656232b578d3Smrg else 656332b578d3Smrg objdir="$dir/$origobjdir" 656432b578d3Smrg fi 656532b578d3Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 656632b578d3Smrg test "$mode" = uninstall && objdir="$dir" 656732b578d3Smrg 656832b578d3Smrg # Remember objdir for removal later, being careful to avoid duplicates 656932b578d3Smrg if test "$mode" = clean; then 657032b578d3Smrg case " $rmdirs " in 657132b578d3Smrg *" $objdir "*) ;; 657232b578d3Smrg *) rmdirs="$rmdirs $objdir" ;; 657332b578d3Smrg esac 657432b578d3Smrg fi 657532b578d3Smrg 657632b578d3Smrg # Don't error if the file doesn't exist and rm -f was used. 657732b578d3Smrg if (test -L "$file") >/dev/null 2>&1 \ 657832b578d3Smrg || (test -h "$file") >/dev/null 2>&1 \ 657932b578d3Smrg || test -f "$file"; then 658032b578d3Smrg : 658132b578d3Smrg elif test -d "$file"; then 658232b578d3Smrg exit_status=1 658332b578d3Smrg continue 658432b578d3Smrg elif test "$rmforce" = yes; then 658532b578d3Smrg continue 658632b578d3Smrg fi 658732b578d3Smrg 658832b578d3Smrg rmfiles="$file" 658932b578d3Smrg 659032b578d3Smrg case $name in 659132b578d3Smrg *.la) 659232b578d3Smrg # Possibly a libtool archive, so verify it. 659332b578d3Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 659432b578d3Smrg . $dir/$name 659532b578d3Smrg 659632b578d3Smrg # Delete the libtool libraries and symlinks. 659732b578d3Smrg for n in $library_names; do 659832b578d3Smrg rmfiles="$rmfiles $objdir/$n" 659932b578d3Smrg done 660032b578d3Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 660132b578d3Smrg 660232b578d3Smrg case "$mode" in 660332b578d3Smrg clean) 660432b578d3Smrg case " $library_names " in 660532b578d3Smrg # " " in the beginning catches empty $dlname 660632b578d3Smrg *" $dlname "*) ;; 660732b578d3Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 660832b578d3Smrg esac 660932b578d3Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 661032b578d3Smrg ;; 661132b578d3Smrg uninstall) 661232b578d3Smrg if test -n "$library_names"; then 661332b578d3Smrg # Do each command in the postuninstall commands. 661432b578d3Smrg cmds=$postuninstall_cmds 661532b578d3Smrg save_ifs="$IFS"; IFS='~' 661632b578d3Smrg for cmd in $cmds; do 661732b578d3Smrg IFS="$save_ifs" 661832b578d3Smrg eval cmd=\"$cmd\" 661932b578d3Smrg $show "$cmd" 662032b578d3Smrg $run eval "$cmd" 662132b578d3Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 662232b578d3Smrg exit_status=1 662332b578d3Smrg fi 662432b578d3Smrg done 662532b578d3Smrg IFS="$save_ifs" 662632b578d3Smrg fi 662732b578d3Smrg 662832b578d3Smrg if test -n "$old_library"; then 662932b578d3Smrg # Do each command in the old_postuninstall commands. 663032b578d3Smrg cmds=$old_postuninstall_cmds 663132b578d3Smrg save_ifs="$IFS"; IFS='~' 663232b578d3Smrg for cmd in $cmds; do 663332b578d3Smrg IFS="$save_ifs" 663432b578d3Smrg eval cmd=\"$cmd\" 663532b578d3Smrg $show "$cmd" 663632b578d3Smrg $run eval "$cmd" 663732b578d3Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 663832b578d3Smrg exit_status=1 663932b578d3Smrg fi 664032b578d3Smrg done 664132b578d3Smrg IFS="$save_ifs" 664232b578d3Smrg fi 664332b578d3Smrg # FIXME: should reinstall the best remaining shared library. 664432b578d3Smrg ;; 664532b578d3Smrg esac 664632b578d3Smrg fi 664732b578d3Smrg ;; 664832b578d3Smrg 664932b578d3Smrg *.lo) 665032b578d3Smrg # Possibly a libtool object, so verify it. 665132b578d3Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 665232b578d3Smrg 665332b578d3Smrg # Read the .lo file 665432b578d3Smrg . $dir/$name 665532b578d3Smrg 665632b578d3Smrg # Add PIC object to the list of files to remove. 665732b578d3Smrg if test -n "$pic_object" \ 665832b578d3Smrg && test "$pic_object" != none; then 665932b578d3Smrg rmfiles="$rmfiles $dir/$pic_object" 666032b578d3Smrg fi 666132b578d3Smrg 666232b578d3Smrg # Add non-PIC object to the list of files to remove. 666332b578d3Smrg if test -n "$non_pic_object" \ 666432b578d3Smrg && test "$non_pic_object" != none; then 666532b578d3Smrg rmfiles="$rmfiles $dir/$non_pic_object" 666632b578d3Smrg fi 666732b578d3Smrg fi 666832b578d3Smrg ;; 666932b578d3Smrg 667032b578d3Smrg *) 667132b578d3Smrg if test "$mode" = clean ; then 667232b578d3Smrg noexename=$name 667332b578d3Smrg case $file in 667432b578d3Smrg *.exe) 667532b578d3Smrg file=`$echo $file|${SED} 's,.exe$,,'` 667632b578d3Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 667732b578d3Smrg # $file with .exe has already been added to rmfiles, 667832b578d3Smrg # add $file without .exe 667932b578d3Smrg rmfiles="$rmfiles $file" 668032b578d3Smrg ;; 668132b578d3Smrg esac 668232b578d3Smrg # Do a test to see if this is a libtool program. 668332b578d3Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 668432b578d3Smrg relink_command= 668532b578d3Smrg . $dir/$noexename 668632b578d3Smrg 668732b578d3Smrg # note $name still contains .exe if it was in $file originally 668832b578d3Smrg # as does the version of $file that was added into $rmfiles 668932b578d3Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 669032b578d3Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 669132b578d3Smrg rmfiles="$rmfiles $objdir/lt-$name" 669232b578d3Smrg fi 669332b578d3Smrg if test "X$noexename" != "X$name" ; then 669432b578d3Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 669532b578d3Smrg fi 669632b578d3Smrg fi 669732b578d3Smrg fi 669832b578d3Smrg ;; 669932b578d3Smrg esac 670032b578d3Smrg $show "$rm $rmfiles" 670132b578d3Smrg $run $rm $rmfiles || exit_status=1 670232b578d3Smrg done 670332b578d3Smrg objdir="$origobjdir" 670432b578d3Smrg 670532b578d3Smrg # Try to remove the ${objdir}s in the directories where we deleted files 670632b578d3Smrg for dir in $rmdirs; do 670732b578d3Smrg if test -d "$dir"; then 670832b578d3Smrg $show "rmdir $dir" 670932b578d3Smrg $run rmdir $dir >/dev/null 2>&1 671032b578d3Smrg fi 671132b578d3Smrg done 671232b578d3Smrg 671332b578d3Smrg exit $exit_status 671432b578d3Smrg ;; 671532b578d3Smrg 671632b578d3Smrg "") 671732b578d3Smrg $echo "$modename: you must specify a MODE" 1>&2 671832b578d3Smrg $echo "$generic_help" 1>&2 671932b578d3Smrg exit $EXIT_FAILURE 672032b578d3Smrg ;; 672132b578d3Smrg esac 672232b578d3Smrg 672332b578d3Smrg if test -z "$exec_cmd"; then 672432b578d3Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 672532b578d3Smrg $echo "$generic_help" 1>&2 672632b578d3Smrg exit $EXIT_FAILURE 672732b578d3Smrg fi 672832b578d3Smrgfi # test -z "$show_help" 672932b578d3Smrg 673032b578d3Smrgif test -n "$exec_cmd"; then 673132b578d3Smrg eval exec $exec_cmd 673232b578d3Smrg exit $EXIT_FAILURE 673332b578d3Smrgfi 673432b578d3Smrg 673532b578d3Smrg# We need to display help for each of the modes. 673632b578d3Smrgcase $mode in 673732b578d3Smrg"") $echo \ 673832b578d3Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 673932b578d3Smrg 674032b578d3SmrgProvide generalized library-building support services. 674132b578d3Smrg 674232b578d3Smrg --config show all configuration variables 674332b578d3Smrg --debug enable verbose shell tracing 674432b578d3Smrg-n, --dry-run display commands without modifying any files 674532b578d3Smrg --features display basic configuration information and exit 674632b578d3Smrg --finish same as \`--mode=finish' 674732b578d3Smrg --help display this help message and exit 674832b578d3Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 674932b578d3Smrg --quiet same as \`--silent' 675032b578d3Smrg --silent don't print informational messages 675132b578d3Smrg --tag=TAG use configuration variables from tag TAG 675232b578d3Smrg --version print version information 675332b578d3Smrg 675432b578d3SmrgMODE must be one of the following: 675532b578d3Smrg 675632b578d3Smrg clean remove files from the build directory 675732b578d3Smrg compile compile a source file into a libtool object 675832b578d3Smrg execute automatically set library path, then run a program 675932b578d3Smrg finish complete the installation of libtool libraries 676032b578d3Smrg install install libraries or executables 676132b578d3Smrg link create a library or an executable 676232b578d3Smrg uninstall remove libraries from an installed directory 676332b578d3Smrg 676432b578d3SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 676532b578d3Smrga more detailed description of MODE. 676632b578d3Smrg 676732b578d3SmrgReport bugs to <bug-libtool@gnu.org>." 676832b578d3Smrg exit $EXIT_SUCCESS 676932b578d3Smrg ;; 677032b578d3Smrg 677132b578d3Smrgclean) 677232b578d3Smrg $echo \ 677332b578d3Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 677432b578d3Smrg 677532b578d3SmrgRemove files from the build directory. 677632b578d3Smrg 677732b578d3SmrgRM is the name of the program to use to delete files associated with each FILE 677832b578d3Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 677932b578d3Smrgto RM. 678032b578d3Smrg 678132b578d3SmrgIf FILE is a libtool library, object or program, all the files associated 678232b578d3Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 678332b578d3Smrg ;; 678432b578d3Smrg 678532b578d3Smrgcompile) 678632b578d3Smrg $echo \ 678732b578d3Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 678832b578d3Smrg 678932b578d3SmrgCompile a source file into a libtool library object. 679032b578d3Smrg 679132b578d3SmrgThis mode accepts the following additional options: 679232b578d3Smrg 679332b578d3Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 679432b578d3Smrg -prefer-pic try to building PIC objects only 679532b578d3Smrg -prefer-non-pic try to building non-PIC objects only 679632b578d3Smrg -static always build a \`.o' file suitable for static linking 679732b578d3Smrg 679832b578d3SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 679932b578d3Smrgfrom the given SOURCEFILE. 680032b578d3Smrg 680132b578d3SmrgThe output file name is determined by removing the directory component from 680232b578d3SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 680332b578d3Smrglibrary object suffix, \`.lo'." 680432b578d3Smrg ;; 680532b578d3Smrg 680632b578d3Smrgexecute) 680732b578d3Smrg $echo \ 680832b578d3Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 680932b578d3Smrg 681032b578d3SmrgAutomatically set library path, then run a program. 681132b578d3Smrg 681232b578d3SmrgThis mode accepts the following additional options: 681332b578d3Smrg 681432b578d3Smrg -dlopen FILE add the directory containing FILE to the library path 681532b578d3Smrg 681632b578d3SmrgThis mode sets the library path environment variable according to \`-dlopen' 681732b578d3Smrgflags. 681832b578d3Smrg 681932b578d3SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 682032b578d3Smrginto their corresponding uninstalled binary, and any of their required library 682132b578d3Smrgdirectories are added to the library path. 682232b578d3Smrg 682332b578d3SmrgThen, COMMAND is executed, with ARGS as arguments." 682432b578d3Smrg ;; 682532b578d3Smrg 682632b578d3Smrgfinish) 682732b578d3Smrg $echo \ 682832b578d3Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 682932b578d3Smrg 683032b578d3SmrgComplete the installation of libtool libraries. 683132b578d3Smrg 683232b578d3SmrgEach LIBDIR is a directory that contains libtool libraries. 683332b578d3Smrg 683432b578d3SmrgThe commands that this mode executes may require superuser privileges. Use 683532b578d3Smrgthe \`--dry-run' option if you just want to see what would be executed." 683632b578d3Smrg ;; 683732b578d3Smrg 683832b578d3Smrginstall) 683932b578d3Smrg $echo \ 684032b578d3Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 684132b578d3Smrg 684232b578d3SmrgInstall executables or libraries. 684332b578d3Smrg 684432b578d3SmrgINSTALL-COMMAND is the installation command. The first component should be 684532b578d3Smrgeither the \`install' or \`cp' program. 684632b578d3Smrg 684732b578d3SmrgThe rest of the components are interpreted as arguments to that command (only 684832b578d3SmrgBSD-compatible install options are recognized)." 684932b578d3Smrg ;; 685032b578d3Smrg 685132b578d3Smrglink) 685232b578d3Smrg $echo \ 685332b578d3Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 685432b578d3Smrg 685532b578d3SmrgLink object files or libraries together to form another library, or to 685632b578d3Smrgcreate an executable program. 685732b578d3Smrg 685832b578d3SmrgLINK-COMMAND is a command using the C compiler that you would use to create 685932b578d3Smrga program from several object files. 686032b578d3Smrg 686132b578d3SmrgThe following components of LINK-COMMAND are treated specially: 686232b578d3Smrg 686332b578d3Smrg -all-static do not do any dynamic linking at all 686432b578d3Smrg -avoid-version do not add a version suffix if possible 686532b578d3Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 686632b578d3Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 686732b578d3Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 686832b578d3Smrg -export-symbols SYMFILE 68692a51b5beSmrg try to export only the symbols listed in SYMFILE 687032b578d3Smrg -export-symbols-regex REGEX 68712a51b5beSmrg try to export only the symbols matching REGEX 687232b578d3Smrg -LLIBDIR search LIBDIR for required installed libraries 687332b578d3Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 687432b578d3Smrg -module build a library that can dlopened 687532b578d3Smrg -no-fast-install disable the fast-install mode 687632b578d3Smrg -no-install link a not-installable executable 687732b578d3Smrg -no-undefined declare that a library does not refer to external symbols 687832b578d3Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 687932b578d3Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 688032b578d3Smrg -precious-files-regex REGEX 688132b578d3Smrg don't remove output files matching REGEX 688232b578d3Smrg -release RELEASE specify package release information 688332b578d3Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 688432b578d3Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 68852a51b5beSmrg -static do not do any dynamic linking of uninstalled libtool libraries 68862a51b5beSmrg -static-libtool-libs 68872a51b5beSmrg do not do any dynamic linking of libtool libraries 688832b578d3Smrg -version-info CURRENT[:REVISION[:AGE]] 68892a51b5beSmrg specify library version info [each variable defaults to 0] 689032b578d3Smrg 689132b578d3SmrgAll other options (arguments beginning with \`-') are ignored. 689232b578d3Smrg 689332b578d3SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 689432b578d3Smrgtreated as uninstalled libtool libraries, other files are standard or library 689532b578d3Smrgobject files. 689632b578d3Smrg 689732b578d3SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 689832b578d3Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 689932b578d3Smrgrequired, except when creating a convenience library. 690032b578d3Smrg 690132b578d3SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 690232b578d3Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 690332b578d3Smrg 690432b578d3SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 690532b578d3Smrgis created, otherwise an executable program is created." 690632b578d3Smrg ;; 690732b578d3Smrg 690832b578d3Smrguninstall) 690932b578d3Smrg $echo \ 691032b578d3Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 691132b578d3Smrg 691232b578d3SmrgRemove libraries from an installation directory. 691332b578d3Smrg 691432b578d3SmrgRM is the name of the program to use to delete files associated with each FILE 691532b578d3Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 691632b578d3Smrgto RM. 691732b578d3Smrg 691832b578d3SmrgIf FILE is a libtool library, all the files associated with it are deleted. 691932b578d3SmrgOtherwise, only FILE itself is deleted using RM." 692032b578d3Smrg ;; 692132b578d3Smrg 692232b578d3Smrg*) 692332b578d3Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 692432b578d3Smrg $echo "$help" 1>&2 692532b578d3Smrg exit $EXIT_FAILURE 692632b578d3Smrg ;; 692732b578d3Smrgesac 692832b578d3Smrg 692932b578d3Smrg$echo 693032b578d3Smrg$echo "Try \`$modename --help' for more information about other modes." 693132b578d3Smrg 693232b578d3Smrgexit $? 693332b578d3Smrg 693432b578d3Smrg# The TAGs below are defined such that we never get into a situation 693532b578d3Smrg# in which we disable both kinds of libraries. Given conflicting 693632b578d3Smrg# choices, we go for a static library, that is the most portable, 693732b578d3Smrg# since we can't tell whether shared libraries were disabled because 693832b578d3Smrg# the user asked for that or because the platform doesn't support 693932b578d3Smrg# them. This is particularly important on AIX, because we don't 694032b578d3Smrg# support having both static and shared libraries enabled at the same 694132b578d3Smrg# time on that platform, so we default to a shared-only configuration. 694232b578d3Smrg# If a disable-shared tag is given, we'll fallback to a static-only 694332b578d3Smrg# configuration. But we'll never go from static-only to shared-only. 694432b578d3Smrg 694532b578d3Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 694632b578d3Smrgdisable_libs=shared 694732b578d3Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 694832b578d3Smrg 694932b578d3Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 695032b578d3Smrgdisable_libs=static 695132b578d3Smrg# ### END LIBTOOL TAG CONFIG: disable-static 695232b578d3Smrg 695332b578d3Smrg# Local Variables: 695432b578d3Smrg# mode:shell-script 695532b578d3Smrg# sh-indentation:2 695632b578d3Smrg# End: 6957