ltmain.sh revision d8556812
1d8556812Smrg# ltmain.sh - Provide generalized library-building support services. 2d8556812Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 3d8556812Smrg# 4d8556812Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 5d8556812Smrg# 2007, 2008 Free Software Foundation, Inc. 6d8556812Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7d8556812Smrg# 8d8556812Smrg# This program is free software; you can redistribute it and/or modify 976888252Smrg# it under the terms of the GNU General Public License as published by 1076888252Smrg# the Free Software Foundation; either version 2 of the License, or 1176888252Smrg# (at your option) any later version. 1276888252Smrg# 13d8556812Smrg# This program is distributed in the hope that it will be useful, but 1476888252Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1576888252Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1676888252Smrg# General Public License for more details. 1776888252Smrg# 1876888252Smrg# You should have received a copy of the GNU General Public License 19d8556812Smrg# along with this program; if not, write to the Free Software 20d8556812Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2176888252Smrg# 22d8556812Smrg# As a special exception to the GNU General Public License, if you 23d8556812Smrg# distribute this file as part of a program that contains a 24d8556812Smrg# configuration script generated by Autoconf, you may include it under 25d8556812Smrg# the same distribution terms that you use for the rest of that program. 26d8556812Smrg 27d8556812Smrgbasename="s,^.*/,,g" 28d8556812Smrg 29d8556812Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30d8556812Smrg# is ksh but when the shell is invoked as "sh" and the current value of 31d8556812Smrg# the _XPG environment variable is not equal to 1 (one), the special 32d8556812Smrg# positional parameter $0, within a function call, is the name of the 33d8556812Smrg# function. 34d8556812Smrgprogpath="$0" 35d8556812Smrg 36d8556812Smrg# The name of this program: 37d8556812Smrgprogname=`echo "$progpath" | $SED $basename` 38d8556812Smrgmodename="$progname" 39d8556812Smrg 40d8556812Smrg# Global variables: 41d8556812SmrgEXIT_SUCCESS=0 42d8556812SmrgEXIT_FAILURE=1 4386dafe34Smrg 4486dafe34SmrgPROGRAM=ltmain.sh 4586dafe34SmrgPACKAGE=libtool 46d8556812SmrgVERSION=1.5.26 47d8556812SmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 4886dafe34Smrg 49d8556812Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5086dafe34Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 5186dafe34Smrg emulate sh 5286dafe34Smrg NULLCMD=: 5386dafe34Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 5486dafe34Smrg # is contrary to our usage. Disable this feature. 5586dafe34Smrg alias -g '${1+"$@"}'='"$@"' 5686dafe34Smrg setopt NO_GLOB_SUBST 5786dafe34Smrgelse 5886dafe34Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 5986dafe34Smrgfi 6086dafe34SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 6186dafe34SmrgDUALCASE=1; export DUALCASE # for MKS sh 6286dafe34Smrg 63d8556812Smrg# Check that we have a working $echo. 64d8556812Smrgif test "X$1" = X--no-reexec; then 65d8556812Smrg # Discard the --no-reexec flag, and continue. 66d8556812Smrg shift 67d8556812Smrgelif test "X$1" = X--fallback-echo; then 68d8556812Smrg # Avoid inline document here, it may be left over 69d8556812Smrg : 70d8556812Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 71d8556812Smrg # Yippee, $echo works! 72d8556812Smrg : 73d8556812Smrgelse 74d8556812Smrg # Restart under the correct shell, and then maybe $echo will work. 75d8556812Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 76d8556812Smrgfi 77d8556812Smrg 78d8556812Smrgif test "X$1" = X--fallback-echo; then 79d8556812Smrg # used as fallback echo 80d8556812Smrg shift 81d8556812Smrg cat <<EOF 82d8556812Smrg$* 83d8556812SmrgEOF 84d8556812Smrg exit $EXIT_SUCCESS 85d8556812Smrgfi 86d8556812Smrg 87d8556812Smrgdefault_mode= 88d8556812Smrghelp="Try \`$progname --help' for more information." 89d8556812Smrgmagic="%%%MAGIC variable%%%" 90d8556812Smrgmkdir="mkdir" 91d8556812Smrgmv="mv -f" 92d8556812Smrgrm="rm -f" 93d8556812Smrg 94d8556812Smrg# Sed substitution that helps us do robust quoting. It backslashifies 95d8556812Smrg# metacharacters that are still active within double-quoted strings. 96d8556812SmrgXsed="${SED}"' -e 1s/^X//' 97d8556812Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 98d8556812Smrg# test EBCDIC or ASCII 99d8556812Smrgcase `echo X|tr X '\101'` in 100d8556812Smrg A) # ASCII based system 101d8556812Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 102d8556812Smrg SP2NL='tr \040 \012' 103d8556812Smrg NL2SP='tr \015\012 \040\040' 104d8556812Smrg ;; 105d8556812Smrg *) # EBCDIC based system 106d8556812Smrg SP2NL='tr \100 \n' 107d8556812Smrg NL2SP='tr \r\n \100\100' 108d8556812Smrg ;; 109d8556812Smrgesac 110d8556812Smrg 111d8556812Smrg# NLS nuisances. 11286dafe34Smrg# Only set LANG and LC_ALL to C if already set. 11386dafe34Smrg# These must not be set unconditionally because not all systems understand 11486dafe34Smrg# e.g. LANG=C (notably SCO). 115d8556812Smrg# We save the old values to restore during execute mode. 116d8556812Smrglt_env= 11786dafe34Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11886dafe34Smrgdo 11986dafe34Smrg eval "if test \"\${$lt_var+set}\" = set; then 120d8556812Smrg save_$lt_var=\$$lt_var 121d8556812Smrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 122d8556812Smrg $lt_var=C 12386dafe34Smrg export $lt_var 12486dafe34Smrg fi" 12586dafe34Smrgdone 12686dafe34Smrg 127d8556812Smrgif test -n "$lt_env"; then 128d8556812Smrg lt_env="env $lt_env" 129d8556812Smrgfi 13086dafe34Smrg 13186dafe34Smrg# Make sure IFS has a sensible default 13286dafe34Smrglt_nl=' 13386dafe34Smrg' 13486dafe34SmrgIFS=" $lt_nl" 13586dafe34Smrg 136d8556812Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 137d8556812Smrg $echo "$modename: not configured to build any kind of library" 1>&2 138d8556812Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 139d8556812Smrg exit $EXIT_FAILURE 140d8556812Smrgfi 14186dafe34Smrg 142d8556812Smrg# Global variables. 143d8556812Smrgmode=$default_mode 144d8556812Smrgnonopt= 145d8556812Smrgprev= 146d8556812Smrgprevopt= 147d8556812Smrgrun= 148d8556812Smrgshow="$echo" 149d8556812Smrgshow_help= 150d8556812Smrgexecute_dlfiles= 151d8556812Smrgduplicate_deps=no 152d8556812Smrgpreserve_args= 153d8556812Smrglo2o="s/\\.lo\$/.${objext}/" 154d8556812Smrgo2lo="s/\\.${objext}\$/.lo/" 155d8556812Smrgextracted_archives= 156d8556812Smrgextracted_serial=0 15776888252Smrg 158d8556812Smrg##################################### 159d8556812Smrg# Shell function definitions: 160d8556812Smrg# This seems to be the best place for them 16176888252Smrg 16276888252Smrg# func_mktempdir [string] 16376888252Smrg# Make a temporary directory that won't clash with other running 16476888252Smrg# libtool processes, and avoids race conditions if possible. If 16576888252Smrg# given, STRING is the basename for that directory. 16676888252Smrgfunc_mktempdir () 16776888252Smrg{ 16876888252Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 16976888252Smrg 170d8556812Smrg if test "$run" = ":"; then 17176888252Smrg # Return a directory name, but don't create it in dry-run mode 17276888252Smrg my_tmpdir="${my_template}-$$" 17376888252Smrg else 17476888252Smrg 17576888252Smrg # If mktemp works, use that first and foremost 17676888252Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 17776888252Smrg 17876888252Smrg if test ! -d "$my_tmpdir"; then 179d8556812Smrg # Failing that, at least try and use $RANDOM to avoid a race 180d8556812Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 18176888252Smrg 182d8556812Smrg save_mktempdir_umask=`umask` 183d8556812Smrg umask 0077 184d8556812Smrg $mkdir "$my_tmpdir" 185d8556812Smrg umask $save_mktempdir_umask 18676888252Smrg fi 18776888252Smrg 18876888252Smrg # If we're not in dry-run mode, bomb out on failure 189d8556812Smrg test -d "$my_tmpdir" || { 190d8556812Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 191d8556812Smrg exit $EXIT_FAILURE 192d8556812Smrg } 19376888252Smrg fi 19476888252Smrg 195d8556812Smrg $echo "X$my_tmpdir" | $Xsed 19676888252Smrg} 19776888252Smrg 19876888252Smrg 199d8556812Smrg# func_win32_libid arg 200d8556812Smrg# return the library type of file 'arg' 201d8556812Smrg# 202d8556812Smrg# Need a lot of goo to handle *both* DLLs and import libs 203d8556812Smrg# Has to be a shell function in order to 'eat' the argument 204d8556812Smrg# that is supplied when $file_magic_command is called. 205d8556812Smrgfunc_win32_libid () 20676888252Smrg{ 207d8556812Smrg win32_libid_type="unknown" 208d8556812Smrg win32_fileres=`file -L $1 2>/dev/null` 209d8556812Smrg case $win32_fileres in 210d8556812Smrg *ar\ archive\ import\ library*) # definitely import 211d8556812Smrg win32_libid_type="x86 archive import" 212d8556812Smrg ;; 213d8556812Smrg *ar\ archive*) # could be an import, or static 214d8556812Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 215d8556812Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 216d8556812Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 217d8556812Smrg $SED -n -e '1,100{ 218d8556812Smrg / I /{ 219d8556812Smrg s,.*,import, 220d8556812Smrg p 221d8556812Smrg q 222d8556812Smrg } 223d8556812Smrg }'` 224d8556812Smrg case $win32_nmres in 225d8556812Smrg import*) win32_libid_type="x86 archive import";; 226d8556812Smrg *) win32_libid_type="x86 archive static";; 227d8556812Smrg esac 228d8556812Smrg fi 229d8556812Smrg ;; 230d8556812Smrg *DLL*) 231d8556812Smrg win32_libid_type="x86 DLL" 232d8556812Smrg ;; 233d8556812Smrg *executable*) # but shell scripts are "executable" too... 234d8556812Smrg case $win32_fileres in 235d8556812Smrg *MS\ Windows\ PE\ Intel*) 236d8556812Smrg win32_libid_type="x86 DLL" 237d8556812Smrg ;; 23876888252Smrg esac 239d8556812Smrg ;; 240d8556812Smrg esac 241d8556812Smrg $echo $win32_libid_type 24276888252Smrg} 24376888252Smrg 24476888252Smrg 245d8556812Smrg# func_infer_tag arg 246d8556812Smrg# Infer tagged configuration to use if any are available and 247d8556812Smrg# if one wasn't chosen via the "--tag" command line option. 248d8556812Smrg# Only attempt this if the compiler in the base compile 249d8556812Smrg# command doesn't match the default compiler. 250d8556812Smrg# arg is usually of the form 'gcc ...' 251d8556812Smrgfunc_infer_tag () 25276888252Smrg{ 253d8556812Smrg if test -n "$available_tags" && test -z "$tagname"; then 254d8556812Smrg CC_quoted= 255d8556812Smrg for arg in $CC; do 256d8556812Smrg case $arg in 257d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 258d8556812Smrg arg="\"$arg\"" 259d8556812Smrg ;; 260d8556812Smrg esac 261d8556812Smrg CC_quoted="$CC_quoted $arg" 262d8556812Smrg done 263d8556812Smrg case $@ in 264d8556812Smrg # Blanks in the command may have been stripped by the calling shell, 265d8556812Smrg # but not from the CC environment variable when configure was run. 266d8556812Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 267d8556812Smrg # Blanks at the start of $base_compile will cause this to fail 268d8556812Smrg # if we don't check for them as well. 26976888252Smrg *) 270d8556812Smrg for z in $available_tags; do 271d8556812Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 272d8556812Smrg # Evaluate the configuration. 273d8556812Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 274d8556812Smrg CC_quoted= 275d8556812Smrg for arg in $CC; do 276d8556812Smrg # Double-quote args containing other shell metacharacters. 277d8556812Smrg case $arg in 278d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 279d8556812Smrg arg="\"$arg\"" 280d8556812Smrg ;; 281d8556812Smrg esac 282d8556812Smrg CC_quoted="$CC_quoted $arg" 283d8556812Smrg done 284d8556812Smrg case "$@ " in 285d8556812Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 286d8556812Smrg # The compiler in the base compile command matches 287d8556812Smrg # the one in the tagged configuration. 288d8556812Smrg # Assume this is the tagged configuration we want. 289d8556812Smrg tagname=$z 290d8556812Smrg break 291d8556812Smrg ;; 292d8556812Smrg esac 293d8556812Smrg fi 294d8556812Smrg done 295d8556812Smrg # If $tagname still isn't set, then no tagged configuration 296d8556812Smrg # was found and let the user know that the "--tag" command 297d8556812Smrg # line option must be used. 298d8556812Smrg if test -z "$tagname"; then 299d8556812Smrg $echo "$modename: unable to infer tagged configuration" 300d8556812Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 301d8556812Smrg exit $EXIT_FAILURE 302d8556812Smrg# else 303d8556812Smrg# $echo "$modename: using $tagname tagged configuration" 304d8556812Smrg fi 305d8556812Smrg ;; 306d8556812Smrg esac 307d8556812Smrg fi 30876888252Smrg} 30976888252Smrg 31076888252Smrg 311d8556812Smrg# func_extract_an_archive dir oldlib 312d8556812Smrgfunc_extract_an_archive () 31376888252Smrg{ 314d8556812Smrg f_ex_an_ar_dir="$1"; shift 315d8556812Smrg f_ex_an_ar_oldlib="$1" 31686dafe34Smrg 317d8556812Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 318d8556812Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 319d8556812Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 320d8556812Smrg : 321d8556812Smrg else 322d8556812Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 323d8556812Smrg exit $EXIT_FAILURE 32476888252Smrg fi 32576888252Smrg} 32676888252Smrg 327d8556812Smrg# func_extract_archives gentop oldlib ... 328d8556812Smrgfunc_extract_archives () 32976888252Smrg{ 330d8556812Smrg my_gentop="$1"; shift 331d8556812Smrg my_oldlibs=${1+"$@"} 332d8556812Smrg my_oldobjs="" 333d8556812Smrg my_xlib="" 334d8556812Smrg my_xabs="" 335d8556812Smrg my_xdir="" 336d8556812Smrg my_status="" 337d8556812Smrg 338d8556812Smrg $show "${rm}r $my_gentop" 339d8556812Smrg $run ${rm}r "$my_gentop" 340d8556812Smrg $show "$mkdir $my_gentop" 341d8556812Smrg $run $mkdir "$my_gentop" 342d8556812Smrg my_status=$? 343d8556812Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 344d8556812Smrg exit $my_status 34586dafe34Smrg fi 34676888252Smrg 347d8556812Smrg for my_xlib in $my_oldlibs; do 348d8556812Smrg # Extract the objects. 349d8556812Smrg case $my_xlib in 350d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 351d8556812Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 352d8556812Smrg esac 353d8556812Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 354d8556812Smrg my_xlib_u=$my_xlib 355d8556812Smrg while :; do 356d8556812Smrg case " $extracted_archives " in 357d8556812Smrg *" $my_xlib_u "*) 358d8556812Smrg extracted_serial=`expr $extracted_serial + 1` 359d8556812Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 360d8556812Smrg *) break ;; 361d8556812Smrg esac 362d8556812Smrg done 363d8556812Smrg extracted_archives="$extracted_archives $my_xlib_u" 364d8556812Smrg my_xdir="$my_gentop/$my_xlib_u" 36576888252Smrg 366d8556812Smrg $show "${rm}r $my_xdir" 367d8556812Smrg $run ${rm}r "$my_xdir" 368d8556812Smrg $show "$mkdir $my_xdir" 369d8556812Smrg $run $mkdir "$my_xdir" 370d8556812Smrg exit_status=$? 371d8556812Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 372d8556812Smrg exit $exit_status 373d8556812Smrg fi 374d8556812Smrg case $host in 375d8556812Smrg *-darwin*) 376d8556812Smrg $show "Extracting $my_xabs" 377d8556812Smrg # Do not bother doing anything if just a dry run 378d8556812Smrg if test -z "$run"; then 379d8556812Smrg darwin_orig_dir=`pwd` 380d8556812Smrg cd $my_xdir || exit $? 381d8556812Smrg darwin_archive=$my_xabs 382d8556812Smrg darwin_curdir=`pwd` 383d8556812Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 384d8556812Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 385d8556812Smrg if test -n "$darwin_arches"; then 386d8556812Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 387d8556812Smrg darwin_arch= 388d8556812Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 389d8556812Smrg for darwin_arch in $darwin_arches ; do 390d8556812Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 391d8556812Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 392d8556812Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 393d8556812Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 394d8556812Smrg cd "$darwin_curdir" 395d8556812Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 396d8556812Smrg done # $darwin_arches 397d8556812Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 398d8556812Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 399d8556812Smrg darwin_file= 400d8556812Smrg darwin_files= 401d8556812Smrg for darwin_file in $darwin_filelist; do 402d8556812Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 403d8556812Smrg lipo -create -output "$darwin_file" $darwin_files 404d8556812Smrg done # $darwin_filelist 405d8556812Smrg ${rm}r unfat-$$ 406d8556812Smrg cd "$darwin_orig_dir" 407d8556812Smrg else 408d8556812Smrg cd "$darwin_orig_dir" 409d8556812Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 410d8556812Smrg fi # $darwin_arches 411d8556812Smrg fi # $run 412d8556812Smrg ;; 413d8556812Smrg *) 414d8556812Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 415d8556812Smrg ;; 416d8556812Smrg esac 417d8556812Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 418d8556812Smrg done 419d8556812Smrg func_extract_archives_result="$my_oldobjs" 42086dafe34Smrg} 421d8556812Smrg# End of Shell function definitions 422d8556812Smrg##################################### 42386dafe34Smrg 424d8556812Smrg# Darwin sucks 425d8556812Smrgeval std_shrext=\"$shrext_cmds\" 42686dafe34Smrg 427d8556812Smrgdisable_libs=no 42886dafe34Smrg 429d8556812Smrg# Parse our command line options once, thoroughly. 430d8556812Smrgwhile test "$#" -gt 0 431d8556812Smrgdo 432d8556812Smrg arg="$1" 43386dafe34Smrg shift 43476888252Smrg 435d8556812Smrg case $arg in 436d8556812Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 437d8556812Smrg *) optarg= ;; 438d8556812Smrg esac 43976888252Smrg 440d8556812Smrg # If the previous option needs an argument, assign it. 441d8556812Smrg if test -n "$prev"; then 442d8556812Smrg case $prev in 443d8556812Smrg execute_dlfiles) 444d8556812Smrg execute_dlfiles="$execute_dlfiles $arg" 445d8556812Smrg ;; 446d8556812Smrg tag) 447d8556812Smrg tagname="$arg" 448d8556812Smrg preserve_args="${preserve_args}=$arg" 449d8556812Smrg 450d8556812Smrg # Check whether tagname contains only valid characters 451d8556812Smrg case $tagname in 452d8556812Smrg *[!-_A-Za-z0-9,/]*) 453d8556812Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 454d8556812Smrg exit $EXIT_FAILURE 455d8556812Smrg ;; 456d8556812Smrg esac 45776888252Smrg 458d8556812Smrg case $tagname in 459d8556812Smrg CC) 460d8556812Smrg # Don't test for the "default" C tag, as we know, it's there, but 461d8556812Smrg # not specially marked. 462d8556812Smrg ;; 463d8556812Smrg *) 464d8556812Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 465d8556812Smrg taglist="$taglist $tagname" 466d8556812Smrg # Evaluate the configuration. 467d8556812Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 468d8556812Smrg else 469d8556812Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 470d8556812Smrg fi 471d8556812Smrg ;; 472d8556812Smrg esac 473d8556812Smrg ;; 474d8556812Smrg *) 475d8556812Smrg eval "$prev=\$arg" 476d8556812Smrg ;; 477d8556812Smrg esac 47876888252Smrg 479d8556812Smrg prev= 480d8556812Smrg prevopt= 481d8556812Smrg continue 482d8556812Smrg fi 48386dafe34Smrg 484d8556812Smrg # Have we seen a non-optional argument yet? 485d8556812Smrg case $arg in 486d8556812Smrg --help) 487d8556812Smrg show_help=yes 488d8556812Smrg ;; 48986dafe34Smrg 490d8556812Smrg --version) 491d8556812Smrg echo "\ 492d8556812Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 49386dafe34Smrg 494d8556812SmrgCopyright (C) 2008 Free Software Foundation, Inc. 495d8556812SmrgThis is free software; see the source for copying conditions. There is NO 496d8556812Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 497d8556812Smrg exit $? 498d8556812Smrg ;; 49976888252Smrg 500d8556812Smrg --config) 501d8556812Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 50276888252Smrg # Now print the configurations for the tags. 50376888252Smrg for tagname in $taglist; do 504d8556812Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 50576888252Smrg done 50686dafe34Smrg exit $? 507d8556812Smrg ;; 50876888252Smrg 509d8556812Smrg --debug) 510d8556812Smrg $echo "$progname: enabling shell trace mode" 511d8556812Smrg set -x 512d8556812Smrg preserve_args="$preserve_args $arg" 513d8556812Smrg ;; 514d8556812Smrg 515d8556812Smrg --dry-run | -n) 516d8556812Smrg run=: 517d8556812Smrg ;; 518d8556812Smrg 519d8556812Smrg --features) 520d8556812Smrg $echo "host: $host" 52176888252Smrg if test "$build_libtool_libs" = yes; then 522d8556812Smrg $echo "enable shared libraries" 52376888252Smrg else 524d8556812Smrg $echo "disable shared libraries" 52576888252Smrg fi 52676888252Smrg if test "$build_old_libs" = yes; then 527d8556812Smrg $echo "enable static libraries" 52876888252Smrg else 529d8556812Smrg $echo "disable static libraries" 53076888252Smrg fi 53176888252Smrg exit $? 532d8556812Smrg ;; 53376888252Smrg 534d8556812Smrg --finish) mode="finish" ;; 53576888252Smrg 536d8556812Smrg --mode) prevopt="--mode" prev=mode ;; 537d8556812Smrg --mode=*) mode="$optarg" ;; 53876888252Smrg 539d8556812Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 54076888252Smrg 541d8556812Smrg --quiet | --silent) 542d8556812Smrg show=: 543d8556812Smrg preserve_args="$preserve_args $arg" 54476888252Smrg ;; 545d8556812Smrg 546d8556812Smrg --tag) 547d8556812Smrg prevopt="--tag" 548d8556812Smrg prev=tag 549d8556812Smrg preserve_args="$preserve_args --tag" 55076888252Smrg ;; 551d8556812Smrg --tag=*) 552d8556812Smrg set tag "$optarg" ${1+"$@"} 553d8556812Smrg shift 554d8556812Smrg prev=tag 555d8556812Smrg preserve_args="$preserve_args --tag" 55676888252Smrg ;; 557d8556812Smrg 558d8556812Smrg -dlopen) 559d8556812Smrg prevopt="-dlopen" 560d8556812Smrg prev=execute_dlfiles 56186dafe34Smrg ;; 562d8556812Smrg 563d8556812Smrg -*) 564d8556812Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 565d8556812Smrg $echo "$help" 1>&2 566d8556812Smrg exit $EXIT_FAILURE 56786dafe34Smrg ;; 568d8556812Smrg 569d8556812Smrg *) 570d8556812Smrg nonopt="$arg" 571d8556812Smrg break 57276888252Smrg ;; 57376888252Smrg esac 574d8556812Smrgdone 57576888252Smrg 576d8556812Smrgif test -n "$prevopt"; then 577d8556812Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 578d8556812Smrg $echo "$help" 1>&2 579d8556812Smrg exit $EXIT_FAILURE 580d8556812Smrgfi 58186dafe34Smrg 582d8556812Smrgcase $disable_libs in 583d8556812Smrgno) 584d8556812Smrg ;; 585d8556812Smrgshared) 586d8556812Smrg build_libtool_libs=no 587d8556812Smrg build_old_libs=yes 588d8556812Smrg ;; 589d8556812Smrgstatic) 590d8556812Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 591d8556812Smrg ;; 592d8556812Smrgesac 59386dafe34Smrg 594d8556812Smrg# If this variable is set in any of the actions, the command in it 595d8556812Smrg# will be execed at the end. This prevents here-documents from being 596d8556812Smrg# left over by shells. 597d8556812Smrgexec_cmd= 59886dafe34Smrg 599d8556812Smrgif test -z "$show_help"; then 60086dafe34Smrg 601d8556812Smrg # Infer the operation mode. 602d8556812Smrg if test -z "$mode"; then 603d8556812Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 604d8556812Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 605d8556812Smrg case $nonopt in 606d8556812Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 607d8556812Smrg mode=link 608d8556812Smrg for arg 609d8556812Smrg do 610d8556812Smrg case $arg in 611d8556812Smrg -c) 612d8556812Smrg mode=compile 613d8556812Smrg break 614d8556812Smrg ;; 615d8556812Smrg esac 616d8556812Smrg done 61776888252Smrg ;; 618d8556812Smrg *db | *dbx | *strace | *truss) 619d8556812Smrg mode=execute 62086dafe34Smrg ;; 621d8556812Smrg *install*|cp|mv) 622d8556812Smrg mode=install 623d8556812Smrg ;; 624d8556812Smrg *rm) 625d8556812Smrg mode=uninstall 626d8556812Smrg ;; 627d8556812Smrg *) 628d8556812Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 629d8556812Smrg test -n "$execute_dlfiles" && mode=execute 63086dafe34Smrg 631d8556812Smrg # Just use the default operation mode. 632d8556812Smrg if test -z "$mode"; then 633d8556812Smrg if test -n "$nonopt"; then 634d8556812Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 635d8556812Smrg else 636d8556812Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 637d8556812Smrg fi 63876888252Smrg fi 639d8556812Smrg ;; 640d8556812Smrg esac 64176888252Smrg fi 64276888252Smrg 64376888252Smrg # Only execute mode is allowed to have -dlopen flags. 64476888252Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 645d8556812Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 646d8556812Smrg $echo "$help" 1>&2 64776888252Smrg exit $EXIT_FAILURE 64876888252Smrg fi 64976888252Smrg 65076888252Smrg # Change the help message to a mode-specific one. 65176888252Smrg generic_help="$help" 652d8556812Smrg help="Try \`$modename --help --mode=$mode' for more information." 65376888252Smrg 654d8556812Smrg # These modes are in order of execution frequency so that they run quickly. 655d8556812Smrg case $mode in 656d8556812Smrg # libtool compile mode 657d8556812Smrg compile) 658d8556812Smrg modename="$modename: compile" 659d8556812Smrg # Get the compilation command and the source file. 660d8556812Smrg base_compile= 661d8556812Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 662d8556812Smrg suppress_opt=yes 663d8556812Smrg suppress_output= 664d8556812Smrg arg_mode=normal 665d8556812Smrg libobj= 666d8556812Smrg later= 66776888252Smrg 668d8556812Smrg for arg 669d8556812Smrg do 670d8556812Smrg case $arg_mode in 671d8556812Smrg arg ) 672d8556812Smrg # do not "continue". Instead, add this to base_compile 673d8556812Smrg lastarg="$arg" 674d8556812Smrg arg_mode=normal 675d8556812Smrg ;; 67676888252Smrg 677d8556812Smrg target ) 678d8556812Smrg libobj="$arg" 679d8556812Smrg arg_mode=normal 680d8556812Smrg continue 681d8556812Smrg ;; 68276888252Smrg 683d8556812Smrg normal ) 684d8556812Smrg # Accept any command-line options. 685d8556812Smrg case $arg in 686d8556812Smrg -o) 687d8556812Smrg if test -n "$libobj" ; then 688d8556812Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 689d8556812Smrg exit $EXIT_FAILURE 690d8556812Smrg fi 691d8556812Smrg arg_mode=target 692d8556812Smrg continue 693d8556812Smrg ;; 69476888252Smrg 695d8556812Smrg -static | -prefer-pic | -prefer-non-pic) 696d8556812Smrg later="$later $arg" 697d8556812Smrg continue 698d8556812Smrg ;; 69986dafe34Smrg 70086dafe34Smrg -no-suppress) 70186dafe34Smrg suppress_opt=no 70286dafe34Smrg continue 70386dafe34Smrg ;; 70486dafe34Smrg 70586dafe34Smrg -Xcompiler) 70686dafe34Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 70786dafe34Smrg continue # The current "srcfile" will either be retained or 70886dafe34Smrg ;; # replaced later. I would guess that would be a bug. 70986dafe34Smrg 71086dafe34Smrg -Wc,*) 711d8556812Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 71286dafe34Smrg lastarg= 71386dafe34Smrg save_ifs="$IFS"; IFS=',' 714d8556812Smrg for arg in $args; do 71586dafe34Smrg IFS="$save_ifs" 716d8556812Smrg 717d8556812Smrg # Double-quote args containing other shell metacharacters. 718d8556812Smrg # Many Bourne shells cannot handle close brackets correctly 719d8556812Smrg # in scan sets, so we specify it separately. 720d8556812Smrg case $arg in 721d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722d8556812Smrg arg="\"$arg\"" 723d8556812Smrg ;; 724d8556812Smrg esac 725d8556812Smrg lastarg="$lastarg $arg" 72676888252Smrg done 72776888252Smrg IFS="$save_ifs" 728d8556812Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 72976888252Smrg 73076888252Smrg # Add the arguments to base_compile. 73176888252Smrg base_compile="$base_compile $lastarg" 73276888252Smrg continue 73376888252Smrg ;; 73476888252Smrg 735d8556812Smrg * ) 73676888252Smrg # Accept the current argument as the source file. 73776888252Smrg # The previous "srcfile" becomes the current argument. 73876888252Smrg # 73976888252Smrg lastarg="$srcfile" 74076888252Smrg srcfile="$arg" 74176888252Smrg ;; 74276888252Smrg esac # case $arg 74376888252Smrg ;; 74476888252Smrg esac # case $arg_mode 74576888252Smrg 74676888252Smrg # Aesthetically quote the previous argument. 747d8556812Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 748d8556812Smrg 749d8556812Smrg case $lastarg in 750d8556812Smrg # Double-quote args containing other shell metacharacters. 751d8556812Smrg # Many Bourne shells cannot handle close brackets correctly 752d8556812Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 753d8556812Smrg # in scan sets (worked around with variable expansion), 754d8556812Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 755d8556812Smrg # at all, so we specify them separately. 756d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 757d8556812Smrg lastarg="\"$lastarg\"" 758d8556812Smrg ;; 759d8556812Smrg esac 760d8556812Smrg 761d8556812Smrg base_compile="$base_compile $lastarg" 76276888252Smrg done # for arg 76376888252Smrg 76476888252Smrg case $arg_mode in 76576888252Smrg arg) 766d8556812Smrg $echo "$modename: you must specify an argument for -Xcompile" 767d8556812Smrg exit $EXIT_FAILURE 76876888252Smrg ;; 76976888252Smrg target) 770d8556812Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 771d8556812Smrg exit $EXIT_FAILURE 77276888252Smrg ;; 77376888252Smrg *) 77476888252Smrg # Get the name of the library object. 775d8556812Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 77676888252Smrg ;; 77776888252Smrg esac 77876888252Smrg 77976888252Smrg # Recognize several different file suffixes. 78076888252Smrg # If the user specifies -o file.o, it is replaced with file.lo 781d8556812Smrg xform='[cCFSifmso]' 78276888252Smrg case $libobj in 783d8556812Smrg *.ada) xform=ada ;; 784d8556812Smrg *.adb) xform=adb ;; 785d8556812Smrg *.ads) xform=ads ;; 786d8556812Smrg *.asm) xform=asm ;; 787d8556812Smrg *.c++) xform=c++ ;; 788d8556812Smrg *.cc) xform=cc ;; 789d8556812Smrg *.ii) xform=ii ;; 790d8556812Smrg *.class) xform=class ;; 791d8556812Smrg *.cpp) xform=cpp ;; 792d8556812Smrg *.cxx) xform=cxx ;; 793d8556812Smrg *.[fF][09]?) xform=[fF][09]. ;; 794d8556812Smrg *.for) xform=for ;; 795d8556812Smrg *.java) xform=java ;; 796d8556812Smrg *.obj) xform=obj ;; 797d8556812Smrg *.sx) xform=sx ;; 79876888252Smrg esac 79976888252Smrg 800d8556812Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 801d8556812Smrg 80276888252Smrg case $libobj in 803d8556812Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 80476888252Smrg *) 805d8556812Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 806d8556812Smrg exit $EXIT_FAILURE 80776888252Smrg ;; 80876888252Smrg esac 80976888252Smrg 81076888252Smrg func_infer_tag $base_compile 81176888252Smrg 81276888252Smrg for arg in $later; do 81376888252Smrg case $arg in 81476888252Smrg -static) 81576888252Smrg build_old_libs=yes 81676888252Smrg continue 81776888252Smrg ;; 81876888252Smrg 81976888252Smrg -prefer-pic) 82076888252Smrg pic_mode=yes 82176888252Smrg continue 82276888252Smrg ;; 82376888252Smrg 82476888252Smrg -prefer-non-pic) 82576888252Smrg pic_mode=no 82676888252Smrg continue 82776888252Smrg ;; 82876888252Smrg esac 82976888252Smrg done 83076888252Smrg 831d8556812Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 832d8556812Smrg case $qlibobj in 833d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 834d8556812Smrg qlibobj="\"$qlibobj\"" ;; 835d8556812Smrg esac 836d8556812Smrg test "X$libobj" != "X$qlibobj" \ 837d8556812Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 838d8556812Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 839d8556812Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 840d8556812Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 841d8556812Smrg if test "X$xdir" = "X$obj"; then 842d8556812Smrg xdir= 843d8556812Smrg else 844d8556812Smrg xdir=$xdir/ 845d8556812Smrg fi 84676888252Smrg lobj=${xdir}$objdir/$objname 84776888252Smrg 848d8556812Smrg if test -z "$base_compile"; then 849d8556812Smrg $echo "$modename: you must specify a compilation command" 1>&2 850d8556812Smrg $echo "$help" 1>&2 851d8556812Smrg exit $EXIT_FAILURE 852d8556812Smrg fi 85376888252Smrg 85476888252Smrg # Delete any leftover library objects. 85576888252Smrg if test "$build_old_libs" = yes; then 85676888252Smrg removelist="$obj $lobj $libobj ${libobj}T" 85776888252Smrg else 85876888252Smrg removelist="$lobj $libobj ${libobj}T" 85976888252Smrg fi 86076888252Smrg 861d8556812Smrg $run $rm $removelist 862d8556812Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 863d8556812Smrg 86476888252Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 86576888252Smrg case $host_os in 866d8556812Smrg cygwin* | mingw* | pw32* | os2*) 86776888252Smrg pic_mode=default 86876888252Smrg ;; 86976888252Smrg esac 87076888252Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 87176888252Smrg # non-PIC code in shared libraries is not supported 87276888252Smrg pic_mode=default 87376888252Smrg fi 87476888252Smrg 87576888252Smrg # Calculate the filename of the output object if compiler does 87676888252Smrg # not support -o with -c 87776888252Smrg if test "$compiler_c_o" = no; then 878d8556812Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 87976888252Smrg lockfile="$output_obj.lock" 880d8556812Smrg removelist="$removelist $output_obj $lockfile" 881d8556812Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 88276888252Smrg else 88376888252Smrg output_obj= 88476888252Smrg need_locks=no 88576888252Smrg lockfile= 88676888252Smrg fi 88776888252Smrg 88876888252Smrg # Lock this critical section if it is needed 88976888252Smrg # We use this script file to make the link, it avoids creating a new file 89076888252Smrg if test "$need_locks" = yes; then 891d8556812Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 892d8556812Smrg $show "Waiting for $lockfile to be removed" 89376888252Smrg sleep 2 89476888252Smrg done 89576888252Smrg elif test "$need_locks" = warn; then 89676888252Smrg if test -f "$lockfile"; then 897d8556812Smrg $echo "\ 89876888252Smrg*** ERROR, $lockfile exists and contains: 89976888252Smrg`cat $lockfile 2>/dev/null` 90076888252Smrg 90176888252SmrgThis indicates that another process is trying to use the same 90276888252Smrgtemporary object file, and libtool could not work around it because 90376888252Smrgyour compiler does not support \`-c' and \`-o' together. If you 90476888252Smrgrepeat this compilation, it may succeed, by chance, but you had better 90576888252Smrgavoid parallel builds (make -j) in this platform, or get a better 90676888252Smrgcompiler." 90776888252Smrg 908d8556812Smrg $run $rm $removelist 90976888252Smrg exit $EXIT_FAILURE 91076888252Smrg fi 911d8556812Smrg $echo "$srcfile" > "$lockfile" 91276888252Smrg fi 91376888252Smrg 91476888252Smrg if test -n "$fix_srcfile_path"; then 91576888252Smrg eval srcfile=\"$fix_srcfile_path\" 91676888252Smrg fi 917d8556812Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 918d8556812Smrg case $qsrcfile in 919d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 920d8556812Smrg qsrcfile="\"$qsrcfile\"" ;; 921d8556812Smrg esac 922d8556812Smrg 923d8556812Smrg $run $rm "$libobj" "${libobj}T" 924d8556812Smrg 925d8556812Smrg # Create a libtool object file (analogous to a ".la" file), 926d8556812Smrg # but don't create it if we're doing a dry run. 927d8556812Smrg test -z "$run" && cat > ${libobj}T <<EOF 928d8556812Smrg# $libobj - a libtool object file 929d8556812Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 930d8556812Smrg# 931d8556812Smrg# Please DO NOT delete this file! 932d8556812Smrg# It is necessary for linking the library. 933d8556812Smrg 934d8556812Smrg# Name of the PIC object. 935d8556812SmrgEOF 93676888252Smrg 93776888252Smrg # Only build a PIC object if we are building libtool libraries. 93876888252Smrg if test "$build_libtool_libs" = yes; then 93976888252Smrg # Without this assignment, base_compile gets emptied. 94076888252Smrg fbsd_hideous_sh_bug=$base_compile 94176888252Smrg 94276888252Smrg if test "$pic_mode" != no; then 94376888252Smrg command="$base_compile $qsrcfile $pic_flag" 94476888252Smrg else 94576888252Smrg # Don't build PIC code 94676888252Smrg command="$base_compile $qsrcfile" 94776888252Smrg fi 94876888252Smrg 949d8556812Smrg if test ! -d "${xdir}$objdir"; then 950d8556812Smrg $show "$mkdir ${xdir}$objdir" 951d8556812Smrg $run $mkdir ${xdir}$objdir 952d8556812Smrg exit_status=$? 953d8556812Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 954d8556812Smrg exit $exit_status 955d8556812Smrg fi 956d8556812Smrg fi 95776888252Smrg 95876888252Smrg if test -z "$output_obj"; then 95976888252Smrg # Place PIC objects in $objdir 96076888252Smrg command="$command -o $lobj" 96176888252Smrg fi 96276888252Smrg 963d8556812Smrg $run $rm "$lobj" "$output_obj" 964d8556812Smrg 965d8556812Smrg $show "$command" 966d8556812Smrg if $run eval $lt_env "$command"; then : 967d8556812Smrg else 968d8556812Smrg test -n "$output_obj" && $run $rm $removelist 969d8556812Smrg exit $EXIT_FAILURE 970d8556812Smrg fi 97176888252Smrg 97276888252Smrg if test "$need_locks" = warn && 97376888252Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 974d8556812Smrg $echo "\ 97576888252Smrg*** ERROR, $lockfile contains: 97676888252Smrg`cat $lockfile 2>/dev/null` 97776888252Smrg 97876888252Smrgbut it should contain: 97976888252Smrg$srcfile 98076888252Smrg 98176888252SmrgThis indicates that another process is trying to use the same 98276888252Smrgtemporary object file, and libtool could not work around it because 98376888252Smrgyour compiler does not support \`-c' and \`-o' together. If you 98476888252Smrgrepeat this compilation, it may succeed, by chance, but you had better 98576888252Smrgavoid parallel builds (make -j) in this platform, or get a better 98676888252Smrgcompiler." 98776888252Smrg 988d8556812Smrg $run $rm $removelist 98976888252Smrg exit $EXIT_FAILURE 99076888252Smrg fi 99176888252Smrg 99276888252Smrg # Just move the object if needed, then go on to compile the next one 99376888252Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 994d8556812Smrg $show "$mv $output_obj $lobj" 995d8556812Smrg if $run $mv $output_obj $lobj; then : 996d8556812Smrg else 997d8556812Smrg error=$? 998d8556812Smrg $run $rm $removelist 999d8556812Smrg exit $error 1000d8556812Smrg fi 100176888252Smrg fi 100276888252Smrg 1003d8556812Smrg # Append the name of the PIC object to the libtool object file. 1004d8556812Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1005d8556812Smrgpic_object='$objdir/$objname' 1006d8556812Smrg 1007d8556812SmrgEOF 1008d8556812Smrg 100976888252Smrg # Allow error messages only from the first compilation. 101076888252Smrg if test "$suppress_opt" = yes; then 1011d8556812Smrg suppress_output=' >/dev/null 2>&1' 101276888252Smrg fi 1013d8556812Smrg else 1014d8556812Smrg # No PIC object so indicate it doesn't exist in the libtool 1015d8556812Smrg # object file. 1016d8556812Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1017d8556812Smrgpic_object=none 1018d8556812Smrg 1019d8556812SmrgEOF 102076888252Smrg fi 102176888252Smrg 102276888252Smrg # Only build a position-dependent object if we build old libraries. 102376888252Smrg if test "$build_old_libs" = yes; then 102476888252Smrg if test "$pic_mode" != yes; then 102576888252Smrg # Don't build PIC code 1026d8556812Smrg command="$base_compile $qsrcfile" 102776888252Smrg else 102876888252Smrg command="$base_compile $qsrcfile $pic_flag" 102976888252Smrg fi 103076888252Smrg if test "$compiler_c_o" = yes; then 103176888252Smrg command="$command -o $obj" 103276888252Smrg fi 103376888252Smrg 103476888252Smrg # Suppress compiler output if we already did a PIC compilation. 103576888252Smrg command="$command$suppress_output" 1036d8556812Smrg $run $rm "$obj" "$output_obj" 1037d8556812Smrg $show "$command" 1038d8556812Smrg if $run eval $lt_env "$command"; then : 1039d8556812Smrg else 1040d8556812Smrg $run $rm $removelist 1041d8556812Smrg exit $EXIT_FAILURE 1042d8556812Smrg fi 104376888252Smrg 104476888252Smrg if test "$need_locks" = warn && 104576888252Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1046d8556812Smrg $echo "\ 104776888252Smrg*** ERROR, $lockfile contains: 104876888252Smrg`cat $lockfile 2>/dev/null` 104976888252Smrg 105076888252Smrgbut it should contain: 105176888252Smrg$srcfile 105276888252Smrg 105376888252SmrgThis indicates that another process is trying to use the same 105476888252Smrgtemporary object file, and libtool could not work around it because 105576888252Smrgyour compiler does not support \`-c' and \`-o' together. If you 105676888252Smrgrepeat this compilation, it may succeed, by chance, but you had better 105776888252Smrgavoid parallel builds (make -j) in this platform, or get a better 105876888252Smrgcompiler." 105976888252Smrg 1060d8556812Smrg $run $rm $removelist 106176888252Smrg exit $EXIT_FAILURE 106276888252Smrg fi 106376888252Smrg 106476888252Smrg # Just move the object if needed 106576888252Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1066d8556812Smrg $show "$mv $output_obj $obj" 1067d8556812Smrg if $run $mv $output_obj $obj; then : 1068d8556812Smrg else 1069d8556812Smrg error=$? 1070d8556812Smrg $run $rm $removelist 1071d8556812Smrg exit $error 1072d8556812Smrg fi 107376888252Smrg fi 1074d8556812Smrg 1075d8556812Smrg # Append the name of the non-PIC object the libtool object file. 1076d8556812Smrg # Only append if the libtool object file exists. 1077d8556812Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1078d8556812Smrg# Name of the non-PIC object. 1079d8556812Smrgnon_pic_object='$objname' 1080d8556812Smrg 1081d8556812SmrgEOF 1082d8556812Smrg else 1083d8556812Smrg # Append the name of the non-PIC object the libtool object file. 1084d8556812Smrg # Only append if the libtool object file exists. 1085d8556812Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1086d8556812Smrg# Name of the non-PIC object. 1087d8556812Smrgnon_pic_object=none 1088d8556812Smrg 1089d8556812SmrgEOF 109076888252Smrg fi 109176888252Smrg 1092d8556812Smrg $run $mv "${libobj}T" "${libobj}" 109376888252Smrg 1094d8556812Smrg # Unlock the critical section if it was locked 1095d8556812Smrg if test "$need_locks" != no; then 1096d8556812Smrg $run $rm "$lockfile" 1097d8556812Smrg fi 109876888252Smrg 109976888252Smrg exit $EXIT_SUCCESS 1100d8556812Smrg ;; 110176888252Smrg 1102d8556812Smrg # libtool link mode 1103d8556812Smrg link | relink) 1104d8556812Smrg modename="$modename: link" 1105d8556812Smrg case $host in 1106d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1107d8556812Smrg # It is impossible to link a dll without this setting, and 1108d8556812Smrg # we shouldn't force the makefile maintainer to figure out 1109d8556812Smrg # which system we are compiling for in order to pass an extra 1110d8556812Smrg # flag for every libtool invocation. 1111d8556812Smrg # allow_undefined=no 111276888252Smrg 1113d8556812Smrg # FIXME: Unfortunately, there are problems with the above when trying 1114d8556812Smrg # to make a dll which has undefined symbols, in which case not 1115d8556812Smrg # even a static library is built. For now, we need to specify 1116d8556812Smrg # -no-undefined on the libtool link line when we can be certain 1117d8556812Smrg # that all symbols are satisfied, otherwise we get a static library. 1118d8556812Smrg allow_undefined=yes 1119d8556812Smrg ;; 1120d8556812Smrg *) 1121d8556812Smrg allow_undefined=yes 1122d8556812Smrg ;; 1123d8556812Smrg esac 1124d8556812Smrg libtool_args="$nonopt" 1125d8556812Smrg base_compile="$nonopt $@" 1126d8556812Smrg compile_command="$nonopt" 1127d8556812Smrg finalize_command="$nonopt" 112876888252Smrg 1129d8556812Smrg compile_rpath= 1130d8556812Smrg finalize_rpath= 1131d8556812Smrg compile_shlibpath= 1132d8556812Smrg finalize_shlibpath= 1133d8556812Smrg convenience= 1134d8556812Smrg old_convenience= 1135d8556812Smrg deplibs= 1136d8556812Smrg old_deplibs= 1137d8556812Smrg compiler_flags= 1138d8556812Smrg linker_flags= 1139d8556812Smrg dllsearchpath= 1140d8556812Smrg lib_search_path=`pwd` 1141d8556812Smrg inst_prefix_dir= 114276888252Smrg 1143d8556812Smrg avoid_version=no 1144d8556812Smrg dlfiles= 1145d8556812Smrg dlprefiles= 1146d8556812Smrg dlself=no 1147d8556812Smrg export_dynamic=no 1148d8556812Smrg export_symbols= 1149d8556812Smrg export_symbols_regex= 1150d8556812Smrg generated= 1151d8556812Smrg libobjs= 1152d8556812Smrg ltlibs= 1153d8556812Smrg module=no 1154d8556812Smrg no_install=no 1155d8556812Smrg objs= 1156d8556812Smrg non_pic_objects= 1157d8556812Smrg notinst_path= # paths that contain not-installed libtool libraries 1158d8556812Smrg precious_files_regex= 1159d8556812Smrg prefer_static_libs=no 1160d8556812Smrg preload=no 1161d8556812Smrg prev= 1162d8556812Smrg prevarg= 1163d8556812Smrg release= 1164d8556812Smrg rpath= 1165d8556812Smrg xrpath= 1166d8556812Smrg perm_rpath= 1167d8556812Smrg temp_rpath= 1168d8556812Smrg thread_safe=no 1169d8556812Smrg vinfo= 1170d8556812Smrg vinfo_number=no 1171d8556812Smrg single_module="${wl}-single_module" 117276888252Smrg 1173d8556812Smrg func_infer_tag $base_compile 117476888252Smrg 1175d8556812Smrg # We need to know -static, to get the right output filenames. 1176d8556812Smrg for arg 1177d8556812Smrg do 1178d8556812Smrg case $arg in 1179d8556812Smrg -all-static | -static | -static-libtool-libs) 1180d8556812Smrg case $arg in 1181d8556812Smrg -all-static) 1182d8556812Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1183d8556812Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1184d8556812Smrg fi 1185d8556812Smrg if test -n "$link_static_flag"; then 1186d8556812Smrg dlopen_self=$dlopen_self_static 1187d8556812Smrg fi 1188d8556812Smrg prefer_static_libs=yes 1189d8556812Smrg ;; 1190d8556812Smrg -static) 1191d8556812Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1192d8556812Smrg dlopen_self=$dlopen_self_static 1193d8556812Smrg fi 1194d8556812Smrg prefer_static_libs=built 1195d8556812Smrg ;; 1196d8556812Smrg -static-libtool-libs) 1197d8556812Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1198d8556812Smrg dlopen_self=$dlopen_self_static 1199d8556812Smrg fi 1200d8556812Smrg prefer_static_libs=yes 1201d8556812Smrg ;; 1202d8556812Smrg esac 1203d8556812Smrg build_libtool_libs=no 1204d8556812Smrg build_old_libs=yes 1205d8556812Smrg break 1206d8556812Smrg ;; 1207d8556812Smrg esac 1208d8556812Smrg done 120976888252Smrg 1210d8556812Smrg # See if our shared archives depend on static archives. 1211d8556812Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 121276888252Smrg 1213d8556812Smrg # Go through the arguments, transforming them on the way. 1214d8556812Smrg while test "$#" -gt 0; do 1215d8556812Smrg arg="$1" 1216d8556812Smrg shift 1217d8556812Smrg case $arg in 1218d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1219d8556812Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1220d8556812Smrg ;; 1221d8556812Smrg *) qarg=$arg ;; 1222d8556812Smrg esac 1223d8556812Smrg libtool_args="$libtool_args $qarg" 122476888252Smrg 1225d8556812Smrg # If the previous option needs an argument, assign it. 1226d8556812Smrg if test -n "$prev"; then 1227d8556812Smrg case $prev in 1228d8556812Smrg output) 1229d8556812Smrg compile_command="$compile_command @OUTPUT@" 1230d8556812Smrg finalize_command="$finalize_command @OUTPUT@" 1231d8556812Smrg ;; 1232d8556812Smrg esac 123376888252Smrg 1234d8556812Smrg case $prev in 1235d8556812Smrg dlfiles|dlprefiles) 1236d8556812Smrg if test "$preload" = no; then 1237d8556812Smrg # Add the symbol object into the linking commands. 1238d8556812Smrg compile_command="$compile_command @SYMFILE@" 1239d8556812Smrg finalize_command="$finalize_command @SYMFILE@" 1240d8556812Smrg preload=yes 1241d8556812Smrg fi 1242d8556812Smrg case $arg in 1243d8556812Smrg *.la | *.lo) ;; # We handle these cases below. 1244d8556812Smrg force) 1245d8556812Smrg if test "$dlself" = no; then 1246d8556812Smrg dlself=needless 1247d8556812Smrg export_dynamic=yes 1248d8556812Smrg fi 1249d8556812Smrg prev= 1250d8556812Smrg continue 1251d8556812Smrg ;; 1252d8556812Smrg self) 1253d8556812Smrg if test "$prev" = dlprefiles; then 1254d8556812Smrg dlself=yes 1255d8556812Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1256d8556812Smrg dlself=yes 1257d8556812Smrg else 1258d8556812Smrg dlself=needless 1259d8556812Smrg export_dynamic=yes 1260d8556812Smrg fi 1261d8556812Smrg prev= 1262d8556812Smrg continue 1263d8556812Smrg ;; 1264d8556812Smrg *) 1265d8556812Smrg if test "$prev" = dlfiles; then 1266d8556812Smrg dlfiles="$dlfiles $arg" 1267d8556812Smrg else 1268d8556812Smrg dlprefiles="$dlprefiles $arg" 1269d8556812Smrg fi 1270d8556812Smrg prev= 1271d8556812Smrg continue 1272d8556812Smrg ;; 1273d8556812Smrg esac 1274d8556812Smrg ;; 1275d8556812Smrg expsyms) 1276d8556812Smrg export_symbols="$arg" 1277d8556812Smrg if test ! -f "$arg"; then 1278d8556812Smrg $echo "$modename: symbol file \`$arg' does not exist" 1279d8556812Smrg exit $EXIT_FAILURE 1280d8556812Smrg fi 1281d8556812Smrg prev= 1282d8556812Smrg continue 1283d8556812Smrg ;; 1284d8556812Smrg expsyms_regex) 1285d8556812Smrg export_symbols_regex="$arg" 1286d8556812Smrg prev= 1287d8556812Smrg continue 1288d8556812Smrg ;; 1289d8556812Smrg inst_prefix) 1290d8556812Smrg inst_prefix_dir="$arg" 1291d8556812Smrg prev= 1292d8556812Smrg continue 1293d8556812Smrg ;; 1294d8556812Smrg precious_regex) 1295d8556812Smrg precious_files_regex="$arg" 1296d8556812Smrg prev= 1297d8556812Smrg continue 1298d8556812Smrg ;; 1299d8556812Smrg release) 1300d8556812Smrg release="-$arg" 1301d8556812Smrg prev= 1302d8556812Smrg continue 1303d8556812Smrg ;; 1304d8556812Smrg objectlist) 1305d8556812Smrg if test -f "$arg"; then 1306d8556812Smrg save_arg=$arg 1307d8556812Smrg moreargs= 1308d8556812Smrg for fil in `cat $save_arg` 1309d8556812Smrg do 1310d8556812Smrg# moreargs="$moreargs $fil" 1311d8556812Smrg arg=$fil 1312d8556812Smrg # A libtool-controlled object. 131376888252Smrg 1314d8556812Smrg # Check to see that this really is a libtool object. 1315d8556812Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1316d8556812Smrg pic_object= 1317d8556812Smrg non_pic_object= 131876888252Smrg 1319d8556812Smrg # Read the .lo file 1320d8556812Smrg # If there is no directory component, then add one. 1321d8556812Smrg case $arg in 1322d8556812Smrg */* | *\\*) . $arg ;; 1323d8556812Smrg *) . ./$arg ;; 1324d8556812Smrg esac 132576888252Smrg 1326d8556812Smrg if test -z "$pic_object" || \ 1327d8556812Smrg test -z "$non_pic_object" || 1328d8556812Smrg test "$pic_object" = none && \ 1329d8556812Smrg test "$non_pic_object" = none; then 1330d8556812Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1331d8556812Smrg exit $EXIT_FAILURE 1332d8556812Smrg fi 133376888252Smrg 1334d8556812Smrg # Extract subdirectory from the argument. 1335d8556812Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1336d8556812Smrg if test "X$xdir" = "X$arg"; then 1337d8556812Smrg xdir= 1338d8556812Smrg else 1339d8556812Smrg xdir="$xdir/" 1340d8556812Smrg fi 134176888252Smrg 1342d8556812Smrg if test "$pic_object" != none; then 1343d8556812Smrg # Prepend the subdirectory the object is found in. 1344d8556812Smrg pic_object="$xdir$pic_object" 134576888252Smrg 1346d8556812Smrg if test "$prev" = dlfiles; then 1347d8556812Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1348d8556812Smrg dlfiles="$dlfiles $pic_object" 1349d8556812Smrg prev= 1350d8556812Smrg continue 1351d8556812Smrg else 1352d8556812Smrg # If libtool objects are unsupported, then we need to preload. 1353d8556812Smrg prev=dlprefiles 1354d8556812Smrg fi 1355d8556812Smrg fi 135676888252Smrg 1357d8556812Smrg # CHECK ME: I think I busted this. -Ossama 1358d8556812Smrg if test "$prev" = dlprefiles; then 1359d8556812Smrg # Preload the old-style object. 1360d8556812Smrg dlprefiles="$dlprefiles $pic_object" 1361d8556812Smrg prev= 1362d8556812Smrg fi 136376888252Smrg 1364d8556812Smrg # A PIC object. 1365d8556812Smrg libobjs="$libobjs $pic_object" 1366d8556812Smrg arg="$pic_object" 1367d8556812Smrg fi 136876888252Smrg 1369d8556812Smrg # Non-PIC object. 1370d8556812Smrg if test "$non_pic_object" != none; then 1371d8556812Smrg # Prepend the subdirectory the object is found in. 1372d8556812Smrg non_pic_object="$xdir$non_pic_object" 137376888252Smrg 1374d8556812Smrg # A standard non-PIC object 1375d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1376d8556812Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1377d8556812Smrg arg="$non_pic_object" 1378d8556812Smrg fi 1379d8556812Smrg else 1380d8556812Smrg # If the PIC object exists, use it instead. 1381d8556812Smrg # $xdir was prepended to $pic_object above. 1382d8556812Smrg non_pic_object="$pic_object" 1383d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1384d8556812Smrg fi 1385d8556812Smrg else 1386d8556812Smrg # Only an error if not doing a dry-run. 1387d8556812Smrg if test -z "$run"; then 1388d8556812Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1389d8556812Smrg exit $EXIT_FAILURE 1390d8556812Smrg else 1391d8556812Smrg # Dry-run case. 139276888252Smrg 1393d8556812Smrg # Extract subdirectory from the argument. 1394d8556812Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1395d8556812Smrg if test "X$xdir" = "X$arg"; then 1396d8556812Smrg xdir= 1397d8556812Smrg else 1398d8556812Smrg xdir="$xdir/" 1399d8556812Smrg fi 140076888252Smrg 1401d8556812Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1402d8556812Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1403d8556812Smrg libobjs="$libobjs $pic_object" 1404d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1405d8556812Smrg fi 1406d8556812Smrg fi 1407d8556812Smrg done 1408d8556812Smrg else 1409d8556812Smrg $echo "$modename: link input file \`$save_arg' does not exist" 1410d8556812Smrg exit $EXIT_FAILURE 1411d8556812Smrg fi 1412d8556812Smrg arg=$save_arg 1413d8556812Smrg prev= 1414d8556812Smrg continue 1415d8556812Smrg ;; 1416d8556812Smrg rpath | xrpath) 1417d8556812Smrg # We need an absolute path. 1418d8556812Smrg case $arg in 1419d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1420d8556812Smrg *) 1421d8556812Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1422d8556812Smrg exit $EXIT_FAILURE 1423d8556812Smrg ;; 1424d8556812Smrg esac 1425d8556812Smrg if test "$prev" = rpath; then 1426d8556812Smrg case "$rpath " in 1427d8556812Smrg *" $arg "*) ;; 1428d8556812Smrg *) rpath="$rpath $arg" ;; 1429d8556812Smrg esac 1430d8556812Smrg else 1431d8556812Smrg case "$xrpath " in 1432d8556812Smrg *" $arg "*) ;; 1433d8556812Smrg *) xrpath="$xrpath $arg" ;; 1434d8556812Smrg esac 1435d8556812Smrg fi 1436d8556812Smrg prev= 1437d8556812Smrg continue 1438d8556812Smrg ;; 1439d8556812Smrg xcompiler) 1440d8556812Smrg compiler_flags="$compiler_flags $qarg" 1441d8556812Smrg prev= 1442d8556812Smrg compile_command="$compile_command $qarg" 1443d8556812Smrg finalize_command="$finalize_command $qarg" 1444d8556812Smrg continue 1445d8556812Smrg ;; 1446d8556812Smrg xlinker) 1447d8556812Smrg linker_flags="$linker_flags $qarg" 1448d8556812Smrg compiler_flags="$compiler_flags $wl$qarg" 1449d8556812Smrg prev= 1450d8556812Smrg compile_command="$compile_command $wl$qarg" 1451d8556812Smrg finalize_command="$finalize_command $wl$qarg" 1452d8556812Smrg continue 1453d8556812Smrg ;; 1454d8556812Smrg xcclinker) 1455d8556812Smrg linker_flags="$linker_flags $qarg" 1456d8556812Smrg compiler_flags="$compiler_flags $qarg" 1457d8556812Smrg prev= 1458d8556812Smrg compile_command="$compile_command $qarg" 1459d8556812Smrg finalize_command="$finalize_command $qarg" 1460d8556812Smrg continue 1461d8556812Smrg ;; 1462d8556812Smrg shrext) 1463d8556812Smrg shrext_cmds="$arg" 1464d8556812Smrg prev= 1465d8556812Smrg continue 1466d8556812Smrg ;; 1467d8556812Smrg darwin_framework|darwin_framework_skip) 1468d8556812Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1469d8556812Smrg compile_command="$compile_command $arg" 1470d8556812Smrg finalize_command="$finalize_command $arg" 1471d8556812Smrg prev= 1472d8556812Smrg continue 1473d8556812Smrg ;; 1474d8556812Smrg *) 1475d8556812Smrg eval "$prev=\"\$arg\"" 1476d8556812Smrg prev= 1477d8556812Smrg continue 1478d8556812Smrg ;; 1479d8556812Smrg esac 1480d8556812Smrg fi # test -n "$prev" 148176888252Smrg 1482d8556812Smrg prevarg="$arg" 148376888252Smrg 1484d8556812Smrg case $arg in 1485d8556812Smrg -all-static) 1486d8556812Smrg if test -n "$link_static_flag"; then 1487d8556812Smrg compile_command="$compile_command $link_static_flag" 1488d8556812Smrg finalize_command="$finalize_command $link_static_flag" 1489d8556812Smrg fi 1490d8556812Smrg continue 1491d8556812Smrg ;; 149276888252Smrg 1493d8556812Smrg -allow-undefined) 1494d8556812Smrg # FIXME: remove this flag sometime in the future. 1495d8556812Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1496d8556812Smrg continue 1497d8556812Smrg ;; 149876888252Smrg 1499d8556812Smrg -avoid-version) 1500d8556812Smrg avoid_version=yes 1501d8556812Smrg continue 1502d8556812Smrg ;; 150376888252Smrg 1504d8556812Smrg -dlopen) 1505d8556812Smrg prev=dlfiles 1506d8556812Smrg continue 1507d8556812Smrg ;; 150876888252Smrg 1509d8556812Smrg -dlpreopen) 1510d8556812Smrg prev=dlprefiles 1511d8556812Smrg continue 1512d8556812Smrg ;; 151376888252Smrg 1514d8556812Smrg -export-dynamic) 1515d8556812Smrg export_dynamic=yes 1516d8556812Smrg continue 1517d8556812Smrg ;; 151876888252Smrg 1519d8556812Smrg -export-symbols | -export-symbols-regex) 1520d8556812Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1521d8556812Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 1522d8556812Smrg exit $EXIT_FAILURE 1523d8556812Smrg fi 1524d8556812Smrg if test "X$arg" = "X-export-symbols"; then 1525d8556812Smrg prev=expsyms 1526d8556812Smrg else 1527d8556812Smrg prev=expsyms_regex 1528d8556812Smrg fi 1529d8556812Smrg continue 1530d8556812Smrg ;; 153176888252Smrg 1532d8556812Smrg -framework|-arch|-isysroot) 1533d8556812Smrg case " $CC " in 1534d8556812Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1535d8556812Smrg prev=darwin_framework_skip ;; 1536d8556812Smrg *) compiler_flags="$compiler_flags $arg" 1537d8556812Smrg prev=darwin_framework ;; 1538d8556812Smrg esac 1539d8556812Smrg compile_command="$compile_command $arg" 1540d8556812Smrg finalize_command="$finalize_command $arg" 1541d8556812Smrg continue 1542d8556812Smrg ;; 154376888252Smrg 1544d8556812Smrg -inst-prefix-dir) 1545d8556812Smrg prev=inst_prefix 1546d8556812Smrg continue 1547d8556812Smrg ;; 154876888252Smrg 1549d8556812Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1550d8556812Smrg # so, if we see these flags be careful not to treat them like -L 1551d8556812Smrg -L[A-Z][A-Z]*:*) 1552d8556812Smrg case $with_gcc/$host in 1553d8556812Smrg no/*-*-irix* | /*-*-irix*) 1554d8556812Smrg compile_command="$compile_command $arg" 1555d8556812Smrg finalize_command="$finalize_command $arg" 1556d8556812Smrg ;; 1557d8556812Smrg esac 1558d8556812Smrg continue 1559d8556812Smrg ;; 156076888252Smrg 1561d8556812Smrg -L*) 1562d8556812Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1563d8556812Smrg # We need an absolute path. 1564d8556812Smrg case $dir in 1565d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1566d8556812Smrg *) 1567d8556812Smrg absdir=`cd "$dir" && pwd` 1568d8556812Smrg if test -z "$absdir"; then 1569d8556812Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1570d8556812Smrg absdir="$dir" 1571d8556812Smrg notinst_path="$notinst_path $dir" 1572d8556812Smrg fi 1573d8556812Smrg dir="$absdir" 1574d8556812Smrg ;; 1575d8556812Smrg esac 1576d8556812Smrg case "$deplibs " in 1577d8556812Smrg *" -L$dir "*) ;; 1578d8556812Smrg *) 1579d8556812Smrg deplibs="$deplibs -L$dir" 1580d8556812Smrg lib_search_path="$lib_search_path $dir" 1581d8556812Smrg ;; 1582d8556812Smrg esac 1583d8556812Smrg case $host in 1584d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1585d8556812Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1586d8556812Smrg case :$dllsearchpath: in 1587d8556812Smrg *":$dir:"*) ;; 1588d8556812Smrg *) dllsearchpath="$dllsearchpath:$dir";; 1589d8556812Smrg esac 1590d8556812Smrg case :$dllsearchpath: in 1591d8556812Smrg *":$testbindir:"*) ;; 1592d8556812Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 1593d8556812Smrg esac 1594d8556812Smrg ;; 1595d8556812Smrg esac 1596d8556812Smrg continue 1597d8556812Smrg ;; 159876888252Smrg 1599d8556812Smrg -l*) 1600d8556812Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1601d8556812Smrg case $host in 1602d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1603d8556812Smrg # These systems don't actually have a C or math library (as such) 1604d8556812Smrg continue 1605d8556812Smrg ;; 1606d8556812Smrg *-*-os2*) 1607d8556812Smrg # These systems don't actually have a C library (as such) 1608d8556812Smrg test "X$arg" = "X-lc" && continue 1609d8556812Smrg ;; 1610d8556812Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1611d8556812Smrg # Do not include libc due to us having libc/libc_r. 1612d8556812Smrg test "X$arg" = "X-lc" && continue 1613d8556812Smrg ;; 1614d8556812Smrg *-*-rhapsody* | *-*-darwin1.[012]) 1615d8556812Smrg # Rhapsody C and math libraries are in the System framework 1616d8556812Smrg deplibs="$deplibs -framework System" 1617d8556812Smrg continue 1618d8556812Smrg ;; 1619d8556812Smrg *-*-sco3.2v5* | *-*-sco5v6*) 1620d8556812Smrg # Causes problems with __ctype 1621d8556812Smrg test "X$arg" = "X-lc" && continue 1622d8556812Smrg ;; 1623d8556812Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1624d8556812Smrg # Compiler inserts libc in the correct place for threads to work 1625d8556812Smrg test "X$arg" = "X-lc" && continue 1626d8556812Smrg ;; 1627d8556812Smrg esac 1628d8556812Smrg elif test "X$arg" = "X-lc_r"; then 1629d8556812Smrg case $host in 1630d8556812Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1631d8556812Smrg # Do not include libc_r directly, use -pthread flag. 1632d8556812Smrg continue 1633d8556812Smrg ;; 1634d8556812Smrg esac 163586dafe34Smrg fi 1636d8556812Smrg deplibs="$deplibs $arg" 1637d8556812Smrg continue 1638d8556812Smrg ;; 163976888252Smrg 1640d8556812Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1641d8556812Smrg # classes, name mangling, and exception handling. 1642d8556812Smrg -model) 1643d8556812Smrg compile_command="$compile_command $arg" 1644d8556812Smrg compiler_flags="$compiler_flags $arg" 1645d8556812Smrg finalize_command="$finalize_command $arg" 1646d8556812Smrg prev=xcompiler 1647d8556812Smrg continue 164876888252Smrg ;; 164976888252Smrg 1650d8556812Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 1651d8556812Smrg compiler_flags="$compiler_flags $arg" 1652d8556812Smrg compile_command="$compile_command $arg" 1653d8556812Smrg finalize_command="$finalize_command $arg" 1654d8556812Smrg continue 165576888252Smrg ;; 165676888252Smrg 1657d8556812Smrg -multi_module) 1658d8556812Smrg single_module="${wl}-multi_module" 165976888252Smrg continue 166076888252Smrg ;; 166176888252Smrg 1662d8556812Smrg -module) 1663d8556812Smrg module=yes 1664d8556812Smrg continue 1665d8556812Smrg ;; 166676888252Smrg 1667d8556812Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1668d8556812Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 1669d8556812Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1670d8556812Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 1671d8556812Smrg # -q* pass through compiler args for the IBM compiler 1672d8556812Smrg # -m* pass through architecture-specific compiler args for GCC 1673d8556812Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 1674d8556812Smrg # compiler args for GCC 1675d8556812Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 1676d8556812Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 1677d8556812Smrg # @file GCC response files 1678d8556812Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 1679d8556812Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 168076888252Smrg 1681d8556812Smrg # Unknown arguments in both finalize_command and compile_command need 1682d8556812Smrg # to be aesthetically quoted because they are evaled later. 1683d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1684d8556812Smrg case $arg in 1685d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1686d8556812Smrg arg="\"$arg\"" 1687d8556812Smrg ;; 1688d8556812Smrg esac 1689d8556812Smrg compile_command="$compile_command $arg" 1690d8556812Smrg finalize_command="$finalize_command $arg" 1691d8556812Smrg compiler_flags="$compiler_flags $arg" 1692d8556812Smrg continue 1693d8556812Smrg ;; 169476888252Smrg 1695d8556812Smrg -shrext) 1696d8556812Smrg prev=shrext 1697d8556812Smrg continue 169886dafe34Smrg ;; 169976888252Smrg 1700d8556812Smrg -no-fast-install) 1701d8556812Smrg fast_install=no 1702d8556812Smrg continue 1703d8556812Smrg ;; 170476888252Smrg 1705d8556812Smrg -no-install) 1706d8556812Smrg case $host in 1707d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 1708d8556812Smrg # The PATH hackery in wrapper scripts is required on Windows 1709d8556812Smrg # and Darwin in order for the loader to find any dlls it needs. 1710d8556812Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1711d8556812Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1712d8556812Smrg fast_install=no 1713d8556812Smrg ;; 1714d8556812Smrg *) no_install=yes ;; 1715d8556812Smrg esac 1716d8556812Smrg continue 1717d8556812Smrg ;; 171876888252Smrg 1719d8556812Smrg -no-undefined) 1720d8556812Smrg allow_undefined=no 1721d8556812Smrg continue 1722d8556812Smrg ;; 172376888252Smrg 1724d8556812Smrg -objectlist) 1725d8556812Smrg prev=objectlist 1726d8556812Smrg continue 172776888252Smrg ;; 172876888252Smrg 1729d8556812Smrg -o) prev=output ;; 173076888252Smrg 1731d8556812Smrg -precious-files-regex) 1732d8556812Smrg prev=precious_regex 1733d8556812Smrg continue 1734d8556812Smrg ;; 173576888252Smrg 1736d8556812Smrg -release) 1737d8556812Smrg prev=release 1738d8556812Smrg continue 1739d8556812Smrg ;; 174076888252Smrg 1741d8556812Smrg -rpath) 1742d8556812Smrg prev=rpath 1743d8556812Smrg continue 1744d8556812Smrg ;; 174586dafe34Smrg 1746d8556812Smrg -R) 1747d8556812Smrg prev=xrpath 174886dafe34Smrg continue 1749d8556812Smrg ;; 175076888252Smrg 1751d8556812Smrg -R*) 1752d8556812Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1753d8556812Smrg # We need an absolute path. 1754d8556812Smrg case $dir in 1755d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1756d8556812Smrg *) 1757d8556812Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1758d8556812Smrg exit $EXIT_FAILURE 1759d8556812Smrg ;; 1760d8556812Smrg esac 1761d8556812Smrg case "$xrpath " in 1762d8556812Smrg *" $dir "*) ;; 1763d8556812Smrg *) xrpath="$xrpath $dir" ;; 176486dafe34Smrg esac 1765d8556812Smrg continue 176686dafe34Smrg ;; 1767d8556812Smrg 1768d8556812Smrg -static | -static-libtool-libs) 1769d8556812Smrg # The effects of -static are defined in a previous loop. 1770d8556812Smrg # We used to do the same as -all-static on platforms that 1771d8556812Smrg # didn't have a PIC flag, but the assumption that the effects 1772d8556812Smrg # would be equivalent was wrong. It would break on at least 1773d8556812Smrg # Digital Unix and AIX. 1774d8556812Smrg continue 177586dafe34Smrg ;; 1776d8556812Smrg 1777d8556812Smrg -thread-safe) 1778d8556812Smrg thread_safe=yes 177986dafe34Smrg continue 178086dafe34Smrg ;; 1781d8556812Smrg 1782d8556812Smrg -version-info) 1783d8556812Smrg prev=vinfo 1784d8556812Smrg continue 178586dafe34Smrg ;; 1786d8556812Smrg -version-number) 1787d8556812Smrg prev=vinfo 1788d8556812Smrg vinfo_number=yes 1789d8556812Smrg continue 179086dafe34Smrg ;; 179176888252Smrg 1792d8556812Smrg -Wc,*) 1793d8556812Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1794d8556812Smrg arg= 1795d8556812Smrg save_ifs="$IFS"; IFS=',' 1796d8556812Smrg for flag in $args; do 1797d8556812Smrg IFS="$save_ifs" 1798d8556812Smrg case $flag in 1799d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1800d8556812Smrg flag="\"$flag\"" 1801d8556812Smrg ;; 1802d8556812Smrg esac 1803d8556812Smrg arg="$arg $wl$flag" 1804d8556812Smrg compiler_flags="$compiler_flags $flag" 1805d8556812Smrg done 1806d8556812Smrg IFS="$save_ifs" 1807d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1808d8556812Smrg ;; 180976888252Smrg 1810d8556812Smrg -Wl,*) 1811d8556812Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1812d8556812Smrg arg= 1813d8556812Smrg save_ifs="$IFS"; IFS=',' 1814d8556812Smrg for flag in $args; do 1815d8556812Smrg IFS="$save_ifs" 1816d8556812Smrg case $flag in 1817d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1818d8556812Smrg flag="\"$flag\"" 1819d8556812Smrg ;; 1820d8556812Smrg esac 1821d8556812Smrg arg="$arg $wl$flag" 1822d8556812Smrg compiler_flags="$compiler_flags $wl$flag" 1823d8556812Smrg linker_flags="$linker_flags $flag" 1824d8556812Smrg done 1825d8556812Smrg IFS="$save_ifs" 1826d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1827d8556812Smrg ;; 182876888252Smrg 1829d8556812Smrg -Xcompiler) 1830d8556812Smrg prev=xcompiler 1831d8556812Smrg continue 1832d8556812Smrg ;; 183376888252Smrg 1834d8556812Smrg -Xlinker) 1835d8556812Smrg prev=xlinker 1836d8556812Smrg continue 1837d8556812Smrg ;; 183876888252Smrg 1839d8556812Smrg -XCClinker) 1840d8556812Smrg prev=xcclinker 1841d8556812Smrg continue 1842d8556812Smrg ;; 184386dafe34Smrg 1844d8556812Smrg # Some other compiler flag. 1845d8556812Smrg -* | +*) 1846d8556812Smrg # Unknown arguments in both finalize_command and compile_command need 1847d8556812Smrg # to be aesthetically quoted because they are evaled later. 1848d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1849d8556812Smrg case $arg in 1850d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1851d8556812Smrg arg="\"$arg\"" 185286dafe34Smrg ;; 185386dafe34Smrg esac 1854d8556812Smrg ;; 185576888252Smrg 1856d8556812Smrg *.$objext) 1857d8556812Smrg # A standard object. 1858d8556812Smrg objs="$objs $arg" 185986dafe34Smrg ;; 186086dafe34Smrg 1861d8556812Smrg *.lo) 1862d8556812Smrg # A libtool-controlled object. 186386dafe34Smrg 1864d8556812Smrg # Check to see that this really is a libtool object. 1865d8556812Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1866d8556812Smrg pic_object= 1867d8556812Smrg non_pic_object= 186886dafe34Smrg 1869d8556812Smrg # Read the .lo file 1870d8556812Smrg # If there is no directory component, then add one. 1871d8556812Smrg case $arg in 1872d8556812Smrg */* | *\\*) . $arg ;; 1873d8556812Smrg *) . ./$arg ;; 187486dafe34Smrg esac 187586dafe34Smrg 1876d8556812Smrg if test -z "$pic_object" || \ 1877d8556812Smrg test -z "$non_pic_object" || 1878d8556812Smrg test "$pic_object" = none && \ 1879d8556812Smrg test "$non_pic_object" = none; then 1880d8556812Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1881d8556812Smrg exit $EXIT_FAILURE 1882d8556812Smrg fi 188386dafe34Smrg 1884d8556812Smrg # Extract subdirectory from the argument. 1885d8556812Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1886d8556812Smrg if test "X$xdir" = "X$arg"; then 1887d8556812Smrg xdir= 1888d8556812Smrg else 1889d8556812Smrg xdir="$xdir/" 189086dafe34Smrg fi 189186dafe34Smrg 1892d8556812Smrg if test "$pic_object" != none; then 1893d8556812Smrg # Prepend the subdirectory the object is found in. 1894d8556812Smrg pic_object="$xdir$pic_object" 189586dafe34Smrg 1896d8556812Smrg if test "$prev" = dlfiles; then 1897d8556812Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1898d8556812Smrg dlfiles="$dlfiles $pic_object" 1899d8556812Smrg prev= 1900d8556812Smrg continue 1901d8556812Smrg else 1902d8556812Smrg # If libtool objects are unsupported, then we need to preload. 1903d8556812Smrg prev=dlprefiles 1904d8556812Smrg fi 1905d8556812Smrg fi 190686dafe34Smrg 1907d8556812Smrg # CHECK ME: I think I busted this. -Ossama 1908d8556812Smrg if test "$prev" = dlprefiles; then 1909d8556812Smrg # Preload the old-style object. 1910d8556812Smrg dlprefiles="$dlprefiles $pic_object" 1911d8556812Smrg prev= 1912d8556812Smrg fi 191386dafe34Smrg 1914d8556812Smrg # A PIC object. 1915d8556812Smrg libobjs="$libobjs $pic_object" 1916d8556812Smrg arg="$pic_object" 191776888252Smrg fi 191886dafe34Smrg 1919d8556812Smrg # Non-PIC object. 1920d8556812Smrg if test "$non_pic_object" != none; then 1921d8556812Smrg # Prepend the subdirectory the object is found in. 1922d8556812Smrg non_pic_object="$xdir$non_pic_object" 1923d8556812Smrg 1924d8556812Smrg # A standard non-PIC object 1925d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1926d8556812Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1927d8556812Smrg arg="$non_pic_object" 1928d8556812Smrg fi 1929d8556812Smrg else 1930d8556812Smrg # If the PIC object exists, use it instead. 1931d8556812Smrg # $xdir was prepended to $pic_object above. 1932d8556812Smrg non_pic_object="$pic_object" 1933d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 193476888252Smrg fi 1935d8556812Smrg else 1936d8556812Smrg # Only an error if not doing a dry-run. 1937d8556812Smrg if test -z "$run"; then 1938d8556812Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1939d8556812Smrg exit $EXIT_FAILURE 1940d8556812Smrg else 1941d8556812Smrg # Dry-run case. 194276888252Smrg 1943d8556812Smrg # Extract subdirectory from the argument. 1944d8556812Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1945d8556812Smrg if test "X$xdir" = "X$arg"; then 1946d8556812Smrg xdir= 1947d8556812Smrg else 1948d8556812Smrg xdir="$xdir/" 1949d8556812Smrg fi 195076888252Smrg 1951d8556812Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1952d8556812Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1953d8556812Smrg libobjs="$libobjs $pic_object" 1954d8556812Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1955d8556812Smrg fi 1956d8556812Smrg fi 1957d8556812Smrg ;; 195876888252Smrg 1959d8556812Smrg *.$libext) 1960d8556812Smrg # An archive. 1961d8556812Smrg deplibs="$deplibs $arg" 1962d8556812Smrg old_deplibs="$old_deplibs $arg" 1963d8556812Smrg continue 196486dafe34Smrg ;; 196576888252Smrg 1966d8556812Smrg *.la) 1967d8556812Smrg # A libtool-controlled library. 196876888252Smrg 1969d8556812Smrg if test "$prev" = dlfiles; then 1970d8556812Smrg # This library was specified with -dlopen. 1971d8556812Smrg dlfiles="$dlfiles $arg" 1972d8556812Smrg prev= 1973d8556812Smrg elif test "$prev" = dlprefiles; then 1974d8556812Smrg # The library was specified with -dlpreopen. 1975d8556812Smrg dlprefiles="$dlprefiles $arg" 1976d8556812Smrg prev= 197786dafe34Smrg else 1978d8556812Smrg deplibs="$deplibs $arg" 197986dafe34Smrg fi 1980d8556812Smrg continue 1981d8556812Smrg ;; 198286dafe34Smrg 1983d8556812Smrg # Some other compiler argument. 1984d8556812Smrg *) 1985d8556812Smrg # Unknown arguments in both finalize_command and compile_command need 1986d8556812Smrg # to be aesthetically quoted because they are evaled later. 1987d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1988d8556812Smrg case $arg in 1989d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1990d8556812Smrg arg="\"$arg\"" 199186dafe34Smrg ;; 199276888252Smrg esac 199386dafe34Smrg ;; 1994d8556812Smrg esac # arg 199576888252Smrg 1996d8556812Smrg # Now actually substitute the argument into the commands. 1997d8556812Smrg if test -n "$arg"; then 1998d8556812Smrg compile_command="$compile_command $arg" 1999d8556812Smrg finalize_command="$finalize_command $arg" 2000d8556812Smrg fi 2001d8556812Smrg done # argument parsing loop 200286dafe34Smrg 2003d8556812Smrg if test -n "$prev"; then 2004d8556812Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2005d8556812Smrg $echo "$help" 1>&2 2006d8556812Smrg exit $EXIT_FAILURE 2007d8556812Smrg fi 200876888252Smrg 2009d8556812Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2010d8556812Smrg eval arg=\"$export_dynamic_flag_spec\" 2011d8556812Smrg compile_command="$compile_command $arg" 2012d8556812Smrg finalize_command="$finalize_command $arg" 2013d8556812Smrg fi 201476888252Smrg 2015d8556812Smrg oldlibs= 2016d8556812Smrg # calculate the name of the file, without its directory 2017d8556812Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 2018d8556812Smrg libobjs_save="$libobjs" 201976888252Smrg 2020d8556812Smrg if test -n "$shlibpath_var"; then 2021d8556812Smrg # get the directories listed in $shlibpath_var 2022d8556812Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 2023d8556812Smrg else 2024d8556812Smrg shlib_search_path= 2025d8556812Smrg fi 2026d8556812Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 2027d8556812Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 202886dafe34Smrg 2029d8556812Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 2030d8556812Smrg if test "X$output_objdir" = "X$output"; then 2031d8556812Smrg output_objdir="$objdir" 203286dafe34Smrg else 2033d8556812Smrg output_objdir="$output_objdir/$objdir" 203486dafe34Smrg fi 2035d8556812Smrg # Create the object directory. 2036d8556812Smrg if test ! -d "$output_objdir"; then 2037d8556812Smrg $show "$mkdir $output_objdir" 2038d8556812Smrg $run $mkdir $output_objdir 2039d8556812Smrg exit_status=$? 2040d8556812Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 2041d8556812Smrg exit $exit_status 204286dafe34Smrg fi 204386dafe34Smrg fi 204476888252Smrg 2045d8556812Smrg # Determine the type of output 2046d8556812Smrg case $output in 2047d8556812Smrg "") 2048d8556812Smrg $echo "$modename: you must specify an output file" 1>&2 2049d8556812Smrg $echo "$help" 1>&2 2050d8556812Smrg exit $EXIT_FAILURE 2051d8556812Smrg ;; 2052d8556812Smrg *.$libext) linkmode=oldlib ;; 2053d8556812Smrg *.lo | *.$objext) linkmode=obj ;; 2054d8556812Smrg *.la) linkmode=lib ;; 2055d8556812Smrg *) linkmode=prog ;; # Anything else should be a program. 2056d8556812Smrg esac 205776888252Smrg 2058d8556812Smrg case $host in 2059d8556812Smrg *cygwin* | *mingw* | *pw32*) 2060d8556812Smrg # don't eliminate duplications in $postdeps and $predeps 2061d8556812Smrg duplicate_compiler_generated_deps=yes 2062d8556812Smrg ;; 2063d8556812Smrg *) 2064d8556812Smrg duplicate_compiler_generated_deps=$duplicate_deps 2065d8556812Smrg ;; 2066d8556812Smrg esac 2067d8556812Smrg specialdeplibs= 206876888252Smrg 2069d8556812Smrg libs= 2070d8556812Smrg # Find all interdependent deplibs by searching for libraries 2071d8556812Smrg # that are linked more than once (e.g. -la -lb -la) 2072d8556812Smrg for deplib in $deplibs; do 2073d8556812Smrg if test "X$duplicate_deps" = "Xyes" ; then 2074d8556812Smrg case "$libs " in 2075d8556812Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2076d8556812Smrg esac 2077d8556812Smrg fi 2078d8556812Smrg libs="$libs $deplib" 2079d8556812Smrg done 208086dafe34Smrg 2081d8556812Smrg if test "$linkmode" = lib; then 2082d8556812Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 208386dafe34Smrg 2084d8556812Smrg # Compute libraries that are listed more than once in $predeps 2085d8556812Smrg # $postdeps and mark them as special (i.e., whose duplicates are 2086d8556812Smrg # not to be eliminated). 2087d8556812Smrg pre_post_deps= 2088d8556812Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2089d8556812Smrg for pre_post_dep in $predeps $postdeps; do 2090d8556812Smrg case "$pre_post_deps " in 2091d8556812Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 209286dafe34Smrg esac 2093d8556812Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 2094d8556812Smrg done 2095d8556812Smrg fi 2096d8556812Smrg pre_post_deps= 2097d8556812Smrg fi 209886dafe34Smrg 2099d8556812Smrg deplibs= 2100d8556812Smrg newdependency_libs= 2101d8556812Smrg newlib_search_path= 2102d8556812Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 2103d8556812Smrg notinst_deplibs= # not-installed libtool libraries 2104d8556812Smrg case $linkmode in 2105d8556812Smrg lib) 2106d8556812Smrg passes="conv link" 2107d8556812Smrg for file in $dlfiles $dlprefiles; do 2108d8556812Smrg case $file in 2109d8556812Smrg *.la) ;; 211086dafe34Smrg *) 2111d8556812Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2112d8556812Smrg exit $EXIT_FAILURE 211386dafe34Smrg ;; 211486dafe34Smrg esac 211586dafe34Smrg done 211686dafe34Smrg ;; 2117d8556812Smrg prog) 2118d8556812Smrg compile_deplibs= 2119d8556812Smrg finalize_deplibs= 2120d8556812Smrg alldeplibs=no 2121d8556812Smrg newdlfiles= 2122d8556812Smrg newdlprefiles= 2123d8556812Smrg passes="conv scan dlopen dlpreopen link" 2124d8556812Smrg ;; 2125d8556812Smrg *) passes="conv" 212686dafe34Smrg ;; 212786dafe34Smrg esac 2128d8556812Smrg for pass in $passes; do 2129d8556812Smrg if test "$linkmode,$pass" = "lib,link" || 2130d8556812Smrg test "$linkmode,$pass" = "prog,scan"; then 2131d8556812Smrg libs="$deplibs" 2132d8556812Smrg deplibs= 2133d8556812Smrg fi 2134d8556812Smrg if test "$linkmode" = prog; then 2135d8556812Smrg case $pass in 2136d8556812Smrg dlopen) libs="$dlfiles" ;; 2137d8556812Smrg dlpreopen) libs="$dlprefiles" ;; 2138d8556812Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 2139d8556812Smrg esac 2140d8556812Smrg fi 2141d8556812Smrg if test "$pass" = dlopen; then 2142d8556812Smrg # Collect dlpreopened libraries 2143d8556812Smrg save_deplibs="$deplibs" 2144d8556812Smrg deplibs= 2145d8556812Smrg fi 2146d8556812Smrg for deplib in $libs; do 2147d8556812Smrg lib= 2148d8556812Smrg found=no 2149d8556812Smrg case $deplib in 2150d8556812Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 2151d8556812Smrg if test "$linkmode,$pass" = "prog,link"; then 2152d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2153d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2154d8556812Smrg else 2155d8556812Smrg compiler_flags="$compiler_flags $deplib" 2156d8556812Smrg fi 2157d8556812Smrg continue 2158d8556812Smrg ;; 2159d8556812Smrg -l*) 2160d8556812Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 2161d8556812Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2162d8556812Smrg continue 2163d8556812Smrg fi 2164d8556812Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2165d8556812Smrg if test "$linkmode" = lib; then 2166d8556812Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 2167d8556812Smrg else 2168d8556812Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 2169d8556812Smrg fi 2170d8556812Smrg for searchdir in $searchdirs; do 2171d8556812Smrg for search_ext in .la $std_shrext .so .a; do 2172d8556812Smrg # Search the libtool library 2173d8556812Smrg lib="$searchdir/lib${name}${search_ext}" 2174d8556812Smrg if test -f "$lib"; then 2175d8556812Smrg if test "$search_ext" = ".la"; then 2176d8556812Smrg found=yes 2177d8556812Smrg else 2178d8556812Smrg found=no 2179d8556812Smrg fi 2180d8556812Smrg break 2 2181d8556812Smrg fi 2182d8556812Smrg done 2183d8556812Smrg done 2184d8556812Smrg if test "$found" != yes; then 2185d8556812Smrg # deplib doesn't seem to be a libtool library 2186d8556812Smrg if test "$linkmode,$pass" = "prog,link"; then 2187d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2188d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2189d8556812Smrg else 2190d8556812Smrg deplibs="$deplib $deplibs" 2191d8556812Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2192d8556812Smrg fi 2193d8556812Smrg continue 2194d8556812Smrg else # deplib is a libtool library 2195d8556812Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2196d8556812Smrg # We need to do some special things here, and not later. 2197d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2198d8556812Smrg case " $predeps $postdeps " in 2199d8556812Smrg *" $deplib "*) 2200d8556812Smrg if (${SED} -e '2q' $lib | 2201d8556812Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2202d8556812Smrg library_names= 2203d8556812Smrg old_library= 2204d8556812Smrg case $lib in 2205d8556812Smrg */* | *\\*) . $lib ;; 2206d8556812Smrg *) . ./$lib ;; 2207d8556812Smrg esac 2208d8556812Smrg for l in $old_library $library_names; do 2209d8556812Smrg ll="$l" 2210d8556812Smrg done 2211d8556812Smrg if test "X$ll" = "X$old_library" ; then # only static version available 2212d8556812Smrg found=no 2213d8556812Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2214d8556812Smrg test "X$ladir" = "X$lib" && ladir="." 2215d8556812Smrg lib=$ladir/$old_library 2216d8556812Smrg if test "$linkmode,$pass" = "prog,link"; then 2217d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2218d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2219d8556812Smrg else 2220d8556812Smrg deplibs="$deplib $deplibs" 2221d8556812Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2222d8556812Smrg fi 2223d8556812Smrg continue 2224d8556812Smrg fi 2225d8556812Smrg fi 2226d8556812Smrg ;; 2227d8556812Smrg *) ;; 2228d8556812Smrg esac 2229d8556812Smrg fi 2230d8556812Smrg fi 2231d8556812Smrg ;; # -l 2232d8556812Smrg -L*) 2233d8556812Smrg case $linkmode in 2234d8556812Smrg lib) 2235d8556812Smrg deplibs="$deplib $deplibs" 2236d8556812Smrg test "$pass" = conv && continue 2237d8556812Smrg newdependency_libs="$deplib $newdependency_libs" 2238d8556812Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2239d8556812Smrg ;; 2240d8556812Smrg prog) 2241d8556812Smrg if test "$pass" = conv; then 2242d8556812Smrg deplibs="$deplib $deplibs" 2243d8556812Smrg continue 2244d8556812Smrg fi 2245d8556812Smrg if test "$pass" = scan; then 2246d8556812Smrg deplibs="$deplib $deplibs" 2247d8556812Smrg else 2248d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2249d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2250d8556812Smrg fi 2251d8556812Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2252d8556812Smrg ;; 2253d8556812Smrg *) 2254d8556812Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2255d8556812Smrg ;; 2256d8556812Smrg esac # linkmode 2257d8556812Smrg continue 2258d8556812Smrg ;; # -L 2259d8556812Smrg -R*) 2260d8556812Smrg if test "$pass" = link; then 2261d8556812Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2262d8556812Smrg # Make sure the xrpath contains only unique directories. 2263d8556812Smrg case "$xrpath " in 2264d8556812Smrg *" $dir "*) ;; 2265d8556812Smrg *) xrpath="$xrpath $dir" ;; 2266d8556812Smrg esac 2267d8556812Smrg fi 2268d8556812Smrg deplibs="$deplib $deplibs" 2269d8556812Smrg continue 2270d8556812Smrg ;; 2271d8556812Smrg *.la) lib="$deplib" ;; 2272d8556812Smrg *.$libext) 2273d8556812Smrg if test "$pass" = conv; then 2274d8556812Smrg deplibs="$deplib $deplibs" 2275d8556812Smrg continue 2276d8556812Smrg fi 2277d8556812Smrg case $linkmode in 2278d8556812Smrg lib) 2279d8556812Smrg valid_a_lib=no 2280d8556812Smrg case $deplibs_check_method in 2281d8556812Smrg match_pattern*) 2282d8556812Smrg set dummy $deplibs_check_method 2283d8556812Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2284d8556812Smrg if eval $echo \"$deplib\" 2>/dev/null \ 2285d8556812Smrg | $SED 10q \ 2286d8556812Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 2287d8556812Smrg valid_a_lib=yes 2288d8556812Smrg fi 2289d8556812Smrg ;; 2290d8556812Smrg pass_all) 2291d8556812Smrg valid_a_lib=yes 2292d8556812Smrg ;; 2293d8556812Smrg esac 2294d8556812Smrg if test "$valid_a_lib" != yes; then 2295d8556812Smrg $echo 2296d8556812Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 2297d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 2298d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 2299d8556812Smrg $echo "*** shared version of the library, which you do not appear to have" 2300d8556812Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 2301d8556812Smrg $echo "*** that it is just a static archive that I should not used here." 2302d8556812Smrg else 2303d8556812Smrg $echo 2304d8556812Smrg $echo "*** Warning: Linking the shared library $output against the" 2305d8556812Smrg $echo "*** static library $deplib is not portable!" 2306d8556812Smrg deplibs="$deplib $deplibs" 2307d8556812Smrg fi 2308d8556812Smrg continue 2309d8556812Smrg ;; 2310d8556812Smrg prog) 2311d8556812Smrg if test "$pass" != link; then 2312d8556812Smrg deplibs="$deplib $deplibs" 2313d8556812Smrg else 2314d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2315d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2316d8556812Smrg fi 2317d8556812Smrg continue 2318d8556812Smrg ;; 2319d8556812Smrg esac # linkmode 2320d8556812Smrg ;; # *.$libext 2321d8556812Smrg *.lo | *.$objext) 2322d8556812Smrg if test "$pass" = conv; then 2323d8556812Smrg deplibs="$deplib $deplibs" 2324d8556812Smrg elif test "$linkmode" = prog; then 2325d8556812Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2326d8556812Smrg # If there is no dlopen support or we're linking statically, 2327d8556812Smrg # we need to preload. 2328d8556812Smrg newdlprefiles="$newdlprefiles $deplib" 2329d8556812Smrg compile_deplibs="$deplib $compile_deplibs" 2330d8556812Smrg finalize_deplibs="$deplib $finalize_deplibs" 2331d8556812Smrg else 2332d8556812Smrg newdlfiles="$newdlfiles $deplib" 2333d8556812Smrg fi 2334d8556812Smrg fi 2335d8556812Smrg continue 2336d8556812Smrg ;; 2337d8556812Smrg %DEPLIBS%) 2338d8556812Smrg alldeplibs=yes 2339d8556812Smrg continue 2340d8556812Smrg ;; 2341d8556812Smrg esac # case $deplib 2342d8556812Smrg if test "$found" = yes || test -f "$lib"; then : 2343d8556812Smrg else 2344d8556812Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2345d8556812Smrg exit $EXIT_FAILURE 2346d8556812Smrg fi 234776888252Smrg 2348d8556812Smrg # Check to see that this really is a libtool archive. 2349d8556812Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2350d8556812Smrg else 2351d8556812Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2352d8556812Smrg exit $EXIT_FAILURE 2353d8556812Smrg fi 235476888252Smrg 2355d8556812Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2356d8556812Smrg test "X$ladir" = "X$lib" && ladir="." 235776888252Smrg 2358d8556812Smrg dlname= 2359d8556812Smrg dlopen= 2360d8556812Smrg dlpreopen= 2361d8556812Smrg libdir= 2362d8556812Smrg library_names= 2363d8556812Smrg old_library= 2364d8556812Smrg # If the library was installed with an old release of libtool, 2365d8556812Smrg # it will not redefine variables installed, or shouldnotlink 2366d8556812Smrg installed=yes 2367d8556812Smrg shouldnotlink=no 2368d8556812Smrg avoidtemprpath= 236976888252Smrg 237076888252Smrg 2371d8556812Smrg # Read the .la file 2372d8556812Smrg case $lib in 2373d8556812Smrg */* | *\\*) . $lib ;; 2374d8556812Smrg *) . ./$lib ;; 237586dafe34Smrg esac 237676888252Smrg 2377d8556812Smrg if test "$linkmode,$pass" = "lib,link" || 2378d8556812Smrg test "$linkmode,$pass" = "prog,scan" || 2379d8556812Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2380d8556812Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2381d8556812Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2382d8556812Smrg fi 238376888252Smrg 2384d8556812Smrg if test "$pass" = conv; then 2385d8556812Smrg # Only check for convenience libraries 2386d8556812Smrg deplibs="$lib $deplibs" 2387d8556812Smrg if test -z "$libdir"; then 2388d8556812Smrg if test -z "$old_library"; then 2389d8556812Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2390d8556812Smrg exit $EXIT_FAILURE 2391d8556812Smrg fi 2392d8556812Smrg # It is a libtool convenience library, so add in its objects. 2393d8556812Smrg convenience="$convenience $ladir/$objdir/$old_library" 2394d8556812Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 2395d8556812Smrg tmp_libs= 2396d8556812Smrg for deplib in $dependency_libs; do 2397d8556812Smrg deplibs="$deplib $deplibs" 2398d8556812Smrg if test "X$duplicate_deps" = "Xyes" ; then 2399d8556812Smrg case "$tmp_libs " in 2400d8556812Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2401d8556812Smrg esac 2402d8556812Smrg fi 2403d8556812Smrg tmp_libs="$tmp_libs $deplib" 2404d8556812Smrg done 2405d8556812Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 2406d8556812Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 2407d8556812Smrg exit $EXIT_FAILURE 2408d8556812Smrg fi 2409d8556812Smrg continue 2410d8556812Smrg fi # $pass = conv 241176888252Smrg 241276888252Smrg 2413d8556812Smrg # Get the name of the library we link against. 2414d8556812Smrg linklib= 2415d8556812Smrg for l in $old_library $library_names; do 2416d8556812Smrg linklib="$l" 2417d8556812Smrg done 2418d8556812Smrg if test -z "$linklib"; then 2419d8556812Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2420d8556812Smrg exit $EXIT_FAILURE 242176888252Smrg fi 242276888252Smrg 2423d8556812Smrg # This library was specified with -dlopen. 2424d8556812Smrg if test "$pass" = dlopen; then 2425d8556812Smrg if test -z "$libdir"; then 2426d8556812Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2427d8556812Smrg exit $EXIT_FAILURE 2428d8556812Smrg fi 2429d8556812Smrg if test -z "$dlname" || 2430d8556812Smrg test "$dlopen_support" != yes || 2431d8556812Smrg test "$build_libtool_libs" = no; then 2432d8556812Smrg # If there is no dlname, no dlopen support or we're linking 2433d8556812Smrg # statically, we need to preload. We also need to preload any 2434d8556812Smrg # dependent libraries so libltdl's deplib preloader doesn't 2435d8556812Smrg # bomb out in the load deplibs phase. 2436d8556812Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 2437d8556812Smrg else 2438d8556812Smrg newdlfiles="$newdlfiles $lib" 2439d8556812Smrg fi 2440d8556812Smrg continue 2441d8556812Smrg fi # $pass = dlopen 244276888252Smrg 2443d8556812Smrg # We need an absolute path. 2444d8556812Smrg case $ladir in 2445d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2446d8556812Smrg *) 2447d8556812Smrg abs_ladir=`cd "$ladir" && pwd` 2448d8556812Smrg if test -z "$abs_ladir"; then 2449d8556812Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2450d8556812Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2451d8556812Smrg abs_ladir="$ladir" 2452d8556812Smrg fi 2453d8556812Smrg ;; 2454d8556812Smrg esac 2455d8556812Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 245676888252Smrg 2457d8556812Smrg # Find the relevant object directory and library name. 2458d8556812Smrg if test "X$installed" = Xyes; then 2459d8556812Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2460d8556812Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 2461d8556812Smrg dir="$ladir" 2462d8556812Smrg absdir="$abs_ladir" 2463d8556812Smrg libdir="$abs_ladir" 2464d8556812Smrg else 2465d8556812Smrg dir="$libdir" 2466d8556812Smrg absdir="$libdir" 2467d8556812Smrg fi 2468d8556812Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2469d8556812Smrg else 2470d8556812Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2471d8556812Smrg dir="$ladir" 2472d8556812Smrg absdir="$abs_ladir" 2473d8556812Smrg # Remove this search path later 2474d8556812Smrg notinst_path="$notinst_path $abs_ladir" 2475d8556812Smrg else 2476d8556812Smrg dir="$ladir/$objdir" 2477d8556812Smrg absdir="$abs_ladir/$objdir" 2478d8556812Smrg # Remove this search path later 2479d8556812Smrg notinst_path="$notinst_path $abs_ladir" 2480d8556812Smrg fi 2481d8556812Smrg fi # $installed = yes 2482d8556812Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 248376888252Smrg 2484d8556812Smrg # This library was specified with -dlpreopen. 2485d8556812Smrg if test "$pass" = dlpreopen; then 2486d8556812Smrg if test -z "$libdir"; then 2487d8556812Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2488d8556812Smrg exit $EXIT_FAILURE 2489d8556812Smrg fi 2490d8556812Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 2491d8556812Smrg # are required to link). 2492d8556812Smrg if test -n "$old_library"; then 2493d8556812Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 2494d8556812Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 2495d8556812Smrg elif test -n "$dlname"; then 2496d8556812Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 2497d8556812Smrg else 2498d8556812Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 2499d8556812Smrg fi 2500d8556812Smrg fi # $pass = dlpreopen 250176888252Smrg 2502d8556812Smrg if test -z "$libdir"; then 2503d8556812Smrg # Link the convenience library 2504d8556812Smrg if test "$linkmode" = lib; then 2505d8556812Smrg deplibs="$dir/$old_library $deplibs" 2506d8556812Smrg elif test "$linkmode,$pass" = "prog,link"; then 2507d8556812Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 2508d8556812Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 2509d8556812Smrg else 2510d8556812Smrg deplibs="$lib $deplibs" # used for prog,scan pass 2511d8556812Smrg fi 2512d8556812Smrg continue 2513d8556812Smrg fi 251476888252Smrg 251576888252Smrg 2516d8556812Smrg if test "$linkmode" = prog && test "$pass" != link; then 2517d8556812Smrg newlib_search_path="$newlib_search_path $ladir" 2518d8556812Smrg deplibs="$lib $deplibs" 251976888252Smrg 2520d8556812Smrg linkalldeplibs=no 2521d8556812Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 2522d8556812Smrg test "$build_libtool_libs" = no; then 2523d8556812Smrg linkalldeplibs=yes 2524d8556812Smrg fi 252576888252Smrg 2526d8556812Smrg tmp_libs= 2527d8556812Smrg for deplib in $dependency_libs; do 2528d8556812Smrg case $deplib in 2529d8556812Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2530d8556812Smrg esac 2531d8556812Smrg # Need to link against all dependency_libs? 2532d8556812Smrg if test "$linkalldeplibs" = yes; then 2533d8556812Smrg deplibs="$deplib $deplibs" 2534d8556812Smrg else 2535d8556812Smrg # Need to hardcode shared library paths 2536d8556812Smrg # or/and link against static libraries 2537d8556812Smrg newdependency_libs="$deplib $newdependency_libs" 2538d8556812Smrg fi 2539d8556812Smrg if test "X$duplicate_deps" = "Xyes" ; then 2540d8556812Smrg case "$tmp_libs " in 2541d8556812Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2542d8556812Smrg esac 2543d8556812Smrg fi 2544d8556812Smrg tmp_libs="$tmp_libs $deplib" 2545d8556812Smrg done # for deplib 2546d8556812Smrg continue 2547d8556812Smrg fi # $linkmode = prog... 254876888252Smrg 2549d8556812Smrg if test "$linkmode,$pass" = "prog,link"; then 2550d8556812Smrg if test -n "$library_names" && 2551d8556812Smrg { { test "$prefer_static_libs" = no || 2552d8556812Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 2553d8556812Smrg test -z "$old_library"; }; then 2554d8556812Smrg # We need to hardcode the library path 2555d8556812Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2556d8556812Smrg # Make sure the rpath contains only unique directories. 2557d8556812Smrg case "$temp_rpath " in 2558d8556812Smrg *" $dir "*) ;; 2559d8556812Smrg *" $absdir "*) ;; 2560d8556812Smrg *) temp_rpath="$temp_rpath $absdir" ;; 2561d8556812Smrg esac 2562d8556812Smrg fi 256376888252Smrg 2564d8556812Smrg # Hardcode the library path. 2565d8556812Smrg # Skip directories that are in the system default run-time 2566d8556812Smrg # search path. 2567d8556812Smrg case " $sys_lib_dlsearch_path " in 2568d8556812Smrg *" $absdir "*) ;; 2569d8556812Smrg *) 2570d8556812Smrg case "$compile_rpath " in 2571d8556812Smrg *" $absdir "*) ;; 2572d8556812Smrg *) compile_rpath="$compile_rpath $absdir" 2573d8556812Smrg esac 2574d8556812Smrg ;; 2575d8556812Smrg esac 2576d8556812Smrg case " $sys_lib_dlsearch_path " in 2577d8556812Smrg *" $libdir "*) ;; 2578d8556812Smrg *) 2579d8556812Smrg case "$finalize_rpath " in 2580d8556812Smrg *" $libdir "*) ;; 2581d8556812Smrg *) finalize_rpath="$finalize_rpath $libdir" 2582d8556812Smrg esac 2583d8556812Smrg ;; 2584d8556812Smrg esac 2585d8556812Smrg fi # $linkmode,$pass = prog,link... 258676888252Smrg 2587d8556812Smrg if test "$alldeplibs" = yes && 2588d8556812Smrg { test "$deplibs_check_method" = pass_all || 2589d8556812Smrg { test "$build_libtool_libs" = yes && 2590d8556812Smrg test -n "$library_names"; }; }; then 2591d8556812Smrg # We only need to search for static libraries 2592d8556812Smrg continue 2593d8556812Smrg fi 259486dafe34Smrg fi 259576888252Smrg 2596d8556812Smrg link_static=no # Whether the deplib will be linked statically 2597d8556812Smrg use_static_libs=$prefer_static_libs 2598d8556812Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 2599d8556812Smrg use_static_libs=no 2600d8556812Smrg fi 2601d8556812Smrg if test -n "$library_names" && 2602d8556812Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 2603d8556812Smrg if test "$installed" = no; then 2604d8556812Smrg notinst_deplibs="$notinst_deplibs $lib" 2605d8556812Smrg need_relink=yes 2606d8556812Smrg fi 2607d8556812Smrg # This is a shared library 260876888252Smrg 2609d8556812Smrg # Warn about portability, can't link against -module's on 2610d8556812Smrg # some systems (darwin) 2611d8556812Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 2612d8556812Smrg $echo 2613d8556812Smrg if test "$linkmode" = prog; then 2614d8556812Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 2615d8556812Smrg else 2616d8556812Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 2617d8556812Smrg fi 2618d8556812Smrg $echo "*** $linklib is not portable!" 2619d8556812Smrg fi 2620d8556812Smrg if test "$linkmode" = lib && 2621d8556812Smrg test "$hardcode_into_libs" = yes; then 2622d8556812Smrg # Hardcode the library path. 2623d8556812Smrg # Skip directories that are in the system default run-time 2624d8556812Smrg # search path. 2625d8556812Smrg case " $sys_lib_dlsearch_path " in 2626d8556812Smrg *" $absdir "*) ;; 2627d8556812Smrg *) 2628d8556812Smrg case "$compile_rpath " in 2629d8556812Smrg *" $absdir "*) ;; 2630d8556812Smrg *) compile_rpath="$compile_rpath $absdir" 2631d8556812Smrg esac 2632d8556812Smrg ;; 2633d8556812Smrg esac 2634d8556812Smrg case " $sys_lib_dlsearch_path " in 2635d8556812Smrg *" $libdir "*) ;; 2636d8556812Smrg *) 2637d8556812Smrg case "$finalize_rpath " in 2638d8556812Smrg *" $libdir "*) ;; 2639d8556812Smrg *) finalize_rpath="$finalize_rpath $libdir" 2640d8556812Smrg esac 2641d8556812Smrg ;; 2642d8556812Smrg esac 2643d8556812Smrg fi 264476888252Smrg 2645d8556812Smrg if test -n "$old_archive_from_expsyms_cmds"; then 2646d8556812Smrg # figure out the soname 2647d8556812Smrg set dummy $library_names 2648d8556812Smrg realname="$2" 2649d8556812Smrg shift; shift 2650d8556812Smrg libname=`eval \\$echo \"$libname_spec\"` 2651d8556812Smrg # use dlname if we got it. it's perfectly good, no? 2652d8556812Smrg if test -n "$dlname"; then 2653d8556812Smrg soname="$dlname" 2654d8556812Smrg elif test -n "$soname_spec"; then 2655d8556812Smrg # bleh windows 2656d8556812Smrg case $host in 2657d8556812Smrg *cygwin* | mingw*) 2658d8556812Smrg major=`expr $current - $age` 2659d8556812Smrg versuffix="-$major" 2660d8556812Smrg ;; 2661d8556812Smrg esac 2662d8556812Smrg eval soname=\"$soname_spec\" 2663d8556812Smrg else 2664d8556812Smrg soname="$realname" 2665d8556812Smrg fi 266676888252Smrg 2667d8556812Smrg # Make a new name for the extract_expsyms_cmds to use 2668d8556812Smrg soroot="$soname" 2669d8556812Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2670d8556812Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 267176888252Smrg 2672d8556812Smrg # If the library has no export list, then create one now 2673d8556812Smrg if test -f "$output_objdir/$soname-def"; then : 2674d8556812Smrg else 2675d8556812Smrg $show "extracting exported symbol list from \`$soname'" 2676d8556812Smrg save_ifs="$IFS"; IFS='~' 2677d8556812Smrg cmds=$extract_expsyms_cmds 2678d8556812Smrg for cmd in $cmds; do 2679d8556812Smrg IFS="$save_ifs" 2680d8556812Smrg eval cmd=\"$cmd\" 2681d8556812Smrg $show "$cmd" 2682d8556812Smrg $run eval "$cmd" || exit $? 2683d8556812Smrg done 2684d8556812Smrg IFS="$save_ifs" 2685d8556812Smrg fi 268676888252Smrg 2687d8556812Smrg # Create $newlib 2688d8556812Smrg if test -f "$output_objdir/$newlib"; then :; else 2689d8556812Smrg $show "generating import library for \`$soname'" 2690d8556812Smrg save_ifs="$IFS"; IFS='~' 2691d8556812Smrg cmds=$old_archive_from_expsyms_cmds 2692d8556812Smrg for cmd in $cmds; do 2693d8556812Smrg IFS="$save_ifs" 2694d8556812Smrg eval cmd=\"$cmd\" 2695d8556812Smrg $show "$cmd" 2696d8556812Smrg $run eval "$cmd" || exit $? 2697d8556812Smrg done 2698d8556812Smrg IFS="$save_ifs" 2699d8556812Smrg fi 2700d8556812Smrg # make sure the library variables are pointing to the new library 2701d8556812Smrg dir=$output_objdir 2702d8556812Smrg linklib=$newlib 2703d8556812Smrg fi # test -n "$old_archive_from_expsyms_cmds" 270476888252Smrg 2705d8556812Smrg if test "$linkmode" = prog || test "$mode" != relink; then 2706d8556812Smrg add_shlibpath= 2707d8556812Smrg add_dir= 2708d8556812Smrg add= 2709d8556812Smrg lib_linked=yes 2710d8556812Smrg case $hardcode_action in 2711d8556812Smrg immediate | unsupported) 2712d8556812Smrg if test "$hardcode_direct" = no; then 2713d8556812Smrg add="$dir/$linklib" 2714d8556812Smrg case $host in 2715d8556812Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2716d8556812Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2717d8556812Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2718d8556812Smrg *-*-unixware7*) add_dir="-L$dir" ;; 2719d8556812Smrg *-*-darwin* ) 2720d8556812Smrg # if the lib is a module then we can not link against 2721d8556812Smrg # it, someone is ignoring the new warnings I added 2722d8556812Smrg if /usr/bin/file -L $add 2> /dev/null | 2723d8556812Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 2724d8556812Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 2725d8556812Smrg if test -z "$old_library" ; then 2726d8556812Smrg $echo 2727d8556812Smrg $echo "** And there doesn't seem to be a static archive available" 2728d8556812Smrg $echo "** The link will probably fail, sorry" 2729d8556812Smrg else 2730d8556812Smrg add="$dir/$old_library" 2731d8556812Smrg fi 2732d8556812Smrg fi 2733d8556812Smrg esac 2734d8556812Smrg elif test "$hardcode_minus_L" = no; then 2735d8556812Smrg case $host in 2736d8556812Smrg *-*-sunos*) add_shlibpath="$dir" ;; 2737d8556812Smrg esac 2738d8556812Smrg add_dir="-L$dir" 2739d8556812Smrg add="-l$name" 2740d8556812Smrg elif test "$hardcode_shlibpath_var" = no; then 2741d8556812Smrg add_shlibpath="$dir" 2742d8556812Smrg add="-l$name" 2743d8556812Smrg else 2744d8556812Smrg lib_linked=no 2745d8556812Smrg fi 2746d8556812Smrg ;; 2747d8556812Smrg relink) 2748d8556812Smrg if test "$hardcode_direct" = yes; then 2749d8556812Smrg add="$dir/$linklib" 2750d8556812Smrg elif test "$hardcode_minus_L" = yes; then 2751d8556812Smrg add_dir="-L$dir" 2752d8556812Smrg # Try looking first in the location we're being installed to. 2753d8556812Smrg if test -n "$inst_prefix_dir"; then 2754d8556812Smrg case $libdir in 2755d8556812Smrg [\\/]*) 2756d8556812Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2757d8556812Smrg ;; 2758d8556812Smrg esac 2759d8556812Smrg fi 2760d8556812Smrg add="-l$name" 2761d8556812Smrg elif test "$hardcode_shlibpath_var" = yes; then 2762d8556812Smrg add_shlibpath="$dir" 2763d8556812Smrg add="-l$name" 2764d8556812Smrg else 2765d8556812Smrg lib_linked=no 2766d8556812Smrg fi 2767d8556812Smrg ;; 2768d8556812Smrg *) lib_linked=no ;; 2769d8556812Smrg esac 277076888252Smrg 2771d8556812Smrg if test "$lib_linked" != yes; then 2772d8556812Smrg $echo "$modename: configuration error: unsupported hardcode properties" 2773d8556812Smrg exit $EXIT_FAILURE 2774d8556812Smrg fi 277576888252Smrg 2776d8556812Smrg if test -n "$add_shlibpath"; then 2777d8556812Smrg case :$compile_shlibpath: in 2778d8556812Smrg *":$add_shlibpath:"*) ;; 2779d8556812Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2780d8556812Smrg esac 2781d8556812Smrg fi 2782d8556812Smrg if test "$linkmode" = prog; then 2783d8556812Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2784d8556812Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 2785d8556812Smrg else 2786d8556812Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2787d8556812Smrg test -n "$add" && deplibs="$add $deplibs" 2788d8556812Smrg if test "$hardcode_direct" != yes && \ 2789d8556812Smrg test "$hardcode_minus_L" != yes && \ 2790d8556812Smrg test "$hardcode_shlibpath_var" = yes; then 2791d8556812Smrg case :$finalize_shlibpath: in 2792d8556812Smrg *":$libdir:"*) ;; 2793d8556812Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2794d8556812Smrg esac 2795d8556812Smrg fi 2796d8556812Smrg fi 2797d8556812Smrg fi 279876888252Smrg 2799d8556812Smrg if test "$linkmode" = prog || test "$mode" = relink; then 2800d8556812Smrg add_shlibpath= 2801d8556812Smrg add_dir= 2802d8556812Smrg add= 2803d8556812Smrg # Finalize command for both is simple: just hardcode it. 2804d8556812Smrg if test "$hardcode_direct" = yes; then 2805d8556812Smrg add="$libdir/$linklib" 2806d8556812Smrg elif test "$hardcode_minus_L" = yes; then 2807d8556812Smrg add_dir="-L$libdir" 2808d8556812Smrg add="-l$name" 2809d8556812Smrg elif test "$hardcode_shlibpath_var" = yes; then 2810d8556812Smrg case :$finalize_shlibpath: in 2811d8556812Smrg *":$libdir:"*) ;; 2812d8556812Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2813d8556812Smrg esac 2814d8556812Smrg add="-l$name" 2815d8556812Smrg elif test "$hardcode_automatic" = yes; then 2816d8556812Smrg if test -n "$inst_prefix_dir" && 2817d8556812Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 2818d8556812Smrg add="$inst_prefix_dir$libdir/$linklib" 2819d8556812Smrg else 2820d8556812Smrg add="$libdir/$linklib" 2821d8556812Smrg fi 2822d8556812Smrg else 2823d8556812Smrg # We cannot seem to hardcode it, guess we'll fake it. 2824d8556812Smrg add_dir="-L$libdir" 2825d8556812Smrg # Try looking first in the location we're being installed to. 2826d8556812Smrg if test -n "$inst_prefix_dir"; then 2827d8556812Smrg case $libdir in 2828d8556812Smrg [\\/]*) 2829d8556812Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2830d8556812Smrg ;; 2831d8556812Smrg esac 2832d8556812Smrg fi 2833d8556812Smrg add="-l$name" 2834d8556812Smrg fi 283576888252Smrg 2836d8556812Smrg if test "$linkmode" = prog; then 2837d8556812Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2838d8556812Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2839d8556812Smrg else 2840d8556812Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2841d8556812Smrg test -n "$add" && deplibs="$add $deplibs" 2842d8556812Smrg fi 2843d8556812Smrg fi 2844d8556812Smrg elif test "$linkmode" = prog; then 2845d8556812Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 2846d8556812Smrg # is not unsupported. This is valid on all known static and 2847d8556812Smrg # shared platforms. 2848d8556812Smrg if test "$hardcode_direct" != unsupported; then 2849d8556812Smrg test -n "$old_library" && linklib="$old_library" 2850d8556812Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 2851d8556812Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 2852d8556812Smrg else 2853d8556812Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 2854d8556812Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2855d8556812Smrg fi 2856d8556812Smrg elif test "$build_libtool_libs" = yes; then 2857d8556812Smrg # Not a shared library 2858d8556812Smrg if test "$deplibs_check_method" != pass_all; then 2859d8556812Smrg # We're trying link a shared library against a static one 2860d8556812Smrg # but the system doesn't support it. 286176888252Smrg 2862d8556812Smrg # Just print a warning and add the library to dependency_libs so 2863d8556812Smrg # that the program can be linked against the static library. 2864d8556812Smrg $echo 2865d8556812Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 2866d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 2867d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 2868d8556812Smrg $echo "*** shared version of the library, which you do not appear to have." 2869d8556812Smrg if test "$module" = yes; then 2870d8556812Smrg $echo "*** But as you try to build a module library, libtool will still create " 2871d8556812Smrg $echo "*** a static module, that should work as long as the dlopening application" 2872d8556812Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2873d8556812Smrg if test -z "$global_symbol_pipe"; then 2874d8556812Smrg $echo 2875d8556812Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 2876d8556812Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2877d8556812Smrg $echo "*** not find such a program. So, this module is probably useless." 2878d8556812Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2879d8556812Smrg fi 2880d8556812Smrg if test "$build_old_libs" = no; then 2881d8556812Smrg build_libtool_libs=module 2882d8556812Smrg build_old_libs=yes 2883d8556812Smrg else 2884d8556812Smrg build_libtool_libs=no 2885d8556812Smrg fi 2886d8556812Smrg fi 2887d8556812Smrg else 2888d8556812Smrg deplibs="$dir/$old_library $deplibs" 2889d8556812Smrg link_static=yes 2890d8556812Smrg fi 2891d8556812Smrg fi # link shared/static library? 289276888252Smrg 2893d8556812Smrg if test "$linkmode" = lib; then 2894d8556812Smrg if test -n "$dependency_libs" && 2895d8556812Smrg { test "$hardcode_into_libs" != yes || 2896d8556812Smrg test "$build_old_libs" = yes || 2897d8556812Smrg test "$link_static" = yes; }; then 2898d8556812Smrg # Extract -R from dependency_libs 2899d8556812Smrg temp_deplibs= 2900d8556812Smrg for libdir in $dependency_libs; do 2901d8556812Smrg case $libdir in 2902d8556812Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2903d8556812Smrg case " $xrpath " in 2904d8556812Smrg *" $temp_xrpath "*) ;; 2905d8556812Smrg *) xrpath="$xrpath $temp_xrpath";; 2906d8556812Smrg esac;; 2907d8556812Smrg *) temp_deplibs="$temp_deplibs $libdir";; 2908d8556812Smrg esac 2909d8556812Smrg done 2910d8556812Smrg dependency_libs="$temp_deplibs" 2911d8556812Smrg fi 291276888252Smrg 2913d8556812Smrg newlib_search_path="$newlib_search_path $absdir" 2914d8556812Smrg # Link against this library 2915d8556812Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2916d8556812Smrg # ... and its dependency_libs 2917d8556812Smrg tmp_libs= 2918d8556812Smrg for deplib in $dependency_libs; do 2919d8556812Smrg newdependency_libs="$deplib $newdependency_libs" 2920d8556812Smrg if test "X$duplicate_deps" = "Xyes" ; then 2921d8556812Smrg case "$tmp_libs " in 2922d8556812Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2923d8556812Smrg esac 2924d8556812Smrg fi 2925d8556812Smrg tmp_libs="$tmp_libs $deplib" 2926d8556812Smrg done 292786dafe34Smrg 2928d8556812Smrg if test "$link_all_deplibs" != no; then 2929d8556812Smrg # Add the search paths of all dependency libraries 2930d8556812Smrg for deplib in $dependency_libs; do 2931d8556812Smrg case $deplib in 2932d8556812Smrg -L*) path="$deplib" ;; 2933d8556812Smrg *.la) 2934d8556812Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2935d8556812Smrg test "X$dir" = "X$deplib" && dir="." 2936d8556812Smrg # We need an absolute path. 2937d8556812Smrg case $dir in 2938d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2939d8556812Smrg *) 2940d8556812Smrg absdir=`cd "$dir" && pwd` 2941d8556812Smrg if test -z "$absdir"; then 2942d8556812Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2943d8556812Smrg absdir="$dir" 2944d8556812Smrg fi 2945d8556812Smrg ;; 2946d8556812Smrg esac 2947d8556812Smrg if grep "^installed=no" $deplib > /dev/null; then 2948d8556812Smrg path="$absdir/$objdir" 2949d8556812Smrg else 2950d8556812Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2951d8556812Smrg if test -z "$libdir"; then 2952d8556812Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2953d8556812Smrg exit $EXIT_FAILURE 2954d8556812Smrg fi 2955d8556812Smrg if test "$absdir" != "$libdir"; then 2956d8556812Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2957d8556812Smrg fi 2958d8556812Smrg path="$absdir" 2959d8556812Smrg fi 2960d8556812Smrg depdepl= 2961d8556812Smrg case $host in 2962d8556812Smrg *-*-darwin*) 2963d8556812Smrg # we do not want to link against static libs, 2964d8556812Smrg # but need to link against shared 2965d8556812Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2966d8556812Smrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2967d8556812Smrg if test -n "$deplibrary_names" ; then 2968d8556812Smrg for tmp in $deplibrary_names ; do 2969d8556812Smrg depdepl=$tmp 2970d8556812Smrg done 2971d8556812Smrg if test -f "$deplibdir/$depdepl" ; then 2972d8556812Smrg depdepl="$deplibdir/$depdepl" 2973d8556812Smrg elif test -f "$path/$depdepl" ; then 2974d8556812Smrg depdepl="$path/$depdepl" 2975d8556812Smrg else 2976d8556812Smrg # Can't find it, oh well... 2977d8556812Smrg depdepl= 2978d8556812Smrg fi 2979d8556812Smrg # do not add paths which are already there 2980d8556812Smrg case " $newlib_search_path " in 2981d8556812Smrg *" $path "*) ;; 2982d8556812Smrg *) newlib_search_path="$newlib_search_path $path";; 2983d8556812Smrg esac 2984d8556812Smrg fi 2985d8556812Smrg path="" 2986d8556812Smrg ;; 2987d8556812Smrg *) 2988d8556812Smrg path="-L$path" 2989d8556812Smrg ;; 2990d8556812Smrg esac 2991d8556812Smrg ;; 2992d8556812Smrg -l*) 2993d8556812Smrg case $host in 2994d8556812Smrg *-*-darwin*) 2995d8556812Smrg # Again, we only want to link against shared libraries 2996d8556812Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 2997d8556812Smrg for tmp in $newlib_search_path ; do 2998d8556812Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 2999d8556812Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 3000d8556812Smrg break 3001d8556812Smrg fi 3002d8556812Smrg done 3003d8556812Smrg path="" 3004d8556812Smrg ;; 3005d8556812Smrg *) continue ;; 3006d8556812Smrg esac 3007d8556812Smrg ;; 3008d8556812Smrg *) continue ;; 3009d8556812Smrg esac 3010d8556812Smrg case " $deplibs " in 3011d8556812Smrg *" $path "*) ;; 3012d8556812Smrg *) deplibs="$path $deplibs" ;; 3013d8556812Smrg esac 3014d8556812Smrg case " $deplibs " in 3015d8556812Smrg *" $depdepl "*) ;; 3016d8556812Smrg *) deplibs="$depdepl $deplibs" ;; 3017d8556812Smrg esac 3018d8556812Smrg done 3019d8556812Smrg fi # link_all_deplibs != no 3020d8556812Smrg fi # linkmode = lib 3021d8556812Smrg done # for deplib in $libs 3022d8556812Smrg dependency_libs="$newdependency_libs" 3023d8556812Smrg if test "$pass" = dlpreopen; then 3024d8556812Smrg # Link the dlpreopened libraries before other libraries 3025d8556812Smrg for deplib in $save_deplibs; do 3026d8556812Smrg deplibs="$deplib $deplibs" 3027d8556812Smrg done 3028d8556812Smrg fi 3029d8556812Smrg if test "$pass" != dlopen; then 3030d8556812Smrg if test "$pass" != conv; then 3031d8556812Smrg # Make sure lib_search_path contains only unique directories. 3032d8556812Smrg lib_search_path= 3033d8556812Smrg for dir in $newlib_search_path; do 3034d8556812Smrg case "$lib_search_path " in 3035d8556812Smrg *" $dir "*) ;; 3036d8556812Smrg *) lib_search_path="$lib_search_path $dir" ;; 3037d8556812Smrg esac 3038d8556812Smrg done 3039d8556812Smrg newlib_search_path= 3040d8556812Smrg fi 3041d8556812Smrg 3042d8556812Smrg if test "$linkmode,$pass" != "prog,link"; then 3043d8556812Smrg vars="deplibs" 3044d8556812Smrg else 3045d8556812Smrg vars="compile_deplibs finalize_deplibs" 3046d8556812Smrg fi 3047d8556812Smrg for var in $vars dependency_libs; do 3048d8556812Smrg # Add libraries to $var in reverse order 3049d8556812Smrg eval tmp_libs=\"\$$var\" 3050d8556812Smrg new_libs= 3051d8556812Smrg for deplib in $tmp_libs; do 3052d8556812Smrg # FIXME: Pedantically, this is the right thing to do, so 3053d8556812Smrg # that some nasty dependency loop isn't accidentally 3054d8556812Smrg # broken: 3055d8556812Smrg #new_libs="$deplib $new_libs" 3056d8556812Smrg # Pragmatically, this seems to cause very few problems in 3057d8556812Smrg # practice: 3058d8556812Smrg case $deplib in 3059d8556812Smrg -L*) new_libs="$deplib $new_libs" ;; 3060d8556812Smrg -R*) ;; 3061d8556812Smrg *) 3062d8556812Smrg # And here is the reason: when a library appears more 3063d8556812Smrg # than once as an explicit dependence of a library, or 3064d8556812Smrg # is implicitly linked in more than once by the 3065d8556812Smrg # compiler, it is considered special, and multiple 3066d8556812Smrg # occurrences thereof are not removed. Compare this 3067d8556812Smrg # with having the same library being listed as a 3068d8556812Smrg # dependency of multiple other libraries: in this case, 3069d8556812Smrg # we know (pedantically, we assume) the library does not 3070d8556812Smrg # need to be listed more than once, so we keep only the 3071d8556812Smrg # last copy. This is not always right, but it is rare 3072d8556812Smrg # enough that we require users that really mean to play 3073d8556812Smrg # such unportable linking tricks to link the library 3074d8556812Smrg # using -Wl,-lname, so that libtool does not consider it 3075d8556812Smrg # for duplicate removal. 3076d8556812Smrg case " $specialdeplibs " in 3077d8556812Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 3078d8556812Smrg *) 3079d8556812Smrg case " $new_libs " in 3080d8556812Smrg *" $deplib "*) ;; 3081d8556812Smrg *) new_libs="$deplib $new_libs" ;; 3082d8556812Smrg esac 3083d8556812Smrg ;; 3084d8556812Smrg esac 3085d8556812Smrg ;; 3086d8556812Smrg esac 3087d8556812Smrg done 3088d8556812Smrg tmp_libs= 3089d8556812Smrg for deplib in $new_libs; do 3090d8556812Smrg case $deplib in 3091d8556812Smrg -L*) 3092d8556812Smrg case " $tmp_libs " in 3093d8556812Smrg *" $deplib "*) ;; 3094d8556812Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3095d8556812Smrg esac 3096d8556812Smrg ;; 3097d8556812Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3098d8556812Smrg esac 3099d8556812Smrg done 3100d8556812Smrg eval $var=\"$tmp_libs\" 3101d8556812Smrg done # for var 3102d8556812Smrg fi 3103d8556812Smrg # Last step: remove runtime libs from dependency_libs 3104d8556812Smrg # (they stay in deplibs) 3105d8556812Smrg tmp_libs= 3106d8556812Smrg for i in $dependency_libs ; do 3107d8556812Smrg case " $predeps $postdeps $compiler_lib_search_path " in 3108d8556812Smrg *" $i "*) 3109d8556812Smrg i="" 311086dafe34Smrg ;; 311186dafe34Smrg esac 3112d8556812Smrg if test -n "$i" ; then 3113d8556812Smrg tmp_libs="$tmp_libs $i" 3114d8556812Smrg fi 3115d8556812Smrg done 3116d8556812Smrg dependency_libs=$tmp_libs 3117d8556812Smrg done # for pass 3118d8556812Smrg if test "$linkmode" = prog; then 3119d8556812Smrg dlfiles="$newdlfiles" 3120d8556812Smrg dlprefiles="$newdlprefiles" 312186dafe34Smrg fi 312286dafe34Smrg 3123d8556812Smrg case $linkmode in 3124d8556812Smrg oldlib) 3125d8556812Smrg case " $deplibs" in 3126d8556812Smrg *\ -l* | *\ -L*) 3127d8556812Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 3128d8556812Smrg esac 312986dafe34Smrg 3130d8556812Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3131d8556812Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3132d8556812Smrg fi 313376888252Smrg 3134d8556812Smrg if test -n "$rpath"; then 3135d8556812Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3136d8556812Smrg fi 313776888252Smrg 3138d8556812Smrg if test -n "$xrpath"; then 3139d8556812Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3140d8556812Smrg fi 314176888252Smrg 3142d8556812Smrg if test -n "$vinfo"; then 3143d8556812Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3144d8556812Smrg fi 314576888252Smrg 3146d8556812Smrg if test -n "$release"; then 3147d8556812Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3148d8556812Smrg fi 314976888252Smrg 3150d8556812Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3151d8556812Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3152d8556812Smrg fi 315376888252Smrg 3154d8556812Smrg # Now set the variables for building old libraries. 3155d8556812Smrg build_libtool_libs=no 3156d8556812Smrg oldlibs="$output" 3157d8556812Smrg objs="$objs$old_deplibs" 3158d8556812Smrg ;; 315976888252Smrg 3160d8556812Smrg lib) 3161d8556812Smrg # Make sure we only generate libraries of the form `libNAME.la'. 3162d8556812Smrg case $outputname in 3163d8556812Smrg lib*) 3164d8556812Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3165d8556812Smrg eval shared_ext=\"$shrext_cmds\" 3166d8556812Smrg eval libname=\"$libname_spec\" 3167d8556812Smrg ;; 3168d8556812Smrg *) 3169d8556812Smrg if test "$module" = no; then 3170d8556812Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3171d8556812Smrg $echo "$help" 1>&2 3172d8556812Smrg exit $EXIT_FAILURE 3173d8556812Smrg fi 3174d8556812Smrg if test "$need_lib_prefix" != no; then 3175d8556812Smrg # Add the "lib" prefix for modules if required 3176d8556812Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3177d8556812Smrg eval shared_ext=\"$shrext_cmds\" 3178d8556812Smrg eval libname=\"$libname_spec\" 3179d8556812Smrg else 3180d8556812Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3181d8556812Smrg fi 3182d8556812Smrg ;; 3183d8556812Smrg esac 318486dafe34Smrg 3185d8556812Smrg if test -n "$objs"; then 3186d8556812Smrg if test "$deplibs_check_method" != pass_all; then 3187d8556812Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3188d8556812Smrg exit $EXIT_FAILURE 3189d8556812Smrg else 3190d8556812Smrg $echo 3191d8556812Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 3192d8556812Smrg $echo "*** objects $objs is not portable!" 3193d8556812Smrg libobjs="$libobjs $objs" 3194d8556812Smrg fi 3195d8556812Smrg fi 319686dafe34Smrg 3197d8556812Smrg if test "$dlself" != no; then 3198d8556812Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3199d8556812Smrg fi 320086dafe34Smrg 3201d8556812Smrg set dummy $rpath 3202d8556812Smrg if test "$#" -gt 2; then 3203d8556812Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3204d8556812Smrg fi 3205d8556812Smrg install_libdir="$2" 320686dafe34Smrg 3207d8556812Smrg oldlibs= 3208d8556812Smrg if test -z "$rpath"; then 3209d8556812Smrg if test "$build_libtool_libs" = yes; then 3210d8556812Smrg # Building a libtool convenience library. 3211d8556812Smrg # Some compilers have problems with a `.al' extension so 3212d8556812Smrg # convenience libraries should have the same extension an 3213d8556812Smrg # archive normally would. 3214d8556812Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 3215d8556812Smrg build_libtool_libs=convenience 3216d8556812Smrg build_old_libs=yes 3217d8556812Smrg fi 321886dafe34Smrg 3219d8556812Smrg if test -n "$vinfo"; then 3220d8556812Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3221d8556812Smrg fi 322286dafe34Smrg 3223d8556812Smrg if test -n "$release"; then 3224d8556812Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3225d8556812Smrg fi 3226d8556812Smrg else 322786dafe34Smrg 3228d8556812Smrg # Parse the version information argument. 3229d8556812Smrg save_ifs="$IFS"; IFS=':' 3230d8556812Smrg set dummy $vinfo 0 0 0 3231d8556812Smrg IFS="$save_ifs" 323286dafe34Smrg 3233d8556812Smrg if test -n "$8"; then 3234d8556812Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 3235d8556812Smrg $echo "$help" 1>&2 3236d8556812Smrg exit $EXIT_FAILURE 3237d8556812Smrg fi 323886dafe34Smrg 3239d8556812Smrg # convert absolute version numbers to libtool ages 3240d8556812Smrg # this retains compatibility with .la files and attempts 3241d8556812Smrg # to make the code below a bit more comprehensible 324286dafe34Smrg 3243d8556812Smrg case $vinfo_number in 3244d8556812Smrg yes) 3245d8556812Smrg number_major="$2" 3246d8556812Smrg number_minor="$3" 3247d8556812Smrg number_revision="$4" 3248d8556812Smrg # 3249d8556812Smrg # There are really only two kinds -- those that 3250d8556812Smrg # use the current revision as the major version 3251d8556812Smrg # and those that subtract age and use age as 3252d8556812Smrg # a minor version. But, then there is irix 3253d8556812Smrg # which has an extra 1 added just for fun 3254d8556812Smrg # 3255d8556812Smrg case $version_type in 3256d8556812Smrg darwin|linux|osf|windows|none) 3257d8556812Smrg current=`expr $number_major + $number_minor` 3258d8556812Smrg age="$number_minor" 3259d8556812Smrg revision="$number_revision" 3260d8556812Smrg ;; 3261d8556812Smrg freebsd-aout|freebsd-elf|sunos) 3262d8556812Smrg current="$number_major" 3263d8556812Smrg revision="$number_minor" 3264d8556812Smrg age="0" 3265d8556812Smrg ;; 3266d8556812Smrg irix|nonstopux) 3267d8556812Smrg current=`expr $number_major + $number_minor` 3268d8556812Smrg age="$number_minor" 3269d8556812Smrg revision="$number_minor" 3270d8556812Smrg lt_irix_increment=no 3271d8556812Smrg ;; 3272d8556812Smrg esac 3273d8556812Smrg ;; 3274d8556812Smrg no) 3275d8556812Smrg current="$2" 3276d8556812Smrg revision="$3" 3277d8556812Smrg age="$4" 3278d8556812Smrg ;; 3279d8556812Smrg esac 328086dafe34Smrg 3281d8556812Smrg # Check that each of the things are valid numbers. 3282d8556812Smrg case $current in 3283d8556812Smrg 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]) ;; 3284d8556812Smrg *) 3285d8556812Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3286d8556812Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3287d8556812Smrg exit $EXIT_FAILURE 3288d8556812Smrg ;; 3289d8556812Smrg esac 329086dafe34Smrg 3291d8556812Smrg case $revision in 3292d8556812Smrg 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]) ;; 3293d8556812Smrg *) 3294d8556812Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3295d8556812Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3296d8556812Smrg exit $EXIT_FAILURE 3297d8556812Smrg ;; 3298d8556812Smrg esac 329986dafe34Smrg 3300d8556812Smrg case $age in 3301d8556812Smrg 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]) ;; 3302d8556812Smrg *) 3303d8556812Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3304d8556812Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3305d8556812Smrg exit $EXIT_FAILURE 3306d8556812Smrg ;; 3307d8556812Smrg esac 330886dafe34Smrg 3309d8556812Smrg if test "$age" -gt "$current"; then 3310d8556812Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3311d8556812Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3312d8556812Smrg exit $EXIT_FAILURE 3313d8556812Smrg fi 331486dafe34Smrg 3315d8556812Smrg # Calculate the version variables. 3316d8556812Smrg major= 3317d8556812Smrg versuffix= 3318d8556812Smrg verstring= 3319d8556812Smrg case $version_type in 3320d8556812Smrg none) ;; 332186dafe34Smrg 3322d8556812Smrg darwin) 3323d8556812Smrg # Like Linux, but with the current version available in 3324d8556812Smrg # verstring for coding it into the library header 3325d8556812Smrg major=.`expr $current - $age` 3326d8556812Smrg versuffix="$major.$age.$revision" 3327d8556812Smrg # Darwin ld doesn't like 0 for these options... 3328d8556812Smrg minor_current=`expr $current + 1` 3329d8556812Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3330d8556812Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3331d8556812Smrg ;; 333286dafe34Smrg 3333d8556812Smrg freebsd-aout) 3334d8556812Smrg major=".$current" 3335d8556812Smrg versuffix=".$current.$revision"; 3336d8556812Smrg ;; 333786dafe34Smrg 3338d8556812Smrg freebsd-elf) 3339d8556812Smrg major=".$current" 3340d8556812Smrg versuffix=".$current"; 3341d8556812Smrg ;; 334286dafe34Smrg 3343d8556812Smrg irix | nonstopux) 3344d8556812Smrg if test "X$lt_irix_increment" = "Xno"; then 3345d8556812Smrg major=`expr $current - $age` 3346d8556812Smrg else 3347d8556812Smrg major=`expr $current - $age + 1` 3348d8556812Smrg fi 3349d8556812Smrg case $version_type in 3350d8556812Smrg nonstopux) verstring_prefix=nonstopux ;; 3351d8556812Smrg *) verstring_prefix=sgi ;; 3352d8556812Smrg esac 3353d8556812Smrg verstring="$verstring_prefix$major.$revision" 335476888252Smrg 3355d8556812Smrg # Add in all the interfaces that we are compatible with. 3356d8556812Smrg loop=$revision 3357d8556812Smrg while test "$loop" -ne 0; do 3358d8556812Smrg iface=`expr $revision - $loop` 3359d8556812Smrg loop=`expr $loop - 1` 3360d8556812Smrg verstring="$verstring_prefix$major.$iface:$verstring" 3361d8556812Smrg done 336276888252Smrg 3363d8556812Smrg # Before this point, $major must not contain `.'. 3364d8556812Smrg major=.$major 3365d8556812Smrg versuffix="$major.$revision" 3366d8556812Smrg ;; 336776888252Smrg 3368d8556812Smrg linux) 3369d8556812Smrg major=.`expr $current - $age` 3370d8556812Smrg versuffix="$major.$age.$revision" 3371d8556812Smrg ;; 337276888252Smrg 3373d8556812Smrg osf) 3374d8556812Smrg major=.`expr $current - $age` 3375d8556812Smrg versuffix=".$current.$age.$revision" 3376d8556812Smrg verstring="$current.$age.$revision" 337776888252Smrg 3378d8556812Smrg # Add in all the interfaces that we are compatible with. 3379d8556812Smrg loop=$age 3380d8556812Smrg while test "$loop" -ne 0; do 3381d8556812Smrg iface=`expr $current - $loop` 3382d8556812Smrg loop=`expr $loop - 1` 3383d8556812Smrg verstring="$verstring:${iface}.0" 3384d8556812Smrg done 338576888252Smrg 3386d8556812Smrg # Make executables depend on our current version. 3387d8556812Smrg verstring="$verstring:${current}.0" 3388d8556812Smrg ;; 338976888252Smrg 3390d8556812Smrg sunos) 3391d8556812Smrg major=".$current" 3392d8556812Smrg versuffix=".$current.$revision" 3393d8556812Smrg ;; 339476888252Smrg 3395d8556812Smrg windows) 3396d8556812Smrg # Use '-' rather than '.', since we only want one 3397d8556812Smrg # extension on DOS 8.3 filesystems. 3398d8556812Smrg major=`expr $current - $age` 3399d8556812Smrg versuffix="-$major" 3400d8556812Smrg ;; 340176888252Smrg 3402d8556812Smrg *) 3403d8556812Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 3404d8556812Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3405d8556812Smrg exit $EXIT_FAILURE 3406d8556812Smrg ;; 3407d8556812Smrg esac 340876888252Smrg 3409d8556812Smrg # Clear the version info if we defaulted, and they specified a release. 3410d8556812Smrg if test -z "$vinfo" && test -n "$release"; then 3411d8556812Smrg major= 3412d8556812Smrg case $version_type in 3413d8556812Smrg darwin) 3414d8556812Smrg # we can't check for "0.0" in archive_cmds due to quoting 3415d8556812Smrg # problems, so we reset it completely 3416d8556812Smrg verstring= 341786dafe34Smrg ;; 3418d8556812Smrg *) 3419d8556812Smrg verstring="0.0" 3420d8556812Smrg ;; 3421d8556812Smrg esac 3422d8556812Smrg if test "$need_version" = no; then 3423d8556812Smrg versuffix= 3424d8556812Smrg else 3425d8556812Smrg versuffix=".0.0" 3426d8556812Smrg fi 3427d8556812Smrg fi 342876888252Smrg 3429d8556812Smrg # Remove version info from name if versioning should be avoided 3430d8556812Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 3431d8556812Smrg major= 3432d8556812Smrg versuffix= 3433d8556812Smrg verstring="" 3434d8556812Smrg fi 343576888252Smrg 3436d8556812Smrg # Check to see if the archive will have undefined symbols. 3437d8556812Smrg if test "$allow_undefined" = yes; then 3438d8556812Smrg if test "$allow_undefined_flag" = unsupported; then 3439d8556812Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3440d8556812Smrg build_libtool_libs=no 3441d8556812Smrg build_old_libs=yes 3442d8556812Smrg fi 3443d8556812Smrg else 3444d8556812Smrg # Don't allow undefined symbols. 3445d8556812Smrg allow_undefined_flag="$no_undefined_flag" 3446d8556812Smrg fi 3447d8556812Smrg fi 344876888252Smrg 3449d8556812Smrg if test "$mode" != relink; then 3450d8556812Smrg # Remove our outputs, but don't remove object files since they 3451d8556812Smrg # may have been created when compiling PIC objects. 3452d8556812Smrg removelist= 3453d8556812Smrg tempremovelist=`$echo "$output_objdir/*"` 3454d8556812Smrg for p in $tempremovelist; do 3455d8556812Smrg case $p in 3456d8556812Smrg *.$objext) 3457d8556812Smrg ;; 3458d8556812Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3459d8556812Smrg if test "X$precious_files_regex" != "X"; then 3460d8556812Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3461d8556812Smrg then 3462d8556812Smrg continue 3463d8556812Smrg fi 3464d8556812Smrg fi 3465d8556812Smrg removelist="$removelist $p" 3466d8556812Smrg ;; 3467d8556812Smrg *) ;; 3468d8556812Smrg esac 3469d8556812Smrg done 3470d8556812Smrg if test -n "$removelist"; then 3471d8556812Smrg $show "${rm}r $removelist" 3472d8556812Smrg $run ${rm}r $removelist 3473d8556812Smrg fi 3474d8556812Smrg fi 347576888252Smrg 3476d8556812Smrg # Now set the variables for building old libraries. 3477d8556812Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3478d8556812Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 347976888252Smrg 3480d8556812Smrg # Transform .lo files to .o files. 3481d8556812Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3482d8556812Smrg fi 348376888252Smrg 3484d8556812Smrg # Eliminate all temporary directories. 3485d8556812Smrg #for path in $notinst_path; do 3486d8556812Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3487d8556812Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3488d8556812Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3489d8556812Smrg #done 349076888252Smrg 3491d8556812Smrg if test -n "$xrpath"; then 3492d8556812Smrg # If the user specified any rpath flags, then add them. 3493d8556812Smrg temp_xrpath= 3494d8556812Smrg for libdir in $xrpath; do 3495d8556812Smrg temp_xrpath="$temp_xrpath -R$libdir" 3496d8556812Smrg case "$finalize_rpath " in 3497d8556812Smrg *" $libdir "*) ;; 3498d8556812Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 3499d8556812Smrg esac 3500d8556812Smrg done 3501d8556812Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3502d8556812Smrg dependency_libs="$temp_xrpath $dependency_libs" 3503d8556812Smrg fi 3504d8556812Smrg fi 350576888252Smrg 3506d8556812Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 3507d8556812Smrg old_dlfiles="$dlfiles" 3508d8556812Smrg dlfiles= 3509d8556812Smrg for lib in $old_dlfiles; do 3510d8556812Smrg case " $dlprefiles $dlfiles " in 3511d8556812Smrg *" $lib "*) ;; 3512d8556812Smrg *) dlfiles="$dlfiles $lib" ;; 3513d8556812Smrg esac 3514d8556812Smrg done 351576888252Smrg 3516d8556812Smrg # Make sure dlprefiles contains only unique files 3517d8556812Smrg old_dlprefiles="$dlprefiles" 3518d8556812Smrg dlprefiles= 3519d8556812Smrg for lib in $old_dlprefiles; do 3520d8556812Smrg case "$dlprefiles " in 3521d8556812Smrg *" $lib "*) ;; 3522d8556812Smrg *) dlprefiles="$dlprefiles $lib" ;; 3523d8556812Smrg esac 3524d8556812Smrg done 352576888252Smrg 3526d8556812Smrg if test "$build_libtool_libs" = yes; then 3527d8556812Smrg if test -n "$rpath"; then 3528d8556812Smrg case $host in 3529d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3530d8556812Smrg # these systems don't actually have a c library (as such)! 3531d8556812Smrg ;; 3532d8556812Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3533d8556812Smrg # Rhapsody C library is in the System framework 3534d8556812Smrg deplibs="$deplibs -framework System" 3535d8556812Smrg ;; 3536d8556812Smrg *-*-netbsd*) 3537d8556812Smrg # Don't link with libc until the a.out ld.so is fixed. 3538d8556812Smrg ;; 3539d8556812Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3540d8556812Smrg # Do not include libc due to us having libc/libc_r. 3541d8556812Smrg ;; 3542d8556812Smrg *-*-sco3.2v5* | *-*-sco5v6*) 3543d8556812Smrg # Causes problems with __ctype 3544d8556812Smrg ;; 3545d8556812Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3546d8556812Smrg # Compiler inserts libc in the correct place for threads to work 3547d8556812Smrg ;; 3548d8556812Smrg *) 3549d8556812Smrg # Add libc to deplibs on all other systems if necessary. 3550d8556812Smrg if test "$build_libtool_need_lc" = "yes"; then 3551d8556812Smrg deplibs="$deplibs -lc" 3552d8556812Smrg fi 3553d8556812Smrg ;; 3554d8556812Smrg esac 3555d8556812Smrg fi 355676888252Smrg 3557d8556812Smrg # Transform deplibs into only deplibs that can be linked in shared. 3558d8556812Smrg name_save=$name 3559d8556812Smrg libname_save=$libname 3560d8556812Smrg release_save=$release 3561d8556812Smrg versuffix_save=$versuffix 3562d8556812Smrg major_save=$major 3563d8556812Smrg # I'm not sure if I'm treating the release correctly. I think 3564d8556812Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 3565d8556812Smrg # add it in twice. Is that correct? 3566d8556812Smrg release="" 3567d8556812Smrg versuffix="" 3568d8556812Smrg major="" 3569d8556812Smrg newdeplibs= 3570d8556812Smrg droppeddeps=no 3571d8556812Smrg case $deplibs_check_method in 3572d8556812Smrg pass_all) 3573d8556812Smrg # Don't check for shared/static. Everything works. 3574d8556812Smrg # This might be a little naive. We might want to check 3575d8556812Smrg # whether the library exists or not. But this is on 3576d8556812Smrg # osf3 & osf4 and I'm not really sure... Just 3577d8556812Smrg # implementing what was already the behavior. 3578d8556812Smrg newdeplibs=$deplibs 3579d8556812Smrg ;; 3580d8556812Smrg test_compile) 3581d8556812Smrg # This code stresses the "libraries are programs" paradigm to its 3582d8556812Smrg # limits. Maybe even breaks it. We compile a program, linking it 3583d8556812Smrg # against the deplibs as a proxy for the library. Then we can check 3584d8556812Smrg # whether they linked in statically or dynamically with ldd. 3585d8556812Smrg $rm conftest.c 3586d8556812Smrg cat > conftest.c <<EOF 3587d8556812Smrg int main() { return 0; } 3588d8556812SmrgEOF 3589d8556812Smrg $rm conftest 3590d8556812Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 3591d8556812Smrg ldd_output=`ldd conftest` 3592d8556812Smrg for i in $deplibs; do 3593d8556812Smrg name=`expr $i : '-l\(.*\)'` 3594d8556812Smrg # If $name is empty we are operating on a -L argument. 3595d8556812Smrg if test "$name" != "" && test "$name" != "0"; then 3596d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3597d8556812Smrg case " $predeps $postdeps " in 3598d8556812Smrg *" $i "*) 3599d8556812Smrg newdeplibs="$newdeplibs $i" 3600d8556812Smrg i="" 3601d8556812Smrg ;; 3602d8556812Smrg esac 3603d8556812Smrg fi 3604d8556812Smrg if test -n "$i" ; then 3605d8556812Smrg libname=`eval \\$echo \"$libname_spec\"` 3606d8556812Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3607d8556812Smrg set dummy $deplib_matches 3608d8556812Smrg deplib_match=$2 3609d8556812Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3610d8556812Smrg newdeplibs="$newdeplibs $i" 3611d8556812Smrg else 3612d8556812Smrg droppeddeps=yes 3613d8556812Smrg $echo 3614d8556812Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3615d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 3616d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 3617d8556812Smrg $echo "*** shared version of the library, which I believe you do not have" 3618d8556812Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 3619d8556812Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3620d8556812Smrg fi 3621d8556812Smrg fi 3622d8556812Smrg else 3623d8556812Smrg newdeplibs="$newdeplibs $i" 3624d8556812Smrg fi 3625d8556812Smrg done 3626d8556812Smrg else 3627d8556812Smrg # Error occurred in the first compile. Let's try to salvage 3628d8556812Smrg # the situation: Compile a separate program for each library. 3629d8556812Smrg for i in $deplibs; do 3630d8556812Smrg name=`expr $i : '-l\(.*\)'` 3631d8556812Smrg # If $name is empty we are operating on a -L argument. 3632d8556812Smrg if test "$name" != "" && test "$name" != "0"; then 3633d8556812Smrg $rm conftest 3634d8556812Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 3635d8556812Smrg ldd_output=`ldd conftest` 3636d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3637d8556812Smrg case " $predeps $postdeps " in 3638d8556812Smrg *" $i "*) 3639d8556812Smrg newdeplibs="$newdeplibs $i" 3640d8556812Smrg i="" 3641d8556812Smrg ;; 3642d8556812Smrg esac 3643d8556812Smrg fi 3644d8556812Smrg if test -n "$i" ; then 3645d8556812Smrg libname=`eval \\$echo \"$libname_spec\"` 3646d8556812Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3647d8556812Smrg set dummy $deplib_matches 3648d8556812Smrg deplib_match=$2 3649d8556812Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3650d8556812Smrg newdeplibs="$newdeplibs $i" 3651d8556812Smrg else 3652d8556812Smrg droppeddeps=yes 3653d8556812Smrg $echo 3654d8556812Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3655d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 3656d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 3657d8556812Smrg $echo "*** shared version of the library, which you do not appear to have" 3658d8556812Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 3659d8556812Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3660d8556812Smrg fi 3661d8556812Smrg fi 3662d8556812Smrg else 3663d8556812Smrg droppeddeps=yes 3664d8556812Smrg $echo 3665d8556812Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 3666d8556812Smrg $echo "*** make it link in! You will probably need to install it or some" 3667d8556812Smrg $echo "*** library that it depends on before this library will be fully" 3668d8556812Smrg $echo "*** functional. Installing it before continuing would be even better." 3669d8556812Smrg fi 3670d8556812Smrg else 3671d8556812Smrg newdeplibs="$newdeplibs $i" 3672d8556812Smrg fi 3673d8556812Smrg done 3674d8556812Smrg fi 3675d8556812Smrg ;; 3676d8556812Smrg file_magic*) 3677d8556812Smrg set dummy $deplibs_check_method 3678d8556812Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3679d8556812Smrg for a_deplib in $deplibs; do 3680d8556812Smrg name=`expr $a_deplib : '-l\(.*\)'` 3681d8556812Smrg # If $name is empty we are operating on a -L argument. 3682d8556812Smrg if test "$name" != "" && test "$name" != "0"; then 3683d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3684d8556812Smrg case " $predeps $postdeps " in 3685d8556812Smrg *" $a_deplib "*) 3686d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3687d8556812Smrg a_deplib="" 3688d8556812Smrg ;; 3689d8556812Smrg esac 3690d8556812Smrg fi 3691d8556812Smrg if test -n "$a_deplib" ; then 3692d8556812Smrg libname=`eval \\$echo \"$libname_spec\"` 3693d8556812Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3694d8556812Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3695d8556812Smrg for potent_lib in $potential_libs; do 3696d8556812Smrg # Follow soft links. 3697d8556812Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 3698d8556812Smrg | grep " -> " >/dev/null; then 3699d8556812Smrg continue 3700d8556812Smrg fi 3701d8556812Smrg # The statement above tries to avoid entering an 3702d8556812Smrg # endless loop below, in case of cyclic links. 3703d8556812Smrg # We might still enter an endless loop, since a link 3704d8556812Smrg # loop can be closed while we follow links, 3705d8556812Smrg # but so what? 3706d8556812Smrg potlib="$potent_lib" 3707d8556812Smrg while test -h "$potlib" 2>/dev/null; do 3708d8556812Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3709d8556812Smrg case $potliblink in 3710d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3711d8556812Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3712d8556812Smrg esac 3713d8556812Smrg done 3714d8556812Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3715d8556812Smrg | ${SED} 10q \ 3716d8556812Smrg | $EGREP "$file_magic_regex" > /dev/null; then 3717d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3718d8556812Smrg a_deplib="" 3719d8556812Smrg break 2 3720d8556812Smrg fi 3721d8556812Smrg done 3722d8556812Smrg done 3723d8556812Smrg fi 3724d8556812Smrg if test -n "$a_deplib" ; then 3725d8556812Smrg droppeddeps=yes 3726d8556812Smrg $echo 3727d8556812Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3728d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 3729d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 3730d8556812Smrg $echo "*** shared version of the library, which you do not appear to have" 3731d8556812Smrg $echo "*** because I did check the linker path looking for a file starting" 3732d8556812Smrg if test -z "$potlib" ; then 3733d8556812Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 3734d8556812Smrg else 3735d8556812Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3736d8556812Smrg $echo "*** using a file magic. Last file checked: $potlib" 3737d8556812Smrg fi 3738d8556812Smrg fi 3739d8556812Smrg else 3740d8556812Smrg # Add a -L argument. 3741d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3742d8556812Smrg fi 3743d8556812Smrg done # Gone through all deplibs. 3744d8556812Smrg ;; 3745d8556812Smrg match_pattern*) 3746d8556812Smrg set dummy $deplibs_check_method 3747d8556812Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3748d8556812Smrg for a_deplib in $deplibs; do 3749d8556812Smrg name=`expr $a_deplib : '-l\(.*\)'` 3750d8556812Smrg # If $name is empty we are operating on a -L argument. 3751d8556812Smrg if test -n "$name" && test "$name" != "0"; then 3752d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3753d8556812Smrg case " $predeps $postdeps " in 3754d8556812Smrg *" $a_deplib "*) 3755d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3756d8556812Smrg a_deplib="" 3757d8556812Smrg ;; 3758d8556812Smrg esac 3759d8556812Smrg fi 3760d8556812Smrg if test -n "$a_deplib" ; then 3761d8556812Smrg libname=`eval \\$echo \"$libname_spec\"` 3762d8556812Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3763d8556812Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3764d8556812Smrg for potent_lib in $potential_libs; do 3765d8556812Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 3766d8556812Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 3767d8556812Smrg | ${SED} 10q \ 3768d8556812Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 3769d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3770d8556812Smrg a_deplib="" 3771d8556812Smrg break 2 3772d8556812Smrg fi 3773d8556812Smrg done 3774d8556812Smrg done 3775d8556812Smrg fi 3776d8556812Smrg if test -n "$a_deplib" ; then 3777d8556812Smrg droppeddeps=yes 3778d8556812Smrg $echo 3779d8556812Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3780d8556812Smrg $echo "*** I have the capability to make that library automatically link in when" 3781d8556812Smrg $echo "*** you link to this library. But I can only do this if you have a" 3782d8556812Smrg $echo "*** shared version of the library, which you do not appear to have" 3783d8556812Smrg $echo "*** because I did check the linker path looking for a file starting" 3784d8556812Smrg if test -z "$potlib" ; then 3785d8556812Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3786d8556812Smrg else 3787d8556812Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3788d8556812Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 3789d8556812Smrg fi 3790d8556812Smrg fi 3791d8556812Smrg else 3792d8556812Smrg # Add a -L argument. 3793d8556812Smrg newdeplibs="$newdeplibs $a_deplib" 3794d8556812Smrg fi 3795d8556812Smrg done # Gone through all deplibs. 3796d8556812Smrg ;; 3797d8556812Smrg none | unknown | *) 3798d8556812Smrg newdeplibs="" 3799d8556812Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3800d8556812Smrg -e 's/ -[LR][^ ]*//g'` 3801d8556812Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3802d8556812Smrg for i in $predeps $postdeps ; do 3803d8556812Smrg # can't use Xsed below, because $i might contain '/' 3804d8556812Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3805d8556812Smrg done 3806d8556812Smrg fi 3807d8556812Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3808d8556812Smrg | grep . >/dev/null; then 3809d8556812Smrg $echo 3810d8556812Smrg if test "X$deplibs_check_method" = "Xnone"; then 3811d8556812Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 3812d8556812Smrg else 3813d8556812Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 3814d8556812Smrg fi 3815d8556812Smrg $echo "*** All declared inter-library dependencies are being dropped." 3816d8556812Smrg droppeddeps=yes 3817d8556812Smrg fi 3818d8556812Smrg ;; 3819d8556812Smrg esac 3820d8556812Smrg versuffix=$versuffix_save 3821d8556812Smrg major=$major_save 3822d8556812Smrg release=$release_save 3823d8556812Smrg libname=$libname_save 3824d8556812Smrg name=$name_save 382576888252Smrg 3826d8556812Smrg case $host in 3827d8556812Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3828d8556812Smrg # On Rhapsody replace the C library is the System framework 3829d8556812Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3830d8556812Smrg ;; 3831d8556812Smrg esac 383276888252Smrg 3833d8556812Smrg if test "$droppeddeps" = yes; then 3834d8556812Smrg if test "$module" = yes; then 3835d8556812Smrg $echo 3836d8556812Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 3837d8556812Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 3838d8556812Smrg $echo "*** a static module, that should work as long as the dlopening" 3839d8556812Smrg $echo "*** application is linked with the -dlopen flag." 3840d8556812Smrg if test -z "$global_symbol_pipe"; then 3841d8556812Smrg $echo 3842d8556812Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 3843d8556812Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3844d8556812Smrg $echo "*** not find such a program. So, this module is probably useless." 3845d8556812Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3846d8556812Smrg fi 3847d8556812Smrg if test "$build_old_libs" = no; then 3848d8556812Smrg oldlibs="$output_objdir/$libname.$libext" 3849d8556812Smrg build_libtool_libs=module 3850d8556812Smrg build_old_libs=yes 3851d8556812Smrg else 3852d8556812Smrg build_libtool_libs=no 3853d8556812Smrg fi 3854d8556812Smrg else 3855d8556812Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 3856d8556812Smrg $echo "*** automatically added whenever a program is linked with this library" 3857d8556812Smrg $echo "*** or is declared to -dlopen it." 385876888252Smrg 3859d8556812Smrg if test "$allow_undefined" = no; then 3860d8556812Smrg $echo 3861d8556812Smrg $echo "*** Since this library must not contain undefined symbols," 3862d8556812Smrg $echo "*** because either the platform does not support them or" 3863d8556812Smrg $echo "*** it was explicitly requested with -no-undefined," 3864d8556812Smrg $echo "*** libtool will only create a static version of it." 3865d8556812Smrg if test "$build_old_libs" = no; then 3866d8556812Smrg oldlibs="$output_objdir/$libname.$libext" 3867d8556812Smrg build_libtool_libs=module 3868d8556812Smrg build_old_libs=yes 3869d8556812Smrg else 3870d8556812Smrg build_libtool_libs=no 3871d8556812Smrg fi 3872d8556812Smrg fi 3873d8556812Smrg fi 3874d8556812Smrg fi 3875d8556812Smrg # Done checking deplibs! 3876d8556812Smrg deplibs=$newdeplibs 3877d8556812Smrg fi 387876888252Smrg 387976888252Smrg 3880d8556812Smrg # move library search paths that coincide with paths to not yet 3881d8556812Smrg # installed libraries to the beginning of the library search list 3882d8556812Smrg new_libs= 3883d8556812Smrg for path in $notinst_path; do 3884d8556812Smrg case " $new_libs " in 3885d8556812Smrg *" -L$path/$objdir "*) ;; 3886d8556812Smrg *) 3887d8556812Smrg case " $deplibs " in 3888d8556812Smrg *" -L$path/$objdir "*) 3889d8556812Smrg new_libs="$new_libs -L$path/$objdir" ;; 3890d8556812Smrg esac 3891d8556812Smrg ;; 3892d8556812Smrg esac 3893d8556812Smrg done 3894d8556812Smrg for deplib in $deplibs; do 3895d8556812Smrg case $deplib in 3896d8556812Smrg -L*) 3897d8556812Smrg case " $new_libs " in 3898d8556812Smrg *" $deplib "*) ;; 3899d8556812Smrg *) new_libs="$new_libs $deplib" ;; 3900d8556812Smrg esac 3901d8556812Smrg ;; 3902d8556812Smrg *) new_libs="$new_libs $deplib" ;; 3903d8556812Smrg esac 3904d8556812Smrg done 3905d8556812Smrg deplibs="$new_libs" 390676888252Smrg 390776888252Smrg 3908d8556812Smrg # All the library-specific variables (install_libdir is set above). 3909d8556812Smrg library_names= 3910d8556812Smrg old_library= 3911d8556812Smrg dlname= 391276888252Smrg 3913d8556812Smrg # Test again, we may have decided not to build it any more 3914d8556812Smrg if test "$build_libtool_libs" = yes; then 3915d8556812Smrg if test "$hardcode_into_libs" = yes; then 3916d8556812Smrg # Hardcode the library paths 3917d8556812Smrg hardcode_libdirs= 3918d8556812Smrg dep_rpath= 3919d8556812Smrg rpath="$finalize_rpath" 3920d8556812Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 3921d8556812Smrg for libdir in $rpath; do 3922d8556812Smrg if test -n "$hardcode_libdir_flag_spec"; then 3923d8556812Smrg if test -n "$hardcode_libdir_separator"; then 3924d8556812Smrg if test -z "$hardcode_libdirs"; then 3925d8556812Smrg hardcode_libdirs="$libdir" 3926d8556812Smrg else 3927d8556812Smrg # Just accumulate the unique libdirs. 3928d8556812Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3929d8556812Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3930d8556812Smrg ;; 3931d8556812Smrg *) 3932d8556812Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3933d8556812Smrg ;; 3934d8556812Smrg esac 3935d8556812Smrg fi 3936d8556812Smrg else 3937d8556812Smrg eval flag=\"$hardcode_libdir_flag_spec\" 3938d8556812Smrg dep_rpath="$dep_rpath $flag" 3939d8556812Smrg fi 3940d8556812Smrg elif test -n "$runpath_var"; then 3941d8556812Smrg case "$perm_rpath " in 3942d8556812Smrg *" $libdir "*) ;; 3943d8556812Smrg *) perm_rpath="$perm_rpath $libdir" ;; 3944d8556812Smrg esac 3945d8556812Smrg fi 3946d8556812Smrg done 3947d8556812Smrg # Substitute the hardcoded libdirs into the rpath. 3948d8556812Smrg if test -n "$hardcode_libdir_separator" && 3949d8556812Smrg test -n "$hardcode_libdirs"; then 3950d8556812Smrg libdir="$hardcode_libdirs" 3951d8556812Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 3952d8556812Smrg case $archive_cmds in 3953d8556812Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 3954d8556812Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 3955d8556812Smrg esac 3956d8556812Smrg else 3957d8556812Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3958d8556812Smrg fi 3959d8556812Smrg fi 3960d8556812Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 3961d8556812Smrg # We should set the runpath_var. 3962d8556812Smrg rpath= 3963d8556812Smrg for dir in $perm_rpath; do 3964d8556812Smrg rpath="$rpath$dir:" 3965d8556812Smrg done 3966d8556812Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3967d8556812Smrg fi 3968d8556812Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3969d8556812Smrg fi 397076888252Smrg 3971d8556812Smrg shlibpath="$finalize_shlibpath" 3972d8556812Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3973d8556812Smrg if test -n "$shlibpath"; then 3974d8556812Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3975d8556812Smrg fi 397676888252Smrg 3977d8556812Smrg # Get the real and link names of the library. 3978d8556812Smrg eval shared_ext=\"$shrext_cmds\" 3979d8556812Smrg eval library_names=\"$library_names_spec\" 3980d8556812Smrg set dummy $library_names 3981d8556812Smrg realname="$2" 3982d8556812Smrg shift; shift 398376888252Smrg 3984d8556812Smrg if test -n "$soname_spec"; then 3985d8556812Smrg eval soname=\"$soname_spec\" 3986d8556812Smrg else 3987d8556812Smrg soname="$realname" 3988d8556812Smrg fi 3989d8556812Smrg if test -z "$dlname"; then 3990d8556812Smrg dlname=$soname 3991d8556812Smrg fi 399276888252Smrg 3993d8556812Smrg lib="$output_objdir/$realname" 3994d8556812Smrg linknames= 3995d8556812Smrg for link 3996d8556812Smrg do 3997d8556812Smrg linknames="$linknames $link" 3998d8556812Smrg done 399976888252Smrg 4000d8556812Smrg # Use standard objects if they are pic 4001d8556812Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 400276888252Smrg 4003d8556812Smrg # Prepare the list of exported symbols 4004d8556812Smrg if test -z "$export_symbols"; then 4005d8556812Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 4006d8556812Smrg $show "generating symbol list for \`$libname.la'" 4007d8556812Smrg export_symbols="$output_objdir/$libname.exp" 4008d8556812Smrg $run $rm $export_symbols 4009d8556812Smrg cmds=$export_symbols_cmds 4010d8556812Smrg save_ifs="$IFS"; IFS='~' 4011d8556812Smrg for cmd in $cmds; do 4012d8556812Smrg IFS="$save_ifs" 4013d8556812Smrg eval cmd=\"$cmd\" 4014d8556812Smrg if len=`expr "X$cmd" : ".*"` && 4015d8556812Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4016d8556812Smrg $show "$cmd" 4017d8556812Smrg $run eval "$cmd" || exit $? 4018d8556812Smrg skipped_export=false 4019d8556812Smrg else 4020d8556812Smrg # The command line is too long to execute in one step. 4021d8556812Smrg $show "using reloadable object file for export list..." 4022d8556812Smrg skipped_export=: 4023d8556812Smrg # Break out early, otherwise skipped_export may be 4024d8556812Smrg # set to false by a later but shorter cmd. 4025d8556812Smrg break 4026d8556812Smrg fi 4027d8556812Smrg done 4028d8556812Smrg IFS="$save_ifs" 4029d8556812Smrg if test -n "$export_symbols_regex"; then 4030d8556812Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4031d8556812Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 4032d8556812Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 4033d8556812Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 4034d8556812Smrg fi 4035d8556812Smrg fi 4036d8556812Smrg fi 403776888252Smrg 4038d8556812Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 4039d8556812Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 4040d8556812Smrg fi 404176888252Smrg 4042d8556812Smrg tmp_deplibs= 4043d8556812Smrg for test_deplib in $deplibs; do 4044d8556812Smrg case " $convenience " in 4045d8556812Smrg *" $test_deplib "*) ;; 4046d8556812Smrg *) 4047d8556812Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 4048d8556812Smrg ;; 4049d8556812Smrg esac 4050d8556812Smrg done 4051d8556812Smrg deplibs="$tmp_deplibs" 405276888252Smrg 4053d8556812Smrg if test -n "$convenience"; then 4054d8556812Smrg if test -n "$whole_archive_flag_spec"; then 4055d8556812Smrg save_libobjs=$libobjs 4056d8556812Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4057d8556812Smrg else 4058d8556812Smrg gentop="$output_objdir/${outputname}x" 4059d8556812Smrg generated="$generated $gentop" 406076888252Smrg 4061d8556812Smrg func_extract_archives $gentop $convenience 4062d8556812Smrg libobjs="$libobjs $func_extract_archives_result" 4063d8556812Smrg fi 4064d8556812Smrg fi 4065d8556812Smrg 4066d8556812Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4067d8556812Smrg eval flag=\"$thread_safe_flag_spec\" 4068d8556812Smrg linker_flags="$linker_flags $flag" 4069d8556812Smrg fi 407076888252Smrg 4071d8556812Smrg # Make a backup of the uninstalled library when relinking 4072d8556812Smrg if test "$mode" = relink; then 4073d8556812Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4074d8556812Smrg fi 407576888252Smrg 4076d8556812Smrg # Do each of the archive commands. 4077d8556812Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4078d8556812Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4079d8556812Smrg eval test_cmds=\"$module_expsym_cmds\" 4080d8556812Smrg cmds=$module_expsym_cmds 4081d8556812Smrg else 4082d8556812Smrg eval test_cmds=\"$module_cmds\" 4083d8556812Smrg cmds=$module_cmds 4084d8556812Smrg fi 4085d8556812Smrg else 4086d8556812Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4087d8556812Smrg eval test_cmds=\"$archive_expsym_cmds\" 4088d8556812Smrg cmds=$archive_expsym_cmds 4089d8556812Smrg else 4090d8556812Smrg eval test_cmds=\"$archive_cmds\" 4091d8556812Smrg cmds=$archive_cmds 4092d8556812Smrg fi 4093d8556812Smrg fi 409476888252Smrg 4095d8556812Smrg if test "X$skipped_export" != "X:" && 4096d8556812Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4097d8556812Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4098d8556812Smrg : 4099d8556812Smrg else 4100d8556812Smrg # The command line is too long to link in one step, link piecewise. 4101d8556812Smrg $echo "creating reloadable object files..." 410276888252Smrg 4103d8556812Smrg # Save the value of $output and $libobjs because we want to 4104d8556812Smrg # use them later. If we have whole_archive_flag_spec, we 4105d8556812Smrg # want to use save_libobjs as it was before 4106d8556812Smrg # whole_archive_flag_spec was expanded, because we can't 4107d8556812Smrg # assume the linker understands whole_archive_flag_spec. 4108d8556812Smrg # This may have to be revisited, in case too many 4109d8556812Smrg # convenience libraries get linked in and end up exceeding 4110d8556812Smrg # the spec. 4111d8556812Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4112d8556812Smrg save_libobjs=$libobjs 4113d8556812Smrg fi 4114d8556812Smrg save_output=$output 4115d8556812Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 411676888252Smrg 4117d8556812Smrg # Clear the reloadable object creation command queue and 4118d8556812Smrg # initialize k to one. 4119d8556812Smrg test_cmds= 4120d8556812Smrg concat_cmds= 4121d8556812Smrg objlist= 4122d8556812Smrg delfiles= 4123d8556812Smrg last_robj= 4124d8556812Smrg k=1 4125d8556812Smrg output=$output_objdir/$output_la-${k}.$objext 4126d8556812Smrg # Loop over the list of objects to be linked. 4127d8556812Smrg for obj in $save_libobjs 4128d8556812Smrg do 4129d8556812Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4130d8556812Smrg if test "X$objlist" = X || 4131d8556812Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4132d8556812Smrg test "$len" -le "$max_cmd_len"; }; then 4133d8556812Smrg objlist="$objlist $obj" 4134d8556812Smrg else 4135d8556812Smrg # The command $test_cmds is almost too long, add a 4136d8556812Smrg # command to the queue. 4137d8556812Smrg if test "$k" -eq 1 ; then 4138d8556812Smrg # The first file doesn't have a previous command to add. 4139d8556812Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4140d8556812Smrg else 4141d8556812Smrg # All subsequent reloadable object files will link in 4142d8556812Smrg # the last one created. 4143d8556812Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4144d8556812Smrg fi 4145d8556812Smrg last_robj=$output_objdir/$output_la-${k}.$objext 4146d8556812Smrg k=`expr $k + 1` 4147d8556812Smrg output=$output_objdir/$output_la-${k}.$objext 4148d8556812Smrg objlist=$obj 4149d8556812Smrg len=1 4150d8556812Smrg fi 4151d8556812Smrg done 4152d8556812Smrg # Handle the remaining objects by creating one last 4153d8556812Smrg # reloadable object file. All subsequent reloadable object 4154d8556812Smrg # files will link in the last one created. 4155d8556812Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4156d8556812Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4157d8556812Smrg 4158d8556812Smrg if ${skipped_export-false}; then 4159d8556812Smrg $show "generating symbol list for \`$libname.la'" 4160d8556812Smrg export_symbols="$output_objdir/$libname.exp" 4161d8556812Smrg $run $rm $export_symbols 4162d8556812Smrg libobjs=$output 4163d8556812Smrg # Append the command to create the export file. 4164d8556812Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4165d8556812Smrg fi 4166d8556812Smrg 4167d8556812Smrg # Set up a command to remove the reloadable object files 4168d8556812Smrg # after they are used. 4169d8556812Smrg i=0 4170d8556812Smrg while test "$i" -lt "$k" 4171d8556812Smrg do 4172d8556812Smrg i=`expr $i + 1` 4173d8556812Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4174d8556812Smrg done 417576888252Smrg 4176d8556812Smrg $echo "creating a temporary reloadable object file: $output" 417776888252Smrg 4178d8556812Smrg # Loop through the commands generated above and execute them. 4179d8556812Smrg save_ifs="$IFS"; IFS='~' 4180d8556812Smrg for cmd in $concat_cmds; do 4181d8556812Smrg IFS="$save_ifs" 4182d8556812Smrg $show "$cmd" 4183d8556812Smrg $run eval "$cmd" || exit $? 4184d8556812Smrg done 4185d8556812Smrg IFS="$save_ifs" 418676888252Smrg 4187d8556812Smrg libobjs=$output 4188d8556812Smrg # Restore the value of output. 4189d8556812Smrg output=$save_output 419076888252Smrg 4191d8556812Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4192d8556812Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4193d8556812Smrg fi 4194d8556812Smrg # Expand the library linking commands again to reset the 4195d8556812Smrg # value of $libobjs for piecewise linking. 419676888252Smrg 4197d8556812Smrg # Do each of the archive commands. 4198d8556812Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4199d8556812Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4200d8556812Smrg cmds=$module_expsym_cmds 4201d8556812Smrg else 4202d8556812Smrg cmds=$module_cmds 4203d8556812Smrg fi 4204d8556812Smrg else 4205d8556812Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4206d8556812Smrg cmds=$archive_expsym_cmds 4207d8556812Smrg else 4208d8556812Smrg cmds=$archive_cmds 4209d8556812Smrg fi 4210d8556812Smrg fi 421176888252Smrg 4212d8556812Smrg # Append the command to remove the reloadable object files 4213d8556812Smrg # to the just-reset $cmds. 4214d8556812Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 4215d8556812Smrg fi 4216d8556812Smrg save_ifs="$IFS"; IFS='~' 4217d8556812Smrg for cmd in $cmds; do 4218d8556812Smrg IFS="$save_ifs" 4219d8556812Smrg eval cmd=\"$cmd\" 4220d8556812Smrg $show "$cmd" 4221d8556812Smrg $run eval "$cmd" || { 4222d8556812Smrg lt_exit=$? 422376888252Smrg 4224d8556812Smrg # Restore the uninstalled library and exit 4225d8556812Smrg if test "$mode" = relink; then 4226d8556812Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4227d8556812Smrg fi 422876888252Smrg 4229d8556812Smrg exit $lt_exit 4230d8556812Smrg } 4231d8556812Smrg done 4232d8556812Smrg IFS="$save_ifs" 4233d8556812Smrg 4234d8556812Smrg # Restore the uninstalled library and exit 4235d8556812Smrg if test "$mode" = relink; then 4236d8556812Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4237d8556812Smrg 4238d8556812Smrg if test -n "$convenience"; then 4239d8556812Smrg if test -z "$whole_archive_flag_spec"; then 4240d8556812Smrg $show "${rm}r $gentop" 4241d8556812Smrg $run ${rm}r "$gentop" 4242d8556812Smrg fi 4243d8556812Smrg fi 4244d8556812Smrg 4245d8556812Smrg exit $EXIT_SUCCESS 4246d8556812Smrg fi 4247d8556812Smrg 4248d8556812Smrg # Create links to the real library. 4249d8556812Smrg for linkname in $linknames; do 4250d8556812Smrg if test "$realname" != "$linkname"; then 4251d8556812Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4252d8556812Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4253d8556812Smrg fi 4254d8556812Smrg done 4255d8556812Smrg 4256d8556812Smrg # If -module or -export-dynamic was specified, set the dlname. 4257d8556812Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 4258d8556812Smrg # On all known operating systems, these are identical. 4259d8556812Smrg dlname="$soname" 4260d8556812Smrg fi 4261d8556812Smrg fi 426286dafe34Smrg ;; 426376888252Smrg 4264d8556812Smrg obj) 4265d8556812Smrg case " $deplibs" in 4266d8556812Smrg *\ -l* | *\ -L*) 4267d8556812Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 4268d8556812Smrg esac 426976888252Smrg 4270d8556812Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4271d8556812Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4272d8556812Smrg fi 427376888252Smrg 4274d8556812Smrg if test -n "$rpath"; then 4275d8556812Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4276d8556812Smrg fi 4277d8556812Smrg 4278d8556812Smrg if test -n "$xrpath"; then 4279d8556812Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4280d8556812Smrg fi 4281d8556812Smrg 4282d8556812Smrg if test -n "$vinfo"; then 4283d8556812Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4284d8556812Smrg fi 4285d8556812Smrg 4286d8556812Smrg if test -n "$release"; then 4287d8556812Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4288d8556812Smrg fi 4289d8556812Smrg 4290d8556812Smrg case $output in 4291d8556812Smrg *.lo) 4292d8556812Smrg if test -n "$objs$old_deplibs"; then 4293d8556812Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4294d8556812Smrg exit $EXIT_FAILURE 4295d8556812Smrg fi 4296d8556812Smrg libobj="$output" 4297d8556812Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 429886dafe34Smrg ;; 4299d8556812Smrg *) 4300d8556812Smrg libobj= 4301d8556812Smrg obj="$output" 430286dafe34Smrg ;; 430386dafe34Smrg esac 430476888252Smrg 4305d8556812Smrg # Delete the old objects. 4306d8556812Smrg $run $rm $obj $libobj 430776888252Smrg 4308d8556812Smrg # Objects from convenience libraries. This assumes 4309d8556812Smrg # single-version convenience libraries. Whenever we create 4310d8556812Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 4311d8556812Smrg # the extraction. 4312d8556812Smrg reload_conv_objs= 4313d8556812Smrg gentop= 4314d8556812Smrg # reload_cmds runs $LD directly, so let us get rid of 4315d8556812Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 4316d8556812Smrg # turning comma into space.. 4317d8556812Smrg wl= 431876888252Smrg 4319d8556812Smrg if test -n "$convenience"; then 4320d8556812Smrg if test -n "$whole_archive_flag_spec"; then 4321d8556812Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 4322d8556812Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 4323d8556812Smrg else 4324d8556812Smrg gentop="$output_objdir/${obj}x" 4325d8556812Smrg generated="$generated $gentop" 432676888252Smrg 4327d8556812Smrg func_extract_archives $gentop $convenience 4328d8556812Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 4329d8556812Smrg fi 4330d8556812Smrg fi 433176888252Smrg 4332d8556812Smrg # Create the old-style object. 4333d8556812Smrg 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 433476888252Smrg 4335d8556812Smrg output="$obj" 4336d8556812Smrg cmds=$reload_cmds 4337d8556812Smrg save_ifs="$IFS"; IFS='~' 4338d8556812Smrg for cmd in $cmds; do 4339d8556812Smrg IFS="$save_ifs" 4340d8556812Smrg eval cmd=\"$cmd\" 4341d8556812Smrg $show "$cmd" 4342d8556812Smrg $run eval "$cmd" || exit $? 4343d8556812Smrg done 4344d8556812Smrg IFS="$save_ifs" 434576888252Smrg 4346d8556812Smrg # Exit if we aren't doing a library object file. 4347d8556812Smrg if test -z "$libobj"; then 4348d8556812Smrg if test -n "$gentop"; then 4349d8556812Smrg $show "${rm}r $gentop" 4350d8556812Smrg $run ${rm}r $gentop 4351d8556812Smrg fi 435276888252Smrg 4353d8556812Smrg exit $EXIT_SUCCESS 4354d8556812Smrg fi 435576888252Smrg 4356d8556812Smrg if test "$build_libtool_libs" != yes; then 4357d8556812Smrg if test -n "$gentop"; then 4358d8556812Smrg $show "${rm}r $gentop" 4359d8556812Smrg $run ${rm}r $gentop 4360d8556812Smrg fi 436176888252Smrg 4362d8556812Smrg # Create an invalid libtool object if no PIC, so that we don't 4363d8556812Smrg # accidentally link it into a program. 4364d8556812Smrg # $show "echo timestamp > $libobj" 4365d8556812Smrg # $run eval "echo timestamp > $libobj" || exit $? 4366d8556812Smrg exit $EXIT_SUCCESS 4367d8556812Smrg fi 436876888252Smrg 4369d8556812Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 4370d8556812Smrg # Only do commands if we really have different PIC objects. 4371d8556812Smrg reload_objs="$libobjs $reload_conv_objs" 4372d8556812Smrg output="$libobj" 4373d8556812Smrg cmds=$reload_cmds 4374d8556812Smrg save_ifs="$IFS"; IFS='~' 4375d8556812Smrg for cmd in $cmds; do 4376d8556812Smrg IFS="$save_ifs" 4377d8556812Smrg eval cmd=\"$cmd\" 4378d8556812Smrg $show "$cmd" 4379d8556812Smrg $run eval "$cmd" || exit $? 4380d8556812Smrg done 4381d8556812Smrg IFS="$save_ifs" 4382d8556812Smrg fi 438376888252Smrg 4384d8556812Smrg if test -n "$gentop"; then 4385d8556812Smrg $show "${rm}r $gentop" 4386d8556812Smrg $run ${rm}r $gentop 4387d8556812Smrg fi 438876888252Smrg 4389d8556812Smrg exit $EXIT_SUCCESS 4390d8556812Smrg ;; 439176888252Smrg 4392d8556812Smrg prog) 4393d8556812Smrg case $host in 4394d8556812Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4395d8556812Smrg esac 4396d8556812Smrg if test -n "$vinfo"; then 4397d8556812Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4398d8556812Smrg fi 439976888252Smrg 4400d8556812Smrg if test -n "$release"; then 4401d8556812Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4402d8556812Smrg fi 440376888252Smrg 4404d8556812Smrg if test "$preload" = yes; then 4405d8556812Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4406d8556812Smrg test "$dlopen_self_static" = unknown; then 4407d8556812Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 440886dafe34Smrg fi 4409d8556812Smrg fi 441076888252Smrg 4411d8556812Smrg case $host in 4412d8556812Smrg *-*-rhapsody* | *-*-darwin1.[012]) 4413d8556812Smrg # On Rhapsody replace the C library is the System framework 4414d8556812Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4415d8556812Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 441686dafe34Smrg ;; 4417d8556812Smrg esac 441876888252Smrg 4419d8556812Smrg case $host in 4420d8556812Smrg *darwin*) 4421d8556812Smrg # Don't allow lazy linking, it breaks C++ global constructors 4422d8556812Smrg if test "$tagname" = CXX ; then 4423d8556812Smrg compile_command="$compile_command ${wl}-bind_at_load" 4424d8556812Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 4425d8556812Smrg fi 4426d8556812Smrg ;; 4427d8556812Smrg esac 442876888252Smrg 442976888252Smrg 4430d8556812Smrg # move library search paths that coincide with paths to not yet 4431d8556812Smrg # installed libraries to the beginning of the library search list 4432d8556812Smrg new_libs= 4433d8556812Smrg for path in $notinst_path; do 4434d8556812Smrg case " $new_libs " in 4435d8556812Smrg *" -L$path/$objdir "*) ;; 4436d8556812Smrg *) 4437d8556812Smrg case " $compile_deplibs " in 4438d8556812Smrg *" -L$path/$objdir "*) 4439d8556812Smrg new_libs="$new_libs -L$path/$objdir" ;; 4440d8556812Smrg esac 4441d8556812Smrg ;; 4442d8556812Smrg esac 4443d8556812Smrg done 4444d8556812Smrg for deplib in $compile_deplibs; do 4445d8556812Smrg case $deplib in 4446d8556812Smrg -L*) 4447d8556812Smrg case " $new_libs " in 4448d8556812Smrg *" $deplib "*) ;; 4449d8556812Smrg *) new_libs="$new_libs $deplib" ;; 4450d8556812Smrg esac 4451d8556812Smrg ;; 4452d8556812Smrg *) new_libs="$new_libs $deplib" ;; 4453d8556812Smrg esac 4454d8556812Smrg done 4455d8556812Smrg compile_deplibs="$new_libs" 445676888252Smrg 445776888252Smrg 4458d8556812Smrg compile_command="$compile_command $compile_deplibs" 4459d8556812Smrg finalize_command="$finalize_command $finalize_deplibs" 446076888252Smrg 4461d8556812Smrg if test -n "$rpath$xrpath"; then 4462d8556812Smrg # If the user specified any rpath flags, then add them. 4463d8556812Smrg for libdir in $rpath $xrpath; do 4464d8556812Smrg # This is the magic to use -rpath. 4465d8556812Smrg case "$finalize_rpath " in 4466d8556812Smrg *" $libdir "*) ;; 4467d8556812Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 4468d8556812Smrg esac 4469d8556812Smrg done 4470d8556812Smrg fi 447176888252Smrg 4472d8556812Smrg # Now hardcode the library paths 4473d8556812Smrg rpath= 4474d8556812Smrg hardcode_libdirs= 4475d8556812Smrg for libdir in $compile_rpath $finalize_rpath; do 4476d8556812Smrg if test -n "$hardcode_libdir_flag_spec"; then 4477d8556812Smrg if test -n "$hardcode_libdir_separator"; then 4478d8556812Smrg if test -z "$hardcode_libdirs"; then 4479d8556812Smrg hardcode_libdirs="$libdir" 4480d8556812Smrg else 4481d8556812Smrg # Just accumulate the unique libdirs. 4482d8556812Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4483d8556812Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4484d8556812Smrg ;; 4485d8556812Smrg *) 4486d8556812Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4487d8556812Smrg ;; 4488d8556812Smrg esac 4489d8556812Smrg fi 449086dafe34Smrg else 4491d8556812Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4492d8556812Smrg rpath="$rpath $flag" 449386dafe34Smrg fi 4494d8556812Smrg elif test -n "$runpath_var"; then 4495d8556812Smrg case "$perm_rpath " in 4496d8556812Smrg *" $libdir "*) ;; 4497d8556812Smrg *) perm_rpath="$perm_rpath $libdir" ;; 4498d8556812Smrg esac 449986dafe34Smrg fi 450086dafe34Smrg case $host in 4501d8556812Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4502d8556812Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 450386dafe34Smrg case :$dllsearchpath: in 4504d8556812Smrg *":$libdir:"*) ;; 4505d8556812Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 450686dafe34Smrg esac 450786dafe34Smrg case :$dllsearchpath: in 450886dafe34Smrg *":$testbindir:"*) ;; 450986dafe34Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 451086dafe34Smrg esac 451186dafe34Smrg ;; 451286dafe34Smrg esac 4513d8556812Smrg done 4514d8556812Smrg # Substitute the hardcoded libdirs into the rpath. 4515d8556812Smrg if test -n "$hardcode_libdir_separator" && 4516d8556812Smrg test -n "$hardcode_libdirs"; then 4517d8556812Smrg libdir="$hardcode_libdirs" 4518d8556812Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4519d8556812Smrg fi 4520d8556812Smrg compile_rpath="$rpath" 452176888252Smrg 4522d8556812Smrg rpath= 4523d8556812Smrg hardcode_libdirs= 4524d8556812Smrg for libdir in $finalize_rpath; do 4525d8556812Smrg if test -n "$hardcode_libdir_flag_spec"; then 4526d8556812Smrg if test -n "$hardcode_libdir_separator"; then 4527d8556812Smrg if test -z "$hardcode_libdirs"; then 4528d8556812Smrg hardcode_libdirs="$libdir" 4529d8556812Smrg else 4530d8556812Smrg # Just accumulate the unique libdirs. 4531d8556812Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4532d8556812Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4533d8556812Smrg ;; 4534d8556812Smrg *) 4535d8556812Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4536d8556812Smrg ;; 4537d8556812Smrg esac 4538d8556812Smrg fi 4539d8556812Smrg else 4540d8556812Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4541d8556812Smrg rpath="$rpath $flag" 4542d8556812Smrg fi 4543d8556812Smrg elif test -n "$runpath_var"; then 4544d8556812Smrg case "$finalize_perm_rpath " in 4545d8556812Smrg *" $libdir "*) ;; 4546d8556812Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 454786dafe34Smrg esac 454886dafe34Smrg fi 4549d8556812Smrg done 4550d8556812Smrg # Substitute the hardcoded libdirs into the rpath. 4551d8556812Smrg if test -n "$hardcode_libdir_separator" && 4552d8556812Smrg test -n "$hardcode_libdirs"; then 4553d8556812Smrg libdir="$hardcode_libdirs" 4554d8556812Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4555d8556812Smrg fi 4556d8556812Smrg finalize_rpath="$rpath" 455776888252Smrg 4558d8556812Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 4559d8556812Smrg # Transform all the library objects into standard objects. 4560d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4561d8556812Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4562d8556812Smrg fi 456376888252Smrg 4564d8556812Smrg dlsyms= 4565d8556812Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4566d8556812Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 4567d8556812Smrg dlsyms="${outputname}S.c" 4568d8556812Smrg else 4569d8556812Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4570d8556812Smrg fi 4571d8556812Smrg fi 457276888252Smrg 4573d8556812Smrg if test -n "$dlsyms"; then 4574d8556812Smrg case $dlsyms in 4575d8556812Smrg "") ;; 4576d8556812Smrg *.c) 4577d8556812Smrg # Discover the nlist of each of the dlfiles. 4578d8556812Smrg nlist="$output_objdir/${outputname}.nm" 457976888252Smrg 4580d8556812Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 4581d8556812Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 458276888252Smrg 4583d8556812Smrg # Parse the name list into a source file. 4584d8556812Smrg $show "creating $output_objdir/$dlsyms" 458576888252Smrg 4586d8556812Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4587d8556812Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4588d8556812Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 458976888252Smrg 4590d8556812Smrg#ifdef __cplusplus 4591d8556812Smrgextern \"C\" { 4592d8556812Smrg#endif 459376888252Smrg 4594d8556812Smrg/* Prevent the only kind of declaration conflicts we can make. */ 4595d8556812Smrg#define lt_preloaded_symbols some_other_symbol 459676888252Smrg 4597d8556812Smrg/* External symbol declarations for the compiler. */\ 4598d8556812Smrg" 459976888252Smrg 4600d8556812Smrg if test "$dlself" = yes; then 4601d8556812Smrg $show "generating symbol list for \`$output'" 460276888252Smrg 4603d8556812Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 460476888252Smrg 4605d8556812Smrg # Add our own program objects to the symbol list. 4606d8556812Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4607d8556812Smrg for arg in $progfiles; do 4608d8556812Smrg $show "extracting global C symbols from \`$arg'" 4609d8556812Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4610d8556812Smrg done 461176888252Smrg 4612d8556812Smrg if test -n "$exclude_expsyms"; then 4613d8556812Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4614d8556812Smrg $run eval '$mv "$nlist"T "$nlist"' 4615d8556812Smrg fi 461676888252Smrg 4617d8556812Smrg if test -n "$export_symbols_regex"; then 4618d8556812Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4619d8556812Smrg $run eval '$mv "$nlist"T "$nlist"' 4620d8556812Smrg fi 462176888252Smrg 4622d8556812Smrg # Prepare the list of exported symbols 4623d8556812Smrg if test -z "$export_symbols"; then 4624d8556812Smrg export_symbols="$output_objdir/$outputname.exp" 4625d8556812Smrg $run $rm $export_symbols 4626d8556812Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4627d8556812Smrg case $host in 4628d8556812Smrg *cygwin* | *mingw* ) 4629d8556812Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4630d8556812Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4631d8556812Smrg ;; 4632d8556812Smrg esac 4633d8556812Smrg else 4634d8556812Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4635d8556812Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4636d8556812Smrg $run eval 'mv "$nlist"T "$nlist"' 4637d8556812Smrg case $host in 4638d8556812Smrg *cygwin* | *mingw* ) 4639d8556812Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4640d8556812Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4641d8556812Smrg ;; 4642d8556812Smrg esac 4643d8556812Smrg fi 4644d8556812Smrg fi 464576888252Smrg 4646d8556812Smrg for arg in $dlprefiles; do 4647d8556812Smrg $show "extracting global C symbols from \`$arg'" 4648d8556812Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4649d8556812Smrg $run eval '$echo ": $name " >> "$nlist"' 4650d8556812Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4651d8556812Smrg done 465276888252Smrg 4653d8556812Smrg if test -z "$run"; then 4654d8556812Smrg # Make sure we have at least an empty file. 4655d8556812Smrg test -f "$nlist" || : > "$nlist" 465676888252Smrg 4657d8556812Smrg if test -n "$exclude_expsyms"; then 4658d8556812Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4659d8556812Smrg $mv "$nlist"T "$nlist" 4660d8556812Smrg fi 466176888252Smrg 4662d8556812Smrg # Try sorting and uniquifying the output. 4663d8556812Smrg if grep -v "^: " < "$nlist" | 4664d8556812Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 4665d8556812Smrg sort -k 3 4666d8556812Smrg else 4667d8556812Smrg sort +2 4668d8556812Smrg fi | 4669d8556812Smrg uniq > "$nlist"S; then 4670d8556812Smrg : 4671d8556812Smrg else 4672d8556812Smrg grep -v "^: " < "$nlist" > "$nlist"S 4673d8556812Smrg fi 467476888252Smrg 4675d8556812Smrg if test -f "$nlist"S; then 4676d8556812Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4677d8556812Smrg else 4678d8556812Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4679d8556812Smrg fi 468076888252Smrg 4681d8556812Smrg $echo >> "$output_objdir/$dlsyms" "\ 468276888252Smrg 4683d8556812Smrg#undef lt_preloaded_symbols 468476888252Smrg 4685d8556812Smrg#if defined (__STDC__) && __STDC__ 4686d8556812Smrg# define lt_ptr void * 4687d8556812Smrg#else 4688d8556812Smrg# define lt_ptr char * 4689d8556812Smrg# define const 4690d8556812Smrg#endif 469176888252Smrg 4692d8556812Smrg/* The mapping between symbol names and symbols. */ 4693d8556812Smrg" 469476888252Smrg 4695d8556812Smrg case $host in 4696d8556812Smrg *cygwin* | *mingw* ) 4697d8556812Smrg $echo >> "$output_objdir/$dlsyms" "\ 4698d8556812Smrg/* DATA imports from DLLs on WIN32 can't be const, because 4699d8556812Smrg runtime relocations are performed -- see ld's documentation 4700d8556812Smrg on pseudo-relocs */ 4701d8556812Smrgstruct { 4702d8556812Smrg" 4703d8556812Smrg ;; 4704d8556812Smrg * ) 4705d8556812Smrg $echo >> "$output_objdir/$dlsyms" "\ 4706d8556812Smrgconst struct { 4707d8556812Smrg" 4708d8556812Smrg ;; 4709d8556812Smrg esac 471076888252Smrg 471176888252Smrg 4712d8556812Smrg $echo >> "$output_objdir/$dlsyms" "\ 4713d8556812Smrg const char *name; 4714d8556812Smrg lt_ptr address; 4715d8556812Smrg} 4716d8556812Smrglt_preloaded_symbols[] = 4717d8556812Smrg{\ 4718d8556812Smrg" 471986dafe34Smrg 4720d8556812Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 472186dafe34Smrg 4722d8556812Smrg $echo >> "$output_objdir/$dlsyms" "\ 4723d8556812Smrg {0, (lt_ptr) 0} 4724d8556812Smrg}; 472586dafe34Smrg 4726d8556812Smrg/* This works around a problem in FreeBSD linker */ 4727d8556812Smrg#ifdef FREEBSD_WORKAROUND 4728d8556812Smrgstatic const void *lt_preloaded_setup() { 4729d8556812Smrg return lt_preloaded_symbols; 4730d8556812Smrg} 4731d8556812Smrg#endif 473286dafe34Smrg 4733d8556812Smrg#ifdef __cplusplus 4734d8556812Smrg} 4735d8556812Smrg#endif\ 4736d8556812Smrg" 473786dafe34Smrg fi 473886dafe34Smrg 4739d8556812Smrg pic_flag_for_symtable= 4740d8556812Smrg case $host in 4741d8556812Smrg # compiling the symbol table file with pic_flag works around 4742d8556812Smrg # a FreeBSD bug that causes programs to crash when -lm is 4743d8556812Smrg # linked before any other PIC object. But we must not use 4744d8556812Smrg # pic_flag when linking with -static. The problem exists in 4745d8556812Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4746d8556812Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4747d8556812Smrg case "$compile_command " in 4748d8556812Smrg *" -static "*) ;; 4749d8556812Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4750d8556812Smrg esac;; 4751d8556812Smrg *-*-hpux*) 4752d8556812Smrg case "$compile_command " in 4753d8556812Smrg *" -static "*) ;; 4754d8556812Smrg *) pic_flag_for_symtable=" $pic_flag";; 4755d8556812Smrg esac 4756d8556812Smrg esac 475786dafe34Smrg 4758d8556812Smrg # Now compile the dynamic symbol file. 4759d8556812Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4760d8556812Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 476186dafe34Smrg 4762d8556812Smrg # Clean up the generated files. 4763d8556812Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4764d8556812Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 476586dafe34Smrg 4766d8556812Smrg # Transform the symbol file into the correct name. 4767d8556812Smrg case $host in 4768d8556812Smrg *cygwin* | *mingw* ) 4769d8556812Smrg if test -f "$output_objdir/${outputname}.def" ; then 4770d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4771d8556812Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4772d8556812Smrg else 4773d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4774d8556812Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4775d8556812Smrg fi 4776d8556812Smrg ;; 4777d8556812Smrg * ) 4778d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4779d8556812Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4780d8556812Smrg ;; 4781d8556812Smrg esac 4782d8556812Smrg ;; 4783d8556812Smrg *) 4784d8556812Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4785d8556812Smrg exit $EXIT_FAILURE 4786d8556812Smrg ;; 4787d8556812Smrg esac 4788d8556812Smrg else 4789d8556812Smrg # We keep going just in case the user didn't refer to 4790d8556812Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4791d8556812Smrg # really was required. 479286dafe34Smrg 4793d8556812Smrg # Nullify the symbol file. 4794d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4795d8556812Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4796d8556812Smrg fi 479786dafe34Smrg 4798d8556812Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4799d8556812Smrg # Replace the output file specification. 4800d8556812Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 4801d8556812Smrg link_command="$compile_command$compile_rpath" 480286dafe34Smrg 4803d8556812Smrg # We have no uninstalled library dependencies, so finalize right now. 4804d8556812Smrg $show "$link_command" 4805d8556812Smrg $run eval "$link_command" 4806d8556812Smrg exit_status=$? 480786dafe34Smrg 4808d8556812Smrg # Delete the generated files. 4809d8556812Smrg if test -n "$dlsyms"; then 4810d8556812Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 4811d8556812Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 481286dafe34Smrg fi 481386dafe34Smrg 4814d8556812Smrg exit $exit_status 4815d8556812Smrg fi 481686dafe34Smrg 4817d8556812Smrg if test -n "$shlibpath_var"; then 4818d8556812Smrg # We should set the shlibpath_var 4819d8556812Smrg rpath= 4820d8556812Smrg for dir in $temp_rpath; do 4821d8556812Smrg case $dir in 4822d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) 4823d8556812Smrg # Absolute path. 4824d8556812Smrg rpath="$rpath$dir:" 4825d8556812Smrg ;; 4826d8556812Smrg *) 4827d8556812Smrg # Relative path: add a thisdir entry. 4828d8556812Smrg rpath="$rpath\$thisdir/$dir:" 4829d8556812Smrg ;; 4830d8556812Smrg esac 4831d8556812Smrg done 4832d8556812Smrg temp_rpath="$rpath" 483386dafe34Smrg fi 483486dafe34Smrg 4835d8556812Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 4836d8556812Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4837d8556812Smrg fi 4838d8556812Smrg if test -n "$finalize_shlibpath"; then 4839d8556812Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4840d8556812Smrg fi 484186dafe34Smrg 4842d8556812Smrg compile_var= 4843d8556812Smrg finalize_var= 4844d8556812Smrg if test -n "$runpath_var"; then 4845d8556812Smrg if test -n "$perm_rpath"; then 4846d8556812Smrg # We should set the runpath_var. 4847d8556812Smrg rpath= 4848d8556812Smrg for dir in $perm_rpath; do 4849d8556812Smrg rpath="$rpath$dir:" 4850d8556812Smrg done 4851d8556812Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4852d8556812Smrg fi 4853d8556812Smrg if test -n "$finalize_perm_rpath"; then 4854d8556812Smrg # We should set the runpath_var. 4855d8556812Smrg rpath= 4856d8556812Smrg for dir in $finalize_perm_rpath; do 4857d8556812Smrg rpath="$rpath$dir:" 4858d8556812Smrg done 4859d8556812Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4860d8556812Smrg fi 4861d8556812Smrg fi 486286dafe34Smrg 4863d8556812Smrg if test "$no_install" = yes; then 4864d8556812Smrg # We don't need to create a wrapper script. 4865d8556812Smrg link_command="$compile_var$compile_command$compile_rpath" 4866d8556812Smrg # Replace the output file specification. 4867d8556812Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4868d8556812Smrg # Delete the old output file. 4869d8556812Smrg $run $rm $output 4870d8556812Smrg # Link the executable and exit 4871d8556812Smrg $show "$link_command" 4872d8556812Smrg $run eval "$link_command" || exit $? 4873d8556812Smrg exit $EXIT_SUCCESS 4874d8556812Smrg fi 487586dafe34Smrg 4876d8556812Smrg if test "$hardcode_action" = relink; then 4877d8556812Smrg # Fast installation is not supported 4878d8556812Smrg link_command="$compile_var$compile_command$compile_rpath" 4879d8556812Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 488086dafe34Smrg 4881d8556812Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4882d8556812Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 4883d8556812Smrg else 4884d8556812Smrg if test "$fast_install" != no; then 4885d8556812Smrg link_command="$finalize_var$compile_command$finalize_rpath" 4886d8556812Smrg if test "$fast_install" = yes; then 4887d8556812Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 4888d8556812Smrg else 4889d8556812Smrg # fast_install is set to needless 4890d8556812Smrg relink_command= 4891d8556812Smrg fi 4892d8556812Smrg else 4893d8556812Smrg link_command="$compile_var$compile_command$compile_rpath" 4894d8556812Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4895d8556812Smrg fi 489686dafe34Smrg fi 489786dafe34Smrg 4898d8556812Smrg # Replace the output file specification. 4899d8556812Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 490086dafe34Smrg 4901d8556812Smrg # Delete the old output files. 4902d8556812Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 490386dafe34Smrg 4904d8556812Smrg $show "$link_command" 4905d8556812Smrg $run eval "$link_command" || exit $? 490686dafe34Smrg 4907d8556812Smrg # Now create the wrapper script. 4908d8556812Smrg $show "creating $output" 490986dafe34Smrg 4910d8556812Smrg # Quote the relink command for shipping. 4911d8556812Smrg if test -n "$relink_command"; then 4912d8556812Smrg # Preserve any variables that may affect compiler behavior 4913d8556812Smrg for var in $variables_saved_for_relink; do 4914d8556812Smrg if eval test -z \"\${$var+set}\"; then 4915d8556812Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4916d8556812Smrg elif eval var_value=\$$var; test -z "$var_value"; then 4917d8556812Smrg relink_command="$var=; export $var; $relink_command" 4918d8556812Smrg else 4919d8556812Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4920d8556812Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 4921d8556812Smrg fi 492286dafe34Smrg done 4923d8556812Smrg relink_command="(cd `pwd`; $relink_command)" 4924d8556812Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 492586dafe34Smrg fi 492686dafe34Smrg 4927d8556812Smrg # Quote $echo for shipping. 4928d8556812Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4929d8556812Smrg case $progpath in 4930d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4931d8556812Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 493286dafe34Smrg esac 4933d8556812Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4934d8556812Smrg else 4935d8556812Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 493686dafe34Smrg fi 493786dafe34Smrg 4938d8556812Smrg # Only actually do things if our run command is non-null. 4939d8556812Smrg if test -z "$run"; then 4940d8556812Smrg # win32 will think the script is a binary if it has 4941d8556812Smrg # a .exe suffix, so we strip it off here. 4942d8556812Smrg case $output in 4943d8556812Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4944d8556812Smrg esac 4945d8556812Smrg # test for cygwin because mv fails w/o .exe extensions 4946d8556812Smrg case $host in 4947d8556812Smrg *cygwin*) 4948d8556812Smrg exeext=.exe 4949d8556812Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4950d8556812Smrg *) exeext= ;; 4951d8556812Smrg esac 4952d8556812Smrg case $host in 4953d8556812Smrg *cygwin* | *mingw* ) 4954d8556812Smrg output_name=`basename $output` 4955d8556812Smrg output_path=`dirname $output` 4956d8556812Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 4957d8556812Smrg cwrapper="$output_path/$output_name.exe" 4958d8556812Smrg $rm $cwrappersource $cwrapper 4959d8556812Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 496086dafe34Smrg 4961d8556812Smrg cat > $cwrappersource <<EOF 496286dafe34Smrg 4963d8556812Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4964d8556812Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 496586dafe34Smrg 4966d8556812Smrg The $output program cannot be directly executed until all the libtool 4967d8556812Smrg libraries that it depends on are installed. 496886dafe34Smrg 4969d8556812Smrg This wrapper executable should never be moved out of the build directory. 4970d8556812Smrg If it is, it will not operate correctly. 497186dafe34Smrg 4972d8556812Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 4973d8556812Smrg but could eventually absorb all of the scripts functionality and 4974d8556812Smrg exec $objdir/$outputname directly. 4975d8556812Smrg*/ 4976d8556812SmrgEOF 4977d8556812Smrg cat >> $cwrappersource<<"EOF" 4978d8556812Smrg#include <stdio.h> 4979d8556812Smrg#include <stdlib.h> 4980d8556812Smrg#include <unistd.h> 4981d8556812Smrg#include <malloc.h> 4982d8556812Smrg#include <stdarg.h> 4983d8556812Smrg#include <assert.h> 4984d8556812Smrg#include <string.h> 4985d8556812Smrg#include <ctype.h> 4986d8556812Smrg#include <sys/stat.h> 498786dafe34Smrg 4988d8556812Smrg#if defined(PATH_MAX) 4989d8556812Smrg# define LT_PATHMAX PATH_MAX 4990d8556812Smrg#elif defined(MAXPATHLEN) 4991d8556812Smrg# define LT_PATHMAX MAXPATHLEN 4992d8556812Smrg#else 4993d8556812Smrg# define LT_PATHMAX 1024 4994d8556812Smrg#endif 499586dafe34Smrg 4996d8556812Smrg#ifndef DIR_SEPARATOR 4997d8556812Smrg# define DIR_SEPARATOR '/' 4998d8556812Smrg# define PATH_SEPARATOR ':' 4999d8556812Smrg#endif 500086dafe34Smrg 5001d8556812Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 5002d8556812Smrg defined (__OS2__) 5003d8556812Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 5004d8556812Smrg# ifndef DIR_SEPARATOR_2 5005d8556812Smrg# define DIR_SEPARATOR_2 '\\' 5006d8556812Smrg# endif 5007d8556812Smrg# ifndef PATH_SEPARATOR_2 5008d8556812Smrg# define PATH_SEPARATOR_2 ';' 5009d8556812Smrg# endif 5010d8556812Smrg#endif 501186dafe34Smrg 5012d8556812Smrg#ifndef DIR_SEPARATOR_2 5013d8556812Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5014d8556812Smrg#else /* DIR_SEPARATOR_2 */ 5015d8556812Smrg# define IS_DIR_SEPARATOR(ch) \ 5016d8556812Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5017d8556812Smrg#endif /* DIR_SEPARATOR_2 */ 501886dafe34Smrg 5019d8556812Smrg#ifndef PATH_SEPARATOR_2 5020d8556812Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5021d8556812Smrg#else /* PATH_SEPARATOR_2 */ 5022d8556812Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5023d8556812Smrg#endif /* PATH_SEPARATOR_2 */ 502486dafe34Smrg 5025d8556812Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5026d8556812Smrg#define XFREE(stale) do { \ 5027d8556812Smrg if (stale) { free ((void *) stale); stale = 0; } \ 5028d8556812Smrg} while (0) 502986dafe34Smrg 5030d8556812Smrg/* -DDEBUG is fairly common in CFLAGS. */ 5031d8556812Smrg#undef DEBUG 5032d8556812Smrg#if defined DEBUGWRAPPER 5033d8556812Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 5034d8556812Smrg#else 5035d8556812Smrg# define DEBUG(format, ...) 5036d8556812Smrg#endif 503786dafe34Smrg 5038d8556812Smrgconst char *program_name = NULL; 503986dafe34Smrg 5040d8556812Smrgvoid * xmalloc (size_t num); 5041d8556812Smrgchar * xstrdup (const char *string); 5042d8556812Smrgconst char * base_name (const char *name); 5043d8556812Smrgchar * find_executable(const char *wrapper); 5044d8556812Smrgint check_executable(const char *path); 5045d8556812Smrgchar * strendzap(char *str, const char *pat); 5046d8556812Smrgvoid lt_fatal (const char *message, ...); 504786dafe34Smrg 5048d8556812Smrgint 5049d8556812Smrgmain (int argc, char *argv[]) 5050d8556812Smrg{ 5051d8556812Smrg char **newargz; 5052d8556812Smrg int i; 505386dafe34Smrg 5054d8556812Smrg program_name = (char *) xstrdup (base_name (argv[0])); 5055d8556812Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 5056d8556812Smrg DEBUG("(main) program_name : %s\n",program_name); 5057d8556812Smrg newargz = XMALLOC(char *, argc+2); 5058d8556812SmrgEOF 505986dafe34Smrg 5060d8556812Smrg cat >> $cwrappersource <<EOF 5061d8556812Smrg newargz[0] = (char *) xstrdup("$SHELL"); 5062d8556812SmrgEOF 506386dafe34Smrg 5064d8556812Smrg cat >> $cwrappersource <<"EOF" 5065d8556812Smrg newargz[1] = find_executable(argv[0]); 5066d8556812Smrg if (newargz[1] == NULL) 5067d8556812Smrg lt_fatal("Couldn't find %s", argv[0]); 5068d8556812Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 5069d8556812Smrg /* we know the script has the same name, without the .exe */ 5070d8556812Smrg /* so make sure newargz[1] doesn't end in .exe */ 5071d8556812Smrg strendzap(newargz[1],".exe"); 5072d8556812Smrg for (i = 1; i < argc; i++) 5073d8556812Smrg newargz[i+1] = xstrdup(argv[i]); 5074d8556812Smrg newargz[argc+1] = NULL; 507586dafe34Smrg 5076d8556812Smrg for (i=0; i<argc+1; i++) 5077d8556812Smrg { 5078d8556812Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5079d8556812Smrg ; 5080d8556812Smrg } 508186dafe34Smrg 5082d8556812SmrgEOF 508386dafe34Smrg 5084d8556812Smrg case $host_os in 5085d8556812Smrg mingw*) 5086d8556812Smrg cat >> $cwrappersource <<EOF 5087d8556812Smrg execv("$SHELL",(char const **)newargz); 5088d8556812SmrgEOF 5089d8556812Smrg ;; 5090d8556812Smrg *) 5091d8556812Smrg cat >> $cwrappersource <<EOF 5092d8556812Smrg execv("$SHELL",newargz); 5093d8556812SmrgEOF 5094d8556812Smrg ;; 5095d8556812Smrg esac 509686dafe34Smrg 5097d8556812Smrg cat >> $cwrappersource <<"EOF" 5098d8556812Smrg return 127; 5099d8556812Smrg} 510086dafe34Smrg 5101d8556812Smrgvoid * 5102d8556812Smrgxmalloc (size_t num) 5103d8556812Smrg{ 5104d8556812Smrg void * p = (void *) malloc (num); 5105d8556812Smrg if (!p) 5106d8556812Smrg lt_fatal ("Memory exhausted"); 510786dafe34Smrg 5108d8556812Smrg return p; 5109d8556812Smrg} 511086dafe34Smrg 5111d8556812Smrgchar * 5112d8556812Smrgxstrdup (const char *string) 5113d8556812Smrg{ 5114d8556812Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5115d8556812Smrg; 5116d8556812Smrg} 511786dafe34Smrg 5118d8556812Smrgconst char * 5119d8556812Smrgbase_name (const char *name) 5120d8556812Smrg{ 5121d8556812Smrg const char *base; 512286dafe34Smrg 5123d8556812Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5124d8556812Smrg /* Skip over the disk name in MSDOS pathnames. */ 5125d8556812Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5126d8556812Smrg name += 2; 5127d8556812Smrg#endif 512886dafe34Smrg 5129d8556812Smrg for (base = name; *name; name++) 5130d8556812Smrg if (IS_DIR_SEPARATOR (*name)) 5131d8556812Smrg base = name + 1; 5132d8556812Smrg return base; 5133d8556812Smrg} 513486dafe34Smrg 5135d8556812Smrgint 5136d8556812Smrgcheck_executable(const char * path) 5137d8556812Smrg{ 5138d8556812Smrg struct stat st; 513986dafe34Smrg 5140d8556812Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5141d8556812Smrg if ((!path) || (!*path)) 5142d8556812Smrg return 0; 514386dafe34Smrg 5144d8556812Smrg if ((stat (path, &st) >= 0) && 5145d8556812Smrg ( 5146d8556812Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5147d8556812Smrg#if defined (S_IXOTH) 5148d8556812Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 5149d8556812Smrg#endif 5150d8556812Smrg#if defined (S_IXGRP) 5151d8556812Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 5152d8556812Smrg#endif 5153d8556812Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 5154d8556812Smrg ) 5155d8556812Smrg return 1; 5156d8556812Smrg else 5157d8556812Smrg return 0; 5158d8556812Smrg} 515986dafe34Smrg 5160d8556812Smrg/* Searches for the full path of the wrapper. Returns 5161d8556812Smrg newly allocated full path name if found, NULL otherwise */ 5162d8556812Smrgchar * 5163d8556812Smrgfind_executable (const char* wrapper) 5164d8556812Smrg{ 5165d8556812Smrg int has_slash = 0; 5166d8556812Smrg const char* p; 5167d8556812Smrg const char* p_next; 5168d8556812Smrg /* static buffer for getcwd */ 5169d8556812Smrg char tmp[LT_PATHMAX + 1]; 5170d8556812Smrg int tmp_len; 5171d8556812Smrg char* concat_name; 517286dafe34Smrg 5173d8556812Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 517486dafe34Smrg 5175d8556812Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 5176d8556812Smrg return NULL; 517776888252Smrg 5178d8556812Smrg /* Absolute path? */ 5179d8556812Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5180d8556812Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5181d8556812Smrg { 5182d8556812Smrg concat_name = xstrdup (wrapper); 5183d8556812Smrg if (check_executable(concat_name)) 5184d8556812Smrg return concat_name; 5185d8556812Smrg XFREE(concat_name); 5186d8556812Smrg } 5187d8556812Smrg else 5188d8556812Smrg { 5189d8556812Smrg#endif 5190d8556812Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 5191d8556812Smrg { 5192d8556812Smrg concat_name = xstrdup (wrapper); 5193d8556812Smrg if (check_executable(concat_name)) 5194d8556812Smrg return concat_name; 5195d8556812Smrg XFREE(concat_name); 5196d8556812Smrg } 5197d8556812Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5198d8556812Smrg } 5199d8556812Smrg#endif 5200d8556812Smrg 5201d8556812Smrg for (p = wrapper; *p; p++) 5202d8556812Smrg if (*p == '/') 5203d8556812Smrg { 5204d8556812Smrg has_slash = 1; 5205d8556812Smrg break; 5206d8556812Smrg } 5207d8556812Smrg if (!has_slash) 5208d8556812Smrg { 5209d8556812Smrg /* no slashes; search PATH */ 5210d8556812Smrg const char* path = getenv ("PATH"); 5211d8556812Smrg if (path != NULL) 5212d8556812Smrg { 5213d8556812Smrg for (p = path; *p; p = p_next) 5214d8556812Smrg { 5215d8556812Smrg const char* q; 5216d8556812Smrg size_t p_len; 5217d8556812Smrg for (q = p; *q; q++) 5218d8556812Smrg if (IS_PATH_SEPARATOR(*q)) 5219d8556812Smrg break; 5220d8556812Smrg p_len = q - p; 5221d8556812Smrg p_next = (*q == '\0' ? q : q + 1); 5222d8556812Smrg if (p_len == 0) 5223d8556812Smrg { 5224d8556812Smrg /* empty path: current directory */ 5225d8556812Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5226d8556812Smrg lt_fatal ("getcwd failed"); 5227d8556812Smrg tmp_len = strlen(tmp); 5228d8556812Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5229d8556812Smrg memcpy (concat_name, tmp, tmp_len); 5230d8556812Smrg concat_name[tmp_len] = '/'; 5231d8556812Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5232d8556812Smrg } 5233d8556812Smrg else 5234d8556812Smrg { 5235d8556812Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5236d8556812Smrg memcpy (concat_name, p, p_len); 5237d8556812Smrg concat_name[p_len] = '/'; 5238d8556812Smrg strcpy (concat_name + p_len + 1, wrapper); 5239d8556812Smrg } 5240d8556812Smrg if (check_executable(concat_name)) 5241d8556812Smrg return concat_name; 5242d8556812Smrg XFREE(concat_name); 5243d8556812Smrg } 5244d8556812Smrg } 5245d8556812Smrg /* not found in PATH; assume curdir */ 5246d8556812Smrg } 5247d8556812Smrg /* Relative path | not found in path: prepend cwd */ 5248d8556812Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5249d8556812Smrg lt_fatal ("getcwd failed"); 5250d8556812Smrg tmp_len = strlen(tmp); 5251d8556812Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5252d8556812Smrg memcpy (concat_name, tmp, tmp_len); 5253d8556812Smrg concat_name[tmp_len] = '/'; 5254d8556812Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5255d8556812Smrg 5256d8556812Smrg if (check_executable(concat_name)) 5257d8556812Smrg return concat_name; 5258d8556812Smrg XFREE(concat_name); 5259d8556812Smrg return NULL; 5260d8556812Smrg} 5261d8556812Smrg 5262d8556812Smrgchar * 5263d8556812Smrgstrendzap(char *str, const char *pat) 5264d8556812Smrg{ 5265d8556812Smrg size_t len, patlen; 5266d8556812Smrg 5267d8556812Smrg assert(str != NULL); 5268d8556812Smrg assert(pat != NULL); 5269d8556812Smrg 5270d8556812Smrg len = strlen(str); 5271d8556812Smrg patlen = strlen(pat); 5272d8556812Smrg 5273d8556812Smrg if (patlen <= len) 5274d8556812Smrg { 5275d8556812Smrg str += len - patlen; 5276d8556812Smrg if (strcmp(str, pat) == 0) 5277d8556812Smrg *str = '\0'; 5278d8556812Smrg } 5279d8556812Smrg return str; 5280d8556812Smrg} 5281d8556812Smrg 5282d8556812Smrgstatic void 5283d8556812Smrglt_error_core (int exit_status, const char * mode, 5284d8556812Smrg const char * message, va_list ap) 5285d8556812Smrg{ 5286d8556812Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 5287d8556812Smrg vfprintf (stderr, message, ap); 5288d8556812Smrg fprintf (stderr, ".\n"); 5289d8556812Smrg 5290d8556812Smrg if (exit_status >= 0) 5291d8556812Smrg exit (exit_status); 5292d8556812Smrg} 5293d8556812Smrg 5294d8556812Smrgvoid 5295d8556812Smrglt_fatal (const char *message, ...) 5296d8556812Smrg{ 5297d8556812Smrg va_list ap; 5298d8556812Smrg va_start (ap, message); 5299d8556812Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5300d8556812Smrg va_end (ap); 5301d8556812Smrg} 5302d8556812SmrgEOF 5303d8556812Smrg # we should really use a build-platform specific compiler 5304d8556812Smrg # here, but OTOH, the wrappers (shell script and this C one) 5305d8556812Smrg # are only useful if you want to execute the "real" binary. 5306d8556812Smrg # Since the "real" binary is built for $host, then this 5307d8556812Smrg # wrapper might as well be built for $host, too. 5308d8556812Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5309d8556812Smrg ;; 5310d8556812Smrg esac 5311d8556812Smrg $rm $output 5312d8556812Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5313d8556812Smrg 5314d8556812Smrg $echo > $output "\ 5315d8556812Smrg#! $SHELL 5316d8556812Smrg 5317d8556812Smrg# $output - temporary wrapper script for $objdir/$outputname 5318d8556812Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5319d8556812Smrg# 5320d8556812Smrg# The $output program cannot be directly executed until all the libtool 5321d8556812Smrg# libraries that it depends on are installed. 5322d8556812Smrg# 5323d8556812Smrg# This wrapper script should never be moved out of the build directory. 5324d8556812Smrg# If it is, it will not operate correctly. 5325d8556812Smrg 5326d8556812Smrg# Sed substitution that helps us do robust quoting. It backslashifies 5327d8556812Smrg# metacharacters that are still active within double-quoted strings. 5328d8556812SmrgXsed='${SED} -e 1s/^X//' 5329d8556812Smrgsed_quote_subst='$sed_quote_subst' 5330d8556812Smrg 5331d8556812Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5332d8556812Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5333d8556812Smrg emulate sh 5334d8556812Smrg NULLCMD=: 5335d8556812Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5336d8556812Smrg # is contrary to our usage. Disable this feature. 5337d8556812Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 5338d8556812Smrg setopt NO_GLOB_SUBST 5339d8556812Smrgelse 5340d8556812Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5341d8556812Smrgfi 5342d8556812SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 5343d8556812SmrgDUALCASE=1; export DUALCASE # for MKS sh 5344d8556812Smrg 5345d8556812Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 5346d8556812Smrg# if CDPATH is set. 5347d8556812Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5348d8556812Smrg 5349d8556812Smrgrelink_command=\"$relink_command\" 5350d8556812Smrg 5351d8556812Smrg# This environment variable determines our operation mode. 5352d8556812Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 5353d8556812Smrg # install mode needs the following variable: 5354d8556812Smrg notinst_deplibs='$notinst_deplibs' 5355d8556812Smrgelse 5356d8556812Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 5357d8556812Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5358d8556812Smrg echo=\"$qecho\" 5359d8556812Smrg file=\"\$0\" 5360d8556812Smrg # Make sure echo works. 5361d8556812Smrg if test \"X\$1\" = X--no-reexec; then 5362d8556812Smrg # Discard the --no-reexec flag, and continue. 5363d8556812Smrg shift 5364d8556812Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5365d8556812Smrg # Yippee, \$echo works! 5366d8556812Smrg : 5367d8556812Smrg else 5368d8556812Smrg # Restart under the correct shell, and then maybe \$echo will work. 5369d8556812Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5370d8556812Smrg fi 5371d8556812Smrg fi\ 5372d8556812Smrg" 5373d8556812Smrg $echo >> $output "\ 537476888252Smrg 5375d8556812Smrg # Find the directory that this script lives in. 5376d8556812Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5377d8556812Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 537876888252Smrg 5379d8556812Smrg # Follow symbolic links until we get to the real thisdir. 5380d8556812Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5381d8556812Smrg while test -n \"\$file\"; do 5382d8556812Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 538376888252Smrg 5384d8556812Smrg # If there was a directory component, then change thisdir. 5385d8556812Smrg if test \"x\$destdir\" != \"x\$file\"; then 5386d8556812Smrg case \"\$destdir\" in 5387d8556812Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5388d8556812Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 5389d8556812Smrg esac 5390d8556812Smrg fi 539176888252Smrg 5392d8556812Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5393d8556812Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5394d8556812Smrg done 539576888252Smrg 5396d8556812Smrg # Try to get the absolute directory name. 5397d8556812Smrg absdir=\`cd \"\$thisdir\" && pwd\` 5398d8556812Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 5399d8556812Smrg" 540076888252Smrg 5401d8556812Smrg if test "$fast_install" = yes; then 5402d8556812Smrg $echo >> $output "\ 5403d8556812Smrg program=lt-'$outputname'$exeext 5404d8556812Smrg progdir=\"\$thisdir/$objdir\" 540576888252Smrg 5406d8556812Smrg if test ! -f \"\$progdir/\$program\" || \\ 5407d8556812Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5408d8556812Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 540976888252Smrg 5410d8556812Smrg file=\"\$\$-\$program\" 541176888252Smrg 5412d8556812Smrg if test ! -d \"\$progdir\"; then 5413d8556812Smrg $mkdir \"\$progdir\" 5414d8556812Smrg else 5415d8556812Smrg $rm \"\$progdir/\$file\" 5416d8556812Smrg fi" 541776888252Smrg 5418d8556812Smrg $echo >> $output "\ 541976888252Smrg 5420d8556812Smrg # relink executable if necessary 5421d8556812Smrg if test -n \"\$relink_command\"; then 5422d8556812Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5423d8556812Smrg else 5424d8556812Smrg $echo \"\$relink_command_output\" >&2 5425d8556812Smrg $rm \"\$progdir/\$file\" 5426d8556812Smrg exit $EXIT_FAILURE 5427d8556812Smrg fi 5428d8556812Smrg fi 542976888252Smrg 5430d8556812Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5431d8556812Smrg { $rm \"\$progdir/\$program\"; 5432d8556812Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5433d8556812Smrg $rm \"\$progdir/\$file\" 5434d8556812Smrg fi" 5435d8556812Smrg else 5436d8556812Smrg $echo >> $output "\ 5437d8556812Smrg program='$outputname' 5438d8556812Smrg progdir=\"\$thisdir/$objdir\" 5439d8556812Smrg" 544086dafe34Smrg fi 544176888252Smrg 5442d8556812Smrg $echo >> $output "\ 544376888252Smrg 5444d8556812Smrg if test -f \"\$progdir/\$program\"; then" 544576888252Smrg 5446d8556812Smrg # Export our shlibpath_var if we have one. 5447d8556812Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5448d8556812Smrg $echo >> $output "\ 5449d8556812Smrg # Add our own library path to $shlibpath_var 5450d8556812Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 545176888252Smrg 5452d8556812Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 5453d8556812Smrg # The second colon is a workaround for a bug in BeOS R4 sed 5454d8556812Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 545576888252Smrg 5456d8556812Smrg export $shlibpath_var 5457d8556812Smrg" 5458d8556812Smrg fi 545976888252Smrg 5460d8556812Smrg # fixup the dll searchpath if we need to. 5461d8556812Smrg if test -n "$dllsearchpath"; then 5462d8556812Smrg $echo >> $output "\ 5463d8556812Smrg # Add the dll search path components to the executable PATH 5464d8556812Smrg PATH=$dllsearchpath:\$PATH 5465d8556812Smrg" 5466d8556812Smrg fi 546776888252Smrg 5468d8556812Smrg $echo >> $output "\ 5469d8556812Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5470d8556812Smrg # Run the actual program with our arguments. 5471d8556812Smrg" 5472d8556812Smrg case $host in 5473d8556812Smrg # Backslashes separate directories on plain windows 5474d8556812Smrg *-*-mingw | *-*-os2*) 5475d8556812Smrg $echo >> $output "\ 5476d8556812Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5477d8556812Smrg" 5478d8556812Smrg ;; 547976888252Smrg 5480d8556812Smrg *) 5481d8556812Smrg $echo >> $output "\ 5482d8556812Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 5483d8556812Smrg" 5484d8556812Smrg ;; 5485d8556812Smrg esac 5486d8556812Smrg $echo >> $output "\ 5487d8556812Smrg \$echo \"\$0: cannot exec \$program \$*\" 5488d8556812Smrg exit $EXIT_FAILURE 5489d8556812Smrg fi 5490d8556812Smrg else 5491d8556812Smrg # The program doesn't exist. 5492d8556812Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5493d8556812Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 5494d8556812Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5495d8556812Smrg exit $EXIT_FAILURE 5496d8556812Smrg fi 5497d8556812Smrgfi\ 5498d8556812Smrg" 5499d8556812Smrg chmod +x $output 5500d8556812Smrg fi 5501d8556812Smrg exit $EXIT_SUCCESS 5502d8556812Smrg ;; 5503d8556812Smrg esac 550476888252Smrg 5505d8556812Smrg # See if we need to build an old-fashioned archive. 5506d8556812Smrg for oldlib in $oldlibs; do 550776888252Smrg 5508d8556812Smrg if test "$build_libtool_libs" = convenience; then 5509d8556812Smrg oldobjs="$libobjs_save" 5510d8556812Smrg addlibs="$convenience" 5511d8556812Smrg build_libtool_libs=no 5512d8556812Smrg else 5513d8556812Smrg if test "$build_libtool_libs" = module; then 5514d8556812Smrg oldobjs="$libobjs_save" 5515d8556812Smrg build_libtool_libs=no 5516d8556812Smrg else 5517d8556812Smrg oldobjs="$old_deplibs $non_pic_objects" 5518d8556812Smrg fi 5519d8556812Smrg addlibs="$old_convenience" 5520d8556812Smrg fi 552176888252Smrg 5522d8556812Smrg if test -n "$addlibs"; then 5523d8556812Smrg gentop="$output_objdir/${outputname}x" 5524d8556812Smrg generated="$generated $gentop" 552576888252Smrg 5526d8556812Smrg func_extract_archives $gentop $addlibs 5527d8556812Smrg oldobjs="$oldobjs $func_extract_archives_result" 5528d8556812Smrg fi 552986dafe34Smrg 5530d8556812Smrg # Do each command in the archive commands. 5531d8556812Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5532d8556812Smrg cmds=$old_archive_from_new_cmds 5533d8556812Smrg else 5534d8556812Smrg # POSIX demands no paths to be encoded in archives. We have 5535d8556812Smrg # to avoid creating archives with duplicate basenames if we 5536d8556812Smrg # might have to extract them afterwards, e.g., when creating a 5537d8556812Smrg # static archive out of a convenience library, or when linking 5538d8556812Smrg # the entirety of a libtool archive into another (currently 5539d8556812Smrg # not supported by libtool). 5540d8556812Smrg if (for obj in $oldobjs 5541d8556812Smrg do 5542d8556812Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 5543d8556812Smrg done | sort | sort -uc >/dev/null 2>&1); then 5544d8556812Smrg : 5545d8556812Smrg else 5546d8556812Smrg $echo "copying selected object files to avoid basename conflicts..." 554776888252Smrg 5548d8556812Smrg if test -z "$gentop"; then 5549d8556812Smrg gentop="$output_objdir/${outputname}x" 5550d8556812Smrg generated="$generated $gentop" 555176888252Smrg 5552d8556812Smrg $show "${rm}r $gentop" 5553d8556812Smrg $run ${rm}r "$gentop" 5554d8556812Smrg $show "$mkdir $gentop" 5555d8556812Smrg $run $mkdir "$gentop" 5556d8556812Smrg exit_status=$? 5557d8556812Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5558d8556812Smrg exit $exit_status 555986dafe34Smrg fi 556086dafe34Smrg fi 556176888252Smrg 5562d8556812Smrg save_oldobjs=$oldobjs 5563d8556812Smrg oldobjs= 5564d8556812Smrg counter=1 5565d8556812Smrg for obj in $save_oldobjs 5566d8556812Smrg do 5567d8556812Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5568d8556812Smrg case " $oldobjs " in 5569d8556812Smrg " ") oldobjs=$obj ;; 5570d8556812Smrg *[\ /]"$objbase "*) 5571d8556812Smrg while :; do 5572d8556812Smrg # Make sure we don't pick an alternate name that also 5573d8556812Smrg # overlaps. 5574d8556812Smrg newobj=lt$counter-$objbase 5575d8556812Smrg counter=`expr $counter + 1` 5576d8556812Smrg case " $oldobjs " in 5577d8556812Smrg *[\ /]"$newobj "*) ;; 5578d8556812Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5579d8556812Smrg esac 5580d8556812Smrg done 5581d8556812Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5582d8556812Smrg $run ln "$obj" "$gentop/$newobj" || 5583d8556812Smrg $run cp "$obj" "$gentop/$newobj" 5584d8556812Smrg oldobjs="$oldobjs $gentop/$newobj" 5585d8556812Smrg ;; 5586d8556812Smrg *) oldobjs="$oldobjs $obj" ;; 5587d8556812Smrg esac 5588d8556812Smrg done 5589d8556812Smrg fi 559076888252Smrg 5591d8556812Smrg eval cmds=\"$old_archive_cmds\" 559286dafe34Smrg 5593d8556812Smrg if len=`expr "X$cmds" : ".*"` && 5594d8556812Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5595d8556812Smrg cmds=$old_archive_cmds 5596d8556812Smrg else 5597d8556812Smrg # the command line is too long to link in one step, link in parts 5598d8556812Smrg $echo "using piecewise archive linking..." 5599d8556812Smrg save_RANLIB=$RANLIB 5600d8556812Smrg RANLIB=: 5601d8556812Smrg objlist= 5602d8556812Smrg concat_cmds= 5603d8556812Smrg save_oldobjs=$oldobjs 5604d8556812Smrg 5605d8556812Smrg # Is there a better way of finding the last object in the list? 5606d8556812Smrg for obj in $save_oldobjs 5607d8556812Smrg do 5608d8556812Smrg last_oldobj=$obj 5609d8556812Smrg done 5610d8556812Smrg for obj in $save_oldobjs 5611d8556812Smrg do 5612d8556812Smrg oldobjs="$objlist $obj" 5613d8556812Smrg objlist="$objlist $obj" 5614d8556812Smrg eval test_cmds=\"$old_archive_cmds\" 5615d8556812Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5616d8556812Smrg test "$len" -le "$max_cmd_len"; then 5617d8556812Smrg : 561876888252Smrg else 5619d8556812Smrg # the above command should be used before it gets too long 5620d8556812Smrg oldobjs=$objlist 5621d8556812Smrg if test "$obj" = "$last_oldobj" ; then 5622d8556812Smrg RANLIB=$save_RANLIB 5623d8556812Smrg fi 5624d8556812Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5625d8556812Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5626d8556812Smrg objlist= 562776888252Smrg fi 5628d8556812Smrg done 5629d8556812Smrg RANLIB=$save_RANLIB 5630d8556812Smrg oldobjs=$objlist 5631d8556812Smrg if test "X$oldobjs" = "X" ; then 5632d8556812Smrg eval cmds=\"\$concat_cmds\" 563376888252Smrg else 5634d8556812Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 563576888252Smrg fi 563676888252Smrg fi 5637d8556812Smrg fi 5638d8556812Smrg save_ifs="$IFS"; IFS='~' 5639d8556812Smrg for cmd in $cmds; do 5640d8556812Smrg eval cmd=\"$cmd\" 564186dafe34Smrg IFS="$save_ifs" 5642d8556812Smrg $show "$cmd" 5643d8556812Smrg $run eval "$cmd" || exit $? 5644d8556812Smrg done 5645d8556812Smrg IFS="$save_ifs" 5646d8556812Smrg done 564786dafe34Smrg 5648d8556812Smrg if test -n "$generated"; then 5649d8556812Smrg $show "${rm}r$generated" 5650d8556812Smrg $run ${rm}r$generated 5651d8556812Smrg fi 565276888252Smrg 5653d8556812Smrg # Now create the libtool archive. 5654d8556812Smrg case $output in 5655d8556812Smrg *.la) 5656d8556812Smrg old_library= 5657d8556812Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 5658d8556812Smrg $show "creating $output" 565986dafe34Smrg 5660d8556812Smrg # Preserve any variables that may affect compiler behavior 5661d8556812Smrg for var in $variables_saved_for_relink; do 5662d8556812Smrg if eval test -z \"\${$var+set}\"; then 5663d8556812Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5664d8556812Smrg elif eval var_value=\$$var; test -z "$var_value"; then 5665d8556812Smrg relink_command="$var=; export $var; $relink_command" 5666d8556812Smrg else 5667d8556812Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5668d8556812Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 566986dafe34Smrg fi 5670d8556812Smrg done 5671d8556812Smrg # Quote the link command for shipping. 5672d8556812Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5673d8556812Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 5674d8556812Smrg if test "$hardcode_automatic" = yes ; then 5675d8556812Smrg relink_command= 567686dafe34Smrg fi 567786dafe34Smrg 567886dafe34Smrg 5679d8556812Smrg # Only create the output if not a dry run. 5680d8556812Smrg if test -z "$run"; then 5681d8556812Smrg for installed in no yes; do 5682d8556812Smrg if test "$installed" = yes; then 5683d8556812Smrg if test -z "$install_libdir"; then 5684d8556812Smrg break 5685d8556812Smrg fi 5686d8556812Smrg output="$output_objdir/$outputname"i 5687d8556812Smrg # Replace all uninstalled libtool libraries with the installed ones 5688d8556812Smrg newdependency_libs= 5689d8556812Smrg for deplib in $dependency_libs; do 5690d8556812Smrg case $deplib in 5691d8556812Smrg *.la) 5692d8556812Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5693d8556812Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5694d8556812Smrg if test -z "$libdir"; then 5695d8556812Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5696d8556812Smrg exit $EXIT_FAILURE 5697d8556812Smrg fi 5698d8556812Smrg newdependency_libs="$newdependency_libs $libdir/$name" 5699d8556812Smrg ;; 5700d8556812Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 5701d8556812Smrg esac 5702d8556812Smrg done 5703d8556812Smrg dependency_libs="$newdependency_libs" 5704d8556812Smrg newdlfiles= 5705d8556812Smrg for lib in $dlfiles; do 5706d8556812Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5707d8556812Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5708d8556812Smrg if test -z "$libdir"; then 5709d8556812Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5710d8556812Smrg exit $EXIT_FAILURE 5711d8556812Smrg fi 5712d8556812Smrg newdlfiles="$newdlfiles $libdir/$name" 5713d8556812Smrg done 5714d8556812Smrg dlfiles="$newdlfiles" 5715d8556812Smrg newdlprefiles= 5716d8556812Smrg for lib in $dlprefiles; do 5717d8556812Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5718d8556812Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5719d8556812Smrg if test -z "$libdir"; then 5720d8556812Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5721d8556812Smrg exit $EXIT_FAILURE 5722d8556812Smrg fi 5723d8556812Smrg newdlprefiles="$newdlprefiles $libdir/$name" 5724d8556812Smrg done 5725d8556812Smrg dlprefiles="$newdlprefiles" 5726d8556812Smrg else 5727d8556812Smrg newdlfiles= 5728d8556812Smrg for lib in $dlfiles; do 5729d8556812Smrg case $lib in 5730d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5731d8556812Smrg *) abs=`pwd`"/$lib" ;; 5732d8556812Smrg esac 5733d8556812Smrg newdlfiles="$newdlfiles $abs" 5734d8556812Smrg done 5735d8556812Smrg dlfiles="$newdlfiles" 5736d8556812Smrg newdlprefiles= 5737d8556812Smrg for lib in $dlprefiles; do 5738d8556812Smrg case $lib in 5739d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5740d8556812Smrg *) abs=`pwd`"/$lib" ;; 5741d8556812Smrg esac 5742d8556812Smrg newdlprefiles="$newdlprefiles $abs" 5743d8556812Smrg done 5744d8556812Smrg dlprefiles="$newdlprefiles" 5745d8556812Smrg fi 5746d8556812Smrg $rm $output 5747d8556812Smrg # place dlname in correct position for cygwin 5748d8556812Smrg tdlname=$dlname 5749d8556812Smrg case $host,$output,$installed,$module,$dlname in 5750d8556812Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5751d8556812Smrg esac 5752d8556812Smrg $echo > $output "\ 5753d8556812Smrg# $outputname - a libtool library file 5754d8556812Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5755d8556812Smrg# 5756d8556812Smrg# Please DO NOT delete this file! 5757d8556812Smrg# It is necessary for linking the library. 575886dafe34Smrg 5759d8556812Smrg# The name that we can dlopen(3). 5760d8556812Smrgdlname='$tdlname' 576176888252Smrg 5762d8556812Smrg# Names of this library. 5763d8556812Smrglibrary_names='$library_names' 576476888252Smrg 5765d8556812Smrg# The name of the static archive. 5766d8556812Smrgold_library='$old_library' 576776888252Smrg 5768d8556812Smrg# Libraries that this one depends upon. 5769d8556812Smrgdependency_libs='$dependency_libs' 577076888252Smrg 5771d8556812Smrg# Version information for $libname. 5772d8556812Smrgcurrent=$current 5773d8556812Smrgage=$age 5774d8556812Smrgrevision=$revision 577576888252Smrg 5776d8556812Smrg# Is this an already installed library? 5777d8556812Smrginstalled=$installed 577876888252Smrg 5779d8556812Smrg# Should we warn about portability when linking against -modules? 5780d8556812Smrgshouldnotlink=$module 578176888252Smrg 5782d8556812Smrg# Files to dlopen/dlpreopen 5783d8556812Smrgdlopen='$dlfiles' 5784d8556812Smrgdlpreopen='$dlprefiles' 578576888252Smrg 5786d8556812Smrg# Directory that this library needs to be installed in: 5787d8556812Smrglibdir='$install_libdir'" 5788d8556812Smrg if test "$installed" = no && test "$need_relink" = yes; then 5789d8556812Smrg $echo >> $output "\ 5790d8556812Smrgrelink_command=\"$relink_command\"" 5791d8556812Smrg fi 5792d8556812Smrg done 579386dafe34Smrg fi 579476888252Smrg 5795d8556812Smrg # Do a symbolic link so that the libtool archive can be found in 5796d8556812Smrg # LD_LIBRARY_PATH before the program is installed. 5797d8556812Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5798d8556812Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 579986dafe34Smrg ;; 5800d8556812Smrg esac 5801d8556812Smrg exit $EXIT_SUCCESS 5802d8556812Smrg ;; 580376888252Smrg 5804d8556812Smrg # libtool install mode 5805d8556812Smrg install) 5806d8556812Smrg modename="$modename: install" 5807d8556812Smrg 5808d8556812Smrg # There may be an optional sh(1) argument at the beginning of 5809d8556812Smrg # install_prog (especially on Windows NT). 5810d8556812Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5811d8556812Smrg # Allow the use of GNU shtool's install command. 5812d8556812Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 5813d8556812Smrg # Aesthetically quote it. 5814d8556812Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5815d8556812Smrg case $arg in 5816d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5817d8556812Smrg arg="\"$arg\"" 5818d8556812Smrg ;; 581976888252Smrg esac 5820d8556812Smrg install_prog="$arg " 5821d8556812Smrg arg="$1" 5822d8556812Smrg shift 5823d8556812Smrg else 5824d8556812Smrg install_prog= 5825d8556812Smrg arg=$nonopt 5826d8556812Smrg fi 582776888252Smrg 5828d8556812Smrg # The real first argument should be the name of the installation program. 5829d8556812Smrg # Aesthetically quote it. 5830d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5831d8556812Smrg case $arg in 5832d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5833d8556812Smrg arg="\"$arg\"" 5834d8556812Smrg ;; 5835d8556812Smrg esac 5836d8556812Smrg install_prog="$install_prog$arg" 583776888252Smrg 5838d8556812Smrg # We need to accept at least all the BSD install flags. 5839d8556812Smrg dest= 5840d8556812Smrg files= 5841d8556812Smrg opts= 5842d8556812Smrg prev= 5843d8556812Smrg install_type= 5844d8556812Smrg isdir=no 5845d8556812Smrg stripme= 5846d8556812Smrg for arg 5847d8556812Smrg do 5848d8556812Smrg if test -n "$dest"; then 5849d8556812Smrg files="$files $dest" 5850d8556812Smrg dest=$arg 5851d8556812Smrg continue 5852d8556812Smrg fi 585376888252Smrg 5854d8556812Smrg case $arg in 5855d8556812Smrg -d) isdir=yes ;; 5856d8556812Smrg -f) 5857d8556812Smrg case " $install_prog " in 5858d8556812Smrg *[\\\ /]cp\ *) ;; 5859d8556812Smrg *) prev=$arg ;; 5860d8556812Smrg esac 5861d8556812Smrg ;; 5862d8556812Smrg -g | -m | -o) prev=$arg ;; 5863d8556812Smrg -s) 5864d8556812Smrg stripme=" -s" 5865d8556812Smrg continue 5866d8556812Smrg ;; 5867d8556812Smrg -*) 5868d8556812Smrg ;; 5869d8556812Smrg *) 5870d8556812Smrg # If the previous option needed an argument, then skip it. 5871d8556812Smrg if test -n "$prev"; then 5872d8556812Smrg prev= 5873d8556812Smrg else 5874d8556812Smrg dest=$arg 5875d8556812Smrg continue 5876d8556812Smrg fi 587776888252Smrg ;; 587876888252Smrg esac 587976888252Smrg 5880d8556812Smrg # Aesthetically quote the argument. 5881d8556812Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5882d8556812Smrg case $arg in 5883d8556812Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5884d8556812Smrg arg="\"$arg\"" 588576888252Smrg ;; 588676888252Smrg esac 5887d8556812Smrg install_prog="$install_prog $arg" 5888d8556812Smrg done 588976888252Smrg 5890d8556812Smrg if test -z "$install_prog"; then 5891d8556812Smrg $echo "$modename: you must specify an install program" 1>&2 5892d8556812Smrg $echo "$help" 1>&2 5893d8556812Smrg exit $EXIT_FAILURE 5894d8556812Smrg fi 589576888252Smrg 5896d8556812Smrg if test -n "$prev"; then 5897d8556812Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 5898d8556812Smrg $echo "$help" 1>&2 5899d8556812Smrg exit $EXIT_FAILURE 5900d8556812Smrg fi 5901d8556812Smrg 5902d8556812Smrg if test -z "$files"; then 5903d8556812Smrg if test -z "$dest"; then 5904d8556812Smrg $echo "$modename: no file or destination specified" 1>&2 5905d8556812Smrg else 5906d8556812Smrg $echo "$modename: you must specify a destination" 1>&2 5907d8556812Smrg fi 5908d8556812Smrg $echo "$help" 1>&2 5909d8556812Smrg exit $EXIT_FAILURE 5910d8556812Smrg fi 5911d8556812Smrg 5912d8556812Smrg # Strip any trailing slash from the destination. 5913d8556812Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5914d8556812Smrg 5915d8556812Smrg # Check to see that the destination is a directory. 5916d8556812Smrg test -d "$dest" && isdir=yes 5917d8556812Smrg if test "$isdir" = yes; then 5918d8556812Smrg destdir="$dest" 5919d8556812Smrg destname= 5920d8556812Smrg else 5921d8556812Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5922d8556812Smrg test "X$destdir" = "X$dest" && destdir=. 5923d8556812Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5924d8556812Smrg 5925d8556812Smrg # Not a directory, so check to see that there is only one file specified. 5926d8556812Smrg set dummy $files 5927d8556812Smrg if test "$#" -gt 2; then 5928d8556812Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 5929d8556812Smrg $echo "$help" 1>&2 5930d8556812Smrg exit $EXIT_FAILURE 5931d8556812Smrg fi 5932d8556812Smrg fi 5933d8556812Smrg case $destdir in 5934d8556812Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5935d8556812Smrg *) 5936d8556812Smrg for file in $files; do 5937d8556812Smrg case $file in 5938d8556812Smrg *.lo) ;; 593976888252Smrg *) 5940d8556812Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5941d8556812Smrg $echo "$help" 1>&2 5942d8556812Smrg exit $EXIT_FAILURE 594386dafe34Smrg ;; 594486dafe34Smrg esac 594586dafe34Smrg done 5946d8556812Smrg ;; 5947d8556812Smrg esac 594876888252Smrg 5949d8556812Smrg # This variable tells wrapper scripts just to set variables rather 5950d8556812Smrg # than running their programs. 5951d8556812Smrg libtool_install_magic="$magic" 595276888252Smrg 5953d8556812Smrg staticlibs= 5954d8556812Smrg future_libdirs= 5955d8556812Smrg current_libdirs= 5956d8556812Smrg for file in $files; do 595776888252Smrg 5958d8556812Smrg # Do each installation. 5959d8556812Smrg case $file in 5960d8556812Smrg *.$libext) 5961d8556812Smrg # Do the static libraries later. 5962d8556812Smrg staticlibs="$staticlibs $file" 5963d8556812Smrg ;; 5964d8556812Smrg 5965d8556812Smrg *.la) 5966d8556812Smrg # Check to see that this really is a libtool archive. 5967d8556812Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5968d8556812Smrg else 5969d8556812Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5970d8556812Smrg $echo "$help" 1>&2 5971d8556812Smrg exit $EXIT_FAILURE 5972d8556812Smrg fi 5973d8556812Smrg 5974d8556812Smrg library_names= 5975d8556812Smrg old_library= 5976d8556812Smrg relink_command= 5977d8556812Smrg # If there is no directory component, then add one. 5978d8556812Smrg case $file in 5979d8556812Smrg */* | *\\*) . $file ;; 5980d8556812Smrg *) . ./$file ;; 5981d8556812Smrg esac 5982d8556812Smrg 5983d8556812Smrg # Add the libdir to current_libdirs if it is the destination. 5984d8556812Smrg if test "X$destdir" = "X$libdir"; then 5985d8556812Smrg case "$current_libdirs " in 598686dafe34Smrg *" $libdir "*) ;; 5987d8556812Smrg *) current_libdirs="$current_libdirs $libdir" ;; 598886dafe34Smrg esac 5989d8556812Smrg else 5990d8556812Smrg # Note the libdir as a future libdir. 5991d8556812Smrg case "$future_libdirs " in 599276888252Smrg *" $libdir "*) ;; 5993d8556812Smrg *) future_libdirs="$future_libdirs $libdir" ;; 599476888252Smrg esac 599586dafe34Smrg fi 599686dafe34Smrg 5997d8556812Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 5998d8556812Smrg test "X$dir" = "X$file/" && dir= 5999d8556812Smrg dir="$dir$objdir" 6000d8556812Smrg 6001d8556812Smrg if test -n "$relink_command"; then 6002d8556812Smrg # Determine the prefix the user has applied to our future dir. 6003d8556812Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 6004d8556812Smrg 6005d8556812Smrg # Don't allow the user to place us outside of our expected 6006d8556812Smrg # location b/c this prevents finding dependent libraries that 6007d8556812Smrg # are installed to the same prefix. 6008d8556812Smrg # At present, this check doesn't affect windows .dll's that 6009d8556812Smrg # are installed into $libdir/../bin (currently, that works fine) 6010d8556812Smrg # but it's something to keep an eye on. 6011d8556812Smrg if test "$inst_prefix_dir" = "$destdir"; then 6012d8556812Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 6013d8556812Smrg exit $EXIT_FAILURE 6014d8556812Smrg fi 6015d8556812Smrg 6016d8556812Smrg if test -n "$inst_prefix_dir"; then 6017d8556812Smrg # Stick the inst_prefix_dir data into the link command. 6018d8556812Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 6019d8556812Smrg else 6020d8556812Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 6021d8556812Smrg fi 6022d8556812Smrg 6023d8556812Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 6024d8556812Smrg $show "$relink_command" 6025d8556812Smrg if $run eval "$relink_command"; then : 602686dafe34Smrg else 6027d8556812Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6028d8556812Smrg exit $EXIT_FAILURE 602986dafe34Smrg fi 603076888252Smrg fi 603176888252Smrg 6032d8556812Smrg # See the names of the shared library. 6033d8556812Smrg set dummy $library_names 6034d8556812Smrg if test -n "$2"; then 6035d8556812Smrg realname="$2" 6036d8556812Smrg shift 6037d8556812Smrg shift 603876888252Smrg 6039d8556812Smrg srcname="$realname" 6040d8556812Smrg test -n "$relink_command" && srcname="$realname"T 604176888252Smrg 6042d8556812Smrg # Install the shared library and build the symlinks. 6043d8556812Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 6044d8556812Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 6045d8556812Smrg if test -n "$stripme" && test -n "$striplib"; then 6046d8556812Smrg $show "$striplib $destdir/$realname" 6047d8556812Smrg $run eval "$striplib $destdir/$realname" || exit $? 6048d8556812Smrg fi 604976888252Smrg 6050d8556812Smrg if test "$#" -gt 0; then 6051d8556812Smrg # Delete the old symlinks, and create new ones. 6052d8556812Smrg # Try `ln -sf' first, because the `ln' binary might depend on 6053d8556812Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 6054d8556812Smrg # so we also need to try rm && ln -s. 6055d8556812Smrg for linkname 6056d8556812Smrg do 6057d8556812Smrg if test "$linkname" != "$realname"; then 6058d8556812Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6059d8556812Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6060d8556812Smrg fi 6061d8556812Smrg done 6062d8556812Smrg fi 606376888252Smrg 6064d8556812Smrg # Do each command in the postinstall commands. 6065d8556812Smrg lib="$destdir/$realname" 6066d8556812Smrg cmds=$postinstall_cmds 6067d8556812Smrg save_ifs="$IFS"; IFS='~' 6068d8556812Smrg for cmd in $cmds; do 6069d8556812Smrg IFS="$save_ifs" 6070d8556812Smrg eval cmd=\"$cmd\" 6071d8556812Smrg $show "$cmd" 6072d8556812Smrg $run eval "$cmd" || { 6073d8556812Smrg lt_exit=$? 6074d8556812Smrg 6075d8556812Smrg # Restore the uninstalled library and exit 6076d8556812Smrg if test "$mode" = relink; then 6077d8556812Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 6078d8556812Smrg fi 607976888252Smrg 6080d8556812Smrg exit $lt_exit 6081d8556812Smrg } 6082d8556812Smrg done 6083d8556812Smrg IFS="$save_ifs" 608486dafe34Smrg fi 608576888252Smrg 6086d8556812Smrg # Install the pseudo-library for information purposes. 6087d8556812Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6088d8556812Smrg instname="$dir/$name"i 6089d8556812Smrg $show "$install_prog $instname $destdir/$name" 6090d8556812Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 609176888252Smrg 6092d8556812Smrg # Maybe install the static library, too. 6093d8556812Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6094d8556812Smrg ;; 609576888252Smrg 6096d8556812Smrg *.lo) 6097d8556812Smrg # Install (i.e. copy) a libtool object. 6098d8556812Smrg 6099d8556812Smrg # Figure out destination file name, if it wasn't already specified. 6100d8556812Smrg if test -n "$destname"; then 6101d8556812Smrg destfile="$destdir/$destname" 6102d8556812Smrg else 6103d8556812Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6104d8556812Smrg destfile="$destdir/$destfile" 610576888252Smrg fi 6106d8556812Smrg 6107d8556812Smrg # Deduce the name of the destination old-style object file. 6108d8556812Smrg case $destfile in 6109d8556812Smrg *.lo) 6110d8556812Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6111d8556812Smrg ;; 6112d8556812Smrg *.$objext) 6113d8556812Smrg staticdest="$destfile" 6114d8556812Smrg destfile= 6115d8556812Smrg ;; 6116d8556812Smrg *) 6117d8556812Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6118d8556812Smrg $echo "$help" 1>&2 6119d8556812Smrg exit $EXIT_FAILURE 6120d8556812Smrg ;; 6121d8556812Smrg esac 6122d8556812Smrg 6123d8556812Smrg # Install the libtool object if requested. 6124d8556812Smrg if test -n "$destfile"; then 6125d8556812Smrg $show "$install_prog $file $destfile" 6126d8556812Smrg $run eval "$install_prog $file $destfile" || exit $? 612786dafe34Smrg fi 612876888252Smrg 6129d8556812Smrg # Install the old object if enabled. 6130d8556812Smrg if test "$build_old_libs" = yes; then 6131d8556812Smrg # Deduce the name of the old-style object file. 6132d8556812Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 613376888252Smrg 6134d8556812Smrg $show "$install_prog $staticobj $staticdest" 6135d8556812Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6136d8556812Smrg fi 6137d8556812Smrg exit $EXIT_SUCCESS 6138d8556812Smrg ;; 613976888252Smrg 6140d8556812Smrg *) 6141d8556812Smrg # Figure out destination file name, if it wasn't already specified. 6142d8556812Smrg if test -n "$destname"; then 6143d8556812Smrg destfile="$destdir/$destname" 614476888252Smrg else 6145d8556812Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6146d8556812Smrg destfile="$destdir/$destfile" 614776888252Smrg fi 614876888252Smrg 6149d8556812Smrg # If the file is missing, and there is a .exe on the end, strip it 6150d8556812Smrg # because it is most likely a libtool script we actually want to 6151d8556812Smrg # install 6152d8556812Smrg stripped_ext="" 6153d8556812Smrg case $file in 6154d8556812Smrg *.exe) 6155d8556812Smrg if test ! -f "$file"; then 6156d8556812Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6157d8556812Smrg stripped_ext=".exe" 6158d8556812Smrg fi 6159d8556812Smrg ;; 6160d8556812Smrg esac 616176888252Smrg 6162d8556812Smrg # Do a test to see if this is really a libtool program. 6163d8556812Smrg case $host in 6164d8556812Smrg *cygwin*|*mingw*) 6165d8556812Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6166d8556812Smrg ;; 6167d8556812Smrg *) 6168d8556812Smrg wrapper=$file 6169d8556812Smrg ;; 6170d8556812Smrg esac 6171d8556812Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6172d8556812Smrg notinst_deplibs= 6173d8556812Smrg relink_command= 617476888252Smrg 6175d8556812Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6176d8556812Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6177d8556812Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6178d8556812Smrg # `FILE.' does not work on cygwin managed mounts. 6179d8556812Smrg # 6180d8556812Smrg # If there is no directory component, then add one. 6181d8556812Smrg case $wrapper in 6182d8556812Smrg */* | *\\*) . ${wrapper} ;; 6183d8556812Smrg *) . ./${wrapper} ;; 6184d8556812Smrg esac 618576888252Smrg 6186d8556812Smrg # Check the variables that should have been set. 6187d8556812Smrg if test -z "$notinst_deplibs"; then 6188d8556812Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6189d8556812Smrg exit $EXIT_FAILURE 6190d8556812Smrg fi 619176888252Smrg 6192d8556812Smrg finalize=yes 6193d8556812Smrg for lib in $notinst_deplibs; do 6194d8556812Smrg # Check to see that each library is installed. 6195d8556812Smrg libdir= 6196d8556812Smrg if test -f "$lib"; then 6197d8556812Smrg # If there is no directory component, then add one. 6198d8556812Smrg case $lib in 6199d8556812Smrg */* | *\\*) . $lib ;; 6200d8556812Smrg *) . ./$lib ;; 6201d8556812Smrg esac 6202d8556812Smrg fi 6203d8556812Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6204d8556812Smrg if test -n "$libdir" && test ! -f "$libfile"; then 6205d8556812Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6206d8556812Smrg finalize=no 6207d8556812Smrg fi 6208d8556812Smrg done 6209d8556812Smrg 6210d8556812Smrg relink_command= 6211d8556812Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6212d8556812Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6213d8556812Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6214d8556812Smrg # `FILE.' does not work on cygwin managed mounts. 6215d8556812Smrg # 6216d8556812Smrg # If there is no directory component, then add one. 6217d8556812Smrg case $wrapper in 6218d8556812Smrg */* | *\\*) . ${wrapper} ;; 6219d8556812Smrg *) . ./${wrapper} ;; 6220d8556812Smrg esac 6221d8556812Smrg 6222d8556812Smrg outputname= 6223d8556812Smrg if test "$fast_install" = no && test -n "$relink_command"; then 6224d8556812Smrg if test "$finalize" = yes && test -z "$run"; then 6225d8556812Smrg tmpdir=`func_mktempdir` 6226d8556812Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6227d8556812Smrg outputname="$tmpdir/$file" 6228d8556812Smrg # Replace the output file specification. 6229d8556812Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 6230d8556812Smrg 6231d8556812Smrg $show "$relink_command" 6232d8556812Smrg if $run eval "$relink_command"; then : 6233d8556812Smrg else 6234d8556812Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6235d8556812Smrg ${rm}r "$tmpdir" 6236d8556812Smrg continue 6237d8556812Smrg fi 6238d8556812Smrg file="$outputname" 6239d8556812Smrg else 6240d8556812Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 6241d8556812Smrg fi 624286dafe34Smrg else 6243d8556812Smrg # Install the binary that we compiled earlier. 6244d8556812Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 624586dafe34Smrg fi 6246d8556812Smrg fi 624776888252Smrg 6248d8556812Smrg # remove .exe since cygwin /usr/bin/install will append another 6249d8556812Smrg # one anyway 6250d8556812Smrg case $install_prog,$host in 6251d8556812Smrg */usr/bin/install*,*cygwin*) 6252d8556812Smrg case $file:$destfile in 6253d8556812Smrg *.exe:*.exe) 6254d8556812Smrg # this is ok 6255d8556812Smrg ;; 6256d8556812Smrg *.exe:*) 6257d8556812Smrg destfile=$destfile.exe 6258d8556812Smrg ;; 6259d8556812Smrg *:*.exe) 6260d8556812Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6261d8556812Smrg ;; 6262d8556812Smrg esac 6263d8556812Smrg ;; 626476888252Smrg esac 6265d8556812Smrg $show "$install_prog$stripme $file $destfile" 6266d8556812Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6267d8556812Smrg test -n "$outputname" && ${rm}r "$tmpdir" 6268d8556812Smrg ;; 6269d8556812Smrg esac 6270d8556812Smrg done 627176888252Smrg 6272d8556812Smrg for file in $staticlibs; do 6273d8556812Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 627476888252Smrg 6275d8556812Smrg # Set up the ranlib parameters. 6276d8556812Smrg oldlib="$destdir/$name" 627776888252Smrg 6278d8556812Smrg $show "$install_prog $file $oldlib" 6279d8556812Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 628076888252Smrg 6281d8556812Smrg if test -n "$stripme" && test -n "$old_striplib"; then 6282d8556812Smrg $show "$old_striplib $oldlib" 6283d8556812Smrg $run eval "$old_striplib $oldlib" || exit $? 628476888252Smrg fi 628576888252Smrg 6286d8556812Smrg # Do each command in the postinstall commands. 6287d8556812Smrg cmds=$old_postinstall_cmds 6288d8556812Smrg save_ifs="$IFS"; IFS='~' 6289d8556812Smrg for cmd in $cmds; do 6290d8556812Smrg IFS="$save_ifs" 6291d8556812Smrg eval cmd=\"$cmd\" 6292d8556812Smrg $show "$cmd" 6293d8556812Smrg $run eval "$cmd" || exit $? 6294d8556812Smrg done 6295d8556812Smrg IFS="$save_ifs" 6296d8556812Smrg done 629776888252Smrg 6298d8556812Smrg if test -n "$future_libdirs"; then 6299d8556812Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6300d8556812Smrg fi 630176888252Smrg 6302d8556812Smrg if test -n "$current_libdirs"; then 6303d8556812Smrg # Maybe just do a dry run. 6304d8556812Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 6305d8556812Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6306d8556812Smrg else 6307d8556812Smrg exit $EXIT_SUCCESS 6308d8556812Smrg fi 6309d8556812Smrg ;; 631076888252Smrg 6311d8556812Smrg # libtool finish mode 6312d8556812Smrg finish) 6313d8556812Smrg modename="$modename: finish" 6314d8556812Smrg libdirs="$nonopt" 6315d8556812Smrg admincmds= 631676888252Smrg 6317d8556812Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6318d8556812Smrg for dir 6319d8556812Smrg do 6320d8556812Smrg libdirs="$libdirs $dir" 6321d8556812Smrg done 632276888252Smrg 6323d8556812Smrg for libdir in $libdirs; do 6324d8556812Smrg if test -n "$finish_cmds"; then 6325d8556812Smrg # Do each command in the finish commands. 6326d8556812Smrg cmds=$finish_cmds 6327d8556812Smrg save_ifs="$IFS"; IFS='~' 6328d8556812Smrg for cmd in $cmds; do 6329d8556812Smrg IFS="$save_ifs" 6330d8556812Smrg eval cmd=\"$cmd\" 6331d8556812Smrg $show "$cmd" 6332d8556812Smrg $run eval "$cmd" || admincmds="$admincmds 6333d8556812Smrg $cmd" 633476888252Smrg done 6335d8556812Smrg IFS="$save_ifs" 633676888252Smrg fi 6337d8556812Smrg if test -n "$finish_eval"; then 6338d8556812Smrg # Do the single finish_eval. 6339d8556812Smrg eval cmds=\"$finish_eval\" 6340d8556812Smrg $run eval "$cmds" || admincmds="$admincmds 6341d8556812Smrg $cmds" 634286dafe34Smrg fi 6343d8556812Smrg done 6344d8556812Smrg fi 6345d8556812Smrg 6346d8556812Smrg # Exit here if they wanted silent mode. 6347d8556812Smrg test "$show" = : && exit $EXIT_SUCCESS 6348d8556812Smrg 6349d8556812Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6350d8556812Smrg $echo "Libraries have been installed in:" 6351d8556812Smrg for libdir in $libdirs; do 6352d8556812Smrg $echo " $libdir" 635376888252Smrg done 6354d8556812Smrg $echo 6355d8556812Smrg $echo "If you ever happen to want to link against installed libraries" 6356d8556812Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 6357d8556812Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6358d8556812Smrg $echo "flag during linking and do at least one of the following:" 6359d8556812Smrg if test -n "$shlibpath_var"; then 6360d8556812Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6361d8556812Smrg $echo " during execution" 6362d8556812Smrg fi 6363d8556812Smrg if test -n "$runpath_var"; then 6364d8556812Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6365d8556812Smrg $echo " during linking" 6366d8556812Smrg fi 6367d8556812Smrg if test -n "$hardcode_libdir_flag_spec"; then 6368d8556812Smrg libdir=LIBDIR 6369d8556812Smrg eval flag=\"$hardcode_libdir_flag_spec\" 637076888252Smrg 6371d8556812Smrg $echo " - use the \`$flag' linker flag" 6372d8556812Smrg fi 6373d8556812Smrg if test -n "$admincmds"; then 6374d8556812Smrg $echo " - have your system administrator run these commands:$admincmds" 6375d8556812Smrg fi 6376d8556812Smrg if test -f /etc/ld.so.conf; then 6377d8556812Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6378d8556812Smrg fi 6379d8556812Smrg $echo 6380d8556812Smrg $echo "See any operating system documentation about shared libraries for" 6381d8556812Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6382d8556812Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6383d8556812Smrg exit $EXIT_SUCCESS 6384d8556812Smrg ;; 638576888252Smrg 6386d8556812Smrg # libtool execute mode 6387d8556812Smrg execute) 6388d8556812Smrg modename="$modename: execute" 638976888252Smrg 6390d8556812Smrg # The first argument is the command name. 6391d8556812Smrg cmd="$nonopt" 6392d8556812Smrg if test -z "$cmd"; then 6393d8556812Smrg $echo "$modename: you must specify a COMMAND" 1>&2 6394d8556812Smrg $echo "$help" 6395d8556812Smrg exit $EXIT_FAILURE 6396d8556812Smrg fi 639776888252Smrg 6398d8556812Smrg # Handle -dlopen flags immediately. 6399d8556812Smrg for file in $execute_dlfiles; do 6400d8556812Smrg if test ! -f "$file"; then 6401d8556812Smrg $echo "$modename: \`$file' is not a file" 1>&2 6402d8556812Smrg $echo "$help" 1>&2 6403d8556812Smrg exit $EXIT_FAILURE 6404d8556812Smrg fi 640586dafe34Smrg 6406d8556812Smrg dir= 6407d8556812Smrg case $file in 6408d8556812Smrg *.la) 6409d8556812Smrg # Check to see that this really is a libtool archive. 6410d8556812Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6411d8556812Smrg else 6412d8556812Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6413d8556812Smrg $echo "$help" 1>&2 6414d8556812Smrg exit $EXIT_FAILURE 6415d8556812Smrg fi 641676888252Smrg 6417d8556812Smrg # Read the libtool library. 6418d8556812Smrg dlname= 6419d8556812Smrg library_names= 642076888252Smrg 6421d8556812Smrg # If there is no directory component, then add one. 6422d8556812Smrg case $file in 6423d8556812Smrg */* | *\\*) . $file ;; 6424d8556812Smrg *) . ./$file ;; 6425d8556812Smrg esac 642676888252Smrg 6427d8556812Smrg # Skip this library if it cannot be dlopened. 6428d8556812Smrg if test -z "$dlname"; then 6429d8556812Smrg # Warn if it was a shared library. 6430d8556812Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6431d8556812Smrg continue 6432d8556812Smrg fi 643376888252Smrg 6434d8556812Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6435d8556812Smrg test "X$dir" = "X$file" && dir=. 643676888252Smrg 6437d8556812Smrg if test -f "$dir/$objdir/$dlname"; then 6438d8556812Smrg dir="$dir/$objdir" 6439d8556812Smrg else 6440d8556812Smrg if test ! -f "$dir/$dlname"; then 6441d8556812Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6442d8556812Smrg exit $EXIT_FAILURE 6443d8556812Smrg fi 6444d8556812Smrg fi 6445d8556812Smrg ;; 644676888252Smrg 6447d8556812Smrg *.lo) 6448d8556812Smrg # Just add the directory containing the .lo file. 6449d8556812Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6450d8556812Smrg test "X$dir" = "X$file" && dir=. 6451d8556812Smrg ;; 645276888252Smrg 6453d8556812Smrg *) 6454d8556812Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6455d8556812Smrg continue 6456d8556812Smrg ;; 6457d8556812Smrg esac 645876888252Smrg 6459d8556812Smrg # Get the absolute pathname. 6460d8556812Smrg absdir=`cd "$dir" && pwd` 6461d8556812Smrg test -n "$absdir" && dir="$absdir" 646276888252Smrg 6463d8556812Smrg # Now add the directory to shlibpath_var. 6464d8556812Smrg if eval "test -z \"\$$shlibpath_var\""; then 6465d8556812Smrg eval "$shlibpath_var=\"\$dir\"" 6466d8556812Smrg else 6467d8556812Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6468d8556812Smrg fi 6469d8556812Smrg done 647076888252Smrg 6471d8556812Smrg # This variable tells wrapper scripts just to set shlibpath_var 6472d8556812Smrg # rather than running their programs. 6473d8556812Smrg libtool_execute_magic="$magic" 647476888252Smrg 6475d8556812Smrg # Check if any of the arguments is a wrapper script. 6476d8556812Smrg args= 6477d8556812Smrg for file 6478d8556812Smrg do 6479d8556812Smrg case $file in 6480d8556812Smrg -*) ;; 6481d8556812Smrg *) 6482d8556812Smrg # Do a test to see if this is really a libtool program. 6483d8556812Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6484d8556812Smrg # If there is no directory component, then add one. 6485d8556812Smrg case $file in 6486d8556812Smrg */* | *\\*) . $file ;; 6487d8556812Smrg *) . ./$file ;; 6488d8556812Smrg esac 648976888252Smrg 6490d8556812Smrg # Transform arg to wrapped name. 6491d8556812Smrg file="$progdir/$program" 6492d8556812Smrg fi 6493d8556812Smrg ;; 6494d8556812Smrg esac 6495d8556812Smrg # Quote arguments (to preserve shell metacharacters). 6496d8556812Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6497d8556812Smrg args="$args \"$file\"" 6498d8556812Smrg done 649976888252Smrg 6500d8556812Smrg if test -z "$run"; then 6501d8556812Smrg if test -n "$shlibpath_var"; then 6502d8556812Smrg # Export the shlibpath_var. 6503d8556812Smrg eval "export $shlibpath_var" 6504d8556812Smrg fi 6505d8556812Smrg 6506d8556812Smrg # Restore saved environment variables 6507d8556812Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 6508d8556812Smrg do 6509d8556812Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 6510d8556812Smrg $lt_var=\$save_$lt_var; export $lt_var 6511d8556812Smrg fi" 6512d8556812Smrg done 651376888252Smrg 6514d8556812Smrg # Now prepare to actually exec the command. 6515d8556812Smrg exec_cmd="\$cmd$args" 6516d8556812Smrg else 6517d8556812Smrg # Display what would be done. 6518d8556812Smrg if test -n "$shlibpath_var"; then 6519d8556812Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6520d8556812Smrg $echo "export $shlibpath_var" 6521d8556812Smrg fi 6522d8556812Smrg $echo "$cmd$args" 6523d8556812Smrg exit $EXIT_SUCCESS 6524d8556812Smrg fi 6525d8556812Smrg ;; 652676888252Smrg 6527d8556812Smrg # libtool clean and uninstall mode 6528d8556812Smrg clean | uninstall) 6529d8556812Smrg modename="$modename: $mode" 6530d8556812Smrg rm="$nonopt" 653176888252Smrg files= 653276888252Smrg rmforce= 653376888252Smrg exit_status=0 653476888252Smrg 653576888252Smrg # This variable tells wrapper scripts just to set variables rather 653676888252Smrg # than running their programs. 653776888252Smrg libtool_install_magic="$magic" 653876888252Smrg 653976888252Smrg for arg 654076888252Smrg do 654176888252Smrg case $arg in 6542d8556812Smrg -f) rm="$rm $arg"; rmforce=yes ;; 6543d8556812Smrg -*) rm="$rm $arg" ;; 654476888252Smrg *) files="$files $arg" ;; 654576888252Smrg esac 654676888252Smrg done 654776888252Smrg 6548d8556812Smrg if test -z "$rm"; then 6549d8556812Smrg $echo "$modename: you must specify an RM program" 1>&2 6550d8556812Smrg $echo "$help" 1>&2 6551d8556812Smrg exit $EXIT_FAILURE 6552d8556812Smrg fi 655376888252Smrg 655476888252Smrg rmdirs= 655576888252Smrg 655676888252Smrg origobjdir="$objdir" 655776888252Smrg for file in $files; do 6558d8556812Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6559d8556812Smrg if test "X$dir" = "X$file"; then 6560d8556812Smrg dir=. 656176888252Smrg objdir="$origobjdir" 656276888252Smrg else 656376888252Smrg objdir="$dir/$origobjdir" 656476888252Smrg fi 6565d8556812Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 656676888252Smrg test "$mode" = uninstall && objdir="$dir" 656776888252Smrg 656876888252Smrg # Remember objdir for removal later, being careful to avoid duplicates 656976888252Smrg if test "$mode" = clean; then 657076888252Smrg case " $rmdirs " in 657176888252Smrg *" $objdir "*) ;; 657276888252Smrg *) rmdirs="$rmdirs $objdir" ;; 657376888252Smrg esac 657476888252Smrg fi 657576888252Smrg 657676888252Smrg # Don't error if the file doesn't exist and rm -f was used. 6577d8556812Smrg if (test -L "$file") >/dev/null 2>&1 \ 6578d8556812Smrg || (test -h "$file") >/dev/null 2>&1 \ 6579d8556812Smrg || test -f "$file"; then 658076888252Smrg : 658176888252Smrg elif test -d "$file"; then 658276888252Smrg exit_status=1 658376888252Smrg continue 658476888252Smrg elif test "$rmforce" = yes; then 658576888252Smrg continue 658676888252Smrg fi 658776888252Smrg 658876888252Smrg rmfiles="$file" 658976888252Smrg 659076888252Smrg case $name in 659176888252Smrg *.la) 659276888252Smrg # Possibly a libtool archive, so verify it. 6593d8556812Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6594d8556812Smrg . $dir/$name 659576888252Smrg 659676888252Smrg # Delete the libtool libraries and symlinks. 659776888252Smrg for n in $library_names; do 659876888252Smrg rmfiles="$rmfiles $objdir/$n" 659976888252Smrg done 660076888252Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 660176888252Smrg 660276888252Smrg case "$mode" in 660376888252Smrg clean) 660476888252Smrg case " $library_names " in 660576888252Smrg # " " in the beginning catches empty $dlname 660676888252Smrg *" $dlname "*) ;; 660776888252Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 660876888252Smrg esac 6609d8556812Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 661076888252Smrg ;; 661176888252Smrg uninstall) 661276888252Smrg if test -n "$library_names"; then 661376888252Smrg # Do each command in the postuninstall commands. 6614d8556812Smrg cmds=$postuninstall_cmds 6615d8556812Smrg save_ifs="$IFS"; IFS='~' 6616d8556812Smrg for cmd in $cmds; do 6617d8556812Smrg IFS="$save_ifs" 6618d8556812Smrg eval cmd=\"$cmd\" 6619d8556812Smrg $show "$cmd" 6620d8556812Smrg $run eval "$cmd" 6621d8556812Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6622d8556812Smrg exit_status=1 6623d8556812Smrg fi 6624d8556812Smrg done 6625d8556812Smrg IFS="$save_ifs" 662676888252Smrg fi 662776888252Smrg 662876888252Smrg if test -n "$old_library"; then 662976888252Smrg # Do each command in the old_postuninstall commands. 6630d8556812Smrg cmds=$old_postuninstall_cmds 6631d8556812Smrg save_ifs="$IFS"; IFS='~' 6632d8556812Smrg for cmd in $cmds; do 6633d8556812Smrg IFS="$save_ifs" 6634d8556812Smrg eval cmd=\"$cmd\" 6635d8556812Smrg $show "$cmd" 6636d8556812Smrg $run eval "$cmd" 6637d8556812Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6638d8556812Smrg exit_status=1 6639d8556812Smrg fi 6640d8556812Smrg done 6641d8556812Smrg IFS="$save_ifs" 664276888252Smrg fi 664376888252Smrg # FIXME: should reinstall the best remaining shared library. 664476888252Smrg ;; 664576888252Smrg esac 664676888252Smrg fi 664776888252Smrg ;; 664876888252Smrg 664976888252Smrg *.lo) 665076888252Smrg # Possibly a libtool object, so verify it. 6651d8556812Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 665276888252Smrg 665376888252Smrg # Read the .lo file 6654d8556812Smrg . $dir/$name 665576888252Smrg 665676888252Smrg # Add PIC object to the list of files to remove. 6657d8556812Smrg if test -n "$pic_object" \ 6658d8556812Smrg && test "$pic_object" != none; then 665976888252Smrg rmfiles="$rmfiles $dir/$pic_object" 666076888252Smrg fi 666176888252Smrg 666276888252Smrg # Add non-PIC object to the list of files to remove. 6663d8556812Smrg if test -n "$non_pic_object" \ 6664d8556812Smrg && test "$non_pic_object" != none; then 666576888252Smrg rmfiles="$rmfiles $dir/$non_pic_object" 666676888252Smrg fi 666776888252Smrg fi 666876888252Smrg ;; 666976888252Smrg 667076888252Smrg *) 667176888252Smrg if test "$mode" = clean ; then 667276888252Smrg noexename=$name 667376888252Smrg case $file in 667476888252Smrg *.exe) 6675d8556812Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6676d8556812Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 667776888252Smrg # $file with .exe has already been added to rmfiles, 667876888252Smrg # add $file without .exe 667976888252Smrg rmfiles="$rmfiles $file" 668076888252Smrg ;; 668176888252Smrg esac 668276888252Smrg # Do a test to see if this is a libtool program. 6683d8556812Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6684d8556812Smrg relink_command= 6685d8556812Smrg . $dir/$noexename 668676888252Smrg 668776888252Smrg # note $name still contains .exe if it was in $file originally 668876888252Smrg # as does the version of $file that was added into $rmfiles 668976888252Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 669076888252Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 669176888252Smrg rmfiles="$rmfiles $objdir/lt-$name" 669276888252Smrg fi 669376888252Smrg if test "X$noexename" != "X$name" ; then 669476888252Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 669576888252Smrg fi 669676888252Smrg fi 669776888252Smrg fi 669876888252Smrg ;; 669976888252Smrg esac 6700d8556812Smrg $show "$rm $rmfiles" 6701d8556812Smrg $run $rm $rmfiles || exit_status=1 670276888252Smrg done 670376888252Smrg objdir="$origobjdir" 670476888252Smrg 670576888252Smrg # Try to remove the ${objdir}s in the directories where we deleted files 670676888252Smrg for dir in $rmdirs; do 670776888252Smrg if test -d "$dir"; then 6708d8556812Smrg $show "rmdir $dir" 6709d8556812Smrg $run rmdir $dir >/dev/null 2>&1 671076888252Smrg fi 671176888252Smrg done 671276888252Smrg 671376888252Smrg exit $exit_status 6714d8556812Smrg ;; 671576888252Smrg 6716d8556812Smrg "") 6717d8556812Smrg $echo "$modename: you must specify a MODE" 1>&2 6718d8556812Smrg $echo "$generic_help" 1>&2 6719d8556812Smrg exit $EXIT_FAILURE 6720d8556812Smrg ;; 6721d8556812Smrg esac 672286dafe34Smrg 6723d8556812Smrg if test -z "$exec_cmd"; then 6724d8556812Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6725d8556812Smrg $echo "$generic_help" 1>&2 6726d8556812Smrg exit $EXIT_FAILURE 6727d8556812Smrg fi 6728d8556812Smrgfi # test -z "$show_help" 672976888252Smrg 673076888252Smrgif test -n "$exec_cmd"; then 6731d8556812Smrg eval exec $exec_cmd 673276888252Smrg exit $EXIT_FAILURE 673376888252Smrgfi 673476888252Smrg 6735d8556812Smrg# We need to display help for each of the modes. 6736d8556812Smrgcase $mode in 6737d8556812Smrg"") $echo \ 6738d8556812Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 6739d8556812Smrg 6740d8556812SmrgProvide generalized library-building support services. 6741d8556812Smrg 6742d8556812Smrg --config show all configuration variables 6743d8556812Smrg --debug enable verbose shell tracing 6744d8556812Smrg-n, --dry-run display commands without modifying any files 6745d8556812Smrg --features display basic configuration information and exit 6746d8556812Smrg --finish same as \`--mode=finish' 6747d8556812Smrg --help display this help message and exit 6748d8556812Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6749d8556812Smrg --quiet same as \`--silent' 6750d8556812Smrg --silent don't print informational messages 6751d8556812Smrg --tag=TAG use configuration variables from tag TAG 6752d8556812Smrg --version print version information 6753d8556812Smrg 6754d8556812SmrgMODE must be one of the following: 6755d8556812Smrg 6756d8556812Smrg clean remove files from the build directory 6757d8556812Smrg compile compile a source file into a libtool object 6758d8556812Smrg execute automatically set library path, then run a program 6759d8556812Smrg finish complete the installation of libtool libraries 6760d8556812Smrg install install libraries or executables 6761d8556812Smrg link create a library or an executable 6762d8556812Smrg uninstall remove libraries from an installed directory 6763d8556812Smrg 6764d8556812SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6765d8556812Smrga more detailed description of MODE. 6766d8556812Smrg 6767d8556812SmrgReport bugs to <bug-libtool@gnu.org>." 6768d8556812Smrg exit $EXIT_SUCCESS 6769d8556812Smrg ;; 6770d8556812Smrg 6771d8556812Smrgclean) 6772d8556812Smrg $echo \ 6773d8556812Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6774d8556812Smrg 6775d8556812SmrgRemove files from the build directory. 6776d8556812Smrg 6777d8556812SmrgRM is the name of the program to use to delete files associated with each FILE 6778d8556812Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6779d8556812Smrgto RM. 6780d8556812Smrg 6781d8556812SmrgIf FILE is a libtool library, object or program, all the files associated 6782d8556812Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6783d8556812Smrg ;; 6784d8556812Smrg 6785d8556812Smrgcompile) 6786d8556812Smrg $echo \ 6787d8556812Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6788d8556812Smrg 6789d8556812SmrgCompile a source file into a libtool library object. 6790d8556812Smrg 6791d8556812SmrgThis mode accepts the following additional options: 6792d8556812Smrg 6793d8556812Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6794d8556812Smrg -prefer-pic try to building PIC objects only 6795d8556812Smrg -prefer-non-pic try to building non-PIC objects only 6796d8556812Smrg -static always build a \`.o' file suitable for static linking 6797d8556812Smrg 6798d8556812SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6799d8556812Smrgfrom the given SOURCEFILE. 6800d8556812Smrg 6801d8556812SmrgThe output file name is determined by removing the directory component from 6802d8556812SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 6803d8556812Smrglibrary object suffix, \`.lo'." 6804d8556812Smrg ;; 6805d8556812Smrg 6806d8556812Smrgexecute) 6807d8556812Smrg $echo \ 6808d8556812Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6809d8556812Smrg 6810d8556812SmrgAutomatically set library path, then run a program. 6811d8556812Smrg 6812d8556812SmrgThis mode accepts the following additional options: 6813d8556812Smrg 6814d8556812Smrg -dlopen FILE add the directory containing FILE to the library path 6815d8556812Smrg 6816d8556812SmrgThis mode sets the library path environment variable according to \`-dlopen' 6817d8556812Smrgflags. 6818d8556812Smrg 6819d8556812SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 6820d8556812Smrginto their corresponding uninstalled binary, and any of their required library 6821d8556812Smrgdirectories are added to the library path. 6822d8556812Smrg 6823d8556812SmrgThen, COMMAND is executed, with ARGS as arguments." 6824d8556812Smrg ;; 6825d8556812Smrg 6826d8556812Smrgfinish) 6827d8556812Smrg $echo \ 6828d8556812Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6829d8556812Smrg 6830d8556812SmrgComplete the installation of libtool libraries. 6831d8556812Smrg 6832d8556812SmrgEach LIBDIR is a directory that contains libtool libraries. 6833d8556812Smrg 6834d8556812SmrgThe commands that this mode executes may require superuser privileges. Use 6835d8556812Smrgthe \`--dry-run' option if you just want to see what would be executed." 6836d8556812Smrg ;; 6837d8556812Smrg 6838d8556812Smrginstall) 6839d8556812Smrg $echo \ 6840d8556812Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6841d8556812Smrg 6842d8556812SmrgInstall executables or libraries. 6843d8556812Smrg 6844d8556812SmrgINSTALL-COMMAND is the installation command. The first component should be 6845d8556812Smrgeither the \`install' or \`cp' program. 6846d8556812Smrg 6847d8556812SmrgThe rest of the components are interpreted as arguments to that command (only 6848d8556812SmrgBSD-compatible install options are recognized)." 6849d8556812Smrg ;; 6850d8556812Smrg 6851d8556812Smrglink) 6852d8556812Smrg $echo \ 6853d8556812Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6854d8556812Smrg 6855d8556812SmrgLink object files or libraries together to form another library, or to 6856d8556812Smrgcreate an executable program. 685776888252Smrg 6858d8556812SmrgLINK-COMMAND is a command using the C compiler that you would use to create 6859d8556812Smrga program from several object files. 6860d8556812Smrg 6861d8556812SmrgThe following components of LINK-COMMAND are treated specially: 6862d8556812Smrg 6863d8556812Smrg -all-static do not do any dynamic linking at all 6864d8556812Smrg -avoid-version do not add a version suffix if possible 6865d8556812Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6866d8556812Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6867d8556812Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6868d8556812Smrg -export-symbols SYMFILE 6869d8556812Smrg try to export only the symbols listed in SYMFILE 6870d8556812Smrg -export-symbols-regex REGEX 6871d8556812Smrg try to export only the symbols matching REGEX 6872d8556812Smrg -LLIBDIR search LIBDIR for required installed libraries 6873d8556812Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 6874d8556812Smrg -module build a library that can dlopened 6875d8556812Smrg -no-fast-install disable the fast-install mode 6876d8556812Smrg -no-install link a not-installable executable 6877d8556812Smrg -no-undefined declare that a library does not refer to external symbols 6878d8556812Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6879d8556812Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 6880d8556812Smrg -precious-files-regex REGEX 6881d8556812Smrg don't remove output files matching REGEX 6882d8556812Smrg -release RELEASE specify package release information 6883d8556812Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 6884d8556812Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6885d8556812Smrg -static do not do any dynamic linking of uninstalled libtool libraries 6886d8556812Smrg -static-libtool-libs 6887d8556812Smrg do not do any dynamic linking of libtool libraries 6888d8556812Smrg -version-info CURRENT[:REVISION[:AGE]] 6889d8556812Smrg specify library version info [each variable defaults to 0] 6890d8556812Smrg 6891d8556812SmrgAll other options (arguments beginning with \`-') are ignored. 6892d8556812Smrg 6893d8556812SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 6894d8556812Smrgtreated as uninstalled libtool libraries, other files are standard or library 6895d8556812Smrgobject files. 6896d8556812Smrg 6897d8556812SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6898d8556812Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6899d8556812Smrgrequired, except when creating a convenience library. 6900d8556812Smrg 6901d8556812SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6902d8556812Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 6903d8556812Smrg 6904d8556812SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6905d8556812Smrgis created, otherwise an executable program is created." 6906d8556812Smrg ;; 6907d8556812Smrg 6908d8556812Smrguninstall) 6909d8556812Smrg $echo \ 6910d8556812Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6911d8556812Smrg 6912d8556812SmrgRemove libraries from an installation directory. 6913d8556812Smrg 6914d8556812SmrgRM is the name of the program to use to delete files associated with each FILE 6915d8556812Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6916d8556812Smrgto RM. 6917d8556812Smrg 6918d8556812SmrgIf FILE is a libtool library, all the files associated with it are deleted. 6919d8556812SmrgOtherwise, only FILE itself is deleted using RM." 6920d8556812Smrg ;; 6921d8556812Smrg 6922d8556812Smrg*) 6923d8556812Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6924d8556812Smrg $echo "$help" 1>&2 6925d8556812Smrg exit $EXIT_FAILURE 6926d8556812Smrg ;; 6927d8556812Smrgesac 6928d8556812Smrg 6929d8556812Smrg$echo 6930d8556812Smrg$echo "Try \`$modename --help' for more information about other modes." 6931d8556812Smrg 6932d8556812Smrgexit $? 693376888252Smrg 693476888252Smrg# The TAGs below are defined such that we never get into a situation 693576888252Smrg# in which we disable both kinds of libraries. Given conflicting 693676888252Smrg# choices, we go for a static library, that is the most portable, 693776888252Smrg# since we can't tell whether shared libraries were disabled because 693876888252Smrg# the user asked for that or because the platform doesn't support 693976888252Smrg# them. This is particularly important on AIX, because we don't 694076888252Smrg# support having both static and shared libraries enabled at the same 694176888252Smrg# time on that platform, so we default to a shared-only configuration. 694276888252Smrg# If a disable-shared tag is given, we'll fallback to a static-only 694376888252Smrg# configuration. But we'll never go from static-only to shared-only. 694476888252Smrg 694576888252Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6946d8556812Smrgdisable_libs=shared 694776888252Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 694876888252Smrg 694976888252Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6950d8556812Smrgdisable_libs=static 695176888252Smrg# ### END LIBTOOL TAG CONFIG: disable-static 695276888252Smrg 695376888252Smrg# Local Variables: 695476888252Smrg# mode:shell-script 695576888252Smrg# sh-indentation:2 695676888252Smrg# End: 6957