ltmain.sh revision 7104f784
109885543Smrg# ltmain.sh - Provide generalized library-building support services. 209885543Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 309885543Smrg# 47104f784Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 57104f784Smrg# 2007, 2008 Free Software Foundation, Inc. 609885543Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 709885543Smrg# 809885543Smrg# This program is free software; you can redistribute it and/or modify 909885543Smrg# it under the terms of the GNU General Public License as published by 1009885543Smrg# the Free Software Foundation; either version 2 of the License, or 1109885543Smrg# (at your option) any later version. 1209885543Smrg# 1309885543Smrg# This program is distributed in the hope that it will be useful, but 1409885543Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1509885543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1609885543Smrg# General Public License for more details. 1709885543Smrg# 1809885543Smrg# You should have received a copy of the GNU General Public License 1909885543Smrg# along with this program; if not, write to the Free Software 2009885543Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2109885543Smrg# 2209885543Smrg# As a special exception to the GNU General Public License, if you 2309885543Smrg# distribute this file as part of a program that contains a 2409885543Smrg# configuration script generated by Autoconf, you may include it under 2509885543Smrg# the same distribution terms that you use for the rest of that program. 2609885543Smrg 2709885543Smrgbasename="s,^.*/,,g" 2809885543Smrg 2909885543Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 3009885543Smrg# is ksh but when the shell is invoked as "sh" and the current value of 3109885543Smrg# the _XPG environment variable is not equal to 1 (one), the special 3209885543Smrg# positional parameter $0, within a function call, is the name of the 3309885543Smrg# function. 3409885543Smrgprogpath="$0" 3509885543Smrg 3609885543Smrg# The name of this program: 3709885543Smrgprogname=`echo "$progpath" | $SED $basename` 3809885543Smrgmodename="$progname" 3909885543Smrg 4009885543Smrg# Global variables: 4109885543SmrgEXIT_SUCCESS=0 4209885543SmrgEXIT_FAILURE=1 4309885543Smrg 4409885543SmrgPROGRAM=ltmain.sh 4509885543SmrgPACKAGE=libtool 467104f784SmrgVERSION=1.5.26 477104f784SmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 487104f784Smrg 497104f784Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 507104f784Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 517104f784Smrg emulate sh 527104f784Smrg NULLCMD=: 537104f784Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 547104f784Smrg # is contrary to our usage. Disable this feature. 557104f784Smrg alias -g '${1+"$@"}'='"$@"' 5609885543Smrg setopt NO_GLOB_SUBST 577104f784Smrgelse 587104f784Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 5909885543Smrgfi 607104f784SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 617104f784SmrgDUALCASE=1; export DUALCASE # for MKS sh 6209885543Smrg 6309885543Smrg# Check that we have a working $echo. 6409885543Smrgif test "X$1" = X--no-reexec; then 6509885543Smrg # Discard the --no-reexec flag, and continue. 6609885543Smrg shift 6709885543Smrgelif test "X$1" = X--fallback-echo; then 6809885543Smrg # Avoid inline document here, it may be left over 6909885543Smrg : 7009885543Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 7109885543Smrg # Yippee, $echo works! 7209885543Smrg : 7309885543Smrgelse 7409885543Smrg # Restart under the correct shell, and then maybe $echo will work. 7509885543Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 7609885543Smrgfi 7709885543Smrg 7809885543Smrgif test "X$1" = X--fallback-echo; then 7909885543Smrg # used as fallback echo 8009885543Smrg shift 8109885543Smrg cat <<EOF 8209885543Smrg$* 8309885543SmrgEOF 8409885543Smrg exit $EXIT_SUCCESS 8509885543Smrgfi 8609885543Smrg 8709885543Smrgdefault_mode= 8809885543Smrghelp="Try \`$progname --help' for more information." 8909885543Smrgmagic="%%%MAGIC variable%%%" 9009885543Smrgmkdir="mkdir" 9109885543Smrgmv="mv -f" 9209885543Smrgrm="rm -f" 9309885543Smrg 9409885543Smrg# Sed substitution that helps us do robust quoting. It backslashifies 9509885543Smrg# metacharacters that are still active within double-quoted strings. 9609885543SmrgXsed="${SED}"' -e 1s/^X//' 9709885543Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 9809885543Smrg# test EBCDIC or ASCII 9909885543Smrgcase `echo X|tr X '\101'` in 10009885543Smrg A) # ASCII based system 10109885543Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 10209885543Smrg SP2NL='tr \040 \012' 10309885543Smrg NL2SP='tr \015\012 \040\040' 10409885543Smrg ;; 10509885543Smrg *) # EBCDIC based system 10609885543Smrg SP2NL='tr \100 \n' 10709885543Smrg NL2SP='tr \r\n \100\100' 10809885543Smrg ;; 10909885543Smrgesac 11009885543Smrg 11109885543Smrg# NLS nuisances. 11209885543Smrg# Only set LANG and LC_ALL to C if already set. 11309885543Smrg# These must not be set unconditionally because not all systems understand 11409885543Smrg# e.g. LANG=C (notably SCO). 11509885543Smrg# We save the old values to restore during execute mode. 1167104f784Smrglt_env= 1177104f784Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1187104f784Smrgdo 1197104f784Smrg eval "if test \"\${$lt_var+set}\" = set; then 1207104f784Smrg save_$lt_var=\$$lt_var 1217104f784Smrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1227104f784Smrg $lt_var=C 1237104f784Smrg export $lt_var 1247104f784Smrg fi" 1257104f784Smrgdone 1267104f784Smrg 1277104f784Smrgif test -n "$lt_env"; then 1287104f784Smrg lt_env="env $lt_env" 12909885543Smrgfi 13009885543Smrg 13109885543Smrg# Make sure IFS has a sensible default 13209885543Smrglt_nl=' 13309885543Smrg' 13409885543SmrgIFS=" $lt_nl" 13509885543Smrg 13609885543Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 13709885543Smrg $echo "$modename: not configured to build any kind of library" 1>&2 13809885543Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 13909885543Smrg exit $EXIT_FAILURE 14009885543Smrgfi 14109885543Smrg 14209885543Smrg# Global variables. 14309885543Smrgmode=$default_mode 14409885543Smrgnonopt= 14509885543Smrgprev= 14609885543Smrgprevopt= 14709885543Smrgrun= 14809885543Smrgshow="$echo" 14909885543Smrgshow_help= 15009885543Smrgexecute_dlfiles= 15109885543Smrgduplicate_deps=no 15209885543Smrgpreserve_args= 15309885543Smrglo2o="s/\\.lo\$/.${objext}/" 15409885543Smrgo2lo="s/\\.${objext}\$/.lo/" 1557104f784Smrgextracted_archives= 1567104f784Smrgextracted_serial=0 15709885543Smrg 15809885543Smrg##################################### 15909885543Smrg# Shell function definitions: 16009885543Smrg# This seems to be the best place for them 16109885543Smrg 16209885543Smrg# func_mktempdir [string] 16309885543Smrg# Make a temporary directory that won't clash with other running 16409885543Smrg# libtool processes, and avoids race conditions if possible. If 16509885543Smrg# given, STRING is the basename for that directory. 16609885543Smrgfunc_mktempdir () 16709885543Smrg{ 16809885543Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 16909885543Smrg 17009885543Smrg if test "$run" = ":"; then 17109885543Smrg # Return a directory name, but don't create it in dry-run mode 17209885543Smrg my_tmpdir="${my_template}-$$" 17309885543Smrg else 17409885543Smrg 17509885543Smrg # If mktemp works, use that first and foremost 17609885543Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 17709885543Smrg 17809885543Smrg if test ! -d "$my_tmpdir"; then 17909885543Smrg # Failing that, at least try and use $RANDOM to avoid a race 18009885543Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 18109885543Smrg 18209885543Smrg save_mktempdir_umask=`umask` 18309885543Smrg umask 0077 18409885543Smrg $mkdir "$my_tmpdir" 18509885543Smrg umask $save_mktempdir_umask 18609885543Smrg fi 18709885543Smrg 18809885543Smrg # If we're not in dry-run mode, bomb out on failure 18909885543Smrg test -d "$my_tmpdir" || { 19009885543Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 19109885543Smrg exit $EXIT_FAILURE 19209885543Smrg } 19309885543Smrg fi 19409885543Smrg 19509885543Smrg $echo "X$my_tmpdir" | $Xsed 19609885543Smrg} 19709885543Smrg 19809885543Smrg 19909885543Smrg# func_win32_libid arg 20009885543Smrg# return the library type of file 'arg' 20109885543Smrg# 20209885543Smrg# Need a lot of goo to handle *both* DLLs and import libs 20309885543Smrg# Has to be a shell function in order to 'eat' the argument 20409885543Smrg# that is supplied when $file_magic_command is called. 20509885543Smrgfunc_win32_libid () 20609885543Smrg{ 20709885543Smrg win32_libid_type="unknown" 20809885543Smrg win32_fileres=`file -L $1 2>/dev/null` 20909885543Smrg case $win32_fileres in 21009885543Smrg *ar\ archive\ import\ library*) # definitely import 21109885543Smrg win32_libid_type="x86 archive import" 21209885543Smrg ;; 21309885543Smrg *ar\ archive*) # could be an import, or static 21409885543Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 21509885543Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 21609885543Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 2177104f784Smrg $SED -n -e '1,100{ 2187104f784Smrg / I /{ 2197104f784Smrg s,.*,import, 2207104f784Smrg p 2217104f784Smrg q 2227104f784Smrg } 2237104f784Smrg }'` 22409885543Smrg case $win32_nmres in 22509885543Smrg import*) win32_libid_type="x86 archive import";; 22609885543Smrg *) win32_libid_type="x86 archive static";; 22709885543Smrg esac 22809885543Smrg fi 22909885543Smrg ;; 23009885543Smrg *DLL*) 23109885543Smrg win32_libid_type="x86 DLL" 23209885543Smrg ;; 23309885543Smrg *executable*) # but shell scripts are "executable" too... 23409885543Smrg case $win32_fileres in 23509885543Smrg *MS\ Windows\ PE\ Intel*) 23609885543Smrg win32_libid_type="x86 DLL" 23709885543Smrg ;; 23809885543Smrg esac 23909885543Smrg ;; 24009885543Smrg esac 24109885543Smrg $echo $win32_libid_type 24209885543Smrg} 24309885543Smrg 24409885543Smrg 24509885543Smrg# func_infer_tag arg 24609885543Smrg# Infer tagged configuration to use if any are available and 24709885543Smrg# if one wasn't chosen via the "--tag" command line option. 24809885543Smrg# Only attempt this if the compiler in the base compile 24909885543Smrg# command doesn't match the default compiler. 25009885543Smrg# arg is usually of the form 'gcc ...' 25109885543Smrgfunc_infer_tag () 25209885543Smrg{ 25309885543Smrg if test -n "$available_tags" && test -z "$tagname"; then 25409885543Smrg CC_quoted= 25509885543Smrg for arg in $CC; do 25609885543Smrg case $arg in 25709885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 25809885543Smrg arg="\"$arg\"" 25909885543Smrg ;; 26009885543Smrg esac 26109885543Smrg CC_quoted="$CC_quoted $arg" 26209885543Smrg done 26309885543Smrg case $@ in 26409885543Smrg # Blanks in the command may have been stripped by the calling shell, 26509885543Smrg # but not from the CC environment variable when configure was run. 26609885543Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 26709885543Smrg # Blanks at the start of $base_compile will cause this to fail 26809885543Smrg # if we don't check for them as well. 26909885543Smrg *) 27009885543Smrg for z in $available_tags; do 27109885543Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 27209885543Smrg # Evaluate the configuration. 27309885543Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 27409885543Smrg CC_quoted= 27509885543Smrg for arg in $CC; do 27609885543Smrg # Double-quote args containing other shell metacharacters. 27709885543Smrg case $arg in 27809885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 27909885543Smrg arg="\"$arg\"" 28009885543Smrg ;; 28109885543Smrg esac 28209885543Smrg CC_quoted="$CC_quoted $arg" 28309885543Smrg done 2847104f784Smrg # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc' 2857104f784Smrg trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"` 2867104f784Smrg # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc 2877104f784Smrg extendcc=${host}-${CC} 2887104f784Smrg # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc 2897104f784Smrg # (Gentoo-specific hack because we always export $CHOST) 2907104f784Smrg mungedcc=${CHOST-${host}}-${trimedcc} 29109885543Smrg case "$@ " in 2927104f784Smrg "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\ 2937104f784Smrg "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*) 2947104f784Smrg tagname=CC 2957104f784Smrg break ;; 2967104f784Smrg "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\ 2977104f784Smrg "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\ 2987104f784Smrg "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\ 29909885543Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 30009885543Smrg # The compiler in the base compile command matches 30109885543Smrg # the one in the tagged configuration. 30209885543Smrg # Assume this is the tagged configuration we want. 30309885543Smrg tagname=$z 30409885543Smrg break 30509885543Smrg ;; 30609885543Smrg esac 30709885543Smrg fi 30809885543Smrg done 30909885543Smrg # If $tagname still isn't set, then no tagged configuration 31009885543Smrg # was found and let the user know that the "--tag" command 31109885543Smrg # line option must be used. 31209885543Smrg if test -z "$tagname"; then 31309885543Smrg $echo "$modename: unable to infer tagged configuration" 31409885543Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 31509885543Smrg exit $EXIT_FAILURE 31609885543Smrg# else 31709885543Smrg# $echo "$modename: using $tagname tagged configuration" 31809885543Smrg fi 31909885543Smrg ;; 32009885543Smrg esac 32109885543Smrg fi 32209885543Smrg} 32309885543Smrg 32409885543Smrg 32509885543Smrg# func_extract_an_archive dir oldlib 32609885543Smrgfunc_extract_an_archive () 32709885543Smrg{ 32809885543Smrg f_ex_an_ar_dir="$1"; shift 32909885543Smrg f_ex_an_ar_oldlib="$1" 33009885543Smrg 33109885543Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 33209885543Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 33309885543Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 33409885543Smrg : 33509885543Smrg else 33609885543Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 33709885543Smrg exit $EXIT_FAILURE 33809885543Smrg fi 33909885543Smrg} 34009885543Smrg 34109885543Smrg# func_extract_archives gentop oldlib ... 34209885543Smrgfunc_extract_archives () 34309885543Smrg{ 34409885543Smrg my_gentop="$1"; shift 34509885543Smrg my_oldlibs=${1+"$@"} 34609885543Smrg my_oldobjs="" 34709885543Smrg my_xlib="" 34809885543Smrg my_xabs="" 34909885543Smrg my_xdir="" 35009885543Smrg my_status="" 35109885543Smrg 35209885543Smrg $show "${rm}r $my_gentop" 35309885543Smrg $run ${rm}r "$my_gentop" 35409885543Smrg $show "$mkdir $my_gentop" 35509885543Smrg $run $mkdir "$my_gentop" 35609885543Smrg my_status=$? 35709885543Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 35809885543Smrg exit $my_status 35909885543Smrg fi 36009885543Smrg 36109885543Smrg for my_xlib in $my_oldlibs; do 36209885543Smrg # Extract the objects. 36309885543Smrg case $my_xlib in 36409885543Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 36509885543Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 36609885543Smrg esac 36709885543Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3687104f784Smrg my_xlib_u=$my_xlib 3697104f784Smrg while :; do 3707104f784Smrg case " $extracted_archives " in 3717104f784Smrg *" $my_xlib_u "*) 3727104f784Smrg extracted_serial=`expr $extracted_serial + 1` 3737104f784Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3747104f784Smrg *) break ;; 3757104f784Smrg esac 3767104f784Smrg done 3777104f784Smrg extracted_archives="$extracted_archives $my_xlib_u" 3787104f784Smrg my_xdir="$my_gentop/$my_xlib_u" 37909885543Smrg 38009885543Smrg $show "${rm}r $my_xdir" 38109885543Smrg $run ${rm}r "$my_xdir" 38209885543Smrg $show "$mkdir $my_xdir" 38309885543Smrg $run $mkdir "$my_xdir" 38409885543Smrg exit_status=$? 38509885543Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 38609885543Smrg exit $exit_status 38709885543Smrg fi 38809885543Smrg case $host in 38909885543Smrg *-darwin*) 39009885543Smrg $show "Extracting $my_xabs" 39109885543Smrg # Do not bother doing anything if just a dry run 39209885543Smrg if test -z "$run"; then 39309885543Smrg darwin_orig_dir=`pwd` 39409885543Smrg cd $my_xdir || exit $? 39509885543Smrg darwin_archive=$my_xabs 39609885543Smrg darwin_curdir=`pwd` 39709885543Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 39809885543Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 39909885543Smrg if test -n "$darwin_arches"; then 40009885543Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 40109885543Smrg darwin_arch= 40209885543Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 40309885543Smrg for darwin_arch in $darwin_arches ; do 40409885543Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 40509885543Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 40609885543Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 40709885543Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 40809885543Smrg cd "$darwin_curdir" 40909885543Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 41009885543Smrg done # $darwin_arches 41109885543Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 41209885543Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 41309885543Smrg darwin_file= 41409885543Smrg darwin_files= 41509885543Smrg for darwin_file in $darwin_filelist; do 41609885543Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 41709885543Smrg lipo -create -output "$darwin_file" $darwin_files 41809885543Smrg done # $darwin_filelist 41909885543Smrg ${rm}r unfat-$$ 42009885543Smrg cd "$darwin_orig_dir" 42109885543Smrg else 42209885543Smrg cd "$darwin_orig_dir" 42309885543Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 42409885543Smrg fi # $darwin_arches 42509885543Smrg fi # $run 42609885543Smrg ;; 42709885543Smrg *) 42809885543Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 42909885543Smrg ;; 43009885543Smrg esac 43109885543Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 43209885543Smrg done 43309885543Smrg func_extract_archives_result="$my_oldobjs" 43409885543Smrg} 43509885543Smrg# End of Shell function definitions 43609885543Smrg##################################### 43709885543Smrg 43809885543Smrg# Darwin sucks 43909885543Smrgeval std_shrext=\"$shrext_cmds\" 44009885543Smrg 44109885543Smrgdisable_libs=no 44209885543Smrg 44309885543Smrg# Parse our command line options once, thoroughly. 44409885543Smrgwhile test "$#" -gt 0 44509885543Smrgdo 44609885543Smrg arg="$1" 44709885543Smrg shift 44809885543Smrg 44909885543Smrg case $arg in 45009885543Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 45109885543Smrg *) optarg= ;; 45209885543Smrg esac 45309885543Smrg 45409885543Smrg # If the previous option needs an argument, assign it. 45509885543Smrg if test -n "$prev"; then 45609885543Smrg case $prev in 45709885543Smrg execute_dlfiles) 45809885543Smrg execute_dlfiles="$execute_dlfiles $arg" 45909885543Smrg ;; 46009885543Smrg tag) 46109885543Smrg tagname="$arg" 46209885543Smrg preserve_args="${preserve_args}=$arg" 46309885543Smrg 46409885543Smrg # Check whether tagname contains only valid characters 46509885543Smrg case $tagname in 46609885543Smrg *[!-_A-Za-z0-9,/]*) 46709885543Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 46809885543Smrg exit $EXIT_FAILURE 46909885543Smrg ;; 47009885543Smrg esac 47109885543Smrg 47209885543Smrg case $tagname in 47309885543Smrg CC) 47409885543Smrg # Don't test for the "default" C tag, as we know, it's there, but 47509885543Smrg # not specially marked. 47609885543Smrg ;; 47709885543Smrg *) 47809885543Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 47909885543Smrg taglist="$taglist $tagname" 48009885543Smrg # Evaluate the configuration. 48109885543Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 48209885543Smrg else 48309885543Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 48409885543Smrg fi 48509885543Smrg ;; 48609885543Smrg esac 48709885543Smrg ;; 48809885543Smrg *) 48909885543Smrg eval "$prev=\$arg" 49009885543Smrg ;; 49109885543Smrg esac 49209885543Smrg 49309885543Smrg prev= 49409885543Smrg prevopt= 49509885543Smrg continue 49609885543Smrg fi 49709885543Smrg 49809885543Smrg # Have we seen a non-optional argument yet? 49909885543Smrg case $arg in 50009885543Smrg --help) 50109885543Smrg show_help=yes 50209885543Smrg ;; 50309885543Smrg 50409885543Smrg --version) 5057104f784Smrg echo "\ 5067104f784Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 5077104f784Smrg 5087104f784SmrgCopyright (C) 2008 Free Software Foundation, Inc. 5097104f784SmrgThis is free software; see the source for copying conditions. There is NO 5107104f784Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 51109885543Smrg exit $? 51209885543Smrg ;; 51309885543Smrg 51409885543Smrg --config) 51509885543Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 51609885543Smrg # Now print the configurations for the tags. 51709885543Smrg for tagname in $taglist; do 51809885543Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 51909885543Smrg done 52009885543Smrg exit $? 52109885543Smrg ;; 52209885543Smrg 52309885543Smrg --debug) 52409885543Smrg $echo "$progname: enabling shell trace mode" 52509885543Smrg set -x 52609885543Smrg preserve_args="$preserve_args $arg" 52709885543Smrg ;; 52809885543Smrg 52909885543Smrg --dry-run | -n) 53009885543Smrg run=: 53109885543Smrg ;; 53209885543Smrg 53309885543Smrg --features) 53409885543Smrg $echo "host: $host" 53509885543Smrg if test "$build_libtool_libs" = yes; then 53609885543Smrg $echo "enable shared libraries" 53709885543Smrg else 53809885543Smrg $echo "disable shared libraries" 53909885543Smrg fi 54009885543Smrg if test "$build_old_libs" = yes; then 54109885543Smrg $echo "enable static libraries" 54209885543Smrg else 54309885543Smrg $echo "disable static libraries" 54409885543Smrg fi 54509885543Smrg exit $? 54609885543Smrg ;; 54709885543Smrg 54809885543Smrg --finish) mode="finish" ;; 54909885543Smrg 55009885543Smrg --mode) prevopt="--mode" prev=mode ;; 55109885543Smrg --mode=*) mode="$optarg" ;; 55209885543Smrg 55309885543Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 55409885543Smrg 55509885543Smrg --quiet | --silent) 55609885543Smrg show=: 55709885543Smrg preserve_args="$preserve_args $arg" 55809885543Smrg ;; 55909885543Smrg 56009885543Smrg --tag) 56109885543Smrg prevopt="--tag" 56209885543Smrg prev=tag 56309885543Smrg preserve_args="$preserve_args --tag" 56409885543Smrg ;; 56509885543Smrg --tag=*) 56609885543Smrg set tag "$optarg" ${1+"$@"} 56709885543Smrg shift 56809885543Smrg prev=tag 56909885543Smrg preserve_args="$preserve_args --tag" 57009885543Smrg ;; 57109885543Smrg 57209885543Smrg -dlopen) 57309885543Smrg prevopt="-dlopen" 57409885543Smrg prev=execute_dlfiles 57509885543Smrg ;; 57609885543Smrg 57709885543Smrg -*) 57809885543Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 57909885543Smrg $echo "$help" 1>&2 58009885543Smrg exit $EXIT_FAILURE 58109885543Smrg ;; 58209885543Smrg 58309885543Smrg *) 58409885543Smrg nonopt="$arg" 58509885543Smrg break 58609885543Smrg ;; 58709885543Smrg esac 58809885543Smrgdone 58909885543Smrg 59009885543Smrgif test -n "$prevopt"; then 59109885543Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 59209885543Smrg $echo "$help" 1>&2 59309885543Smrg exit $EXIT_FAILURE 59409885543Smrgfi 59509885543Smrg 59609885543Smrgcase $disable_libs in 59709885543Smrgno) 59809885543Smrg ;; 59909885543Smrgshared) 60009885543Smrg build_libtool_libs=no 60109885543Smrg build_old_libs=yes 60209885543Smrg ;; 60309885543Smrgstatic) 60409885543Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 60509885543Smrg ;; 60609885543Smrgesac 60709885543Smrg 60809885543Smrg# If this variable is set in any of the actions, the command in it 60909885543Smrg# will be execed at the end. This prevents here-documents from being 61009885543Smrg# left over by shells. 61109885543Smrgexec_cmd= 61209885543Smrg 61309885543Smrgif test -z "$show_help"; then 61409885543Smrg 61509885543Smrg # Infer the operation mode. 61609885543Smrg if test -z "$mode"; then 61709885543Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 61809885543Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 61909885543Smrg case $nonopt in 62009885543Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 62109885543Smrg mode=link 62209885543Smrg for arg 62309885543Smrg do 62409885543Smrg case $arg in 62509885543Smrg -c) 62609885543Smrg mode=compile 62709885543Smrg break 62809885543Smrg ;; 62909885543Smrg esac 63009885543Smrg done 63109885543Smrg ;; 63209885543Smrg *db | *dbx | *strace | *truss) 63309885543Smrg mode=execute 63409885543Smrg ;; 63509885543Smrg *install*|cp|mv) 63609885543Smrg mode=install 63709885543Smrg ;; 63809885543Smrg *rm) 63909885543Smrg mode=uninstall 64009885543Smrg ;; 64109885543Smrg *) 64209885543Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 64309885543Smrg test -n "$execute_dlfiles" && mode=execute 64409885543Smrg 64509885543Smrg # Just use the default operation mode. 64609885543Smrg if test -z "$mode"; then 64709885543Smrg if test -n "$nonopt"; then 64809885543Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 64909885543Smrg else 65009885543Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 65109885543Smrg fi 65209885543Smrg fi 65309885543Smrg ;; 65409885543Smrg esac 65509885543Smrg fi 65609885543Smrg 65709885543Smrg # Only execute mode is allowed to have -dlopen flags. 65809885543Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 65909885543Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 66009885543Smrg $echo "$help" 1>&2 66109885543Smrg exit $EXIT_FAILURE 66209885543Smrg fi 66309885543Smrg 66409885543Smrg # Change the help message to a mode-specific one. 66509885543Smrg generic_help="$help" 66609885543Smrg help="Try \`$modename --help --mode=$mode' for more information." 66709885543Smrg 66809885543Smrg # These modes are in order of execution frequency so that they run quickly. 66909885543Smrg case $mode in 67009885543Smrg # libtool compile mode 67109885543Smrg compile) 67209885543Smrg modename="$modename: compile" 67309885543Smrg # Get the compilation command and the source file. 67409885543Smrg base_compile= 67509885543Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 67609885543Smrg suppress_opt=yes 67709885543Smrg suppress_output= 67809885543Smrg arg_mode=normal 67909885543Smrg libobj= 68009885543Smrg later= 68109885543Smrg 68209885543Smrg for arg 68309885543Smrg do 68409885543Smrg case $arg_mode in 68509885543Smrg arg ) 68609885543Smrg # do not "continue". Instead, add this to base_compile 68709885543Smrg lastarg="$arg" 68809885543Smrg arg_mode=normal 68909885543Smrg ;; 69009885543Smrg 69109885543Smrg target ) 69209885543Smrg libobj="$arg" 69309885543Smrg arg_mode=normal 69409885543Smrg continue 69509885543Smrg ;; 69609885543Smrg 69709885543Smrg normal ) 69809885543Smrg # Accept any command-line options. 69909885543Smrg case $arg in 70009885543Smrg -o) 70109885543Smrg if test -n "$libobj" ; then 70209885543Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 70309885543Smrg exit $EXIT_FAILURE 70409885543Smrg fi 70509885543Smrg arg_mode=target 70609885543Smrg continue 70709885543Smrg ;; 70809885543Smrg 70909885543Smrg -static | -prefer-pic | -prefer-non-pic) 71009885543Smrg later="$later $arg" 71109885543Smrg continue 71209885543Smrg ;; 71309885543Smrg 71409885543Smrg -no-suppress) 71509885543Smrg suppress_opt=no 71609885543Smrg continue 71709885543Smrg ;; 71809885543Smrg 71909885543Smrg -Xcompiler) 72009885543Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 72109885543Smrg continue # The current "srcfile" will either be retained or 72209885543Smrg ;; # replaced later. I would guess that would be a bug. 72309885543Smrg 72409885543Smrg -Wc,*) 72509885543Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 72609885543Smrg lastarg= 72709885543Smrg save_ifs="$IFS"; IFS=',' 72809885543Smrg for arg in $args; do 72909885543Smrg IFS="$save_ifs" 73009885543Smrg 73109885543Smrg # Double-quote args containing other shell metacharacters. 73209885543Smrg # Many Bourne shells cannot handle close brackets correctly 73309885543Smrg # in scan sets, so we specify it separately. 73409885543Smrg case $arg in 73509885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 73609885543Smrg arg="\"$arg\"" 73709885543Smrg ;; 73809885543Smrg esac 73909885543Smrg lastarg="$lastarg $arg" 74009885543Smrg done 74109885543Smrg IFS="$save_ifs" 74209885543Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 74309885543Smrg 74409885543Smrg # Add the arguments to base_compile. 74509885543Smrg base_compile="$base_compile $lastarg" 74609885543Smrg continue 74709885543Smrg ;; 74809885543Smrg 74909885543Smrg * ) 75009885543Smrg # Accept the current argument as the source file. 75109885543Smrg # The previous "srcfile" becomes the current argument. 75209885543Smrg # 75309885543Smrg lastarg="$srcfile" 75409885543Smrg srcfile="$arg" 75509885543Smrg ;; 75609885543Smrg esac # case $arg 75709885543Smrg ;; 75809885543Smrg esac # case $arg_mode 75909885543Smrg 76009885543Smrg # Aesthetically quote the previous argument. 76109885543Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 76209885543Smrg 76309885543Smrg case $lastarg in 76409885543Smrg # Double-quote args containing other shell metacharacters. 76509885543Smrg # Many Bourne shells cannot handle close brackets correctly 76609885543Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 76709885543Smrg # in scan sets (worked around with variable expansion), 76809885543Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 76909885543Smrg # at all, so we specify them separately. 77009885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 77109885543Smrg lastarg="\"$lastarg\"" 77209885543Smrg ;; 77309885543Smrg esac 77409885543Smrg 77509885543Smrg base_compile="$base_compile $lastarg" 77609885543Smrg done # for arg 77709885543Smrg 77809885543Smrg case $arg_mode in 77909885543Smrg arg) 78009885543Smrg $echo "$modename: you must specify an argument for -Xcompile" 78109885543Smrg exit $EXIT_FAILURE 78209885543Smrg ;; 78309885543Smrg target) 78409885543Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 78509885543Smrg exit $EXIT_FAILURE 78609885543Smrg ;; 78709885543Smrg *) 78809885543Smrg # Get the name of the library object. 78909885543Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 79009885543Smrg ;; 79109885543Smrg esac 79209885543Smrg 79309885543Smrg # Recognize several different file suffixes. 79409885543Smrg # If the user specifies -o file.o, it is replaced with file.lo 79509885543Smrg xform='[cCFSifmso]' 79609885543Smrg case $libobj in 79709885543Smrg *.ada) xform=ada ;; 79809885543Smrg *.adb) xform=adb ;; 79909885543Smrg *.ads) xform=ads ;; 80009885543Smrg *.asm) xform=asm ;; 80109885543Smrg *.c++) xform=c++ ;; 80209885543Smrg *.cc) xform=cc ;; 80309885543Smrg *.ii) xform=ii ;; 80409885543Smrg *.class) xform=class ;; 80509885543Smrg *.cpp) xform=cpp ;; 80609885543Smrg *.cxx) xform=cxx ;; 8077104f784Smrg *.[fF][09]?) xform=[fF][09]. ;; 80809885543Smrg *.for) xform=for ;; 80909885543Smrg *.java) xform=java ;; 8107104f784Smrg *.obj) xform=obj ;; 8117104f784Smrg *.sx) xform=sx ;; 81209885543Smrg esac 81309885543Smrg 81409885543Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 81509885543Smrg 81609885543Smrg case $libobj in 81709885543Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 81809885543Smrg *) 81909885543Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 82009885543Smrg exit $EXIT_FAILURE 82109885543Smrg ;; 82209885543Smrg esac 82309885543Smrg 82409885543Smrg func_infer_tag $base_compile 82509885543Smrg 82609885543Smrg for arg in $later; do 82709885543Smrg case $arg in 82809885543Smrg -static) 82909885543Smrg build_old_libs=yes 83009885543Smrg continue 83109885543Smrg ;; 83209885543Smrg 83309885543Smrg -prefer-pic) 83409885543Smrg pic_mode=yes 83509885543Smrg continue 83609885543Smrg ;; 83709885543Smrg 83809885543Smrg -prefer-non-pic) 83909885543Smrg pic_mode=no 84009885543Smrg continue 84109885543Smrg ;; 84209885543Smrg esac 84309885543Smrg done 84409885543Smrg 84509885543Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 84609885543Smrg case $qlibobj in 84709885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 84809885543Smrg qlibobj="\"$qlibobj\"" ;; 84909885543Smrg esac 85009885543Smrg test "X$libobj" != "X$qlibobj" \ 85109885543Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 85209885543Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 85309885543Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 85409885543Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 85509885543Smrg if test "X$xdir" = "X$obj"; then 85609885543Smrg xdir= 85709885543Smrg else 85809885543Smrg xdir=$xdir/ 85909885543Smrg fi 86009885543Smrg lobj=${xdir}$objdir/$objname 86109885543Smrg 86209885543Smrg if test -z "$base_compile"; then 86309885543Smrg $echo "$modename: you must specify a compilation command" 1>&2 86409885543Smrg $echo "$help" 1>&2 86509885543Smrg exit $EXIT_FAILURE 86609885543Smrg fi 86709885543Smrg 86809885543Smrg # Delete any leftover library objects. 86909885543Smrg if test "$build_old_libs" = yes; then 87009885543Smrg removelist="$obj $lobj $libobj ${libobj}T" 87109885543Smrg else 87209885543Smrg removelist="$lobj $libobj ${libobj}T" 87309885543Smrg fi 87409885543Smrg 87509885543Smrg $run $rm $removelist 87609885543Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 87709885543Smrg 87809885543Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 87909885543Smrg case $host_os in 88009885543Smrg cygwin* | mingw* | pw32* | os2*) 88109885543Smrg pic_mode=default 88209885543Smrg ;; 88309885543Smrg esac 88409885543Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 88509885543Smrg # non-PIC code in shared libraries is not supported 88609885543Smrg pic_mode=default 88709885543Smrg fi 88809885543Smrg 88909885543Smrg # Calculate the filename of the output object if compiler does 89009885543Smrg # not support -o with -c 89109885543Smrg if test "$compiler_c_o" = no; then 89209885543Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 89309885543Smrg lockfile="$output_obj.lock" 89409885543Smrg removelist="$removelist $output_obj $lockfile" 89509885543Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 89609885543Smrg else 89709885543Smrg output_obj= 89809885543Smrg need_locks=no 89909885543Smrg lockfile= 90009885543Smrg fi 90109885543Smrg 90209885543Smrg # Lock this critical section if it is needed 90309885543Smrg # We use this script file to make the link, it avoids creating a new file 90409885543Smrg if test "$need_locks" = yes; then 9057104f784Smrg until $run ln "$srcfile" "$lockfile" 2>/dev/null; do 90609885543Smrg $show "Waiting for $lockfile to be removed" 90709885543Smrg sleep 2 90809885543Smrg done 90909885543Smrg elif test "$need_locks" = warn; then 91009885543Smrg if test -f "$lockfile"; then 91109885543Smrg $echo "\ 91209885543Smrg*** ERROR, $lockfile exists and contains: 91309885543Smrg`cat $lockfile 2>/dev/null` 91409885543Smrg 91509885543SmrgThis indicates that another process is trying to use the same 91609885543Smrgtemporary object file, and libtool could not work around it because 91709885543Smrgyour compiler does not support \`-c' and \`-o' together. If you 91809885543Smrgrepeat this compilation, it may succeed, by chance, but you had better 91909885543Smrgavoid parallel builds (make -j) in this platform, or get a better 92009885543Smrgcompiler." 92109885543Smrg 92209885543Smrg $run $rm $removelist 92309885543Smrg exit $EXIT_FAILURE 92409885543Smrg fi 92509885543Smrg $echo "$srcfile" > "$lockfile" 92609885543Smrg fi 92709885543Smrg 92809885543Smrg if test -n "$fix_srcfile_path"; then 92909885543Smrg eval srcfile=\"$fix_srcfile_path\" 93009885543Smrg fi 93109885543Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 93209885543Smrg case $qsrcfile in 93309885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 93409885543Smrg qsrcfile="\"$qsrcfile\"" ;; 93509885543Smrg esac 93609885543Smrg 93709885543Smrg $run $rm "$libobj" "${libobj}T" 93809885543Smrg 93909885543Smrg # Create a libtool object file (analogous to a ".la" file), 94009885543Smrg # but don't create it if we're doing a dry run. 94109885543Smrg test -z "$run" && cat > ${libobj}T <<EOF 94209885543Smrg# $libobj - a libtool object file 94309885543Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 94409885543Smrg# 94509885543Smrg# Please DO NOT delete this file! 94609885543Smrg# It is necessary for linking the library. 94709885543Smrg 94809885543Smrg# Name of the PIC object. 94909885543SmrgEOF 95009885543Smrg 95109885543Smrg # Only build a PIC object if we are building libtool libraries. 95209885543Smrg if test "$build_libtool_libs" = yes; then 95309885543Smrg # Without this assignment, base_compile gets emptied. 95409885543Smrg fbsd_hideous_sh_bug=$base_compile 95509885543Smrg 95609885543Smrg if test "$pic_mode" != no; then 95709885543Smrg command="$base_compile $qsrcfile $pic_flag" 95809885543Smrg else 95909885543Smrg # Don't build PIC code 96009885543Smrg command="$base_compile $qsrcfile" 96109885543Smrg fi 96209885543Smrg 96309885543Smrg if test ! -d "${xdir}$objdir"; then 96409885543Smrg $show "$mkdir ${xdir}$objdir" 96509885543Smrg $run $mkdir ${xdir}$objdir 96609885543Smrg exit_status=$? 96709885543Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 96809885543Smrg exit $exit_status 96909885543Smrg fi 97009885543Smrg fi 97109885543Smrg 97209885543Smrg if test -z "$output_obj"; then 97309885543Smrg # Place PIC objects in $objdir 97409885543Smrg command="$command -o $lobj" 97509885543Smrg fi 97609885543Smrg 97709885543Smrg $run $rm "$lobj" "$output_obj" 97809885543Smrg 97909885543Smrg $show "$command" 9807104f784Smrg if $run eval $lt_env "$command"; then : 98109885543Smrg else 98209885543Smrg test -n "$output_obj" && $run $rm $removelist 98309885543Smrg exit $EXIT_FAILURE 98409885543Smrg fi 98509885543Smrg 98609885543Smrg if test "$need_locks" = warn && 98709885543Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 98809885543Smrg $echo "\ 98909885543Smrg*** ERROR, $lockfile contains: 99009885543Smrg`cat $lockfile 2>/dev/null` 99109885543Smrg 99209885543Smrgbut it should contain: 99309885543Smrg$srcfile 99409885543Smrg 99509885543SmrgThis indicates that another process is trying to use the same 99609885543Smrgtemporary object file, and libtool could not work around it because 99709885543Smrgyour compiler does not support \`-c' and \`-o' together. If you 99809885543Smrgrepeat this compilation, it may succeed, by chance, but you had better 99909885543Smrgavoid parallel builds (make -j) in this platform, or get a better 100009885543Smrgcompiler." 100109885543Smrg 100209885543Smrg $run $rm $removelist 100309885543Smrg exit $EXIT_FAILURE 100409885543Smrg fi 100509885543Smrg 100609885543Smrg # Just move the object if needed, then go on to compile the next one 100709885543Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 100809885543Smrg $show "$mv $output_obj $lobj" 100909885543Smrg if $run $mv $output_obj $lobj; then : 101009885543Smrg else 101109885543Smrg error=$? 101209885543Smrg $run $rm $removelist 101309885543Smrg exit $error 101409885543Smrg fi 101509885543Smrg fi 101609885543Smrg 101709885543Smrg # Append the name of the PIC object to the libtool object file. 101809885543Smrg test -z "$run" && cat >> ${libobj}T <<EOF 101909885543Smrgpic_object='$objdir/$objname' 102009885543Smrg 102109885543SmrgEOF 102209885543Smrg 102309885543Smrg # Allow error messages only from the first compilation. 102409885543Smrg if test "$suppress_opt" = yes; then 102509885543Smrg suppress_output=' >/dev/null 2>&1' 102609885543Smrg fi 102709885543Smrg else 102809885543Smrg # No PIC object so indicate it doesn't exist in the libtool 102909885543Smrg # object file. 103009885543Smrg test -z "$run" && cat >> ${libobj}T <<EOF 103109885543Smrgpic_object=none 103209885543Smrg 103309885543SmrgEOF 103409885543Smrg fi 103509885543Smrg 103609885543Smrg # Only build a position-dependent object if we build old libraries. 103709885543Smrg if test "$build_old_libs" = yes; then 103809885543Smrg if test "$pic_mode" != yes; then 103909885543Smrg # Don't build PIC code 104009885543Smrg command="$base_compile $qsrcfile" 104109885543Smrg else 104209885543Smrg command="$base_compile $qsrcfile $pic_flag" 104309885543Smrg fi 104409885543Smrg if test "$compiler_c_o" = yes; then 104509885543Smrg command="$command -o $obj" 104609885543Smrg fi 104709885543Smrg 104809885543Smrg # Suppress compiler output if we already did a PIC compilation. 104909885543Smrg command="$command$suppress_output" 105009885543Smrg $run $rm "$obj" "$output_obj" 105109885543Smrg $show "$command" 10527104f784Smrg if $run eval $lt_env "$command"; then : 105309885543Smrg else 105409885543Smrg $run $rm $removelist 105509885543Smrg exit $EXIT_FAILURE 105609885543Smrg fi 105709885543Smrg 105809885543Smrg if test "$need_locks" = warn && 105909885543Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 106009885543Smrg $echo "\ 106109885543Smrg*** ERROR, $lockfile contains: 106209885543Smrg`cat $lockfile 2>/dev/null` 106309885543Smrg 106409885543Smrgbut it should contain: 106509885543Smrg$srcfile 106609885543Smrg 106709885543SmrgThis indicates that another process is trying to use the same 106809885543Smrgtemporary object file, and libtool could not work around it because 106909885543Smrgyour compiler does not support \`-c' and \`-o' together. If you 107009885543Smrgrepeat this compilation, it may succeed, by chance, but you had better 107109885543Smrgavoid parallel builds (make -j) in this platform, or get a better 107209885543Smrgcompiler." 107309885543Smrg 107409885543Smrg $run $rm $removelist 107509885543Smrg exit $EXIT_FAILURE 107609885543Smrg fi 107709885543Smrg 107809885543Smrg # Just move the object if needed 107909885543Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 108009885543Smrg $show "$mv $output_obj $obj" 108109885543Smrg if $run $mv $output_obj $obj; then : 108209885543Smrg else 108309885543Smrg error=$? 108409885543Smrg $run $rm $removelist 108509885543Smrg exit $error 108609885543Smrg fi 108709885543Smrg fi 108809885543Smrg 108909885543Smrg # Append the name of the non-PIC object the libtool object file. 109009885543Smrg # Only append if the libtool object file exists. 109109885543Smrg test -z "$run" && cat >> ${libobj}T <<EOF 109209885543Smrg# Name of the non-PIC object. 109309885543Smrgnon_pic_object='$objname' 109409885543Smrg 109509885543SmrgEOF 109609885543Smrg else 109709885543Smrg # Append the name of the non-PIC object the libtool object file. 109809885543Smrg # Only append if the libtool object file exists. 109909885543Smrg test -z "$run" && cat >> ${libobj}T <<EOF 110009885543Smrg# Name of the non-PIC object. 110109885543Smrgnon_pic_object=none 110209885543Smrg 110309885543SmrgEOF 110409885543Smrg fi 110509885543Smrg 110609885543Smrg $run $mv "${libobj}T" "${libobj}" 110709885543Smrg 110809885543Smrg # Unlock the critical section if it was locked 110909885543Smrg if test "$need_locks" != no; then 111009885543Smrg $run $rm "$lockfile" 111109885543Smrg fi 111209885543Smrg 111309885543Smrg exit $EXIT_SUCCESS 111409885543Smrg ;; 111509885543Smrg 111609885543Smrg # libtool link mode 111709885543Smrg link | relink) 111809885543Smrg modename="$modename: link" 111909885543Smrg case $host in 112009885543Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 112109885543Smrg # It is impossible to link a dll without this setting, and 112209885543Smrg # we shouldn't force the makefile maintainer to figure out 112309885543Smrg # which system we are compiling for in order to pass an extra 112409885543Smrg # flag for every libtool invocation. 112509885543Smrg # allow_undefined=no 112609885543Smrg 112709885543Smrg # FIXME: Unfortunately, there are problems with the above when trying 112809885543Smrg # to make a dll which has undefined symbols, in which case not 112909885543Smrg # even a static library is built. For now, we need to specify 113009885543Smrg # -no-undefined on the libtool link line when we can be certain 113109885543Smrg # that all symbols are satisfied, otherwise we get a static library. 113209885543Smrg allow_undefined=yes 113309885543Smrg ;; 113409885543Smrg *) 113509885543Smrg allow_undefined=yes 113609885543Smrg ;; 113709885543Smrg esac 113809885543Smrg libtool_args="$nonopt" 113909885543Smrg base_compile="$nonopt $@" 114009885543Smrg compile_command="$nonopt" 114109885543Smrg finalize_command="$nonopt" 114209885543Smrg 114309885543Smrg compile_rpath= 114409885543Smrg finalize_rpath= 114509885543Smrg compile_shlibpath= 114609885543Smrg finalize_shlibpath= 114709885543Smrg convenience= 114809885543Smrg old_convenience= 114909885543Smrg deplibs= 115009885543Smrg old_deplibs= 115109885543Smrg compiler_flags= 115209885543Smrg linker_flags= 115309885543Smrg dllsearchpath= 115409885543Smrg lib_search_path=`pwd` 115509885543Smrg inst_prefix_dir= 115609885543Smrg 115709885543Smrg avoid_version=no 115809885543Smrg dlfiles= 115909885543Smrg dlprefiles= 116009885543Smrg dlself=no 116109885543Smrg export_dynamic=no 116209885543Smrg export_symbols= 116309885543Smrg export_symbols_regex= 116409885543Smrg generated= 116509885543Smrg libobjs= 116609885543Smrg ltlibs= 116709885543Smrg module=no 116809885543Smrg no_install=no 116909885543Smrg objs= 117009885543Smrg non_pic_objects= 117109885543Smrg notinst_path= # paths that contain not-installed libtool libraries 117209885543Smrg precious_files_regex= 117309885543Smrg prefer_static_libs=no 117409885543Smrg preload=no 117509885543Smrg prev= 117609885543Smrg prevarg= 117709885543Smrg release= 117809885543Smrg rpath= 117909885543Smrg xrpath= 118009885543Smrg perm_rpath= 118109885543Smrg temp_rpath= 118209885543Smrg thread_safe=no 118309885543Smrg vinfo= 118409885543Smrg vinfo_number=no 11857104f784Smrg single_module="${wl}-single_module" 118609885543Smrg 118709885543Smrg func_infer_tag $base_compile 118809885543Smrg 118909885543Smrg # We need to know -static, to get the right output filenames. 119009885543Smrg for arg 119109885543Smrg do 119209885543Smrg case $arg in 11937104f784Smrg -all-static | -static | -static-libtool-libs) 11947104f784Smrg case $arg in 11957104f784Smrg -all-static) 119609885543Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 119709885543Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 119809885543Smrg fi 119909885543Smrg if test -n "$link_static_flag"; then 120009885543Smrg dlopen_self=$dlopen_self_static 120109885543Smrg fi 120209885543Smrg prefer_static_libs=yes 12037104f784Smrg ;; 12047104f784Smrg -static) 120509885543Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 120609885543Smrg dlopen_self=$dlopen_self_static 120709885543Smrg fi 120809885543Smrg prefer_static_libs=built 12097104f784Smrg ;; 12107104f784Smrg -static-libtool-libs) 12117104f784Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 12127104f784Smrg dlopen_self=$dlopen_self_static 12137104f784Smrg fi 12147104f784Smrg prefer_static_libs=yes 12157104f784Smrg ;; 12167104f784Smrg esac 121709885543Smrg build_libtool_libs=no 121809885543Smrg build_old_libs=yes 121909885543Smrg break 122009885543Smrg ;; 122109885543Smrg esac 122209885543Smrg done 122309885543Smrg 122409885543Smrg # See if our shared archives depend on static archives. 122509885543Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 122609885543Smrg 122709885543Smrg # Go through the arguments, transforming them on the way. 122809885543Smrg while test "$#" -gt 0; do 122909885543Smrg arg="$1" 123009885543Smrg shift 123109885543Smrg case $arg in 123209885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 123309885543Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 123409885543Smrg ;; 123509885543Smrg *) qarg=$arg ;; 123609885543Smrg esac 123709885543Smrg libtool_args="$libtool_args $qarg" 123809885543Smrg 123909885543Smrg # If the previous option needs an argument, assign it. 124009885543Smrg if test -n "$prev"; then 124109885543Smrg case $prev in 124209885543Smrg output) 124309885543Smrg compile_command="$compile_command @OUTPUT@" 124409885543Smrg finalize_command="$finalize_command @OUTPUT@" 124509885543Smrg ;; 124609885543Smrg esac 124709885543Smrg 124809885543Smrg case $prev in 124909885543Smrg dlfiles|dlprefiles) 125009885543Smrg if test "$preload" = no; then 125109885543Smrg # Add the symbol object into the linking commands. 125209885543Smrg compile_command="$compile_command @SYMFILE@" 125309885543Smrg finalize_command="$finalize_command @SYMFILE@" 125409885543Smrg preload=yes 125509885543Smrg fi 125609885543Smrg case $arg in 125709885543Smrg *.la | *.lo) ;; # We handle these cases below. 125809885543Smrg force) 125909885543Smrg if test "$dlself" = no; then 126009885543Smrg dlself=needless 126109885543Smrg export_dynamic=yes 126209885543Smrg fi 126309885543Smrg prev= 126409885543Smrg continue 126509885543Smrg ;; 126609885543Smrg self) 126709885543Smrg if test "$prev" = dlprefiles; then 126809885543Smrg dlself=yes 126909885543Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 127009885543Smrg dlself=yes 127109885543Smrg else 127209885543Smrg dlself=needless 127309885543Smrg export_dynamic=yes 127409885543Smrg fi 127509885543Smrg prev= 127609885543Smrg continue 127709885543Smrg ;; 127809885543Smrg *) 127909885543Smrg if test "$prev" = dlfiles; then 128009885543Smrg dlfiles="$dlfiles $arg" 128109885543Smrg else 128209885543Smrg dlprefiles="$dlprefiles $arg" 128309885543Smrg fi 128409885543Smrg prev= 128509885543Smrg continue 128609885543Smrg ;; 128709885543Smrg esac 128809885543Smrg ;; 128909885543Smrg expsyms) 129009885543Smrg export_symbols="$arg" 129109885543Smrg if test ! -f "$arg"; then 129209885543Smrg $echo "$modename: symbol file \`$arg' does not exist" 129309885543Smrg exit $EXIT_FAILURE 129409885543Smrg fi 129509885543Smrg prev= 129609885543Smrg continue 129709885543Smrg ;; 129809885543Smrg expsyms_regex) 129909885543Smrg export_symbols_regex="$arg" 130009885543Smrg prev= 130109885543Smrg continue 130209885543Smrg ;; 130309885543Smrg inst_prefix) 130409885543Smrg inst_prefix_dir="$arg" 130509885543Smrg prev= 130609885543Smrg continue 130709885543Smrg ;; 130809885543Smrg precious_regex) 130909885543Smrg precious_files_regex="$arg" 131009885543Smrg prev= 131109885543Smrg continue 131209885543Smrg ;; 131309885543Smrg release) 131409885543Smrg release="-$arg" 131509885543Smrg prev= 131609885543Smrg continue 131709885543Smrg ;; 131809885543Smrg objectlist) 131909885543Smrg if test -f "$arg"; then 132009885543Smrg save_arg=$arg 132109885543Smrg moreargs= 132209885543Smrg for fil in `cat $save_arg` 132309885543Smrg do 132409885543Smrg# moreargs="$moreargs $fil" 132509885543Smrg arg=$fil 132609885543Smrg # A libtool-controlled object. 132709885543Smrg 132809885543Smrg # Check to see that this really is a libtool object. 132909885543Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 133009885543Smrg pic_object= 133109885543Smrg non_pic_object= 133209885543Smrg 133309885543Smrg # Read the .lo file 133409885543Smrg # If there is no directory component, then add one. 133509885543Smrg case $arg in 133609885543Smrg */* | *\\*) . $arg ;; 133709885543Smrg *) . ./$arg ;; 133809885543Smrg esac 133909885543Smrg 134009885543Smrg if test -z "$pic_object" || \ 134109885543Smrg test -z "$non_pic_object" || 134209885543Smrg test "$pic_object" = none && \ 134309885543Smrg test "$non_pic_object" = none; then 134409885543Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 134509885543Smrg exit $EXIT_FAILURE 134609885543Smrg fi 134709885543Smrg 134809885543Smrg # Extract subdirectory from the argument. 134909885543Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 135009885543Smrg if test "X$xdir" = "X$arg"; then 135109885543Smrg xdir= 135209885543Smrg else 135309885543Smrg xdir="$xdir/" 135409885543Smrg fi 135509885543Smrg 135609885543Smrg if test "$pic_object" != none; then 135709885543Smrg # Prepend the subdirectory the object is found in. 135809885543Smrg pic_object="$xdir$pic_object" 135909885543Smrg 136009885543Smrg if test "$prev" = dlfiles; then 136109885543Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 136209885543Smrg dlfiles="$dlfiles $pic_object" 136309885543Smrg prev= 136409885543Smrg continue 136509885543Smrg else 136609885543Smrg # If libtool objects are unsupported, then we need to preload. 136709885543Smrg prev=dlprefiles 136809885543Smrg fi 136909885543Smrg fi 137009885543Smrg 137109885543Smrg # CHECK ME: I think I busted this. -Ossama 137209885543Smrg if test "$prev" = dlprefiles; then 137309885543Smrg # Preload the old-style object. 137409885543Smrg dlprefiles="$dlprefiles $pic_object" 137509885543Smrg prev= 137609885543Smrg fi 137709885543Smrg 137809885543Smrg # A PIC object. 137909885543Smrg libobjs="$libobjs $pic_object" 138009885543Smrg arg="$pic_object" 138109885543Smrg fi 138209885543Smrg 138309885543Smrg # Non-PIC object. 138409885543Smrg if test "$non_pic_object" != none; then 138509885543Smrg # Prepend the subdirectory the object is found in. 138609885543Smrg non_pic_object="$xdir$non_pic_object" 138709885543Smrg 138809885543Smrg # A standard non-PIC object 138909885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 139009885543Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 139109885543Smrg arg="$non_pic_object" 139209885543Smrg fi 139309885543Smrg else 139409885543Smrg # If the PIC object exists, use it instead. 139509885543Smrg # $xdir was prepended to $pic_object above. 139609885543Smrg non_pic_object="$pic_object" 139709885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 139809885543Smrg fi 139909885543Smrg else 140009885543Smrg # Only an error if not doing a dry-run. 140109885543Smrg if test -z "$run"; then 140209885543Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 140309885543Smrg exit $EXIT_FAILURE 140409885543Smrg else 140509885543Smrg # Dry-run case. 140609885543Smrg 140709885543Smrg # Extract subdirectory from the argument. 140809885543Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 140909885543Smrg if test "X$xdir" = "X$arg"; then 141009885543Smrg xdir= 141109885543Smrg else 141209885543Smrg xdir="$xdir/" 141309885543Smrg fi 141409885543Smrg 141509885543Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 141609885543Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 141709885543Smrg libobjs="$libobjs $pic_object" 141809885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 141909885543Smrg fi 142009885543Smrg fi 142109885543Smrg done 142209885543Smrg else 142309885543Smrg $echo "$modename: link input file \`$save_arg' does not exist" 142409885543Smrg exit $EXIT_FAILURE 142509885543Smrg fi 142609885543Smrg arg=$save_arg 142709885543Smrg prev= 142809885543Smrg continue 142909885543Smrg ;; 143009885543Smrg rpath | xrpath) 143109885543Smrg # We need an absolute path. 143209885543Smrg case $arg in 143309885543Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 143409885543Smrg *) 143509885543Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 143609885543Smrg exit $EXIT_FAILURE 143709885543Smrg ;; 143809885543Smrg esac 143909885543Smrg if test "$prev" = rpath; then 144009885543Smrg case "$rpath " in 144109885543Smrg *" $arg "*) ;; 144209885543Smrg *) rpath="$rpath $arg" ;; 144309885543Smrg esac 144409885543Smrg else 144509885543Smrg case "$xrpath " in 144609885543Smrg *" $arg "*) ;; 144709885543Smrg *) xrpath="$xrpath $arg" ;; 144809885543Smrg esac 144909885543Smrg fi 145009885543Smrg prev= 145109885543Smrg continue 145209885543Smrg ;; 145309885543Smrg xcompiler) 145409885543Smrg compiler_flags="$compiler_flags $qarg" 145509885543Smrg prev= 145609885543Smrg compile_command="$compile_command $qarg" 145709885543Smrg finalize_command="$finalize_command $qarg" 145809885543Smrg continue 145909885543Smrg ;; 146009885543Smrg xlinker) 146109885543Smrg linker_flags="$linker_flags $qarg" 146209885543Smrg compiler_flags="$compiler_flags $wl$qarg" 146309885543Smrg prev= 146409885543Smrg compile_command="$compile_command $wl$qarg" 146509885543Smrg finalize_command="$finalize_command $wl$qarg" 146609885543Smrg continue 146709885543Smrg ;; 146809885543Smrg xcclinker) 146909885543Smrg linker_flags="$linker_flags $qarg" 147009885543Smrg compiler_flags="$compiler_flags $qarg" 147109885543Smrg prev= 147209885543Smrg compile_command="$compile_command $qarg" 147309885543Smrg finalize_command="$finalize_command $qarg" 147409885543Smrg continue 147509885543Smrg ;; 147609885543Smrg shrext) 147709885543Smrg shrext_cmds="$arg" 147809885543Smrg prev= 147909885543Smrg continue 148009885543Smrg ;; 148109885543Smrg darwin_framework|darwin_framework_skip) 148209885543Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 148309885543Smrg compile_command="$compile_command $arg" 148409885543Smrg finalize_command="$finalize_command $arg" 148509885543Smrg prev= 148609885543Smrg continue 148709885543Smrg ;; 148809885543Smrg *) 148909885543Smrg eval "$prev=\"\$arg\"" 149009885543Smrg prev= 149109885543Smrg continue 149209885543Smrg ;; 149309885543Smrg esac 149409885543Smrg fi # test -n "$prev" 149509885543Smrg 149609885543Smrg prevarg="$arg" 149709885543Smrg 149809885543Smrg case $arg in 149909885543Smrg -all-static) 150009885543Smrg if test -n "$link_static_flag"; then 150109885543Smrg compile_command="$compile_command $link_static_flag" 150209885543Smrg finalize_command="$finalize_command $link_static_flag" 150309885543Smrg fi 150409885543Smrg continue 150509885543Smrg ;; 150609885543Smrg 150709885543Smrg -allow-undefined) 150809885543Smrg # FIXME: remove this flag sometime in the future. 150909885543Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 151009885543Smrg continue 151109885543Smrg ;; 151209885543Smrg 151309885543Smrg -avoid-version) 151409885543Smrg avoid_version=yes 151509885543Smrg continue 151609885543Smrg ;; 151709885543Smrg 151809885543Smrg -dlopen) 151909885543Smrg prev=dlfiles 152009885543Smrg continue 152109885543Smrg ;; 152209885543Smrg 152309885543Smrg -dlpreopen) 152409885543Smrg prev=dlprefiles 152509885543Smrg continue 152609885543Smrg ;; 152709885543Smrg 152809885543Smrg -export-dynamic) 152909885543Smrg export_dynamic=yes 153009885543Smrg continue 153109885543Smrg ;; 153209885543Smrg 153309885543Smrg -export-symbols | -export-symbols-regex) 153409885543Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 153509885543Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 153609885543Smrg exit $EXIT_FAILURE 153709885543Smrg fi 153809885543Smrg if test "X$arg" = "X-export-symbols"; then 153909885543Smrg prev=expsyms 154009885543Smrg else 154109885543Smrg prev=expsyms_regex 154209885543Smrg fi 154309885543Smrg continue 154409885543Smrg ;; 154509885543Smrg 154609885543Smrg -framework|-arch|-isysroot) 154709885543Smrg case " $CC " in 154809885543Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 154909885543Smrg prev=darwin_framework_skip ;; 155009885543Smrg *) compiler_flags="$compiler_flags $arg" 155109885543Smrg prev=darwin_framework ;; 155209885543Smrg esac 155309885543Smrg compile_command="$compile_command $arg" 155409885543Smrg finalize_command="$finalize_command $arg" 155509885543Smrg continue 155609885543Smrg ;; 155709885543Smrg 155809885543Smrg -inst-prefix-dir) 155909885543Smrg prev=inst_prefix 156009885543Smrg continue 156109885543Smrg ;; 156209885543Smrg 156309885543Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 156409885543Smrg # so, if we see these flags be careful not to treat them like -L 156509885543Smrg -L[A-Z][A-Z]*:*) 156609885543Smrg case $with_gcc/$host in 156709885543Smrg no/*-*-irix* | /*-*-irix*) 156809885543Smrg compile_command="$compile_command $arg" 156909885543Smrg finalize_command="$finalize_command $arg" 157009885543Smrg ;; 157109885543Smrg esac 157209885543Smrg continue 157309885543Smrg ;; 157409885543Smrg 157509885543Smrg -L*) 157609885543Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 157709885543Smrg # We need an absolute path. 157809885543Smrg case $dir in 157909885543Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 158009885543Smrg *) 158109885543Smrg absdir=`cd "$dir" && pwd` 158209885543Smrg if test -z "$absdir"; then 158309885543Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 158409885543Smrg absdir="$dir" 158509885543Smrg notinst_path="$notinst_path $dir" 158609885543Smrg fi 158709885543Smrg dir="$absdir" 158809885543Smrg ;; 158909885543Smrg esac 159009885543Smrg case "$deplibs " in 159109885543Smrg *" -L$dir "*) ;; 159209885543Smrg *) 159309885543Smrg deplibs="$deplibs -L$dir" 159409885543Smrg lib_search_path="$lib_search_path $dir" 159509885543Smrg ;; 159609885543Smrg esac 159709885543Smrg case $host in 159809885543Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 159909885543Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 160009885543Smrg case :$dllsearchpath: in 160109885543Smrg *":$dir:"*) ;; 160209885543Smrg *) dllsearchpath="$dllsearchpath:$dir";; 160309885543Smrg esac 160409885543Smrg case :$dllsearchpath: in 160509885543Smrg *":$testbindir:"*) ;; 160609885543Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 160709885543Smrg esac 160809885543Smrg ;; 160909885543Smrg esac 161009885543Smrg continue 161109885543Smrg ;; 161209885543Smrg 161309885543Smrg -l*) 161409885543Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 161509885543Smrg case $host in 161609885543Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 161709885543Smrg # These systems don't actually have a C or math library (as such) 161809885543Smrg continue 161909885543Smrg ;; 162009885543Smrg *-*-os2*) 162109885543Smrg # These systems don't actually have a C library (as such) 162209885543Smrg test "X$arg" = "X-lc" && continue 162309885543Smrg ;; 162409885543Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 162509885543Smrg # Do not include libc due to us having libc/libc_r. 162609885543Smrg test "X$arg" = "X-lc" && continue 162709885543Smrg ;; 162809885543Smrg *-*-rhapsody* | *-*-darwin1.[012]) 162909885543Smrg # Rhapsody C and math libraries are in the System framework 163009885543Smrg deplibs="$deplibs -framework System" 163109885543Smrg continue 163209885543Smrg ;; 163309885543Smrg *-*-sco3.2v5* | *-*-sco5v6*) 163409885543Smrg # Causes problems with __ctype 163509885543Smrg test "X$arg" = "X-lc" && continue 163609885543Smrg ;; 163709885543Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 163809885543Smrg # Compiler inserts libc in the correct place for threads to work 163909885543Smrg test "X$arg" = "X-lc" && continue 164009885543Smrg ;; 164109885543Smrg esac 164209885543Smrg elif test "X$arg" = "X-lc_r"; then 164309885543Smrg case $host in 164409885543Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 164509885543Smrg # Do not include libc_r directly, use -pthread flag. 164609885543Smrg continue 164709885543Smrg ;; 164809885543Smrg esac 164909885543Smrg fi 165009885543Smrg deplibs="$deplibs $arg" 165109885543Smrg continue 165209885543Smrg ;; 165309885543Smrg 165409885543Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 165509885543Smrg # classes, name mangling, and exception handling. 165609885543Smrg -model) 165709885543Smrg compile_command="$compile_command $arg" 165809885543Smrg compiler_flags="$compiler_flags $arg" 165909885543Smrg finalize_command="$finalize_command $arg" 166009885543Smrg prev=xcompiler 166109885543Smrg continue 166209885543Smrg ;; 166309885543Smrg 16647104f784Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 166509885543Smrg compiler_flags="$compiler_flags $arg" 166609885543Smrg compile_command="$compile_command $arg" 166709885543Smrg finalize_command="$finalize_command $arg" 166809885543Smrg continue 166909885543Smrg ;; 167009885543Smrg 16717104f784Smrg -multi_module) 16727104f784Smrg single_module="${wl}-multi_module" 16737104f784Smrg continue 16747104f784Smrg ;; 16757104f784Smrg 167609885543Smrg -module) 167709885543Smrg module=yes 167809885543Smrg continue 167909885543Smrg ;; 168009885543Smrg 168109885543Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 168209885543Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 168309885543Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 168409885543Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 168509885543Smrg # -q* pass through compiler args for the IBM compiler 168609885543Smrg # -m* pass through architecture-specific compiler args for GCC 168709885543Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 168809885543Smrg # compiler args for GCC 16897104f784Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 16907104f784Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 169109885543Smrg # @file GCC response files 16927104f784Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 16937104f784Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 169409885543Smrg 169509885543Smrg # Unknown arguments in both finalize_command and compile_command need 169609885543Smrg # to be aesthetically quoted because they are evaled later. 169709885543Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 169809885543Smrg case $arg in 169909885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 170009885543Smrg arg="\"$arg\"" 170109885543Smrg ;; 170209885543Smrg esac 170309885543Smrg compile_command="$compile_command $arg" 170409885543Smrg finalize_command="$finalize_command $arg" 170509885543Smrg compiler_flags="$compiler_flags $arg" 170609885543Smrg continue 170709885543Smrg ;; 170809885543Smrg 170909885543Smrg -shrext) 171009885543Smrg prev=shrext 171109885543Smrg continue 171209885543Smrg ;; 171309885543Smrg 171409885543Smrg -no-fast-install) 171509885543Smrg fast_install=no 171609885543Smrg continue 171709885543Smrg ;; 171809885543Smrg 171909885543Smrg -no-install) 172009885543Smrg case $host in 17217104f784Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 172209885543Smrg # The PATH hackery in wrapper scripts is required on Windows 17237104f784Smrg # and Darwin in order for the loader to find any dlls it needs. 172409885543Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 172509885543Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 172609885543Smrg fast_install=no 172709885543Smrg ;; 172809885543Smrg *) no_install=yes ;; 172909885543Smrg esac 173009885543Smrg continue 173109885543Smrg ;; 173209885543Smrg 173309885543Smrg -no-undefined) 173409885543Smrg allow_undefined=no 173509885543Smrg continue 173609885543Smrg ;; 173709885543Smrg 173809885543Smrg -objectlist) 173909885543Smrg prev=objectlist 174009885543Smrg continue 174109885543Smrg ;; 174209885543Smrg 174309885543Smrg -o) prev=output ;; 174409885543Smrg 174509885543Smrg -precious-files-regex) 174609885543Smrg prev=precious_regex 174709885543Smrg continue 174809885543Smrg ;; 174909885543Smrg 175009885543Smrg -release) 175109885543Smrg prev=release 175209885543Smrg continue 175309885543Smrg ;; 175409885543Smrg 175509885543Smrg -rpath) 175609885543Smrg prev=rpath 175709885543Smrg continue 175809885543Smrg ;; 175909885543Smrg 176009885543Smrg -R) 176109885543Smrg prev=xrpath 176209885543Smrg continue 176309885543Smrg ;; 176409885543Smrg 176509885543Smrg -R*) 176609885543Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 176709885543Smrg # We need an absolute path. 176809885543Smrg case $dir in 176909885543Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 177009885543Smrg *) 177109885543Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 177209885543Smrg exit $EXIT_FAILURE 177309885543Smrg ;; 177409885543Smrg esac 177509885543Smrg case "$xrpath " in 177609885543Smrg *" $dir "*) ;; 177709885543Smrg *) xrpath="$xrpath $dir" ;; 177809885543Smrg esac 177909885543Smrg continue 178009885543Smrg ;; 178109885543Smrg 17827104f784Smrg -static | -static-libtool-libs) 178309885543Smrg # The effects of -static are defined in a previous loop. 178409885543Smrg # We used to do the same as -all-static on platforms that 178509885543Smrg # didn't have a PIC flag, but the assumption that the effects 178609885543Smrg # would be equivalent was wrong. It would break on at least 178709885543Smrg # Digital Unix and AIX. 178809885543Smrg continue 178909885543Smrg ;; 179009885543Smrg 179109885543Smrg -thread-safe) 179209885543Smrg thread_safe=yes 179309885543Smrg continue 179409885543Smrg ;; 179509885543Smrg 179609885543Smrg -version-info) 179709885543Smrg prev=vinfo 179809885543Smrg continue 179909885543Smrg ;; 180009885543Smrg -version-number) 180109885543Smrg prev=vinfo 180209885543Smrg vinfo_number=yes 180309885543Smrg continue 180409885543Smrg ;; 180509885543Smrg 180609885543Smrg -Wc,*) 180709885543Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 180809885543Smrg arg= 180909885543Smrg save_ifs="$IFS"; IFS=',' 181009885543Smrg for flag in $args; do 181109885543Smrg IFS="$save_ifs" 181209885543Smrg case $flag in 181309885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 181409885543Smrg flag="\"$flag\"" 181509885543Smrg ;; 181609885543Smrg esac 181709885543Smrg arg="$arg $wl$flag" 181809885543Smrg compiler_flags="$compiler_flags $flag" 181909885543Smrg done 182009885543Smrg IFS="$save_ifs" 182109885543Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 182209885543Smrg ;; 182309885543Smrg 182409885543Smrg -Wl,*) 182509885543Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 182609885543Smrg arg= 182709885543Smrg save_ifs="$IFS"; IFS=',' 182809885543Smrg for flag in $args; do 182909885543Smrg IFS="$save_ifs" 183009885543Smrg case $flag in 183109885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 183209885543Smrg flag="\"$flag\"" 183309885543Smrg ;; 183409885543Smrg esac 183509885543Smrg arg="$arg $wl$flag" 183609885543Smrg compiler_flags="$compiler_flags $wl$flag" 183709885543Smrg linker_flags="$linker_flags $flag" 183809885543Smrg done 183909885543Smrg IFS="$save_ifs" 184009885543Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 184109885543Smrg ;; 184209885543Smrg 184309885543Smrg -Xcompiler) 184409885543Smrg prev=xcompiler 184509885543Smrg continue 184609885543Smrg ;; 184709885543Smrg 184809885543Smrg -Xlinker) 184909885543Smrg prev=xlinker 185009885543Smrg continue 185109885543Smrg ;; 185209885543Smrg 185309885543Smrg -XCClinker) 185409885543Smrg prev=xcclinker 185509885543Smrg continue 185609885543Smrg ;; 185709885543Smrg 185809885543Smrg # Some other compiler flag. 185909885543Smrg -* | +*) 186009885543Smrg # Unknown arguments in both finalize_command and compile_command need 186109885543Smrg # to be aesthetically quoted because they are evaled later. 186209885543Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 186309885543Smrg case $arg in 186409885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 186509885543Smrg arg="\"$arg\"" 186609885543Smrg ;; 186709885543Smrg esac 186809885543Smrg ;; 186909885543Smrg 187009885543Smrg *.$objext) 187109885543Smrg # A standard object. 187209885543Smrg objs="$objs $arg" 187309885543Smrg ;; 187409885543Smrg 187509885543Smrg *.lo) 187609885543Smrg # A libtool-controlled object. 187709885543Smrg 187809885543Smrg # Check to see that this really is a libtool object. 187909885543Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 188009885543Smrg pic_object= 188109885543Smrg non_pic_object= 188209885543Smrg 188309885543Smrg # Read the .lo file 188409885543Smrg # If there is no directory component, then add one. 188509885543Smrg case $arg in 188609885543Smrg */* | *\\*) . $arg ;; 188709885543Smrg *) . ./$arg ;; 188809885543Smrg esac 188909885543Smrg 189009885543Smrg if test -z "$pic_object" || \ 189109885543Smrg test -z "$non_pic_object" || 189209885543Smrg test "$pic_object" = none && \ 189309885543Smrg test "$non_pic_object" = none; then 189409885543Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 189509885543Smrg exit $EXIT_FAILURE 189609885543Smrg fi 189709885543Smrg 189809885543Smrg # Extract subdirectory from the argument. 189909885543Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 190009885543Smrg if test "X$xdir" = "X$arg"; then 190109885543Smrg xdir= 190209885543Smrg else 190309885543Smrg xdir="$xdir/" 190409885543Smrg fi 190509885543Smrg 190609885543Smrg if test "$pic_object" != none; then 190709885543Smrg # Prepend the subdirectory the object is found in. 190809885543Smrg pic_object="$xdir$pic_object" 190909885543Smrg 191009885543Smrg if test "$prev" = dlfiles; then 191109885543Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 191209885543Smrg dlfiles="$dlfiles $pic_object" 191309885543Smrg prev= 191409885543Smrg continue 191509885543Smrg else 191609885543Smrg # If libtool objects are unsupported, then we need to preload. 191709885543Smrg prev=dlprefiles 191809885543Smrg fi 191909885543Smrg fi 192009885543Smrg 192109885543Smrg # CHECK ME: I think I busted this. -Ossama 192209885543Smrg if test "$prev" = dlprefiles; then 192309885543Smrg # Preload the old-style object. 192409885543Smrg dlprefiles="$dlprefiles $pic_object" 192509885543Smrg prev= 192609885543Smrg fi 192709885543Smrg 192809885543Smrg # A PIC object. 192909885543Smrg libobjs="$libobjs $pic_object" 193009885543Smrg arg="$pic_object" 193109885543Smrg fi 193209885543Smrg 193309885543Smrg # Non-PIC object. 193409885543Smrg if test "$non_pic_object" != none; then 193509885543Smrg # Prepend the subdirectory the object is found in. 193609885543Smrg non_pic_object="$xdir$non_pic_object" 193709885543Smrg 193809885543Smrg # A standard non-PIC object 193909885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 194009885543Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 194109885543Smrg arg="$non_pic_object" 194209885543Smrg fi 194309885543Smrg else 194409885543Smrg # If the PIC object exists, use it instead. 194509885543Smrg # $xdir was prepended to $pic_object above. 194609885543Smrg non_pic_object="$pic_object" 194709885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 194809885543Smrg fi 194909885543Smrg else 195009885543Smrg # Only an error if not doing a dry-run. 195109885543Smrg if test -z "$run"; then 195209885543Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 195309885543Smrg exit $EXIT_FAILURE 195409885543Smrg else 195509885543Smrg # Dry-run case. 195609885543Smrg 195709885543Smrg # Extract subdirectory from the argument. 195809885543Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 195909885543Smrg if test "X$xdir" = "X$arg"; then 196009885543Smrg xdir= 196109885543Smrg else 196209885543Smrg xdir="$xdir/" 196309885543Smrg fi 196409885543Smrg 196509885543Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 196609885543Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 196709885543Smrg libobjs="$libobjs $pic_object" 196809885543Smrg non_pic_objects="$non_pic_objects $non_pic_object" 196909885543Smrg fi 197009885543Smrg fi 197109885543Smrg ;; 197209885543Smrg 197309885543Smrg *.$libext) 197409885543Smrg # An archive. 197509885543Smrg deplibs="$deplibs $arg" 197609885543Smrg old_deplibs="$old_deplibs $arg" 197709885543Smrg continue 197809885543Smrg ;; 197909885543Smrg 198009885543Smrg *.la) 198109885543Smrg # A libtool-controlled library. 198209885543Smrg 198309885543Smrg if test "$prev" = dlfiles; then 198409885543Smrg # This library was specified with -dlopen. 198509885543Smrg dlfiles="$dlfiles $arg" 198609885543Smrg prev= 198709885543Smrg elif test "$prev" = dlprefiles; then 198809885543Smrg # The library was specified with -dlpreopen. 198909885543Smrg dlprefiles="$dlprefiles $arg" 199009885543Smrg prev= 199109885543Smrg else 199209885543Smrg deplibs="$deplibs $arg" 199309885543Smrg fi 199409885543Smrg continue 199509885543Smrg ;; 199609885543Smrg 199709885543Smrg # Some other compiler argument. 199809885543Smrg *) 199909885543Smrg # Unknown arguments in both finalize_command and compile_command need 200009885543Smrg # to be aesthetically quoted because they are evaled later. 200109885543Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 200209885543Smrg case $arg in 200309885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 200409885543Smrg arg="\"$arg\"" 200509885543Smrg ;; 200609885543Smrg esac 200709885543Smrg ;; 200809885543Smrg esac # arg 200909885543Smrg 201009885543Smrg # Now actually substitute the argument into the commands. 201109885543Smrg if test -n "$arg"; then 201209885543Smrg compile_command="$compile_command $arg" 201309885543Smrg finalize_command="$finalize_command $arg" 201409885543Smrg fi 201509885543Smrg done # argument parsing loop 201609885543Smrg 201709885543Smrg if test -n "$prev"; then 201809885543Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 201909885543Smrg $echo "$help" 1>&2 202009885543Smrg exit $EXIT_FAILURE 202109885543Smrg fi 202209885543Smrg 202309885543Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 202409885543Smrg eval arg=\"$export_dynamic_flag_spec\" 202509885543Smrg compile_command="$compile_command $arg" 202609885543Smrg finalize_command="$finalize_command $arg" 202709885543Smrg fi 202809885543Smrg 202909885543Smrg oldlibs= 203009885543Smrg # calculate the name of the file, without its directory 203109885543Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 203209885543Smrg libobjs_save="$libobjs" 203309885543Smrg 203409885543Smrg if test -n "$shlibpath_var"; then 203509885543Smrg # get the directories listed in $shlibpath_var 203609885543Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 203709885543Smrg else 203809885543Smrg shlib_search_path= 203909885543Smrg fi 204009885543Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 204109885543Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 204209885543Smrg 204309885543Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 204409885543Smrg if test "X$output_objdir" = "X$output"; then 204509885543Smrg output_objdir="$objdir" 204609885543Smrg else 204709885543Smrg output_objdir="$output_objdir/$objdir" 204809885543Smrg fi 204909885543Smrg # Create the object directory. 205009885543Smrg if test ! -d "$output_objdir"; then 205109885543Smrg $show "$mkdir $output_objdir" 205209885543Smrg $run $mkdir $output_objdir 205309885543Smrg exit_status=$? 205409885543Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 205509885543Smrg exit $exit_status 205609885543Smrg fi 205709885543Smrg fi 205809885543Smrg 205909885543Smrg # Determine the type of output 206009885543Smrg case $output in 206109885543Smrg "") 206209885543Smrg $echo "$modename: you must specify an output file" 1>&2 206309885543Smrg $echo "$help" 1>&2 206409885543Smrg exit $EXIT_FAILURE 206509885543Smrg ;; 206609885543Smrg *.$libext) linkmode=oldlib ;; 206709885543Smrg *.lo | *.$objext) linkmode=obj ;; 206809885543Smrg *.la) linkmode=lib ;; 206909885543Smrg *) linkmode=prog ;; # Anything else should be a program. 207009885543Smrg esac 207109885543Smrg 207209885543Smrg case $host in 207309885543Smrg *cygwin* | *mingw* | *pw32*) 207409885543Smrg # don't eliminate duplications in $postdeps and $predeps 207509885543Smrg duplicate_compiler_generated_deps=yes 207609885543Smrg ;; 207709885543Smrg *) 207809885543Smrg duplicate_compiler_generated_deps=$duplicate_deps 207909885543Smrg ;; 208009885543Smrg esac 208109885543Smrg specialdeplibs= 208209885543Smrg 208309885543Smrg libs= 208409885543Smrg # Find all interdependent deplibs by searching for libraries 208509885543Smrg # that are linked more than once (e.g. -la -lb -la) 208609885543Smrg for deplib in $deplibs; do 208709885543Smrg if test "X$duplicate_deps" = "Xyes" ; then 208809885543Smrg case "$libs " in 208909885543Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 209009885543Smrg esac 209109885543Smrg fi 209209885543Smrg libs="$libs $deplib" 209309885543Smrg done 209409885543Smrg 209509885543Smrg if test "$linkmode" = lib; then 209609885543Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 209709885543Smrg 209809885543Smrg # Compute libraries that are listed more than once in $predeps 209909885543Smrg # $postdeps and mark them as special (i.e., whose duplicates are 210009885543Smrg # not to be eliminated). 210109885543Smrg pre_post_deps= 210209885543Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 210309885543Smrg for pre_post_dep in $predeps $postdeps; do 210409885543Smrg case "$pre_post_deps " in 210509885543Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 210609885543Smrg esac 210709885543Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 210809885543Smrg done 210909885543Smrg fi 211009885543Smrg pre_post_deps= 211109885543Smrg fi 211209885543Smrg 211309885543Smrg deplibs= 211409885543Smrg newdependency_libs= 211509885543Smrg newlib_search_path= 211609885543Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 211709885543Smrg notinst_deplibs= # not-installed libtool libraries 211809885543Smrg case $linkmode in 211909885543Smrg lib) 212009885543Smrg passes="conv link" 212109885543Smrg for file in $dlfiles $dlprefiles; do 212209885543Smrg case $file in 212309885543Smrg *.la) ;; 212409885543Smrg *) 212509885543Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 212609885543Smrg exit $EXIT_FAILURE 212709885543Smrg ;; 212809885543Smrg esac 212909885543Smrg done 213009885543Smrg ;; 213109885543Smrg prog) 213209885543Smrg compile_deplibs= 213309885543Smrg finalize_deplibs= 213409885543Smrg alldeplibs=no 213509885543Smrg newdlfiles= 213609885543Smrg newdlprefiles= 213709885543Smrg passes="conv scan dlopen dlpreopen link" 213809885543Smrg ;; 213909885543Smrg *) passes="conv" 214009885543Smrg ;; 214109885543Smrg esac 214209885543Smrg for pass in $passes; do 214309885543Smrg if test "$linkmode,$pass" = "lib,link" || 214409885543Smrg test "$linkmode,$pass" = "prog,scan"; then 214509885543Smrg libs="$deplibs" 214609885543Smrg deplibs= 214709885543Smrg fi 214809885543Smrg if test "$linkmode" = prog; then 214909885543Smrg case $pass in 215009885543Smrg dlopen) libs="$dlfiles" ;; 215109885543Smrg dlpreopen) libs="$dlprefiles" ;; 21527104f784Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 215309885543Smrg esac 215409885543Smrg fi 215509885543Smrg if test "$pass" = dlopen; then 215609885543Smrg # Collect dlpreopened libraries 215709885543Smrg save_deplibs="$deplibs" 215809885543Smrg deplibs= 215909885543Smrg fi 216009885543Smrg for deplib in $libs; do 216109885543Smrg lib= 216209885543Smrg found=no 216309885543Smrg case $deplib in 21647104f784Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 216509885543Smrg if test "$linkmode,$pass" = "prog,link"; then 216609885543Smrg compile_deplibs="$deplib $compile_deplibs" 216709885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 216809885543Smrg else 216909885543Smrg compiler_flags="$compiler_flags $deplib" 217009885543Smrg fi 217109885543Smrg continue 217209885543Smrg ;; 217309885543Smrg -l*) 217409885543Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 217509885543Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 217609885543Smrg continue 217709885543Smrg fi 217809885543Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21797104f784Smrg if test "$linkmode" = lib; then 21807104f784Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 21817104f784Smrg else 21827104f784Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 21837104f784Smrg fi 21847104f784Smrg for searchdir in $searchdirs; do 218509885543Smrg for search_ext in .la $std_shrext .so .a; do 218609885543Smrg # Search the libtool library 218709885543Smrg lib="$searchdir/lib${name}${search_ext}" 218809885543Smrg if test -f "$lib"; then 218909885543Smrg if test "$search_ext" = ".la"; then 219009885543Smrg found=yes 219109885543Smrg else 219209885543Smrg found=no 219309885543Smrg fi 219409885543Smrg break 2 219509885543Smrg fi 219609885543Smrg done 219709885543Smrg done 219809885543Smrg if test "$found" != yes; then 219909885543Smrg # deplib doesn't seem to be a libtool library 220009885543Smrg if test "$linkmode,$pass" = "prog,link"; then 220109885543Smrg compile_deplibs="$deplib $compile_deplibs" 220209885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 220309885543Smrg else 220409885543Smrg deplibs="$deplib $deplibs" 220509885543Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 220609885543Smrg fi 220709885543Smrg continue 220809885543Smrg else # deplib is a libtool library 220909885543Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 221009885543Smrg # We need to do some special things here, and not later. 221109885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 221209885543Smrg case " $predeps $postdeps " in 221309885543Smrg *" $deplib "*) 221409885543Smrg if (${SED} -e '2q' $lib | 221509885543Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 221609885543Smrg library_names= 221709885543Smrg old_library= 221809885543Smrg case $lib in 221909885543Smrg */* | *\\*) . $lib ;; 222009885543Smrg *) . ./$lib ;; 222109885543Smrg esac 222209885543Smrg for l in $old_library $library_names; do 222309885543Smrg ll="$l" 222409885543Smrg done 222509885543Smrg if test "X$ll" = "X$old_library" ; then # only static version available 222609885543Smrg found=no 222709885543Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 222809885543Smrg test "X$ladir" = "X$lib" && ladir="." 222909885543Smrg lib=$ladir/$old_library 223009885543Smrg if test "$linkmode,$pass" = "prog,link"; then 223109885543Smrg compile_deplibs="$deplib $compile_deplibs" 223209885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 223309885543Smrg else 223409885543Smrg deplibs="$deplib $deplibs" 223509885543Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 223609885543Smrg fi 223709885543Smrg continue 223809885543Smrg fi 223909885543Smrg fi 224009885543Smrg ;; 224109885543Smrg *) ;; 224209885543Smrg esac 224309885543Smrg fi 224409885543Smrg fi 224509885543Smrg ;; # -l 224609885543Smrg -L*) 224709885543Smrg case $linkmode in 224809885543Smrg lib) 224909885543Smrg deplibs="$deplib $deplibs" 225009885543Smrg test "$pass" = conv && continue 225109885543Smrg newdependency_libs="$deplib $newdependency_libs" 225209885543Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 225309885543Smrg ;; 225409885543Smrg prog) 225509885543Smrg if test "$pass" = conv; then 225609885543Smrg deplibs="$deplib $deplibs" 225709885543Smrg continue 225809885543Smrg fi 225909885543Smrg if test "$pass" = scan; then 226009885543Smrg deplibs="$deplib $deplibs" 226109885543Smrg else 226209885543Smrg compile_deplibs="$deplib $compile_deplibs" 226309885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 226409885543Smrg fi 226509885543Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 226609885543Smrg ;; 226709885543Smrg *) 226809885543Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 226909885543Smrg ;; 227009885543Smrg esac # linkmode 227109885543Smrg continue 227209885543Smrg ;; # -L 227309885543Smrg -R*) 227409885543Smrg if test "$pass" = link; then 227509885543Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 227609885543Smrg # Make sure the xrpath contains only unique directories. 227709885543Smrg case "$xrpath " in 227809885543Smrg *" $dir "*) ;; 227909885543Smrg *) xrpath="$xrpath $dir" ;; 228009885543Smrg esac 228109885543Smrg fi 228209885543Smrg deplibs="$deplib $deplibs" 228309885543Smrg continue 228409885543Smrg ;; 228509885543Smrg *.la) lib="$deplib" ;; 228609885543Smrg *.$libext) 228709885543Smrg if test "$pass" = conv; then 228809885543Smrg deplibs="$deplib $deplibs" 228909885543Smrg continue 229009885543Smrg fi 229109885543Smrg case $linkmode in 229209885543Smrg lib) 229309885543Smrg valid_a_lib=no 229409885543Smrg case $deplibs_check_method in 229509885543Smrg match_pattern*) 229609885543Smrg set dummy $deplibs_check_method 229709885543Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 229809885543Smrg if eval $echo \"$deplib\" 2>/dev/null \ 229909885543Smrg | $SED 10q \ 230009885543Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 230109885543Smrg valid_a_lib=yes 230209885543Smrg fi 230309885543Smrg ;; 230409885543Smrg pass_all) 230509885543Smrg valid_a_lib=yes 230609885543Smrg ;; 230709885543Smrg esac 230809885543Smrg if test "$valid_a_lib" != yes; then 230909885543Smrg $echo 231009885543Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 231109885543Smrg $echo "*** I have the capability to make that library automatically link in when" 231209885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 231309885543Smrg $echo "*** shared version of the library, which you do not appear to have" 231409885543Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 231509885543Smrg $echo "*** that it is just a static archive that I should not used here." 231609885543Smrg else 231709885543Smrg $echo 231809885543Smrg $echo "*** Warning: Linking the shared library $output against the" 231909885543Smrg $echo "*** static library $deplib is not portable!" 232009885543Smrg deplibs="$deplib $deplibs" 232109885543Smrg fi 232209885543Smrg continue 232309885543Smrg ;; 232409885543Smrg prog) 232509885543Smrg if test "$pass" != link; then 232609885543Smrg deplibs="$deplib $deplibs" 232709885543Smrg else 232809885543Smrg compile_deplibs="$deplib $compile_deplibs" 232909885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 233009885543Smrg fi 233109885543Smrg continue 233209885543Smrg ;; 233309885543Smrg esac # linkmode 233409885543Smrg ;; # *.$libext 233509885543Smrg *.lo | *.$objext) 233609885543Smrg if test "$pass" = conv; then 233709885543Smrg deplibs="$deplib $deplibs" 233809885543Smrg elif test "$linkmode" = prog; then 233909885543Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 234009885543Smrg # If there is no dlopen support or we're linking statically, 234109885543Smrg # we need to preload. 234209885543Smrg newdlprefiles="$newdlprefiles $deplib" 234309885543Smrg compile_deplibs="$deplib $compile_deplibs" 234409885543Smrg finalize_deplibs="$deplib $finalize_deplibs" 234509885543Smrg else 234609885543Smrg newdlfiles="$newdlfiles $deplib" 234709885543Smrg fi 234809885543Smrg fi 234909885543Smrg continue 235009885543Smrg ;; 235109885543Smrg %DEPLIBS%) 235209885543Smrg alldeplibs=yes 235309885543Smrg continue 235409885543Smrg ;; 235509885543Smrg esac # case $deplib 235609885543Smrg if test "$found" = yes || test -f "$lib"; then : 235709885543Smrg else 235809885543Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 235909885543Smrg exit $EXIT_FAILURE 236009885543Smrg fi 236109885543Smrg 236209885543Smrg # Check to see that this really is a libtool archive. 236309885543Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 236409885543Smrg else 236509885543Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 236609885543Smrg exit $EXIT_FAILURE 236709885543Smrg fi 236809885543Smrg 236909885543Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 237009885543Smrg test "X$ladir" = "X$lib" && ladir="." 237109885543Smrg 237209885543Smrg dlname= 237309885543Smrg dlopen= 237409885543Smrg dlpreopen= 237509885543Smrg libdir= 237609885543Smrg library_names= 237709885543Smrg old_library= 237809885543Smrg # If the library was installed with an old release of libtool, 237909885543Smrg # it will not redefine variables installed, or shouldnotlink 238009885543Smrg installed=yes 238109885543Smrg shouldnotlink=no 238209885543Smrg avoidtemprpath= 238309885543Smrg 238409885543Smrg 238509885543Smrg # Read the .la file 238609885543Smrg case $lib in 238709885543Smrg */* | *\\*) . $lib ;; 238809885543Smrg *) . ./$lib ;; 238909885543Smrg esac 239009885543Smrg 239109885543Smrg if test "$linkmode,$pass" = "lib,link" || 239209885543Smrg test "$linkmode,$pass" = "prog,scan" || 239309885543Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 239409885543Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 239509885543Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 239609885543Smrg fi 239709885543Smrg 239809885543Smrg if test "$pass" = conv; then 239909885543Smrg # Only check for convenience libraries 240009885543Smrg deplibs="$lib $deplibs" 240109885543Smrg if test -z "$libdir"; then 240209885543Smrg if test -z "$old_library"; then 240309885543Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 240409885543Smrg exit $EXIT_FAILURE 240509885543Smrg fi 240609885543Smrg # It is a libtool convenience library, so add in its objects. 240709885543Smrg convenience="$convenience $ladir/$objdir/$old_library" 240809885543Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 240909885543Smrg tmp_libs= 241009885543Smrg for deplib in $dependency_libs; do 241109885543Smrg deplibs="$deplib $deplibs" 241209885543Smrg if test "X$duplicate_deps" = "Xyes" ; then 241309885543Smrg case "$tmp_libs " in 241409885543Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 241509885543Smrg esac 241609885543Smrg fi 241709885543Smrg tmp_libs="$tmp_libs $deplib" 241809885543Smrg done 241909885543Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 242009885543Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 242109885543Smrg exit $EXIT_FAILURE 242209885543Smrg fi 242309885543Smrg continue 242409885543Smrg fi # $pass = conv 242509885543Smrg 242609885543Smrg 242709885543Smrg # Get the name of the library we link against. 242809885543Smrg linklib= 242909885543Smrg for l in $old_library $library_names; do 243009885543Smrg linklib="$l" 243109885543Smrg done 243209885543Smrg if test -z "$linklib"; then 243309885543Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 243409885543Smrg exit $EXIT_FAILURE 243509885543Smrg fi 243609885543Smrg 243709885543Smrg # This library was specified with -dlopen. 243809885543Smrg if test "$pass" = dlopen; then 243909885543Smrg if test -z "$libdir"; then 244009885543Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 244109885543Smrg exit $EXIT_FAILURE 244209885543Smrg fi 244309885543Smrg if test -z "$dlname" || 244409885543Smrg test "$dlopen_support" != yes || 244509885543Smrg test "$build_libtool_libs" = no; then 244609885543Smrg # If there is no dlname, no dlopen support or we're linking 244709885543Smrg # statically, we need to preload. We also need to preload any 244809885543Smrg # dependent libraries so libltdl's deplib preloader doesn't 244909885543Smrg # bomb out in the load deplibs phase. 245009885543Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 245109885543Smrg else 245209885543Smrg newdlfiles="$newdlfiles $lib" 245309885543Smrg fi 245409885543Smrg continue 245509885543Smrg fi # $pass = dlopen 245609885543Smrg 245709885543Smrg # We need an absolute path. 245809885543Smrg case $ladir in 245909885543Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 246009885543Smrg *) 246109885543Smrg abs_ladir=`cd "$ladir" && pwd` 246209885543Smrg if test -z "$abs_ladir"; then 246309885543Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 246409885543Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 246509885543Smrg abs_ladir="$ladir" 246609885543Smrg fi 246709885543Smrg ;; 246809885543Smrg esac 246909885543Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 247009885543Smrg 247109885543Smrg # Find the relevant object directory and library name. 247209885543Smrg if test "X$installed" = Xyes; then 247309885543Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 247409885543Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 247509885543Smrg dir="$ladir" 247609885543Smrg absdir="$abs_ladir" 247709885543Smrg libdir="$abs_ladir" 247809885543Smrg else 247909885543Smrg dir="$libdir" 248009885543Smrg absdir="$libdir" 248109885543Smrg fi 248209885543Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 248309885543Smrg else 248409885543Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 248509885543Smrg dir="$ladir" 248609885543Smrg absdir="$abs_ladir" 248709885543Smrg # Remove this search path later 248809885543Smrg notinst_path="$notinst_path $abs_ladir" 248909885543Smrg else 249009885543Smrg dir="$ladir/$objdir" 249109885543Smrg absdir="$abs_ladir/$objdir" 249209885543Smrg # Remove this search path later 249309885543Smrg notinst_path="$notinst_path $abs_ladir" 249409885543Smrg fi 249509885543Smrg fi # $installed = yes 249609885543Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 249709885543Smrg 249809885543Smrg # This library was specified with -dlpreopen. 249909885543Smrg if test "$pass" = dlpreopen; then 250009885543Smrg if test -z "$libdir"; then 250109885543Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 250209885543Smrg exit $EXIT_FAILURE 250309885543Smrg fi 250409885543Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 250509885543Smrg # are required to link). 250609885543Smrg if test -n "$old_library"; then 250709885543Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 250809885543Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 250909885543Smrg elif test -n "$dlname"; then 251009885543Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 251109885543Smrg else 251209885543Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 251309885543Smrg fi 251409885543Smrg fi # $pass = dlpreopen 251509885543Smrg 251609885543Smrg if test -z "$libdir"; then 251709885543Smrg # Link the convenience library 251809885543Smrg if test "$linkmode" = lib; then 251909885543Smrg deplibs="$dir/$old_library $deplibs" 252009885543Smrg elif test "$linkmode,$pass" = "prog,link"; then 252109885543Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 252209885543Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 252309885543Smrg else 252409885543Smrg deplibs="$lib $deplibs" # used for prog,scan pass 252509885543Smrg fi 252609885543Smrg continue 252709885543Smrg fi 252809885543Smrg 252909885543Smrg 253009885543Smrg if test "$linkmode" = prog && test "$pass" != link; then 253109885543Smrg newlib_search_path="$newlib_search_path $ladir" 253209885543Smrg deplibs="$lib $deplibs" 253309885543Smrg 253409885543Smrg linkalldeplibs=no 253509885543Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 253609885543Smrg test "$build_libtool_libs" = no; then 253709885543Smrg linkalldeplibs=yes 253809885543Smrg fi 253909885543Smrg 254009885543Smrg tmp_libs= 254109885543Smrg for deplib in $dependency_libs; do 254209885543Smrg case $deplib in 254309885543Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 254409885543Smrg esac 254509885543Smrg # Need to link against all dependency_libs? 254609885543Smrg if test "$linkalldeplibs" = yes; then 254709885543Smrg deplibs="$deplib $deplibs" 254809885543Smrg else 254909885543Smrg # Need to hardcode shared library paths 255009885543Smrg # or/and link against static libraries 255109885543Smrg newdependency_libs="$deplib $newdependency_libs" 255209885543Smrg fi 255309885543Smrg if test "X$duplicate_deps" = "Xyes" ; then 255409885543Smrg case "$tmp_libs " in 255509885543Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 255609885543Smrg esac 255709885543Smrg fi 255809885543Smrg tmp_libs="$tmp_libs $deplib" 255909885543Smrg done # for deplib 256009885543Smrg continue 256109885543Smrg fi # $linkmode = prog... 256209885543Smrg 256309885543Smrg if test "$linkmode,$pass" = "prog,link"; then 256409885543Smrg if test -n "$library_names" && 25657104f784Smrg { { test "$prefer_static_libs" = no || 25667104f784Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 25677104f784Smrg test -z "$old_library"; }; then 256809885543Smrg # We need to hardcode the library path 256909885543Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 257009885543Smrg # Make sure the rpath contains only unique directories. 257109885543Smrg case "$temp_rpath " in 257209885543Smrg *" $dir "*) ;; 257309885543Smrg *" $absdir "*) ;; 257409885543Smrg *) temp_rpath="$temp_rpath $absdir" ;; 257509885543Smrg esac 257609885543Smrg fi 257709885543Smrg 257809885543Smrg # Hardcode the library path. 257909885543Smrg # Skip directories that are in the system default run-time 258009885543Smrg # search path. 258109885543Smrg case " $sys_lib_dlsearch_path " in 258209885543Smrg *" $absdir "*) ;; 258309885543Smrg *) 258409885543Smrg case "$compile_rpath " in 258509885543Smrg *" $absdir "*) ;; 258609885543Smrg *) compile_rpath="$compile_rpath $absdir" 258709885543Smrg esac 258809885543Smrg ;; 258909885543Smrg esac 259009885543Smrg case " $sys_lib_dlsearch_path " in 259109885543Smrg *" $libdir "*) ;; 259209885543Smrg *) 259309885543Smrg case "$finalize_rpath " in 259409885543Smrg *" $libdir "*) ;; 259509885543Smrg *) finalize_rpath="$finalize_rpath $libdir" 259609885543Smrg esac 259709885543Smrg ;; 259809885543Smrg esac 259909885543Smrg fi # $linkmode,$pass = prog,link... 260009885543Smrg 260109885543Smrg if test "$alldeplibs" = yes && 260209885543Smrg { test "$deplibs_check_method" = pass_all || 260309885543Smrg { test "$build_libtool_libs" = yes && 260409885543Smrg test -n "$library_names"; }; }; then 260509885543Smrg # We only need to search for static libraries 260609885543Smrg continue 260709885543Smrg fi 260809885543Smrg fi 260909885543Smrg 261009885543Smrg link_static=no # Whether the deplib will be linked statically 261109885543Smrg use_static_libs=$prefer_static_libs 261209885543Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 261309885543Smrg use_static_libs=no 261409885543Smrg fi 261509885543Smrg if test -n "$library_names" && 261609885543Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 261709885543Smrg if test "$installed" = no; then 261809885543Smrg notinst_deplibs="$notinst_deplibs $lib" 261909885543Smrg need_relink=yes 262009885543Smrg fi 262109885543Smrg # This is a shared library 262209885543Smrg 262309885543Smrg # Warn about portability, can't link against -module's on 262409885543Smrg # some systems (darwin) 262509885543Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 262609885543Smrg $echo 262709885543Smrg if test "$linkmode" = prog; then 262809885543Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 262909885543Smrg else 263009885543Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 263109885543Smrg fi 263209885543Smrg $echo "*** $linklib is not portable!" 263309885543Smrg fi 263409885543Smrg if test "$linkmode" = lib && 263509885543Smrg test "$hardcode_into_libs" = yes; then 263609885543Smrg # Hardcode the library path. 263709885543Smrg # Skip directories that are in the system default run-time 263809885543Smrg # search path. 263909885543Smrg case " $sys_lib_dlsearch_path " in 264009885543Smrg *" $absdir "*) ;; 264109885543Smrg *) 264209885543Smrg case "$compile_rpath " in 264309885543Smrg *" $absdir "*) ;; 264409885543Smrg *) compile_rpath="$compile_rpath $absdir" 264509885543Smrg esac 264609885543Smrg ;; 264709885543Smrg esac 264809885543Smrg case " $sys_lib_dlsearch_path " in 264909885543Smrg *" $libdir "*) ;; 265009885543Smrg *) 265109885543Smrg case "$finalize_rpath " in 265209885543Smrg *" $libdir "*) ;; 265309885543Smrg *) finalize_rpath="$finalize_rpath $libdir" 265409885543Smrg esac 265509885543Smrg ;; 265609885543Smrg esac 265709885543Smrg fi 265809885543Smrg 265909885543Smrg if test -n "$old_archive_from_expsyms_cmds"; then 266009885543Smrg # figure out the soname 266109885543Smrg set dummy $library_names 266209885543Smrg realname="$2" 266309885543Smrg shift; shift 266409885543Smrg libname=`eval \\$echo \"$libname_spec\"` 266509885543Smrg # use dlname if we got it. it's perfectly good, no? 266609885543Smrg if test -n "$dlname"; then 266709885543Smrg soname="$dlname" 266809885543Smrg elif test -n "$soname_spec"; then 266909885543Smrg # bleh windows 267009885543Smrg case $host in 267109885543Smrg *cygwin* | mingw*) 267209885543Smrg major=`expr $current - $age` 267309885543Smrg versuffix="-$major" 267409885543Smrg ;; 267509885543Smrg esac 267609885543Smrg eval soname=\"$soname_spec\" 267709885543Smrg else 267809885543Smrg soname="$realname" 267909885543Smrg fi 268009885543Smrg 268109885543Smrg # Make a new name for the extract_expsyms_cmds to use 268209885543Smrg soroot="$soname" 268309885543Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 268409885543Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 268509885543Smrg 268609885543Smrg # If the library has no export list, then create one now 268709885543Smrg if test -f "$output_objdir/$soname-def"; then : 268809885543Smrg else 268909885543Smrg $show "extracting exported symbol list from \`$soname'" 269009885543Smrg save_ifs="$IFS"; IFS='~' 269109885543Smrg cmds=$extract_expsyms_cmds 269209885543Smrg for cmd in $cmds; do 269309885543Smrg IFS="$save_ifs" 269409885543Smrg eval cmd=\"$cmd\" 269509885543Smrg $show "$cmd" 269609885543Smrg $run eval "$cmd" || exit $? 269709885543Smrg done 269809885543Smrg IFS="$save_ifs" 269909885543Smrg fi 270009885543Smrg 270109885543Smrg # Create $newlib 270209885543Smrg if test -f "$output_objdir/$newlib"; then :; else 270309885543Smrg $show "generating import library for \`$soname'" 270409885543Smrg save_ifs="$IFS"; IFS='~' 270509885543Smrg cmds=$old_archive_from_expsyms_cmds 270609885543Smrg for cmd in $cmds; do 270709885543Smrg IFS="$save_ifs" 270809885543Smrg eval cmd=\"$cmd\" 270909885543Smrg $show "$cmd" 271009885543Smrg $run eval "$cmd" || exit $? 271109885543Smrg done 271209885543Smrg IFS="$save_ifs" 271309885543Smrg fi 271409885543Smrg # make sure the library variables are pointing to the new library 271509885543Smrg dir=$output_objdir 271609885543Smrg linklib=$newlib 271709885543Smrg fi # test -n "$old_archive_from_expsyms_cmds" 271809885543Smrg 271909885543Smrg if test "$linkmode" = prog || test "$mode" != relink; then 272009885543Smrg add_shlibpath= 272109885543Smrg add_dir= 272209885543Smrg add= 272309885543Smrg lib_linked=yes 272409885543Smrg case $hardcode_action in 272509885543Smrg immediate | unsupported) 272609885543Smrg if test "$hardcode_direct" = no; then 272709885543Smrg add="$dir/$linklib" 272809885543Smrg case $host in 272909885543Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 273009885543Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 273109885543Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 273209885543Smrg *-*-unixware7*) add_dir="-L$dir" ;; 273309885543Smrg *-*-darwin* ) 273409885543Smrg # if the lib is a module then we can not link against 273509885543Smrg # it, someone is ignoring the new warnings I added 273609885543Smrg if /usr/bin/file -L $add 2> /dev/null | 273709885543Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 273809885543Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 273909885543Smrg if test -z "$old_library" ; then 274009885543Smrg $echo 274109885543Smrg $echo "** And there doesn't seem to be a static archive available" 274209885543Smrg $echo "** The link will probably fail, sorry" 274309885543Smrg else 274409885543Smrg add="$dir/$old_library" 274509885543Smrg fi 274609885543Smrg fi 274709885543Smrg esac 274809885543Smrg elif test "$hardcode_minus_L" = no; then 274909885543Smrg case $host in 275009885543Smrg *-*-sunos*) add_shlibpath="$dir" ;; 275109885543Smrg esac 275209885543Smrg add_dir="-L$dir" 275309885543Smrg add="-l$name" 275409885543Smrg elif test "$hardcode_shlibpath_var" = no; then 275509885543Smrg add_shlibpath="$dir" 275609885543Smrg add="-l$name" 275709885543Smrg else 275809885543Smrg lib_linked=no 275909885543Smrg fi 276009885543Smrg ;; 276109885543Smrg relink) 276209885543Smrg if test "$hardcode_direct" = yes; then 276309885543Smrg add="$dir/$linklib" 276409885543Smrg elif test "$hardcode_minus_L" = yes; then 276509885543Smrg add_dir="-L$dir" 276609885543Smrg # Try looking first in the location we're being installed to. 276709885543Smrg if test -n "$inst_prefix_dir"; then 276809885543Smrg case $libdir in 276909885543Smrg [\\/]*) 277009885543Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 277109885543Smrg ;; 277209885543Smrg esac 277309885543Smrg fi 277409885543Smrg add="-l$name" 277509885543Smrg elif test "$hardcode_shlibpath_var" = yes; then 277609885543Smrg add_shlibpath="$dir" 277709885543Smrg add="-l$name" 277809885543Smrg else 277909885543Smrg lib_linked=no 278009885543Smrg fi 278109885543Smrg ;; 278209885543Smrg *) lib_linked=no ;; 278309885543Smrg esac 278409885543Smrg 278509885543Smrg if test "$lib_linked" != yes; then 278609885543Smrg $echo "$modename: configuration error: unsupported hardcode properties" 278709885543Smrg exit $EXIT_FAILURE 278809885543Smrg fi 278909885543Smrg 279009885543Smrg if test -n "$add_shlibpath"; then 279109885543Smrg case :$compile_shlibpath: in 279209885543Smrg *":$add_shlibpath:"*) ;; 279309885543Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 279409885543Smrg esac 279509885543Smrg fi 279609885543Smrg if test "$linkmode" = prog; then 279709885543Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 279809885543Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 279909885543Smrg else 280009885543Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 280109885543Smrg test -n "$add" && deplibs="$add $deplibs" 280209885543Smrg if test "$hardcode_direct" != yes && \ 280309885543Smrg test "$hardcode_minus_L" != yes && \ 280409885543Smrg test "$hardcode_shlibpath_var" = yes; then 280509885543Smrg case :$finalize_shlibpath: in 280609885543Smrg *":$libdir:"*) ;; 280709885543Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 280809885543Smrg esac 280909885543Smrg fi 281009885543Smrg fi 281109885543Smrg fi 281209885543Smrg 281309885543Smrg if test "$linkmode" = prog || test "$mode" = relink; then 281409885543Smrg add_shlibpath= 281509885543Smrg add_dir= 281609885543Smrg add= 281709885543Smrg # Finalize command for both is simple: just hardcode it. 281809885543Smrg if test "$hardcode_direct" = yes; then 281909885543Smrg add="$libdir/$linklib" 282009885543Smrg elif test "$hardcode_minus_L" = yes; then 282109885543Smrg add_dir="-L$libdir" 282209885543Smrg add="-l$name" 282309885543Smrg elif test "$hardcode_shlibpath_var" = yes; then 282409885543Smrg case :$finalize_shlibpath: in 282509885543Smrg *":$libdir:"*) ;; 282609885543Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 282709885543Smrg esac 282809885543Smrg add="-l$name" 282909885543Smrg elif test "$hardcode_automatic" = yes; then 283009885543Smrg if test -n "$inst_prefix_dir" && 283109885543Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 283209885543Smrg add="$inst_prefix_dir$libdir/$linklib" 283309885543Smrg else 283409885543Smrg add="$libdir/$linklib" 283509885543Smrg fi 283609885543Smrg else 283709885543Smrg # We cannot seem to hardcode it, guess we'll fake it. 283809885543Smrg add_dir="-L$libdir" 283909885543Smrg # Try looking first in the location we're being installed to. 284009885543Smrg if test -n "$inst_prefix_dir"; then 284109885543Smrg case $libdir in 284209885543Smrg [\\/]*) 284309885543Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 284409885543Smrg ;; 284509885543Smrg esac 284609885543Smrg fi 284709885543Smrg add="-l$name" 284809885543Smrg fi 284909885543Smrg 285009885543Smrg if test "$linkmode" = prog; then 285109885543Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 285209885543Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 285309885543Smrg else 285409885543Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 285509885543Smrg test -n "$add" && deplibs="$add $deplibs" 285609885543Smrg fi 285709885543Smrg fi 285809885543Smrg elif test "$linkmode" = prog; then 285909885543Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 286009885543Smrg # is not unsupported. This is valid on all known static and 286109885543Smrg # shared platforms. 286209885543Smrg if test "$hardcode_direct" != unsupported; then 286309885543Smrg test -n "$old_library" && linklib="$old_library" 286409885543Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 286509885543Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 286609885543Smrg else 286709885543Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 286809885543Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 286909885543Smrg fi 287009885543Smrg elif test "$build_libtool_libs" = yes; then 287109885543Smrg # Not a shared library 287209885543Smrg if test "$deplibs_check_method" != pass_all; then 287309885543Smrg # We're trying link a shared library against a static one 287409885543Smrg # but the system doesn't support it. 287509885543Smrg 287609885543Smrg # Just print a warning and add the library to dependency_libs so 287709885543Smrg # that the program can be linked against the static library. 287809885543Smrg $echo 287909885543Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 288009885543Smrg $echo "*** I have the capability to make that library automatically link in when" 288109885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 288209885543Smrg $echo "*** shared version of the library, which you do not appear to have." 288309885543Smrg if test "$module" = yes; then 288409885543Smrg $echo "*** But as you try to build a module library, libtool will still create " 288509885543Smrg $echo "*** a static module, that should work as long as the dlopening application" 288609885543Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 288709885543Smrg if test -z "$global_symbol_pipe"; then 288809885543Smrg $echo 288909885543Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 289009885543Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 289109885543Smrg $echo "*** not find such a program. So, this module is probably useless." 289209885543Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 289309885543Smrg fi 289409885543Smrg if test "$build_old_libs" = no; then 289509885543Smrg build_libtool_libs=module 289609885543Smrg build_old_libs=yes 289709885543Smrg else 289809885543Smrg build_libtool_libs=no 289909885543Smrg fi 290009885543Smrg fi 290109885543Smrg else 290209885543Smrg deplibs="$dir/$old_library $deplibs" 290309885543Smrg link_static=yes 290409885543Smrg fi 290509885543Smrg fi # link shared/static library? 290609885543Smrg 290709885543Smrg if test "$linkmode" = lib; then 290809885543Smrg if test -n "$dependency_libs" && 290909885543Smrg { test "$hardcode_into_libs" != yes || 291009885543Smrg test "$build_old_libs" = yes || 291109885543Smrg test "$link_static" = yes; }; then 291209885543Smrg # Extract -R from dependency_libs 291309885543Smrg temp_deplibs= 291409885543Smrg for libdir in $dependency_libs; do 291509885543Smrg case $libdir in 291609885543Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 291709885543Smrg case " $xrpath " in 291809885543Smrg *" $temp_xrpath "*) ;; 291909885543Smrg *) xrpath="$xrpath $temp_xrpath";; 292009885543Smrg esac;; 292109885543Smrg *) temp_deplibs="$temp_deplibs $libdir";; 292209885543Smrg esac 292309885543Smrg done 292409885543Smrg dependency_libs="$temp_deplibs" 292509885543Smrg fi 292609885543Smrg 292709885543Smrg newlib_search_path="$newlib_search_path $absdir" 292809885543Smrg # Link against this library 292909885543Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 293009885543Smrg # ... and its dependency_libs 293109885543Smrg tmp_libs= 293209885543Smrg for deplib in $dependency_libs; do 293309885543Smrg newdependency_libs="$deplib $newdependency_libs" 293409885543Smrg if test "X$duplicate_deps" = "Xyes" ; then 293509885543Smrg case "$tmp_libs " in 293609885543Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 293709885543Smrg esac 293809885543Smrg fi 293909885543Smrg tmp_libs="$tmp_libs $deplib" 294009885543Smrg done 294109885543Smrg 294209885543Smrg if test "$link_all_deplibs" != no; then 294309885543Smrg # Add the search paths of all dependency libraries 294409885543Smrg for deplib in $dependency_libs; do 294509885543Smrg case $deplib in 294609885543Smrg -L*) path="$deplib" ;; 294709885543Smrg *.la) 294809885543Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 294909885543Smrg test "X$dir" = "X$deplib" && dir="." 295009885543Smrg # We need an absolute path. 295109885543Smrg case $dir in 295209885543Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 295309885543Smrg *) 295409885543Smrg absdir=`cd "$dir" && pwd` 295509885543Smrg if test -z "$absdir"; then 295609885543Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 295709885543Smrg absdir="$dir" 295809885543Smrg fi 295909885543Smrg ;; 296009885543Smrg esac 296109885543Smrg if grep "^installed=no" $deplib > /dev/null; then 296209885543Smrg path="$absdir/$objdir" 296309885543Smrg else 296409885543Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 296509885543Smrg if test -z "$libdir"; then 296609885543Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 296709885543Smrg exit $EXIT_FAILURE 296809885543Smrg fi 296909885543Smrg if test "$absdir" != "$libdir"; then 297009885543Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 297109885543Smrg fi 297209885543Smrg path="$absdir" 297309885543Smrg fi 297409885543Smrg depdepl= 297509885543Smrg case $host in 297609885543Smrg *-*-darwin*) 297709885543Smrg # we do not want to link against static libs, 297809885543Smrg # but need to link against shared 297909885543Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29807104f784Smrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 298109885543Smrg if test -n "$deplibrary_names" ; then 298209885543Smrg for tmp in $deplibrary_names ; do 298309885543Smrg depdepl=$tmp 298409885543Smrg done 29857104f784Smrg if test -f "$deplibdir/$depdepl" ; then 29867104f784Smrg depdepl="$deplibdir/$depdepl" 29877104f784Smrg elif test -f "$path/$depdepl" ; then 298809885543Smrg depdepl="$path/$depdepl" 29897104f784Smrg else 29907104f784Smrg # Can't find it, oh well... 29917104f784Smrg depdepl= 299209885543Smrg fi 299309885543Smrg # do not add paths which are already there 299409885543Smrg case " $newlib_search_path " in 299509885543Smrg *" $path "*) ;; 299609885543Smrg *) newlib_search_path="$newlib_search_path $path";; 299709885543Smrg esac 299809885543Smrg fi 299909885543Smrg path="" 300009885543Smrg ;; 300109885543Smrg *) 300209885543Smrg path="-L$path" 300309885543Smrg ;; 300409885543Smrg esac 300509885543Smrg ;; 300609885543Smrg -l*) 300709885543Smrg case $host in 300809885543Smrg *-*-darwin*) 300909885543Smrg # Again, we only want to link against shared libraries 301009885543Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 301109885543Smrg for tmp in $newlib_search_path ; do 301209885543Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 301309885543Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 301409885543Smrg break 301509885543Smrg fi 301609885543Smrg done 301709885543Smrg path="" 301809885543Smrg ;; 301909885543Smrg *) continue ;; 302009885543Smrg esac 302109885543Smrg ;; 302209885543Smrg *) continue ;; 302309885543Smrg esac 302409885543Smrg case " $deplibs " in 302509885543Smrg *" $path "*) ;; 302609885543Smrg *) deplibs="$path $deplibs" ;; 302709885543Smrg esac 302809885543Smrg case " $deplibs " in 302909885543Smrg *" $depdepl "*) ;; 303009885543Smrg *) deplibs="$depdepl $deplibs" ;; 303109885543Smrg esac 303209885543Smrg done 303309885543Smrg fi # link_all_deplibs != no 303409885543Smrg fi # linkmode = lib 303509885543Smrg done # for deplib in $libs 303609885543Smrg dependency_libs="$newdependency_libs" 303709885543Smrg if test "$pass" = dlpreopen; then 303809885543Smrg # Link the dlpreopened libraries before other libraries 303909885543Smrg for deplib in $save_deplibs; do 304009885543Smrg deplibs="$deplib $deplibs" 304109885543Smrg done 304209885543Smrg fi 304309885543Smrg if test "$pass" != dlopen; then 304409885543Smrg if test "$pass" != conv; then 304509885543Smrg # Make sure lib_search_path contains only unique directories. 304609885543Smrg lib_search_path= 304709885543Smrg for dir in $newlib_search_path; do 304809885543Smrg case "$lib_search_path " in 304909885543Smrg *" $dir "*) ;; 305009885543Smrg *) lib_search_path="$lib_search_path $dir" ;; 305109885543Smrg esac 305209885543Smrg done 305309885543Smrg newlib_search_path= 305409885543Smrg fi 305509885543Smrg 305609885543Smrg if test "$linkmode,$pass" != "prog,link"; then 305709885543Smrg vars="deplibs" 305809885543Smrg else 305909885543Smrg vars="compile_deplibs finalize_deplibs" 306009885543Smrg fi 306109885543Smrg for var in $vars dependency_libs; do 306209885543Smrg # Add libraries to $var in reverse order 306309885543Smrg eval tmp_libs=\"\$$var\" 306409885543Smrg new_libs= 306509885543Smrg for deplib in $tmp_libs; do 306609885543Smrg # FIXME: Pedantically, this is the right thing to do, so 306709885543Smrg # that some nasty dependency loop isn't accidentally 306809885543Smrg # broken: 306909885543Smrg #new_libs="$deplib $new_libs" 307009885543Smrg # Pragmatically, this seems to cause very few problems in 307109885543Smrg # practice: 307209885543Smrg case $deplib in 307309885543Smrg -L*) new_libs="$deplib $new_libs" ;; 307409885543Smrg -R*) ;; 307509885543Smrg *) 307609885543Smrg # And here is the reason: when a library appears more 307709885543Smrg # than once as an explicit dependence of a library, or 307809885543Smrg # is implicitly linked in more than once by the 307909885543Smrg # compiler, it is considered special, and multiple 308009885543Smrg # occurrences thereof are not removed. Compare this 308109885543Smrg # with having the same library being listed as a 308209885543Smrg # dependency of multiple other libraries: in this case, 308309885543Smrg # we know (pedantically, we assume) the library does not 308409885543Smrg # need to be listed more than once, so we keep only the 308509885543Smrg # last copy. This is not always right, but it is rare 308609885543Smrg # enough that we require users that really mean to play 308709885543Smrg # such unportable linking tricks to link the library 308809885543Smrg # using -Wl,-lname, so that libtool does not consider it 308909885543Smrg # for duplicate removal. 309009885543Smrg case " $specialdeplibs " in 309109885543Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 309209885543Smrg *) 309309885543Smrg case " $new_libs " in 309409885543Smrg *" $deplib "*) ;; 309509885543Smrg *) new_libs="$deplib $new_libs" ;; 309609885543Smrg esac 309709885543Smrg ;; 309809885543Smrg esac 309909885543Smrg ;; 310009885543Smrg esac 310109885543Smrg done 310209885543Smrg tmp_libs= 310309885543Smrg for deplib in $new_libs; do 310409885543Smrg case $deplib in 310509885543Smrg -L*) 310609885543Smrg case " $tmp_libs " in 310709885543Smrg *" $deplib "*) ;; 310809885543Smrg *) tmp_libs="$tmp_libs $deplib" ;; 310909885543Smrg esac 311009885543Smrg ;; 311109885543Smrg *) tmp_libs="$tmp_libs $deplib" ;; 311209885543Smrg esac 311309885543Smrg done 311409885543Smrg eval $var=\"$tmp_libs\" 311509885543Smrg done # for var 311609885543Smrg fi 311709885543Smrg # Last step: remove runtime libs from dependency_libs 311809885543Smrg # (they stay in deplibs) 311909885543Smrg tmp_libs= 312009885543Smrg for i in $dependency_libs ; do 312109885543Smrg case " $predeps $postdeps $compiler_lib_search_path " in 312209885543Smrg *" $i "*) 312309885543Smrg i="" 312409885543Smrg ;; 312509885543Smrg esac 312609885543Smrg if test -n "$i" ; then 312709885543Smrg tmp_libs="$tmp_libs $i" 312809885543Smrg fi 312909885543Smrg done 313009885543Smrg dependency_libs=$tmp_libs 313109885543Smrg done # for pass 313209885543Smrg if test "$linkmode" = prog; then 313309885543Smrg dlfiles="$newdlfiles" 313409885543Smrg dlprefiles="$newdlprefiles" 313509885543Smrg fi 313609885543Smrg 313709885543Smrg case $linkmode in 313809885543Smrg oldlib) 31397104f784Smrg case " $deplibs" in 31407104f784Smrg *\ -l* | *\ -L*) 31417104f784Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 31427104f784Smrg esac 314309885543Smrg 314409885543Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 314509885543Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 314609885543Smrg fi 314709885543Smrg 314809885543Smrg if test -n "$rpath"; then 314909885543Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 315009885543Smrg fi 315109885543Smrg 315209885543Smrg if test -n "$xrpath"; then 315309885543Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 315409885543Smrg fi 315509885543Smrg 315609885543Smrg if test -n "$vinfo"; then 315709885543Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 315809885543Smrg fi 315909885543Smrg 316009885543Smrg if test -n "$release"; then 316109885543Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 316209885543Smrg fi 316309885543Smrg 316409885543Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 316509885543Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 316609885543Smrg fi 316709885543Smrg 316809885543Smrg # Now set the variables for building old libraries. 316909885543Smrg build_libtool_libs=no 317009885543Smrg oldlibs="$output" 317109885543Smrg objs="$objs$old_deplibs" 317209885543Smrg ;; 317309885543Smrg 317409885543Smrg lib) 317509885543Smrg # Make sure we only generate libraries of the form `libNAME.la'. 317609885543Smrg case $outputname in 317709885543Smrg lib*) 317809885543Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 317909885543Smrg eval shared_ext=\"$shrext_cmds\" 318009885543Smrg eval libname=\"$libname_spec\" 318109885543Smrg ;; 318209885543Smrg *) 318309885543Smrg if test "$module" = no; then 318409885543Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 318509885543Smrg $echo "$help" 1>&2 318609885543Smrg exit $EXIT_FAILURE 318709885543Smrg fi 318809885543Smrg if test "$need_lib_prefix" != no; then 318909885543Smrg # Add the "lib" prefix for modules if required 319009885543Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 319109885543Smrg eval shared_ext=\"$shrext_cmds\" 319209885543Smrg eval libname=\"$libname_spec\" 319309885543Smrg else 319409885543Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 319509885543Smrg fi 319609885543Smrg ;; 319709885543Smrg esac 319809885543Smrg 319909885543Smrg if test -n "$objs"; then 320009885543Smrg if test "$deplibs_check_method" != pass_all; then 320109885543Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 320209885543Smrg exit $EXIT_FAILURE 320309885543Smrg else 320409885543Smrg $echo 320509885543Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 320609885543Smrg $echo "*** objects $objs is not portable!" 320709885543Smrg libobjs="$libobjs $objs" 320809885543Smrg fi 320909885543Smrg fi 321009885543Smrg 321109885543Smrg if test "$dlself" != no; then 321209885543Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 321309885543Smrg fi 321409885543Smrg 321509885543Smrg set dummy $rpath 321609885543Smrg if test "$#" -gt 2; then 321709885543Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 321809885543Smrg fi 321909885543Smrg install_libdir="$2" 322009885543Smrg 322109885543Smrg oldlibs= 322209885543Smrg if test -z "$rpath"; then 322309885543Smrg if test "$build_libtool_libs" = yes; then 322409885543Smrg # Building a libtool convenience library. 322509885543Smrg # Some compilers have problems with a `.al' extension so 322609885543Smrg # convenience libraries should have the same extension an 322709885543Smrg # archive normally would. 322809885543Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 322909885543Smrg build_libtool_libs=convenience 323009885543Smrg build_old_libs=yes 323109885543Smrg fi 323209885543Smrg 323309885543Smrg if test -n "$vinfo"; then 323409885543Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 323509885543Smrg fi 323609885543Smrg 323709885543Smrg if test -n "$release"; then 323809885543Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 323909885543Smrg fi 324009885543Smrg else 324109885543Smrg 324209885543Smrg # Parse the version information argument. 324309885543Smrg save_ifs="$IFS"; IFS=':' 324409885543Smrg set dummy $vinfo 0 0 0 324509885543Smrg IFS="$save_ifs" 324609885543Smrg 324709885543Smrg if test -n "$8"; then 324809885543Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 324909885543Smrg $echo "$help" 1>&2 325009885543Smrg exit $EXIT_FAILURE 325109885543Smrg fi 325209885543Smrg 325309885543Smrg # convert absolute version numbers to libtool ages 325409885543Smrg # this retains compatibility with .la files and attempts 325509885543Smrg # to make the code below a bit more comprehensible 325609885543Smrg 325709885543Smrg case $vinfo_number in 325809885543Smrg yes) 325909885543Smrg number_major="$2" 326009885543Smrg number_minor="$3" 326109885543Smrg number_revision="$4" 326209885543Smrg # 326309885543Smrg # There are really only two kinds -- those that 326409885543Smrg # use the current revision as the major version 326509885543Smrg # and those that subtract age and use age as 326609885543Smrg # a minor version. But, then there is irix 326709885543Smrg # which has an extra 1 added just for fun 326809885543Smrg # 326909885543Smrg case $version_type in 32707104f784Smrg darwin|linux|osf|windows|none) 327109885543Smrg current=`expr $number_major + $number_minor` 327209885543Smrg age="$number_minor" 327309885543Smrg revision="$number_revision" 327409885543Smrg ;; 327509885543Smrg freebsd-aout|freebsd-elf|sunos) 327609885543Smrg current="$number_major" 327709885543Smrg revision="$number_minor" 327809885543Smrg age="0" 327909885543Smrg ;; 328009885543Smrg irix|nonstopux) 32817104f784Smrg current=`expr $number_major + $number_minor` 328209885543Smrg age="$number_minor" 328309885543Smrg revision="$number_minor" 32847104f784Smrg lt_irix_increment=no 328509885543Smrg ;; 328609885543Smrg esac 328709885543Smrg ;; 328809885543Smrg no) 328909885543Smrg current="$2" 329009885543Smrg revision="$3" 329109885543Smrg age="$4" 329209885543Smrg ;; 329309885543Smrg esac 329409885543Smrg 329509885543Smrg # Check that each of the things are valid numbers. 329609885543Smrg case $current in 329709885543Smrg 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]) ;; 329809885543Smrg *) 329909885543Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 330009885543Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 330109885543Smrg exit $EXIT_FAILURE 330209885543Smrg ;; 330309885543Smrg esac 330409885543Smrg 330509885543Smrg case $revision in 330609885543Smrg 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]) ;; 330709885543Smrg *) 330809885543Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 330909885543Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 331009885543Smrg exit $EXIT_FAILURE 331109885543Smrg ;; 331209885543Smrg esac 331309885543Smrg 331409885543Smrg case $age in 331509885543Smrg 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]) ;; 331609885543Smrg *) 331709885543Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 331809885543Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 331909885543Smrg exit $EXIT_FAILURE 332009885543Smrg ;; 332109885543Smrg esac 332209885543Smrg 332309885543Smrg if test "$age" -gt "$current"; then 332409885543Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 332509885543Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 332609885543Smrg exit $EXIT_FAILURE 332709885543Smrg fi 332809885543Smrg 332909885543Smrg # Calculate the version variables. 333009885543Smrg major= 333109885543Smrg versuffix= 333209885543Smrg verstring= 333309885543Smrg case $version_type in 333409885543Smrg none) ;; 333509885543Smrg 333609885543Smrg darwin) 333709885543Smrg # Like Linux, but with the current version available in 333809885543Smrg # verstring for coding it into the library header 333909885543Smrg major=.`expr $current - $age` 334009885543Smrg versuffix="$major.$age.$revision" 334109885543Smrg # Darwin ld doesn't like 0 for these options... 334209885543Smrg minor_current=`expr $current + 1` 33437104f784Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 33447104f784Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 334509885543Smrg ;; 334609885543Smrg 334709885543Smrg freebsd-aout) 334809885543Smrg major=".$current" 334909885543Smrg versuffix=".$current.$revision"; 335009885543Smrg ;; 335109885543Smrg 335209885543Smrg freebsd-elf) 335309885543Smrg major=".$current" 335409885543Smrg versuffix=".$current"; 335509885543Smrg ;; 335609885543Smrg 335709885543Smrg irix | nonstopux) 33587104f784Smrg if test "X$lt_irix_increment" = "Xno"; then 33597104f784Smrg major=`expr $current - $age` 33607104f784Smrg else 33617104f784Smrg major=`expr $current - $age + 1` 33627104f784Smrg fi 336309885543Smrg case $version_type in 336409885543Smrg nonstopux) verstring_prefix=nonstopux ;; 336509885543Smrg *) verstring_prefix=sgi ;; 336609885543Smrg esac 336709885543Smrg verstring="$verstring_prefix$major.$revision" 336809885543Smrg 336909885543Smrg # Add in all the interfaces that we are compatible with. 337009885543Smrg loop=$revision 337109885543Smrg while test "$loop" -ne 0; do 337209885543Smrg iface=`expr $revision - $loop` 337309885543Smrg loop=`expr $loop - 1` 337409885543Smrg verstring="$verstring_prefix$major.$iface:$verstring" 337509885543Smrg done 337609885543Smrg 337709885543Smrg # Before this point, $major must not contain `.'. 337809885543Smrg major=.$major 337909885543Smrg versuffix="$major.$revision" 338009885543Smrg ;; 338109885543Smrg 338209885543Smrg linux) 338309885543Smrg major=.`expr $current - $age` 338409885543Smrg versuffix="$major.$age.$revision" 338509885543Smrg ;; 338609885543Smrg 338709885543Smrg osf) 338809885543Smrg major=.`expr $current - $age` 338909885543Smrg versuffix=".$current.$age.$revision" 339009885543Smrg verstring="$current.$age.$revision" 339109885543Smrg 339209885543Smrg # Add in all the interfaces that we are compatible with. 339309885543Smrg loop=$age 339409885543Smrg while test "$loop" -ne 0; do 339509885543Smrg iface=`expr $current - $loop` 339609885543Smrg loop=`expr $loop - 1` 339709885543Smrg verstring="$verstring:${iface}.0" 339809885543Smrg done 339909885543Smrg 340009885543Smrg # Make executables depend on our current version. 340109885543Smrg verstring="$verstring:${current}.0" 340209885543Smrg ;; 340309885543Smrg 340409885543Smrg sunos) 340509885543Smrg major=".$current" 340609885543Smrg versuffix=".$current.$revision" 340709885543Smrg ;; 340809885543Smrg 340909885543Smrg windows) 341009885543Smrg # Use '-' rather than '.', since we only want one 341109885543Smrg # extension on DOS 8.3 filesystems. 341209885543Smrg major=`expr $current - $age` 341309885543Smrg versuffix="-$major" 341409885543Smrg ;; 341509885543Smrg 341609885543Smrg *) 341709885543Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 341809885543Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 341909885543Smrg exit $EXIT_FAILURE 342009885543Smrg ;; 342109885543Smrg esac 342209885543Smrg 342309885543Smrg # Clear the version info if we defaulted, and they specified a release. 342409885543Smrg if test -z "$vinfo" && test -n "$release"; then 342509885543Smrg major= 342609885543Smrg case $version_type in 342709885543Smrg darwin) 342809885543Smrg # we can't check for "0.0" in archive_cmds due to quoting 342909885543Smrg # problems, so we reset it completely 343009885543Smrg verstring= 343109885543Smrg ;; 343209885543Smrg *) 343309885543Smrg verstring="0.0" 343409885543Smrg ;; 343509885543Smrg esac 343609885543Smrg if test "$need_version" = no; then 343709885543Smrg versuffix= 343809885543Smrg else 343909885543Smrg versuffix=".0.0" 344009885543Smrg fi 344109885543Smrg fi 344209885543Smrg 344309885543Smrg # Remove version info from name if versioning should be avoided 344409885543Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 344509885543Smrg major= 344609885543Smrg versuffix= 344709885543Smrg verstring="" 344809885543Smrg fi 344909885543Smrg 345009885543Smrg # Check to see if the archive will have undefined symbols. 345109885543Smrg if test "$allow_undefined" = yes; then 345209885543Smrg if test "$allow_undefined_flag" = unsupported; then 345309885543Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 345409885543Smrg build_libtool_libs=no 345509885543Smrg build_old_libs=yes 345609885543Smrg fi 345709885543Smrg else 345809885543Smrg # Don't allow undefined symbols. 345909885543Smrg allow_undefined_flag="$no_undefined_flag" 346009885543Smrg fi 346109885543Smrg fi 346209885543Smrg 346309885543Smrg if test "$mode" != relink; then 346409885543Smrg # Remove our outputs, but don't remove object files since they 346509885543Smrg # may have been created when compiling PIC objects. 346609885543Smrg removelist= 346709885543Smrg tempremovelist=`$echo "$output_objdir/*"` 346809885543Smrg for p in $tempremovelist; do 346909885543Smrg case $p in 347009885543Smrg *.$objext) 347109885543Smrg ;; 347209885543Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 347309885543Smrg if test "X$precious_files_regex" != "X"; then 347409885543Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 347509885543Smrg then 347609885543Smrg continue 347709885543Smrg fi 347809885543Smrg fi 347909885543Smrg removelist="$removelist $p" 348009885543Smrg ;; 348109885543Smrg *) ;; 348209885543Smrg esac 348309885543Smrg done 348409885543Smrg if test -n "$removelist"; then 348509885543Smrg $show "${rm}r $removelist" 348609885543Smrg $run ${rm}r $removelist 348709885543Smrg fi 348809885543Smrg fi 348909885543Smrg 349009885543Smrg # Now set the variables for building old libraries. 349109885543Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 349209885543Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 349309885543Smrg 349409885543Smrg # Transform .lo files to .o files. 349509885543Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 349609885543Smrg fi 349709885543Smrg 349809885543Smrg # Eliminate all temporary directories. 34997104f784Smrg #for path in $notinst_path; do 35007104f784Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 35017104f784Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 35027104f784Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 35037104f784Smrg #done 350409885543Smrg 350509885543Smrg if test -n "$xrpath"; then 350609885543Smrg # If the user specified any rpath flags, then add them. 350709885543Smrg temp_xrpath= 350809885543Smrg for libdir in $xrpath; do 350909885543Smrg temp_xrpath="$temp_xrpath -R$libdir" 351009885543Smrg case "$finalize_rpath " in 351109885543Smrg *" $libdir "*) ;; 351209885543Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 351309885543Smrg esac 351409885543Smrg done 351509885543Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 351609885543Smrg dependency_libs="$temp_xrpath $dependency_libs" 351709885543Smrg fi 351809885543Smrg fi 351909885543Smrg 352009885543Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 352109885543Smrg old_dlfiles="$dlfiles" 352209885543Smrg dlfiles= 352309885543Smrg for lib in $old_dlfiles; do 352409885543Smrg case " $dlprefiles $dlfiles " in 352509885543Smrg *" $lib "*) ;; 352609885543Smrg *) dlfiles="$dlfiles $lib" ;; 352709885543Smrg esac 352809885543Smrg done 352909885543Smrg 353009885543Smrg # Make sure dlprefiles contains only unique files 353109885543Smrg old_dlprefiles="$dlprefiles" 353209885543Smrg dlprefiles= 353309885543Smrg for lib in $old_dlprefiles; do 353409885543Smrg case "$dlprefiles " in 353509885543Smrg *" $lib "*) ;; 353609885543Smrg *) dlprefiles="$dlprefiles $lib" ;; 353709885543Smrg esac 353809885543Smrg done 353909885543Smrg 354009885543Smrg if test "$build_libtool_libs" = yes; then 354109885543Smrg if test -n "$rpath"; then 354209885543Smrg case $host in 354309885543Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 354409885543Smrg # these systems don't actually have a c library (as such)! 354509885543Smrg ;; 354609885543Smrg *-*-rhapsody* | *-*-darwin1.[012]) 354709885543Smrg # Rhapsody C library is in the System framework 354809885543Smrg deplibs="$deplibs -framework System" 354909885543Smrg ;; 355009885543Smrg *-*-netbsd*) 355109885543Smrg # Don't link with libc until the a.out ld.so is fixed. 355209885543Smrg ;; 355309885543Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 355409885543Smrg # Do not include libc due to us having libc/libc_r. 355509885543Smrg ;; 355609885543Smrg *-*-sco3.2v5* | *-*-sco5v6*) 355709885543Smrg # Causes problems with __ctype 355809885543Smrg ;; 355909885543Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 356009885543Smrg # Compiler inserts libc in the correct place for threads to work 356109885543Smrg ;; 356209885543Smrg *) 356309885543Smrg # Add libc to deplibs on all other systems if necessary. 356409885543Smrg if test "$build_libtool_need_lc" = "yes"; then 356509885543Smrg deplibs="$deplibs -lc" 356609885543Smrg fi 356709885543Smrg ;; 356809885543Smrg esac 356909885543Smrg fi 357009885543Smrg 357109885543Smrg # Transform deplibs into only deplibs that can be linked in shared. 357209885543Smrg name_save=$name 357309885543Smrg libname_save=$libname 357409885543Smrg release_save=$release 357509885543Smrg versuffix_save=$versuffix 357609885543Smrg major_save=$major 357709885543Smrg # I'm not sure if I'm treating the release correctly. I think 357809885543Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 357909885543Smrg # add it in twice. Is that correct? 358009885543Smrg release="" 358109885543Smrg versuffix="" 358209885543Smrg major="" 358309885543Smrg newdeplibs= 358409885543Smrg droppeddeps=no 358509885543Smrg case $deplibs_check_method in 358609885543Smrg pass_all) 358709885543Smrg # Don't check for shared/static. Everything works. 358809885543Smrg # This might be a little naive. We might want to check 358909885543Smrg # whether the library exists or not. But this is on 359009885543Smrg # osf3 & osf4 and I'm not really sure... Just 359109885543Smrg # implementing what was already the behavior. 359209885543Smrg newdeplibs=$deplibs 359309885543Smrg ;; 359409885543Smrg test_compile) 359509885543Smrg # This code stresses the "libraries are programs" paradigm to its 359609885543Smrg # limits. Maybe even breaks it. We compile a program, linking it 359709885543Smrg # against the deplibs as a proxy for the library. Then we can check 359809885543Smrg # whether they linked in statically or dynamically with ldd. 359909885543Smrg $rm conftest.c 360009885543Smrg cat > conftest.c <<EOF 360109885543Smrg int main() { return 0; } 360209885543SmrgEOF 360309885543Smrg $rm conftest 36047104f784Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 360509885543Smrg ldd_output=`ldd conftest` 360609885543Smrg for i in $deplibs; do 360709885543Smrg name=`expr $i : '-l\(.*\)'` 360809885543Smrg # If $name is empty we are operating on a -L argument. 36097104f784Smrg if test "$name" != "" && test "$name" != "0"; then 361009885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 361109885543Smrg case " $predeps $postdeps " in 361209885543Smrg *" $i "*) 361309885543Smrg newdeplibs="$newdeplibs $i" 361409885543Smrg i="" 361509885543Smrg ;; 361609885543Smrg esac 361709885543Smrg fi 361809885543Smrg if test -n "$i" ; then 361909885543Smrg libname=`eval \\$echo \"$libname_spec\"` 362009885543Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 362109885543Smrg set dummy $deplib_matches 362209885543Smrg deplib_match=$2 362309885543Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 362409885543Smrg newdeplibs="$newdeplibs $i" 362509885543Smrg else 362609885543Smrg droppeddeps=yes 362709885543Smrg $echo 362809885543Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 362909885543Smrg $echo "*** I have the capability to make that library automatically link in when" 363009885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 363109885543Smrg $echo "*** shared version of the library, which I believe you do not have" 363209885543Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 363309885543Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 363409885543Smrg fi 363509885543Smrg fi 363609885543Smrg else 363709885543Smrg newdeplibs="$newdeplibs $i" 363809885543Smrg fi 363909885543Smrg done 364009885543Smrg else 364109885543Smrg # Error occurred in the first compile. Let's try to salvage 364209885543Smrg # the situation: Compile a separate program for each library. 364309885543Smrg for i in $deplibs; do 364409885543Smrg name=`expr $i : '-l\(.*\)'` 364509885543Smrg # If $name is empty we are operating on a -L argument. 364609885543Smrg if test "$name" != "" && test "$name" != "0"; then 364709885543Smrg $rm conftest 36487104f784Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 364909885543Smrg ldd_output=`ldd conftest` 365009885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 365109885543Smrg case " $predeps $postdeps " in 365209885543Smrg *" $i "*) 365309885543Smrg newdeplibs="$newdeplibs $i" 365409885543Smrg i="" 365509885543Smrg ;; 365609885543Smrg esac 365709885543Smrg fi 365809885543Smrg if test -n "$i" ; then 365909885543Smrg libname=`eval \\$echo \"$libname_spec\"` 366009885543Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 366109885543Smrg set dummy $deplib_matches 366209885543Smrg deplib_match=$2 366309885543Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 366409885543Smrg newdeplibs="$newdeplibs $i" 366509885543Smrg else 366609885543Smrg droppeddeps=yes 366709885543Smrg $echo 366809885543Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 366909885543Smrg $echo "*** I have the capability to make that library automatically link in when" 367009885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 367109885543Smrg $echo "*** shared version of the library, which you do not appear to have" 367209885543Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 367309885543Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 367409885543Smrg fi 367509885543Smrg fi 367609885543Smrg else 367709885543Smrg droppeddeps=yes 367809885543Smrg $echo 367909885543Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 36807104f784Smrg $echo "*** make it link in! You will probably need to install it or some" 368109885543Smrg $echo "*** library that it depends on before this library will be fully" 368209885543Smrg $echo "*** functional. Installing it before continuing would be even better." 368309885543Smrg fi 368409885543Smrg else 368509885543Smrg newdeplibs="$newdeplibs $i" 368609885543Smrg fi 368709885543Smrg done 368809885543Smrg fi 368909885543Smrg ;; 369009885543Smrg file_magic*) 369109885543Smrg set dummy $deplibs_check_method 369209885543Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 369309885543Smrg for a_deplib in $deplibs; do 369409885543Smrg name=`expr $a_deplib : '-l\(.*\)'` 369509885543Smrg # If $name is empty we are operating on a -L argument. 369609885543Smrg if test "$name" != "" && test "$name" != "0"; then 369709885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 369809885543Smrg case " $predeps $postdeps " in 369909885543Smrg *" $a_deplib "*) 370009885543Smrg newdeplibs="$newdeplibs $a_deplib" 370109885543Smrg a_deplib="" 370209885543Smrg ;; 370309885543Smrg esac 370409885543Smrg fi 370509885543Smrg if test -n "$a_deplib" ; then 370609885543Smrg libname=`eval \\$echo \"$libname_spec\"` 370709885543Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 370809885543Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 370909885543Smrg for potent_lib in $potential_libs; do 371009885543Smrg # Follow soft links. 371109885543Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 371209885543Smrg | grep " -> " >/dev/null; then 371309885543Smrg continue 371409885543Smrg fi 371509885543Smrg # The statement above tries to avoid entering an 371609885543Smrg # endless loop below, in case of cyclic links. 371709885543Smrg # We might still enter an endless loop, since a link 371809885543Smrg # loop can be closed while we follow links, 371909885543Smrg # but so what? 372009885543Smrg potlib="$potent_lib" 372109885543Smrg while test -h "$potlib" 2>/dev/null; do 372209885543Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 372309885543Smrg case $potliblink in 372409885543Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 372509885543Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 372609885543Smrg esac 372709885543Smrg done 372809885543Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 372909885543Smrg | ${SED} 10q \ 373009885543Smrg | $EGREP "$file_magic_regex" > /dev/null; then 373109885543Smrg newdeplibs="$newdeplibs $a_deplib" 373209885543Smrg a_deplib="" 373309885543Smrg break 2 373409885543Smrg fi 373509885543Smrg done 373609885543Smrg done 373709885543Smrg fi 373809885543Smrg if test -n "$a_deplib" ; then 373909885543Smrg droppeddeps=yes 374009885543Smrg $echo 374109885543Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 374209885543Smrg $echo "*** I have the capability to make that library automatically link in when" 374309885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 374409885543Smrg $echo "*** shared version of the library, which you do not appear to have" 374509885543Smrg $echo "*** because I did check the linker path looking for a file starting" 374609885543Smrg if test -z "$potlib" ; then 374709885543Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 374809885543Smrg else 374909885543Smrg $echo "*** with $libname and none of the candidates passed a file format test" 375009885543Smrg $echo "*** using a file magic. Last file checked: $potlib" 375109885543Smrg fi 375209885543Smrg fi 375309885543Smrg else 375409885543Smrg # Add a -L argument. 375509885543Smrg newdeplibs="$newdeplibs $a_deplib" 375609885543Smrg fi 375709885543Smrg done # Gone through all deplibs. 375809885543Smrg ;; 375909885543Smrg match_pattern*) 376009885543Smrg set dummy $deplibs_check_method 376109885543Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 376209885543Smrg for a_deplib in $deplibs; do 376309885543Smrg name=`expr $a_deplib : '-l\(.*\)'` 376409885543Smrg # If $name is empty we are operating on a -L argument. 376509885543Smrg if test -n "$name" && test "$name" != "0"; then 376609885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 376709885543Smrg case " $predeps $postdeps " in 376809885543Smrg *" $a_deplib "*) 376909885543Smrg newdeplibs="$newdeplibs $a_deplib" 377009885543Smrg a_deplib="" 377109885543Smrg ;; 377209885543Smrg esac 377309885543Smrg fi 377409885543Smrg if test -n "$a_deplib" ; then 377509885543Smrg libname=`eval \\$echo \"$libname_spec\"` 377609885543Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 377709885543Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 377809885543Smrg for potent_lib in $potential_libs; do 377909885543Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 378009885543Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 378109885543Smrg | ${SED} 10q \ 378209885543Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 378309885543Smrg newdeplibs="$newdeplibs $a_deplib" 378409885543Smrg a_deplib="" 378509885543Smrg break 2 378609885543Smrg fi 378709885543Smrg done 378809885543Smrg done 378909885543Smrg fi 379009885543Smrg if test -n "$a_deplib" ; then 379109885543Smrg droppeddeps=yes 379209885543Smrg $echo 379309885543Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 379409885543Smrg $echo "*** I have the capability to make that library automatically link in when" 379509885543Smrg $echo "*** you link to this library. But I can only do this if you have a" 379609885543Smrg $echo "*** shared version of the library, which you do not appear to have" 379709885543Smrg $echo "*** because I did check the linker path looking for a file starting" 379809885543Smrg if test -z "$potlib" ; then 379909885543Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 380009885543Smrg else 380109885543Smrg $echo "*** with $libname and none of the candidates passed a file format test" 380209885543Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 380309885543Smrg fi 380409885543Smrg fi 380509885543Smrg else 380609885543Smrg # Add a -L argument. 380709885543Smrg newdeplibs="$newdeplibs $a_deplib" 380809885543Smrg fi 380909885543Smrg done # Gone through all deplibs. 381009885543Smrg ;; 381109885543Smrg none | unknown | *) 381209885543Smrg newdeplibs="" 381309885543Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 381409885543Smrg -e 's/ -[LR][^ ]*//g'` 381509885543Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 381609885543Smrg for i in $predeps $postdeps ; do 381709885543Smrg # can't use Xsed below, because $i might contain '/' 381809885543Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 381909885543Smrg done 382009885543Smrg fi 382109885543Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 382209885543Smrg | grep . >/dev/null; then 382309885543Smrg $echo 382409885543Smrg if test "X$deplibs_check_method" = "Xnone"; then 382509885543Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 382609885543Smrg else 382709885543Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 382809885543Smrg fi 382909885543Smrg $echo "*** All declared inter-library dependencies are being dropped." 383009885543Smrg droppeddeps=yes 383109885543Smrg fi 383209885543Smrg ;; 383309885543Smrg esac 383409885543Smrg versuffix=$versuffix_save 383509885543Smrg major=$major_save 383609885543Smrg release=$release_save 383709885543Smrg libname=$libname_save 383809885543Smrg name=$name_save 383909885543Smrg 384009885543Smrg case $host in 384109885543Smrg *-*-rhapsody* | *-*-darwin1.[012]) 384209885543Smrg # On Rhapsody replace the C library is the System framework 384309885543Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 384409885543Smrg ;; 384509885543Smrg esac 384609885543Smrg 384709885543Smrg if test "$droppeddeps" = yes; then 384809885543Smrg if test "$module" = yes; then 384909885543Smrg $echo 385009885543Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 385109885543Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 385209885543Smrg $echo "*** a static module, that should work as long as the dlopening" 385309885543Smrg $echo "*** application is linked with the -dlopen flag." 385409885543Smrg if test -z "$global_symbol_pipe"; then 385509885543Smrg $echo 385609885543Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 385709885543Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 385809885543Smrg $echo "*** not find such a program. So, this module is probably useless." 385909885543Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 386009885543Smrg fi 386109885543Smrg if test "$build_old_libs" = no; then 386209885543Smrg oldlibs="$output_objdir/$libname.$libext" 386309885543Smrg build_libtool_libs=module 386409885543Smrg build_old_libs=yes 386509885543Smrg else 386609885543Smrg build_libtool_libs=no 386709885543Smrg fi 386809885543Smrg else 386909885543Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 387009885543Smrg $echo "*** automatically added whenever a program is linked with this library" 387109885543Smrg $echo "*** or is declared to -dlopen it." 387209885543Smrg 387309885543Smrg if test "$allow_undefined" = no; then 387409885543Smrg $echo 387509885543Smrg $echo "*** Since this library must not contain undefined symbols," 387609885543Smrg $echo "*** because either the platform does not support them or" 387709885543Smrg $echo "*** it was explicitly requested with -no-undefined," 387809885543Smrg $echo "*** libtool will only create a static version of it." 387909885543Smrg if test "$build_old_libs" = no; then 388009885543Smrg oldlibs="$output_objdir/$libname.$libext" 388109885543Smrg build_libtool_libs=module 388209885543Smrg build_old_libs=yes 388309885543Smrg else 388409885543Smrg build_libtool_libs=no 388509885543Smrg fi 388609885543Smrg fi 388709885543Smrg fi 388809885543Smrg fi 388909885543Smrg # Done checking deplibs! 389009885543Smrg deplibs=$newdeplibs 389109885543Smrg fi 389209885543Smrg 389309885543Smrg 389409885543Smrg # move library search paths that coincide with paths to not yet 389509885543Smrg # installed libraries to the beginning of the library search list 389609885543Smrg new_libs= 389709885543Smrg for path in $notinst_path; do 389809885543Smrg case " $new_libs " in 389909885543Smrg *" -L$path/$objdir "*) ;; 390009885543Smrg *) 390109885543Smrg case " $deplibs " in 390209885543Smrg *" -L$path/$objdir "*) 390309885543Smrg new_libs="$new_libs -L$path/$objdir" ;; 390409885543Smrg esac 390509885543Smrg ;; 390609885543Smrg esac 390709885543Smrg done 390809885543Smrg for deplib in $deplibs; do 390909885543Smrg case $deplib in 391009885543Smrg -L*) 391109885543Smrg case " $new_libs " in 391209885543Smrg *" $deplib "*) ;; 391309885543Smrg *) new_libs="$new_libs $deplib" ;; 391409885543Smrg esac 391509885543Smrg ;; 391609885543Smrg *) new_libs="$new_libs $deplib" ;; 391709885543Smrg esac 391809885543Smrg done 391909885543Smrg deplibs="$new_libs" 392009885543Smrg 392109885543Smrg 392209885543Smrg # All the library-specific variables (install_libdir is set above). 392309885543Smrg library_names= 392409885543Smrg old_library= 392509885543Smrg dlname= 392609885543Smrg 392709885543Smrg # Test again, we may have decided not to build it any more 392809885543Smrg if test "$build_libtool_libs" = yes; then 392909885543Smrg if test "$hardcode_into_libs" = yes; then 393009885543Smrg # Hardcode the library paths 393109885543Smrg hardcode_libdirs= 393209885543Smrg dep_rpath= 393309885543Smrg rpath="$finalize_rpath" 393409885543Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 393509885543Smrg for libdir in $rpath; do 393609885543Smrg if test -n "$hardcode_libdir_flag_spec"; then 393709885543Smrg if test -n "$hardcode_libdir_separator"; then 393809885543Smrg if test -z "$hardcode_libdirs"; then 393909885543Smrg hardcode_libdirs="$libdir" 394009885543Smrg else 394109885543Smrg # Just accumulate the unique libdirs. 394209885543Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 394309885543Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 394409885543Smrg ;; 394509885543Smrg *) 394609885543Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 394709885543Smrg ;; 394809885543Smrg esac 394909885543Smrg fi 395009885543Smrg else 395109885543Smrg eval flag=\"$hardcode_libdir_flag_spec\" 395209885543Smrg dep_rpath="$dep_rpath $flag" 395309885543Smrg fi 395409885543Smrg elif test -n "$runpath_var"; then 395509885543Smrg case "$perm_rpath " in 395609885543Smrg *" $libdir "*) ;; 395709885543Smrg *) perm_rpath="$perm_rpath $libdir" ;; 395809885543Smrg esac 395909885543Smrg fi 396009885543Smrg done 396109885543Smrg # Substitute the hardcoded libdirs into the rpath. 396209885543Smrg if test -n "$hardcode_libdir_separator" && 396309885543Smrg test -n "$hardcode_libdirs"; then 396409885543Smrg libdir="$hardcode_libdirs" 396509885543Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 39667104f784Smrg case $archive_cmds in 39677104f784Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 39687104f784Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 39697104f784Smrg esac 397009885543Smrg else 397109885543Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 397209885543Smrg fi 397309885543Smrg fi 397409885543Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 397509885543Smrg # We should set the runpath_var. 397609885543Smrg rpath= 397709885543Smrg for dir in $perm_rpath; do 397809885543Smrg rpath="$rpath$dir:" 397909885543Smrg done 398009885543Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 398109885543Smrg fi 398209885543Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 398309885543Smrg fi 398409885543Smrg 398509885543Smrg shlibpath="$finalize_shlibpath" 398609885543Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 398709885543Smrg if test -n "$shlibpath"; then 398809885543Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 398909885543Smrg fi 399009885543Smrg 399109885543Smrg # Get the real and link names of the library. 399209885543Smrg eval shared_ext=\"$shrext_cmds\" 399309885543Smrg eval library_names=\"$library_names_spec\" 399409885543Smrg set dummy $library_names 399509885543Smrg realname="$2" 399609885543Smrg shift; shift 399709885543Smrg 399809885543Smrg if test -n "$soname_spec"; then 399909885543Smrg eval soname=\"$soname_spec\" 400009885543Smrg else 400109885543Smrg soname="$realname" 400209885543Smrg fi 400309885543Smrg if test -z "$dlname"; then 400409885543Smrg dlname=$soname 400509885543Smrg fi 400609885543Smrg 400709885543Smrg lib="$output_objdir/$realname" 400809885543Smrg linknames= 400909885543Smrg for link 401009885543Smrg do 401109885543Smrg linknames="$linknames $link" 401209885543Smrg done 401309885543Smrg 401409885543Smrg # Use standard objects if they are pic 401509885543Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 401609885543Smrg 401709885543Smrg # Prepare the list of exported symbols 401809885543Smrg if test -z "$export_symbols"; then 401909885543Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 402009885543Smrg $show "generating symbol list for \`$libname.la'" 402109885543Smrg export_symbols="$output_objdir/$libname.exp" 402209885543Smrg $run $rm $export_symbols 402309885543Smrg cmds=$export_symbols_cmds 402409885543Smrg save_ifs="$IFS"; IFS='~' 402509885543Smrg for cmd in $cmds; do 402609885543Smrg IFS="$save_ifs" 402709885543Smrg eval cmd=\"$cmd\" 402809885543Smrg if len=`expr "X$cmd" : ".*"` && 402909885543Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 403009885543Smrg $show "$cmd" 403109885543Smrg $run eval "$cmd" || exit $? 403209885543Smrg skipped_export=false 403309885543Smrg else 403409885543Smrg # The command line is too long to execute in one step. 403509885543Smrg $show "using reloadable object file for export list..." 403609885543Smrg skipped_export=: 403709885543Smrg # Break out early, otherwise skipped_export may be 403809885543Smrg # set to false by a later but shorter cmd. 403909885543Smrg break 404009885543Smrg fi 404109885543Smrg done 404209885543Smrg IFS="$save_ifs" 404309885543Smrg if test -n "$export_symbols_regex"; then 404409885543Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 404509885543Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 404609885543Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 404709885543Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 404809885543Smrg fi 404909885543Smrg fi 405009885543Smrg fi 405109885543Smrg 405209885543Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 405309885543Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 405409885543Smrg fi 405509885543Smrg 405609885543Smrg tmp_deplibs= 405709885543Smrg for test_deplib in $deplibs; do 405809885543Smrg case " $convenience " in 405909885543Smrg *" $test_deplib "*) ;; 406009885543Smrg *) 406109885543Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 406209885543Smrg ;; 406309885543Smrg esac 406409885543Smrg done 406509885543Smrg deplibs="$tmp_deplibs" 406609885543Smrg 406709885543Smrg if test -n "$convenience"; then 406809885543Smrg if test -n "$whole_archive_flag_spec"; then 406909885543Smrg save_libobjs=$libobjs 407009885543Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 407109885543Smrg else 407209885543Smrg gentop="$output_objdir/${outputname}x" 407309885543Smrg generated="$generated $gentop" 407409885543Smrg 407509885543Smrg func_extract_archives $gentop $convenience 407609885543Smrg libobjs="$libobjs $func_extract_archives_result" 407709885543Smrg fi 407809885543Smrg fi 407909885543Smrg 408009885543Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 408109885543Smrg eval flag=\"$thread_safe_flag_spec\" 408209885543Smrg linker_flags="$linker_flags $flag" 408309885543Smrg fi 408409885543Smrg 408509885543Smrg # Make a backup of the uninstalled library when relinking 408609885543Smrg if test "$mode" = relink; then 408709885543Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 408809885543Smrg fi 408909885543Smrg 409009885543Smrg # Do each of the archive commands. 409109885543Smrg if test "$module" = yes && test -n "$module_cmds" ; then 409209885543Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 409309885543Smrg eval test_cmds=\"$module_expsym_cmds\" 409409885543Smrg cmds=$module_expsym_cmds 409509885543Smrg else 409609885543Smrg eval test_cmds=\"$module_cmds\" 409709885543Smrg cmds=$module_cmds 409809885543Smrg fi 409909885543Smrg else 410009885543Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 410109885543Smrg eval test_cmds=\"$archive_expsym_cmds\" 410209885543Smrg cmds=$archive_expsym_cmds 410309885543Smrg else 410409885543Smrg eval test_cmds=\"$archive_cmds\" 410509885543Smrg cmds=$archive_cmds 410609885543Smrg fi 410709885543Smrg fi 410809885543Smrg 410909885543Smrg if test "X$skipped_export" != "X:" && 411009885543Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 411109885543Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 411209885543Smrg : 411309885543Smrg else 411409885543Smrg # The command line is too long to link in one step, link piecewise. 411509885543Smrg $echo "creating reloadable object files..." 411609885543Smrg 411709885543Smrg # Save the value of $output and $libobjs because we want to 411809885543Smrg # use them later. If we have whole_archive_flag_spec, we 411909885543Smrg # want to use save_libobjs as it was before 412009885543Smrg # whole_archive_flag_spec was expanded, because we can't 412109885543Smrg # assume the linker understands whole_archive_flag_spec. 412209885543Smrg # This may have to be revisited, in case too many 412309885543Smrg # convenience libraries get linked in and end up exceeding 412409885543Smrg # the spec. 412509885543Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 412609885543Smrg save_libobjs=$libobjs 412709885543Smrg fi 412809885543Smrg save_output=$output 412909885543Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 413009885543Smrg 413109885543Smrg # Clear the reloadable object creation command queue and 413209885543Smrg # initialize k to one. 413309885543Smrg test_cmds= 413409885543Smrg concat_cmds= 413509885543Smrg objlist= 413609885543Smrg delfiles= 413709885543Smrg last_robj= 413809885543Smrg k=1 413909885543Smrg output=$output_objdir/$output_la-${k}.$objext 414009885543Smrg # Loop over the list of objects to be linked. 414109885543Smrg for obj in $save_libobjs 414209885543Smrg do 414309885543Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 414409885543Smrg if test "X$objlist" = X || 414509885543Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 414609885543Smrg test "$len" -le "$max_cmd_len"; }; then 414709885543Smrg objlist="$objlist $obj" 414809885543Smrg else 414909885543Smrg # The command $test_cmds is almost too long, add a 415009885543Smrg # command to the queue. 415109885543Smrg if test "$k" -eq 1 ; then 415209885543Smrg # The first file doesn't have a previous command to add. 415309885543Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 415409885543Smrg else 415509885543Smrg # All subsequent reloadable object files will link in 415609885543Smrg # the last one created. 415709885543Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 415809885543Smrg fi 415909885543Smrg last_robj=$output_objdir/$output_la-${k}.$objext 416009885543Smrg k=`expr $k + 1` 416109885543Smrg output=$output_objdir/$output_la-${k}.$objext 416209885543Smrg objlist=$obj 416309885543Smrg len=1 416409885543Smrg fi 416509885543Smrg done 416609885543Smrg # Handle the remaining objects by creating one last 416709885543Smrg # reloadable object file. All subsequent reloadable object 416809885543Smrg # files will link in the last one created. 416909885543Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 417009885543Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 417109885543Smrg 417209885543Smrg if ${skipped_export-false}; then 417309885543Smrg $show "generating symbol list for \`$libname.la'" 417409885543Smrg export_symbols="$output_objdir/$libname.exp" 417509885543Smrg $run $rm $export_symbols 417609885543Smrg libobjs=$output 417709885543Smrg # Append the command to create the export file. 417809885543Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 417909885543Smrg fi 418009885543Smrg 418109885543Smrg # Set up a command to remove the reloadable object files 418209885543Smrg # after they are used. 418309885543Smrg i=0 418409885543Smrg while test "$i" -lt "$k" 418509885543Smrg do 418609885543Smrg i=`expr $i + 1` 418709885543Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 418809885543Smrg done 418909885543Smrg 419009885543Smrg $echo "creating a temporary reloadable object file: $output" 419109885543Smrg 419209885543Smrg # Loop through the commands generated above and execute them. 419309885543Smrg save_ifs="$IFS"; IFS='~' 419409885543Smrg for cmd in $concat_cmds; do 419509885543Smrg IFS="$save_ifs" 419609885543Smrg $show "$cmd" 419709885543Smrg $run eval "$cmd" || exit $? 419809885543Smrg done 419909885543Smrg IFS="$save_ifs" 420009885543Smrg 420109885543Smrg libobjs=$output 420209885543Smrg # Restore the value of output. 420309885543Smrg output=$save_output 420409885543Smrg 420509885543Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 420609885543Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 420709885543Smrg fi 420809885543Smrg # Expand the library linking commands again to reset the 420909885543Smrg # value of $libobjs for piecewise linking. 421009885543Smrg 421109885543Smrg # Do each of the archive commands. 421209885543Smrg if test "$module" = yes && test -n "$module_cmds" ; then 421309885543Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 421409885543Smrg cmds=$module_expsym_cmds 421509885543Smrg else 421609885543Smrg cmds=$module_cmds 421709885543Smrg fi 421809885543Smrg else 421909885543Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 422009885543Smrg cmds=$archive_expsym_cmds 422109885543Smrg else 422209885543Smrg cmds=$archive_cmds 422309885543Smrg fi 422409885543Smrg fi 422509885543Smrg 422609885543Smrg # Append the command to remove the reloadable object files 422709885543Smrg # to the just-reset $cmds. 422809885543Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 422909885543Smrg fi 423009885543Smrg save_ifs="$IFS"; IFS='~' 423109885543Smrg for cmd in $cmds; do 423209885543Smrg IFS="$save_ifs" 423309885543Smrg eval cmd=\"$cmd\" 423409885543Smrg $show "$cmd" 423509885543Smrg $run eval "$cmd" || { 423609885543Smrg lt_exit=$? 423709885543Smrg 423809885543Smrg # Restore the uninstalled library and exit 423909885543Smrg if test "$mode" = relink; then 424009885543Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 424109885543Smrg fi 424209885543Smrg 424309885543Smrg exit $lt_exit 424409885543Smrg } 424509885543Smrg done 424609885543Smrg IFS="$save_ifs" 424709885543Smrg 424809885543Smrg # Restore the uninstalled library and exit 424909885543Smrg if test "$mode" = relink; then 425009885543Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 425109885543Smrg 425209885543Smrg if test -n "$convenience"; then 425309885543Smrg if test -z "$whole_archive_flag_spec"; then 425409885543Smrg $show "${rm}r $gentop" 425509885543Smrg $run ${rm}r "$gentop" 425609885543Smrg fi 425709885543Smrg fi 425809885543Smrg 425909885543Smrg exit $EXIT_SUCCESS 426009885543Smrg fi 426109885543Smrg 426209885543Smrg # Create links to the real library. 426309885543Smrg for linkname in $linknames; do 426409885543Smrg if test "$realname" != "$linkname"; then 426509885543Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 426609885543Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 426709885543Smrg fi 426809885543Smrg done 426909885543Smrg 427009885543Smrg # If -module or -export-dynamic was specified, set the dlname. 427109885543Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 427209885543Smrg # On all known operating systems, these are identical. 427309885543Smrg dlname="$soname" 427409885543Smrg fi 427509885543Smrg fi 427609885543Smrg ;; 427709885543Smrg 427809885543Smrg obj) 42797104f784Smrg case " $deplibs" in 42807104f784Smrg *\ -l* | *\ -L*) 42817104f784Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 42827104f784Smrg esac 428309885543Smrg 428409885543Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 428509885543Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 428609885543Smrg fi 428709885543Smrg 428809885543Smrg if test -n "$rpath"; then 428909885543Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 429009885543Smrg fi 429109885543Smrg 429209885543Smrg if test -n "$xrpath"; then 429309885543Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 429409885543Smrg fi 429509885543Smrg 429609885543Smrg if test -n "$vinfo"; then 429709885543Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 429809885543Smrg fi 429909885543Smrg 430009885543Smrg if test -n "$release"; then 430109885543Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 430209885543Smrg fi 430309885543Smrg 430409885543Smrg case $output in 430509885543Smrg *.lo) 430609885543Smrg if test -n "$objs$old_deplibs"; then 430709885543Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 430809885543Smrg exit $EXIT_FAILURE 430909885543Smrg fi 431009885543Smrg libobj="$output" 431109885543Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 431209885543Smrg ;; 431309885543Smrg *) 431409885543Smrg libobj= 431509885543Smrg obj="$output" 431609885543Smrg ;; 431709885543Smrg esac 431809885543Smrg 431909885543Smrg # Delete the old objects. 432009885543Smrg $run $rm $obj $libobj 432109885543Smrg 432209885543Smrg # Objects from convenience libraries. This assumes 432309885543Smrg # single-version convenience libraries. Whenever we create 432409885543Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 432509885543Smrg # the extraction. 432609885543Smrg reload_conv_objs= 432709885543Smrg gentop= 432809885543Smrg # reload_cmds runs $LD directly, so let us get rid of 43297104f784Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 43307104f784Smrg # turning comma into space.. 433109885543Smrg wl= 433209885543Smrg 433309885543Smrg if test -n "$convenience"; then 433409885543Smrg if test -n "$whole_archive_flag_spec"; then 43357104f784Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 43367104f784Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 433709885543Smrg else 433809885543Smrg gentop="$output_objdir/${obj}x" 433909885543Smrg generated="$generated $gentop" 434009885543Smrg 434109885543Smrg func_extract_archives $gentop $convenience 434209885543Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 434309885543Smrg fi 434409885543Smrg fi 434509885543Smrg 434609885543Smrg # Create the old-style object. 434709885543Smrg 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 434809885543Smrg 434909885543Smrg output="$obj" 435009885543Smrg cmds=$reload_cmds 435109885543Smrg save_ifs="$IFS"; IFS='~' 435209885543Smrg for cmd in $cmds; do 435309885543Smrg IFS="$save_ifs" 435409885543Smrg eval cmd=\"$cmd\" 435509885543Smrg $show "$cmd" 435609885543Smrg $run eval "$cmd" || exit $? 435709885543Smrg done 435809885543Smrg IFS="$save_ifs" 435909885543Smrg 436009885543Smrg # Exit if we aren't doing a library object file. 436109885543Smrg if test -z "$libobj"; then 436209885543Smrg if test -n "$gentop"; then 436309885543Smrg $show "${rm}r $gentop" 436409885543Smrg $run ${rm}r $gentop 436509885543Smrg fi 436609885543Smrg 436709885543Smrg exit $EXIT_SUCCESS 436809885543Smrg fi 436909885543Smrg 437009885543Smrg if test "$build_libtool_libs" != yes; then 437109885543Smrg if test -n "$gentop"; then 437209885543Smrg $show "${rm}r $gentop" 437309885543Smrg $run ${rm}r $gentop 437409885543Smrg fi 437509885543Smrg 437609885543Smrg # Create an invalid libtool object if no PIC, so that we don't 437709885543Smrg # accidentally link it into a program. 437809885543Smrg # $show "echo timestamp > $libobj" 437909885543Smrg # $run eval "echo timestamp > $libobj" || exit $? 438009885543Smrg exit $EXIT_SUCCESS 438109885543Smrg fi 438209885543Smrg 438309885543Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 438409885543Smrg # Only do commands if we really have different PIC objects. 438509885543Smrg reload_objs="$libobjs $reload_conv_objs" 438609885543Smrg output="$libobj" 438709885543Smrg cmds=$reload_cmds 438809885543Smrg save_ifs="$IFS"; IFS='~' 438909885543Smrg for cmd in $cmds; do 439009885543Smrg IFS="$save_ifs" 439109885543Smrg eval cmd=\"$cmd\" 439209885543Smrg $show "$cmd" 439309885543Smrg $run eval "$cmd" || exit $? 439409885543Smrg done 439509885543Smrg IFS="$save_ifs" 439609885543Smrg fi 439709885543Smrg 439809885543Smrg if test -n "$gentop"; then 439909885543Smrg $show "${rm}r $gentop" 440009885543Smrg $run ${rm}r $gentop 440109885543Smrg fi 440209885543Smrg 440309885543Smrg exit $EXIT_SUCCESS 440409885543Smrg ;; 440509885543Smrg 440609885543Smrg prog) 440709885543Smrg case $host in 440809885543Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 440909885543Smrg esac 441009885543Smrg if test -n "$vinfo"; then 441109885543Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 441209885543Smrg fi 441309885543Smrg 441409885543Smrg if test -n "$release"; then 441509885543Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 441609885543Smrg fi 441709885543Smrg 441809885543Smrg if test "$preload" = yes; then 441909885543Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 442009885543Smrg test "$dlopen_self_static" = unknown; then 442109885543Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 442209885543Smrg fi 442309885543Smrg fi 442409885543Smrg 442509885543Smrg case $host in 442609885543Smrg *-*-rhapsody* | *-*-darwin1.[012]) 442709885543Smrg # On Rhapsody replace the C library is the System framework 442809885543Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 442909885543Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 443009885543Smrg ;; 443109885543Smrg esac 443209885543Smrg 443309885543Smrg case $host in 443409885543Smrg *darwin*) 443509885543Smrg # Don't allow lazy linking, it breaks C++ global constructors 443609885543Smrg if test "$tagname" = CXX ; then 443709885543Smrg compile_command="$compile_command ${wl}-bind_at_load" 443809885543Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 443909885543Smrg fi 444009885543Smrg ;; 444109885543Smrg esac 444209885543Smrg 444309885543Smrg 444409885543Smrg # move library search paths that coincide with paths to not yet 444509885543Smrg # installed libraries to the beginning of the library search list 444609885543Smrg new_libs= 444709885543Smrg for path in $notinst_path; do 444809885543Smrg case " $new_libs " in 444909885543Smrg *" -L$path/$objdir "*) ;; 445009885543Smrg *) 445109885543Smrg case " $compile_deplibs " in 445209885543Smrg *" -L$path/$objdir "*) 445309885543Smrg new_libs="$new_libs -L$path/$objdir" ;; 445409885543Smrg esac 445509885543Smrg ;; 445609885543Smrg esac 445709885543Smrg done 445809885543Smrg for deplib in $compile_deplibs; do 445909885543Smrg case $deplib in 446009885543Smrg -L*) 446109885543Smrg case " $new_libs " in 446209885543Smrg *" $deplib "*) ;; 446309885543Smrg *) new_libs="$new_libs $deplib" ;; 446409885543Smrg esac 446509885543Smrg ;; 446609885543Smrg *) new_libs="$new_libs $deplib" ;; 446709885543Smrg esac 446809885543Smrg done 446909885543Smrg compile_deplibs="$new_libs" 447009885543Smrg 447109885543Smrg 447209885543Smrg compile_command="$compile_command $compile_deplibs" 447309885543Smrg finalize_command="$finalize_command $finalize_deplibs" 447409885543Smrg 447509885543Smrg if test -n "$rpath$xrpath"; then 447609885543Smrg # If the user specified any rpath flags, then add them. 447709885543Smrg for libdir in $rpath $xrpath; do 447809885543Smrg # This is the magic to use -rpath. 447909885543Smrg case "$finalize_rpath " in 448009885543Smrg *" $libdir "*) ;; 448109885543Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 448209885543Smrg esac 448309885543Smrg done 448409885543Smrg fi 448509885543Smrg 448609885543Smrg # Now hardcode the library paths 448709885543Smrg rpath= 448809885543Smrg hardcode_libdirs= 448909885543Smrg for libdir in $compile_rpath $finalize_rpath; do 449009885543Smrg if test -n "$hardcode_libdir_flag_spec"; then 449109885543Smrg if test -n "$hardcode_libdir_separator"; then 449209885543Smrg if test -z "$hardcode_libdirs"; then 449309885543Smrg hardcode_libdirs="$libdir" 449409885543Smrg else 449509885543Smrg # Just accumulate the unique libdirs. 449609885543Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 449709885543Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 449809885543Smrg ;; 449909885543Smrg *) 450009885543Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 450109885543Smrg ;; 450209885543Smrg esac 450309885543Smrg fi 450409885543Smrg else 450509885543Smrg eval flag=\"$hardcode_libdir_flag_spec\" 450609885543Smrg rpath="$rpath $flag" 450709885543Smrg fi 450809885543Smrg elif test -n "$runpath_var"; then 450909885543Smrg case "$perm_rpath " in 451009885543Smrg *" $libdir "*) ;; 451109885543Smrg *) perm_rpath="$perm_rpath $libdir" ;; 451209885543Smrg esac 451309885543Smrg fi 451409885543Smrg case $host in 451509885543Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 451609885543Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 451709885543Smrg case :$dllsearchpath: in 451809885543Smrg *":$libdir:"*) ;; 451909885543Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 452009885543Smrg esac 452109885543Smrg case :$dllsearchpath: in 452209885543Smrg *":$testbindir:"*) ;; 452309885543Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 452409885543Smrg esac 452509885543Smrg ;; 452609885543Smrg esac 452709885543Smrg done 452809885543Smrg # Substitute the hardcoded libdirs into the rpath. 452909885543Smrg if test -n "$hardcode_libdir_separator" && 453009885543Smrg test -n "$hardcode_libdirs"; then 453109885543Smrg libdir="$hardcode_libdirs" 453209885543Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 453309885543Smrg fi 453409885543Smrg compile_rpath="$rpath" 453509885543Smrg 453609885543Smrg rpath= 453709885543Smrg hardcode_libdirs= 453809885543Smrg for libdir in $finalize_rpath; do 453909885543Smrg if test -n "$hardcode_libdir_flag_spec"; then 454009885543Smrg if test -n "$hardcode_libdir_separator"; then 454109885543Smrg if test -z "$hardcode_libdirs"; then 454209885543Smrg hardcode_libdirs="$libdir" 454309885543Smrg else 454409885543Smrg # Just accumulate the unique libdirs. 454509885543Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 454609885543Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 454709885543Smrg ;; 454809885543Smrg *) 454909885543Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 455009885543Smrg ;; 455109885543Smrg esac 455209885543Smrg fi 455309885543Smrg else 455409885543Smrg eval flag=\"$hardcode_libdir_flag_spec\" 455509885543Smrg rpath="$rpath $flag" 455609885543Smrg fi 455709885543Smrg elif test -n "$runpath_var"; then 455809885543Smrg case "$finalize_perm_rpath " in 455909885543Smrg *" $libdir "*) ;; 456009885543Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 456109885543Smrg esac 456209885543Smrg fi 456309885543Smrg done 456409885543Smrg # Substitute the hardcoded libdirs into the rpath. 456509885543Smrg if test -n "$hardcode_libdir_separator" && 456609885543Smrg test -n "$hardcode_libdirs"; then 456709885543Smrg libdir="$hardcode_libdirs" 456809885543Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 456909885543Smrg fi 457009885543Smrg finalize_rpath="$rpath" 457109885543Smrg 457209885543Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 457309885543Smrg # Transform all the library objects into standard objects. 457409885543Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 457509885543Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 457609885543Smrg fi 457709885543Smrg 457809885543Smrg dlsyms= 457909885543Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 458009885543Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 458109885543Smrg dlsyms="${outputname}S.c" 458209885543Smrg else 458309885543Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 458409885543Smrg fi 458509885543Smrg fi 458609885543Smrg 458709885543Smrg if test -n "$dlsyms"; then 458809885543Smrg case $dlsyms in 458909885543Smrg "") ;; 459009885543Smrg *.c) 459109885543Smrg # Discover the nlist of each of the dlfiles. 459209885543Smrg nlist="$output_objdir/${outputname}.nm" 459309885543Smrg 459409885543Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 459509885543Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 459609885543Smrg 459709885543Smrg # Parse the name list into a source file. 459809885543Smrg $show "creating $output_objdir/$dlsyms" 459909885543Smrg 460009885543Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 460109885543Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 460209885543Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 460309885543Smrg 460409885543Smrg#ifdef __cplusplus 460509885543Smrgextern \"C\" { 460609885543Smrg#endif 460709885543Smrg 460809885543Smrg/* Prevent the only kind of declaration conflicts we can make. */ 460909885543Smrg#define lt_preloaded_symbols some_other_symbol 461009885543Smrg 461109885543Smrg/* External symbol declarations for the compiler. */\ 461209885543Smrg" 461309885543Smrg 461409885543Smrg if test "$dlself" = yes; then 461509885543Smrg $show "generating symbol list for \`$output'" 461609885543Smrg 461709885543Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 461809885543Smrg 461909885543Smrg # Add our own program objects to the symbol list. 462009885543Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 462109885543Smrg for arg in $progfiles; do 462209885543Smrg $show "extracting global C symbols from \`$arg'" 462309885543Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 462409885543Smrg done 462509885543Smrg 462609885543Smrg if test -n "$exclude_expsyms"; then 462709885543Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 462809885543Smrg $run eval '$mv "$nlist"T "$nlist"' 462909885543Smrg fi 463009885543Smrg 463109885543Smrg if test -n "$export_symbols_regex"; then 463209885543Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 463309885543Smrg $run eval '$mv "$nlist"T "$nlist"' 463409885543Smrg fi 463509885543Smrg 463609885543Smrg # Prepare the list of exported symbols 463709885543Smrg if test -z "$export_symbols"; then 463809885543Smrg export_symbols="$output_objdir/$outputname.exp" 463909885543Smrg $run $rm $export_symbols 464009885543Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 464109885543Smrg case $host in 464209885543Smrg *cygwin* | *mingw* ) 464309885543Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 464409885543Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 464509885543Smrg ;; 464609885543Smrg esac 464709885543Smrg else 464809885543Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 464909885543Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 465009885543Smrg $run eval 'mv "$nlist"T "$nlist"' 465109885543Smrg case $host in 465209885543Smrg *cygwin* | *mingw* ) 465309885543Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 465409885543Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 465509885543Smrg ;; 465609885543Smrg esac 465709885543Smrg fi 465809885543Smrg fi 465909885543Smrg 466009885543Smrg for arg in $dlprefiles; do 466109885543Smrg $show "extracting global C symbols from \`$arg'" 466209885543Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 466309885543Smrg $run eval '$echo ": $name " >> "$nlist"' 466409885543Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 466509885543Smrg done 466609885543Smrg 466709885543Smrg if test -z "$run"; then 466809885543Smrg # Make sure we have at least an empty file. 466909885543Smrg test -f "$nlist" || : > "$nlist" 467009885543Smrg 467109885543Smrg if test -n "$exclude_expsyms"; then 467209885543Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 467309885543Smrg $mv "$nlist"T "$nlist" 467409885543Smrg fi 467509885543Smrg 467609885543Smrg # Try sorting and uniquifying the output. 467709885543Smrg if grep -v "^: " < "$nlist" | 467809885543Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 467909885543Smrg sort -k 3 468009885543Smrg else 468109885543Smrg sort +2 468209885543Smrg fi | 468309885543Smrg uniq > "$nlist"S; then 468409885543Smrg : 468509885543Smrg else 468609885543Smrg grep -v "^: " < "$nlist" > "$nlist"S 468709885543Smrg fi 468809885543Smrg 468909885543Smrg if test -f "$nlist"S; then 469009885543Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 469109885543Smrg else 469209885543Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 469309885543Smrg fi 469409885543Smrg 469509885543Smrg $echo >> "$output_objdir/$dlsyms" "\ 469609885543Smrg 469709885543Smrg#undef lt_preloaded_symbols 469809885543Smrg 469909885543Smrg#if defined (__STDC__) && __STDC__ 470009885543Smrg# define lt_ptr void * 470109885543Smrg#else 470209885543Smrg# define lt_ptr char * 470309885543Smrg# define const 470409885543Smrg#endif 470509885543Smrg 470609885543Smrg/* The mapping between symbol names and symbols. */ 470709885543Smrg" 470809885543Smrg 470909885543Smrg case $host in 471009885543Smrg *cygwin* | *mingw* ) 471109885543Smrg $echo >> "$output_objdir/$dlsyms" "\ 471209885543Smrg/* DATA imports from DLLs on WIN32 can't be const, because 471309885543Smrg runtime relocations are performed -- see ld's documentation 471409885543Smrg on pseudo-relocs */ 471509885543Smrgstruct { 471609885543Smrg" 471709885543Smrg ;; 471809885543Smrg * ) 471909885543Smrg $echo >> "$output_objdir/$dlsyms" "\ 472009885543Smrgconst struct { 472109885543Smrg" 472209885543Smrg ;; 472309885543Smrg esac 472409885543Smrg 472509885543Smrg 472609885543Smrg $echo >> "$output_objdir/$dlsyms" "\ 472709885543Smrg const char *name; 472809885543Smrg lt_ptr address; 472909885543Smrg} 473009885543Smrglt_preloaded_symbols[] = 473109885543Smrg{\ 473209885543Smrg" 473309885543Smrg 473409885543Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 473509885543Smrg 473609885543Smrg $echo >> "$output_objdir/$dlsyms" "\ 473709885543Smrg {0, (lt_ptr) 0} 473809885543Smrg}; 473909885543Smrg 474009885543Smrg/* This works around a problem in FreeBSD linker */ 474109885543Smrg#ifdef FREEBSD_WORKAROUND 474209885543Smrgstatic const void *lt_preloaded_setup() { 474309885543Smrg return lt_preloaded_symbols; 474409885543Smrg} 474509885543Smrg#endif 474609885543Smrg 474709885543Smrg#ifdef __cplusplus 474809885543Smrg} 474909885543Smrg#endif\ 475009885543Smrg" 475109885543Smrg fi 475209885543Smrg 475309885543Smrg pic_flag_for_symtable= 475409885543Smrg case $host in 475509885543Smrg # compiling the symbol table file with pic_flag works around 475609885543Smrg # a FreeBSD bug that causes programs to crash when -lm is 475709885543Smrg # linked before any other PIC object. But we must not use 475809885543Smrg # pic_flag when linking with -static. The problem exists in 475909885543Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 476009885543Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 476109885543Smrg case "$compile_command " in 476209885543Smrg *" -static "*) ;; 476309885543Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 476409885543Smrg esac;; 476509885543Smrg *-*-hpux*) 476609885543Smrg case "$compile_command " in 476709885543Smrg *" -static "*) ;; 476809885543Smrg *) pic_flag_for_symtable=" $pic_flag";; 476909885543Smrg esac 477009885543Smrg esac 477109885543Smrg 477209885543Smrg # Now compile the dynamic symbol file. 477309885543Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 477409885543Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 477509885543Smrg 477609885543Smrg # Clean up the generated files. 477709885543Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 477809885543Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 477909885543Smrg 478009885543Smrg # Transform the symbol file into the correct name. 478109885543Smrg case $host in 478209885543Smrg *cygwin* | *mingw* ) 478309885543Smrg if test -f "$output_objdir/${outputname}.def" ; then 47847104f784Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47857104f784Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 478609885543Smrg else 47877104f784Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47887104f784Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 478909885543Smrg fi 479009885543Smrg ;; 479109885543Smrg * ) 47927104f784Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47937104f784Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 479409885543Smrg ;; 479509885543Smrg esac 479609885543Smrg ;; 479709885543Smrg *) 479809885543Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 479909885543Smrg exit $EXIT_FAILURE 480009885543Smrg ;; 480109885543Smrg esac 480209885543Smrg else 480309885543Smrg # We keep going just in case the user didn't refer to 480409885543Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 480509885543Smrg # really was required. 480609885543Smrg 480709885543Smrg # Nullify the symbol file. 48087104f784Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 48097104f784Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 481009885543Smrg fi 481109885543Smrg 481209885543Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 481309885543Smrg # Replace the output file specification. 48147104f784Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 481509885543Smrg link_command="$compile_command$compile_rpath" 481609885543Smrg 481709885543Smrg # We have no uninstalled library dependencies, so finalize right now. 481809885543Smrg $show "$link_command" 481909885543Smrg $run eval "$link_command" 482009885543Smrg exit_status=$? 482109885543Smrg 482209885543Smrg # Delete the generated files. 482309885543Smrg if test -n "$dlsyms"; then 482409885543Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 482509885543Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 482609885543Smrg fi 482709885543Smrg 482809885543Smrg exit $exit_status 482909885543Smrg fi 483009885543Smrg 483109885543Smrg if test -n "$shlibpath_var"; then 483209885543Smrg # We should set the shlibpath_var 483309885543Smrg rpath= 483409885543Smrg for dir in $temp_rpath; do 483509885543Smrg case $dir in 483609885543Smrg [\\/]* | [A-Za-z]:[\\/]*) 483709885543Smrg # Absolute path. 483809885543Smrg rpath="$rpath$dir:" 483909885543Smrg ;; 484009885543Smrg *) 484109885543Smrg # Relative path: add a thisdir entry. 484209885543Smrg rpath="$rpath\$thisdir/$dir:" 484309885543Smrg ;; 484409885543Smrg esac 484509885543Smrg done 484609885543Smrg temp_rpath="$rpath" 484709885543Smrg fi 484809885543Smrg 484909885543Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 485009885543Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 485109885543Smrg fi 485209885543Smrg if test -n "$finalize_shlibpath"; then 485309885543Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 485409885543Smrg fi 485509885543Smrg 485609885543Smrg compile_var= 485709885543Smrg finalize_var= 485809885543Smrg if test -n "$runpath_var"; then 485909885543Smrg if test -n "$perm_rpath"; then 486009885543Smrg # We should set the runpath_var. 486109885543Smrg rpath= 486209885543Smrg for dir in $perm_rpath; do 486309885543Smrg rpath="$rpath$dir:" 486409885543Smrg done 486509885543Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 486609885543Smrg fi 486709885543Smrg if test -n "$finalize_perm_rpath"; then 486809885543Smrg # We should set the runpath_var. 486909885543Smrg rpath= 487009885543Smrg for dir in $finalize_perm_rpath; do 487109885543Smrg rpath="$rpath$dir:" 487209885543Smrg done 487309885543Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 487409885543Smrg fi 487509885543Smrg fi 487609885543Smrg 487709885543Smrg if test "$no_install" = yes; then 487809885543Smrg # We don't need to create a wrapper script. 487909885543Smrg link_command="$compile_var$compile_command$compile_rpath" 488009885543Smrg # Replace the output file specification. 488109885543Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 488209885543Smrg # Delete the old output file. 488309885543Smrg $run $rm $output 488409885543Smrg # Link the executable and exit 488509885543Smrg $show "$link_command" 488609885543Smrg $run eval "$link_command" || exit $? 488709885543Smrg exit $EXIT_SUCCESS 488809885543Smrg fi 488909885543Smrg 489009885543Smrg if test "$hardcode_action" = relink; then 489109885543Smrg # Fast installation is not supported 489209885543Smrg link_command="$compile_var$compile_command$compile_rpath" 489309885543Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 489409885543Smrg 489509885543Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 489609885543Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 489709885543Smrg else 489809885543Smrg if test "$fast_install" != no; then 489909885543Smrg link_command="$finalize_var$compile_command$finalize_rpath" 490009885543Smrg if test "$fast_install" = yes; then 49017104f784Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 490209885543Smrg else 490309885543Smrg # fast_install is set to needless 490409885543Smrg relink_command= 490509885543Smrg fi 490609885543Smrg else 490709885543Smrg link_command="$compile_var$compile_command$compile_rpath" 490809885543Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 490909885543Smrg fi 491009885543Smrg fi 491109885543Smrg 491209885543Smrg # Replace the output file specification. 491309885543Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 491409885543Smrg 491509885543Smrg # Delete the old output files. 491609885543Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 491709885543Smrg 491809885543Smrg $show "$link_command" 491909885543Smrg $run eval "$link_command" || exit $? 492009885543Smrg 492109885543Smrg # Now create the wrapper script. 492209885543Smrg $show "creating $output" 492309885543Smrg 492409885543Smrg # Quote the relink command for shipping. 492509885543Smrg if test -n "$relink_command"; then 492609885543Smrg # Preserve any variables that may affect compiler behavior 492709885543Smrg for var in $variables_saved_for_relink; do 492809885543Smrg if eval test -z \"\${$var+set}\"; then 492909885543Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 493009885543Smrg elif eval var_value=\$$var; test -z "$var_value"; then 493109885543Smrg relink_command="$var=; export $var; $relink_command" 493209885543Smrg else 493309885543Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 493409885543Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 493509885543Smrg fi 493609885543Smrg done 493709885543Smrg relink_command="(cd `pwd`; $relink_command)" 49387104f784Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 493909885543Smrg fi 494009885543Smrg 494109885543Smrg # Quote $echo for shipping. 494209885543Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 494309885543Smrg case $progpath in 494409885543Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 494509885543Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 494609885543Smrg esac 494709885543Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 494809885543Smrg else 494909885543Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 495009885543Smrg fi 495109885543Smrg 495209885543Smrg # Only actually do things if our run command is non-null. 495309885543Smrg if test -z "$run"; then 495409885543Smrg # win32 will think the script is a binary if it has 495509885543Smrg # a .exe suffix, so we strip it off here. 495609885543Smrg case $output in 495709885543Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 495809885543Smrg esac 495909885543Smrg # test for cygwin because mv fails w/o .exe extensions 496009885543Smrg case $host in 496109885543Smrg *cygwin*) 496209885543Smrg exeext=.exe 496309885543Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 496409885543Smrg *) exeext= ;; 496509885543Smrg esac 496609885543Smrg case $host in 496709885543Smrg *cygwin* | *mingw* ) 496809885543Smrg output_name=`basename $output` 496909885543Smrg output_path=`dirname $output` 497009885543Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 497109885543Smrg cwrapper="$output_path/$output_name.exe" 497209885543Smrg $rm $cwrappersource $cwrapper 497309885543Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 497409885543Smrg 497509885543Smrg cat > $cwrappersource <<EOF 497609885543Smrg 497709885543Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 497809885543Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 497909885543Smrg 498009885543Smrg The $output program cannot be directly executed until all the libtool 498109885543Smrg libraries that it depends on are installed. 498209885543Smrg 498309885543Smrg This wrapper executable should never be moved out of the build directory. 498409885543Smrg If it is, it will not operate correctly. 498509885543Smrg 498609885543Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 498709885543Smrg but could eventually absorb all of the scripts functionality and 498809885543Smrg exec $objdir/$outputname directly. 498909885543Smrg*/ 499009885543SmrgEOF 499109885543Smrg cat >> $cwrappersource<<"EOF" 499209885543Smrg#include <stdio.h> 499309885543Smrg#include <stdlib.h> 499409885543Smrg#include <unistd.h> 499509885543Smrg#include <malloc.h> 499609885543Smrg#include <stdarg.h> 499709885543Smrg#include <assert.h> 499809885543Smrg#include <string.h> 499909885543Smrg#include <ctype.h> 500009885543Smrg#include <sys/stat.h> 500109885543Smrg 500209885543Smrg#if defined(PATH_MAX) 500309885543Smrg# define LT_PATHMAX PATH_MAX 500409885543Smrg#elif defined(MAXPATHLEN) 500509885543Smrg# define LT_PATHMAX MAXPATHLEN 500609885543Smrg#else 500709885543Smrg# define LT_PATHMAX 1024 500809885543Smrg#endif 500909885543Smrg 501009885543Smrg#ifndef DIR_SEPARATOR 501109885543Smrg# define DIR_SEPARATOR '/' 501209885543Smrg# define PATH_SEPARATOR ':' 501309885543Smrg#endif 501409885543Smrg 501509885543Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 501609885543Smrg defined (__OS2__) 501709885543Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 501809885543Smrg# ifndef DIR_SEPARATOR_2 501909885543Smrg# define DIR_SEPARATOR_2 '\\' 502009885543Smrg# endif 502109885543Smrg# ifndef PATH_SEPARATOR_2 502209885543Smrg# define PATH_SEPARATOR_2 ';' 502309885543Smrg# endif 502409885543Smrg#endif 502509885543Smrg 502609885543Smrg#ifndef DIR_SEPARATOR_2 502709885543Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 502809885543Smrg#else /* DIR_SEPARATOR_2 */ 502909885543Smrg# define IS_DIR_SEPARATOR(ch) \ 503009885543Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 503109885543Smrg#endif /* DIR_SEPARATOR_2 */ 503209885543Smrg 503309885543Smrg#ifndef PATH_SEPARATOR_2 503409885543Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 503509885543Smrg#else /* PATH_SEPARATOR_2 */ 503609885543Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 503709885543Smrg#endif /* PATH_SEPARATOR_2 */ 503809885543Smrg 503909885543Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 504009885543Smrg#define XFREE(stale) do { \ 504109885543Smrg if (stale) { free ((void *) stale); stale = 0; } \ 504209885543Smrg} while (0) 504309885543Smrg 504409885543Smrg/* -DDEBUG is fairly common in CFLAGS. */ 504509885543Smrg#undef DEBUG 504609885543Smrg#if defined DEBUGWRAPPER 504709885543Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 504809885543Smrg#else 504909885543Smrg# define DEBUG(format, ...) 505009885543Smrg#endif 505109885543Smrg 505209885543Smrgconst char *program_name = NULL; 505309885543Smrg 505409885543Smrgvoid * xmalloc (size_t num); 505509885543Smrgchar * xstrdup (const char *string); 505609885543Smrgconst char * base_name (const char *name); 505709885543Smrgchar * find_executable(const char *wrapper); 505809885543Smrgint check_executable(const char *path); 505909885543Smrgchar * strendzap(char *str, const char *pat); 506009885543Smrgvoid lt_fatal (const char *message, ...); 506109885543Smrg 506209885543Smrgint 506309885543Smrgmain (int argc, char *argv[]) 506409885543Smrg{ 506509885543Smrg char **newargz; 506609885543Smrg int i; 506709885543Smrg 506809885543Smrg program_name = (char *) xstrdup (base_name (argv[0])); 506909885543Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 507009885543Smrg DEBUG("(main) program_name : %s\n",program_name); 507109885543Smrg newargz = XMALLOC(char *, argc+2); 507209885543SmrgEOF 507309885543Smrg 507409885543Smrg cat >> $cwrappersource <<EOF 507509885543Smrg newargz[0] = (char *) xstrdup("$SHELL"); 507609885543SmrgEOF 507709885543Smrg 507809885543Smrg cat >> $cwrappersource <<"EOF" 507909885543Smrg newargz[1] = find_executable(argv[0]); 508009885543Smrg if (newargz[1] == NULL) 508109885543Smrg lt_fatal("Couldn't find %s", argv[0]); 508209885543Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 508309885543Smrg /* we know the script has the same name, without the .exe */ 508409885543Smrg /* so make sure newargz[1] doesn't end in .exe */ 508509885543Smrg strendzap(newargz[1],".exe"); 508609885543Smrg for (i = 1; i < argc; i++) 508709885543Smrg newargz[i+1] = xstrdup(argv[i]); 508809885543Smrg newargz[argc+1] = NULL; 508909885543Smrg 509009885543Smrg for (i=0; i<argc+1; i++) 509109885543Smrg { 509209885543Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 509309885543Smrg ; 509409885543Smrg } 509509885543Smrg 509609885543SmrgEOF 509709885543Smrg 509809885543Smrg case $host_os in 509909885543Smrg mingw*) 510009885543Smrg cat >> $cwrappersource <<EOF 510109885543Smrg execv("$SHELL",(char const **)newargz); 510209885543SmrgEOF 510309885543Smrg ;; 510409885543Smrg *) 510509885543Smrg cat >> $cwrappersource <<EOF 510609885543Smrg execv("$SHELL",newargz); 510709885543SmrgEOF 510809885543Smrg ;; 510909885543Smrg esac 511009885543Smrg 511109885543Smrg cat >> $cwrappersource <<"EOF" 511209885543Smrg return 127; 511309885543Smrg} 511409885543Smrg 511509885543Smrgvoid * 511609885543Smrgxmalloc (size_t num) 511709885543Smrg{ 511809885543Smrg void * p = (void *) malloc (num); 511909885543Smrg if (!p) 512009885543Smrg lt_fatal ("Memory exhausted"); 512109885543Smrg 512209885543Smrg return p; 512309885543Smrg} 512409885543Smrg 512509885543Smrgchar * 512609885543Smrgxstrdup (const char *string) 512709885543Smrg{ 512809885543Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 512909885543Smrg; 513009885543Smrg} 513109885543Smrg 513209885543Smrgconst char * 513309885543Smrgbase_name (const char *name) 513409885543Smrg{ 513509885543Smrg const char *base; 513609885543Smrg 513709885543Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 513809885543Smrg /* Skip over the disk name in MSDOS pathnames. */ 513909885543Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 514009885543Smrg name += 2; 514109885543Smrg#endif 514209885543Smrg 514309885543Smrg for (base = name; *name; name++) 514409885543Smrg if (IS_DIR_SEPARATOR (*name)) 514509885543Smrg base = name + 1; 514609885543Smrg return base; 514709885543Smrg} 514809885543Smrg 514909885543Smrgint 515009885543Smrgcheck_executable(const char * path) 515109885543Smrg{ 515209885543Smrg struct stat st; 515309885543Smrg 515409885543Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 515509885543Smrg if ((!path) || (!*path)) 515609885543Smrg return 0; 515709885543Smrg 515809885543Smrg if ((stat (path, &st) >= 0) && 515909885543Smrg ( 516009885543Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 516109885543Smrg#if defined (S_IXOTH) 516209885543Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 516309885543Smrg#endif 516409885543Smrg#if defined (S_IXGRP) 516509885543Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 516609885543Smrg#endif 516709885543Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 516809885543Smrg ) 516909885543Smrg return 1; 517009885543Smrg else 517109885543Smrg return 0; 517209885543Smrg} 517309885543Smrg 517409885543Smrg/* Searches for the full path of the wrapper. Returns 517509885543Smrg newly allocated full path name if found, NULL otherwise */ 517609885543Smrgchar * 517709885543Smrgfind_executable (const char* wrapper) 517809885543Smrg{ 517909885543Smrg int has_slash = 0; 518009885543Smrg const char* p; 518109885543Smrg const char* p_next; 518209885543Smrg /* static buffer for getcwd */ 518309885543Smrg char tmp[LT_PATHMAX + 1]; 518409885543Smrg int tmp_len; 518509885543Smrg char* concat_name; 518609885543Smrg 518709885543Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 518809885543Smrg 518909885543Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 519009885543Smrg return NULL; 519109885543Smrg 519209885543Smrg /* Absolute path? */ 519309885543Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 519409885543Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 519509885543Smrg { 519609885543Smrg concat_name = xstrdup (wrapper); 519709885543Smrg if (check_executable(concat_name)) 519809885543Smrg return concat_name; 519909885543Smrg XFREE(concat_name); 520009885543Smrg } 520109885543Smrg else 520209885543Smrg { 520309885543Smrg#endif 520409885543Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 520509885543Smrg { 520609885543Smrg concat_name = xstrdup (wrapper); 520709885543Smrg if (check_executable(concat_name)) 520809885543Smrg return concat_name; 520909885543Smrg XFREE(concat_name); 521009885543Smrg } 521109885543Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 521209885543Smrg } 521309885543Smrg#endif 521409885543Smrg 521509885543Smrg for (p = wrapper; *p; p++) 521609885543Smrg if (*p == '/') 521709885543Smrg { 521809885543Smrg has_slash = 1; 521909885543Smrg break; 522009885543Smrg } 522109885543Smrg if (!has_slash) 522209885543Smrg { 522309885543Smrg /* no slashes; search PATH */ 522409885543Smrg const char* path = getenv ("PATH"); 522509885543Smrg if (path != NULL) 522609885543Smrg { 522709885543Smrg for (p = path; *p; p = p_next) 522809885543Smrg { 522909885543Smrg const char* q; 523009885543Smrg size_t p_len; 523109885543Smrg for (q = p; *q; q++) 523209885543Smrg if (IS_PATH_SEPARATOR(*q)) 523309885543Smrg break; 523409885543Smrg p_len = q - p; 523509885543Smrg p_next = (*q == '\0' ? q : q + 1); 523609885543Smrg if (p_len == 0) 523709885543Smrg { 523809885543Smrg /* empty path: current directory */ 523909885543Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 524009885543Smrg lt_fatal ("getcwd failed"); 524109885543Smrg tmp_len = strlen(tmp); 524209885543Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 524309885543Smrg memcpy (concat_name, tmp, tmp_len); 524409885543Smrg concat_name[tmp_len] = '/'; 524509885543Smrg strcpy (concat_name + tmp_len + 1, wrapper); 524609885543Smrg } 524709885543Smrg else 524809885543Smrg { 524909885543Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 525009885543Smrg memcpy (concat_name, p, p_len); 525109885543Smrg concat_name[p_len] = '/'; 525209885543Smrg strcpy (concat_name + p_len + 1, wrapper); 525309885543Smrg } 525409885543Smrg if (check_executable(concat_name)) 525509885543Smrg return concat_name; 525609885543Smrg XFREE(concat_name); 525709885543Smrg } 525809885543Smrg } 525909885543Smrg /* not found in PATH; assume curdir */ 526009885543Smrg } 526109885543Smrg /* Relative path | not found in path: prepend cwd */ 526209885543Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 526309885543Smrg lt_fatal ("getcwd failed"); 526409885543Smrg tmp_len = strlen(tmp); 526509885543Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 526609885543Smrg memcpy (concat_name, tmp, tmp_len); 526709885543Smrg concat_name[tmp_len] = '/'; 526809885543Smrg strcpy (concat_name + tmp_len + 1, wrapper); 526909885543Smrg 527009885543Smrg if (check_executable(concat_name)) 527109885543Smrg return concat_name; 527209885543Smrg XFREE(concat_name); 527309885543Smrg return NULL; 527409885543Smrg} 527509885543Smrg 527609885543Smrgchar * 527709885543Smrgstrendzap(char *str, const char *pat) 527809885543Smrg{ 527909885543Smrg size_t len, patlen; 528009885543Smrg 528109885543Smrg assert(str != NULL); 528209885543Smrg assert(pat != NULL); 528309885543Smrg 528409885543Smrg len = strlen(str); 528509885543Smrg patlen = strlen(pat); 528609885543Smrg 528709885543Smrg if (patlen <= len) 528809885543Smrg { 528909885543Smrg str += len - patlen; 529009885543Smrg if (strcmp(str, pat) == 0) 529109885543Smrg *str = '\0'; 529209885543Smrg } 529309885543Smrg return str; 529409885543Smrg} 529509885543Smrg 529609885543Smrgstatic void 529709885543Smrglt_error_core (int exit_status, const char * mode, 529809885543Smrg const char * message, va_list ap) 529909885543Smrg{ 530009885543Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 530109885543Smrg vfprintf (stderr, message, ap); 530209885543Smrg fprintf (stderr, ".\n"); 530309885543Smrg 530409885543Smrg if (exit_status >= 0) 530509885543Smrg exit (exit_status); 530609885543Smrg} 530709885543Smrg 530809885543Smrgvoid 530909885543Smrglt_fatal (const char *message, ...) 531009885543Smrg{ 531109885543Smrg va_list ap; 531209885543Smrg va_start (ap, message); 531309885543Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 531409885543Smrg va_end (ap); 531509885543Smrg} 531609885543SmrgEOF 531709885543Smrg # we should really use a build-platform specific compiler 531809885543Smrg # here, but OTOH, the wrappers (shell script and this C one) 531909885543Smrg # are only useful if you want to execute the "real" binary. 532009885543Smrg # Since the "real" binary is built for $host, then this 532109885543Smrg # wrapper might as well be built for $host, too. 532209885543Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 532309885543Smrg ;; 532409885543Smrg esac 532509885543Smrg $rm $output 532609885543Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 532709885543Smrg 532809885543Smrg $echo > $output "\ 532909885543Smrg#! $SHELL 533009885543Smrg 533109885543Smrg# $output - temporary wrapper script for $objdir/$outputname 533209885543Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 533309885543Smrg# 533409885543Smrg# The $output program cannot be directly executed until all the libtool 533509885543Smrg# libraries that it depends on are installed. 533609885543Smrg# 533709885543Smrg# This wrapper script should never be moved out of the build directory. 533809885543Smrg# If it is, it will not operate correctly. 533909885543Smrg 534009885543Smrg# Sed substitution that helps us do robust quoting. It backslashifies 534109885543Smrg# metacharacters that are still active within double-quoted strings. 534209885543SmrgXsed='${SED} -e 1s/^X//' 534309885543Smrgsed_quote_subst='$sed_quote_subst' 534409885543Smrg 53457104f784Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53467104f784Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 53477104f784Smrg emulate sh 53487104f784Smrg NULLCMD=: 53497104f784Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 53507104f784Smrg # is contrary to our usage. Disable this feature. 53517104f784Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 53527104f784Smrg setopt NO_GLOB_SUBST 53537104f784Smrgelse 53547104f784Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 53557104f784Smrgfi 53567104f784SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 53577104f784SmrgDUALCASE=1; export DUALCASE # for MKS sh 53587104f784Smrg 535909885543Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 536009885543Smrg# if CDPATH is set. 536109885543Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 536209885543Smrg 536309885543Smrgrelink_command=\"$relink_command\" 536409885543Smrg 536509885543Smrg# This environment variable determines our operation mode. 536609885543Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 536709885543Smrg # install mode needs the following variable: 536809885543Smrg notinst_deplibs='$notinst_deplibs' 536909885543Smrgelse 537009885543Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 537109885543Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 537209885543Smrg echo=\"$qecho\" 537309885543Smrg file=\"\$0\" 537409885543Smrg # Make sure echo works. 537509885543Smrg if test \"X\$1\" = X--no-reexec; then 537609885543Smrg # Discard the --no-reexec flag, and continue. 537709885543Smrg shift 537809885543Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 537909885543Smrg # Yippee, \$echo works! 538009885543Smrg : 538109885543Smrg else 538209885543Smrg # Restart under the correct shell, and then maybe \$echo will work. 538309885543Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 538409885543Smrg fi 538509885543Smrg fi\ 538609885543Smrg" 538709885543Smrg $echo >> $output "\ 538809885543Smrg 538909885543Smrg # Find the directory that this script lives in. 539009885543Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 539109885543Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 539209885543Smrg 539309885543Smrg # Follow symbolic links until we get to the real thisdir. 539409885543Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 539509885543Smrg while test -n \"\$file\"; do 539609885543Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 539709885543Smrg 539809885543Smrg # If there was a directory component, then change thisdir. 539909885543Smrg if test \"x\$destdir\" != \"x\$file\"; then 540009885543Smrg case \"\$destdir\" in 540109885543Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 540209885543Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 540309885543Smrg esac 540409885543Smrg fi 540509885543Smrg 540609885543Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 540709885543Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 540809885543Smrg done 540909885543Smrg 541009885543Smrg # Try to get the absolute directory name. 541109885543Smrg absdir=\`cd \"\$thisdir\" && pwd\` 541209885543Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 541309885543Smrg" 541409885543Smrg 541509885543Smrg if test "$fast_install" = yes; then 541609885543Smrg $echo >> $output "\ 541709885543Smrg program=lt-'$outputname'$exeext 541809885543Smrg progdir=\"\$thisdir/$objdir\" 541909885543Smrg 542009885543Smrg if test ! -f \"\$progdir/\$program\" || \\ 542109885543Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 542209885543Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 542309885543Smrg 542409885543Smrg file=\"\$\$-\$program\" 542509885543Smrg 542609885543Smrg if test ! -d \"\$progdir\"; then 542709885543Smrg $mkdir \"\$progdir\" 542809885543Smrg else 542909885543Smrg $rm \"\$progdir/\$file\" 543009885543Smrg fi" 543109885543Smrg 543209885543Smrg $echo >> $output "\ 543309885543Smrg 543409885543Smrg # relink executable if necessary 543509885543Smrg if test -n \"\$relink_command\"; then 543609885543Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 543709885543Smrg else 543809885543Smrg $echo \"\$relink_command_output\" >&2 543909885543Smrg $rm \"\$progdir/\$file\" 544009885543Smrg exit $EXIT_FAILURE 544109885543Smrg fi 544209885543Smrg fi 544309885543Smrg 544409885543Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 544509885543Smrg { $rm \"\$progdir/\$program\"; 544609885543Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 544709885543Smrg $rm \"\$progdir/\$file\" 544809885543Smrg fi" 544909885543Smrg else 545009885543Smrg $echo >> $output "\ 545109885543Smrg program='$outputname' 545209885543Smrg progdir=\"\$thisdir/$objdir\" 545309885543Smrg" 545409885543Smrg fi 545509885543Smrg 545609885543Smrg $echo >> $output "\ 545709885543Smrg 545809885543Smrg if test -f \"\$progdir/\$program\"; then" 545909885543Smrg 546009885543Smrg # Export our shlibpath_var if we have one. 546109885543Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 546209885543Smrg $echo >> $output "\ 546309885543Smrg # Add our own library path to $shlibpath_var 546409885543Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 546509885543Smrg 546609885543Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 546709885543Smrg # The second colon is a workaround for a bug in BeOS R4 sed 546809885543Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 546909885543Smrg 547009885543Smrg export $shlibpath_var 547109885543Smrg" 547209885543Smrg fi 547309885543Smrg 547409885543Smrg # fixup the dll searchpath if we need to. 547509885543Smrg if test -n "$dllsearchpath"; then 547609885543Smrg $echo >> $output "\ 547709885543Smrg # Add the dll search path components to the executable PATH 547809885543Smrg PATH=$dllsearchpath:\$PATH 547909885543Smrg" 548009885543Smrg fi 548109885543Smrg 548209885543Smrg $echo >> $output "\ 548309885543Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 548409885543Smrg # Run the actual program with our arguments. 54857104f784Smrg 54867104f784Smrg # Make sure env LD_LIBRARY_PATH does not mess us up 54877104f784Smrg if test -n \"\${LD_LIBRARY_PATH+set}\"; then 54887104f784Smrg export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH 54897104f784Smrg fi 549009885543Smrg" 549109885543Smrg case $host in 549209885543Smrg # Backslashes separate directories on plain windows 549309885543Smrg *-*-mingw | *-*-os2*) 549409885543Smrg $echo >> $output "\ 549509885543Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 549609885543Smrg" 549709885543Smrg ;; 549809885543Smrg 549909885543Smrg *) 550009885543Smrg $echo >> $output "\ 550109885543Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 550209885543Smrg" 550309885543Smrg ;; 550409885543Smrg esac 550509885543Smrg $echo >> $output "\ 55067104f784Smrg \$echo \"\$0: cannot exec \$program \$*\" 550709885543Smrg exit $EXIT_FAILURE 550809885543Smrg fi 550909885543Smrg else 551009885543Smrg # The program doesn't exist. 551109885543Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 551209885543Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 551309885543Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 551409885543Smrg exit $EXIT_FAILURE 551509885543Smrg fi 551609885543Smrgfi\ 551709885543Smrg" 551809885543Smrg chmod +x $output 551909885543Smrg fi 552009885543Smrg exit $EXIT_SUCCESS 552109885543Smrg ;; 552209885543Smrg esac 552309885543Smrg 552409885543Smrg # See if we need to build an old-fashioned archive. 552509885543Smrg for oldlib in $oldlibs; do 552609885543Smrg 552709885543Smrg if test "$build_libtool_libs" = convenience; then 552809885543Smrg oldobjs="$libobjs_save" 552909885543Smrg addlibs="$convenience" 553009885543Smrg build_libtool_libs=no 553109885543Smrg else 553209885543Smrg if test "$build_libtool_libs" = module; then 553309885543Smrg oldobjs="$libobjs_save" 553409885543Smrg build_libtool_libs=no 553509885543Smrg else 553609885543Smrg oldobjs="$old_deplibs $non_pic_objects" 553709885543Smrg fi 553809885543Smrg addlibs="$old_convenience" 553909885543Smrg fi 554009885543Smrg 554109885543Smrg if test -n "$addlibs"; then 554209885543Smrg gentop="$output_objdir/${outputname}x" 554309885543Smrg generated="$generated $gentop" 554409885543Smrg 554509885543Smrg func_extract_archives $gentop $addlibs 554609885543Smrg oldobjs="$oldobjs $func_extract_archives_result" 554709885543Smrg fi 554809885543Smrg 554909885543Smrg # Do each command in the archive commands. 555009885543Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 555109885543Smrg cmds=$old_archive_from_new_cmds 555209885543Smrg else 555309885543Smrg # POSIX demands no paths to be encoded in archives. We have 555409885543Smrg # to avoid creating archives with duplicate basenames if we 555509885543Smrg # might have to extract them afterwards, e.g., when creating a 555609885543Smrg # static archive out of a convenience library, or when linking 555709885543Smrg # the entirety of a libtool archive into another (currently 555809885543Smrg # not supported by libtool). 555909885543Smrg if (for obj in $oldobjs 556009885543Smrg do 556109885543Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 556209885543Smrg done | sort | sort -uc >/dev/null 2>&1); then 556309885543Smrg : 556409885543Smrg else 556509885543Smrg $echo "copying selected object files to avoid basename conflicts..." 556609885543Smrg 556709885543Smrg if test -z "$gentop"; then 556809885543Smrg gentop="$output_objdir/${outputname}x" 556909885543Smrg generated="$generated $gentop" 557009885543Smrg 557109885543Smrg $show "${rm}r $gentop" 557209885543Smrg $run ${rm}r "$gentop" 557309885543Smrg $show "$mkdir $gentop" 557409885543Smrg $run $mkdir "$gentop" 557509885543Smrg exit_status=$? 557609885543Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 557709885543Smrg exit $exit_status 557809885543Smrg fi 557909885543Smrg fi 558009885543Smrg 558109885543Smrg save_oldobjs=$oldobjs 558209885543Smrg oldobjs= 558309885543Smrg counter=1 558409885543Smrg for obj in $save_oldobjs 558509885543Smrg do 558609885543Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 558709885543Smrg case " $oldobjs " in 558809885543Smrg " ") oldobjs=$obj ;; 558909885543Smrg *[\ /]"$objbase "*) 559009885543Smrg while :; do 559109885543Smrg # Make sure we don't pick an alternate name that also 559209885543Smrg # overlaps. 559309885543Smrg newobj=lt$counter-$objbase 559409885543Smrg counter=`expr $counter + 1` 559509885543Smrg case " $oldobjs " in 559609885543Smrg *[\ /]"$newobj "*) ;; 559709885543Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 559809885543Smrg esac 559909885543Smrg done 560009885543Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 560109885543Smrg $run ln "$obj" "$gentop/$newobj" || 560209885543Smrg $run cp "$obj" "$gentop/$newobj" 560309885543Smrg oldobjs="$oldobjs $gentop/$newobj" 560409885543Smrg ;; 560509885543Smrg *) oldobjs="$oldobjs $obj" ;; 560609885543Smrg esac 560709885543Smrg done 560809885543Smrg fi 560909885543Smrg 561009885543Smrg eval cmds=\"$old_archive_cmds\" 561109885543Smrg 561209885543Smrg if len=`expr "X$cmds" : ".*"` && 561309885543Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 561409885543Smrg cmds=$old_archive_cmds 561509885543Smrg else 561609885543Smrg # the command line is too long to link in one step, link in parts 561709885543Smrg $echo "using piecewise archive linking..." 561809885543Smrg save_RANLIB=$RANLIB 561909885543Smrg RANLIB=: 562009885543Smrg objlist= 562109885543Smrg concat_cmds= 562209885543Smrg save_oldobjs=$oldobjs 562309885543Smrg 562409885543Smrg # Is there a better way of finding the last object in the list? 562509885543Smrg for obj in $save_oldobjs 562609885543Smrg do 562709885543Smrg last_oldobj=$obj 562809885543Smrg done 562909885543Smrg for obj in $save_oldobjs 563009885543Smrg do 563109885543Smrg oldobjs="$objlist $obj" 563209885543Smrg objlist="$objlist $obj" 563309885543Smrg eval test_cmds=\"$old_archive_cmds\" 563409885543Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 563509885543Smrg test "$len" -le "$max_cmd_len"; then 563609885543Smrg : 563709885543Smrg else 563809885543Smrg # the above command should be used before it gets too long 563909885543Smrg oldobjs=$objlist 564009885543Smrg if test "$obj" = "$last_oldobj" ; then 564109885543Smrg RANLIB=$save_RANLIB 564209885543Smrg fi 564309885543Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 564409885543Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 564509885543Smrg objlist= 564609885543Smrg fi 564709885543Smrg done 564809885543Smrg RANLIB=$save_RANLIB 564909885543Smrg oldobjs=$objlist 565009885543Smrg if test "X$oldobjs" = "X" ; then 565109885543Smrg eval cmds=\"\$concat_cmds\" 565209885543Smrg else 565309885543Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 565409885543Smrg fi 565509885543Smrg fi 565609885543Smrg fi 565709885543Smrg save_ifs="$IFS"; IFS='~' 565809885543Smrg for cmd in $cmds; do 565909885543Smrg eval cmd=\"$cmd\" 566009885543Smrg IFS="$save_ifs" 566109885543Smrg $show "$cmd" 566209885543Smrg $run eval "$cmd" || exit $? 566309885543Smrg done 566409885543Smrg IFS="$save_ifs" 566509885543Smrg done 566609885543Smrg 566709885543Smrg if test -n "$generated"; then 566809885543Smrg $show "${rm}r$generated" 566909885543Smrg $run ${rm}r$generated 567009885543Smrg fi 567109885543Smrg 567209885543Smrg # Now create the libtool archive. 567309885543Smrg case $output in 567409885543Smrg *.la) 567509885543Smrg old_library= 567609885543Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 567709885543Smrg $show "creating $output" 567809885543Smrg 567909885543Smrg # Preserve any variables that may affect compiler behavior 568009885543Smrg for var in $variables_saved_for_relink; do 568109885543Smrg if eval test -z \"\${$var+set}\"; then 568209885543Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 568309885543Smrg elif eval var_value=\$$var; test -z "$var_value"; then 568409885543Smrg relink_command="$var=; export $var; $relink_command" 568509885543Smrg else 568609885543Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 568709885543Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 568809885543Smrg fi 568909885543Smrg done 569009885543Smrg # Quote the link command for shipping. 569109885543Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 56927104f784Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 569309885543Smrg if test "$hardcode_automatic" = yes ; then 569409885543Smrg relink_command= 569509885543Smrg fi 569609885543Smrg 569709885543Smrg 569809885543Smrg # Only create the output if not a dry run. 569909885543Smrg if test -z "$run"; then 570009885543Smrg for installed in no yes; do 570109885543Smrg if test "$installed" = yes; then 570209885543Smrg if test -z "$install_libdir"; then 570309885543Smrg break 570409885543Smrg fi 570509885543Smrg output="$output_objdir/$outputname"i 570609885543Smrg # Replace all uninstalled libtool libraries with the installed ones 570709885543Smrg newdependency_libs= 570809885543Smrg for deplib in $dependency_libs; do 570909885543Smrg case $deplib in 571009885543Smrg *.la) 571109885543Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 571209885543Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 571309885543Smrg if test -z "$libdir"; then 571409885543Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 571509885543Smrg exit $EXIT_FAILURE 571609885543Smrg fi 571709885543Smrg newdependency_libs="$newdependency_libs $libdir/$name" 571809885543Smrg ;; 571909885543Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 572009885543Smrg esac 572109885543Smrg done 572209885543Smrg dependency_libs="$newdependency_libs" 572309885543Smrg newdlfiles= 572409885543Smrg for lib in $dlfiles; do 572509885543Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 572609885543Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 572709885543Smrg if test -z "$libdir"; then 572809885543Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 572909885543Smrg exit $EXIT_FAILURE 573009885543Smrg fi 573109885543Smrg newdlfiles="$newdlfiles $libdir/$name" 573209885543Smrg done 573309885543Smrg dlfiles="$newdlfiles" 573409885543Smrg newdlprefiles= 573509885543Smrg for lib in $dlprefiles; do 573609885543Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 573709885543Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 573809885543Smrg if test -z "$libdir"; then 573909885543Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 574009885543Smrg exit $EXIT_FAILURE 574109885543Smrg fi 574209885543Smrg newdlprefiles="$newdlprefiles $libdir/$name" 574309885543Smrg done 574409885543Smrg dlprefiles="$newdlprefiles" 574509885543Smrg else 574609885543Smrg newdlfiles= 574709885543Smrg for lib in $dlfiles; do 574809885543Smrg case $lib in 574909885543Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 575009885543Smrg *) abs=`pwd`"/$lib" ;; 575109885543Smrg esac 575209885543Smrg newdlfiles="$newdlfiles $abs" 575309885543Smrg done 575409885543Smrg dlfiles="$newdlfiles" 575509885543Smrg newdlprefiles= 575609885543Smrg for lib in $dlprefiles; do 575709885543Smrg case $lib in 575809885543Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 575909885543Smrg *) abs=`pwd`"/$lib" ;; 576009885543Smrg esac 576109885543Smrg newdlprefiles="$newdlprefiles $abs" 576209885543Smrg done 576309885543Smrg dlprefiles="$newdlprefiles" 576409885543Smrg fi 576509885543Smrg $rm $output 576609885543Smrg # place dlname in correct position for cygwin 576709885543Smrg tdlname=$dlname 576809885543Smrg case $host,$output,$installed,$module,$dlname in 576909885543Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 577009885543Smrg esac 577109885543Smrg $echo > $output "\ 577209885543Smrg# $outputname - a libtool library file 577309885543Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 577409885543Smrg# 577509885543Smrg# Please DO NOT delete this file! 577609885543Smrg# It is necessary for linking the library. 577709885543Smrg 577809885543Smrg# The name that we can dlopen(3). 577909885543Smrgdlname='$tdlname' 578009885543Smrg 578109885543Smrg# Names of this library. 578209885543Smrglibrary_names='$library_names' 578309885543Smrg 578409885543Smrg# The name of the static archive. 578509885543Smrgold_library='$old_library' 578609885543Smrg 578709885543Smrg# Libraries that this one depends upon. 578809885543Smrgdependency_libs='$dependency_libs' 578909885543Smrg 579009885543Smrg# Version information for $libname. 579109885543Smrgcurrent=$current 579209885543Smrgage=$age 579309885543Smrgrevision=$revision 579409885543Smrg 579509885543Smrg# Is this an already installed library? 579609885543Smrginstalled=$installed 579709885543Smrg 579809885543Smrg# Should we warn about portability when linking against -modules? 579909885543Smrgshouldnotlink=$module 580009885543Smrg 580109885543Smrg# Files to dlopen/dlpreopen 580209885543Smrgdlopen='$dlfiles' 580309885543Smrgdlpreopen='$dlprefiles' 580409885543Smrg 580509885543Smrg# Directory that this library needs to be installed in: 580609885543Smrglibdir='$install_libdir'" 580709885543Smrg if test "$installed" = no && test "$need_relink" = yes; then 580809885543Smrg $echo >> $output "\ 580909885543Smrgrelink_command=\"$relink_command\"" 581009885543Smrg fi 581109885543Smrg done 581209885543Smrg fi 581309885543Smrg 581409885543Smrg # Do a symbolic link so that the libtool archive can be found in 581509885543Smrg # LD_LIBRARY_PATH before the program is installed. 581609885543Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 581709885543Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 581809885543Smrg ;; 581909885543Smrg esac 582009885543Smrg exit $EXIT_SUCCESS 582109885543Smrg ;; 582209885543Smrg 582309885543Smrg # libtool install mode 582409885543Smrg install) 582509885543Smrg modename="$modename: install" 582609885543Smrg 582709885543Smrg # There may be an optional sh(1) argument at the beginning of 582809885543Smrg # install_prog (especially on Windows NT). 582909885543Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 583009885543Smrg # Allow the use of GNU shtool's install command. 583109885543Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 583209885543Smrg # Aesthetically quote it. 583309885543Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 583409885543Smrg case $arg in 583509885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 583609885543Smrg arg="\"$arg\"" 583709885543Smrg ;; 583809885543Smrg esac 583909885543Smrg install_prog="$arg " 584009885543Smrg arg="$1" 584109885543Smrg shift 584209885543Smrg else 584309885543Smrg install_prog= 584409885543Smrg arg=$nonopt 584509885543Smrg fi 584609885543Smrg 584709885543Smrg # The real first argument should be the name of the installation program. 584809885543Smrg # Aesthetically quote it. 584909885543Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 585009885543Smrg case $arg in 585109885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 585209885543Smrg arg="\"$arg\"" 585309885543Smrg ;; 585409885543Smrg esac 585509885543Smrg install_prog="$install_prog$arg" 585609885543Smrg 585709885543Smrg # We need to accept at least all the BSD install flags. 585809885543Smrg dest= 585909885543Smrg files= 586009885543Smrg opts= 586109885543Smrg prev= 586209885543Smrg install_type= 586309885543Smrg isdir=no 586409885543Smrg stripme= 586509885543Smrg for arg 586609885543Smrg do 586709885543Smrg if test -n "$dest"; then 586809885543Smrg files="$files $dest" 586909885543Smrg dest=$arg 587009885543Smrg continue 587109885543Smrg fi 587209885543Smrg 587309885543Smrg case $arg in 587409885543Smrg -d) isdir=yes ;; 587509885543Smrg -f) 587609885543Smrg case " $install_prog " in 587709885543Smrg *[\\\ /]cp\ *) ;; 587809885543Smrg *) prev=$arg ;; 587909885543Smrg esac 588009885543Smrg ;; 588109885543Smrg -g | -m | -o) prev=$arg ;; 588209885543Smrg -s) 588309885543Smrg stripme=" -s" 588409885543Smrg continue 588509885543Smrg ;; 588609885543Smrg -*) 588709885543Smrg ;; 588809885543Smrg *) 588909885543Smrg # If the previous option needed an argument, then skip it. 589009885543Smrg if test -n "$prev"; then 589109885543Smrg prev= 589209885543Smrg else 589309885543Smrg dest=$arg 589409885543Smrg continue 589509885543Smrg fi 589609885543Smrg ;; 589709885543Smrg esac 589809885543Smrg 589909885543Smrg # Aesthetically quote the argument. 590009885543Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 590109885543Smrg case $arg in 590209885543Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 590309885543Smrg arg="\"$arg\"" 590409885543Smrg ;; 590509885543Smrg esac 590609885543Smrg install_prog="$install_prog $arg" 590709885543Smrg done 590809885543Smrg 590909885543Smrg if test -z "$install_prog"; then 591009885543Smrg $echo "$modename: you must specify an install program" 1>&2 591109885543Smrg $echo "$help" 1>&2 591209885543Smrg exit $EXIT_FAILURE 591309885543Smrg fi 591409885543Smrg 591509885543Smrg if test -n "$prev"; then 591609885543Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 591709885543Smrg $echo "$help" 1>&2 591809885543Smrg exit $EXIT_FAILURE 591909885543Smrg fi 592009885543Smrg 592109885543Smrg if test -z "$files"; then 592209885543Smrg if test -z "$dest"; then 592309885543Smrg $echo "$modename: no file or destination specified" 1>&2 592409885543Smrg else 592509885543Smrg $echo "$modename: you must specify a destination" 1>&2 592609885543Smrg fi 592709885543Smrg $echo "$help" 1>&2 592809885543Smrg exit $EXIT_FAILURE 592909885543Smrg fi 593009885543Smrg 593109885543Smrg # Strip any trailing slash from the destination. 593209885543Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 593309885543Smrg 593409885543Smrg # Check to see that the destination is a directory. 593509885543Smrg test -d "$dest" && isdir=yes 593609885543Smrg if test "$isdir" = yes; then 593709885543Smrg destdir="$dest" 593809885543Smrg destname= 593909885543Smrg else 594009885543Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 594109885543Smrg test "X$destdir" = "X$dest" && destdir=. 594209885543Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 594309885543Smrg 594409885543Smrg # Not a directory, so check to see that there is only one file specified. 594509885543Smrg set dummy $files 594609885543Smrg if test "$#" -gt 2; then 594709885543Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 594809885543Smrg $echo "$help" 1>&2 594909885543Smrg exit $EXIT_FAILURE 595009885543Smrg fi 595109885543Smrg fi 595209885543Smrg case $destdir in 595309885543Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 595409885543Smrg *) 595509885543Smrg for file in $files; do 595609885543Smrg case $file in 595709885543Smrg *.lo) ;; 595809885543Smrg *) 595909885543Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 596009885543Smrg $echo "$help" 1>&2 596109885543Smrg exit $EXIT_FAILURE 596209885543Smrg ;; 596309885543Smrg esac 596409885543Smrg done 596509885543Smrg ;; 596609885543Smrg esac 596709885543Smrg 596809885543Smrg # This variable tells wrapper scripts just to set variables rather 596909885543Smrg # than running their programs. 597009885543Smrg libtool_install_magic="$magic" 597109885543Smrg 597209885543Smrg staticlibs= 597309885543Smrg future_libdirs= 597409885543Smrg current_libdirs= 597509885543Smrg for file in $files; do 597609885543Smrg 597709885543Smrg # Do each installation. 597809885543Smrg case $file in 597909885543Smrg *.$libext) 598009885543Smrg # Do the static libraries later. 598109885543Smrg staticlibs="$staticlibs $file" 598209885543Smrg ;; 598309885543Smrg 598409885543Smrg *.la) 598509885543Smrg # Check to see that this really is a libtool archive. 598609885543Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 598709885543Smrg else 598809885543Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 598909885543Smrg $echo "$help" 1>&2 599009885543Smrg exit $EXIT_FAILURE 599109885543Smrg fi 599209885543Smrg 599309885543Smrg library_names= 599409885543Smrg old_library= 599509885543Smrg relink_command= 599609885543Smrg # If there is no directory component, then add one. 599709885543Smrg case $file in 599809885543Smrg */* | *\\*) . $file ;; 599909885543Smrg *) . ./$file ;; 600009885543Smrg esac 600109885543Smrg 600209885543Smrg # Add the libdir to current_libdirs if it is the destination. 600309885543Smrg if test "X$destdir" = "X$libdir"; then 600409885543Smrg case "$current_libdirs " in 600509885543Smrg *" $libdir "*) ;; 600609885543Smrg *) current_libdirs="$current_libdirs $libdir" ;; 600709885543Smrg esac 600809885543Smrg else 600909885543Smrg # Note the libdir as a future libdir. 601009885543Smrg case "$future_libdirs " in 601109885543Smrg *" $libdir "*) ;; 601209885543Smrg *) future_libdirs="$future_libdirs $libdir" ;; 601309885543Smrg esac 601409885543Smrg fi 601509885543Smrg 601609885543Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 601709885543Smrg test "X$dir" = "X$file/" && dir= 601809885543Smrg dir="$dir$objdir" 601909885543Smrg 602009885543Smrg if test -n "$relink_command"; then 602109885543Smrg # Determine the prefix the user has applied to our future dir. 602209885543Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 602309885543Smrg 602409885543Smrg # Don't allow the user to place us outside of our expected 602509885543Smrg # location b/c this prevents finding dependent libraries that 602609885543Smrg # are installed to the same prefix. 602709885543Smrg # At present, this check doesn't affect windows .dll's that 602809885543Smrg # are installed into $libdir/../bin (currently, that works fine) 602909885543Smrg # but it's something to keep an eye on. 603009885543Smrg if test "$inst_prefix_dir" = "$destdir"; then 603109885543Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 603209885543Smrg exit $EXIT_FAILURE 603309885543Smrg fi 603409885543Smrg 603509885543Smrg if test -n "$inst_prefix_dir"; then 603609885543Smrg # Stick the inst_prefix_dir data into the link command. 60377104f784Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 603809885543Smrg else 60397104f784Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 604009885543Smrg fi 604109885543Smrg 604209885543Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 604309885543Smrg $show "$relink_command" 604409885543Smrg if $run eval "$relink_command"; then : 604509885543Smrg else 604609885543Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 604709885543Smrg exit $EXIT_FAILURE 604809885543Smrg fi 604909885543Smrg fi 605009885543Smrg 605109885543Smrg # See the names of the shared library. 605209885543Smrg set dummy $library_names 605309885543Smrg if test -n "$2"; then 605409885543Smrg realname="$2" 605509885543Smrg shift 605609885543Smrg shift 605709885543Smrg 605809885543Smrg srcname="$realname" 605909885543Smrg test -n "$relink_command" && srcname="$realname"T 606009885543Smrg 606109885543Smrg # Install the shared library and build the symlinks. 606209885543Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 606309885543Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 606409885543Smrg if test -n "$stripme" && test -n "$striplib"; then 606509885543Smrg $show "$striplib $destdir/$realname" 606609885543Smrg $run eval "$striplib $destdir/$realname" || exit $? 606709885543Smrg fi 606809885543Smrg 606909885543Smrg if test "$#" -gt 0; then 607009885543Smrg # Delete the old symlinks, and create new ones. 607109885543Smrg # Try `ln -sf' first, because the `ln' binary might depend on 607209885543Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 607309885543Smrg # so we also need to try rm && ln -s. 607409885543Smrg for linkname 607509885543Smrg do 607609885543Smrg if test "$linkname" != "$realname"; then 607709885543Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 607809885543Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 607909885543Smrg fi 608009885543Smrg done 608109885543Smrg fi 608209885543Smrg 608309885543Smrg # Do each command in the postinstall commands. 608409885543Smrg lib="$destdir/$realname" 608509885543Smrg cmds=$postinstall_cmds 608609885543Smrg save_ifs="$IFS"; IFS='~' 608709885543Smrg for cmd in $cmds; do 608809885543Smrg IFS="$save_ifs" 608909885543Smrg eval cmd=\"$cmd\" 609009885543Smrg $show "$cmd" 609109885543Smrg $run eval "$cmd" || { 609209885543Smrg lt_exit=$? 609309885543Smrg 609409885543Smrg # Restore the uninstalled library and exit 609509885543Smrg if test "$mode" = relink; then 609609885543Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 609709885543Smrg fi 609809885543Smrg 609909885543Smrg exit $lt_exit 610009885543Smrg } 610109885543Smrg done 610209885543Smrg IFS="$save_ifs" 610309885543Smrg fi 610409885543Smrg 610509885543Smrg # Install the pseudo-library for information purposes. 610609885543Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 610709885543Smrg instname="$dir/$name"i 610809885543Smrg $show "$install_prog $instname $destdir/$name" 610909885543Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 611009885543Smrg 611109885543Smrg # Maybe install the static library, too. 611209885543Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 611309885543Smrg ;; 611409885543Smrg 611509885543Smrg *.lo) 611609885543Smrg # Install (i.e. copy) a libtool object. 611709885543Smrg 611809885543Smrg # Figure out destination file name, if it wasn't already specified. 611909885543Smrg if test -n "$destname"; then 612009885543Smrg destfile="$destdir/$destname" 612109885543Smrg else 612209885543Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 612309885543Smrg destfile="$destdir/$destfile" 612409885543Smrg fi 612509885543Smrg 612609885543Smrg # Deduce the name of the destination old-style object file. 612709885543Smrg case $destfile in 612809885543Smrg *.lo) 612909885543Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 613009885543Smrg ;; 613109885543Smrg *.$objext) 613209885543Smrg staticdest="$destfile" 613309885543Smrg destfile= 613409885543Smrg ;; 613509885543Smrg *) 613609885543Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 613709885543Smrg $echo "$help" 1>&2 613809885543Smrg exit $EXIT_FAILURE 613909885543Smrg ;; 614009885543Smrg esac 614109885543Smrg 614209885543Smrg # Install the libtool object if requested. 614309885543Smrg if test -n "$destfile"; then 614409885543Smrg $show "$install_prog $file $destfile" 614509885543Smrg $run eval "$install_prog $file $destfile" || exit $? 614609885543Smrg fi 614709885543Smrg 614809885543Smrg # Install the old object if enabled. 614909885543Smrg if test "$build_old_libs" = yes; then 615009885543Smrg # Deduce the name of the old-style object file. 615109885543Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 615209885543Smrg 615309885543Smrg $show "$install_prog $staticobj $staticdest" 615409885543Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 615509885543Smrg fi 615609885543Smrg exit $EXIT_SUCCESS 615709885543Smrg ;; 615809885543Smrg 615909885543Smrg *) 616009885543Smrg # Figure out destination file name, if it wasn't already specified. 616109885543Smrg if test -n "$destname"; then 616209885543Smrg destfile="$destdir/$destname" 616309885543Smrg else 616409885543Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 616509885543Smrg destfile="$destdir/$destfile" 616609885543Smrg fi 616709885543Smrg 616809885543Smrg # If the file is missing, and there is a .exe on the end, strip it 616909885543Smrg # because it is most likely a libtool script we actually want to 617009885543Smrg # install 617109885543Smrg stripped_ext="" 617209885543Smrg case $file in 617309885543Smrg *.exe) 617409885543Smrg if test ! -f "$file"; then 617509885543Smrg file=`$echo $file|${SED} 's,.exe$,,'` 617609885543Smrg stripped_ext=".exe" 617709885543Smrg fi 617809885543Smrg ;; 617909885543Smrg esac 618009885543Smrg 618109885543Smrg # Do a test to see if this is really a libtool program. 618209885543Smrg case $host in 618309885543Smrg *cygwin*|*mingw*) 618409885543Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 618509885543Smrg ;; 618609885543Smrg *) 618709885543Smrg wrapper=$file 618809885543Smrg ;; 618909885543Smrg esac 619009885543Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 619109885543Smrg notinst_deplibs= 619209885543Smrg relink_command= 619309885543Smrg 619409885543Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 619509885543Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 619609885543Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 619709885543Smrg # `FILE.' does not work on cygwin managed mounts. 619809885543Smrg # 619909885543Smrg # If there is no directory component, then add one. 620009885543Smrg case $wrapper in 620109885543Smrg */* | *\\*) . ${wrapper} ;; 620209885543Smrg *) . ./${wrapper} ;; 620309885543Smrg esac 620409885543Smrg 620509885543Smrg # Check the variables that should have been set. 620609885543Smrg if test -z "$notinst_deplibs"; then 620709885543Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 620809885543Smrg exit $EXIT_FAILURE 620909885543Smrg fi 621009885543Smrg 621109885543Smrg finalize=yes 621209885543Smrg for lib in $notinst_deplibs; do 621309885543Smrg # Check to see that each library is installed. 621409885543Smrg libdir= 621509885543Smrg if test -f "$lib"; then 621609885543Smrg # If there is no directory component, then add one. 621709885543Smrg case $lib in 621809885543Smrg */* | *\\*) . $lib ;; 621909885543Smrg *) . ./$lib ;; 622009885543Smrg esac 622109885543Smrg fi 622209885543Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 622309885543Smrg if test -n "$libdir" && test ! -f "$libfile"; then 622409885543Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 622509885543Smrg finalize=no 622609885543Smrg fi 622709885543Smrg done 622809885543Smrg 622909885543Smrg relink_command= 623009885543Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 623109885543Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 623209885543Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 623309885543Smrg # `FILE.' does not work on cygwin managed mounts. 623409885543Smrg # 623509885543Smrg # If there is no directory component, then add one. 623609885543Smrg case $wrapper in 623709885543Smrg */* | *\\*) . ${wrapper} ;; 623809885543Smrg *) . ./${wrapper} ;; 623909885543Smrg esac 624009885543Smrg 624109885543Smrg outputname= 624209885543Smrg if test "$fast_install" = no && test -n "$relink_command"; then 624309885543Smrg if test "$finalize" = yes && test -z "$run"; then 624409885543Smrg tmpdir=`func_mktempdir` 624509885543Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 624609885543Smrg outputname="$tmpdir/$file" 624709885543Smrg # Replace the output file specification. 62487104f784Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 624909885543Smrg 625009885543Smrg $show "$relink_command" 625109885543Smrg if $run eval "$relink_command"; then : 625209885543Smrg else 625309885543Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 625409885543Smrg ${rm}r "$tmpdir" 625509885543Smrg continue 625609885543Smrg fi 625709885543Smrg file="$outputname" 625809885543Smrg else 625909885543Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 626009885543Smrg fi 626109885543Smrg else 626209885543Smrg # Install the binary that we compiled earlier. 626309885543Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 626409885543Smrg fi 626509885543Smrg fi 626609885543Smrg 626709885543Smrg # remove .exe since cygwin /usr/bin/install will append another 626809885543Smrg # one anyway 626909885543Smrg case $install_prog,$host in 627009885543Smrg */usr/bin/install*,*cygwin*) 627109885543Smrg case $file:$destfile in 627209885543Smrg *.exe:*.exe) 627309885543Smrg # this is ok 627409885543Smrg ;; 627509885543Smrg *.exe:*) 627609885543Smrg destfile=$destfile.exe 627709885543Smrg ;; 627809885543Smrg *:*.exe) 627909885543Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 628009885543Smrg ;; 628109885543Smrg esac 628209885543Smrg ;; 628309885543Smrg esac 628409885543Smrg $show "$install_prog$stripme $file $destfile" 628509885543Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 628609885543Smrg test -n "$outputname" && ${rm}r "$tmpdir" 628709885543Smrg ;; 628809885543Smrg esac 628909885543Smrg done 629009885543Smrg 629109885543Smrg for file in $staticlibs; do 629209885543Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 629309885543Smrg 629409885543Smrg # Set up the ranlib parameters. 629509885543Smrg oldlib="$destdir/$name" 629609885543Smrg 629709885543Smrg $show "$install_prog $file $oldlib" 629809885543Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 629909885543Smrg 630009885543Smrg if test -n "$stripme" && test -n "$old_striplib"; then 630109885543Smrg $show "$old_striplib $oldlib" 630209885543Smrg $run eval "$old_striplib $oldlib" || exit $? 630309885543Smrg fi 630409885543Smrg 630509885543Smrg # Do each command in the postinstall commands. 630609885543Smrg cmds=$old_postinstall_cmds 630709885543Smrg save_ifs="$IFS"; IFS='~' 630809885543Smrg for cmd in $cmds; do 630909885543Smrg IFS="$save_ifs" 631009885543Smrg eval cmd=\"$cmd\" 631109885543Smrg $show "$cmd" 631209885543Smrg $run eval "$cmd" || exit $? 631309885543Smrg done 631409885543Smrg IFS="$save_ifs" 631509885543Smrg done 631609885543Smrg 631709885543Smrg if test -n "$future_libdirs"; then 631809885543Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 631909885543Smrg fi 632009885543Smrg 632109885543Smrg if test -n "$current_libdirs"; then 632209885543Smrg # Maybe just do a dry run. 632309885543Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 632409885543Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 632509885543Smrg else 632609885543Smrg exit $EXIT_SUCCESS 632709885543Smrg fi 632809885543Smrg ;; 632909885543Smrg 633009885543Smrg # libtool finish mode 633109885543Smrg finish) 633209885543Smrg modename="$modename: finish" 633309885543Smrg libdirs="$nonopt" 633409885543Smrg admincmds= 633509885543Smrg 633609885543Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 633709885543Smrg for dir 633809885543Smrg do 633909885543Smrg libdirs="$libdirs $dir" 634009885543Smrg done 634109885543Smrg 634209885543Smrg for libdir in $libdirs; do 634309885543Smrg if test -n "$finish_cmds"; then 634409885543Smrg # Do each command in the finish commands. 634509885543Smrg cmds=$finish_cmds 634609885543Smrg save_ifs="$IFS"; IFS='~' 634709885543Smrg for cmd in $cmds; do 634809885543Smrg IFS="$save_ifs" 634909885543Smrg eval cmd=\"$cmd\" 635009885543Smrg $show "$cmd" 635109885543Smrg $run eval "$cmd" || admincmds="$admincmds 635209885543Smrg $cmd" 635309885543Smrg done 635409885543Smrg IFS="$save_ifs" 635509885543Smrg fi 635609885543Smrg if test -n "$finish_eval"; then 635709885543Smrg # Do the single finish_eval. 635809885543Smrg eval cmds=\"$finish_eval\" 635909885543Smrg $run eval "$cmds" || admincmds="$admincmds 636009885543Smrg $cmds" 636109885543Smrg fi 636209885543Smrg done 636309885543Smrg fi 636409885543Smrg 636509885543Smrg # Exit here if they wanted silent mode. 636609885543Smrg test "$show" = : && exit $EXIT_SUCCESS 636709885543Smrg 636809885543Smrg $echo "X----------------------------------------------------------------------" | $Xsed 636909885543Smrg $echo "Libraries have been installed in:" 637009885543Smrg for libdir in $libdirs; do 637109885543Smrg $echo " $libdir" 637209885543Smrg done 637309885543Smrg $echo 637409885543Smrg $echo "If you ever happen to want to link against installed libraries" 637509885543Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 637609885543Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 637709885543Smrg $echo "flag during linking and do at least one of the following:" 637809885543Smrg if test -n "$shlibpath_var"; then 637909885543Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 638009885543Smrg $echo " during execution" 638109885543Smrg fi 638209885543Smrg if test -n "$runpath_var"; then 638309885543Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 638409885543Smrg $echo " during linking" 638509885543Smrg fi 638609885543Smrg if test -n "$hardcode_libdir_flag_spec"; then 638709885543Smrg libdir=LIBDIR 638809885543Smrg eval flag=\"$hardcode_libdir_flag_spec\" 638909885543Smrg 639009885543Smrg $echo " - use the \`$flag' linker flag" 639109885543Smrg fi 639209885543Smrg if test -n "$admincmds"; then 639309885543Smrg $echo " - have your system administrator run these commands:$admincmds" 639409885543Smrg fi 639509885543Smrg if test -f /etc/ld.so.conf; then 639609885543Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 639709885543Smrg fi 639809885543Smrg $echo 639909885543Smrg $echo "See any operating system documentation about shared libraries for" 640009885543Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 640109885543Smrg $echo "X----------------------------------------------------------------------" | $Xsed 640209885543Smrg exit $EXIT_SUCCESS 640309885543Smrg ;; 640409885543Smrg 640509885543Smrg # libtool execute mode 640609885543Smrg execute) 640709885543Smrg modename="$modename: execute" 640809885543Smrg 640909885543Smrg # The first argument is the command name. 641009885543Smrg cmd="$nonopt" 641109885543Smrg if test -z "$cmd"; then 641209885543Smrg $echo "$modename: you must specify a COMMAND" 1>&2 641309885543Smrg $echo "$help" 641409885543Smrg exit $EXIT_FAILURE 641509885543Smrg fi 641609885543Smrg 641709885543Smrg # Handle -dlopen flags immediately. 641809885543Smrg for file in $execute_dlfiles; do 641909885543Smrg if test ! -f "$file"; then 642009885543Smrg $echo "$modename: \`$file' is not a file" 1>&2 642109885543Smrg $echo "$help" 1>&2 642209885543Smrg exit $EXIT_FAILURE 642309885543Smrg fi 642409885543Smrg 642509885543Smrg dir= 642609885543Smrg case $file in 642709885543Smrg *.la) 642809885543Smrg # Check to see that this really is a libtool archive. 642909885543Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 643009885543Smrg else 643109885543Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 643209885543Smrg $echo "$help" 1>&2 643309885543Smrg exit $EXIT_FAILURE 643409885543Smrg fi 643509885543Smrg 643609885543Smrg # Read the libtool library. 643709885543Smrg dlname= 643809885543Smrg library_names= 643909885543Smrg 644009885543Smrg # If there is no directory component, then add one. 644109885543Smrg case $file in 644209885543Smrg */* | *\\*) . $file ;; 644309885543Smrg *) . ./$file ;; 644409885543Smrg esac 644509885543Smrg 644609885543Smrg # Skip this library if it cannot be dlopened. 644709885543Smrg if test -z "$dlname"; then 644809885543Smrg # Warn if it was a shared library. 644909885543Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 645009885543Smrg continue 645109885543Smrg fi 645209885543Smrg 645309885543Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 645409885543Smrg test "X$dir" = "X$file" && dir=. 645509885543Smrg 645609885543Smrg if test -f "$dir/$objdir/$dlname"; then 645709885543Smrg dir="$dir/$objdir" 645809885543Smrg else 64597104f784Smrg if test ! -f "$dir/$dlname"; then 64607104f784Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 64617104f784Smrg exit $EXIT_FAILURE 64627104f784Smrg fi 646309885543Smrg fi 646409885543Smrg ;; 646509885543Smrg 646609885543Smrg *.lo) 646709885543Smrg # Just add the directory containing the .lo file. 646809885543Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 646909885543Smrg test "X$dir" = "X$file" && dir=. 647009885543Smrg ;; 647109885543Smrg 647209885543Smrg *) 647309885543Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 647409885543Smrg continue 647509885543Smrg ;; 647609885543Smrg esac 647709885543Smrg 647809885543Smrg # Get the absolute pathname. 647909885543Smrg absdir=`cd "$dir" && pwd` 648009885543Smrg test -n "$absdir" && dir="$absdir" 648109885543Smrg 648209885543Smrg # Now add the directory to shlibpath_var. 648309885543Smrg if eval "test -z \"\$$shlibpath_var\""; then 648409885543Smrg eval "$shlibpath_var=\"\$dir\"" 648509885543Smrg else 648609885543Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 648709885543Smrg fi 648809885543Smrg done 648909885543Smrg 649009885543Smrg # This variable tells wrapper scripts just to set shlibpath_var 649109885543Smrg # rather than running their programs. 649209885543Smrg libtool_execute_magic="$magic" 649309885543Smrg 649409885543Smrg # Check if any of the arguments is a wrapper script. 649509885543Smrg args= 649609885543Smrg for file 649709885543Smrg do 649809885543Smrg case $file in 649909885543Smrg -*) ;; 650009885543Smrg *) 650109885543Smrg # Do a test to see if this is really a libtool program. 650209885543Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 650309885543Smrg # If there is no directory component, then add one. 650409885543Smrg case $file in 650509885543Smrg */* | *\\*) . $file ;; 650609885543Smrg *) . ./$file ;; 650709885543Smrg esac 650809885543Smrg 650909885543Smrg # Transform arg to wrapped name. 651009885543Smrg file="$progdir/$program" 651109885543Smrg fi 651209885543Smrg ;; 651309885543Smrg esac 651409885543Smrg # Quote arguments (to preserve shell metacharacters). 651509885543Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 651609885543Smrg args="$args \"$file\"" 651709885543Smrg done 651809885543Smrg 651909885543Smrg if test -z "$run"; then 652009885543Smrg if test -n "$shlibpath_var"; then 652109885543Smrg # Export the shlibpath_var. 652209885543Smrg eval "export $shlibpath_var" 652309885543Smrg fi 652409885543Smrg 652509885543Smrg # Restore saved environment variables 65267104f784Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 65277104f784Smrg do 65287104f784Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 65297104f784Smrg $lt_var=\$save_$lt_var; export $lt_var 65307104f784Smrg fi" 65317104f784Smrg done 653209885543Smrg 653309885543Smrg # Now prepare to actually exec the command. 653409885543Smrg exec_cmd="\$cmd$args" 653509885543Smrg else 653609885543Smrg # Display what would be done. 653709885543Smrg if test -n "$shlibpath_var"; then 653809885543Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 653909885543Smrg $echo "export $shlibpath_var" 654009885543Smrg fi 654109885543Smrg $echo "$cmd$args" 654209885543Smrg exit $EXIT_SUCCESS 654309885543Smrg fi 654409885543Smrg ;; 654509885543Smrg 654609885543Smrg # libtool clean and uninstall mode 654709885543Smrg clean | uninstall) 654809885543Smrg modename="$modename: $mode" 654909885543Smrg rm="$nonopt" 655009885543Smrg files= 655109885543Smrg rmforce= 655209885543Smrg exit_status=0 655309885543Smrg 655409885543Smrg # This variable tells wrapper scripts just to set variables rather 655509885543Smrg # than running their programs. 655609885543Smrg libtool_install_magic="$magic" 655709885543Smrg 655809885543Smrg for arg 655909885543Smrg do 656009885543Smrg case $arg in 656109885543Smrg -f) rm="$rm $arg"; rmforce=yes ;; 656209885543Smrg -*) rm="$rm $arg" ;; 656309885543Smrg *) files="$files $arg" ;; 656409885543Smrg esac 656509885543Smrg done 656609885543Smrg 656709885543Smrg if test -z "$rm"; then 656809885543Smrg $echo "$modename: you must specify an RM program" 1>&2 656909885543Smrg $echo "$help" 1>&2 657009885543Smrg exit $EXIT_FAILURE 657109885543Smrg fi 657209885543Smrg 657309885543Smrg rmdirs= 657409885543Smrg 657509885543Smrg origobjdir="$objdir" 657609885543Smrg for file in $files; do 657709885543Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 657809885543Smrg if test "X$dir" = "X$file"; then 657909885543Smrg dir=. 658009885543Smrg objdir="$origobjdir" 658109885543Smrg else 658209885543Smrg objdir="$dir/$origobjdir" 658309885543Smrg fi 658409885543Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 658509885543Smrg test "$mode" = uninstall && objdir="$dir" 658609885543Smrg 658709885543Smrg # Remember objdir for removal later, being careful to avoid duplicates 658809885543Smrg if test "$mode" = clean; then 658909885543Smrg case " $rmdirs " in 659009885543Smrg *" $objdir "*) ;; 659109885543Smrg *) rmdirs="$rmdirs $objdir" ;; 659209885543Smrg esac 659309885543Smrg fi 659409885543Smrg 659509885543Smrg # Don't error if the file doesn't exist and rm -f was used. 659609885543Smrg if (test -L "$file") >/dev/null 2>&1 \ 659709885543Smrg || (test -h "$file") >/dev/null 2>&1 \ 659809885543Smrg || test -f "$file"; then 659909885543Smrg : 660009885543Smrg elif test -d "$file"; then 660109885543Smrg exit_status=1 660209885543Smrg continue 660309885543Smrg elif test "$rmforce" = yes; then 660409885543Smrg continue 660509885543Smrg fi 660609885543Smrg 660709885543Smrg rmfiles="$file" 660809885543Smrg 660909885543Smrg case $name in 661009885543Smrg *.la) 661109885543Smrg # Possibly a libtool archive, so verify it. 661209885543Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 661309885543Smrg . $dir/$name 661409885543Smrg 661509885543Smrg # Delete the libtool libraries and symlinks. 661609885543Smrg for n in $library_names; do 661709885543Smrg rmfiles="$rmfiles $objdir/$n" 661809885543Smrg done 661909885543Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 662009885543Smrg 662109885543Smrg case "$mode" in 662209885543Smrg clean) 662309885543Smrg case " $library_names " in 662409885543Smrg # " " in the beginning catches empty $dlname 662509885543Smrg *" $dlname "*) ;; 662609885543Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 662709885543Smrg esac 662809885543Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 662909885543Smrg ;; 663009885543Smrg uninstall) 663109885543Smrg if test -n "$library_names"; then 663209885543Smrg # Do each command in the postuninstall commands. 663309885543Smrg cmds=$postuninstall_cmds 663409885543Smrg save_ifs="$IFS"; IFS='~' 663509885543Smrg for cmd in $cmds; do 663609885543Smrg IFS="$save_ifs" 663709885543Smrg eval cmd=\"$cmd\" 663809885543Smrg $show "$cmd" 663909885543Smrg $run eval "$cmd" 664009885543Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 664109885543Smrg exit_status=1 664209885543Smrg fi 664309885543Smrg done 664409885543Smrg IFS="$save_ifs" 664509885543Smrg fi 664609885543Smrg 664709885543Smrg if test -n "$old_library"; then 664809885543Smrg # Do each command in the old_postuninstall commands. 664909885543Smrg cmds=$old_postuninstall_cmds 665009885543Smrg save_ifs="$IFS"; IFS='~' 665109885543Smrg for cmd in $cmds; do 665209885543Smrg IFS="$save_ifs" 665309885543Smrg eval cmd=\"$cmd\" 665409885543Smrg $show "$cmd" 665509885543Smrg $run eval "$cmd" 665609885543Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 665709885543Smrg exit_status=1 665809885543Smrg fi 665909885543Smrg done 666009885543Smrg IFS="$save_ifs" 666109885543Smrg fi 666209885543Smrg # FIXME: should reinstall the best remaining shared library. 666309885543Smrg ;; 666409885543Smrg esac 666509885543Smrg fi 666609885543Smrg ;; 666709885543Smrg 666809885543Smrg *.lo) 666909885543Smrg # Possibly a libtool object, so verify it. 667009885543Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 667109885543Smrg 667209885543Smrg # Read the .lo file 667309885543Smrg . $dir/$name 667409885543Smrg 667509885543Smrg # Add PIC object to the list of files to remove. 667609885543Smrg if test -n "$pic_object" \ 667709885543Smrg && test "$pic_object" != none; then 667809885543Smrg rmfiles="$rmfiles $dir/$pic_object" 667909885543Smrg fi 668009885543Smrg 668109885543Smrg # Add non-PIC object to the list of files to remove. 668209885543Smrg if test -n "$non_pic_object" \ 668309885543Smrg && test "$non_pic_object" != none; then 668409885543Smrg rmfiles="$rmfiles $dir/$non_pic_object" 668509885543Smrg fi 668609885543Smrg fi 668709885543Smrg ;; 668809885543Smrg 668909885543Smrg *) 669009885543Smrg if test "$mode" = clean ; then 669109885543Smrg noexename=$name 669209885543Smrg case $file in 669309885543Smrg *.exe) 669409885543Smrg file=`$echo $file|${SED} 's,.exe$,,'` 669509885543Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 669609885543Smrg # $file with .exe has already been added to rmfiles, 669709885543Smrg # add $file without .exe 669809885543Smrg rmfiles="$rmfiles $file" 669909885543Smrg ;; 670009885543Smrg esac 670109885543Smrg # Do a test to see if this is a libtool program. 670209885543Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 670309885543Smrg relink_command= 670409885543Smrg . $dir/$noexename 670509885543Smrg 670609885543Smrg # note $name still contains .exe if it was in $file originally 670709885543Smrg # as does the version of $file that was added into $rmfiles 670809885543Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 670909885543Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 671009885543Smrg rmfiles="$rmfiles $objdir/lt-$name" 671109885543Smrg fi 671209885543Smrg if test "X$noexename" != "X$name" ; then 671309885543Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 671409885543Smrg fi 671509885543Smrg fi 671609885543Smrg fi 671709885543Smrg ;; 671809885543Smrg esac 671909885543Smrg $show "$rm $rmfiles" 672009885543Smrg $run $rm $rmfiles || exit_status=1 672109885543Smrg done 672209885543Smrg objdir="$origobjdir" 672309885543Smrg 672409885543Smrg # Try to remove the ${objdir}s in the directories where we deleted files 672509885543Smrg for dir in $rmdirs; do 672609885543Smrg if test -d "$dir"; then 672709885543Smrg $show "rmdir $dir" 672809885543Smrg $run rmdir $dir >/dev/null 2>&1 672909885543Smrg fi 673009885543Smrg done 673109885543Smrg 673209885543Smrg exit $exit_status 673309885543Smrg ;; 673409885543Smrg 673509885543Smrg "") 673609885543Smrg $echo "$modename: you must specify a MODE" 1>&2 673709885543Smrg $echo "$generic_help" 1>&2 673809885543Smrg exit $EXIT_FAILURE 673909885543Smrg ;; 674009885543Smrg esac 674109885543Smrg 674209885543Smrg if test -z "$exec_cmd"; then 674309885543Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 674409885543Smrg $echo "$generic_help" 1>&2 674509885543Smrg exit $EXIT_FAILURE 674609885543Smrg fi 674709885543Smrgfi # test -z "$show_help" 674809885543Smrg 674909885543Smrgif test -n "$exec_cmd"; then 675009885543Smrg eval exec $exec_cmd 675109885543Smrg exit $EXIT_FAILURE 675209885543Smrgfi 675309885543Smrg 675409885543Smrg# We need to display help for each of the modes. 675509885543Smrgcase $mode in 675609885543Smrg"") $echo \ 675709885543Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 675809885543Smrg 675909885543SmrgProvide generalized library-building support services. 676009885543Smrg 676109885543Smrg --config show all configuration variables 676209885543Smrg --debug enable verbose shell tracing 676309885543Smrg-n, --dry-run display commands without modifying any files 676409885543Smrg --features display basic configuration information and exit 676509885543Smrg --finish same as \`--mode=finish' 676609885543Smrg --help display this help message and exit 676709885543Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 676809885543Smrg --quiet same as \`--silent' 676909885543Smrg --silent don't print informational messages 677009885543Smrg --tag=TAG use configuration variables from tag TAG 677109885543Smrg --version print version information 677209885543Smrg 677309885543SmrgMODE must be one of the following: 677409885543Smrg 677509885543Smrg clean remove files from the build directory 677609885543Smrg compile compile a source file into a libtool object 677709885543Smrg execute automatically set library path, then run a program 677809885543Smrg finish complete the installation of libtool libraries 677909885543Smrg install install libraries or executables 678009885543Smrg link create a library or an executable 678109885543Smrg uninstall remove libraries from an installed directory 678209885543Smrg 678309885543SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 678409885543Smrga more detailed description of MODE. 678509885543Smrg 678609885543SmrgReport bugs to <bug-libtool@gnu.org>." 678709885543Smrg exit $EXIT_SUCCESS 678809885543Smrg ;; 678909885543Smrg 679009885543Smrgclean) 679109885543Smrg $echo \ 679209885543Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 679309885543Smrg 679409885543SmrgRemove files from the build directory. 679509885543Smrg 679609885543SmrgRM is the name of the program to use to delete files associated with each FILE 679709885543Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 679809885543Smrgto RM. 679909885543Smrg 680009885543SmrgIf FILE is a libtool library, object or program, all the files associated 680109885543Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 680209885543Smrg ;; 680309885543Smrg 680409885543Smrgcompile) 680509885543Smrg $echo \ 680609885543Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 680709885543Smrg 680809885543SmrgCompile a source file into a libtool library object. 680909885543Smrg 681009885543SmrgThis mode accepts the following additional options: 681109885543Smrg 681209885543Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 681309885543Smrg -prefer-pic try to building PIC objects only 681409885543Smrg -prefer-non-pic try to building non-PIC objects only 681509885543Smrg -static always build a \`.o' file suitable for static linking 681609885543Smrg 681709885543SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 681809885543Smrgfrom the given SOURCEFILE. 681909885543Smrg 682009885543SmrgThe output file name is determined by removing the directory component from 682109885543SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 682209885543Smrglibrary object suffix, \`.lo'." 682309885543Smrg ;; 682409885543Smrg 682509885543Smrgexecute) 682609885543Smrg $echo \ 682709885543Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 682809885543Smrg 682909885543SmrgAutomatically set library path, then run a program. 683009885543Smrg 683109885543SmrgThis mode accepts the following additional options: 683209885543Smrg 683309885543Smrg -dlopen FILE add the directory containing FILE to the library path 683409885543Smrg 683509885543SmrgThis mode sets the library path environment variable according to \`-dlopen' 683609885543Smrgflags. 683709885543Smrg 683809885543SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 683909885543Smrginto their corresponding uninstalled binary, and any of their required library 684009885543Smrgdirectories are added to the library path. 684109885543Smrg 684209885543SmrgThen, COMMAND is executed, with ARGS as arguments." 684309885543Smrg ;; 684409885543Smrg 684509885543Smrgfinish) 684609885543Smrg $echo \ 684709885543Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 684809885543Smrg 684909885543SmrgComplete the installation of libtool libraries. 685009885543Smrg 685109885543SmrgEach LIBDIR is a directory that contains libtool libraries. 685209885543Smrg 685309885543SmrgThe commands that this mode executes may require superuser privileges. Use 685409885543Smrgthe \`--dry-run' option if you just want to see what would be executed." 685509885543Smrg ;; 685609885543Smrg 685709885543Smrginstall) 685809885543Smrg $echo \ 685909885543Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 686009885543Smrg 686109885543SmrgInstall executables or libraries. 686209885543Smrg 686309885543SmrgINSTALL-COMMAND is the installation command. The first component should be 686409885543Smrgeither the \`install' or \`cp' program. 686509885543Smrg 686609885543SmrgThe rest of the components are interpreted as arguments to that command (only 686709885543SmrgBSD-compatible install options are recognized)." 686809885543Smrg ;; 686909885543Smrg 687009885543Smrglink) 687109885543Smrg $echo \ 687209885543Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 687309885543Smrg 687409885543SmrgLink object files or libraries together to form another library, or to 687509885543Smrgcreate an executable program. 687609885543Smrg 687709885543SmrgLINK-COMMAND is a command using the C compiler that you would use to create 687809885543Smrga program from several object files. 687909885543Smrg 688009885543SmrgThe following components of LINK-COMMAND are treated specially: 688109885543Smrg 688209885543Smrg -all-static do not do any dynamic linking at all 688309885543Smrg -avoid-version do not add a version suffix if possible 688409885543Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 688509885543Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 688609885543Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 688709885543Smrg -export-symbols SYMFILE 68887104f784Smrg try to export only the symbols listed in SYMFILE 688909885543Smrg -export-symbols-regex REGEX 68907104f784Smrg try to export only the symbols matching REGEX 689109885543Smrg -LLIBDIR search LIBDIR for required installed libraries 689209885543Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 689309885543Smrg -module build a library that can dlopened 689409885543Smrg -no-fast-install disable the fast-install mode 689509885543Smrg -no-install link a not-installable executable 689609885543Smrg -no-undefined declare that a library does not refer to external symbols 689709885543Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 689809885543Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 689909885543Smrg -precious-files-regex REGEX 690009885543Smrg don't remove output files matching REGEX 690109885543Smrg -release RELEASE specify package release information 690209885543Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 690309885543Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 69047104f784Smrg -static do not do any dynamic linking of uninstalled libtool libraries 69057104f784Smrg -static-libtool-libs 69067104f784Smrg do not do any dynamic linking of libtool libraries 690709885543Smrg -version-info CURRENT[:REVISION[:AGE]] 69087104f784Smrg specify library version info [each variable defaults to 0] 690909885543Smrg 691009885543SmrgAll other options (arguments beginning with \`-') are ignored. 691109885543Smrg 691209885543SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 691309885543Smrgtreated as uninstalled libtool libraries, other files are standard or library 691409885543Smrgobject files. 691509885543Smrg 691609885543SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 691709885543Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 691809885543Smrgrequired, except when creating a convenience library. 691909885543Smrg 692009885543SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 692109885543Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 692209885543Smrg 692309885543SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 692409885543Smrgis created, otherwise an executable program is created." 692509885543Smrg ;; 692609885543Smrg 692709885543Smrguninstall) 692809885543Smrg $echo \ 692909885543Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 693009885543Smrg 693109885543SmrgRemove libraries from an installation directory. 693209885543Smrg 693309885543SmrgRM is the name of the program to use to delete files associated with each FILE 693409885543Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 693509885543Smrgto RM. 693609885543Smrg 693709885543SmrgIf FILE is a libtool library, all the files associated with it are deleted. 693809885543SmrgOtherwise, only FILE itself is deleted using RM." 693909885543Smrg ;; 694009885543Smrg 694109885543Smrg*) 694209885543Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 694309885543Smrg $echo "$help" 1>&2 694409885543Smrg exit $EXIT_FAILURE 694509885543Smrg ;; 694609885543Smrgesac 694709885543Smrg 694809885543Smrg$echo 694909885543Smrg$echo "Try \`$modename --help' for more information about other modes." 695009885543Smrg 695109885543Smrgexit $? 695209885543Smrg 695309885543Smrg# The TAGs below are defined such that we never get into a situation 695409885543Smrg# in which we disable both kinds of libraries. Given conflicting 695509885543Smrg# choices, we go for a static library, that is the most portable, 695609885543Smrg# since we can't tell whether shared libraries were disabled because 695709885543Smrg# the user asked for that or because the platform doesn't support 695809885543Smrg# them. This is particularly important on AIX, because we don't 695909885543Smrg# support having both static and shared libraries enabled at the same 696009885543Smrg# time on that platform, so we default to a shared-only configuration. 696109885543Smrg# If a disable-shared tag is given, we'll fallback to a static-only 696209885543Smrg# configuration. But we'll never go from static-only to shared-only. 696309885543Smrg 696409885543Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 696509885543Smrgdisable_libs=shared 696609885543Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 696709885543Smrg 696809885543Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 696909885543Smrgdisable_libs=static 697009885543Smrg# ### END LIBTOOL TAG CONFIG: disable-static 697109885543Smrg 697209885543Smrg# Local Variables: 697309885543Smrg# mode:shell-script 697409885543Smrg# sh-indentation:2 697509885543Smrg# End: 6976