ltmain.sh revision 95b296d0
195b296d0Smrg# ltmain.sh - Provide generalized library-building support services. 295b296d0Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 395b296d0Smrg# 495b296d0Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 595b296d0Smrg# Free Software Foundation, Inc. 695b296d0Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 795b296d0Smrg# 895b296d0Smrg# This program is free software; you can redistribute it and/or modify 995b296d0Smrg# it under the terms of the GNU General Public License as published by 1095b296d0Smrg# the Free Software Foundation; either version 2 of the License, or 1195b296d0Smrg# (at your option) any later version. 1295b296d0Smrg# 1395b296d0Smrg# This program is distributed in the hope that it will be useful, but 1495b296d0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1595b296d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1695b296d0Smrg# General Public License for more details. 1795b296d0Smrg# 1895b296d0Smrg# You should have received a copy of the GNU General Public License 1995b296d0Smrg# along with this program; if not, write to the Free Software 2095b296d0Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2195b296d0Smrg# 2295b296d0Smrg# As a special exception to the GNU General Public License, if you 2395b296d0Smrg# distribute this file as part of a program that contains a 2495b296d0Smrg# configuration script generated by Autoconf, you may include it under 2595b296d0Smrg# the same distribution terms that you use for the rest of that program. 2695b296d0Smrg 2795b296d0Smrgbasename="s,^.*/,,g" 2895b296d0Smrg 2995b296d0Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 3095b296d0Smrg# is ksh but when the shell is invoked as "sh" and the current value of 3195b296d0Smrg# the _XPG environment variable is not equal to 1 (one), the special 3295b296d0Smrg# positional parameter $0, within a function call, is the name of the 3395b296d0Smrg# function. 3495b296d0Smrgprogpath="$0" 3595b296d0Smrg 3695b296d0Smrg# define SED for historic ltconfig's generated by Libtool 1.3 3795b296d0Smrgtest -z "$SED" && SED=sed 3895b296d0Smrg 3995b296d0Smrg# The name of this program: 4095b296d0Smrgprogname=`echo "$progpath" | $SED $basename` 4195b296d0Smrgmodename="$progname" 4295b296d0Smrg 4395b296d0Smrg# Global variables: 4495b296d0SmrgEXIT_SUCCESS=0 4595b296d0SmrgEXIT_FAILURE=1 4695b296d0Smrg 4795b296d0SmrgPROGRAM=ltmain.sh 4895b296d0SmrgPACKAGE=libtool 4995b296d0SmrgVERSION=1.5.22 5095b296d0SmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 5195b296d0Smrg 5295b296d0Smrg# See if we are running on zsh, and set the options which allow our 5395b296d0Smrg# commands through without removal of \ escapes. 5495b296d0Smrgif test -n "${ZSH_VERSION+set}" ; then 5595b296d0Smrg setopt NO_GLOB_SUBST 5695b296d0Smrgfi 5795b296d0Smrg# Same for EGREP, and just to be sure, do LTCC as well 5895b296d0Smrgif test "X$EGREP" = X ; then 5995b296d0Smrg EGREP=egrep 6095b296d0Smrgfi 6195b296d0Smrgif test "X$LTCC" = X ; then 6295b296d0Smrg LTCC=${CC-gcc} 6395b296d0Smrgfi 6495b296d0Smrg 6595b296d0Smrg# Check that we have a working $echo. 6695b296d0Smrgif test "X$1" = X--no-reexec; then 6795b296d0Smrg # Discard the --no-reexec flag, and continue. 6895b296d0Smrg shift 6995b296d0Smrgelif test "X$1" = X--fallback-echo; then 7095b296d0Smrg # Avoid inline document here, it may be left over 7195b296d0Smrg : 7295b296d0Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 7395b296d0Smrg # Yippee, $echo works! 7495b296d0Smrg : 7595b296d0Smrgelse 7695b296d0Smrg # Restart under the correct shell, and then maybe $echo will work. 7795b296d0Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 7895b296d0Smrgfi 7995b296d0Smrg 8095b296d0Smrgif test "X$1" = X--fallback-echo; then 8195b296d0Smrg # used as fallback echo 8295b296d0Smrg shift 8395b296d0Smrg cat <<EOF 8495b296d0Smrg$* 8595b296d0SmrgEOF 8695b296d0Smrg exit $EXIT_SUCCESS 8795b296d0Smrgfi 8895b296d0Smrg 8995b296d0Smrgdefault_mode= 9095b296d0Smrghelp="Try \`$progname --help' for more information." 9195b296d0Smrgmagic="%%%MAGIC variable%%%" 9295b296d0Smrgmkdir="mkdir" 9395b296d0Smrgmv="mv -f" 9495b296d0Smrgrm="rm -f" 9595b296d0Smrg 9695b296d0Smrg# Sed substitution that helps us do robust quoting. It backslashifies 9795b296d0Smrg# metacharacters that are still active within double-quoted strings. 9895b296d0SmrgXsed="${SED}"' -e 1s/^X//' 9995b296d0Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 10095b296d0Smrg# test EBCDIC or ASCII 10195b296d0Smrgcase `echo X|tr X '\101'` in 10295b296d0Smrg A) # ASCII based system 10395b296d0Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 10495b296d0Smrg SP2NL='tr \040 \012' 10595b296d0Smrg NL2SP='tr \015\012 \040\040' 10695b296d0Smrg ;; 10795b296d0Smrg *) # EBCDIC based system 10895b296d0Smrg SP2NL='tr \100 \n' 10995b296d0Smrg NL2SP='tr \r\n \100\100' 11095b296d0Smrg ;; 11195b296d0Smrgesac 11295b296d0Smrg 11395b296d0Smrg# NLS nuisances. 11495b296d0Smrg# Only set LANG and LC_ALL to C if already set. 11595b296d0Smrg# These must not be set unconditionally because not all systems understand 11695b296d0Smrg# e.g. LANG=C (notably SCO). 11795b296d0Smrg# We save the old values to restore during execute mode. 11895b296d0Smrgif test "${LC_ALL+set}" = set; then 11995b296d0Smrg save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 12095b296d0Smrgfi 12195b296d0Smrgif test "${LANG+set}" = set; then 12295b296d0Smrg save_LANG="$LANG"; LANG=C; export LANG 12395b296d0Smrgfi 12495b296d0Smrg 12595b296d0Smrg# Make sure IFS has a sensible default 12695b296d0Smrglt_nl=' 12795b296d0Smrg' 12895b296d0SmrgIFS=" $lt_nl" 12995b296d0Smrg 13095b296d0Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 13195b296d0Smrg $echo "$modename: not configured to build any kind of library" 1>&2 13295b296d0Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 13395b296d0Smrg exit $EXIT_FAILURE 13495b296d0Smrgfi 13595b296d0Smrg 13695b296d0Smrg# Global variables. 13795b296d0Smrgmode=$default_mode 13895b296d0Smrgnonopt= 13995b296d0Smrgprev= 14095b296d0Smrgprevopt= 14195b296d0Smrgrun= 14295b296d0Smrgshow="$echo" 14395b296d0Smrgshow_help= 14495b296d0Smrgexecute_dlfiles= 14595b296d0Smrgduplicate_deps=no 14695b296d0Smrgpreserve_args= 14795b296d0Smrglo2o="s/\\.lo\$/.${objext}/" 14895b296d0Smrgo2lo="s/\\.${objext}\$/.lo/" 14995b296d0Smrg 15095b296d0Smrgif test -z "$max_cmd_len"; then 15195b296d0Smrg i=0 15295b296d0Smrg testring="ABCD" 15395b296d0Smrg new_result= 15495b296d0Smrg 15595b296d0Smrg # If test is not a shell built-in, we'll probably end up computing a 15695b296d0Smrg # maximum length that is only half of the actual maximum length, but 15795b296d0Smrg # we can't tell. 15895b296d0Smrg while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ 15995b296d0Smrg = "XX$testring") >/dev/null 2>&1 && 16095b296d0Smrg new_result=`expr "X$testring" : ".*" 2>&1` && 16195b296d0Smrg max_cmd_len="$new_result" && 16295b296d0Smrg test "$i" != 17 # 1/2 MB should be enough 16395b296d0Smrg do 16495b296d0Smrg i=`expr $i + 1` 16595b296d0Smrg testring="$testring$testring" 16695b296d0Smrg done 16795b296d0Smrg testring= 16895b296d0Smrg # Add a significant safety factor because C++ compilers can tack on massive 16995b296d0Smrg # amounts of additional arguments before passing them to the linker. 17095b296d0Smrg # It appears as though 1/2 is a usable value. 17195b296d0Smrg max_cmd_len=`expr $max_cmd_len \/ 2` 17295b296d0Smrgfi 17395b296d0Smrg 17495b296d0Smrg##################################### 17595b296d0Smrg# Shell function definitions: 17695b296d0Smrg# This seems to be the best place for them 17795b296d0Smrg 17895b296d0Smrg# func_mktempdir [string] 17995b296d0Smrg# Make a temporary directory that won't clash with other running 18095b296d0Smrg# libtool processes, and avoids race conditions if possible. If 18195b296d0Smrg# given, STRING is the basename for that directory. 18295b296d0Smrgfunc_mktempdir () 18395b296d0Smrg{ 18495b296d0Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 18595b296d0Smrg 18695b296d0Smrg if test "$run" = ":"; then 18795b296d0Smrg # Return a directory name, but don't create it in dry-run mode 18895b296d0Smrg my_tmpdir="${my_template}-$$" 18995b296d0Smrg else 19095b296d0Smrg 19195b296d0Smrg # If mktemp works, use that first and foremost 19295b296d0Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 19395b296d0Smrg 19495b296d0Smrg if test ! -d "$my_tmpdir"; then 19595b296d0Smrg # Failing that, at least try and use $RANDOM to avoid a race 19695b296d0Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 19795b296d0Smrg 19895b296d0Smrg save_mktempdir_umask=`umask` 19995b296d0Smrg umask 0077 20095b296d0Smrg $mkdir "$my_tmpdir" 20195b296d0Smrg umask $save_mktempdir_umask 20295b296d0Smrg fi 20395b296d0Smrg 20495b296d0Smrg # If we're not in dry-run mode, bomb out on failure 20595b296d0Smrg test -d "$my_tmpdir" || { 20695b296d0Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 20795b296d0Smrg exit $EXIT_FAILURE 20895b296d0Smrg } 20995b296d0Smrg fi 21095b296d0Smrg 21195b296d0Smrg $echo "X$my_tmpdir" | $Xsed 21295b296d0Smrg} 21395b296d0Smrg 21495b296d0Smrg 21595b296d0Smrg# func_win32_libid arg 21695b296d0Smrg# return the library type of file 'arg' 21795b296d0Smrg# 21895b296d0Smrg# Need a lot of goo to handle *both* DLLs and import libs 21995b296d0Smrg# Has to be a shell function in order to 'eat' the argument 22095b296d0Smrg# that is supplied when $file_magic_command is called. 22195b296d0Smrgfunc_win32_libid () 22295b296d0Smrg{ 22395b296d0Smrg win32_libid_type="unknown" 22495b296d0Smrg win32_fileres=`file -L $1 2>/dev/null` 22595b296d0Smrg case $win32_fileres in 22695b296d0Smrg *ar\ archive\ import\ library*) # definitely import 22795b296d0Smrg win32_libid_type="x86 archive import" 22895b296d0Smrg ;; 22995b296d0Smrg *ar\ archive*) # could be an import, or static 23095b296d0Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 23195b296d0Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 23295b296d0Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 23395b296d0Smrg $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 23495b296d0Smrg case $win32_nmres in 23595b296d0Smrg import*) win32_libid_type="x86 archive import";; 23695b296d0Smrg *) win32_libid_type="x86 archive static";; 23795b296d0Smrg esac 23895b296d0Smrg fi 23995b296d0Smrg ;; 24095b296d0Smrg *DLL*) 24195b296d0Smrg win32_libid_type="x86 DLL" 24295b296d0Smrg ;; 24395b296d0Smrg *executable*) # but shell scripts are "executable" too... 24495b296d0Smrg case $win32_fileres in 24595b296d0Smrg *MS\ Windows\ PE\ Intel*) 24695b296d0Smrg win32_libid_type="x86 DLL" 24795b296d0Smrg ;; 24895b296d0Smrg esac 24995b296d0Smrg ;; 25095b296d0Smrg esac 25195b296d0Smrg $echo $win32_libid_type 25295b296d0Smrg} 25395b296d0Smrg 25495b296d0Smrg 25595b296d0Smrg# func_infer_tag arg 25695b296d0Smrg# Infer tagged configuration to use if any are available and 25795b296d0Smrg# if one wasn't chosen via the "--tag" command line option. 25895b296d0Smrg# Only attempt this if the compiler in the base compile 25995b296d0Smrg# command doesn't match the default compiler. 26095b296d0Smrg# arg is usually of the form 'gcc ...' 26195b296d0Smrgfunc_infer_tag () 26295b296d0Smrg{ 26395b296d0Smrg if test -n "$available_tags" && test -z "$tagname"; then 26495b296d0Smrg CC_quoted= 26595b296d0Smrg for arg in $CC; do 26695b296d0Smrg case $arg in 26795b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 26895b296d0Smrg arg="\"$arg\"" 26995b296d0Smrg ;; 27095b296d0Smrg esac 27195b296d0Smrg CC_quoted="$CC_quoted $arg" 27295b296d0Smrg done 27395b296d0Smrg case $@ in 27495b296d0Smrg # Blanks in the command may have been stripped by the calling shell, 27595b296d0Smrg # but not from the CC environment variable when configure was run. 27695b296d0Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 27795b296d0Smrg # Blanks at the start of $base_compile will cause this to fail 27895b296d0Smrg # if we don't check for them as well. 27995b296d0Smrg *) 28095b296d0Smrg for z in $available_tags; do 28195b296d0Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 28295b296d0Smrg # Evaluate the configuration. 28395b296d0Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 28495b296d0Smrg CC_quoted= 28595b296d0Smrg for arg in $CC; do 28695b296d0Smrg # Double-quote args containing other shell metacharacters. 28795b296d0Smrg case $arg in 28895b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 28995b296d0Smrg arg="\"$arg\"" 29095b296d0Smrg ;; 29195b296d0Smrg esac 29295b296d0Smrg CC_quoted="$CC_quoted $arg" 29395b296d0Smrg done 29495b296d0Smrg # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc' 29595b296d0Smrg trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"` 29695b296d0Smrg # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc 29795b296d0Smrg extendcc=${host}-${CC} 29895b296d0Smrg # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc 29995b296d0Smrg # (Gentoo-specific hack because we always export $CHOST) 30095b296d0Smrg mungedcc=${CHOST-${host}}-${trimedcc} 30195b296d0Smrg case "$@ " in 30295b296d0Smrg "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\ 30395b296d0Smrg "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*) 30495b296d0Smrg tagname=CC 30595b296d0Smrg break ;; 30695b296d0Smrg "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\ 30795b296d0Smrg "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\ 30895b296d0Smrg "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\ 30995b296d0Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 31095b296d0Smrg # The compiler in the base compile command matches 31195b296d0Smrg # the one in the tagged configuration. 31295b296d0Smrg # Assume this is the tagged configuration we want. 31395b296d0Smrg tagname=$z 31495b296d0Smrg break 31595b296d0Smrg ;; 31695b296d0Smrg esac 31795b296d0Smrg fi 31895b296d0Smrg done 31995b296d0Smrg # If $tagname still isn't set, then no tagged configuration 32095b296d0Smrg # was found and let the user know that the "--tag" command 32195b296d0Smrg # line option must be used. 32295b296d0Smrg if test -z "$tagname"; then 32395b296d0Smrg $echo "$modename: unable to infer tagged configuration" 32495b296d0Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 32595b296d0Smrg exit $EXIT_FAILURE 32695b296d0Smrg# else 32795b296d0Smrg# $echo "$modename: using $tagname tagged configuration" 32895b296d0Smrg fi 32995b296d0Smrg ;; 33095b296d0Smrg esac 33195b296d0Smrg fi 33295b296d0Smrg} 33395b296d0Smrg 33495b296d0Smrg 33595b296d0Smrg# func_extract_an_archive dir oldlib 33695b296d0Smrgfunc_extract_an_archive () 33795b296d0Smrg{ 33895b296d0Smrg f_ex_an_ar_dir="$1"; shift 33995b296d0Smrg f_ex_an_ar_oldlib="$1" 34095b296d0Smrg 34195b296d0Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 34295b296d0Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 34395b296d0Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 34495b296d0Smrg : 34595b296d0Smrg else 34695b296d0Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 34795b296d0Smrg exit $EXIT_FAILURE 34895b296d0Smrg fi 34995b296d0Smrg} 35095b296d0Smrg 35195b296d0Smrg# func_extract_archives gentop oldlib ... 35295b296d0Smrgfunc_extract_archives () 35395b296d0Smrg{ 35495b296d0Smrg my_gentop="$1"; shift 35595b296d0Smrg my_oldlibs=${1+"$@"} 35695b296d0Smrg my_oldobjs="" 35795b296d0Smrg my_xlib="" 35895b296d0Smrg my_xabs="" 35995b296d0Smrg my_xdir="" 36095b296d0Smrg my_status="" 36195b296d0Smrg 36295b296d0Smrg $show "${rm}r $my_gentop" 36395b296d0Smrg $run ${rm}r "$my_gentop" 36495b296d0Smrg $show "$mkdir $my_gentop" 36595b296d0Smrg $run $mkdir "$my_gentop" 36695b296d0Smrg my_status=$? 36795b296d0Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 36895b296d0Smrg exit $my_status 36995b296d0Smrg fi 37095b296d0Smrg 37195b296d0Smrg for my_xlib in $my_oldlibs; do 37295b296d0Smrg # Extract the objects. 37395b296d0Smrg case $my_xlib in 37495b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 37595b296d0Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 37695b296d0Smrg esac 37795b296d0Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 37895b296d0Smrg my_xdir="$my_gentop/$my_xlib" 37995b296d0Smrg 38095b296d0Smrg $show "${rm}r $my_xdir" 38195b296d0Smrg $run ${rm}r "$my_xdir" 38295b296d0Smrg $show "$mkdir $my_xdir" 38395b296d0Smrg $run $mkdir "$my_xdir" 38495b296d0Smrg exit_status=$? 38595b296d0Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 38695b296d0Smrg exit $exit_status 38795b296d0Smrg fi 38895b296d0Smrg case $host in 38995b296d0Smrg *-darwin*) 39095b296d0Smrg $show "Extracting $my_xabs" 39195b296d0Smrg # Do not bother doing anything if just a dry run 39295b296d0Smrg if test -z "$run"; then 39395b296d0Smrg darwin_orig_dir=`pwd` 39495b296d0Smrg cd $my_xdir || exit $? 39595b296d0Smrg darwin_archive=$my_xabs 39695b296d0Smrg darwin_curdir=`pwd` 39795b296d0Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 39895b296d0Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 39995b296d0Smrg if test -n "$darwin_arches"; then 40095b296d0Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 40195b296d0Smrg darwin_arch= 40295b296d0Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 40395b296d0Smrg for darwin_arch in $darwin_arches ; do 40495b296d0Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 40595b296d0Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 40695b296d0Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 40795b296d0Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 40895b296d0Smrg cd "$darwin_curdir" 40995b296d0Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 41095b296d0Smrg done # $darwin_arches 41195b296d0Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 41295b296d0Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 41395b296d0Smrg darwin_file= 41495b296d0Smrg darwin_files= 41595b296d0Smrg for darwin_file in $darwin_filelist; do 41695b296d0Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 41795b296d0Smrg lipo -create -output "$darwin_file" $darwin_files 41895b296d0Smrg done # $darwin_filelist 41995b296d0Smrg ${rm}r unfat-$$ 42095b296d0Smrg cd "$darwin_orig_dir" 42195b296d0Smrg else 42295b296d0Smrg cd "$darwin_orig_dir" 42395b296d0Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 42495b296d0Smrg fi # $darwin_arches 42595b296d0Smrg fi # $run 42695b296d0Smrg ;; 42795b296d0Smrg *) 42895b296d0Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 42995b296d0Smrg ;; 43095b296d0Smrg esac 43195b296d0Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 43295b296d0Smrg done 43395b296d0Smrg func_extract_archives_result="$my_oldobjs" 43495b296d0Smrg} 43595b296d0Smrg# End of Shell function definitions 43695b296d0Smrg##################################### 43795b296d0Smrg 43895b296d0Smrg# Darwin sucks 43995b296d0Smrgeval std_shrext=\"$shrext_cmds\" 44095b296d0Smrg 44195b296d0Smrgdisable_libs=no 44295b296d0Smrg 44395b296d0Smrg# Parse our command line options once, thoroughly. 44495b296d0Smrgwhile test "$#" -gt 0 44595b296d0Smrgdo 44695b296d0Smrg arg="$1" 44795b296d0Smrg shift 44895b296d0Smrg 44995b296d0Smrg case $arg in 45095b296d0Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 45195b296d0Smrg *) optarg= ;; 45295b296d0Smrg esac 45395b296d0Smrg 45495b296d0Smrg # If the previous option needs an argument, assign it. 45595b296d0Smrg if test -n "$prev"; then 45695b296d0Smrg case $prev in 45795b296d0Smrg execute_dlfiles) 45895b296d0Smrg execute_dlfiles="$execute_dlfiles $arg" 45995b296d0Smrg ;; 46095b296d0Smrg tag) 46195b296d0Smrg tagname="$arg" 46295b296d0Smrg preserve_args="${preserve_args}=$arg" 46395b296d0Smrg 46495b296d0Smrg # Check whether tagname contains only valid characters 46595b296d0Smrg case $tagname in 46695b296d0Smrg *[!-_A-Za-z0-9,/]*) 46795b296d0Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 46895b296d0Smrg exit $EXIT_FAILURE 46995b296d0Smrg ;; 47095b296d0Smrg esac 47195b296d0Smrg 47295b296d0Smrg case $tagname in 47395b296d0Smrg CC) 47495b296d0Smrg # Don't test for the "default" C tag, as we know, it's there, but 47595b296d0Smrg # not specially marked. 47695b296d0Smrg ;; 47795b296d0Smrg *) 47895b296d0Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 47995b296d0Smrg taglist="$taglist $tagname" 48095b296d0Smrg # Evaluate the configuration. 48195b296d0Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 48295b296d0Smrg else 48395b296d0Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 48495b296d0Smrg fi 48595b296d0Smrg ;; 48695b296d0Smrg esac 48795b296d0Smrg ;; 48895b296d0Smrg *) 48995b296d0Smrg eval "$prev=\$arg" 49095b296d0Smrg ;; 49195b296d0Smrg esac 49295b296d0Smrg 49395b296d0Smrg prev= 49495b296d0Smrg prevopt= 49595b296d0Smrg continue 49695b296d0Smrg fi 49795b296d0Smrg 49895b296d0Smrg # Have we seen a non-optional argument yet? 49995b296d0Smrg case $arg in 50095b296d0Smrg --help) 50195b296d0Smrg show_help=yes 50295b296d0Smrg ;; 50395b296d0Smrg 50495b296d0Smrg --version) 50595b296d0Smrg $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 50695b296d0Smrg $echo 50795b296d0Smrg $echo "Copyright (C) 2005 Free Software Foundation, Inc." 50895b296d0Smrg $echo "This is free software; see the source for copying conditions. There is NO" 50995b296d0Smrg $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 51095b296d0Smrg exit $? 51195b296d0Smrg ;; 51295b296d0Smrg 51395b296d0Smrg --config) 51495b296d0Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 51595b296d0Smrg # Now print the configurations for the tags. 51695b296d0Smrg for tagname in $taglist; do 51795b296d0Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 51895b296d0Smrg done 51995b296d0Smrg exit $? 52095b296d0Smrg ;; 52195b296d0Smrg 52295b296d0Smrg --debug) 52395b296d0Smrg $echo "$progname: enabling shell trace mode" 52495b296d0Smrg set -x 52595b296d0Smrg preserve_args="$preserve_args $arg" 52695b296d0Smrg ;; 52795b296d0Smrg 52895b296d0Smrg --dry-run | -n) 52995b296d0Smrg run=: 53095b296d0Smrg ;; 53195b296d0Smrg 53295b296d0Smrg --features) 53395b296d0Smrg $echo "host: $host" 53495b296d0Smrg if test "$build_libtool_libs" = yes; then 53595b296d0Smrg $echo "enable shared libraries" 53695b296d0Smrg else 53795b296d0Smrg $echo "disable shared libraries" 53895b296d0Smrg fi 53995b296d0Smrg if test "$build_old_libs" = yes; then 54095b296d0Smrg $echo "enable static libraries" 54195b296d0Smrg else 54295b296d0Smrg $echo "disable static libraries" 54395b296d0Smrg fi 54495b296d0Smrg exit $? 54595b296d0Smrg ;; 54695b296d0Smrg 54795b296d0Smrg --finish) mode="finish" ;; 54895b296d0Smrg 54995b296d0Smrg --mode) prevopt="--mode" prev=mode ;; 55095b296d0Smrg --mode=*) mode="$optarg" ;; 55195b296d0Smrg 55295b296d0Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 55395b296d0Smrg 55495b296d0Smrg --quiet | --silent) 55595b296d0Smrg show=: 55695b296d0Smrg preserve_args="$preserve_args $arg" 55795b296d0Smrg ;; 55895b296d0Smrg 55995b296d0Smrg --tag) 56095b296d0Smrg prevopt="--tag" 56195b296d0Smrg prev=tag 56295b296d0Smrg preserve_args="$preserve_args --tag" 56395b296d0Smrg ;; 56495b296d0Smrg --tag=*) 56595b296d0Smrg set tag "$optarg" ${1+"$@"} 56695b296d0Smrg shift 56795b296d0Smrg prev=tag 56895b296d0Smrg preserve_args="$preserve_args --tag" 56995b296d0Smrg ;; 57095b296d0Smrg 57195b296d0Smrg -dlopen) 57295b296d0Smrg prevopt="-dlopen" 57395b296d0Smrg prev=execute_dlfiles 57495b296d0Smrg ;; 57595b296d0Smrg 57695b296d0Smrg -*) 57795b296d0Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 57895b296d0Smrg $echo "$help" 1>&2 57995b296d0Smrg exit $EXIT_FAILURE 58095b296d0Smrg ;; 58195b296d0Smrg 58295b296d0Smrg *) 58395b296d0Smrg nonopt="$arg" 58495b296d0Smrg break 58595b296d0Smrg ;; 58695b296d0Smrg esac 58795b296d0Smrgdone 58895b296d0Smrg 58995b296d0Smrgif test -n "$prevopt"; then 59095b296d0Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 59195b296d0Smrg $echo "$help" 1>&2 59295b296d0Smrg exit $EXIT_FAILURE 59395b296d0Smrgfi 59495b296d0Smrg 59595b296d0Smrgcase $disable_libs in 59695b296d0Smrgno) 59795b296d0Smrg ;; 59895b296d0Smrgshared) 59995b296d0Smrg build_libtool_libs=no 60095b296d0Smrg build_old_libs=yes 60195b296d0Smrg ;; 60295b296d0Smrgstatic) 60395b296d0Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 60495b296d0Smrg ;; 60595b296d0Smrgesac 60695b296d0Smrg 60795b296d0Smrg# If this variable is set in any of the actions, the command in it 60895b296d0Smrg# will be execed at the end. This prevents here-documents from being 60995b296d0Smrg# left over by shells. 61095b296d0Smrgexec_cmd= 61195b296d0Smrg 61295b296d0Smrgif test -z "$show_help"; then 61395b296d0Smrg 61495b296d0Smrg # Infer the operation mode. 61595b296d0Smrg if test -z "$mode"; then 61695b296d0Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 61795b296d0Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 61895b296d0Smrg case $nonopt in 61995b296d0Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 62095b296d0Smrg mode=link 62195b296d0Smrg for arg 62295b296d0Smrg do 62395b296d0Smrg case $arg in 62495b296d0Smrg -c) 62595b296d0Smrg mode=compile 62695b296d0Smrg break 62795b296d0Smrg ;; 62895b296d0Smrg esac 62995b296d0Smrg done 63095b296d0Smrg ;; 63195b296d0Smrg *db | *dbx | *strace | *truss) 63295b296d0Smrg mode=execute 63395b296d0Smrg ;; 63495b296d0Smrg *install*|cp|mv) 63595b296d0Smrg mode=install 63695b296d0Smrg ;; 63795b296d0Smrg *rm) 63895b296d0Smrg mode=uninstall 63995b296d0Smrg ;; 64095b296d0Smrg *) 64195b296d0Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 64295b296d0Smrg test -n "$execute_dlfiles" && mode=execute 64395b296d0Smrg 64495b296d0Smrg # Just use the default operation mode. 64595b296d0Smrg if test -z "$mode"; then 64695b296d0Smrg if test -n "$nonopt"; then 64795b296d0Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 64895b296d0Smrg else 64995b296d0Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 65095b296d0Smrg fi 65195b296d0Smrg fi 65295b296d0Smrg ;; 65395b296d0Smrg esac 65495b296d0Smrg fi 65595b296d0Smrg 65695b296d0Smrg # Only execute mode is allowed to have -dlopen flags. 65795b296d0Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 65895b296d0Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 65995b296d0Smrg $echo "$help" 1>&2 66095b296d0Smrg exit $EXIT_FAILURE 66195b296d0Smrg fi 66295b296d0Smrg 66395b296d0Smrg # Change the help message to a mode-specific one. 66495b296d0Smrg generic_help="$help" 66595b296d0Smrg help="Try \`$modename --help --mode=$mode' for more information." 66695b296d0Smrg 66795b296d0Smrg # These modes are in order of execution frequency so that they run quickly. 66895b296d0Smrg case $mode in 66995b296d0Smrg # libtool compile mode 67095b296d0Smrg compile) 67195b296d0Smrg modename="$modename: compile" 67295b296d0Smrg # Get the compilation command and the source file. 67395b296d0Smrg base_compile= 67495b296d0Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 67595b296d0Smrg suppress_opt=yes 67695b296d0Smrg suppress_output= 67795b296d0Smrg arg_mode=normal 67895b296d0Smrg libobj= 67995b296d0Smrg later= 68095b296d0Smrg 68195b296d0Smrg for arg 68295b296d0Smrg do 68395b296d0Smrg case $arg_mode in 68495b296d0Smrg arg ) 68595b296d0Smrg # do not "continue". Instead, add this to base_compile 68695b296d0Smrg lastarg="$arg" 68795b296d0Smrg arg_mode=normal 68895b296d0Smrg ;; 68995b296d0Smrg 69095b296d0Smrg target ) 69195b296d0Smrg libobj="$arg" 69295b296d0Smrg arg_mode=normal 69395b296d0Smrg continue 69495b296d0Smrg ;; 69595b296d0Smrg 69695b296d0Smrg normal ) 69795b296d0Smrg # Accept any command-line options. 69895b296d0Smrg case $arg in 69995b296d0Smrg -o) 70095b296d0Smrg if test -n "$libobj" ; then 70195b296d0Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 70295b296d0Smrg exit $EXIT_FAILURE 70395b296d0Smrg fi 70495b296d0Smrg arg_mode=target 70595b296d0Smrg continue 70695b296d0Smrg ;; 70795b296d0Smrg 70895b296d0Smrg -static | -prefer-pic | -prefer-non-pic) 70995b296d0Smrg later="$later $arg" 71095b296d0Smrg continue 71195b296d0Smrg ;; 71295b296d0Smrg 71395b296d0Smrg -no-suppress) 71495b296d0Smrg suppress_opt=no 71595b296d0Smrg continue 71695b296d0Smrg ;; 71795b296d0Smrg 71895b296d0Smrg -Xcompiler) 71995b296d0Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 72095b296d0Smrg continue # The current "srcfile" will either be retained or 72195b296d0Smrg ;; # replaced later. I would guess that would be a bug. 72295b296d0Smrg 72395b296d0Smrg -Wc,*) 72495b296d0Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 72595b296d0Smrg lastarg= 72695b296d0Smrg save_ifs="$IFS"; IFS=',' 72795b296d0Smrg for arg in $args; do 72895b296d0Smrg IFS="$save_ifs" 72995b296d0Smrg 73095b296d0Smrg # Double-quote args containing other shell metacharacters. 73195b296d0Smrg # Many Bourne shells cannot handle close brackets correctly 73295b296d0Smrg # in scan sets, so we specify it separately. 73395b296d0Smrg case $arg in 73495b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 73595b296d0Smrg arg="\"$arg\"" 73695b296d0Smrg ;; 73795b296d0Smrg esac 73895b296d0Smrg lastarg="$lastarg $arg" 73995b296d0Smrg done 74095b296d0Smrg IFS="$save_ifs" 74195b296d0Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 74295b296d0Smrg 74395b296d0Smrg # Add the arguments to base_compile. 74495b296d0Smrg base_compile="$base_compile $lastarg" 74595b296d0Smrg continue 74695b296d0Smrg ;; 74795b296d0Smrg 74895b296d0Smrg * ) 74995b296d0Smrg # Accept the current argument as the source file. 75095b296d0Smrg # The previous "srcfile" becomes the current argument. 75195b296d0Smrg # 75295b296d0Smrg lastarg="$srcfile" 75395b296d0Smrg srcfile="$arg" 75495b296d0Smrg ;; 75595b296d0Smrg esac # case $arg 75695b296d0Smrg ;; 75795b296d0Smrg esac # case $arg_mode 75895b296d0Smrg 75995b296d0Smrg # Aesthetically quote the previous argument. 76095b296d0Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 76195b296d0Smrg 76295b296d0Smrg case $lastarg in 76395b296d0Smrg # Double-quote args containing other shell metacharacters. 76495b296d0Smrg # Many Bourne shells cannot handle close brackets correctly 76595b296d0Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 76695b296d0Smrg # in scan sets (worked around with variable expansion), 76795b296d0Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 76895b296d0Smrg # at all, so we specify them separately. 76995b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 77095b296d0Smrg lastarg="\"$lastarg\"" 77195b296d0Smrg ;; 77295b296d0Smrg esac 77395b296d0Smrg 77495b296d0Smrg base_compile="$base_compile $lastarg" 77595b296d0Smrg done # for arg 77695b296d0Smrg 77795b296d0Smrg case $arg_mode in 77895b296d0Smrg arg) 77995b296d0Smrg $echo "$modename: you must specify an argument for -Xcompile" 78095b296d0Smrg exit $EXIT_FAILURE 78195b296d0Smrg ;; 78295b296d0Smrg target) 78395b296d0Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 78495b296d0Smrg exit $EXIT_FAILURE 78595b296d0Smrg ;; 78695b296d0Smrg *) 78795b296d0Smrg # Get the name of the library object. 78895b296d0Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 78995b296d0Smrg ;; 79095b296d0Smrg esac 79195b296d0Smrg 79295b296d0Smrg # Recognize several different file suffixes. 79395b296d0Smrg # If the user specifies -o file.o, it is replaced with file.lo 79495b296d0Smrg xform='[cCFSifmso]' 79595b296d0Smrg case $libobj in 79695b296d0Smrg *.ada) xform=ada ;; 79795b296d0Smrg *.adb) xform=adb ;; 79895b296d0Smrg *.ads) xform=ads ;; 79995b296d0Smrg *.asm) xform=asm ;; 80095b296d0Smrg *.c++) xform=c++ ;; 80195b296d0Smrg *.cc) xform=cc ;; 80295b296d0Smrg *.ii) xform=ii ;; 80395b296d0Smrg *.class) xform=class ;; 80495b296d0Smrg *.cpp) xform=cpp ;; 80595b296d0Smrg *.cxx) xform=cxx ;; 80695b296d0Smrg *.f90) xform=f90 ;; 80795b296d0Smrg *.for) xform=for ;; 80895b296d0Smrg *.java) xform=java ;; 80995b296d0Smrg esac 81095b296d0Smrg 81195b296d0Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 81295b296d0Smrg 81395b296d0Smrg case $libobj in 81495b296d0Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 81595b296d0Smrg *) 81695b296d0Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 81795b296d0Smrg exit $EXIT_FAILURE 81895b296d0Smrg ;; 81995b296d0Smrg esac 82095b296d0Smrg 82195b296d0Smrg func_infer_tag $base_compile 82295b296d0Smrg 82395b296d0Smrg for arg in $later; do 82495b296d0Smrg case $arg in 82595b296d0Smrg -static) 82695b296d0Smrg build_old_libs=yes 82795b296d0Smrg continue 82895b296d0Smrg ;; 82995b296d0Smrg 83095b296d0Smrg -prefer-pic) 83195b296d0Smrg pic_mode=yes 83295b296d0Smrg continue 83395b296d0Smrg ;; 83495b296d0Smrg 83595b296d0Smrg -prefer-non-pic) 83695b296d0Smrg pic_mode=no 83795b296d0Smrg continue 83895b296d0Smrg ;; 83995b296d0Smrg esac 84095b296d0Smrg done 84195b296d0Smrg 84295b296d0Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 84395b296d0Smrg case $qlibobj in 84495b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 84595b296d0Smrg qlibobj="\"$qlibobj\"" ;; 84695b296d0Smrg esac 84795b296d0Smrg test "X$libobj" != "X$qlibobj" \ 84895b296d0Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 84995b296d0Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 85095b296d0Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 85195b296d0Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 85295b296d0Smrg if test "X$xdir" = "X$obj"; then 85395b296d0Smrg xdir= 85495b296d0Smrg else 85595b296d0Smrg xdir=$xdir/ 85695b296d0Smrg fi 85795b296d0Smrg lobj=${xdir}$objdir/$objname 85895b296d0Smrg 85995b296d0Smrg if test -z "$base_compile"; then 86095b296d0Smrg $echo "$modename: you must specify a compilation command" 1>&2 86195b296d0Smrg $echo "$help" 1>&2 86295b296d0Smrg exit $EXIT_FAILURE 86395b296d0Smrg fi 86495b296d0Smrg 86595b296d0Smrg # Delete any leftover library objects. 86695b296d0Smrg if test "$build_old_libs" = yes; then 86795b296d0Smrg removelist="$obj $lobj $libobj ${libobj}T" 86895b296d0Smrg else 86995b296d0Smrg removelist="$lobj $libobj ${libobj}T" 87095b296d0Smrg fi 87195b296d0Smrg 87295b296d0Smrg $run $rm $removelist 87395b296d0Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 87495b296d0Smrg 87595b296d0Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 87695b296d0Smrg case $host_os in 87795b296d0Smrg cygwin* | mingw* | pw32* | os2*) 87895b296d0Smrg pic_mode=default 87995b296d0Smrg ;; 88095b296d0Smrg esac 88195b296d0Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 88295b296d0Smrg # non-PIC code in shared libraries is not supported 88395b296d0Smrg pic_mode=default 88495b296d0Smrg fi 88595b296d0Smrg 88695b296d0Smrg # Calculate the filename of the output object if compiler does 88795b296d0Smrg # not support -o with -c 88895b296d0Smrg if test "$compiler_c_o" = no; then 88995b296d0Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 89095b296d0Smrg lockfile="$output_obj.lock" 89195b296d0Smrg removelist="$removelist $output_obj $lockfile" 89295b296d0Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 89395b296d0Smrg else 89495b296d0Smrg output_obj= 89595b296d0Smrg need_locks=no 89695b296d0Smrg lockfile= 89795b296d0Smrg fi 89895b296d0Smrg 89995b296d0Smrg # Lock this critical section if it is needed 90095b296d0Smrg # We use this script file to make the link, it avoids creating a new file 90195b296d0Smrg if test "$need_locks" = yes; then 90295b296d0Smrg until $run ln "$srcfile" "$lockfile" 2>/dev/null; do 90395b296d0Smrg $show "Waiting for $lockfile to be removed" 90495b296d0Smrg sleep 2 90595b296d0Smrg done 90695b296d0Smrg elif test "$need_locks" = warn; then 90795b296d0Smrg if test -f "$lockfile"; then 90895b296d0Smrg $echo "\ 90995b296d0Smrg*** ERROR, $lockfile exists and contains: 91095b296d0Smrg`cat $lockfile 2>/dev/null` 91195b296d0Smrg 91295b296d0SmrgThis indicates that another process is trying to use the same 91395b296d0Smrgtemporary object file, and libtool could not work around it because 91495b296d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 91595b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 91695b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better 91795b296d0Smrgcompiler." 91895b296d0Smrg 91995b296d0Smrg $run $rm $removelist 92095b296d0Smrg exit $EXIT_FAILURE 92195b296d0Smrg fi 92295b296d0Smrg $echo "$srcfile" > "$lockfile" 92395b296d0Smrg fi 92495b296d0Smrg 92595b296d0Smrg if test -n "$fix_srcfile_path"; then 92695b296d0Smrg eval srcfile=\"$fix_srcfile_path\" 92795b296d0Smrg fi 92895b296d0Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 92995b296d0Smrg case $qsrcfile in 93095b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 93195b296d0Smrg qsrcfile="\"$qsrcfile\"" ;; 93295b296d0Smrg esac 93395b296d0Smrg 93495b296d0Smrg $run $rm "$libobj" "${libobj}T" 93595b296d0Smrg 93695b296d0Smrg # Create a libtool object file (analogous to a ".la" file), 93795b296d0Smrg # but don't create it if we're doing a dry run. 93895b296d0Smrg test -z "$run" && cat > ${libobj}T <<EOF 93995b296d0Smrg# $libobj - a libtool object file 94095b296d0Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 94195b296d0Smrg# 94295b296d0Smrg# Please DO NOT delete this file! 94395b296d0Smrg# It is necessary for linking the library. 94495b296d0Smrg 94595b296d0Smrg# Name of the PIC object. 94695b296d0SmrgEOF 94795b296d0Smrg 94895b296d0Smrg # Only build a PIC object if we are building libtool libraries. 94995b296d0Smrg if test "$build_libtool_libs" = yes; then 95095b296d0Smrg # Without this assignment, base_compile gets emptied. 95195b296d0Smrg fbsd_hideous_sh_bug=$base_compile 95295b296d0Smrg 95395b296d0Smrg if test "$pic_mode" != no; then 95495b296d0Smrg command="$base_compile $qsrcfile $pic_flag" 95595b296d0Smrg else 95695b296d0Smrg # Don't build PIC code 95795b296d0Smrg command="$base_compile $qsrcfile" 95895b296d0Smrg fi 95995b296d0Smrg 96095b296d0Smrg if test ! -d "${xdir}$objdir"; then 96195b296d0Smrg $show "$mkdir ${xdir}$objdir" 96295b296d0Smrg $run $mkdir ${xdir}$objdir 96395b296d0Smrg exit_status=$? 96495b296d0Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 96595b296d0Smrg exit $exit_status 96695b296d0Smrg fi 96795b296d0Smrg fi 96895b296d0Smrg 96995b296d0Smrg if test -z "$output_obj"; then 97095b296d0Smrg # Place PIC objects in $objdir 97195b296d0Smrg command="$command -o $lobj" 97295b296d0Smrg fi 97395b296d0Smrg 97495b296d0Smrg $run $rm "$lobj" "$output_obj" 97595b296d0Smrg 97695b296d0Smrg $show "$command" 97795b296d0Smrg if $run eval "$command"; then : 97895b296d0Smrg else 97995b296d0Smrg test -n "$output_obj" && $run $rm $removelist 98095b296d0Smrg exit $EXIT_FAILURE 98195b296d0Smrg fi 98295b296d0Smrg 98395b296d0Smrg if test "$need_locks" = warn && 98495b296d0Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 98595b296d0Smrg $echo "\ 98695b296d0Smrg*** ERROR, $lockfile contains: 98795b296d0Smrg`cat $lockfile 2>/dev/null` 98895b296d0Smrg 98995b296d0Smrgbut it should contain: 99095b296d0Smrg$srcfile 99195b296d0Smrg 99295b296d0SmrgThis indicates that another process is trying to use the same 99395b296d0Smrgtemporary object file, and libtool could not work around it because 99495b296d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 99595b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 99695b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better 99795b296d0Smrgcompiler." 99895b296d0Smrg 99995b296d0Smrg $run $rm $removelist 100095b296d0Smrg exit $EXIT_FAILURE 100195b296d0Smrg fi 100295b296d0Smrg 100395b296d0Smrg # Just move the object if needed, then go on to compile the next one 100495b296d0Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 100595b296d0Smrg $show "$mv $output_obj $lobj" 100695b296d0Smrg if $run $mv $output_obj $lobj; then : 100795b296d0Smrg else 100895b296d0Smrg error=$? 100995b296d0Smrg $run $rm $removelist 101095b296d0Smrg exit $error 101195b296d0Smrg fi 101295b296d0Smrg fi 101395b296d0Smrg 101495b296d0Smrg # Append the name of the PIC object to the libtool object file. 101595b296d0Smrg test -z "$run" && cat >> ${libobj}T <<EOF 101695b296d0Smrgpic_object='$objdir/$objname' 101795b296d0Smrg 101895b296d0SmrgEOF 101995b296d0Smrg 102095b296d0Smrg # Allow error messages only from the first compilation. 102195b296d0Smrg if test "$suppress_opt" = yes; then 102295b296d0Smrg suppress_output=' >/dev/null 2>&1' 102395b296d0Smrg fi 102495b296d0Smrg else 102595b296d0Smrg # No PIC object so indicate it doesn't exist in the libtool 102695b296d0Smrg # object file. 102795b296d0Smrg test -z "$run" && cat >> ${libobj}T <<EOF 102895b296d0Smrgpic_object=none 102995b296d0Smrg 103095b296d0SmrgEOF 103195b296d0Smrg fi 103295b296d0Smrg 103395b296d0Smrg # Only build a position-dependent object if we build old libraries. 103495b296d0Smrg if test "$build_old_libs" = yes; then 103595b296d0Smrg if test "$pic_mode" != yes; then 103695b296d0Smrg # Don't build PIC code 103795b296d0Smrg command="$base_compile $qsrcfile" 103895b296d0Smrg else 103995b296d0Smrg command="$base_compile $qsrcfile $pic_flag" 104095b296d0Smrg fi 104195b296d0Smrg if test "$compiler_c_o" = yes; then 104295b296d0Smrg command="$command -o $obj" 104395b296d0Smrg fi 104495b296d0Smrg 104595b296d0Smrg # Suppress compiler output if we already did a PIC compilation. 104695b296d0Smrg command="$command$suppress_output" 104795b296d0Smrg $run $rm "$obj" "$output_obj" 104895b296d0Smrg $show "$command" 104995b296d0Smrg if $run eval "$command"; then : 105095b296d0Smrg else 105195b296d0Smrg $run $rm $removelist 105295b296d0Smrg exit $EXIT_FAILURE 105395b296d0Smrg fi 105495b296d0Smrg 105595b296d0Smrg if test "$need_locks" = warn && 105695b296d0Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 105795b296d0Smrg $echo "\ 105895b296d0Smrg*** ERROR, $lockfile contains: 105995b296d0Smrg`cat $lockfile 2>/dev/null` 106095b296d0Smrg 106195b296d0Smrgbut it should contain: 106295b296d0Smrg$srcfile 106395b296d0Smrg 106495b296d0SmrgThis indicates that another process is trying to use the same 106595b296d0Smrgtemporary object file, and libtool could not work around it because 106695b296d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 106795b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 106895b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better 106995b296d0Smrgcompiler." 107095b296d0Smrg 107195b296d0Smrg $run $rm $removelist 107295b296d0Smrg exit $EXIT_FAILURE 107395b296d0Smrg fi 107495b296d0Smrg 107595b296d0Smrg # Just move the object if needed 107695b296d0Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 107795b296d0Smrg $show "$mv $output_obj $obj" 107895b296d0Smrg if $run $mv $output_obj $obj; then : 107995b296d0Smrg else 108095b296d0Smrg error=$? 108195b296d0Smrg $run $rm $removelist 108295b296d0Smrg exit $error 108395b296d0Smrg fi 108495b296d0Smrg fi 108595b296d0Smrg 108695b296d0Smrg # Append the name of the non-PIC object the libtool object file. 108795b296d0Smrg # Only append if the libtool object file exists. 108895b296d0Smrg test -z "$run" && cat >> ${libobj}T <<EOF 108995b296d0Smrg# Name of the non-PIC object. 109095b296d0Smrgnon_pic_object='$objname' 109195b296d0Smrg 109295b296d0SmrgEOF 109395b296d0Smrg else 109495b296d0Smrg # Append the name of the non-PIC object the libtool object file. 109595b296d0Smrg # Only append if the libtool object file exists. 109695b296d0Smrg test -z "$run" && cat >> ${libobj}T <<EOF 109795b296d0Smrg# Name of the non-PIC object. 109895b296d0Smrgnon_pic_object=none 109995b296d0Smrg 110095b296d0SmrgEOF 110195b296d0Smrg fi 110295b296d0Smrg 110395b296d0Smrg $run $mv "${libobj}T" "${libobj}" 110495b296d0Smrg 110595b296d0Smrg # Unlock the critical section if it was locked 110695b296d0Smrg if test "$need_locks" != no; then 110795b296d0Smrg $run $rm "$lockfile" 110895b296d0Smrg fi 110995b296d0Smrg 111095b296d0Smrg exit $EXIT_SUCCESS 111195b296d0Smrg ;; 111295b296d0Smrg 111395b296d0Smrg # libtool link mode 111495b296d0Smrg link | relink) 111595b296d0Smrg modename="$modename: link" 111695b296d0Smrg case $host in 111795b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 111895b296d0Smrg # It is impossible to link a dll without this setting, and 111995b296d0Smrg # we shouldn't force the makefile maintainer to figure out 112095b296d0Smrg # which system we are compiling for in order to pass an extra 112195b296d0Smrg # flag for every libtool invocation. 112295b296d0Smrg # allow_undefined=no 112395b296d0Smrg 112495b296d0Smrg # FIXME: Unfortunately, there are problems with the above when trying 112595b296d0Smrg # to make a dll which has undefined symbols, in which case not 112695b296d0Smrg # even a static library is built. For now, we need to specify 112795b296d0Smrg # -no-undefined on the libtool link line when we can be certain 112895b296d0Smrg # that all symbols are satisfied, otherwise we get a static library. 112995b296d0Smrg allow_undefined=yes 113095b296d0Smrg ;; 113195b296d0Smrg *) 113295b296d0Smrg allow_undefined=yes 113395b296d0Smrg ;; 113495b296d0Smrg esac 113595b296d0Smrg libtool_args="$nonopt" 113695b296d0Smrg base_compile="$nonopt $@" 113795b296d0Smrg compile_command="$nonopt" 113895b296d0Smrg finalize_command="$nonopt" 113995b296d0Smrg 114095b296d0Smrg compile_rpath= 114195b296d0Smrg finalize_rpath= 114295b296d0Smrg compile_shlibpath= 114395b296d0Smrg finalize_shlibpath= 114495b296d0Smrg convenience= 114595b296d0Smrg old_convenience= 114695b296d0Smrg deplibs= 114795b296d0Smrg old_deplibs= 114895b296d0Smrg compiler_flags= 114995b296d0Smrg linker_flags= 115095b296d0Smrg dllsearchpath= 115195b296d0Smrg lib_search_path=`pwd` 115295b296d0Smrg inst_prefix_dir= 115395b296d0Smrg 115495b296d0Smrg avoid_version=no 115595b296d0Smrg dlfiles= 115695b296d0Smrg dlprefiles= 115795b296d0Smrg dlself=no 115895b296d0Smrg export_dynamic=no 115995b296d0Smrg export_symbols= 116095b296d0Smrg export_symbols_regex= 116195b296d0Smrg generated= 116295b296d0Smrg libobjs= 116395b296d0Smrg ltlibs= 116495b296d0Smrg module=no 116595b296d0Smrg no_install=no 116695b296d0Smrg objs= 116795b296d0Smrg non_pic_objects= 116895b296d0Smrg notinst_path= # paths that contain not-installed libtool libraries 116995b296d0Smrg precious_files_regex= 117095b296d0Smrg prefer_static_libs=no 117195b296d0Smrg preload=no 117295b296d0Smrg prev= 117395b296d0Smrg prevarg= 117495b296d0Smrg release= 117595b296d0Smrg rpath= 117695b296d0Smrg xrpath= 117795b296d0Smrg perm_rpath= 117895b296d0Smrg temp_rpath= 117995b296d0Smrg thread_safe=no 118095b296d0Smrg vinfo= 118195b296d0Smrg vinfo_number=no 118295b296d0Smrg 118395b296d0Smrg func_infer_tag $base_compile 118495b296d0Smrg 118595b296d0Smrg # We need to know -static, to get the right output filenames. 118695b296d0Smrg for arg 118795b296d0Smrg do 118895b296d0Smrg case $arg in 118995b296d0Smrg -all-static | -static) 119095b296d0Smrg if test "X$arg" = "X-all-static"; then 119195b296d0Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 119295b296d0Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 119395b296d0Smrg fi 119495b296d0Smrg if test -n "$link_static_flag"; then 119595b296d0Smrg dlopen_self=$dlopen_self_static 119695b296d0Smrg fi 119795b296d0Smrg prefer_static_libs=yes 119895b296d0Smrg else 119995b296d0Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 120095b296d0Smrg dlopen_self=$dlopen_self_static 120195b296d0Smrg fi 120295b296d0Smrg prefer_static_libs=built 120395b296d0Smrg fi 120495b296d0Smrg build_libtool_libs=no 120595b296d0Smrg build_old_libs=yes 120695b296d0Smrg break 120795b296d0Smrg ;; 120895b296d0Smrg esac 120995b296d0Smrg done 121095b296d0Smrg 121195b296d0Smrg # See if our shared archives depend on static archives. 121295b296d0Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 121395b296d0Smrg 121495b296d0Smrg # Go through the arguments, transforming them on the way. 121595b296d0Smrg while test "$#" -gt 0; do 121695b296d0Smrg arg="$1" 121795b296d0Smrg shift 121895b296d0Smrg case $arg in 121995b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 122095b296d0Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 122195b296d0Smrg ;; 122295b296d0Smrg *) qarg=$arg ;; 122395b296d0Smrg esac 122495b296d0Smrg libtool_args="$libtool_args $qarg" 122595b296d0Smrg 122695b296d0Smrg # If the previous option needs an argument, assign it. 122795b296d0Smrg if test -n "$prev"; then 122895b296d0Smrg case $prev in 122995b296d0Smrg output) 123095b296d0Smrg compile_command="$compile_command @OUTPUT@" 123195b296d0Smrg finalize_command="$finalize_command @OUTPUT@" 123295b296d0Smrg ;; 123395b296d0Smrg esac 123495b296d0Smrg 123595b296d0Smrg case $prev in 123695b296d0Smrg dlfiles|dlprefiles) 123795b296d0Smrg if test "$preload" = no; then 123895b296d0Smrg # Add the symbol object into the linking commands. 123995b296d0Smrg compile_command="$compile_command @SYMFILE@" 124095b296d0Smrg finalize_command="$finalize_command @SYMFILE@" 124195b296d0Smrg preload=yes 124295b296d0Smrg fi 124395b296d0Smrg case $arg in 124495b296d0Smrg *.la | *.lo) ;; # We handle these cases below. 124595b296d0Smrg force) 124695b296d0Smrg if test "$dlself" = no; then 124795b296d0Smrg dlself=needless 124895b296d0Smrg export_dynamic=yes 124995b296d0Smrg fi 125095b296d0Smrg prev= 125195b296d0Smrg continue 125295b296d0Smrg ;; 125395b296d0Smrg self) 125495b296d0Smrg if test "$prev" = dlprefiles; then 125595b296d0Smrg dlself=yes 125695b296d0Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 125795b296d0Smrg dlself=yes 125895b296d0Smrg else 125995b296d0Smrg dlself=needless 126095b296d0Smrg export_dynamic=yes 126195b296d0Smrg fi 126295b296d0Smrg prev= 126395b296d0Smrg continue 126495b296d0Smrg ;; 126595b296d0Smrg *) 126695b296d0Smrg if test "$prev" = dlfiles; then 126795b296d0Smrg dlfiles="$dlfiles $arg" 126895b296d0Smrg else 126995b296d0Smrg dlprefiles="$dlprefiles $arg" 127095b296d0Smrg fi 127195b296d0Smrg prev= 127295b296d0Smrg continue 127395b296d0Smrg ;; 127495b296d0Smrg esac 127595b296d0Smrg ;; 127695b296d0Smrg expsyms) 127795b296d0Smrg export_symbols="$arg" 127895b296d0Smrg if test ! -f "$arg"; then 127995b296d0Smrg $echo "$modename: symbol file \`$arg' does not exist" 128095b296d0Smrg exit $EXIT_FAILURE 128195b296d0Smrg fi 128295b296d0Smrg prev= 128395b296d0Smrg continue 128495b296d0Smrg ;; 128595b296d0Smrg expsyms_regex) 128695b296d0Smrg export_symbols_regex="$arg" 128795b296d0Smrg prev= 128895b296d0Smrg continue 128995b296d0Smrg ;; 129095b296d0Smrg inst_prefix) 129195b296d0Smrg inst_prefix_dir="$arg" 129295b296d0Smrg prev= 129395b296d0Smrg continue 129495b296d0Smrg ;; 129595b296d0Smrg precious_regex) 129695b296d0Smrg precious_files_regex="$arg" 129795b296d0Smrg prev= 129895b296d0Smrg continue 129995b296d0Smrg ;; 130095b296d0Smrg release) 130195b296d0Smrg release="-$arg" 130295b296d0Smrg prev= 130395b296d0Smrg continue 130495b296d0Smrg ;; 130595b296d0Smrg objectlist) 130695b296d0Smrg if test -f "$arg"; then 130795b296d0Smrg save_arg=$arg 130895b296d0Smrg moreargs= 130995b296d0Smrg for fil in `cat $save_arg` 131095b296d0Smrg do 131195b296d0Smrg# moreargs="$moreargs $fil" 131295b296d0Smrg arg=$fil 131395b296d0Smrg # A libtool-controlled object. 131495b296d0Smrg 131595b296d0Smrg # Check to see that this really is a libtool object. 131695b296d0Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 131795b296d0Smrg pic_object= 131895b296d0Smrg non_pic_object= 131995b296d0Smrg 132095b296d0Smrg # Read the .lo file 132195b296d0Smrg # If there is no directory component, then add one. 132295b296d0Smrg case $arg in 132395b296d0Smrg */* | *\\*) . $arg ;; 132495b296d0Smrg *) . ./$arg ;; 132595b296d0Smrg esac 132695b296d0Smrg 132795b296d0Smrg if test -z "$pic_object" || \ 132895b296d0Smrg test -z "$non_pic_object" || 132995b296d0Smrg test "$pic_object" = none && \ 133095b296d0Smrg test "$non_pic_object" = none; then 133195b296d0Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 133295b296d0Smrg exit $EXIT_FAILURE 133395b296d0Smrg fi 133495b296d0Smrg 133595b296d0Smrg # Extract subdirectory from the argument. 133695b296d0Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 133795b296d0Smrg if test "X$xdir" = "X$arg"; then 133895b296d0Smrg xdir= 133995b296d0Smrg else 134095b296d0Smrg xdir="$xdir/" 134195b296d0Smrg fi 134295b296d0Smrg 134395b296d0Smrg if test "$pic_object" != none; then 134495b296d0Smrg # Prepend the subdirectory the object is found in. 134595b296d0Smrg pic_object="$xdir$pic_object" 134695b296d0Smrg 134795b296d0Smrg if test "$prev" = dlfiles; then 134895b296d0Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 134995b296d0Smrg dlfiles="$dlfiles $pic_object" 135095b296d0Smrg prev= 135195b296d0Smrg continue 135295b296d0Smrg else 135395b296d0Smrg # If libtool objects are unsupported, then we need to preload. 135495b296d0Smrg prev=dlprefiles 135595b296d0Smrg fi 135695b296d0Smrg fi 135795b296d0Smrg 135895b296d0Smrg # CHECK ME: I think I busted this. -Ossama 135995b296d0Smrg if test "$prev" = dlprefiles; then 136095b296d0Smrg # Preload the old-style object. 136195b296d0Smrg dlprefiles="$dlprefiles $pic_object" 136295b296d0Smrg prev= 136395b296d0Smrg fi 136495b296d0Smrg 136595b296d0Smrg # A PIC object. 136695b296d0Smrg libobjs="$libobjs $pic_object" 136795b296d0Smrg arg="$pic_object" 136895b296d0Smrg fi 136995b296d0Smrg 137095b296d0Smrg # Non-PIC object. 137195b296d0Smrg if test "$non_pic_object" != none; then 137295b296d0Smrg # Prepend the subdirectory the object is found in. 137395b296d0Smrg non_pic_object="$xdir$non_pic_object" 137495b296d0Smrg 137595b296d0Smrg # A standard non-PIC object 137695b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 137795b296d0Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 137895b296d0Smrg arg="$non_pic_object" 137995b296d0Smrg fi 138095b296d0Smrg else 138195b296d0Smrg # If the PIC object exists, use it instead. 138295b296d0Smrg # $xdir was prepended to $pic_object above. 138395b296d0Smrg non_pic_object="$pic_object" 138495b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 138595b296d0Smrg fi 138695b296d0Smrg else 138795b296d0Smrg # Only an error if not doing a dry-run. 138895b296d0Smrg if test -z "$run"; then 138995b296d0Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 139095b296d0Smrg exit $EXIT_FAILURE 139195b296d0Smrg else 139295b296d0Smrg # Dry-run case. 139395b296d0Smrg 139495b296d0Smrg # Extract subdirectory from the argument. 139595b296d0Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 139695b296d0Smrg if test "X$xdir" = "X$arg"; then 139795b296d0Smrg xdir= 139895b296d0Smrg else 139995b296d0Smrg xdir="$xdir/" 140095b296d0Smrg fi 140195b296d0Smrg 140295b296d0Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 140395b296d0Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 140495b296d0Smrg libobjs="$libobjs $pic_object" 140595b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 140695b296d0Smrg fi 140795b296d0Smrg fi 140895b296d0Smrg done 140995b296d0Smrg else 141095b296d0Smrg $echo "$modename: link input file \`$save_arg' does not exist" 141195b296d0Smrg exit $EXIT_FAILURE 141295b296d0Smrg fi 141395b296d0Smrg arg=$save_arg 141495b296d0Smrg prev= 141595b296d0Smrg continue 141695b296d0Smrg ;; 141795b296d0Smrg rpath | xrpath) 141895b296d0Smrg # We need an absolute path. 141995b296d0Smrg case $arg in 142095b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 142195b296d0Smrg *) 142295b296d0Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 142395b296d0Smrg exit $EXIT_FAILURE 142495b296d0Smrg ;; 142595b296d0Smrg esac 142695b296d0Smrg if test "$prev" = rpath; then 142795b296d0Smrg case "$rpath " in 142895b296d0Smrg *" $arg "*) ;; 142995b296d0Smrg *) rpath="$rpath $arg" ;; 143095b296d0Smrg esac 143195b296d0Smrg else 143295b296d0Smrg case "$xrpath " in 143395b296d0Smrg *" $arg "*) ;; 143495b296d0Smrg *) xrpath="$xrpath $arg" ;; 143595b296d0Smrg esac 143695b296d0Smrg fi 143795b296d0Smrg prev= 143895b296d0Smrg continue 143995b296d0Smrg ;; 144095b296d0Smrg xcompiler) 144195b296d0Smrg compiler_flags="$compiler_flags $qarg" 144295b296d0Smrg prev= 144395b296d0Smrg compile_command="$compile_command $qarg" 144495b296d0Smrg finalize_command="$finalize_command $qarg" 144595b296d0Smrg continue 144695b296d0Smrg ;; 144795b296d0Smrg xlinker) 144895b296d0Smrg linker_flags="$linker_flags $qarg" 144995b296d0Smrg compiler_flags="$compiler_flags $wl$qarg" 145095b296d0Smrg prev= 145195b296d0Smrg compile_command="$compile_command $wl$qarg" 145295b296d0Smrg finalize_command="$finalize_command $wl$qarg" 145395b296d0Smrg continue 145495b296d0Smrg ;; 145595b296d0Smrg xcclinker) 145695b296d0Smrg linker_flags="$linker_flags $qarg" 145795b296d0Smrg compiler_flags="$compiler_flags $qarg" 145895b296d0Smrg prev= 145995b296d0Smrg compile_command="$compile_command $qarg" 146095b296d0Smrg finalize_command="$finalize_command $qarg" 146195b296d0Smrg continue 146295b296d0Smrg ;; 146395b296d0Smrg shrext) 146495b296d0Smrg shrext_cmds="$arg" 146595b296d0Smrg prev= 146695b296d0Smrg continue 146795b296d0Smrg ;; 146895b296d0Smrg darwin_framework|darwin_framework_skip) 146995b296d0Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 147095b296d0Smrg compile_command="$compile_command $arg" 147195b296d0Smrg finalize_command="$finalize_command $arg" 147295b296d0Smrg prev= 147395b296d0Smrg continue 147495b296d0Smrg ;; 147595b296d0Smrg *) 147695b296d0Smrg eval "$prev=\"\$arg\"" 147795b296d0Smrg prev= 147895b296d0Smrg continue 147995b296d0Smrg ;; 148095b296d0Smrg esac 148195b296d0Smrg fi # test -n "$prev" 148295b296d0Smrg 148395b296d0Smrg prevarg="$arg" 148495b296d0Smrg 148595b296d0Smrg case $arg in 148695b296d0Smrg -all-static) 148795b296d0Smrg if test -n "$link_static_flag"; then 148895b296d0Smrg compile_command="$compile_command $link_static_flag" 148995b296d0Smrg finalize_command="$finalize_command $link_static_flag" 149095b296d0Smrg fi 149195b296d0Smrg continue 149295b296d0Smrg ;; 149395b296d0Smrg 149495b296d0Smrg -allow-undefined) 149595b296d0Smrg # FIXME: remove this flag sometime in the future. 149695b296d0Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 149795b296d0Smrg continue 149895b296d0Smrg ;; 149995b296d0Smrg 150095b296d0Smrg -avoid-version) 150195b296d0Smrg avoid_version=yes 150295b296d0Smrg continue 150395b296d0Smrg ;; 150495b296d0Smrg 150595b296d0Smrg -dlopen) 150695b296d0Smrg prev=dlfiles 150795b296d0Smrg continue 150895b296d0Smrg ;; 150995b296d0Smrg 151095b296d0Smrg -dlpreopen) 151195b296d0Smrg prev=dlprefiles 151295b296d0Smrg continue 151395b296d0Smrg ;; 151495b296d0Smrg 151595b296d0Smrg -export-dynamic) 151695b296d0Smrg export_dynamic=yes 151795b296d0Smrg continue 151895b296d0Smrg ;; 151995b296d0Smrg 152095b296d0Smrg -export-symbols | -export-symbols-regex) 152195b296d0Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 152295b296d0Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 152395b296d0Smrg exit $EXIT_FAILURE 152495b296d0Smrg fi 152595b296d0Smrg if test "X$arg" = "X-export-symbols"; then 152695b296d0Smrg prev=expsyms 152795b296d0Smrg else 152895b296d0Smrg prev=expsyms_regex 152995b296d0Smrg fi 153095b296d0Smrg continue 153195b296d0Smrg ;; 153295b296d0Smrg 153395b296d0Smrg -framework|-arch|-isysroot) 153495b296d0Smrg case " $CC " in 153595b296d0Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 153695b296d0Smrg prev=darwin_framework_skip ;; 153795b296d0Smrg *) compiler_flags="$compiler_flags $arg" 153895b296d0Smrg prev=darwin_framework ;; 153995b296d0Smrg esac 154095b296d0Smrg compile_command="$compile_command $arg" 154195b296d0Smrg finalize_command="$finalize_command $arg" 154295b296d0Smrg continue 154395b296d0Smrg ;; 154495b296d0Smrg 154595b296d0Smrg -inst-prefix-dir) 154695b296d0Smrg prev=inst_prefix 154795b296d0Smrg continue 154895b296d0Smrg ;; 154995b296d0Smrg 155095b296d0Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 155195b296d0Smrg # so, if we see these flags be careful not to treat them like -L 155295b296d0Smrg -L[A-Z][A-Z]*:*) 155395b296d0Smrg case $with_gcc/$host in 155495b296d0Smrg no/*-*-irix* | /*-*-irix*) 155595b296d0Smrg compile_command="$compile_command $arg" 155695b296d0Smrg finalize_command="$finalize_command $arg" 155795b296d0Smrg ;; 155895b296d0Smrg esac 155995b296d0Smrg continue 156095b296d0Smrg ;; 156195b296d0Smrg 156295b296d0Smrg -L*) 156395b296d0Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 156495b296d0Smrg # We need an absolute path. 156595b296d0Smrg case $dir in 156695b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 156795b296d0Smrg *) 156895b296d0Smrg absdir=`cd "$dir" && pwd` 156995b296d0Smrg if test -z "$absdir"; then 157095b296d0Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 157195b296d0Smrg absdir="$dir" 157295b296d0Smrg notinst_path="$notinst_path $dir" 157395b296d0Smrg fi 157495b296d0Smrg dir="$absdir" 157595b296d0Smrg ;; 157695b296d0Smrg esac 157795b296d0Smrg case "$deplibs " in 157895b296d0Smrg *" -L$dir "*) ;; 157995b296d0Smrg *) 158095b296d0Smrg deplibs="$deplibs -L$dir" 158195b296d0Smrg lib_search_path="$lib_search_path $dir" 158295b296d0Smrg ;; 158395b296d0Smrg esac 158495b296d0Smrg case $host in 158595b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 158695b296d0Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 158795b296d0Smrg case :$dllsearchpath: in 158895b296d0Smrg *":$dir:"*) ;; 158995b296d0Smrg *) dllsearchpath="$dllsearchpath:$dir";; 159095b296d0Smrg esac 159195b296d0Smrg case :$dllsearchpath: in 159295b296d0Smrg *":$testbindir:"*) ;; 159395b296d0Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 159495b296d0Smrg esac 159595b296d0Smrg ;; 159695b296d0Smrg esac 159795b296d0Smrg continue 159895b296d0Smrg ;; 159995b296d0Smrg 160095b296d0Smrg -l*) 160195b296d0Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 160295b296d0Smrg case $host in 160395b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 160495b296d0Smrg # These systems don't actually have a C or math library (as such) 160595b296d0Smrg continue 160695b296d0Smrg ;; 160795b296d0Smrg *-*-os2*) 160895b296d0Smrg # These systems don't actually have a C library (as such) 160995b296d0Smrg test "X$arg" = "X-lc" && continue 161095b296d0Smrg ;; 161195b296d0Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 161295b296d0Smrg # Do not include libc due to us having libc/libc_r. 161395b296d0Smrg test "X$arg" = "X-lc" && continue 161495b296d0Smrg ;; 161595b296d0Smrg *-*-rhapsody* | *-*-darwin1.[012]) 161695b296d0Smrg # Rhapsody C and math libraries are in the System framework 161795b296d0Smrg deplibs="$deplibs -framework System" 161895b296d0Smrg continue 161995b296d0Smrg ;; 162095b296d0Smrg *-*-sco3.2v5* | *-*-sco5v6*) 162195b296d0Smrg # Causes problems with __ctype 162295b296d0Smrg test "X$arg" = "X-lc" && continue 162395b296d0Smrg ;; 162495b296d0Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 162595b296d0Smrg # Compiler inserts libc in the correct place for threads to work 162695b296d0Smrg test "X$arg" = "X-lc" && continue 162795b296d0Smrg ;; 162895b296d0Smrg esac 162995b296d0Smrg elif test "X$arg" = "X-lc_r"; then 163095b296d0Smrg case $host in 163195b296d0Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 163295b296d0Smrg # Do not include libc_r directly, use -pthread flag. 163395b296d0Smrg continue 163495b296d0Smrg ;; 163595b296d0Smrg esac 163695b296d0Smrg fi 163795b296d0Smrg deplibs="$deplibs $arg" 163895b296d0Smrg continue 163995b296d0Smrg ;; 164095b296d0Smrg 164195b296d0Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 164295b296d0Smrg # classes, name mangling, and exception handling. 164395b296d0Smrg -model) 164495b296d0Smrg compile_command="$compile_command $arg" 164595b296d0Smrg compiler_flags="$compiler_flags $arg" 164695b296d0Smrg finalize_command="$finalize_command $arg" 164795b296d0Smrg prev=xcompiler 164895b296d0Smrg continue 164995b296d0Smrg ;; 165095b296d0Smrg 165195b296d0Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 165295b296d0Smrg compiler_flags="$compiler_flags $arg" 165395b296d0Smrg compile_command="$compile_command $arg" 165495b296d0Smrg finalize_command="$finalize_command $arg" 165595b296d0Smrg continue 165695b296d0Smrg ;; 165795b296d0Smrg 165895b296d0Smrg -module) 165995b296d0Smrg module=yes 166095b296d0Smrg continue 166195b296d0Smrg ;; 166295b296d0Smrg 166395b296d0Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 166495b296d0Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 166595b296d0Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 166695b296d0Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 166795b296d0Smrg # -q* pass through compiler args for the IBM compiler 166895b296d0Smrg # -m* pass through architecture-specific compiler args for GCC 166995b296d0Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 167095b296d0Smrg # compiler args for GCC 167195b296d0Smrg # -pg pass through profiling flag for GCC 167295b296d0Smrg # @file GCC response files 167395b296d0Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 167495b296d0Smrg -t[45]*|-txscale*|@*) 167595b296d0Smrg 167695b296d0Smrg # Unknown arguments in both finalize_command and compile_command need 167795b296d0Smrg # to be aesthetically quoted because they are evaled later. 167895b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 167995b296d0Smrg case $arg in 168095b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 168195b296d0Smrg arg="\"$arg\"" 168295b296d0Smrg ;; 168395b296d0Smrg esac 168495b296d0Smrg compile_command="$compile_command $arg" 168595b296d0Smrg finalize_command="$finalize_command $arg" 168695b296d0Smrg compiler_flags="$compiler_flags $arg" 168795b296d0Smrg continue 168895b296d0Smrg ;; 168995b296d0Smrg 169095b296d0Smrg -shrext) 169195b296d0Smrg prev=shrext 169295b296d0Smrg continue 169395b296d0Smrg ;; 169495b296d0Smrg 169595b296d0Smrg -no-fast-install) 169695b296d0Smrg fast_install=no 169795b296d0Smrg continue 169895b296d0Smrg ;; 169995b296d0Smrg 170095b296d0Smrg -no-install) 170195b296d0Smrg case $host in 170295b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 170395b296d0Smrg # The PATH hackery in wrapper scripts is required on Windows 170495b296d0Smrg # in order for the loader to find any dlls it needs. 170595b296d0Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 170695b296d0Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 170795b296d0Smrg fast_install=no 170895b296d0Smrg ;; 170995b296d0Smrg *) no_install=yes ;; 171095b296d0Smrg esac 171195b296d0Smrg continue 171295b296d0Smrg ;; 171395b296d0Smrg 171495b296d0Smrg -no-undefined) 171595b296d0Smrg allow_undefined=no 171695b296d0Smrg continue 171795b296d0Smrg ;; 171895b296d0Smrg 171995b296d0Smrg -objectlist) 172095b296d0Smrg prev=objectlist 172195b296d0Smrg continue 172295b296d0Smrg ;; 172395b296d0Smrg 172495b296d0Smrg -o) prev=output ;; 172595b296d0Smrg 172695b296d0Smrg -precious-files-regex) 172795b296d0Smrg prev=precious_regex 172895b296d0Smrg continue 172995b296d0Smrg ;; 173095b296d0Smrg 173195b296d0Smrg -release) 173295b296d0Smrg prev=release 173395b296d0Smrg continue 173495b296d0Smrg ;; 173595b296d0Smrg 173695b296d0Smrg -rpath) 173795b296d0Smrg prev=rpath 173895b296d0Smrg continue 173995b296d0Smrg ;; 174095b296d0Smrg 174195b296d0Smrg -R) 174295b296d0Smrg prev=xrpath 174395b296d0Smrg continue 174495b296d0Smrg ;; 174595b296d0Smrg 174695b296d0Smrg -R*) 174795b296d0Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 174895b296d0Smrg # We need an absolute path. 174995b296d0Smrg case $dir in 175095b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 175195b296d0Smrg *) 175295b296d0Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 175395b296d0Smrg exit $EXIT_FAILURE 175495b296d0Smrg ;; 175595b296d0Smrg esac 175695b296d0Smrg case "$xrpath " in 175795b296d0Smrg *" $dir "*) ;; 175895b296d0Smrg *) xrpath="$xrpath $dir" ;; 175995b296d0Smrg esac 176095b296d0Smrg continue 176195b296d0Smrg ;; 176295b296d0Smrg 176395b296d0Smrg -static) 176495b296d0Smrg # The effects of -static are defined in a previous loop. 176595b296d0Smrg # We used to do the same as -all-static on platforms that 176695b296d0Smrg # didn't have a PIC flag, but the assumption that the effects 176795b296d0Smrg # would be equivalent was wrong. It would break on at least 176895b296d0Smrg # Digital Unix and AIX. 176995b296d0Smrg continue 177095b296d0Smrg ;; 177195b296d0Smrg 177295b296d0Smrg -thread-safe) 177395b296d0Smrg thread_safe=yes 177495b296d0Smrg continue 177595b296d0Smrg ;; 177695b296d0Smrg 177795b296d0Smrg -version-info) 177895b296d0Smrg prev=vinfo 177995b296d0Smrg continue 178095b296d0Smrg ;; 178195b296d0Smrg -version-number) 178295b296d0Smrg prev=vinfo 178395b296d0Smrg vinfo_number=yes 178495b296d0Smrg continue 178595b296d0Smrg ;; 178695b296d0Smrg 178795b296d0Smrg -Wc,*) 178895b296d0Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 178995b296d0Smrg arg= 179095b296d0Smrg save_ifs="$IFS"; IFS=',' 179195b296d0Smrg for flag in $args; do 179295b296d0Smrg IFS="$save_ifs" 179395b296d0Smrg case $flag in 179495b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 179595b296d0Smrg flag="\"$flag\"" 179695b296d0Smrg ;; 179795b296d0Smrg esac 179895b296d0Smrg arg="$arg $wl$flag" 179995b296d0Smrg compiler_flags="$compiler_flags $flag" 180095b296d0Smrg done 180195b296d0Smrg IFS="$save_ifs" 180295b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 180395b296d0Smrg ;; 180495b296d0Smrg 180595b296d0Smrg -Wl,*) 180695b296d0Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 180795b296d0Smrg arg= 180895b296d0Smrg save_ifs="$IFS"; IFS=',' 180995b296d0Smrg for flag in $args; do 181095b296d0Smrg IFS="$save_ifs" 181195b296d0Smrg case $flag in 181295b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 181395b296d0Smrg flag="\"$flag\"" 181495b296d0Smrg ;; 181595b296d0Smrg esac 181695b296d0Smrg arg="$arg $wl$flag" 181795b296d0Smrg compiler_flags="$compiler_flags $wl$flag" 181895b296d0Smrg linker_flags="$linker_flags $flag" 181995b296d0Smrg done 182095b296d0Smrg IFS="$save_ifs" 182195b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 182295b296d0Smrg ;; 182395b296d0Smrg 182495b296d0Smrg -Xcompiler) 182595b296d0Smrg prev=xcompiler 182695b296d0Smrg continue 182795b296d0Smrg ;; 182895b296d0Smrg 182995b296d0Smrg -Xlinker) 183095b296d0Smrg prev=xlinker 183195b296d0Smrg continue 183295b296d0Smrg ;; 183395b296d0Smrg 183495b296d0Smrg -XCClinker) 183595b296d0Smrg prev=xcclinker 183695b296d0Smrg continue 183795b296d0Smrg ;; 183895b296d0Smrg 183995b296d0Smrg # Some other compiler flag. 184095b296d0Smrg -* | +*) 184195b296d0Smrg # Unknown arguments in both finalize_command and compile_command need 184295b296d0Smrg # to be aesthetically quoted because they are evaled later. 184395b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 184495b296d0Smrg case $arg in 184595b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 184695b296d0Smrg arg="\"$arg\"" 184795b296d0Smrg ;; 184895b296d0Smrg esac 184995b296d0Smrg ;; 185095b296d0Smrg 185195b296d0Smrg *.$objext) 185295b296d0Smrg # A standard object. 185395b296d0Smrg objs="$objs $arg" 185495b296d0Smrg ;; 185595b296d0Smrg 185695b296d0Smrg *.lo) 185795b296d0Smrg # A libtool-controlled object. 185895b296d0Smrg 185995b296d0Smrg # Check to see that this really is a libtool object. 186095b296d0Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 186195b296d0Smrg pic_object= 186295b296d0Smrg non_pic_object= 186395b296d0Smrg 186495b296d0Smrg # Read the .lo file 186595b296d0Smrg # If there is no directory component, then add one. 186695b296d0Smrg case $arg in 186795b296d0Smrg */* | *\\*) . $arg ;; 186895b296d0Smrg *) . ./$arg ;; 186995b296d0Smrg esac 187095b296d0Smrg 187195b296d0Smrg if test -z "$pic_object" || \ 187295b296d0Smrg test -z "$non_pic_object" || 187395b296d0Smrg test "$pic_object" = none && \ 187495b296d0Smrg test "$non_pic_object" = none; then 187595b296d0Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 187695b296d0Smrg exit $EXIT_FAILURE 187795b296d0Smrg fi 187895b296d0Smrg 187995b296d0Smrg # Extract subdirectory from the argument. 188095b296d0Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 188195b296d0Smrg if test "X$xdir" = "X$arg"; then 188295b296d0Smrg xdir= 188395b296d0Smrg else 188495b296d0Smrg xdir="$xdir/" 188595b296d0Smrg fi 188695b296d0Smrg 188795b296d0Smrg if test "$pic_object" != none; then 188895b296d0Smrg # Prepend the subdirectory the object is found in. 188995b296d0Smrg pic_object="$xdir$pic_object" 189095b296d0Smrg 189195b296d0Smrg if test "$prev" = dlfiles; then 189295b296d0Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 189395b296d0Smrg dlfiles="$dlfiles $pic_object" 189495b296d0Smrg prev= 189595b296d0Smrg continue 189695b296d0Smrg else 189795b296d0Smrg # If libtool objects are unsupported, then we need to preload. 189895b296d0Smrg prev=dlprefiles 189995b296d0Smrg fi 190095b296d0Smrg fi 190195b296d0Smrg 190295b296d0Smrg # CHECK ME: I think I busted this. -Ossama 190395b296d0Smrg if test "$prev" = dlprefiles; then 190495b296d0Smrg # Preload the old-style object. 190595b296d0Smrg dlprefiles="$dlprefiles $pic_object" 190695b296d0Smrg prev= 190795b296d0Smrg fi 190895b296d0Smrg 190995b296d0Smrg # A PIC object. 191095b296d0Smrg libobjs="$libobjs $pic_object" 191195b296d0Smrg arg="$pic_object" 191295b296d0Smrg fi 191395b296d0Smrg 191495b296d0Smrg # Non-PIC object. 191595b296d0Smrg if test "$non_pic_object" != none; then 191695b296d0Smrg # Prepend the subdirectory the object is found in. 191795b296d0Smrg non_pic_object="$xdir$non_pic_object" 191895b296d0Smrg 191995b296d0Smrg # A standard non-PIC object 192095b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 192195b296d0Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 192295b296d0Smrg arg="$non_pic_object" 192395b296d0Smrg fi 192495b296d0Smrg else 192595b296d0Smrg # If the PIC object exists, use it instead. 192695b296d0Smrg # $xdir was prepended to $pic_object above. 192795b296d0Smrg non_pic_object="$pic_object" 192895b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 192995b296d0Smrg fi 193095b296d0Smrg else 193195b296d0Smrg # Only an error if not doing a dry-run. 193295b296d0Smrg if test -z "$run"; then 193395b296d0Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 193495b296d0Smrg exit $EXIT_FAILURE 193595b296d0Smrg else 193695b296d0Smrg # Dry-run case. 193795b296d0Smrg 193895b296d0Smrg # Extract subdirectory from the argument. 193995b296d0Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 194095b296d0Smrg if test "X$xdir" = "X$arg"; then 194195b296d0Smrg xdir= 194295b296d0Smrg else 194395b296d0Smrg xdir="$xdir/" 194495b296d0Smrg fi 194595b296d0Smrg 194695b296d0Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 194795b296d0Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 194895b296d0Smrg libobjs="$libobjs $pic_object" 194995b296d0Smrg non_pic_objects="$non_pic_objects $non_pic_object" 195095b296d0Smrg fi 195195b296d0Smrg fi 195295b296d0Smrg ;; 195395b296d0Smrg 195495b296d0Smrg *.$libext) 195595b296d0Smrg # An archive. 195695b296d0Smrg deplibs="$deplibs $arg" 195795b296d0Smrg old_deplibs="$old_deplibs $arg" 195895b296d0Smrg continue 195995b296d0Smrg ;; 196095b296d0Smrg 196195b296d0Smrg *.la) 196295b296d0Smrg # A libtool-controlled library. 196395b296d0Smrg 196495b296d0Smrg if test "$prev" = dlfiles; then 196595b296d0Smrg # This library was specified with -dlopen. 196695b296d0Smrg dlfiles="$dlfiles $arg" 196795b296d0Smrg prev= 196895b296d0Smrg elif test "$prev" = dlprefiles; then 196995b296d0Smrg # The library was specified with -dlpreopen. 197095b296d0Smrg dlprefiles="$dlprefiles $arg" 197195b296d0Smrg prev= 197295b296d0Smrg else 197395b296d0Smrg deplibs="$deplibs $arg" 197495b296d0Smrg fi 197595b296d0Smrg continue 197695b296d0Smrg ;; 197795b296d0Smrg 197895b296d0Smrg # Some other compiler argument. 197995b296d0Smrg *) 198095b296d0Smrg # Unknown arguments in both finalize_command and compile_command need 198195b296d0Smrg # to be aesthetically quoted because they are evaled later. 198295b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 198395b296d0Smrg case $arg in 198495b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 198595b296d0Smrg arg="\"$arg\"" 198695b296d0Smrg ;; 198795b296d0Smrg esac 198895b296d0Smrg ;; 198995b296d0Smrg esac # arg 199095b296d0Smrg 199195b296d0Smrg # Now actually substitute the argument into the commands. 199295b296d0Smrg if test -n "$arg"; then 199395b296d0Smrg compile_command="$compile_command $arg" 199495b296d0Smrg finalize_command="$finalize_command $arg" 199595b296d0Smrg fi 199695b296d0Smrg done # argument parsing loop 199795b296d0Smrg 199895b296d0Smrg if test -n "$prev"; then 199995b296d0Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 200095b296d0Smrg $echo "$help" 1>&2 200195b296d0Smrg exit $EXIT_FAILURE 200295b296d0Smrg fi 200395b296d0Smrg 200495b296d0Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 200595b296d0Smrg eval arg=\"$export_dynamic_flag_spec\" 200695b296d0Smrg compile_command="$compile_command $arg" 200795b296d0Smrg finalize_command="$finalize_command $arg" 200895b296d0Smrg fi 200995b296d0Smrg 201095b296d0Smrg oldlibs= 201195b296d0Smrg # calculate the name of the file, without its directory 201295b296d0Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 201395b296d0Smrg libobjs_save="$libobjs" 201495b296d0Smrg 201595b296d0Smrg if test -n "$shlibpath_var"; then 201695b296d0Smrg # get the directories listed in $shlibpath_var 201795b296d0Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 201895b296d0Smrg else 201995b296d0Smrg shlib_search_path= 202095b296d0Smrg fi 202195b296d0Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 202295b296d0Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 202395b296d0Smrg 202495b296d0Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 202595b296d0Smrg if test "X$output_objdir" = "X$output"; then 202695b296d0Smrg output_objdir="$objdir" 202795b296d0Smrg else 202895b296d0Smrg output_objdir="$output_objdir/$objdir" 202995b296d0Smrg fi 203095b296d0Smrg # Create the object directory. 203195b296d0Smrg if test ! -d "$output_objdir"; then 203295b296d0Smrg $show "$mkdir $output_objdir" 203395b296d0Smrg $run $mkdir $output_objdir 203495b296d0Smrg exit_status=$? 203595b296d0Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 203695b296d0Smrg exit $exit_status 203795b296d0Smrg fi 203895b296d0Smrg fi 203995b296d0Smrg 204095b296d0Smrg # Determine the type of output 204195b296d0Smrg case $output in 204295b296d0Smrg "") 204395b296d0Smrg $echo "$modename: you must specify an output file" 1>&2 204495b296d0Smrg $echo "$help" 1>&2 204595b296d0Smrg exit $EXIT_FAILURE 204695b296d0Smrg ;; 204795b296d0Smrg *.$libext) linkmode=oldlib ;; 204895b296d0Smrg *.lo | *.$objext) linkmode=obj ;; 204995b296d0Smrg *.la) linkmode=lib ;; 205095b296d0Smrg *) linkmode=prog ;; # Anything else should be a program. 205195b296d0Smrg esac 205295b296d0Smrg 205395b296d0Smrg case $host in 205495b296d0Smrg *cygwin* | *mingw* | *pw32*) 205595b296d0Smrg # don't eliminate duplications in $postdeps and $predeps 205695b296d0Smrg duplicate_compiler_generated_deps=yes 205795b296d0Smrg ;; 205895b296d0Smrg *) 205995b296d0Smrg duplicate_compiler_generated_deps=$duplicate_deps 206095b296d0Smrg ;; 206195b296d0Smrg esac 206295b296d0Smrg specialdeplibs= 206395b296d0Smrg 206495b296d0Smrg libs= 206595b296d0Smrg # Find all interdependent deplibs by searching for libraries 206695b296d0Smrg # that are linked more than once (e.g. -la -lb -la) 206795b296d0Smrg for deplib in $deplibs; do 206895b296d0Smrg if test "X$duplicate_deps" = "Xyes" ; then 206995b296d0Smrg case "$libs " in 207095b296d0Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 207195b296d0Smrg esac 207295b296d0Smrg fi 207395b296d0Smrg libs="$libs $deplib" 207495b296d0Smrg done 207595b296d0Smrg 207695b296d0Smrg if test "$linkmode" = lib; then 207795b296d0Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 207895b296d0Smrg 207995b296d0Smrg # Compute libraries that are listed more than once in $predeps 208095b296d0Smrg # $postdeps and mark them as special (i.e., whose duplicates are 208195b296d0Smrg # not to be eliminated). 208295b296d0Smrg pre_post_deps= 208395b296d0Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 208495b296d0Smrg for pre_post_dep in $predeps $postdeps; do 208595b296d0Smrg case "$pre_post_deps " in 208695b296d0Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 208795b296d0Smrg esac 208895b296d0Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 208995b296d0Smrg done 209095b296d0Smrg fi 209195b296d0Smrg pre_post_deps= 209295b296d0Smrg fi 209395b296d0Smrg 209495b296d0Smrg deplibs= 209595b296d0Smrg newdependency_libs= 209695b296d0Smrg newlib_search_path= 209795b296d0Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 209895b296d0Smrg notinst_deplibs= # not-installed libtool libraries 209995b296d0Smrg case $linkmode in 210095b296d0Smrg lib) 210195b296d0Smrg passes="conv link" 210295b296d0Smrg for file in $dlfiles $dlprefiles; do 210395b296d0Smrg case $file in 210495b296d0Smrg *.la) ;; 210595b296d0Smrg *) 210695b296d0Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 210795b296d0Smrg exit $EXIT_FAILURE 210895b296d0Smrg ;; 210995b296d0Smrg esac 211095b296d0Smrg done 211195b296d0Smrg ;; 211295b296d0Smrg prog) 211395b296d0Smrg compile_deplibs= 211495b296d0Smrg finalize_deplibs= 211595b296d0Smrg alldeplibs=no 211695b296d0Smrg newdlfiles= 211795b296d0Smrg newdlprefiles= 211895b296d0Smrg passes="conv scan dlopen dlpreopen link" 211995b296d0Smrg ;; 212095b296d0Smrg *) passes="conv" 212195b296d0Smrg ;; 212295b296d0Smrg esac 212395b296d0Smrg for pass in $passes; do 212495b296d0Smrg if test "$linkmode,$pass" = "lib,link" || 212595b296d0Smrg test "$linkmode,$pass" = "prog,scan"; then 212695b296d0Smrg libs="$deplibs" 212795b296d0Smrg deplibs= 212895b296d0Smrg fi 212995b296d0Smrg if test "$linkmode" = prog; then 213095b296d0Smrg case $pass in 213195b296d0Smrg dlopen) libs="$dlfiles" ;; 213295b296d0Smrg dlpreopen) libs="$dlprefiles" ;; 213395b296d0Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 213495b296d0Smrg esac 213595b296d0Smrg fi 213695b296d0Smrg if test "$pass" = dlopen; then 213795b296d0Smrg # Collect dlpreopened libraries 213895b296d0Smrg save_deplibs="$deplibs" 213995b296d0Smrg deplibs= 214095b296d0Smrg fi 214195b296d0Smrg for deplib in $libs; do 214295b296d0Smrg lib= 214395b296d0Smrg found=no 214495b296d0Smrg case $deplib in 214595b296d0Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 214695b296d0Smrg if test "$linkmode,$pass" = "prog,link"; then 214795b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 214895b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 214995b296d0Smrg else 215095b296d0Smrg compiler_flags="$compiler_flags $deplib" 215195b296d0Smrg fi 215295b296d0Smrg continue 215395b296d0Smrg ;; 215495b296d0Smrg -l*) 215595b296d0Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 215695b296d0Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 215795b296d0Smrg continue 215895b296d0Smrg fi 215995b296d0Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 216095b296d0Smrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 216195b296d0Smrg for search_ext in .la $std_shrext .so .a; do 216295b296d0Smrg # Search the libtool library 216395b296d0Smrg lib="$searchdir/lib${name}${search_ext}" 216495b296d0Smrg if test -f "$lib"; then 216595b296d0Smrg if test "$search_ext" = ".la"; then 216695b296d0Smrg found=yes 216795b296d0Smrg else 216895b296d0Smrg found=no 216995b296d0Smrg fi 217095b296d0Smrg break 2 217195b296d0Smrg fi 217295b296d0Smrg done 217395b296d0Smrg done 217495b296d0Smrg if test "$found" != yes; then 217595b296d0Smrg # deplib doesn't seem to be a libtool library 217695b296d0Smrg if test "$linkmode,$pass" = "prog,link"; then 217795b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 217895b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 217995b296d0Smrg else 218095b296d0Smrg deplibs="$deplib $deplibs" 218195b296d0Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 218295b296d0Smrg fi 218395b296d0Smrg continue 218495b296d0Smrg else # deplib is a libtool library 218595b296d0Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 218695b296d0Smrg # We need to do some special things here, and not later. 218795b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 218895b296d0Smrg case " $predeps $postdeps " in 218995b296d0Smrg *" $deplib "*) 219095b296d0Smrg if (${SED} -e '2q' $lib | 219195b296d0Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 219295b296d0Smrg library_names= 219395b296d0Smrg old_library= 219495b296d0Smrg case $lib in 219595b296d0Smrg */* | *\\*) . $lib ;; 219695b296d0Smrg *) . ./$lib ;; 219795b296d0Smrg esac 219895b296d0Smrg for l in $old_library $library_names; do 219995b296d0Smrg ll="$l" 220095b296d0Smrg done 220195b296d0Smrg if test "X$ll" = "X$old_library" ; then # only static version available 220295b296d0Smrg found=no 220395b296d0Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 220495b296d0Smrg test "X$ladir" = "X$lib" && ladir="." 220595b296d0Smrg lib=$ladir/$old_library 220695b296d0Smrg if test "$linkmode,$pass" = "prog,link"; then 220795b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 220895b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 220995b296d0Smrg else 221095b296d0Smrg deplibs="$deplib $deplibs" 221195b296d0Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 221295b296d0Smrg fi 221395b296d0Smrg continue 221495b296d0Smrg fi 221595b296d0Smrg fi 221695b296d0Smrg ;; 221795b296d0Smrg *) ;; 221895b296d0Smrg esac 221995b296d0Smrg fi 222095b296d0Smrg fi 222195b296d0Smrg ;; # -l 222295b296d0Smrg -L*) 222395b296d0Smrg case $linkmode in 222495b296d0Smrg lib) 222595b296d0Smrg deplibs="$deplib $deplibs" 222695b296d0Smrg test "$pass" = conv && continue 222795b296d0Smrg newdependency_libs="$deplib $newdependency_libs" 222895b296d0Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 222995b296d0Smrg ;; 223095b296d0Smrg prog) 223195b296d0Smrg if test "$pass" = conv; then 223295b296d0Smrg deplibs="$deplib $deplibs" 223395b296d0Smrg continue 223495b296d0Smrg fi 223595b296d0Smrg if test "$pass" = scan; then 223695b296d0Smrg deplibs="$deplib $deplibs" 223795b296d0Smrg else 223895b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 223995b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 224095b296d0Smrg fi 224195b296d0Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 224295b296d0Smrg ;; 224395b296d0Smrg *) 224495b296d0Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 224595b296d0Smrg ;; 224695b296d0Smrg esac # linkmode 224795b296d0Smrg continue 224895b296d0Smrg ;; # -L 224995b296d0Smrg -R*) 225095b296d0Smrg if test "$pass" = link; then 225195b296d0Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 225295b296d0Smrg # Make sure the xrpath contains only unique directories. 225395b296d0Smrg case "$xrpath " in 225495b296d0Smrg *" $dir "*) ;; 225595b296d0Smrg *) xrpath="$xrpath $dir" ;; 225695b296d0Smrg esac 225795b296d0Smrg fi 225895b296d0Smrg deplibs="$deplib $deplibs" 225995b296d0Smrg continue 226095b296d0Smrg ;; 226195b296d0Smrg *.la) lib="$deplib" ;; 226295b296d0Smrg *.$libext) 226395b296d0Smrg if test "$pass" = conv; then 226495b296d0Smrg deplibs="$deplib $deplibs" 226595b296d0Smrg continue 226695b296d0Smrg fi 226795b296d0Smrg case $linkmode in 226895b296d0Smrg lib) 226995b296d0Smrg valid_a_lib=no 227095b296d0Smrg case $deplibs_check_method in 227195b296d0Smrg match_pattern*) 227295b296d0Smrg set dummy $deplibs_check_method 227395b296d0Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 227495b296d0Smrg if eval $echo \"$deplib\" 2>/dev/null \ 227595b296d0Smrg | $SED 10q \ 227695b296d0Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 227795b296d0Smrg valid_a_lib=yes 227895b296d0Smrg fi 227995b296d0Smrg ;; 228095b296d0Smrg pass_all) 228195b296d0Smrg valid_a_lib=yes 228295b296d0Smrg ;; 228395b296d0Smrg esac 228495b296d0Smrg if test "$valid_a_lib" != yes; then 228595b296d0Smrg $echo 228695b296d0Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 228795b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 228895b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 228995b296d0Smrg $echo "*** shared version of the library, which you do not appear to have" 229095b296d0Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 229195b296d0Smrg $echo "*** that it is just a static archive that I should not used here." 229295b296d0Smrg else 229395b296d0Smrg $echo 229495b296d0Smrg $echo "*** Warning: Linking the shared library $output against the" 229595b296d0Smrg $echo "*** static library $deplib is not portable!" 229695b296d0Smrg deplibs="$deplib $deplibs" 229795b296d0Smrg fi 229895b296d0Smrg continue 229995b296d0Smrg ;; 230095b296d0Smrg prog) 230195b296d0Smrg if test "$pass" != link; then 230295b296d0Smrg deplibs="$deplib $deplibs" 230395b296d0Smrg else 230495b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 230595b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 230695b296d0Smrg fi 230795b296d0Smrg continue 230895b296d0Smrg ;; 230995b296d0Smrg esac # linkmode 231095b296d0Smrg ;; # *.$libext 231195b296d0Smrg *.lo | *.$objext) 231295b296d0Smrg if test "$pass" = conv; then 231395b296d0Smrg deplibs="$deplib $deplibs" 231495b296d0Smrg elif test "$linkmode" = prog; then 231595b296d0Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 231695b296d0Smrg # If there is no dlopen support or we're linking statically, 231795b296d0Smrg # we need to preload. 231895b296d0Smrg newdlprefiles="$newdlprefiles $deplib" 231995b296d0Smrg compile_deplibs="$deplib $compile_deplibs" 232095b296d0Smrg finalize_deplibs="$deplib $finalize_deplibs" 232195b296d0Smrg else 232295b296d0Smrg newdlfiles="$newdlfiles $deplib" 232395b296d0Smrg fi 232495b296d0Smrg fi 232595b296d0Smrg continue 232695b296d0Smrg ;; 232795b296d0Smrg %DEPLIBS%) 232895b296d0Smrg alldeplibs=yes 232995b296d0Smrg continue 233095b296d0Smrg ;; 233195b296d0Smrg esac # case $deplib 233295b296d0Smrg if test "$found" = yes || test -f "$lib"; then : 233395b296d0Smrg else 233495b296d0Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 233595b296d0Smrg exit $EXIT_FAILURE 233695b296d0Smrg fi 233795b296d0Smrg 233895b296d0Smrg # Check to see that this really is a libtool archive. 233995b296d0Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 234095b296d0Smrg else 234195b296d0Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 234295b296d0Smrg exit $EXIT_FAILURE 234395b296d0Smrg fi 234495b296d0Smrg 234595b296d0Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 234695b296d0Smrg test "X$ladir" = "X$lib" && ladir="." 234795b296d0Smrg 234895b296d0Smrg dlname= 234995b296d0Smrg dlopen= 235095b296d0Smrg dlpreopen= 235195b296d0Smrg libdir= 235295b296d0Smrg library_names= 235395b296d0Smrg old_library= 235495b296d0Smrg # If the library was installed with an old release of libtool, 235595b296d0Smrg # it will not redefine variables installed, or shouldnotlink 235695b296d0Smrg installed=yes 235795b296d0Smrg shouldnotlink=no 235895b296d0Smrg avoidtemprpath= 235995b296d0Smrg 236095b296d0Smrg 236195b296d0Smrg # Read the .la file 236295b296d0Smrg case $lib in 236395b296d0Smrg */* | *\\*) . $lib ;; 236495b296d0Smrg *) . ./$lib ;; 236595b296d0Smrg esac 236695b296d0Smrg 236795b296d0Smrg if test "$linkmode,$pass" = "lib,link" || 236895b296d0Smrg test "$linkmode,$pass" = "prog,scan" || 236995b296d0Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 237095b296d0Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 237195b296d0Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 237295b296d0Smrg fi 237395b296d0Smrg 237495b296d0Smrg if test "$pass" = conv; then 237595b296d0Smrg # Only check for convenience libraries 237695b296d0Smrg deplibs="$lib $deplibs" 237795b296d0Smrg if test -z "$libdir"; then 237895b296d0Smrg if test -z "$old_library"; then 237995b296d0Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 238095b296d0Smrg exit $EXIT_FAILURE 238195b296d0Smrg fi 238295b296d0Smrg # It is a libtool convenience library, so add in its objects. 238395b296d0Smrg convenience="$convenience $ladir/$objdir/$old_library" 238495b296d0Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 238595b296d0Smrg tmp_libs= 238695b296d0Smrg for deplib in $dependency_libs; do 238795b296d0Smrg deplibs="$deplib $deplibs" 238895b296d0Smrg if test "X$duplicate_deps" = "Xyes" ; then 238995b296d0Smrg case "$tmp_libs " in 239095b296d0Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 239195b296d0Smrg esac 239295b296d0Smrg fi 239395b296d0Smrg tmp_libs="$tmp_libs $deplib" 239495b296d0Smrg done 239595b296d0Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 239695b296d0Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 239795b296d0Smrg exit $EXIT_FAILURE 239895b296d0Smrg fi 239995b296d0Smrg continue 240095b296d0Smrg fi # $pass = conv 240195b296d0Smrg 240295b296d0Smrg 240395b296d0Smrg # Get the name of the library we link against. 240495b296d0Smrg linklib= 240595b296d0Smrg for l in $old_library $library_names; do 240695b296d0Smrg linklib="$l" 240795b296d0Smrg done 240895b296d0Smrg if test -z "$linklib"; then 240995b296d0Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 241095b296d0Smrg exit $EXIT_FAILURE 241195b296d0Smrg fi 241295b296d0Smrg 241395b296d0Smrg # This library was specified with -dlopen. 241495b296d0Smrg if test "$pass" = dlopen; then 241595b296d0Smrg if test -z "$libdir"; then 241695b296d0Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 241795b296d0Smrg exit $EXIT_FAILURE 241895b296d0Smrg fi 241995b296d0Smrg if test -z "$dlname" || 242095b296d0Smrg test "$dlopen_support" != yes || 242195b296d0Smrg test "$build_libtool_libs" = no; then 242295b296d0Smrg # If there is no dlname, no dlopen support or we're linking 242395b296d0Smrg # statically, we need to preload. We also need to preload any 242495b296d0Smrg # dependent libraries so libltdl's deplib preloader doesn't 242595b296d0Smrg # bomb out in the load deplibs phase. 242695b296d0Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 242795b296d0Smrg else 242895b296d0Smrg newdlfiles="$newdlfiles $lib" 242995b296d0Smrg fi 243095b296d0Smrg continue 243195b296d0Smrg fi # $pass = dlopen 243295b296d0Smrg 243395b296d0Smrg # We need an absolute path. 243495b296d0Smrg case $ladir in 243595b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 243695b296d0Smrg *) 243795b296d0Smrg abs_ladir=`cd "$ladir" && pwd` 243895b296d0Smrg if test -z "$abs_ladir"; then 243995b296d0Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 244095b296d0Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 244195b296d0Smrg abs_ladir="$ladir" 244295b296d0Smrg fi 244395b296d0Smrg ;; 244495b296d0Smrg esac 244595b296d0Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 244695b296d0Smrg 244795b296d0Smrg # Find the relevant object directory and library name. 244895b296d0Smrg if test "X$installed" = Xyes; then 244995b296d0Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 245095b296d0Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 245195b296d0Smrg dir="$ladir" 245295b296d0Smrg absdir="$abs_ladir" 245395b296d0Smrg libdir="$abs_ladir" 245495b296d0Smrg else 245595b296d0Smrg dir="$libdir" 245695b296d0Smrg absdir="$libdir" 245795b296d0Smrg fi 245895b296d0Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 245995b296d0Smrg else 246095b296d0Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 246195b296d0Smrg dir="$ladir" 246295b296d0Smrg absdir="$abs_ladir" 246395b296d0Smrg # Remove this search path later 246495b296d0Smrg notinst_path="$notinst_path $abs_ladir" 246595b296d0Smrg else 246695b296d0Smrg dir="$ladir/$objdir" 246795b296d0Smrg absdir="$abs_ladir/$objdir" 246895b296d0Smrg # Remove this search path later 246995b296d0Smrg notinst_path="$notinst_path $abs_ladir" 247095b296d0Smrg fi 247195b296d0Smrg fi # $installed = yes 247295b296d0Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 247395b296d0Smrg 247495b296d0Smrg # This library was specified with -dlpreopen. 247595b296d0Smrg if test "$pass" = dlpreopen; then 247695b296d0Smrg if test -z "$libdir"; then 247795b296d0Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 247895b296d0Smrg exit $EXIT_FAILURE 247995b296d0Smrg fi 248095b296d0Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 248195b296d0Smrg # are required to link). 248295b296d0Smrg if test -n "$old_library"; then 248395b296d0Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 248495b296d0Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 248595b296d0Smrg elif test -n "$dlname"; then 248695b296d0Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 248795b296d0Smrg else 248895b296d0Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 248995b296d0Smrg fi 249095b296d0Smrg fi # $pass = dlpreopen 249195b296d0Smrg 249295b296d0Smrg if test -z "$libdir"; then 249395b296d0Smrg # Link the convenience library 249495b296d0Smrg if test "$linkmode" = lib; then 249595b296d0Smrg deplibs="$dir/$old_library $deplibs" 249695b296d0Smrg elif test "$linkmode,$pass" = "prog,link"; then 249795b296d0Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 249895b296d0Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 249995b296d0Smrg else 250095b296d0Smrg deplibs="$lib $deplibs" # used for prog,scan pass 250195b296d0Smrg fi 250295b296d0Smrg continue 250395b296d0Smrg fi 250495b296d0Smrg 250595b296d0Smrg 250695b296d0Smrg if test "$linkmode" = prog && test "$pass" != link; then 250795b296d0Smrg newlib_search_path="$newlib_search_path $ladir" 250895b296d0Smrg deplibs="$lib $deplibs" 250995b296d0Smrg 251095b296d0Smrg linkalldeplibs=no 251195b296d0Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 251295b296d0Smrg test "$build_libtool_libs" = no; then 251395b296d0Smrg linkalldeplibs=yes 251495b296d0Smrg fi 251595b296d0Smrg 251695b296d0Smrg tmp_libs= 251795b296d0Smrg for deplib in $dependency_libs; do 251895b296d0Smrg case $deplib in 251995b296d0Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 252095b296d0Smrg esac 252195b296d0Smrg # Need to link against all dependency_libs? 252295b296d0Smrg if test "$linkalldeplibs" = yes; then 252395b296d0Smrg deplibs="$deplib $deplibs" 252495b296d0Smrg else 252595b296d0Smrg # Need to hardcode shared library paths 252695b296d0Smrg # or/and link against static libraries 252795b296d0Smrg newdependency_libs="$deplib $newdependency_libs" 252895b296d0Smrg fi 252995b296d0Smrg if test "X$duplicate_deps" = "Xyes" ; then 253095b296d0Smrg case "$tmp_libs " in 253195b296d0Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 253295b296d0Smrg esac 253395b296d0Smrg fi 253495b296d0Smrg tmp_libs="$tmp_libs $deplib" 253595b296d0Smrg done # for deplib 253695b296d0Smrg continue 253795b296d0Smrg fi # $linkmode = prog... 253895b296d0Smrg 253995b296d0Smrg if test "$linkmode,$pass" = "prog,link"; then 254095b296d0Smrg if test -n "$library_names" && 254195b296d0Smrg { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 254295b296d0Smrg # We need to hardcode the library path 254395b296d0Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 254495b296d0Smrg # Make sure the rpath contains only unique directories. 254595b296d0Smrg case "$temp_rpath " in 254695b296d0Smrg *" $dir "*) ;; 254795b296d0Smrg *" $absdir "*) ;; 254895b296d0Smrg *) temp_rpath="$temp_rpath $absdir" ;; 254995b296d0Smrg esac 255095b296d0Smrg fi 255195b296d0Smrg 255295b296d0Smrg # Hardcode the library path. 255395b296d0Smrg # Skip directories that are in the system default run-time 255495b296d0Smrg # search path. 255595b296d0Smrg case " $sys_lib_dlsearch_path " in 255695b296d0Smrg *" $absdir "*) ;; 255795b296d0Smrg *) 255895b296d0Smrg case "$compile_rpath " in 255995b296d0Smrg *" $absdir "*) ;; 256095b296d0Smrg *) compile_rpath="$compile_rpath $absdir" 256195b296d0Smrg esac 256295b296d0Smrg ;; 256395b296d0Smrg esac 256495b296d0Smrg case " $sys_lib_dlsearch_path " in 256595b296d0Smrg *" $libdir "*) ;; 256695b296d0Smrg *) 256795b296d0Smrg case "$finalize_rpath " in 256895b296d0Smrg *" $libdir "*) ;; 256995b296d0Smrg *) finalize_rpath="$finalize_rpath $libdir" 257095b296d0Smrg esac 257195b296d0Smrg ;; 257295b296d0Smrg esac 257395b296d0Smrg fi # $linkmode,$pass = prog,link... 257495b296d0Smrg 257595b296d0Smrg if test "$alldeplibs" = yes && 257695b296d0Smrg { test "$deplibs_check_method" = pass_all || 257795b296d0Smrg { test "$build_libtool_libs" = yes && 257895b296d0Smrg test -n "$library_names"; }; }; then 257995b296d0Smrg # We only need to search for static libraries 258095b296d0Smrg continue 258195b296d0Smrg fi 258295b296d0Smrg fi 258395b296d0Smrg 258495b296d0Smrg link_static=no # Whether the deplib will be linked statically 258595b296d0Smrg use_static_libs=$prefer_static_libs 258695b296d0Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 258795b296d0Smrg use_static_libs=no 258895b296d0Smrg fi 258995b296d0Smrg if test -n "$library_names" && 259095b296d0Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 259195b296d0Smrg if test "$installed" = no; then 259295b296d0Smrg notinst_deplibs="$notinst_deplibs $lib" 259395b296d0Smrg need_relink=yes 259495b296d0Smrg fi 259595b296d0Smrg # This is a shared library 259695b296d0Smrg 259795b296d0Smrg # Warn about portability, can't link against -module's on 259895b296d0Smrg # some systems (darwin) 259995b296d0Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 260095b296d0Smrg $echo 260195b296d0Smrg if test "$linkmode" = prog; then 260295b296d0Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 260395b296d0Smrg else 260495b296d0Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 260595b296d0Smrg fi 260695b296d0Smrg $echo "*** $linklib is not portable!" 260795b296d0Smrg fi 260895b296d0Smrg if test "$linkmode" = lib && 260995b296d0Smrg test "$hardcode_into_libs" = yes; then 261095b296d0Smrg # Hardcode the library path. 261195b296d0Smrg # Skip directories that are in the system default run-time 261295b296d0Smrg # search path. 261395b296d0Smrg case " $sys_lib_dlsearch_path " in 261495b296d0Smrg *" $absdir "*) ;; 261595b296d0Smrg *) 261695b296d0Smrg case "$compile_rpath " in 261795b296d0Smrg *" $absdir "*) ;; 261895b296d0Smrg *) compile_rpath="$compile_rpath $absdir" 261995b296d0Smrg esac 262095b296d0Smrg ;; 262195b296d0Smrg esac 262295b296d0Smrg case " $sys_lib_dlsearch_path " in 262395b296d0Smrg *" $libdir "*) ;; 262495b296d0Smrg *) 262595b296d0Smrg case "$finalize_rpath " in 262695b296d0Smrg *" $libdir "*) ;; 262795b296d0Smrg *) finalize_rpath="$finalize_rpath $libdir" 262895b296d0Smrg esac 262995b296d0Smrg ;; 263095b296d0Smrg esac 263195b296d0Smrg fi 263295b296d0Smrg 263395b296d0Smrg if test -n "$old_archive_from_expsyms_cmds"; then 263495b296d0Smrg # figure out the soname 263595b296d0Smrg set dummy $library_names 263695b296d0Smrg realname="$2" 263795b296d0Smrg shift; shift 263895b296d0Smrg libname=`eval \\$echo \"$libname_spec\"` 263995b296d0Smrg # use dlname if we got it. it's perfectly good, no? 264095b296d0Smrg if test -n "$dlname"; then 264195b296d0Smrg soname="$dlname" 264295b296d0Smrg elif test -n "$soname_spec"; then 264395b296d0Smrg # bleh windows 264495b296d0Smrg case $host in 264595b296d0Smrg *cygwin* | mingw*) 264695b296d0Smrg major=`expr $current - $age` 264795b296d0Smrg versuffix="-$major" 264895b296d0Smrg ;; 264995b296d0Smrg esac 265095b296d0Smrg eval soname=\"$soname_spec\" 265195b296d0Smrg else 265295b296d0Smrg soname="$realname" 265395b296d0Smrg fi 265495b296d0Smrg 265595b296d0Smrg # Make a new name for the extract_expsyms_cmds to use 265695b296d0Smrg soroot="$soname" 265795b296d0Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 265895b296d0Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 265995b296d0Smrg 266095b296d0Smrg # If the library has no export list, then create one now 266195b296d0Smrg if test -f "$output_objdir/$soname-def"; then : 266295b296d0Smrg else 266395b296d0Smrg $show "extracting exported symbol list from \`$soname'" 266495b296d0Smrg save_ifs="$IFS"; IFS='~' 266595b296d0Smrg cmds=$extract_expsyms_cmds 266695b296d0Smrg for cmd in $cmds; do 266795b296d0Smrg IFS="$save_ifs" 266895b296d0Smrg eval cmd=\"$cmd\" 266995b296d0Smrg $show "$cmd" 267095b296d0Smrg $run eval "$cmd" || exit $? 267195b296d0Smrg done 267295b296d0Smrg IFS="$save_ifs" 267395b296d0Smrg fi 267495b296d0Smrg 267595b296d0Smrg # Create $newlib 267695b296d0Smrg if test -f "$output_objdir/$newlib"; then :; else 267795b296d0Smrg $show "generating import library for \`$soname'" 267895b296d0Smrg save_ifs="$IFS"; IFS='~' 267995b296d0Smrg cmds=$old_archive_from_expsyms_cmds 268095b296d0Smrg for cmd in $cmds; do 268195b296d0Smrg IFS="$save_ifs" 268295b296d0Smrg eval cmd=\"$cmd\" 268395b296d0Smrg $show "$cmd" 268495b296d0Smrg $run eval "$cmd" || exit $? 268595b296d0Smrg done 268695b296d0Smrg IFS="$save_ifs" 268795b296d0Smrg fi 268895b296d0Smrg # make sure the library variables are pointing to the new library 268995b296d0Smrg dir=$output_objdir 269095b296d0Smrg linklib=$newlib 269195b296d0Smrg fi # test -n "$old_archive_from_expsyms_cmds" 269295b296d0Smrg 269395b296d0Smrg if test "$linkmode" = prog || test "$mode" != relink; then 269495b296d0Smrg add_shlibpath= 269595b296d0Smrg add_dir= 269695b296d0Smrg add= 269795b296d0Smrg lib_linked=yes 269895b296d0Smrg case $hardcode_action in 269995b296d0Smrg immediate | unsupported) 270095b296d0Smrg if test "$hardcode_direct" = no; then 270195b296d0Smrg add="$dir/$linklib" 270295b296d0Smrg case $host in 270395b296d0Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 270495b296d0Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 270595b296d0Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 270695b296d0Smrg *-*-unixware7*) add_dir="-L$dir" ;; 270795b296d0Smrg *-*-darwin* ) 270895b296d0Smrg # if the lib is a module then we can not link against 270995b296d0Smrg # it, someone is ignoring the new warnings I added 271095b296d0Smrg if /usr/bin/file -L $add 2> /dev/null | 271195b296d0Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 271295b296d0Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 271395b296d0Smrg if test -z "$old_library" ; then 271495b296d0Smrg $echo 271595b296d0Smrg $echo "** And there doesn't seem to be a static archive available" 271695b296d0Smrg $echo "** The link will probably fail, sorry" 271795b296d0Smrg else 271895b296d0Smrg add="$dir/$old_library" 271995b296d0Smrg fi 272095b296d0Smrg fi 272195b296d0Smrg esac 272295b296d0Smrg elif test "$hardcode_minus_L" = no; then 272395b296d0Smrg case $host in 272495b296d0Smrg *-*-sunos*) add_shlibpath="$dir" ;; 272595b296d0Smrg esac 272695b296d0Smrg add_dir="-L$dir" 272795b296d0Smrg add="-l$name" 272895b296d0Smrg elif test "$hardcode_shlibpath_var" = no; then 272995b296d0Smrg add_shlibpath="$dir" 273095b296d0Smrg add="-l$name" 273195b296d0Smrg else 273295b296d0Smrg lib_linked=no 273395b296d0Smrg fi 273495b296d0Smrg ;; 273595b296d0Smrg relink) 273695b296d0Smrg if test "$hardcode_direct" = yes; then 273795b296d0Smrg add="$dir/$linklib" 273895b296d0Smrg elif test "$hardcode_minus_L" = yes; then 273995b296d0Smrg add_dir="-L$dir" 274095b296d0Smrg # Try looking first in the location we're being installed to. 274195b296d0Smrg if test -n "$inst_prefix_dir"; then 274295b296d0Smrg case $libdir in 274395b296d0Smrg [\\/]*) 274495b296d0Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 274595b296d0Smrg ;; 274695b296d0Smrg esac 274795b296d0Smrg fi 274895b296d0Smrg add="-l$name" 274995b296d0Smrg elif test "$hardcode_shlibpath_var" = yes; then 275095b296d0Smrg add_shlibpath="$dir" 275195b296d0Smrg add="-l$name" 275295b296d0Smrg else 275395b296d0Smrg lib_linked=no 275495b296d0Smrg fi 275595b296d0Smrg ;; 275695b296d0Smrg *) lib_linked=no ;; 275795b296d0Smrg esac 275895b296d0Smrg 275995b296d0Smrg if test "$lib_linked" != yes; then 276095b296d0Smrg $echo "$modename: configuration error: unsupported hardcode properties" 276195b296d0Smrg exit $EXIT_FAILURE 276295b296d0Smrg fi 276395b296d0Smrg 276495b296d0Smrg if test -n "$add_shlibpath"; then 276595b296d0Smrg case :$compile_shlibpath: in 276695b296d0Smrg *":$add_shlibpath:"*) ;; 276795b296d0Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 276895b296d0Smrg esac 276995b296d0Smrg fi 277095b296d0Smrg if test "$linkmode" = prog; then 277195b296d0Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 277295b296d0Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 277395b296d0Smrg else 277495b296d0Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 277595b296d0Smrg test -n "$add" && deplibs="$add $deplibs" 277695b296d0Smrg if test "$hardcode_direct" != yes && \ 277795b296d0Smrg test "$hardcode_minus_L" != yes && \ 277895b296d0Smrg test "$hardcode_shlibpath_var" = yes; then 277995b296d0Smrg case :$finalize_shlibpath: in 278095b296d0Smrg *":$libdir:"*) ;; 278195b296d0Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 278295b296d0Smrg esac 278395b296d0Smrg fi 278495b296d0Smrg fi 278595b296d0Smrg fi 278695b296d0Smrg 278795b296d0Smrg if test "$linkmode" = prog || test "$mode" = relink; then 278895b296d0Smrg add_shlibpath= 278995b296d0Smrg add_dir= 279095b296d0Smrg add= 279195b296d0Smrg # Finalize command for both is simple: just hardcode it. 279295b296d0Smrg if test "$hardcode_direct" = yes; then 279395b296d0Smrg add="$libdir/$linklib" 279495b296d0Smrg elif test "$hardcode_minus_L" = yes; then 279595b296d0Smrg add_dir="-L$libdir" 279695b296d0Smrg add="-l$name" 279795b296d0Smrg elif test "$hardcode_shlibpath_var" = yes; then 279895b296d0Smrg case :$finalize_shlibpath: in 279995b296d0Smrg *":$libdir:"*) ;; 280095b296d0Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 280195b296d0Smrg esac 280295b296d0Smrg add="-l$name" 280395b296d0Smrg elif test "$hardcode_automatic" = yes; then 280495b296d0Smrg if test -n "$inst_prefix_dir" && 280595b296d0Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 280695b296d0Smrg add="$inst_prefix_dir$libdir/$linklib" 280795b296d0Smrg else 280895b296d0Smrg add="$libdir/$linklib" 280995b296d0Smrg fi 281095b296d0Smrg else 281195b296d0Smrg # We cannot seem to hardcode it, guess we'll fake it. 281295b296d0Smrg add_dir="-L$libdir" 281395b296d0Smrg # Try looking first in the location we're being installed to. 281495b296d0Smrg if test -n "$inst_prefix_dir"; then 281595b296d0Smrg case $libdir in 281695b296d0Smrg [\\/]*) 281795b296d0Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 281895b296d0Smrg ;; 281995b296d0Smrg esac 282095b296d0Smrg fi 282195b296d0Smrg add="-l$name" 282295b296d0Smrg fi 282395b296d0Smrg 282495b296d0Smrg if test "$linkmode" = prog; then 282595b296d0Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 282695b296d0Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 282795b296d0Smrg else 282895b296d0Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 282995b296d0Smrg test -n "$add" && deplibs="$add $deplibs" 283095b296d0Smrg fi 283195b296d0Smrg fi 283295b296d0Smrg elif test "$linkmode" = prog; then 283395b296d0Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 283495b296d0Smrg # is not unsupported. This is valid on all known static and 283595b296d0Smrg # shared platforms. 283695b296d0Smrg if test "$hardcode_direct" != unsupported; then 283795b296d0Smrg test -n "$old_library" && linklib="$old_library" 283895b296d0Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 283995b296d0Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 284095b296d0Smrg else 284195b296d0Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 284295b296d0Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 284395b296d0Smrg fi 284495b296d0Smrg elif test "$build_libtool_libs" = yes; then 284595b296d0Smrg # Not a shared library 284695b296d0Smrg if test "$deplibs_check_method" != pass_all; then 284795b296d0Smrg # We're trying link a shared library against a static one 284895b296d0Smrg # but the system doesn't support it. 284995b296d0Smrg 285095b296d0Smrg # Just print a warning and add the library to dependency_libs so 285195b296d0Smrg # that the program can be linked against the static library. 285295b296d0Smrg $echo 285395b296d0Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 285495b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 285595b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 285695b296d0Smrg $echo "*** shared version of the library, which you do not appear to have." 285795b296d0Smrg if test "$module" = yes; then 285895b296d0Smrg $echo "*** But as you try to build a module library, libtool will still create " 285995b296d0Smrg $echo "*** a static module, that should work as long as the dlopening application" 286095b296d0Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 286195b296d0Smrg if test -z "$global_symbol_pipe"; then 286295b296d0Smrg $echo 286395b296d0Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 286495b296d0Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 286595b296d0Smrg $echo "*** not find such a program. So, this module is probably useless." 286695b296d0Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 286795b296d0Smrg fi 286895b296d0Smrg if test "$build_old_libs" = no; then 286995b296d0Smrg build_libtool_libs=module 287095b296d0Smrg build_old_libs=yes 287195b296d0Smrg else 287295b296d0Smrg build_libtool_libs=no 287395b296d0Smrg fi 287495b296d0Smrg fi 287595b296d0Smrg else 287695b296d0Smrg deplibs="$dir/$old_library $deplibs" 287795b296d0Smrg link_static=yes 287895b296d0Smrg fi 287995b296d0Smrg fi # link shared/static library? 288095b296d0Smrg 288195b296d0Smrg if test "$linkmode" = lib; then 288295b296d0Smrg if test -n "$dependency_libs" && 288395b296d0Smrg { test "$hardcode_into_libs" != yes || 288495b296d0Smrg test "$build_old_libs" = yes || 288595b296d0Smrg test "$link_static" = yes; }; then 288695b296d0Smrg # Extract -R from dependency_libs 288795b296d0Smrg temp_deplibs= 288895b296d0Smrg for libdir in $dependency_libs; do 288995b296d0Smrg case $libdir in 289095b296d0Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 289195b296d0Smrg case " $xrpath " in 289295b296d0Smrg *" $temp_xrpath "*) ;; 289395b296d0Smrg *) xrpath="$xrpath $temp_xrpath";; 289495b296d0Smrg esac;; 289595b296d0Smrg *) temp_deplibs="$temp_deplibs $libdir";; 289695b296d0Smrg esac 289795b296d0Smrg done 289895b296d0Smrg dependency_libs="$temp_deplibs" 289995b296d0Smrg fi 290095b296d0Smrg 290195b296d0Smrg newlib_search_path="$newlib_search_path $absdir" 290295b296d0Smrg # Link against this library 290395b296d0Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 290495b296d0Smrg # ... and its dependency_libs 290595b296d0Smrg tmp_libs= 290695b296d0Smrg for deplib in $dependency_libs; do 290795b296d0Smrg newdependency_libs="$deplib $newdependency_libs" 290895b296d0Smrg if test "X$duplicate_deps" = "Xyes" ; then 290995b296d0Smrg case "$tmp_libs " in 291095b296d0Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 291195b296d0Smrg esac 291295b296d0Smrg fi 291395b296d0Smrg tmp_libs="$tmp_libs $deplib" 291495b296d0Smrg done 291595b296d0Smrg 291695b296d0Smrg if test "$link_all_deplibs" != no; then 291795b296d0Smrg # Add the search paths of all dependency libraries 291895b296d0Smrg for deplib in $dependency_libs; do 291995b296d0Smrg case $deplib in 292095b296d0Smrg -L*) path="$deplib" ;; 292195b296d0Smrg *.la) 292295b296d0Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 292395b296d0Smrg test "X$dir" = "X$deplib" && dir="." 292495b296d0Smrg # We need an absolute path. 292595b296d0Smrg case $dir in 292695b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 292795b296d0Smrg *) 292895b296d0Smrg absdir=`cd "$dir" && pwd` 292995b296d0Smrg if test -z "$absdir"; then 293095b296d0Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 293195b296d0Smrg absdir="$dir" 293295b296d0Smrg fi 293395b296d0Smrg ;; 293495b296d0Smrg esac 293595b296d0Smrg if grep "^installed=no" $deplib > /dev/null; then 293695b296d0Smrg path="$absdir/$objdir" 293795b296d0Smrg else 293895b296d0Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 293995b296d0Smrg if test -z "$libdir"; then 294095b296d0Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 294195b296d0Smrg exit $EXIT_FAILURE 294295b296d0Smrg fi 294395b296d0Smrg if test "$absdir" != "$libdir"; then 294495b296d0Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 294595b296d0Smrg fi 294695b296d0Smrg path="$absdir" 294795b296d0Smrg fi 294895b296d0Smrg depdepl= 294995b296d0Smrg case $host in 295095b296d0Smrg *-*-darwin*) 295195b296d0Smrg # we do not want to link against static libs, 295295b296d0Smrg # but need to link against shared 295395b296d0Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 295495b296d0Smrg if test -n "$deplibrary_names" ; then 295595b296d0Smrg for tmp in $deplibrary_names ; do 295695b296d0Smrg depdepl=$tmp 295795b296d0Smrg done 295895b296d0Smrg if test -f "$path/$depdepl" ; then 295995b296d0Smrg depdepl="$path/$depdepl" 296095b296d0Smrg fi 296195b296d0Smrg # do not add paths which are already there 296295b296d0Smrg case " $newlib_search_path " in 296395b296d0Smrg *" $path "*) ;; 296495b296d0Smrg *) newlib_search_path="$newlib_search_path $path";; 296595b296d0Smrg esac 296695b296d0Smrg fi 296795b296d0Smrg path="" 296895b296d0Smrg ;; 296995b296d0Smrg *) 297095b296d0Smrg path="-L$path" 297195b296d0Smrg ;; 297295b296d0Smrg esac 297395b296d0Smrg ;; 297495b296d0Smrg -l*) 297595b296d0Smrg case $host in 297695b296d0Smrg *-*-darwin*) 297795b296d0Smrg # Again, we only want to link against shared libraries 297895b296d0Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 297995b296d0Smrg for tmp in $newlib_search_path ; do 298095b296d0Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 298195b296d0Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 298295b296d0Smrg break 298395b296d0Smrg fi 298495b296d0Smrg done 298595b296d0Smrg path="" 298695b296d0Smrg ;; 298795b296d0Smrg *) continue ;; 298895b296d0Smrg esac 298995b296d0Smrg ;; 299095b296d0Smrg *) continue ;; 299195b296d0Smrg esac 299295b296d0Smrg case " $deplibs " in 299395b296d0Smrg *" $path "*) ;; 299495b296d0Smrg *) deplibs="$path $deplibs" ;; 299595b296d0Smrg esac 299695b296d0Smrg case " $deplibs " in 299795b296d0Smrg *" $depdepl "*) ;; 299895b296d0Smrg *) deplibs="$depdepl $deplibs" ;; 299995b296d0Smrg esac 300095b296d0Smrg done 300195b296d0Smrg fi # link_all_deplibs != no 300295b296d0Smrg fi # linkmode = lib 300395b296d0Smrg done # for deplib in $libs 300495b296d0Smrg dependency_libs="$newdependency_libs" 300595b296d0Smrg if test "$pass" = dlpreopen; then 300695b296d0Smrg # Link the dlpreopened libraries before other libraries 300795b296d0Smrg for deplib in $save_deplibs; do 300895b296d0Smrg deplibs="$deplib $deplibs" 300995b296d0Smrg done 301095b296d0Smrg fi 301195b296d0Smrg if test "$pass" != dlopen; then 301295b296d0Smrg if test "$pass" != conv; then 301395b296d0Smrg # Make sure lib_search_path contains only unique directories. 301495b296d0Smrg lib_search_path= 301595b296d0Smrg for dir in $newlib_search_path; do 301695b296d0Smrg case "$lib_search_path " in 301795b296d0Smrg *" $dir "*) ;; 301895b296d0Smrg *) lib_search_path="$lib_search_path $dir" ;; 301995b296d0Smrg esac 302095b296d0Smrg done 302195b296d0Smrg newlib_search_path= 302295b296d0Smrg fi 302395b296d0Smrg 302495b296d0Smrg if test "$linkmode,$pass" != "prog,link"; then 302595b296d0Smrg vars="deplibs" 302695b296d0Smrg else 302795b296d0Smrg vars="compile_deplibs finalize_deplibs" 302895b296d0Smrg fi 302995b296d0Smrg for var in $vars dependency_libs; do 303095b296d0Smrg # Add libraries to $var in reverse order 303195b296d0Smrg eval tmp_libs=\"\$$var\" 303295b296d0Smrg new_libs= 303395b296d0Smrg for deplib in $tmp_libs; do 303495b296d0Smrg # FIXME: Pedantically, this is the right thing to do, so 303595b296d0Smrg # that some nasty dependency loop isn't accidentally 303695b296d0Smrg # broken: 303795b296d0Smrg #new_libs="$deplib $new_libs" 303895b296d0Smrg # Pragmatically, this seems to cause very few problems in 303995b296d0Smrg # practice: 304095b296d0Smrg case $deplib in 304195b296d0Smrg -L*) new_libs="$deplib $new_libs" ;; 304295b296d0Smrg -R*) ;; 304395b296d0Smrg *) 304495b296d0Smrg # And here is the reason: when a library appears more 304595b296d0Smrg # than once as an explicit dependence of a library, or 304695b296d0Smrg # is implicitly linked in more than once by the 304795b296d0Smrg # compiler, it is considered special, and multiple 304895b296d0Smrg # occurrences thereof are not removed. Compare this 304995b296d0Smrg # with having the same library being listed as a 305095b296d0Smrg # dependency of multiple other libraries: in this case, 305195b296d0Smrg # we know (pedantically, we assume) the library does not 305295b296d0Smrg # need to be listed more than once, so we keep only the 305395b296d0Smrg # last copy. This is not always right, but it is rare 305495b296d0Smrg # enough that we require users that really mean to play 305595b296d0Smrg # such unportable linking tricks to link the library 305695b296d0Smrg # using -Wl,-lname, so that libtool does not consider it 305795b296d0Smrg # for duplicate removal. 305895b296d0Smrg case " $specialdeplibs " in 305995b296d0Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 306095b296d0Smrg *) 306195b296d0Smrg case " $new_libs " in 306295b296d0Smrg *" $deplib "*) ;; 306395b296d0Smrg *) new_libs="$deplib $new_libs" ;; 306495b296d0Smrg esac 306595b296d0Smrg ;; 306695b296d0Smrg esac 306795b296d0Smrg ;; 306895b296d0Smrg esac 306995b296d0Smrg done 307095b296d0Smrg tmp_libs= 307195b296d0Smrg for deplib in $new_libs; do 307295b296d0Smrg case $deplib in 307395b296d0Smrg -L*) 307495b296d0Smrg case " $tmp_libs " in 307595b296d0Smrg *" $deplib "*) ;; 307695b296d0Smrg *) tmp_libs="$tmp_libs $deplib" ;; 307795b296d0Smrg esac 307895b296d0Smrg ;; 307995b296d0Smrg *) tmp_libs="$tmp_libs $deplib" ;; 308095b296d0Smrg esac 308195b296d0Smrg done 308295b296d0Smrg eval $var=\"$tmp_libs\" 308395b296d0Smrg done # for var 308495b296d0Smrg fi 308595b296d0Smrg # Last step: remove runtime libs from dependency_libs 308695b296d0Smrg # (they stay in deplibs) 308795b296d0Smrg tmp_libs= 308895b296d0Smrg for i in $dependency_libs ; do 308995b296d0Smrg case " $predeps $postdeps $compiler_lib_search_path " in 309095b296d0Smrg *" $i "*) 309195b296d0Smrg i="" 309295b296d0Smrg ;; 309395b296d0Smrg esac 309495b296d0Smrg if test -n "$i" ; then 309595b296d0Smrg tmp_libs="$tmp_libs $i" 309695b296d0Smrg fi 309795b296d0Smrg done 309895b296d0Smrg dependency_libs=$tmp_libs 309995b296d0Smrg done # for pass 310095b296d0Smrg if test "$linkmode" = prog; then 310195b296d0Smrg dlfiles="$newdlfiles" 310295b296d0Smrg dlprefiles="$newdlprefiles" 310395b296d0Smrg fi 310495b296d0Smrg 310595b296d0Smrg case $linkmode in 310695b296d0Smrg oldlib) 310795b296d0Smrg if test -n "$deplibs"; then 310895b296d0Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 310995b296d0Smrg fi 311095b296d0Smrg 311195b296d0Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 311295b296d0Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 311395b296d0Smrg fi 311495b296d0Smrg 311595b296d0Smrg if test -n "$rpath"; then 311695b296d0Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 311795b296d0Smrg fi 311895b296d0Smrg 311995b296d0Smrg if test -n "$xrpath"; then 312095b296d0Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 312195b296d0Smrg fi 312295b296d0Smrg 312395b296d0Smrg if test -n "$vinfo"; then 312495b296d0Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 312595b296d0Smrg fi 312695b296d0Smrg 312795b296d0Smrg if test -n "$release"; then 312895b296d0Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 312995b296d0Smrg fi 313095b296d0Smrg 313195b296d0Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 313295b296d0Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 313395b296d0Smrg fi 313495b296d0Smrg 313595b296d0Smrg # Now set the variables for building old libraries. 313695b296d0Smrg build_libtool_libs=no 313795b296d0Smrg oldlibs="$output" 313895b296d0Smrg objs="$objs$old_deplibs" 313995b296d0Smrg ;; 314095b296d0Smrg 314195b296d0Smrg lib) 314295b296d0Smrg # Make sure we only generate libraries of the form `libNAME.la'. 314395b296d0Smrg case $outputname in 314495b296d0Smrg lib*) 314595b296d0Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 314695b296d0Smrg eval shared_ext=\"$shrext_cmds\" 314795b296d0Smrg eval libname=\"$libname_spec\" 314895b296d0Smrg ;; 314995b296d0Smrg *) 315095b296d0Smrg if test "$module" = no; then 315195b296d0Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 315295b296d0Smrg $echo "$help" 1>&2 315395b296d0Smrg exit $EXIT_FAILURE 315495b296d0Smrg fi 315595b296d0Smrg if test "$need_lib_prefix" != no; then 315695b296d0Smrg # Add the "lib" prefix for modules if required 315795b296d0Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 315895b296d0Smrg eval shared_ext=\"$shrext_cmds\" 315995b296d0Smrg eval libname=\"$libname_spec\" 316095b296d0Smrg else 316195b296d0Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 316295b296d0Smrg fi 316395b296d0Smrg ;; 316495b296d0Smrg esac 316595b296d0Smrg 316695b296d0Smrg if test -n "$objs"; then 316795b296d0Smrg if test "$deplibs_check_method" != pass_all; then 316895b296d0Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 316995b296d0Smrg exit $EXIT_FAILURE 317095b296d0Smrg else 317195b296d0Smrg $echo 317295b296d0Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 317395b296d0Smrg $echo "*** objects $objs is not portable!" 317495b296d0Smrg libobjs="$libobjs $objs" 317595b296d0Smrg fi 317695b296d0Smrg fi 317795b296d0Smrg 317895b296d0Smrg if test "$dlself" != no; then 317995b296d0Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 318095b296d0Smrg fi 318195b296d0Smrg 318295b296d0Smrg set dummy $rpath 318395b296d0Smrg if test "$#" -gt 2; then 318495b296d0Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 318595b296d0Smrg fi 318695b296d0Smrg install_libdir="$2" 318795b296d0Smrg 318895b296d0Smrg oldlibs= 318995b296d0Smrg if test -z "$rpath"; then 319095b296d0Smrg if test "$build_libtool_libs" = yes; then 319195b296d0Smrg # Building a libtool convenience library. 319295b296d0Smrg # Some compilers have problems with a `.al' extension so 319395b296d0Smrg # convenience libraries should have the same extension an 319495b296d0Smrg # archive normally would. 319595b296d0Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 319695b296d0Smrg build_libtool_libs=convenience 319795b296d0Smrg build_old_libs=yes 319895b296d0Smrg fi 319995b296d0Smrg 320095b296d0Smrg if test -n "$vinfo"; then 320195b296d0Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 320295b296d0Smrg fi 320395b296d0Smrg 320495b296d0Smrg if test -n "$release"; then 320595b296d0Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 320695b296d0Smrg fi 320795b296d0Smrg else 320895b296d0Smrg 320995b296d0Smrg # Parse the version information argument. 321095b296d0Smrg save_ifs="$IFS"; IFS=':' 321195b296d0Smrg set dummy $vinfo 0 0 0 321295b296d0Smrg IFS="$save_ifs" 321395b296d0Smrg 321495b296d0Smrg if test -n "$8"; then 321595b296d0Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 321695b296d0Smrg $echo "$help" 1>&2 321795b296d0Smrg exit $EXIT_FAILURE 321895b296d0Smrg fi 321995b296d0Smrg 322095b296d0Smrg # convert absolute version numbers to libtool ages 322195b296d0Smrg # this retains compatibility with .la files and attempts 322295b296d0Smrg # to make the code below a bit more comprehensible 322395b296d0Smrg 322495b296d0Smrg case $vinfo_number in 322595b296d0Smrg yes) 322695b296d0Smrg number_major="$2" 322795b296d0Smrg number_minor="$3" 322895b296d0Smrg number_revision="$4" 322995b296d0Smrg # 323095b296d0Smrg # There are really only two kinds -- those that 323195b296d0Smrg # use the current revision as the major version 323295b296d0Smrg # and those that subtract age and use age as 323395b296d0Smrg # a minor version. But, then there is irix 323495b296d0Smrg # which has an extra 1 added just for fun 323595b296d0Smrg # 323695b296d0Smrg case $version_type in 323795b296d0Smrg darwin|linux|osf|windows) 323895b296d0Smrg current=`expr $number_major + $number_minor` 323995b296d0Smrg age="$number_minor" 324095b296d0Smrg revision="$number_revision" 324195b296d0Smrg ;; 324295b296d0Smrg freebsd-aout|freebsd-elf|sunos) 324395b296d0Smrg current="$number_major" 324495b296d0Smrg revision="$number_minor" 324595b296d0Smrg age="0" 324695b296d0Smrg ;; 324795b296d0Smrg irix|nonstopux) 324895b296d0Smrg current=`expr $number_major + $number_minor - 1` 324995b296d0Smrg age="$number_minor" 325095b296d0Smrg revision="$number_minor" 325195b296d0Smrg ;; 325295b296d0Smrg esac 325395b296d0Smrg ;; 325495b296d0Smrg no) 325595b296d0Smrg current="$2" 325695b296d0Smrg revision="$3" 325795b296d0Smrg age="$4" 325895b296d0Smrg ;; 325995b296d0Smrg esac 326095b296d0Smrg 326195b296d0Smrg # Check that each of the things are valid numbers. 326295b296d0Smrg case $current in 326395b296d0Smrg 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]) ;; 326495b296d0Smrg *) 326595b296d0Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 326695b296d0Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 326795b296d0Smrg exit $EXIT_FAILURE 326895b296d0Smrg ;; 326995b296d0Smrg esac 327095b296d0Smrg 327195b296d0Smrg case $revision in 327295b296d0Smrg 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]) ;; 327395b296d0Smrg *) 327495b296d0Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 327595b296d0Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 327695b296d0Smrg exit $EXIT_FAILURE 327795b296d0Smrg ;; 327895b296d0Smrg esac 327995b296d0Smrg 328095b296d0Smrg case $age in 328195b296d0Smrg 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]) ;; 328295b296d0Smrg *) 328395b296d0Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 328495b296d0Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 328595b296d0Smrg exit $EXIT_FAILURE 328695b296d0Smrg ;; 328795b296d0Smrg esac 328895b296d0Smrg 328995b296d0Smrg if test "$age" -gt "$current"; then 329095b296d0Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 329195b296d0Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 329295b296d0Smrg exit $EXIT_FAILURE 329395b296d0Smrg fi 329495b296d0Smrg 329595b296d0Smrg # Calculate the version variables. 329695b296d0Smrg major= 329795b296d0Smrg versuffix= 329895b296d0Smrg verstring= 329995b296d0Smrg case $version_type in 330095b296d0Smrg none) ;; 330195b296d0Smrg 330295b296d0Smrg darwin) 330395b296d0Smrg # Like Linux, but with the current version available in 330495b296d0Smrg # verstring for coding it into the library header 330595b296d0Smrg major=.`expr $current - $age` 330695b296d0Smrg versuffix="$major.$age.$revision" 330795b296d0Smrg # Darwin ld doesn't like 0 for these options... 330895b296d0Smrg minor_current=`expr $current + 1` 330995b296d0Smrg verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 331095b296d0Smrg ;; 331195b296d0Smrg 331295b296d0Smrg freebsd-aout) 331395b296d0Smrg major=".$current" 331495b296d0Smrg versuffix=".$current.$revision"; 331595b296d0Smrg ;; 331695b296d0Smrg 331795b296d0Smrg freebsd-elf) 331895b296d0Smrg major=".$current" 331995b296d0Smrg versuffix=".$current"; 332095b296d0Smrg ;; 332195b296d0Smrg 332295b296d0Smrg irix | nonstopux) 332395b296d0Smrg major=`expr $current - $age + 1` 332495b296d0Smrg 332595b296d0Smrg case $version_type in 332695b296d0Smrg nonstopux) verstring_prefix=nonstopux ;; 332795b296d0Smrg *) verstring_prefix=sgi ;; 332895b296d0Smrg esac 332995b296d0Smrg verstring="$verstring_prefix$major.$revision" 333095b296d0Smrg 333195b296d0Smrg # Add in all the interfaces that we are compatible with. 333295b296d0Smrg loop=$revision 333395b296d0Smrg while test "$loop" -ne 0; do 333495b296d0Smrg iface=`expr $revision - $loop` 333595b296d0Smrg loop=`expr $loop - 1` 333695b296d0Smrg verstring="$verstring_prefix$major.$iface:$verstring" 333795b296d0Smrg done 333895b296d0Smrg 333995b296d0Smrg # Before this point, $major must not contain `.'. 334095b296d0Smrg major=.$major 334195b296d0Smrg versuffix="$major.$revision" 334295b296d0Smrg ;; 334395b296d0Smrg 334495b296d0Smrg linux) 334595b296d0Smrg major=.`expr $current - $age` 334695b296d0Smrg versuffix="$major.$age.$revision" 334795b296d0Smrg ;; 334895b296d0Smrg 334995b296d0Smrg osf) 335095b296d0Smrg major=.`expr $current - $age` 335195b296d0Smrg versuffix=".$current.$age.$revision" 335295b296d0Smrg verstring="$current.$age.$revision" 335395b296d0Smrg 335495b296d0Smrg # Add in all the interfaces that we are compatible with. 335595b296d0Smrg loop=$age 335695b296d0Smrg while test "$loop" -ne 0; do 335795b296d0Smrg iface=`expr $current - $loop` 335895b296d0Smrg loop=`expr $loop - 1` 335995b296d0Smrg verstring="$verstring:${iface}.0" 336095b296d0Smrg done 336195b296d0Smrg 336295b296d0Smrg # Make executables depend on our current version. 336395b296d0Smrg verstring="$verstring:${current}.0" 336495b296d0Smrg ;; 336595b296d0Smrg 336695b296d0Smrg sunos) 336795b296d0Smrg major=".$current" 336895b296d0Smrg versuffix=".$current.$revision" 336995b296d0Smrg ;; 337095b296d0Smrg 337195b296d0Smrg windows) 337295b296d0Smrg # Use '-' rather than '.', since we only want one 337395b296d0Smrg # extension on DOS 8.3 filesystems. 337495b296d0Smrg major=`expr $current - $age` 337595b296d0Smrg versuffix="-$major" 337695b296d0Smrg ;; 337795b296d0Smrg 337895b296d0Smrg *) 337995b296d0Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 338095b296d0Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 338195b296d0Smrg exit $EXIT_FAILURE 338295b296d0Smrg ;; 338395b296d0Smrg esac 338495b296d0Smrg 338595b296d0Smrg # Clear the version info if we defaulted, and they specified a release. 338695b296d0Smrg if test -z "$vinfo" && test -n "$release"; then 338795b296d0Smrg major= 338895b296d0Smrg case $version_type in 338995b296d0Smrg darwin) 339095b296d0Smrg # we can't check for "0.0" in archive_cmds due to quoting 339195b296d0Smrg # problems, so we reset it completely 339295b296d0Smrg verstring= 339395b296d0Smrg ;; 339495b296d0Smrg *) 339595b296d0Smrg verstring="0.0" 339695b296d0Smrg ;; 339795b296d0Smrg esac 339895b296d0Smrg if test "$need_version" = no; then 339995b296d0Smrg versuffix= 340095b296d0Smrg else 340195b296d0Smrg versuffix=".0.0" 340295b296d0Smrg fi 340395b296d0Smrg fi 340495b296d0Smrg 340595b296d0Smrg # Remove version info from name if versioning should be avoided 340695b296d0Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 340795b296d0Smrg major= 340895b296d0Smrg versuffix= 340995b296d0Smrg verstring="" 341095b296d0Smrg fi 341195b296d0Smrg 341295b296d0Smrg # Check to see if the archive will have undefined symbols. 341395b296d0Smrg if test "$allow_undefined" = yes; then 341495b296d0Smrg if test "$allow_undefined_flag" = unsupported; then 341595b296d0Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 341695b296d0Smrg build_libtool_libs=no 341795b296d0Smrg build_old_libs=yes 341895b296d0Smrg fi 341995b296d0Smrg else 342095b296d0Smrg # Don't allow undefined symbols. 342195b296d0Smrg allow_undefined_flag="$no_undefined_flag" 342295b296d0Smrg fi 342395b296d0Smrg fi 342495b296d0Smrg 342595b296d0Smrg if test "$mode" != relink; then 342695b296d0Smrg # Remove our outputs, but don't remove object files since they 342795b296d0Smrg # may have been created when compiling PIC objects. 342895b296d0Smrg removelist= 342995b296d0Smrg tempremovelist=`$echo "$output_objdir/*"` 343095b296d0Smrg for p in $tempremovelist; do 343195b296d0Smrg case $p in 343295b296d0Smrg *.$objext) 343395b296d0Smrg ;; 343495b296d0Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 343595b296d0Smrg if test "X$precious_files_regex" != "X"; then 343695b296d0Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 343795b296d0Smrg then 343895b296d0Smrg continue 343995b296d0Smrg fi 344095b296d0Smrg fi 344195b296d0Smrg removelist="$removelist $p" 344295b296d0Smrg ;; 344395b296d0Smrg *) ;; 344495b296d0Smrg esac 344595b296d0Smrg done 344695b296d0Smrg if test -n "$removelist"; then 344795b296d0Smrg $show "${rm}r $removelist" 344895b296d0Smrg $run ${rm}r $removelist 344995b296d0Smrg fi 345095b296d0Smrg fi 345195b296d0Smrg 345295b296d0Smrg # Now set the variables for building old libraries. 345395b296d0Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 345495b296d0Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 345595b296d0Smrg 345695b296d0Smrg # Transform .lo files to .o files. 345795b296d0Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 345895b296d0Smrg fi 345995b296d0Smrg 346095b296d0Smrg # Eliminate all temporary directories. 346195b296d0Smrg for path in $notinst_path; do 346295b296d0Smrg lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 346395b296d0Smrg deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 346495b296d0Smrg dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 346595b296d0Smrg done 346695b296d0Smrg 346795b296d0Smrg if test -n "$xrpath"; then 346895b296d0Smrg # If the user specified any rpath flags, then add them. 346995b296d0Smrg temp_xrpath= 347095b296d0Smrg for libdir in $xrpath; do 347195b296d0Smrg temp_xrpath="$temp_xrpath -R$libdir" 347295b296d0Smrg case "$finalize_rpath " in 347395b296d0Smrg *" $libdir "*) ;; 347495b296d0Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 347595b296d0Smrg esac 347695b296d0Smrg done 347795b296d0Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 347895b296d0Smrg dependency_libs="$temp_xrpath $dependency_libs" 347995b296d0Smrg fi 348095b296d0Smrg fi 348195b296d0Smrg 348295b296d0Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 348395b296d0Smrg old_dlfiles="$dlfiles" 348495b296d0Smrg dlfiles= 348595b296d0Smrg for lib in $old_dlfiles; do 348695b296d0Smrg case " $dlprefiles $dlfiles " in 348795b296d0Smrg *" $lib "*) ;; 348895b296d0Smrg *) dlfiles="$dlfiles $lib" ;; 348995b296d0Smrg esac 349095b296d0Smrg done 349195b296d0Smrg 349295b296d0Smrg # Make sure dlprefiles contains only unique files 349395b296d0Smrg old_dlprefiles="$dlprefiles" 349495b296d0Smrg dlprefiles= 349595b296d0Smrg for lib in $old_dlprefiles; do 349695b296d0Smrg case "$dlprefiles " in 349795b296d0Smrg *" $lib "*) ;; 349895b296d0Smrg *) dlprefiles="$dlprefiles $lib" ;; 349995b296d0Smrg esac 350095b296d0Smrg done 350195b296d0Smrg 350295b296d0Smrg if test "$build_libtool_libs" = yes; then 350395b296d0Smrg if test -n "$rpath"; then 350495b296d0Smrg case $host in 350595b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 350695b296d0Smrg # these systems don't actually have a c library (as such)! 350795b296d0Smrg ;; 350895b296d0Smrg *-*-rhapsody* | *-*-darwin1.[012]) 350995b296d0Smrg # Rhapsody C library is in the System framework 351095b296d0Smrg deplibs="$deplibs -framework System" 351195b296d0Smrg ;; 351295b296d0Smrg *-*-netbsd*) 351395b296d0Smrg # Don't link with libc until the a.out ld.so is fixed. 351495b296d0Smrg ;; 351595b296d0Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 351695b296d0Smrg # Do not include libc due to us having libc/libc_r. 351795b296d0Smrg ;; 351895b296d0Smrg *-*-sco3.2v5* | *-*-sco5v6*) 351995b296d0Smrg # Causes problems with __ctype 352095b296d0Smrg ;; 352195b296d0Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 352295b296d0Smrg # Compiler inserts libc in the correct place for threads to work 352395b296d0Smrg ;; 352495b296d0Smrg *) 352595b296d0Smrg # Add libc to deplibs on all other systems if necessary. 352695b296d0Smrg if test "$build_libtool_need_lc" = "yes"; then 352795b296d0Smrg deplibs="$deplibs -lc" 352895b296d0Smrg fi 352995b296d0Smrg ;; 353095b296d0Smrg esac 353195b296d0Smrg fi 353295b296d0Smrg 353395b296d0Smrg # Transform deplibs into only deplibs that can be linked in shared. 353495b296d0Smrg name_save=$name 353595b296d0Smrg libname_save=$libname 353695b296d0Smrg release_save=$release 353795b296d0Smrg versuffix_save=$versuffix 353895b296d0Smrg major_save=$major 353995b296d0Smrg # I'm not sure if I'm treating the release correctly. I think 354095b296d0Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 354195b296d0Smrg # add it in twice. Is that correct? 354295b296d0Smrg release="" 354395b296d0Smrg versuffix="" 354495b296d0Smrg major="" 354595b296d0Smrg newdeplibs= 354695b296d0Smrg droppeddeps=no 354795b296d0Smrg case $deplibs_check_method in 354895b296d0Smrg pass_all) 354995b296d0Smrg # Don't check for shared/static. Everything works. 355095b296d0Smrg # This might be a little naive. We might want to check 355195b296d0Smrg # whether the library exists or not. But this is on 355295b296d0Smrg # osf3 & osf4 and I'm not really sure... Just 355395b296d0Smrg # implementing what was already the behavior. 355495b296d0Smrg newdeplibs=$deplibs 355595b296d0Smrg ;; 355695b296d0Smrg test_compile) 355795b296d0Smrg # This code stresses the "libraries are programs" paradigm to its 355895b296d0Smrg # limits. Maybe even breaks it. We compile a program, linking it 355995b296d0Smrg # against the deplibs as a proxy for the library. Then we can check 356095b296d0Smrg # whether they linked in statically or dynamically with ldd. 356195b296d0Smrg $rm conftest.c 356295b296d0Smrg cat > conftest.c <<EOF 356395b296d0Smrg int main() { return 0; } 356495b296d0SmrgEOF 356595b296d0Smrg $rm conftest 356695b296d0Smrg $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 356795b296d0Smrg if test "$?" -eq 0 ; then 356895b296d0Smrg ldd_output=`ldd conftest` 356995b296d0Smrg for i in $deplibs; do 357095b296d0Smrg name=`expr $i : '-l\(.*\)'` 357195b296d0Smrg # If $name is empty we are operating on a -L argument. 357295b296d0Smrg if test "$name" != "" && test "$name" -ne "0"; then 357395b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 357495b296d0Smrg case " $predeps $postdeps " in 357595b296d0Smrg *" $i "*) 357695b296d0Smrg newdeplibs="$newdeplibs $i" 357795b296d0Smrg i="" 357895b296d0Smrg ;; 357995b296d0Smrg esac 358095b296d0Smrg fi 358195b296d0Smrg if test -n "$i" ; then 358295b296d0Smrg libname=`eval \\$echo \"$libname_spec\"` 358395b296d0Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 358495b296d0Smrg set dummy $deplib_matches 358595b296d0Smrg deplib_match=$2 358695b296d0Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 358795b296d0Smrg newdeplibs="$newdeplibs $i" 358895b296d0Smrg else 358995b296d0Smrg droppeddeps=yes 359095b296d0Smrg $echo 359195b296d0Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 359295b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 359395b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 359495b296d0Smrg $echo "*** shared version of the library, which I believe you do not have" 359595b296d0Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 359695b296d0Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 359795b296d0Smrg fi 359895b296d0Smrg fi 359995b296d0Smrg else 360095b296d0Smrg newdeplibs="$newdeplibs $i" 360195b296d0Smrg fi 360295b296d0Smrg done 360395b296d0Smrg else 360495b296d0Smrg # Error occurred in the first compile. Let's try to salvage 360595b296d0Smrg # the situation: Compile a separate program for each library. 360695b296d0Smrg for i in $deplibs; do 360795b296d0Smrg name=`expr $i : '-l\(.*\)'` 360895b296d0Smrg # If $name is empty we are operating on a -L argument. 360995b296d0Smrg if test "$name" != "" && test "$name" != "0"; then 361095b296d0Smrg $rm conftest 361195b296d0Smrg $LTCC $LTCFLAGS -o conftest conftest.c $i 361295b296d0Smrg # Did it work? 361395b296d0Smrg if test "$?" -eq 0 ; then 361495b296d0Smrg ldd_output=`ldd conftest` 361595b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 361695b296d0Smrg case " $predeps $postdeps " in 361795b296d0Smrg *" $i "*) 361895b296d0Smrg newdeplibs="$newdeplibs $i" 361995b296d0Smrg i="" 362095b296d0Smrg ;; 362195b296d0Smrg esac 362295b296d0Smrg fi 362395b296d0Smrg if test -n "$i" ; then 362495b296d0Smrg libname=`eval \\$echo \"$libname_spec\"` 362595b296d0Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 362695b296d0Smrg set dummy $deplib_matches 362795b296d0Smrg deplib_match=$2 362895b296d0Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 362995b296d0Smrg newdeplibs="$newdeplibs $i" 363095b296d0Smrg else 363195b296d0Smrg droppeddeps=yes 363295b296d0Smrg $echo 363395b296d0Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 363495b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 363595b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 363695b296d0Smrg $echo "*** shared version of the library, which you do not appear to have" 363795b296d0Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 363895b296d0Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 363995b296d0Smrg fi 364095b296d0Smrg fi 364195b296d0Smrg else 364295b296d0Smrg droppeddeps=yes 364395b296d0Smrg $echo 364495b296d0Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 364595b296d0Smrg $echo "*** make it link in! You will probably need to install it or some" 364695b296d0Smrg $echo "*** library that it depends on before this library will be fully" 364795b296d0Smrg $echo "*** functional. Installing it before continuing would be even better." 364895b296d0Smrg fi 364995b296d0Smrg else 365095b296d0Smrg newdeplibs="$newdeplibs $i" 365195b296d0Smrg fi 365295b296d0Smrg done 365395b296d0Smrg fi 365495b296d0Smrg ;; 365595b296d0Smrg file_magic*) 365695b296d0Smrg set dummy $deplibs_check_method 365795b296d0Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 365895b296d0Smrg for a_deplib in $deplibs; do 365995b296d0Smrg name=`expr $a_deplib : '-l\(.*\)'` 366095b296d0Smrg # If $name is empty we are operating on a -L argument. 366195b296d0Smrg if test "$name" != "" && test "$name" != "0"; then 366295b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 366395b296d0Smrg case " $predeps $postdeps " in 366495b296d0Smrg *" $a_deplib "*) 366595b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 366695b296d0Smrg a_deplib="" 366795b296d0Smrg ;; 366895b296d0Smrg esac 366995b296d0Smrg fi 367095b296d0Smrg if test -n "$a_deplib" ; then 367195b296d0Smrg libname=`eval \\$echo \"$libname_spec\"` 367295b296d0Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 367395b296d0Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 367495b296d0Smrg for potent_lib in $potential_libs; do 367595b296d0Smrg # Follow soft links. 367695b296d0Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 367795b296d0Smrg | grep " -> " >/dev/null; then 367895b296d0Smrg continue 367995b296d0Smrg fi 368095b296d0Smrg # The statement above tries to avoid entering an 368195b296d0Smrg # endless loop below, in case of cyclic links. 368295b296d0Smrg # We might still enter an endless loop, since a link 368395b296d0Smrg # loop can be closed while we follow links, 368495b296d0Smrg # but so what? 368595b296d0Smrg potlib="$potent_lib" 368695b296d0Smrg while test -h "$potlib" 2>/dev/null; do 368795b296d0Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 368895b296d0Smrg case $potliblink in 368995b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 369095b296d0Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 369195b296d0Smrg esac 369295b296d0Smrg done 369395b296d0Smrg # It is ok to link against an archive when 369495b296d0Smrg # building a shared library. 369595b296d0Smrg if $AR -t $potlib > /dev/null 2>&1; then 369695b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 369795b296d0Smrg a_deplib="" 369895b296d0Smrg break 2 369995b296d0Smrg fi 370095b296d0Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 370195b296d0Smrg | ${SED} 10q \ 370295b296d0Smrg | $EGREP "$file_magic_regex" > /dev/null; then 370395b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 370495b296d0Smrg a_deplib="" 370595b296d0Smrg break 2 370695b296d0Smrg fi 370795b296d0Smrg done 370895b296d0Smrg done 370995b296d0Smrg fi 371095b296d0Smrg if test -n "$a_deplib" ; then 371195b296d0Smrg droppeddeps=yes 371295b296d0Smrg $echo 371395b296d0Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 371495b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 371595b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 371695b296d0Smrg $echo "*** shared version of the library, which you do not appear to have" 371795b296d0Smrg $echo "*** because I did check the linker path looking for a file starting" 371895b296d0Smrg if test -z "$potlib" ; then 371995b296d0Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 372095b296d0Smrg else 372195b296d0Smrg $echo "*** with $libname and none of the candidates passed a file format test" 372295b296d0Smrg $echo "*** using a file magic. Last file checked: $potlib" 372395b296d0Smrg fi 372495b296d0Smrg fi 372595b296d0Smrg else 372695b296d0Smrg # Add a -L argument. 372795b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 372895b296d0Smrg fi 372995b296d0Smrg done # Gone through all deplibs. 373095b296d0Smrg ;; 373195b296d0Smrg match_pattern*) 373295b296d0Smrg set dummy $deplibs_check_method 373395b296d0Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 373495b296d0Smrg for a_deplib in $deplibs; do 373595b296d0Smrg name=`expr $a_deplib : '-l\(.*\)'` 373695b296d0Smrg # If $name is empty we are operating on a -L argument. 373795b296d0Smrg if test -n "$name" && test "$name" != "0"; then 373895b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 373995b296d0Smrg case " $predeps $postdeps " in 374095b296d0Smrg *" $a_deplib "*) 374195b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 374295b296d0Smrg a_deplib="" 374395b296d0Smrg ;; 374495b296d0Smrg esac 374595b296d0Smrg fi 374695b296d0Smrg if test -n "$a_deplib" ; then 374795b296d0Smrg libname=`eval \\$echo \"$libname_spec\"` 374895b296d0Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 374995b296d0Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 375095b296d0Smrg for potent_lib in $potential_libs; do 375195b296d0Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 375295b296d0Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 375395b296d0Smrg | ${SED} 10q \ 375495b296d0Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 375595b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 375695b296d0Smrg a_deplib="" 375795b296d0Smrg break 2 375895b296d0Smrg fi 375995b296d0Smrg done 376095b296d0Smrg done 376195b296d0Smrg fi 376295b296d0Smrg if test -n "$a_deplib" ; then 376395b296d0Smrg droppeddeps=yes 376495b296d0Smrg $echo 376595b296d0Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 376695b296d0Smrg $echo "*** I have the capability to make that library automatically link in when" 376795b296d0Smrg $echo "*** you link to this library. But I can only do this if you have a" 376895b296d0Smrg $echo "*** shared version of the library, which you do not appear to have" 376995b296d0Smrg $echo "*** because I did check the linker path looking for a file starting" 377095b296d0Smrg if test -z "$potlib" ; then 377195b296d0Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 377295b296d0Smrg else 377395b296d0Smrg $echo "*** with $libname and none of the candidates passed a file format test" 377495b296d0Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 377595b296d0Smrg fi 377695b296d0Smrg fi 377795b296d0Smrg else 377895b296d0Smrg # Add a -L argument. 377995b296d0Smrg newdeplibs="$newdeplibs $a_deplib" 378095b296d0Smrg fi 378195b296d0Smrg done # Gone through all deplibs. 378295b296d0Smrg ;; 378395b296d0Smrg none | unknown | *) 378495b296d0Smrg newdeplibs="" 378595b296d0Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 378695b296d0Smrg -e 's/ -[LR][^ ]*//g'` 378795b296d0Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 378895b296d0Smrg for i in $predeps $postdeps ; do 378995b296d0Smrg # can't use Xsed below, because $i might contain '/' 379095b296d0Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 379195b296d0Smrg done 379295b296d0Smrg fi 379395b296d0Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 379495b296d0Smrg | grep . >/dev/null; then 379595b296d0Smrg $echo 379695b296d0Smrg if test "X$deplibs_check_method" = "Xnone"; then 379795b296d0Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 379895b296d0Smrg else 379995b296d0Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 380095b296d0Smrg fi 380195b296d0Smrg $echo "*** All declared inter-library dependencies are being dropped." 380295b296d0Smrg droppeddeps=yes 380395b296d0Smrg fi 380495b296d0Smrg ;; 380595b296d0Smrg esac 380695b296d0Smrg versuffix=$versuffix_save 380795b296d0Smrg major=$major_save 380895b296d0Smrg release=$release_save 380995b296d0Smrg libname=$libname_save 381095b296d0Smrg name=$name_save 381195b296d0Smrg 381295b296d0Smrg case $host in 381395b296d0Smrg *-*-rhapsody* | *-*-darwin1.[012]) 381495b296d0Smrg # On Rhapsody replace the C library is the System framework 381595b296d0Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 381695b296d0Smrg ;; 381795b296d0Smrg esac 381895b296d0Smrg 381995b296d0Smrg if test "$droppeddeps" = yes; then 382095b296d0Smrg if test "$module" = yes; then 382195b296d0Smrg $echo 382295b296d0Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 382395b296d0Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 382495b296d0Smrg $echo "*** a static module, that should work as long as the dlopening" 382595b296d0Smrg $echo "*** application is linked with the -dlopen flag." 382695b296d0Smrg if test -z "$global_symbol_pipe"; then 382795b296d0Smrg $echo 382895b296d0Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 382995b296d0Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 383095b296d0Smrg $echo "*** not find such a program. So, this module is probably useless." 383195b296d0Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 383295b296d0Smrg fi 383395b296d0Smrg if test "$build_old_libs" = no; then 383495b296d0Smrg oldlibs="$output_objdir/$libname.$libext" 383595b296d0Smrg build_libtool_libs=module 383695b296d0Smrg build_old_libs=yes 383795b296d0Smrg else 383895b296d0Smrg build_libtool_libs=no 383995b296d0Smrg fi 384095b296d0Smrg else 384195b296d0Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 384295b296d0Smrg $echo "*** automatically added whenever a program is linked with this library" 384395b296d0Smrg $echo "*** or is declared to -dlopen it." 384495b296d0Smrg 384595b296d0Smrg if test "$allow_undefined" = no; then 384695b296d0Smrg $echo 384795b296d0Smrg $echo "*** Since this library must not contain undefined symbols," 384895b296d0Smrg $echo "*** because either the platform does not support them or" 384995b296d0Smrg $echo "*** it was explicitly requested with -no-undefined," 385095b296d0Smrg $echo "*** libtool will only create a static version of it." 385195b296d0Smrg if test "$build_old_libs" = no; then 385295b296d0Smrg oldlibs="$output_objdir/$libname.$libext" 385395b296d0Smrg build_libtool_libs=module 385495b296d0Smrg build_old_libs=yes 385595b296d0Smrg else 385695b296d0Smrg build_libtool_libs=no 385795b296d0Smrg fi 385895b296d0Smrg fi 385995b296d0Smrg fi 386095b296d0Smrg fi 386195b296d0Smrg # Done checking deplibs! 386295b296d0Smrg deplibs=$newdeplibs 386395b296d0Smrg fi 386495b296d0Smrg 386595b296d0Smrg 386695b296d0Smrg # move library search paths that coincide with paths to not yet 386795b296d0Smrg # installed libraries to the beginning of the library search list 386895b296d0Smrg new_libs= 386995b296d0Smrg for path in $notinst_path; do 387095b296d0Smrg case " $new_libs " in 387195b296d0Smrg *" -L$path/$objdir "*) ;; 387295b296d0Smrg *) 387395b296d0Smrg case " $deplibs " in 387495b296d0Smrg *" -L$path/$objdir "*) 387595b296d0Smrg new_libs="$new_libs -L$path/$objdir" ;; 387695b296d0Smrg esac 387795b296d0Smrg ;; 387895b296d0Smrg esac 387995b296d0Smrg done 388095b296d0Smrg for deplib in $deplibs; do 388195b296d0Smrg case $deplib in 388295b296d0Smrg -L*) 388395b296d0Smrg case " $new_libs " in 388495b296d0Smrg *" $deplib "*) ;; 388595b296d0Smrg *) new_libs="$new_libs $deplib" ;; 388695b296d0Smrg esac 388795b296d0Smrg ;; 388895b296d0Smrg *) new_libs="$new_libs $deplib" ;; 388995b296d0Smrg esac 389095b296d0Smrg done 389195b296d0Smrg deplibs="$new_libs" 389295b296d0Smrg 389395b296d0Smrg 389495b296d0Smrg # All the library-specific variables (install_libdir is set above). 389595b296d0Smrg library_names= 389695b296d0Smrg old_library= 389795b296d0Smrg dlname= 389895b296d0Smrg 389995b296d0Smrg # Test again, we may have decided not to build it any more 390095b296d0Smrg if test "$build_libtool_libs" = yes; then 390195b296d0Smrg if test "$hardcode_into_libs" = yes; then 390295b296d0Smrg # Hardcode the library paths 390395b296d0Smrg hardcode_libdirs= 390495b296d0Smrg dep_rpath= 390595b296d0Smrg rpath="$finalize_rpath" 390695b296d0Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 390795b296d0Smrg for libdir in $rpath; do 390895b296d0Smrg if test -n "$hardcode_libdir_flag_spec"; then 390995b296d0Smrg if test -n "$hardcode_libdir_separator"; then 391095b296d0Smrg if test -z "$hardcode_libdirs"; then 391195b296d0Smrg hardcode_libdirs="$libdir" 391295b296d0Smrg else 391395b296d0Smrg # Just accumulate the unique libdirs. 391495b296d0Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 391595b296d0Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 391695b296d0Smrg ;; 391795b296d0Smrg *) 391895b296d0Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 391995b296d0Smrg ;; 392095b296d0Smrg esac 392195b296d0Smrg fi 392295b296d0Smrg else 392395b296d0Smrg eval flag=\"$hardcode_libdir_flag_spec\" 392495b296d0Smrg dep_rpath="$dep_rpath $flag" 392595b296d0Smrg fi 392695b296d0Smrg elif test -n "$runpath_var"; then 392795b296d0Smrg case "$perm_rpath " in 392895b296d0Smrg *" $libdir "*) ;; 392995b296d0Smrg *) perm_rpath="$perm_rpath $libdir" ;; 393095b296d0Smrg esac 393195b296d0Smrg fi 393295b296d0Smrg done 393395b296d0Smrg # Substitute the hardcoded libdirs into the rpath. 393495b296d0Smrg if test -n "$hardcode_libdir_separator" && 393595b296d0Smrg test -n "$hardcode_libdirs"; then 393695b296d0Smrg libdir="$hardcode_libdirs" 393795b296d0Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 393895b296d0Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 393995b296d0Smrg else 394095b296d0Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 394195b296d0Smrg fi 394295b296d0Smrg fi 394395b296d0Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 394495b296d0Smrg # We should set the runpath_var. 394595b296d0Smrg rpath= 394695b296d0Smrg for dir in $perm_rpath; do 394795b296d0Smrg rpath="$rpath$dir:" 394895b296d0Smrg done 394995b296d0Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 395095b296d0Smrg fi 395195b296d0Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 395295b296d0Smrg fi 395395b296d0Smrg 395495b296d0Smrg shlibpath="$finalize_shlibpath" 395595b296d0Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 395695b296d0Smrg if test -n "$shlibpath"; then 395795b296d0Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 395895b296d0Smrg fi 395995b296d0Smrg 396095b296d0Smrg # Get the real and link names of the library. 396195b296d0Smrg eval shared_ext=\"$shrext_cmds\" 396295b296d0Smrg eval library_names=\"$library_names_spec\" 396395b296d0Smrg set dummy $library_names 396495b296d0Smrg realname="$2" 396595b296d0Smrg shift; shift 396695b296d0Smrg 396795b296d0Smrg if test -n "$soname_spec"; then 396895b296d0Smrg eval soname=\"$soname_spec\" 396995b296d0Smrg else 397095b296d0Smrg soname="$realname" 397195b296d0Smrg fi 397295b296d0Smrg if test -z "$dlname"; then 397395b296d0Smrg dlname=$soname 397495b296d0Smrg fi 397595b296d0Smrg 397695b296d0Smrg lib="$output_objdir/$realname" 397795b296d0Smrg linknames= 397895b296d0Smrg for link 397995b296d0Smrg do 398095b296d0Smrg linknames="$linknames $link" 398195b296d0Smrg done 398295b296d0Smrg 398395b296d0Smrg # Use standard objects if they are pic 398495b296d0Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 398595b296d0Smrg 398695b296d0Smrg # Prepare the list of exported symbols 398795b296d0Smrg if test -z "$export_symbols"; then 398895b296d0Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 398995b296d0Smrg $show "generating symbol list for \`$libname.la'" 399095b296d0Smrg export_symbols="$output_objdir/$libname.exp" 399195b296d0Smrg $run $rm $export_symbols 399295b296d0Smrg cmds=$export_symbols_cmds 399395b296d0Smrg save_ifs="$IFS"; IFS='~' 399495b296d0Smrg for cmd in $cmds; do 399595b296d0Smrg IFS="$save_ifs" 399695b296d0Smrg eval cmd=\"$cmd\" 399795b296d0Smrg if len=`expr "X$cmd" : ".*"` && 399895b296d0Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 399995b296d0Smrg $show "$cmd" 400095b296d0Smrg $run eval "$cmd" || exit $? 400195b296d0Smrg skipped_export=false 400295b296d0Smrg else 400395b296d0Smrg # The command line is too long to execute in one step. 400495b296d0Smrg $show "using reloadable object file for export list..." 400595b296d0Smrg skipped_export=: 400695b296d0Smrg # Break out early, otherwise skipped_export may be 400795b296d0Smrg # set to false by a later but shorter cmd. 400895b296d0Smrg break 400995b296d0Smrg fi 401095b296d0Smrg done 401195b296d0Smrg IFS="$save_ifs" 401295b296d0Smrg if test -n "$export_symbols_regex"; then 401395b296d0Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 401495b296d0Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 401595b296d0Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 401695b296d0Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 401795b296d0Smrg fi 401895b296d0Smrg fi 401995b296d0Smrg fi 402095b296d0Smrg 402195b296d0Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 402295b296d0Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 402395b296d0Smrg fi 402495b296d0Smrg 402595b296d0Smrg tmp_deplibs= 402695b296d0Smrg for test_deplib in $deplibs; do 402795b296d0Smrg case " $convenience " in 402895b296d0Smrg *" $test_deplib "*) ;; 402995b296d0Smrg *) 403095b296d0Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 403195b296d0Smrg ;; 403295b296d0Smrg esac 403395b296d0Smrg done 403495b296d0Smrg deplibs="$tmp_deplibs" 403595b296d0Smrg 403695b296d0Smrg if test -n "$convenience"; then 403795b296d0Smrg if test -n "$whole_archive_flag_spec"; then 403895b296d0Smrg save_libobjs=$libobjs 403995b296d0Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 404095b296d0Smrg else 404195b296d0Smrg gentop="$output_objdir/${outputname}x" 404295b296d0Smrg generated="$generated $gentop" 404395b296d0Smrg 404495b296d0Smrg func_extract_archives $gentop $convenience 404595b296d0Smrg libobjs="$libobjs $func_extract_archives_result" 404695b296d0Smrg fi 404795b296d0Smrg fi 404895b296d0Smrg 404995b296d0Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 405095b296d0Smrg eval flag=\"$thread_safe_flag_spec\" 405195b296d0Smrg linker_flags="$linker_flags $flag" 405295b296d0Smrg fi 405395b296d0Smrg 405495b296d0Smrg # Make a backup of the uninstalled library when relinking 405595b296d0Smrg if test "$mode" = relink; then 405695b296d0Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 405795b296d0Smrg fi 405895b296d0Smrg 405995b296d0Smrg # Do each of the archive commands. 406095b296d0Smrg if test "$module" = yes && test -n "$module_cmds" ; then 406195b296d0Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 406295b296d0Smrg eval test_cmds=\"$module_expsym_cmds\" 406395b296d0Smrg cmds=$module_expsym_cmds 406495b296d0Smrg else 406595b296d0Smrg eval test_cmds=\"$module_cmds\" 406695b296d0Smrg cmds=$module_cmds 406795b296d0Smrg fi 406895b296d0Smrg else 406995b296d0Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 407095b296d0Smrg eval test_cmds=\"$archive_expsym_cmds\" 407195b296d0Smrg cmds=$archive_expsym_cmds 407295b296d0Smrg else 407395b296d0Smrg eval test_cmds=\"$archive_cmds\" 407495b296d0Smrg cmds=$archive_cmds 407595b296d0Smrg fi 407695b296d0Smrg fi 407795b296d0Smrg 407895b296d0Smrg if test "X$skipped_export" != "X:" && 407995b296d0Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 408095b296d0Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 408195b296d0Smrg : 408295b296d0Smrg else 408395b296d0Smrg # The command line is too long to link in one step, link piecewise. 408495b296d0Smrg $echo "creating reloadable object files..." 408595b296d0Smrg 408695b296d0Smrg # Save the value of $output and $libobjs because we want to 408795b296d0Smrg # use them later. If we have whole_archive_flag_spec, we 408895b296d0Smrg # want to use save_libobjs as it was before 408995b296d0Smrg # whole_archive_flag_spec was expanded, because we can't 409095b296d0Smrg # assume the linker understands whole_archive_flag_spec. 409195b296d0Smrg # This may have to be revisited, in case too many 409295b296d0Smrg # convenience libraries get linked in and end up exceeding 409395b296d0Smrg # the spec. 409495b296d0Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 409595b296d0Smrg save_libobjs=$libobjs 409695b296d0Smrg fi 409795b296d0Smrg save_output=$output 409895b296d0Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 409995b296d0Smrg 410095b296d0Smrg # Clear the reloadable object creation command queue and 410195b296d0Smrg # initialize k to one. 410295b296d0Smrg test_cmds= 410395b296d0Smrg concat_cmds= 410495b296d0Smrg objlist= 410595b296d0Smrg delfiles= 410695b296d0Smrg last_robj= 410795b296d0Smrg k=1 410895b296d0Smrg output=$output_objdir/$output_la-${k}.$objext 410995b296d0Smrg # Loop over the list of objects to be linked. 411095b296d0Smrg for obj in $save_libobjs 411195b296d0Smrg do 411295b296d0Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 411395b296d0Smrg if test "X$objlist" = X || 411495b296d0Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 411595b296d0Smrg test "$len" -le "$max_cmd_len"; }; then 411695b296d0Smrg objlist="$objlist $obj" 411795b296d0Smrg else 411895b296d0Smrg # The command $test_cmds is almost too long, add a 411995b296d0Smrg # command to the queue. 412095b296d0Smrg if test "$k" -eq 1 ; then 412195b296d0Smrg # The first file doesn't have a previous command to add. 412295b296d0Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 412395b296d0Smrg else 412495b296d0Smrg # All subsequent reloadable object files will link in 412595b296d0Smrg # the last one created. 412695b296d0Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 412795b296d0Smrg fi 412895b296d0Smrg last_robj=$output_objdir/$output_la-${k}.$objext 412995b296d0Smrg k=`expr $k + 1` 413095b296d0Smrg output=$output_objdir/$output_la-${k}.$objext 413195b296d0Smrg objlist=$obj 413295b296d0Smrg len=1 413395b296d0Smrg fi 413495b296d0Smrg done 413595b296d0Smrg # Handle the remaining objects by creating one last 413695b296d0Smrg # reloadable object file. All subsequent reloadable object 413795b296d0Smrg # files will link in the last one created. 413895b296d0Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 413995b296d0Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 414095b296d0Smrg 414195b296d0Smrg if ${skipped_export-false}; then 414295b296d0Smrg $show "generating symbol list for \`$libname.la'" 414395b296d0Smrg export_symbols="$output_objdir/$libname.exp" 414495b296d0Smrg $run $rm $export_symbols 414595b296d0Smrg libobjs=$output 414695b296d0Smrg # Append the command to create the export file. 414795b296d0Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 414895b296d0Smrg fi 414995b296d0Smrg 415095b296d0Smrg # Set up a command to remove the reloadable object files 415195b296d0Smrg # after they are used. 415295b296d0Smrg i=0 415395b296d0Smrg while test "$i" -lt "$k" 415495b296d0Smrg do 415595b296d0Smrg i=`expr $i + 1` 415695b296d0Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 415795b296d0Smrg done 415895b296d0Smrg 415995b296d0Smrg $echo "creating a temporary reloadable object file: $output" 416095b296d0Smrg 416195b296d0Smrg # Loop through the commands generated above and execute them. 416295b296d0Smrg save_ifs="$IFS"; IFS='~' 416395b296d0Smrg for cmd in $concat_cmds; do 416495b296d0Smrg IFS="$save_ifs" 416595b296d0Smrg $show "$cmd" 416695b296d0Smrg $run eval "$cmd" || exit $? 416795b296d0Smrg done 416895b296d0Smrg IFS="$save_ifs" 416995b296d0Smrg 417095b296d0Smrg libobjs=$output 417195b296d0Smrg # Restore the value of output. 417295b296d0Smrg output=$save_output 417395b296d0Smrg 417495b296d0Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 417595b296d0Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 417695b296d0Smrg fi 417795b296d0Smrg # Expand the library linking commands again to reset the 417895b296d0Smrg # value of $libobjs for piecewise linking. 417995b296d0Smrg 418095b296d0Smrg # Do each of the archive commands. 418195b296d0Smrg if test "$module" = yes && test -n "$module_cmds" ; then 418295b296d0Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 418395b296d0Smrg cmds=$module_expsym_cmds 418495b296d0Smrg else 418595b296d0Smrg cmds=$module_cmds 418695b296d0Smrg fi 418795b296d0Smrg else 418895b296d0Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 418995b296d0Smrg cmds=$archive_expsym_cmds 419095b296d0Smrg else 419195b296d0Smrg cmds=$archive_cmds 419295b296d0Smrg fi 419395b296d0Smrg fi 419495b296d0Smrg 419595b296d0Smrg # Append the command to remove the reloadable object files 419695b296d0Smrg # to the just-reset $cmds. 419795b296d0Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 419895b296d0Smrg fi 419995b296d0Smrg save_ifs="$IFS"; IFS='~' 420095b296d0Smrg for cmd in $cmds; do 420195b296d0Smrg IFS="$save_ifs" 420295b296d0Smrg eval cmd=\"$cmd\" 420395b296d0Smrg $show "$cmd" 420495b296d0Smrg $run eval "$cmd" || { 420595b296d0Smrg lt_exit=$? 420695b296d0Smrg 420795b296d0Smrg # Restore the uninstalled library and exit 420895b296d0Smrg if test "$mode" = relink; then 420995b296d0Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 421095b296d0Smrg fi 421195b296d0Smrg 421295b296d0Smrg exit $lt_exit 421395b296d0Smrg } 421495b296d0Smrg done 421595b296d0Smrg IFS="$save_ifs" 421695b296d0Smrg 421795b296d0Smrg # Restore the uninstalled library and exit 421895b296d0Smrg if test "$mode" = relink; then 421995b296d0Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 422095b296d0Smrg 422195b296d0Smrg if test -n "$convenience"; then 422295b296d0Smrg if test -z "$whole_archive_flag_spec"; then 422395b296d0Smrg $show "${rm}r $gentop" 422495b296d0Smrg $run ${rm}r "$gentop" 422595b296d0Smrg fi 422695b296d0Smrg fi 422795b296d0Smrg 422895b296d0Smrg exit $EXIT_SUCCESS 422995b296d0Smrg fi 423095b296d0Smrg 423195b296d0Smrg # Create links to the real library. 423295b296d0Smrg for linkname in $linknames; do 423395b296d0Smrg if test "$realname" != "$linkname"; then 423495b296d0Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 423595b296d0Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 423695b296d0Smrg fi 423795b296d0Smrg done 423895b296d0Smrg 423995b296d0Smrg # If -module or -export-dynamic was specified, set the dlname. 424095b296d0Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 424195b296d0Smrg # On all known operating systems, these are identical. 424295b296d0Smrg dlname="$soname" 424395b296d0Smrg fi 424495b296d0Smrg fi 424595b296d0Smrg ;; 424695b296d0Smrg 424795b296d0Smrg obj) 424895b296d0Smrg if test -n "$deplibs"; then 424995b296d0Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 425095b296d0Smrg fi 425195b296d0Smrg 425295b296d0Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 425395b296d0Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 425495b296d0Smrg fi 425595b296d0Smrg 425695b296d0Smrg if test -n "$rpath"; then 425795b296d0Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 425895b296d0Smrg fi 425995b296d0Smrg 426095b296d0Smrg if test -n "$xrpath"; then 426195b296d0Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 426295b296d0Smrg fi 426395b296d0Smrg 426495b296d0Smrg if test -n "$vinfo"; then 426595b296d0Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 426695b296d0Smrg fi 426795b296d0Smrg 426895b296d0Smrg if test -n "$release"; then 426995b296d0Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 427095b296d0Smrg fi 427195b296d0Smrg 427295b296d0Smrg case $output in 427395b296d0Smrg *.lo) 427495b296d0Smrg if test -n "$objs$old_deplibs"; then 427595b296d0Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 427695b296d0Smrg exit $EXIT_FAILURE 427795b296d0Smrg fi 427895b296d0Smrg libobj="$output" 427995b296d0Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 428095b296d0Smrg ;; 428195b296d0Smrg *) 428295b296d0Smrg libobj= 428395b296d0Smrg obj="$output" 428495b296d0Smrg ;; 428595b296d0Smrg esac 428695b296d0Smrg 428795b296d0Smrg # Delete the old objects. 428895b296d0Smrg $run $rm $obj $libobj 428995b296d0Smrg 429095b296d0Smrg # Objects from convenience libraries. This assumes 429195b296d0Smrg # single-version convenience libraries. Whenever we create 429295b296d0Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 429395b296d0Smrg # the extraction. 429495b296d0Smrg reload_conv_objs= 429595b296d0Smrg gentop= 429695b296d0Smrg # reload_cmds runs $LD directly, so let us get rid of 429795b296d0Smrg # -Wl from whole_archive_flag_spec 429895b296d0Smrg wl= 429995b296d0Smrg 430095b296d0Smrg if test -n "$convenience"; then 430195b296d0Smrg if test -n "$whole_archive_flag_spec"; then 430295b296d0Smrg eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 430395b296d0Smrg else 430495b296d0Smrg gentop="$output_objdir/${obj}x" 430595b296d0Smrg generated="$generated $gentop" 430695b296d0Smrg 430795b296d0Smrg func_extract_archives $gentop $convenience 430895b296d0Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 430995b296d0Smrg fi 431095b296d0Smrg fi 431195b296d0Smrg 431295b296d0Smrg # Create the old-style object. 431395b296d0Smrg 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 431495b296d0Smrg 431595b296d0Smrg output="$obj" 431695b296d0Smrg cmds=$reload_cmds 431795b296d0Smrg save_ifs="$IFS"; IFS='~' 431895b296d0Smrg for cmd in $cmds; do 431995b296d0Smrg IFS="$save_ifs" 432095b296d0Smrg eval cmd=\"$cmd\" 432195b296d0Smrg $show "$cmd" 432295b296d0Smrg $run eval "$cmd" || exit $? 432395b296d0Smrg done 432495b296d0Smrg IFS="$save_ifs" 432595b296d0Smrg 432695b296d0Smrg # Exit if we aren't doing a library object file. 432795b296d0Smrg if test -z "$libobj"; then 432895b296d0Smrg if test -n "$gentop"; then 432995b296d0Smrg $show "${rm}r $gentop" 433095b296d0Smrg $run ${rm}r $gentop 433195b296d0Smrg fi 433295b296d0Smrg 433395b296d0Smrg exit $EXIT_SUCCESS 433495b296d0Smrg fi 433595b296d0Smrg 433695b296d0Smrg if test "$build_libtool_libs" != yes; then 433795b296d0Smrg if test -n "$gentop"; then 433895b296d0Smrg $show "${rm}r $gentop" 433995b296d0Smrg $run ${rm}r $gentop 434095b296d0Smrg fi 434195b296d0Smrg 434295b296d0Smrg # Create an invalid libtool object if no PIC, so that we don't 434395b296d0Smrg # accidentally link it into a program. 434495b296d0Smrg # $show "echo timestamp > $libobj" 434595b296d0Smrg # $run eval "echo timestamp > $libobj" || exit $? 434695b296d0Smrg exit $EXIT_SUCCESS 434795b296d0Smrg fi 434895b296d0Smrg 434995b296d0Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 435095b296d0Smrg # Only do commands if we really have different PIC objects. 435195b296d0Smrg reload_objs="$libobjs $reload_conv_objs" 435295b296d0Smrg output="$libobj" 435395b296d0Smrg cmds=$reload_cmds 435495b296d0Smrg save_ifs="$IFS"; IFS='~' 435595b296d0Smrg for cmd in $cmds; do 435695b296d0Smrg IFS="$save_ifs" 435795b296d0Smrg eval cmd=\"$cmd\" 435895b296d0Smrg $show "$cmd" 435995b296d0Smrg $run eval "$cmd" || exit $? 436095b296d0Smrg done 436195b296d0Smrg IFS="$save_ifs" 436295b296d0Smrg fi 436395b296d0Smrg 436495b296d0Smrg if test -n "$gentop"; then 436595b296d0Smrg $show "${rm}r $gentop" 436695b296d0Smrg $run ${rm}r $gentop 436795b296d0Smrg fi 436895b296d0Smrg 436995b296d0Smrg exit $EXIT_SUCCESS 437095b296d0Smrg ;; 437195b296d0Smrg 437295b296d0Smrg prog) 437395b296d0Smrg case $host in 437495b296d0Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 437595b296d0Smrg esac 437695b296d0Smrg if test -n "$vinfo"; then 437795b296d0Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 437895b296d0Smrg fi 437995b296d0Smrg 438095b296d0Smrg if test -n "$release"; then 438195b296d0Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 438295b296d0Smrg fi 438395b296d0Smrg 438495b296d0Smrg if test "$preload" = yes; then 438595b296d0Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 438695b296d0Smrg test "$dlopen_self_static" = unknown; then 438795b296d0Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 438895b296d0Smrg fi 438995b296d0Smrg fi 439095b296d0Smrg 439195b296d0Smrg case $host in 439295b296d0Smrg *-*-rhapsody* | *-*-darwin1.[012]) 439395b296d0Smrg # On Rhapsody replace the C library is the System framework 439495b296d0Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 439595b296d0Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 439695b296d0Smrg ;; 439795b296d0Smrg esac 439895b296d0Smrg 439995b296d0Smrg case $host in 440095b296d0Smrg *darwin*) 440195b296d0Smrg # Don't allow lazy linking, it breaks C++ global constructors 440295b296d0Smrg if test "$tagname" = CXX ; then 440395b296d0Smrg compile_command="$compile_command ${wl}-bind_at_load" 440495b296d0Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 440595b296d0Smrg fi 440695b296d0Smrg ;; 440795b296d0Smrg esac 440895b296d0Smrg 440995b296d0Smrg 441095b296d0Smrg # move library search paths that coincide with paths to not yet 441195b296d0Smrg # installed libraries to the beginning of the library search list 441295b296d0Smrg new_libs= 441395b296d0Smrg for path in $notinst_path; do 441495b296d0Smrg case " $new_libs " in 441595b296d0Smrg *" -L$path/$objdir "*) ;; 441695b296d0Smrg *) 441795b296d0Smrg case " $compile_deplibs " in 441895b296d0Smrg *" -L$path/$objdir "*) 441995b296d0Smrg new_libs="$new_libs -L$path/$objdir" ;; 442095b296d0Smrg esac 442195b296d0Smrg ;; 442295b296d0Smrg esac 442395b296d0Smrg done 442495b296d0Smrg for deplib in $compile_deplibs; do 442595b296d0Smrg case $deplib in 442695b296d0Smrg -L*) 442795b296d0Smrg case " $new_libs " in 442895b296d0Smrg *" $deplib "*) ;; 442995b296d0Smrg *) new_libs="$new_libs $deplib" ;; 443095b296d0Smrg esac 443195b296d0Smrg ;; 443295b296d0Smrg *) new_libs="$new_libs $deplib" ;; 443395b296d0Smrg esac 443495b296d0Smrg done 443595b296d0Smrg compile_deplibs="$new_libs" 443695b296d0Smrg 443795b296d0Smrg 443895b296d0Smrg compile_command="$compile_command $compile_deplibs" 443995b296d0Smrg finalize_command="$finalize_command $finalize_deplibs" 444095b296d0Smrg 444195b296d0Smrg if test -n "$rpath$xrpath"; then 444295b296d0Smrg # If the user specified any rpath flags, then add them. 444395b296d0Smrg for libdir in $rpath $xrpath; do 444495b296d0Smrg # This is the magic to use -rpath. 444595b296d0Smrg case "$finalize_rpath " in 444695b296d0Smrg *" $libdir "*) ;; 444795b296d0Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 444895b296d0Smrg esac 444995b296d0Smrg done 445095b296d0Smrg fi 445195b296d0Smrg 445295b296d0Smrg # Now hardcode the library paths 445395b296d0Smrg rpath= 445495b296d0Smrg hardcode_libdirs= 445595b296d0Smrg for libdir in $compile_rpath $finalize_rpath; do 445695b296d0Smrg if test -n "$hardcode_libdir_flag_spec"; then 445795b296d0Smrg if test -n "$hardcode_libdir_separator"; then 445895b296d0Smrg if test -z "$hardcode_libdirs"; then 445995b296d0Smrg hardcode_libdirs="$libdir" 446095b296d0Smrg else 446195b296d0Smrg # Just accumulate the unique libdirs. 446295b296d0Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 446395b296d0Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 446495b296d0Smrg ;; 446595b296d0Smrg *) 446695b296d0Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 446795b296d0Smrg ;; 446895b296d0Smrg esac 446995b296d0Smrg fi 447095b296d0Smrg else 447195b296d0Smrg eval flag=\"$hardcode_libdir_flag_spec\" 447295b296d0Smrg rpath="$rpath $flag" 447395b296d0Smrg fi 447495b296d0Smrg elif test -n "$runpath_var"; then 447595b296d0Smrg case "$perm_rpath " in 447695b296d0Smrg *" $libdir "*) ;; 447795b296d0Smrg *) perm_rpath="$perm_rpath $libdir" ;; 447895b296d0Smrg esac 447995b296d0Smrg fi 448095b296d0Smrg case $host in 448195b296d0Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 448295b296d0Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 448395b296d0Smrg case :$dllsearchpath: in 448495b296d0Smrg *":$libdir:"*) ;; 448595b296d0Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 448695b296d0Smrg esac 448795b296d0Smrg case :$dllsearchpath: in 448895b296d0Smrg *":$testbindir:"*) ;; 448995b296d0Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 449095b296d0Smrg esac 449195b296d0Smrg ;; 449295b296d0Smrg esac 449395b296d0Smrg done 449495b296d0Smrg # Substitute the hardcoded libdirs into the rpath. 449595b296d0Smrg if test -n "$hardcode_libdir_separator" && 449695b296d0Smrg test -n "$hardcode_libdirs"; then 449795b296d0Smrg libdir="$hardcode_libdirs" 449895b296d0Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 449995b296d0Smrg fi 450095b296d0Smrg compile_rpath="$rpath" 450195b296d0Smrg 450295b296d0Smrg rpath= 450395b296d0Smrg hardcode_libdirs= 450495b296d0Smrg for libdir in $finalize_rpath; do 450595b296d0Smrg if test -n "$hardcode_libdir_flag_spec"; then 450695b296d0Smrg if test -n "$hardcode_libdir_separator"; then 450795b296d0Smrg if test -z "$hardcode_libdirs"; then 450895b296d0Smrg hardcode_libdirs="$libdir" 450995b296d0Smrg else 451095b296d0Smrg # Just accumulate the unique libdirs. 451195b296d0Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 451295b296d0Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 451395b296d0Smrg ;; 451495b296d0Smrg *) 451595b296d0Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 451695b296d0Smrg ;; 451795b296d0Smrg esac 451895b296d0Smrg fi 451995b296d0Smrg else 452095b296d0Smrg eval flag=\"$hardcode_libdir_flag_spec\" 452195b296d0Smrg rpath="$rpath $flag" 452295b296d0Smrg fi 452395b296d0Smrg elif test -n "$runpath_var"; then 452495b296d0Smrg case "$finalize_perm_rpath " in 452595b296d0Smrg *" $libdir "*) ;; 452695b296d0Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 452795b296d0Smrg esac 452895b296d0Smrg fi 452995b296d0Smrg done 453095b296d0Smrg # Substitute the hardcoded libdirs into the rpath. 453195b296d0Smrg if test -n "$hardcode_libdir_separator" && 453295b296d0Smrg test -n "$hardcode_libdirs"; then 453395b296d0Smrg libdir="$hardcode_libdirs" 453495b296d0Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 453595b296d0Smrg fi 453695b296d0Smrg finalize_rpath="$rpath" 453795b296d0Smrg 453895b296d0Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 453995b296d0Smrg # Transform all the library objects into standard objects. 454095b296d0Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 454195b296d0Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 454295b296d0Smrg fi 454395b296d0Smrg 454495b296d0Smrg dlsyms= 454595b296d0Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 454695b296d0Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 454795b296d0Smrg dlsyms="${outputname}S.c" 454895b296d0Smrg else 454995b296d0Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 455095b296d0Smrg fi 455195b296d0Smrg fi 455295b296d0Smrg 455395b296d0Smrg if test -n "$dlsyms"; then 455495b296d0Smrg case $dlsyms in 455595b296d0Smrg "") ;; 455695b296d0Smrg *.c) 455795b296d0Smrg # Discover the nlist of each of the dlfiles. 455895b296d0Smrg nlist="$output_objdir/${outputname}.nm" 455995b296d0Smrg 456095b296d0Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 456195b296d0Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 456295b296d0Smrg 456395b296d0Smrg # Parse the name list into a source file. 456495b296d0Smrg $show "creating $output_objdir/$dlsyms" 456595b296d0Smrg 456695b296d0Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 456795b296d0Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 456895b296d0Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 456995b296d0Smrg 457095b296d0Smrg#ifdef __cplusplus 457195b296d0Smrgextern \"C\" { 457295b296d0Smrg#endif 457395b296d0Smrg 457495b296d0Smrg/* Prevent the only kind of declaration conflicts we can make. */ 457595b296d0Smrg#define lt_preloaded_symbols some_other_symbol 457695b296d0Smrg 457795b296d0Smrg/* External symbol declarations for the compiler. */\ 457895b296d0Smrg" 457995b296d0Smrg 458095b296d0Smrg if test "$dlself" = yes; then 458195b296d0Smrg $show "generating symbol list for \`$output'" 458295b296d0Smrg 458395b296d0Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 458495b296d0Smrg 458595b296d0Smrg # Add our own program objects to the symbol list. 458695b296d0Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 458795b296d0Smrg for arg in $progfiles; do 458895b296d0Smrg $show "extracting global C symbols from \`$arg'" 458995b296d0Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 459095b296d0Smrg done 459195b296d0Smrg 459295b296d0Smrg if test -n "$exclude_expsyms"; then 459395b296d0Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 459495b296d0Smrg $run eval '$mv "$nlist"T "$nlist"' 459595b296d0Smrg fi 459695b296d0Smrg 459795b296d0Smrg if test -n "$export_symbols_regex"; then 459895b296d0Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 459995b296d0Smrg $run eval '$mv "$nlist"T "$nlist"' 460095b296d0Smrg fi 460195b296d0Smrg 460295b296d0Smrg # Prepare the list of exported symbols 460395b296d0Smrg if test -z "$export_symbols"; then 460495b296d0Smrg export_symbols="$output_objdir/$outputname.exp" 460595b296d0Smrg $run $rm $export_symbols 460695b296d0Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 460795b296d0Smrg case $host in 460895b296d0Smrg *cygwin* | *mingw* ) 460995b296d0Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 461095b296d0Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 461195b296d0Smrg ;; 461295b296d0Smrg esac 461395b296d0Smrg else 461495b296d0Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 461595b296d0Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 461695b296d0Smrg $run eval 'mv "$nlist"T "$nlist"' 461795b296d0Smrg case $host in 461895b296d0Smrg *cygwin* | *mingw* ) 461995b296d0Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 462095b296d0Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 462195b296d0Smrg ;; 462295b296d0Smrg esac 462395b296d0Smrg fi 462495b296d0Smrg fi 462595b296d0Smrg 462695b296d0Smrg for arg in $dlprefiles; do 462795b296d0Smrg $show "extracting global C symbols from \`$arg'" 462895b296d0Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 462995b296d0Smrg $run eval '$echo ": $name " >> "$nlist"' 463095b296d0Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 463195b296d0Smrg done 463295b296d0Smrg 463395b296d0Smrg if test -z "$run"; then 463495b296d0Smrg # Make sure we have at least an empty file. 463595b296d0Smrg test -f "$nlist" || : > "$nlist" 463695b296d0Smrg 463795b296d0Smrg if test -n "$exclude_expsyms"; then 463895b296d0Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 463995b296d0Smrg $mv "$nlist"T "$nlist" 464095b296d0Smrg fi 464195b296d0Smrg 464295b296d0Smrg # Try sorting and uniquifying the output. 464395b296d0Smrg if grep -v "^: " < "$nlist" | 464495b296d0Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 464595b296d0Smrg sort -k 3 464695b296d0Smrg else 464795b296d0Smrg sort +2 464895b296d0Smrg fi | 464995b296d0Smrg uniq > "$nlist"S; then 465095b296d0Smrg : 465195b296d0Smrg else 465295b296d0Smrg grep -v "^: " < "$nlist" > "$nlist"S 465395b296d0Smrg fi 465495b296d0Smrg 465595b296d0Smrg if test -f "$nlist"S; then 465695b296d0Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 465795b296d0Smrg else 465895b296d0Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 465995b296d0Smrg fi 466095b296d0Smrg 466195b296d0Smrg $echo >> "$output_objdir/$dlsyms" "\ 466295b296d0Smrg 466395b296d0Smrg#undef lt_preloaded_symbols 466495b296d0Smrg 466595b296d0Smrg#if defined (__STDC__) && __STDC__ 466695b296d0Smrg# define lt_ptr void * 466795b296d0Smrg#else 466895b296d0Smrg# define lt_ptr char * 466995b296d0Smrg# define const 467095b296d0Smrg#endif 467195b296d0Smrg 467295b296d0Smrg/* The mapping between symbol names and symbols. */ 467395b296d0Smrg" 467495b296d0Smrg 467595b296d0Smrg case $host in 467695b296d0Smrg *cygwin* | *mingw* ) 467795b296d0Smrg $echo >> "$output_objdir/$dlsyms" "\ 467895b296d0Smrg/* DATA imports from DLLs on WIN32 can't be const, because 467995b296d0Smrg runtime relocations are performed -- see ld's documentation 468095b296d0Smrg on pseudo-relocs */ 468195b296d0Smrgstruct { 468295b296d0Smrg" 468395b296d0Smrg ;; 468495b296d0Smrg * ) 468595b296d0Smrg $echo >> "$output_objdir/$dlsyms" "\ 468695b296d0Smrgconst struct { 468795b296d0Smrg" 468895b296d0Smrg ;; 468995b296d0Smrg esac 469095b296d0Smrg 469195b296d0Smrg 469295b296d0Smrg $echo >> "$output_objdir/$dlsyms" "\ 469395b296d0Smrg const char *name; 469495b296d0Smrg lt_ptr address; 469595b296d0Smrg} 469695b296d0Smrglt_preloaded_symbols[] = 469795b296d0Smrg{\ 469895b296d0Smrg" 469995b296d0Smrg 470095b296d0Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 470195b296d0Smrg 470295b296d0Smrg $echo >> "$output_objdir/$dlsyms" "\ 470395b296d0Smrg {0, (lt_ptr) 0} 470495b296d0Smrg}; 470595b296d0Smrg 470695b296d0Smrg/* This works around a problem in FreeBSD linker */ 470795b296d0Smrg#ifdef FREEBSD_WORKAROUND 470895b296d0Smrgstatic const void *lt_preloaded_setup() { 470995b296d0Smrg return lt_preloaded_symbols; 471095b296d0Smrg} 471195b296d0Smrg#endif 471295b296d0Smrg 471395b296d0Smrg#ifdef __cplusplus 471495b296d0Smrg} 471595b296d0Smrg#endif\ 471695b296d0Smrg" 471795b296d0Smrg fi 471895b296d0Smrg 471995b296d0Smrg pic_flag_for_symtable= 472095b296d0Smrg case $host in 472195b296d0Smrg # compiling the symbol table file with pic_flag works around 472295b296d0Smrg # a FreeBSD bug that causes programs to crash when -lm is 472395b296d0Smrg # linked before any other PIC object. But we must not use 472495b296d0Smrg # pic_flag when linking with -static. The problem exists in 472595b296d0Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 472695b296d0Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 472795b296d0Smrg case "$compile_command " in 472895b296d0Smrg *" -static "*) ;; 472995b296d0Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 473095b296d0Smrg esac;; 473195b296d0Smrg *-*-hpux*) 473295b296d0Smrg case "$compile_command " in 473395b296d0Smrg *" -static "*) ;; 473495b296d0Smrg *) pic_flag_for_symtable=" $pic_flag";; 473595b296d0Smrg esac 473695b296d0Smrg esac 473795b296d0Smrg 473895b296d0Smrg # Now compile the dynamic symbol file. 473995b296d0Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 474095b296d0Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 474195b296d0Smrg 474295b296d0Smrg # Clean up the generated files. 474395b296d0Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 474495b296d0Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 474595b296d0Smrg 474695b296d0Smrg # Transform the symbol file into the correct name. 474795b296d0Smrg case $host in 474895b296d0Smrg *cygwin* | *mingw* ) 474995b296d0Smrg if test -f "$output_objdir/${outputname}.def" ; then 475095b296d0Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 475195b296d0Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 475295b296d0Smrg else 475395b296d0Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 475495b296d0Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 475595b296d0Smrg fi 475695b296d0Smrg ;; 475795b296d0Smrg * ) 475895b296d0Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 475995b296d0Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 476095b296d0Smrg ;; 476195b296d0Smrg esac 476295b296d0Smrg ;; 476395b296d0Smrg *) 476495b296d0Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 476595b296d0Smrg exit $EXIT_FAILURE 476695b296d0Smrg ;; 476795b296d0Smrg esac 476895b296d0Smrg else 476995b296d0Smrg # We keep going just in case the user didn't refer to 477095b296d0Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 477195b296d0Smrg # really was required. 477295b296d0Smrg 477395b296d0Smrg # Nullify the symbol file. 477495b296d0Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 477595b296d0Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 477695b296d0Smrg fi 477795b296d0Smrg 477895b296d0Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 477995b296d0Smrg # Replace the output file specification. 478095b296d0Smrg compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 478195b296d0Smrg link_command="$compile_command$compile_rpath" 478295b296d0Smrg 478395b296d0Smrg # We have no uninstalled library dependencies, so finalize right now. 478495b296d0Smrg $show "$link_command" 478595b296d0Smrg $run eval "$link_command" 478695b296d0Smrg exit_status=$? 478795b296d0Smrg 478895b296d0Smrg # Delete the generated files. 478995b296d0Smrg if test -n "$dlsyms"; then 479095b296d0Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 479195b296d0Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 479295b296d0Smrg fi 479395b296d0Smrg 479495b296d0Smrg exit $exit_status 479595b296d0Smrg fi 479695b296d0Smrg 479795b296d0Smrg if test -n "$shlibpath_var"; then 479895b296d0Smrg # We should set the shlibpath_var 479995b296d0Smrg rpath= 480095b296d0Smrg for dir in $temp_rpath; do 480195b296d0Smrg case $dir in 480295b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) 480395b296d0Smrg # Absolute path. 480495b296d0Smrg rpath="$rpath$dir:" 480595b296d0Smrg ;; 480695b296d0Smrg *) 480795b296d0Smrg # Relative path: add a thisdir entry. 480895b296d0Smrg rpath="$rpath\$thisdir/$dir:" 480995b296d0Smrg ;; 481095b296d0Smrg esac 481195b296d0Smrg done 481295b296d0Smrg temp_rpath="$rpath" 481395b296d0Smrg fi 481495b296d0Smrg 481595b296d0Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 481695b296d0Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 481795b296d0Smrg fi 481895b296d0Smrg if test -n "$finalize_shlibpath"; then 481995b296d0Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 482095b296d0Smrg fi 482195b296d0Smrg 482295b296d0Smrg compile_var= 482395b296d0Smrg finalize_var= 482495b296d0Smrg if test -n "$runpath_var"; then 482595b296d0Smrg if test -n "$perm_rpath"; then 482695b296d0Smrg # We should set the runpath_var. 482795b296d0Smrg rpath= 482895b296d0Smrg for dir in $perm_rpath; do 482995b296d0Smrg rpath="$rpath$dir:" 483095b296d0Smrg done 483195b296d0Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 483295b296d0Smrg fi 483395b296d0Smrg if test -n "$finalize_perm_rpath"; then 483495b296d0Smrg # We should set the runpath_var. 483595b296d0Smrg rpath= 483695b296d0Smrg for dir in $finalize_perm_rpath; do 483795b296d0Smrg rpath="$rpath$dir:" 483895b296d0Smrg done 483995b296d0Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 484095b296d0Smrg fi 484195b296d0Smrg fi 484295b296d0Smrg 484395b296d0Smrg if test "$no_install" = yes; then 484495b296d0Smrg # We don't need to create a wrapper script. 484595b296d0Smrg link_command="$compile_var$compile_command$compile_rpath" 484695b296d0Smrg # Replace the output file specification. 484795b296d0Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 484895b296d0Smrg # Delete the old output file. 484995b296d0Smrg $run $rm $output 485095b296d0Smrg # Link the executable and exit 485195b296d0Smrg $show "$link_command" 485295b296d0Smrg $run eval "$link_command" || exit $? 485395b296d0Smrg exit $EXIT_SUCCESS 485495b296d0Smrg fi 485595b296d0Smrg 485695b296d0Smrg if test "$hardcode_action" = relink; then 485795b296d0Smrg # Fast installation is not supported 485895b296d0Smrg link_command="$compile_var$compile_command$compile_rpath" 485995b296d0Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 486095b296d0Smrg 486195b296d0Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 486295b296d0Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 486395b296d0Smrg else 486495b296d0Smrg if test "$fast_install" != no; then 486595b296d0Smrg link_command="$finalize_var$compile_command$finalize_rpath" 486695b296d0Smrg if test "$fast_install" = yes; then 486795b296d0Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 486895b296d0Smrg else 486995b296d0Smrg # fast_install is set to needless 487095b296d0Smrg relink_command= 487195b296d0Smrg fi 487295b296d0Smrg else 487395b296d0Smrg link_command="$compile_var$compile_command$compile_rpath" 487495b296d0Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 487595b296d0Smrg fi 487695b296d0Smrg fi 487795b296d0Smrg 487895b296d0Smrg # Replace the output file specification. 487995b296d0Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 488095b296d0Smrg 488195b296d0Smrg # Delete the old output files. 488295b296d0Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 488395b296d0Smrg 488495b296d0Smrg $show "$link_command" 488595b296d0Smrg $run eval "$link_command" || exit $? 488695b296d0Smrg 488795b296d0Smrg # Now create the wrapper script. 488895b296d0Smrg $show "creating $output" 488995b296d0Smrg 489095b296d0Smrg # Quote the relink command for shipping. 489195b296d0Smrg if test -n "$relink_command"; then 489295b296d0Smrg # Preserve any variables that may affect compiler behavior 489395b296d0Smrg for var in $variables_saved_for_relink; do 489495b296d0Smrg if eval test -z \"\${$var+set}\"; then 489595b296d0Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 489695b296d0Smrg elif eval var_value=\$$var; test -z "$var_value"; then 489795b296d0Smrg relink_command="$var=; export $var; $relink_command" 489895b296d0Smrg else 489995b296d0Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 490095b296d0Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 490195b296d0Smrg fi 490295b296d0Smrg done 490395b296d0Smrg relink_command="(cd `pwd`; $relink_command)" 490495b296d0Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 490595b296d0Smrg fi 490695b296d0Smrg 490795b296d0Smrg # Quote $echo for shipping. 490895b296d0Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 490995b296d0Smrg case $progpath in 491095b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 491195b296d0Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 491295b296d0Smrg esac 491395b296d0Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 491495b296d0Smrg else 491595b296d0Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 491695b296d0Smrg fi 491795b296d0Smrg 491895b296d0Smrg # Only actually do things if our run command is non-null. 491995b296d0Smrg if test -z "$run"; then 492095b296d0Smrg # win32 will think the script is a binary if it has 492195b296d0Smrg # a .exe suffix, so we strip it off here. 492295b296d0Smrg case $output in 492395b296d0Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 492495b296d0Smrg esac 492595b296d0Smrg # test for cygwin because mv fails w/o .exe extensions 492695b296d0Smrg case $host in 492795b296d0Smrg *cygwin*) 492895b296d0Smrg exeext=.exe 492995b296d0Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 493095b296d0Smrg *) exeext= ;; 493195b296d0Smrg esac 493295b296d0Smrg case $host in 493395b296d0Smrg *cygwin* | *mingw* ) 493495b296d0Smrg output_name=`basename $output` 493595b296d0Smrg output_path=`dirname $output` 493695b296d0Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 493795b296d0Smrg cwrapper="$output_path/$output_name.exe" 493895b296d0Smrg $rm $cwrappersource $cwrapper 493995b296d0Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 494095b296d0Smrg 494195b296d0Smrg cat > $cwrappersource <<EOF 494295b296d0Smrg 494395b296d0Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 494495b296d0Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 494595b296d0Smrg 494695b296d0Smrg The $output program cannot be directly executed until all the libtool 494795b296d0Smrg libraries that it depends on are installed. 494895b296d0Smrg 494995b296d0Smrg This wrapper executable should never be moved out of the build directory. 495095b296d0Smrg If it is, it will not operate correctly. 495195b296d0Smrg 495295b296d0Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 495395b296d0Smrg but could eventually absorb all of the scripts functionality and 495495b296d0Smrg exec $objdir/$outputname directly. 495595b296d0Smrg*/ 495695b296d0SmrgEOF 495795b296d0Smrg cat >> $cwrappersource<<"EOF" 495895b296d0Smrg#include <stdio.h> 495995b296d0Smrg#include <stdlib.h> 496095b296d0Smrg#include <unistd.h> 496195b296d0Smrg#include <malloc.h> 496295b296d0Smrg#include <stdarg.h> 496395b296d0Smrg#include <assert.h> 496495b296d0Smrg#include <string.h> 496595b296d0Smrg#include <ctype.h> 496695b296d0Smrg#include <sys/stat.h> 496795b296d0Smrg 496895b296d0Smrg#if defined(PATH_MAX) 496995b296d0Smrg# define LT_PATHMAX PATH_MAX 497095b296d0Smrg#elif defined(MAXPATHLEN) 497195b296d0Smrg# define LT_PATHMAX MAXPATHLEN 497295b296d0Smrg#else 497395b296d0Smrg# define LT_PATHMAX 1024 497495b296d0Smrg#endif 497595b296d0Smrg 497695b296d0Smrg#ifndef DIR_SEPARATOR 497795b296d0Smrg# define DIR_SEPARATOR '/' 497895b296d0Smrg# define PATH_SEPARATOR ':' 497995b296d0Smrg#endif 498095b296d0Smrg 498195b296d0Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 498295b296d0Smrg defined (__OS2__) 498395b296d0Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 498495b296d0Smrg# ifndef DIR_SEPARATOR_2 498595b296d0Smrg# define DIR_SEPARATOR_2 '\\' 498695b296d0Smrg# endif 498795b296d0Smrg# ifndef PATH_SEPARATOR_2 498895b296d0Smrg# define PATH_SEPARATOR_2 ';' 498995b296d0Smrg# endif 499095b296d0Smrg#endif 499195b296d0Smrg 499295b296d0Smrg#ifndef DIR_SEPARATOR_2 499395b296d0Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 499495b296d0Smrg#else /* DIR_SEPARATOR_2 */ 499595b296d0Smrg# define IS_DIR_SEPARATOR(ch) \ 499695b296d0Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 499795b296d0Smrg#endif /* DIR_SEPARATOR_2 */ 499895b296d0Smrg 499995b296d0Smrg#ifndef PATH_SEPARATOR_2 500095b296d0Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 500195b296d0Smrg#else /* PATH_SEPARATOR_2 */ 500295b296d0Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 500395b296d0Smrg#endif /* PATH_SEPARATOR_2 */ 500495b296d0Smrg 500595b296d0Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 500695b296d0Smrg#define XFREE(stale) do { \ 500795b296d0Smrg if (stale) { free ((void *) stale); stale = 0; } \ 500895b296d0Smrg} while (0) 500995b296d0Smrg 501095b296d0Smrg/* -DDEBUG is fairly common in CFLAGS. */ 501195b296d0Smrg#undef DEBUG 501295b296d0Smrg#if defined DEBUGWRAPPER 501395b296d0Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 501495b296d0Smrg#else 501595b296d0Smrg# define DEBUG(format, ...) 501695b296d0Smrg#endif 501795b296d0Smrg 501895b296d0Smrgconst char *program_name = NULL; 501995b296d0Smrg 502095b296d0Smrgvoid * xmalloc (size_t num); 502195b296d0Smrgchar * xstrdup (const char *string); 502295b296d0Smrgconst char * base_name (const char *name); 502395b296d0Smrgchar * find_executable(const char *wrapper); 502495b296d0Smrgint check_executable(const char *path); 502595b296d0Smrgchar * strendzap(char *str, const char *pat); 502695b296d0Smrgvoid lt_fatal (const char *message, ...); 502795b296d0Smrg 502895b296d0Smrgint 502995b296d0Smrgmain (int argc, char *argv[]) 503095b296d0Smrg{ 503195b296d0Smrg char **newargz; 503295b296d0Smrg int i; 503395b296d0Smrg 503495b296d0Smrg program_name = (char *) xstrdup (base_name (argv[0])); 503595b296d0Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 503695b296d0Smrg DEBUG("(main) program_name : %s\n",program_name); 503795b296d0Smrg newargz = XMALLOC(char *, argc+2); 503895b296d0SmrgEOF 503995b296d0Smrg 504095b296d0Smrg cat >> $cwrappersource <<EOF 504195b296d0Smrg newargz[0] = (char *) xstrdup("$SHELL"); 504295b296d0SmrgEOF 504395b296d0Smrg 504495b296d0Smrg cat >> $cwrappersource <<"EOF" 504595b296d0Smrg newargz[1] = find_executable(argv[0]); 504695b296d0Smrg if (newargz[1] == NULL) 504795b296d0Smrg lt_fatal("Couldn't find %s", argv[0]); 504895b296d0Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 504995b296d0Smrg /* we know the script has the same name, without the .exe */ 505095b296d0Smrg /* so make sure newargz[1] doesn't end in .exe */ 505195b296d0Smrg strendzap(newargz[1],".exe"); 505295b296d0Smrg for (i = 1; i < argc; i++) 505395b296d0Smrg newargz[i+1] = xstrdup(argv[i]); 505495b296d0Smrg newargz[argc+1] = NULL; 505595b296d0Smrg 505695b296d0Smrg for (i=0; i<argc+1; i++) 505795b296d0Smrg { 505895b296d0Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 505995b296d0Smrg ; 506095b296d0Smrg } 506195b296d0Smrg 506295b296d0SmrgEOF 506395b296d0Smrg 506495b296d0Smrg case $host_os in 506595b296d0Smrg mingw*) 506695b296d0Smrg cat >> $cwrappersource <<EOF 506795b296d0Smrg execv("$SHELL",(char const **)newargz); 506895b296d0SmrgEOF 506995b296d0Smrg ;; 507095b296d0Smrg *) 507195b296d0Smrg cat >> $cwrappersource <<EOF 507295b296d0Smrg execv("$SHELL",newargz); 507395b296d0SmrgEOF 507495b296d0Smrg ;; 507595b296d0Smrg esac 507695b296d0Smrg 507795b296d0Smrg cat >> $cwrappersource <<"EOF" 507895b296d0Smrg return 127; 507995b296d0Smrg} 508095b296d0Smrg 508195b296d0Smrgvoid * 508295b296d0Smrgxmalloc (size_t num) 508395b296d0Smrg{ 508495b296d0Smrg void * p = (void *) malloc (num); 508595b296d0Smrg if (!p) 508695b296d0Smrg lt_fatal ("Memory exhausted"); 508795b296d0Smrg 508895b296d0Smrg return p; 508995b296d0Smrg} 509095b296d0Smrg 509195b296d0Smrgchar * 509295b296d0Smrgxstrdup (const char *string) 509395b296d0Smrg{ 509495b296d0Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 509595b296d0Smrg; 509695b296d0Smrg} 509795b296d0Smrg 509895b296d0Smrgconst char * 509995b296d0Smrgbase_name (const char *name) 510095b296d0Smrg{ 510195b296d0Smrg const char *base; 510295b296d0Smrg 510395b296d0Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 510495b296d0Smrg /* Skip over the disk name in MSDOS pathnames. */ 510595b296d0Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 510695b296d0Smrg name += 2; 510795b296d0Smrg#endif 510895b296d0Smrg 510995b296d0Smrg for (base = name; *name; name++) 511095b296d0Smrg if (IS_DIR_SEPARATOR (*name)) 511195b296d0Smrg base = name + 1; 511295b296d0Smrg return base; 511395b296d0Smrg} 511495b296d0Smrg 511595b296d0Smrgint 511695b296d0Smrgcheck_executable(const char * path) 511795b296d0Smrg{ 511895b296d0Smrg struct stat st; 511995b296d0Smrg 512095b296d0Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 512195b296d0Smrg if ((!path) || (!*path)) 512295b296d0Smrg return 0; 512395b296d0Smrg 512495b296d0Smrg if ((stat (path, &st) >= 0) && 512595b296d0Smrg ( 512695b296d0Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 512795b296d0Smrg#if defined (S_IXOTH) 512895b296d0Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 512995b296d0Smrg#endif 513095b296d0Smrg#if defined (S_IXGRP) 513195b296d0Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 513295b296d0Smrg#endif 513395b296d0Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 513495b296d0Smrg ) 513595b296d0Smrg return 1; 513695b296d0Smrg else 513795b296d0Smrg return 0; 513895b296d0Smrg} 513995b296d0Smrg 514095b296d0Smrg/* Searches for the full path of the wrapper. Returns 514195b296d0Smrg newly allocated full path name if found, NULL otherwise */ 514295b296d0Smrgchar * 514395b296d0Smrgfind_executable (const char* wrapper) 514495b296d0Smrg{ 514595b296d0Smrg int has_slash = 0; 514695b296d0Smrg const char* p; 514795b296d0Smrg const char* p_next; 514895b296d0Smrg /* static buffer for getcwd */ 514995b296d0Smrg char tmp[LT_PATHMAX + 1]; 515095b296d0Smrg int tmp_len; 515195b296d0Smrg char* concat_name; 515295b296d0Smrg 515395b296d0Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 515495b296d0Smrg 515595b296d0Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 515695b296d0Smrg return NULL; 515795b296d0Smrg 515895b296d0Smrg /* Absolute path? */ 515995b296d0Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 516095b296d0Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 516195b296d0Smrg { 516295b296d0Smrg concat_name = xstrdup (wrapper); 516395b296d0Smrg if (check_executable(concat_name)) 516495b296d0Smrg return concat_name; 516595b296d0Smrg XFREE(concat_name); 516695b296d0Smrg } 516795b296d0Smrg else 516895b296d0Smrg { 516995b296d0Smrg#endif 517095b296d0Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 517195b296d0Smrg { 517295b296d0Smrg concat_name = xstrdup (wrapper); 517395b296d0Smrg if (check_executable(concat_name)) 517495b296d0Smrg return concat_name; 517595b296d0Smrg XFREE(concat_name); 517695b296d0Smrg } 517795b296d0Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 517895b296d0Smrg } 517995b296d0Smrg#endif 518095b296d0Smrg 518195b296d0Smrg for (p = wrapper; *p; p++) 518295b296d0Smrg if (*p == '/') 518395b296d0Smrg { 518495b296d0Smrg has_slash = 1; 518595b296d0Smrg break; 518695b296d0Smrg } 518795b296d0Smrg if (!has_slash) 518895b296d0Smrg { 518995b296d0Smrg /* no slashes; search PATH */ 519095b296d0Smrg const char* path = getenv ("PATH"); 519195b296d0Smrg if (path != NULL) 519295b296d0Smrg { 519395b296d0Smrg for (p = path; *p; p = p_next) 519495b296d0Smrg { 519595b296d0Smrg const char* q; 519695b296d0Smrg size_t p_len; 519795b296d0Smrg for (q = p; *q; q++) 519895b296d0Smrg if (IS_PATH_SEPARATOR(*q)) 519995b296d0Smrg break; 520095b296d0Smrg p_len = q - p; 520195b296d0Smrg p_next = (*q == '\0' ? q : q + 1); 520295b296d0Smrg if (p_len == 0) 520395b296d0Smrg { 520495b296d0Smrg /* empty path: current directory */ 520595b296d0Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 520695b296d0Smrg lt_fatal ("getcwd failed"); 520795b296d0Smrg tmp_len = strlen(tmp); 520895b296d0Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 520995b296d0Smrg memcpy (concat_name, tmp, tmp_len); 521095b296d0Smrg concat_name[tmp_len] = '/'; 521195b296d0Smrg strcpy (concat_name + tmp_len + 1, wrapper); 521295b296d0Smrg } 521395b296d0Smrg else 521495b296d0Smrg { 521595b296d0Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 521695b296d0Smrg memcpy (concat_name, p, p_len); 521795b296d0Smrg concat_name[p_len] = '/'; 521895b296d0Smrg strcpy (concat_name + p_len + 1, wrapper); 521995b296d0Smrg } 522095b296d0Smrg if (check_executable(concat_name)) 522195b296d0Smrg return concat_name; 522295b296d0Smrg XFREE(concat_name); 522395b296d0Smrg } 522495b296d0Smrg } 522595b296d0Smrg /* not found in PATH; assume curdir */ 522695b296d0Smrg } 522795b296d0Smrg /* Relative path | not found in path: prepend cwd */ 522895b296d0Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 522995b296d0Smrg lt_fatal ("getcwd failed"); 523095b296d0Smrg tmp_len = strlen(tmp); 523195b296d0Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 523295b296d0Smrg memcpy (concat_name, tmp, tmp_len); 523395b296d0Smrg concat_name[tmp_len] = '/'; 523495b296d0Smrg strcpy (concat_name + tmp_len + 1, wrapper); 523595b296d0Smrg 523695b296d0Smrg if (check_executable(concat_name)) 523795b296d0Smrg return concat_name; 523895b296d0Smrg XFREE(concat_name); 523995b296d0Smrg return NULL; 524095b296d0Smrg} 524195b296d0Smrg 524295b296d0Smrgchar * 524395b296d0Smrgstrendzap(char *str, const char *pat) 524495b296d0Smrg{ 524595b296d0Smrg size_t len, patlen; 524695b296d0Smrg 524795b296d0Smrg assert(str != NULL); 524895b296d0Smrg assert(pat != NULL); 524995b296d0Smrg 525095b296d0Smrg len = strlen(str); 525195b296d0Smrg patlen = strlen(pat); 525295b296d0Smrg 525395b296d0Smrg if (patlen <= len) 525495b296d0Smrg { 525595b296d0Smrg str += len - patlen; 525695b296d0Smrg if (strcmp(str, pat) == 0) 525795b296d0Smrg *str = '\0'; 525895b296d0Smrg } 525995b296d0Smrg return str; 526095b296d0Smrg} 526195b296d0Smrg 526295b296d0Smrgstatic void 526395b296d0Smrglt_error_core (int exit_status, const char * mode, 526495b296d0Smrg const char * message, va_list ap) 526595b296d0Smrg{ 526695b296d0Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 526795b296d0Smrg vfprintf (stderr, message, ap); 526895b296d0Smrg fprintf (stderr, ".\n"); 526995b296d0Smrg 527095b296d0Smrg if (exit_status >= 0) 527195b296d0Smrg exit (exit_status); 527295b296d0Smrg} 527395b296d0Smrg 527495b296d0Smrgvoid 527595b296d0Smrglt_fatal (const char *message, ...) 527695b296d0Smrg{ 527795b296d0Smrg va_list ap; 527895b296d0Smrg va_start (ap, message); 527995b296d0Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 528095b296d0Smrg va_end (ap); 528195b296d0Smrg} 528295b296d0SmrgEOF 528395b296d0Smrg # we should really use a build-platform specific compiler 528495b296d0Smrg # here, but OTOH, the wrappers (shell script and this C one) 528595b296d0Smrg # are only useful if you want to execute the "real" binary. 528695b296d0Smrg # Since the "real" binary is built for $host, then this 528795b296d0Smrg # wrapper might as well be built for $host, too. 528895b296d0Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 528995b296d0Smrg ;; 529095b296d0Smrg esac 529195b296d0Smrg $rm $output 529295b296d0Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 529395b296d0Smrg 529495b296d0Smrg $echo > $output "\ 529595b296d0Smrg#! $SHELL 529695b296d0Smrg 529795b296d0Smrg# $output - temporary wrapper script for $objdir/$outputname 529895b296d0Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 529995b296d0Smrg# 530095b296d0Smrg# The $output program cannot be directly executed until all the libtool 530195b296d0Smrg# libraries that it depends on are installed. 530295b296d0Smrg# 530395b296d0Smrg# This wrapper script should never be moved out of the build directory. 530495b296d0Smrg# If it is, it will not operate correctly. 530595b296d0Smrg 530695b296d0Smrg# Sed substitution that helps us do robust quoting. It backslashifies 530795b296d0Smrg# metacharacters that are still active within double-quoted strings. 530895b296d0SmrgXsed='${SED} -e 1s/^X//' 530995b296d0Smrgsed_quote_subst='$sed_quote_subst' 531095b296d0Smrg 531195b296d0Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 531295b296d0Smrg# if CDPATH is set. 531395b296d0Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 531495b296d0Smrg 531595b296d0Smrgrelink_command=\"$relink_command\" 531695b296d0Smrg 531795b296d0Smrg# This environment variable determines our operation mode. 531895b296d0Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 531995b296d0Smrg # install mode needs the following variable: 532095b296d0Smrg notinst_deplibs='$notinst_deplibs' 532195b296d0Smrgelse 532295b296d0Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 532395b296d0Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 532495b296d0Smrg echo=\"$qecho\" 532595b296d0Smrg file=\"\$0\" 532695b296d0Smrg # Make sure echo works. 532795b296d0Smrg if test \"X\$1\" = X--no-reexec; then 532895b296d0Smrg # Discard the --no-reexec flag, and continue. 532995b296d0Smrg shift 533095b296d0Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 533195b296d0Smrg # Yippee, \$echo works! 533295b296d0Smrg : 533395b296d0Smrg else 533495b296d0Smrg # Restart under the correct shell, and then maybe \$echo will work. 533595b296d0Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 533695b296d0Smrg fi 533795b296d0Smrg fi\ 533895b296d0Smrg" 533995b296d0Smrg $echo >> $output "\ 534095b296d0Smrg 534195b296d0Smrg # Find the directory that this script lives in. 534295b296d0Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 534395b296d0Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 534495b296d0Smrg 534595b296d0Smrg # Follow symbolic links until we get to the real thisdir. 534695b296d0Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 534795b296d0Smrg while test -n \"\$file\"; do 534895b296d0Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 534995b296d0Smrg 535095b296d0Smrg # If there was a directory component, then change thisdir. 535195b296d0Smrg if test \"x\$destdir\" != \"x\$file\"; then 535295b296d0Smrg case \"\$destdir\" in 535395b296d0Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 535495b296d0Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 535595b296d0Smrg esac 535695b296d0Smrg fi 535795b296d0Smrg 535895b296d0Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 535995b296d0Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 536095b296d0Smrg done 536195b296d0Smrg 536295b296d0Smrg # Try to get the absolute directory name. 536395b296d0Smrg absdir=\`cd \"\$thisdir\" && pwd\` 536495b296d0Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 536595b296d0Smrg" 536695b296d0Smrg 536795b296d0Smrg if test "$fast_install" = yes; then 536895b296d0Smrg $echo >> $output "\ 536995b296d0Smrg program=lt-'$outputname'$exeext 537095b296d0Smrg progdir=\"\$thisdir/$objdir\" 537195b296d0Smrg 537295b296d0Smrg if test ! -f \"\$progdir/\$program\" || \\ 537395b296d0Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 537495b296d0Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 537595b296d0Smrg 537695b296d0Smrg file=\"\$\$-\$program\" 537795b296d0Smrg 537895b296d0Smrg if test ! -d \"\$progdir\"; then 537995b296d0Smrg $mkdir \"\$progdir\" 538095b296d0Smrg else 538195b296d0Smrg $rm \"\$progdir/\$file\" 538295b296d0Smrg fi" 538395b296d0Smrg 538495b296d0Smrg $echo >> $output "\ 538595b296d0Smrg 538695b296d0Smrg # relink executable if necessary 538795b296d0Smrg if test -n \"\$relink_command\"; then 538895b296d0Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 538995b296d0Smrg else 539095b296d0Smrg $echo \"\$relink_command_output\" >&2 539195b296d0Smrg $rm \"\$progdir/\$file\" 539295b296d0Smrg exit $EXIT_FAILURE 539395b296d0Smrg fi 539495b296d0Smrg fi 539595b296d0Smrg 539695b296d0Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 539795b296d0Smrg { $rm \"\$progdir/\$program\"; 539895b296d0Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 539995b296d0Smrg $rm \"\$progdir/\$file\" 540095b296d0Smrg fi" 540195b296d0Smrg else 540295b296d0Smrg $echo >> $output "\ 540395b296d0Smrg program='$outputname' 540495b296d0Smrg progdir=\"\$thisdir/$objdir\" 540595b296d0Smrg" 540695b296d0Smrg fi 540795b296d0Smrg 540895b296d0Smrg $echo >> $output "\ 540995b296d0Smrg 541095b296d0Smrg if test -f \"\$progdir/\$program\"; then" 541195b296d0Smrg 541295b296d0Smrg # Export our shlibpath_var if we have one. 541395b296d0Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 541495b296d0Smrg $echo >> $output "\ 541595b296d0Smrg # Add our own library path to $shlibpath_var 541695b296d0Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 541795b296d0Smrg 541895b296d0Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 541995b296d0Smrg # The second colon is a workaround for a bug in BeOS R4 sed 542095b296d0Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 542195b296d0Smrg 542295b296d0Smrg export $shlibpath_var 542395b296d0Smrg" 542495b296d0Smrg fi 542595b296d0Smrg 542695b296d0Smrg # fixup the dll searchpath if we need to. 542795b296d0Smrg if test -n "$dllsearchpath"; then 542895b296d0Smrg $echo >> $output "\ 542995b296d0Smrg # Add the dll search path components to the executable PATH 543095b296d0Smrg PATH=$dllsearchpath:\$PATH 543195b296d0Smrg" 543295b296d0Smrg fi 543395b296d0Smrg 543495b296d0Smrg $echo >> $output "\ 543595b296d0Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 543695b296d0Smrg # Run the actual program with our arguments. 543795b296d0Smrg 543895b296d0Smrg # Make sure env LD_LIBRARY_PATH does not mess us up 543995b296d0Smrg if test -n \"\${LD_LIBRARY_PATH+set}\"; then 544095b296d0Smrg export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH 544195b296d0Smrg fi 544295b296d0Smrg" 544395b296d0Smrg case $host in 544495b296d0Smrg # Backslashes separate directories on plain windows 544595b296d0Smrg *-*-mingw | *-*-os2*) 544695b296d0Smrg $echo >> $output "\ 544795b296d0Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 544895b296d0Smrg" 544995b296d0Smrg ;; 545095b296d0Smrg 545195b296d0Smrg *) 545295b296d0Smrg $echo >> $output "\ 545395b296d0Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 545495b296d0Smrg" 545595b296d0Smrg ;; 545695b296d0Smrg esac 545795b296d0Smrg $echo >> $output "\ 545895b296d0Smrg \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 545995b296d0Smrg exit $EXIT_FAILURE 546095b296d0Smrg fi 546195b296d0Smrg else 546295b296d0Smrg # The program doesn't exist. 546395b296d0Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 546495b296d0Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 546595b296d0Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 546695b296d0Smrg exit $EXIT_FAILURE 546795b296d0Smrg fi 546895b296d0Smrgfi\ 546995b296d0Smrg" 547095b296d0Smrg chmod +x $output 547195b296d0Smrg fi 547295b296d0Smrg exit $EXIT_SUCCESS 547395b296d0Smrg ;; 547495b296d0Smrg esac 547595b296d0Smrg 547695b296d0Smrg # See if we need to build an old-fashioned archive. 547795b296d0Smrg for oldlib in $oldlibs; do 547895b296d0Smrg 547995b296d0Smrg if test "$build_libtool_libs" = convenience; then 548095b296d0Smrg oldobjs="$libobjs_save" 548195b296d0Smrg addlibs="$convenience" 548295b296d0Smrg build_libtool_libs=no 548395b296d0Smrg else 548495b296d0Smrg if test "$build_libtool_libs" = module; then 548595b296d0Smrg oldobjs="$libobjs_save" 548695b296d0Smrg build_libtool_libs=no 548795b296d0Smrg else 548895b296d0Smrg oldobjs="$old_deplibs $non_pic_objects" 548995b296d0Smrg fi 549095b296d0Smrg addlibs="$old_convenience" 549195b296d0Smrg fi 549295b296d0Smrg 549395b296d0Smrg if test -n "$addlibs"; then 549495b296d0Smrg gentop="$output_objdir/${outputname}x" 549595b296d0Smrg generated="$generated $gentop" 549695b296d0Smrg 549795b296d0Smrg func_extract_archives $gentop $addlibs 549895b296d0Smrg oldobjs="$oldobjs $func_extract_archives_result" 549995b296d0Smrg fi 550095b296d0Smrg 550195b296d0Smrg # Do each command in the archive commands. 550295b296d0Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 550395b296d0Smrg cmds=$old_archive_from_new_cmds 550495b296d0Smrg else 550595b296d0Smrg # POSIX demands no paths to be encoded in archives. We have 550695b296d0Smrg # to avoid creating archives with duplicate basenames if we 550795b296d0Smrg # might have to extract them afterwards, e.g., when creating a 550895b296d0Smrg # static archive out of a convenience library, or when linking 550995b296d0Smrg # the entirety of a libtool archive into another (currently 551095b296d0Smrg # not supported by libtool). 551195b296d0Smrg if (for obj in $oldobjs 551295b296d0Smrg do 551395b296d0Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 551495b296d0Smrg done | sort | sort -uc >/dev/null 2>&1); then 551595b296d0Smrg : 551695b296d0Smrg else 551795b296d0Smrg $echo "copying selected object files to avoid basename conflicts..." 551895b296d0Smrg 551995b296d0Smrg if test -z "$gentop"; then 552095b296d0Smrg gentop="$output_objdir/${outputname}x" 552195b296d0Smrg generated="$generated $gentop" 552295b296d0Smrg 552395b296d0Smrg $show "${rm}r $gentop" 552495b296d0Smrg $run ${rm}r "$gentop" 552595b296d0Smrg $show "$mkdir $gentop" 552695b296d0Smrg $run $mkdir "$gentop" 552795b296d0Smrg exit_status=$? 552895b296d0Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 552995b296d0Smrg exit $exit_status 553095b296d0Smrg fi 553195b296d0Smrg fi 553295b296d0Smrg 553395b296d0Smrg save_oldobjs=$oldobjs 553495b296d0Smrg oldobjs= 553595b296d0Smrg counter=1 553695b296d0Smrg for obj in $save_oldobjs 553795b296d0Smrg do 553895b296d0Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 553995b296d0Smrg case " $oldobjs " in 554095b296d0Smrg " ") oldobjs=$obj ;; 554195b296d0Smrg *[\ /]"$objbase "*) 554295b296d0Smrg while :; do 554395b296d0Smrg # Make sure we don't pick an alternate name that also 554495b296d0Smrg # overlaps. 554595b296d0Smrg newobj=lt$counter-$objbase 554695b296d0Smrg counter=`expr $counter + 1` 554795b296d0Smrg case " $oldobjs " in 554895b296d0Smrg *[\ /]"$newobj "*) ;; 554995b296d0Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 555095b296d0Smrg esac 555195b296d0Smrg done 555295b296d0Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 555395b296d0Smrg $run ln "$obj" "$gentop/$newobj" || 555495b296d0Smrg $run cp "$obj" "$gentop/$newobj" 555595b296d0Smrg oldobjs="$oldobjs $gentop/$newobj" 555695b296d0Smrg ;; 555795b296d0Smrg *) oldobjs="$oldobjs $obj" ;; 555895b296d0Smrg esac 555995b296d0Smrg done 556095b296d0Smrg fi 556195b296d0Smrg 556295b296d0Smrg eval cmds=\"$old_archive_cmds\" 556395b296d0Smrg 556495b296d0Smrg if len=`expr "X$cmds" : ".*"` && 556595b296d0Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 556695b296d0Smrg cmds=$old_archive_cmds 556795b296d0Smrg else 556895b296d0Smrg # the command line is too long to link in one step, link in parts 556995b296d0Smrg $echo "using piecewise archive linking..." 557095b296d0Smrg save_RANLIB=$RANLIB 557195b296d0Smrg RANLIB=: 557295b296d0Smrg objlist= 557395b296d0Smrg concat_cmds= 557495b296d0Smrg save_oldobjs=$oldobjs 557595b296d0Smrg 557695b296d0Smrg # Is there a better way of finding the last object in the list? 557795b296d0Smrg for obj in $save_oldobjs 557895b296d0Smrg do 557995b296d0Smrg last_oldobj=$obj 558095b296d0Smrg done 558195b296d0Smrg for obj in $save_oldobjs 558295b296d0Smrg do 558395b296d0Smrg oldobjs="$objlist $obj" 558495b296d0Smrg objlist="$objlist $obj" 558595b296d0Smrg eval test_cmds=\"$old_archive_cmds\" 558695b296d0Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 558795b296d0Smrg test "$len" -le "$max_cmd_len"; then 558895b296d0Smrg : 558995b296d0Smrg else 559095b296d0Smrg # the above command should be used before it gets too long 559195b296d0Smrg oldobjs=$objlist 559295b296d0Smrg if test "$obj" = "$last_oldobj" ; then 559395b296d0Smrg RANLIB=$save_RANLIB 559495b296d0Smrg fi 559595b296d0Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 559695b296d0Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 559795b296d0Smrg objlist= 559895b296d0Smrg fi 559995b296d0Smrg done 560095b296d0Smrg RANLIB=$save_RANLIB 560195b296d0Smrg oldobjs=$objlist 560295b296d0Smrg if test "X$oldobjs" = "X" ; then 560395b296d0Smrg eval cmds=\"\$concat_cmds\" 560495b296d0Smrg else 560595b296d0Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 560695b296d0Smrg fi 560795b296d0Smrg fi 560895b296d0Smrg fi 560995b296d0Smrg save_ifs="$IFS"; IFS='~' 561095b296d0Smrg for cmd in $cmds; do 561195b296d0Smrg eval cmd=\"$cmd\" 561295b296d0Smrg IFS="$save_ifs" 561395b296d0Smrg $show "$cmd" 561495b296d0Smrg $run eval "$cmd" || exit $? 561595b296d0Smrg done 561695b296d0Smrg IFS="$save_ifs" 561795b296d0Smrg done 561895b296d0Smrg 561995b296d0Smrg if test -n "$generated"; then 562095b296d0Smrg $show "${rm}r$generated" 562195b296d0Smrg $run ${rm}r$generated 562295b296d0Smrg fi 562395b296d0Smrg 562495b296d0Smrg # Now create the libtool archive. 562595b296d0Smrg case $output in 562695b296d0Smrg *.la) 562795b296d0Smrg old_library= 562895b296d0Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 562995b296d0Smrg $show "creating $output" 563095b296d0Smrg 563195b296d0Smrg # Preserve any variables that may affect compiler behavior 563295b296d0Smrg for var in $variables_saved_for_relink; do 563395b296d0Smrg if eval test -z \"\${$var+set}\"; then 563495b296d0Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 563595b296d0Smrg elif eval var_value=\$$var; test -z "$var_value"; then 563695b296d0Smrg relink_command="$var=; export $var; $relink_command" 563795b296d0Smrg else 563895b296d0Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 563995b296d0Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 564095b296d0Smrg fi 564195b296d0Smrg done 564295b296d0Smrg # Quote the link command for shipping. 564395b296d0Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 564495b296d0Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 564595b296d0Smrg if test "$hardcode_automatic" = yes ; then 564695b296d0Smrg relink_command= 564795b296d0Smrg fi 564895b296d0Smrg 564995b296d0Smrg 565095b296d0Smrg # Only create the output if not a dry run. 565195b296d0Smrg if test -z "$run"; then 565295b296d0Smrg for installed in no yes; do 565395b296d0Smrg if test "$installed" = yes; then 565495b296d0Smrg if test -z "$install_libdir"; then 565595b296d0Smrg break 565695b296d0Smrg fi 565795b296d0Smrg output="$output_objdir/$outputname"i 565895b296d0Smrg # Replace all uninstalled libtool libraries with the installed ones 565995b296d0Smrg newdependency_libs= 566095b296d0Smrg for deplib in $dependency_libs; do 566195b296d0Smrg case $deplib in 566295b296d0Smrg *.la) 566395b296d0Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 566495b296d0Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 566595b296d0Smrg if test -z "$libdir"; then 566695b296d0Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 566795b296d0Smrg exit $EXIT_FAILURE 566895b296d0Smrg fi 566995b296d0Smrg if test "X$EGREP" = X ; then 567095b296d0Smrg EGREP=egrep 567195b296d0Smrg fi 567295b296d0Smrg # We do not want portage's install root ($D) present. Check only for 567395b296d0Smrg # this if the .la is being installed. 567495b296d0Smrg if test "$installed" = yes && test "$D"; then 567595b296d0Smrg eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 567695b296d0Smrg else 567795b296d0Smrg mynewdependency_lib="$libdir/$name" 567895b296d0Smrg fi 567995b296d0Smrg # Do not add duplicates 568095b296d0Smrg if test "$mynewdependency_lib"; then 568195b296d0Smrg my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` 568295b296d0Smrg if test -z "$my_little_ninja_foo_1"; then 568395b296d0Smrg newdependency_libs="$newdependency_libs $mynewdependency_lib" 568495b296d0Smrg fi 568595b296d0Smrg fi 568695b296d0Smrg ;; 568795b296d0Smrg *) 568895b296d0Smrg if test "$installed" = yes; then 568995b296d0Smrg # Rather use S=WORKDIR if our version of portage supports it. 569095b296d0Smrg # This is because some ebuild (gcc) do not use $S as buildroot. 569195b296d0Smrg if test "$PWORKDIR"; then 569295b296d0Smrg S="$PWORKDIR" 569395b296d0Smrg fi 569495b296d0Smrg # We do not want portage's build root ($S) present. 569595b296d0Smrg my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"` 569695b296d0Smrg # We do not want portage's install root ($D) present. 569795b296d0Smrg my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"` 569895b296d0Smrg if test -n "$my_little_ninja_foo_2" && test "$S"; then 569995b296d0Smrg mynewdependency_lib="" 570095b296d0Smrg elif test -n "$my_little_ninja_foo_3" && test "$D"; then 570195b296d0Smrg eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 570295b296d0Smrg else 570395b296d0Smrg mynewdependency_lib="$deplib" 570495b296d0Smrg fi 570595b296d0Smrg else 570695b296d0Smrg mynewdependency_lib="$deplib" 570795b296d0Smrg fi 570895b296d0Smrg # Do not add duplicates 570995b296d0Smrg if test "$mynewdependency_lib"; then 571095b296d0Smrg my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` 571195b296d0Smrg if test -z "$my_little_ninja_foo_4"; then 571295b296d0Smrg newdependency_libs="$newdependency_libs $mynewdependency_lib" 571395b296d0Smrg fi 571495b296d0Smrg fi 571595b296d0Smrg ;; 571695b296d0Smrg esac 571795b296d0Smrg done 571895b296d0Smrg dependency_libs="$newdependency_libs" 571995b296d0Smrg newdlfiles= 572095b296d0Smrg for lib in $dlfiles; do 572195b296d0Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 572295b296d0Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 572395b296d0Smrg if test -z "$libdir"; then 572495b296d0Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 572595b296d0Smrg exit $EXIT_FAILURE 572695b296d0Smrg fi 572795b296d0Smrg newdlfiles="$newdlfiles $libdir/$name" 572895b296d0Smrg done 572995b296d0Smrg dlfiles="$newdlfiles" 573095b296d0Smrg newdlprefiles= 573195b296d0Smrg for lib in $dlprefiles; do 573295b296d0Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 573395b296d0Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 573495b296d0Smrg if test -z "$libdir"; then 573595b296d0Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 573695b296d0Smrg exit $EXIT_FAILURE 573795b296d0Smrg fi 573895b296d0Smrg newdlprefiles="$newdlprefiles $libdir/$name" 573995b296d0Smrg done 574095b296d0Smrg dlprefiles="$newdlprefiles" 574195b296d0Smrg else 574295b296d0Smrg newdlfiles= 574395b296d0Smrg for lib in $dlfiles; do 574495b296d0Smrg case $lib in 574595b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 574695b296d0Smrg *) abs=`pwd`"/$lib" ;; 574795b296d0Smrg esac 574895b296d0Smrg newdlfiles="$newdlfiles $abs" 574995b296d0Smrg done 575095b296d0Smrg dlfiles="$newdlfiles" 575195b296d0Smrg newdlprefiles= 575295b296d0Smrg for lib in $dlprefiles; do 575395b296d0Smrg case $lib in 575495b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 575595b296d0Smrg *) abs=`pwd`"/$lib" ;; 575695b296d0Smrg esac 575795b296d0Smrg newdlprefiles="$newdlprefiles $abs" 575895b296d0Smrg done 575995b296d0Smrg dlprefiles="$newdlprefiles" 576095b296d0Smrg fi 576195b296d0Smrg $rm $output 576295b296d0Smrg # place dlname in correct position for cygwin 576395b296d0Smrg tdlname=$dlname 576495b296d0Smrg case $host,$output,$installed,$module,$dlname in 576595b296d0Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 576695b296d0Smrg esac 576795b296d0Smrg # Do not add duplicates 576895b296d0Smrg if test "$installed" = yes && test "$D"; then 576995b296d0Smrg install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 577095b296d0Smrg fi 577195b296d0Smrg $echo > $output "\ 577295b296d0Smrg# $outputname - a libtool library file 577395b296d0Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 577495b296d0Smrg# 577595b296d0Smrg# Please DO NOT delete this file! 577695b296d0Smrg# It is necessary for linking the library. 577795b296d0Smrg 577895b296d0Smrg# The name that we can dlopen(3). 577995b296d0Smrgdlname='$tdlname' 578095b296d0Smrg 578195b296d0Smrg# Names of this library. 578295b296d0Smrglibrary_names='$library_names' 578395b296d0Smrg 578495b296d0Smrg# The name of the static archive. 578595b296d0Smrgold_library='$old_library' 578695b296d0Smrg 578795b296d0Smrg# Libraries that this one depends upon. 578895b296d0Smrgdependency_libs='$dependency_libs' 578995b296d0Smrg 579095b296d0Smrg# Version information for $libname. 579195b296d0Smrgcurrent=$current 579295b296d0Smrgage=$age 579395b296d0Smrgrevision=$revision 579495b296d0Smrg 579595b296d0Smrg# Is this an already installed library? 579695b296d0Smrginstalled=$installed 579795b296d0Smrg 579895b296d0Smrg# Should we warn about portability when linking against -modules? 579995b296d0Smrgshouldnotlink=$module 580095b296d0Smrg 580195b296d0Smrg# Files to dlopen/dlpreopen 580295b296d0Smrgdlopen='$dlfiles' 580395b296d0Smrgdlpreopen='$dlprefiles' 580495b296d0Smrg 580595b296d0Smrg# Directory that this library needs to be installed in: 580695b296d0Smrglibdir='$install_libdir'" 580795b296d0Smrg if test "$installed" = no && test "$need_relink" = yes; then 580895b296d0Smrg $echo >> $output "\ 580995b296d0Smrgrelink_command=\"$relink_command\"" 581095b296d0Smrg fi 581195b296d0Smrg done 581295b296d0Smrg fi 581395b296d0Smrg 581495b296d0Smrg # Do a symbolic link so that the libtool archive can be found in 581595b296d0Smrg # LD_LIBRARY_PATH before the program is installed. 581695b296d0Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 581795b296d0Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 581895b296d0Smrg ;; 581995b296d0Smrg esac 582095b296d0Smrg exit $EXIT_SUCCESS 582195b296d0Smrg ;; 582295b296d0Smrg 582395b296d0Smrg # libtool install mode 582495b296d0Smrg install) 582595b296d0Smrg modename="$modename: install" 582695b296d0Smrg 582795b296d0Smrg # There may be an optional sh(1) argument at the beginning of 582895b296d0Smrg # install_prog (especially on Windows NT). 582995b296d0Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 583095b296d0Smrg # Allow the use of GNU shtool's install command. 583195b296d0Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 583295b296d0Smrg # Aesthetically quote it. 583395b296d0Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 583495b296d0Smrg case $arg in 583595b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 583695b296d0Smrg arg="\"$arg\"" 583795b296d0Smrg ;; 583895b296d0Smrg esac 583995b296d0Smrg install_prog="$arg " 584095b296d0Smrg arg="$1" 584195b296d0Smrg shift 584295b296d0Smrg else 584395b296d0Smrg install_prog= 584495b296d0Smrg arg=$nonopt 584595b296d0Smrg fi 584695b296d0Smrg 584795b296d0Smrg # The real first argument should be the name of the installation program. 584895b296d0Smrg # Aesthetically quote it. 584995b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 585095b296d0Smrg case $arg in 585195b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 585295b296d0Smrg arg="\"$arg\"" 585395b296d0Smrg ;; 585495b296d0Smrg esac 585595b296d0Smrg install_prog="$install_prog$arg" 585695b296d0Smrg 585795b296d0Smrg # We need to accept at least all the BSD install flags. 585895b296d0Smrg dest= 585995b296d0Smrg files= 586095b296d0Smrg opts= 586195b296d0Smrg prev= 586295b296d0Smrg install_type= 586395b296d0Smrg isdir=no 586495b296d0Smrg stripme= 586595b296d0Smrg for arg 586695b296d0Smrg do 586795b296d0Smrg if test -n "$dest"; then 586895b296d0Smrg files="$files $dest" 586995b296d0Smrg dest=$arg 587095b296d0Smrg continue 587195b296d0Smrg fi 587295b296d0Smrg 587395b296d0Smrg case $arg in 587495b296d0Smrg -d) isdir=yes ;; 587595b296d0Smrg -f) 587695b296d0Smrg case " $install_prog " in 587795b296d0Smrg *[\\\ /]cp\ *) ;; 587895b296d0Smrg *) prev=$arg ;; 587995b296d0Smrg esac 588095b296d0Smrg ;; 588195b296d0Smrg -g | -m | -o) prev=$arg ;; 588295b296d0Smrg -s) 588395b296d0Smrg stripme=" -s" 588495b296d0Smrg continue 588595b296d0Smrg ;; 588695b296d0Smrg -*) 588795b296d0Smrg ;; 588895b296d0Smrg *) 588995b296d0Smrg # If the previous option needed an argument, then skip it. 589095b296d0Smrg if test -n "$prev"; then 589195b296d0Smrg prev= 589295b296d0Smrg else 589395b296d0Smrg dest=$arg 589495b296d0Smrg continue 589595b296d0Smrg fi 589695b296d0Smrg ;; 589795b296d0Smrg esac 589895b296d0Smrg 589995b296d0Smrg # Aesthetically quote the argument. 590095b296d0Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 590195b296d0Smrg case $arg in 590295b296d0Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 590395b296d0Smrg arg="\"$arg\"" 590495b296d0Smrg ;; 590595b296d0Smrg esac 590695b296d0Smrg install_prog="$install_prog $arg" 590795b296d0Smrg done 590895b296d0Smrg 590995b296d0Smrg if test -z "$install_prog"; then 591095b296d0Smrg $echo "$modename: you must specify an install program" 1>&2 591195b296d0Smrg $echo "$help" 1>&2 591295b296d0Smrg exit $EXIT_FAILURE 591395b296d0Smrg fi 591495b296d0Smrg 591595b296d0Smrg if test -n "$prev"; then 591695b296d0Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 591795b296d0Smrg $echo "$help" 1>&2 591895b296d0Smrg exit $EXIT_FAILURE 591995b296d0Smrg fi 592095b296d0Smrg 592195b296d0Smrg if test -z "$files"; then 592295b296d0Smrg if test -z "$dest"; then 592395b296d0Smrg $echo "$modename: no file or destination specified" 1>&2 592495b296d0Smrg else 592595b296d0Smrg $echo "$modename: you must specify a destination" 1>&2 592695b296d0Smrg fi 592795b296d0Smrg $echo "$help" 1>&2 592895b296d0Smrg exit $EXIT_FAILURE 592995b296d0Smrg fi 593095b296d0Smrg 593195b296d0Smrg # Strip any trailing slash from the destination. 593295b296d0Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 593395b296d0Smrg 593495b296d0Smrg # Check to see that the destination is a directory. 593595b296d0Smrg test -d "$dest" && isdir=yes 593695b296d0Smrg if test "$isdir" = yes; then 593795b296d0Smrg destdir="$dest" 593895b296d0Smrg destname= 593995b296d0Smrg else 594095b296d0Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 594195b296d0Smrg test "X$destdir" = "X$dest" && destdir=. 594295b296d0Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 594395b296d0Smrg 594495b296d0Smrg # Not a directory, so check to see that there is only one file specified. 594595b296d0Smrg set dummy $files 594695b296d0Smrg if test "$#" -gt 2; then 594795b296d0Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 594895b296d0Smrg $echo "$help" 1>&2 594995b296d0Smrg exit $EXIT_FAILURE 595095b296d0Smrg fi 595195b296d0Smrg fi 595295b296d0Smrg case $destdir in 595395b296d0Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 595495b296d0Smrg *) 595595b296d0Smrg for file in $files; do 595695b296d0Smrg case $file in 595795b296d0Smrg *.lo) ;; 595895b296d0Smrg *) 595995b296d0Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 596095b296d0Smrg $echo "$help" 1>&2 596195b296d0Smrg exit $EXIT_FAILURE 596295b296d0Smrg ;; 596395b296d0Smrg esac 596495b296d0Smrg done 596595b296d0Smrg ;; 596695b296d0Smrg esac 596795b296d0Smrg 596895b296d0Smrg # This variable tells wrapper scripts just to set variables rather 596995b296d0Smrg # than running their programs. 597095b296d0Smrg libtool_install_magic="$magic" 597195b296d0Smrg 597295b296d0Smrg staticlibs= 597395b296d0Smrg future_libdirs= 597495b296d0Smrg current_libdirs= 597595b296d0Smrg for file in $files; do 597695b296d0Smrg 597795b296d0Smrg # Do each installation. 597895b296d0Smrg case $file in 597995b296d0Smrg *.$libext) 598095b296d0Smrg # Do the static libraries later. 598195b296d0Smrg staticlibs="$staticlibs $file" 598295b296d0Smrg ;; 598395b296d0Smrg 598495b296d0Smrg *.la) 598595b296d0Smrg # Check to see that this really is a libtool archive. 598695b296d0Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 598795b296d0Smrg else 598895b296d0Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 598995b296d0Smrg $echo "$help" 1>&2 599095b296d0Smrg exit $EXIT_FAILURE 599195b296d0Smrg fi 599295b296d0Smrg 599395b296d0Smrg library_names= 599495b296d0Smrg old_library= 599595b296d0Smrg relink_command= 599695b296d0Smrg # If there is no directory component, then add one. 599795b296d0Smrg case $file in 599895b296d0Smrg */* | *\\*) . $file ;; 599995b296d0Smrg *) . ./$file ;; 600095b296d0Smrg esac 600195b296d0Smrg 600295b296d0Smrg # Add the libdir to current_libdirs if it is the destination. 600395b296d0Smrg if test "X$destdir" = "X$libdir"; then 600495b296d0Smrg case "$current_libdirs " in 600595b296d0Smrg *" $libdir "*) ;; 600695b296d0Smrg *) current_libdirs="$current_libdirs $libdir" ;; 600795b296d0Smrg esac 600895b296d0Smrg else 600995b296d0Smrg # Note the libdir as a future libdir. 601095b296d0Smrg case "$future_libdirs " in 601195b296d0Smrg *" $libdir "*) ;; 601295b296d0Smrg *) future_libdirs="$future_libdirs $libdir" ;; 601395b296d0Smrg esac 601495b296d0Smrg fi 601595b296d0Smrg 601695b296d0Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 601795b296d0Smrg test "X$dir" = "X$file/" && dir= 601895b296d0Smrg dir="$dir$objdir" 601995b296d0Smrg 602095b296d0Smrg if test -n "$relink_command"; then 602195b296d0Smrg # Determine the prefix the user has applied to our future dir. 602295b296d0Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 602395b296d0Smrg 602495b296d0Smrg # Don't allow the user to place us outside of our expected 602595b296d0Smrg # location b/c this prevents finding dependent libraries that 602695b296d0Smrg # are installed to the same prefix. 602795b296d0Smrg # At present, this check doesn't affect windows .dll's that 602895b296d0Smrg # are installed into $libdir/../bin (currently, that works fine) 602995b296d0Smrg # but it's something to keep an eye on. 603095b296d0Smrg if test "$inst_prefix_dir" = "$destdir"; then 603195b296d0Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 603295b296d0Smrg exit $EXIT_FAILURE 603395b296d0Smrg fi 603495b296d0Smrg 603595b296d0Smrg if test -n "$inst_prefix_dir"; then 603695b296d0Smrg # Stick the inst_prefix_dir data into the link command. 603795b296d0Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 603895b296d0Smrg else 603995b296d0Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 604095b296d0Smrg fi 604195b296d0Smrg 604295b296d0Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 604395b296d0Smrg $show "$relink_command" 604495b296d0Smrg if $run eval "$relink_command"; then : 604595b296d0Smrg else 604695b296d0Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 604795b296d0Smrg exit $EXIT_FAILURE 604895b296d0Smrg fi 604995b296d0Smrg fi 605095b296d0Smrg 605195b296d0Smrg # See the names of the shared library. 605295b296d0Smrg set dummy $library_names 605395b296d0Smrg if test -n "$2"; then 605495b296d0Smrg realname="$2" 605595b296d0Smrg shift 605695b296d0Smrg shift 605795b296d0Smrg 605895b296d0Smrg srcname="$realname" 605995b296d0Smrg test -n "$relink_command" && srcname="$realname"T 606095b296d0Smrg 606195b296d0Smrg # Install the shared library and build the symlinks. 606295b296d0Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 606395b296d0Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 606495b296d0Smrg if test -n "$stripme" && test -n "$striplib"; then 606595b296d0Smrg $show "$striplib $destdir/$realname" 606695b296d0Smrg $run eval "$striplib $destdir/$realname" || exit $? 606795b296d0Smrg fi 606895b296d0Smrg 606995b296d0Smrg if test "$#" -gt 0; then 607095b296d0Smrg # Delete the old symlinks, and create new ones. 607195b296d0Smrg # Try `ln -sf' first, because the `ln' binary might depend on 607295b296d0Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 607395b296d0Smrg # so we also need to try rm && ln -s. 607495b296d0Smrg for linkname 607595b296d0Smrg do 607695b296d0Smrg if test "$linkname" != "$realname"; then 607795b296d0Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 607895b296d0Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 607995b296d0Smrg fi 608095b296d0Smrg done 608195b296d0Smrg fi 608295b296d0Smrg 608395b296d0Smrg # Do each command in the postinstall commands. 608495b296d0Smrg lib="$destdir/$realname" 608595b296d0Smrg cmds=$postinstall_cmds 608695b296d0Smrg save_ifs="$IFS"; IFS='~' 608795b296d0Smrg for cmd in $cmds; do 608895b296d0Smrg IFS="$save_ifs" 608995b296d0Smrg eval cmd=\"$cmd\" 609095b296d0Smrg $show "$cmd" 609195b296d0Smrg $run eval "$cmd" || { 609295b296d0Smrg lt_exit=$? 609395b296d0Smrg 609495b296d0Smrg # Restore the uninstalled library and exit 609595b296d0Smrg if test "$mode" = relink; then 609695b296d0Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 609795b296d0Smrg fi 609895b296d0Smrg 609995b296d0Smrg exit $lt_exit 610095b296d0Smrg } 610195b296d0Smrg done 610295b296d0Smrg IFS="$save_ifs" 610395b296d0Smrg fi 610495b296d0Smrg 610595b296d0Smrg # Install the pseudo-library for information purposes. 610695b296d0Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 610795b296d0Smrg instname="$dir/$name"i 610895b296d0Smrg $show "$install_prog $instname $destdir/$name" 610995b296d0Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 611095b296d0Smrg 611195b296d0Smrg # Maybe install the static library, too. 611295b296d0Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 611395b296d0Smrg ;; 611495b296d0Smrg 611595b296d0Smrg *.lo) 611695b296d0Smrg # Install (i.e. copy) a libtool object. 611795b296d0Smrg 611895b296d0Smrg # Figure out destination file name, if it wasn't already specified. 611995b296d0Smrg if test -n "$destname"; then 612095b296d0Smrg destfile="$destdir/$destname" 612195b296d0Smrg else 612295b296d0Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 612395b296d0Smrg destfile="$destdir/$destfile" 612495b296d0Smrg fi 612595b296d0Smrg 612695b296d0Smrg # Deduce the name of the destination old-style object file. 612795b296d0Smrg case $destfile in 612895b296d0Smrg *.lo) 612995b296d0Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 613095b296d0Smrg ;; 613195b296d0Smrg *.$objext) 613295b296d0Smrg staticdest="$destfile" 613395b296d0Smrg destfile= 613495b296d0Smrg ;; 613595b296d0Smrg *) 613695b296d0Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 613795b296d0Smrg $echo "$help" 1>&2 613895b296d0Smrg exit $EXIT_FAILURE 613995b296d0Smrg ;; 614095b296d0Smrg esac 614195b296d0Smrg 614295b296d0Smrg # Install the libtool object if requested. 614395b296d0Smrg if test -n "$destfile"; then 614495b296d0Smrg $show "$install_prog $file $destfile" 614595b296d0Smrg $run eval "$install_prog $file $destfile" || exit $? 614695b296d0Smrg fi 614795b296d0Smrg 614895b296d0Smrg # Install the old object if enabled. 614995b296d0Smrg if test "$build_old_libs" = yes; then 615095b296d0Smrg # Deduce the name of the old-style object file. 615195b296d0Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 615295b296d0Smrg 615395b296d0Smrg $show "$install_prog $staticobj $staticdest" 615495b296d0Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 615595b296d0Smrg fi 615695b296d0Smrg exit $EXIT_SUCCESS 615795b296d0Smrg ;; 615895b296d0Smrg 615995b296d0Smrg *) 616095b296d0Smrg # Figure out destination file name, if it wasn't already specified. 616195b296d0Smrg if test -n "$destname"; then 616295b296d0Smrg destfile="$destdir/$destname" 616395b296d0Smrg else 616495b296d0Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 616595b296d0Smrg destfile="$destdir/$destfile" 616695b296d0Smrg fi 616795b296d0Smrg 616895b296d0Smrg # If the file is missing, and there is a .exe on the end, strip it 616995b296d0Smrg # because it is most likely a libtool script we actually want to 617095b296d0Smrg # install 617195b296d0Smrg stripped_ext="" 617295b296d0Smrg case $file in 617395b296d0Smrg *.exe) 617495b296d0Smrg if test ! -f "$file"; then 617595b296d0Smrg file=`$echo $file|${SED} 's,.exe$,,'` 617695b296d0Smrg stripped_ext=".exe" 617795b296d0Smrg fi 617895b296d0Smrg ;; 617995b296d0Smrg esac 618095b296d0Smrg 618195b296d0Smrg # Do a test to see if this is really a libtool program. 618295b296d0Smrg case $host in 618395b296d0Smrg *cygwin*|*mingw*) 618495b296d0Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 618595b296d0Smrg ;; 618695b296d0Smrg *) 618795b296d0Smrg wrapper=$file 618895b296d0Smrg ;; 618995b296d0Smrg esac 619095b296d0Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 619195b296d0Smrg notinst_deplibs= 619295b296d0Smrg relink_command= 619395b296d0Smrg 619495b296d0Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 619595b296d0Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 619695b296d0Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 619795b296d0Smrg # `FILE.' does not work on cygwin managed mounts. 619895b296d0Smrg # 619995b296d0Smrg # If there is no directory component, then add one. 620095b296d0Smrg case $wrapper in 620195b296d0Smrg */* | *\\*) . ${wrapper} ;; 620295b296d0Smrg *) . ./${wrapper} ;; 620395b296d0Smrg esac 620495b296d0Smrg 620595b296d0Smrg # Check the variables that should have been set. 620695b296d0Smrg if test -z "$notinst_deplibs"; then 620795b296d0Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 620895b296d0Smrg exit $EXIT_FAILURE 620995b296d0Smrg fi 621095b296d0Smrg 621195b296d0Smrg finalize=yes 621295b296d0Smrg for lib in $notinst_deplibs; do 621395b296d0Smrg # Check to see that each library is installed. 621495b296d0Smrg libdir= 621595b296d0Smrg if test -f "$lib"; then 621695b296d0Smrg # If there is no directory component, then add one. 621795b296d0Smrg case $lib in 621895b296d0Smrg */* | *\\*) . $lib ;; 621995b296d0Smrg *) . ./$lib ;; 622095b296d0Smrg esac 622195b296d0Smrg fi 622295b296d0Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 622395b296d0Smrg if test -n "$libdir" && test ! -f "$libfile"; then 622495b296d0Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 622595b296d0Smrg finalize=no 622695b296d0Smrg fi 622795b296d0Smrg done 622895b296d0Smrg 622995b296d0Smrg relink_command= 623095b296d0Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 623195b296d0Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 623295b296d0Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 623395b296d0Smrg # `FILE.' does not work on cygwin managed mounts. 623495b296d0Smrg # 623595b296d0Smrg # If there is no directory component, then add one. 623695b296d0Smrg case $wrapper in 623795b296d0Smrg */* | *\\*) . ${wrapper} ;; 623895b296d0Smrg *) . ./${wrapper} ;; 623995b296d0Smrg esac 624095b296d0Smrg 624195b296d0Smrg outputname= 624295b296d0Smrg if test "$fast_install" = no && test -n "$relink_command"; then 624395b296d0Smrg if test "$finalize" = yes && test -z "$run"; then 624495b296d0Smrg tmpdir=`func_mktempdir` 624595b296d0Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 624695b296d0Smrg outputname="$tmpdir/$file" 624795b296d0Smrg # Replace the output file specification. 624895b296d0Smrg relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 624995b296d0Smrg 625095b296d0Smrg $show "$relink_command" 625195b296d0Smrg if $run eval "$relink_command"; then : 625295b296d0Smrg else 625395b296d0Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 625495b296d0Smrg ${rm}r "$tmpdir" 625595b296d0Smrg continue 625695b296d0Smrg fi 625795b296d0Smrg file="$outputname" 625895b296d0Smrg else 625995b296d0Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 626095b296d0Smrg fi 626195b296d0Smrg else 626295b296d0Smrg # Install the binary that we compiled earlier. 626395b296d0Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 626495b296d0Smrg fi 626595b296d0Smrg fi 626695b296d0Smrg 626795b296d0Smrg # remove .exe since cygwin /usr/bin/install will append another 626895b296d0Smrg # one anyway 626995b296d0Smrg case $install_prog,$host in 627095b296d0Smrg */usr/bin/install*,*cygwin*) 627195b296d0Smrg case $file:$destfile in 627295b296d0Smrg *.exe:*.exe) 627395b296d0Smrg # this is ok 627495b296d0Smrg ;; 627595b296d0Smrg *.exe:*) 627695b296d0Smrg destfile=$destfile.exe 627795b296d0Smrg ;; 627895b296d0Smrg *:*.exe) 627995b296d0Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 628095b296d0Smrg ;; 628195b296d0Smrg esac 628295b296d0Smrg ;; 628395b296d0Smrg esac 628495b296d0Smrg $show "$install_prog$stripme $file $destfile" 628595b296d0Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 628695b296d0Smrg test -n "$outputname" && ${rm}r "$tmpdir" 628795b296d0Smrg ;; 628895b296d0Smrg esac 628995b296d0Smrg done 629095b296d0Smrg 629195b296d0Smrg for file in $staticlibs; do 629295b296d0Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 629395b296d0Smrg 629495b296d0Smrg # Set up the ranlib parameters. 629595b296d0Smrg oldlib="$destdir/$name" 629695b296d0Smrg 629795b296d0Smrg $show "$install_prog $file $oldlib" 629895b296d0Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 629995b296d0Smrg 630095b296d0Smrg if test -n "$stripme" && test -n "$old_striplib"; then 630195b296d0Smrg $show "$old_striplib $oldlib" 630295b296d0Smrg $run eval "$old_striplib $oldlib" || exit $? 630395b296d0Smrg fi 630495b296d0Smrg 630595b296d0Smrg # Do each command in the postinstall commands. 630695b296d0Smrg cmds=$old_postinstall_cmds 630795b296d0Smrg save_ifs="$IFS"; IFS='~' 630895b296d0Smrg for cmd in $cmds; do 630995b296d0Smrg IFS="$save_ifs" 631095b296d0Smrg eval cmd=\"$cmd\" 631195b296d0Smrg $show "$cmd" 631295b296d0Smrg $run eval "$cmd" || exit $? 631395b296d0Smrg done 631495b296d0Smrg IFS="$save_ifs" 631595b296d0Smrg done 631695b296d0Smrg 631795b296d0Smrg if test -n "$future_libdirs"; then 631895b296d0Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 631995b296d0Smrg fi 632095b296d0Smrg 632195b296d0Smrg if test -n "$current_libdirs"; then 632295b296d0Smrg # Maybe just do a dry run. 632395b296d0Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 632495b296d0Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 632595b296d0Smrg else 632695b296d0Smrg exit $EXIT_SUCCESS 632795b296d0Smrg fi 632895b296d0Smrg ;; 632995b296d0Smrg 633095b296d0Smrg # libtool finish mode 633195b296d0Smrg finish) 633295b296d0Smrg modename="$modename: finish" 633395b296d0Smrg libdirs="$nonopt" 633495b296d0Smrg admincmds= 633595b296d0Smrg 633695b296d0Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 633795b296d0Smrg for dir 633895b296d0Smrg do 633995b296d0Smrg libdirs="$libdirs $dir" 634095b296d0Smrg done 634195b296d0Smrg 634295b296d0Smrg for libdir in $libdirs; do 634395b296d0Smrg if test -n "$finish_cmds"; then 634495b296d0Smrg # Do each command in the finish commands. 634595b296d0Smrg cmds=$finish_cmds 634695b296d0Smrg save_ifs="$IFS"; IFS='~' 634795b296d0Smrg for cmd in $cmds; do 634895b296d0Smrg IFS="$save_ifs" 634995b296d0Smrg eval cmd=\"$cmd\" 635095b296d0Smrg $show "$cmd" 635195b296d0Smrg $run eval "$cmd" || admincmds="$admincmds 635295b296d0Smrg $cmd" 635395b296d0Smrg done 635495b296d0Smrg IFS="$save_ifs" 635595b296d0Smrg fi 635695b296d0Smrg if test -n "$finish_eval"; then 635795b296d0Smrg # Do the single finish_eval. 635895b296d0Smrg eval cmds=\"$finish_eval\" 635995b296d0Smrg $run eval "$cmds" || admincmds="$admincmds 636095b296d0Smrg $cmds" 636195b296d0Smrg fi 636295b296d0Smrg done 636395b296d0Smrg fi 636495b296d0Smrg 636595b296d0Smrg # Exit here if they wanted silent mode. 636695b296d0Smrg test "$show" = : && exit $EXIT_SUCCESS 636795b296d0Smrg 636895b296d0Smrg $echo "X----------------------------------------------------------------------" | $Xsed 636995b296d0Smrg $echo "Libraries have been installed in:" 637095b296d0Smrg for libdir in $libdirs; do 637195b296d0Smrg $echo " $libdir" 637295b296d0Smrg done 637395b296d0Smrg $echo 637495b296d0Smrg $echo "If you ever happen to want to link against installed libraries" 637595b296d0Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 637695b296d0Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 637795b296d0Smrg $echo "flag during linking and do at least one of the following:" 637895b296d0Smrg if test -n "$shlibpath_var"; then 637995b296d0Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 638095b296d0Smrg $echo " during execution" 638195b296d0Smrg fi 638295b296d0Smrg if test -n "$runpath_var"; then 638395b296d0Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 638495b296d0Smrg $echo " during linking" 638595b296d0Smrg fi 638695b296d0Smrg if test -n "$hardcode_libdir_flag_spec"; then 638795b296d0Smrg libdir=LIBDIR 638895b296d0Smrg eval flag=\"$hardcode_libdir_flag_spec\" 638995b296d0Smrg 639095b296d0Smrg $echo " - use the \`$flag' linker flag" 639195b296d0Smrg fi 639295b296d0Smrg if test -n "$admincmds"; then 639395b296d0Smrg $echo " - have your system administrator run these commands:$admincmds" 639495b296d0Smrg fi 639595b296d0Smrg if test -f /etc/ld.so.conf; then 639695b296d0Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 639795b296d0Smrg fi 639895b296d0Smrg $echo 639995b296d0Smrg $echo "See any operating system documentation about shared libraries for" 640095b296d0Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 640195b296d0Smrg $echo "X----------------------------------------------------------------------" | $Xsed 640295b296d0Smrg exit $EXIT_SUCCESS 640395b296d0Smrg ;; 640495b296d0Smrg 640595b296d0Smrg # libtool execute mode 640695b296d0Smrg execute) 640795b296d0Smrg modename="$modename: execute" 640895b296d0Smrg 640995b296d0Smrg # The first argument is the command name. 641095b296d0Smrg cmd="$nonopt" 641195b296d0Smrg if test -z "$cmd"; then 641295b296d0Smrg $echo "$modename: you must specify a COMMAND" 1>&2 641395b296d0Smrg $echo "$help" 641495b296d0Smrg exit $EXIT_FAILURE 641595b296d0Smrg fi 641695b296d0Smrg 641795b296d0Smrg # Handle -dlopen flags immediately. 641895b296d0Smrg for file in $execute_dlfiles; do 641995b296d0Smrg if test ! -f "$file"; then 642095b296d0Smrg $echo "$modename: \`$file' is not a file" 1>&2 642195b296d0Smrg $echo "$help" 1>&2 642295b296d0Smrg exit $EXIT_FAILURE 642395b296d0Smrg fi 642495b296d0Smrg 642595b296d0Smrg dir= 642695b296d0Smrg case $file in 642795b296d0Smrg *.la) 642895b296d0Smrg # Check to see that this really is a libtool archive. 642995b296d0Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 643095b296d0Smrg else 643195b296d0Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 643295b296d0Smrg $echo "$help" 1>&2 643395b296d0Smrg exit $EXIT_FAILURE 643495b296d0Smrg fi 643595b296d0Smrg 643695b296d0Smrg # Read the libtool library. 643795b296d0Smrg dlname= 643895b296d0Smrg library_names= 643995b296d0Smrg 644095b296d0Smrg # If there is no directory component, then add one. 644195b296d0Smrg case $file in 644295b296d0Smrg */* | *\\*) . $file ;; 644395b296d0Smrg *) . ./$file ;; 644495b296d0Smrg esac 644595b296d0Smrg 644695b296d0Smrg # Skip this library if it cannot be dlopened. 644795b296d0Smrg if test -z "$dlname"; then 644895b296d0Smrg # Warn if it was a shared library. 644995b296d0Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 645095b296d0Smrg continue 645195b296d0Smrg fi 645295b296d0Smrg 645395b296d0Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 645495b296d0Smrg test "X$dir" = "X$file" && dir=. 645595b296d0Smrg 645695b296d0Smrg if test -f "$dir/$objdir/$dlname"; then 645795b296d0Smrg dir="$dir/$objdir" 645895b296d0Smrg else 645995b296d0Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 646095b296d0Smrg exit $EXIT_FAILURE 646195b296d0Smrg fi 646295b296d0Smrg ;; 646395b296d0Smrg 646495b296d0Smrg *.lo) 646595b296d0Smrg # Just add the directory containing the .lo file. 646695b296d0Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 646795b296d0Smrg test "X$dir" = "X$file" && dir=. 646895b296d0Smrg ;; 646995b296d0Smrg 647095b296d0Smrg *) 647195b296d0Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 647295b296d0Smrg continue 647395b296d0Smrg ;; 647495b296d0Smrg esac 647595b296d0Smrg 647695b296d0Smrg # Get the absolute pathname. 647795b296d0Smrg absdir=`cd "$dir" && pwd` 647895b296d0Smrg test -n "$absdir" && dir="$absdir" 647995b296d0Smrg 648095b296d0Smrg # Now add the directory to shlibpath_var. 648195b296d0Smrg if eval "test -z \"\$$shlibpath_var\""; then 648295b296d0Smrg eval "$shlibpath_var=\"\$dir\"" 648395b296d0Smrg else 648495b296d0Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 648595b296d0Smrg fi 648695b296d0Smrg done 648795b296d0Smrg 648895b296d0Smrg # This variable tells wrapper scripts just to set shlibpath_var 648995b296d0Smrg # rather than running their programs. 649095b296d0Smrg libtool_execute_magic="$magic" 649195b296d0Smrg 649295b296d0Smrg # Check if any of the arguments is a wrapper script. 649395b296d0Smrg args= 649495b296d0Smrg for file 649595b296d0Smrg do 649695b296d0Smrg case $file in 649795b296d0Smrg -*) ;; 649895b296d0Smrg *) 649995b296d0Smrg # Do a test to see if this is really a libtool program. 650095b296d0Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 650195b296d0Smrg # If there is no directory component, then add one. 650295b296d0Smrg case $file in 650395b296d0Smrg */* | *\\*) . $file ;; 650495b296d0Smrg *) . ./$file ;; 650595b296d0Smrg esac 650695b296d0Smrg 650795b296d0Smrg # Transform arg to wrapped name. 650895b296d0Smrg file="$progdir/$program" 650995b296d0Smrg fi 651095b296d0Smrg ;; 651195b296d0Smrg esac 651295b296d0Smrg # Quote arguments (to preserve shell metacharacters). 651395b296d0Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 651495b296d0Smrg args="$args \"$file\"" 651595b296d0Smrg done 651695b296d0Smrg 651795b296d0Smrg if test -z "$run"; then 651895b296d0Smrg if test -n "$shlibpath_var"; then 651995b296d0Smrg # Export the shlibpath_var. 652095b296d0Smrg eval "export $shlibpath_var" 652195b296d0Smrg fi 652295b296d0Smrg 652395b296d0Smrg # Restore saved environment variables 652495b296d0Smrg if test "${save_LC_ALL+set}" = set; then 652595b296d0Smrg LC_ALL="$save_LC_ALL"; export LC_ALL 652695b296d0Smrg fi 652795b296d0Smrg if test "${save_LANG+set}" = set; then 652895b296d0Smrg LANG="$save_LANG"; export LANG 652995b296d0Smrg fi 653095b296d0Smrg 653195b296d0Smrg # Now prepare to actually exec the command. 653295b296d0Smrg exec_cmd="\$cmd$args" 653395b296d0Smrg else 653495b296d0Smrg # Display what would be done. 653595b296d0Smrg if test -n "$shlibpath_var"; then 653695b296d0Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 653795b296d0Smrg $echo "export $shlibpath_var" 653895b296d0Smrg fi 653995b296d0Smrg $echo "$cmd$args" 654095b296d0Smrg exit $EXIT_SUCCESS 654195b296d0Smrg fi 654295b296d0Smrg ;; 654395b296d0Smrg 654495b296d0Smrg # libtool clean and uninstall mode 654595b296d0Smrg clean | uninstall) 654695b296d0Smrg modename="$modename: $mode" 654795b296d0Smrg rm="$nonopt" 654895b296d0Smrg files= 654995b296d0Smrg rmforce= 655095b296d0Smrg exit_status=0 655195b296d0Smrg 655295b296d0Smrg # This variable tells wrapper scripts just to set variables rather 655395b296d0Smrg # than running their programs. 655495b296d0Smrg libtool_install_magic="$magic" 655595b296d0Smrg 655695b296d0Smrg for arg 655795b296d0Smrg do 655895b296d0Smrg case $arg in 655995b296d0Smrg -f) rm="$rm $arg"; rmforce=yes ;; 656095b296d0Smrg -*) rm="$rm $arg" ;; 656195b296d0Smrg *) files="$files $arg" ;; 656295b296d0Smrg esac 656395b296d0Smrg done 656495b296d0Smrg 656595b296d0Smrg if test -z "$rm"; then 656695b296d0Smrg $echo "$modename: you must specify an RM program" 1>&2 656795b296d0Smrg $echo "$help" 1>&2 656895b296d0Smrg exit $EXIT_FAILURE 656995b296d0Smrg fi 657095b296d0Smrg 657195b296d0Smrg rmdirs= 657295b296d0Smrg 657395b296d0Smrg origobjdir="$objdir" 657495b296d0Smrg for file in $files; do 657595b296d0Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 657695b296d0Smrg if test "X$dir" = "X$file"; then 657795b296d0Smrg dir=. 657895b296d0Smrg objdir="$origobjdir" 657995b296d0Smrg else 658095b296d0Smrg objdir="$dir/$origobjdir" 658195b296d0Smrg fi 658295b296d0Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 658395b296d0Smrg test "$mode" = uninstall && objdir="$dir" 658495b296d0Smrg 658595b296d0Smrg # Remember objdir for removal later, being careful to avoid duplicates 658695b296d0Smrg if test "$mode" = clean; then 658795b296d0Smrg case " $rmdirs " in 658895b296d0Smrg *" $objdir "*) ;; 658995b296d0Smrg *) rmdirs="$rmdirs $objdir" ;; 659095b296d0Smrg esac 659195b296d0Smrg fi 659295b296d0Smrg 659395b296d0Smrg # Don't error if the file doesn't exist and rm -f was used. 659495b296d0Smrg if (test -L "$file") >/dev/null 2>&1 \ 659595b296d0Smrg || (test -h "$file") >/dev/null 2>&1 \ 659695b296d0Smrg || test -f "$file"; then 659795b296d0Smrg : 659895b296d0Smrg elif test -d "$file"; then 659995b296d0Smrg exit_status=1 660095b296d0Smrg continue 660195b296d0Smrg elif test "$rmforce" = yes; then 660295b296d0Smrg continue 660395b296d0Smrg fi 660495b296d0Smrg 660595b296d0Smrg rmfiles="$file" 660695b296d0Smrg 660795b296d0Smrg case $name in 660895b296d0Smrg *.la) 660995b296d0Smrg # Possibly a libtool archive, so verify it. 661095b296d0Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 661195b296d0Smrg . $dir/$name 661295b296d0Smrg 661395b296d0Smrg # Delete the libtool libraries and symlinks. 661495b296d0Smrg for n in $library_names; do 661595b296d0Smrg rmfiles="$rmfiles $objdir/$n" 661695b296d0Smrg done 661795b296d0Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 661895b296d0Smrg 661995b296d0Smrg case "$mode" in 662095b296d0Smrg clean) 662195b296d0Smrg case " $library_names " in 662295b296d0Smrg # " " in the beginning catches empty $dlname 662395b296d0Smrg *" $dlname "*) ;; 662495b296d0Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 662595b296d0Smrg esac 662695b296d0Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 662795b296d0Smrg ;; 662895b296d0Smrg uninstall) 662995b296d0Smrg if test -n "$library_names"; then 663095b296d0Smrg # Do each command in the postuninstall commands. 663195b296d0Smrg cmds=$postuninstall_cmds 663295b296d0Smrg save_ifs="$IFS"; IFS='~' 663395b296d0Smrg for cmd in $cmds; do 663495b296d0Smrg IFS="$save_ifs" 663595b296d0Smrg eval cmd=\"$cmd\" 663695b296d0Smrg $show "$cmd" 663795b296d0Smrg $run eval "$cmd" 663895b296d0Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 663995b296d0Smrg exit_status=1 664095b296d0Smrg fi 664195b296d0Smrg done 664295b296d0Smrg IFS="$save_ifs" 664395b296d0Smrg fi 664495b296d0Smrg 664595b296d0Smrg if test -n "$old_library"; then 664695b296d0Smrg # Do each command in the old_postuninstall commands. 664795b296d0Smrg cmds=$old_postuninstall_cmds 664895b296d0Smrg save_ifs="$IFS"; IFS='~' 664995b296d0Smrg for cmd in $cmds; do 665095b296d0Smrg IFS="$save_ifs" 665195b296d0Smrg eval cmd=\"$cmd\" 665295b296d0Smrg $show "$cmd" 665395b296d0Smrg $run eval "$cmd" 665495b296d0Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 665595b296d0Smrg exit_status=1 665695b296d0Smrg fi 665795b296d0Smrg done 665895b296d0Smrg IFS="$save_ifs" 665995b296d0Smrg fi 666095b296d0Smrg # FIXME: should reinstall the best remaining shared library. 666195b296d0Smrg ;; 666295b296d0Smrg esac 666395b296d0Smrg fi 666495b296d0Smrg ;; 666595b296d0Smrg 666695b296d0Smrg *.lo) 666795b296d0Smrg # Possibly a libtool object, so verify it. 666895b296d0Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 666995b296d0Smrg 667095b296d0Smrg # Read the .lo file 667195b296d0Smrg . $dir/$name 667295b296d0Smrg 667395b296d0Smrg # Add PIC object to the list of files to remove. 667495b296d0Smrg if test -n "$pic_object" \ 667595b296d0Smrg && test "$pic_object" != none; then 667695b296d0Smrg rmfiles="$rmfiles $dir/$pic_object" 667795b296d0Smrg fi 667895b296d0Smrg 667995b296d0Smrg # Add non-PIC object to the list of files to remove. 668095b296d0Smrg if test -n "$non_pic_object" \ 668195b296d0Smrg && test "$non_pic_object" != none; then 668295b296d0Smrg rmfiles="$rmfiles $dir/$non_pic_object" 668395b296d0Smrg fi 668495b296d0Smrg fi 668595b296d0Smrg ;; 668695b296d0Smrg 668795b296d0Smrg *) 668895b296d0Smrg if test "$mode" = clean ; then 668995b296d0Smrg noexename=$name 669095b296d0Smrg case $file in 669195b296d0Smrg *.exe) 669295b296d0Smrg file=`$echo $file|${SED} 's,.exe$,,'` 669395b296d0Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 669495b296d0Smrg # $file with .exe has already been added to rmfiles, 669595b296d0Smrg # add $file without .exe 669695b296d0Smrg rmfiles="$rmfiles $file" 669795b296d0Smrg ;; 669895b296d0Smrg esac 669995b296d0Smrg # Do a test to see if this is a libtool program. 670095b296d0Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 670195b296d0Smrg relink_command= 670295b296d0Smrg . $dir/$noexename 670395b296d0Smrg 670495b296d0Smrg # note $name still contains .exe if it was in $file originally 670595b296d0Smrg # as does the version of $file that was added into $rmfiles 670695b296d0Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 670795b296d0Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 670895b296d0Smrg rmfiles="$rmfiles $objdir/lt-$name" 670995b296d0Smrg fi 671095b296d0Smrg if test "X$noexename" != "X$name" ; then 671195b296d0Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 671295b296d0Smrg fi 671395b296d0Smrg fi 671495b296d0Smrg fi 671595b296d0Smrg ;; 671695b296d0Smrg esac 671795b296d0Smrg $show "$rm $rmfiles" 671895b296d0Smrg $run $rm $rmfiles || exit_status=1 671995b296d0Smrg done 672095b296d0Smrg objdir="$origobjdir" 672195b296d0Smrg 672295b296d0Smrg # Try to remove the ${objdir}s in the directories where we deleted files 672395b296d0Smrg for dir in $rmdirs; do 672495b296d0Smrg if test -d "$dir"; then 672595b296d0Smrg $show "rmdir $dir" 672695b296d0Smrg $run rmdir $dir >/dev/null 2>&1 672795b296d0Smrg fi 672895b296d0Smrg done 672995b296d0Smrg 673095b296d0Smrg exit $exit_status 673195b296d0Smrg ;; 673295b296d0Smrg 673395b296d0Smrg "") 673495b296d0Smrg $echo "$modename: you must specify a MODE" 1>&2 673595b296d0Smrg $echo "$generic_help" 1>&2 673695b296d0Smrg exit $EXIT_FAILURE 673795b296d0Smrg ;; 673895b296d0Smrg esac 673995b296d0Smrg 674095b296d0Smrg if test -z "$exec_cmd"; then 674195b296d0Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 674295b296d0Smrg $echo "$generic_help" 1>&2 674395b296d0Smrg exit $EXIT_FAILURE 674495b296d0Smrg fi 674595b296d0Smrgfi # test -z "$show_help" 674695b296d0Smrg 674795b296d0Smrgif test -n "$exec_cmd"; then 674895b296d0Smrg eval exec $exec_cmd 674995b296d0Smrg exit $EXIT_FAILURE 675095b296d0Smrgfi 675195b296d0Smrg 675295b296d0Smrg# We need to display help for each of the modes. 675395b296d0Smrgcase $mode in 675495b296d0Smrg"") $echo \ 675595b296d0Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 675695b296d0Smrg 675795b296d0SmrgProvide generalized library-building support services. 675895b296d0Smrg 675995b296d0Smrg --config show all configuration variables 676095b296d0Smrg --debug enable verbose shell tracing 676195b296d0Smrg-n, --dry-run display commands without modifying any files 676295b296d0Smrg --features display basic configuration information and exit 676395b296d0Smrg --finish same as \`--mode=finish' 676495b296d0Smrg --help display this help message and exit 676595b296d0Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 676695b296d0Smrg --quiet same as \`--silent' 676795b296d0Smrg --silent don't print informational messages 676895b296d0Smrg --tag=TAG use configuration variables from tag TAG 676995b296d0Smrg --version print version information 677095b296d0Smrg 677195b296d0SmrgMODE must be one of the following: 677295b296d0Smrg 677395b296d0Smrg clean remove files from the build directory 677495b296d0Smrg compile compile a source file into a libtool object 677595b296d0Smrg execute automatically set library path, then run a program 677695b296d0Smrg finish complete the installation of libtool libraries 677795b296d0Smrg install install libraries or executables 677895b296d0Smrg link create a library or an executable 677995b296d0Smrg uninstall remove libraries from an installed directory 678095b296d0Smrg 678195b296d0SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 678295b296d0Smrga more detailed description of MODE. 678395b296d0Smrg 678495b296d0SmrgReport bugs to <bug-libtool@gnu.org>." 678595b296d0Smrg exit $EXIT_SUCCESS 678695b296d0Smrg ;; 678795b296d0Smrg 678895b296d0Smrgclean) 678995b296d0Smrg $echo \ 679095b296d0Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 679195b296d0Smrg 679295b296d0SmrgRemove files from the build directory. 679395b296d0Smrg 679495b296d0SmrgRM is the name of the program to use to delete files associated with each FILE 679595b296d0Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 679695b296d0Smrgto RM. 679795b296d0Smrg 679895b296d0SmrgIf FILE is a libtool library, object or program, all the files associated 679995b296d0Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 680095b296d0Smrg ;; 680195b296d0Smrg 680295b296d0Smrgcompile) 680395b296d0Smrg $echo \ 680495b296d0Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 680595b296d0Smrg 680695b296d0SmrgCompile a source file into a libtool library object. 680795b296d0Smrg 680895b296d0SmrgThis mode accepts the following additional options: 680995b296d0Smrg 681095b296d0Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 681195b296d0Smrg -prefer-pic try to building PIC objects only 681295b296d0Smrg -prefer-non-pic try to building non-PIC objects only 681395b296d0Smrg -static always build a \`.o' file suitable for static linking 681495b296d0Smrg 681595b296d0SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 681695b296d0Smrgfrom the given SOURCEFILE. 681795b296d0Smrg 681895b296d0SmrgThe output file name is determined by removing the directory component from 681995b296d0SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 682095b296d0Smrglibrary object suffix, \`.lo'." 682195b296d0Smrg ;; 682295b296d0Smrg 682395b296d0Smrgexecute) 682495b296d0Smrg $echo \ 682595b296d0Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 682695b296d0Smrg 682795b296d0SmrgAutomatically set library path, then run a program. 682895b296d0Smrg 682995b296d0SmrgThis mode accepts the following additional options: 683095b296d0Smrg 683195b296d0Smrg -dlopen FILE add the directory containing FILE to the library path 683295b296d0Smrg 683395b296d0SmrgThis mode sets the library path environment variable according to \`-dlopen' 683495b296d0Smrgflags. 683595b296d0Smrg 683695b296d0SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 683795b296d0Smrginto their corresponding uninstalled binary, and any of their required library 683895b296d0Smrgdirectories are added to the library path. 683995b296d0Smrg 684095b296d0SmrgThen, COMMAND is executed, with ARGS as arguments." 684195b296d0Smrg ;; 684295b296d0Smrg 684395b296d0Smrgfinish) 684495b296d0Smrg $echo \ 684595b296d0Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 684695b296d0Smrg 684795b296d0SmrgComplete the installation of libtool libraries. 684895b296d0Smrg 684995b296d0SmrgEach LIBDIR is a directory that contains libtool libraries. 685095b296d0Smrg 685195b296d0SmrgThe commands that this mode executes may require superuser privileges. Use 685295b296d0Smrgthe \`--dry-run' option if you just want to see what would be executed." 685395b296d0Smrg ;; 685495b296d0Smrg 685595b296d0Smrginstall) 685695b296d0Smrg $echo \ 685795b296d0Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 685895b296d0Smrg 685995b296d0SmrgInstall executables or libraries. 686095b296d0Smrg 686195b296d0SmrgINSTALL-COMMAND is the installation command. The first component should be 686295b296d0Smrgeither the \`install' or \`cp' program. 686395b296d0Smrg 686495b296d0SmrgThe rest of the components are interpreted as arguments to that command (only 686595b296d0SmrgBSD-compatible install options are recognized)." 686695b296d0Smrg ;; 686795b296d0Smrg 686895b296d0Smrglink) 686995b296d0Smrg $echo \ 687095b296d0Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 687195b296d0Smrg 687295b296d0SmrgLink object files or libraries together to form another library, or to 687395b296d0Smrgcreate an executable program. 687495b296d0Smrg 687595b296d0SmrgLINK-COMMAND is a command using the C compiler that you would use to create 687695b296d0Smrga program from several object files. 687795b296d0Smrg 687895b296d0SmrgThe following components of LINK-COMMAND are treated specially: 687995b296d0Smrg 688095b296d0Smrg -all-static do not do any dynamic linking at all 688195b296d0Smrg -avoid-version do not add a version suffix if possible 688295b296d0Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 688395b296d0Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 688495b296d0Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 688595b296d0Smrg -export-symbols SYMFILE 688695b296d0Smrg try to export only the symbols listed in SYMFILE 688795b296d0Smrg -export-symbols-regex REGEX 688895b296d0Smrg try to export only the symbols matching REGEX 688995b296d0Smrg -LLIBDIR search LIBDIR for required installed libraries 689095b296d0Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 689195b296d0Smrg -module build a library that can dlopened 689295b296d0Smrg -no-fast-install disable the fast-install mode 689395b296d0Smrg -no-install link a not-installable executable 689495b296d0Smrg -no-undefined declare that a library does not refer to external symbols 689595b296d0Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 689695b296d0Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 689795b296d0Smrg -precious-files-regex REGEX 689895b296d0Smrg don't remove output files matching REGEX 689995b296d0Smrg -release RELEASE specify package release information 690095b296d0Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 690195b296d0Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 690295b296d0Smrg -static do not do any dynamic linking of libtool libraries 690395b296d0Smrg -version-info CURRENT[:REVISION[:AGE]] 690495b296d0Smrg specify library version info [each variable defaults to 0] 690595b296d0Smrg 690695b296d0SmrgAll other options (arguments beginning with \`-') are ignored. 690795b296d0Smrg 690895b296d0SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 690995b296d0Smrgtreated as uninstalled libtool libraries, other files are standard or library 691095b296d0Smrgobject files. 691195b296d0Smrg 691295b296d0SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 691395b296d0Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 691495b296d0Smrgrequired, except when creating a convenience library. 691595b296d0Smrg 691695b296d0SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 691795b296d0Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 691895b296d0Smrg 691995b296d0SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 692095b296d0Smrgis created, otherwise an executable program is created." 692195b296d0Smrg ;; 692295b296d0Smrg 692395b296d0Smrguninstall) 692495b296d0Smrg $echo \ 692595b296d0Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 692695b296d0Smrg 692795b296d0SmrgRemove libraries from an installation directory. 692895b296d0Smrg 692995b296d0SmrgRM is the name of the program to use to delete files associated with each FILE 693095b296d0Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 693195b296d0Smrgto RM. 693295b296d0Smrg 693395b296d0SmrgIf FILE is a libtool library, all the files associated with it are deleted. 693495b296d0SmrgOtherwise, only FILE itself is deleted using RM." 693595b296d0Smrg ;; 693695b296d0Smrg 693795b296d0Smrg*) 693895b296d0Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 693995b296d0Smrg $echo "$help" 1>&2 694095b296d0Smrg exit $EXIT_FAILURE 694195b296d0Smrg ;; 694295b296d0Smrgesac 694395b296d0Smrg 694495b296d0Smrg$echo 694595b296d0Smrg$echo "Try \`$modename --help' for more information about other modes." 694695b296d0Smrg 694795b296d0Smrgexit $? 694895b296d0Smrg 694995b296d0Smrg# The TAGs below are defined such that we never get into a situation 695095b296d0Smrg# in which we disable both kinds of libraries. Given conflicting 695195b296d0Smrg# choices, we go for a static library, that is the most portable, 695295b296d0Smrg# since we can't tell whether shared libraries were disabled because 695395b296d0Smrg# the user asked for that or because the platform doesn't support 695495b296d0Smrg# them. This is particularly important on AIX, because we don't 695595b296d0Smrg# support having both static and shared libraries enabled at the same 695695b296d0Smrg# time on that platform, so we default to a shared-only configuration. 695795b296d0Smrg# If a disable-shared tag is given, we'll fallback to a static-only 695895b296d0Smrg# configuration. But we'll never go from static-only to shared-only. 695995b296d0Smrg 696095b296d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 696195b296d0Smrgdisable_libs=shared 696295b296d0Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 696395b296d0Smrg 696495b296d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 696595b296d0Smrgdisable_libs=static 696695b296d0Smrg# ### END LIBTOOL TAG CONFIG: disable-static 696795b296d0Smrg 696895b296d0Smrg# Local Variables: 696995b296d0Smrg# mode:shell-script 697095b296d0Smrg# sh-indentation:2 697195b296d0Smrg# End: 6972