ltmain.sh revision 1fd23544
172b676d7Smrg# ltmain.sh - Provide generalized library-building support services. 272b676d7Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 372b676d7Smrg# 41fd23544Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 51fd23544Smrg# 2007, 2008 Free Software Foundation, Inc. 672b676d7Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 772b676d7Smrg# 872b676d7Smrg# This program is free software; you can redistribute it and/or modify 972b676d7Smrg# it under the terms of the GNU General Public License as published by 1072b676d7Smrg# the Free Software Foundation; either version 2 of the License, or 1172b676d7Smrg# (at your option) any later version. 1272b676d7Smrg# 1372b676d7Smrg# This program is distributed in the hope that it will be useful, but 1472b676d7Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1572b676d7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1672b676d7Smrg# General Public License for more details. 1772b676d7Smrg# 1872b676d7Smrg# You should have received a copy of the GNU General Public License 1972b676d7Smrg# along with this program; if not, write to the Free Software 2072b676d7Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2172b676d7Smrg# 2272b676d7Smrg# As a special exception to the GNU General Public License, if you 2372b676d7Smrg# distribute this file as part of a program that contains a 2472b676d7Smrg# configuration script generated by Autoconf, you may include it under 2572b676d7Smrg# the same distribution terms that you use for the rest of that program. 2672b676d7Smrg 2772b676d7Smrgbasename="s,^.*/,,g" 2872b676d7Smrg 2972b676d7Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 3072b676d7Smrg# is ksh but when the shell is invoked as "sh" and the current value of 3172b676d7Smrg# the _XPG environment variable is not equal to 1 (one), the special 3272b676d7Smrg# positional parameter $0, within a function call, is the name of the 3372b676d7Smrg# function. 3472b676d7Smrgprogpath="$0" 3572b676d7Smrg 3672b676d7Smrg# The name of this program: 3772b676d7Smrgprogname=`echo "$progpath" | $SED $basename` 3872b676d7Smrgmodename="$progname" 3972b676d7Smrg 4072b676d7Smrg# Global variables: 4172b676d7SmrgEXIT_SUCCESS=0 4272b676d7SmrgEXIT_FAILURE=1 4372b676d7Smrg 4472b676d7SmrgPROGRAM=ltmain.sh 4572b676d7SmrgPACKAGE=libtool 461fd23544SmrgVERSION=1.5.26 471fd23544SmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 481fd23544Smrg 491fd23544Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 501fd23544Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 511fd23544Smrg emulate sh 521fd23544Smrg NULLCMD=: 531fd23544Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 541fd23544Smrg # is contrary to our usage. Disable this feature. 551fd23544Smrg alias -g '${1+"$@"}'='"$@"' 5672b676d7Smrg setopt NO_GLOB_SUBST 571fd23544Smrgelse 581fd23544Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 5972b676d7Smrgfi 601fd23544SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 611fd23544SmrgDUALCASE=1; export DUALCASE # for MKS sh 6272b676d7Smrg 6372b676d7Smrg# Check that we have a working $echo. 6472b676d7Smrgif test "X$1" = X--no-reexec; then 6572b676d7Smrg # Discard the --no-reexec flag, and continue. 6672b676d7Smrg shift 6772b676d7Smrgelif test "X$1" = X--fallback-echo; then 6872b676d7Smrg # Avoid inline document here, it may be left over 6972b676d7Smrg : 7072b676d7Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 7172b676d7Smrg # Yippee, $echo works! 7272b676d7Smrg : 7372b676d7Smrgelse 7472b676d7Smrg # Restart under the correct shell, and then maybe $echo will work. 7572b676d7Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 7672b676d7Smrgfi 7772b676d7Smrg 7872b676d7Smrgif test "X$1" = X--fallback-echo; then 7972b676d7Smrg # used as fallback echo 8072b676d7Smrg shift 8172b676d7Smrg cat <<EOF 8272b676d7Smrg$* 8372b676d7SmrgEOF 8472b676d7Smrg exit $EXIT_SUCCESS 8572b676d7Smrgfi 8672b676d7Smrg 8772b676d7Smrgdefault_mode= 8872b676d7Smrghelp="Try \`$progname --help' for more information." 8972b676d7Smrgmagic="%%%MAGIC variable%%%" 9072b676d7Smrgmkdir="mkdir" 9172b676d7Smrgmv="mv -f" 9272b676d7Smrgrm="rm -f" 9372b676d7Smrg 9472b676d7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 9572b676d7Smrg# metacharacters that are still active within double-quoted strings. 9672b676d7SmrgXsed="${SED}"' -e 1s/^X//' 9772b676d7Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 9872b676d7Smrg# test EBCDIC or ASCII 9972b676d7Smrgcase `echo X|tr X '\101'` in 10072b676d7Smrg A) # ASCII based system 10172b676d7Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 10272b676d7Smrg SP2NL='tr \040 \012' 10372b676d7Smrg NL2SP='tr \015\012 \040\040' 10472b676d7Smrg ;; 10572b676d7Smrg *) # EBCDIC based system 10672b676d7Smrg SP2NL='tr \100 \n' 10772b676d7Smrg NL2SP='tr \r\n \100\100' 10872b676d7Smrg ;; 10972b676d7Smrgesac 11072b676d7Smrg 11172b676d7Smrg# NLS nuisances. 11272b676d7Smrg# Only set LANG and LC_ALL to C if already set. 11372b676d7Smrg# These must not be set unconditionally because not all systems understand 11472b676d7Smrg# e.g. LANG=C (notably SCO). 11572b676d7Smrg# We save the old values to restore during execute mode. 1161fd23544Smrglt_env= 1171fd23544Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1181fd23544Smrgdo 1191fd23544Smrg eval "if test \"\${$lt_var+set}\" = set; then 1201fd23544Smrg save_$lt_var=\$$lt_var 1211fd23544Smrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1221fd23544Smrg $lt_var=C 1231fd23544Smrg export $lt_var 1241fd23544Smrg fi" 1251fd23544Smrgdone 1261fd23544Smrg 1271fd23544Smrgif test -n "$lt_env"; then 1281fd23544Smrg lt_env="env $lt_env" 12972b676d7Smrgfi 13072b676d7Smrg 13172b676d7Smrg# Make sure IFS has a sensible default 13272b676d7Smrglt_nl=' 13372b676d7Smrg' 13472b676d7SmrgIFS=" $lt_nl" 13572b676d7Smrg 13672b676d7Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 13772b676d7Smrg $echo "$modename: not configured to build any kind of library" 1>&2 13872b676d7Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 13972b676d7Smrg exit $EXIT_FAILURE 14072b676d7Smrgfi 14172b676d7Smrg 14272b676d7Smrg# Global variables. 14372b676d7Smrgmode=$default_mode 14472b676d7Smrgnonopt= 14572b676d7Smrgprev= 14672b676d7Smrgprevopt= 14772b676d7Smrgrun= 14872b676d7Smrgshow="$echo" 14972b676d7Smrgshow_help= 15072b676d7Smrgexecute_dlfiles= 15172b676d7Smrgduplicate_deps=no 15272b676d7Smrgpreserve_args= 15372b676d7Smrglo2o="s/\\.lo\$/.${objext}/" 15472b676d7Smrgo2lo="s/\\.${objext}\$/.lo/" 1551fd23544Smrgextracted_archives= 1561fd23544Smrgextracted_serial=0 15772b676d7Smrg 15872b676d7Smrg##################################### 15972b676d7Smrg# Shell function definitions: 16072b676d7Smrg# This seems to be the best place for them 16172b676d7Smrg 16272b676d7Smrg# func_mktempdir [string] 16372b676d7Smrg# Make a temporary directory that won't clash with other running 16472b676d7Smrg# libtool processes, and avoids race conditions if possible. If 16572b676d7Smrg# given, STRING is the basename for that directory. 16672b676d7Smrgfunc_mktempdir () 16772b676d7Smrg{ 16872b676d7Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 16972b676d7Smrg 17072b676d7Smrg if test "$run" = ":"; then 17172b676d7Smrg # Return a directory name, but don't create it in dry-run mode 17272b676d7Smrg my_tmpdir="${my_template}-$$" 17372b676d7Smrg else 17472b676d7Smrg 17572b676d7Smrg # If mktemp works, use that first and foremost 17672b676d7Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 17772b676d7Smrg 17872b676d7Smrg if test ! -d "$my_tmpdir"; then 17972b676d7Smrg # Failing that, at least try and use $RANDOM to avoid a race 18072b676d7Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 18172b676d7Smrg 18272b676d7Smrg save_mktempdir_umask=`umask` 18372b676d7Smrg umask 0077 18472b676d7Smrg $mkdir "$my_tmpdir" 18572b676d7Smrg umask $save_mktempdir_umask 18672b676d7Smrg fi 18772b676d7Smrg 18872b676d7Smrg # If we're not in dry-run mode, bomb out on failure 18972b676d7Smrg test -d "$my_tmpdir" || { 19072b676d7Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 19172b676d7Smrg exit $EXIT_FAILURE 19272b676d7Smrg } 19372b676d7Smrg fi 19472b676d7Smrg 19572b676d7Smrg $echo "X$my_tmpdir" | $Xsed 19672b676d7Smrg} 19772b676d7Smrg 19872b676d7Smrg 19972b676d7Smrg# func_win32_libid arg 20072b676d7Smrg# return the library type of file 'arg' 20172b676d7Smrg# 20272b676d7Smrg# Need a lot of goo to handle *both* DLLs and import libs 20372b676d7Smrg# Has to be a shell function in order to 'eat' the argument 20472b676d7Smrg# that is supplied when $file_magic_command is called. 20572b676d7Smrgfunc_win32_libid () 20672b676d7Smrg{ 20772b676d7Smrg win32_libid_type="unknown" 20872b676d7Smrg win32_fileres=`file -L $1 2>/dev/null` 20972b676d7Smrg case $win32_fileres in 21072b676d7Smrg *ar\ archive\ import\ library*) # definitely import 21172b676d7Smrg win32_libid_type="x86 archive import" 21272b676d7Smrg ;; 21372b676d7Smrg *ar\ archive*) # could be an import, or static 21472b676d7Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 21572b676d7Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 21672b676d7Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 2171fd23544Smrg $SED -n -e '1,100{ 2181fd23544Smrg / I /{ 2191fd23544Smrg s,.*,import, 2201fd23544Smrg p 2211fd23544Smrg q 2221fd23544Smrg } 2231fd23544Smrg }'` 22472b676d7Smrg case $win32_nmres in 22572b676d7Smrg import*) win32_libid_type="x86 archive import";; 22672b676d7Smrg *) win32_libid_type="x86 archive static";; 22772b676d7Smrg esac 22872b676d7Smrg fi 22972b676d7Smrg ;; 23072b676d7Smrg *DLL*) 23172b676d7Smrg win32_libid_type="x86 DLL" 23272b676d7Smrg ;; 23372b676d7Smrg *executable*) # but shell scripts are "executable" too... 23472b676d7Smrg case $win32_fileres in 23572b676d7Smrg *MS\ Windows\ PE\ Intel*) 23672b676d7Smrg win32_libid_type="x86 DLL" 23772b676d7Smrg ;; 23872b676d7Smrg esac 23972b676d7Smrg ;; 24072b676d7Smrg esac 24172b676d7Smrg $echo $win32_libid_type 24272b676d7Smrg} 24372b676d7Smrg 24472b676d7Smrg 24572b676d7Smrg# func_infer_tag arg 24672b676d7Smrg# Infer tagged configuration to use if any are available and 24772b676d7Smrg# if one wasn't chosen via the "--tag" command line option. 24872b676d7Smrg# Only attempt this if the compiler in the base compile 24972b676d7Smrg# command doesn't match the default compiler. 25072b676d7Smrg# arg is usually of the form 'gcc ...' 25172b676d7Smrgfunc_infer_tag () 25272b676d7Smrg{ 25372b676d7Smrg if test -n "$available_tags" && test -z "$tagname"; then 25472b676d7Smrg CC_quoted= 25572b676d7Smrg for arg in $CC; do 25672b676d7Smrg case $arg in 25772b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 25872b676d7Smrg arg="\"$arg\"" 25972b676d7Smrg ;; 26072b676d7Smrg esac 26172b676d7Smrg CC_quoted="$CC_quoted $arg" 26272b676d7Smrg done 26372b676d7Smrg case $@ in 26472b676d7Smrg # Blanks in the command may have been stripped by the calling shell, 26572b676d7Smrg # but not from the CC environment variable when configure was run. 26672b676d7Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 26772b676d7Smrg # Blanks at the start of $base_compile will cause this to fail 26872b676d7Smrg # if we don't check for them as well. 26972b676d7Smrg *) 27072b676d7Smrg for z in $available_tags; do 27172b676d7Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 27272b676d7Smrg # Evaluate the configuration. 27372b676d7Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 27472b676d7Smrg CC_quoted= 27572b676d7Smrg for arg in $CC; do 27672b676d7Smrg # Double-quote args containing other shell metacharacters. 27772b676d7Smrg case $arg in 27872b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 27972b676d7Smrg arg="\"$arg\"" 28072b676d7Smrg ;; 28172b676d7Smrg esac 28272b676d7Smrg CC_quoted="$CC_quoted $arg" 28372b676d7Smrg done 28472b676d7Smrg case "$@ " in 28572b676d7Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 28672b676d7Smrg # The compiler in the base compile command matches 28772b676d7Smrg # the one in the tagged configuration. 28872b676d7Smrg # Assume this is the tagged configuration we want. 28972b676d7Smrg tagname=$z 29072b676d7Smrg break 29172b676d7Smrg ;; 29272b676d7Smrg esac 29372b676d7Smrg fi 29472b676d7Smrg done 29572b676d7Smrg # If $tagname still isn't set, then no tagged configuration 29672b676d7Smrg # was found and let the user know that the "--tag" command 29772b676d7Smrg # line option must be used. 29872b676d7Smrg if test -z "$tagname"; then 29972b676d7Smrg $echo "$modename: unable to infer tagged configuration" 30072b676d7Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 30172b676d7Smrg exit $EXIT_FAILURE 30272b676d7Smrg# else 30372b676d7Smrg# $echo "$modename: using $tagname tagged configuration" 30472b676d7Smrg fi 30572b676d7Smrg ;; 30672b676d7Smrg esac 30772b676d7Smrg fi 30872b676d7Smrg} 30972b676d7Smrg 31072b676d7Smrg 31172b676d7Smrg# func_extract_an_archive dir oldlib 31272b676d7Smrgfunc_extract_an_archive () 31372b676d7Smrg{ 31472b676d7Smrg f_ex_an_ar_dir="$1"; shift 31572b676d7Smrg f_ex_an_ar_oldlib="$1" 31672b676d7Smrg 31772b676d7Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 31872b676d7Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 31972b676d7Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 32072b676d7Smrg : 32172b676d7Smrg else 32272b676d7Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 32372b676d7Smrg exit $EXIT_FAILURE 32472b676d7Smrg fi 32572b676d7Smrg} 32672b676d7Smrg 32772b676d7Smrg# func_extract_archives gentop oldlib ... 32872b676d7Smrgfunc_extract_archives () 32972b676d7Smrg{ 33072b676d7Smrg my_gentop="$1"; shift 33172b676d7Smrg my_oldlibs=${1+"$@"} 33272b676d7Smrg my_oldobjs="" 33372b676d7Smrg my_xlib="" 33472b676d7Smrg my_xabs="" 33572b676d7Smrg my_xdir="" 33672b676d7Smrg my_status="" 33772b676d7Smrg 33872b676d7Smrg $show "${rm}r $my_gentop" 33972b676d7Smrg $run ${rm}r "$my_gentop" 34072b676d7Smrg $show "$mkdir $my_gentop" 34172b676d7Smrg $run $mkdir "$my_gentop" 34272b676d7Smrg my_status=$? 34372b676d7Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 34472b676d7Smrg exit $my_status 34572b676d7Smrg fi 34672b676d7Smrg 34772b676d7Smrg for my_xlib in $my_oldlibs; do 34872b676d7Smrg # Extract the objects. 34972b676d7Smrg case $my_xlib in 35072b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 35172b676d7Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 35272b676d7Smrg esac 35372b676d7Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3541fd23544Smrg my_xlib_u=$my_xlib 3551fd23544Smrg while :; do 3561fd23544Smrg case " $extracted_archives " in 3571fd23544Smrg *" $my_xlib_u "*) 3581fd23544Smrg extracted_serial=`expr $extracted_serial + 1` 3591fd23544Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3601fd23544Smrg *) break ;; 3611fd23544Smrg esac 3621fd23544Smrg done 3631fd23544Smrg extracted_archives="$extracted_archives $my_xlib_u" 3641fd23544Smrg my_xdir="$my_gentop/$my_xlib_u" 36572b676d7Smrg 36672b676d7Smrg $show "${rm}r $my_xdir" 36772b676d7Smrg $run ${rm}r "$my_xdir" 36872b676d7Smrg $show "$mkdir $my_xdir" 36972b676d7Smrg $run $mkdir "$my_xdir" 37072b676d7Smrg exit_status=$? 37172b676d7Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 37272b676d7Smrg exit $exit_status 37372b676d7Smrg fi 37472b676d7Smrg case $host in 37572b676d7Smrg *-darwin*) 37672b676d7Smrg $show "Extracting $my_xabs" 37772b676d7Smrg # Do not bother doing anything if just a dry run 37872b676d7Smrg if test -z "$run"; then 37972b676d7Smrg darwin_orig_dir=`pwd` 38072b676d7Smrg cd $my_xdir || exit $? 38172b676d7Smrg darwin_archive=$my_xabs 38272b676d7Smrg darwin_curdir=`pwd` 38372b676d7Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 38472b676d7Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 38572b676d7Smrg if test -n "$darwin_arches"; then 38672b676d7Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 38772b676d7Smrg darwin_arch= 38872b676d7Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 38972b676d7Smrg for darwin_arch in $darwin_arches ; do 39072b676d7Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 39172b676d7Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 39272b676d7Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 39372b676d7Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 39472b676d7Smrg cd "$darwin_curdir" 39572b676d7Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 39672b676d7Smrg done # $darwin_arches 39772b676d7Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 39872b676d7Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 39972b676d7Smrg darwin_file= 40072b676d7Smrg darwin_files= 40172b676d7Smrg for darwin_file in $darwin_filelist; do 40272b676d7Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 40372b676d7Smrg lipo -create -output "$darwin_file" $darwin_files 40472b676d7Smrg done # $darwin_filelist 40572b676d7Smrg ${rm}r unfat-$$ 40672b676d7Smrg cd "$darwin_orig_dir" 40772b676d7Smrg else 40872b676d7Smrg cd "$darwin_orig_dir" 40972b676d7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 41072b676d7Smrg fi # $darwin_arches 41172b676d7Smrg fi # $run 41272b676d7Smrg ;; 41372b676d7Smrg *) 41472b676d7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 41572b676d7Smrg ;; 41672b676d7Smrg esac 41772b676d7Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 41872b676d7Smrg done 41972b676d7Smrg func_extract_archives_result="$my_oldobjs" 42072b676d7Smrg} 42172b676d7Smrg# End of Shell function definitions 42272b676d7Smrg##################################### 42372b676d7Smrg 42472b676d7Smrg# Darwin sucks 42572b676d7Smrgeval std_shrext=\"$shrext_cmds\" 42672b676d7Smrg 42772b676d7Smrgdisable_libs=no 42872b676d7Smrg 42972b676d7Smrg# Parse our command line options once, thoroughly. 43072b676d7Smrgwhile test "$#" -gt 0 43172b676d7Smrgdo 43272b676d7Smrg arg="$1" 43372b676d7Smrg shift 43472b676d7Smrg 43572b676d7Smrg case $arg in 43672b676d7Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 43772b676d7Smrg *) optarg= ;; 43872b676d7Smrg esac 43972b676d7Smrg 44072b676d7Smrg # If the previous option needs an argument, assign it. 44172b676d7Smrg if test -n "$prev"; then 44272b676d7Smrg case $prev in 44372b676d7Smrg execute_dlfiles) 44472b676d7Smrg execute_dlfiles="$execute_dlfiles $arg" 44572b676d7Smrg ;; 44672b676d7Smrg tag) 44772b676d7Smrg tagname="$arg" 44872b676d7Smrg preserve_args="${preserve_args}=$arg" 44972b676d7Smrg 45072b676d7Smrg # Check whether tagname contains only valid characters 45172b676d7Smrg case $tagname in 45272b676d7Smrg *[!-_A-Za-z0-9,/]*) 45372b676d7Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 45472b676d7Smrg exit $EXIT_FAILURE 45572b676d7Smrg ;; 45672b676d7Smrg esac 45772b676d7Smrg 45872b676d7Smrg case $tagname in 45972b676d7Smrg CC) 46072b676d7Smrg # Don't test for the "default" C tag, as we know, it's there, but 46172b676d7Smrg # not specially marked. 46272b676d7Smrg ;; 46372b676d7Smrg *) 46472b676d7Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 46572b676d7Smrg taglist="$taglist $tagname" 46672b676d7Smrg # Evaluate the configuration. 46772b676d7Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 46872b676d7Smrg else 46972b676d7Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 47072b676d7Smrg fi 47172b676d7Smrg ;; 47272b676d7Smrg esac 47372b676d7Smrg ;; 47472b676d7Smrg *) 47572b676d7Smrg eval "$prev=\$arg" 47672b676d7Smrg ;; 47772b676d7Smrg esac 47872b676d7Smrg 47972b676d7Smrg prev= 48072b676d7Smrg prevopt= 48172b676d7Smrg continue 48272b676d7Smrg fi 48372b676d7Smrg 48472b676d7Smrg # Have we seen a non-optional argument yet? 48572b676d7Smrg case $arg in 48672b676d7Smrg --help) 48772b676d7Smrg show_help=yes 48872b676d7Smrg ;; 48972b676d7Smrg 49072b676d7Smrg --version) 4911fd23544Smrg echo "\ 4921fd23544Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 4931fd23544Smrg 4941fd23544SmrgCopyright (C) 2008 Free Software Foundation, Inc. 4951fd23544SmrgThis is free software; see the source for copying conditions. There is NO 4961fd23544Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 49772b676d7Smrg exit $? 49872b676d7Smrg ;; 49972b676d7Smrg 50072b676d7Smrg --config) 50172b676d7Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 50272b676d7Smrg # Now print the configurations for the tags. 50372b676d7Smrg for tagname in $taglist; do 50472b676d7Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 50572b676d7Smrg done 50672b676d7Smrg exit $? 50772b676d7Smrg ;; 50872b676d7Smrg 50972b676d7Smrg --debug) 51072b676d7Smrg $echo "$progname: enabling shell trace mode" 51172b676d7Smrg set -x 51272b676d7Smrg preserve_args="$preserve_args $arg" 51372b676d7Smrg ;; 51472b676d7Smrg 51572b676d7Smrg --dry-run | -n) 51672b676d7Smrg run=: 51772b676d7Smrg ;; 51872b676d7Smrg 51972b676d7Smrg --features) 52072b676d7Smrg $echo "host: $host" 52172b676d7Smrg if test "$build_libtool_libs" = yes; then 52272b676d7Smrg $echo "enable shared libraries" 52372b676d7Smrg else 52472b676d7Smrg $echo "disable shared libraries" 52572b676d7Smrg fi 52672b676d7Smrg if test "$build_old_libs" = yes; then 52772b676d7Smrg $echo "enable static libraries" 52872b676d7Smrg else 52972b676d7Smrg $echo "disable static libraries" 53072b676d7Smrg fi 53172b676d7Smrg exit $? 53272b676d7Smrg ;; 53372b676d7Smrg 53472b676d7Smrg --finish) mode="finish" ;; 53572b676d7Smrg 53672b676d7Smrg --mode) prevopt="--mode" prev=mode ;; 53772b676d7Smrg --mode=*) mode="$optarg" ;; 53872b676d7Smrg 53972b676d7Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 54072b676d7Smrg 54172b676d7Smrg --quiet | --silent) 54272b676d7Smrg show=: 54372b676d7Smrg preserve_args="$preserve_args $arg" 54472b676d7Smrg ;; 54572b676d7Smrg 54672b676d7Smrg --tag) 54772b676d7Smrg prevopt="--tag" 54872b676d7Smrg prev=tag 54972b676d7Smrg preserve_args="$preserve_args --tag" 55072b676d7Smrg ;; 55172b676d7Smrg --tag=*) 55272b676d7Smrg set tag "$optarg" ${1+"$@"} 55372b676d7Smrg shift 55472b676d7Smrg prev=tag 55572b676d7Smrg preserve_args="$preserve_args --tag" 55672b676d7Smrg ;; 55772b676d7Smrg 55872b676d7Smrg -dlopen) 55972b676d7Smrg prevopt="-dlopen" 56072b676d7Smrg prev=execute_dlfiles 56172b676d7Smrg ;; 56272b676d7Smrg 56372b676d7Smrg -*) 56472b676d7Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 56572b676d7Smrg $echo "$help" 1>&2 56672b676d7Smrg exit $EXIT_FAILURE 56772b676d7Smrg ;; 56872b676d7Smrg 56972b676d7Smrg *) 57072b676d7Smrg nonopt="$arg" 57172b676d7Smrg break 57272b676d7Smrg ;; 57372b676d7Smrg esac 57472b676d7Smrgdone 57572b676d7Smrg 57672b676d7Smrgif test -n "$prevopt"; then 57772b676d7Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 57872b676d7Smrg $echo "$help" 1>&2 57972b676d7Smrg exit $EXIT_FAILURE 58072b676d7Smrgfi 58172b676d7Smrg 58272b676d7Smrgcase $disable_libs in 58372b676d7Smrgno) 58472b676d7Smrg ;; 58572b676d7Smrgshared) 58672b676d7Smrg build_libtool_libs=no 58772b676d7Smrg build_old_libs=yes 58872b676d7Smrg ;; 58972b676d7Smrgstatic) 59072b676d7Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 59172b676d7Smrg ;; 59272b676d7Smrgesac 59372b676d7Smrg 59472b676d7Smrg# If this variable is set in any of the actions, the command in it 59572b676d7Smrg# will be execed at the end. This prevents here-documents from being 59672b676d7Smrg# left over by shells. 59772b676d7Smrgexec_cmd= 59872b676d7Smrg 59972b676d7Smrgif test -z "$show_help"; then 60072b676d7Smrg 60172b676d7Smrg # Infer the operation mode. 60272b676d7Smrg if test -z "$mode"; then 60372b676d7Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 60472b676d7Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 60572b676d7Smrg case $nonopt in 60672b676d7Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 60772b676d7Smrg mode=link 60872b676d7Smrg for arg 60972b676d7Smrg do 61072b676d7Smrg case $arg in 61172b676d7Smrg -c) 61272b676d7Smrg mode=compile 61372b676d7Smrg break 61472b676d7Smrg ;; 61572b676d7Smrg esac 61672b676d7Smrg done 61772b676d7Smrg ;; 61872b676d7Smrg *db | *dbx | *strace | *truss) 61972b676d7Smrg mode=execute 62072b676d7Smrg ;; 62172b676d7Smrg *install*|cp|mv) 62272b676d7Smrg mode=install 62372b676d7Smrg ;; 62472b676d7Smrg *rm) 62572b676d7Smrg mode=uninstall 62672b676d7Smrg ;; 62772b676d7Smrg *) 62872b676d7Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 62972b676d7Smrg test -n "$execute_dlfiles" && mode=execute 63072b676d7Smrg 63172b676d7Smrg # Just use the default operation mode. 63272b676d7Smrg if test -z "$mode"; then 63372b676d7Smrg if test -n "$nonopt"; then 63472b676d7Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 63572b676d7Smrg else 63672b676d7Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 63772b676d7Smrg fi 63872b676d7Smrg fi 63972b676d7Smrg ;; 64072b676d7Smrg esac 64172b676d7Smrg fi 64272b676d7Smrg 64372b676d7Smrg # Only execute mode is allowed to have -dlopen flags. 64472b676d7Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 64572b676d7Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 64672b676d7Smrg $echo "$help" 1>&2 64772b676d7Smrg exit $EXIT_FAILURE 64872b676d7Smrg fi 64972b676d7Smrg 65072b676d7Smrg # Change the help message to a mode-specific one. 65172b676d7Smrg generic_help="$help" 65272b676d7Smrg help="Try \`$modename --help --mode=$mode' for more information." 65372b676d7Smrg 65472b676d7Smrg # These modes are in order of execution frequency so that they run quickly. 65572b676d7Smrg case $mode in 65672b676d7Smrg # libtool compile mode 65772b676d7Smrg compile) 65872b676d7Smrg modename="$modename: compile" 65972b676d7Smrg # Get the compilation command and the source file. 66072b676d7Smrg base_compile= 66172b676d7Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 66272b676d7Smrg suppress_opt=yes 66372b676d7Smrg suppress_output= 66472b676d7Smrg arg_mode=normal 66572b676d7Smrg libobj= 66672b676d7Smrg later= 66772b676d7Smrg 66872b676d7Smrg for arg 66972b676d7Smrg do 67072b676d7Smrg case $arg_mode in 67172b676d7Smrg arg ) 67272b676d7Smrg # do not "continue". Instead, add this to base_compile 67372b676d7Smrg lastarg="$arg" 67472b676d7Smrg arg_mode=normal 67572b676d7Smrg ;; 67672b676d7Smrg 67772b676d7Smrg target ) 67872b676d7Smrg libobj="$arg" 67972b676d7Smrg arg_mode=normal 68072b676d7Smrg continue 68172b676d7Smrg ;; 68272b676d7Smrg 68372b676d7Smrg normal ) 68472b676d7Smrg # Accept any command-line options. 68572b676d7Smrg case $arg in 68672b676d7Smrg -o) 68772b676d7Smrg if test -n "$libobj" ; then 68872b676d7Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 68972b676d7Smrg exit $EXIT_FAILURE 69072b676d7Smrg fi 69172b676d7Smrg arg_mode=target 69272b676d7Smrg continue 69372b676d7Smrg ;; 69472b676d7Smrg 69572b676d7Smrg -static | -prefer-pic | -prefer-non-pic) 69672b676d7Smrg later="$later $arg" 69772b676d7Smrg continue 69872b676d7Smrg ;; 69972b676d7Smrg 70072b676d7Smrg -no-suppress) 70172b676d7Smrg suppress_opt=no 70272b676d7Smrg continue 70372b676d7Smrg ;; 70472b676d7Smrg 70572b676d7Smrg -Xcompiler) 70672b676d7Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 70772b676d7Smrg continue # The current "srcfile" will either be retained or 70872b676d7Smrg ;; # replaced later. I would guess that would be a bug. 70972b676d7Smrg 71072b676d7Smrg -Wc,*) 71172b676d7Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 71272b676d7Smrg lastarg= 71372b676d7Smrg save_ifs="$IFS"; IFS=',' 71472b676d7Smrg for arg in $args; do 71572b676d7Smrg IFS="$save_ifs" 71672b676d7Smrg 71772b676d7Smrg # Double-quote args containing other shell metacharacters. 71872b676d7Smrg # Many Bourne shells cannot handle close brackets correctly 71972b676d7Smrg # in scan sets, so we specify it separately. 72072b676d7Smrg case $arg in 72172b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 72272b676d7Smrg arg="\"$arg\"" 72372b676d7Smrg ;; 72472b676d7Smrg esac 72572b676d7Smrg lastarg="$lastarg $arg" 72672b676d7Smrg done 72772b676d7Smrg IFS="$save_ifs" 72872b676d7Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 72972b676d7Smrg 73072b676d7Smrg # Add the arguments to base_compile. 73172b676d7Smrg base_compile="$base_compile $lastarg" 73272b676d7Smrg continue 73372b676d7Smrg ;; 73472b676d7Smrg 73572b676d7Smrg * ) 73672b676d7Smrg # Accept the current argument as the source file. 73772b676d7Smrg # The previous "srcfile" becomes the current argument. 73872b676d7Smrg # 73972b676d7Smrg lastarg="$srcfile" 74072b676d7Smrg srcfile="$arg" 74172b676d7Smrg ;; 74272b676d7Smrg esac # case $arg 74372b676d7Smrg ;; 74472b676d7Smrg esac # case $arg_mode 74572b676d7Smrg 74672b676d7Smrg # Aesthetically quote the previous argument. 74772b676d7Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 74872b676d7Smrg 74972b676d7Smrg case $lastarg in 75072b676d7Smrg # Double-quote args containing other shell metacharacters. 75172b676d7Smrg # Many Bourne shells cannot handle close brackets correctly 75272b676d7Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 75372b676d7Smrg # in scan sets (worked around with variable expansion), 75472b676d7Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 75572b676d7Smrg # at all, so we specify them separately. 75672b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 75772b676d7Smrg lastarg="\"$lastarg\"" 75872b676d7Smrg ;; 75972b676d7Smrg esac 76072b676d7Smrg 76172b676d7Smrg base_compile="$base_compile $lastarg" 76272b676d7Smrg done # for arg 76372b676d7Smrg 76472b676d7Smrg case $arg_mode in 76572b676d7Smrg arg) 76672b676d7Smrg $echo "$modename: you must specify an argument for -Xcompile" 76772b676d7Smrg exit $EXIT_FAILURE 76872b676d7Smrg ;; 76972b676d7Smrg target) 77072b676d7Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 77172b676d7Smrg exit $EXIT_FAILURE 77272b676d7Smrg ;; 77372b676d7Smrg *) 77472b676d7Smrg # Get the name of the library object. 77572b676d7Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 77672b676d7Smrg ;; 77772b676d7Smrg esac 77872b676d7Smrg 77972b676d7Smrg # Recognize several different file suffixes. 78072b676d7Smrg # If the user specifies -o file.o, it is replaced with file.lo 78172b676d7Smrg xform='[cCFSifmso]' 78272b676d7Smrg case $libobj in 78372b676d7Smrg *.ada) xform=ada ;; 78472b676d7Smrg *.adb) xform=adb ;; 78572b676d7Smrg *.ads) xform=ads ;; 78672b676d7Smrg *.asm) xform=asm ;; 78772b676d7Smrg *.c++) xform=c++ ;; 78872b676d7Smrg *.cc) xform=cc ;; 78972b676d7Smrg *.ii) xform=ii ;; 79072b676d7Smrg *.class) xform=class ;; 79172b676d7Smrg *.cpp) xform=cpp ;; 79272b676d7Smrg *.cxx) xform=cxx ;; 7931fd23544Smrg *.[fF][09]?) xform=[fF][09]. ;; 79472b676d7Smrg *.for) xform=for ;; 79572b676d7Smrg *.java) xform=java ;; 7961fd23544Smrg *.obj) xform=obj ;; 7971fd23544Smrg *.sx) xform=sx ;; 79872b676d7Smrg esac 79972b676d7Smrg 80072b676d7Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 80172b676d7Smrg 80272b676d7Smrg case $libobj in 80372b676d7Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 80472b676d7Smrg *) 80572b676d7Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 80672b676d7Smrg exit $EXIT_FAILURE 80772b676d7Smrg ;; 80872b676d7Smrg esac 80972b676d7Smrg 81072b676d7Smrg func_infer_tag $base_compile 81172b676d7Smrg 81272b676d7Smrg for arg in $later; do 81372b676d7Smrg case $arg in 81472b676d7Smrg -static) 81572b676d7Smrg build_old_libs=yes 81672b676d7Smrg continue 81772b676d7Smrg ;; 81872b676d7Smrg 81972b676d7Smrg -prefer-pic) 82072b676d7Smrg pic_mode=yes 82172b676d7Smrg continue 82272b676d7Smrg ;; 82372b676d7Smrg 82472b676d7Smrg -prefer-non-pic) 82572b676d7Smrg pic_mode=no 82672b676d7Smrg continue 82772b676d7Smrg ;; 82872b676d7Smrg esac 82972b676d7Smrg done 83072b676d7Smrg 83172b676d7Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 83272b676d7Smrg case $qlibobj in 83372b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 83472b676d7Smrg qlibobj="\"$qlibobj\"" ;; 83572b676d7Smrg esac 83672b676d7Smrg test "X$libobj" != "X$qlibobj" \ 83772b676d7Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 83872b676d7Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 83972b676d7Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 84072b676d7Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 84172b676d7Smrg if test "X$xdir" = "X$obj"; then 84272b676d7Smrg xdir= 84372b676d7Smrg else 84472b676d7Smrg xdir=$xdir/ 84572b676d7Smrg fi 84672b676d7Smrg lobj=${xdir}$objdir/$objname 84772b676d7Smrg 84872b676d7Smrg if test -z "$base_compile"; then 84972b676d7Smrg $echo "$modename: you must specify a compilation command" 1>&2 85072b676d7Smrg $echo "$help" 1>&2 85172b676d7Smrg exit $EXIT_FAILURE 85272b676d7Smrg fi 85372b676d7Smrg 85472b676d7Smrg # Delete any leftover library objects. 85572b676d7Smrg if test "$build_old_libs" = yes; then 85672b676d7Smrg removelist="$obj $lobj $libobj ${libobj}T" 85772b676d7Smrg else 85872b676d7Smrg removelist="$lobj $libobj ${libobj}T" 85972b676d7Smrg fi 86072b676d7Smrg 86172b676d7Smrg $run $rm $removelist 86272b676d7Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 86372b676d7Smrg 86472b676d7Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 86572b676d7Smrg case $host_os in 86672b676d7Smrg cygwin* | mingw* | pw32* | os2*) 86772b676d7Smrg pic_mode=default 86872b676d7Smrg ;; 86972b676d7Smrg esac 87072b676d7Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 87172b676d7Smrg # non-PIC code in shared libraries is not supported 87272b676d7Smrg pic_mode=default 87372b676d7Smrg fi 87472b676d7Smrg 87572b676d7Smrg # Calculate the filename of the output object if compiler does 87672b676d7Smrg # not support -o with -c 87772b676d7Smrg if test "$compiler_c_o" = no; then 87872b676d7Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 87972b676d7Smrg lockfile="$output_obj.lock" 88072b676d7Smrg removelist="$removelist $output_obj $lockfile" 88172b676d7Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 88272b676d7Smrg else 88372b676d7Smrg output_obj= 88472b676d7Smrg need_locks=no 88572b676d7Smrg lockfile= 88672b676d7Smrg fi 88772b676d7Smrg 88872b676d7Smrg # Lock this critical section if it is needed 88972b676d7Smrg # We use this script file to make the link, it avoids creating a new file 89072b676d7Smrg if test "$need_locks" = yes; then 89172b676d7Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 89272b676d7Smrg $show "Waiting for $lockfile to be removed" 89372b676d7Smrg sleep 2 89472b676d7Smrg done 89572b676d7Smrg elif test "$need_locks" = warn; then 89672b676d7Smrg if test -f "$lockfile"; then 89772b676d7Smrg $echo "\ 89872b676d7Smrg*** ERROR, $lockfile exists and contains: 89972b676d7Smrg`cat $lockfile 2>/dev/null` 90072b676d7Smrg 90172b676d7SmrgThis indicates that another process is trying to use the same 90272b676d7Smrgtemporary object file, and libtool could not work around it because 90372b676d7Smrgyour compiler does not support \`-c' and \`-o' together. If you 90472b676d7Smrgrepeat this compilation, it may succeed, by chance, but you had better 90572b676d7Smrgavoid parallel builds (make -j) in this platform, or get a better 90672b676d7Smrgcompiler." 90772b676d7Smrg 90872b676d7Smrg $run $rm $removelist 90972b676d7Smrg exit $EXIT_FAILURE 91072b676d7Smrg fi 91172b676d7Smrg $echo "$srcfile" > "$lockfile" 91272b676d7Smrg fi 91372b676d7Smrg 91472b676d7Smrg if test -n "$fix_srcfile_path"; then 91572b676d7Smrg eval srcfile=\"$fix_srcfile_path\" 91672b676d7Smrg fi 91772b676d7Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 91872b676d7Smrg case $qsrcfile in 91972b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 92072b676d7Smrg qsrcfile="\"$qsrcfile\"" ;; 92172b676d7Smrg esac 92272b676d7Smrg 92372b676d7Smrg $run $rm "$libobj" "${libobj}T" 92472b676d7Smrg 92572b676d7Smrg # Create a libtool object file (analogous to a ".la" file), 92672b676d7Smrg # but don't create it if we're doing a dry run. 92772b676d7Smrg test -z "$run" && cat > ${libobj}T <<EOF 92872b676d7Smrg# $libobj - a libtool object file 92972b676d7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 93072b676d7Smrg# 93172b676d7Smrg# Please DO NOT delete this file! 93272b676d7Smrg# It is necessary for linking the library. 93372b676d7Smrg 93472b676d7Smrg# Name of the PIC object. 93572b676d7SmrgEOF 93672b676d7Smrg 93772b676d7Smrg # Only build a PIC object if we are building libtool libraries. 93872b676d7Smrg if test "$build_libtool_libs" = yes; then 93972b676d7Smrg # Without this assignment, base_compile gets emptied. 94072b676d7Smrg fbsd_hideous_sh_bug=$base_compile 94172b676d7Smrg 94272b676d7Smrg if test "$pic_mode" != no; then 94372b676d7Smrg command="$base_compile $qsrcfile $pic_flag" 94472b676d7Smrg else 94572b676d7Smrg # Don't build PIC code 94672b676d7Smrg command="$base_compile $qsrcfile" 94772b676d7Smrg fi 94872b676d7Smrg 94972b676d7Smrg if test ! -d "${xdir}$objdir"; then 95072b676d7Smrg $show "$mkdir ${xdir}$objdir" 95172b676d7Smrg $run $mkdir ${xdir}$objdir 95272b676d7Smrg exit_status=$? 95372b676d7Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 95472b676d7Smrg exit $exit_status 95572b676d7Smrg fi 95672b676d7Smrg fi 95772b676d7Smrg 95872b676d7Smrg if test -z "$output_obj"; then 95972b676d7Smrg # Place PIC objects in $objdir 96072b676d7Smrg command="$command -o $lobj" 96172b676d7Smrg fi 96272b676d7Smrg 96372b676d7Smrg $run $rm "$lobj" "$output_obj" 96472b676d7Smrg 96572b676d7Smrg $show "$command" 9661fd23544Smrg if $run eval $lt_env "$command"; then : 96772b676d7Smrg else 96872b676d7Smrg test -n "$output_obj" && $run $rm $removelist 96972b676d7Smrg exit $EXIT_FAILURE 97072b676d7Smrg fi 97172b676d7Smrg 97272b676d7Smrg if test "$need_locks" = warn && 97372b676d7Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 97472b676d7Smrg $echo "\ 97572b676d7Smrg*** ERROR, $lockfile contains: 97672b676d7Smrg`cat $lockfile 2>/dev/null` 97772b676d7Smrg 97872b676d7Smrgbut it should contain: 97972b676d7Smrg$srcfile 98072b676d7Smrg 98172b676d7SmrgThis indicates that another process is trying to use the same 98272b676d7Smrgtemporary object file, and libtool could not work around it because 98372b676d7Smrgyour compiler does not support \`-c' and \`-o' together. If you 98472b676d7Smrgrepeat this compilation, it may succeed, by chance, but you had better 98572b676d7Smrgavoid parallel builds (make -j) in this platform, or get a better 98672b676d7Smrgcompiler." 98772b676d7Smrg 98872b676d7Smrg $run $rm $removelist 98972b676d7Smrg exit $EXIT_FAILURE 99072b676d7Smrg fi 99172b676d7Smrg 99272b676d7Smrg # Just move the object if needed, then go on to compile the next one 99372b676d7Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 99472b676d7Smrg $show "$mv $output_obj $lobj" 99572b676d7Smrg if $run $mv $output_obj $lobj; then : 99672b676d7Smrg else 99772b676d7Smrg error=$? 99872b676d7Smrg $run $rm $removelist 99972b676d7Smrg exit $error 100072b676d7Smrg fi 100172b676d7Smrg fi 100272b676d7Smrg 100372b676d7Smrg # Append the name of the PIC object to the libtool object file. 100472b676d7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 100572b676d7Smrgpic_object='$objdir/$objname' 100672b676d7Smrg 100772b676d7SmrgEOF 100872b676d7Smrg 100972b676d7Smrg # Allow error messages only from the first compilation. 101072b676d7Smrg if test "$suppress_opt" = yes; then 101172b676d7Smrg suppress_output=' >/dev/null 2>&1' 101272b676d7Smrg fi 101372b676d7Smrg else 101472b676d7Smrg # No PIC object so indicate it doesn't exist in the libtool 101572b676d7Smrg # object file. 101672b676d7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 101772b676d7Smrgpic_object=none 101872b676d7Smrg 101972b676d7SmrgEOF 102072b676d7Smrg fi 102172b676d7Smrg 102272b676d7Smrg # Only build a position-dependent object if we build old libraries. 102372b676d7Smrg if test "$build_old_libs" = yes; then 102472b676d7Smrg if test "$pic_mode" != yes; then 102572b676d7Smrg # Don't build PIC code 102672b676d7Smrg command="$base_compile $qsrcfile" 102772b676d7Smrg else 102872b676d7Smrg command="$base_compile $qsrcfile $pic_flag" 102972b676d7Smrg fi 103072b676d7Smrg if test "$compiler_c_o" = yes; then 103172b676d7Smrg command="$command -o $obj" 103272b676d7Smrg fi 103372b676d7Smrg 103472b676d7Smrg # Suppress compiler output if we already did a PIC compilation. 103572b676d7Smrg command="$command$suppress_output" 103672b676d7Smrg $run $rm "$obj" "$output_obj" 103772b676d7Smrg $show "$command" 10381fd23544Smrg if $run eval $lt_env "$command"; then : 103972b676d7Smrg else 104072b676d7Smrg $run $rm $removelist 104172b676d7Smrg exit $EXIT_FAILURE 104272b676d7Smrg fi 104372b676d7Smrg 104472b676d7Smrg if test "$need_locks" = warn && 104572b676d7Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 104672b676d7Smrg $echo "\ 104772b676d7Smrg*** ERROR, $lockfile contains: 104872b676d7Smrg`cat $lockfile 2>/dev/null` 104972b676d7Smrg 105072b676d7Smrgbut it should contain: 105172b676d7Smrg$srcfile 105272b676d7Smrg 105372b676d7SmrgThis indicates that another process is trying to use the same 105472b676d7Smrgtemporary object file, and libtool could not work around it because 105572b676d7Smrgyour compiler does not support \`-c' and \`-o' together. If you 105672b676d7Smrgrepeat this compilation, it may succeed, by chance, but you had better 105772b676d7Smrgavoid parallel builds (make -j) in this platform, or get a better 105872b676d7Smrgcompiler." 105972b676d7Smrg 106072b676d7Smrg $run $rm $removelist 106172b676d7Smrg exit $EXIT_FAILURE 106272b676d7Smrg fi 106372b676d7Smrg 106472b676d7Smrg # Just move the object if needed 106572b676d7Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 106672b676d7Smrg $show "$mv $output_obj $obj" 106772b676d7Smrg if $run $mv $output_obj $obj; then : 106872b676d7Smrg else 106972b676d7Smrg error=$? 107072b676d7Smrg $run $rm $removelist 107172b676d7Smrg exit $error 107272b676d7Smrg fi 107372b676d7Smrg fi 107472b676d7Smrg 107572b676d7Smrg # Append the name of the non-PIC object the libtool object file. 107672b676d7Smrg # Only append if the libtool object file exists. 107772b676d7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 107872b676d7Smrg# Name of the non-PIC object. 107972b676d7Smrgnon_pic_object='$objname' 108072b676d7Smrg 108172b676d7SmrgEOF 108272b676d7Smrg else 108372b676d7Smrg # Append the name of the non-PIC object the libtool object file. 108472b676d7Smrg # Only append if the libtool object file exists. 108572b676d7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 108672b676d7Smrg# Name of the non-PIC object. 108772b676d7Smrgnon_pic_object=none 108872b676d7Smrg 108972b676d7SmrgEOF 109072b676d7Smrg fi 109172b676d7Smrg 109272b676d7Smrg $run $mv "${libobj}T" "${libobj}" 109372b676d7Smrg 109472b676d7Smrg # Unlock the critical section if it was locked 109572b676d7Smrg if test "$need_locks" != no; then 109672b676d7Smrg $run $rm "$lockfile" 109772b676d7Smrg fi 109872b676d7Smrg 109972b676d7Smrg exit $EXIT_SUCCESS 110072b676d7Smrg ;; 110172b676d7Smrg 110272b676d7Smrg # libtool link mode 110372b676d7Smrg link | relink) 110472b676d7Smrg modename="$modename: link" 110572b676d7Smrg case $host in 110672b676d7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 110772b676d7Smrg # It is impossible to link a dll without this setting, and 110872b676d7Smrg # we shouldn't force the makefile maintainer to figure out 110972b676d7Smrg # which system we are compiling for in order to pass an extra 111072b676d7Smrg # flag for every libtool invocation. 111172b676d7Smrg # allow_undefined=no 111272b676d7Smrg 111372b676d7Smrg # FIXME: Unfortunately, there are problems with the above when trying 111472b676d7Smrg # to make a dll which has undefined symbols, in which case not 111572b676d7Smrg # even a static library is built. For now, we need to specify 111672b676d7Smrg # -no-undefined on the libtool link line when we can be certain 111772b676d7Smrg # that all symbols are satisfied, otherwise we get a static library. 111872b676d7Smrg allow_undefined=yes 111972b676d7Smrg ;; 112072b676d7Smrg *) 112172b676d7Smrg allow_undefined=yes 112272b676d7Smrg ;; 112372b676d7Smrg esac 112472b676d7Smrg libtool_args="$nonopt" 112572b676d7Smrg base_compile="$nonopt $@" 112672b676d7Smrg compile_command="$nonopt" 112772b676d7Smrg finalize_command="$nonopt" 112872b676d7Smrg 112972b676d7Smrg compile_rpath= 113072b676d7Smrg finalize_rpath= 113172b676d7Smrg compile_shlibpath= 113272b676d7Smrg finalize_shlibpath= 113372b676d7Smrg convenience= 113472b676d7Smrg old_convenience= 113572b676d7Smrg deplibs= 113672b676d7Smrg old_deplibs= 113772b676d7Smrg compiler_flags= 113872b676d7Smrg linker_flags= 113972b676d7Smrg dllsearchpath= 114072b676d7Smrg lib_search_path=`pwd` 114172b676d7Smrg inst_prefix_dir= 114272b676d7Smrg 114372b676d7Smrg avoid_version=no 114472b676d7Smrg dlfiles= 114572b676d7Smrg dlprefiles= 114672b676d7Smrg dlself=no 114772b676d7Smrg export_dynamic=no 114872b676d7Smrg export_symbols= 114972b676d7Smrg export_symbols_regex= 115072b676d7Smrg generated= 115172b676d7Smrg libobjs= 115272b676d7Smrg ltlibs= 115372b676d7Smrg module=no 115472b676d7Smrg no_install=no 115572b676d7Smrg objs= 115672b676d7Smrg non_pic_objects= 115772b676d7Smrg notinst_path= # paths that contain not-installed libtool libraries 115872b676d7Smrg precious_files_regex= 115972b676d7Smrg prefer_static_libs=no 116072b676d7Smrg preload=no 116172b676d7Smrg prev= 116272b676d7Smrg prevarg= 116372b676d7Smrg release= 116472b676d7Smrg rpath= 116572b676d7Smrg xrpath= 116672b676d7Smrg perm_rpath= 116772b676d7Smrg temp_rpath= 116872b676d7Smrg thread_safe=no 116972b676d7Smrg vinfo= 117072b676d7Smrg vinfo_number=no 11711fd23544Smrg single_module="${wl}-single_module" 117272b676d7Smrg 117372b676d7Smrg func_infer_tag $base_compile 117472b676d7Smrg 117572b676d7Smrg # We need to know -static, to get the right output filenames. 117672b676d7Smrg for arg 117772b676d7Smrg do 117872b676d7Smrg case $arg in 11791fd23544Smrg -all-static | -static | -static-libtool-libs) 11801fd23544Smrg case $arg in 11811fd23544Smrg -all-static) 118272b676d7Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 118372b676d7Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 118472b676d7Smrg fi 118572b676d7Smrg if test -n "$link_static_flag"; then 118672b676d7Smrg dlopen_self=$dlopen_self_static 118772b676d7Smrg fi 118872b676d7Smrg prefer_static_libs=yes 11891fd23544Smrg ;; 11901fd23544Smrg -static) 119172b676d7Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 119272b676d7Smrg dlopen_self=$dlopen_self_static 119372b676d7Smrg fi 119472b676d7Smrg prefer_static_libs=built 11951fd23544Smrg ;; 11961fd23544Smrg -static-libtool-libs) 11971fd23544Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11981fd23544Smrg dlopen_self=$dlopen_self_static 11991fd23544Smrg fi 12001fd23544Smrg prefer_static_libs=yes 12011fd23544Smrg ;; 12021fd23544Smrg esac 120372b676d7Smrg build_libtool_libs=no 120472b676d7Smrg build_old_libs=yes 120572b676d7Smrg break 120672b676d7Smrg ;; 120772b676d7Smrg esac 120872b676d7Smrg done 120972b676d7Smrg 121072b676d7Smrg # See if our shared archives depend on static archives. 121172b676d7Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 121272b676d7Smrg 121372b676d7Smrg # Go through the arguments, transforming them on the way. 121472b676d7Smrg while test "$#" -gt 0; do 121572b676d7Smrg arg="$1" 121672b676d7Smrg shift 121772b676d7Smrg case $arg in 121872b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 121972b676d7Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 122072b676d7Smrg ;; 122172b676d7Smrg *) qarg=$arg ;; 122272b676d7Smrg esac 122372b676d7Smrg libtool_args="$libtool_args $qarg" 122472b676d7Smrg 122572b676d7Smrg # If the previous option needs an argument, assign it. 122672b676d7Smrg if test -n "$prev"; then 122772b676d7Smrg case $prev in 122872b676d7Smrg output) 122972b676d7Smrg compile_command="$compile_command @OUTPUT@" 123072b676d7Smrg finalize_command="$finalize_command @OUTPUT@" 123172b676d7Smrg ;; 123272b676d7Smrg esac 123372b676d7Smrg 123472b676d7Smrg case $prev in 123572b676d7Smrg dlfiles|dlprefiles) 123672b676d7Smrg if test "$preload" = no; then 123772b676d7Smrg # Add the symbol object into the linking commands. 123872b676d7Smrg compile_command="$compile_command @SYMFILE@" 123972b676d7Smrg finalize_command="$finalize_command @SYMFILE@" 124072b676d7Smrg preload=yes 124172b676d7Smrg fi 124272b676d7Smrg case $arg in 124372b676d7Smrg *.la | *.lo) ;; # We handle these cases below. 124472b676d7Smrg force) 124572b676d7Smrg if test "$dlself" = no; then 124672b676d7Smrg dlself=needless 124772b676d7Smrg export_dynamic=yes 124872b676d7Smrg fi 124972b676d7Smrg prev= 125072b676d7Smrg continue 125172b676d7Smrg ;; 125272b676d7Smrg self) 125372b676d7Smrg if test "$prev" = dlprefiles; then 125472b676d7Smrg dlself=yes 125572b676d7Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 125672b676d7Smrg dlself=yes 125772b676d7Smrg else 125872b676d7Smrg dlself=needless 125972b676d7Smrg export_dynamic=yes 126072b676d7Smrg fi 126172b676d7Smrg prev= 126272b676d7Smrg continue 126372b676d7Smrg ;; 126472b676d7Smrg *) 126572b676d7Smrg if test "$prev" = dlfiles; then 126672b676d7Smrg dlfiles="$dlfiles $arg" 126772b676d7Smrg else 126872b676d7Smrg dlprefiles="$dlprefiles $arg" 126972b676d7Smrg fi 127072b676d7Smrg prev= 127172b676d7Smrg continue 127272b676d7Smrg ;; 127372b676d7Smrg esac 127472b676d7Smrg ;; 127572b676d7Smrg expsyms) 127672b676d7Smrg export_symbols="$arg" 127772b676d7Smrg if test ! -f "$arg"; then 127872b676d7Smrg $echo "$modename: symbol file \`$arg' does not exist" 127972b676d7Smrg exit $EXIT_FAILURE 128072b676d7Smrg fi 128172b676d7Smrg prev= 128272b676d7Smrg continue 128372b676d7Smrg ;; 128472b676d7Smrg expsyms_regex) 128572b676d7Smrg export_symbols_regex="$arg" 128672b676d7Smrg prev= 128772b676d7Smrg continue 128872b676d7Smrg ;; 128972b676d7Smrg inst_prefix) 129072b676d7Smrg inst_prefix_dir="$arg" 129172b676d7Smrg prev= 129272b676d7Smrg continue 129372b676d7Smrg ;; 129472b676d7Smrg precious_regex) 129572b676d7Smrg precious_files_regex="$arg" 129672b676d7Smrg prev= 129772b676d7Smrg continue 129872b676d7Smrg ;; 129972b676d7Smrg release) 130072b676d7Smrg release="-$arg" 130172b676d7Smrg prev= 130272b676d7Smrg continue 130372b676d7Smrg ;; 130472b676d7Smrg objectlist) 130572b676d7Smrg if test -f "$arg"; then 130672b676d7Smrg save_arg=$arg 130772b676d7Smrg moreargs= 130872b676d7Smrg for fil in `cat $save_arg` 130972b676d7Smrg do 131072b676d7Smrg# moreargs="$moreargs $fil" 131172b676d7Smrg arg=$fil 131272b676d7Smrg # A libtool-controlled object. 131372b676d7Smrg 131472b676d7Smrg # Check to see that this really is a libtool object. 131572b676d7Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 131672b676d7Smrg pic_object= 131772b676d7Smrg non_pic_object= 131872b676d7Smrg 131972b676d7Smrg # Read the .lo file 132072b676d7Smrg # If there is no directory component, then add one. 132172b676d7Smrg case $arg in 132272b676d7Smrg */* | *\\*) . $arg ;; 132372b676d7Smrg *) . ./$arg ;; 132472b676d7Smrg esac 132572b676d7Smrg 132672b676d7Smrg if test -z "$pic_object" || \ 132772b676d7Smrg test -z "$non_pic_object" || 132872b676d7Smrg test "$pic_object" = none && \ 132972b676d7Smrg test "$non_pic_object" = none; then 133072b676d7Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 133172b676d7Smrg exit $EXIT_FAILURE 133272b676d7Smrg fi 133372b676d7Smrg 133472b676d7Smrg # Extract subdirectory from the argument. 133572b676d7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 133672b676d7Smrg if test "X$xdir" = "X$arg"; then 133772b676d7Smrg xdir= 133872b676d7Smrg else 133972b676d7Smrg xdir="$xdir/" 134072b676d7Smrg fi 134172b676d7Smrg 134272b676d7Smrg if test "$pic_object" != none; then 134372b676d7Smrg # Prepend the subdirectory the object is found in. 134472b676d7Smrg pic_object="$xdir$pic_object" 134572b676d7Smrg 134672b676d7Smrg if test "$prev" = dlfiles; then 134772b676d7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 134872b676d7Smrg dlfiles="$dlfiles $pic_object" 134972b676d7Smrg prev= 135072b676d7Smrg continue 135172b676d7Smrg else 135272b676d7Smrg # If libtool objects are unsupported, then we need to preload. 135372b676d7Smrg prev=dlprefiles 135472b676d7Smrg fi 135572b676d7Smrg fi 135672b676d7Smrg 135772b676d7Smrg # CHECK ME: I think I busted this. -Ossama 135872b676d7Smrg if test "$prev" = dlprefiles; then 135972b676d7Smrg # Preload the old-style object. 136072b676d7Smrg dlprefiles="$dlprefiles $pic_object" 136172b676d7Smrg prev= 136272b676d7Smrg fi 136372b676d7Smrg 136472b676d7Smrg # A PIC object. 136572b676d7Smrg libobjs="$libobjs $pic_object" 136672b676d7Smrg arg="$pic_object" 136772b676d7Smrg fi 136872b676d7Smrg 136972b676d7Smrg # Non-PIC object. 137072b676d7Smrg if test "$non_pic_object" != none; then 137172b676d7Smrg # Prepend the subdirectory the object is found in. 137272b676d7Smrg non_pic_object="$xdir$non_pic_object" 137372b676d7Smrg 137472b676d7Smrg # A standard non-PIC object 137572b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 137672b676d7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 137772b676d7Smrg arg="$non_pic_object" 137872b676d7Smrg fi 137972b676d7Smrg else 138072b676d7Smrg # If the PIC object exists, use it instead. 138172b676d7Smrg # $xdir was prepended to $pic_object above. 138272b676d7Smrg non_pic_object="$pic_object" 138372b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 138472b676d7Smrg fi 138572b676d7Smrg else 138672b676d7Smrg # Only an error if not doing a dry-run. 138772b676d7Smrg if test -z "$run"; then 138872b676d7Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 138972b676d7Smrg exit $EXIT_FAILURE 139072b676d7Smrg else 139172b676d7Smrg # Dry-run case. 139272b676d7Smrg 139372b676d7Smrg # Extract subdirectory from the argument. 139472b676d7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 139572b676d7Smrg if test "X$xdir" = "X$arg"; then 139672b676d7Smrg xdir= 139772b676d7Smrg else 139872b676d7Smrg xdir="$xdir/" 139972b676d7Smrg fi 140072b676d7Smrg 140172b676d7Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 140272b676d7Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 140372b676d7Smrg libobjs="$libobjs $pic_object" 140472b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 140572b676d7Smrg fi 140672b676d7Smrg fi 140772b676d7Smrg done 140872b676d7Smrg else 140972b676d7Smrg $echo "$modename: link input file \`$save_arg' does not exist" 141072b676d7Smrg exit $EXIT_FAILURE 141172b676d7Smrg fi 141272b676d7Smrg arg=$save_arg 141372b676d7Smrg prev= 141472b676d7Smrg continue 141572b676d7Smrg ;; 141672b676d7Smrg rpath | xrpath) 141772b676d7Smrg # We need an absolute path. 141872b676d7Smrg case $arg in 141972b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 142072b676d7Smrg *) 142172b676d7Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 142272b676d7Smrg exit $EXIT_FAILURE 142372b676d7Smrg ;; 142472b676d7Smrg esac 142572b676d7Smrg if test "$prev" = rpath; then 142672b676d7Smrg case "$rpath " in 142772b676d7Smrg *" $arg "*) ;; 142872b676d7Smrg *) rpath="$rpath $arg" ;; 142972b676d7Smrg esac 143072b676d7Smrg else 143172b676d7Smrg case "$xrpath " in 143272b676d7Smrg *" $arg "*) ;; 143372b676d7Smrg *) xrpath="$xrpath $arg" ;; 143472b676d7Smrg esac 143572b676d7Smrg fi 143672b676d7Smrg prev= 143772b676d7Smrg continue 143872b676d7Smrg ;; 143972b676d7Smrg xcompiler) 144072b676d7Smrg compiler_flags="$compiler_flags $qarg" 144172b676d7Smrg prev= 144272b676d7Smrg compile_command="$compile_command $qarg" 144372b676d7Smrg finalize_command="$finalize_command $qarg" 144472b676d7Smrg continue 144572b676d7Smrg ;; 144672b676d7Smrg xlinker) 144772b676d7Smrg linker_flags="$linker_flags $qarg" 144872b676d7Smrg compiler_flags="$compiler_flags $wl$qarg" 144972b676d7Smrg prev= 145072b676d7Smrg compile_command="$compile_command $wl$qarg" 145172b676d7Smrg finalize_command="$finalize_command $wl$qarg" 145272b676d7Smrg continue 145372b676d7Smrg ;; 145472b676d7Smrg xcclinker) 145572b676d7Smrg linker_flags="$linker_flags $qarg" 145672b676d7Smrg compiler_flags="$compiler_flags $qarg" 145772b676d7Smrg prev= 145872b676d7Smrg compile_command="$compile_command $qarg" 145972b676d7Smrg finalize_command="$finalize_command $qarg" 146072b676d7Smrg continue 146172b676d7Smrg ;; 146272b676d7Smrg shrext) 146372b676d7Smrg shrext_cmds="$arg" 146472b676d7Smrg prev= 146572b676d7Smrg continue 146672b676d7Smrg ;; 146772b676d7Smrg darwin_framework|darwin_framework_skip) 146872b676d7Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 146972b676d7Smrg compile_command="$compile_command $arg" 147072b676d7Smrg finalize_command="$finalize_command $arg" 147172b676d7Smrg prev= 147272b676d7Smrg continue 147372b676d7Smrg ;; 147472b676d7Smrg *) 147572b676d7Smrg eval "$prev=\"\$arg\"" 147672b676d7Smrg prev= 147772b676d7Smrg continue 147872b676d7Smrg ;; 147972b676d7Smrg esac 148072b676d7Smrg fi # test -n "$prev" 148172b676d7Smrg 148272b676d7Smrg prevarg="$arg" 148372b676d7Smrg 148472b676d7Smrg case $arg in 148572b676d7Smrg -all-static) 148672b676d7Smrg if test -n "$link_static_flag"; then 148772b676d7Smrg compile_command="$compile_command $link_static_flag" 148872b676d7Smrg finalize_command="$finalize_command $link_static_flag" 148972b676d7Smrg fi 149072b676d7Smrg continue 149172b676d7Smrg ;; 149272b676d7Smrg 149372b676d7Smrg -allow-undefined) 149472b676d7Smrg # FIXME: remove this flag sometime in the future. 149572b676d7Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 149672b676d7Smrg continue 149772b676d7Smrg ;; 149872b676d7Smrg 149972b676d7Smrg -avoid-version) 150072b676d7Smrg avoid_version=yes 150172b676d7Smrg continue 150272b676d7Smrg ;; 150372b676d7Smrg 150472b676d7Smrg -dlopen) 150572b676d7Smrg prev=dlfiles 150672b676d7Smrg continue 150772b676d7Smrg ;; 150872b676d7Smrg 150972b676d7Smrg -dlpreopen) 151072b676d7Smrg prev=dlprefiles 151172b676d7Smrg continue 151272b676d7Smrg ;; 151372b676d7Smrg 151472b676d7Smrg -export-dynamic) 151572b676d7Smrg export_dynamic=yes 151672b676d7Smrg continue 151772b676d7Smrg ;; 151872b676d7Smrg 151972b676d7Smrg -export-symbols | -export-symbols-regex) 152072b676d7Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 152172b676d7Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 152272b676d7Smrg exit $EXIT_FAILURE 152372b676d7Smrg fi 152472b676d7Smrg if test "X$arg" = "X-export-symbols"; then 152572b676d7Smrg prev=expsyms 152672b676d7Smrg else 152772b676d7Smrg prev=expsyms_regex 152872b676d7Smrg fi 152972b676d7Smrg continue 153072b676d7Smrg ;; 153172b676d7Smrg 153272b676d7Smrg -framework|-arch|-isysroot) 153372b676d7Smrg case " $CC " in 153472b676d7Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 153572b676d7Smrg prev=darwin_framework_skip ;; 153672b676d7Smrg *) compiler_flags="$compiler_flags $arg" 153772b676d7Smrg prev=darwin_framework ;; 153872b676d7Smrg esac 153972b676d7Smrg compile_command="$compile_command $arg" 154072b676d7Smrg finalize_command="$finalize_command $arg" 154172b676d7Smrg continue 154272b676d7Smrg ;; 154372b676d7Smrg 154472b676d7Smrg -inst-prefix-dir) 154572b676d7Smrg prev=inst_prefix 154672b676d7Smrg continue 154772b676d7Smrg ;; 154872b676d7Smrg 154972b676d7Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 155072b676d7Smrg # so, if we see these flags be careful not to treat them like -L 155172b676d7Smrg -L[A-Z][A-Z]*:*) 155272b676d7Smrg case $with_gcc/$host in 155372b676d7Smrg no/*-*-irix* | /*-*-irix*) 155472b676d7Smrg compile_command="$compile_command $arg" 155572b676d7Smrg finalize_command="$finalize_command $arg" 155672b676d7Smrg ;; 155772b676d7Smrg esac 155872b676d7Smrg continue 155972b676d7Smrg ;; 156072b676d7Smrg 156172b676d7Smrg -L*) 156272b676d7Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 156372b676d7Smrg # We need an absolute path. 156472b676d7Smrg case $dir in 156572b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 156672b676d7Smrg *) 156772b676d7Smrg absdir=`cd "$dir" && pwd` 156872b676d7Smrg if test -z "$absdir"; then 156972b676d7Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 157072b676d7Smrg absdir="$dir" 157172b676d7Smrg notinst_path="$notinst_path $dir" 157272b676d7Smrg fi 157372b676d7Smrg dir="$absdir" 157472b676d7Smrg ;; 157572b676d7Smrg esac 157672b676d7Smrg case "$deplibs " in 157772b676d7Smrg *" -L$dir "*) ;; 157872b676d7Smrg *) 157972b676d7Smrg deplibs="$deplibs -L$dir" 158072b676d7Smrg lib_search_path="$lib_search_path $dir" 158172b676d7Smrg ;; 158272b676d7Smrg esac 158372b676d7Smrg case $host in 158472b676d7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 158572b676d7Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 158672b676d7Smrg case :$dllsearchpath: in 158772b676d7Smrg *":$dir:"*) ;; 158872b676d7Smrg *) dllsearchpath="$dllsearchpath:$dir";; 158972b676d7Smrg esac 159072b676d7Smrg case :$dllsearchpath: in 159172b676d7Smrg *":$testbindir:"*) ;; 159272b676d7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 159372b676d7Smrg esac 159472b676d7Smrg ;; 159572b676d7Smrg esac 159672b676d7Smrg continue 159772b676d7Smrg ;; 159872b676d7Smrg 159972b676d7Smrg -l*) 160072b676d7Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 160172b676d7Smrg case $host in 160272b676d7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 160372b676d7Smrg # These systems don't actually have a C or math library (as such) 160472b676d7Smrg continue 160572b676d7Smrg ;; 160672b676d7Smrg *-*-os2*) 160772b676d7Smrg # These systems don't actually have a C library (as such) 160872b676d7Smrg test "X$arg" = "X-lc" && continue 160972b676d7Smrg ;; 161072b676d7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 161172b676d7Smrg # Do not include libc due to us having libc/libc_r. 161272b676d7Smrg test "X$arg" = "X-lc" && continue 161372b676d7Smrg ;; 161472b676d7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 161572b676d7Smrg # Rhapsody C and math libraries are in the System framework 161672b676d7Smrg deplibs="$deplibs -framework System" 161772b676d7Smrg continue 161872b676d7Smrg ;; 161972b676d7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 162072b676d7Smrg # Causes problems with __ctype 162172b676d7Smrg test "X$arg" = "X-lc" && continue 162272b676d7Smrg ;; 162372b676d7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 162472b676d7Smrg # Compiler inserts libc in the correct place for threads to work 162572b676d7Smrg test "X$arg" = "X-lc" && continue 162672b676d7Smrg ;; 162772b676d7Smrg esac 162872b676d7Smrg elif test "X$arg" = "X-lc_r"; then 162972b676d7Smrg case $host in 163072b676d7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 163172b676d7Smrg # Do not include libc_r directly, use -pthread flag. 163272b676d7Smrg continue 163372b676d7Smrg ;; 163472b676d7Smrg esac 163572b676d7Smrg fi 163672b676d7Smrg deplibs="$deplibs $arg" 163772b676d7Smrg continue 163872b676d7Smrg ;; 163972b676d7Smrg 164072b676d7Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 164172b676d7Smrg # classes, name mangling, and exception handling. 164272b676d7Smrg -model) 164372b676d7Smrg compile_command="$compile_command $arg" 164472b676d7Smrg compiler_flags="$compiler_flags $arg" 164572b676d7Smrg finalize_command="$finalize_command $arg" 164672b676d7Smrg prev=xcompiler 164772b676d7Smrg continue 164872b676d7Smrg ;; 164972b676d7Smrg 16501fd23544Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 165172b676d7Smrg compiler_flags="$compiler_flags $arg" 165272b676d7Smrg compile_command="$compile_command $arg" 165372b676d7Smrg finalize_command="$finalize_command $arg" 165472b676d7Smrg continue 165572b676d7Smrg ;; 165672b676d7Smrg 16571fd23544Smrg -multi_module) 16581fd23544Smrg single_module="${wl}-multi_module" 16591fd23544Smrg continue 16601fd23544Smrg ;; 16611fd23544Smrg 166272b676d7Smrg -module) 166372b676d7Smrg module=yes 166472b676d7Smrg continue 166572b676d7Smrg ;; 166672b676d7Smrg 166772b676d7Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 166872b676d7Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 166972b676d7Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 167072b676d7Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 167172b676d7Smrg # -q* pass through compiler args for the IBM compiler 167272b676d7Smrg # -m* pass through architecture-specific compiler args for GCC 167372b676d7Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 167472b676d7Smrg # compiler args for GCC 16751fd23544Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 16761fd23544Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 167772b676d7Smrg # @file GCC response files 16781fd23544Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 16791fd23544Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 168072b676d7Smrg 168172b676d7Smrg # Unknown arguments in both finalize_command and compile_command need 168272b676d7Smrg # to be aesthetically quoted because they are evaled later. 168372b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 168472b676d7Smrg case $arg in 168572b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 168672b676d7Smrg arg="\"$arg\"" 168772b676d7Smrg ;; 168872b676d7Smrg esac 168972b676d7Smrg compile_command="$compile_command $arg" 169072b676d7Smrg finalize_command="$finalize_command $arg" 169172b676d7Smrg compiler_flags="$compiler_flags $arg" 169272b676d7Smrg continue 169372b676d7Smrg ;; 169472b676d7Smrg 169572b676d7Smrg -shrext) 169672b676d7Smrg prev=shrext 169772b676d7Smrg continue 169872b676d7Smrg ;; 169972b676d7Smrg 170072b676d7Smrg -no-fast-install) 170172b676d7Smrg fast_install=no 170272b676d7Smrg continue 170372b676d7Smrg ;; 170472b676d7Smrg 170572b676d7Smrg -no-install) 170672b676d7Smrg case $host in 17071fd23544Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 170872b676d7Smrg # The PATH hackery in wrapper scripts is required on Windows 17091fd23544Smrg # and Darwin in order for the loader to find any dlls it needs. 171072b676d7Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 171172b676d7Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 171272b676d7Smrg fast_install=no 171372b676d7Smrg ;; 171472b676d7Smrg *) no_install=yes ;; 171572b676d7Smrg esac 171672b676d7Smrg continue 171772b676d7Smrg ;; 171872b676d7Smrg 171972b676d7Smrg -no-undefined) 172072b676d7Smrg allow_undefined=no 172172b676d7Smrg continue 172272b676d7Smrg ;; 172372b676d7Smrg 172472b676d7Smrg -objectlist) 172572b676d7Smrg prev=objectlist 172672b676d7Smrg continue 172772b676d7Smrg ;; 172872b676d7Smrg 172972b676d7Smrg -o) prev=output ;; 173072b676d7Smrg 173172b676d7Smrg -precious-files-regex) 173272b676d7Smrg prev=precious_regex 173372b676d7Smrg continue 173472b676d7Smrg ;; 173572b676d7Smrg 173672b676d7Smrg -release) 173772b676d7Smrg prev=release 173872b676d7Smrg continue 173972b676d7Smrg ;; 174072b676d7Smrg 174172b676d7Smrg -rpath) 174272b676d7Smrg prev=rpath 174372b676d7Smrg continue 174472b676d7Smrg ;; 174572b676d7Smrg 174672b676d7Smrg -R) 174772b676d7Smrg prev=xrpath 174872b676d7Smrg continue 174972b676d7Smrg ;; 175072b676d7Smrg 175172b676d7Smrg -R*) 175272b676d7Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 175372b676d7Smrg # We need an absolute path. 175472b676d7Smrg case $dir in 175572b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 175672b676d7Smrg *) 175772b676d7Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 175872b676d7Smrg exit $EXIT_FAILURE 175972b676d7Smrg ;; 176072b676d7Smrg esac 176172b676d7Smrg case "$xrpath " in 176272b676d7Smrg *" $dir "*) ;; 176372b676d7Smrg *) xrpath="$xrpath $dir" ;; 176472b676d7Smrg esac 176572b676d7Smrg continue 176672b676d7Smrg ;; 176772b676d7Smrg 17681fd23544Smrg -static | -static-libtool-libs) 176972b676d7Smrg # The effects of -static are defined in a previous loop. 177072b676d7Smrg # We used to do the same as -all-static on platforms that 177172b676d7Smrg # didn't have a PIC flag, but the assumption that the effects 177272b676d7Smrg # would be equivalent was wrong. It would break on at least 177372b676d7Smrg # Digital Unix and AIX. 177472b676d7Smrg continue 177572b676d7Smrg ;; 177672b676d7Smrg 177772b676d7Smrg -thread-safe) 177872b676d7Smrg thread_safe=yes 177972b676d7Smrg continue 178072b676d7Smrg ;; 178172b676d7Smrg 178272b676d7Smrg -version-info) 178372b676d7Smrg prev=vinfo 178472b676d7Smrg continue 178572b676d7Smrg ;; 178672b676d7Smrg -version-number) 178772b676d7Smrg prev=vinfo 178872b676d7Smrg vinfo_number=yes 178972b676d7Smrg continue 179072b676d7Smrg ;; 179172b676d7Smrg 179272b676d7Smrg -Wc,*) 179372b676d7Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 179472b676d7Smrg arg= 179572b676d7Smrg save_ifs="$IFS"; IFS=',' 179672b676d7Smrg for flag in $args; do 179772b676d7Smrg IFS="$save_ifs" 179872b676d7Smrg case $flag in 179972b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 180072b676d7Smrg flag="\"$flag\"" 180172b676d7Smrg ;; 180272b676d7Smrg esac 180372b676d7Smrg arg="$arg $wl$flag" 180472b676d7Smrg compiler_flags="$compiler_flags $flag" 180572b676d7Smrg done 180672b676d7Smrg IFS="$save_ifs" 180772b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 180872b676d7Smrg ;; 180972b676d7Smrg 181072b676d7Smrg -Wl,*) 181172b676d7Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 181272b676d7Smrg arg= 181372b676d7Smrg save_ifs="$IFS"; IFS=',' 181472b676d7Smrg for flag in $args; do 181572b676d7Smrg IFS="$save_ifs" 181672b676d7Smrg case $flag in 181772b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 181872b676d7Smrg flag="\"$flag\"" 181972b676d7Smrg ;; 182072b676d7Smrg esac 182172b676d7Smrg arg="$arg $wl$flag" 182272b676d7Smrg compiler_flags="$compiler_flags $wl$flag" 182372b676d7Smrg linker_flags="$linker_flags $flag" 182472b676d7Smrg done 182572b676d7Smrg IFS="$save_ifs" 182672b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 182772b676d7Smrg ;; 182872b676d7Smrg 182972b676d7Smrg -Xcompiler) 183072b676d7Smrg prev=xcompiler 183172b676d7Smrg continue 183272b676d7Smrg ;; 183372b676d7Smrg 183472b676d7Smrg -Xlinker) 183572b676d7Smrg prev=xlinker 183672b676d7Smrg continue 183772b676d7Smrg ;; 183872b676d7Smrg 183972b676d7Smrg -XCClinker) 184072b676d7Smrg prev=xcclinker 184172b676d7Smrg continue 184272b676d7Smrg ;; 184372b676d7Smrg 184472b676d7Smrg # Some other compiler flag. 184572b676d7Smrg -* | +*) 184672b676d7Smrg # Unknown arguments in both finalize_command and compile_command need 184772b676d7Smrg # to be aesthetically quoted because they are evaled later. 184872b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 184972b676d7Smrg case $arg in 185072b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 185172b676d7Smrg arg="\"$arg\"" 185272b676d7Smrg ;; 185372b676d7Smrg esac 185472b676d7Smrg ;; 185572b676d7Smrg 185672b676d7Smrg *.$objext) 185772b676d7Smrg # A standard object. 185872b676d7Smrg objs="$objs $arg" 185972b676d7Smrg ;; 186072b676d7Smrg 186172b676d7Smrg *.lo) 186272b676d7Smrg # A libtool-controlled object. 186372b676d7Smrg 186472b676d7Smrg # Check to see that this really is a libtool object. 186572b676d7Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 186672b676d7Smrg pic_object= 186772b676d7Smrg non_pic_object= 186872b676d7Smrg 186972b676d7Smrg # Read the .lo file 187072b676d7Smrg # If there is no directory component, then add one. 187172b676d7Smrg case $arg in 187272b676d7Smrg */* | *\\*) . $arg ;; 187372b676d7Smrg *) . ./$arg ;; 187472b676d7Smrg esac 187572b676d7Smrg 187672b676d7Smrg if test -z "$pic_object" || \ 187772b676d7Smrg test -z "$non_pic_object" || 187872b676d7Smrg test "$pic_object" = none && \ 187972b676d7Smrg test "$non_pic_object" = none; then 188072b676d7Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 188172b676d7Smrg exit $EXIT_FAILURE 188272b676d7Smrg fi 188372b676d7Smrg 188472b676d7Smrg # Extract subdirectory from the argument. 188572b676d7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 188672b676d7Smrg if test "X$xdir" = "X$arg"; then 188772b676d7Smrg xdir= 188872b676d7Smrg else 188972b676d7Smrg xdir="$xdir/" 189072b676d7Smrg fi 189172b676d7Smrg 189272b676d7Smrg if test "$pic_object" != none; then 189372b676d7Smrg # Prepend the subdirectory the object is found in. 189472b676d7Smrg pic_object="$xdir$pic_object" 189572b676d7Smrg 189672b676d7Smrg if test "$prev" = dlfiles; then 189772b676d7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 189872b676d7Smrg dlfiles="$dlfiles $pic_object" 189972b676d7Smrg prev= 190072b676d7Smrg continue 190172b676d7Smrg else 190272b676d7Smrg # If libtool objects are unsupported, then we need to preload. 190372b676d7Smrg prev=dlprefiles 190472b676d7Smrg fi 190572b676d7Smrg fi 190672b676d7Smrg 190772b676d7Smrg # CHECK ME: I think I busted this. -Ossama 190872b676d7Smrg if test "$prev" = dlprefiles; then 190972b676d7Smrg # Preload the old-style object. 191072b676d7Smrg dlprefiles="$dlprefiles $pic_object" 191172b676d7Smrg prev= 191272b676d7Smrg fi 191372b676d7Smrg 191472b676d7Smrg # A PIC object. 191572b676d7Smrg libobjs="$libobjs $pic_object" 191672b676d7Smrg arg="$pic_object" 191772b676d7Smrg fi 191872b676d7Smrg 191972b676d7Smrg # Non-PIC object. 192072b676d7Smrg if test "$non_pic_object" != none; then 192172b676d7Smrg # Prepend the subdirectory the object is found in. 192272b676d7Smrg non_pic_object="$xdir$non_pic_object" 192372b676d7Smrg 192472b676d7Smrg # A standard non-PIC object 192572b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 192672b676d7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 192772b676d7Smrg arg="$non_pic_object" 192872b676d7Smrg fi 192972b676d7Smrg else 193072b676d7Smrg # If the PIC object exists, use it instead. 193172b676d7Smrg # $xdir was prepended to $pic_object above. 193272b676d7Smrg non_pic_object="$pic_object" 193372b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 193472b676d7Smrg fi 193572b676d7Smrg else 193672b676d7Smrg # Only an error if not doing a dry-run. 193772b676d7Smrg if test -z "$run"; then 193872b676d7Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 193972b676d7Smrg exit $EXIT_FAILURE 194072b676d7Smrg else 194172b676d7Smrg # Dry-run case. 194272b676d7Smrg 194372b676d7Smrg # Extract subdirectory from the argument. 194472b676d7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 194572b676d7Smrg if test "X$xdir" = "X$arg"; then 194672b676d7Smrg xdir= 194772b676d7Smrg else 194872b676d7Smrg xdir="$xdir/" 194972b676d7Smrg fi 195072b676d7Smrg 195172b676d7Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 195272b676d7Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 195372b676d7Smrg libobjs="$libobjs $pic_object" 195472b676d7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 195572b676d7Smrg fi 195672b676d7Smrg fi 195772b676d7Smrg ;; 195872b676d7Smrg 195972b676d7Smrg *.$libext) 196072b676d7Smrg # An archive. 196172b676d7Smrg deplibs="$deplibs $arg" 196272b676d7Smrg old_deplibs="$old_deplibs $arg" 196372b676d7Smrg continue 196472b676d7Smrg ;; 196572b676d7Smrg 196672b676d7Smrg *.la) 196772b676d7Smrg # A libtool-controlled library. 196872b676d7Smrg 196972b676d7Smrg if test "$prev" = dlfiles; then 197072b676d7Smrg # This library was specified with -dlopen. 197172b676d7Smrg dlfiles="$dlfiles $arg" 197272b676d7Smrg prev= 197372b676d7Smrg elif test "$prev" = dlprefiles; then 197472b676d7Smrg # The library was specified with -dlpreopen. 197572b676d7Smrg dlprefiles="$dlprefiles $arg" 197672b676d7Smrg prev= 197772b676d7Smrg else 197872b676d7Smrg deplibs="$deplibs $arg" 197972b676d7Smrg fi 198072b676d7Smrg continue 198172b676d7Smrg ;; 198272b676d7Smrg 198372b676d7Smrg # Some other compiler argument. 198472b676d7Smrg *) 198572b676d7Smrg # Unknown arguments in both finalize_command and compile_command need 198672b676d7Smrg # to be aesthetically quoted because they are evaled later. 198772b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 198872b676d7Smrg case $arg in 198972b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 199072b676d7Smrg arg="\"$arg\"" 199172b676d7Smrg ;; 199272b676d7Smrg esac 199372b676d7Smrg ;; 199472b676d7Smrg esac # arg 199572b676d7Smrg 199672b676d7Smrg # Now actually substitute the argument into the commands. 199772b676d7Smrg if test -n "$arg"; then 199872b676d7Smrg compile_command="$compile_command $arg" 199972b676d7Smrg finalize_command="$finalize_command $arg" 200072b676d7Smrg fi 200172b676d7Smrg done # argument parsing loop 200272b676d7Smrg 200372b676d7Smrg if test -n "$prev"; then 200472b676d7Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 200572b676d7Smrg $echo "$help" 1>&2 200672b676d7Smrg exit $EXIT_FAILURE 200772b676d7Smrg fi 200872b676d7Smrg 200972b676d7Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 201072b676d7Smrg eval arg=\"$export_dynamic_flag_spec\" 201172b676d7Smrg compile_command="$compile_command $arg" 201272b676d7Smrg finalize_command="$finalize_command $arg" 201372b676d7Smrg fi 201472b676d7Smrg 201572b676d7Smrg oldlibs= 201672b676d7Smrg # calculate the name of the file, without its directory 201772b676d7Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 201872b676d7Smrg libobjs_save="$libobjs" 201972b676d7Smrg 202072b676d7Smrg if test -n "$shlibpath_var"; then 202172b676d7Smrg # get the directories listed in $shlibpath_var 202272b676d7Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 202372b676d7Smrg else 202472b676d7Smrg shlib_search_path= 202572b676d7Smrg fi 202672b676d7Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 202772b676d7Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 202872b676d7Smrg 202972b676d7Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 203072b676d7Smrg if test "X$output_objdir" = "X$output"; then 203172b676d7Smrg output_objdir="$objdir" 203272b676d7Smrg else 203372b676d7Smrg output_objdir="$output_objdir/$objdir" 203472b676d7Smrg fi 203572b676d7Smrg # Create the object directory. 203672b676d7Smrg if test ! -d "$output_objdir"; then 203772b676d7Smrg $show "$mkdir $output_objdir" 203872b676d7Smrg $run $mkdir $output_objdir 203972b676d7Smrg exit_status=$? 204072b676d7Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 204172b676d7Smrg exit $exit_status 204272b676d7Smrg fi 204372b676d7Smrg fi 204472b676d7Smrg 204572b676d7Smrg # Determine the type of output 204672b676d7Smrg case $output in 204772b676d7Smrg "") 204872b676d7Smrg $echo "$modename: you must specify an output file" 1>&2 204972b676d7Smrg $echo "$help" 1>&2 205072b676d7Smrg exit $EXIT_FAILURE 205172b676d7Smrg ;; 205272b676d7Smrg *.$libext) linkmode=oldlib ;; 205372b676d7Smrg *.lo | *.$objext) linkmode=obj ;; 205472b676d7Smrg *.la) linkmode=lib ;; 205572b676d7Smrg *) linkmode=prog ;; # Anything else should be a program. 205672b676d7Smrg esac 205772b676d7Smrg 205872b676d7Smrg case $host in 205972b676d7Smrg *cygwin* | *mingw* | *pw32*) 206072b676d7Smrg # don't eliminate duplications in $postdeps and $predeps 206172b676d7Smrg duplicate_compiler_generated_deps=yes 206272b676d7Smrg ;; 206372b676d7Smrg *) 206472b676d7Smrg duplicate_compiler_generated_deps=$duplicate_deps 206572b676d7Smrg ;; 206672b676d7Smrg esac 206772b676d7Smrg specialdeplibs= 206872b676d7Smrg 206972b676d7Smrg libs= 207072b676d7Smrg # Find all interdependent deplibs by searching for libraries 207172b676d7Smrg # that are linked more than once (e.g. -la -lb -la) 207272b676d7Smrg for deplib in $deplibs; do 207372b676d7Smrg if test "X$duplicate_deps" = "Xyes" ; then 207472b676d7Smrg case "$libs " in 207572b676d7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 207672b676d7Smrg esac 207772b676d7Smrg fi 207872b676d7Smrg libs="$libs $deplib" 207972b676d7Smrg done 208072b676d7Smrg 208172b676d7Smrg if test "$linkmode" = lib; then 208272b676d7Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 208372b676d7Smrg 208472b676d7Smrg # Compute libraries that are listed more than once in $predeps 208572b676d7Smrg # $postdeps and mark them as special (i.e., whose duplicates are 208672b676d7Smrg # not to be eliminated). 208772b676d7Smrg pre_post_deps= 208872b676d7Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 208972b676d7Smrg for pre_post_dep in $predeps $postdeps; do 209072b676d7Smrg case "$pre_post_deps " in 209172b676d7Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 209272b676d7Smrg esac 209372b676d7Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 209472b676d7Smrg done 209572b676d7Smrg fi 209672b676d7Smrg pre_post_deps= 209772b676d7Smrg fi 209872b676d7Smrg 209972b676d7Smrg deplibs= 210072b676d7Smrg newdependency_libs= 210172b676d7Smrg newlib_search_path= 210272b676d7Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 210372b676d7Smrg notinst_deplibs= # not-installed libtool libraries 210472b676d7Smrg case $linkmode in 210572b676d7Smrg lib) 210672b676d7Smrg passes="conv link" 210772b676d7Smrg for file in $dlfiles $dlprefiles; do 210872b676d7Smrg case $file in 210972b676d7Smrg *.la) ;; 211072b676d7Smrg *) 211172b676d7Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 211272b676d7Smrg exit $EXIT_FAILURE 211372b676d7Smrg ;; 211472b676d7Smrg esac 211572b676d7Smrg done 211672b676d7Smrg ;; 211772b676d7Smrg prog) 211872b676d7Smrg compile_deplibs= 211972b676d7Smrg finalize_deplibs= 212072b676d7Smrg alldeplibs=no 212172b676d7Smrg newdlfiles= 212272b676d7Smrg newdlprefiles= 212372b676d7Smrg passes="conv scan dlopen dlpreopen link" 212472b676d7Smrg ;; 212572b676d7Smrg *) passes="conv" 212672b676d7Smrg ;; 212772b676d7Smrg esac 212872b676d7Smrg for pass in $passes; do 212972b676d7Smrg if test "$linkmode,$pass" = "lib,link" || 213072b676d7Smrg test "$linkmode,$pass" = "prog,scan"; then 213172b676d7Smrg libs="$deplibs" 213272b676d7Smrg deplibs= 213372b676d7Smrg fi 213472b676d7Smrg if test "$linkmode" = prog; then 213572b676d7Smrg case $pass in 213672b676d7Smrg dlopen) libs="$dlfiles" ;; 213772b676d7Smrg dlpreopen) libs="$dlprefiles" ;; 21381fd23544Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 213972b676d7Smrg esac 214072b676d7Smrg fi 214172b676d7Smrg if test "$pass" = dlopen; then 214272b676d7Smrg # Collect dlpreopened libraries 214372b676d7Smrg save_deplibs="$deplibs" 214472b676d7Smrg deplibs= 214572b676d7Smrg fi 214672b676d7Smrg for deplib in $libs; do 214772b676d7Smrg lib= 214872b676d7Smrg found=no 214972b676d7Smrg case $deplib in 21501fd23544Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 215172b676d7Smrg if test "$linkmode,$pass" = "prog,link"; then 215272b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 215372b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 215472b676d7Smrg else 215572b676d7Smrg compiler_flags="$compiler_flags $deplib" 215672b676d7Smrg fi 215772b676d7Smrg continue 215872b676d7Smrg ;; 215972b676d7Smrg -l*) 216072b676d7Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 216172b676d7Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 216272b676d7Smrg continue 216372b676d7Smrg fi 216472b676d7Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21651fd23544Smrg if test "$linkmode" = lib; then 21661fd23544Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 21671fd23544Smrg else 21681fd23544Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 21691fd23544Smrg fi 21701fd23544Smrg for searchdir in $searchdirs; do 217172b676d7Smrg for search_ext in .la $std_shrext .so .a; do 217272b676d7Smrg # Search the libtool library 217372b676d7Smrg lib="$searchdir/lib${name}${search_ext}" 217472b676d7Smrg if test -f "$lib"; then 217572b676d7Smrg if test "$search_ext" = ".la"; then 217672b676d7Smrg found=yes 217772b676d7Smrg else 217872b676d7Smrg found=no 217972b676d7Smrg fi 218072b676d7Smrg break 2 218172b676d7Smrg fi 218272b676d7Smrg done 218372b676d7Smrg done 218472b676d7Smrg if test "$found" != yes; then 218572b676d7Smrg # deplib doesn't seem to be a libtool library 218672b676d7Smrg if test "$linkmode,$pass" = "prog,link"; then 218772b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 218872b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 218972b676d7Smrg else 219072b676d7Smrg deplibs="$deplib $deplibs" 219172b676d7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 219272b676d7Smrg fi 219372b676d7Smrg continue 219472b676d7Smrg else # deplib is a libtool library 219572b676d7Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 219672b676d7Smrg # We need to do some special things here, and not later. 219772b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 219872b676d7Smrg case " $predeps $postdeps " in 219972b676d7Smrg *" $deplib "*) 220072b676d7Smrg if (${SED} -e '2q' $lib | 220172b676d7Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 220272b676d7Smrg library_names= 220372b676d7Smrg old_library= 220472b676d7Smrg case $lib in 220572b676d7Smrg */* | *\\*) . $lib ;; 220672b676d7Smrg *) . ./$lib ;; 220772b676d7Smrg esac 220872b676d7Smrg for l in $old_library $library_names; do 220972b676d7Smrg ll="$l" 221072b676d7Smrg done 221172b676d7Smrg if test "X$ll" = "X$old_library" ; then # only static version available 221272b676d7Smrg found=no 221372b676d7Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 221472b676d7Smrg test "X$ladir" = "X$lib" && ladir="." 221572b676d7Smrg lib=$ladir/$old_library 221672b676d7Smrg if test "$linkmode,$pass" = "prog,link"; then 221772b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 221872b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 221972b676d7Smrg else 222072b676d7Smrg deplibs="$deplib $deplibs" 222172b676d7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 222272b676d7Smrg fi 222372b676d7Smrg continue 222472b676d7Smrg fi 222572b676d7Smrg fi 222672b676d7Smrg ;; 222772b676d7Smrg *) ;; 222872b676d7Smrg esac 222972b676d7Smrg fi 223072b676d7Smrg fi 223172b676d7Smrg ;; # -l 223272b676d7Smrg -L*) 223372b676d7Smrg case $linkmode in 223472b676d7Smrg lib) 223572b676d7Smrg deplibs="$deplib $deplibs" 223672b676d7Smrg test "$pass" = conv && continue 223772b676d7Smrg newdependency_libs="$deplib $newdependency_libs" 223872b676d7Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 223972b676d7Smrg ;; 224072b676d7Smrg prog) 224172b676d7Smrg if test "$pass" = conv; then 224272b676d7Smrg deplibs="$deplib $deplibs" 224372b676d7Smrg continue 224472b676d7Smrg fi 224572b676d7Smrg if test "$pass" = scan; then 224672b676d7Smrg deplibs="$deplib $deplibs" 224772b676d7Smrg else 224872b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 224972b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 225072b676d7Smrg fi 225172b676d7Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 225272b676d7Smrg ;; 225372b676d7Smrg *) 225472b676d7Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 225572b676d7Smrg ;; 225672b676d7Smrg esac # linkmode 225772b676d7Smrg continue 225872b676d7Smrg ;; # -L 225972b676d7Smrg -R*) 226072b676d7Smrg if test "$pass" = link; then 226172b676d7Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 226272b676d7Smrg # Make sure the xrpath contains only unique directories. 226372b676d7Smrg case "$xrpath " in 226472b676d7Smrg *" $dir "*) ;; 226572b676d7Smrg *) xrpath="$xrpath $dir" ;; 226672b676d7Smrg esac 226772b676d7Smrg fi 226872b676d7Smrg deplibs="$deplib $deplibs" 226972b676d7Smrg continue 227072b676d7Smrg ;; 227172b676d7Smrg *.la) lib="$deplib" ;; 227272b676d7Smrg *.$libext) 227372b676d7Smrg if test "$pass" = conv; then 227472b676d7Smrg deplibs="$deplib $deplibs" 227572b676d7Smrg continue 227672b676d7Smrg fi 227772b676d7Smrg case $linkmode in 227872b676d7Smrg lib) 227972b676d7Smrg valid_a_lib=no 228072b676d7Smrg case $deplibs_check_method in 228172b676d7Smrg match_pattern*) 228272b676d7Smrg set dummy $deplibs_check_method 228372b676d7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 228472b676d7Smrg if eval $echo \"$deplib\" 2>/dev/null \ 228572b676d7Smrg | $SED 10q \ 228672b676d7Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 228772b676d7Smrg valid_a_lib=yes 228872b676d7Smrg fi 228972b676d7Smrg ;; 229072b676d7Smrg pass_all) 229172b676d7Smrg valid_a_lib=yes 229272b676d7Smrg ;; 229372b676d7Smrg esac 229472b676d7Smrg if test "$valid_a_lib" != yes; then 229572b676d7Smrg $echo 229672b676d7Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 229772b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 229872b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 229972b676d7Smrg $echo "*** shared version of the library, which you do not appear to have" 230072b676d7Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 230172b676d7Smrg $echo "*** that it is just a static archive that I should not used here." 230272b676d7Smrg else 230372b676d7Smrg $echo 230472b676d7Smrg $echo "*** Warning: Linking the shared library $output against the" 230572b676d7Smrg $echo "*** static library $deplib is not portable!" 230672b676d7Smrg deplibs="$deplib $deplibs" 230772b676d7Smrg fi 230872b676d7Smrg continue 230972b676d7Smrg ;; 231072b676d7Smrg prog) 231172b676d7Smrg if test "$pass" != link; then 231272b676d7Smrg deplibs="$deplib $deplibs" 231372b676d7Smrg else 231472b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 231572b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 231672b676d7Smrg fi 231772b676d7Smrg continue 231872b676d7Smrg ;; 231972b676d7Smrg esac # linkmode 232072b676d7Smrg ;; # *.$libext 232172b676d7Smrg *.lo | *.$objext) 232272b676d7Smrg if test "$pass" = conv; then 232372b676d7Smrg deplibs="$deplib $deplibs" 232472b676d7Smrg elif test "$linkmode" = prog; then 232572b676d7Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 232672b676d7Smrg # If there is no dlopen support or we're linking statically, 232772b676d7Smrg # we need to preload. 232872b676d7Smrg newdlprefiles="$newdlprefiles $deplib" 232972b676d7Smrg compile_deplibs="$deplib $compile_deplibs" 233072b676d7Smrg finalize_deplibs="$deplib $finalize_deplibs" 233172b676d7Smrg else 233272b676d7Smrg newdlfiles="$newdlfiles $deplib" 233372b676d7Smrg fi 233472b676d7Smrg fi 233572b676d7Smrg continue 233672b676d7Smrg ;; 233772b676d7Smrg %DEPLIBS%) 233872b676d7Smrg alldeplibs=yes 233972b676d7Smrg continue 234072b676d7Smrg ;; 234172b676d7Smrg esac # case $deplib 234272b676d7Smrg if test "$found" = yes || test -f "$lib"; then : 234372b676d7Smrg else 234472b676d7Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 234572b676d7Smrg exit $EXIT_FAILURE 234672b676d7Smrg fi 234772b676d7Smrg 234872b676d7Smrg # Check to see that this really is a libtool archive. 234972b676d7Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 235072b676d7Smrg else 235172b676d7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 235272b676d7Smrg exit $EXIT_FAILURE 235372b676d7Smrg fi 235472b676d7Smrg 235572b676d7Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 235672b676d7Smrg test "X$ladir" = "X$lib" && ladir="." 235772b676d7Smrg 235872b676d7Smrg dlname= 235972b676d7Smrg dlopen= 236072b676d7Smrg dlpreopen= 236172b676d7Smrg libdir= 236272b676d7Smrg library_names= 236372b676d7Smrg old_library= 236472b676d7Smrg # If the library was installed with an old release of libtool, 236572b676d7Smrg # it will not redefine variables installed, or shouldnotlink 236672b676d7Smrg installed=yes 236772b676d7Smrg shouldnotlink=no 236872b676d7Smrg avoidtemprpath= 236972b676d7Smrg 237072b676d7Smrg 237172b676d7Smrg # Read the .la file 237272b676d7Smrg case $lib in 237372b676d7Smrg */* | *\\*) . $lib ;; 237472b676d7Smrg *) . ./$lib ;; 237572b676d7Smrg esac 237672b676d7Smrg 237772b676d7Smrg if test "$linkmode,$pass" = "lib,link" || 237872b676d7Smrg test "$linkmode,$pass" = "prog,scan" || 237972b676d7Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 238072b676d7Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 238172b676d7Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 238272b676d7Smrg fi 238372b676d7Smrg 238472b676d7Smrg if test "$pass" = conv; then 238572b676d7Smrg # Only check for convenience libraries 238672b676d7Smrg deplibs="$lib $deplibs" 238772b676d7Smrg if test -z "$libdir"; then 238872b676d7Smrg if test -z "$old_library"; then 238972b676d7Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 239072b676d7Smrg exit $EXIT_FAILURE 239172b676d7Smrg fi 239272b676d7Smrg # It is a libtool convenience library, so add in its objects. 239372b676d7Smrg convenience="$convenience $ladir/$objdir/$old_library" 239472b676d7Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 239572b676d7Smrg tmp_libs= 239672b676d7Smrg for deplib in $dependency_libs; do 239772b676d7Smrg deplibs="$deplib $deplibs" 239872b676d7Smrg if test "X$duplicate_deps" = "Xyes" ; then 239972b676d7Smrg case "$tmp_libs " in 240072b676d7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 240172b676d7Smrg esac 240272b676d7Smrg fi 240372b676d7Smrg tmp_libs="$tmp_libs $deplib" 240472b676d7Smrg done 240572b676d7Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 240672b676d7Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 240772b676d7Smrg exit $EXIT_FAILURE 240872b676d7Smrg fi 240972b676d7Smrg continue 241072b676d7Smrg fi # $pass = conv 241172b676d7Smrg 241272b676d7Smrg 241372b676d7Smrg # Get the name of the library we link against. 241472b676d7Smrg linklib= 241572b676d7Smrg for l in $old_library $library_names; do 241672b676d7Smrg linklib="$l" 241772b676d7Smrg done 241872b676d7Smrg if test -z "$linklib"; then 241972b676d7Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 242072b676d7Smrg exit $EXIT_FAILURE 242172b676d7Smrg fi 242272b676d7Smrg 242372b676d7Smrg # This library was specified with -dlopen. 242472b676d7Smrg if test "$pass" = dlopen; then 242572b676d7Smrg if test -z "$libdir"; then 242672b676d7Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 242772b676d7Smrg exit $EXIT_FAILURE 242872b676d7Smrg fi 242972b676d7Smrg if test -z "$dlname" || 243072b676d7Smrg test "$dlopen_support" != yes || 243172b676d7Smrg test "$build_libtool_libs" = no; then 243272b676d7Smrg # If there is no dlname, no dlopen support or we're linking 243372b676d7Smrg # statically, we need to preload. We also need to preload any 243472b676d7Smrg # dependent libraries so libltdl's deplib preloader doesn't 243572b676d7Smrg # bomb out in the load deplibs phase. 243672b676d7Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 243772b676d7Smrg else 243872b676d7Smrg newdlfiles="$newdlfiles $lib" 243972b676d7Smrg fi 244072b676d7Smrg continue 244172b676d7Smrg fi # $pass = dlopen 244272b676d7Smrg 244372b676d7Smrg # We need an absolute path. 244472b676d7Smrg case $ladir in 244572b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 244672b676d7Smrg *) 244772b676d7Smrg abs_ladir=`cd "$ladir" && pwd` 244872b676d7Smrg if test -z "$abs_ladir"; then 244972b676d7Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 245072b676d7Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 245172b676d7Smrg abs_ladir="$ladir" 245272b676d7Smrg fi 245372b676d7Smrg ;; 245472b676d7Smrg esac 245572b676d7Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 245672b676d7Smrg 245772b676d7Smrg # Find the relevant object directory and library name. 245872b676d7Smrg if test "X$installed" = Xyes; then 245972b676d7Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 246072b676d7Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 246172b676d7Smrg dir="$ladir" 246272b676d7Smrg absdir="$abs_ladir" 246372b676d7Smrg libdir="$abs_ladir" 246472b676d7Smrg else 246572b676d7Smrg dir="$libdir" 246672b676d7Smrg absdir="$libdir" 246772b676d7Smrg fi 246872b676d7Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 246972b676d7Smrg else 247072b676d7Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 247172b676d7Smrg dir="$ladir" 247272b676d7Smrg absdir="$abs_ladir" 247372b676d7Smrg # Remove this search path later 247472b676d7Smrg notinst_path="$notinst_path $abs_ladir" 247572b676d7Smrg else 247672b676d7Smrg dir="$ladir/$objdir" 247772b676d7Smrg absdir="$abs_ladir/$objdir" 247872b676d7Smrg # Remove this search path later 247972b676d7Smrg notinst_path="$notinst_path $abs_ladir" 248072b676d7Smrg fi 248172b676d7Smrg fi # $installed = yes 248272b676d7Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 248372b676d7Smrg 248472b676d7Smrg # This library was specified with -dlpreopen. 248572b676d7Smrg if test "$pass" = dlpreopen; then 248672b676d7Smrg if test -z "$libdir"; then 248772b676d7Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 248872b676d7Smrg exit $EXIT_FAILURE 248972b676d7Smrg fi 249072b676d7Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 249172b676d7Smrg # are required to link). 249272b676d7Smrg if test -n "$old_library"; then 249372b676d7Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 249472b676d7Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 249572b676d7Smrg elif test -n "$dlname"; then 249672b676d7Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 249772b676d7Smrg else 249872b676d7Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 249972b676d7Smrg fi 250072b676d7Smrg fi # $pass = dlpreopen 250172b676d7Smrg 250272b676d7Smrg if test -z "$libdir"; then 250372b676d7Smrg # Link the convenience library 250472b676d7Smrg if test "$linkmode" = lib; then 250572b676d7Smrg deplibs="$dir/$old_library $deplibs" 250672b676d7Smrg elif test "$linkmode,$pass" = "prog,link"; then 250772b676d7Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 250872b676d7Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 250972b676d7Smrg else 251072b676d7Smrg deplibs="$lib $deplibs" # used for prog,scan pass 251172b676d7Smrg fi 251272b676d7Smrg continue 251372b676d7Smrg fi 251472b676d7Smrg 251572b676d7Smrg 251672b676d7Smrg if test "$linkmode" = prog && test "$pass" != link; then 251772b676d7Smrg newlib_search_path="$newlib_search_path $ladir" 251872b676d7Smrg deplibs="$lib $deplibs" 251972b676d7Smrg 252072b676d7Smrg linkalldeplibs=no 252172b676d7Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 252272b676d7Smrg test "$build_libtool_libs" = no; then 252372b676d7Smrg linkalldeplibs=yes 252472b676d7Smrg fi 252572b676d7Smrg 252672b676d7Smrg tmp_libs= 252772b676d7Smrg for deplib in $dependency_libs; do 252872b676d7Smrg case $deplib in 252972b676d7Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 253072b676d7Smrg esac 253172b676d7Smrg # Need to link against all dependency_libs? 253272b676d7Smrg if test "$linkalldeplibs" = yes; then 253372b676d7Smrg deplibs="$deplib $deplibs" 253472b676d7Smrg else 253572b676d7Smrg # Need to hardcode shared library paths 253672b676d7Smrg # or/and link against static libraries 253772b676d7Smrg newdependency_libs="$deplib $newdependency_libs" 253872b676d7Smrg fi 253972b676d7Smrg if test "X$duplicate_deps" = "Xyes" ; then 254072b676d7Smrg case "$tmp_libs " in 254172b676d7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 254272b676d7Smrg esac 254372b676d7Smrg fi 254472b676d7Smrg tmp_libs="$tmp_libs $deplib" 254572b676d7Smrg done # for deplib 254672b676d7Smrg continue 254772b676d7Smrg fi # $linkmode = prog... 254872b676d7Smrg 254972b676d7Smrg if test "$linkmode,$pass" = "prog,link"; then 255072b676d7Smrg if test -n "$library_names" && 25511fd23544Smrg { { test "$prefer_static_libs" = no || 25521fd23544Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 25531fd23544Smrg test -z "$old_library"; }; then 255472b676d7Smrg # We need to hardcode the library path 255572b676d7Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 255672b676d7Smrg # Make sure the rpath contains only unique directories. 255772b676d7Smrg case "$temp_rpath " in 255872b676d7Smrg *" $dir "*) ;; 255972b676d7Smrg *" $absdir "*) ;; 256072b676d7Smrg *) temp_rpath="$temp_rpath $absdir" ;; 256172b676d7Smrg esac 256272b676d7Smrg fi 256372b676d7Smrg 256472b676d7Smrg # Hardcode the library path. 256572b676d7Smrg # Skip directories that are in the system default run-time 256672b676d7Smrg # search path. 256772b676d7Smrg case " $sys_lib_dlsearch_path " in 256872b676d7Smrg *" $absdir "*) ;; 256972b676d7Smrg *) 257072b676d7Smrg case "$compile_rpath " in 257172b676d7Smrg *" $absdir "*) ;; 257272b676d7Smrg *) compile_rpath="$compile_rpath $absdir" 257372b676d7Smrg esac 257472b676d7Smrg ;; 257572b676d7Smrg esac 257672b676d7Smrg case " $sys_lib_dlsearch_path " in 257772b676d7Smrg *" $libdir "*) ;; 257872b676d7Smrg *) 257972b676d7Smrg case "$finalize_rpath " in 258072b676d7Smrg *" $libdir "*) ;; 258172b676d7Smrg *) finalize_rpath="$finalize_rpath $libdir" 258272b676d7Smrg esac 258372b676d7Smrg ;; 258472b676d7Smrg esac 258572b676d7Smrg fi # $linkmode,$pass = prog,link... 258672b676d7Smrg 258772b676d7Smrg if test "$alldeplibs" = yes && 258872b676d7Smrg { test "$deplibs_check_method" = pass_all || 258972b676d7Smrg { test "$build_libtool_libs" = yes && 259072b676d7Smrg test -n "$library_names"; }; }; then 259172b676d7Smrg # We only need to search for static libraries 259272b676d7Smrg continue 259372b676d7Smrg fi 259472b676d7Smrg fi 259572b676d7Smrg 259672b676d7Smrg link_static=no # Whether the deplib will be linked statically 259772b676d7Smrg use_static_libs=$prefer_static_libs 259872b676d7Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 259972b676d7Smrg use_static_libs=no 260072b676d7Smrg fi 260172b676d7Smrg if test -n "$library_names" && 260272b676d7Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 260372b676d7Smrg if test "$installed" = no; then 260472b676d7Smrg notinst_deplibs="$notinst_deplibs $lib" 260572b676d7Smrg need_relink=yes 260672b676d7Smrg fi 260772b676d7Smrg # This is a shared library 260872b676d7Smrg 260972b676d7Smrg # Warn about portability, can't link against -module's on 261072b676d7Smrg # some systems (darwin) 261172b676d7Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 261272b676d7Smrg $echo 261372b676d7Smrg if test "$linkmode" = prog; then 261472b676d7Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 261572b676d7Smrg else 261672b676d7Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 261772b676d7Smrg fi 261872b676d7Smrg $echo "*** $linklib is not portable!" 261972b676d7Smrg fi 262072b676d7Smrg if test "$linkmode" = lib && 262172b676d7Smrg test "$hardcode_into_libs" = yes; then 262272b676d7Smrg # Hardcode the library path. 262372b676d7Smrg # Skip directories that are in the system default run-time 262472b676d7Smrg # search path. 262572b676d7Smrg case " $sys_lib_dlsearch_path " in 262672b676d7Smrg *" $absdir "*) ;; 262772b676d7Smrg *) 262872b676d7Smrg case "$compile_rpath " in 262972b676d7Smrg *" $absdir "*) ;; 263072b676d7Smrg *) compile_rpath="$compile_rpath $absdir" 263172b676d7Smrg esac 263272b676d7Smrg ;; 263372b676d7Smrg esac 263472b676d7Smrg case " $sys_lib_dlsearch_path " in 263572b676d7Smrg *" $libdir "*) ;; 263672b676d7Smrg *) 263772b676d7Smrg case "$finalize_rpath " in 263872b676d7Smrg *" $libdir "*) ;; 263972b676d7Smrg *) finalize_rpath="$finalize_rpath $libdir" 264072b676d7Smrg esac 264172b676d7Smrg ;; 264272b676d7Smrg esac 264372b676d7Smrg fi 264472b676d7Smrg 264572b676d7Smrg if test -n "$old_archive_from_expsyms_cmds"; then 264672b676d7Smrg # figure out the soname 264772b676d7Smrg set dummy $library_names 264872b676d7Smrg realname="$2" 264972b676d7Smrg shift; shift 265072b676d7Smrg libname=`eval \\$echo \"$libname_spec\"` 265172b676d7Smrg # use dlname if we got it. it's perfectly good, no? 265272b676d7Smrg if test -n "$dlname"; then 265372b676d7Smrg soname="$dlname" 265472b676d7Smrg elif test -n "$soname_spec"; then 265572b676d7Smrg # bleh windows 265672b676d7Smrg case $host in 265772b676d7Smrg *cygwin* | mingw*) 265872b676d7Smrg major=`expr $current - $age` 265972b676d7Smrg versuffix="-$major" 266072b676d7Smrg ;; 266172b676d7Smrg esac 266272b676d7Smrg eval soname=\"$soname_spec\" 266372b676d7Smrg else 266472b676d7Smrg soname="$realname" 266572b676d7Smrg fi 266672b676d7Smrg 266772b676d7Smrg # Make a new name for the extract_expsyms_cmds to use 266872b676d7Smrg soroot="$soname" 266972b676d7Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 267072b676d7Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 267172b676d7Smrg 267272b676d7Smrg # If the library has no export list, then create one now 267372b676d7Smrg if test -f "$output_objdir/$soname-def"; then : 267472b676d7Smrg else 267572b676d7Smrg $show "extracting exported symbol list from \`$soname'" 267672b676d7Smrg save_ifs="$IFS"; IFS='~' 267772b676d7Smrg cmds=$extract_expsyms_cmds 267872b676d7Smrg for cmd in $cmds; do 267972b676d7Smrg IFS="$save_ifs" 268072b676d7Smrg eval cmd=\"$cmd\" 268172b676d7Smrg $show "$cmd" 268272b676d7Smrg $run eval "$cmd" || exit $? 268372b676d7Smrg done 268472b676d7Smrg IFS="$save_ifs" 268572b676d7Smrg fi 268672b676d7Smrg 268772b676d7Smrg # Create $newlib 268872b676d7Smrg if test -f "$output_objdir/$newlib"; then :; else 268972b676d7Smrg $show "generating import library for \`$soname'" 269072b676d7Smrg save_ifs="$IFS"; IFS='~' 269172b676d7Smrg cmds=$old_archive_from_expsyms_cmds 269272b676d7Smrg for cmd in $cmds; do 269372b676d7Smrg IFS="$save_ifs" 269472b676d7Smrg eval cmd=\"$cmd\" 269572b676d7Smrg $show "$cmd" 269672b676d7Smrg $run eval "$cmd" || exit $? 269772b676d7Smrg done 269872b676d7Smrg IFS="$save_ifs" 269972b676d7Smrg fi 270072b676d7Smrg # make sure the library variables are pointing to the new library 270172b676d7Smrg dir=$output_objdir 270272b676d7Smrg linklib=$newlib 270372b676d7Smrg fi # test -n "$old_archive_from_expsyms_cmds" 270472b676d7Smrg 270572b676d7Smrg if test "$linkmode" = prog || test "$mode" != relink; then 270672b676d7Smrg add_shlibpath= 270772b676d7Smrg add_dir= 270872b676d7Smrg add= 270972b676d7Smrg lib_linked=yes 271072b676d7Smrg case $hardcode_action in 271172b676d7Smrg immediate | unsupported) 271272b676d7Smrg if test "$hardcode_direct" = no; then 271372b676d7Smrg add="$dir/$linklib" 271472b676d7Smrg case $host in 271572b676d7Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 271672b676d7Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 271772b676d7Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 271872b676d7Smrg *-*-unixware7*) add_dir="-L$dir" ;; 271972b676d7Smrg *-*-darwin* ) 272072b676d7Smrg # if the lib is a module then we can not link against 272172b676d7Smrg # it, someone is ignoring the new warnings I added 272272b676d7Smrg if /usr/bin/file -L $add 2> /dev/null | 272372b676d7Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 272472b676d7Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 272572b676d7Smrg if test -z "$old_library" ; then 272672b676d7Smrg $echo 272772b676d7Smrg $echo "** And there doesn't seem to be a static archive available" 272872b676d7Smrg $echo "** The link will probably fail, sorry" 272972b676d7Smrg else 273072b676d7Smrg add="$dir/$old_library" 273172b676d7Smrg fi 273272b676d7Smrg fi 273372b676d7Smrg esac 273472b676d7Smrg elif test "$hardcode_minus_L" = no; then 273572b676d7Smrg case $host in 273672b676d7Smrg *-*-sunos*) add_shlibpath="$dir" ;; 273772b676d7Smrg esac 273872b676d7Smrg add_dir="-L$dir" 273972b676d7Smrg add="-l$name" 274072b676d7Smrg elif test "$hardcode_shlibpath_var" = no; then 274172b676d7Smrg add_shlibpath="$dir" 274272b676d7Smrg add="-l$name" 274372b676d7Smrg else 274472b676d7Smrg lib_linked=no 274572b676d7Smrg fi 274672b676d7Smrg ;; 274772b676d7Smrg relink) 274872b676d7Smrg if test "$hardcode_direct" = yes; then 274972b676d7Smrg add="$dir/$linklib" 275072b676d7Smrg elif test "$hardcode_minus_L" = yes; then 275172b676d7Smrg add_dir="-L$dir" 275272b676d7Smrg # Try looking first in the location we're being installed to. 275372b676d7Smrg if test -n "$inst_prefix_dir"; then 275472b676d7Smrg case $libdir in 275572b676d7Smrg [\\/]*) 275672b676d7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 275772b676d7Smrg ;; 275872b676d7Smrg esac 275972b676d7Smrg fi 276072b676d7Smrg add="-l$name" 276172b676d7Smrg elif test "$hardcode_shlibpath_var" = yes; then 276272b676d7Smrg add_shlibpath="$dir" 276372b676d7Smrg add="-l$name" 276472b676d7Smrg else 276572b676d7Smrg lib_linked=no 276672b676d7Smrg fi 276772b676d7Smrg ;; 276872b676d7Smrg *) lib_linked=no ;; 276972b676d7Smrg esac 277072b676d7Smrg 277172b676d7Smrg if test "$lib_linked" != yes; then 277272b676d7Smrg $echo "$modename: configuration error: unsupported hardcode properties" 277372b676d7Smrg exit $EXIT_FAILURE 277472b676d7Smrg fi 277572b676d7Smrg 277672b676d7Smrg if test -n "$add_shlibpath"; then 277772b676d7Smrg case :$compile_shlibpath: in 277872b676d7Smrg *":$add_shlibpath:"*) ;; 277972b676d7Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 278072b676d7Smrg esac 278172b676d7Smrg fi 278272b676d7Smrg if test "$linkmode" = prog; then 278372b676d7Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 278472b676d7Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 278572b676d7Smrg else 278672b676d7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 278772b676d7Smrg test -n "$add" && deplibs="$add $deplibs" 278872b676d7Smrg if test "$hardcode_direct" != yes && \ 278972b676d7Smrg test "$hardcode_minus_L" != yes && \ 279072b676d7Smrg test "$hardcode_shlibpath_var" = yes; then 279172b676d7Smrg case :$finalize_shlibpath: in 279272b676d7Smrg *":$libdir:"*) ;; 279372b676d7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 279472b676d7Smrg esac 279572b676d7Smrg fi 279672b676d7Smrg fi 279772b676d7Smrg fi 279872b676d7Smrg 279972b676d7Smrg if test "$linkmode" = prog || test "$mode" = relink; then 280072b676d7Smrg add_shlibpath= 280172b676d7Smrg add_dir= 280272b676d7Smrg add= 280372b676d7Smrg # Finalize command for both is simple: just hardcode it. 280472b676d7Smrg if test "$hardcode_direct" = yes; then 280572b676d7Smrg add="$libdir/$linklib" 280672b676d7Smrg elif test "$hardcode_minus_L" = yes; then 280772b676d7Smrg add_dir="-L$libdir" 280872b676d7Smrg add="-l$name" 280972b676d7Smrg elif test "$hardcode_shlibpath_var" = yes; then 281072b676d7Smrg case :$finalize_shlibpath: in 281172b676d7Smrg *":$libdir:"*) ;; 281272b676d7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 281372b676d7Smrg esac 281472b676d7Smrg add="-l$name" 281572b676d7Smrg elif test "$hardcode_automatic" = yes; then 281672b676d7Smrg if test -n "$inst_prefix_dir" && 281772b676d7Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 281872b676d7Smrg add="$inst_prefix_dir$libdir/$linklib" 281972b676d7Smrg else 282072b676d7Smrg add="$libdir/$linklib" 282172b676d7Smrg fi 282272b676d7Smrg else 282372b676d7Smrg # We cannot seem to hardcode it, guess we'll fake it. 282472b676d7Smrg add_dir="-L$libdir" 282572b676d7Smrg # Try looking first in the location we're being installed to. 282672b676d7Smrg if test -n "$inst_prefix_dir"; then 282772b676d7Smrg case $libdir in 282872b676d7Smrg [\\/]*) 282972b676d7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 283072b676d7Smrg ;; 283172b676d7Smrg esac 283272b676d7Smrg fi 283372b676d7Smrg add="-l$name" 283472b676d7Smrg fi 283572b676d7Smrg 283672b676d7Smrg if test "$linkmode" = prog; then 283772b676d7Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 283872b676d7Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 283972b676d7Smrg else 284072b676d7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 284172b676d7Smrg test -n "$add" && deplibs="$add $deplibs" 284272b676d7Smrg fi 284372b676d7Smrg fi 284472b676d7Smrg elif test "$linkmode" = prog; then 284572b676d7Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 284672b676d7Smrg # is not unsupported. This is valid on all known static and 284772b676d7Smrg # shared platforms. 284872b676d7Smrg if test "$hardcode_direct" != unsupported; then 284972b676d7Smrg test -n "$old_library" && linklib="$old_library" 285072b676d7Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 285172b676d7Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 285272b676d7Smrg else 285372b676d7Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 285472b676d7Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 285572b676d7Smrg fi 285672b676d7Smrg elif test "$build_libtool_libs" = yes; then 285772b676d7Smrg # Not a shared library 285872b676d7Smrg if test "$deplibs_check_method" != pass_all; then 285972b676d7Smrg # We're trying link a shared library against a static one 286072b676d7Smrg # but the system doesn't support it. 286172b676d7Smrg 286272b676d7Smrg # Just print a warning and add the library to dependency_libs so 286372b676d7Smrg # that the program can be linked against the static library. 286472b676d7Smrg $echo 286572b676d7Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 286672b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 286772b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 286872b676d7Smrg $echo "*** shared version of the library, which you do not appear to have." 286972b676d7Smrg if test "$module" = yes; then 287072b676d7Smrg $echo "*** But as you try to build a module library, libtool will still create " 287172b676d7Smrg $echo "*** a static module, that should work as long as the dlopening application" 287272b676d7Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 287372b676d7Smrg if test -z "$global_symbol_pipe"; then 287472b676d7Smrg $echo 287572b676d7Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 287672b676d7Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 287772b676d7Smrg $echo "*** not find such a program. So, this module is probably useless." 287872b676d7Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 287972b676d7Smrg fi 288072b676d7Smrg if test "$build_old_libs" = no; then 288172b676d7Smrg build_libtool_libs=module 288272b676d7Smrg build_old_libs=yes 288372b676d7Smrg else 288472b676d7Smrg build_libtool_libs=no 288572b676d7Smrg fi 288672b676d7Smrg fi 288772b676d7Smrg else 288872b676d7Smrg deplibs="$dir/$old_library $deplibs" 288972b676d7Smrg link_static=yes 289072b676d7Smrg fi 289172b676d7Smrg fi # link shared/static library? 289272b676d7Smrg 289372b676d7Smrg if test "$linkmode" = lib; then 289472b676d7Smrg if test -n "$dependency_libs" && 289572b676d7Smrg { test "$hardcode_into_libs" != yes || 289672b676d7Smrg test "$build_old_libs" = yes || 289772b676d7Smrg test "$link_static" = yes; }; then 289872b676d7Smrg # Extract -R from dependency_libs 289972b676d7Smrg temp_deplibs= 290072b676d7Smrg for libdir in $dependency_libs; do 290172b676d7Smrg case $libdir in 290272b676d7Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 290372b676d7Smrg case " $xrpath " in 290472b676d7Smrg *" $temp_xrpath "*) ;; 290572b676d7Smrg *) xrpath="$xrpath $temp_xrpath";; 290672b676d7Smrg esac;; 290772b676d7Smrg *) temp_deplibs="$temp_deplibs $libdir";; 290872b676d7Smrg esac 290972b676d7Smrg done 291072b676d7Smrg dependency_libs="$temp_deplibs" 291172b676d7Smrg fi 291272b676d7Smrg 291372b676d7Smrg newlib_search_path="$newlib_search_path $absdir" 291472b676d7Smrg # Link against this library 291572b676d7Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 291672b676d7Smrg # ... and its dependency_libs 291772b676d7Smrg tmp_libs= 291872b676d7Smrg for deplib in $dependency_libs; do 291972b676d7Smrg newdependency_libs="$deplib $newdependency_libs" 292072b676d7Smrg if test "X$duplicate_deps" = "Xyes" ; then 292172b676d7Smrg case "$tmp_libs " in 292272b676d7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 292372b676d7Smrg esac 292472b676d7Smrg fi 292572b676d7Smrg tmp_libs="$tmp_libs $deplib" 292672b676d7Smrg done 292772b676d7Smrg 292872b676d7Smrg if test "$link_all_deplibs" != no; then 292972b676d7Smrg # Add the search paths of all dependency libraries 293072b676d7Smrg for deplib in $dependency_libs; do 293172b676d7Smrg case $deplib in 293272b676d7Smrg -L*) path="$deplib" ;; 293372b676d7Smrg *.la) 293472b676d7Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 293572b676d7Smrg test "X$dir" = "X$deplib" && dir="." 293672b676d7Smrg # We need an absolute path. 293772b676d7Smrg case $dir in 293872b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 293972b676d7Smrg *) 294072b676d7Smrg absdir=`cd "$dir" && pwd` 294172b676d7Smrg if test -z "$absdir"; then 294272b676d7Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 294372b676d7Smrg absdir="$dir" 294472b676d7Smrg fi 294572b676d7Smrg ;; 294672b676d7Smrg esac 294772b676d7Smrg if grep "^installed=no" $deplib > /dev/null; then 294872b676d7Smrg path="$absdir/$objdir" 294972b676d7Smrg else 295072b676d7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 295172b676d7Smrg if test -z "$libdir"; then 295272b676d7Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 295372b676d7Smrg exit $EXIT_FAILURE 295472b676d7Smrg fi 295572b676d7Smrg if test "$absdir" != "$libdir"; then 295672b676d7Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 295772b676d7Smrg fi 295872b676d7Smrg path="$absdir" 295972b676d7Smrg fi 296072b676d7Smrg depdepl= 296172b676d7Smrg case $host in 296272b676d7Smrg *-*-darwin*) 296372b676d7Smrg # we do not want to link against static libs, 296472b676d7Smrg # but need to link against shared 296572b676d7Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29661fd23544Smrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 296772b676d7Smrg if test -n "$deplibrary_names" ; then 296872b676d7Smrg for tmp in $deplibrary_names ; do 296972b676d7Smrg depdepl=$tmp 297072b676d7Smrg done 29711fd23544Smrg if test -f "$deplibdir/$depdepl" ; then 29721fd23544Smrg depdepl="$deplibdir/$depdepl" 29731fd23544Smrg elif test -f "$path/$depdepl" ; then 297472b676d7Smrg depdepl="$path/$depdepl" 29751fd23544Smrg else 29761fd23544Smrg # Can't find it, oh well... 29771fd23544Smrg depdepl= 297872b676d7Smrg fi 297972b676d7Smrg # do not add paths which are already there 298072b676d7Smrg case " $newlib_search_path " in 298172b676d7Smrg *" $path "*) ;; 298272b676d7Smrg *) newlib_search_path="$newlib_search_path $path";; 298372b676d7Smrg esac 298472b676d7Smrg fi 298572b676d7Smrg path="" 298672b676d7Smrg ;; 298772b676d7Smrg *) 298872b676d7Smrg path="-L$path" 298972b676d7Smrg ;; 299072b676d7Smrg esac 299172b676d7Smrg ;; 299272b676d7Smrg -l*) 299372b676d7Smrg case $host in 299472b676d7Smrg *-*-darwin*) 299572b676d7Smrg # Again, we only want to link against shared libraries 299672b676d7Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 299772b676d7Smrg for tmp in $newlib_search_path ; do 299872b676d7Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 299972b676d7Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 300072b676d7Smrg break 300172b676d7Smrg fi 300272b676d7Smrg done 300372b676d7Smrg path="" 300472b676d7Smrg ;; 300572b676d7Smrg *) continue ;; 300672b676d7Smrg esac 300772b676d7Smrg ;; 300872b676d7Smrg *) continue ;; 300972b676d7Smrg esac 301072b676d7Smrg case " $deplibs " in 301172b676d7Smrg *" $path "*) ;; 301272b676d7Smrg *) deplibs="$path $deplibs" ;; 301372b676d7Smrg esac 301472b676d7Smrg case " $deplibs " in 301572b676d7Smrg *" $depdepl "*) ;; 301672b676d7Smrg *) deplibs="$depdepl $deplibs" ;; 301772b676d7Smrg esac 301872b676d7Smrg done 301972b676d7Smrg fi # link_all_deplibs != no 302072b676d7Smrg fi # linkmode = lib 302172b676d7Smrg done # for deplib in $libs 302272b676d7Smrg dependency_libs="$newdependency_libs" 302372b676d7Smrg if test "$pass" = dlpreopen; then 302472b676d7Smrg # Link the dlpreopened libraries before other libraries 302572b676d7Smrg for deplib in $save_deplibs; do 302672b676d7Smrg deplibs="$deplib $deplibs" 302772b676d7Smrg done 302872b676d7Smrg fi 302972b676d7Smrg if test "$pass" != dlopen; then 303072b676d7Smrg if test "$pass" != conv; then 303172b676d7Smrg # Make sure lib_search_path contains only unique directories. 303272b676d7Smrg lib_search_path= 303372b676d7Smrg for dir in $newlib_search_path; do 303472b676d7Smrg case "$lib_search_path " in 303572b676d7Smrg *" $dir "*) ;; 303672b676d7Smrg *) lib_search_path="$lib_search_path $dir" ;; 303772b676d7Smrg esac 303872b676d7Smrg done 303972b676d7Smrg newlib_search_path= 304072b676d7Smrg fi 304172b676d7Smrg 304272b676d7Smrg if test "$linkmode,$pass" != "prog,link"; then 304372b676d7Smrg vars="deplibs" 304472b676d7Smrg else 304572b676d7Smrg vars="compile_deplibs finalize_deplibs" 304672b676d7Smrg fi 304772b676d7Smrg for var in $vars dependency_libs; do 304872b676d7Smrg # Add libraries to $var in reverse order 304972b676d7Smrg eval tmp_libs=\"\$$var\" 305072b676d7Smrg new_libs= 305172b676d7Smrg for deplib in $tmp_libs; do 305272b676d7Smrg # FIXME: Pedantically, this is the right thing to do, so 305372b676d7Smrg # that some nasty dependency loop isn't accidentally 305472b676d7Smrg # broken: 305572b676d7Smrg #new_libs="$deplib $new_libs" 305672b676d7Smrg # Pragmatically, this seems to cause very few problems in 305772b676d7Smrg # practice: 305872b676d7Smrg case $deplib in 305972b676d7Smrg -L*) new_libs="$deplib $new_libs" ;; 306072b676d7Smrg -R*) ;; 306172b676d7Smrg *) 306272b676d7Smrg # And here is the reason: when a library appears more 306372b676d7Smrg # than once as an explicit dependence of a library, or 306472b676d7Smrg # is implicitly linked in more than once by the 306572b676d7Smrg # compiler, it is considered special, and multiple 306672b676d7Smrg # occurrences thereof are not removed. Compare this 306772b676d7Smrg # with having the same library being listed as a 306872b676d7Smrg # dependency of multiple other libraries: in this case, 306972b676d7Smrg # we know (pedantically, we assume) the library does not 307072b676d7Smrg # need to be listed more than once, so we keep only the 307172b676d7Smrg # last copy. This is not always right, but it is rare 307272b676d7Smrg # enough that we require users that really mean to play 307372b676d7Smrg # such unportable linking tricks to link the library 307472b676d7Smrg # using -Wl,-lname, so that libtool does not consider it 307572b676d7Smrg # for duplicate removal. 307672b676d7Smrg case " $specialdeplibs " in 307772b676d7Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 307872b676d7Smrg *) 307972b676d7Smrg case " $new_libs " in 308072b676d7Smrg *" $deplib "*) ;; 308172b676d7Smrg *) new_libs="$deplib $new_libs" ;; 308272b676d7Smrg esac 308372b676d7Smrg ;; 308472b676d7Smrg esac 308572b676d7Smrg ;; 308672b676d7Smrg esac 308772b676d7Smrg done 308872b676d7Smrg tmp_libs= 308972b676d7Smrg for deplib in $new_libs; do 309072b676d7Smrg case $deplib in 309172b676d7Smrg -L*) 309272b676d7Smrg case " $tmp_libs " in 309372b676d7Smrg *" $deplib "*) ;; 309472b676d7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 309572b676d7Smrg esac 309672b676d7Smrg ;; 309772b676d7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 309872b676d7Smrg esac 309972b676d7Smrg done 310072b676d7Smrg eval $var=\"$tmp_libs\" 310172b676d7Smrg done # for var 310272b676d7Smrg fi 310372b676d7Smrg # Last step: remove runtime libs from dependency_libs 310472b676d7Smrg # (they stay in deplibs) 310572b676d7Smrg tmp_libs= 310672b676d7Smrg for i in $dependency_libs ; do 310772b676d7Smrg case " $predeps $postdeps $compiler_lib_search_path " in 310872b676d7Smrg *" $i "*) 310972b676d7Smrg i="" 311072b676d7Smrg ;; 311172b676d7Smrg esac 311272b676d7Smrg if test -n "$i" ; then 311372b676d7Smrg tmp_libs="$tmp_libs $i" 311472b676d7Smrg fi 311572b676d7Smrg done 311672b676d7Smrg dependency_libs=$tmp_libs 311772b676d7Smrg done # for pass 311872b676d7Smrg if test "$linkmode" = prog; then 311972b676d7Smrg dlfiles="$newdlfiles" 312072b676d7Smrg dlprefiles="$newdlprefiles" 312172b676d7Smrg fi 312272b676d7Smrg 312372b676d7Smrg case $linkmode in 312472b676d7Smrg oldlib) 31251fd23544Smrg case " $deplibs" in 31261fd23544Smrg *\ -l* | *\ -L*) 31271fd23544Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 31281fd23544Smrg esac 312972b676d7Smrg 313072b676d7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 313172b676d7Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 313272b676d7Smrg fi 313372b676d7Smrg 313472b676d7Smrg if test -n "$rpath"; then 313572b676d7Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 313672b676d7Smrg fi 313772b676d7Smrg 313872b676d7Smrg if test -n "$xrpath"; then 313972b676d7Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 314072b676d7Smrg fi 314172b676d7Smrg 314272b676d7Smrg if test -n "$vinfo"; then 314372b676d7Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 314472b676d7Smrg fi 314572b676d7Smrg 314672b676d7Smrg if test -n "$release"; then 314772b676d7Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 314872b676d7Smrg fi 314972b676d7Smrg 315072b676d7Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 315172b676d7Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 315272b676d7Smrg fi 315372b676d7Smrg 315472b676d7Smrg # Now set the variables for building old libraries. 315572b676d7Smrg build_libtool_libs=no 315672b676d7Smrg oldlibs="$output" 315772b676d7Smrg objs="$objs$old_deplibs" 315872b676d7Smrg ;; 315972b676d7Smrg 316072b676d7Smrg lib) 316172b676d7Smrg # Make sure we only generate libraries of the form `libNAME.la'. 316272b676d7Smrg case $outputname in 316372b676d7Smrg lib*) 316472b676d7Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 316572b676d7Smrg eval shared_ext=\"$shrext_cmds\" 316672b676d7Smrg eval libname=\"$libname_spec\" 316772b676d7Smrg ;; 316872b676d7Smrg *) 316972b676d7Smrg if test "$module" = no; then 317072b676d7Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 317172b676d7Smrg $echo "$help" 1>&2 317272b676d7Smrg exit $EXIT_FAILURE 317372b676d7Smrg fi 317472b676d7Smrg if test "$need_lib_prefix" != no; then 317572b676d7Smrg # Add the "lib" prefix for modules if required 317672b676d7Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 317772b676d7Smrg eval shared_ext=\"$shrext_cmds\" 317872b676d7Smrg eval libname=\"$libname_spec\" 317972b676d7Smrg else 318072b676d7Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 318172b676d7Smrg fi 318272b676d7Smrg ;; 318372b676d7Smrg esac 318472b676d7Smrg 318572b676d7Smrg if test -n "$objs"; then 318672b676d7Smrg if test "$deplibs_check_method" != pass_all; then 318772b676d7Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 318872b676d7Smrg exit $EXIT_FAILURE 318972b676d7Smrg else 319072b676d7Smrg $echo 319172b676d7Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 319272b676d7Smrg $echo "*** objects $objs is not portable!" 319372b676d7Smrg libobjs="$libobjs $objs" 319472b676d7Smrg fi 319572b676d7Smrg fi 319672b676d7Smrg 319772b676d7Smrg if test "$dlself" != no; then 319872b676d7Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 319972b676d7Smrg fi 320072b676d7Smrg 320172b676d7Smrg set dummy $rpath 320272b676d7Smrg if test "$#" -gt 2; then 320372b676d7Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 320472b676d7Smrg fi 320572b676d7Smrg install_libdir="$2" 320672b676d7Smrg 320772b676d7Smrg oldlibs= 320872b676d7Smrg if test -z "$rpath"; then 320972b676d7Smrg if test "$build_libtool_libs" = yes; then 321072b676d7Smrg # Building a libtool convenience library. 321172b676d7Smrg # Some compilers have problems with a `.al' extension so 321272b676d7Smrg # convenience libraries should have the same extension an 321372b676d7Smrg # archive normally would. 321472b676d7Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 321572b676d7Smrg build_libtool_libs=convenience 321672b676d7Smrg build_old_libs=yes 321772b676d7Smrg fi 321872b676d7Smrg 321972b676d7Smrg if test -n "$vinfo"; then 322072b676d7Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 322172b676d7Smrg fi 322272b676d7Smrg 322372b676d7Smrg if test -n "$release"; then 322472b676d7Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 322572b676d7Smrg fi 322672b676d7Smrg else 322772b676d7Smrg 322872b676d7Smrg # Parse the version information argument. 322972b676d7Smrg save_ifs="$IFS"; IFS=':' 323072b676d7Smrg set dummy $vinfo 0 0 0 323172b676d7Smrg IFS="$save_ifs" 323272b676d7Smrg 323372b676d7Smrg if test -n "$8"; then 323472b676d7Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 323572b676d7Smrg $echo "$help" 1>&2 323672b676d7Smrg exit $EXIT_FAILURE 323772b676d7Smrg fi 323872b676d7Smrg 323972b676d7Smrg # convert absolute version numbers to libtool ages 324072b676d7Smrg # this retains compatibility with .la files and attempts 324172b676d7Smrg # to make the code below a bit more comprehensible 324272b676d7Smrg 324372b676d7Smrg case $vinfo_number in 324472b676d7Smrg yes) 324572b676d7Smrg number_major="$2" 324672b676d7Smrg number_minor="$3" 324772b676d7Smrg number_revision="$4" 324872b676d7Smrg # 324972b676d7Smrg # There are really only two kinds -- those that 325072b676d7Smrg # use the current revision as the major version 325172b676d7Smrg # and those that subtract age and use age as 325272b676d7Smrg # a minor version. But, then there is irix 325372b676d7Smrg # which has an extra 1 added just for fun 325472b676d7Smrg # 325572b676d7Smrg case $version_type in 32561fd23544Smrg darwin|linux|osf|windows|none) 325772b676d7Smrg current=`expr $number_major + $number_minor` 325872b676d7Smrg age="$number_minor" 325972b676d7Smrg revision="$number_revision" 326072b676d7Smrg ;; 326172b676d7Smrg freebsd-aout|freebsd-elf|sunos) 326272b676d7Smrg current="$number_major" 326372b676d7Smrg revision="$number_minor" 326472b676d7Smrg age="0" 326572b676d7Smrg ;; 326672b676d7Smrg irix|nonstopux) 32671fd23544Smrg current=`expr $number_major + $number_minor` 326872b676d7Smrg age="$number_minor" 326972b676d7Smrg revision="$number_minor" 32701fd23544Smrg lt_irix_increment=no 327172b676d7Smrg ;; 327272b676d7Smrg esac 327372b676d7Smrg ;; 327472b676d7Smrg no) 327572b676d7Smrg current="$2" 327672b676d7Smrg revision="$3" 327772b676d7Smrg age="$4" 327872b676d7Smrg ;; 327972b676d7Smrg esac 328072b676d7Smrg 328172b676d7Smrg # Check that each of the things are valid numbers. 328272b676d7Smrg case $current in 328372b676d7Smrg 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]) ;; 328472b676d7Smrg *) 328572b676d7Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 328672b676d7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 328772b676d7Smrg exit $EXIT_FAILURE 328872b676d7Smrg ;; 328972b676d7Smrg esac 329072b676d7Smrg 329172b676d7Smrg case $revision in 329272b676d7Smrg 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]) ;; 329372b676d7Smrg *) 329472b676d7Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 329572b676d7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 329672b676d7Smrg exit $EXIT_FAILURE 329772b676d7Smrg ;; 329872b676d7Smrg esac 329972b676d7Smrg 330072b676d7Smrg case $age in 330172b676d7Smrg 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]) ;; 330272b676d7Smrg *) 330372b676d7Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 330472b676d7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 330572b676d7Smrg exit $EXIT_FAILURE 330672b676d7Smrg ;; 330772b676d7Smrg esac 330872b676d7Smrg 330972b676d7Smrg if test "$age" -gt "$current"; then 331072b676d7Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 331172b676d7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 331272b676d7Smrg exit $EXIT_FAILURE 331372b676d7Smrg fi 331472b676d7Smrg 331572b676d7Smrg # Calculate the version variables. 331672b676d7Smrg major= 331772b676d7Smrg versuffix= 331872b676d7Smrg verstring= 331972b676d7Smrg case $version_type in 332072b676d7Smrg none) ;; 332172b676d7Smrg 332272b676d7Smrg darwin) 332372b676d7Smrg # Like Linux, but with the current version available in 332472b676d7Smrg # verstring for coding it into the library header 332572b676d7Smrg major=.`expr $current - $age` 332672b676d7Smrg versuffix="$major.$age.$revision" 332772b676d7Smrg # Darwin ld doesn't like 0 for these options... 332872b676d7Smrg minor_current=`expr $current + 1` 33291fd23544Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 33301fd23544Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 333172b676d7Smrg ;; 333272b676d7Smrg 333372b676d7Smrg freebsd-aout) 333472b676d7Smrg major=".$current" 333572b676d7Smrg versuffix=".$current.$revision"; 333672b676d7Smrg ;; 333772b676d7Smrg 333872b676d7Smrg freebsd-elf) 333972b676d7Smrg major=".$current" 334072b676d7Smrg versuffix=".$current"; 334172b676d7Smrg ;; 334272b676d7Smrg 334372b676d7Smrg irix | nonstopux) 33441fd23544Smrg if test "X$lt_irix_increment" = "Xno"; then 33451fd23544Smrg major=`expr $current - $age` 33461fd23544Smrg else 33471fd23544Smrg major=`expr $current - $age + 1` 33481fd23544Smrg fi 334972b676d7Smrg case $version_type in 335072b676d7Smrg nonstopux) verstring_prefix=nonstopux ;; 335172b676d7Smrg *) verstring_prefix=sgi ;; 335272b676d7Smrg esac 335372b676d7Smrg verstring="$verstring_prefix$major.$revision" 335472b676d7Smrg 335572b676d7Smrg # Add in all the interfaces that we are compatible with. 335672b676d7Smrg loop=$revision 335772b676d7Smrg while test "$loop" -ne 0; do 335872b676d7Smrg iface=`expr $revision - $loop` 335972b676d7Smrg loop=`expr $loop - 1` 336072b676d7Smrg verstring="$verstring_prefix$major.$iface:$verstring" 336172b676d7Smrg done 336272b676d7Smrg 336372b676d7Smrg # Before this point, $major must not contain `.'. 336472b676d7Smrg major=.$major 336572b676d7Smrg versuffix="$major.$revision" 336672b676d7Smrg ;; 336772b676d7Smrg 336872b676d7Smrg linux) 336972b676d7Smrg major=.`expr $current - $age` 337072b676d7Smrg versuffix="$major.$age.$revision" 337172b676d7Smrg ;; 337272b676d7Smrg 337372b676d7Smrg osf) 337472b676d7Smrg major=.`expr $current - $age` 337572b676d7Smrg versuffix=".$current.$age.$revision" 337672b676d7Smrg verstring="$current.$age.$revision" 337772b676d7Smrg 337872b676d7Smrg # Add in all the interfaces that we are compatible with. 337972b676d7Smrg loop=$age 338072b676d7Smrg while test "$loop" -ne 0; do 338172b676d7Smrg iface=`expr $current - $loop` 338272b676d7Smrg loop=`expr $loop - 1` 338372b676d7Smrg verstring="$verstring:${iface}.0" 338472b676d7Smrg done 338572b676d7Smrg 338672b676d7Smrg # Make executables depend on our current version. 338772b676d7Smrg verstring="$verstring:${current}.0" 338872b676d7Smrg ;; 338972b676d7Smrg 339072b676d7Smrg sunos) 339172b676d7Smrg major=".$current" 339272b676d7Smrg versuffix=".$current.$revision" 339372b676d7Smrg ;; 339472b676d7Smrg 339572b676d7Smrg windows) 339672b676d7Smrg # Use '-' rather than '.', since we only want one 339772b676d7Smrg # extension on DOS 8.3 filesystems. 339872b676d7Smrg major=`expr $current - $age` 339972b676d7Smrg versuffix="-$major" 340072b676d7Smrg ;; 340172b676d7Smrg 340272b676d7Smrg *) 340372b676d7Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 340472b676d7Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 340572b676d7Smrg exit $EXIT_FAILURE 340672b676d7Smrg ;; 340772b676d7Smrg esac 340872b676d7Smrg 340972b676d7Smrg # Clear the version info if we defaulted, and they specified a release. 341072b676d7Smrg if test -z "$vinfo" && test -n "$release"; then 341172b676d7Smrg major= 341272b676d7Smrg case $version_type in 341372b676d7Smrg darwin) 341472b676d7Smrg # we can't check for "0.0" in archive_cmds due to quoting 341572b676d7Smrg # problems, so we reset it completely 341672b676d7Smrg verstring= 341772b676d7Smrg ;; 341872b676d7Smrg *) 341972b676d7Smrg verstring="0.0" 342072b676d7Smrg ;; 342172b676d7Smrg esac 342272b676d7Smrg if test "$need_version" = no; then 342372b676d7Smrg versuffix= 342472b676d7Smrg else 342572b676d7Smrg versuffix=".0.0" 342672b676d7Smrg fi 342772b676d7Smrg fi 342872b676d7Smrg 342972b676d7Smrg # Remove version info from name if versioning should be avoided 343072b676d7Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 343172b676d7Smrg major= 343272b676d7Smrg versuffix= 343372b676d7Smrg verstring="" 343472b676d7Smrg fi 343572b676d7Smrg 343672b676d7Smrg # Check to see if the archive will have undefined symbols. 343772b676d7Smrg if test "$allow_undefined" = yes; then 343872b676d7Smrg if test "$allow_undefined_flag" = unsupported; then 343972b676d7Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 344072b676d7Smrg build_libtool_libs=no 344172b676d7Smrg build_old_libs=yes 344272b676d7Smrg fi 344372b676d7Smrg else 344472b676d7Smrg # Don't allow undefined symbols. 344572b676d7Smrg allow_undefined_flag="$no_undefined_flag" 344672b676d7Smrg fi 344772b676d7Smrg fi 344872b676d7Smrg 344972b676d7Smrg if test "$mode" != relink; then 345072b676d7Smrg # Remove our outputs, but don't remove object files since they 345172b676d7Smrg # may have been created when compiling PIC objects. 345272b676d7Smrg removelist= 345372b676d7Smrg tempremovelist=`$echo "$output_objdir/*"` 345472b676d7Smrg for p in $tempremovelist; do 345572b676d7Smrg case $p in 345672b676d7Smrg *.$objext) 345772b676d7Smrg ;; 345872b676d7Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 345972b676d7Smrg if test "X$precious_files_regex" != "X"; then 346072b676d7Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 346172b676d7Smrg then 346272b676d7Smrg continue 346372b676d7Smrg fi 346472b676d7Smrg fi 346572b676d7Smrg removelist="$removelist $p" 346672b676d7Smrg ;; 346772b676d7Smrg *) ;; 346872b676d7Smrg esac 346972b676d7Smrg done 347072b676d7Smrg if test -n "$removelist"; then 347172b676d7Smrg $show "${rm}r $removelist" 347272b676d7Smrg $run ${rm}r $removelist 347372b676d7Smrg fi 347472b676d7Smrg fi 347572b676d7Smrg 347672b676d7Smrg # Now set the variables for building old libraries. 347772b676d7Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 347872b676d7Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 347972b676d7Smrg 348072b676d7Smrg # Transform .lo files to .o files. 348172b676d7Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 348272b676d7Smrg fi 348372b676d7Smrg 348472b676d7Smrg # Eliminate all temporary directories. 34851fd23544Smrg #for path in $notinst_path; do 34861fd23544Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 34871fd23544Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 34881fd23544Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 34891fd23544Smrg #done 349072b676d7Smrg 349172b676d7Smrg if test -n "$xrpath"; then 349272b676d7Smrg # If the user specified any rpath flags, then add them. 349372b676d7Smrg temp_xrpath= 349472b676d7Smrg for libdir in $xrpath; do 349572b676d7Smrg temp_xrpath="$temp_xrpath -R$libdir" 349672b676d7Smrg case "$finalize_rpath " in 349772b676d7Smrg *" $libdir "*) ;; 349872b676d7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 349972b676d7Smrg esac 350072b676d7Smrg done 350172b676d7Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 350272b676d7Smrg dependency_libs="$temp_xrpath $dependency_libs" 350372b676d7Smrg fi 350472b676d7Smrg fi 350572b676d7Smrg 350672b676d7Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 350772b676d7Smrg old_dlfiles="$dlfiles" 350872b676d7Smrg dlfiles= 350972b676d7Smrg for lib in $old_dlfiles; do 351072b676d7Smrg case " $dlprefiles $dlfiles " in 351172b676d7Smrg *" $lib "*) ;; 351272b676d7Smrg *) dlfiles="$dlfiles $lib" ;; 351372b676d7Smrg esac 351472b676d7Smrg done 351572b676d7Smrg 351672b676d7Smrg # Make sure dlprefiles contains only unique files 351772b676d7Smrg old_dlprefiles="$dlprefiles" 351872b676d7Smrg dlprefiles= 351972b676d7Smrg for lib in $old_dlprefiles; do 352072b676d7Smrg case "$dlprefiles " in 352172b676d7Smrg *" $lib "*) ;; 352272b676d7Smrg *) dlprefiles="$dlprefiles $lib" ;; 352372b676d7Smrg esac 352472b676d7Smrg done 352572b676d7Smrg 352672b676d7Smrg if test "$build_libtool_libs" = yes; then 352772b676d7Smrg if test -n "$rpath"; then 352872b676d7Smrg case $host in 352972b676d7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 353072b676d7Smrg # these systems don't actually have a c library (as such)! 353172b676d7Smrg ;; 353272b676d7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 353372b676d7Smrg # Rhapsody C library is in the System framework 353472b676d7Smrg deplibs="$deplibs -framework System" 353572b676d7Smrg ;; 353672b676d7Smrg *-*-netbsd*) 353772b676d7Smrg # Don't link with libc until the a.out ld.so is fixed. 353872b676d7Smrg ;; 353972b676d7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 354072b676d7Smrg # Do not include libc due to us having libc/libc_r. 354172b676d7Smrg ;; 354272b676d7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 354372b676d7Smrg # Causes problems with __ctype 354472b676d7Smrg ;; 354572b676d7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 354672b676d7Smrg # Compiler inserts libc in the correct place for threads to work 354772b676d7Smrg ;; 354872b676d7Smrg *) 354972b676d7Smrg # Add libc to deplibs on all other systems if necessary. 355072b676d7Smrg if test "$build_libtool_need_lc" = "yes"; then 355172b676d7Smrg deplibs="$deplibs -lc" 355272b676d7Smrg fi 355372b676d7Smrg ;; 355472b676d7Smrg esac 355572b676d7Smrg fi 355672b676d7Smrg 355772b676d7Smrg # Transform deplibs into only deplibs that can be linked in shared. 355872b676d7Smrg name_save=$name 355972b676d7Smrg libname_save=$libname 356072b676d7Smrg release_save=$release 356172b676d7Smrg versuffix_save=$versuffix 356272b676d7Smrg major_save=$major 356372b676d7Smrg # I'm not sure if I'm treating the release correctly. I think 356472b676d7Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 356572b676d7Smrg # add it in twice. Is that correct? 356672b676d7Smrg release="" 356772b676d7Smrg versuffix="" 356872b676d7Smrg major="" 356972b676d7Smrg newdeplibs= 357072b676d7Smrg droppeddeps=no 357172b676d7Smrg case $deplibs_check_method in 357272b676d7Smrg pass_all) 357372b676d7Smrg # Don't check for shared/static. Everything works. 357472b676d7Smrg # This might be a little naive. We might want to check 357572b676d7Smrg # whether the library exists or not. But this is on 357672b676d7Smrg # osf3 & osf4 and I'm not really sure... Just 357772b676d7Smrg # implementing what was already the behavior. 357872b676d7Smrg newdeplibs=$deplibs 357972b676d7Smrg ;; 358072b676d7Smrg test_compile) 358172b676d7Smrg # This code stresses the "libraries are programs" paradigm to its 358272b676d7Smrg # limits. Maybe even breaks it. We compile a program, linking it 358372b676d7Smrg # against the deplibs as a proxy for the library. Then we can check 358472b676d7Smrg # whether they linked in statically or dynamically with ldd. 358572b676d7Smrg $rm conftest.c 358672b676d7Smrg cat > conftest.c <<EOF 358772b676d7Smrg int main() { return 0; } 358872b676d7SmrgEOF 358972b676d7Smrg $rm conftest 35901fd23544Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 359172b676d7Smrg ldd_output=`ldd conftest` 359272b676d7Smrg for i in $deplibs; do 359372b676d7Smrg name=`expr $i : '-l\(.*\)'` 359472b676d7Smrg # If $name is empty we are operating on a -L argument. 35951fd23544Smrg if test "$name" != "" && test "$name" != "0"; then 359672b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 359772b676d7Smrg case " $predeps $postdeps " in 359872b676d7Smrg *" $i "*) 359972b676d7Smrg newdeplibs="$newdeplibs $i" 360072b676d7Smrg i="" 360172b676d7Smrg ;; 360272b676d7Smrg esac 360372b676d7Smrg fi 360472b676d7Smrg if test -n "$i" ; then 360572b676d7Smrg libname=`eval \\$echo \"$libname_spec\"` 360672b676d7Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 360772b676d7Smrg set dummy $deplib_matches 360872b676d7Smrg deplib_match=$2 360972b676d7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 361072b676d7Smrg newdeplibs="$newdeplibs $i" 361172b676d7Smrg else 361272b676d7Smrg droppeddeps=yes 361372b676d7Smrg $echo 361472b676d7Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 361572b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 361672b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 361772b676d7Smrg $echo "*** shared version of the library, which I believe you do not have" 361872b676d7Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 361972b676d7Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 362072b676d7Smrg fi 362172b676d7Smrg fi 362272b676d7Smrg else 362372b676d7Smrg newdeplibs="$newdeplibs $i" 362472b676d7Smrg fi 362572b676d7Smrg done 362672b676d7Smrg else 362772b676d7Smrg # Error occurred in the first compile. Let's try to salvage 362872b676d7Smrg # the situation: Compile a separate program for each library. 362972b676d7Smrg for i in $deplibs; do 363072b676d7Smrg name=`expr $i : '-l\(.*\)'` 363172b676d7Smrg # If $name is empty we are operating on a -L argument. 363272b676d7Smrg if test "$name" != "" && test "$name" != "0"; then 363372b676d7Smrg $rm conftest 36341fd23544Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 363572b676d7Smrg ldd_output=`ldd conftest` 363672b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 363772b676d7Smrg case " $predeps $postdeps " in 363872b676d7Smrg *" $i "*) 363972b676d7Smrg newdeplibs="$newdeplibs $i" 364072b676d7Smrg i="" 364172b676d7Smrg ;; 364272b676d7Smrg esac 364372b676d7Smrg fi 364472b676d7Smrg if test -n "$i" ; then 364572b676d7Smrg libname=`eval \\$echo \"$libname_spec\"` 364672b676d7Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 364772b676d7Smrg set dummy $deplib_matches 364872b676d7Smrg deplib_match=$2 364972b676d7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 365072b676d7Smrg newdeplibs="$newdeplibs $i" 365172b676d7Smrg else 365272b676d7Smrg droppeddeps=yes 365372b676d7Smrg $echo 365472b676d7Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 365572b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 365672b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 365772b676d7Smrg $echo "*** shared version of the library, which you do not appear to have" 365872b676d7Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 365972b676d7Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 366072b676d7Smrg fi 366172b676d7Smrg fi 366272b676d7Smrg else 366372b676d7Smrg droppeddeps=yes 366472b676d7Smrg $echo 366572b676d7Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 36661fd23544Smrg $echo "*** make it link in! You will probably need to install it or some" 366772b676d7Smrg $echo "*** library that it depends on before this library will be fully" 366872b676d7Smrg $echo "*** functional. Installing it before continuing would be even better." 366972b676d7Smrg fi 367072b676d7Smrg else 367172b676d7Smrg newdeplibs="$newdeplibs $i" 367272b676d7Smrg fi 367372b676d7Smrg done 367472b676d7Smrg fi 367572b676d7Smrg ;; 367672b676d7Smrg file_magic*) 367772b676d7Smrg set dummy $deplibs_check_method 367872b676d7Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 367972b676d7Smrg for a_deplib in $deplibs; do 368072b676d7Smrg name=`expr $a_deplib : '-l\(.*\)'` 368172b676d7Smrg # If $name is empty we are operating on a -L argument. 368272b676d7Smrg if test "$name" != "" && test "$name" != "0"; then 368372b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 368472b676d7Smrg case " $predeps $postdeps " in 368572b676d7Smrg *" $a_deplib "*) 368672b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 368772b676d7Smrg a_deplib="" 368872b676d7Smrg ;; 368972b676d7Smrg esac 369072b676d7Smrg fi 369172b676d7Smrg if test -n "$a_deplib" ; then 369272b676d7Smrg libname=`eval \\$echo \"$libname_spec\"` 369372b676d7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 369472b676d7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 369572b676d7Smrg for potent_lib in $potential_libs; do 369672b676d7Smrg # Follow soft links. 369772b676d7Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 369872b676d7Smrg | grep " -> " >/dev/null; then 369972b676d7Smrg continue 370072b676d7Smrg fi 370172b676d7Smrg # The statement above tries to avoid entering an 370272b676d7Smrg # endless loop below, in case of cyclic links. 370372b676d7Smrg # We might still enter an endless loop, since a link 370472b676d7Smrg # loop can be closed while we follow links, 370572b676d7Smrg # but so what? 370672b676d7Smrg potlib="$potent_lib" 370772b676d7Smrg while test -h "$potlib" 2>/dev/null; do 370872b676d7Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 370972b676d7Smrg case $potliblink in 371072b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 371172b676d7Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 371272b676d7Smrg esac 371372b676d7Smrg done 371472b676d7Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 371572b676d7Smrg | ${SED} 10q \ 371672b676d7Smrg | $EGREP "$file_magic_regex" > /dev/null; then 371772b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 371872b676d7Smrg a_deplib="" 371972b676d7Smrg break 2 372072b676d7Smrg fi 372172b676d7Smrg done 372272b676d7Smrg done 372372b676d7Smrg fi 372472b676d7Smrg if test -n "$a_deplib" ; then 372572b676d7Smrg droppeddeps=yes 372672b676d7Smrg $echo 372772b676d7Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 372872b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 372972b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 373072b676d7Smrg $echo "*** shared version of the library, which you do not appear to have" 373172b676d7Smrg $echo "*** because I did check the linker path looking for a file starting" 373272b676d7Smrg if test -z "$potlib" ; then 373372b676d7Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 373472b676d7Smrg else 373572b676d7Smrg $echo "*** with $libname and none of the candidates passed a file format test" 373672b676d7Smrg $echo "*** using a file magic. Last file checked: $potlib" 373772b676d7Smrg fi 373872b676d7Smrg fi 373972b676d7Smrg else 374072b676d7Smrg # Add a -L argument. 374172b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 374272b676d7Smrg fi 374372b676d7Smrg done # Gone through all deplibs. 374472b676d7Smrg ;; 374572b676d7Smrg match_pattern*) 374672b676d7Smrg set dummy $deplibs_check_method 374772b676d7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 374872b676d7Smrg for a_deplib in $deplibs; do 374972b676d7Smrg name=`expr $a_deplib : '-l\(.*\)'` 375072b676d7Smrg # If $name is empty we are operating on a -L argument. 375172b676d7Smrg if test -n "$name" && test "$name" != "0"; then 375272b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 375372b676d7Smrg case " $predeps $postdeps " in 375472b676d7Smrg *" $a_deplib "*) 375572b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 375672b676d7Smrg a_deplib="" 375772b676d7Smrg ;; 375872b676d7Smrg esac 375972b676d7Smrg fi 376072b676d7Smrg if test -n "$a_deplib" ; then 376172b676d7Smrg libname=`eval \\$echo \"$libname_spec\"` 376272b676d7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 376372b676d7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 376472b676d7Smrg for potent_lib in $potential_libs; do 376572b676d7Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 376672b676d7Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 376772b676d7Smrg | ${SED} 10q \ 376872b676d7Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 376972b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 377072b676d7Smrg a_deplib="" 377172b676d7Smrg break 2 377272b676d7Smrg fi 377372b676d7Smrg done 377472b676d7Smrg done 377572b676d7Smrg fi 377672b676d7Smrg if test -n "$a_deplib" ; then 377772b676d7Smrg droppeddeps=yes 377872b676d7Smrg $echo 377972b676d7Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 378072b676d7Smrg $echo "*** I have the capability to make that library automatically link in when" 378172b676d7Smrg $echo "*** you link to this library. But I can only do this if you have a" 378272b676d7Smrg $echo "*** shared version of the library, which you do not appear to have" 378372b676d7Smrg $echo "*** because I did check the linker path looking for a file starting" 378472b676d7Smrg if test -z "$potlib" ; then 378572b676d7Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 378672b676d7Smrg else 378772b676d7Smrg $echo "*** with $libname and none of the candidates passed a file format test" 378872b676d7Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 378972b676d7Smrg fi 379072b676d7Smrg fi 379172b676d7Smrg else 379272b676d7Smrg # Add a -L argument. 379372b676d7Smrg newdeplibs="$newdeplibs $a_deplib" 379472b676d7Smrg fi 379572b676d7Smrg done # Gone through all deplibs. 379672b676d7Smrg ;; 379772b676d7Smrg none | unknown | *) 379872b676d7Smrg newdeplibs="" 379972b676d7Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 380072b676d7Smrg -e 's/ -[LR][^ ]*//g'` 380172b676d7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 380272b676d7Smrg for i in $predeps $postdeps ; do 380372b676d7Smrg # can't use Xsed below, because $i might contain '/' 380472b676d7Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 380572b676d7Smrg done 380672b676d7Smrg fi 380772b676d7Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 380872b676d7Smrg | grep . >/dev/null; then 380972b676d7Smrg $echo 381072b676d7Smrg if test "X$deplibs_check_method" = "Xnone"; then 381172b676d7Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 381272b676d7Smrg else 381372b676d7Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 381472b676d7Smrg fi 381572b676d7Smrg $echo "*** All declared inter-library dependencies are being dropped." 381672b676d7Smrg droppeddeps=yes 381772b676d7Smrg fi 381872b676d7Smrg ;; 381972b676d7Smrg esac 382072b676d7Smrg versuffix=$versuffix_save 382172b676d7Smrg major=$major_save 382272b676d7Smrg release=$release_save 382372b676d7Smrg libname=$libname_save 382472b676d7Smrg name=$name_save 382572b676d7Smrg 382672b676d7Smrg case $host in 382772b676d7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 382872b676d7Smrg # On Rhapsody replace the C library is the System framework 382972b676d7Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 383072b676d7Smrg ;; 383172b676d7Smrg esac 383272b676d7Smrg 383372b676d7Smrg if test "$droppeddeps" = yes; then 383472b676d7Smrg if test "$module" = yes; then 383572b676d7Smrg $echo 383672b676d7Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 383772b676d7Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 383872b676d7Smrg $echo "*** a static module, that should work as long as the dlopening" 383972b676d7Smrg $echo "*** application is linked with the -dlopen flag." 384072b676d7Smrg if test -z "$global_symbol_pipe"; then 384172b676d7Smrg $echo 384272b676d7Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 384372b676d7Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 384472b676d7Smrg $echo "*** not find such a program. So, this module is probably useless." 384572b676d7Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 384672b676d7Smrg fi 384772b676d7Smrg if test "$build_old_libs" = no; then 384872b676d7Smrg oldlibs="$output_objdir/$libname.$libext" 384972b676d7Smrg build_libtool_libs=module 385072b676d7Smrg build_old_libs=yes 385172b676d7Smrg else 385272b676d7Smrg build_libtool_libs=no 385372b676d7Smrg fi 385472b676d7Smrg else 385572b676d7Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 385672b676d7Smrg $echo "*** automatically added whenever a program is linked with this library" 385772b676d7Smrg $echo "*** or is declared to -dlopen it." 385872b676d7Smrg 385972b676d7Smrg if test "$allow_undefined" = no; then 386072b676d7Smrg $echo 386172b676d7Smrg $echo "*** Since this library must not contain undefined symbols," 386272b676d7Smrg $echo "*** because either the platform does not support them or" 386372b676d7Smrg $echo "*** it was explicitly requested with -no-undefined," 386472b676d7Smrg $echo "*** libtool will only create a static version of it." 386572b676d7Smrg if test "$build_old_libs" = no; then 386672b676d7Smrg oldlibs="$output_objdir/$libname.$libext" 386772b676d7Smrg build_libtool_libs=module 386872b676d7Smrg build_old_libs=yes 386972b676d7Smrg else 387072b676d7Smrg build_libtool_libs=no 387172b676d7Smrg fi 387272b676d7Smrg fi 387372b676d7Smrg fi 387472b676d7Smrg fi 387572b676d7Smrg # Done checking deplibs! 387672b676d7Smrg deplibs=$newdeplibs 387772b676d7Smrg fi 387872b676d7Smrg 387972b676d7Smrg 388072b676d7Smrg # move library search paths that coincide with paths to not yet 388172b676d7Smrg # installed libraries to the beginning of the library search list 388272b676d7Smrg new_libs= 388372b676d7Smrg for path in $notinst_path; do 388472b676d7Smrg case " $new_libs " in 388572b676d7Smrg *" -L$path/$objdir "*) ;; 388672b676d7Smrg *) 388772b676d7Smrg case " $deplibs " in 388872b676d7Smrg *" -L$path/$objdir "*) 388972b676d7Smrg new_libs="$new_libs -L$path/$objdir" ;; 389072b676d7Smrg esac 389172b676d7Smrg ;; 389272b676d7Smrg esac 389372b676d7Smrg done 389472b676d7Smrg for deplib in $deplibs; do 389572b676d7Smrg case $deplib in 389672b676d7Smrg -L*) 389772b676d7Smrg case " $new_libs " in 389872b676d7Smrg *" $deplib "*) ;; 389972b676d7Smrg *) new_libs="$new_libs $deplib" ;; 390072b676d7Smrg esac 390172b676d7Smrg ;; 390272b676d7Smrg *) new_libs="$new_libs $deplib" ;; 390372b676d7Smrg esac 390472b676d7Smrg done 390572b676d7Smrg deplibs="$new_libs" 390672b676d7Smrg 390772b676d7Smrg 390872b676d7Smrg # All the library-specific variables (install_libdir is set above). 390972b676d7Smrg library_names= 391072b676d7Smrg old_library= 391172b676d7Smrg dlname= 391272b676d7Smrg 391372b676d7Smrg # Test again, we may have decided not to build it any more 391472b676d7Smrg if test "$build_libtool_libs" = yes; then 391572b676d7Smrg if test "$hardcode_into_libs" = yes; then 391672b676d7Smrg # Hardcode the library paths 391772b676d7Smrg hardcode_libdirs= 391872b676d7Smrg dep_rpath= 391972b676d7Smrg rpath="$finalize_rpath" 392072b676d7Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 392172b676d7Smrg for libdir in $rpath; do 392272b676d7Smrg if test -n "$hardcode_libdir_flag_spec"; then 392372b676d7Smrg if test -n "$hardcode_libdir_separator"; then 392472b676d7Smrg if test -z "$hardcode_libdirs"; then 392572b676d7Smrg hardcode_libdirs="$libdir" 392672b676d7Smrg else 392772b676d7Smrg # Just accumulate the unique libdirs. 392872b676d7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 392972b676d7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 393072b676d7Smrg ;; 393172b676d7Smrg *) 393272b676d7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 393372b676d7Smrg ;; 393472b676d7Smrg esac 393572b676d7Smrg fi 393672b676d7Smrg else 393772b676d7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 393872b676d7Smrg dep_rpath="$dep_rpath $flag" 393972b676d7Smrg fi 394072b676d7Smrg elif test -n "$runpath_var"; then 394172b676d7Smrg case "$perm_rpath " in 394272b676d7Smrg *" $libdir "*) ;; 394372b676d7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 394472b676d7Smrg esac 394572b676d7Smrg fi 394672b676d7Smrg done 394772b676d7Smrg # Substitute the hardcoded libdirs into the rpath. 394872b676d7Smrg if test -n "$hardcode_libdir_separator" && 394972b676d7Smrg test -n "$hardcode_libdirs"; then 395072b676d7Smrg libdir="$hardcode_libdirs" 395172b676d7Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 39521fd23544Smrg case $archive_cmds in 39531fd23544Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 39541fd23544Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 39551fd23544Smrg esac 395672b676d7Smrg else 395772b676d7Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 395872b676d7Smrg fi 395972b676d7Smrg fi 396072b676d7Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 396172b676d7Smrg # We should set the runpath_var. 396272b676d7Smrg rpath= 396372b676d7Smrg for dir in $perm_rpath; do 396472b676d7Smrg rpath="$rpath$dir:" 396572b676d7Smrg done 396672b676d7Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 396772b676d7Smrg fi 396872b676d7Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 396972b676d7Smrg fi 397072b676d7Smrg 397172b676d7Smrg shlibpath="$finalize_shlibpath" 397272b676d7Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 397372b676d7Smrg if test -n "$shlibpath"; then 397472b676d7Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 397572b676d7Smrg fi 397672b676d7Smrg 397772b676d7Smrg # Get the real and link names of the library. 397872b676d7Smrg eval shared_ext=\"$shrext_cmds\" 397972b676d7Smrg eval library_names=\"$library_names_spec\" 398072b676d7Smrg set dummy $library_names 398172b676d7Smrg realname="$2" 398272b676d7Smrg shift; shift 398372b676d7Smrg 398472b676d7Smrg if test -n "$soname_spec"; then 398572b676d7Smrg eval soname=\"$soname_spec\" 398672b676d7Smrg else 398772b676d7Smrg soname="$realname" 398872b676d7Smrg fi 398972b676d7Smrg if test -z "$dlname"; then 399072b676d7Smrg dlname=$soname 399172b676d7Smrg fi 399272b676d7Smrg 399372b676d7Smrg lib="$output_objdir/$realname" 399472b676d7Smrg linknames= 399572b676d7Smrg for link 399672b676d7Smrg do 399772b676d7Smrg linknames="$linknames $link" 399872b676d7Smrg done 399972b676d7Smrg 400072b676d7Smrg # Use standard objects if they are pic 400172b676d7Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 400272b676d7Smrg 400372b676d7Smrg # Prepare the list of exported symbols 400472b676d7Smrg if test -z "$export_symbols"; then 400572b676d7Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 400672b676d7Smrg $show "generating symbol list for \`$libname.la'" 400772b676d7Smrg export_symbols="$output_objdir/$libname.exp" 400872b676d7Smrg $run $rm $export_symbols 400972b676d7Smrg cmds=$export_symbols_cmds 401072b676d7Smrg save_ifs="$IFS"; IFS='~' 401172b676d7Smrg for cmd in $cmds; do 401272b676d7Smrg IFS="$save_ifs" 401372b676d7Smrg eval cmd=\"$cmd\" 401472b676d7Smrg if len=`expr "X$cmd" : ".*"` && 401572b676d7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 401672b676d7Smrg $show "$cmd" 401772b676d7Smrg $run eval "$cmd" || exit $? 401872b676d7Smrg skipped_export=false 401972b676d7Smrg else 402072b676d7Smrg # The command line is too long to execute in one step. 402172b676d7Smrg $show "using reloadable object file for export list..." 402272b676d7Smrg skipped_export=: 402372b676d7Smrg # Break out early, otherwise skipped_export may be 402472b676d7Smrg # set to false by a later but shorter cmd. 402572b676d7Smrg break 402672b676d7Smrg fi 402772b676d7Smrg done 402872b676d7Smrg IFS="$save_ifs" 402972b676d7Smrg if test -n "$export_symbols_regex"; then 403072b676d7Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 403172b676d7Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 403272b676d7Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 403372b676d7Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 403472b676d7Smrg fi 403572b676d7Smrg fi 403672b676d7Smrg fi 403772b676d7Smrg 403872b676d7Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 403972b676d7Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 404072b676d7Smrg fi 404172b676d7Smrg 404272b676d7Smrg tmp_deplibs= 404372b676d7Smrg for test_deplib in $deplibs; do 404472b676d7Smrg case " $convenience " in 404572b676d7Smrg *" $test_deplib "*) ;; 404672b676d7Smrg *) 404772b676d7Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 404872b676d7Smrg ;; 404972b676d7Smrg esac 405072b676d7Smrg done 405172b676d7Smrg deplibs="$tmp_deplibs" 405272b676d7Smrg 405372b676d7Smrg if test -n "$convenience"; then 405472b676d7Smrg if test -n "$whole_archive_flag_spec"; then 405572b676d7Smrg save_libobjs=$libobjs 405672b676d7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 405772b676d7Smrg else 405872b676d7Smrg gentop="$output_objdir/${outputname}x" 405972b676d7Smrg generated="$generated $gentop" 406072b676d7Smrg 406172b676d7Smrg func_extract_archives $gentop $convenience 406272b676d7Smrg libobjs="$libobjs $func_extract_archives_result" 406372b676d7Smrg fi 406472b676d7Smrg fi 406572b676d7Smrg 406672b676d7Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 406772b676d7Smrg eval flag=\"$thread_safe_flag_spec\" 406872b676d7Smrg linker_flags="$linker_flags $flag" 406972b676d7Smrg fi 407072b676d7Smrg 407172b676d7Smrg # Make a backup of the uninstalled library when relinking 407272b676d7Smrg if test "$mode" = relink; then 407372b676d7Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 407472b676d7Smrg fi 407572b676d7Smrg 407672b676d7Smrg # Do each of the archive commands. 407772b676d7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 407872b676d7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 407972b676d7Smrg eval test_cmds=\"$module_expsym_cmds\" 408072b676d7Smrg cmds=$module_expsym_cmds 408172b676d7Smrg else 408272b676d7Smrg eval test_cmds=\"$module_cmds\" 408372b676d7Smrg cmds=$module_cmds 408472b676d7Smrg fi 408572b676d7Smrg else 408672b676d7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 408772b676d7Smrg eval test_cmds=\"$archive_expsym_cmds\" 408872b676d7Smrg cmds=$archive_expsym_cmds 408972b676d7Smrg else 409072b676d7Smrg eval test_cmds=\"$archive_cmds\" 409172b676d7Smrg cmds=$archive_cmds 409272b676d7Smrg fi 409372b676d7Smrg fi 409472b676d7Smrg 409572b676d7Smrg if test "X$skipped_export" != "X:" && 409672b676d7Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 409772b676d7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 409872b676d7Smrg : 409972b676d7Smrg else 410072b676d7Smrg # The command line is too long to link in one step, link piecewise. 410172b676d7Smrg $echo "creating reloadable object files..." 410272b676d7Smrg 410372b676d7Smrg # Save the value of $output and $libobjs because we want to 410472b676d7Smrg # use them later. If we have whole_archive_flag_spec, we 410572b676d7Smrg # want to use save_libobjs as it was before 410672b676d7Smrg # whole_archive_flag_spec was expanded, because we can't 410772b676d7Smrg # assume the linker understands whole_archive_flag_spec. 410872b676d7Smrg # This may have to be revisited, in case too many 410972b676d7Smrg # convenience libraries get linked in and end up exceeding 411072b676d7Smrg # the spec. 411172b676d7Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 411272b676d7Smrg save_libobjs=$libobjs 411372b676d7Smrg fi 411472b676d7Smrg save_output=$output 411572b676d7Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 411672b676d7Smrg 411772b676d7Smrg # Clear the reloadable object creation command queue and 411872b676d7Smrg # initialize k to one. 411972b676d7Smrg test_cmds= 412072b676d7Smrg concat_cmds= 412172b676d7Smrg objlist= 412272b676d7Smrg delfiles= 412372b676d7Smrg last_robj= 412472b676d7Smrg k=1 412572b676d7Smrg output=$output_objdir/$output_la-${k}.$objext 412672b676d7Smrg # Loop over the list of objects to be linked. 412772b676d7Smrg for obj in $save_libobjs 412872b676d7Smrg do 412972b676d7Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 413072b676d7Smrg if test "X$objlist" = X || 413172b676d7Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 413272b676d7Smrg test "$len" -le "$max_cmd_len"; }; then 413372b676d7Smrg objlist="$objlist $obj" 413472b676d7Smrg else 413572b676d7Smrg # The command $test_cmds is almost too long, add a 413672b676d7Smrg # command to the queue. 413772b676d7Smrg if test "$k" -eq 1 ; then 413872b676d7Smrg # The first file doesn't have a previous command to add. 413972b676d7Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 414072b676d7Smrg else 414172b676d7Smrg # All subsequent reloadable object files will link in 414272b676d7Smrg # the last one created. 414372b676d7Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 414472b676d7Smrg fi 414572b676d7Smrg last_robj=$output_objdir/$output_la-${k}.$objext 414672b676d7Smrg k=`expr $k + 1` 414772b676d7Smrg output=$output_objdir/$output_la-${k}.$objext 414872b676d7Smrg objlist=$obj 414972b676d7Smrg len=1 415072b676d7Smrg fi 415172b676d7Smrg done 415272b676d7Smrg # Handle the remaining objects by creating one last 415372b676d7Smrg # reloadable object file. All subsequent reloadable object 415472b676d7Smrg # files will link in the last one created. 415572b676d7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 415672b676d7Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 415772b676d7Smrg 415872b676d7Smrg if ${skipped_export-false}; then 415972b676d7Smrg $show "generating symbol list for \`$libname.la'" 416072b676d7Smrg export_symbols="$output_objdir/$libname.exp" 416172b676d7Smrg $run $rm $export_symbols 416272b676d7Smrg libobjs=$output 416372b676d7Smrg # Append the command to create the export file. 416472b676d7Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 416572b676d7Smrg fi 416672b676d7Smrg 416772b676d7Smrg # Set up a command to remove the reloadable object files 416872b676d7Smrg # after they are used. 416972b676d7Smrg i=0 417072b676d7Smrg while test "$i" -lt "$k" 417172b676d7Smrg do 417272b676d7Smrg i=`expr $i + 1` 417372b676d7Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 417472b676d7Smrg done 417572b676d7Smrg 417672b676d7Smrg $echo "creating a temporary reloadable object file: $output" 417772b676d7Smrg 417872b676d7Smrg # Loop through the commands generated above and execute them. 417972b676d7Smrg save_ifs="$IFS"; IFS='~' 418072b676d7Smrg for cmd in $concat_cmds; do 418172b676d7Smrg IFS="$save_ifs" 418272b676d7Smrg $show "$cmd" 418372b676d7Smrg $run eval "$cmd" || exit $? 418472b676d7Smrg done 418572b676d7Smrg IFS="$save_ifs" 418672b676d7Smrg 418772b676d7Smrg libobjs=$output 418872b676d7Smrg # Restore the value of output. 418972b676d7Smrg output=$save_output 419072b676d7Smrg 419172b676d7Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 419272b676d7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 419372b676d7Smrg fi 419472b676d7Smrg # Expand the library linking commands again to reset the 419572b676d7Smrg # value of $libobjs for piecewise linking. 419672b676d7Smrg 419772b676d7Smrg # Do each of the archive commands. 419872b676d7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 419972b676d7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 420072b676d7Smrg cmds=$module_expsym_cmds 420172b676d7Smrg else 420272b676d7Smrg cmds=$module_cmds 420372b676d7Smrg fi 420472b676d7Smrg else 420572b676d7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 420672b676d7Smrg cmds=$archive_expsym_cmds 420772b676d7Smrg else 420872b676d7Smrg cmds=$archive_cmds 420972b676d7Smrg fi 421072b676d7Smrg fi 421172b676d7Smrg 421272b676d7Smrg # Append the command to remove the reloadable object files 421372b676d7Smrg # to the just-reset $cmds. 421472b676d7Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 421572b676d7Smrg fi 421672b676d7Smrg save_ifs="$IFS"; IFS='~' 421772b676d7Smrg for cmd in $cmds; do 421872b676d7Smrg IFS="$save_ifs" 421972b676d7Smrg eval cmd=\"$cmd\" 422072b676d7Smrg $show "$cmd" 422172b676d7Smrg $run eval "$cmd" || { 422272b676d7Smrg lt_exit=$? 422372b676d7Smrg 422472b676d7Smrg # Restore the uninstalled library and exit 422572b676d7Smrg if test "$mode" = relink; then 422672b676d7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 422772b676d7Smrg fi 422872b676d7Smrg 422972b676d7Smrg exit $lt_exit 423072b676d7Smrg } 423172b676d7Smrg done 423272b676d7Smrg IFS="$save_ifs" 423372b676d7Smrg 423472b676d7Smrg # Restore the uninstalled library and exit 423572b676d7Smrg if test "$mode" = relink; then 423672b676d7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 423772b676d7Smrg 423872b676d7Smrg if test -n "$convenience"; then 423972b676d7Smrg if test -z "$whole_archive_flag_spec"; then 424072b676d7Smrg $show "${rm}r $gentop" 424172b676d7Smrg $run ${rm}r "$gentop" 424272b676d7Smrg fi 424372b676d7Smrg fi 424472b676d7Smrg 424572b676d7Smrg exit $EXIT_SUCCESS 424672b676d7Smrg fi 424772b676d7Smrg 424872b676d7Smrg # Create links to the real library. 424972b676d7Smrg for linkname in $linknames; do 425072b676d7Smrg if test "$realname" != "$linkname"; then 425172b676d7Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 425272b676d7Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 425372b676d7Smrg fi 425472b676d7Smrg done 425572b676d7Smrg 425672b676d7Smrg # If -module or -export-dynamic was specified, set the dlname. 425772b676d7Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 425872b676d7Smrg # On all known operating systems, these are identical. 425972b676d7Smrg dlname="$soname" 426072b676d7Smrg fi 426172b676d7Smrg fi 426272b676d7Smrg ;; 426372b676d7Smrg 426472b676d7Smrg obj) 42651fd23544Smrg case " $deplibs" in 42661fd23544Smrg *\ -l* | *\ -L*) 42671fd23544Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 42681fd23544Smrg esac 426972b676d7Smrg 427072b676d7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 427172b676d7Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 427272b676d7Smrg fi 427372b676d7Smrg 427472b676d7Smrg if test -n "$rpath"; then 427572b676d7Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 427672b676d7Smrg fi 427772b676d7Smrg 427872b676d7Smrg if test -n "$xrpath"; then 427972b676d7Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 428072b676d7Smrg fi 428172b676d7Smrg 428272b676d7Smrg if test -n "$vinfo"; then 428372b676d7Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 428472b676d7Smrg fi 428572b676d7Smrg 428672b676d7Smrg if test -n "$release"; then 428772b676d7Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 428872b676d7Smrg fi 428972b676d7Smrg 429072b676d7Smrg case $output in 429172b676d7Smrg *.lo) 429272b676d7Smrg if test -n "$objs$old_deplibs"; then 429372b676d7Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 429472b676d7Smrg exit $EXIT_FAILURE 429572b676d7Smrg fi 429672b676d7Smrg libobj="$output" 429772b676d7Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 429872b676d7Smrg ;; 429972b676d7Smrg *) 430072b676d7Smrg libobj= 430172b676d7Smrg obj="$output" 430272b676d7Smrg ;; 430372b676d7Smrg esac 430472b676d7Smrg 430572b676d7Smrg # Delete the old objects. 430672b676d7Smrg $run $rm $obj $libobj 430772b676d7Smrg 430872b676d7Smrg # Objects from convenience libraries. This assumes 430972b676d7Smrg # single-version convenience libraries. Whenever we create 431072b676d7Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 431172b676d7Smrg # the extraction. 431272b676d7Smrg reload_conv_objs= 431372b676d7Smrg gentop= 431472b676d7Smrg # reload_cmds runs $LD directly, so let us get rid of 43151fd23544Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 43161fd23544Smrg # turning comma into space.. 431772b676d7Smrg wl= 431872b676d7Smrg 431972b676d7Smrg if test -n "$convenience"; then 432072b676d7Smrg if test -n "$whole_archive_flag_spec"; then 43211fd23544Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 43221fd23544Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 432372b676d7Smrg else 432472b676d7Smrg gentop="$output_objdir/${obj}x" 432572b676d7Smrg generated="$generated $gentop" 432672b676d7Smrg 432772b676d7Smrg func_extract_archives $gentop $convenience 432872b676d7Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 432972b676d7Smrg fi 433072b676d7Smrg fi 433172b676d7Smrg 433272b676d7Smrg # Create the old-style object. 433372b676d7Smrg 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 433472b676d7Smrg 433572b676d7Smrg output="$obj" 433672b676d7Smrg cmds=$reload_cmds 433772b676d7Smrg save_ifs="$IFS"; IFS='~' 433872b676d7Smrg for cmd in $cmds; do 433972b676d7Smrg IFS="$save_ifs" 434072b676d7Smrg eval cmd=\"$cmd\" 434172b676d7Smrg $show "$cmd" 434272b676d7Smrg $run eval "$cmd" || exit $? 434372b676d7Smrg done 434472b676d7Smrg IFS="$save_ifs" 434572b676d7Smrg 434672b676d7Smrg # Exit if we aren't doing a library object file. 434772b676d7Smrg if test -z "$libobj"; then 434872b676d7Smrg if test -n "$gentop"; then 434972b676d7Smrg $show "${rm}r $gentop" 435072b676d7Smrg $run ${rm}r $gentop 435172b676d7Smrg fi 435272b676d7Smrg 435372b676d7Smrg exit $EXIT_SUCCESS 435472b676d7Smrg fi 435572b676d7Smrg 435672b676d7Smrg if test "$build_libtool_libs" != yes; then 435772b676d7Smrg if test -n "$gentop"; then 435872b676d7Smrg $show "${rm}r $gentop" 435972b676d7Smrg $run ${rm}r $gentop 436072b676d7Smrg fi 436172b676d7Smrg 436272b676d7Smrg # Create an invalid libtool object if no PIC, so that we don't 436372b676d7Smrg # accidentally link it into a program. 436472b676d7Smrg # $show "echo timestamp > $libobj" 436572b676d7Smrg # $run eval "echo timestamp > $libobj" || exit $? 436672b676d7Smrg exit $EXIT_SUCCESS 436772b676d7Smrg fi 436872b676d7Smrg 436972b676d7Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 437072b676d7Smrg # Only do commands if we really have different PIC objects. 437172b676d7Smrg reload_objs="$libobjs $reload_conv_objs" 437272b676d7Smrg output="$libobj" 437372b676d7Smrg cmds=$reload_cmds 437472b676d7Smrg save_ifs="$IFS"; IFS='~' 437572b676d7Smrg for cmd in $cmds; do 437672b676d7Smrg IFS="$save_ifs" 437772b676d7Smrg eval cmd=\"$cmd\" 437872b676d7Smrg $show "$cmd" 437972b676d7Smrg $run eval "$cmd" || exit $? 438072b676d7Smrg done 438172b676d7Smrg IFS="$save_ifs" 438272b676d7Smrg fi 438372b676d7Smrg 438472b676d7Smrg if test -n "$gentop"; then 438572b676d7Smrg $show "${rm}r $gentop" 438672b676d7Smrg $run ${rm}r $gentop 438772b676d7Smrg fi 438872b676d7Smrg 438972b676d7Smrg exit $EXIT_SUCCESS 439072b676d7Smrg ;; 439172b676d7Smrg 439272b676d7Smrg prog) 439372b676d7Smrg case $host in 439472b676d7Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 439572b676d7Smrg esac 439672b676d7Smrg if test -n "$vinfo"; then 439772b676d7Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 439872b676d7Smrg fi 439972b676d7Smrg 440072b676d7Smrg if test -n "$release"; then 440172b676d7Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 440272b676d7Smrg fi 440372b676d7Smrg 440472b676d7Smrg if test "$preload" = yes; then 440572b676d7Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 440672b676d7Smrg test "$dlopen_self_static" = unknown; then 440772b676d7Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 440872b676d7Smrg fi 440972b676d7Smrg fi 441072b676d7Smrg 441172b676d7Smrg case $host in 441272b676d7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 441372b676d7Smrg # On Rhapsody replace the C library is the System framework 441472b676d7Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 441572b676d7Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 441672b676d7Smrg ;; 441772b676d7Smrg esac 441872b676d7Smrg 441972b676d7Smrg case $host in 442072b676d7Smrg *darwin*) 442172b676d7Smrg # Don't allow lazy linking, it breaks C++ global constructors 442272b676d7Smrg if test "$tagname" = CXX ; then 442372b676d7Smrg compile_command="$compile_command ${wl}-bind_at_load" 442472b676d7Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 442572b676d7Smrg fi 442672b676d7Smrg ;; 442772b676d7Smrg esac 442872b676d7Smrg 442972b676d7Smrg 443072b676d7Smrg # move library search paths that coincide with paths to not yet 443172b676d7Smrg # installed libraries to the beginning of the library search list 443272b676d7Smrg new_libs= 443372b676d7Smrg for path in $notinst_path; do 443472b676d7Smrg case " $new_libs " in 443572b676d7Smrg *" -L$path/$objdir "*) ;; 443672b676d7Smrg *) 443772b676d7Smrg case " $compile_deplibs " in 443872b676d7Smrg *" -L$path/$objdir "*) 443972b676d7Smrg new_libs="$new_libs -L$path/$objdir" ;; 444072b676d7Smrg esac 444172b676d7Smrg ;; 444272b676d7Smrg esac 444372b676d7Smrg done 444472b676d7Smrg for deplib in $compile_deplibs; do 444572b676d7Smrg case $deplib in 444672b676d7Smrg -L*) 444772b676d7Smrg case " $new_libs " in 444872b676d7Smrg *" $deplib "*) ;; 444972b676d7Smrg *) new_libs="$new_libs $deplib" ;; 445072b676d7Smrg esac 445172b676d7Smrg ;; 445272b676d7Smrg *) new_libs="$new_libs $deplib" ;; 445372b676d7Smrg esac 445472b676d7Smrg done 445572b676d7Smrg compile_deplibs="$new_libs" 445672b676d7Smrg 445772b676d7Smrg 445872b676d7Smrg compile_command="$compile_command $compile_deplibs" 445972b676d7Smrg finalize_command="$finalize_command $finalize_deplibs" 446072b676d7Smrg 446172b676d7Smrg if test -n "$rpath$xrpath"; then 446272b676d7Smrg # If the user specified any rpath flags, then add them. 446372b676d7Smrg for libdir in $rpath $xrpath; do 446472b676d7Smrg # This is the magic to use -rpath. 446572b676d7Smrg case "$finalize_rpath " in 446672b676d7Smrg *" $libdir "*) ;; 446772b676d7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 446872b676d7Smrg esac 446972b676d7Smrg done 447072b676d7Smrg fi 447172b676d7Smrg 447272b676d7Smrg # Now hardcode the library paths 447372b676d7Smrg rpath= 447472b676d7Smrg hardcode_libdirs= 447572b676d7Smrg for libdir in $compile_rpath $finalize_rpath; do 447672b676d7Smrg if test -n "$hardcode_libdir_flag_spec"; then 447772b676d7Smrg if test -n "$hardcode_libdir_separator"; then 447872b676d7Smrg if test -z "$hardcode_libdirs"; then 447972b676d7Smrg hardcode_libdirs="$libdir" 448072b676d7Smrg else 448172b676d7Smrg # Just accumulate the unique libdirs. 448272b676d7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 448372b676d7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 448472b676d7Smrg ;; 448572b676d7Smrg *) 448672b676d7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 448772b676d7Smrg ;; 448872b676d7Smrg esac 448972b676d7Smrg fi 449072b676d7Smrg else 449172b676d7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 449272b676d7Smrg rpath="$rpath $flag" 449372b676d7Smrg fi 449472b676d7Smrg elif test -n "$runpath_var"; then 449572b676d7Smrg case "$perm_rpath " in 449672b676d7Smrg *" $libdir "*) ;; 449772b676d7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 449872b676d7Smrg esac 449972b676d7Smrg fi 450072b676d7Smrg case $host in 450172b676d7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 450272b676d7Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 450372b676d7Smrg case :$dllsearchpath: in 450472b676d7Smrg *":$libdir:"*) ;; 450572b676d7Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 450672b676d7Smrg esac 450772b676d7Smrg case :$dllsearchpath: in 450872b676d7Smrg *":$testbindir:"*) ;; 450972b676d7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 451072b676d7Smrg esac 451172b676d7Smrg ;; 451272b676d7Smrg esac 451372b676d7Smrg done 451472b676d7Smrg # Substitute the hardcoded libdirs into the rpath. 451572b676d7Smrg if test -n "$hardcode_libdir_separator" && 451672b676d7Smrg test -n "$hardcode_libdirs"; then 451772b676d7Smrg libdir="$hardcode_libdirs" 451872b676d7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 451972b676d7Smrg fi 452072b676d7Smrg compile_rpath="$rpath" 452172b676d7Smrg 452272b676d7Smrg rpath= 452372b676d7Smrg hardcode_libdirs= 452472b676d7Smrg for libdir in $finalize_rpath; do 452572b676d7Smrg if test -n "$hardcode_libdir_flag_spec"; then 452672b676d7Smrg if test -n "$hardcode_libdir_separator"; then 452772b676d7Smrg if test -z "$hardcode_libdirs"; then 452872b676d7Smrg hardcode_libdirs="$libdir" 452972b676d7Smrg else 453072b676d7Smrg # Just accumulate the unique libdirs. 453172b676d7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 453272b676d7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 453372b676d7Smrg ;; 453472b676d7Smrg *) 453572b676d7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 453672b676d7Smrg ;; 453772b676d7Smrg esac 453872b676d7Smrg fi 453972b676d7Smrg else 454072b676d7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 454172b676d7Smrg rpath="$rpath $flag" 454272b676d7Smrg fi 454372b676d7Smrg elif test -n "$runpath_var"; then 454472b676d7Smrg case "$finalize_perm_rpath " in 454572b676d7Smrg *" $libdir "*) ;; 454672b676d7Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 454772b676d7Smrg esac 454872b676d7Smrg fi 454972b676d7Smrg done 455072b676d7Smrg # Substitute the hardcoded libdirs into the rpath. 455172b676d7Smrg if test -n "$hardcode_libdir_separator" && 455272b676d7Smrg test -n "$hardcode_libdirs"; then 455372b676d7Smrg libdir="$hardcode_libdirs" 455472b676d7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 455572b676d7Smrg fi 455672b676d7Smrg finalize_rpath="$rpath" 455772b676d7Smrg 455872b676d7Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 455972b676d7Smrg # Transform all the library objects into standard objects. 456072b676d7Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 456172b676d7Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 456272b676d7Smrg fi 456372b676d7Smrg 456472b676d7Smrg dlsyms= 456572b676d7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 456672b676d7Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 456772b676d7Smrg dlsyms="${outputname}S.c" 456872b676d7Smrg else 456972b676d7Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 457072b676d7Smrg fi 457172b676d7Smrg fi 457272b676d7Smrg 457372b676d7Smrg if test -n "$dlsyms"; then 457472b676d7Smrg case $dlsyms in 457572b676d7Smrg "") ;; 457672b676d7Smrg *.c) 457772b676d7Smrg # Discover the nlist of each of the dlfiles. 457872b676d7Smrg nlist="$output_objdir/${outputname}.nm" 457972b676d7Smrg 458072b676d7Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 458172b676d7Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 458272b676d7Smrg 458372b676d7Smrg # Parse the name list into a source file. 458472b676d7Smrg $show "creating $output_objdir/$dlsyms" 458572b676d7Smrg 458672b676d7Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 458772b676d7Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 458872b676d7Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 458972b676d7Smrg 459072b676d7Smrg#ifdef __cplusplus 459172b676d7Smrgextern \"C\" { 459272b676d7Smrg#endif 459372b676d7Smrg 459472b676d7Smrg/* Prevent the only kind of declaration conflicts we can make. */ 459572b676d7Smrg#define lt_preloaded_symbols some_other_symbol 459672b676d7Smrg 459772b676d7Smrg/* External symbol declarations for the compiler. */\ 459872b676d7Smrg" 459972b676d7Smrg 460072b676d7Smrg if test "$dlself" = yes; then 460172b676d7Smrg $show "generating symbol list for \`$output'" 460272b676d7Smrg 460372b676d7Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 460472b676d7Smrg 460572b676d7Smrg # Add our own program objects to the symbol list. 460672b676d7Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 460772b676d7Smrg for arg in $progfiles; do 460872b676d7Smrg $show "extracting global C symbols from \`$arg'" 460972b676d7Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 461072b676d7Smrg done 461172b676d7Smrg 461272b676d7Smrg if test -n "$exclude_expsyms"; then 461372b676d7Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 461472b676d7Smrg $run eval '$mv "$nlist"T "$nlist"' 461572b676d7Smrg fi 461672b676d7Smrg 461772b676d7Smrg if test -n "$export_symbols_regex"; then 461872b676d7Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 461972b676d7Smrg $run eval '$mv "$nlist"T "$nlist"' 462072b676d7Smrg fi 462172b676d7Smrg 462272b676d7Smrg # Prepare the list of exported symbols 462372b676d7Smrg if test -z "$export_symbols"; then 462472b676d7Smrg export_symbols="$output_objdir/$outputname.exp" 462572b676d7Smrg $run $rm $export_symbols 462672b676d7Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 462772b676d7Smrg case $host in 462872b676d7Smrg *cygwin* | *mingw* ) 462972b676d7Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 463072b676d7Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 463172b676d7Smrg ;; 463272b676d7Smrg esac 463372b676d7Smrg else 463472b676d7Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 463572b676d7Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 463672b676d7Smrg $run eval 'mv "$nlist"T "$nlist"' 463772b676d7Smrg case $host in 463872b676d7Smrg *cygwin* | *mingw* ) 463972b676d7Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 464072b676d7Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 464172b676d7Smrg ;; 464272b676d7Smrg esac 464372b676d7Smrg fi 464472b676d7Smrg fi 464572b676d7Smrg 464672b676d7Smrg for arg in $dlprefiles; do 464772b676d7Smrg $show "extracting global C symbols from \`$arg'" 464872b676d7Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 464972b676d7Smrg $run eval '$echo ": $name " >> "$nlist"' 465072b676d7Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 465172b676d7Smrg done 465272b676d7Smrg 465372b676d7Smrg if test -z "$run"; then 465472b676d7Smrg # Make sure we have at least an empty file. 465572b676d7Smrg test -f "$nlist" || : > "$nlist" 465672b676d7Smrg 465772b676d7Smrg if test -n "$exclude_expsyms"; then 465872b676d7Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 465972b676d7Smrg $mv "$nlist"T "$nlist" 466072b676d7Smrg fi 466172b676d7Smrg 466272b676d7Smrg # Try sorting and uniquifying the output. 466372b676d7Smrg if grep -v "^: " < "$nlist" | 466472b676d7Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 466572b676d7Smrg sort -k 3 466672b676d7Smrg else 466772b676d7Smrg sort +2 466872b676d7Smrg fi | 466972b676d7Smrg uniq > "$nlist"S; then 467072b676d7Smrg : 467172b676d7Smrg else 467272b676d7Smrg grep -v "^: " < "$nlist" > "$nlist"S 467372b676d7Smrg fi 467472b676d7Smrg 467572b676d7Smrg if test -f "$nlist"S; then 467672b676d7Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 467772b676d7Smrg else 467872b676d7Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 467972b676d7Smrg fi 468072b676d7Smrg 468172b676d7Smrg $echo >> "$output_objdir/$dlsyms" "\ 468272b676d7Smrg 468372b676d7Smrg#undef lt_preloaded_symbols 468472b676d7Smrg 468572b676d7Smrg#if defined (__STDC__) && __STDC__ 468672b676d7Smrg# define lt_ptr void * 468772b676d7Smrg#else 468872b676d7Smrg# define lt_ptr char * 468972b676d7Smrg# define const 469072b676d7Smrg#endif 469172b676d7Smrg 469272b676d7Smrg/* The mapping between symbol names and symbols. */ 469372b676d7Smrg" 469472b676d7Smrg 469572b676d7Smrg case $host in 469672b676d7Smrg *cygwin* | *mingw* ) 469772b676d7Smrg $echo >> "$output_objdir/$dlsyms" "\ 469872b676d7Smrg/* DATA imports from DLLs on WIN32 can't be const, because 469972b676d7Smrg runtime relocations are performed -- see ld's documentation 470072b676d7Smrg on pseudo-relocs */ 470172b676d7Smrgstruct { 470272b676d7Smrg" 470372b676d7Smrg ;; 470472b676d7Smrg * ) 470572b676d7Smrg $echo >> "$output_objdir/$dlsyms" "\ 470672b676d7Smrgconst struct { 470772b676d7Smrg" 470872b676d7Smrg ;; 470972b676d7Smrg esac 471072b676d7Smrg 471172b676d7Smrg 471272b676d7Smrg $echo >> "$output_objdir/$dlsyms" "\ 471372b676d7Smrg const char *name; 471472b676d7Smrg lt_ptr address; 471572b676d7Smrg} 471672b676d7Smrglt_preloaded_symbols[] = 471772b676d7Smrg{\ 471872b676d7Smrg" 471972b676d7Smrg 472072b676d7Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 472172b676d7Smrg 472272b676d7Smrg $echo >> "$output_objdir/$dlsyms" "\ 472372b676d7Smrg {0, (lt_ptr) 0} 472472b676d7Smrg}; 472572b676d7Smrg 472672b676d7Smrg/* This works around a problem in FreeBSD linker */ 472772b676d7Smrg#ifdef FREEBSD_WORKAROUND 472872b676d7Smrgstatic const void *lt_preloaded_setup() { 472972b676d7Smrg return lt_preloaded_symbols; 473072b676d7Smrg} 473172b676d7Smrg#endif 473272b676d7Smrg 473372b676d7Smrg#ifdef __cplusplus 473472b676d7Smrg} 473572b676d7Smrg#endif\ 473672b676d7Smrg" 473772b676d7Smrg fi 473872b676d7Smrg 473972b676d7Smrg pic_flag_for_symtable= 474072b676d7Smrg case $host in 474172b676d7Smrg # compiling the symbol table file with pic_flag works around 474272b676d7Smrg # a FreeBSD bug that causes programs to crash when -lm is 474372b676d7Smrg # linked before any other PIC object. But we must not use 474472b676d7Smrg # pic_flag when linking with -static. The problem exists in 474572b676d7Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 474672b676d7Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 474772b676d7Smrg case "$compile_command " in 474872b676d7Smrg *" -static "*) ;; 474972b676d7Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 475072b676d7Smrg esac;; 475172b676d7Smrg *-*-hpux*) 475272b676d7Smrg case "$compile_command " in 475372b676d7Smrg *" -static "*) ;; 475472b676d7Smrg *) pic_flag_for_symtable=" $pic_flag";; 475572b676d7Smrg esac 475672b676d7Smrg esac 475772b676d7Smrg 475872b676d7Smrg # Now compile the dynamic symbol file. 475972b676d7Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 476072b676d7Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 476172b676d7Smrg 476272b676d7Smrg # Clean up the generated files. 476372b676d7Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 476472b676d7Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 476572b676d7Smrg 476672b676d7Smrg # Transform the symbol file into the correct name. 476772b676d7Smrg case $host in 476872b676d7Smrg *cygwin* | *mingw* ) 476972b676d7Smrg if test -f "$output_objdir/${outputname}.def" ; then 47701fd23544Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47711fd23544Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 477272b676d7Smrg else 47731fd23544Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47741fd23544Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 477572b676d7Smrg fi 477672b676d7Smrg ;; 477772b676d7Smrg * ) 47781fd23544Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47791fd23544Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 478072b676d7Smrg ;; 478172b676d7Smrg esac 478272b676d7Smrg ;; 478372b676d7Smrg *) 478472b676d7Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 478572b676d7Smrg exit $EXIT_FAILURE 478672b676d7Smrg ;; 478772b676d7Smrg esac 478872b676d7Smrg else 478972b676d7Smrg # We keep going just in case the user didn't refer to 479072b676d7Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 479172b676d7Smrg # really was required. 479272b676d7Smrg 479372b676d7Smrg # Nullify the symbol file. 47941fd23544Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47951fd23544Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 479672b676d7Smrg fi 479772b676d7Smrg 479872b676d7Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 479972b676d7Smrg # Replace the output file specification. 48001fd23544Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 480172b676d7Smrg link_command="$compile_command$compile_rpath" 480272b676d7Smrg 480372b676d7Smrg # We have no uninstalled library dependencies, so finalize right now. 480472b676d7Smrg $show "$link_command" 480572b676d7Smrg $run eval "$link_command" 480672b676d7Smrg exit_status=$? 480772b676d7Smrg 480872b676d7Smrg # Delete the generated files. 480972b676d7Smrg if test -n "$dlsyms"; then 481072b676d7Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 481172b676d7Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 481272b676d7Smrg fi 481372b676d7Smrg 481472b676d7Smrg exit $exit_status 481572b676d7Smrg fi 481672b676d7Smrg 481772b676d7Smrg if test -n "$shlibpath_var"; then 481872b676d7Smrg # We should set the shlibpath_var 481972b676d7Smrg rpath= 482072b676d7Smrg for dir in $temp_rpath; do 482172b676d7Smrg case $dir in 482272b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) 482372b676d7Smrg # Absolute path. 482472b676d7Smrg rpath="$rpath$dir:" 482572b676d7Smrg ;; 482672b676d7Smrg *) 482772b676d7Smrg # Relative path: add a thisdir entry. 482872b676d7Smrg rpath="$rpath\$thisdir/$dir:" 482972b676d7Smrg ;; 483072b676d7Smrg esac 483172b676d7Smrg done 483272b676d7Smrg temp_rpath="$rpath" 483372b676d7Smrg fi 483472b676d7Smrg 483572b676d7Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 483672b676d7Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 483772b676d7Smrg fi 483872b676d7Smrg if test -n "$finalize_shlibpath"; then 483972b676d7Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 484072b676d7Smrg fi 484172b676d7Smrg 484272b676d7Smrg compile_var= 484372b676d7Smrg finalize_var= 484472b676d7Smrg if test -n "$runpath_var"; then 484572b676d7Smrg if test -n "$perm_rpath"; then 484672b676d7Smrg # We should set the runpath_var. 484772b676d7Smrg rpath= 484872b676d7Smrg for dir in $perm_rpath; do 484972b676d7Smrg rpath="$rpath$dir:" 485072b676d7Smrg done 485172b676d7Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 485272b676d7Smrg fi 485372b676d7Smrg if test -n "$finalize_perm_rpath"; then 485472b676d7Smrg # We should set the runpath_var. 485572b676d7Smrg rpath= 485672b676d7Smrg for dir in $finalize_perm_rpath; do 485772b676d7Smrg rpath="$rpath$dir:" 485872b676d7Smrg done 485972b676d7Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 486072b676d7Smrg fi 486172b676d7Smrg fi 486272b676d7Smrg 486372b676d7Smrg if test "$no_install" = yes; then 486472b676d7Smrg # We don't need to create a wrapper script. 486572b676d7Smrg link_command="$compile_var$compile_command$compile_rpath" 486672b676d7Smrg # Replace the output file specification. 486772b676d7Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 486872b676d7Smrg # Delete the old output file. 486972b676d7Smrg $run $rm $output 487072b676d7Smrg # Link the executable and exit 487172b676d7Smrg $show "$link_command" 487272b676d7Smrg $run eval "$link_command" || exit $? 487372b676d7Smrg exit $EXIT_SUCCESS 487472b676d7Smrg fi 487572b676d7Smrg 487672b676d7Smrg if test "$hardcode_action" = relink; then 487772b676d7Smrg # Fast installation is not supported 487872b676d7Smrg link_command="$compile_var$compile_command$compile_rpath" 487972b676d7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 488072b676d7Smrg 488172b676d7Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 488272b676d7Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 488372b676d7Smrg else 488472b676d7Smrg if test "$fast_install" != no; then 488572b676d7Smrg link_command="$finalize_var$compile_command$finalize_rpath" 488672b676d7Smrg if test "$fast_install" = yes; then 48871fd23544Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 488872b676d7Smrg else 488972b676d7Smrg # fast_install is set to needless 489072b676d7Smrg relink_command= 489172b676d7Smrg fi 489272b676d7Smrg else 489372b676d7Smrg link_command="$compile_var$compile_command$compile_rpath" 489472b676d7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 489572b676d7Smrg fi 489672b676d7Smrg fi 489772b676d7Smrg 489872b676d7Smrg # Replace the output file specification. 489972b676d7Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 490072b676d7Smrg 490172b676d7Smrg # Delete the old output files. 490272b676d7Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 490372b676d7Smrg 490472b676d7Smrg $show "$link_command" 490572b676d7Smrg $run eval "$link_command" || exit $? 490672b676d7Smrg 490772b676d7Smrg # Now create the wrapper script. 490872b676d7Smrg $show "creating $output" 490972b676d7Smrg 491072b676d7Smrg # Quote the relink command for shipping. 491172b676d7Smrg if test -n "$relink_command"; then 491272b676d7Smrg # Preserve any variables that may affect compiler behavior 491372b676d7Smrg for var in $variables_saved_for_relink; do 491472b676d7Smrg if eval test -z \"\${$var+set}\"; then 491572b676d7Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 491672b676d7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 491772b676d7Smrg relink_command="$var=; export $var; $relink_command" 491872b676d7Smrg else 491972b676d7Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 492072b676d7Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 492172b676d7Smrg fi 492272b676d7Smrg done 492372b676d7Smrg relink_command="(cd `pwd`; $relink_command)" 49241fd23544Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 492572b676d7Smrg fi 492672b676d7Smrg 492772b676d7Smrg # Quote $echo for shipping. 492872b676d7Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 492972b676d7Smrg case $progpath in 493072b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 493172b676d7Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 493272b676d7Smrg esac 493372b676d7Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 493472b676d7Smrg else 493572b676d7Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 493672b676d7Smrg fi 493772b676d7Smrg 493872b676d7Smrg # Only actually do things if our run command is non-null. 493972b676d7Smrg if test -z "$run"; then 494072b676d7Smrg # win32 will think the script is a binary if it has 494172b676d7Smrg # a .exe suffix, so we strip it off here. 494272b676d7Smrg case $output in 494372b676d7Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 494472b676d7Smrg esac 494572b676d7Smrg # test for cygwin because mv fails w/o .exe extensions 494672b676d7Smrg case $host in 494772b676d7Smrg *cygwin*) 494872b676d7Smrg exeext=.exe 494972b676d7Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 495072b676d7Smrg *) exeext= ;; 495172b676d7Smrg esac 495272b676d7Smrg case $host in 495372b676d7Smrg *cygwin* | *mingw* ) 495472b676d7Smrg output_name=`basename $output` 495572b676d7Smrg output_path=`dirname $output` 495672b676d7Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 495772b676d7Smrg cwrapper="$output_path/$output_name.exe" 495872b676d7Smrg $rm $cwrappersource $cwrapper 495972b676d7Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 496072b676d7Smrg 496172b676d7Smrg cat > $cwrappersource <<EOF 496272b676d7Smrg 496372b676d7Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 496472b676d7Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 496572b676d7Smrg 496672b676d7Smrg The $output program cannot be directly executed until all the libtool 496772b676d7Smrg libraries that it depends on are installed. 496872b676d7Smrg 496972b676d7Smrg This wrapper executable should never be moved out of the build directory. 497072b676d7Smrg If it is, it will not operate correctly. 497172b676d7Smrg 497272b676d7Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 497372b676d7Smrg but could eventually absorb all of the scripts functionality and 497472b676d7Smrg exec $objdir/$outputname directly. 497572b676d7Smrg*/ 497672b676d7SmrgEOF 497772b676d7Smrg cat >> $cwrappersource<<"EOF" 497872b676d7Smrg#include <stdio.h> 497972b676d7Smrg#include <stdlib.h> 498072b676d7Smrg#include <unistd.h> 498172b676d7Smrg#include <malloc.h> 498272b676d7Smrg#include <stdarg.h> 498372b676d7Smrg#include <assert.h> 498472b676d7Smrg#include <string.h> 498572b676d7Smrg#include <ctype.h> 498672b676d7Smrg#include <sys/stat.h> 498772b676d7Smrg 498872b676d7Smrg#if defined(PATH_MAX) 498972b676d7Smrg# define LT_PATHMAX PATH_MAX 499072b676d7Smrg#elif defined(MAXPATHLEN) 499172b676d7Smrg# define LT_PATHMAX MAXPATHLEN 499272b676d7Smrg#else 499372b676d7Smrg# define LT_PATHMAX 1024 499472b676d7Smrg#endif 499572b676d7Smrg 499672b676d7Smrg#ifndef DIR_SEPARATOR 499772b676d7Smrg# define DIR_SEPARATOR '/' 499872b676d7Smrg# define PATH_SEPARATOR ':' 499972b676d7Smrg#endif 500072b676d7Smrg 500172b676d7Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 500272b676d7Smrg defined (__OS2__) 500372b676d7Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 500472b676d7Smrg# ifndef DIR_SEPARATOR_2 500572b676d7Smrg# define DIR_SEPARATOR_2 '\\' 500672b676d7Smrg# endif 500772b676d7Smrg# ifndef PATH_SEPARATOR_2 500872b676d7Smrg# define PATH_SEPARATOR_2 ';' 500972b676d7Smrg# endif 501072b676d7Smrg#endif 501172b676d7Smrg 501272b676d7Smrg#ifndef DIR_SEPARATOR_2 501372b676d7Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 501472b676d7Smrg#else /* DIR_SEPARATOR_2 */ 501572b676d7Smrg# define IS_DIR_SEPARATOR(ch) \ 501672b676d7Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 501772b676d7Smrg#endif /* DIR_SEPARATOR_2 */ 501872b676d7Smrg 501972b676d7Smrg#ifndef PATH_SEPARATOR_2 502072b676d7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 502172b676d7Smrg#else /* PATH_SEPARATOR_2 */ 502272b676d7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 502372b676d7Smrg#endif /* PATH_SEPARATOR_2 */ 502472b676d7Smrg 502572b676d7Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 502672b676d7Smrg#define XFREE(stale) do { \ 502772b676d7Smrg if (stale) { free ((void *) stale); stale = 0; } \ 502872b676d7Smrg} while (0) 502972b676d7Smrg 503072b676d7Smrg/* -DDEBUG is fairly common in CFLAGS. */ 503172b676d7Smrg#undef DEBUG 503272b676d7Smrg#if defined DEBUGWRAPPER 503372b676d7Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 503472b676d7Smrg#else 503572b676d7Smrg# define DEBUG(format, ...) 503672b676d7Smrg#endif 503772b676d7Smrg 503872b676d7Smrgconst char *program_name = NULL; 503972b676d7Smrg 504072b676d7Smrgvoid * xmalloc (size_t num); 504172b676d7Smrgchar * xstrdup (const char *string); 504272b676d7Smrgconst char * base_name (const char *name); 504372b676d7Smrgchar * find_executable(const char *wrapper); 504472b676d7Smrgint check_executable(const char *path); 504572b676d7Smrgchar * strendzap(char *str, const char *pat); 504672b676d7Smrgvoid lt_fatal (const char *message, ...); 504772b676d7Smrg 504872b676d7Smrgint 504972b676d7Smrgmain (int argc, char *argv[]) 505072b676d7Smrg{ 505172b676d7Smrg char **newargz; 505272b676d7Smrg int i; 505372b676d7Smrg 505472b676d7Smrg program_name = (char *) xstrdup (base_name (argv[0])); 505572b676d7Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 505672b676d7Smrg DEBUG("(main) program_name : %s\n",program_name); 505772b676d7Smrg newargz = XMALLOC(char *, argc+2); 505872b676d7SmrgEOF 505972b676d7Smrg 506072b676d7Smrg cat >> $cwrappersource <<EOF 506172b676d7Smrg newargz[0] = (char *) xstrdup("$SHELL"); 506272b676d7SmrgEOF 506372b676d7Smrg 506472b676d7Smrg cat >> $cwrappersource <<"EOF" 506572b676d7Smrg newargz[1] = find_executable(argv[0]); 506672b676d7Smrg if (newargz[1] == NULL) 506772b676d7Smrg lt_fatal("Couldn't find %s", argv[0]); 506872b676d7Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 506972b676d7Smrg /* we know the script has the same name, without the .exe */ 507072b676d7Smrg /* so make sure newargz[1] doesn't end in .exe */ 507172b676d7Smrg strendzap(newargz[1],".exe"); 507272b676d7Smrg for (i = 1; i < argc; i++) 507372b676d7Smrg newargz[i+1] = xstrdup(argv[i]); 507472b676d7Smrg newargz[argc+1] = NULL; 507572b676d7Smrg 507672b676d7Smrg for (i=0; i<argc+1; i++) 507772b676d7Smrg { 507872b676d7Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 507972b676d7Smrg ; 508072b676d7Smrg } 508172b676d7Smrg 508272b676d7SmrgEOF 508372b676d7Smrg 508472b676d7Smrg case $host_os in 508572b676d7Smrg mingw*) 508672b676d7Smrg cat >> $cwrappersource <<EOF 508772b676d7Smrg execv("$SHELL",(char const **)newargz); 508872b676d7SmrgEOF 508972b676d7Smrg ;; 509072b676d7Smrg *) 509172b676d7Smrg cat >> $cwrappersource <<EOF 509272b676d7Smrg execv("$SHELL",newargz); 509372b676d7SmrgEOF 509472b676d7Smrg ;; 509572b676d7Smrg esac 509672b676d7Smrg 509772b676d7Smrg cat >> $cwrappersource <<"EOF" 509872b676d7Smrg return 127; 509972b676d7Smrg} 510072b676d7Smrg 510172b676d7Smrgvoid * 510272b676d7Smrgxmalloc (size_t num) 510372b676d7Smrg{ 510472b676d7Smrg void * p = (void *) malloc (num); 510572b676d7Smrg if (!p) 510672b676d7Smrg lt_fatal ("Memory exhausted"); 510772b676d7Smrg 510872b676d7Smrg return p; 510972b676d7Smrg} 511072b676d7Smrg 511172b676d7Smrgchar * 511272b676d7Smrgxstrdup (const char *string) 511372b676d7Smrg{ 511472b676d7Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 511572b676d7Smrg; 511672b676d7Smrg} 511772b676d7Smrg 511872b676d7Smrgconst char * 511972b676d7Smrgbase_name (const char *name) 512072b676d7Smrg{ 512172b676d7Smrg const char *base; 512272b676d7Smrg 512372b676d7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 512472b676d7Smrg /* Skip over the disk name in MSDOS pathnames. */ 512572b676d7Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 512672b676d7Smrg name += 2; 512772b676d7Smrg#endif 512872b676d7Smrg 512972b676d7Smrg for (base = name; *name; name++) 513072b676d7Smrg if (IS_DIR_SEPARATOR (*name)) 513172b676d7Smrg base = name + 1; 513272b676d7Smrg return base; 513372b676d7Smrg} 513472b676d7Smrg 513572b676d7Smrgint 513672b676d7Smrgcheck_executable(const char * path) 513772b676d7Smrg{ 513872b676d7Smrg struct stat st; 513972b676d7Smrg 514072b676d7Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 514172b676d7Smrg if ((!path) || (!*path)) 514272b676d7Smrg return 0; 514372b676d7Smrg 514472b676d7Smrg if ((stat (path, &st) >= 0) && 514572b676d7Smrg ( 514672b676d7Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 514772b676d7Smrg#if defined (S_IXOTH) 514872b676d7Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 514972b676d7Smrg#endif 515072b676d7Smrg#if defined (S_IXGRP) 515172b676d7Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 515272b676d7Smrg#endif 515372b676d7Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 515472b676d7Smrg ) 515572b676d7Smrg return 1; 515672b676d7Smrg else 515772b676d7Smrg return 0; 515872b676d7Smrg} 515972b676d7Smrg 516072b676d7Smrg/* Searches for the full path of the wrapper. Returns 516172b676d7Smrg newly allocated full path name if found, NULL otherwise */ 516272b676d7Smrgchar * 516372b676d7Smrgfind_executable (const char* wrapper) 516472b676d7Smrg{ 516572b676d7Smrg int has_slash = 0; 516672b676d7Smrg const char* p; 516772b676d7Smrg const char* p_next; 516872b676d7Smrg /* static buffer for getcwd */ 516972b676d7Smrg char tmp[LT_PATHMAX + 1]; 517072b676d7Smrg int tmp_len; 517172b676d7Smrg char* concat_name; 517272b676d7Smrg 517372b676d7Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 517472b676d7Smrg 517572b676d7Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 517672b676d7Smrg return NULL; 517772b676d7Smrg 517872b676d7Smrg /* Absolute path? */ 517972b676d7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 518072b676d7Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 518172b676d7Smrg { 518272b676d7Smrg concat_name = xstrdup (wrapper); 518372b676d7Smrg if (check_executable(concat_name)) 518472b676d7Smrg return concat_name; 518572b676d7Smrg XFREE(concat_name); 518672b676d7Smrg } 518772b676d7Smrg else 518872b676d7Smrg { 518972b676d7Smrg#endif 519072b676d7Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 519172b676d7Smrg { 519272b676d7Smrg concat_name = xstrdup (wrapper); 519372b676d7Smrg if (check_executable(concat_name)) 519472b676d7Smrg return concat_name; 519572b676d7Smrg XFREE(concat_name); 519672b676d7Smrg } 519772b676d7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 519872b676d7Smrg } 519972b676d7Smrg#endif 520072b676d7Smrg 520172b676d7Smrg for (p = wrapper; *p; p++) 520272b676d7Smrg if (*p == '/') 520372b676d7Smrg { 520472b676d7Smrg has_slash = 1; 520572b676d7Smrg break; 520672b676d7Smrg } 520772b676d7Smrg if (!has_slash) 520872b676d7Smrg { 520972b676d7Smrg /* no slashes; search PATH */ 521072b676d7Smrg const char* path = getenv ("PATH"); 521172b676d7Smrg if (path != NULL) 521272b676d7Smrg { 521372b676d7Smrg for (p = path; *p; p = p_next) 521472b676d7Smrg { 521572b676d7Smrg const char* q; 521672b676d7Smrg size_t p_len; 521772b676d7Smrg for (q = p; *q; q++) 521872b676d7Smrg if (IS_PATH_SEPARATOR(*q)) 521972b676d7Smrg break; 522072b676d7Smrg p_len = q - p; 522172b676d7Smrg p_next = (*q == '\0' ? q : q + 1); 522272b676d7Smrg if (p_len == 0) 522372b676d7Smrg { 522472b676d7Smrg /* empty path: current directory */ 522572b676d7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 522672b676d7Smrg lt_fatal ("getcwd failed"); 522772b676d7Smrg tmp_len = strlen(tmp); 522872b676d7Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 522972b676d7Smrg memcpy (concat_name, tmp, tmp_len); 523072b676d7Smrg concat_name[tmp_len] = '/'; 523172b676d7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 523272b676d7Smrg } 523372b676d7Smrg else 523472b676d7Smrg { 523572b676d7Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 523672b676d7Smrg memcpy (concat_name, p, p_len); 523772b676d7Smrg concat_name[p_len] = '/'; 523872b676d7Smrg strcpy (concat_name + p_len + 1, wrapper); 523972b676d7Smrg } 524072b676d7Smrg if (check_executable(concat_name)) 524172b676d7Smrg return concat_name; 524272b676d7Smrg XFREE(concat_name); 524372b676d7Smrg } 524472b676d7Smrg } 524572b676d7Smrg /* not found in PATH; assume curdir */ 524672b676d7Smrg } 524772b676d7Smrg /* Relative path | not found in path: prepend cwd */ 524872b676d7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 524972b676d7Smrg lt_fatal ("getcwd failed"); 525072b676d7Smrg tmp_len = strlen(tmp); 525172b676d7Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 525272b676d7Smrg memcpy (concat_name, tmp, tmp_len); 525372b676d7Smrg concat_name[tmp_len] = '/'; 525472b676d7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 525572b676d7Smrg 525672b676d7Smrg if (check_executable(concat_name)) 525772b676d7Smrg return concat_name; 525872b676d7Smrg XFREE(concat_name); 525972b676d7Smrg return NULL; 526072b676d7Smrg} 526172b676d7Smrg 526272b676d7Smrgchar * 526372b676d7Smrgstrendzap(char *str, const char *pat) 526472b676d7Smrg{ 526572b676d7Smrg size_t len, patlen; 526672b676d7Smrg 526772b676d7Smrg assert(str != NULL); 526872b676d7Smrg assert(pat != NULL); 526972b676d7Smrg 527072b676d7Smrg len = strlen(str); 527172b676d7Smrg patlen = strlen(pat); 527272b676d7Smrg 527372b676d7Smrg if (patlen <= len) 527472b676d7Smrg { 527572b676d7Smrg str += len - patlen; 527672b676d7Smrg if (strcmp(str, pat) == 0) 527772b676d7Smrg *str = '\0'; 527872b676d7Smrg } 527972b676d7Smrg return str; 528072b676d7Smrg} 528172b676d7Smrg 528272b676d7Smrgstatic void 528372b676d7Smrglt_error_core (int exit_status, const char * mode, 528472b676d7Smrg const char * message, va_list ap) 528572b676d7Smrg{ 528672b676d7Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 528772b676d7Smrg vfprintf (stderr, message, ap); 528872b676d7Smrg fprintf (stderr, ".\n"); 528972b676d7Smrg 529072b676d7Smrg if (exit_status >= 0) 529172b676d7Smrg exit (exit_status); 529272b676d7Smrg} 529372b676d7Smrg 529472b676d7Smrgvoid 529572b676d7Smrglt_fatal (const char *message, ...) 529672b676d7Smrg{ 529772b676d7Smrg va_list ap; 529872b676d7Smrg va_start (ap, message); 529972b676d7Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 530072b676d7Smrg va_end (ap); 530172b676d7Smrg} 530272b676d7SmrgEOF 530372b676d7Smrg # we should really use a build-platform specific compiler 530472b676d7Smrg # here, but OTOH, the wrappers (shell script and this C one) 530572b676d7Smrg # are only useful if you want to execute the "real" binary. 530672b676d7Smrg # Since the "real" binary is built for $host, then this 530772b676d7Smrg # wrapper might as well be built for $host, too. 530872b676d7Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 530972b676d7Smrg ;; 531072b676d7Smrg esac 531172b676d7Smrg $rm $output 531272b676d7Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 531372b676d7Smrg 531472b676d7Smrg $echo > $output "\ 531572b676d7Smrg#! $SHELL 531672b676d7Smrg 531772b676d7Smrg# $output - temporary wrapper script for $objdir/$outputname 531872b676d7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 531972b676d7Smrg# 532072b676d7Smrg# The $output program cannot be directly executed until all the libtool 532172b676d7Smrg# libraries that it depends on are installed. 532272b676d7Smrg# 532372b676d7Smrg# This wrapper script should never be moved out of the build directory. 532472b676d7Smrg# If it is, it will not operate correctly. 532572b676d7Smrg 532672b676d7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 532772b676d7Smrg# metacharacters that are still active within double-quoted strings. 532872b676d7SmrgXsed='${SED} -e 1s/^X//' 532972b676d7Smrgsed_quote_subst='$sed_quote_subst' 533072b676d7Smrg 53311fd23544Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53321fd23544Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 53331fd23544Smrg emulate sh 53341fd23544Smrg NULLCMD=: 53351fd23544Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 53361fd23544Smrg # is contrary to our usage. Disable this feature. 53371fd23544Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 53381fd23544Smrg setopt NO_GLOB_SUBST 53391fd23544Smrgelse 53401fd23544Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 53411fd23544Smrgfi 53421fd23544SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 53431fd23544SmrgDUALCASE=1; export DUALCASE # for MKS sh 53441fd23544Smrg 534572b676d7Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 534672b676d7Smrg# if CDPATH is set. 534772b676d7Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 534872b676d7Smrg 534972b676d7Smrgrelink_command=\"$relink_command\" 535072b676d7Smrg 535172b676d7Smrg# This environment variable determines our operation mode. 535272b676d7Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 535372b676d7Smrg # install mode needs the following variable: 535472b676d7Smrg notinst_deplibs='$notinst_deplibs' 535572b676d7Smrgelse 535672b676d7Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 535772b676d7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 535872b676d7Smrg echo=\"$qecho\" 535972b676d7Smrg file=\"\$0\" 536072b676d7Smrg # Make sure echo works. 536172b676d7Smrg if test \"X\$1\" = X--no-reexec; then 536272b676d7Smrg # Discard the --no-reexec flag, and continue. 536372b676d7Smrg shift 536472b676d7Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 536572b676d7Smrg # Yippee, \$echo works! 536672b676d7Smrg : 536772b676d7Smrg else 536872b676d7Smrg # Restart under the correct shell, and then maybe \$echo will work. 536972b676d7Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 537072b676d7Smrg fi 537172b676d7Smrg fi\ 537272b676d7Smrg" 537372b676d7Smrg $echo >> $output "\ 537472b676d7Smrg 537572b676d7Smrg # Find the directory that this script lives in. 537672b676d7Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 537772b676d7Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 537872b676d7Smrg 537972b676d7Smrg # Follow symbolic links until we get to the real thisdir. 538072b676d7Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 538172b676d7Smrg while test -n \"\$file\"; do 538272b676d7Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 538372b676d7Smrg 538472b676d7Smrg # If there was a directory component, then change thisdir. 538572b676d7Smrg if test \"x\$destdir\" != \"x\$file\"; then 538672b676d7Smrg case \"\$destdir\" in 538772b676d7Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 538872b676d7Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 538972b676d7Smrg esac 539072b676d7Smrg fi 539172b676d7Smrg 539272b676d7Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 539372b676d7Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 539472b676d7Smrg done 539572b676d7Smrg 539672b676d7Smrg # Try to get the absolute directory name. 539772b676d7Smrg absdir=\`cd \"\$thisdir\" && pwd\` 539872b676d7Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 539972b676d7Smrg" 540072b676d7Smrg 540172b676d7Smrg if test "$fast_install" = yes; then 540272b676d7Smrg $echo >> $output "\ 540372b676d7Smrg program=lt-'$outputname'$exeext 540472b676d7Smrg progdir=\"\$thisdir/$objdir\" 540572b676d7Smrg 540672b676d7Smrg if test ! -f \"\$progdir/\$program\" || \\ 540772b676d7Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 540872b676d7Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 540972b676d7Smrg 541072b676d7Smrg file=\"\$\$-\$program\" 541172b676d7Smrg 541272b676d7Smrg if test ! -d \"\$progdir\"; then 541372b676d7Smrg $mkdir \"\$progdir\" 541472b676d7Smrg else 541572b676d7Smrg $rm \"\$progdir/\$file\" 541672b676d7Smrg fi" 541772b676d7Smrg 541872b676d7Smrg $echo >> $output "\ 541972b676d7Smrg 542072b676d7Smrg # relink executable if necessary 542172b676d7Smrg if test -n \"\$relink_command\"; then 542272b676d7Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 542372b676d7Smrg else 542472b676d7Smrg $echo \"\$relink_command_output\" >&2 542572b676d7Smrg $rm \"\$progdir/\$file\" 542672b676d7Smrg exit $EXIT_FAILURE 542772b676d7Smrg fi 542872b676d7Smrg fi 542972b676d7Smrg 543072b676d7Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 543172b676d7Smrg { $rm \"\$progdir/\$program\"; 543272b676d7Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 543372b676d7Smrg $rm \"\$progdir/\$file\" 543472b676d7Smrg fi" 543572b676d7Smrg else 543672b676d7Smrg $echo >> $output "\ 543772b676d7Smrg program='$outputname' 543872b676d7Smrg progdir=\"\$thisdir/$objdir\" 543972b676d7Smrg" 544072b676d7Smrg fi 544172b676d7Smrg 544272b676d7Smrg $echo >> $output "\ 544372b676d7Smrg 544472b676d7Smrg if test -f \"\$progdir/\$program\"; then" 544572b676d7Smrg 544672b676d7Smrg # Export our shlibpath_var if we have one. 544772b676d7Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 544872b676d7Smrg $echo >> $output "\ 544972b676d7Smrg # Add our own library path to $shlibpath_var 545072b676d7Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 545172b676d7Smrg 545272b676d7Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 545372b676d7Smrg # The second colon is a workaround for a bug in BeOS R4 sed 545472b676d7Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 545572b676d7Smrg 545672b676d7Smrg export $shlibpath_var 545772b676d7Smrg" 545872b676d7Smrg fi 545972b676d7Smrg 546072b676d7Smrg # fixup the dll searchpath if we need to. 546172b676d7Smrg if test -n "$dllsearchpath"; then 546272b676d7Smrg $echo >> $output "\ 546372b676d7Smrg # Add the dll search path components to the executable PATH 546472b676d7Smrg PATH=$dllsearchpath:\$PATH 546572b676d7Smrg" 546672b676d7Smrg fi 546772b676d7Smrg 546872b676d7Smrg $echo >> $output "\ 546972b676d7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 547072b676d7Smrg # Run the actual program with our arguments. 547172b676d7Smrg" 547272b676d7Smrg case $host in 547372b676d7Smrg # Backslashes separate directories on plain windows 547472b676d7Smrg *-*-mingw | *-*-os2*) 547572b676d7Smrg $echo >> $output "\ 547672b676d7Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 547772b676d7Smrg" 547872b676d7Smrg ;; 547972b676d7Smrg 548072b676d7Smrg *) 548172b676d7Smrg $echo >> $output "\ 548272b676d7Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 548372b676d7Smrg" 548472b676d7Smrg ;; 548572b676d7Smrg esac 548672b676d7Smrg $echo >> $output "\ 54871fd23544Smrg \$echo \"\$0: cannot exec \$program \$*\" 548872b676d7Smrg exit $EXIT_FAILURE 548972b676d7Smrg fi 549072b676d7Smrg else 549172b676d7Smrg # The program doesn't exist. 549272b676d7Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 549372b676d7Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 549472b676d7Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 549572b676d7Smrg exit $EXIT_FAILURE 549672b676d7Smrg fi 549772b676d7Smrgfi\ 549872b676d7Smrg" 549972b676d7Smrg chmod +x $output 550072b676d7Smrg fi 550172b676d7Smrg exit $EXIT_SUCCESS 550272b676d7Smrg ;; 550372b676d7Smrg esac 550472b676d7Smrg 550572b676d7Smrg # See if we need to build an old-fashioned archive. 550672b676d7Smrg for oldlib in $oldlibs; do 550772b676d7Smrg 550872b676d7Smrg if test "$build_libtool_libs" = convenience; then 550972b676d7Smrg oldobjs="$libobjs_save" 551072b676d7Smrg addlibs="$convenience" 551172b676d7Smrg build_libtool_libs=no 551272b676d7Smrg else 551372b676d7Smrg if test "$build_libtool_libs" = module; then 551472b676d7Smrg oldobjs="$libobjs_save" 551572b676d7Smrg build_libtool_libs=no 551672b676d7Smrg else 551772b676d7Smrg oldobjs="$old_deplibs $non_pic_objects" 551872b676d7Smrg fi 551972b676d7Smrg addlibs="$old_convenience" 552072b676d7Smrg fi 552172b676d7Smrg 552272b676d7Smrg if test -n "$addlibs"; then 552372b676d7Smrg gentop="$output_objdir/${outputname}x" 552472b676d7Smrg generated="$generated $gentop" 552572b676d7Smrg 552672b676d7Smrg func_extract_archives $gentop $addlibs 552772b676d7Smrg oldobjs="$oldobjs $func_extract_archives_result" 552872b676d7Smrg fi 552972b676d7Smrg 553072b676d7Smrg # Do each command in the archive commands. 553172b676d7Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 553272b676d7Smrg cmds=$old_archive_from_new_cmds 553372b676d7Smrg else 553472b676d7Smrg # POSIX demands no paths to be encoded in archives. We have 553572b676d7Smrg # to avoid creating archives with duplicate basenames if we 553672b676d7Smrg # might have to extract them afterwards, e.g., when creating a 553772b676d7Smrg # static archive out of a convenience library, or when linking 553872b676d7Smrg # the entirety of a libtool archive into another (currently 553972b676d7Smrg # not supported by libtool). 554072b676d7Smrg if (for obj in $oldobjs 554172b676d7Smrg do 554272b676d7Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 554372b676d7Smrg done | sort | sort -uc >/dev/null 2>&1); then 554472b676d7Smrg : 554572b676d7Smrg else 554672b676d7Smrg $echo "copying selected object files to avoid basename conflicts..." 554772b676d7Smrg 554872b676d7Smrg if test -z "$gentop"; then 554972b676d7Smrg gentop="$output_objdir/${outputname}x" 555072b676d7Smrg generated="$generated $gentop" 555172b676d7Smrg 555272b676d7Smrg $show "${rm}r $gentop" 555372b676d7Smrg $run ${rm}r "$gentop" 555472b676d7Smrg $show "$mkdir $gentop" 555572b676d7Smrg $run $mkdir "$gentop" 555672b676d7Smrg exit_status=$? 555772b676d7Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 555872b676d7Smrg exit $exit_status 555972b676d7Smrg fi 556072b676d7Smrg fi 556172b676d7Smrg 556272b676d7Smrg save_oldobjs=$oldobjs 556372b676d7Smrg oldobjs= 556472b676d7Smrg counter=1 556572b676d7Smrg for obj in $save_oldobjs 556672b676d7Smrg do 556772b676d7Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 556872b676d7Smrg case " $oldobjs " in 556972b676d7Smrg " ") oldobjs=$obj ;; 557072b676d7Smrg *[\ /]"$objbase "*) 557172b676d7Smrg while :; do 557272b676d7Smrg # Make sure we don't pick an alternate name that also 557372b676d7Smrg # overlaps. 557472b676d7Smrg newobj=lt$counter-$objbase 557572b676d7Smrg counter=`expr $counter + 1` 557672b676d7Smrg case " $oldobjs " in 557772b676d7Smrg *[\ /]"$newobj "*) ;; 557872b676d7Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 557972b676d7Smrg esac 558072b676d7Smrg done 558172b676d7Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 558272b676d7Smrg $run ln "$obj" "$gentop/$newobj" || 558372b676d7Smrg $run cp "$obj" "$gentop/$newobj" 558472b676d7Smrg oldobjs="$oldobjs $gentop/$newobj" 558572b676d7Smrg ;; 558672b676d7Smrg *) oldobjs="$oldobjs $obj" ;; 558772b676d7Smrg esac 558872b676d7Smrg done 558972b676d7Smrg fi 559072b676d7Smrg 559172b676d7Smrg eval cmds=\"$old_archive_cmds\" 559272b676d7Smrg 559372b676d7Smrg if len=`expr "X$cmds" : ".*"` && 559472b676d7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 559572b676d7Smrg cmds=$old_archive_cmds 559672b676d7Smrg else 559772b676d7Smrg # the command line is too long to link in one step, link in parts 559872b676d7Smrg $echo "using piecewise archive linking..." 559972b676d7Smrg save_RANLIB=$RANLIB 560072b676d7Smrg RANLIB=: 560172b676d7Smrg objlist= 560272b676d7Smrg concat_cmds= 560372b676d7Smrg save_oldobjs=$oldobjs 560472b676d7Smrg 560572b676d7Smrg # Is there a better way of finding the last object in the list? 560672b676d7Smrg for obj in $save_oldobjs 560772b676d7Smrg do 560872b676d7Smrg last_oldobj=$obj 560972b676d7Smrg done 561072b676d7Smrg for obj in $save_oldobjs 561172b676d7Smrg do 561272b676d7Smrg oldobjs="$objlist $obj" 561372b676d7Smrg objlist="$objlist $obj" 561472b676d7Smrg eval test_cmds=\"$old_archive_cmds\" 561572b676d7Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 561672b676d7Smrg test "$len" -le "$max_cmd_len"; then 561772b676d7Smrg : 561872b676d7Smrg else 561972b676d7Smrg # the above command should be used before it gets too long 562072b676d7Smrg oldobjs=$objlist 562172b676d7Smrg if test "$obj" = "$last_oldobj" ; then 562272b676d7Smrg RANLIB=$save_RANLIB 562372b676d7Smrg fi 562472b676d7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 562572b676d7Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 562672b676d7Smrg objlist= 562772b676d7Smrg fi 562872b676d7Smrg done 562972b676d7Smrg RANLIB=$save_RANLIB 563072b676d7Smrg oldobjs=$objlist 563172b676d7Smrg if test "X$oldobjs" = "X" ; then 563272b676d7Smrg eval cmds=\"\$concat_cmds\" 563372b676d7Smrg else 563472b676d7Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 563572b676d7Smrg fi 563672b676d7Smrg fi 563772b676d7Smrg fi 563872b676d7Smrg save_ifs="$IFS"; IFS='~' 563972b676d7Smrg for cmd in $cmds; do 564072b676d7Smrg eval cmd=\"$cmd\" 564172b676d7Smrg IFS="$save_ifs" 564272b676d7Smrg $show "$cmd" 564372b676d7Smrg $run eval "$cmd" || exit $? 564472b676d7Smrg done 564572b676d7Smrg IFS="$save_ifs" 564672b676d7Smrg done 564772b676d7Smrg 564872b676d7Smrg if test -n "$generated"; then 564972b676d7Smrg $show "${rm}r$generated" 565072b676d7Smrg $run ${rm}r$generated 565172b676d7Smrg fi 565272b676d7Smrg 565372b676d7Smrg # Now create the libtool archive. 565472b676d7Smrg case $output in 565572b676d7Smrg *.la) 565672b676d7Smrg old_library= 565772b676d7Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 565872b676d7Smrg $show "creating $output" 565972b676d7Smrg 566072b676d7Smrg # Preserve any variables that may affect compiler behavior 566172b676d7Smrg for var in $variables_saved_for_relink; do 566272b676d7Smrg if eval test -z \"\${$var+set}\"; then 566372b676d7Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 566472b676d7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 566572b676d7Smrg relink_command="$var=; export $var; $relink_command" 566672b676d7Smrg else 566772b676d7Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 566872b676d7Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 566972b676d7Smrg fi 567072b676d7Smrg done 567172b676d7Smrg # Quote the link command for shipping. 567272b676d7Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 56731fd23544Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 567472b676d7Smrg if test "$hardcode_automatic" = yes ; then 567572b676d7Smrg relink_command= 567672b676d7Smrg fi 567772b676d7Smrg 567872b676d7Smrg 567972b676d7Smrg # Only create the output if not a dry run. 568072b676d7Smrg if test -z "$run"; then 568172b676d7Smrg for installed in no yes; do 568272b676d7Smrg if test "$installed" = yes; then 568372b676d7Smrg if test -z "$install_libdir"; then 568472b676d7Smrg break 568572b676d7Smrg fi 568672b676d7Smrg output="$output_objdir/$outputname"i 568772b676d7Smrg # Replace all uninstalled libtool libraries with the installed ones 568872b676d7Smrg newdependency_libs= 568972b676d7Smrg for deplib in $dependency_libs; do 569072b676d7Smrg case $deplib in 569172b676d7Smrg *.la) 569272b676d7Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 569372b676d7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 569472b676d7Smrg if test -z "$libdir"; then 569572b676d7Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 569672b676d7Smrg exit $EXIT_FAILURE 569772b676d7Smrg fi 569872b676d7Smrg newdependency_libs="$newdependency_libs $libdir/$name" 569972b676d7Smrg ;; 570072b676d7Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 570172b676d7Smrg esac 570272b676d7Smrg done 570372b676d7Smrg dependency_libs="$newdependency_libs" 570472b676d7Smrg newdlfiles= 570572b676d7Smrg for lib in $dlfiles; do 570672b676d7Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 570772b676d7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 570872b676d7Smrg if test -z "$libdir"; then 570972b676d7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 571072b676d7Smrg exit $EXIT_FAILURE 571172b676d7Smrg fi 571272b676d7Smrg newdlfiles="$newdlfiles $libdir/$name" 571372b676d7Smrg done 571472b676d7Smrg dlfiles="$newdlfiles" 571572b676d7Smrg newdlprefiles= 571672b676d7Smrg for lib in $dlprefiles; do 571772b676d7Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 571872b676d7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 571972b676d7Smrg if test -z "$libdir"; then 572072b676d7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 572172b676d7Smrg exit $EXIT_FAILURE 572272b676d7Smrg fi 572372b676d7Smrg newdlprefiles="$newdlprefiles $libdir/$name" 572472b676d7Smrg done 572572b676d7Smrg dlprefiles="$newdlprefiles" 572672b676d7Smrg else 572772b676d7Smrg newdlfiles= 572872b676d7Smrg for lib in $dlfiles; do 572972b676d7Smrg case $lib in 573072b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 573172b676d7Smrg *) abs=`pwd`"/$lib" ;; 573272b676d7Smrg esac 573372b676d7Smrg newdlfiles="$newdlfiles $abs" 573472b676d7Smrg done 573572b676d7Smrg dlfiles="$newdlfiles" 573672b676d7Smrg newdlprefiles= 573772b676d7Smrg for lib in $dlprefiles; do 573872b676d7Smrg case $lib in 573972b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 574072b676d7Smrg *) abs=`pwd`"/$lib" ;; 574172b676d7Smrg esac 574272b676d7Smrg newdlprefiles="$newdlprefiles $abs" 574372b676d7Smrg done 574472b676d7Smrg dlprefiles="$newdlprefiles" 574572b676d7Smrg fi 574672b676d7Smrg $rm $output 574772b676d7Smrg # place dlname in correct position for cygwin 574872b676d7Smrg tdlname=$dlname 574972b676d7Smrg case $host,$output,$installed,$module,$dlname in 575072b676d7Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 575172b676d7Smrg esac 575272b676d7Smrg $echo > $output "\ 575372b676d7Smrg# $outputname - a libtool library file 575472b676d7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 575572b676d7Smrg# 575672b676d7Smrg# Please DO NOT delete this file! 575772b676d7Smrg# It is necessary for linking the library. 575872b676d7Smrg 575972b676d7Smrg# The name that we can dlopen(3). 576072b676d7Smrgdlname='$tdlname' 576172b676d7Smrg 576272b676d7Smrg# Names of this library. 576372b676d7Smrglibrary_names='$library_names' 576472b676d7Smrg 576572b676d7Smrg# The name of the static archive. 576672b676d7Smrgold_library='$old_library' 576772b676d7Smrg 576872b676d7Smrg# Libraries that this one depends upon. 576972b676d7Smrgdependency_libs='$dependency_libs' 577072b676d7Smrg 577172b676d7Smrg# Version information for $libname. 577272b676d7Smrgcurrent=$current 577372b676d7Smrgage=$age 577472b676d7Smrgrevision=$revision 577572b676d7Smrg 577672b676d7Smrg# Is this an already installed library? 577772b676d7Smrginstalled=$installed 577872b676d7Smrg 577972b676d7Smrg# Should we warn about portability when linking against -modules? 578072b676d7Smrgshouldnotlink=$module 578172b676d7Smrg 578272b676d7Smrg# Files to dlopen/dlpreopen 578372b676d7Smrgdlopen='$dlfiles' 578472b676d7Smrgdlpreopen='$dlprefiles' 578572b676d7Smrg 578672b676d7Smrg# Directory that this library needs to be installed in: 578772b676d7Smrglibdir='$install_libdir'" 578872b676d7Smrg if test "$installed" = no && test "$need_relink" = yes; then 578972b676d7Smrg $echo >> $output "\ 579072b676d7Smrgrelink_command=\"$relink_command\"" 579172b676d7Smrg fi 579272b676d7Smrg done 579372b676d7Smrg fi 579472b676d7Smrg 579572b676d7Smrg # Do a symbolic link so that the libtool archive can be found in 579672b676d7Smrg # LD_LIBRARY_PATH before the program is installed. 579772b676d7Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 579872b676d7Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 579972b676d7Smrg ;; 580072b676d7Smrg esac 580172b676d7Smrg exit $EXIT_SUCCESS 580272b676d7Smrg ;; 580372b676d7Smrg 580472b676d7Smrg # libtool install mode 580572b676d7Smrg install) 580672b676d7Smrg modename="$modename: install" 580772b676d7Smrg 580872b676d7Smrg # There may be an optional sh(1) argument at the beginning of 580972b676d7Smrg # install_prog (especially on Windows NT). 581072b676d7Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 581172b676d7Smrg # Allow the use of GNU shtool's install command. 581272b676d7Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 581372b676d7Smrg # Aesthetically quote it. 581472b676d7Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 581572b676d7Smrg case $arg in 581672b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 581772b676d7Smrg arg="\"$arg\"" 581872b676d7Smrg ;; 581972b676d7Smrg esac 582072b676d7Smrg install_prog="$arg " 582172b676d7Smrg arg="$1" 582272b676d7Smrg shift 582372b676d7Smrg else 582472b676d7Smrg install_prog= 582572b676d7Smrg arg=$nonopt 582672b676d7Smrg fi 582772b676d7Smrg 582872b676d7Smrg # The real first argument should be the name of the installation program. 582972b676d7Smrg # Aesthetically quote it. 583072b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 583172b676d7Smrg case $arg in 583272b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 583372b676d7Smrg arg="\"$arg\"" 583472b676d7Smrg ;; 583572b676d7Smrg esac 583672b676d7Smrg install_prog="$install_prog$arg" 583772b676d7Smrg 583872b676d7Smrg # We need to accept at least all the BSD install flags. 583972b676d7Smrg dest= 584072b676d7Smrg files= 584172b676d7Smrg opts= 584272b676d7Smrg prev= 584372b676d7Smrg install_type= 584472b676d7Smrg isdir=no 584572b676d7Smrg stripme= 584672b676d7Smrg for arg 584772b676d7Smrg do 584872b676d7Smrg if test -n "$dest"; then 584972b676d7Smrg files="$files $dest" 585072b676d7Smrg dest=$arg 585172b676d7Smrg continue 585272b676d7Smrg fi 585372b676d7Smrg 585472b676d7Smrg case $arg in 585572b676d7Smrg -d) isdir=yes ;; 585672b676d7Smrg -f) 585772b676d7Smrg case " $install_prog " in 585872b676d7Smrg *[\\\ /]cp\ *) ;; 585972b676d7Smrg *) prev=$arg ;; 586072b676d7Smrg esac 586172b676d7Smrg ;; 586272b676d7Smrg -g | -m | -o) prev=$arg ;; 586372b676d7Smrg -s) 586472b676d7Smrg stripme=" -s" 586572b676d7Smrg continue 586672b676d7Smrg ;; 586772b676d7Smrg -*) 586872b676d7Smrg ;; 586972b676d7Smrg *) 587072b676d7Smrg # If the previous option needed an argument, then skip it. 587172b676d7Smrg if test -n "$prev"; then 587272b676d7Smrg prev= 587372b676d7Smrg else 587472b676d7Smrg dest=$arg 587572b676d7Smrg continue 587672b676d7Smrg fi 587772b676d7Smrg ;; 587872b676d7Smrg esac 587972b676d7Smrg 588072b676d7Smrg # Aesthetically quote the argument. 588172b676d7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 588272b676d7Smrg case $arg in 588372b676d7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 588472b676d7Smrg arg="\"$arg\"" 588572b676d7Smrg ;; 588672b676d7Smrg esac 588772b676d7Smrg install_prog="$install_prog $arg" 588872b676d7Smrg done 588972b676d7Smrg 589072b676d7Smrg if test -z "$install_prog"; then 589172b676d7Smrg $echo "$modename: you must specify an install program" 1>&2 589272b676d7Smrg $echo "$help" 1>&2 589372b676d7Smrg exit $EXIT_FAILURE 589472b676d7Smrg fi 589572b676d7Smrg 589672b676d7Smrg if test -n "$prev"; then 589772b676d7Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 589872b676d7Smrg $echo "$help" 1>&2 589972b676d7Smrg exit $EXIT_FAILURE 590072b676d7Smrg fi 590172b676d7Smrg 590272b676d7Smrg if test -z "$files"; then 590372b676d7Smrg if test -z "$dest"; then 590472b676d7Smrg $echo "$modename: no file or destination specified" 1>&2 590572b676d7Smrg else 590672b676d7Smrg $echo "$modename: you must specify a destination" 1>&2 590772b676d7Smrg fi 590872b676d7Smrg $echo "$help" 1>&2 590972b676d7Smrg exit $EXIT_FAILURE 591072b676d7Smrg fi 591172b676d7Smrg 591272b676d7Smrg # Strip any trailing slash from the destination. 591372b676d7Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 591472b676d7Smrg 591572b676d7Smrg # Check to see that the destination is a directory. 591672b676d7Smrg test -d "$dest" && isdir=yes 591772b676d7Smrg if test "$isdir" = yes; then 591872b676d7Smrg destdir="$dest" 591972b676d7Smrg destname= 592072b676d7Smrg else 592172b676d7Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 592272b676d7Smrg test "X$destdir" = "X$dest" && destdir=. 592372b676d7Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 592472b676d7Smrg 592572b676d7Smrg # Not a directory, so check to see that there is only one file specified. 592672b676d7Smrg set dummy $files 592772b676d7Smrg if test "$#" -gt 2; then 592872b676d7Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 592972b676d7Smrg $echo "$help" 1>&2 593072b676d7Smrg exit $EXIT_FAILURE 593172b676d7Smrg fi 593272b676d7Smrg fi 593372b676d7Smrg case $destdir in 593472b676d7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 593572b676d7Smrg *) 593672b676d7Smrg for file in $files; do 593772b676d7Smrg case $file in 593872b676d7Smrg *.lo) ;; 593972b676d7Smrg *) 594072b676d7Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 594172b676d7Smrg $echo "$help" 1>&2 594272b676d7Smrg exit $EXIT_FAILURE 594372b676d7Smrg ;; 594472b676d7Smrg esac 594572b676d7Smrg done 594672b676d7Smrg ;; 594772b676d7Smrg esac 594872b676d7Smrg 594972b676d7Smrg # This variable tells wrapper scripts just to set variables rather 595072b676d7Smrg # than running their programs. 595172b676d7Smrg libtool_install_magic="$magic" 595272b676d7Smrg 595372b676d7Smrg staticlibs= 595472b676d7Smrg future_libdirs= 595572b676d7Smrg current_libdirs= 595672b676d7Smrg for file in $files; do 595772b676d7Smrg 595872b676d7Smrg # Do each installation. 595972b676d7Smrg case $file in 596072b676d7Smrg *.$libext) 596172b676d7Smrg # Do the static libraries later. 596272b676d7Smrg staticlibs="$staticlibs $file" 596372b676d7Smrg ;; 596472b676d7Smrg 596572b676d7Smrg *.la) 596672b676d7Smrg # Check to see that this really is a libtool archive. 596772b676d7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 596872b676d7Smrg else 596972b676d7Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 597072b676d7Smrg $echo "$help" 1>&2 597172b676d7Smrg exit $EXIT_FAILURE 597272b676d7Smrg fi 597372b676d7Smrg 597472b676d7Smrg library_names= 597572b676d7Smrg old_library= 597672b676d7Smrg relink_command= 597772b676d7Smrg # If there is no directory component, then add one. 597872b676d7Smrg case $file in 597972b676d7Smrg */* | *\\*) . $file ;; 598072b676d7Smrg *) . ./$file ;; 598172b676d7Smrg esac 598272b676d7Smrg 598372b676d7Smrg # Add the libdir to current_libdirs if it is the destination. 598472b676d7Smrg if test "X$destdir" = "X$libdir"; then 598572b676d7Smrg case "$current_libdirs " in 598672b676d7Smrg *" $libdir "*) ;; 598772b676d7Smrg *) current_libdirs="$current_libdirs $libdir" ;; 598872b676d7Smrg esac 598972b676d7Smrg else 599072b676d7Smrg # Note the libdir as a future libdir. 599172b676d7Smrg case "$future_libdirs " in 599272b676d7Smrg *" $libdir "*) ;; 599372b676d7Smrg *) future_libdirs="$future_libdirs $libdir" ;; 599472b676d7Smrg esac 599572b676d7Smrg fi 599672b676d7Smrg 599772b676d7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 599872b676d7Smrg test "X$dir" = "X$file/" && dir= 599972b676d7Smrg dir="$dir$objdir" 600072b676d7Smrg 600172b676d7Smrg if test -n "$relink_command"; then 600272b676d7Smrg # Determine the prefix the user has applied to our future dir. 600372b676d7Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 600472b676d7Smrg 600572b676d7Smrg # Don't allow the user to place us outside of our expected 600672b676d7Smrg # location b/c this prevents finding dependent libraries that 600772b676d7Smrg # are installed to the same prefix. 600872b676d7Smrg # At present, this check doesn't affect windows .dll's that 600972b676d7Smrg # are installed into $libdir/../bin (currently, that works fine) 601072b676d7Smrg # but it's something to keep an eye on. 601172b676d7Smrg if test "$inst_prefix_dir" = "$destdir"; then 601272b676d7Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 601372b676d7Smrg exit $EXIT_FAILURE 601472b676d7Smrg fi 601572b676d7Smrg 601672b676d7Smrg if test -n "$inst_prefix_dir"; then 601772b676d7Smrg # Stick the inst_prefix_dir data into the link command. 60181fd23544Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 601972b676d7Smrg else 60201fd23544Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 602172b676d7Smrg fi 602272b676d7Smrg 602372b676d7Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 602472b676d7Smrg $show "$relink_command" 602572b676d7Smrg if $run eval "$relink_command"; then : 602672b676d7Smrg else 602772b676d7Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 602872b676d7Smrg exit $EXIT_FAILURE 602972b676d7Smrg fi 603072b676d7Smrg fi 603172b676d7Smrg 603272b676d7Smrg # See the names of the shared library. 603372b676d7Smrg set dummy $library_names 603472b676d7Smrg if test -n "$2"; then 603572b676d7Smrg realname="$2" 603672b676d7Smrg shift 603772b676d7Smrg shift 603872b676d7Smrg 603972b676d7Smrg srcname="$realname" 604072b676d7Smrg test -n "$relink_command" && srcname="$realname"T 604172b676d7Smrg 604272b676d7Smrg # Install the shared library and build the symlinks. 604372b676d7Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 604472b676d7Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 604572b676d7Smrg if test -n "$stripme" && test -n "$striplib"; then 604672b676d7Smrg $show "$striplib $destdir/$realname" 604772b676d7Smrg $run eval "$striplib $destdir/$realname" || exit $? 604872b676d7Smrg fi 604972b676d7Smrg 605072b676d7Smrg if test "$#" -gt 0; then 605172b676d7Smrg # Delete the old symlinks, and create new ones. 605272b676d7Smrg # Try `ln -sf' first, because the `ln' binary might depend on 605372b676d7Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 605472b676d7Smrg # so we also need to try rm && ln -s. 605572b676d7Smrg for linkname 605672b676d7Smrg do 605772b676d7Smrg if test "$linkname" != "$realname"; then 605872b676d7Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 605972b676d7Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 606072b676d7Smrg fi 606172b676d7Smrg done 606272b676d7Smrg fi 606372b676d7Smrg 606472b676d7Smrg # Do each command in the postinstall commands. 606572b676d7Smrg lib="$destdir/$realname" 606672b676d7Smrg cmds=$postinstall_cmds 606772b676d7Smrg save_ifs="$IFS"; IFS='~' 606872b676d7Smrg for cmd in $cmds; do 606972b676d7Smrg IFS="$save_ifs" 607072b676d7Smrg eval cmd=\"$cmd\" 607172b676d7Smrg $show "$cmd" 607272b676d7Smrg $run eval "$cmd" || { 607372b676d7Smrg lt_exit=$? 607472b676d7Smrg 607572b676d7Smrg # Restore the uninstalled library and exit 607672b676d7Smrg if test "$mode" = relink; then 607772b676d7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 607872b676d7Smrg fi 607972b676d7Smrg 608072b676d7Smrg exit $lt_exit 608172b676d7Smrg } 608272b676d7Smrg done 608372b676d7Smrg IFS="$save_ifs" 608472b676d7Smrg fi 608572b676d7Smrg 608672b676d7Smrg # Install the pseudo-library for information purposes. 608772b676d7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 608872b676d7Smrg instname="$dir/$name"i 608972b676d7Smrg $show "$install_prog $instname $destdir/$name" 609072b676d7Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 609172b676d7Smrg 609272b676d7Smrg # Maybe install the static library, too. 609372b676d7Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 609472b676d7Smrg ;; 609572b676d7Smrg 609672b676d7Smrg *.lo) 609772b676d7Smrg # Install (i.e. copy) a libtool object. 609872b676d7Smrg 609972b676d7Smrg # Figure out destination file name, if it wasn't already specified. 610072b676d7Smrg if test -n "$destname"; then 610172b676d7Smrg destfile="$destdir/$destname" 610272b676d7Smrg else 610372b676d7Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 610472b676d7Smrg destfile="$destdir/$destfile" 610572b676d7Smrg fi 610672b676d7Smrg 610772b676d7Smrg # Deduce the name of the destination old-style object file. 610872b676d7Smrg case $destfile in 610972b676d7Smrg *.lo) 611072b676d7Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 611172b676d7Smrg ;; 611272b676d7Smrg *.$objext) 611372b676d7Smrg staticdest="$destfile" 611472b676d7Smrg destfile= 611572b676d7Smrg ;; 611672b676d7Smrg *) 611772b676d7Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 611872b676d7Smrg $echo "$help" 1>&2 611972b676d7Smrg exit $EXIT_FAILURE 612072b676d7Smrg ;; 612172b676d7Smrg esac 612272b676d7Smrg 612372b676d7Smrg # Install the libtool object if requested. 612472b676d7Smrg if test -n "$destfile"; then 612572b676d7Smrg $show "$install_prog $file $destfile" 612672b676d7Smrg $run eval "$install_prog $file $destfile" || exit $? 612772b676d7Smrg fi 612872b676d7Smrg 612972b676d7Smrg # Install the old object if enabled. 613072b676d7Smrg if test "$build_old_libs" = yes; then 613172b676d7Smrg # Deduce the name of the old-style object file. 613272b676d7Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 613372b676d7Smrg 613472b676d7Smrg $show "$install_prog $staticobj $staticdest" 613572b676d7Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 613672b676d7Smrg fi 613772b676d7Smrg exit $EXIT_SUCCESS 613872b676d7Smrg ;; 613972b676d7Smrg 614072b676d7Smrg *) 614172b676d7Smrg # Figure out destination file name, if it wasn't already specified. 614272b676d7Smrg if test -n "$destname"; then 614372b676d7Smrg destfile="$destdir/$destname" 614472b676d7Smrg else 614572b676d7Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 614672b676d7Smrg destfile="$destdir/$destfile" 614772b676d7Smrg fi 614872b676d7Smrg 614972b676d7Smrg # If the file is missing, and there is a .exe on the end, strip it 615072b676d7Smrg # because it is most likely a libtool script we actually want to 615172b676d7Smrg # install 615272b676d7Smrg stripped_ext="" 615372b676d7Smrg case $file in 615472b676d7Smrg *.exe) 615572b676d7Smrg if test ! -f "$file"; then 615672b676d7Smrg file=`$echo $file|${SED} 's,.exe$,,'` 615772b676d7Smrg stripped_ext=".exe" 615872b676d7Smrg fi 615972b676d7Smrg ;; 616072b676d7Smrg esac 616172b676d7Smrg 616272b676d7Smrg # Do a test to see if this is really a libtool program. 616372b676d7Smrg case $host in 616472b676d7Smrg *cygwin*|*mingw*) 616572b676d7Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 616672b676d7Smrg ;; 616772b676d7Smrg *) 616872b676d7Smrg wrapper=$file 616972b676d7Smrg ;; 617072b676d7Smrg esac 617172b676d7Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 617272b676d7Smrg notinst_deplibs= 617372b676d7Smrg relink_command= 617472b676d7Smrg 617572b676d7Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 617672b676d7Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 617772b676d7Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 617872b676d7Smrg # `FILE.' does not work on cygwin managed mounts. 617972b676d7Smrg # 618072b676d7Smrg # If there is no directory component, then add one. 618172b676d7Smrg case $wrapper in 618272b676d7Smrg */* | *\\*) . ${wrapper} ;; 618372b676d7Smrg *) . ./${wrapper} ;; 618472b676d7Smrg esac 618572b676d7Smrg 618672b676d7Smrg # Check the variables that should have been set. 618772b676d7Smrg if test -z "$notinst_deplibs"; then 618872b676d7Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 618972b676d7Smrg exit $EXIT_FAILURE 619072b676d7Smrg fi 619172b676d7Smrg 619272b676d7Smrg finalize=yes 619372b676d7Smrg for lib in $notinst_deplibs; do 619472b676d7Smrg # Check to see that each library is installed. 619572b676d7Smrg libdir= 619672b676d7Smrg if test -f "$lib"; then 619772b676d7Smrg # If there is no directory component, then add one. 619872b676d7Smrg case $lib in 619972b676d7Smrg */* | *\\*) . $lib ;; 620072b676d7Smrg *) . ./$lib ;; 620172b676d7Smrg esac 620272b676d7Smrg fi 620372b676d7Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 620472b676d7Smrg if test -n "$libdir" && test ! -f "$libfile"; then 620572b676d7Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 620672b676d7Smrg finalize=no 620772b676d7Smrg fi 620872b676d7Smrg done 620972b676d7Smrg 621072b676d7Smrg relink_command= 621172b676d7Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 621272b676d7Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 621372b676d7Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 621472b676d7Smrg # `FILE.' does not work on cygwin managed mounts. 621572b676d7Smrg # 621672b676d7Smrg # If there is no directory component, then add one. 621772b676d7Smrg case $wrapper in 621872b676d7Smrg */* | *\\*) . ${wrapper} ;; 621972b676d7Smrg *) . ./${wrapper} ;; 622072b676d7Smrg esac 622172b676d7Smrg 622272b676d7Smrg outputname= 622372b676d7Smrg if test "$fast_install" = no && test -n "$relink_command"; then 622472b676d7Smrg if test "$finalize" = yes && test -z "$run"; then 622572b676d7Smrg tmpdir=`func_mktempdir` 622672b676d7Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 622772b676d7Smrg outputname="$tmpdir/$file" 622872b676d7Smrg # Replace the output file specification. 62291fd23544Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 623072b676d7Smrg 623172b676d7Smrg $show "$relink_command" 623272b676d7Smrg if $run eval "$relink_command"; then : 623372b676d7Smrg else 623472b676d7Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 623572b676d7Smrg ${rm}r "$tmpdir" 623672b676d7Smrg continue 623772b676d7Smrg fi 623872b676d7Smrg file="$outputname" 623972b676d7Smrg else 624072b676d7Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 624172b676d7Smrg fi 624272b676d7Smrg else 624372b676d7Smrg # Install the binary that we compiled earlier. 624472b676d7Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 624572b676d7Smrg fi 624672b676d7Smrg fi 624772b676d7Smrg 624872b676d7Smrg # remove .exe since cygwin /usr/bin/install will append another 624972b676d7Smrg # one anyway 625072b676d7Smrg case $install_prog,$host in 625172b676d7Smrg */usr/bin/install*,*cygwin*) 625272b676d7Smrg case $file:$destfile in 625372b676d7Smrg *.exe:*.exe) 625472b676d7Smrg # this is ok 625572b676d7Smrg ;; 625672b676d7Smrg *.exe:*) 625772b676d7Smrg destfile=$destfile.exe 625872b676d7Smrg ;; 625972b676d7Smrg *:*.exe) 626072b676d7Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 626172b676d7Smrg ;; 626272b676d7Smrg esac 626372b676d7Smrg ;; 626472b676d7Smrg esac 626572b676d7Smrg $show "$install_prog$stripme $file $destfile" 626672b676d7Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 626772b676d7Smrg test -n "$outputname" && ${rm}r "$tmpdir" 626872b676d7Smrg ;; 626972b676d7Smrg esac 627072b676d7Smrg done 627172b676d7Smrg 627272b676d7Smrg for file in $staticlibs; do 627372b676d7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 627472b676d7Smrg 627572b676d7Smrg # Set up the ranlib parameters. 627672b676d7Smrg oldlib="$destdir/$name" 627772b676d7Smrg 627872b676d7Smrg $show "$install_prog $file $oldlib" 627972b676d7Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 628072b676d7Smrg 628172b676d7Smrg if test -n "$stripme" && test -n "$old_striplib"; then 628272b676d7Smrg $show "$old_striplib $oldlib" 628372b676d7Smrg $run eval "$old_striplib $oldlib" || exit $? 628472b676d7Smrg fi 628572b676d7Smrg 628672b676d7Smrg # Do each command in the postinstall commands. 628772b676d7Smrg cmds=$old_postinstall_cmds 628872b676d7Smrg save_ifs="$IFS"; IFS='~' 628972b676d7Smrg for cmd in $cmds; do 629072b676d7Smrg IFS="$save_ifs" 629172b676d7Smrg eval cmd=\"$cmd\" 629272b676d7Smrg $show "$cmd" 629372b676d7Smrg $run eval "$cmd" || exit $? 629472b676d7Smrg done 629572b676d7Smrg IFS="$save_ifs" 629672b676d7Smrg done 629772b676d7Smrg 629872b676d7Smrg if test -n "$future_libdirs"; then 629972b676d7Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 630072b676d7Smrg fi 630172b676d7Smrg 630272b676d7Smrg if test -n "$current_libdirs"; then 630372b676d7Smrg # Maybe just do a dry run. 630472b676d7Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 630572b676d7Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 630672b676d7Smrg else 630772b676d7Smrg exit $EXIT_SUCCESS 630872b676d7Smrg fi 630972b676d7Smrg ;; 631072b676d7Smrg 631172b676d7Smrg # libtool finish mode 631272b676d7Smrg finish) 631372b676d7Smrg modename="$modename: finish" 631472b676d7Smrg libdirs="$nonopt" 631572b676d7Smrg admincmds= 631672b676d7Smrg 631772b676d7Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 631872b676d7Smrg for dir 631972b676d7Smrg do 632072b676d7Smrg libdirs="$libdirs $dir" 632172b676d7Smrg done 632272b676d7Smrg 632372b676d7Smrg for libdir in $libdirs; do 632472b676d7Smrg if test -n "$finish_cmds"; then 632572b676d7Smrg # Do each command in the finish commands. 632672b676d7Smrg cmds=$finish_cmds 632772b676d7Smrg save_ifs="$IFS"; IFS='~' 632872b676d7Smrg for cmd in $cmds; do 632972b676d7Smrg IFS="$save_ifs" 633072b676d7Smrg eval cmd=\"$cmd\" 633172b676d7Smrg $show "$cmd" 633272b676d7Smrg $run eval "$cmd" || admincmds="$admincmds 633372b676d7Smrg $cmd" 633472b676d7Smrg done 633572b676d7Smrg IFS="$save_ifs" 633672b676d7Smrg fi 633772b676d7Smrg if test -n "$finish_eval"; then 633872b676d7Smrg # Do the single finish_eval. 633972b676d7Smrg eval cmds=\"$finish_eval\" 634072b676d7Smrg $run eval "$cmds" || admincmds="$admincmds 634172b676d7Smrg $cmds" 634272b676d7Smrg fi 634372b676d7Smrg done 634472b676d7Smrg fi 634572b676d7Smrg 634672b676d7Smrg # Exit here if they wanted silent mode. 634772b676d7Smrg test "$show" = : && exit $EXIT_SUCCESS 634872b676d7Smrg 634972b676d7Smrg $echo "X----------------------------------------------------------------------" | $Xsed 635072b676d7Smrg $echo "Libraries have been installed in:" 635172b676d7Smrg for libdir in $libdirs; do 635272b676d7Smrg $echo " $libdir" 635372b676d7Smrg done 635472b676d7Smrg $echo 635572b676d7Smrg $echo "If you ever happen to want to link against installed libraries" 635672b676d7Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 635772b676d7Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 635872b676d7Smrg $echo "flag during linking and do at least one of the following:" 635972b676d7Smrg if test -n "$shlibpath_var"; then 636072b676d7Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 636172b676d7Smrg $echo " during execution" 636272b676d7Smrg fi 636372b676d7Smrg if test -n "$runpath_var"; then 636472b676d7Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 636572b676d7Smrg $echo " during linking" 636672b676d7Smrg fi 636772b676d7Smrg if test -n "$hardcode_libdir_flag_spec"; then 636872b676d7Smrg libdir=LIBDIR 636972b676d7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 637072b676d7Smrg 637172b676d7Smrg $echo " - use the \`$flag' linker flag" 637272b676d7Smrg fi 637372b676d7Smrg if test -n "$admincmds"; then 637472b676d7Smrg $echo " - have your system administrator run these commands:$admincmds" 637572b676d7Smrg fi 637672b676d7Smrg if test -f /etc/ld.so.conf; then 637772b676d7Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 637872b676d7Smrg fi 637972b676d7Smrg $echo 638072b676d7Smrg $echo "See any operating system documentation about shared libraries for" 638172b676d7Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 638272b676d7Smrg $echo "X----------------------------------------------------------------------" | $Xsed 638372b676d7Smrg exit $EXIT_SUCCESS 638472b676d7Smrg ;; 638572b676d7Smrg 638672b676d7Smrg # libtool execute mode 638772b676d7Smrg execute) 638872b676d7Smrg modename="$modename: execute" 638972b676d7Smrg 639072b676d7Smrg # The first argument is the command name. 639172b676d7Smrg cmd="$nonopt" 639272b676d7Smrg if test -z "$cmd"; then 639372b676d7Smrg $echo "$modename: you must specify a COMMAND" 1>&2 639472b676d7Smrg $echo "$help" 639572b676d7Smrg exit $EXIT_FAILURE 639672b676d7Smrg fi 639772b676d7Smrg 639872b676d7Smrg # Handle -dlopen flags immediately. 639972b676d7Smrg for file in $execute_dlfiles; do 640072b676d7Smrg if test ! -f "$file"; then 640172b676d7Smrg $echo "$modename: \`$file' is not a file" 1>&2 640272b676d7Smrg $echo "$help" 1>&2 640372b676d7Smrg exit $EXIT_FAILURE 640472b676d7Smrg fi 640572b676d7Smrg 640672b676d7Smrg dir= 640772b676d7Smrg case $file in 640872b676d7Smrg *.la) 640972b676d7Smrg # Check to see that this really is a libtool archive. 641072b676d7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 641172b676d7Smrg else 641272b676d7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 641372b676d7Smrg $echo "$help" 1>&2 641472b676d7Smrg exit $EXIT_FAILURE 641572b676d7Smrg fi 641672b676d7Smrg 641772b676d7Smrg # Read the libtool library. 641872b676d7Smrg dlname= 641972b676d7Smrg library_names= 642072b676d7Smrg 642172b676d7Smrg # If there is no directory component, then add one. 642272b676d7Smrg case $file in 642372b676d7Smrg */* | *\\*) . $file ;; 642472b676d7Smrg *) . ./$file ;; 642572b676d7Smrg esac 642672b676d7Smrg 642772b676d7Smrg # Skip this library if it cannot be dlopened. 642872b676d7Smrg if test -z "$dlname"; then 642972b676d7Smrg # Warn if it was a shared library. 643072b676d7Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 643172b676d7Smrg continue 643272b676d7Smrg fi 643372b676d7Smrg 643472b676d7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 643572b676d7Smrg test "X$dir" = "X$file" && dir=. 643672b676d7Smrg 643772b676d7Smrg if test -f "$dir/$objdir/$dlname"; then 643872b676d7Smrg dir="$dir/$objdir" 643972b676d7Smrg else 64401fd23544Smrg if test ! -f "$dir/$dlname"; then 64411fd23544Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 64421fd23544Smrg exit $EXIT_FAILURE 64431fd23544Smrg fi 644472b676d7Smrg fi 644572b676d7Smrg ;; 644672b676d7Smrg 644772b676d7Smrg *.lo) 644872b676d7Smrg # Just add the directory containing the .lo file. 644972b676d7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 645072b676d7Smrg test "X$dir" = "X$file" && dir=. 645172b676d7Smrg ;; 645272b676d7Smrg 645372b676d7Smrg *) 645472b676d7Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 645572b676d7Smrg continue 645672b676d7Smrg ;; 645772b676d7Smrg esac 645872b676d7Smrg 645972b676d7Smrg # Get the absolute pathname. 646072b676d7Smrg absdir=`cd "$dir" && pwd` 646172b676d7Smrg test -n "$absdir" && dir="$absdir" 646272b676d7Smrg 646372b676d7Smrg # Now add the directory to shlibpath_var. 646472b676d7Smrg if eval "test -z \"\$$shlibpath_var\""; then 646572b676d7Smrg eval "$shlibpath_var=\"\$dir\"" 646672b676d7Smrg else 646772b676d7Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 646872b676d7Smrg fi 646972b676d7Smrg done 647072b676d7Smrg 647172b676d7Smrg # This variable tells wrapper scripts just to set shlibpath_var 647272b676d7Smrg # rather than running their programs. 647372b676d7Smrg libtool_execute_magic="$magic" 647472b676d7Smrg 647572b676d7Smrg # Check if any of the arguments is a wrapper script. 647672b676d7Smrg args= 647772b676d7Smrg for file 647872b676d7Smrg do 647972b676d7Smrg case $file in 648072b676d7Smrg -*) ;; 648172b676d7Smrg *) 648272b676d7Smrg # Do a test to see if this is really a libtool program. 648372b676d7Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 648472b676d7Smrg # If there is no directory component, then add one. 648572b676d7Smrg case $file in 648672b676d7Smrg */* | *\\*) . $file ;; 648772b676d7Smrg *) . ./$file ;; 648872b676d7Smrg esac 648972b676d7Smrg 649072b676d7Smrg # Transform arg to wrapped name. 649172b676d7Smrg file="$progdir/$program" 649272b676d7Smrg fi 649372b676d7Smrg ;; 649472b676d7Smrg esac 649572b676d7Smrg # Quote arguments (to preserve shell metacharacters). 649672b676d7Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 649772b676d7Smrg args="$args \"$file\"" 649872b676d7Smrg done 649972b676d7Smrg 650072b676d7Smrg if test -z "$run"; then 650172b676d7Smrg if test -n "$shlibpath_var"; then 650272b676d7Smrg # Export the shlibpath_var. 650372b676d7Smrg eval "export $shlibpath_var" 650472b676d7Smrg fi 650572b676d7Smrg 650672b676d7Smrg # Restore saved environment variables 65071fd23544Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 65081fd23544Smrg do 65091fd23544Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 65101fd23544Smrg $lt_var=\$save_$lt_var; export $lt_var 65111fd23544Smrg fi" 65121fd23544Smrg done 651372b676d7Smrg 651472b676d7Smrg # Now prepare to actually exec the command. 651572b676d7Smrg exec_cmd="\$cmd$args" 651672b676d7Smrg else 651772b676d7Smrg # Display what would be done. 651872b676d7Smrg if test -n "$shlibpath_var"; then 651972b676d7Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 652072b676d7Smrg $echo "export $shlibpath_var" 652172b676d7Smrg fi 652272b676d7Smrg $echo "$cmd$args" 652372b676d7Smrg exit $EXIT_SUCCESS 652472b676d7Smrg fi 652572b676d7Smrg ;; 652672b676d7Smrg 652772b676d7Smrg # libtool clean and uninstall mode 652872b676d7Smrg clean | uninstall) 652972b676d7Smrg modename="$modename: $mode" 653072b676d7Smrg rm="$nonopt" 653172b676d7Smrg files= 653272b676d7Smrg rmforce= 653372b676d7Smrg exit_status=0 653472b676d7Smrg 653572b676d7Smrg # This variable tells wrapper scripts just to set variables rather 653672b676d7Smrg # than running their programs. 653772b676d7Smrg libtool_install_magic="$magic" 653872b676d7Smrg 653972b676d7Smrg for arg 654072b676d7Smrg do 654172b676d7Smrg case $arg in 654272b676d7Smrg -f) rm="$rm $arg"; rmforce=yes ;; 654372b676d7Smrg -*) rm="$rm $arg" ;; 654472b676d7Smrg *) files="$files $arg" ;; 654572b676d7Smrg esac 654672b676d7Smrg done 654772b676d7Smrg 654872b676d7Smrg if test -z "$rm"; then 654972b676d7Smrg $echo "$modename: you must specify an RM program" 1>&2 655072b676d7Smrg $echo "$help" 1>&2 655172b676d7Smrg exit $EXIT_FAILURE 655272b676d7Smrg fi 655372b676d7Smrg 655472b676d7Smrg rmdirs= 655572b676d7Smrg 655672b676d7Smrg origobjdir="$objdir" 655772b676d7Smrg for file in $files; do 655872b676d7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 655972b676d7Smrg if test "X$dir" = "X$file"; then 656072b676d7Smrg dir=. 656172b676d7Smrg objdir="$origobjdir" 656272b676d7Smrg else 656372b676d7Smrg objdir="$dir/$origobjdir" 656472b676d7Smrg fi 656572b676d7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 656672b676d7Smrg test "$mode" = uninstall && objdir="$dir" 656772b676d7Smrg 656872b676d7Smrg # Remember objdir for removal later, being careful to avoid duplicates 656972b676d7Smrg if test "$mode" = clean; then 657072b676d7Smrg case " $rmdirs " in 657172b676d7Smrg *" $objdir "*) ;; 657272b676d7Smrg *) rmdirs="$rmdirs $objdir" ;; 657372b676d7Smrg esac 657472b676d7Smrg fi 657572b676d7Smrg 657672b676d7Smrg # Don't error if the file doesn't exist and rm -f was used. 657772b676d7Smrg if (test -L "$file") >/dev/null 2>&1 \ 657872b676d7Smrg || (test -h "$file") >/dev/null 2>&1 \ 657972b676d7Smrg || test -f "$file"; then 658072b676d7Smrg : 658172b676d7Smrg elif test -d "$file"; then 658272b676d7Smrg exit_status=1 658372b676d7Smrg continue 658472b676d7Smrg elif test "$rmforce" = yes; then 658572b676d7Smrg continue 658672b676d7Smrg fi 658772b676d7Smrg 658872b676d7Smrg rmfiles="$file" 658972b676d7Smrg 659072b676d7Smrg case $name in 659172b676d7Smrg *.la) 659272b676d7Smrg # Possibly a libtool archive, so verify it. 659372b676d7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 659472b676d7Smrg . $dir/$name 659572b676d7Smrg 659672b676d7Smrg # Delete the libtool libraries and symlinks. 659772b676d7Smrg for n in $library_names; do 659872b676d7Smrg rmfiles="$rmfiles $objdir/$n" 659972b676d7Smrg done 660072b676d7Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 660172b676d7Smrg 660272b676d7Smrg case "$mode" in 660372b676d7Smrg clean) 660472b676d7Smrg case " $library_names " in 660572b676d7Smrg # " " in the beginning catches empty $dlname 660672b676d7Smrg *" $dlname "*) ;; 660772b676d7Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 660872b676d7Smrg esac 660972b676d7Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 661072b676d7Smrg ;; 661172b676d7Smrg uninstall) 661272b676d7Smrg if test -n "$library_names"; then 661372b676d7Smrg # Do each command in the postuninstall commands. 661472b676d7Smrg cmds=$postuninstall_cmds 661572b676d7Smrg save_ifs="$IFS"; IFS='~' 661672b676d7Smrg for cmd in $cmds; do 661772b676d7Smrg IFS="$save_ifs" 661872b676d7Smrg eval cmd=\"$cmd\" 661972b676d7Smrg $show "$cmd" 662072b676d7Smrg $run eval "$cmd" 662172b676d7Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 662272b676d7Smrg exit_status=1 662372b676d7Smrg fi 662472b676d7Smrg done 662572b676d7Smrg IFS="$save_ifs" 662672b676d7Smrg fi 662772b676d7Smrg 662872b676d7Smrg if test -n "$old_library"; then 662972b676d7Smrg # Do each command in the old_postuninstall commands. 663072b676d7Smrg cmds=$old_postuninstall_cmds 663172b676d7Smrg save_ifs="$IFS"; IFS='~' 663272b676d7Smrg for cmd in $cmds; do 663372b676d7Smrg IFS="$save_ifs" 663472b676d7Smrg eval cmd=\"$cmd\" 663572b676d7Smrg $show "$cmd" 663672b676d7Smrg $run eval "$cmd" 663772b676d7Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 663872b676d7Smrg exit_status=1 663972b676d7Smrg fi 664072b676d7Smrg done 664172b676d7Smrg IFS="$save_ifs" 664272b676d7Smrg fi 664372b676d7Smrg # FIXME: should reinstall the best remaining shared library. 664472b676d7Smrg ;; 664572b676d7Smrg esac 664672b676d7Smrg fi 664772b676d7Smrg ;; 664872b676d7Smrg 664972b676d7Smrg *.lo) 665072b676d7Smrg # Possibly a libtool object, so verify it. 665172b676d7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 665272b676d7Smrg 665372b676d7Smrg # Read the .lo file 665472b676d7Smrg . $dir/$name 665572b676d7Smrg 665672b676d7Smrg # Add PIC object to the list of files to remove. 665772b676d7Smrg if test -n "$pic_object" \ 665872b676d7Smrg && test "$pic_object" != none; then 665972b676d7Smrg rmfiles="$rmfiles $dir/$pic_object" 666072b676d7Smrg fi 666172b676d7Smrg 666272b676d7Smrg # Add non-PIC object to the list of files to remove. 666372b676d7Smrg if test -n "$non_pic_object" \ 666472b676d7Smrg && test "$non_pic_object" != none; then 666572b676d7Smrg rmfiles="$rmfiles $dir/$non_pic_object" 666672b676d7Smrg fi 666772b676d7Smrg fi 666872b676d7Smrg ;; 666972b676d7Smrg 667072b676d7Smrg *) 667172b676d7Smrg if test "$mode" = clean ; then 667272b676d7Smrg noexename=$name 667372b676d7Smrg case $file in 667472b676d7Smrg *.exe) 667572b676d7Smrg file=`$echo $file|${SED} 's,.exe$,,'` 667672b676d7Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 667772b676d7Smrg # $file with .exe has already been added to rmfiles, 667872b676d7Smrg # add $file without .exe 667972b676d7Smrg rmfiles="$rmfiles $file" 668072b676d7Smrg ;; 668172b676d7Smrg esac 668272b676d7Smrg # Do a test to see if this is a libtool program. 668372b676d7Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 668472b676d7Smrg relink_command= 668572b676d7Smrg . $dir/$noexename 668672b676d7Smrg 668772b676d7Smrg # note $name still contains .exe if it was in $file originally 668872b676d7Smrg # as does the version of $file that was added into $rmfiles 668972b676d7Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 669072b676d7Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 669172b676d7Smrg rmfiles="$rmfiles $objdir/lt-$name" 669272b676d7Smrg fi 669372b676d7Smrg if test "X$noexename" != "X$name" ; then 669472b676d7Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 669572b676d7Smrg fi 669672b676d7Smrg fi 669772b676d7Smrg fi 669872b676d7Smrg ;; 669972b676d7Smrg esac 670072b676d7Smrg $show "$rm $rmfiles" 670172b676d7Smrg $run $rm $rmfiles || exit_status=1 670272b676d7Smrg done 670372b676d7Smrg objdir="$origobjdir" 670472b676d7Smrg 670572b676d7Smrg # Try to remove the ${objdir}s in the directories where we deleted files 670672b676d7Smrg for dir in $rmdirs; do 670772b676d7Smrg if test -d "$dir"; then 670872b676d7Smrg $show "rmdir $dir" 670972b676d7Smrg $run rmdir $dir >/dev/null 2>&1 671072b676d7Smrg fi 671172b676d7Smrg done 671272b676d7Smrg 671372b676d7Smrg exit $exit_status 671472b676d7Smrg ;; 671572b676d7Smrg 671672b676d7Smrg "") 671772b676d7Smrg $echo "$modename: you must specify a MODE" 1>&2 671872b676d7Smrg $echo "$generic_help" 1>&2 671972b676d7Smrg exit $EXIT_FAILURE 672072b676d7Smrg ;; 672172b676d7Smrg esac 672272b676d7Smrg 672372b676d7Smrg if test -z "$exec_cmd"; then 672472b676d7Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 672572b676d7Smrg $echo "$generic_help" 1>&2 672672b676d7Smrg exit $EXIT_FAILURE 672772b676d7Smrg fi 672872b676d7Smrgfi # test -z "$show_help" 672972b676d7Smrg 673072b676d7Smrgif test -n "$exec_cmd"; then 673172b676d7Smrg eval exec $exec_cmd 673272b676d7Smrg exit $EXIT_FAILURE 673372b676d7Smrgfi 673472b676d7Smrg 673572b676d7Smrg# We need to display help for each of the modes. 673672b676d7Smrgcase $mode in 673772b676d7Smrg"") $echo \ 673872b676d7Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 673972b676d7Smrg 674072b676d7SmrgProvide generalized library-building support services. 674172b676d7Smrg 674272b676d7Smrg --config show all configuration variables 674372b676d7Smrg --debug enable verbose shell tracing 674472b676d7Smrg-n, --dry-run display commands without modifying any files 674572b676d7Smrg --features display basic configuration information and exit 674672b676d7Smrg --finish same as \`--mode=finish' 674772b676d7Smrg --help display this help message and exit 674872b676d7Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 674972b676d7Smrg --quiet same as \`--silent' 675072b676d7Smrg --silent don't print informational messages 675172b676d7Smrg --tag=TAG use configuration variables from tag TAG 675272b676d7Smrg --version print version information 675372b676d7Smrg 675472b676d7SmrgMODE must be one of the following: 675572b676d7Smrg 675672b676d7Smrg clean remove files from the build directory 675772b676d7Smrg compile compile a source file into a libtool object 675872b676d7Smrg execute automatically set library path, then run a program 675972b676d7Smrg finish complete the installation of libtool libraries 676072b676d7Smrg install install libraries or executables 676172b676d7Smrg link create a library or an executable 676272b676d7Smrg uninstall remove libraries from an installed directory 676372b676d7Smrg 676472b676d7SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 676572b676d7Smrga more detailed description of MODE. 676672b676d7Smrg 676772b676d7SmrgReport bugs to <bug-libtool@gnu.org>." 676872b676d7Smrg exit $EXIT_SUCCESS 676972b676d7Smrg ;; 677072b676d7Smrg 677172b676d7Smrgclean) 677272b676d7Smrg $echo \ 677372b676d7Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 677472b676d7Smrg 677572b676d7SmrgRemove files from the build directory. 677672b676d7Smrg 677772b676d7SmrgRM is the name of the program to use to delete files associated with each FILE 677872b676d7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 677972b676d7Smrgto RM. 678072b676d7Smrg 678172b676d7SmrgIf FILE is a libtool library, object or program, all the files associated 678272b676d7Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 678372b676d7Smrg ;; 678472b676d7Smrg 678572b676d7Smrgcompile) 678672b676d7Smrg $echo \ 678772b676d7Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 678872b676d7Smrg 678972b676d7SmrgCompile a source file into a libtool library object. 679072b676d7Smrg 679172b676d7SmrgThis mode accepts the following additional options: 679272b676d7Smrg 679372b676d7Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 679472b676d7Smrg -prefer-pic try to building PIC objects only 679572b676d7Smrg -prefer-non-pic try to building non-PIC objects only 679672b676d7Smrg -static always build a \`.o' file suitable for static linking 679772b676d7Smrg 679872b676d7SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 679972b676d7Smrgfrom the given SOURCEFILE. 680072b676d7Smrg 680172b676d7SmrgThe output file name is determined by removing the directory component from 680272b676d7SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 680372b676d7Smrglibrary object suffix, \`.lo'." 680472b676d7Smrg ;; 680572b676d7Smrg 680672b676d7Smrgexecute) 680772b676d7Smrg $echo \ 680872b676d7Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 680972b676d7Smrg 681072b676d7SmrgAutomatically set library path, then run a program. 681172b676d7Smrg 681272b676d7SmrgThis mode accepts the following additional options: 681372b676d7Smrg 681472b676d7Smrg -dlopen FILE add the directory containing FILE to the library path 681572b676d7Smrg 681672b676d7SmrgThis mode sets the library path environment variable according to \`-dlopen' 681772b676d7Smrgflags. 681872b676d7Smrg 681972b676d7SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 682072b676d7Smrginto their corresponding uninstalled binary, and any of their required library 682172b676d7Smrgdirectories are added to the library path. 682272b676d7Smrg 682372b676d7SmrgThen, COMMAND is executed, with ARGS as arguments." 682472b676d7Smrg ;; 682572b676d7Smrg 682672b676d7Smrgfinish) 682772b676d7Smrg $echo \ 682872b676d7Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 682972b676d7Smrg 683072b676d7SmrgComplete the installation of libtool libraries. 683172b676d7Smrg 683272b676d7SmrgEach LIBDIR is a directory that contains libtool libraries. 683372b676d7Smrg 683472b676d7SmrgThe commands that this mode executes may require superuser privileges. Use 683572b676d7Smrgthe \`--dry-run' option if you just want to see what would be executed." 683672b676d7Smrg ;; 683772b676d7Smrg 683872b676d7Smrginstall) 683972b676d7Smrg $echo \ 684072b676d7Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 684172b676d7Smrg 684272b676d7SmrgInstall executables or libraries. 684372b676d7Smrg 684472b676d7SmrgINSTALL-COMMAND is the installation command. The first component should be 684572b676d7Smrgeither the \`install' or \`cp' program. 684672b676d7Smrg 684772b676d7SmrgThe rest of the components are interpreted as arguments to that command (only 684872b676d7SmrgBSD-compatible install options are recognized)." 684972b676d7Smrg ;; 685072b676d7Smrg 685172b676d7Smrglink) 685272b676d7Smrg $echo \ 685372b676d7Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 685472b676d7Smrg 685572b676d7SmrgLink object files or libraries together to form another library, or to 685672b676d7Smrgcreate an executable program. 685772b676d7Smrg 685872b676d7SmrgLINK-COMMAND is a command using the C compiler that you would use to create 685972b676d7Smrga program from several object files. 686072b676d7Smrg 686172b676d7SmrgThe following components of LINK-COMMAND are treated specially: 686272b676d7Smrg 686372b676d7Smrg -all-static do not do any dynamic linking at all 686472b676d7Smrg -avoid-version do not add a version suffix if possible 686572b676d7Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 686672b676d7Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 686772b676d7Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 686872b676d7Smrg -export-symbols SYMFILE 68691fd23544Smrg try to export only the symbols listed in SYMFILE 687072b676d7Smrg -export-symbols-regex REGEX 68711fd23544Smrg try to export only the symbols matching REGEX 687272b676d7Smrg -LLIBDIR search LIBDIR for required installed libraries 687372b676d7Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 687472b676d7Smrg -module build a library that can dlopened 687572b676d7Smrg -no-fast-install disable the fast-install mode 687672b676d7Smrg -no-install link a not-installable executable 687772b676d7Smrg -no-undefined declare that a library does not refer to external symbols 687872b676d7Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 687972b676d7Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 688072b676d7Smrg -precious-files-regex REGEX 688172b676d7Smrg don't remove output files matching REGEX 688272b676d7Smrg -release RELEASE specify package release information 688372b676d7Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 688472b676d7Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 68851fd23544Smrg -static do not do any dynamic linking of uninstalled libtool libraries 68861fd23544Smrg -static-libtool-libs 68871fd23544Smrg do not do any dynamic linking of libtool libraries 688872b676d7Smrg -version-info CURRENT[:REVISION[:AGE]] 68891fd23544Smrg specify library version info [each variable defaults to 0] 689072b676d7Smrg 689172b676d7SmrgAll other options (arguments beginning with \`-') are ignored. 689272b676d7Smrg 689372b676d7SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 689472b676d7Smrgtreated as uninstalled libtool libraries, other files are standard or library 689572b676d7Smrgobject files. 689672b676d7Smrg 689772b676d7SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 689872b676d7Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 689972b676d7Smrgrequired, except when creating a convenience library. 690072b676d7Smrg 690172b676d7SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 690272b676d7Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 690372b676d7Smrg 690472b676d7SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 690572b676d7Smrgis created, otherwise an executable program is created." 690672b676d7Smrg ;; 690772b676d7Smrg 690872b676d7Smrguninstall) 690972b676d7Smrg $echo \ 691072b676d7Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 691172b676d7Smrg 691272b676d7SmrgRemove libraries from an installation directory. 691372b676d7Smrg 691472b676d7SmrgRM is the name of the program to use to delete files associated with each FILE 691572b676d7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 691672b676d7Smrgto RM. 691772b676d7Smrg 691872b676d7SmrgIf FILE is a libtool library, all the files associated with it are deleted. 691972b676d7SmrgOtherwise, only FILE itself is deleted using RM." 692072b676d7Smrg ;; 692172b676d7Smrg 692272b676d7Smrg*) 692372b676d7Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 692472b676d7Smrg $echo "$help" 1>&2 692572b676d7Smrg exit $EXIT_FAILURE 692672b676d7Smrg ;; 692772b676d7Smrgesac 692872b676d7Smrg 692972b676d7Smrg$echo 693072b676d7Smrg$echo "Try \`$modename --help' for more information about other modes." 693172b676d7Smrg 693272b676d7Smrgexit $? 693372b676d7Smrg 693472b676d7Smrg# The TAGs below are defined such that we never get into a situation 693572b676d7Smrg# in which we disable both kinds of libraries. Given conflicting 693672b676d7Smrg# choices, we go for a static library, that is the most portable, 693772b676d7Smrg# since we can't tell whether shared libraries were disabled because 693872b676d7Smrg# the user asked for that or because the platform doesn't support 693972b676d7Smrg# them. This is particularly important on AIX, because we don't 694072b676d7Smrg# support having both static and shared libraries enabled at the same 694172b676d7Smrg# time on that platform, so we default to a shared-only configuration. 694272b676d7Smrg# If a disable-shared tag is given, we'll fallback to a static-only 694372b676d7Smrg# configuration. But we'll never go from static-only to shared-only. 694472b676d7Smrg 694572b676d7Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 694672b676d7Smrgdisable_libs=shared 694772b676d7Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 694872b676d7Smrg 694972b676d7Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 695072b676d7Smrgdisable_libs=static 695172b676d7Smrg# ### END LIBTOOL TAG CONFIG: disable-static 695272b676d7Smrg 695372b676d7Smrg# Local Variables: 695472b676d7Smrg# mode:shell-script 695572b676d7Smrg# sh-indentation:2 695672b676d7Smrg# End: 6957