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